From 07ab815e906920dc051b2452cd03a4c517740261 Mon Sep 17 00:00:00 2001 From: ustk iMac Date: Tue, 12 Nov 2024 15:33:39 +0100 Subject: [PATCH] Add Shift modifier for smoother zoom in viewports with sensitive mouse wheels --- hi_tools/hi_standalone_components/ZoomableViewport.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hi_tools/hi_standalone_components/ZoomableViewport.cpp b/hi_tools/hi_standalone_components/ZoomableViewport.cpp index 848b5b846e..719603726f 100644 --- a/hi_tools/hi_standalone_components/ZoomableViewport.cpp +++ b/hi_tools/hi_standalone_components/ZoomableViewport.cpp @@ -248,10 +248,12 @@ void ZoomableViewport::mouseWheelMove(const MouseEvent& e, const MouseWheelDetai { if (e.mods.isCommandDown()) { + const float zoomSpeed = e.mods.isShiftDown() ? 1.03f : 1.15f; + if (wheel.deltaY > 0) - zoomFactor *= 1.15f; + zoomFactor *= zoomSpeed; else - zoomFactor /= 1.15f; + zoomFactor /= zoomSpeed; zoomFactor = jlimit(0.25f, maxZoomFactor, zoomFactor);