Merge pull request #15835 from bdach/off-thread-transforms-unbind

Fix instances of components adding off-thread transforms on unbind
This commit is contained in:
Dean Herbert 2021-11-28 09:27:43 +09:00 committed by GitHub
commit 51a7c60eec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 4 deletions

View File

@ -214,7 +214,8 @@ protected override void LoadComplete()
{
base.LoadComplete();
beatmap.BindDisabledChanged(beatmapDisabledChanged, true);
beatmap.BindDisabledChanged(_ => Scheduler.AddOnce(beatmapDisabledChanged));
beatmapDisabledChanged();
musicController.TrackChanged += trackChanged;
trackChanged(beatmap.Value);
@ -318,8 +319,10 @@ private void trackChanged(WorkingBeatmap beatmap, TrackChangeDirection direction
};
}
private void beatmapDisabledChanged(bool disabled)
private void beatmapDisabledChanged()
{
bool disabled = beatmap.Disabled;
if (disabled)
playlist?.Hide();

View File

@ -68,13 +68,19 @@ protected override void LoadComplete()
{
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()