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:
parent
5fe074a0f9
commit
16bc188ba7
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user