Fix the issue

When Enabled's value has been changed to true, it will now check if it is currently howered, and if yes, it will fade in correctly.
This commit is contained in:
Arphox 2019-06-04 21:30:49 +02:00
parent e9c4b521af
commit 5f4d7437bc
1 changed files with 11 additions and 2 deletions

View File

@ -24,6 +24,9 @@ public OsuHoverContainer()
{ {
Enabled.ValueChanged += e => Enabled.ValueChanged += e =>
{ {
if (e.NewValue && isHovered)
fadeIn();
if (!e.NewValue) if (!e.NewValue)
unhover(); unhover();
}; };
@ -33,11 +36,12 @@ public OsuHoverContainer()
protected override bool OnHover(HoverEvent e) protected override bool OnHover(HoverEvent e)
{ {
isHovered = true;
if (!Enabled.Value) if (!Enabled.Value)
return false; return false;
EffectTargets.ForEach(d => d.FadeColour(HoverColour, FADE_DURATION, Easing.OutQuint)); fadeIn();
isHovered = true;
return base.OnHover(e); return base.OnHover(e);
} }
@ -69,5 +73,10 @@ protected override void LoadComplete()
base.LoadComplete(); base.LoadComplete();
EffectTargets.ForEach(d => d.FadeColour(IdleColour)); EffectTargets.ForEach(d => d.FadeColour(IdleColour));
} }
private void fadeIn()
{
EffectTargets.ForEach(d => d.FadeColour(Color4.Black, FADE_DURATION * 10, Easing.OutQuint));
}
} }
} }