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.

Keep a model's turn on one axis, and link the two sides of a diff

32eefb58a7206f46dfbc280b2d038894e4db865e · Keenan Nemetz · 9d ago · parent 4489805d

Keep a model's turn on one axis, and link the two sides of a diff

The free trackball composes a rotation about the screen's right and up axes
on every pointer move, so a hand-drawn diagonal drag adds a little roll
nobody asked for, and after a couple of drags the part is off its own
vertical with no gesture that spins it in place. The first five pixels of a
drag now pick the dominant axis and the rest of the gesture stays on it: it
is still a trackball, but a mostly horizontal drag can no longer tilt the
model, and the travel spent before the choice is applied rather than lost.

There was also no way to ask for a known side, and no way to compare the
two sides of a diff at one angle. Front, Top and Right turn the model to
meet the fixed camera: each target maps the model's own axes onto the
camera's own basis, so the side is exact whatever the zoom, and the turn
eases there with a slerp, or arrives at once under prefers-reduced-motion.
The row marks the view the model is at and a drag clears it.

Two viewers in one .media-diff are the same file before and after, framed
on the same unit sphere, so an orientation means the same thing in both.
They now publish their turn to each other and start linked; Sync unlinks
them for a reader who wants each side at its own angle, and linking again
hands over the angle of the viewer that was clicked. The pair is a WeakMap
keyed by the container, so a lone model gets no button; a disposed viewer
leaves the set, and a viewer that finishes loading second takes the turn
that is already there.

The toggle buttons now carry aria-pressed as well as the active class, so
the wireframe and the link announce their state instead of only showing it.

Matrix4 and Quaternion are re-exported from the bundle for the view
targets, regenerated with scripts/vendor-three.py; the docs say what the
new buttons do.

Checked in headless Chromium against the bundled three.js, with two STL
models and a third host outside a .media-diff: a drag with 3px of vertical
drift turns about the screen up axis only, a diagonal drag stays on one
axis, the sibling follows and stops following when unlinked, each view
puts its own axis at the reader, and reset and the lone model's toolbar
are unchanged. vole workflow run verify passes.

Closes: 01M87CY5GP3CS51X8KGCX2W4V4

server/web/static/vole.css +9

@@ -1291,6 +1291,15 @@ 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. */
1296 .model-views {
1297 position: absolute;
1298 left: 8px;
1299 bottom: 8px;
1300 display: flex;
1301 gap: 6px;
1302 }
1294 1303 /* A diff pane is narrower and there may be two of them, so the box is shorter. */
1295 1304 .media-diff .model-viewer { height: 320px; min-height: 220px; margin: 0; }
1296 1305