Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions packages/mermaid/src/dagre-wrapper/edges.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,10 @@ export const insertEdgeLabel = async (elem, edge) => {
setTerminalWidth(fo, edge.startLabelLeft);
}
if (edge.startLabelRight) {
// Create the actual text element
const startEdgeLabelRight = elem.insert('g').attr('class', 'edgeTerminals');
const inner = startEdgeLabelRight.insert('g').attr('class', 'inner');
const startLabelElement = await createLabel(
startEdgeLabelRight,
edge.startLabelRight,
edge.labelStyle
);
const startLabelElement = await createLabel(inner, edge.startLabelRight, edge.labelStyle);
fo = startLabelElement;
inner.node().appendChild(startLabelElement);
let slBox = startLabelElement.getBBox();
if (useHtmlLabels) {
const div = startLabelElement.children[0];
Expand All @@ -124,7 +118,6 @@ export const insertEdgeLabel = async (elem, edge) => {
setTerminalWidth(fo, edge.startLabelRight);
}
if (edge.endLabelLeft) {
// Create the actual text element
const endEdgeLabelLeft = elem.insert('g').attr('class', 'edgeTerminals');
const inner = endEdgeLabelLeft.insert('g').attr('class', 'inner');
const endLabelElement = await createLabel(inner, edge.endLabelLeft, edge.labelStyle);
Expand All @@ -139,16 +132,13 @@ export const insertEdgeLabel = async (elem, edge) => {
}
inner.attr('transform', computeLabelTransform(slBox, useHtmlLabels));

endEdgeLabelLeft.node().appendChild(endLabelElement);

if (!terminalLabels[edge.id]) {
terminalLabels[edge.id] = {};
}
terminalLabels[edge.id].endLeft = endEdgeLabelLeft;
setTerminalWidth(fo, edge.endLabelLeft);
}
if (edge.endLabelRight) {
// Create the actual text element
const endEdgeLabelRight = elem.insert('g').attr('class', 'edgeTerminals');
const inner = endEdgeLabelRight.insert('g').attr('class', 'inner');
const endLabelElement = await createLabel(inner, edge.endLabelRight, edge.labelStyle);
Expand All @@ -163,7 +153,6 @@ export const insertEdgeLabel = async (elem, edge) => {
}
inner.attr('transform', computeLabelTransform(slBox, useHtmlLabels));

endEdgeLabelRight.node().appendChild(endLabelElement);
if (!terminalLabels[edge.id]) {
terminalLabels[edge.id] = {};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,11 +345,16 @@ export const render = async (data4Layout, svg) => {
const edge2 = structuredClone(edge);
edge1.label = '';
edge1.arrowTypeEnd = 'none';
edge1.endLabelLeft = '';
edge1.id = nodeId + '-cyclic-special-1';
edgeMid.startLabelRight = '';
edgeMid.endLabelLeft = '';
edgeMid.arrowTypeStart = 'none';
edgeMid.arrowTypeEnd = 'none';
edgeMid.id = nodeId + '-cyclic-special-mid';
edge2.label = '';
edge2.startLabelRight = '';
edge2.arrowTypeStart = 'none';
if (node.isGroup) {
edge1.fromCluster = nodeId;
edge2.toCluster = nodeId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ export const insertEdgeLabel = async (elem, edge) => {
setTerminalWidth(fo, edge.startLabelLeft);
}
if (edge.startLabelRight) {
// Create the actual text element
const startEdgeLabelRight = elem.insert('g').attr('class', 'edgeTerminals');
const inner = startEdgeLabelRight.insert('g').attr('class', 'inner');
const startLabelElement = await createLabel(
Expand All @@ -159,7 +158,6 @@ export const insertEdgeLabel = async (elem, edge) => {
false
);
fo = startLabelElement;
inner.node().appendChild(startLabelElement);
let slBox = startLabelElement.getBBox();
if (useHtmlLabels) {
const div = startLabelElement.children[0];
Expand All @@ -177,7 +175,6 @@ export const insertEdgeLabel = async (elem, edge) => {
setTerminalWidth(fo, edge.startLabelRight);
}
if (edge.endLabelLeft) {
// Create the actual text element
const endEdgeLabelLeft = elem.insert('g').attr('class', 'edgeTerminals');
const inner = endEdgeLabelLeft.insert('g').attr('class', 'inner');
const endLabelElement = await createLabel(
Expand All @@ -198,19 +195,15 @@ export const insertEdgeLabel = async (elem, edge) => {
}
inner.attr('transform', computeLabelTransform(slBox, useHtmlLabels));

endEdgeLabelLeft.node().appendChild(endLabelElement);

if (!terminalLabels.get(edge.id)) {
terminalLabels.set(edge.id, {});
}
terminalLabels.get(edge.id).endLeft = endEdgeLabelLeft;
setTerminalWidth(fo, edge.endLabelLeft);
}
if (edge.endLabelRight) {
// Create the actual text element
const endEdgeLabelRight = elem.insert('g').attr('class', 'edgeTerminals');
const inner = endEdgeLabelRight.insert('g').attr('class', 'inner');

const endLabelElement = await createLabel(
inner,
edge.endLabelRight,
Expand All @@ -229,7 +222,6 @@ export const insertEdgeLabel = async (elem, edge) => {
}
inner.attr('transform', computeLabelTransform(slBox, useHtmlLabels));

endEdgeLabelRight.node().appendChild(endLabelElement);
if (!terminalLabels.get(edge.id)) {
terminalLabels.set(edge.id, {});
}
Expand Down
Loading