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

Make search bar active by default

This commit is contained in:
Cootz 2023-06-04 17:02:46 +03:00
parent 69b640a185
commit 32b9e6ec8f

View File

@ -66,17 +66,17 @@ namespace osu.Game.Overlays.Mods
public string SearchTerm public string SearchTerm
{ {
get => searchTextBox.Current.Value; get => SearchTextBox.Current.Value;
set set
{ {
if (searchTextBox.Current.Value == value) if (SearchTextBox.Current.Value == value)
return; return;
searchTextBox.Current.Value = value; SearchTextBox.Current.Value = value;
} }
} }
private ShearedSearchTextBox searchTextBox = null!; public ShearedSearchTextBox SearchTextBox { get; private set; } = null!;
/// <summary> /// <summary>
/// Whether the total score multiplier calculated from the current selected set of mods should be shown. /// Whether the total score multiplier calculated from the current selected set of mods should be shown.
@ -166,7 +166,7 @@ namespace osu.Game.Overlays.Mods
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Height = ModsEffectDisplay.HEIGHT, Height = ModsEffectDisplay.HEIGHT,
Padding = new MarginPadding { Horizontal = 100 }, Padding = new MarginPadding { Horizontal = 100 },
Child = searchTextBox = new ShearedSearchTextBox Child = SearchTextBox = new ShearedSearchTextBox
{ {
HoldFocus = false, HoldFocus = false,
Width = 300 Width = 300
@ -249,7 +249,7 @@ namespace osu.Game.Overlays.Mods
base.Hide(); base.Hide();
//We want to clear search for next user interaction with mod overlay //We want to clear search for next user interaction with mod overlay
searchTextBox.Current.Value = string.Empty; SearchTextBox.Current.Value = string.Empty;
} }
private ModSettingChangeTracker? modSettingChangeTracker; private ModSettingChangeTracker? modSettingChangeTracker;
@ -289,12 +289,14 @@ namespace osu.Game.Overlays.Mods
customisationVisible.BindValueChanged(_ => updateCustomisationVisualState(), true); customisationVisible.BindValueChanged(_ => updateCustomisationVisualState(), true);
searchTextBox.Current.BindValueChanged(query => SearchTextBox.Current.BindValueChanged(query =>
{ {
foreach (var column in columnFlow.Columns) foreach (var column in columnFlow.Columns)
column.SearchTerm = query.NewValue; column.SearchTerm = query.NewValue;
}, true); }, true);
SearchTextBox.TakeFocus();
// Start scrolled slightly to the right to give the user a sense that // Start scrolled slightly to the right to give the user a sense that
// there is more horizontal content available. // there is more horizontal content available.
ScheduleAfterChildren(() => ScheduleAfterChildren(() =>
@ -789,7 +791,7 @@ namespace osu.Game.Overlays.Mods
if (!Active.Value) if (!Active.Value)
RequestScroll?.Invoke(this); RequestScroll?.Invoke(this);
//Kill focus on searchTextBox //Kill focus on SearchTextBox
Scheduler.Add(() => GetContainingInputManager().ChangeFocus(null)); Scheduler.Add(() => GetContainingInputManager().ChangeFocus(null));
return true; return true;