Merge pull request #18220 from frenzibyte/control-popover-focus

Focus textbox upon opening control point popovers
This commit is contained in:
Dean Herbert
2022-05-11 19:41:25 +09:00
committed by GitHub
5 changed files with 60 additions and 4 deletions

View File

@ -122,6 +122,12 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
beatmap.EndChange();
});
}
protected override void LoadComplete()
{
base.LoadComplete();
ScheduleAfterChildren(() => GetContainingInputManager().ChangeFocus(sliderVelocitySlider));
}
}
}
}

View File

@ -126,6 +126,12 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
volume.Current.BindValueChanged(val => updateVolumeFor(relevantObjects, val.NewValue));
}
protected override void LoadComplete()
{
base.LoadComplete();
ScheduleAfterChildren(() => GetContainingInputManager().ChangeFocus(volume));
}
private static string? getCommonBank(SampleControlPoint[] relevantControlPoints) => relevantControlPoints.Select(point => point.SampleBank).Distinct().Count() == 1 ? relevantControlPoints.First().SampleBank : null;
private static int? getCommonVolume(SampleControlPoint[] relevantControlPoints) => relevantControlPoints.Select(point => point.SampleVolume).Distinct().Count() == 1 ? (int?)relevantControlPoints.First().SampleVolume : null;

View File

@ -7,6 +7,7 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Overlays.Settings;
@ -107,6 +108,14 @@ namespace osu.Game.Screens.Edit.Timing
Current.BindValueChanged(_ => updateState(), true);
}
public override bool AcceptsFocus => true;
protected override void OnFocus(FocusEvent e)
{
base.OnFocus(e);
GetContainingInputManager().ChangeFocus(textBox);
}
private void updateState()
{
if (Current.Value is T nonNullValue)