From abc586a6d4a72dc1cbba7c4b1accb585337cdcb7 Mon Sep 17 00:00:00 2001 From: David Capello Date: Wed, 23 Nov 2016 14:08:34 -0300 Subject: [PATCH] Fix bug on macOS scrolling frames w/mouse wheel in the wrong direction Sometimes macOS returns us a delta of 0.0, so we should not move through frames in that case. --- .../ui/editor/state_with_wheel_behavior.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/app/ui/editor/state_with_wheel_behavior.cpp b/src/app/ui/editor/state_with_wheel_behavior.cpp index 5fee94fb8..dff24b784 100644 --- a/src/app/ui/editor/state_with_wheel_behavior.cpp +++ b/src/app/ui/editor/state_with_wheel_behavior.cpp @@ -113,15 +113,18 @@ bool StateWithWheelBehavior::onMouseWheel(Editor* editor, MouseMessage* msg) } break; - case WHEEL_FRAME: - { - Command* command = CommandsModule::instance()->getCommandByName - ((dz < 0.0) ? CommandId::GotoNextFrame: - CommandId::GotoPreviousFrame); - if (command) - UIContext::instance()->executeCommand(command); - } + case WHEEL_FRAME: { + Command* command = nullptr; + + if (dz < 0.0) + command = CommandsModule::instance()->getCommandByName(CommandId::GotoNextFrame); + else if (dz > 0.0) + command = CommandsModule::instance()->getCommandByName(CommandId::GotoPreviousFrame); + + if (command) + UIContext::instance()->executeCommand(command); break; + } case WHEEL_ZOOM: { render::Zoom zoom = editor->zoom();