Thanks so much for the reply!
Today I have tried using the DelayLinkCurve and it actually did work but it seems that the computation of the curves makes the whole diagram freeze up for at least 30 seconds. I will provide you with my Diagram code to see if there is something I am missing or just messing up:
async function createDiagram(diagramContainer) {
interlockDiagram = new go.Diagram(diagramContainer, {
// Diagram initialization options
"draggingTool.isGridSnapEnabled": true,
"commandHandler.archetypeGroupData": {
text: "Group",
isGroup: true,
color: "blue",
},
"undoManager.isEnabled": true,
"draggingTool.dragsLink": true,
"draggingTool.isGridSnapEnabled": true,
"linkingTool.isUnconnectedLinkValid": true,
"linkingTool.portGravity": 20,
"relinkingTool.isUnconnectedLinkValid": true,
"relinkingTool.portGravity": 20,
"relinkingTool.fromHandleArchetype": $(go.Shape, "Diamond", {
segmentIndex: 0,
cursor: "pointer",
desiredSize: new go.Size(8, 8),
fill: "tomato",
stroke: "darkred",
}),
"relinkingTool.toHandleArchetype": $(go.Shape, "Diamond", {
segmentIndex: -1,
cursor: "pointer",
desiredSize: new go.Size(8, 8),
fill: "darkred",
stroke: "tomato",
}),
"linkReshapingTool.handleArchetype": $(go.Shape, "Diamond", {
desiredSize: new go.Size(7, 7),
fill: "lightblue",
stroke: "deepskyblue",
}),
"rotatingTool.handleAngle": 270,
"rotatingTool.handleDistance": 30,
"rotatingTool.snapAngleMultiple": 15,
"rotatingTool.snapAngleEpsilon": 15,
"undoManager.isEnabled": true,
scrollMode: go.Diagram.DocumentScroll,
maxScale: 2,
minScale: 0.5
});
interlockDiagram.addDiagramListener("ObjectSingleClicked", (e) => {
const part = e.subject.part;
verifyCanEditPorts(part);
// Only input & output gates can update signal label
if (!canEditPorts.value) setPropertiesSection(part);
else txtSignalLabel.value = "";
});
// Add visibility change event listener
document.addEventListener("visibilitychange", handleVisibilityChange);
interlockDiagram.addDiagramListener("BackgroundSingleClicked", () => {
cleanPropertiesSection();
});
interlockDiagram.addDiagramListener("ChangedSelection", (event) => {
const selection = event.diagram.selection;
// Reset the red border for all nodes
interlockDiagram.nodes.each((node) => {
const shape = node.findObject("SHAPE");
if (shape) {
shape.stroke = "black"; // Reset stroke to default color
shape.strokeWidth = 1; // Reset stroke width
}
});
// If exactly one node is selected, apply logic to highlight it and sync with the monitor view
if (selection.count === 1 && selection.first().data.category) {
const selectedGate = selection.first().data;
projectStore.selectGate(selectedGate);
// Highlight the selected node in red
const selectedNode = selection.first();
const shape = selectedNode.findObject("SHAPE");
if (shape) {
shape.stroke = "red";
shape.strokeWidth = 3;
}
} else {
projectStore.selectGate(null);
}
});
// Log when the layout is completed
interlockDiagram.addDiagramListener("InitialLayoutCompleted", () => {
// Hide the loader once the diagram finishes rendering
isLoading.value = false;
delayLinkCurve = new DelayLinkCurve(interlockDiagram /*, go.Curve.JumpGap*/);
delayLinkCurve.onUpdate = numremaining => {
if (numremaining <= 0) {
interlockDiagram.linkTemplate.curve = go.Curve.JumpOver;
}
};
});
// configuring Grid
interlockDiagram.grid = $(
go.Panel,
"Grid",
$(go.Shape, "LineH", {
strokeWidth: 0.5,
strokeDashArray: [0, 9.5, 0.5, 0],
})
);
// enabling Grid Snap
interlockDiagram.toolManager.draggingTool.isGridSnapEnabled = true;
interlockDiagram.toolManager.resizingTool.isGridSnapEnabled = true;
// setting node Template
interlockDiagram.nodeTemplateMap = TemplateGatesMap.diagramTemplateGatesMap;
// setting Link Template
interlockDiagram.linkTemplate = LinkTemplate;
// Define the appearance and behavior for Groups:
// Groups consist of a title in the color given by the group node data
// above a translucent gray rectangle surrounding the member parts
interlockDiagram.groupTemplate = GroupTemplate;
const dataModel = {
linkFromPortIdProperty: "fromPort", // required information:
linkToPortIdProperty: "toPort", // identifies data property names
linkLabelKeysProperty: "labelKeys",
nodeDataArray: [],
linkDataArray: [],
latchTermArray: [],
channels: []
};
interlockDiagram.model = new go.GraphLinksModel(dataModel);
ensureHasNotField(interlockDiagram.model.nodeDataArray);
interlockDiagram.toolManager.linkingTool.archetypeLabelNodeData = {
category: "LinkLabel",
};
}