简体   繁体   中英

Android PhotoView - zoom to previous position (x y coordinates and scale)

I'm using https://github.com/chrisbanes/PhotoView so user can zoom the image and then draw some point.

There is also a function to delete this point. In this case I redraw whole bitmap:

matrix = new Matrix();
canvas.drawBitmap(bmp, matrix, paint);
setImageBitmap(bmp);

But now I want to zoom image to previous position/coordinates.

This should work:

setScale(scale, focalX, focalY, false);

I know the scale but I need focalX, focalY.

How can I get it? Maybe I should somehow calculate it from the

getSuppMatrix(matrix);

But I'm not sure if it's possible and how.

Do you have some tips? Help?

Solved by getting matrix

getSuppMatrix(matrix);

before setting new bitmap

setImageBitmap(bmp);

And then setting previous matrix

setSuppMatrix(matrix);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM