When holding CTRL (to increase adjustment precision) while turning a Rotary VerticalDrag/HorizontalDrag Slider and then releasing CTRL without releasing the mouse button, the Slider jumps back to a position near the one it had when the mouse button was initially pressed to start turning.
Shouldn’t the Slider stay in position just as it is the case for the Linear-type Sliders?
?? When I’m in Jucer and I add a new Rotary VerticalDrag Slider, and press CTRL while turning and release while the mouse button is still down, the Slider suddenly jumps to a previous position. Is that not the case on your computer?
Listen, there’s a bug, really. Not only in the JUCER, but also when I use a rotary slider in my app.
First turn the slider a bit without CTRL, still hold the mouse button down, press CTRL and continue turning, then while still holding the mouse button down, release CTRL and continue turning.
You will notice a jump in the position that should just not be. I remember that this was one of the reasons why I wrote my own “Knob” class.
The jump comes from the incorrect mouse position restoring in Slider::restoreMouseIfHidden, when you release the velocity mode key, here’s a solution for it:
First, two new varaibles for the Silder class (juce_Slider.h):
[code] float rotaryStart, rotaryEnd;
int numDecimalPlaces, mouseXWhenLastDragged, mouseYWhenLastDragged;
int mouseXWhenLastDown, mouseYWhenLastDown;
int sliderRegionStart, sliderRegionSize;
int sliderBeingDragged;[/code]
Second, store the last mouse down position in Slider::mouseDown (juce_Slider.cpp):