mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 19:04:06 +08:00
Merge pull request #904 from Tom94/smoothly-moving-tooltips
Make osu tooltips move smoothly
This commit is contained in:
commit
cbd0e8e375
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
@ -24,6 +25,7 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
{
|
{
|
||||||
private readonly Box background;
|
private readonly Box background;
|
||||||
private readonly OsuSpriteText text;
|
private readonly OsuSpriteText text;
|
||||||
|
private bool instantMovement = true;
|
||||||
|
|
||||||
public override string TooltipText
|
public override string TooltipText
|
||||||
{
|
{
|
||||||
@ -32,7 +34,7 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
if (value == text.Text) return;
|
if (value == text.Text) return;
|
||||||
|
|
||||||
text.Text = value;
|
text.Text = value;
|
||||||
if (Alpha > 0)
|
if (IsPresent)
|
||||||
{
|
{
|
||||||
AutoSizeDuration = 250;
|
AutoSizeDuration = 250;
|
||||||
background.FlashColour(OsuColour.Gray(0.4f), 1000, EasingTypes.OutQuint);
|
background.FlashColour(OsuColour.Gray(0.4f), 1000, EasingTypes.OutQuint);
|
||||||
@ -80,6 +82,7 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
|
|
||||||
protected override void PopIn()
|
protected override void PopIn()
|
||||||
{
|
{
|
||||||
|
instantMovement |= !IsPresent;
|
||||||
FadeIn(500, EasingTypes.OutQuint);
|
FadeIn(500, EasingTypes.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,6 +91,19 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
using (BeginDelayedSequence(150))
|
using (BeginDelayedSequence(150))
|
||||||
FadeOut(500, EasingTypes.OutQuint);
|
FadeOut(500, EasingTypes.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Move(Vector2 pos)
|
||||||
|
{
|
||||||
|
if (instantMovement)
|
||||||
|
{
|
||||||
|
Position = pos;
|
||||||
|
instantMovement = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MoveTo(pos, 200, EasingTypes.OutQuint);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user