Skip to content

Commit

Permalink
Node label defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
lauratinnel committed Sep 21, 2024
1 parent 9468590 commit e1adf5e
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions src/logics/graphImpl/cytoImpl.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import cy, { NodeDefinition, Singular } from "cytoscape";
import edgehandles from 'cytoscape-edgehandles';
import cxtmenu from 'cytoscape-cxtmenu';
import { EdgeData, getColor, GraphData, GraphOptions, GraphTypes, NodeData, traverseQuery } from "../utils";
import { EdgeData, getColor, GraphData, GraphOptions, GraphTypes, NodeData } from "../utils";
import cola, { ColaLayoutOptions } from "cytoscape-cola";
import store, { AppDispatch } from "../../app/store";
import { removeNodes, setSelectedEdge, setSelectedNode, updateColorMap } from "../../reducers/graphReducer";
Expand Down Expand Up @@ -59,11 +59,10 @@ function toCyNode(n: NodeData): cy.NodeDefinition {
'background-color': color,
'background-opacity': 0,
'background-image': getIcon(n.type),
'background-fit': 'contain',
//'font-size': '0px',
'text-max-width' : '80px',
'background-fit': 'none',
'text-max-width' : '150px',
'text-wrap': 'wrap',
'text-valign': 'bottom'
'text-valign': 'bottom',
},
position: { x: n.x ? n.x : Math.random(), y: n.y ? n.y : Math.random() },
};
Expand Down Expand Up @@ -113,7 +112,6 @@ export function getCytoGraph(container?: HTMLElement, data?: GraphData, options?
width: 1,
"curve-style": "bezier",
"target-arrow-shape": 'triangle',
//"font-size": "0px",
"text-rotation": "autorotate",
"label": "data(label)"
}
Expand Down Expand Up @@ -141,20 +139,6 @@ export function getCytoGraph(container?: HTMLElement, data?: GraphData, options?
},
enabled: true // whether the command is selectable
},
{ // example command
content: 'Incoming Edges', // html/text content to be displayed in the menu
select: function (ele: Singular) { // a function to execute when the command is selected
traverseQuery(ele.id(), "in")
},
enabled: true // whether the command is selectable
},
{ // example command
content: 'Outgoing Edges', // html/text content to be displayed in the menu
select: function (ele: Singular) { // a function to execute when the command is selected
traverseQuery(ele.id(), "out")
},
enabled: true // whether the command is selectable
},
], // function( ele ){ return [ /*...*/ ] }, // a function that returns commands or a promise of commands
})

Expand Down

0 comments on commit e1adf5e

Please sign in to comment.