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

docs/media.md +8−4

@@ -47,10 +47,14 @@ An image larger than 32 MiB is a download rather than an inline preview.
47 47
48 48 The viewer runs in the browser and needs only the file. Drag to turn the model,
49 49 which has no stop: a drag rolls it about the screen's own axes, so it can be
50 turned over in any direction rather than orbiting to a pole. Scroll, pinch, or
51 use the + and − buttons to zoom; use the buttons to reset the view or toggle a
52 wireframe. It is loaded on demand, so a page without a model downloads none of
53 it. Without JavaScript or WebGL, the file's download link stays visible.
50 turned over in any direction rather than orbiting to a pole. A gesture commits
51 to the axis it starts on, so a mostly horizontal drag stays horizontal. Scroll,
52 pinch, or use the + and − buttons to zoom; Front, Top and Right put a known side
53 toward you; the remaining buttons reset the view and toggle a wireframe. On a
54 diff the before and after models turn together, and Sync turns that link off for
55 a reader who wants each side at its own angle. It is loaded on demand, so a page
56 without a model downloads none of it. Without JavaScript or WebGL, the file's
57 download link stays visible.
54 58
55 59 A Markdown document names a model the same way it names a picture: a relative
56 60 image path whose extension is on the list above. A README can therefore show an