VivaGraphJS
VivaGraphJS copied to clipboard
Is there a way to subscribe to node move events?
trafficstars
I want to be able to get an event when a node is dragged with the nodes new location.
Is this possible? What is the best way of doing this please?
There is input event handler you can use:
const events = Viva.Graph.webglInputEvents(graphics, graph);
events.click(({ id }) => /* your listener */);
Full list of available events - console.log(events):
click(callback): click(callback)
dblClick: dblClick(callback)
mouseCapture: mouseCapture(node)
mouseDown: mouseDown(callback)
mouseEnter: mouseEnter(callback)
mouseLeave: mouseLeave(callback)
mouseMove: mouseMove(callback)
mouseUp: mouseUp(callback)
releaseMouseCapture: releaseMouseCapture()