Ensure graph hover state is updated after data changes

This commit is contained in:
Dean Herbert 2020-11-10 07:27:27 +09:00
parent d7c30f9b42
commit 1548c0dc25

View File

@ -94,13 +94,18 @@ namespace osu.Game.Overlays.Profile.Header.Components
} }
graph.FadeTo(ranks.Length > 1 ? 1 : 0, fade_duration, Easing.Out); graph.FadeTo(ranks.Length > 1 ? 1 : 0, fade_duration, Easing.Out);
if (IsHovered)
graph.UpdateBallPosition(lastHoverPosition);
} }
private float lastHoverPosition;
protected override bool OnHover(HoverEvent e) protected override bool OnHover(HoverEvent e)
{ {
if (ranks?.Length > 1) if (ranks?.Length > 1)
{ {
graph.UpdateBallPosition(e.MousePosition.X); graph.UpdateBallPosition(lastHoverPosition = e.MousePosition.X);
graph.ShowBar(); graph.ShowBar();
} }
@ -116,12 +121,8 @@ namespace osu.Game.Overlays.Profile.Header.Components
} }
protected override void OnHoverLost(HoverLostEvent e) protected override void OnHoverLost(HoverLostEvent e)
{
if (ranks?.Length > 1)
{ {
graph.HideBar(); graph.HideBar();
}
base.OnHoverLost(e); base.OnHoverLost(e);
} }