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

Merge pull request #12908 from Joehuu/fix-waveform-setting-checkmark

Fix checkmark being hidden after clicking current waveform opacity setting
This commit is contained in:
Dean Herbert 2021-05-23 16:51:50 +09:00 committed by GitHub
commit d0d90d77c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,7 +12,7 @@ namespace osu.Game.Screens.Edit
{
private readonly Bindable<float> waveformOpacity;
private readonly Dictionary<float, ToggleMenuItem> menuItemLookup = new Dictionary<float, ToggleMenuItem>();
private readonly Dictionary<float, TernaryStateRadioMenuItem> menuItemLookup = new Dictionary<float, TernaryStateRadioMenuItem>();
public WaveformOpacityMenuItem(Bindable<float> waveformOpacity)
: base("Waveform opacity")
@ -29,13 +29,13 @@ namespace osu.Game.Screens.Edit
waveformOpacity.BindValueChanged(opacity =>
{
foreach (var kvp in menuItemLookup)
kvp.Value.State.Value = kvp.Key == opacity.NewValue;
kvp.Value.State.Value = kvp.Key == opacity.NewValue ? TernaryState.True : TernaryState.False;
}, true);
}
private ToggleMenuItem createMenuItem(float opacity)
private TernaryStateRadioMenuItem createMenuItem(float opacity)
{
var item = new ToggleMenuItem($"{opacity * 100}%", MenuItemType.Standard, _ => updateOpacity(opacity));
var item = new TernaryStateRadioMenuItem($"{opacity * 100}%", MenuItemType.Standard, _ => updateOpacity(opacity));
menuItemLookup[opacity] = item;
return item;
}