Skip to content

Highlighter, Hider and BoundingBoxer ignore the delta model when given the parent model's ids, so edited items can't be highlighted, hidden or framed by them #845

Open

Description

@cmartif

Describe the bug 📝

After a model is edited with the Fragments editor (editor.edit / createElements + applyChanges), Fragments loads a delta model for it (isDeltaModel, parentModelId; the parent gets deltaModelId). What the user sees of the edited items is the delta; the parent's copy is hidden. Picking returns the delta's ids, and Highlighter.highlightByID maps delta ids onto the parent, so clicking works. The other direction is missing, and an app usually holds the parent's ids (from a query, a classification, a stored selection, a BCF viewpoint):

  1. Highlighter.highlightByID(name, { [parentId]: ids }) (packages/front/src/fragments/Highlighter/index.ts, 3.6.0, lines 301–306) only adds the parent for delta ids, never the delta for parent ids. Highlighting an edited item by its parent id colours the hidden copy and nothing changes on screen.

  2. In the same method, the exclusion is built but not used (lines 314–324):

if (exclude) {
  // Include the delta models
  const exclusion = OBC.ModelIdMapUtils.clone(exclude);
  for (const [modelId, ids] of Object.entries(exclusion)) {
    const model = fragments.list.get(modelId);
    if (!model?.deltaModelId) continue;
    OBC.ModelIdMapUtils.add(exclusion, { [model.deltaModelId]: ids });
  }

  OBC.ModelIdMapUtils.remove(map, exclude); // ← `exclusion` was meant here
}

So an edited item excluded by its parent id stays highlighted through its delta.

  1. Hider.set(visible, { [parentId]: ids }) and Hider.isolate (packages/core/src/fragments/Hider/index.ts, lines 31–63) and BoundingBoxer.addFromModelIdMap (packages/core/src/fragments/BoundingBoxer/index.ts, lines 59–69, used by SimpleCamera.fitToItems) only touch the models in the map. Hiding an edited item by its parent id leaves the delta visible, and framing it measures the parent's hidden copy (or nothing, for an item that only exists in the delta).

Suggested fix. One helper that adds model.deltaModelId for every model of a map that has one (for example ModelIdMapUtils.withDeltaModels(map, fragments)), used in highlightByID (next to the existing parent mapping), in Hider.set / isolate / toggle and in BoundingBoxer.addFromModelIdMap; and remove(map, exclusion) in highlightByID.

Found in a BIM authoring app whose parametric elements are regenerated through the editor. Measured: highlighting an edited element by the parent's id, no visible change; by the delta's id, the selection colour. Our workaround wraps highlightByID, Hider.set / isolate and addFromModelIdMap with such a helper (about 20 lines). We can send a PR if it helps.

Reproduction ▶️

No response

Steps to reproduce 🔢

  1. Load a model and edit one of its items with the Fragments editor (for example change its geometry), then applyChanges. A delta model appears in FragmentsManager.list.
  2. highlighter.highlightByID("select", { [modelId]: new Set([editedId]) }): nothing changes on screen.
  3. The same with { [deltaModelId]: new Set([editedId]) }: the item is highlighted.
  4. hider.set(false, { [modelId]: new Set([editedId]) }): the item stays visible. world.camera.fitToItems({ [modelId]: new Set([editedId]) }) does not frame what is shown.
  5. Highlight every item of every loaded model (the delta included, e.g. a map built from FragmentsManager.list) excluding { [modelId]: new Set([editedId]) }: the edited item is still highlighted, through the delta.

System Info 💻

OS: Windows 11 Pro 10.0.26200
Node: 22.17.0 · npm 10.9.2
Browser: Chrome 155
@thatopen/components 3.6.0 · @thatopen/components-front 3.6.0 · @thatopen/fragments 3.6.0 · web-ifc 0.0.77 · three 0.185.0

Used Package Manager 📦

npm

Error Trace/Logs 📃

No response

Validations ✅

  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Make sure this is a repository issue and not a framework-specific issue. For example, if it's a THREE.js related bug, it should likely be reported to mrdoob/threejs instead.
  • Check that this is a concrete bug. For Q&A join our Community.
  • The provided reproduction is a minimal reproducible example of the bug.

Activity

  1. added
    bug
    on Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions