Disable the Ctrl/Wheel Zoom Effect at Runtime

How to disable mouse-wheel zoom in Atom Editor?

There should be an option at the bottom of the 'Editor' Settings:

Ctrl Scrolling option in Atom

Disable FlexPaper mouse wheel zoom

Its possible to disable Mouse Wheel zooming using our latest version of Desktop Publisher. Tick the option in the left bottom corner of the publisher to disable it. The publisher will produce the UIConfig file you will need to use in your viewer to disable the mouse wheel zoom.

You can grab the latest version from here:
http://flexpaper.devaldi.com/download/

Disable browser zoom on certain elements in Firefox

Using information gathered largely through this question: Catch browser's "zoom" event in JavaScript

I've been playing around with attempting to track browser zoom for the last day or so, and this is about as close as you can get without an onZoom standard event that you can kill.

document.observe('keydown', function (ev) {
var key, keys = ['0'];
var isApple = (navigator.userAgent.indexOf('Mac') > -1), isCmmd, isCtrl;
if (window.event)
{
key = window.event.keyCode;
isCtrl = window.event.ctrlKey ? true : false;
isCmmd = window.event.metaKey ? true : false;
} else {
key = e.which;
isCtrl = ev.ctrlKey ? true : false;
isCmmd = ev.metaKey ? true : false;
}
if (isCtrl || (isCmmd && isApple)) {
switch (key) {
case 48: // 0
// do not stop, or user could get stuck
break;
case 187: // +
case 189: // -
ev.stop()
break;
default:
break;
}
}
});

Unfortunately, and I've been playing with this for a while now, and there isn't any surefire way to really disable it. The zoom options are still available through main application menus, so until a real method of tracking zoom (including after page reloads, which mostly impossible right now, and, besides, webkit exhibits some odd behavior when you attempt to track zoom).

Although many people would like to keep browser zoom more hidden, I can personally see the possible benefits of being able to observe zoom separately from resize, as they are mostly indistinguishable at this point (and that's if for no other reason at all).

Detecting CTRL+Wheel with CHtmlView

If this is CHtmlView with Doc/View structure, use PreTranslateMessage to catch messages.

Documentation for WM_MOUSEWHEEL suggests several macros for finding the state of virtual keys and wheel movement:

BOOL CMyHtmlView::PreTranslateMessage(MSG* pmsg)
{
if(pmsg->message == WM_MOUSEWHEEL)
{
int fwKeys = GET_KEYSTATE_WPARAM(pmsg->wParam);
int zDelta = GET_WHEEL_DELTA_WPARAM(pmsg->wParam);
if (fwKeys & MK_CONTROL)
{
//mousewheel + control key is down
TRACE("%d %d\n", zDelta, zDelta / WHEEL_DELTA);

//update statusbar, or return TRUE to handle this manually
}
}
return CHtmlView::PreTranslateMessage(pmsg);
}

CHtmlView also has its own CHtmlView::ExecWB method to set and get the zoom value etc.

CHtmlView::OnUpdateUI should also send notification for the change.


But the browser may not send a signal at the right time. Just make a timer to wait 1 second after detecting CTRL+WHEEL. Example:

BEGIN_MESSAGE_MAP(CMyHtmlView, CHtmlView)
ON_WM_TIMER()
END_MESSAGE_MAP()

const int ID_TIMER_ZOOM = 1;

BOOL CMyHtmlView::PreTranslateMessage(MSG* pmsg)
{
if(pmsg->message == WM_MOUSEWHEEL)
if (GET_KEYSTATE_WPARAM(pmsg->wParam) & MK_CONTROL)
SetTimer(ID_TIMER_ZOOM, 1000, NULL); //start timer for detecting zoom
return CHtmlView::PreTranslateMessage(pmsg);
}

void CMyHtmlView::OnTimer(UINT_PTR timer_id)
{
if(timer_id == ID_TIMER_ZOOM)
{
//get the zoom value
VARIANT vZoom;
vZoom.vt = VT_I4;
vZoom.lVal = 0;
ExecWB(OLECMDID_OPTICAL_ZOOM, OLECMDEXECOPT_DONTPROMPTUSER, nullptr, &vZoom);
TRACE("zoom %d\n", vZoom.lVal);

//kill the timer
KillTimer(timer_id);
}
}

LeafletJS: How to remove the zoom control

This worked for me:

var map = new L.map('map', { zoomControl: false });

With mapbox try:

var map = L.mapbox.map('map', { zoomControl: false });

See map creation and the zoomControl option in the Leaflet documentation.

How to disable zoom in Windows 8 webviews

Unfortunately this is not possible.

http://social.msdn.microsoft.com/Forums/en-AU/winappswithcsharp/thread/8eecf85d-ebd3-4bc0-ad17-15f342efad25

If the WebView works similarly to the WP7 version then you may be able to catch the events in html and cancel them there similarly to this.



Related Topics



Leave a reply



Submit