1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 09:02:58 +08:00

Automatically focus divisor textbox and hide popover after successful change

This commit is contained in:
Dean Herbert 2022-02-28 15:21:01 +09:00
parent a1786f62d7
commit 3634e12e66
2 changed files with 5 additions and 4 deletions

View File

@ -190,10 +190,6 @@ namespace osu.Game.Tests.Visual.Editing
textBox.Text = divisor.ToString();
InputManager.Key(Key.Enter);
});
AddStep("dismiss popover", () =>
{
InputManager.Key(Key.Escape);
});
AddUntilStep("wait for dismiss", () => !this.ChildrenOfType<BeatDivisorControl.CustomDivisorPopover>().Any());
}
}

View File

@ -16,6 +16,7 @@ using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input;
using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
@ -299,6 +300,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
base.LoadComplete();
BeatDivisor.BindValueChanged(_ => updateState(), true);
divisorTextBox.OnCommit += (_, __) => setPresets();
Schedule(() => GetContainingInputManager().ChangeFocus(divisorTextBox));
}
private void setPresets()
@ -320,6 +323,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
}
BeatDivisor.Value = divisor;
this.HidePopover();
}
private void updateState()