PinchToZoom
PinchToZoom copied to clipboard
How to reset scaling to the original?
Hi! Thanks for the great library.
There is one problem.
- I do imgViev.setImageBitmap(bitmap)
- Enlarge the image, but do not reduce it.
- Upload the next image in imgView
- It is immediately on an enlarged scale, and I want it to be in the original. How to finish this?
Thank you!
P.S. I found a solution!
try {
imageMatrixTouchHandler.animateZoom(0, 0);
} catch (Exception ignore) {
}
try/catch need, because there may be an exception
W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.graphics.Matrix.getValues(float[])' on a null object reference at com.bogdwellers.pinchtozoom.MatrixCorrector.getValues(MatrixCorrector.java:96)
See if the answer in #6 works for you and please post back.
See if the answer in #6 works for you and please post back.
Answer # 6 did not work for me, after the reset, I had indents on the left and above
Hi! Thanks for the great library.
There is one problem.
- I do imgViev.setImageBitmap(bitmap)
- Enlarge the image, but do not reduce it.
- Upload the next image in imgView
- It is immediately on an enlarged scale, and I want it to be in the original. How to finish this?
Thank you!
P.S. I found a solution!
try { imageMatrixTouchHandler.animateZoom(0, 0); } catch (Exception ignore) { }
try/catch need, because there may be an exception
W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.graphics.Matrix.getValues(float[])' on a null object reference at com.bogdwellers.pinchtozoom.MatrixCorrector.getValues(MatrixCorrector.java:96)
where to put this code if using setOnTouchListener
@DilumD
imageMatrixTouchHandler = new ImageMatrixTouchHandler(mContext, corrector) {
@Override
public boolean onTouch(View view, final MotionEvent event) {
super.onTouch(view, event);
}
};
TouchImageView.super.setOnTouchListener(imageMatrixTouchHandler);
try {
imageMatrixTouchHandler.animateZoom(0, 0);
} catch (Exception e) {
e.printStackTrace();
}