-
Notifications
You must be signed in to change notification settings - Fork 97
Open
Description
I guess there is a reset image trans after Zoom in:
/**
* 重置图片位置
* */
float dx = 0;
float dy = 0;
float width = getWidth();
float height = getHeight();
mCurrentMatrix.set(getImageMatrix());//初始化Matrix
float[] values = new float[9];
mCurrentMatrix.getValues(values);
if (values[Matrix.MTRANS_X] > 0) {
dx = -values[Matrix.MTRANS_X];
} else if (values[Matrix.MTRANS_X] < -(mImageWidth * values[Matrix.MSCALE_X] - width)) {
dx = -(mImageWidth * values[Matrix.MSCALE_X] - width) - values[Matrix.MTRANS_X];
}
if (values[Matrix.MTRANS_Y] > 0) {
dy = -values[Matrix.MTRANS_Y];
} else if (values[Matrix.MTRANS_Y] < -(mImageHeight * values[Matrix.MSCALE_Y] - height)) {
dy = -(mImageHeight * values[Matrix.MSCALE_Y] - height) - values[Matrix.MTRANS_Y];
}
mCurrentMatrix.postTranslate(dx, dy);
setImageMatrix(mCurrentMatrix);
Doing this is for reset picture trans which out of bounds during zoom in.
Metadata
Metadata
Assignees
Labels
No labels