Simplify and fix incorrect seeking

This commit is contained in:
Dean Herbert 2020-05-22 22:11:55 +09:00
parent 1486a44b55
commit 12d65f305f
1 changed files with 1 additions and 9 deletions

View File

@ -87,15 +87,7 @@ public bool SeekSnapped(double position)
private void seek(int direction, bool snapped, double amount = 1)
{
double current = CurrentTime;
// if a seek transform is active, use its end time instead of the reported current time.
var existingTransform = Transforms.OfType<TransformSeek>().FirstOrDefault();
// but only if the requested direction is in the same direction as the transform.
// this allows quick pivoting rather than resetting the transform for the first opposite direction movement.
if (existingTransform != null && Math.Sign(existingTransform.EndValue - current) == Math.Sign(direction))
current = existingTransform.EndValue;
double current = CurrentTimeAccurate;
if (amount <= 0) throw new ArgumentException("Value should be greater than zero", nameof(amount));