From 088fc392abc0c49503b8b0b1c9113442f6be93a1 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Wed, 15 Nov 2023 09:42:35 +0530 Subject: [PATCH] Fix SVG width --- packages/mermaid/src/diagrams/packet/renderer.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/mermaid/src/diagrams/packet/renderer.ts b/packages/mermaid/src/diagrams/packet/renderer.ts index 21b941a17..2ef4ab7cd 100644 --- a/packages/mermaid/src/diagrams/packet/renderer.ts +++ b/packages/mermaid/src/diagrams/packet/renderer.ts @@ -2,7 +2,6 @@ import type { Diagram } from '../../Diagram.js'; import type { PacketDiagramConfig } from '../../config.type.js'; import type { DiagramRenderer, DrawDefinition, Group, SVG } from '../../diagram-api/types.js'; import { selectSvgElement } from '../../rendering-util/selectSvgElement.js'; -import { configureSvgSize } from '../../setupGraphViewbox.js'; import type { PacketDB, PacketWord } from './types.js'; // eslint-disable-next-line @typescript-eslint/no-unused-vars @@ -17,8 +16,8 @@ const draw: DrawDefinition = (_text, id, _version, diagram: Diagram) => { const svgWidth = bitWidth * bitsPerRow + 2; const svg: SVG = selectSvgElement(id); - configureSvgSize(svg, svgHeight, svgWidth, true); - svg.attr('height', svgHeight + 'px'); + svg.attr('width', '100%'); + svg.attr('viewbox', `0 0 ${svgWidth} ${svgHeight}`); for (const [row, packet] of words.entries()) { drawWord(svg, packet, row, config);