1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 06:47:24 +08:00

Rename and add xmldoc for smooth seeking method

This commit is contained in:
Dean Herbert 2021-01-15 16:14:21 +09:00
parent 40f020c683
commit 04fa32bc34
5 changed files with 24 additions and 17 deletions

View File

@ -332,7 +332,7 @@ namespace osu.Game.Rulesets.Edit
EditorBeatmap.Add(hitObject);
if (EditorClock.CurrentTime < hitObject.StartTime)
EditorClock.SeekTo(hitObject.StartTime);
EditorClock.SeekSmoothlyTo(hitObject.StartTime);
}
}

View File

@ -58,7 +58,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
return;
float markerPos = Math.Clamp(ToLocalSpace(screenPosition).X, 0, DrawWidth);
editorClock.SeekTo(markerPos / DrawWidth * editorClock.TrackLength);
editorClock.SeekSmoothlyTo(markerPos / DrawWidth * editorClock.TrackLength);
});
}

View File

@ -170,7 +170,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
if (clickedBlueprint == null || SelectionHandler.SelectedBlueprints.FirstOrDefault(b => b.IsHovered) != clickedBlueprint)
return false;
EditorClock?.SeekTo(clickedBlueprint.HitObject.StartTime);
EditorClock?.SeekSmoothlyTo(clickedBlueprint.HitObject.StartTime);
return true;
}

View File

@ -111,7 +111,7 @@ namespace osu.Game.Screens.Edit
if (!snapped || ControlPointInfo.TimingPoints.Count == 0)
{
SeekTo(seekTime);
SeekSmoothlyTo(seekTime);
return;
}
@ -145,11 +145,11 @@ namespace osu.Game.Screens.Edit
// Ensure the sought point is within the boundaries
seekTime = Math.Clamp(seekTime, 0, TrackLength);
SeekTo(seekTime);
SeekSmoothlyTo(seekTime);
}
/// <summary>
/// The current time of this clock, include any active transform seeks performed via <see cref="SeekTo"/>.
/// The current time of this clock, include any active transform seeks performed via <see cref="SeekSmoothlyTo"/>.
/// </summary>
public double CurrentTimeAccurate =>
Transforms.OfType<TransformSeek>().FirstOrDefault()?.EndValue ?? CurrentTime;
@ -182,6 +182,23 @@ namespace osu.Game.Screens.Edit
return underlyingClock.Seek(position);
}
/// <summary>
/// Seek smoothly to the provided destination.
/// Use <see cref="Seek"/> to perform an immediate seek.
/// </summary>
/// <param name="seekDestination"></param>
public void SeekSmoothlyTo(double seekDestination)
{
seekingOrStopped.Value = true;
if (IsRunning)
Seek(seekDestination);
else
{
transformSeekTo(seekDestination, transform_time, Easing.OutQuint);
}
}
public void ResetSpeedAdjustments() => underlyingClock.ResetSpeedAdjustments();
double IAdjustableClock.Rate
@ -243,16 +260,6 @@ namespace osu.Game.Screens.Edit
}
}
public void SeekTo(double seekDestination)
{
seekingOrStopped.Value = true;
if (IsRunning)
Seek(seekDestination);
else
transformSeekTo(seekDestination, transform_time, Easing.OutQuint);
}
private void transformSeekTo(double seek, double duration = 0, Easing easing = Easing.None)
=> this.TransformTo(this.PopulateTransform(new TransformSeek(), seek, duration, easing));

View File

@ -206,7 +206,7 @@ namespace osu.Game.Screens.Edit.Timing
Action = () =>
{
selectedGroup.Value = controlGroup;
clock.SeekTo(controlGroup.Time);
clock.SeekSmoothlyTo(controlGroup.Time);
};
}