mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 17:32:54 +08:00
Improve editor selection rotation value wrapping
This fixes two issues the previous algorithm had: 1. A half-turn rotation used to show up as -180°. 2. Rotating more than 180° in one drag event would overwhelm it and cause the value to go outside its range. This comes at the cost of a negligible performance hit, since a division (modulo) is performed instead of just addition/subtraction.
This commit is contained in:
parent
f1de560d57
commit
c827c2810b
@ -134,10 +134,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
cumulativeRotation.Value = rawCumulativeRotation;
|
||||
}
|
||||
|
||||
if (cumulativeRotation.Value < -180)
|
||||
cumulativeRotation.Value += 360;
|
||||
else if (cumulativeRotation.Value > 180)
|
||||
cumulativeRotation.Value -= 360;
|
||||
cumulativeRotation.Value = (cumulativeRotation.Value - 180) % 360 + 180;
|
||||
|
||||
HandleRotate?.Invoke((float)cumulativeRotation.Value - oldRotation);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user