1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 16:07:24 +08:00

select all input text on popup for an easy typing experience

This commit is contained in:
OliBomby 2024-05-25 18:41:31 +02:00
parent 6aa92bcc45
commit 88314dc584
4 changed files with 14 additions and 2 deletions

View File

@ -78,7 +78,11 @@ namespace osu.Game.Rulesets.Osu.Edit
{
base.LoadComplete();
ScheduleAfterChildren(() => angleInput.TakeFocus());
ScheduleAfterChildren(() =>
{
angleInput.TakeFocus();
angleInput.SelectAll();
});
angleInput.Current.BindValueChanged(angle => rotationInfo.Value = rotationInfo.Value with { Degrees = angle.NewValue });
rotationOrigin.Items.First().Select();

View File

@ -80,7 +80,11 @@ namespace osu.Game.Rulesets.Osu.Edit
{
base.LoadComplete();
ScheduleAfterChildren(() => scaleInput.TakeFocus());
ScheduleAfterChildren(() =>
{
scaleInput.TakeFocus();
scaleInput.SelectAll();
});
scaleInput.Current.BindValueChanged(scale => scaleInfo.Value = scaleInfo.Value with { Scale = scale.NewValue });
scaleOrigin.Items.First().Select();

View File

@ -50,6 +50,8 @@ namespace osu.Game.Graphics.UserInterfaceV2
Component.BorderColour = colours.Blue;
}
public bool SelectAll() => Component.SelectAll();
protected virtual OsuTextBox CreateTextBox() => new OsuTextBox();
public override bool AcceptsFocus => true;

View File

@ -87,6 +87,8 @@ namespace osu.Game.Graphics.UserInterfaceV2
public bool TakeFocus() => GetContainingFocusManager().ChangeFocus(textBox);
public bool SelectAll() => textBox.SelectAll();
private bool updatingFromTextBox;
private void textChanged(ValueChangedEvent<string> change)