Luca448 commited on
Commit
b873791
·
1 Parent(s): ffe05f5

Savestate: Added render distance optimization to detective board and repositioned auto-scroll button to bottom right

Browse files
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.180</div>
69
 
70
  <!-- SVG Filters for Liquid Glass Refraction -->
71
  <svg width="0" height="0" style="position: absolute; pointer-events: none;">
 
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.181</div>
69
 
70
  <!-- SVG Filters for Liquid Glass Refraction -->
71
  <svg width="0" height="0" style="position: absolute; pointer-events: none;">
src/ai/research-canvas.js CHANGED
@@ -59,6 +59,34 @@ function scrollToLatestNode() {
59
 
60
  isUserScrolled = false;
61
  if (scrollBottomBtn) scrollBottomBtn.classList.remove('visible');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  }
63
 
64
  export async function initCanvas() {
@@ -129,6 +157,7 @@ export async function initCanvas() {
129
 
130
  isUserScrolled = true;
131
  if (scrollBottomBtn) scrollBottomBtn.classList.add('visible');
 
132
  }
133
  // Hide tooltip if active
134
  if (tooltip && tooltip.classList.contains('visible')) tooltip.classList.remove('visible');
@@ -176,6 +205,7 @@ export async function initCanvas() {
176
  if (tooltip && tooltip.classList.contains('visible')) {
177
  tooltip.classList.remove('visible'); // Hide tooltip on pan
178
  }
 
179
  });
180
  }
181
  }
@@ -205,14 +235,16 @@ export function addNode(id, label, type = 'query') {
205
  pin.style.left = `${posX}px`;
206
  pin.style.top = `${posY}px`;
207
 
 
 
208
  const pinHead = document.createElement('div');
209
  pinHead.className = 'db-pin-head';
210
  if (type === 'source') {
211
  pinHead.style.background = '#ff00aa';
212
- pinHead.style.boxShadow = '0 0 15px #ff00aa, 0 0 30px #ff00aa';
213
  } else {
214
  pinHead.style.background = '#00e5ff';
215
- pinHead.style.boxShadow = '0 0 15px #00e5ff, 0 0 30px #00e5ff';
216
  }
217
  pin.appendChild(pinHead);
218
 
@@ -231,6 +263,7 @@ export function addNode(id, label, type = 'query') {
231
  };
232
 
233
  panLayer.appendChild(pin);
 
234
 
235
  // Auto scroll down smoothly if user hasn't manually scrolled away
236
  if (!isUserScrolled) {
@@ -265,6 +298,7 @@ export function addEdge(fromId, toId) {
265
  svg.style.pointerEvents = 'none';
266
  svg.style.overflow = 'visible';
267
  svg.style.zIndex = '1';
 
268
 
269
  const sx = fromNode.x - (minX - padding);
270
  const sy = fromNode.y - (minY - padding);
 
59
 
60
  isUserScrolled = false;
61
  if (scrollBottomBtn) scrollBottomBtn.classList.remove('visible');
62
+ updateVisibility();
63
+ }
64
+
65
+ function updateVisibility() {
66
+ if (!panLayer) return;
67
+ const threshold = 1500; // pixels
68
+ const cameraY = -currentPanY;
69
+
70
+ panLayer.querySelectorAll('.db-pin').forEach(pin => {
71
+ const id = pin.dataset.id;
72
+ if (!id) return;
73
+ const node = nodesMap.get(id);
74
+ if (!node) return;
75
+ if (Math.abs(node.y - cameraY) > threshold) {
76
+ pin.style.display = 'none';
77
+ } else {
78
+ pin.style.display = 'block';
79
+ }
80
+ });
81
+
82
+ panLayer.querySelectorAll('.db-edge-svg').forEach(edge => {
83
+ const ey = parseFloat(edge.dataset.y);
84
+ if (Math.abs(ey - cameraY) > threshold) {
85
+ edge.style.display = 'none';
86
+ } else {
87
+ edge.style.display = 'block';
88
+ }
89
+ });
90
  }
91
 
92
  export async function initCanvas() {
 
157
 
158
  isUserScrolled = true;
159
  if (scrollBottomBtn) scrollBottomBtn.classList.add('visible');
160
+ updateVisibility();
161
  }
162
  // Hide tooltip if active
163
  if (tooltip && tooltip.classList.contains('visible')) tooltip.classList.remove('visible');
 
205
  if (tooltip && tooltip.classList.contains('visible')) {
206
  tooltip.classList.remove('visible'); // Hide tooltip on pan
207
  }
208
+ updateVisibility();
209
  });
210
  }
211
  }
 
235
  pin.style.left = `${posX}px`;
236
  pin.style.top = `${posY}px`;
237
 
238
+ pin.dataset.id = id;
239
+
240
  const pinHead = document.createElement('div');
241
  pinHead.className = 'db-pin-head';
242
  if (type === 'source') {
243
  pinHead.style.background = '#ff00aa';
244
+ pinHead.style.boxShadow = '0 0 15px #ff00aa';
245
  } else {
246
  pinHead.style.background = '#00e5ff';
247
+ pinHead.style.boxShadow = '0 0 15px #00e5ff';
248
  }
249
  pin.appendChild(pinHead);
250
 
 
263
  };
264
 
265
  panLayer.appendChild(pin);
266
+ updateVisibility();
267
 
268
  // Auto scroll down smoothly if user hasn't manually scrolled away
269
  if (!isUserScrolled) {
 
298
  svg.style.pointerEvents = 'none';
299
  svg.style.overflow = 'visible';
300
  svg.style.zIndex = '1';
301
+ svg.dataset.y = controlY;
302
 
303
  const sx = fromNode.x - (minX - padding);
304
  const sy = fromNode.y - (minY - padding);
src/styles/detective-board.css CHANGED
@@ -161,32 +161,36 @@
161
  /* Scroll to latest button */
162
  .db-scroll-bottom-btn {
163
  position: absolute;
164
- bottom: 120px;
165
- left: 50%;
166
- transform: translateX(-50%) translateY(20px);
167
- width: 44px;
168
- height: 44px;
 
169
  border-radius: 50%;
170
- background: rgba(0, 229, 255, 0.15);
171
- border: 1px solid rgba(0, 229, 255, 0.3);
172
  color: #00e5ff;
173
  display: flex;
174
  align-items: center;
175
  justify-content: center;
176
  cursor: pointer;
177
- opacity: 0.4;
178
  pointer-events: auto;
179
- transition: opacity 0.3s, transform 0.3s, background 0.2s;
180
  z-index: 999999;
181
  backdrop-filter: blur(8px);
 
182
  }
183
  .db-scroll-bottom-btn:hover {
184
- background: rgba(0, 229, 255, 0.3);
 
185
  }
186
  .db-scroll-bottom-btn.visible {
187
  opacity: 1;
188
- transform: translateX(-50%) translateY(0);
189
- pointer-events: auto;
 
190
  }
191
 
192
  /* SVG Edges */
 
161
  /* Scroll to latest button */
162
  .db-scroll-bottom-btn {
163
  position: absolute;
164
+ bottom: 30px;
165
+ right: 30px;
166
+ left: auto;
167
+ transform: none;
168
+ width: 56px;
169
+ height: 56px;
170
  border-radius: 50%;
171
+ background: rgba(0, 229, 255, 0.2);
172
+ border: 1px solid rgba(0, 229, 255, 0.5);
173
  color: #00e5ff;
174
  display: flex;
175
  align-items: center;
176
  justify-content: center;
177
  cursor: pointer;
178
+ opacity: 0.6;
179
  pointer-events: auto;
180
+ transition: opacity 0.3s, background 0.2s, transform 0.2s;
181
  z-index: 999999;
182
  backdrop-filter: blur(8px);
183
+ box-shadow: 0 4px 20px rgba(0,0,0,0.5);
184
  }
185
  .db-scroll-bottom-btn:hover {
186
+ background: rgba(0, 229, 255, 0.4);
187
+ transform: scale(1.05);
188
  }
189
  .db-scroll-bottom-btn.visible {
190
  opacity: 1;
191
+ background: rgba(0, 229, 255, 0.6);
192
+ border: 1px solid rgba(0, 229, 255, 1);
193
+ box-shadow: 0 0 20px rgba(0, 229, 255, 0.4);
194
  }
195
 
196
  /* SVG Edges */