Avoid querying `GetLastObjectTime` twice in editor seek flow

This commit is contained in:
Dean Herbert 2022-12-02 16:07:24 +09:00
parent 809d02cda0
commit a2db0afe19
1 changed files with 7 additions and 3 deletions

View File

@ -537,10 +537,14 @@ protected override bool OnKeyDown(KeyDownEvent e)
// Seek to last object time, or track end if already there.
// Note that in osu-stable subsequent presses when at track end won't return to last object.
// This has intentionally been changed to make it more useful.
if (!editorBeatmap.HitObjects.Any() || clock.CurrentTime == editorBeatmap.GetLastObjectTime())
if (!editorBeatmap.HitObjects.Any())
{
clock.Seek(clock.TrackLength);
else
clock.Seek(editorBeatmap.GetLastObjectTime());
return true;
}
double lastObjectTime = editorBeatmap.GetLastObjectTime();
clock.Seek(clock.CurrentTime == lastObjectTime ? clock.TrackLength : lastObjectTime);
return true;
}