Luca448 commited on
Commit
ee4d64a
·
1 Parent(s): 3ea1bf5

Savestate: Update detective board to support vertical mouse wheel scrolling and fix SVG viewbox

Browse files
Files changed (2) hide show
  1. index.html +2 -2
  2. src/ai/research-canvas.js +22 -7
index.html CHANGED
@@ -65,7 +65,7 @@
65
  </head>
66
  <body class="dark-theme in-chat-view" data-bg-style="fluid-dark">
67
 
68
- <div id="live-version-badge" style="position: fixed; top: 50px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--text-secondary); opacity: 0.6; z-index: 99999; pointer-events: none; font-weight: 500; font-family: monospace; letter-spacing: 1px; background: rgba(0,0,0,0.2); padding: 2px 8px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.05);">BUILD 1.8.177</div>
69
 
70
  <!-- SVG Filters for Liquid Glass Refraction -->
71
  <svg width="0" height="0" style="position: absolute; pointer-events: none;">
@@ -227,7 +227,7 @@
227
  <div class="db-scene" id="db-scene">
228
  <div class="db-canvas" id="db-canvas">
229
  <div class="db-pan-layer" id="db-pan-layer">
230
- <svg class="db-svg" id="db-svg"></svg>
231
  </div>
232
  </div>
233
  <button class="db-scroll-bottom-btn" id="db-scroll-bottom-btn" title="Zum neuesten Element scrollen">
 
65
  </head>
66
  <body class="dark-theme in-chat-view" data-bg-style="fluid-dark">
67
 
68
+ <div id="live-version-badge" style="position: fixed; top: 50px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--text-secondary); opacity: 0.6; z-index: 99999; pointer-events: none; font-weight: 500; font-family: monospace; letter-spacing: 1px; background: rgba(0,0,0,0.2); padding: 2px 8px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.05);">BUILD 1.8.178</div>
69
 
70
  <!-- SVG Filters for Liquid Glass Refraction -->
71
  <svg width="0" height="0" style="position: absolute; pointer-events: none;">
 
227
  <div class="db-scene" id="db-scene">
228
  <div class="db-canvas" id="db-canvas">
229
  <div class="db-pan-layer" id="db-pan-layer">
230
+ <svg class="db-svg" id="db-svg" width="10000" height="10000" viewBox="0 0 10000 10000" xmlns="http://www.w3.org/2000/svg"></svg>
231
  </div>
232
  </div>
233
  <button class="db-scroll-bottom-btn" id="db-scroll-bottom-btn" title="Zum neuesten Element scrollen">
src/ai/research-canvas.js CHANGED
@@ -120,15 +120,30 @@ export async function initCanvas() {
120
  let startX, startY, startPanX, startPanY;
121
 
122
  scene.addEventListener('wheel', (e) => {
123
- e.preventDefault();
124
- // Optional: center zoom around mouse position would be complex with pan adjustment,
125
- // so we simply scale the entire scene from center for now.
126
- const zoomDelta = e.deltaY > 0 ? 0.9 : 1.1; // zoom out or in
127
- currentZoom = Math.min(Math.max(0.2, currentZoom * zoomDelta), 2.5);
128
- if (canvas) canvas.style.setProperty('--zoom', currentZoom);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  // Hide tooltip if active
130
  if (tooltip && tooltip.classList.contains('visible')) tooltip.classList.remove('visible');
131
- });
132
 
133
  scene.addEventListener('mousedown', (e) => {
134
  if (e.target === scrollBottomBtn || e.target.closest('#db-scroll-bottom-btn')) return;
 
120
  let startX, startY, startPanX, startPanY;
121
 
122
  scene.addEventListener('wheel', (e) => {
123
+ // Optional zoom with ctrl/meta key
124
+ if (e.ctrlKey || e.metaKey) {
125
+ e.preventDefault();
126
+ const zoomDelta = e.deltaY > 0 ? 0.9 : 1.1; // zoom out or in
127
+ currentZoom = Math.min(Math.max(0.2, currentZoom * zoomDelta), 2.5);
128
+ if (canvas) canvas.style.setProperty('--zoom', currentZoom);
129
+ } else {
130
+ // Normal scroll -> Vertical panning along the spine
131
+ // If deltaY is positive (scroll down), nodes move UP on screen (screen Y is negative)
132
+ e.preventDefault();
133
+ const canvasDelta = unprojectFromScreen(0, -e.deltaY);
134
+ currentPanX += canvasDelta.x;
135
+ currentPanY += canvasDelta.y;
136
+ if (canvas) canvas.style.setProperty('--pan-x', `${currentPanX}px`);
137
+ if (canvas) canvas.style.setProperty('--pan-y', `${currentPanY}px`);
138
+ if (panLayer) panLayer.style.setProperty('--pan-x', `${currentPanX}px`);
139
+ if (panLayer) panLayer.style.setProperty('--pan-y', `${currentPanY}px`);
140
+
141
+ isUserScrolled = true;
142
+ if (scrollBottomBtn) scrollBottomBtn.classList.add('visible');
143
+ }
144
  // Hide tooltip if active
145
  if (tooltip && tooltip.classList.contains('visible')) tooltip.classList.remove('visible');
146
+ }, { passive: false });
147
 
148
  scene.addEventListener('mousedown', (e) => {
149
  if (e.target === scrollBottomBtn || e.target.closest('#db-scroll-bottom-btn')) return;