mirror of https://github.com/ppy/osu
Fix initally-disabled OsuAnimatedButton colour fading
This commit is contained in:
parent
03d159d723
commit
c8073000c5
|
@ -38,6 +38,9 @@ protected Color4 HoverColour
|
|||
}
|
||||
}
|
||||
|
||||
[Resolved]
|
||||
private OsuColour colours { get; set; }
|
||||
|
||||
protected override Container<Drawable> Content => content;
|
||||
|
||||
private readonly Container content;
|
||||
|
@ -73,17 +76,25 @@ public OsuAnimatedButton()
|
|||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
private void load()
|
||||
{
|
||||
if (AutoSizeAxes != Axes.None)
|
||||
{
|
||||
content.RelativeSizeAxes = (Axes.Both & ~AutoSizeAxes);
|
||||
content.AutoSizeAxes = AutoSizeAxes;
|
||||
}
|
||||
|
||||
Enabled.BindValueChanged(enabled => this.FadeColour(enabled.NewValue ? Color4.White : colours.Gray9, 200, Easing.OutQuint), true);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
Colour = enablementColour;
|
||||
Enabled.BindValueChanged(_ => this.FadeColour(enablementColour, 200, Easing.OutQuint));
|
||||
}
|
||||
|
||||
private Color4 enablementColour => Enabled.Value ? Color4.White : colours.Gray9;
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
{
|
||||
hover.FadeIn(500, Easing.OutQuint);
|
||||
|
|
Loading…
Reference in New Issue