From d9cb515faccf75d6308b612a8b3117411964c602 Mon Sep 17 00:00:00 2001 From: yari-dewalt Date: Fri, 5 Jul 2024 12:47:09 -0700 Subject: [PATCH] Include default pieWidth in totalWidth --- packages/mermaid/src/diagrams/pie/pieRenderer.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/mermaid/src/diagrams/pie/pieRenderer.ts b/packages/mermaid/src/diagrams/pie/pieRenderer.ts index b5cf340867..d88af76e38 100644 --- a/packages/mermaid/src/diagrams/pie/pieRenderer.ts +++ b/packages/mermaid/src/diagrams/pie/pieRenderer.ts @@ -187,7 +187,11 @@ export const draw: DrawDefinition = (text, id, _version, diagObj) => { .map((node) => (node as Element)?.getBoundingClientRect().right ?? 0) ); - const totalWidth = Math.max(circleOffset + furthestTextPos, MARGIN * 2 + titleTextWidth); + const totalWidth = Math.max( + pieWidth, + circleOffset + furthestTextPos, + MARGIN * 2 + titleTextWidth + ); // Set viewBox svg.attr('viewBox', `0 0 ${totalWidth} ${height}`);