Fix grid type cycling not taking into account the radio button selection

This commit is contained in:
OliBomby 2024-01-01 16:28:35 +01:00
parent b93bc21e45
commit ada20d230a
1 changed files with 3 additions and 5 deletions

View File

@ -27,8 +27,6 @@ public partial class OsuGridToolboxGroup : EditorToolboxGroup, IKeyBindingHandle
{ {
private static readonly PositionSnapGridType[] grid_types = Enum.GetValues(typeof(PositionSnapGridType)).Cast<PositionSnapGridType>().ToArray(); private static readonly PositionSnapGridType[] grid_types = Enum.GetValues(typeof(PositionSnapGridType)).Cast<PositionSnapGridType>().ToArray();
private int currentGridTypeIndex;
[Resolved] [Resolved]
private EditorBeatmap editorBeatmap { get; set; } = null!; private EditorBeatmap editorBeatmap { get; set; } = null!;
@ -252,9 +250,9 @@ private void nextGridSize()
private void nextGridType() private void nextGridType()
{ {
currentGridTypeIndex = (currentGridTypeIndex + 1) % grid_types.Length; int nextGridTypeIndex = (Array.IndexOf(grid_types, GridType.Value) + 1) % grid_types.Length;
GridType.Value = grid_types[currentGridTypeIndex]; GridType.Value = grid_types[nextGridTypeIndex];
gridTypeButtons.Items[currentGridTypeIndex].Select(); gridTypeButtons.Items[nextGridTypeIndex].Select();
} }
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e) public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)