As much as I enjoy the rotary slider class of JUCE, I’m looking for a “drag” variant that IMHO is missing in the current options.
There is already rotary, RotaryHorizontalDrag, and RotaryVerticalDrag options, but would it possible to add a rotaryHorizontalVerticalDrag variant ? So the rotary slider would respond to both vertical & horizontal drag ?
(it’s pseudo code, it’s not meant to work as is, of course)
[code]mouseDrag() // called on mouse drag
{
if ( abs(deltaX) > abs(deltaY) )
{
// operate as in the case of rotaryHorizontalDrag
}
else // movement along Y axis is greater than movement on X axis
{
// operate as in the case of rotaryVerticalDrag
}
Well, I’m not particularly in favour of this solution, I was only trying to guess what was meant.
BTW, if you’re at the boundary where deltaX and deltaY are close to each other, that means that even the calculated value for the slider position shouldn’t differ either way, right?
It’s something that just look at the mouse “delta” mouvement from the moment the user click and start to drag, and then it add together the x+y “delta” value to modify knob position. Not an if/else, but summing.
FWIW here’s bellow for illustration something I use in a javasprit.
x and y are mouse coordinate in pixel.
{delta = (last_y-y + x-last_x)*0.3; // add mouse tracking vert & hor + slow down
}
last_x = x; //reset x position (to calcul delta on drag)
last_y = y;//reset y position
Hmm… I’ve never really liked relative distances in sliders, it always seems to make it drift as you move the mouse at different speeds. Unless the pointer is hidden, I much prefer to see a relationship between a screen position and a slider value, it feels more controllable.