mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 15:12:57 +08:00
Fix NaN when dragging music controller
When dragging music controller we divide by the dragged distance. When dragging to the origin of the drag this resulted in NaN. Now, we check for this and use 0 in this case.
This commit is contained in:
parent
3649b432a1
commit
9af0104e3e
@ -65,7 +65,7 @@ namespace osu.Game.Overlays
|
|||||||
Vector2 change = state.Mouse.Position - state.Mouse.PositionMouseDown.Value;
|
Vector2 change = state.Mouse.Position - state.Mouse.PositionMouseDown.Value;
|
||||||
|
|
||||||
// Diminish the drag distance as we go further to simulate "rubber band" feeling.
|
// Diminish the drag distance as we go further to simulate "rubber band" feeling.
|
||||||
change *= (float)Math.Pow(change.Length, 0.7f) / change.Length;
|
change *= change.Length <= 0 ? 0 : (float)Math.Pow(change.Length, 0.7f) / change.Length;
|
||||||
|
|
||||||
dragContainer.MoveTo(change);
|
dragContainer.MoveTo(change);
|
||||||
return base.OnDrag(state);
|
return base.OnDrag(state);
|
||||||
|
Loading…
Reference in New Issue
Block a user