I have just come across this example on how to handle events from shapes rendered on a canvas element.
Seems the basic is working well, maybe you can take some ideas from reading the source code. http://webcodingeasy.com/JS-classes/Emulate-events-on-canvas-objects Let us know if you get that improved ! -- Diego On Aug 22, 12:36 pm, Amit Agarwal <lifea...@gmail.com> wrote: > Hi, > > I am working on a WebGl based prototype where in I have drawn multiple > shapes. For example, I have one triangle and one square. > > The problem statement is, in WebGl all I can attach event handler to is the > canvas element. Is there a way I can assign independent click handlers for > every shape drawn inside the canvas ? I don't want to do any pixel level > hardcoding for my click event because the shapes inside are moving. And > unlike SVG, shapes are not counted as individual elements in WebGl. > > Any hacks possible here? > > -Amit -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google archive, visit here: http://www.mail-archive.com/jsmentors@googlegroups.com/ To unsubscribe from this group, send email to jsmentors+unsubscr...@googlegroups.com