Tuesday, December 24, 2013

Touch point coordinates with respect to Image after pinch zoom [android help]


Touch point coordinates with respect to Image after pinch zoom



How to calculate the coordinates with respect to image after zoom the image? To zoom the image I followed the url: https://github.com/MikeOrtiz/TouchImageView/blob/master/src/com/example/touch/TouchImageView.java.


if we touch the image at particular point before Zoom then corresponding values are



point:(3,2)
top left corner of image:(0,0)
top left corner of screen:(0,0)
scale factors:(1.25,0.98)


After zoom the image:


if we drag the image until the image top left corner coincides the screen top left corner and touch image exactly at same touch point(before pinch) then



point:(540,220)
top left corner of image:(0,0)
top left corner of screen:(0,0)
scale factors:(4.78,2.67)


if we drag the image until the image top right corner coincides with the screen top right corner and touch image exactly at same touch point(before pinch) then



point:(1080,340)
top left corner of screen:(0,0)
top left corner of image:(-2430,0)
scale factors:(4.78,2.67)


if we drag the image until the image bottom left corner coincides with the screen bottom left corner and touch image exactly at same touch point(before pinch) then



point:(670,80)
top left corner of screen:(0,0)
top left corner of image:(0,-890)
scale factors:(4.78,2.67)


if we drag the image until the image bottom right corner coincides with the screen bottom right corner and touch image exactly at same touch point(before pinch) then



point:(456,274)
top left corner of screen:(0,0)
top left corner of image:(-2430,-890)
scale factors:(4.78,2.67)


if we set the image over the screen [ not to set the any corner]



point:(743,146)
top left corner of screen:(0,0)
top left corner of image:(-1280,-423)
scale factors:(4.78,2.67)


In all the above scenarios I am getting the coordinates in touch event as



x_cord=event.getX();
y_cord=event.getY();


The touch points I am getting are with respect to the screen.


How can I calculate the touch points according to the Image?


Thanks & Regards mini.



Read more

stackoverflow.comm



No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...