mirror of
https://github.com/ppy/osu.git
synced 2025-01-30 06:12:58 +08:00
Merge pull request #23384 from peppy/fix-incorrect-transform-thread
Fix potentially incorrect thread access in `OsuTabControlCheckbox`
This commit is contained in:
commit
88135a3be8
@ -49,11 +49,10 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
private const float transition_length = 500;
|
private const float transition_length = 500;
|
||||||
private Sample sampleChecked;
|
private Sample sampleChecked;
|
||||||
private Sample sampleUnchecked;
|
private Sample sampleUnchecked;
|
||||||
|
private readonly SpriteIcon icon;
|
||||||
|
|
||||||
public OsuTabControlCheckbox()
|
public OsuTabControlCheckbox()
|
||||||
{
|
{
|
||||||
SpriteIcon icon;
|
|
||||||
|
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
@ -85,14 +84,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Current.ValueChanged += selected =>
|
|
||||||
{
|
|
||||||
icon.Icon = selected.NewValue ? FontAwesome.Regular.CheckCircle : FontAwesome.Regular.Circle;
|
|
||||||
text.Font = text.Font.With(weight: selected.NewValue ? FontWeight.Bold : FontWeight.Medium);
|
|
||||||
|
|
||||||
updateFade();
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -105,6 +96,19 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
sampleUnchecked = audio.Samples.Get(@"UI/check-off");
|
sampleUnchecked = audio.Samples.Get(@"UI/check-off");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
Current.BindValueChanged(selected =>
|
||||||
|
{
|
||||||
|
icon.Icon = selected.NewValue ? FontAwesome.Regular.CheckCircle : FontAwesome.Regular.Circle;
|
||||||
|
text.Font = text.Font.With(weight: selected.NewValue ? FontWeight.Bold : FontWeight.Medium);
|
||||||
|
|
||||||
|
updateFade();
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
{
|
{
|
||||||
updateFade();
|
updateFade();
|
||||||
|
Loading…
Reference in New Issue
Block a user