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

Crop Area incorrectly sized for objectFit='cover' #481

Closed
crystaltine opened this issue Aug 30, 2023 · 4 comments · Fixed by #483
Closed

Crop Area incorrectly sized for objectFit='cover' #481

crystaltine opened this issue Aug 30, 2023 · 4 comments · Fixed by #483
Labels
bug Something isn't working released This issue/pull request has been released.

Comments

@crystaltine
Copy link

Hey, first of all thanks for making this! You guys really saved me a lot of time.

My issue comes up if you go to the Basic example with hooks, then perform the following steps:

  1. Change the image prop inside the Cropper component to "https://placehold.co/400x20" (Line 16) - this isn't required, but it makes the bug a lot more visible.
  2. Add objectFit='cover' somewhere in the props of the Cropper component
  3. Refresh the Codesandbox previewer (NOT your own browser page, just the thing on the right of the Codesandbox editor)

This is the result when I do this:
image

The problem seems to be that the Crop area is incorrectly sized and unable to cover the entire image, even on least (x1) zoom. I'm encountering this error in my own project right now, but it just happens when the component that has a Cropper component is rendered visible.

However, I have found that updating Cropper by doing something like resizing the page a little bit (Ctrl + Scroll, etc.) seems to fix it, although obviously it would be best if it worked on load.

Thanks for reading and thanks again for maintaining this project!

@crystaltine
Copy link
Author

Edit - I've been experimenting a little bit in my own project, and I think it may just be a visual bug - generating the cropped image using croppedAreaPixels and that stuff seems to produce the full-size, expected result.

@ValentinH
Copy link
Owner

Thanks for reporting this issue. I think I understand why, you can see the fix in #483.
I'm waiting for the codesandbox package to be published to ensure it does fix the issue.

@ValentinH
Copy link
Owner

@github-actions
Copy link

github-actions bot commented Sep 6, 2023

🚀 Issue was fixed in v5.0.1 🚀

@github-actions github-actions bot added the released This issue/pull request has been released. label Sep 6, 2023
@ValentinH ValentinH added the bug Something isn't working label Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants