Skip to content

Commit

Permalink
fix: Center version text in SVG
Browse files Browse the repository at this point in the history
  • Loading branch information
sidharthv96 committed Aug 14, 2023
1 parent 91b7d42 commit 5f95a26
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions packages/mermaid/src/diagrams/info/infoRenderer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { log } from '../../logger.js';
import { configureSvgSize } from '../../setupGraphViewbox.js';
import type { DrawDefinition, Group, SVG } from '../../diagram-api/types.js';
import type { DrawDefinition, SVG } from '../../diagram-api/types.js';
import { selectSvgElement } from '../../rendering-util/selectSvgElement.js';

/**
Expand All @@ -15,15 +15,14 @@ const draw: DrawDefinition = (text, id, version) => {

const svg: SVG = selectSvgElement(id);
configureSvgSize(svg, 100, 400, true);

const group: Group = svg.append('g');
group
svg
.append('text')
.attr('x', 100)
.attr('y', 40)
.attr('x', '50%')
.attr('y', '50%')
.attr('class', 'version')
.attr('font-size', 32)
.style('text-anchor', 'middle')
.attr('dominant-baseline', 'middle')
.attr('text-anchor', 'middle')
.text(`v${version}`);
};

Expand Down

0 comments on commit 5f95a26

Please sign in to comment.