From b41f3f1cad7312708d864269cfb1c587ed2353ca Mon Sep 17 00:00:00 2001 From: voidedWarranties Date: Mon, 23 Mar 2020 22:37:53 -0700 Subject: [PATCH] Fix seeking back to beginning too early --- .../Compose/Components/Timeline/Timeline.cs | 4 +++- osu.Game/Screens/Edit/EditorClock.cs | 21 +++++++++++-------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs index ddca5e42c2..590abf20b4 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs @@ -130,7 +130,9 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline if (!track.IsLoaded) return; - adjustableClock.Seek(Current / Content.DrawWidth * track.Length); + double target = Current / Content.DrawWidth * track.Length; + + adjustableClock.Seek(Math.Min(track.Length, target)); } private void scrollToTrackTime() diff --git a/osu.Game/Screens/Edit/EditorClock.cs b/osu.Game/Screens/Edit/EditorClock.cs index aef304bd6e..b4ab867774 100644 --- a/osu.Game/Screens/Edit/EditorClock.cs +++ b/osu.Game/Screens/Edit/EditorClock.cs @@ -43,18 +43,21 @@ namespace osu.Game.Screens.Edit { base.ProcessFrame(); - var playbackAlreadyStopped = playbackFinished; - playbackFinished = CurrentTime >= TrackLength; - - if (playbackFinished && IsRunning) + if (IsRunning) { - if (!playbackAlreadyStopped) + var playbackAlreadyStopped = playbackFinished; + playbackFinished = CurrentTime >= TrackLength; + + if (playbackFinished) { - Stop(); - Seek(TrackLength); + if (!playbackAlreadyStopped) + { + Stop(); + Seek(TrackLength); + } + else + Seek(0); } - else - Seek(0); } }