1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-16 23:42:54 +08:00

Refactor code to read better (and adjust lenience to match stable)

This commit is contained in:
Dean Herbert 2024-10-22 18:08:17 +09:00
parent 5fe074a0f9
commit 16bc188ba7
No known key found for this signature in database

View File

@ -1098,17 +1098,12 @@ namespace osu.Game.Screens.Edit
private void seekControlPoint(int direction) private void seekControlPoint(int direction)
{ {
// Gives margin to seek back after last control point // In the case of a backwards seek while playing, it can be hard to jump before a timing point.
double seekMargin = 0; // Adding some lenience here makes it more user-friendly.
double seekLenience = clock.IsRunning ? 1000 * ((IAdjustableClock)clock).Rate : 0;
if (clock.IsRunning) ControlPoint found = direction < 1
{ ? editorBeatmap.ControlPointInfo.AllControlPoints.LastOrDefault(p => p.Time < clock.CurrentTime - seekLenience)
IAdjustableClock adjustableClock = clock;
seekMargin = 450 * adjustableClock.Rate;
}
var found = direction < 1
? editorBeatmap.ControlPointInfo.AllControlPoints.LastOrDefault(p => p.Time < clock.CurrentTime - seekMargin)
: editorBeatmap.ControlPointInfo.AllControlPoints.FirstOrDefault(p => p.Time > clock.CurrentTime); : editorBeatmap.ControlPointInfo.AllControlPoints.FirstOrDefault(p => p.Time > clock.CurrentTime);
if (found != null) if (found != null)