Update to use new `Filter` method and remove silly `ForcedSearchTerm`

This commit is contained in:
Dean Herbert 2023-05-30 13:38:39 +09:00
parent 22c6d6c526
commit e35623df22
2 changed files with 8 additions and 11 deletions

View File

@ -7,23 +7,20 @@ namespace osu.Game.Overlays.Mods
{ {
public partial class ModSearchContainer : SearchContainer public partial class ModSearchContainer : SearchContainer
{ {
/// <summary> public new string SearchTerm
/// Same as <see cref="SearchContainer{T}.SearchTerm"/> except the filtering is guarantied to be performed
/// </summary>
/// <remarks>
/// This is required because <see cref="ModColumn"/> can be hidden when search term applied
/// therefore <see cref="SearchContainer{T}.Update"/> cannot be reached and filter cannot automatically re-validate itself.
/// </remarks>
public string ForcedSearchTerm
{ {
get => SearchTerm; get => base.SearchTerm;
set set
{ {
if (value == SearchTerm) if (value == SearchTerm)
return; return;
SearchTerm = value; SearchTerm = value;
Update();
// Manual filtering here is required because ModColumn can be hidden when search term applied,
// causing the whole SearchContainer to become non-present and never actually perform a subsequent
// filter.
Filter();
} }
} }
} }

View File

@ -45,7 +45,7 @@ public Color4 AccentColour
public string SearchTerm public string SearchTerm
{ {
set => ItemsFlow.ForcedSearchTerm = value; set => ItemsFlow.SearchTerm = value;
} }
protected override bool ReceivePositionalInputAtSubTree(Vector2 screenSpacePos) => base.ReceivePositionalInputAtSubTree(screenSpacePos) && Active.Value; protected override bool ReceivePositionalInputAtSubTree(Vector2 screenSpacePos) => base.ReceivePositionalInputAtSubTree(screenSpacePos) && Active.Value;