AndroidProject icon indicating copy to clipboard operation
AndroidProject copied to clipboard

Zoom in doesn't check trans.

Open Sacrify opened this issue 10 years ago • 0 comments

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.

Sacrify avatar Mar 18 '16 10:03 Sacrify