BJImageCropper
BJImageCropper copied to clipboard
bug infinite loop
Hi Barrett Jacobsen
First of all, thanks for this great project, it's very helpful. Yesterday, i have found a bug during my test. In one case there is an infinite loop, in the while loop of the function call :
- (void)constrainCropToImage; I think the block who create the pb is that one :
if (CGOriginX(frame) + CGWidth(frame) > CGWidth(cropView.superview.frame)) { ........ ........ }
To create this case I start my cropView to 0,0 with the max frame. Then I select the leftView and drag it slowly to the right and in one moment the program stop because of the while loop.
I have try to fixed the bug but I'm not sure.
Other question : If I want to crop the image and keep the ratio, what can I do ??
thanks a lot !!
Can you post an xcode project with your test case, I can't duplicate this based off your description.
how can I post a project please ?? thx
Here is the fix I originally posted on another site. I've changed line "if (CGOriginX(frame) + CGWidth(frame) > CGWidth(cropView.superview.frame))" to "if (CGOriginX(frame) + CGWidth(frame) - CGWidth(cropView.superview.frame) > 0.01)" so that 0.0002 difference will not result in infinite loop and cropper will not hung. I'll submit a pull request.