GKImagePicker
GKImagePicker copied to clipboard
Example: Scaling on wrong axis
Hi, i noticed in some cases scaling is wrong. Example(resizeableCropArea=NO): Image size: 200x100 Crop size: 120x110
I also noticed that it works OK when resizableCropArea=YES due to different scaling calculation. Using this seems to solve all problems for me, including square images, tested on 20+ images:
-(CGRect)_calcVisibleRectForCropArea
{
CGFloat scale = self.imageView.image.size.width / self.imageView.frame.size.width;
scale *= self.scrollView.zoomScale;
//extract visible rect from scrollview and scale it
CGRect visibleRect = [scrollView convertRect:scrollView.bounds toView:imageView];
visibleRect = GKScaleRect(visibleRect, scale);
return visibleRect;
}
Note: I always set images to normal orientation before passing them to GKImageCropViewController, otherwise it doesn't work. BTW: Navigation bar sometimes disappears :P
Nice timing, I discovered the same problem some moments ago. Gonna submit a pull request for this