Is it possible using Ionic Framework to detect touches in a zone of an image?


#1

Let’s suppose i have an image of a map (just image, not a google maps or similar) and i want to do some things when the user taps some zones of the image. Is it possible using Ionic Framework ? How could i do that ?

A lot of thanks in advance.


#2

Yes, it is.

http://play.ionic.io/app/fb8f0850b763

If you check the console you will see a MouseEvent being triggered. If you want zones, then you need to apply some logic ( < > = )


#3

Thanks for your quick answer but i was refering to detect a touch in a zone of an image. Let’s say we have an animal and we want to detect touches in the face to do something and then to do other thing if the touch is on an arm or something like that and the animal is just an image.

Thanks in advance, anything please let me know!


#4

Not ionic related.

If you know what the images are going to be then you only need to define the area (math, javascript) and detect if the touch position is inside that area. And I’m not sure if the area tag will work in mobile but just in case check this http://www.w3schools.com/tags/tag_area.asp


#5

It is not the same because in the area tag the coords are fixed and not responsive as it should be in mobile.


#6

At the end you will need to apply math. I don’t know any javascript library that detects objects (just faces).