1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 19:22:54 +08:00

Simplify snap implementation

This commit is contained in:
Bartłomiej Dach 2023-04-10 14:55:30 +02:00
parent 8d2e852ffd
commit 6fec476147
No known key found for this signature in database

View File

@ -129,10 +129,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
TooltipText = newRotation.ToLocalisableString(tooltipFormat); TooltipText = newRotation.ToLocalisableString(tooltipFormat);
} }
private float snap(float value, float step) private float snap(float value, float step) => MathF.Round(value / step) * step;
{
float floor = MathF.Floor(value / step) * step;
return value - floor < step / 2f ? floor : floor + step;
}
} }
} }