Repository navigation
web: viewport appearance controls (wireframe, fit, ortho, grid) - #18
Conversation
Ship the small operator cluster from INTERFACE.md §3.11 / §5.5: wireframe, fit, ortho, grid, axis triad, and material override with the existing ≥4.5:1 part-vs-ground floor. Bind the flags to the engine's authored display and cameras.py framing. Appearance is session-local, not workspace state, so §4.5 and G4/G5 stay closed. Closes #10. Co-authored-by: Vel <Code4me2@users.noreply.github.com>
Code4me2
left a comment
There was a problem hiding this comment.
MERGE
Adversarial review of #18 vs main at 722da04 (head d996a59). Issue #10 asks for a small pin-bound cluster (wireframe / fit / ortho / grid / axis triad / material override) against INTERFACE.md §3.11 authorship that already exists in display.ts. That is what landed. No merge-blocking bug in this PR's scope. I did not merge and did not expand scope.
Checks
| Check | Result |
|---|---|
| wireframe / fit / ortho / grid are real viewport controls bound to existing engine/API facts, not invented chrome | Pass |
| G4 / G5 not weakened | Pass |
| No CLI / engine drive-by | Pass |
CI on this head is green, including web (node) and render goldens (pinned image) — the latter is the Gate G4 command (pnpm --dir web test:e2e), so G4.5 / G4.6 / G4.7 actually ran against this chrome.
Bindings (not invented chrome)
Each control drives a fact §3.11 / cameras.py already authored. No new material, no new named view, no new CLI verb.
- Wireframe —
applyAppearancesets the fill material's.visibleand leaves the §3.11.4EdgesGeometrychild standing. Hidden solids still hide both (node visibility). That is the existing silhouette, notmaterial.wireframetriangulation. - Fit — calls the existing
ViewportEngine.frame()→framingFor/applyFraming, i.e.cameras.py::camera_framingfor the current named view. Clears theframedRefskip so an orbit can be re-seated. Disabled when there is no pinned GLB on the canvas, with a reason. - Ortho — default on, matching
heph render. Off is a perspective viewing aid at the same eye / target / vertical extent (perspectiveFovDeg/applyPerspectiveFraming). Named views and the renderer stay orthographic.this.orthostartstrue, so mount is a no-op and does not swap cameras under G4. - Grid —
gridRoot.visibleon the existing §3.11.5 pad. Step is unchanged; the readout reports—when the operator has hidden the lines.rebuildGriddoes not reset visibility. - Axes — existing DOM triad; hide is
visibility: hidden(space held) so G4.5's control-region size cannot move on the toggle. - Material — override on is the one authored
MeshStandardMaterialat--viewport-part(≥4.5:1 floor). Off restores the exporter material already stored atSOURCE_MATERIAL_KEY(a selection ID, not a catalogue colour). No third material.
Defaults are the authored picture (wireframe off, ortho / grid / triad / materialOverride on). Appearance is a session store, not WorkspaceState. §4.5's closed record and URL encoder are untouched.
G4 / G5 not weakened
- G4.5 — thresholds in
web/e2e/helpers/maskDelta.tsstay0.10/0.01.viewport.spec.tsis not in this diff. The cluster is fixed-size chrome and does not grow on a visibility toggle (the failure modeGridReadout.tsxalready measured at 1.10% vs a ≤1% ceiling). G4.5 screenshots[data-viewport-canvas]; §3.11.2's centre-vs-corner sample reads the canvas bitmap, not the overlay, so the new strip does not move that floor by existing. - G4.6 — centroids still come off the scene graph via the harness handle. Appearance does not translate nodes.
- G4.7 — section plate is still server bytes. Client preview is still non-evidentiary.
- G5 — no session / pin / REST / composer /
ask_user/ history change.artifact_refstickiness is untouched. - Existing e2e
data-*selectors are preserved. New ones ([data-appearance],[data-appearance-control]) are additive.design-system.spec.tsonly appends default pressed-state checks; it does not relax an older assertion.
No CLI / engine drive-by
Diff is 18 files, +810 / −23: INTERFACE.md (12-line §5.5 note), web/src/**, web/test/**, web/e2e/**. No core/, agent/, server/, Python tests, CLI verbs, or install docs. Parent #4 is correctly left open. The §5.5 paragraph records the cluster; it does not edit gate text or thresholds.
Tests (what they actually prove)
- Store: defaults, single-field toggle, notification, Fit is not a flag.
- Markup: toolbar order, default
aria-pressed, Fit disabled+reason, no new icon id (§3.12 stays closed at 18). - Display: wireframe keeps edges; override off restores
id_to_rgband invents nothing; override on returns--viewport-part; un-authored trees are a no-op. - Scene:
perspectiveFovDeg/applyPerspectiveFramingshare eye / target / half-height with the ortho framing. - e2e: cluster present, defaults match the authored picture, Fit enabled when the pin is on the canvas.
The workspace-URL test only encodes DEFAULT_STATE and greps the string. The stronger fact is that WorkspaceState gained no appearance field — I checked; it did not.
Non-blocking (not a reason to hold the PR)
resize()aftersetOrthocan stretch.setOrthobakes the current scale intotopand resetszoom = 1.resize()still setsleft/rightfrom the storedframing.halfHeight. Orbit or zoom, toggle ortho, then resize the window, and the aspect is wrong until Fit. The default / G4 path never toggles ortho, so this is not a gate defect.- No e2e click-through of wireframe / grid / ortho / Fit. Bindings are unit-tested; G4 proves the strip existing does not move the gates. A later PR can click the cluster if we want operator-path coverage.
- Fit is disabled while
data-glb-state="stale"even though the last completed GLB is still on the canvas. Conservative, not a lie about an empty pin. .previewNoteusestop: calc(var(--space-3) + 5.5rem). If the cluster wraps on a narrow stage, the live-cut badge can collide with it. Section preview is non-evidentiary.
None of these are in G4/G5, none invent chrome, none are worth opening the diff for on this PR.
Closes #10.
Operator appearance controls on the viewport, bound to the pin.
INTERFACE.md§3.11 already authored the picture; this ships the small control cluster that was missing.What landed
A compact toolbar on the viewport (not a second inspector, not a cloned CAD toolbar):
cameras.pyframing for the current named viewheph render); off is a perspective viewing aid at the same eye/target/extent—when it is off--viewport-partwith the existing ≥4.5:1 floor; off restores the exporter material (a selection ID). No catalog, no invented materialsAppearance is session-local (
state/appearance.ts), like visibility. §4.5's closed workspace record is unchanged. Defaults are the authored picture so G4.5 / G4.6 / G4.7 and §3.11.2 do not move by the strip existing.Existing e2e
data-*selectors are preserved. New selectors:[data-appearance],[data-appearance-control].Out of scope (parent #4)
Tree sections, export/BOM header, composer model picker, CLI verbs, install docs, Timeline engine checkpoints. This PR does not close #4.