Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: Avoid dragging downwards or upwards to close the image(especiall…
…y for the portrait image) when enlarge it to preview.
  • Loading branch information
janlionly committed May 27, 2021
commit 150e657f5cfa0488b260b615d237ee3d7e191534
4 changes: 3 additions & 1 deletion BFRImageViewController/BFRImageContainerViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ - (void)handleHiResImageDownloaded:(NSNotification *)note {
// If we have more than one image, this will cancel out dragging horizontally to make it easy to navigate between images
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer {
CGPoint velocity = [(UIPanGestureRecognizer *)gestureRecognizer velocityInView:self.scrollView];
if (self.scrollView.zoomScale > 1) {
return NO;
}
return fabs(velocity.y) > fabs(velocity.x);
}

Expand Down Expand Up @@ -370,7 +373,6 @@ - (void)handleDrag:(UIPanGestureRecognizer *)recognizer {
[self.animator removeAllBehaviors];
self.activeAssetView.userInteractionEnabled = NO;
self.scrollView.userInteractionEnabled = NO;

UIGravityBehavior *exitGravity = [[UIGravityBehavior alloc] initWithItems:@[self.activeAssetView]];
if (CGRectContainsPoint(closeTopThreshhold, location)) {
exitGravity.gravityDirection = CGVectorMake(0.0, -1.0);
Expand Down