mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 07:42:55 +08:00
Rename and add xmldoc for smooth seeking method
This commit is contained in:
parent
40f020c683
commit
04fa32bc34
@ -332,7 +332,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
EditorBeatmap.Add(hitObject);
|
EditorBeatmap.Add(hitObject);
|
||||||
|
|
||||||
if (EditorClock.CurrentTime < hitObject.StartTime)
|
if (EditorClock.CurrentTime < hitObject.StartTime)
|
||||||
EditorClock.SeekTo(hitObject.StartTime);
|
EditorClock.SeekSmoothlyTo(hitObject.StartTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
float markerPos = Math.Clamp(ToLocalSpace(screenPosition).X, 0, DrawWidth);
|
float markerPos = Math.Clamp(ToLocalSpace(screenPosition).X, 0, DrawWidth);
|
||||||
editorClock.SeekTo(markerPos / DrawWidth * editorClock.TrackLength);
|
editorClock.SeekSmoothlyTo(markerPos / DrawWidth * editorClock.TrackLength);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
if (clickedBlueprint == null || SelectionHandler.SelectedBlueprints.FirstOrDefault(b => b.IsHovered) != clickedBlueprint)
|
if (clickedBlueprint == null || SelectionHandler.SelectedBlueprints.FirstOrDefault(b => b.IsHovered) != clickedBlueprint)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
EditorClock?.SeekTo(clickedBlueprint.HitObject.StartTime);
|
EditorClock?.SeekSmoothlyTo(clickedBlueprint.HitObject.StartTime);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
|
|
||||||
if (!snapped || ControlPointInfo.TimingPoints.Count == 0)
|
if (!snapped || ControlPointInfo.TimingPoints.Count == 0)
|
||||||
{
|
{
|
||||||
SeekTo(seekTime);
|
SeekSmoothlyTo(seekTime);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,11 +145,11 @@ namespace osu.Game.Screens.Edit
|
|||||||
|
|
||||||
// Ensure the sought point is within the boundaries
|
// Ensure the sought point is within the boundaries
|
||||||
seekTime = Math.Clamp(seekTime, 0, TrackLength);
|
seekTime = Math.Clamp(seekTime, 0, TrackLength);
|
||||||
SeekTo(seekTime);
|
SeekSmoothlyTo(seekTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
public double CurrentTimeAccurate =>
|
public double CurrentTimeAccurate =>
|
||||||
Transforms.OfType<TransformSeek>().FirstOrDefault()?.EndValue ?? CurrentTime;
|
Transforms.OfType<TransformSeek>().FirstOrDefault()?.EndValue ?? CurrentTime;
|
||||||
@ -182,6 +182,23 @@ namespace osu.Game.Screens.Edit
|
|||||||
return underlyingClock.Seek(position);
|
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();
|
public void ResetSpeedAdjustments() => underlyingClock.ResetSpeedAdjustments();
|
||||||
|
|
||||||
double IAdjustableClock.Rate
|
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)
|
private void transformSeekTo(double seek, double duration = 0, Easing easing = Easing.None)
|
||||||
=> this.TransformTo(this.PopulateTransform(new TransformSeek(), seek, duration, easing));
|
=> this.TransformTo(this.PopulateTransform(new TransformSeek(), seek, duration, easing));
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ namespace osu.Game.Screens.Edit.Timing
|
|||||||
Action = () =>
|
Action = () =>
|
||||||
{
|
{
|
||||||
selectedGroup.Value = controlGroup;
|
selectedGroup.Value = controlGroup;
|
||||||
clock.SeekTo(controlGroup.Time);
|
clock.SeekSmoothlyTo(controlGroup.Time);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user