1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 14:17:26 +08:00

Seek by clicking and dragging on progress bar.

This commit is contained in:
Huo Yaoyuan 2016-10-25 09:18:47 +08:00
parent d9fc04748e
commit fead1d4c6f

View File

@ -247,6 +247,28 @@ namespace osu.Game.Overlays
return scaledSprite;
}
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
{
trySeek(state);
return base.OnMouseDown(state, args);
}
protected override bool OnMouseMove(InputState state)
{
trySeek(state);
return base.OnMouseMove(state);
}
private void trySeek(InputState state)
{
if (state.Mouse.LeftButton)
{
Vector2 pos = GetLocalPosition(state.Mouse.NativeState.Position);
if (pos.Y > 120)
CurrentTrack?.Seek(CurrentTrack.Length * pos.X / 400f);
}
}
//placeholder for toggling
protected override void PopIn() => FadeIn(500);