trang
trang

Reputation: 21

Android : How to get Coordinates X,Y of Image after Zoom and Pan

I'm developing an application with Zoom and Pan Image..Now, i need to get Coordinates X,y Of Image Each when User Touch Image ( after Zoom and Pan ), Not coordinates of Screen such as method event.getX and event.getX..help me..Thank you very much

Upvotes: 2

Views: 7752

Answers (2)

Andres L
Andres L

Reputation: 675

I know this question is a bit old, but i was facing the same problem, this actually did the trick.

Android ImageView - Get coordinates of tap (click) regardless of scroll location or zoom scale

Upvotes: 2

Ramesh Solanki
Ramesh Solanki

Reputation: 2926

please use this formulla to convert actaull coordinates

   float curX = (event.getX() / scale) - (left * scale);
    float curY = (event.getY() / scale) - (top * scale);

     mCanvas.drawCircle(((curX / scale)), ((curY / scale)),
                    width / 2 / scale, mPaint);

Upvotes: 1

Related Questions