react-easy-crop
react-easy-crop copied to clipboard
Improve callbacks while zooming
Describe the bug There are two main problems:
- The callback for
onCropCompleteis being called repeatedly while zooming - so they are being simultaneously called - While zooming, the onZoomChange is being called a lot of times (maybe it's possible to throttle it)
To Reproduce Steps to reproduce the behavior:
- Add logs in the onCropComplete and onZoomChange callbacks
- Zoom in
Expected behavior
- onCropComplete will be called only once - after you finish zooming (the same behavior as happens with onCropChange)
- onZoomChange will be called less frequently
Here's a sample of the logs while zooming in:
Thanks for your help! This package is super useful!
Sorry for missing this issue.
I understand your point. The problem with the zoom is that it's harder to detect that the zoom gesture is complete compared to other gestures. This is due to the wheel event not having a start/end specific event.
I guess we could add some internal logic to only fire the onCropComplete when the wheel event hasn't been received for a while. Basically debouncing it.