Skip to content

Commit

Permalink
Centered Title function and changed rendering order for Elk flowchart…
Browse files Browse the repository at this point in the history
… to find Boundingbox
  • Loading branch information
itsalam committed Oct 26, 2023
1 parent c08f927 commit 5e966d6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,7 @@ export const draw = async function (text, id, _version, diagObj) {
log.info('after layout', JSON.stringify(graph, null, 2));
const g = await elk.layout(graph);
drawNodes(0, 0, g.children, svg, subGraphsEl, diagObj, 0);
utils.insertTitle(svg, 'flowchartTitleText', conf.titleTopMargin, diagObj.db.getDiagramTitle());
log.info('after layout', g);
g.edges?.map((edge) => {
insertEdge(edgesEl, edge, edge.edgeData, diagObj, parentLookupDb, id);
Expand Down
2 changes: 1 addition & 1 deletion packages/mermaid/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ export const insertTitle = (
parent
.append('text')
.text(title)
.attr('x', bounds.x + bounds.width / 2)
.attr('x', '50%')
.attr('y', -titleTopMargin)
.attr('class', cssClass);
};
Expand Down

0 comments on commit 5e966d6

Please sign in to comment.