From 3073b68562b639a4462912acc09eb1e0d97bb741 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole-Andr=C3=A9=20Rodlie?= Date: Mon, 11 Nov 2024 18:36:35 +0100 Subject: [PATCH 1/2] Graph: fix inconsistent zoom behavior * Fixes #160 * Fixes #313 --- src/app/GUI/graphboxeslist.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/app/GUI/graphboxeslist.cpp b/src/app/GUI/graphboxeslist.cpp index b4fa5529a..5bae5091a 100644 --- a/src/app/GUI/graphboxeslist.cpp +++ b/src/app/GUI/graphboxeslist.cpp @@ -487,28 +487,24 @@ void KeysView::graphWheelEvent(QWheelEvent *event) #ifdef Q_OS_MAC if (event->angleDelta().y() == 0) { return; } #endif - if(event->modifiers() & Qt::ControlModifier) { + if (event->modifiers() & Qt::ControlModifier) { + emit wheelEventSignal(event); + } else if (event->modifiers() & Qt::ShiftModifier) { qreal valUnderMouse; qreal frame; const auto ePos = event->position(); graphGetValueAndFrameFromPos(ePos, valUnderMouse, frame); qreal graphScaleInc; - if(event->angleDelta().y() > 0) { - graphScaleInc = 0.1; - } else { - graphScaleInc = -0.1; - } + if (event->angleDelta().y() > 0) { graphScaleInc = 0.1; } + else { graphScaleInc = -0.1; } graphSetMinShownVal(mMinShownVal + (valUnderMouse - mMinShownVal)*graphScaleInc); mPixelsPerValUnit += graphScaleInc*mPixelsPerValUnit; graphUpdateDimensions(); } else { - if(event->angleDelta().y() > 0) { - graphIncMinShownVal(1); - } else { - graphIncMinShownVal(-1); - } + if (event->angleDelta().y() > 0) { graphIncMinShownVal(1); } + else { graphIncMinShownVal(-1); } } update(); From 3a9cc8d67bbc46b47ff3d66898462ec7ee8f33ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole-Andr=C3=A9=20Rodlie?= Date: Mon, 11 Nov 2024 18:55:00 +0100 Subject: [PATCH 2/2] Update graphboxeslist.cpp Return after ctrl+wheel, no need to update the graph. --- src/app/GUI/graphboxeslist.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/GUI/graphboxeslist.cpp b/src/app/GUI/graphboxeslist.cpp index 5bae5091a..f55cf6c13 100644 --- a/src/app/GUI/graphboxeslist.cpp +++ b/src/app/GUI/graphboxeslist.cpp @@ -489,6 +489,7 @@ void KeysView::graphWheelEvent(QWheelEvent *event) #endif if (event->modifiers() & Qt::ControlModifier) { emit wheelEventSignal(event); + return; } else if (event->modifiers() & Qt::ShiftModifier) { qreal valUnderMouse; qreal frame;