Skip to content

Commit

Permalink
Increase gesture recognition interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
kinarobin committed Mar 19, 2019
1 parent 459961b commit 5ef2ea7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
3 changes: 1 addition & 2 deletions RLImageBrowser/RLImageBrowser.m
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,12 @@ - (void)panGestureRecognized:(UIPanGestureRecognizer *)sender {
} else if (sender.state == UIGestureRecognizerStateChanged) {
CGPoint velocity = [sender velocityInView:self.view];
BOOL startPointValid = !CGPointEqualToPoint(self.gestureInteractionStartPoint, CGPointZero);
BOOL distanceArrive = ABS(currentPoint.x - self.gestureInteractionStartPoint.x) < 3 && ABS(velocity.x) < 500;
BOOL distanceArrive = ABS(velocity.x) < 500;
BOOL upArrive = currentPoint.y - self.gestureInteractionStartPoint.y > 3 && scrollView.contentOffset.y <= 1,
downArrive = currentPoint.y - self.gestureInteractionStartPoint.y < - 3 && scrollView.contentOffset.y + scrollView.bounds.size.height >= MAX(scrollView.contentSize.height, scrollView.bounds.size.height) - 1;
BOOL shouldStart = startPointValid && !_isGestureInteraction && distanceArrive && (upArrive || downArrive);
if (shouldStart) {
self.gestureInteractionStartPoint = currentPoint;

CGRect startFrame = scrollView.frame;
CGFloat anchorX = currentPoint.x / startFrame.size.width,
anchorY = currentPoint.y / startFrame.size.height;
Expand Down
1 change: 0 additions & 1 deletion RLImageBrowser/RLTransitionManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ - (void)animateTransition:(id <UIViewControllerContextTransitioning>)transitionC
CGRect imageViewFrame = [self animationFrameForImage:animatedImage presenting:NO scrollView:scrollView];
self.animateImageView.frame = imageViewFrame;
self.animateImageView.image = animatedImage;
self.animateImageView.clipsToBounds = transitionImageView ? transitionView.clipsToBounds : scrollView.photoImageView.clipsToBounds;
self.animateImageView.layer.cornerRadius = transitionImageView ? transitionImageView.layer.cornerRadius : scrollView.photoImageView.layer.cornerRadius;

[RLNormalWindow() addSubview:self.animateImageView];
Expand Down

0 comments on commit 5ef2ea7

Please sign in to comment.