memgraph / orb

Graph visualization library
Apache License 2.0
350 stars 17 forks source link

New: Added support for context menu events #46

Closed shashankshukla96 closed 1 year ago

shashankshukla96 commented 1 year ago

This PR will add support for context menu events (mouse right click), the library exposes the 3 new events

1. NODE_RIGHT_CLICK  :  Triggered when a node on the canvas is clicked
2. EDGE_RIGHT_CLICK : Triggered when an edge is clicked.
3. CANVAS_RIGHT_CLICK : Triggered when the canvas is clicked.

For example, to handle NODE_RIGHT_CLICK event we can use

orb.events.on(Orb.OrbEventType.NODE_RIGHT_CLICK, (data) => {
      data.event.preventDefault();
      console.log("Node Right Clicked", data);
})