Skip to content

Commit 3cd968f

Browse files
author
y-yamasaki
committed
mermaid調整
1 parent af0efc5 commit 3cd968f

2 files changed

Lines changed: 15 additions & 6 deletions

File tree

WebSite/assets/css/blog.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,13 +622,13 @@
622622

623623
/* mermaid SVG 最大高さの制限(縦長すぎるのを防ぐ) */
624624
.mermaid-wrapper {
625-
max-height: 40vh;
625+
max-height: 60vh;
626626
overflow: auto;
627627
}
628628

629629
/* SVG 本体にも制限をかけて縦長表示を防ぐ(アスペクトを維持) */
630630
.mermaid-wrapper .mermaid svg {
631-
max-height: 80vh;
631+
max-height: 120vh;
632632
height: auto;
633633
max-width: 100%;
634634
display: block;

WebSite/assets/js/mermaid-interactions.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"use strict";
1313

1414
// Config
15-
const MIN_SCALE = 0.25;
15+
const MIN_SCALE = 0.5;
1616
const MAX_SCALE = 4.0;
1717
const ZOOM_SENSITIVITY = 0.001;
1818

@@ -46,9 +46,11 @@
4646
// Even if we remove the property setting in JS, the CSS rule in blog.css might still apply it.
4747
// Setting it to 'auto' overrides the CSS and forces vector re-rendering on zoom.
4848
content.style.willChange = "auto";
49-
5049
content.style.transition = "transform 0.1s ease-out"; // Smooth transition for small updates
5150

51+
// Disable native scroll to keep toolbar fixed and enable wheel panning
52+
wrapper.style.overflow = "hidden";
53+
5254
// RAF loop
5355
let rafId = null;
5456
function updateTransform() {
@@ -129,16 +131,23 @@
129131
scheduleUpdate();
130132
}
131133

132-
// Wheel Zoom
134+
// Wheel Zoom & Pan
133135
wrapper.addEventListener(
134136
"wheel",
135137
(e) => {
138+
e.preventDefault();
139+
136140
if (e.ctrlKey || e.metaKey) {
137-
e.preventDefault();
141+
// Zoom
138142
const delta = -e.deltaY;
139143
const factor = Math.exp(delta * ZOOM_SENSITIVITY);
140144
const center = getPoint(e.clientX, e.clientY);
141145
zoomTo(state.scale * factor, center);
146+
} else {
147+
// Pan
148+
state.x -= e.deltaX;
149+
state.y -= e.deltaY;
150+
scheduleUpdate();
142151
}
143152
},
144153
{ passive: false },

0 commit comments

Comments
 (0)