From 5f4d7437bcdafc03434d62446683b5d1692940ae Mon Sep 17 00:00:00 2001 From: Arphox Date: Tue, 4 Jun 2019 21:30:49 +0200 Subject: [PATCH] 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. --- osu.Game/Graphics/Containers/OsuHoverContainer.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/Containers/OsuHoverContainer.cs b/osu.Game/Graphics/Containers/OsuHoverContainer.cs index eb2d926424..d7dcd5b699 100644 --- a/osu.Game/Graphics/Containers/OsuHoverContainer.cs +++ b/osu.Game/Graphics/Containers/OsuHoverContainer.cs @@ -24,6 +24,9 @@ namespace osu.Game.Graphics.Containers { Enabled.ValueChanged += e => { + if (e.NewValue && isHovered) + fadeIn(); + if (!e.NewValue) unhover(); }; @@ -33,11 +36,12 @@ namespace osu.Game.Graphics.Containers protected override bool OnHover(HoverEvent e) { + isHovered = true; + if (!Enabled.Value) return false; - EffectTargets.ForEach(d => d.FadeColour(HoverColour, FADE_DURATION, Easing.OutQuint)); - isHovered = true; + fadeIn(); return base.OnHover(e); } @@ -69,5 +73,10 @@ namespace osu.Game.Graphics.Containers base.LoadComplete(); EffectTargets.ForEach(d => d.FadeColour(IdleColour)); } + + private void fadeIn() + { + EffectTargets.ForEach(d => d.FadeColour(Color4.Black, FADE_DURATION * 10, Easing.OutQuint)); + } } }