1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 13:23:22 +08:00

Expose DragBar's seeking property.

This commit is contained in:
Dean Herbert 2017-04-07 15:20:20 +09:00
parent 361e187949
commit 7d2af9310b
No known key found for this signature in database
GPG Key ID: 46D71BF4958ABB49

View File

@ -16,7 +16,8 @@ namespace osu.Game.Overlays
private readonly Box fill;
public Action<float> SeekRequested;
private bool isDragging;
public bool IsSeeking { get; private set; }
private bool enabled = true;
public bool IsEnabled
@ -48,7 +49,7 @@ namespace osu.Game.Overlays
public void UpdatePosition(float position)
{
if (isDragging || !IsEnabled) return;
if (IsSeeking || !IsEnabled) return;
updatePosition(position);
}
@ -64,7 +65,7 @@ namespace osu.Game.Overlays
private void updatePosition(float position)
{
position = MathHelper.Clamp(position, 0, 1);
fill.TransformTo(fill.Width, position, 100, EasingTypes.OutQuint, new TransformWidth());
fill.TransformTo(fill.Width, position, 200, EasingTypes.OutQuint, new TransformSeek());
}
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
@ -79,15 +80,15 @@ namespace osu.Game.Overlays
return true;
}
protected override bool OnDragStart(InputState state) => isDragging = true;
protected override bool OnDragStart(InputState state) => IsSeeking = true;
protected override bool OnDragEnd(InputState state)
{
isDragging = false;
IsSeeking = false;
return true;
}
private class TransformWidth : TransformFloat
private class TransformSeek : TransformFloat
{
public override void Apply(Drawable d)
{