From 25039290daa8f513261cf99fdc80d06e805442a1 Mon Sep 17 00:00:00 2001 From: itsalam Date: Tue, 19 Sep 2023 10:40:14 -0700 Subject: [PATCH] fixed title bounds calculation, removed extra title from merging issues --- packages/mermaid/src/diagrams/flowchart/elk/flowRenderer-elk.js | 2 -- packages/mermaid/src/utils.ts | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/mermaid/src/diagrams/flowchart/elk/flowRenderer-elk.js b/packages/mermaid/src/diagrams/flowchart/elk/flowRenderer-elk.js index 79b2c8fbdad..ec40349c879 100644 --- a/packages/mermaid/src/diagrams/flowchart/elk/flowRenderer-elk.js +++ b/packages/mermaid/src/diagrams/flowchart/elk/flowRenderer-elk.js @@ -860,8 +860,6 @@ export const draw = async function (text, id, _version, diagObj) { const doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document; const svg = root.select(`[id="${id}"]`); - - utils.insertTitle(svg, 'flowchartTitleText', conf.titleTopMargin, diagObj.db.getDiagramTitle()); // Define the supported markers for the diagram const markers = ['point', 'circle', 'cross']; diff --git a/packages/mermaid/src/utils.ts b/packages/mermaid/src/utils.ts index d6f16a08aa4..e706ef12270 100644 --- a/packages/mermaid/src/utils.ts +++ b/packages/mermaid/src/utils.ts @@ -829,7 +829,7 @@ export const insertTitle = ( parent .append('text') .text(title) - .attr('x', '50%') + .attr('x', bounds.x + bounds.width / 2) .attr('y', -titleTopMargin) .attr('class', cssClass); };