mirror of
https://github.com/ppy/osu.git
synced 2024-11-15 16:27:43 +08:00
Fix weird mouse position handling and don't return true
to event
This commit is contained in:
parent
b5cc45bdda
commit
6e4eed657c
@ -35,13 +35,13 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
|
|
||||||
private double trackTime => (EndTime - StartTime) * Progress;
|
private double trackTime => (EndTime - StartTime) * Progress;
|
||||||
|
|
||||||
private float relativePositionX;
|
private float lastMouseX;
|
||||||
|
|
||||||
public LocalisableString TooltipText
|
public LocalisableString TooltipText
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
double progress = Math.Clamp(relativePositionX, 0, DrawWidth) / DrawWidth;
|
double progress = Math.Clamp(lastMouseX, 0, DrawWidth) / DrawWidth;
|
||||||
|
|
||||||
TimeSpan currentSpan = TimeSpan.FromMilliseconds(Math.Round((EndTime - StartTime) * progress));
|
TimeSpan currentSpan = TimeSpan.FromMilliseconds(Math.Round((EndTime - StartTime) * progress));
|
||||||
|
|
||||||
@ -107,10 +107,8 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
{
|
{
|
||||||
base.OnMouseMove(e);
|
base.OnMouseMove(e);
|
||||||
|
|
||||||
var cursorPosition = e.ScreenSpaceMousePosition;
|
lastMouseX = e.MousePosition.X;
|
||||||
relativePositionX = ToLocalSpace(cursorPosition).X;
|
return false;
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
|
Loading…
Reference in New Issue
Block a user