From 2a007bffb9391e0e6901e3eca4f1b1e13a107e47 Mon Sep 17 00:00:00 2001 From: David Capello Date: Mon, 11 Apr 2016 12:59:51 -0300 Subject: [PATCH] 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. --- src/app/ui/editor/state_with_wheel_behavior.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/app/ui/editor/state_with_wheel_behavior.cpp b/src/app/ui/editor/state_with_wheel_behavior.cpp index d30aae4c3..f1f8ec45d 100644 --- a/src/app/ui/editor/state_with_wheel_behavior.cpp +++ b/src/app/ui/editor/state_with_wheel_behavior.cpp @@ -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;