Open lightframes opened 5 years ago
If I set maxZoom: 1 in options for example and the image I'm cropping is already zoomed at its maxZoom limit, the maxZoom automatically goes to 2 because of this statement:
if (minZoom >= maxZoom) { maxZoom = minZoom + 1; }
In my opinion it should be like this in case I set the maxZoom
if (self.options.maxZoom){ if (minZoom > maxZoom) { maxZoom = minZoom + 1; } } else { if (minZoom >= maxZoom) { maxZoom = minZoom + 1; } }
In this case if i set maxZoom and the image is already zoomed at max i can't go futher with zooming because i have already set the max zoom. In case the minZoom is grater than maxzoom, it's obviously allowed to increase the maxzoom. In my opinion we should not arrive to this last case, checking for example the size of the image while uploading and not allowing it to be cropped if is over a certain size.
Could you please pull this to the script?
I want to add it, but to me, I haven't heard a good pitch for how it would work.
Someone once said they see croppie used more for spitting out several images at a certain dimension. So they would set the zoom limits (and initial value, might as well toss that in here as well) before binding the image.
I'm with you, I don't think the zoom limits make much sense without knowing the image dimensions first. Yet, I still don't know what I would do with the image dimensions after I have them. The min zoom is pretty easy (with enforceBoundary: true), but the max zoom is where I'm a little foggy.
Maybe we should just add methods
setMinZoom
andsetMaxZoom
and call it quits?Do you have any better ideas?
Originally posted by @thedustinsmith in https://github.com/Foliotek/Croppie/issues/232#issuecomment-256343229