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

Incorrect crop result after change image file #456

Closed
tkh0110 opened this issue Jan 8, 2018 · 2 comments
Closed

Incorrect crop result after change image file #456

tkh0110 opened this issue Jan 8, 2018 · 2 comments

Comments

@tkh0110
Copy link

tkh0110 commented Jan 8, 2018

Reproduction scenario:
Refer to video here: https://screencast-o-matic.com/watch/cFVj16oiio)

  • When image file is selected for the first time, the crop result is correct.
  • After select another image file, the crop result becomes wrong. You might need to change the zoom slider sometimes to see the wrong result.
  • After refresh browser and select image file, the crop result becomes correct again.

Root cause:
I found the root cause is incorrect self._originalImageWidth & self._originalImageHeight values after image file is changed. They got the values from self.elements.preview.getBoundingClientRect() in _updatePropertiesFromImage() function, I am not sure what is the reason to use getBoundingClientRect(), but changing to the following codes in _updatePropertiesFromImage() function seems to fix the issue:
self._originalImageWidth = img.width;
self._originalImageHeight = img.height;

@thedustinsmith
Copy link
Contributor

I can't find the issue at the moment, but this has been reported and I'm pretty sure this one will be resolved in 2.5.2 You can even use the code in master to confirm if you'd like.

Thanks for the detailed submission.

@tkh0110
Copy link
Author

tkh0110 commented Jan 9, 2018

Yes, the code in master doesn't have this issue. Thanks a lot!

@tkh0110 tkh0110 closed this as completed Jan 9, 2018
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