Skip to content

web: viewport appearance controls (wireframe, fit, ortho, grid) - #18

Merged
Code4me2 merged 2 commits into
mainfrom
cursor/viewport-appearance-controls-26ea
Aug 31, 2026
Merged

Code4me2 merged 2 commits into
mainfrom
cursor/viewport-appearance-controls-26ea

Conversation

@Code4me2

Copy link
Copy Markdown
Member

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):

  • Wireframe — hide the fill, keep the §3.11.4 silhouette
  • Fit — re-apply cameras.py framing for the current named view
  • Ortho — default on (matches heph render); off is a perspective viewing aid at the same eye/target/extent
  • Grid — show/hide the ground grid; the readout reports — when it is off
  • Axes — show/hide the axis triad
  • Material — override on (default) uses --viewport-part with the existing ≥4.5:1 floor; off restores the exporter material (a selection ID). No catalog, no invented materials

Appearance 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.

Open in Web Open in Cursor 

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
Code4me2 marked this pull request as ready for review August 31, 2026 01:44

@Code4me2 Code4me2 left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 — applyAppearance sets the fill material's .visible and leaves the §3.11.4 EdgesGeometry child standing. Hidden solids still hide both (node visibility). That is the existing silhouette, not material.wireframe triangulation.
  • Fit — calls the existing ViewportEngine.frame() → framingFor / applyFraming, i.e. cameras.py::camera_framing for the current named view. Clears the framedRef skip 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.ortho starts true, so mount is a no-op and does not swap cameras under G4.
  • Grid — gridRoot.visible on the existing §3.11.5 pad. Step is unchanged; the readout reports — when the operator has hidden the lines. rebuildGrid does 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 MeshStandardMaterial at --viewport-part (≥4.5:1 floor). Off restores the exporter material already stored at SOURCE_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.ts stay 0.10 / 0.01. viewport.spec.ts is not in this diff. The cluster is fixed-size chrome and does not grow on a visibility toggle (the failure mode GridReadout.tsx already 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_ref stickiness is untouched.
  • Existing e2e data-* selectors are preserved. New ones ([data-appearance], [data-appearance-control]) are additive. design-system.spec.ts only 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_rgb and invents nothing; override on returns --viewport-part; un-authored trees are a no-op.
  • Scene: perspectiveFovDeg / applyPerspectiveFraming share 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)

  1. resize() after setOrtho can stretch. setOrtho bakes the current scale into top and resets zoom = 1. resize() still sets left/right from the stored framing.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.
  2. 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.
  3. 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.
  4. .previewNote uses top: 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.

@Code4me2
Code4me2 merged commit e8f4ed1 into main Aug 31, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

web: appearance controls (wireframe, fit, ortho, grid) web: Smith-class operator session (simple UI, CLI is the agent core)

2 participants