mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-31 13:35:58 +00:00
iOS: fixed #769 (Safari swipe to dismiss)
Now uses a linear animation curve when tracking the gesture, so it follows the finger, and an ease in/out curve and the same speed as other animations when not.
This commit is contained in:
parent
49149d75e6
commit
6232df3bfa
2 changed files with 6 additions and 4 deletions
|
@ -22,7 +22,7 @@
|
|||
}
|
||||
|
||||
- (CGFloat)transitionDuration:(id <UIViewControllerContextTransitioning>)transitionContext {
|
||||
return 0.75;
|
||||
return 0.35;
|
||||
}
|
||||
|
||||
- (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext {
|
||||
|
@ -56,7 +56,7 @@
|
|||
shadowView.transform = self.dismissing ? CGAffineTransformMakeScale(0.01, 1.0) : CGAffineTransformIdentity;
|
||||
shadowView.alpha = self.dismissing ? 1.0 : 0.0;
|
||||
|
||||
[UIView animateWithDuration:[self transitionDuration:transitionContext] delay:0.0 usingSpringWithDamping:0.9 initialSpringVelocity:1.0 options:self.animationOpts animations:^{
|
||||
[UIView animateWithDuration:[self transitionDuration:transitionContext] delay:0.0 options:[self animationOpts] animations:^{
|
||||
topView.transform = self.dismissing ? CGAffineTransformMakeTranslation(offset, 0.0) : CGAffineTransformIdentity;
|
||||
shadowView.transform = self.dismissing ? CGAffineTransformIdentity : CGAffineTransformMakeScale(0.01, 1.0);
|
||||
shadowView.alpha = self.dismissing ? 0.0 : 1.0;
|
||||
|
@ -68,7 +68,9 @@
|
|||
}
|
||||
|
||||
- (UIViewAnimationOptions)animationOpts {
|
||||
return UIViewAnimationOptionAllowAnimatedContent | UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionLayoutSubviews;
|
||||
UIViewAnimationOptions opts = self.percentageDriven ? UIViewAnimationOptionCurveLinear : UIViewAnimationOptionCurveEaseInOut;
|
||||
|
||||
return opts | UIViewAnimationOptionAllowAnimatedContent | UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionLayoutSubviews;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -1371,7 +1371,7 @@
|
|||
|
||||
- (void)handleGesture:(UIScreenEdgePanGestureRecognizer *)recognizer {
|
||||
self.safariAnimator.percentageDriven = YES;
|
||||
CGFloat percentComplete = [recognizer locationInView:self.view].x / self.view.bounds.size.width / 2.0;
|
||||
CGFloat percentComplete = [recognizer locationInView:self.view].x / self.view.bounds.size.width;
|
||||
|
||||
switch (recognizer.state) {
|
||||
case UIGestureRecognizerStateBegan:
|
||||
|
|
Loading…
Add table
Reference in a new issue