Skip to content

Commit

Permalink
Enables swiping-to-dismiss also from bottom to top
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleš Kocur committed Apr 17, 2016
1 parent d9616a6 commit 944445b
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions Pod/Classes/Core/ZoomAnimatedTransitioning.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class ZoomAnimatedTransitioningDelegate: NSObject, UIViewControllerTransi
}

func handleSwipe(gesture: UIPanGestureRecognizer) {
let percent = min(max(gesture.translationInView(gesture.view!).y / 200.0, 0.0), 1.0)
let percent = min(max(fabs(gesture.translationInView(gesture.view!).y) / 200.0, 0.0), 1.0)

if gesture.state == .Began {
interactionController = UIPercentDrivenInteractiveTransition()
Expand Down Expand Up @@ -88,12 +88,6 @@ extension ZoomAnimatedTransitioningDelegate: UIGestureRecognizerDelegate {
return false
}

let translation = panGestureRecognizer.translationInView(panGestureRecognizer.view!).y
// If panning from bottom to top transition must not begin
if translation < 0 {
return false
}

// Also when panning horizontally
let velocity = panGestureRecognizer.velocityInView(self.referenceSlideshowView)
return fabs(velocity.y) > fabs(velocity.x);
Expand Down

0 comments on commit 944445b

Please sign in to comment.