Skip to content

Commit 20f8d1e

Browse files
committed
#6 - [Feature] enable zoom and pan for large drawings
1 parent 7dd5c0d commit 20f8d1e

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

MermaidEditor/LivePreview/index.html

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
}
5252
#mermaidGraph {
5353
height: 100vh;
54-
max-height: 100vh;
54+
/* max-height: 100vh;*/
5555
overflow: auto;
5656
}
5757

@@ -200,6 +200,18 @@
200200
canvas.width = width ?? svgElem.clientWidth;
201201
canvas.height = height ?? svgElem.clientHeight;
202202

203+
const myGraph = document.querySelector("#mermaidGraph");
204+
if (width > 666 || height > 666)
205+
{
206+
myGraph.style.width = canvas.width + "px";
207+
myGraph.style.height = canvas.height + "px";
208+
}
209+
else
210+
{
211+
myGraph.style.width = null;
212+
myGraph.style.height = null;
213+
}
214+
203215
await drawInlineSVG(svgElem, ctx);
204216
var img = canvas.toDataURL("image/png");
205217
console.log(img);

0 commit comments

Comments
 (0)