1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 13:32:54 +08:00

Hide multiselection checkbox if everything is filtered

This commit is contained in:
Bartłomiej Dach 2022-02-20 14:14:19 +01:00
parent a83f96b026
commit b690df05de
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497
2 changed files with 11 additions and 0 deletions

View File

@ -116,6 +116,14 @@ namespace osu.Game.Tests.Visual.UserInterface
AddUntilStep("two panels visible", () => column.ChildrenOfType<ModPanel>().Count(panel => !panel.Filtered.Value) == 2);
AddAssert("checkbox selected", () => column.ChildrenOfType<OsuCheckbox>().Single().Current.Value);
AddStep("filter out everything", () => column.Filter = _ => false);
AddUntilStep("no panels visible", () => column.ChildrenOfType<ModPanel>().All(panel => panel.Filtered.Value));
AddUntilStep("checkbox hidden", () => !column.ChildrenOfType<OsuCheckbox>().Single().IsPresent);
AddStep("inset filter", () => column.Filter = null);
AddUntilStep("no panels visible", () => column.ChildrenOfType<ModPanel>().All(panel => !panel.Filtered.Value));
AddUntilStep("checkbox hidden", () => column.ChildrenOfType<OsuCheckbox>().Single().IsPresent);
void clickToggle() => AddStep("click toggle", () =>
{
var checkbox = this.ChildrenOfType<OsuCheckbox>().Single();

View File

@ -278,7 +278,10 @@ namespace osu.Game.Overlays.Mods
private void updateToggleState()
{
if (toggleAllCheckbox != null && !SelectionAnimationRunning)
{
toggleAllCheckbox.Alpha = panelFlow.Any(panel => !panel.Filtered.Value) ? 1 : 0;
toggleAllCheckbox.Current.Value = panelFlow.Where(panel => !panel.Filtered.Value).All(panel => panel.Active.Value);
}
}
/// <summary>