Add syntax highlighting, OSD, search, perf optimizations, and UX improvements

- troika-three-text MSDF rendering for resolution-independent code text
- highlight.js syntax highlighting with Catppuccin Mocha colors
- Lazy text pool: max 25 concurrent code meshes, created on demand
- LOD throttled to every 3 frames, OSD every 10
- 45° tiled watermark (repo/path/filename) behind code
- OSD: breadcrumb, file stats, zoom level
- Search: / or Ctrl+F to find and fly to files
- Keybindings: WASD pan, Q/E rotate, Z/C zoom, Space overview, ? help modal
- Mouse wheel zoom vs trackpad pan detection via event frequency
- Zip GBK filename encoding fallback for Chinese filenames
- Docker volume persistence for SQLite cache
This commit is contained in:
2026-04-06 16:30:28 +01:00
parent 7232d4cc37
commit 4aec9510e4
9 changed files with 781 additions and 277 deletions

View File

@@ -186,15 +186,150 @@
background: rgba(30, 30, 46, 0.8);
border: 1px solid #313244;
border-radius: 8px;
font-size: 12px;
font-size: 11px;
color: #585b70;
line-height: 1.6;
line-height: 1.8;
z-index: 50;
display: none;
}
#controls-hint.active { display: block; }
/* OSD info bar (bottom-left) */
#osd-info {
position: fixed;
bottom: 16px;
left: 16px;
padding: 6px 12px;
background: rgba(30, 30, 46, 0.8);
border: 1px solid #313244;
border-radius: 8px;
font-size: 12px;
color: #6c7086;
z-index: 50;
display: none;
font-family: monospace;
}
#osd-info.active { display: block; }
/* Breadcrumb (top-left) */
#osd-breadcrumb {
display: none;
position: fixed;
top: 16px;
left: 16px;
padding: 6px 12px;
background: rgba(30, 30, 46, 0.85);
backdrop-filter: blur(8px);
border: 1px solid #313244;
border-radius: 8px;
font-size: 13px;
font-family: monospace;
color: #89b4fa;
z-index: 50;
pointer-events: none;
}
/* Search overlay */
#search-overlay {
display: none;
position: fixed;
top: 0;
left: 50%;
transform: translateX(-50%);
width: 480px;
max-width: 90vw;
margin-top: 60px;
flex-direction: column;
z-index: 200;
}
#search-input {
padding: 12px 16px;
border: 1px solid #585b70;
border-radius: 10px 10px 0 0;
background: rgba(30, 30, 46, 0.95);
backdrop-filter: blur(12px);
color: #cdd6f4;
font-size: 15px;
font-family: monospace;
outline: none;
}
#search-input:focus { border-color: #cba6f7; }
#search-input::placeholder { color: #585b70; }
#search-results {
background: rgba(30, 30, 46, 0.95);
border: 1px solid #585b70;
border-top: none;
border-radius: 0 0 10px 10px;
max-height: 300px;
overflow-y: auto;
}
.search-item {
padding: 8px 16px;
font-size: 13px;
font-family: monospace;
color: #cdd6f4;
cursor: pointer;
}
.search-item:hover { background: rgba(203, 166, 247, 0.1); }
/* Help modal */
#help-modal {
display: none;
position: fixed;
inset: 0;
z-index: 300;
align-items: center;
justify-content: center;
background: rgba(0,0,0,0.6);
backdrop-filter: blur(4px);
}
.help-content {
background: #1e1e2e;
border: 1px solid #313244;
border-radius: 12px;
padding: 28px 36px;
min-width: 360px;
color: #cdd6f4;
}
.help-content h2 {
font-size: 18px;
font-weight: 600;
margin-bottom: 16px;
color: #cba6f7;
}
.help-content table { width: 100%; border-collapse: collapse; }
.help-content td {
padding: 5px 0;
font-size: 13px;
}
.help-content td:first-child {
font-family: monospace;
color: #89b4fa;
padding-right: 20px;
white-space: nowrap;
}
.help-content td:last-child { color: #a6adc8; }
.help-close {
margin-top: 16px;
text-align: right;
font-size: 12px;
color: #585b70;
}
/* History */
#history {
display: none;
@@ -279,8 +414,34 @@
<div id="viewport"></div>
<div id="tooltip"></div>
<div id="osd-breadcrumb"></div>
<div id="osd-info"></div>
<div id="controls-hint">
LMB drag — rotate &nbsp;|&nbsp; RMB drag — pan &nbsp;|&nbsp; scroll — zoom &nbsp;|&nbsp; double-click — focus file
WASD move · Q/E rotate · Z/C zoom<br>
Space file view / overview · Esc reset<br>
/ search · dbl-click focus · scroll pan
</div>
<div id="search-overlay">
<input type="text" id="search-input" placeholder="Search files... (/ or Ctrl+F)">
<div id="search-results"></div>
</div>
<div id="help-modal">
<div class="help-content">
<h2>Keyboard Shortcuts</h2>
<table>
<tr><td>W A S D</td><td>Pan (move on XZ plane)</td></tr>
<tr><td>Q / E</td><td>Rotate view left / right</td></tr>
<tr><td>Z / C</td><td>Zoom in / out</td></tr>
<tr><td>Space</td><td>File overview → project overview</td></tr>
<tr><td>Esc</td><td>Reset to project overview</td></tr>
<tr><td>/ or Ctrl+F</td><td>Search files</td></tr>
<tr><td>?</td><td>Toggle this help</td></tr>
<tr><td>Double-click</td><td>Focus on file</td></tr>
</table>
<div class="help-close">Press ? or Esc to close</div>
</div>
</div>
<script type="module" src="/src/app.js"></script>