Skip to content

feat(viewer): give long decodes, scaffold results and every state change a visible treatment - #264

Merged
DrunkOnJava merged 3 commits into
mainfrom
feat/viewer-microinteractions
Sep 19, 2026
Merged

DrunkOnJava merged 3 commits into
mainfrom
feat/viewer-microinteractions

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Sep 19, 2026 •

Copy link
Copy Markdown
Owner

Summary

UI/UX polish pass on the browser viewer: an indeterminate-plus-elapsed loading treatment for the viewport, an explanatory empty state for scaffold-only decodes, demo-card interaction states with a real-project badge, a camera ease-in on scene fit, transitions on the panels that change on every load, and a non-blocking toast for load complete / export ready / load failed. No information-architecture change, no new dependencies, no change to the client-side-only privacy posture.

Motivation

The viewer was honest but mute about its own state:

  1. Opening the 33.7 MB Core Interior demo parked a static parsing container status for about 30 s with no motion, no elapsed time and no size-aware expectation, so it read as hung.
  2. Opening a synthetic tier1 demo produced an empty viewport with a bare grid and a one-node tree, with nothing on the canvas saying that a scaffold decode is the expected result for that fixture, and nothing pointing at the real-project demos.
  3. Demo cards had no hover, press or loading feedback, and real projects were not visually distinguished from synthetics.
  4. The scene appeared abruptly with no camera fit transition; tree rows, category toggles, status rows and the quality pill changed with no transition; nothing confirmed a finished load, a downloaded export or a failure.
  5. Focus states were inconsistent for keyboard users.

Changes

The motion language is one motif, not scattered effects: a scan sweep marks the places the machine is actually working (viewport load card, busy demo card, busy status line). Everything else is a 90-150 ms settle with no travel beyond 2 px. The entire set collapses to instant under prefers-reduced-motion.

  • viewer/index.html — colour and motion tokens as CSS custom properties on :root (derived from the values already in use, so the dark engineering identity is unchanged); new component styles for the load overlay, the scaffold explainer, the toast region, demo-card states and the real-project badge; settle transitions on tree rows, category toggles, status rows, the quality pill and the header/side buttons; one focus-ring treatment applied across every interactive surface; a prefers-reduced-motion block that zeroes every transition and animation and renders the sweep rails as static filled bars so "working" stays legible without movement. New markup: #load-overlay, #scaffold-note, #toast-region inside #viewport.
  • viewer/src/main.ts — loading overlay controller (elapsed timer, worker step text, size-derived expectation); toast() with auto-dismiss and an aria-live="polite" region; maybeShowScaffoldNote() plus revealRealProjects(); a 420 ms ease-out camera tween on scene fit, driven from the existing render loop with orbit control suspended for the move; demo-card busy tracking that survives until the worker reports back; data-demo-real and a "real project" badge for catalog entries tagged real-project; status-row entrance stagger; quality-pill settle on change; export/download/failure toasts; an error path for a failed arrayBuffer() read that previously left the UI stuck.
  • viewer/tests/viewer-regression.spec.ts — new coverage for the scaffold empty state, the toast lifecycle, the reduced-motion path, the real-project badge, and the route from the explainer back to the real-project cards; the existing Core Interior test is extended with mid-load assertions on the overlay, the elapsed counter, the size hint and the card's aria-busy.
  • viewer/playwright.config.ts — preview port overridable via RVT_VIEWER_PORT (default 4173).
  • viewer/.gitignore — ignore a local screenshots/ scratch directory.

Deliberate non-change: the loading bar stays indeterminate. The decoder cannot report real progress, so a percentage would be a fabricated number. The overlay shows elapsed seconds and an expectation labelled "about", derived from observed decode throughput across the staged demos.

Every existing element id, class and data attribute relied on by viewer/tests/*.spec.ts and viewer/src/main.ts is preserved.

Testing

  • N/A: no Rust changed. cargo test --all / clippy / fmt untouched by this PR.
  • npm run typecheck passes
  • npm run build passes
  • RVT_VIEWER_SAMPLE=<_project_corpus>/Revit/Revit_IFC5_Einhoven.rvt npm run test:browser — 12 passed, including the network-invariant test, the Einhoven real-project test and the 33.7 MB Core Interior test, with the wasm built via wasm-pack build --target web --out-dir viewer/pkg -- --features wasm --no-default-features
  • New behaviour has tests (scaffold empty state, toast lifecycle, reduced motion, real-project badge, explainer routing, mid-load overlay)
  • N/A: not an IFC exporter change — tests/fixtures/synthetic-project.ifc output is untouched
  • N/A: no element decoder added
  • N/A: not a performance change

A first run came back false-red: Playwright's reuseExistingServer silently attached to another checkout's vite preview already holding port 4173, so the suite tested a different build. That is why RVT_VIEWER_PORT is now overridable; re-running on a dedicated port gave a clean 12/12.

Audit-honesty checklist

  • README / docs reflect the current state after this PR — no new capability is claimed. The viewer's honesty copy is reinforced, not relaxed: the scaffold explainer repeats that scaffold is expected for tier1 synthetics, and the load bar refuses to show a fake percentage.
  • N/A: no limitation resolved
  • N/A: no new limitation introduced. The one estimate added (the size-based load hint) is explicitly hedged as "about" and is display-only; it never gates behaviour.
  • Commit message describes what changed and why
  • No emojis in code, docs, or commit messages
  • No private paths, personal email addresses, or internal jargon in committed files
  • N/A: not a reverse-engineering finding

Legal and contribution hygiene

  • I agree this work is licensable under Apache-2.0
  • No Autodesk proprietary source, decompiled internals, or NDA'd SDK content
  • No new test fixtures added; no PII

Breaking changes

None. No element id, class or data attribute was removed or renamed. RVT_VIEWER_PORT defaults to the previous hard-coded 4173.

Screenshots or output samples

Captured headless at 1600x1000 against the production build, with the real-project corpus staged. Images cannot be attached from this environment, so they are described.

  1. Landing gallery — the two MIT real-project cards sit above the synthetics, each carrying a rust-coloured left rule and a small outlined "real project" badge beside the title; the tier1 cards keep the neutral grey rule. Hover raises a card 1 px and warms its border; press drops it 1 px.
  2. Synthetic demo opened (empty-state overlay) — architectural-2024 loaded, header pill reads Scaffold · 25% in amber. Centred on the otherwise-bare grid, a card titled "Nothing to draw" with an amber left rule explains that the file decoded as scaffold at 25% confidence with no element geometry, that a scaffold decode is the expected result for the tier1 demos rather than a failure, and offers "Show real projects" and "Dismiss". A green-ruled toast in the bottom-right reads Loaded architectural-2024.rvt · 1 categories · 1 s. The right panel is fully populated as before.
  3. Einhoven opened — pill reads Geometry · 100% in green, the scene tree shows four elevation-derived storeys plus the unassigned bucket, the slab geometry is framed by the camera ease-in, the scaffold explainer is correctly absent, and the load toast is present bottom-right.
  4. Core Interior mid-load — seven seconds into the 33.7 MB decode: a panel centred in the viewport reads parsing container · IFC bar scaffold above a sweep rail caught mid-travel, with 7 s elapsed on the left and 32.2 MB, about 30 s on the right, and a footer line Parsed in this tab. Nothing is uploaded. The gallery card behind it carries its own sweeping hairline and aria-busy.

Related issues

None.


Note

Low Risk
Presentation-layer changes in the viewer only; no WASM decode, export, or auth/data-path changes. Existing DOM ids and test selectors are preserved.

Overview
Viewer UX polish adds visible feedback during long decodes, scaffold-only opens, exports, and failures—without changing decode/export behavior or the client-only privacy model.

The viewport gains an indeterminate load overlay (sweep rail, worker step text, elapsed seconds, size-based “about N s” hint, privacy line) wired from loadBytes and worker progress. Scaffold-only decodes show a “Nothing to draw” note with dismiss and “Show real projects,” which reopens the gallery and focuses a real-project demo card. Toasts confirm load complete, exports, and errors; the status line can show a busy sweep via is-busy.

CSS centralizes colour/motion tokens, demo-card hover/press/aria-busy, a real project badge and data-demo-real, panel settle animations, unified :focus-visible, and prefers-reduced-motion collapsing motion while keeping static busy indicators.

main.ts adds a 420 ms ease-out camera tween on fit (skipped when reduced motion), demo-card busy locking until the worker finishes, staggered status rows, quality-pill pulse on change, and handling for failed arrayBuffer() reads.

Tests cover scaffold explainer, toast lifecycle, reduced motion, real-project badge, explainer routing, and mid-load overlay on Core Interior. Playwright preview port is overridable via RVT_VIEWER_PORT; screenshots/ is gitignored.

Reviewed by Cursor Bugbot for commit 8dcbfc3. Configure here.

…nge a visible treatment

The viewer was honest but mute. Opening the 33.7 MB Core Interior demo
parked a static "parsing container" line for ~30 s with no motion, no
elapsed time and no size expectation, so it read as hung. Opening a
synthetic tier1 demo left a bare grid and a one-node tree with nothing
on the canvas saying that is the expected result. Demo cards had no
hover, press or loading feedback and real projects looked identical to
synthetics. Scenes, tree rows, status rows and the quality pill all
changed with no transition, and nothing confirmed a finished load, a
downloaded export or a failure.

The motion language is one motif rather than scattered effects: a scan
sweep marks the places the machine is actually working (the viewport
load card, the busy demo card, the busy status line). Everything else is
a 90-150 ms settle with no travel beyond 2 px, and the whole set
collapses to instant under prefers-reduced-motion.

Loading treatment: an indeterminate sweep plus elapsed seconds and a
size-derived expectation ("32.2 MB, about 30 s"). The bar stays
indeterminate on purpose - the decoder cannot report real progress, so
faking a percentage would be dishonest. The estimate comes from observed
decode throughput across the staged demos and is labelled "about".

Scaffold empty state: when a decode reports zero elements with geometry,
an overlay on the canvas names the result, says a scaffold decode is
expected for the synthetic tier1 demos rather than a failure, and offers
a control that reopens the gallery and puts the keyboard on the first
real project. Escape and a Dismiss button clear it; it never captures
pointer events from the canvas.

Also: demo card hover / press / busy / disabled states, a "real project"
badge and left rule for cards tagged real-project, a 420 ms ease-out
camera move on scene fit (orbit control suspended so damping does not
fight it), settle transitions on tree rows, category toggles, status
rows and the quality pill, a toast region (aria-live polite,
auto-dismiss) for load complete / export ready / load failed, and one
focus-ring treatment across every interactive surface.

No new dependencies, no fonts, no network calls - the client-side-only
posture is unchanged and the no-network invariant test still passes. All
existing element ids, classes and data attributes are preserved; new
colour and motion tokens are CSS custom properties on :root.

The Playwright preview port is now overridable via RVT_VIEWER_PORT so a
worktree does not silently reuse another checkout's preview server on
4173, which is how this branch first got a false-red run.
@cursor

cursor Bot commented Sep 19, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_e9106d2b-6888-4cf6-9829-13a64828bd0d)

@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) September 19, 2026 18:16
@DrunkOnJava
DrunkOnJava merged commit 730699c into main Sep 19, 2026
21 checks passed
@DrunkOnJava
DrunkOnJava deleted the feat/viewer-microinteractions branch September 19, 2026 18:21
DrunkOnJava added a commit that referenced this pull request Sep 19, 2026
…272)

## Summary

Selecting an element used to dump the raw element record into the info
panel — `property_set` arrived as one long
`{"name":"RvtElementRecordGeometry","properties":[...]}` string,
`location_feet` and `extrusion` as raw arrays and objects, index fields
as bare numbers, and every absent optional as a dash — while the
schedule said "872 scheduled elements" and nothing else. Both now read
as words, with the structure computed in Rust (`element_info_panel` /
`build_schedule`) and only the rendering in `viewer/src/main.ts`.

## Motivation

The panel and the schedule were the two places where the viewer still
spoke in record fields rather than in the building. A person inspecting
a door could see `storey_index: 2` but not which level that is,
`extrusion: {…}` but not how tall the door is, and a dash where a field
was simply absent — indistinguishable from a field the decoder failed
on. The schedule's single count said nothing about what the 872 elements
actually are.

## Changes

- **`src/ifc/scene_graph.rs`** — `ElementInfoPanel` gains
`property_group`, `placement_rows`, `extent_rows`, `storey`, `material`,
`predefined_type` and `missing`; new `PanelRow`, `PanelProperty`,
`PanelPropertyGroup`, `PanelStorey`, `PanelMaterial` types. `Schedule`
gains `groups` (`ScheduleTypeGroup { ifc_type, count, entity_indices,
storeys }`) built by `Schedule::from_rows`. Property values carry their
unit; booleans format as `Yes` / `No`; a value that rounds to zero
prints `0.000 ft`, never `-0.000 ft`.
- **`src/ifc/gltf.rs`** — `build_gltf` now writes `extras: {
entityIndex, ifcType }` on every element node (new `NodeExtras`).
- **`viewer/src/main.ts`** — the panel renders entirely from the Rust
payload; per-type and per-material scene highlight; schedule breakdown;
storey jump; empty-optional omission and the diagnostics-backed gap
note.
- **`viewer/index.html`** — panel band and schedule styles; the
schedule's live region is now a persistent child so only the total line
announces.
- **`viewer/tests/viewer-regression.spec.ts`** — extended project-sample
and Core Interior coverage, plus a new schedule test.
- **`docs/viewer-api.md`, `docs/viewer-build-pipeline.md`** — document
the new payload fields and where `userData.entityIndex` /
`userData.ifcType` actually come from.

### What the panel shows now

Selecting `Door-80750` in Core Interior:

```
Name        Door-80750
Type        IFCDOOR · DOOR
GUID        80750
Storey      Level 1 · 0.000 ft          <- selects that storey in the tree
Placement   X 100.790 ft  Y 78.500 ft  Z 0.000 ft
Extents     Width 3.585 ft  Depth 3.501 ft  Height 7.251 ft  Profile Rectangle
RvtElementRecordGeometry
            BodySource          partition_element_record_bbox
            ProfileResolved     No
            LevelBindResolved   Yes
            BoundingBoxHeight   7.251 ft
            LevelElementId      20268
            LevelBindSource     partition_element_record_reference_list
            SourceStream        Partitions/59
            StoreyBindSource    record_level_reference
Hosted by   Wall-80747 · IFCWALL
```

Sets longer than eight properties collapse behind a native `<details>`.
Absent optionals are omitted; a one-line `Not recovered: …` note names a
field only where the export diagnostics confirm it as a known decode gap
(`unsupported_geometry_missing_level`, `partial_element_geometry`,
`revit_element_parameters_to_ifc_property_sets`, and so on), so an
omission is never mistaken for a failure and a failure is never silently
omitted.

### What the schedule shows now

```
872 scheduled elements · 7 types
IFCWALL           360   Clear
IFCCOLUMN         256   Highlight
IFCDOOR           132   Highlight
IFCSLAB            80   Highlight
IFCSHADINGDEVICE   20   Highlight
IFCSPACE           18   Highlight
IFCWINDOW           6   Highlight
```

Each row toggles a tint over every mesh of that type. The affordance
only appears when the scene actually has tintable meshes; a scaffold
export with no geometry gets counts only.

### The glTF extras fix

`build_gltf` wrote no `extras` at all, so `userData.entityIndex` and
`userData.ifcType` were never populated — which meant raycast picking,
the selection highlight, and the category visibility toggles were all
inert against the 3-D scene, despite `docs/viewer-build-pipeline.md`
documenting `userData.entityIndex` as "set when building the scene".
Writing the extras is what makes the new per-type and per-material
highlights act on the scene, and it repairs those three pre-existing
behaviours at the same time.

### Presentation

Keeps the dark dense engineering identity and adds one motif: a 2 px
left rule whose colour says what a band is — grey for inert data, accent
for somewhere you can navigate to, amber for a decode gap — matching the
rule the status rows and the scaffold note already use. New numeric rows
use `font-variant-numeric: tabular-nums` in the panel's own face rather
than introducing a second family. Everything is CSS custom properties,
no new dependencies, no external resources, and the existing
reduced-motion and focus-ring rules cover the new controls.

## Testing

- [x] `cargo test --all` passes locally
- [x] `cargo clippy --all-targets --all-features -- -D warnings` passes
- [x] `cargo fmt --check` passes
- [x] New / changed code has unit tests — 17 new Rust unit tests across
`scene_graph` (resolved storey/material, typed property rows,
placement/extents labelling, profile naming, `missing`, negative-zero,
serde round-trip, schedule grouping) and `gltf` (extras present on every
element node, camelCase serialization)
- [x] If this touches the IFC exporter: no `step_writer` change;
`tests/fixtures/synthetic-project.ifc` output is unchanged
- [x] N/A: no new element decoder
- [x] N/A: not a performance change

Browser suite: `RVT_VIEWER_PORT=4181
RVT_VIEWER_SAMPLE=<Revit_IFC5_Einhoven.rvt> npm run test:browser` —
14/14 passed. The project-sample test asserts the titled property group,
the typed value kinds, `Yes` / `No` booleans, unit-carrying lengths, the
labelled placement and extents rows, that no row renders a bare dash,
and that the storey link selects that storey in the tree by keyboard. A
new test asserts the schedule's per-type counts sum to the reported
total and that the per-type highlight toggles. The Core Interior test
asserts the collapsed property group.

Three existing assertions that pinned the panel to raw record keys
(`#info` contains `ifc_type`) were updated to the new copy — that
display was the defect this PR fixes.

## Audit-honesty checklist

- [x] README / docs reflect the current state after this PR
- [x] If a limitation was resolved, the relevant docs are updated —
`docs/viewer-build-pipeline.md` no longer claims `userData.entityIndex`
is set without saying what sets it
- [x] If a new limitation was introduced, it is documented — see Known
limitations below
- [x] Commit messages describe WHAT changed and WHY
- [x] No emojis in code, docs, or commit messages
- [x] No private paths, personal email addresses, or internal jargon in
committed files
- [x] N/A: not a reverse-engineering finding

### Known limitations

- Neither corpus sample binds a material to an element —
`IfcRelAssociatesMaterial` count is 0 for both Einhoven and Core
Interior, because `revit_compound_assemblies_and_walltype_widths` is
still unsupported. The material band and its highlight are therefore
covered by Rust unit tests only and are not exercised by the browser
suite; the project-sample test instead asserts the band is omitted
outright and that the panel does not falsely claim material was "not
recovered" (the diagnostics report 42 recovered materials, they are just
unbound).
- The gap note is only as good as the diagnostics. A field that is
absent for a reason the diagnostics do not name is omitted silently
rather than guessed at, which is the intended trade.
- `elementInfoPanel` still round-trips the whole model through
`serde-wasm-bindgen` per selection. That is pre-existing and fast enough
on the 33.7 MB sample, but it is the obvious next thing to cache if
selection ever feels slow.

## Legal and contribution hygiene

- [x] I agree this work is licensable under Apache-2.0
- [x] This PR contains no Autodesk proprietary source, decompiled
internals, or NDA'd SDK content
- [x] N/A: no new test fixtures

## Breaking changes

None for the viewer. `Schedule` gains a public `groups` field, so any
external code constructing it with a struct literal should switch to
`Schedule::from_rows`; nothing in this repository did.

## Screenshots or output samples

Attached in the PR thread: the element info panel with `Door-80750`
selected in Core Interior, and the schedule breakdown with `IFCWALL`
highlighted. Both 1600x1000, headless Chromium.

## Related issues

Refs #264, #269.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Touches core viewer UX and glTF export identity on every mesh;
behavior is well-tested but schedule/panel payloads grew and highlight
logic now depends on extras being present.
> 
> **Overview**
> The element info panel and schedule are now **display-ready from
Rust** instead of dumping raw entity records in the browser.
**`element_info_panel`** adds resolved storey/material objects, typed
**`property_group`** rows, **`placement_rows`** / **`extent_rows`**,
**`missing`**, and humanized formatting (units, **Yes/No**,
negative-zero feet). **`Schedule`** adds **`groups`**
(`ScheduleTypeGroup`) for per-IFC-type counts, entity indices, and
storeys, built via **`Schedule::from_rows`**.
> 
> **`build_gltf`** now writes **`extras: { entityIndex, ifcType }`** on
every element node so Three.js **`userData`** enables picking, category
toggles, and the new **per-type** and **per-material** scene highlights.
> 
> The viewer renders banded panels (storey jump, collapsible properties,
diagnostics-backed “not recovered” notes), a **schedule breakdown** with
toggle highlights, and updated styles/tests/docs to match.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
bc75856. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
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.

1 participant