Centered Title function and changed rendering order for Elk flowchart to find Boundingbox

This commit is contained in:
itsalam 2023-09-19 10:10:27 -07:00 committed by Vincent Lam
parent c08f927d60
commit 5e966d60b0
2 changed files with 2 additions and 1 deletions

View File

@ -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);

View File

@ -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);
};