How do I add a simple onClick event handler to a canvas element?

前端 未结 7 1685
自闭症患者
自闭症患者 2020-11-22 09:07

I\'m an experienced Java programmer but am looking at some JavaScript/HTML5 stuff for the first time in about a decade. I\'m completely stumped on what should be the simple

7条回答
  •  悲哀的现实
    2020-11-22 09:38

    You can also put DOM elements, like div on top of the canvas that would represent your canvas elements and be positioned the same way.

    Now you can attach event listeners to these divs and run the necessary actions.

提交回复
热议问题