mirror of
https://github.com/ppy/osu.git
synced 2024-12-16 21:02:55 +08:00
Refactor code to read better (and adjust lenience to match stable)
This commit is contained in:
parent
5fe074a0f9
commit
16bc188ba7
@ -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;
|
||||
// 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;
|
||||
|
||||
if (clock.IsRunning)
|
||||
{
|
||||
IAdjustableClock adjustableClock = clock;
|
||||
seekMargin = 450 * adjustableClock.Rate;
|
||||
}
|
||||
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user