Decorating edges and nodes

This commit is contained in:
Knut Sveidqvist
2024-05-29 15:56:43 +02:00
parent 4538f5b8c6
commit b390fbe1cb
2 changed files with 9 additions and 3 deletions

View File

@@ -622,6 +622,11 @@ export const insertEdge = function (elem, edge, clusterDb, diagramType, graph, i
.attr('class', ' ' + strokeClasses + (edge.classes ? ' ' + edge.classes : ''))
.attr('style', edge.style);
}
// MC Special
svgPath.attr('data-edge', true);
svgPath.attr('data-et', 'edge');
svgPath.attr('data-id', edge.id);
// DEBUG code, adds a red circle at each edge coordinate
// cornerPoints.forEach((point) => {
// elem

View File

@@ -57,9 +57,6 @@ export const insertNode = async (elem, node, dir) => {
let newEl;
let el;
if (node) {
console.log('BLA: rect node', JSON.stringify(node));
}
//special check for rect shape (with or without rounded corners)
if (node.shape === 'rect') {
if (node.rx && node.ry) {
@@ -83,6 +80,10 @@ export const insertNode = async (elem, node, dir) => {
el = await shapes[node.shape](elem, node, dir);
newEl = el;
}
// MC Special
newEl.attr('data-id', node.id);
newEl.attr('data-node', true);
newEl.attr('data-et', 'node');
if (node.tooltip) {
el.attr('title', node.tooltip);
}