feat(state): add from, to in edge

This commit is contained in:
Igor Wessel 2024-05-04 06:21:12 -03:00
parent e68125eb6a
commit 9986b023d7
1 changed files with 5 additions and 2 deletions

View File

@ -252,7 +252,6 @@ const setupNode = (g, parent, parsedItem, diagramStates, diagramDb, altFlag) =>
type: 'group',
padding: 0, //getConfig().flowchart.padding
};
graphItemCount++;
const parentNodeId = itemId + PARENT_ID;
g.setNode(parentNodeId, groupData);
@ -270,17 +269,21 @@ const setupNode = (g, parent, parsedItem, diagramStates, diagramDb, altFlag) =>
from = noteData.id;
to = itemId;
}
g.setEdge(from, to, {
arrowhead: 'none',
arrowType: '',
style: G_EDGE_STYLE,
labelStyle: '',
id: 'edge' + graphItemCount + `_${from}_${to}`,
classes: CSS_EDGE_NOTE_EDGE,
arrowheadStyle: G_EDGE_ARROWHEADSTYLE,
labelpos: G_EDGE_LABELPOS,
labelType: G_EDGE_LABELTYPE,
thickness: G_EDGE_THICKNESS,
});
graphItemCount++;
} else {
g.setNode(itemId, nodeData);
}
@ -324,7 +327,7 @@ const setupDoc = (g, parentParsedItem, doc, diagramStates, diagramDb, altFlag) =
setupNode(g, parentParsedItem, item.state1, diagramStates, diagramDb, altFlag);
setupNode(g, parentParsedItem, item.state2, diagramStates, diagramDb, altFlag);
const edgeData = {
id: 'edge' + graphItemCount,
id: 'edge' + graphItemCount + `_${item.state1.id}_${item.state2.id}`,
arrowhead: 'normal',
arrowTypeEnd: 'arrow_barb',
style: G_EDGE_STYLE,