Skip to content

Commit

Permalink
Fix for text alignment issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ashishjain0512 committed Aug 22, 2024
1 parent 029a444 commit 99ee235
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions packages/mermaid/src/rendering-util/createText.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ async function addHtmlSpan(element, node, width, classes, addBackground = false)
div.style('white-space', 'nowrap');
div.style('line-height', '1.5');
div.style('max-width', width + 'px');
div.style('text-align', 'center');
div.attr('xmlns', 'http://www.w3.org/1999/xhtml');
if (addBackground) {
div.attr('class', 'labelBkg');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ export const rectWithTitle = async (parent: SVGElement, node: Node) => {
)
);

if (evaluate(getConfig()?.flowchart?.htmlLabels)) {
const div = descr.children[0];
const dv = select(descr);
bbox = div.getBoundingClientRect();
dv.attr('width', bbox.width);
dv.attr('height', bbox.height);
}
//if (evaluate(getConfig()?.flowchart?.htmlLabels)) {
const div = descr.children[0];
const dv = select(descr);
bbox = div.getBoundingClientRect();
dv.attr('width', bbox.width);
dv.attr('height', bbox.height);
// }

const halfPadding = (node.padding || 0) / 2;
select(descr).attr(
Expand Down

0 comments on commit 99ee235

Please sign in to comment.