From 850b04510405711c6b2aa60cee4251eb48af98d8 Mon Sep 17 00:00:00 2001 From: Carlo 'zED' Caputo Date: Tue, 11 Oct 2016 16:43:42 -0300 Subject: [PATCH] cleanup and fix for the case of a horizontal scroll --- src/app/ui/timeline.cpp | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/app/ui/timeline.cpp b/src/app/ui/timeline.cpp index 4c29fa178..5a4d69cb3 100644 --- a/src/app/ui/timeline.cpp +++ b/src/app/ui/timeline.cpp @@ -1065,23 +1065,27 @@ bool Timeline::onProcessMessage(Message* msg) case kMouseWheelMessage: if (m_document) { - int dz = static_cast(msg)->wheelDelta().y; - int dx = 0; - int dy = 0; - - dx += static_cast(msg)->wheelDelta().x; + int base_size = skinTheme()->dimensions.timelineBaseSize(); + int dz = static_cast(msg)->wheelDelta().y * base_size; if (msg->altPressed()) { - double next_zoom = m_zoom + (dz < 0 ? 1 : -1); - setZoomAndUpdate(next_zoom); + if (dz != 0) { + double next_zoom = m_zoom + (dz < 0 ? 1 : -1); + setZoomAndUpdate(next_zoom); + } } else { - int base_size = skinTheme()->dimensions.timelineBaseSize(); + int dx; + int dy; - if (msg->ctrlPressed()) - dx = dz * base_size; - else - dy = dz * base_size; + if (msg->ctrlPressed()) { + dx = dz; + dy = 0; + } + else { + dx = static_cast(msg)->wheelDelta().x * base_size; + dy = dz; + } if (msg->shiftPressed()) { dx *= frameBoxWidth() / base_size;