Compare commits
No commits in common. "83d4af2303a7e7f760bb53537acb25e82e4f2f20" and "e61823b78fef150c73eba27cfa0b5ef55231e798" have entirely different histories.
83d4af2303
...
e61823b78f
|
@ -29,8 +29,7 @@ class LargeImageInteractionController: UIPercentDrivenInteractiveTransition {
|
||||||
var progress = translation.y / 200
|
var progress = translation.y / 200
|
||||||
if let direction = direction {
|
if let direction = direction {
|
||||||
progress *= direction
|
progress *= direction
|
||||||
} else if abs(progress) > 0.01 {
|
} else {
|
||||||
// if the progress is less than +/- 1%, don't set the direction because the translation may be random jitter in the user's finger
|
|
||||||
direction = progress > 0 ? 1 : -1
|
direction = progress > 0 ? 1 : -1
|
||||||
progress = abs(progress)
|
progress = abs(progress)
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,12 +68,6 @@ class LargeImageShrinkAnimationController: NSObject, UIViewControllerAnimatedTra
|
||||||
blackView.backgroundColor = .black
|
blackView.backgroundColor = .black
|
||||||
blackView.alpha = 1
|
blackView.alpha = 1
|
||||||
|
|
||||||
// Save the old superview of toVC so we can move it back after the animation.
|
|
||||||
// It would be better to just not move toVC and instead remove from fromVC from the
|
|
||||||
// containerView so that toVC is visible behind it, but that doens't work for some reason
|
|
||||||
// (the entire screen just goes black, not even the contents of the containerView appear).
|
|
||||||
let oldSuperview = toVC.view.superview
|
|
||||||
|
|
||||||
containerView.addSubview(toVC.view)
|
containerView.addSubview(toVC.view)
|
||||||
containerView.addSubview(blackView)
|
containerView.addSubview(blackView)
|
||||||
containerView.addSubview(imageView)
|
containerView.addSubview(imageView)
|
||||||
|
@ -94,9 +88,6 @@ class LargeImageShrinkAnimationController: NSObject, UIViewControllerAnimatedTra
|
||||||
sourceView.alpha = 1
|
sourceView.alpha = 1
|
||||||
|
|
||||||
transitionContext.completeTransition(!transitionContext.transitionWasCancelled)
|
transitionContext.completeTransition(!transitionContext.transitionWasCancelled)
|
||||||
|
|
||||||
// move the toVC back to the view that it was in before
|
|
||||||
oldSuperview?.addSubview(toVC.view)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue