flexible-context-menu
Description
A flexible context menu for Cytoscape. [Demo incoming]
Dependencies
- Cytoscape.js ^3.2.0
Usage instructions
Download the library:
- via npm:
npm install flexible-context-menu
, - via bower:
bower install flexible-context-menu
, or - via direct download in the repository (Look at the releases tab).
Import the library as appropriate for your project:
ES import:
;; cytoscape;
CommonJS require:
let cytoscape = ;let FlexibleContextMenu = ; cytoscape; // register extension
AMD:
;
Plain HTML/JS has the extension registered for you automatically, because no require()
is needed.
API
The extension supports adding menu items for a selected node in the graph. They are, for now, displayed in a circle around the selected node. It exposes only one function - flexibleContextMenu
- which is attached to Cytoscape.
The initialisation for the menu requires the following:
;; Cytoscape; const cytoscape = ; const options: Options = ... ;cytoscape;
This only needs to be run once. After that, the contextual menu will appear and disappear based on the conditions you have specified in the options
.