Skip to content

Commit

Permalink
adjust rotation bounds based on grid type
Browse files Browse the repository at this point in the history
  • Loading branch information
OliBomby committed Jun 19, 2024
1 parent 4f8c167 commit ce4567f
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions osu.Game.Rulesets.Osu/Edit/OsuGridToolboxGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public partial class OsuGridToolboxGroup : EditorToolboxGroup, IKeyBindingHandle
/// </summary>
public BindableFloat GridLinesRotation { get; } = new BindableFloat(0f)
{
MinValue = -45f,
MaxValue = 45f,
MinValue = -180f,
MaxValue = 180f,
Precision = 1f
};

Expand Down Expand Up @@ -191,6 +191,26 @@ protected override void LoadComplete()
gridTypeButtons.FadeTo(v.NewValue ? 1f : 0f, 500, Easing.OutQuint);
gridTypeButtons.BypassAutoSizeAxes = !v.NewValue ? Axes.Y : Axes.None;
}, true);

GridType.BindValueChanged(v =>
{
GridLinesRotation.Disabled = v.NewValue == PositionSnapGridType.Circle;

switch (v.NewValue)
{
case PositionSnapGridType.Square:
GridLinesRotation.Value = (GridLinesRotation.Value + 405) % 90 - 45;
GridLinesRotation.MinValue = -45;
GridLinesRotation.MaxValue = 45;
break;

case PositionSnapGridType.Triangle:
GridLinesRotation.Value = (GridLinesRotation.Value + 390) % 60 - 30;
GridLinesRotation.MinValue = -30;
GridLinesRotation.MaxValue = 30;
break;
}
}, true);
}

private void nextGridSize()
Expand Down

0 comments on commit ce4567f

Please sign in to comment.