vasturiano / aframe-forcegraph-component

Force-directed graph component for A-Frame
https://vasturiano.github.io/aframe-forcegraph-component/
MIT License
77 stars 31 forks source link

where are events defined? #14

Closed jaronimoe closed 5 years ago

jaronimoe commented 5 years ago

Hi, I'm trying to add a click event to the nodes and wanted to see how you defined the on hover event in order to use it as a template - however, I could not figure out where your "on-node-center-hover" is actually defined.. I found the "onNodeCenterHover" definition in the forcegraph schema - but "on-node-center-hover" and "onNodeCenterHover" are nowhere linked in the code.. (searched the entire library for them but got only one hit for each with no connection between them..) where do you define that a mouseover on a node triggers the user defined method specified in the "on-node-center-hover" tag?

it seems like this is a fundamental thing but unfortunately I dont undestand it. could you point me in the right direction? cheers!

vasturiano commented 5 years ago

Hi @jaronimoe, the src code that relates to the (center) hover interactions is here: https://github.com/vasturiano/aframe-forcegraph-component/blob/master/index.js#L241

It uses a raycaster to detect intersections of the center of the canvas with the various objects.

jaronimoe commented 5 years ago

ah the string is queried whether it contains "node" or "link" besides "centerhover".. I was searching for the entire string... - thanks!

already implemented a mouse click handler for graph nodes/edges 👍