← Commit history
0.9.1: American English in the help card, README and comments
11 files changed
+58−25
README.md+3−3@@ -98,7 +98,7 @@ window.Adom3DViewerBabylon9 = { Renders through an offscreen target, so the result does not depend on the on-screen canvas size - `setShadowRefreshRate(rate | null)`: pin the shadow map refresh rate;- `null` restores automatic behaviour. Needed for content animated from+ `null` restores automatic behavior. Needed for content animated from outside the viewer, which `scene.animationGroups` cannot see - `destroy()` @@ -136,7 +136,7 @@ poles in the Y-up and Z-up frames. Every viewer draws a small `?` in its bottom-right corner (0.7.3). The card it opens leads with the move that makes large boards and scaffolds navigable:-Shift+Alt+click a point on the model to set the centre of rotation (a glowing+Shift+Alt+click a point on the model to set the center of rotation (a glowing dot marks it; orbit and zoom then work around that spot). The rest of the controls follow: drag to orbit, right-drag or Ctrl+drag to pan, scroll to zoom toward the cursor, the cube faces with Home and Fit, hold Space to spin. The@@ -195,7 +195,7 @@ Chrome from `~/.cache/puppeteer` (or `PUPPETEER_EXECUTABLE_PATH`). ### Scale -Millimetre-scale models are supported. The near plane is `radius/50`+Millimeter-scale models are supported. The near plane is `radius/50` recomputed per frame, and light height, intensity, panning speed and radius limits are all derived from model size, so a 5 mm part and a 500 mm assembly both frame and light correctly without a unit setting.
SKILL.md+1−1@@ -49,7 +49,7 @@ gets you a working checkout. ## What a GLB can declare (0.9.0) -The viewer reads its behaviour from the GLB itself, in glTF `extras` and node+The viewer reads its behavior from the GLB itself, in glTF `extras` and node names; the one page that lists it all is the `wiki-hero-glb` skill in adom/adom-wiki-skillpack, with the full detail in this package's `docs/CONTENT-CONVENTIONS.md`. The short form:
VERSION+1−1@@ -1 +1 @@-0.9.0+0.9.1
docs/CONTENT-CONVENTIONS.md+1−1@@ -150,7 +150,7 @@ models do: `Adom.LED.State` holds the emissive lens skin and a real spot light, ### What the viewer does with them -- **Never rescales them.** glTF light `range` is metres and `intensity`+- **Never rescales them.** glTF light `range` is meters and `intensity` candela, and neither follows a node matrix. The viewer frames with the camera, never by scaling content, so an authored 15 mm throw stays 15 mm. A light sitting under a scaled node gets a console warning naming the scale:
package.json+40−7@@ -1,9 +1,46 @@ { "name": "adom-3d-viewer-babylon9",- "version": "0.9.0",+ "version": "0.9.1", "description": "The Babylon 9.5 engine behind every component page's 3D tab on wiki.adom.inc. Versioned ESM bundle with GLB loading, view cube, layers toolbar, ground shadows, and Z-up CAD framing.", "type": "app",+ "main": "./dist/index.js",+ "module": "./dist/index.js",+ "types": "./dist/index.d.ts",+ "exports": {+ ".": {+ "import": "./dist/index.js",+ "types": "./dist/index.d.ts"+ }+ },+ "files": [+ "dist",+ "dist-standalone",+ "src",+ "standalone.ts"+ ],+ "scripts": {+ "build": "vite build",+ "build:standalone": "vite build --config vite.standalone.config.mts",+ "dev": "vite build --watch",+ "prepare": "npm run build",+ "test:sandbox": "node test/wiki-sandbox.test.mjs",+ "test:orbit": "node test/orbit.test.mjs",+ "test": "node test/wiki-sandbox.test.mjs && node test/orbit.test.mjs && node test/viewcube.test.mjs && node test/help.test.mjs && node test/lights.test.mjs",+ "test:viewcube": "node test/viewcube.test.mjs",+ "test:help": "node test/help.test.mjs",+ "test:lights": "node test/lights.test.mjs"+ }, "dependencies": {},+ "devDependencies": {+ "@sveltejs/vite-plugin-svelte": "^3.1.2",+ "svelte-check": "^3.8.6",+ "terser": "^5.46.2",+ "typescript": "^5.5.4",+ "vite": "^5.4.1"+ },+ "peerDependencies": {+ "svelte": "^4.0.0 || ^5.0.0"+ }, "slug": "adom-3d-viewer", "license": "MIT", "tags": [@@ -37,9 +74,5 @@ "prompt": "Download the 0.4.3 viewer bundle so my tool vendors a fixed build" } ],- "title": "Adom 3D Viewer",- "scripts": {- "install": "./install.sh",- "uninstall": "./uninstall.sh"- }-}+ "title": "Adom 3D Viewer"+}
src/lib/adom-babylon/3DViewer/ContentLights.ts+2−2@@ -4,7 +4,7 @@ * skin and a real spot light (adom/adom-3d-viewer#7). * * The viewer never creates these and never edits their photometry: glTF range- * is metres and intensity candela, and neither follows a node matrix, so a+ * is meters and intensity candela, and neither follows a node matrix, so a * viewer that rescaled them would turn a 15 mm throw into 15 m. What the * viewer owns is the BUDGET. Babylon's materials light at most * maxSimultaneousLights (4 by default, and the viewer's own key and fill@@ -25,7 +25,7 @@ export type ContentLightRow = { name: string; /** extras.adomRole on the light node or its parent, when the content set one. */ role: string | null;- /** As authored: candela and metres, never rescaled by the viewer. */+ /** As authored: candela and meters, never rescaled by the viewer. */ intensity: number; range: number; /** The light's own switch (the budget turns this on and off). */
standalone.ts+4−4@@ -92,7 +92,7 @@ interface ViewerInstance { setStateGroupEnabled: (key: string, enabled: boolean) => boolean; /** One placement of a role: the third LED on the board, not every LED. */ setStateInstanceEnabled: (key: string, index: number, enabled: boolean) => boolean;- /** Lights that came inside the GLB, as authored (candela, metres). */+ /** Lights that came inside the GLB, as authored (candela, meters). */ getContentLights: () => { name: string; role: string | null; intensity: number; range: number; enabled: boolean; active: boolean }[]; /** How many of them may light surfaces at once (default 4). */ getLightBudget: () => number;@@ -211,7 +211,7 @@ function init(container: HTMLElement, options?: { // ---- The ? button, the controls card, and the one-time Shift+Alt tip ------- // // Colby, 2026-09-16: on a large board or scaffold, Shift+Alt+click to set the-// centre of rotation is the move that makes this viewer good, and nothing+// center of rotation is the move that makes this viewer good, and nothing // told a new reader it existed. Every consumer gets the same small ? in the // bottom-right corner, a card listing the controls with that one first, and // a tip bubble the first time a model is ready (remembered per browser,@@ -260,7 +260,7 @@ function mountHelp(container: HTMLElement) { <button type="button" class="a3d-help-close" aria-label="Close">×</button> <h3>Getting around</h3> <dl>- <div class="a3d-help-star"><b>Set the centre of rotation:</b> <kbd>Shift</kbd>+<kbd>Alt</kbd>+click a point on the model. On a big board or scaffold do this first: the orbit and the zoom then work around that spot instead of the middle of everything. A glowing dot marks it.</div>+ <div class="a3d-help-star"><b>Set the center of rotation:</b> <kbd>Shift</kbd>+<kbd>Alt</kbd>+click a point on the model. On a big board or scaffold do this first: the orbit and the zoom then work around that spot instead of the middle of everything. A glowing dot marks it.</div> <dt>Orbit</dt><dd>drag</dd> <dt>Pan</dt><dd>right-drag, or <kbd>Ctrl</kbd>+drag</dd> <dt>Zoom</dt><dd>scroll, toward the cursor</dd>@@ -268,7 +268,7 @@ function mountHelp(container: HTMLElement) { <dt>Spin</dt><dd>hold <kbd>Space</kbd></dd> <dt>This card</dt><dd><kbd>?</kbd></dd> </dl>- <p class="a3d-help-foot">Tip: zooming into a corner moves the centre a little on its own; Shift+Alt+click puts it exactly where you want it.</p>`;+ <p class="a3d-help-foot">Tip: zooming into a corner moves the center a little on its own; Shift+Alt+click puts it exactly where you want it.</p>`; const tip = doc.createElement('div'); tip.className = 'a3d-help-tip'; tip.setAttribute('role', 'status'); tip.hidden = true;
test/help.test.mjs+2−2@@ -1,6 +1,6 @@ // The ? button, the controls card and the one-time Shift+Alt tip (Colby, // 2026-09-16): every consumer gets a small ? in the corner; its card leads-// with Shift+Alt+click to set the centre of rotation; the tip bubble shows+// with Shift+Alt+click to set the center of rotation; the tip bubble shows // once per browser when the first model is ready; showHelp:false hides it all. import http from "node:http"; import { existsSync, readFileSync, readdirSync } from "node:fs";@@ -73,7 +73,7 @@ try { await page.click(".a3d-help-btn"); assert(await page.$eval(".a3d-help-card", c => !c.hidden), "clicking ? opens the card"); const text = await page.$eval(".a3d-help-card", c => c.textContent.replace(/\s+/g, " "));- assert(/Set the centre of rotation:\s*Shift\+Alt\+click/.test(text), "the card leads with Shift+Alt+click");+ assert(/Set the center of rotation:\s*Shift\+Alt\+click/.test(text), "the card leads with Shift+Alt+click"); assert(/Orbit\s*drag/.test(text) && /Pan\s*right-drag/.test(text) && /Zoom\s*scroll/.test(text) && /hold Space/.test(text), "orbit, pan, zoom and spin are listed"); assert(await page.$eval(".a3d-help-btn", b => b.getAttribute("aria-expanded")) === "true", "button reports expanded"); await page.keyboard.press("Escape");
test/orbit.test.mjs+1−1@@ -91,7 +91,7 @@ const browser = await puppeteer.launch({ args: ["--no-sandbox", "--use-gl=angle", "--use-angle=swiftshader", "--enable-unsafe-swiftshader", "--disable-gpu-sandbox"], }); -// Drag vertically on the canvas centre in steps; returns beta before and after.+// Drag vertically on the canvas center in steps; returns beta before and after. async function dragVertical(page, dy, steps = 12) { const box = await (await page.$("#wrap canvas")).boundingBox(); const x = box.x + box.width / 2, y = box.y + box.height / 2;
test/viewcube.test.mjs+1−1@@ -47,7 +47,7 @@ function makeBoxGlb() { const GLB = makeBoxGlb(); // 640x400: the cube viewport is 120x120 px in the top-right corner (the-// builder's 120 px minimum), so its centre is 60 px in from the right edge+// builder's 120 px minimum), so its center is 60 px in from the right edge // and 60 px down. Every pointer test uses that point. const W = 640, H = 400, CUBE = { x: W - 60, y: 60 }; const HARNESS = `<!doctype html><html><head><meta charset="utf-8">
test/wiki-sandbox.test.mjs+2−2@@ -107,7 +107,7 @@ const HARNESS = `<!doctype html><html><head><meta charset="utf-8"> const v = window.Adom3DViewerBabylon9.init(wrap, opts); if (useBytes) { const bytes = new Uint8Array(await (await fetch('/chip.glb')).arrayBuffer()); await v.whenReady(); await v.loadModelBytes(bytes, { extension: '.glb' }); } const report = await v.whenReady();- // paint check: sample the canvas centre for pixels that are neither the+ // paint check: sample the canvas center for pixels that are neither the // gradient background nor black const canvas = wrap.querySelector('canvas'); let painted = 0, total = 0;@@ -193,7 +193,7 @@ try { assert(viol.length === 0, `no securitypolicyviolation in the frame (${viol.join(" | ")})`); assert(rep.camera.ready && rep.camera.mode === "perspective", "camera ready in perspective"); assert(r1.hasCanvas, "a canvas is in the frame");- assert(r1.painted > r1.total * 0.05, `chip pixels painted in the centre (${r1.painted}/${r1.total})`);+ assert(r1.painted > r1.total * 0.05, `chip pixels painted in the center (${r1.painted}/${r1.total})`); const errs = await frame.evaluate(() => window.__log); assert(!errs.some(l => /SecurityError|blob:|Refused to/.test(l)), `no storage/blob/CSP errors logged (${errs.slice(0, 3).join(" | ")})`);