diff --git a/cypress/platform/knsv-pos.html b/cypress/platform/knsv-pos.html
index e146de579..1b6dc5504 100644
--- a/cypress/platform/knsv-pos.html
+++ b/cypress/platform/knsv-pos.html
@@ -121,22 +121,22 @@
S --> T: angrepp
T --> U: Apa
T --> V: Varg
+ C
+ D
+ E
- B
- C
- D
- `;
- code = `
- stateDiagram
- A0
- state subbe {
- subState
- B
- }
- C
- D
- E
`;
+ // code = `
+ // stateDiagram
+ // A0
+ // state subbe {
+ // subState
+ // B
+ // }
+ // C
+ // D
+ // E
+ // `;
let positions = {
nodes: {
@@ -182,10 +182,10 @@
},
};
- positions = {
- nodes: {},
- edges: {},
- };
+ // positions = {
+ // nodes: {},
+ // edges: {},
+ // };
const { svg } = await mermaid.render('the-id-of-the-svg', code, undefined, positions);
// if (window?.calcIntersections) {
diff --git a/packages/mermaid/package.json b/packages/mermaid/package.json
index 4622d7b90..f87597a85 100644
--- a/packages/mermaid/package.json
+++ b/packages/mermaid/package.json
@@ -1,6 +1,6 @@
{
"name": "@mermaid-chart/mermaid",
- "version": "11.0.2-b.3",
+ "version": "11.0.2-b.4",
"description": "Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.",
"type": "module",
"module": "./dist/mermaid.core.mjs",
diff --git a/packages/mermaid/src/rendering-util/layout-algorithms/fixed/index.js b/packages/mermaid/src/rendering-util/layout-algorithms/fixed/index.js
index f65d1bdd5..568fc4082 100644
--- a/packages/mermaid/src/rendering-util/layout-algorithms/fixed/index.js
+++ b/packages/mermaid/src/rendering-util/layout-algorithms/fixed/index.js
@@ -123,10 +123,10 @@ const doRender = async (_elem, data4Layout, siteConfig, positions) => {
for (const child of children) {
const width = child.width || 50;
const height = child.height || 50;
- // log.info('STO node child 1', child.id, width, height);
+ // log.info('BBB node child 1', child.id, width, height);
calculatePosition(child, positions, childDB);
// log.info(
- // 'STO node child 2',
+ // 'BBB node child 2',
// child.id,
// positions.nodes[child.id].x,
// positions.nodes[child.id].y
@@ -136,16 +136,20 @@ const doRender = async (_elem, data4Layout, siteConfig, positions) => {
minYP = Math.min(positions.nodes[child.id].y - height / 2, minYP);
maxYP = Math.max(positions.nodes[child.id].y + height / 2, maxYP);
}
- positions.nodes[node.id] = {
- x: minX + (maxX - minX) / 2 - 5,
- y: maxY + 15,
- width: maxX - minX + 20,
- height: maxYP - minYP + 30,
- };
+ if (!positions.nodes[node.id]) {
+ positions.nodes[node.id] = {
+ x: minX + (maxX - minX) / 2,
+ y: maxY + 15,
+ width: maxX - minX + 20,
+ height: maxYP - minYP + 30,
+ };
+ }
} else {
- // Simple case
- positions.nodes[node.id] = { x: xPos, y: maxY + 20 };
- xPos = xPos + 75;
+ if (!positions.nodes[node.id]) {
+ // Simple case
+ positions.nodes[node.id] = { x: xPos, y: maxY + 20 };
+ xPos = xPos + 75;
+ }
}
}
data4Layout.nodes.map(function (node) {