1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 17:32:54 +08:00

Fix the timeline and editor fighting over track seeking

This commit is contained in:
smoogipoo 2018-06-18 18:02:26 +09:00
parent 01b909eaa7
commit dbc50e35d5

View File

@ -62,9 +62,9 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
} }
/// <summary> /// <summary>
/// The track's time in the previous frame. /// The timeline's last scroll position.
/// </summary> /// </summary>
private double lastTrackTime; private double lastScrollPosition;
/// <summary> /// <summary>
/// Whether the user is currently dragging the timeline. /// Whether the user is currently dragging the timeline.
@ -100,20 +100,20 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
// 1) The user scrolls on this timeline: We want the track to follow us // 1) The user scrolls on this timeline: We want the track to follow us
// 2) The user changes the track time through some other means (scrolling in the editor or overview timeline): We want to follow the track time // 2) The user changes the track time through some other means (scrolling in the editor or overview timeline): We want to follow the track time
// The simplest way to cover both cases is by checking that inter-frame track times are identical // The simplest way to cover both cases is by checking whether the inter-frame timeline positions are identical
if (adjustableClock.CurrentTime == lastTrackTime) if (Current != lastScrollPosition)
{ {
// The track hasn't been seeked externally // The timeline has moved, seek the track
seekTrackToCurrent(); seekTrackToCurrent();
} }
else else
{ {
// The track has been seeked externally // The timeline hasn't moved, scroll to the track time
scrollToTrackTime(); scrollToTrackTime();
} }
} }
lastTrackTime = adjustableClock.CurrentTime; lastScrollPosition = Current;
void seekTrackToCurrent() void seekTrackToCurrent()
{ {