Fix for text alignment issue

This commit is contained in:
Ashish Jain 2024-08-22 17:52:48 +02:00
parent 029a444d32
commit 99ee235e75
2 changed files with 8 additions and 7 deletions

View File

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

View File

@ -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(