0

Is it possible to select Canvas 'elements' like specific arc's within a Canvas? Are they stored in an array?

JSBin Example

My end goal is to select each circle, add a hover event, and show text relating to the circle that is hovered on. I'm wondering if I can access the arc's in an array like structure.

getContext('2d').context.arc[0].mouseenter is something I'm going for.

Is some interaction like this possible on the Canvas object?

markmiller
  • 158
  • 1
  • 1
  • 10
  • The *'already answered'* link cited is a bit out of date. Now you can put enough info to define each arc in an object and store all objects in an array. Then you can use `context.isPointInPath(mouseX,mouseY)` to have canvas tell you if the mouse is currently inside any one of your arcs. Example code: http://jsfiddle.net/m1erickson/0rbxexc3/ – markE Aug 13 '14 at 03:08
  • Great, I'll look into this. Thanks for the insight! – markmiller Aug 15 '14 at 15:39

0 Answers0