From 096f40f4f6eff8009de7f2273e560f7bf480db51 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Tue, 19 Jan 2021 22:39:07 -0500 Subject: [PATCH] Fix Ctrl+scroll zooming with RackScrollWidget, which was broken when knob scrolling was added. --- src/ui/ScrollWidget.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ui/ScrollWidget.cpp b/src/ui/ScrollWidget.cpp index 3868f470..19e65545 100644 --- a/src/ui/ScrollWidget.cpp +++ b/src/ui/ScrollWidget.cpp @@ -129,6 +129,11 @@ void ScrollWidget::onHoverScroll(const event::HoverScroll& e) { if (e.isConsumed()) return; + int mods = APP->window->getMods(); + // Don't scroll when Ctrl is held because this interferes with RackScrollWidget zooming. + if ((mods & RACK_MOD_MASK) & RACK_MOD_CTRL) + return; + // Check if scrollable math::Rect offsetBound = getContainerOffsetBound(); if (offsetBound.size.x <= 0.f && offsetBound.size.y <= 0.f) @@ -138,7 +143,7 @@ void ScrollWidget::onHoverScroll(const event::HoverScroll& e) { // Flip coordinates if shift is held // Mac (or GLFW?) already does this for us. #if !defined ARCH_MAC - if ((APP->window->getMods() & RACK_MOD_MASK) == GLFW_MOD_SHIFT) + if ((mods & RACK_MOD_MASK) == GLFW_MOD_SHIFT) scrollDelta = scrollDelta.flip(); #endif