Skip to content

Commit

Permalink
fix: Use configureSvgSize
Browse files Browse the repository at this point in the history
Co-authored-by: Reda Al Sulais <[email protected]>
  • Loading branch information
sidharthv96 and Yokozuna59 committed Nov 16, 2023
1 parent 480645d commit a8105f0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/mermaid/src/diagrams/packet/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ 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
Expand All @@ -16,11 +17,11 @@ const draw: DrawDefinition = (_text, id, _version, diagram: Diagram) => {
const svgWidth = bitWidth * bitsPerRow + 2;
const svg: SVG = selectSvgElement(id);

svg.attr('width', '100%');
svg.attr('viewbox', `0 0 ${svgWidth} ${svgHeight}`);
configureSvgSize(svg, svgHeight, svgWidth, config.useMaxWidth);

for (const [row, packet] of words.entries()) {
drawWord(svg, packet, row, config);
for (const [word, packet] of words.entries()) {
drawWord(svg, packet, word, config);
}

svg
Expand Down

0 comments on commit a8105f0

Please sign in to comment.