Fix for padding issue and some cleanup

This commit is contained in:
Knut Sveidqvist
2022-06-14 20:09:55 +02:00
parent 3b8d74f1f9
commit 69b7b0e029
4 changed files with 15 additions and 12 deletions

View File

@@ -22,16 +22,16 @@
<body>
<h1>info below</h1>
<div class="flex">
<div class="mermaid2" style="width: 50%; height: 20%;">
<div class="mermaid" style="width: 50%; height: 20%;">
flowchart BT
subgraph two
b1
subgraph S1
sub1 -->sub2
end
subgraph three
c1-->c2
subgraph S2
sub4
end
c1 --apa apa apa--> b1
two --> c2
S1 --> S2
sub1 --> sub4
</div>
<div class="mermaid2" style="width: 50%; height: 200px;">
sequenceDiagram
@@ -163,7 +163,7 @@ _one --> b
// arrowMarkerAbsolute: true,
// themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}',
logLevel: 0,
flowchart: { curve: 'cardinal', htmlLabels: true },
flowchart: { curve: 'cardinal', htmlLabels: false },
// gantt: { axisFormat: '%m/%d/%Y' },
sequence: { actorMargin: 50, showSequenceNumbers: true },
// sequenceDiagram: { actorMargin: 300 } // deprecated

View File

@@ -137,7 +137,7 @@ flowchart TD
flowchart LR
a["<strong>Haiya</strong>"]---->b
</div>
<div class="mermaid2" style="">
<div class="mermaid" style="">
flowchart LR
%%{init: { "logLevel": 1, "flowchart": {"htmlLabels":true }} }%%
a["<strong>Haiya</strong>"]---->b

View File

@@ -471,7 +471,6 @@ export const draw = function (text, id) {
rect.setAttribute('ry', 0);
rect.setAttribute('width', dim.width);
rect.setAttribute('height', dim.height);
// rect.setAttribute('style', 'fill:#e8e8e8;');
label.insertBefore(rect, label.firstChild);
}

View File

@@ -931,6 +931,10 @@ export const setupGraphViewbox = function (graph, svgElem, padding, useMaxWidth)
if (sWidth > width) {
tx = (sWidth - width) / 2 + padding;
width = sWidth + padding * 2;
} else {
if (Math.abs(sWidth - width) >= 2 * padding + 1) {
width = width - padding;
}
}
if (sHeight > height) {
ty = (sHeight - height) / 2 + padding;