Android - adjust the position of the image at the top of the scalable image

I am working on an image by creating a function that allows the user to place tags on images (e.g. Facebook tag). I have a scalable ImageView (using Mike Ortiz TouchImageView ) as a background image, and some ImageViews as image tags.

Each tag has X and Y , and there is no problem displaying both the background image and the image tags in the correct position. However, when the user starts scaling, the position of the background image changes. This means that the position of each image must also be changed / updated in accordance with the current background zoom level and scroll position .

I am currently using this method:

float currentZoom = mImageView.getCurrentZoom();
float zoomedX = x / currentZoom;
float zoomedY = y / currentZoom;

But when I tried, it went completely wrong. Can someone help me find the correct method / equation?

EDIT:

I tried using Matrix.mapPoints () , but I do not understand how this matrix can help me solve my problem. Here is an image for a better explanation:

image

+4
1

- ( pskink)! , , , Matrix.mapPoints(). X Y . X Y , " ".

:

Matrix matrix = mImageView.getImageMatrix();
float[] pts = {0, 0};
matrix.mapPoints(pts);
float newTagX = (tagX * currentZoom) + pts[0];
float newTagY = (tagY * currentZoom) + pts[1];
+1

All Articles