Merge pull request #21018 from andy840119/reuse-the-function-in-timeline-class

Reuse function in the timeline class
This commit is contained in:
Dean Herbert 2022-10-30 23:49:02 +09:00 committed by GitHub
commit 9ea2bd84bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -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));
}
@ -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)