1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-29 02:40:05 +00:00

Allowed linear-drag rotary sliders to rollover

This commit is contained in:
Tom Poole 2019-04-09 16:08:51 +01:00
parent fcbdf0629f
commit 92c30e780d

View file

@ -775,7 +775,9 @@ public:
newPos = 1.0 - newPos;
}
valueWhenLastDragged = owner.proportionOfLengthToValue (jlimit (0.0, 1.0, newPos));
newPos = (isRotary() && ! rotaryParams.stopAtEnd) ? newPos - std::floor (newPos)
: jlimit (0.0, 1.0, newPos);
valueWhenLastDragged = owner.proportionOfLengthToValue (newPos);
}
void handleVelocityDrag (const MouseEvent& e)
@ -806,8 +808,10 @@ public:
|| (style == IncDecButtons && ! incDecDragDirectionIsHorizontal()))
speed = -speed;
auto currentPos = owner.valueToProportionOfLength (valueWhenLastDragged);
valueWhenLastDragged = owner.proportionOfLengthToValue (jlimit (0.0, 1.0, currentPos + speed));
auto newPos = owner.valueToProportionOfLength (valueWhenLastDragged) + speed;
newPos = (isRotary() && ! rotaryParams.stopAtEnd) ? newPos - std::floor (newPos)
: jlimit (0.0, 1.0, newPos);
valueWhenLastDragged = owner.proportionOfLengthToValue (newPos);
e.source.enableUnboundedMouseMovement (true, false);
}
@ -1051,7 +1055,10 @@ public:
auto proportionDelta = wheelAmount * 0.15;
auto currentPos = owner.valueToProportionOfLength (value);
return owner.proportionOfLengthToValue (jlimit (0.0, 1.0, currentPos + proportionDelta)) - value;
auto newPos = currentPos + proportionDelta;
newPos = (isRotary() && ! rotaryParams.stopAtEnd) ? newPos - std::floor (newPos)
: jlimit (0.0, 1.0, newPos);
return owner.proportionOfLengthToValue (newPos) - value;
}
bool mouseWheelMove (const MouseEvent& e, const MouseWheelDetails& wheel)