ValentinH / react-easy-crop

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

On cropSize change prop doesn't trigged computeSize or updating state of state.cropSize #467

Open Lopliok opened 1 year ago

Lopliok commented 1 year ago

Describe the bug When property cropSize is changed in same time as zoom, computeSizes is not called. So state of cropSize is not updated.

Expected behavior If property cropSize has changed, it will update Resizer state cropSize

image

We are using onMediaLoaded callback to calculate zoom and cropSize. Also we use range sliders to manipulate width, height, zoom.

I tried move condition in componentDidUpdate to be separately and called everytime when cropSize changed and it helps. Should I create PR for this?

image

ValentinH commented 1 year ago

Indeed, having all the conditions tied together doesn't seem right. Most of else should be removed I think.

By the way, why are you using cropSize instead of aspect?

Lopliok commented 1 year ago

I made some local patch for our case, but if i will have time i'll will try investigate how can be helpful aspect.