fengyuanchen / cropperjs

JavaScript image cropper.
https://fengyuanchen.github.io/cropperjs/
MIT License
13.15k stars 2.42k forks source link

Responsive resize causing random zoom and pan #1111

Closed FirstVertex closed 3 months ago

FirstVertex commented 1 year ago

Describe the bug Changing the viewport size results in a poor UX because the zoom and pan changed unpredictably.

To Reproduce Steps to reproduce the behavior:

  1. Using Desktop resolution (mine is 1800px) go to https://fengyuanchen.github.io/cropperjs/
  2. Resize window down to width of approx 500px
  3. Release the mouse
  4. Resize window back to full desktop width (mine is 1800px)
  5. Notice the image is no longer properly centered or zoomed

Expected behavior Expect that a change to the viewport size should not change the crop window contents.

Observed behavior Observed an unpredictable and chaotic change of zoom and pan inside the crop window after resizing the viewport.

Screenshots If applicable, add screenshots to help explain your problem.

image

Desktop (please complete the following information):

fengyuanchen commented 1 year ago

You might set the restore option to false.