Debounce state application events

This commit is contained in:
Dean Herbert
2020-10-12 18:13:25 +09:00
parent ca1f5dcada
commit 954d43ef56

View File

@ -125,15 +125,15 @@ namespace osu.Game.Screens.Select.Carousel
if (item == null) if (item == null)
return; return;
ApplyState(); Scheduler.AddOnce(ApplyState);
Item.Filtered.ValueChanged += onStateChange; Item.Filtered.ValueChanged += onStateChange;
Item.State.ValueChanged += onStateChange; Item.State.ValueChanged += onStateChange;
} }
private void onStateChange(ValueChangedEvent<CarouselItemState> obj) => Schedule(ApplyState); private void onStateChange(ValueChangedEvent<CarouselItemState> obj) => Scheduler.AddOnce(ApplyState);
private void onStateChange(ValueChangedEvent<bool> _) => Schedule(ApplyState); private void onStateChange(ValueChangedEvent<bool> _) => Scheduler.AddOnce(ApplyState);
protected virtual void ApplyState() protected virtual void ApplyState()
{ {