advanced-cropper / vue-advanced-cropper

The advanced vue cropper library that gives you opportunity to create your own croppers suited for any website design
https://advanced-cropper.github.io/vue-advanced-cropper/
Other
1k stars 136 forks source link

fix: handle differing source and result sizes in updateCanvas #276

Closed DerZade closed 5 months ago

DerZade commented 5 months ago

Same PR as #270, but for master branch.


updateCanvas has a bug which only really comes to light if the size of the canvas and the size of the original image differ drastically and the image offset is positive. The dx and dy are not adjusted for the size difference.

Here is a visual representation:

Frame 22 (1)

Since the output (100px) is half the size of the input (200px) the dx and dy have to be halfed.

Norserium commented 5 months ago

@DerZade, I've published changes for both Vue versions. Thank you very much for your contribution, especially for such nice description and illustrations. It was very nice.

DerZade commented 5 months ago

Thank you so much for getting this merged so quickly! And thank you for the great library! Maintaining a library is hard work and is unfortunately all too often not appreciated enough. ❤️