|
1 | 1 | import cy, { NodeDefinition, Singular } from "cytoscape"; |
2 | 2 | import edgehandles from 'cytoscape-edgehandles'; |
3 | 3 | import cxtmenu from 'cytoscape-cxtmenu'; |
4 | | -import { EdgeData, getColor, GraphData, GraphOptions, GraphTypes, NodeData } from "../utils"; |
| 4 | +import { EdgeData, getColor, GraphData, GraphOptions, GraphTypes, NodeData, traverseQuery } from "../utils"; |
5 | 5 | import cola, { ColaLayoutOptions } from "cytoscape-cola"; |
6 | 6 | import store, { AppDispatch } from "../../app/store"; |
7 | 7 | import { removeNodes, setSelectedEdge, setSelectedNode, updateColorMap } from "../../reducers/graphReducer"; |
@@ -139,7 +139,20 @@ export function getCytoGraph(container?: HTMLElement, data?: GraphData, options? |
139 | 139 | }, |
140 | 140 | enabled: true // whether the command is selectable |
141 | 141 | }, |
142 | | - ], // function( ele ){ return [ /*...*/ ] }, // a function that returns commands or a promise of commands |
| 142 | + { // example command |
| 143 | + content: 'Incoming Edges', // html/text content to be displayed in the menu |
| 144 | + select: function (ele: Singular) { // a function to execute when the command is selected |
| 145 | + traverseQuery(ele.id(), "in") |
| 146 | + }, |
| 147 | + enabled: true // whether the command is selectable |
| 148 | + }, |
| 149 | + { // example command |
| 150 | + content: 'Outgoing Edges', // html/text content to be displayed in the menu |
| 151 | + select: function (ele: Singular) { // a function to execute when the command is selected |
| 152 | + traverseQuery(ele.id(), "out") |
| 153 | + }, |
| 154 | + enabled: true // whether the command is selectable |
| 155 | + }, ], // function( ele ){ return [ /*...*/ ] }, // a function that returns commands or a promise of commands |
143 | 156 | }) |
144 | 157 |
|
145 | 158 | layout.start() |
|
0 commit comments