1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 06:35:05 +08:00

Use OnCommit instead of OnChange simplifies things

This commit is contained in:
Drew DeVault 2017-01-31 19:48:33 -05:00
parent f740707712
commit b1a55f6b5e
2 changed files with 5 additions and 5 deletions

View File

@ -51,7 +51,11 @@ namespace osu.Game.Screens.Select
}
};
searchTextBox.OnChange += (sender, text) => FilterChanged?.Invoke();
searchTextBox.OnCommit += (sender, newText) =>
{
if (newText)
FilterChanged?.Invoke();
};
searchTextBox.Exit = () => Exit?.Invoke();
}

View File

@ -189,13 +189,9 @@ namespace osu.Game.Screens.Select
}
private ScheduledDelegate filterTask;
private string previousFilter = string.Empty;
private void filterChanged()
{
if (previousFilter == filter.Search)
return;
previousFilter = filter.Search;
filterTask?.Cancel();
filterTask = Scheduler.AddDelayed(() =>
{