1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 07:42:57 +08:00

Fix duplicate linq and reword comment

This commit is contained in:
Bartłomiej Dach 2023-06-18 14:03:26 +02:00
parent a1015b4145
commit 64e96c6d82
No known key found for this signature in database

View File

@ -150,10 +150,12 @@ namespace osu.Game.Overlays.Mods
if (toggleAllCheckbox != null && !SelectionAnimationRunning)
{
toggleAllCheckbox.Alpha = availableMods.Any(panel => panel.Visible) ? 1 : 0;
bool anyPanelsVisible = availableMods.Any(panel => panel.Visible);
//Prevent checkbox from checking when column have on valid panels
if (availableMods.Any(panel => panel.Visible))
toggleAllCheckbox.Alpha = anyPanelsVisible ? 1 : 0;
// checking `anyPanelsVisible` is important since `.All()` returns `true` for empty enumerables.
if (anyPanelsVisible)
toggleAllCheckbox.Current.Value = availableMods.Where(panel => panel.Visible).All(panel => panel.Active.Value);
}
}