From a884ac215ec194a250b0ed7db3738f004787322d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Apr 2017 16:08:36 +0900 Subject: [PATCH] Position tooltip better; remove need for lastState. --- osu.Game/Graphics/Cursor/TooltipContainer.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/osu.Game/Graphics/Cursor/TooltipContainer.cs b/osu.Game/Graphics/Cursor/TooltipContainer.cs index 59cd06c7f5..cf68baa313 100644 --- a/osu.Game/Graphics/Cursor/TooltipContainer.cs +++ b/osu.Game/Graphics/Cursor/TooltipContainer.cs @@ -30,8 +30,6 @@ namespace osu.Game.Graphics.Cursor private IHasTooltip currentlyDisplayed; - private IMouseState lastState; - public TooltipContainer(CursorContainer cursor) { this.cursor = cursor; @@ -48,21 +46,18 @@ namespace osu.Game.Graphics.Cursor protected override void Update() { - if (tooltip.IsPresent && lastState != null) + if (tooltip.IsPresent) { if (currentlyDisplayed != null) tooltip.TooltipText = currentlyDisplayed.TooltipText; //update the position of the displayed tooltip. - tooltip.Position = new Vector2( - lastState.Position.X, - Math.Min(cursor.ActiveCursor.BoundingBox.Bottom, lastState.Position.Y + cursor.ActiveCursor.DrawHeight)); + tooltip.Position = ToLocalSpace(cursor.ActiveCursor.ScreenSpaceDrawQuad.Centre) + new Vector2(10); } } protected override bool OnMouseMove(InputState state) { - lastState = state.Mouse; if (currentlyDisplayed?.Hovering != true) {