From 3634e12e66ff499831a441d5ff27f7ceab1e8627 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 28 Feb 2022 15:21:01 +0900 Subject: [PATCH] Automatically focus divisor textbox and hide popover after successful change --- osu.Game.Tests/Visual/Editing/TestSceneBeatDivisorControl.cs | 4 ---- .../Screens/Edit/Compose/Components/BeatDivisorControl.cs | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneBeatDivisorControl.cs b/osu.Game.Tests/Visual/Editing/TestSceneBeatDivisorControl.cs index 94c0822235..6a0950c6dd 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneBeatDivisorControl.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneBeatDivisorControl.cs @@ -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().Any()); } } diff --git a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs index d5b0ab19aa..c65423ef9f 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs @@ -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()