mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-19 15:30:03 +02:00
Fix for text sizing calculations ans possibly insertion of a bug
This commit is contained in:
@@ -38,7 +38,8 @@ async function addHtmlSpan(element, node, width, classes, addBackground = false)
|
|||||||
|
|
||||||
applyStyle(div, node.labelStyle);
|
applyStyle(div, node.labelStyle);
|
||||||
div.style('display', 'table-cell');
|
div.style('display', 'table-cell');
|
||||||
div.style('white-space', 'nowrap');
|
// KS: Why is this here?
|
||||||
|
// div.style('white-space', 'nowrap');
|
||||||
div.style('line-height', '1.5');
|
div.style('line-height', '1.5');
|
||||||
div.style('max-width', width + 'px');
|
div.style('max-width', width + 'px');
|
||||||
div.style('text-align', 'center');
|
div.style('text-align', 'center');
|
||||||
|
@@ -9,8 +9,11 @@ export async function text(parent: SVGAElement, node: Node): Promise<SVGAElement
|
|||||||
|
|
||||||
const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));
|
const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));
|
||||||
|
|
||||||
const totalWidth = Math.max(bbox.width + node.padding, node?.width || 0);
|
// width > labelWidth
|
||||||
const totalHeight = Math.max(bbox.height + node.padding, node?.height || 0);
|
|
||||||
|
// labelWidth > width
|
||||||
|
const totalWidth = node?.width ?? bbox.width;
|
||||||
|
const totalHeight = Math.max(bbox.height, node?.height ?? 0);
|
||||||
const x = -totalWidth / 2;
|
const x = -totalWidth / 2;
|
||||||
const y = -totalHeight / 2;
|
const y = -totalHeight / 2;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user