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.
Show a model from a document, and redraw the viewer
0be968244db3882594fa65032ff6b4cf59385bb9 · Keenan Nemetz · 11d ago · parent ffbcb4cc
Show a model from a document, and redraw the viewer A README that names a 3D model with an image path was emitting an <img> of a mesh. The raw route serves model/stl, no browser draws that, so the reader saw a broken image where the rack was supposed to be. A model image in a document now becomes the same viewer host the code browser writes, with the image's alt text as its label and the download link inside it for a reader without JavaScript or WebGL. Only a document with a place in a tree does this: an issue body has no raw route to fetch. The sanitiser admits exactly that host's shape, so the one classed element in a rendered document is the one the renderer wrote. The viewer also never redrew after OrbitControls moved the camera: it renders on demand, and only the button handlers called render. A drag or a wheel zoom changed the camera and left the old frame on screen, which is why the viewer looked static. Listen for the controls' change event, add zoom in/out buttons clamped to the wheel's own limits, and give the canvas a grab cursor. Docs now say a Markdown path names a model the same way it names a picture, and that the code browser's size cap cannot apply to a document rendered from its text alone.
server/web/static/models/README.md +3−2
| @@ -1,8 +1,9 @@ | |||
| 1 | 1 | # 3D model preview | |
| 2 | 2 | ||
| 3 | 3 | `model-viewer.js` is Vole's viewer: it draws a blob into a canvas with | |
| 4 | orbit/zoom and a wireframe toggle. `app.js` imports it only when a page contains | ||
| 5 | a `[data-model]` element, so no other page downloads it. | ||
| 4 | drag-to-orbit, wheel, pinch or button zoom, and a wireframe toggle. `app.js` | ||
| 5 | imports it only when a page contains a `[data-model]` element, so no other page | ||
| 6 | downloads it. | ||
| 6 | 7 | ||
| 7 | 8 | `three.bundle.js` is a generated ES module containing three.js and the loaders | |
| 8 | 9 | the viewer uses. It is committed so an instance is still one binary and there is | |