View Full Version : Image click, get coordinates

16 Sep 2010, 6:34 AM
I am currently looking for a replacement of a flash app I regularly use (since Ipad doesn't enable flash). I would like to have an image and when you click/tap on it, you get the coordinates of where you tabbed on the image (the image of a car). That data is used to calculate which area of the image (door, bumper, tire,...) is clicked/tapped.

Any idea's about how to implement this with Sencha?

16 Sep 2010, 6:41 AM
The tap-event sends an object that includes the pageX and pageY coordinates.

just listen to the event...

img.on('tap', function(e) {
console.log('x: ' + e.pageX + ', y: ' + e.pageY);
}, this);

20 Sep 2010, 11:17 PM
Thanks, works like a charm. Now I just have to figure out how to define area's and check with which area the coordinates match

21 Sep 2010, 1:46 AM
How complex a shape are the areas going to be?

21 Sep 2010, 1:57 AM
The eventual goal is to be able to select areas as small as the headlights or the antenna on this image


so fairly complex, different shapes and sizes.