ValentinH / react-easy-crop

A React component to crop images/videos with easy interactions
https://valentinh.github.io/react-easy-crop/
MIT License
2.23k stars 167 forks source link

Cropper empty space #444

Open mridulbarman027 opened 1 year ago

mridulbarman027 commented 1 year ago

image

Describe the bug While rotating image its showing the empty spaces inside the cropper.

ValentinH commented 1 year ago

This is not a bug but the expected behaviour.

What would you expect instead of this?

mridulbarman027 commented 1 year ago

Its shoud auto zoom in photo so that it fills the empty space in photos and prevent any empty spaces while rotating. You can check other editors for reference.

ValentinH commented 1 year ago

I see your point. The behaviour you expect could be added as a new option (that could be defaulted to "no empty space" in a future major version).

That being said, we need to implement the logic to automatically set the right zoom level based on the rotation. This is not trivial and requires some math/geometry investigation. Are you willing to have a look into this and create a PR?

mathedu4all commented 5 months ago

Given position and rotation of image, we can calculate the min scale ensure the boundary of image and canvas have no intersections.