From b6111714b36b24723f1f4cbdabb140380879cfc5 Mon Sep 17 00:00:00 2001 From: Anton Lundin Date: Wed, 11 Oct 2023 21:34:18 +0200 Subject: [PATCH] Use horizontal mouse wheel for zoomed panning Signed-off-by: Anton Lundin --- CHANGELOG.md | 1 + profile-widget/profilewidget2.cpp | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 954f3abf9..1c6c42c47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ desktop: add divemode as a possible dive list column +profile-widget: Now zomed in profiles can be panned with horizontal scroll. desktop: hide only events with the same severity when 'Hide similar events' is used equipment: mark gas mixes reported by the dive computer as 'inactive' as 'not used' equipment: include unused cylinders in merged dive if the preference is enabled diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp index 22ac062ca..b90105187 100644 --- a/profile-widget/profilewidget2.cpp +++ b/profile-widget/profilewidget2.cpp @@ -322,6 +322,14 @@ void ProfileWidget2::wheelEvent(QWheelEvent *event) { if (!d) return; + if (event->angleDelta().x() && zoomLevel > 0) { + double oldPos = zoomedPosition; + zoomedPosition = profileScene->calcZoomPosition(calcZoom(zoomLevel), + oldPos, + oldPos - event->angleDelta().x()); + if (oldPos != zoomedPosition) + plotDive(d, dc, RenderFlags::Instant | RenderFlags::DontRecalculatePlotInfo); + } if (panning) return; // No change in zoom level while panning. if (event->buttons() == Qt::LeftButton)