jayrambhia / CropperNoCropper

Instagram Style Image Cropper for Android (Library)
http://www.jayrambhia.com/project/nocropper-library
Apache License 2.0
474 stars 99 forks source link

Force not less than width or height #35

Open ruhy99 opened 6 years ago

ruhy99 commented 6 years ago

How to force to imageview to not be reduced less than width and height of the CropperView at the same time? I have tried to use isMakeSquare and then setting up back to the initial position but it's not clear. Please help! I try too with setMinZoom(0)

jayrambhia commented 6 years ago

setMinZoom(0) will not work.

From what I understand about what you're trying to achieve, you need to set a correct min zoom value.

minZoom = Math.min(width, height)/Math.max(width, height)

Set this value as min zoom. This value will make sure that the smallest side (width or height) will always be greater or equal to the size of the cropper view.

Alternatively, you can try this

minZoom = Math.max(width, height)/Math.min(width, height)

This min zoom will make sure that the biggest side (width or height) is always equal or greater than the size of the cropper view.

matteinn commented 6 years ago

Hey @jayrambhia , after setting a minZoom value I'm still able to zoom out so I guess it's not working as intended. Can you confirm, please?