Hello guys. I know this post is an old one but thinking it might be helpful to someone, I share my solution (which is an optimization of what @JimmyFF suggested).
I preferred to incorporate the mechanism in a customLabel class:
void mouseDrag(const MouseEvent& e) override
{
double changeVal = 0.0;
float sensitivity = 1.f;
int newMouseDown;
if (e.getMouseDownY()==mMouseDownPosY)
{
newMouseDown = mMouseCurrentPosY;
mMouseCurrentPosY = e.getPosition().getY();
}
else
{
newMouseDown = e.getMouseDownY();
mMouseCurrentPosY = e.getPosition().getY();
}
if(newMouseDown-mMouseCurrentPosY > 0) changeVal = + sensitivity; //up
if(newMouseDown-mMouseCurrentPosY < 0) changeVal = - sensitivity; //down
mDoubleValue += changeVal;
ParamValues oscVal;
mFloatValue = clipValue(mDoubleValue, minValue, maxValue);
setText(floatToStr(mFloatValue), sendNotification);
mMouseDownPosY = e.getMouseDownY();
}
I don’t know how naive my code might look to the more expert developers; if you have suggestions on how to improve it, I’d be very happy to read. I’m new to programming.