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

Potential wrong scale due to comparison of float value #133

Closed
skyline75489 opened this issue Jan 18, 2016 · 0 comments
Closed

Potential wrong scale due to comparison of float value #133

skyline75489 opened this issue Jan 18, 2016 · 0 comments
Assignees
Labels
Milestone

Comments

@skyline75489
Copy link

The comparison here is potentially wrong:

if (self.scalingImageView.zoomScale >= self.scalingImageView.maximumZoomScale) {
    newZoomScale = self.scalingImageView.minimumZoomScale;
}

In fact, I've just encountered this problem. I've changed this into:

if (self.scalingImageView.zoomScale >= self.scalingImageView.maximumZoomScale || 
ABS(self.scalingImageView.zoomScale - self.scalingImageView.maximumZoomScale) <= FLT_EPSILON) {
    newZoomScale = self.scalingImageView.minimumZoomScale;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants