What I would like to do is have my .PNG image respond to mouse clicks but only when on non transparent pixels. I have a 6 section pie and want each slice to respond to mouse clicks. I could use a area tag to define a clickable shape but what if i rotate my image then this will not work, right so what can I do.
Asked
Active
Viewed 88 times
0
-
1This is going to be a lot easier if you can create a canvas representation of your PNG. So start here: http://stackoverflow.com/questions/8751020/how-to-get-a-pixels-x-y-coordinate-color-from-an-image As an aside, be aware that questions which demonstrate a lack of effort aren't typically well-received on StackOverflow. Try and always show what you have so far. – Nov 10 '14 at 10:49
-
I am limited in that I have to support IE9 so no canvas support. – paul.mortlock Nov 10 '14 at 11:27
-
Canvas works fine in IE9. – Nov 10 '14 at 13:44
-
You can add an array containing the set of coordinates that describes exactly the polygon that contains the area you're interested in. At click you prevent default if at the click happened outside the polygon. – fedeghe Nov 10 '14 at 13:49