diff --git a/packages/mermaid/src/rendering-util/rendering-elements/shapes/flippedTriangle.ts b/packages/mermaid/src/rendering-util/rendering-elements/shapes/flippedTriangle.ts index 9fb2582c7..c20372cda 100644 --- a/packages/mermaid/src/rendering-util/rendering-elements/shapes/flippedTriangle.ts +++ b/packages/mermaid/src/rendering-util/rendering-elements/shapes/flippedTriangle.ts @@ -14,8 +14,11 @@ export const flippedTriangle = async (parent: SVGAElement, node: Node): Promise< node.labelStyle = labelStyles; const { shapeSvg, bbox, label } = await labelHelper(parent, node, getNodeClasses(node)); - const w = bbox.width + (node.padding ?? 0); - const h = w + bbox.height; + const nodePadding = node.padding ?? 0; + const labelPaddingX = node.look === 'neo' ? nodePadding * 2 : nodePadding; + const labelPaddingY = node.look === 'neo' ? nodePadding * 1 : nodePadding; + const w = Math.max(bbox.width + (labelPaddingX ?? 0), node?.width ?? 0); + const h = Math.max(w + bbox.height, node?.width ?? 0); const tw = w + bbox.height; const points = [ @@ -55,7 +58,7 @@ export const flippedTriangle = async (parent: SVGAElement, node: Node): Promise< label.attr( 'transform', - `translate(${-bbox.width / 2 - (bbox.x - (bbox.left ?? 0))}, ${-h / 2 + (node.padding ?? 0) / 2 + (bbox.y - (bbox.top ?? 0))})` + `translate(${-bbox.width / 2 - (bbox.x - (bbox.left ?? 0))}, ${-h / 2 + (labelPaddingY ?? 0) / 2 + (bbox.y - (bbox.top ?? 0))})` ); node.intersect = function (point) { diff --git a/packages/mermaid/src/rendering-util/rendering-elements/shapes/taggedRect.ts b/packages/mermaid/src/rendering-util/rendering-elements/shapes/taggedRect.ts index c6d048897..c2c32b4f2 100644 --- a/packages/mermaid/src/rendering-util/rendering-elements/shapes/taggedRect.ts +++ b/packages/mermaid/src/rendering-util/rendering-elements/shapes/taggedRect.ts @@ -11,8 +11,11 @@ export const taggedRect = async (parent: SVGAElement, node: Node) => { const { labelStyles, nodeStyles } = styles2String(node); node.labelStyle = labelStyles; const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node)); - const w = Math.max(bbox.width + (node.padding ?? 0) * 2, node?.width ?? 0); - const h = Math.max(bbox.height + (node.padding ?? 0) * 2, node?.height ?? 0); + const nodePadding = node.padding ?? 0; + const labelPaddingX = node.look === 'neo' ? nodePadding * 2 : nodePadding; + const labelPaddingY = node.look === 'neo' ? nodePadding * 1 : nodePadding; + const w = Math.max(bbox.width + (labelPaddingX ?? 0) * 2, node?.width ?? 0); + const h = Math.max(bbox.height + (labelPaddingY ?? 0) * 2, node?.height ?? 0); const x = -w / 2; const y = -h / 2; const tagWidth = 0.2 * w; diff --git a/packages/mermaid/src/rendering-util/rendering-elements/shapes/triangle.ts b/packages/mermaid/src/rendering-util/rendering-elements/shapes/triangle.ts index 1bbc0a598..2bb0f82f6 100644 --- a/packages/mermaid/src/rendering-util/rendering-elements/shapes/triangle.ts +++ b/packages/mermaid/src/rendering-util/rendering-elements/shapes/triangle.ts @@ -14,8 +14,10 @@ export const triangle = async (parent: SVGAElement, node: Node): Promise