Fixes suzuki-0000/SKPhotoBrowser#8 - Double tapping scaled UIImage

This commit is contained in:
PJ Gray 2016-01-04 19:56:46 -05:00
parent 8147b6faec
commit e837a4dc4e
1 changed files with 9 additions and 3 deletions

View File

@ -196,9 +196,15 @@ public class SKZoomingScrollView:UIScrollView, UIScrollViewDelegate, SKDetecting
}
public func zoomRectForScrollView(withScale:CGFloat, touchPoint:CGPoint) -> CGRect{
return CGRectMake(touchPoint.x - (frame.size.width / 2.0),
touchPoint.y - (frame.size.height / 2.0),
frame.size.width, frame.size.height)
if let imageScale = photoImageView.image?.scale {
return CGRectMake(touchPoint.x - ((frame.size.width * imageScale) / 2.0),
touchPoint.y - ((frame.size.height * imageScale) / 2.0),
frame.size.width, frame.size.height)
} else {
return CGRectMake(touchPoint.x - (frame.size.width / 2.0),
touchPoint.y - (frame.size.height / 2.0),
frame.size.width, frame.size.height)
}
}
// MARK: - UIScrollViewDelegate