1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-31 13:33:20 +08:00

fix period

This commit is contained in:
OliBomby 2023-12-30 20:58:21 +01:00
parent fea0ceb498
commit c2ea1848ca

View File

@ -64,8 +64,8 @@ namespace osu.Game.Rulesets.Osu.Edit
/// </summary>
public BindableFloat GridLinesRotation { get; } = new BindableFloat(0f)
{
MinValue = -45f,
MaxValue = 45f,
MinValue = -90f,
MaxValue = 90f,
};
/// <summary>
@ -103,9 +103,9 @@ namespace osu.Game.Rulesets.Osu.Edit
StartPositionY.Value = point1.Y;
// Get the angle between the two points and normalize to the valid range.
float period = GridType.Value == PositionSnapGridType.Triangle ? 60 : 90;
const float period = 180;
GridLinesRotation.Value = (MathHelper.RadiansToDegrees(MathF.Atan2(point2.Y - point1.Y, point2.X - point1.X))
+ 360 + period / 2) % period - period / 2;
+ period * 1.5f) % period - period * 0.5f;
// Divide the distance so that there is a good density of grid lines.
float dist = Vector2.Distance(point1, point2);