Skip to content

Commit fc7f4da

Browse files
committed
Fix in/out edge support that got overwritten by commit.
1 parent a069345 commit fc7f4da

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/logics/graphImpl/cytoImpl.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import cy, { NodeDefinition, Singular } from "cytoscape";
22
import edgehandles from 'cytoscape-edgehandles';
33
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";
55
import cola, { ColaLayoutOptions } from "cytoscape-cola";
66
import store, { AppDispatch } from "../../app/store";
77
import { removeNodes, setSelectedEdge, setSelectedNode, updateColorMap } from "../../reducers/graphReducer";
@@ -139,7 +139,20 @@ export function getCytoGraph(container?: HTMLElement, data?: GraphData, options?
139139
},
140140
enabled: true // whether the command is selectable
141141
},
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
143156
})
144157

145158
layout.start()

0 commit comments

Comments
 (0)