Closed gigabit6 closed 6 years ago
@fengyuanchen this seems like a fine option to me, is it going to be merged?
This is exactly what I am looking for. But I'm not sure how to implement your feature tho... I'm just including these files to my userscript : https://rawgit.com/fengyuanchen/cropper/master/dist/cropper.js & https://raw.githubusercontent.com/fengyuanchen/cropper/master/dist/cropper.min.css
Edit: NVM I just had to add your code to cropper.js and remove the "utils.". Thank you for this feature!
Not necessary to add this as the image is scaled at all time.
If you really want to limit the crop box dynamically, just use the cropmove
event to implement it.
With these changes the setCropBoxData allow users to set the minCropBoxWidth and minCropBoxHeight dynamically after the cropper has been initialized. The method should be called as usual:
$().cropper('setCropBoxData', dataObj)
where the dataObj contains the data for the cropBox.