From 16bc188ba7def10716452e3f8dceb902dca6b0d5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 22 Oct 2024 18:08:17 +0900 Subject: [PATCH] Refactor code to read better (and adjust lenience to match stable) --- osu.Game/Screens/Edit/Editor.cs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index f40c357f9c..6dd7b9726f 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -1098,17 +1098,12 @@ namespace osu.Game.Screens.Edit private void seekControlPoint(int direction) { - // Gives margin to seek back after last control point - double seekMargin = 0; - - if (clock.IsRunning) - { - IAdjustableClock adjustableClock = clock; - seekMargin = 450 * adjustableClock.Rate; - } + // In the case of a backwards seek while playing, it can be hard to jump before a timing point. + // Adding some lenience here makes it more user-friendly. + double seekLenience = clock.IsRunning ? 1000 * ((IAdjustableClock)clock).Rate : 0; - var found = direction < 1 - ? editorBeatmap.ControlPointInfo.AllControlPoints.LastOrDefault(p => p.Time < clock.CurrentTime - seekMargin) + ControlPoint found = direction < 1 + ? editorBeatmap.ControlPointInfo.AllControlPoints.LastOrDefault(p => p.Time < clock.CurrentTime - seekLenience) : editorBeatmap.ControlPointInfo.AllControlPoints.FirstOrDefault(p => p.Time > clock.CurrentTime); if (found != null)