-
-
Notifications
You must be signed in to change notification settings - Fork 167
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
fix(crop size): handle vertical ratio properly #157
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 4f8563a:
|
I'm not sure to understand which issue you see. What output would you expect? The crop area size looks correct to me. If you are talking about the image being taller than the screen, this is indeed because we are using a transformation to rotate it. |
Notice that the zoom slider. It is zoomed out as much as possible. You should be able to zoom out further so that the whole image fits within the crop area. |
I see what you mean. Basically, you need to allow a zoom value lower than 1 in this case (probably equals to the aspect ratio?). The image positioning is not handled by JavaScript, we only let the browser fit the image in the container. As mentioned above, when we rotate the image using a transformation, then this automatic positioning let the image flow outside of its container. I don't see (at the moment) how to address this as part of the library without changing too many things. |
I'd prefer that a zoom value of 1, an aspect ratio that matches the image (even when rotated), and
That's okay, this is a step in the right direction. And it seems to fix #152 for me. 👍 I'll start playing around with a solution for #151, but it sounds like it might end up needing to change a lot, so we'll see how it goes. |
Yes, it makes sense. However, with the way the image is rotated today (transformation), this is tricky. If you come up with a PR for this, I'll be happy to review. |
Released under v3.1.1 |
Fixes #151 #152
We are now using the container size to compute the crop size. Thanks to this, we can better use to available size for the crop area.
@ajlende Could you please confirm that this fix is working for your use case? Here's your example running the library version from this PR: https://codesandbox.io/s/react-easy-crop-image-aspect-lwpee
You can use this version of the package to test locally: "https://pkg.csb.dev/ricardo-ch/react-easy-crop/commit/4f8563a2/react-easy-crop"