Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When image orientation is not UIImageOrientationUp, the scaling doesn't work correctly #24

Open
jkrzemie opened this issue Jun 17, 2013 · 2 comments

Comments

@jkrzemie
Copy link

Steps to reproduce:

  • download the latest code
  • launch the demo
  • select an image whose orientation is UIImageOrientationUp, zoom-in heavily, crop; everything will work fine
  • now select an image whose orientation != UIImageOrientationUp, zoom-in heavily, crop; the crop is misplaced.

The screens below display both flows: first a correct crop, then the misplaced one.

photo 3
photo 4
photo 1
photo 2

@joshuafeldman
Copy link

I confirm that I see this issue as well.

@joshuafeldman
Copy link

The problem is in the _calcVisibleRectForCropArea.

The scale width and height variables should look something more like this.

// determine the scales based on original / current sizes
CGFloat scaleWidth = self.imageView.image.size.width / self.imageView.frame.size.width;
CGFloat scaleHeight = self.imageView.image.size.height / self.imageView.frame.size.height;

// factor the zoom scale of the scroll view
scaleWidth *= self.scrollView.zoomScale;
scaleHeight *= self.scrollView.zoomScale;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants