Closed palmithor closed 7 years ago
Thanks for the contribution. But there are so many changes (due to auto formatting and other stuff), I can't find what's the change that made it work. Can you explain what changes did you make to fix the issue?
in onUP in CropperImageView I changed one if condition. From:
if (scaleX <= mMinZoom)
// to:
if (scaleX < mMinZoom)
Otherwise the image was not panning correctly with min zoom when zooming far out.
I also added this to the end of fitToCenter() in the same class:
// If over scrolled, return back to the place.
float tx = getMatrixValue(matrix, Matrix.MTRANS_X);
float ty = getMatrixValue(matrix, Matrix.MTRANS_Y);
float scaleX = getMatrixValue(matrix, Matrix.MSCALE_X);
if (scaleX < mMinZoom) {
float xx = getWidth() / 2 - mMinZoom * drawable.getIntrinsicWidth() / 2;
float yy = getHeight() / 2 - mMinZoom * drawable.getIntrinsicHeight() / 2;
animateAdjustmentWithScale(tx, xx, ty, yy, scaleX, mMinZoom);
}
The reason I added this is that I think that if the user has preset a min zoom, the view should not allow setting the zoom level lover than that which can happen on fitToCenter. So I animated it to minZoom.
Added code.
This pull requests fixes the issue: https://github.com/jayrambhia/CropperNoCropper/issues/10