Commit b4b8703c authored by Tobias's avatar Tobias

snap scrubbing marker to playback marker if scrubbing position is near to playback position

parent fea04edd
......@@ -172,11 +172,24 @@
const CGFloat scaleFactor = 8.0;
CGFloat fractionInView = translation.x/CGRectGetWidth(view.bounds)/scaleFactor;
translation.x = 0.0;
[panGestureRecognizer setTranslation:translation inView:view];
CGFloat scrubbingFraction = MAX(0.0, MIN(bar.scrubbingFraction + fractionInView,1.0));
bar.scrubbingFraction = scrubbingFraction;
if (ABS(scrubbingFraction - bar.playbackFraction)<0.01) {
scrubbingFraction = bar.playbackFraction;
} else {
translation.x = 0.0;
[panGestureRecognizer setTranslation:translation inView:view];
}
[UIView animateWithDuration:0.3
delay:0.0
options:UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionBeginFromCurrentState
animations:^{
bar.scrubbingFraction = scrubbingFraction;
}
completion:nil];
[self updateTimeLabelsForScrubbingFraction:scrubbingFraction];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment