mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
Fix SVG width
This commit is contained in:
parent
0d7644c782
commit
088fc392ab
@ -2,7 +2,6 @@ import type { Diagram } from '../../Diagram.js';
|
|||||||
import type { PacketDiagramConfig } from '../../config.type.js';
|
import type { PacketDiagramConfig } from '../../config.type.js';
|
||||||
import type { DiagramRenderer, DrawDefinition, Group, SVG } from '../../diagram-api/types.js';
|
import type { DiagramRenderer, DrawDefinition, Group, SVG } from '../../diagram-api/types.js';
|
||||||
import { selectSvgElement } from '../../rendering-util/selectSvgElement.js';
|
import { selectSvgElement } from '../../rendering-util/selectSvgElement.js';
|
||||||
import { configureSvgSize } from '../../setupGraphViewbox.js';
|
|
||||||
import type { PacketDB, PacketWord } from './types.js';
|
import type { PacketDB, PacketWord } from './types.js';
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// 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 svgWidth = bitWidth * bitsPerRow + 2;
|
||||||
const svg: SVG = selectSvgElement(id);
|
const svg: SVG = selectSvgElement(id);
|
||||||
|
|
||||||
configureSvgSize(svg, svgHeight, svgWidth, true);
|
svg.attr('width', '100%');
|
||||||
svg.attr('height', svgHeight + 'px');
|
svg.attr('viewbox', `0 0 ${svgWidth} ${svgHeight}`);
|
||||||
|
|
||||||
for (const [row, packet] of words.entries()) {
|
for (const [row, packet] of words.entries()) {
|
||||||
drawWord(svg, packet, row, config);
|
drawWord(svg, packet, row, config);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user