Skip to content

feat(viewer): highlight a layer's material from the element panel - #373

Merged
DrunkOnJava merged 1 commit into
mainfrom
feat/viewer-layer-highlight
Sep 24, 2026
Merged

DrunkOnJava merged 1 commit into
mainfrom
feat/viewer-layer-highlight

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Sep 24, 2026 •

Copy link
Copy Markdown
Owner

Summary

In the viewer's element panel, each layer row of a selected wall, floor, roof or ceiling is now a toggle. It lights up every element using that layer's material, directly or as one of its layers. Its accessible name states the count: "Highlight the 7 elements using Masonry - Brick in the 3-D view".

Before this, a material highlight matched only material_index, so layered elements, which carry their materials in a layer set (RE-58), never lit up.

Checked in Chromium on the MIT tutorial house (local only). Selecting wall 166276 lists its five layers as toggles:

layer elements using the material
Masonry - Brick 7
Misc. Air Layers - Air Space 2
Wood - Sheathing - Plywood 5
Metal - Stud Layer 2
Finishes - Interior - Gypsum Wall Board 42

Clicking "Masonry - Brick" presses it and tints the 7 elements. There is no page error, and only the pressed row is tinted.

Changes

  • src/ifc/scene_graph.rs:
    • PanelLayer { label, value, material } replaces PanelRow in PanelLayers::rows;
    • count_elements_using_material counts use in layer sets.
  • viewer/src/main.ts:
    • layersGroup renders each layer as a toggle;
    • entityIndicesWithMaterial matches layer sets;
    • the model interface gains material_layer_sets and material_layer_set_index.
  • viewer/src/styles.css: .info-layer, with design-token colours and a pressed state.
  • docs/viewer-api.md, CHANGELOG.

Testing

  • Playwright in Chromium against the dev server, on the MIT house, as above.
  • fmt, clippy -D warnings, rustdoc -D warnings, the workspace suite, and cargo +1.85.0 check.
  • Viewer typecheck and build, and the wasm network-import audit (0 network imports).

No tests were added.

Breaking changes

PanelLayers::rows is Vec<PanelLayer> (label, value, material) instead of Vec<PanelRow>.

Related issues

Refs #355.


Note

Medium Risk
Changes the serialized panel API and shared material-highlight logic; incorrect layer-set matching could tint the wrong elements, but scope is viewer UI and read-only model traversal.

Overview
Layer rows in the element panel can now highlight every element that uses that material, including materials buried in compound wall/floor/roof/ceiling layers (RE-58), not only a direct material_index.

The Rust panel payload gains PanelLayer (label, value, optional PanelMaterial) in place of plain PanelRow on PanelLayers::rows, and count_elements_using_material counts elements that reference the material directly or via any layer in their material layer set. The viewer mirrors that in entityIndicesWithMaterial, extends the in-memory model with material_layer_sets / material_layer_set_index, and renders layers through a new layersGroup where each known layer is a pressable row (styled .info-layer) that toggles the same 3-D tint as the main Material band. Docs and the changelog describe the API and behaviour.

Breaking: consumers of PanelLayers::rows must expect PanelLayer instead of PanelRow.

Reviewed by Cursor Bugbot for commit 39bbd8a. Configure here.

Each layer row of a selected wall, floor, roof or ceiling is a toggle
that lights up every element using that material, directly or as a
layer. PanelLayers rows carry their material (index, name, element
count), and material element counts include use in layer sets.
@cursor

cursor Bot commented Sep 24, 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_abb99122-1756-4594-bca8-4426551816cd)

@DrunkOnJava
DrunkOnJava merged commit b1b5074 into main Sep 24, 2026
23 checks passed
@DrunkOnJava
DrunkOnJava deleted the feat/viewer-layer-highlight branch September 24, 2026 04:46
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