g.js
g.js copied to clipboard
hit detection
hi, nice library, wondering if it's possible to do hit detection on a shape, ie: to know which shape the mouse is over?
thanks
Yes, a Path object has a .contains method that takes an x/y argument. This also works on a Group.
Here's the source:
https://github.com/nodebox/g.js/blob/88c9deaba4d57855915264dec4bcf8054b230f17/src/libraries/vg/objects/path.js#L396