1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-19 17:03:02 +08:00

fix addition bank toggle can be switched off with selection

This commit is contained in:
OliBomby 2024-07-16 11:30:52 +02:00
parent e5bc359b88
commit ba501a8eb8

View File

@ -150,9 +150,23 @@ namespace osu.Game.Screens.Edit.Compose.Components
if (SelectionAdditionBankStates.Values.All(b => b.Value == TernaryState.False))
bindable.Value = TernaryState.True;
}
else
{
// Auto should never apply when there is a selection made.
if (bankName == HIT_BANK_AUTO)
break;
// Completely empty selections should be allowed in the case that none of the selected objects have any addition samples.
// This is also required to stop a bindable feedback loop when a HitObject has zero addition samples (and LINQ `All` below becomes true).
if (SelectedItems.SelectMany(enumerateAllSamples).All(h => h.All(o => o.Name == HitSampleInfo.HIT_NORMAL)))
break;
// Never remove a sample bank.
// These are basically radio buttons, not toggles.
if (SelectedItems.SelectMany(enumerateAllSamples).All(h => h.Where(o => o.Name != HitSampleInfo.HIT_NORMAL).All(s => s.Bank == bankName)))
bindable.Value = TernaryState.True;
}
break;
case TernaryState.True: