1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 14:17:26 +08:00

Immediately focus the textbox when clicking to reply to a comment

This commit is contained in:
Dean Herbert 2023-01-19 16:08:27 +09:00
parent 81e6c3792c
commit 4916a742d5
2 changed files with 11 additions and 4 deletions

View File

@ -35,6 +35,8 @@ namespace osu.Game.Overlays.Comments
private RoundedButton commitButton = null!;
private LoadingSpinner loadingSpinner = null!;
protected TextBox TextBox { get; private set; } = null!;
protected bool ShowLoadingSpinner
{
set
@ -51,8 +53,6 @@ namespace osu.Game.Overlays.Comments
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
EditorTextBox textBox;
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Masking = true;
@ -74,7 +74,7 @@ namespace osu.Game.Overlays.Comments
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
textBox = new EditorTextBox
TextBox = new EditorTextBox
{
Height = 40,
RelativeSizeAxes = Axes.X,
@ -133,7 +133,7 @@ namespace osu.Game.Overlays.Comments
}
});
textBox.OnCommit += (_, _) => commitButton.TriggerClick();
TextBox.OnCommit += (_, _) => commitButton.TriggerClick();
}
protected override void LoadComplete()

View File

@ -36,6 +36,13 @@ namespace osu.Game.Overlays.Comments
OnCancel = () => this.FadeOut(200).Expire();
}
protected override void LoadComplete()
{
base.LoadComplete();
GetContainingInputManager().ChangeFocus(TextBox);
}
protected override void OnCommit(string text)
{
ShowLoadingSpinner = true;