Update Editor::onMouseWheel() to use precise wheel as a touch device (scroll by default)

On OS X, when we receive a precise wheel event, it means that the user
has pressed a touch-like device (trackpad, magic mouse, wacom tablet),
so he can scroll by default with the device (it's not a real mouse wheel).
The zoom can be done with the pinch gesture.
This commit is contained in:
David Capello 2016-04-11 12:59:51 -03:00
parent 951bc1b4b0
commit 2a007bffb9

View File

@ -47,12 +47,14 @@ bool StateWithWheelBehavior::onMouseWheel(Editor* editor, MouseMessage* msg)
else
wheelAction = WHEEL_FG;
}
// Normal behavior: mouse wheel zooms
else if (Preferences::instance().editor.zoomWithWheel()) {
// Normal behavior: mouse wheel zooms If the message is from a
// precise wheel i.e. a trackpad/touch-like device, we scroll by
// default.
else if (Preferences::instance().editor.zoomWithWheel() &&
!msg->preciseWheel()) {
if (msg->ctrlPressed())
wheelAction = WHEEL_FRAME;
else if ((msg->wheelDelta().x != 0 && !msg->preciseWheel()) ||
(msg->shiftPressed()))
else if (msg->wheelDelta().x != 0 || msg->shiftPressed())
wheelAction = WHEEL_HSCROLL;
else
wheelAction = WHEEL_ZOOM;