Skip to content

Commit

Permalink
FIX: images w/width same as screen shifted to bottom of view on doubl…
Browse files Browse the repository at this point in the history
…e tap
  • Loading branch information
u10int committed Oct 4, 2014
1 parent 970d7e1 commit 0bbb818
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions URBMediaFocusViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -736,12 +736,14 @@ - (void)handleDoubleTapGesture:(UITapGestureRecognizer *)gestureRecognizer {
else {
CGPoint tapPoint = [self.imageView convertPoint:[gestureRecognizer locationInView:gestureRecognizer.view] fromView:self.scrollView];
CGFloat newZoomScale = self.scrollView.maximumZoomScale;

CGFloat w = CGRectGetWidth(self.imageView.frame) / newZoomScale;
CGFloat h = CGRectGetHeight(self.imageView.frame) / newZoomScale;
CGRect zoomRect = CGRectMake(tapPoint.x - (w / 2.0f), tapPoint.y - (h / 2.0f), w, h);

[self.scrollView zoomToRect:zoomRect animated:YES];
if (w != CGRectGetWidth(self.imageView.frame)) {
CGRect zoomRect = CGRectMake(tapPoint.x - (w / 2.0f), tapPoint.y - (h / 2.0f), w, h);
[self.scrollView zoomToRect:zoomRect animated:YES];
}
}
}

Expand Down Expand Up @@ -791,7 +793,12 @@ - (void)scrollViewDidZoom:(UIScrollView *)scrollView {
}
else {
if (self.panRecognizer) {
[self.imageView removeGestureRecognizer:self.panRecognizer];
if (self.allowSwipeOnBackgroundView) {
[self.containerView removeGestureRecognizer:self.panRecognizer];
}
else {
[self.imageView removeGestureRecognizer:self.panRecognizer];
}
}
scrollView.scrollEnabled = YES;
}
Expand Down

0 comments on commit 0bbb818

Please sign in to comment.