mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 00:09:55 +09:00
Expose DragBar's seeking property.
This commit is contained in:
@ -16,7 +16,8 @@ namespace osu.Game.Overlays
|
|||||||
private readonly Box fill;
|
private readonly Box fill;
|
||||||
|
|
||||||
public Action<float> SeekRequested;
|
public Action<float> SeekRequested;
|
||||||
private bool isDragging;
|
|
||||||
|
public bool IsSeeking { get; private set; }
|
||||||
|
|
||||||
private bool enabled = true;
|
private bool enabled = true;
|
||||||
public bool IsEnabled
|
public bool IsEnabled
|
||||||
@ -48,7 +49,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
public void UpdatePosition(float position)
|
public void UpdatePosition(float position)
|
||||||
{
|
{
|
||||||
if (isDragging || !IsEnabled) return;
|
if (IsSeeking || !IsEnabled) return;
|
||||||
|
|
||||||
updatePosition(position);
|
updatePosition(position);
|
||||||
}
|
}
|
||||||
@ -64,7 +65,7 @@ namespace osu.Game.Overlays
|
|||||||
private void updatePosition(float position)
|
private void updatePosition(float position)
|
||||||
{
|
{
|
||||||
position = MathHelper.Clamp(position, 0, 1);
|
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)
|
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||||
@ -79,15 +80,15 @@ namespace osu.Game.Overlays
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnDragStart(InputState state) => isDragging = true;
|
protected override bool OnDragStart(InputState state) => IsSeeking = true;
|
||||||
|
|
||||||
protected override bool OnDragEnd(InputState state)
|
protected override bool OnDragEnd(InputState state)
|
||||||
{
|
{
|
||||||
isDragging = false;
|
IsSeeking = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TransformWidth : TransformFloat
|
private class TransformSeek : TransformFloat
|
||||||
{
|
{
|
||||||
public override void Apply(Drawable d)
|
public override void Apply(Drawable d)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user