mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 16:03:01 +08:00
Add helper methods for seeking/scrolling
This commit is contained in:
parent
6b0eeb3436
commit
a30f72b477
@ -68,12 +68,12 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
|
||||
if (handlingDragInput)
|
||||
{
|
||||
// The user is dragging - the track should always follow the timeline
|
||||
adjustableClock.Seek(Current / Content.DrawWidth * Beatmap.Value.Track.Length);
|
||||
seekTrackToCurrent();
|
||||
}
|
||||
else if (adjustableClock.IsRunning)
|
||||
{
|
||||
// If the user hasn't provided mouse input but the track is running, always follow the track
|
||||
ScrollTo((float)(adjustableClock.CurrentTime / Beatmap.Value.Track.Length) * Content.DrawWidth, false);
|
||||
scrollToTrackTime();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -86,16 +86,19 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
|
||||
if (adjustableClock.CurrentTime == lastTrackTime)
|
||||
{
|
||||
// The track hasn't been seeked externally
|
||||
adjustableClock.Seek(Current / Content.DrawWidth * Beatmap.Value.Track.Length);
|
||||
seekTrackToCurrent();
|
||||
}
|
||||
else
|
||||
{
|
||||
// The track has been seeked externally
|
||||
ScrollTo((float)(adjustableClock.CurrentTime / Beatmap.Value.Track.Length) * Content.DrawWidth, false);
|
||||
scrollToTrackTime();
|
||||
}
|
||||
}
|
||||
|
||||
lastTrackTime = adjustableClock.CurrentTime;
|
||||
|
||||
void seekTrackToCurrent() => adjustableClock.Seek(Current / Content.DrawWidth * Beatmap.Value.Track.Length);
|
||||
void scrollToTrackTime() => ScrollTo((float)(adjustableClock.CurrentTime / Beatmap.Value.Track.Length) * Content.DrawWidth, false);
|
||||
}
|
||||
|
||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||
|
Loading…
Reference in New Issue
Block a user