mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 16:12:54 +08:00
Add back the old keybind for cycling grid spacing
This commit is contained in:
parent
c5edf43283
commit
594b6fe167
@ -107,6 +107,29 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
||||
};
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGridSizeToggling()
|
||||
{
|
||||
AddStep("enable rectangular grid", () => InputManager.Key(Key.Y));
|
||||
AddUntilStep("rectangular grid visible", () => this.ChildrenOfType<RectangularPositionSnapGrid>().Any());
|
||||
gridSizeIs(4);
|
||||
|
||||
nextGridSizeIs(8);
|
||||
nextGridSizeIs(16);
|
||||
nextGridSizeIs(32);
|
||||
nextGridSizeIs(4);
|
||||
}
|
||||
|
||||
private void nextGridSizeIs(int size)
|
||||
{
|
||||
AddStep("toggle to next grid size", () => InputManager.Key(Key.G));
|
||||
gridSizeIs(size);
|
||||
}
|
||||
|
||||
private void gridSizeIs(int size)
|
||||
=> AddAssert($"grid size is {size}", () => this.ChildrenOfType<RectangularPositionSnapGrid>().Single().Spacing.Value == new Vector2(size)
|
||||
&& EditorBeatmap.BeatmapInfo.GridSize == size);
|
||||
|
||||
[Test]
|
||||
public void TestGridTypeToggling()
|
||||
{
|
||||
@ -121,7 +144,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
||||
|
||||
private void nextGridTypeIs<T>() where T : PositionSnapGrid
|
||||
{
|
||||
AddStep("toggle to next grid type", () => InputManager.Key(Key.G));
|
||||
AddStep("toggle to next grid type", () => InputManager.Key(Key.H));
|
||||
gridActive<T>(true);
|
||||
}
|
||||
}
|
||||
|
@ -100,6 +100,8 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
{
|
||||
}
|
||||
|
||||
private const float max_automatic_spacing = 64;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
@ -196,11 +198,9 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
}, true);
|
||||
}
|
||||
|
||||
private void nextGridType()
|
||||
private void nextGridSize()
|
||||
{
|
||||
currentGridTypeIndex = (currentGridTypeIndex + 1) % grid_types.Length;
|
||||
GridType.Value = grid_types[currentGridTypeIndex];
|
||||
gridTypeButtons.Items[currentGridTypeIndex].Select();
|
||||
Spacing.Value = Spacing.Value * 2 >= max_automatic_spacing ? Spacing.Value / 8 : Spacing.Value * 2;
|
||||
}
|
||||
|
||||
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
||||
@ -208,7 +208,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
switch (e.Action)
|
||||
{
|
||||
case GlobalAction.EditorCycleGridDisplayMode:
|
||||
nextGridType();
|
||||
nextGridSize();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user