Skip to content

Commit

Permalink
Reuse function TimeAtPosition() and PositionAtTime().
Browse files Browse the repository at this point in the history
  • Loading branch information
andy840119 committed Oct 30, 2022
1 parent 933d1d5 commit a753369
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ protected override void UpdateAfterChildren()

private void seekTrackToCurrent()
{
double target = Current / Content.DrawWidth * editorClock.TrackLength;
double target = TimeAtPosition(Current);
editorClock.Seek(Math.Min(editorClock.TrackLength, target));
}

Expand All @@ -264,7 +264,8 @@ private void scrollToTrackTime()
if (handlingDragInput)
editorClock.Stop();

ScrollTo((float)(editorClock.CurrentTime / editorClock.TrackLength) * Content.DrawWidth, false);
float position = PositionAtTime(editorClock.CurrentTime);
ScrollTo(position, false);
}

protected override bool OnMouseDown(MouseDownEvent e)
Expand Down

0 comments on commit a753369

Please sign in to comment.