From 165a4f6825fc9d1a3b59461bf631169255f7ecef Mon Sep 17 00:00:00 2001 From: omkarht Date: Wed, 4 Sep 2024 13:58:45 +0530 Subject: [PATCH] updated trapezoidalPentagon shape --- .../rendering-elements/shapes/trapezoidalPentagon.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/mermaid/src/rendering-util/rendering-elements/shapes/trapezoidalPentagon.ts b/packages/mermaid/src/rendering-util/rendering-elements/shapes/trapezoidalPentagon.ts index b9f97f349..0f883d048 100644 --- a/packages/mermaid/src/rendering-util/rendering-elements/shapes/trapezoidalPentagon.ts +++ b/packages/mermaid/src/rendering-util/rendering-elements/shapes/trapezoidalPentagon.ts @@ -11,9 +11,12 @@ export const trapezoidalPentagon = async (parent: SVGAElement, node: Node) => { const { labelStyles, nodeStyles } = styles2String(node); node.labelStyle = labelStyles; const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node)); + const nodePadding = node.padding ?? 0; + const labelPaddingX = node.look === 'neo' ? nodePadding * 2 : nodePadding; + const labelPaddingY = node.look === 'neo' ? nodePadding * 1 : nodePadding; const widthMultiplier = bbox.width < 40 ? 3 : 1.25; - const w = (bbox.width + node.padding) * widthMultiplier; - const h = bbox.height + node.padding; + const w = Math.max((bbox.width + labelPaddingX) * widthMultiplier, node?.width ?? 0); + const h = Math.max(bbox.height + labelPaddingY, node?.height ?? 0); const { cssStyles } = node; // @ts-ignore - rough is not typed