Right click menus
Background menu
The main background menu (right-click on the canvas) is generated by a call toLGraph.getCanvasMenuOptions. One way to add your own menu options is to hijack this call:
Node menu
When you right click on a node, the menu is similarly generated bynode.getExtraMenuOptions.
But instead of returning an options object, this one gets it passed in…
Submenus
If you want a submenu, provide a callback which usesLiteGraph.ContextMenu to create it:
Capture UI events
This works just like you’d expect - find the UI element in the DOM and add an eventListener.setup() is a good place to do this, since the page
has fully loaded. For instance, to detect a click on the ‘Queue’ button:
Detect when a workflow starts
This is one of manyapi events:
Detect an interrupted workflow
A simple example of hijacking the api:Catch clicks on your node
node has a mouseDown method you can hijack.
This time we’re careful to pass on any return value.