Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Site
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software/vole.git

Self-hosted forge that lives in your Git repo.

Add an orientation cube to the model viewer

d4764b08e9d56c48ff2bf2c8e8d6247e70f2d3e3 · Keenan Nemetz · 9d ago · parent 7178cad6

Add an orientation cube to the model viewer

Replace the Front/Top/Right text row with a six-face CSS 3D cube. The cube follows the model's turn and the main camera, and clicking a face uses the existing turnTo snap path. A visually hidden six-button list keeps the views keyboard and screen-reader accessible; it appears when focused. No new dependency or WebGL context is added.

server/web/static/vole.css +91−2

@@ -1291,18 +1291,107 @@ pre code { background: none; border: 0; padding: 0; font-size: inherit; }
1291 1291 }
1292 1292 .model-tool:hover { color: var(--fg); border-color: var(--accent); }
1293 1293 .model-tool.active { color: var(--accent-fg); background: var(--accent); border-color: var(--accent); }
1294 /* The snap views have their own row in the opposite corner: a narrow diff pane
1295 then wraps one cluster instead of two, and the corner is empty. */
1294 /* The orientation cube is the pointer control. Its six faces are decorative
1295 buttons; the clipped list below is the keyboard and screen-reader equivalent
1296 and appears when focused. */
1297 .model-cube {
1298 position: absolute;
1299 left: 8px;
1300 bottom: 8px;
1301 width: 112px;
1302 height: 112px;
1303 perspective: 600px;
1304 pointer-events: none;
1305 }
1306 .model-cube-stage {
1307 --h: 32px;
1308 position: absolute;
1309 left: 24px;
1310 top: 24px;
1311 width: 64px;
1312 height: 64px;
1313 transform-style: preserve-3d;
1314 pointer-events: auto;
1315 will-change: transform;
1316 }
1317 .model-cube-face {
1318 position: absolute;
1319 inset: 0;
1320 display: grid;
1321 place-content: center;
1322 padding: 0;
1323 border: 1px solid var(--border-strong);
1324 border-radius: 5px;
1325 background: linear-gradient(145deg, var(--bg-raised), var(--bg-panel));
1326 color: var(--fg-muted);
1327 font: inherit;
1328 font-size: calc(11px * var(--font-scale));
1329 font-weight: 600;
1330 letter-spacing: 0.04em;
1331 text-transform: uppercase;
1332 cursor: pointer;
1333 appearance: none;
1334 -webkit-appearance: none;
1335 backface-visibility: hidden;
1336 user-select: none;
1337 }
1338 .model-cube-face:hover { color: var(--fg); border-color: var(--accent); }
1339 .model-cube-face.active {
1340 color: var(--accent-fg);
1341 background: var(--accent);
1342 border-color: var(--accent);
1343 }
1344 .model-cube-face.front { transform: translateZ(var(--h)); }
1345 .model-cube-face.back { transform: rotateY(180deg) translateZ(var(--h)); }
1346 .model-cube-face.right { transform: rotateY(90deg) translateZ(var(--h)); }
1347 .model-cube-face.left { transform: rotateY(-90deg) translateZ(var(--h)); }
1348 .model-cube-face.top { transform: rotateX(90deg) translateZ(var(--h)); }
1349 .model-cube-face.bottom { transform: rotateX(-90deg) translateZ(var(--h)); }
1350
1296 1351 .model-views {
1297 1352 position: absolute;
1298 1353 left: 8px;
1299 1354 bottom: 8px;
1300 1355 display: flex;
1301 1356 gap: 6px;
1357 width: 1px;
1358 height: 1px;
1359 overflow: hidden;
1360 clip-path: inset(50%);
1361 white-space: nowrap;
1362 pointer-events: none;
1363 }
1364 .model-views:focus-within {
1365 width: auto;
1366 height: auto;
1367 overflow: visible;
1368 clip-path: none;
1369 padding: 4px;
1370 border: 1px solid var(--border);
1371 border-radius: var(--radius);
1372 background: var(--bg-panel);
1373 white-space: normal;
1374 pointer-events: auto;
1375 z-index: 3;
1302 1376 }
1303 1377 /* A diff pane is narrower and there may be two of them, so the box is shorter. */
1304 1378 .media-diff .model-viewer { height: 320px; min-height: 220px; margin: 0; }
1305 1379
1380 .media-diff .model-cube { width: 96px; height: 96px; perspective: 520px; }
1381 .media-diff .model-cube-stage {
1382 left: 20px;
1383 top: 20px;
1384 width: 56px;
1385 height: 56px;
1386 --h: 28px;
1387 }
1388
1389 @media (max-width: 720px) {
1390 .model-cube { width: 88px; height: 88px; perspective: 460px; }
1391 .model-cube-stage { left: 18px; top: 18px; width: 52px; height: 52px; --h: 26px; }
1392 .model-cube-face { font-size: calc(9.5px * var(--font-scale)); }
1393 }
1394
1306 1395 /* ---------- shared responsive rules ---------- */
1307 1396
1308 1397 @media (max-width: 720px) {