Skip to content

Zoom in doesn't check trans.  #1

Description

@Sacrify

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions