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:
parent
fcbdf0629f
commit
92c30e780d
1 changed files with 11 additions and 4 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue