Skip to content

Commit ca75985

Browse files
author
yeongseon
committed
fix: improve mermaid zoom readability with white background and 1.5x initial scale
1 parent 1961311 commit ca75985

2 files changed

Lines changed: 23 additions & 2 deletions

File tree

docs/javascripts/mermaid-zoom.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
var currentPlaceholder = null;
3131
var currentHost = null;
32-
var scale = 1;
32+
var scale = 1.5;
3333
var panX = 0;
3434
var panY = 0;
3535

@@ -51,7 +51,7 @@
5151

5252
currentPlaceholder = null;
5353
currentHost = null;
54-
scale = 1;
54+
scale = 1.5;
5555
panX = 0;
5656
panY = 0;
5757

@@ -90,6 +90,7 @@
9090

9191
requestAnimationFrame(function () {
9292
parts.overlay.classList.add("mermaid-zoom-visible");
93+
applyTransform();
9394
});
9495

9596
parts.closeBtn.addEventListener("click", closeOverlay);

docs/stylesheets/extra.css

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,26 @@
6262
.mermaid-zoom-container svg {
6363
max-width: none;
6464
max-height: none;
65+
shape-rendering: geometricPrecision;
66+
text-rendering: optimizeLegibility;
67+
}
68+
69+
/* Improve SVG readability in zoom overlay */
70+
.mermaid-zoom-container .mermaid {
71+
background: #fff;
72+
border-radius: 8px;
73+
padding: 1rem;
74+
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
75+
}
76+
77+
/* Ensure text and colors render crisply */
78+
.mermaid-zoom-container svg text {
79+
-webkit-font-smoothing: antialiased;
80+
-moz-osx-font-smoothing: grayscale;
81+
}
82+
83+
.mermaid-zoom-container svg * {
84+
vector-effect: non-scaling-stroke;
6585
}
6686

6787
.mermaid {

0 commit comments

Comments
 (0)