1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-16 02:22:59 +08:00

Fix being able to start typing something, change other filters, and have the search use the currently typing query

This commit is contained in:
DrabWeb 2017-06-07 11:13:12 -03:00
parent 312fd16631
commit a4be5c8a78

View File

@ -116,7 +116,11 @@ namespace osu.Game.Overlays
Header.Tabs.Current.ValueChanged += tab => { if (tab != DirectTab.Search) Filter.Search.Text = string.Empty; }; Header.Tabs.Current.ValueChanged += tab => { if (tab != DirectTab.Search) Filter.Search.Text = string.Empty; };
Filter.Search.Current.ValueChanged += text => { if (text != string.Empty) Header.Tabs.Current.Value = DirectTab.Search; }; Filter.Search.Current.ValueChanged += text => { if (text != string.Empty) Header.Tabs.Current.Value = DirectTab.Search; };
Filter.Search.OnCommit = (sender, text) => updateSets(); Filter.Search.OnCommit = (sender, text) =>
{
lastQuery = Filter.Search.Text;
updateSets();
};
((FilterControl)Filter).Ruleset.ValueChanged += ruleset => updateSets(); ((FilterControl)Filter).Ruleset.ValueChanged += ruleset => updateSets();
Filter.Tabs.Current.ValueChanged += sortCriteria => updateSets(); Filter.Tabs.Current.ValueChanged += sortCriteria => updateSets();
Filter.DisplayStyleControl.DisplayStyle.ValueChanged += recreatePanels; Filter.DisplayStyleControl.DisplayStyle.ValueChanged += recreatePanels;
@ -155,6 +159,7 @@ namespace osu.Game.Overlays
} }
private GetBeatmapSetsRequest getSetsRequest; private GetBeatmapSetsRequest getSetsRequest;
private string lastQuery;
private void updateSets() private void updateSets()
{ {
if (!IsLoaded) return; if (!IsLoaded) return;
@ -164,7 +169,7 @@ namespace osu.Game.Overlays
if (api == null || Filter.Search.Text == string.Empty) return; if (api == null || Filter.Search.Text == string.Empty) return;
getSetsRequest = new GetBeatmapSetsRequest(Filter.Search.Text, getSetsRequest = new GetBeatmapSetsRequest(lastQuery,
((FilterControl)Filter).Ruleset.Value, ((FilterControl)Filter).Ruleset.Value,
Filter.DisplayStyleControl.Dropdown.Current.Value, Filter.DisplayStyleControl.Dropdown.Current.Value,
Filter.Tabs.Current.Value); //todo: sort direction Filter.Tabs.Current.Value); //todo: sort direction