gearmulator

Emulation of classic VA synths of the late 90s/2000s that are based on Motorola 56300 family DSPs
Log | Files | Refs | Submodules | README | LICENSE

commit b323286b61a88c007701a37fa76919297754672c
parent aad22905c228b588551a4cef841c33c78a8ac441
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Tue, 26 Nov 2024 23:56:56 +0100

fix mouse wheel not working for knobs with less than 32 values

Diffstat:
Msource/juceUiLib/slider.cpp | 11++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/source/juceUiLib/slider.cpp b/source/juceUiLib/slider.cpp @@ -2,16 +2,21 @@ namespace genericUI { + // Juce default is about 32 steps for the mouse wheel to go from min to max + constexpr int g_minStepsForDefaultWheel = 32; + void Slider::mouseWheelMove(const juce::MouseEvent& event, const juce::MouseWheelDetails& wheel) { - // we use the default behaviour if ctrl/cmd is not pressed. If it is, we want to inc/dec single steps - if(!event.mods.isCommandDown() || !isEnabled()) + const auto range = getNormalisableRange(); + + // we use the default behaviour if ctrl/cmd is not pressed and the range is large enough + if((range.end - range.start) > g_minStepsForDefaultWheel && (!event.mods.isCommandDown() || !isEnabled())) { juce::Slider::mouseWheelMove(event, wheel); return; } - const auto range = getNormalisableRange(); + // Otherwise inc/dec single steps if(range.end <= range.start) return;