From 28be21cfefb063f3c0ade14026336680f6cba6d4 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Tue, 18 Aug 2020 18:15:05 -0400 Subject: [PATCH] Fix middle-mouse-drag speed of ScrollWidget with non-1 zoom level. --- CHANGELOG.md | 1 + src/ui/ScrollWidget.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c392dbcb..b94607c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ In this document, Mod is Ctrl on Windows/Linux and Cmd on Mac. - Copy cable color when cloning cables with Ctrl+click. - Fix key commands on AZERTY, Dvorak, and all other keyboard layouts. - Add Mouse device to Computer keyboard/mouse MIDI driver. +- Make scrollbar mouse interaction similar to modern OS behavior. - Core - Add Audio-2 module with stereo input/output, a level knob, and VU meters. diff --git a/src/ui/ScrollWidget.cpp b/src/ui/ScrollWidget.cpp index 515e9c74..f101083a 100644 --- a/src/ui/ScrollWidget.cpp +++ b/src/ui/ScrollWidget.cpp @@ -109,7 +109,8 @@ void ScrollWidget::onDragMove(const event::DragMove& e) { if (!(horizontalScrollBar->isVisible() || verticalScrollBar->isVisible())) return; - offset = offset.minus(e.mouseDelta); + math::Vec offsetDelta = e.mouseDelta.div(getAbsoluteZoom()); + offset = offset.minus(offsetDelta); }