ValentinH / react-easy-crop

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

When using input fields for Crop X and Y values the crop completed is not triggered #535

Closed alielkhateeb closed 7 months ago

alielkhateeb commented 7 months ago

Describe the bug When I use variable inputs for crop (X and Y) that I want the user to insert in an input field, the crop does not get generated and a crop complete event is not emitted.

To Reproduce Steps to reproduce the behavior:

  1. Go to this sandbox
  2. Open console
  3. Move the cropped area (drag)
  4. Notice in the console Crop Complete
  5. Click on the input Crop X
  6. Type 0
  7. You'll notice Crop Complete is not triggered

Expected behavior I expect when input changes the crop is triggered and a cropComplete event is emitted.

ValentinH commented 7 months ago

This is because the onCropComplete is triggered at the end of a gesture (mouse up or drag stop). However, you can use the onCropAreaChange props that has the exact same signature than onCropComplete but is invoked whenever x/y change.