Ensure correct disabled ruleset callback scheduling in ruleset selector

This commit is contained in:
Bartłomiej Dach 2021-11-27 14:39:12 +01:00
parent f4b7db5a7b
commit db49d99cc0
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497

View File

@ -68,13 +68,19 @@ namespace osu.Game.Overlays.Toolbar
{
base.LoadComplete();
Current.BindDisabledChanged(disabled => this.FadeColour(disabled ? Color4.Gray : Color4.White, 300), true);
Current.BindValueChanged(_ => moveLineToCurrent());
Current.BindDisabledChanged(_ => Scheduler.AddOnce(currentDisabledChanged));
currentDisabledChanged();
Current.BindValueChanged(_ => moveLineToCurrent());
// Scheduled to allow the button flow layout to be computed before the line position is updated
ScheduleAfterChildren(moveLineToCurrent);
}
private void currentDisabledChanged()
{
this.FadeColour(Current.Disabled ? Color4.Gray : Color4.White, 300);
}
private bool hasInitialPosition;
private void moveLineToCurrent()