1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-11 00:57:24 +08:00

Fix settings control not visible because of previous search

This also makes `SettingsPanel`'s `SearchTextBox` protected from private so that `SettingsOverlay` can access it.
This commit is contained in:
Zihad 2025-02-28 00:20:58 +06:00
parent 7f99e60cfd
commit 0913174099
No known key found for this signature in database
2 changed files with 11 additions and 8 deletions

View File

@ -68,6 +68,9 @@ namespace osu.Game.Overlays
public void ShowAtControl<T>() public void ShowAtControl<T>()
where T : Drawable where T : Drawable
{ {
// if search isn't cleared then the target control won't be visible if it doesn't match the query
SearchTextBox.Current.Value = "";
Show(); Show();
// wait for load of sections // wait for load of sections

View File

@ -54,7 +54,7 @@ namespace osu.Game.Overlays
public SettingsSectionsContainer SectionsContainer { get; private set; } public SettingsSectionsContainer SectionsContainer { get; private set; }
private SeekLimitedSearchTextBox searchTextBox; protected SeekLimitedSearchTextBox SearchTextBox;
protected override string PopInSampleName => "UI/settings-pop-in"; protected override string PopInSampleName => "UI/settings-pop-in";
protected override double PopInOutSampleBalance => -OsuGameBase.SFX_STEREO_STRENGTH; protected override double PopInOutSampleBalance => -OsuGameBase.SFX_STEREO_STRENGTH;
@ -135,7 +135,7 @@ namespace osu.Game.Overlays
}, },
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Child = searchTextBox = new SettingsSearchTextBox Child = SearchTextBox = new SettingsSearchTextBox
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
@ -183,8 +183,8 @@ namespace osu.Game.Overlays
Sidebar?.MoveToX(0, TRANSITION_LENGTH, Easing.OutQuint); Sidebar?.MoveToX(0, TRANSITION_LENGTH, Easing.OutQuint);
this.FadeTo(1, TRANSITION_LENGTH / 2, Easing.OutQuint); this.FadeTo(1, TRANSITION_LENGTH / 2, Easing.OutQuint);
searchTextBox.TakeFocus(); SearchTextBox.TakeFocus();
searchTextBox.HoldFocus = true; SearchTextBox.HoldFocus = true;
} }
protected virtual float ExpandedPosition => 0; protected virtual float ExpandedPosition => 0;
@ -199,8 +199,8 @@ namespace osu.Game.Overlays
Sidebar?.MoveToX(-sidebar_width, TRANSITION_LENGTH, Easing.OutQuint); Sidebar?.MoveToX(-sidebar_width, TRANSITION_LENGTH, Easing.OutQuint);
this.FadeTo(0, TRANSITION_LENGTH / 2, Easing.OutQuint); this.FadeTo(0, TRANSITION_LENGTH / 2, Easing.OutQuint);
searchTextBox.HoldFocus = false; SearchTextBox.HoldFocus = false;
if (searchTextBox.HasFocus) if (SearchTextBox.HasFocus)
GetContainingFocusManager()!.ChangeFocus(null); GetContainingFocusManager()!.ChangeFocus(null);
} }
@ -208,7 +208,7 @@ namespace osu.Game.Overlays
protected override void OnFocus(FocusEvent e) protected override void OnFocus(FocusEvent e)
{ {
searchTextBox.TakeFocus(); SearchTextBox.TakeFocus();
base.OnFocus(e); base.OnFocus(e);
} }
@ -234,7 +234,7 @@ namespace osu.Game.Overlays
loading.Hide(); loading.Hide();
searchTextBox.Current.BindValueChanged(term => SectionsContainer.SearchTerm = term.NewValue, true); SearchTextBox.Current.BindValueChanged(term => SectionsContainer.SearchTerm = term.NewValue, true);
loadSidebarButtons(); loadSidebarButtons();
}); });