mirror of
https://github.com/osukey/osukey.git
synced 2025-06-30 07:38:04 +09:00
Seek by clicking and dragging on progress bar.
This commit is contained in:
parent
d9fc04748e
commit
fead1d4c6f
@ -247,6 +247,28 @@ namespace osu.Game.Overlays
|
|||||||
return scaledSprite;
|
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
|
//placeholder for toggling
|
||||||
protected override void PopIn() => FadeIn(500);
|
protected override void PopIn() => FadeIn(500);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user