Skip to content

Commit a6c4452

Browse files
committed
fix: correct highlighter result with edited models
1 parent 211bbe0 commit a6c4452

File tree

2 files changed

+23
-21
lines changed

2 files changed

+23
-21
lines changed

packages/front/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@thatopen/components-front",
33
"description": "Collection of frontend tools to author BIM apps.",
4-
"version": "3.2.1",
4+
"version": "3.2.2",
55
"author": "That Open Company",
66
"contributors": [
77
"Antonio Gonzalez Viegas (https://github.com/agviegas)",

packages/front/src/fragments/Highlighter/index.ts

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,12 @@ export class Highlighter
229229
return;
230230
}
231231

232-
const {
233-
localId,
234-
fragments: { modelId },
235-
} = result;
232+
let modelId = result.fragments.modelId;
233+
const { localId } = result;
234+
235+
if (result.fragments.isDeltaModel) {
236+
modelId = result.fragments.parentModelId;
237+
}
236238

237239
const found: OBC.ModelIdMap = { [modelId]: new Set([localId]) };
238240

@@ -286,38 +288,38 @@ export class Highlighter
286288
}
287289

288290
let map = OBC.ModelIdMapUtils.clone(modelIdMap);
289-
const fragments = this.components.get(OBC.FragmentsManager)
291+
const fragments = this.components.get(OBC.FragmentsManager);
290292

291293
// Include the delta model ids in the parent modelIdMap
292294
for (const [modelId, ids] of Object.entries(modelIdMap)) {
293-
const model = fragments.list.get(modelId)
294-
if (!(model?.isDeltaModel && model.parentModelId)) continue
295-
OBC.ModelIdMapUtils.add(map, {[model.parentModelId]: ids})
295+
const model = fragments.list.get(modelId);
296+
if (!(model?.isDeltaModel && model.parentModelId)) continue;
297+
OBC.ModelIdMapUtils.add(map, { [model.parentModelId]: ids });
296298
}
297299

298300
const selectables = this.selectable?.[name];
299301
if (selectables) {
300302
// Include the parent modelIds in the delta modelIdMap from selectables
301-
const selectable = OBC.ModelIdMapUtils.clone(selectables)
303+
const selectable = OBC.ModelIdMapUtils.clone(selectables);
302304
for (const [modelId, ids] of Object.entries(selectable)) {
303-
const model = fragments.list.get(modelId)
304-
if (!model?.deltaModelId) continue
305-
OBC.ModelIdMapUtils.add(selectable, {[model.deltaModelId]: ids})
305+
const model = fragments.list.get(modelId);
306+
if (!model?.deltaModelId) continue;
307+
OBC.ModelIdMapUtils.add(selectable, { [model.deltaModelId]: ids });
306308
}
307-
308-
map = OBC.ModelIdMapUtils.intersect([map, selectable])
309+
310+
map = OBC.ModelIdMapUtils.intersect([map, selectable]);
309311
}
310-
312+
311313
if (exclude) {
312314
// Include the parent modelIds in the exclusion modelIdMap from exclude
313-
const exclusion = OBC.ModelIdMapUtils.clone(exclude)
315+
const exclusion = OBC.ModelIdMapUtils.clone(exclude);
314316
for (const [modelId, ids] of Object.entries(exclusion)) {
315-
const model = fragments.list.get(modelId)
316-
if (!model?.deltaModelId) continue
317-
OBC.ModelIdMapUtils.add(exclusion, {[model.deltaModelId]: ids})
317+
const model = fragments.list.get(modelId);
318+
if (!model?.deltaModelId) continue;
319+
OBC.ModelIdMapUtils.add(exclusion, { [model.deltaModelId]: ids });
318320
}
319321

320-
map = OBC.ModelIdMapUtils.intersect([map, exclude])
322+
map = OBC.ModelIdMapUtils.intersect([map, exclude]);
321323
}
322324

323325
// Apply autotoggle when picking with the mouse

0 commit comments

Comments
 (0)