From f5694d1bf1b5205f07557b2c52122a6206b6c870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Thu, 24 Oct 2024 12:17:58 +0200 Subject: [PATCH] fix(front): more fixes to highlight logic --- packages/core/package.json | 4 ++-- packages/core/src/ifc/IfcJsonExporter/example.ts | 2 +- packages/front/package.json | 6 +++--- packages/front/src/fragments/Highlighter/index.ts | 14 ++++++++------ 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index 8e86ad958..943ce84c0 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -37,7 +37,7 @@ "access": "public" }, "devDependencies": { - "@thatopen/fragments": ">=2.4.0-alpha.4", + "@thatopen/fragments": ">=2.4.0-alpha.8", "@thatopen/ui": "~2.3.0", "@types/three": "0.160.0", "stats.js": "^0.17.0", @@ -51,7 +51,7 @@ "three-mesh-bvh": "0.7.0" }, "peerDependencies": { - "@thatopen/fragments": ">=2.4.0-alpha.4", + "@thatopen/fragments": ">=2.4.0-alpha.8", "three": "^0.160.1", "web-ifc": "0.0.61" } diff --git a/packages/core/src/ifc/IfcJsonExporter/example.ts b/packages/core/src/ifc/IfcJsonExporter/example.ts index 0abcca021..08a24c12c 100644 --- a/packages/core/src/ifc/IfcJsonExporter/example.ts +++ b/packages/core/src/ifc/IfcJsonExporter/example.ts @@ -97,7 +97,7 @@ To convert IFC to JSON we need 2 things: `web-ifc` an the JSON exporter. The for const exporter = components.get(OBC.IfcJsonExporter); const webIfc = new WEBIFC.IfcAPI(); -webIfc.SetWasmPath("https://unpkg.com/web-ifc@0.0.57/", true); +webIfc.SetWasmPath("https://unpkg.com/web-ifc@0.0.61/", true); await webIfc.Init(); /* MD diff --git a/packages/front/package.json b/packages/front/package.json index 5b21e2244..22ac1b918 100644 --- a/packages/front/package.json +++ b/packages/front/package.json @@ -1,7 +1,7 @@ { "name": "@thatopen/components-front", "description": "Collection of frontend tools to author BIM apps.", - "version": "2.4.0-alpha.11", + "version": "2.4.0-alpha.12", "author": "That Open Company", "contributors": [ "Antonio Gonzalez Viegas (https://github.com/agviegas)", @@ -33,12 +33,12 @@ "publish-alpha": "npm publish --tag alpha" }, "peerDependencies": { - "@thatopen/fragments": ">=2.4.0-alpha.4", + "@thatopen/fragments": ">=2.4.0-alpha.8", "three": "^0.160.1", "web-ifc": "0.0.61" }, "devDependencies": { - "@thatopen/fragments": ">=2.4.0-alpha.4", + "@thatopen/fragments": ">=2.4.0-alpha.8", "@thatopen/ui": "~2.3.0", "@thatopen/ui-obc": "~2.3.0", "@types/earcut": "^2.1.4", diff --git a/packages/front/src/fragments/Highlighter/index.ts b/packages/front/src/fragments/Highlighter/index.ts index de417beab..df2a545e5 100644 --- a/packages/front/src/fragments/Highlighter/index.ts +++ b/packages/front/src/fragments/Highlighter/index.ts @@ -452,12 +452,12 @@ export class Highlighter clear(name?: string, filter?: FRAGS.FragmentIdMap) { const names = name ? [name] : Object.keys(this.selection); - for (const name of names) { - this._fills.clear(name); + for (const selectionName of names) { + this._fills.clear(selectionName); const fragments = this.components.get(OBC.FragmentsManager); - const selected = this.selection[name]; + const selected = this.selection[selectionName]; for (const fragID in selected) { const fragment = fragments.list.get(fragID); @@ -465,7 +465,7 @@ export class Highlighter continue; } - const idsToClear = selected[fragID]; + let idsToClear = selected[fragID]; if (!idsToClear) { continue; } @@ -486,6 +486,8 @@ export class Highlighter remaining.add(id); } } + + idsToClear = toClear; if (remaining.size) { selected[fragID] = remaining; } else { @@ -501,10 +503,10 @@ export class Highlighter } if (!filter) { - this.selection[name] = {}; + this.selection[selectionName] = {}; } - this.events[name].onClear.trigger(null); + this.events[selectionName].onClear.trigger(null); } }