fengyuanchen / cropper

⚠️ [Deprecated] No longer maintained, please use https://github.com/fengyuanchen/jquery-cropper
MIT License
7.75k stars 1.74k forks source link

Allow dynamically to edit minCropBox Width/Height #916

Closed gigabit6 closed 6 years ago

gigabit6 commented 7 years ago

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.

toshetoo commented 7 years ago

@fengyuanchen this seems like a fine option to me, is it going to be merged?

alectrona7 commented 7 years ago

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!

fengyuanchen commented 6 years ago

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.