diff --git a/resources/openbim-components.js b/resources/openbim-components.js index a66ccd1b0..af030934a 100644 --- a/resources/openbim-components.js +++ b/resources/openbim-components.js @@ -9715,12 +9715,14 @@ class VertexPicker extends Component { return new THREE$1.Vector3(vertices.getX(index), vertices.getY(index), vertices.getZ(index)); } setupEvents(active) { - const container = this._components.ui.viewerContainer; + const container = this.components.renderer.get().domElement.parentElement; + if (!container) + return; if (active) { container.addEventListener("mousemove", this.update); } else { - container.addEventListener("mousemove", this.update); + container.removeEventListener("mousemove", this.update); } } } @@ -23332,7 +23334,8 @@ class OrthoPerspectiveCamera extends SimpleCamera { this.toggleEvents(true); this._projectionManager = new ProjectionManager(components, this); components.onInitialized.add(() => { - this.setUI(); + if (components.uiEnabled) + this.setUI(); }); this.onAspectUpdated.add(() => this.setOrthoCameraAspect()); } @@ -101580,12 +101583,18 @@ class IfcPropertiesProcessor extends Component { }); } async cleanPropertiesList() { - if (this._propertiesManager) { - const button = this._propertiesManager.uiElement.get("exportButton"); - button.removeFromParent(); + this._currentUI = {}; + if (this.components.uiEnabled) { + if (this._propertiesManager) { + const button = this._propertiesManager.uiElement.get("exportButton"); + button.removeFromParent(); + } + const propsList = this.uiElement.get("propsList"); + await propsList.dispose(true); + const propsWindow = this.uiElement.get("propertiesWindow"); + propsWindow.description = null; + propsList.children = []; } - const propsList = this.uiElement.get("propsList"); - await propsList.dispose(true); // for (const child of this._propsList.children) { // if (child instanceof TreeView) { // this._entityUIPool.return(child); @@ -101593,10 +101602,6 @@ class IfcPropertiesProcessor extends Component { // } // child.dispose(); // } - const propsWindow = this.uiElement.get("propertiesWindow"); - propsWindow.description = null; - propsList.children = []; - this._currentUI = {}; } get() { return this._indexMap; @@ -101624,6 +101629,8 @@ class IfcPropertiesProcessor extends Component { } } async renderProperties(model, expressID) { + if (!this.components.uiEnabled) + return; await this.cleanPropertiesList(); const topToolbar = this.uiElement.get("topToolbar"); const propsList = this.uiElement.get("propsList"); diff --git a/src/ifc/IfcPropertiesProcessor/index.ts b/src/ifc/IfcPropertiesProcessor/index.ts index c5c80062e..bd38b2217 100644 --- a/src/ifc/IfcPropertiesProcessor/index.ts +++ b/src/ifc/IfcPropertiesProcessor/index.ts @@ -222,13 +222,19 @@ export class IfcPropertiesProcessor } async cleanPropertiesList() { - if (this._propertiesManager) { - const button = this._propertiesManager.uiElement.get("exportButton"); - button.removeFromParent(); + this._currentUI = {}; + if (this.components.uiEnabled) { + if (this._propertiesManager) { + const button = this._propertiesManager.uiElement.get("exportButton"); + button.removeFromParent(); + } + const propsList = this.uiElement.get("propsList"); + await propsList.dispose(true); + const propsWindow = + this.uiElement.get("propertiesWindow"); + propsWindow.description = null; + propsList.children = []; } - - const propsList = this.uiElement.get("propsList"); - await propsList.dispose(true); // for (const child of this._propsList.children) { // if (child instanceof TreeView) { // this._entityUIPool.return(child); @@ -236,10 +242,6 @@ export class IfcPropertiesProcessor // } // child.dispose(); // } - const propsWindow = this.uiElement.get("propertiesWindow"); - propsWindow.description = null; - propsList.children = []; - this._currentUI = {}; } get(): IndexMap { @@ -273,6 +275,7 @@ export class IfcPropertiesProcessor } async renderProperties(model: FragmentsGroup, expressID: number) { + if (!this.components.uiEnabled) return; await this.cleanPropertiesList(); const topToolbar = this.uiElement.get("topToolbar"); const propsList = this.uiElement.get("propsList"); diff --git a/src/navigation/OrthoPerspectiveCamera/index.ts b/src/navigation/OrthoPerspectiveCamera/index.ts index d4135a55c..00b97b48d 100644 --- a/src/navigation/OrthoPerspectiveCamera/index.ts +++ b/src/navigation/OrthoPerspectiveCamera/index.ts @@ -52,7 +52,7 @@ export class OrthoPerspectiveCamera extends SimpleCamera implements UI { this._projectionManager = new ProjectionManager(components, this); components.onInitialized.add(() => { - this.setUI(); + if (components.uiEnabled) this.setUI(); }); this.onAspectUpdated.add(() => this.setOrthoCameraAspect()); diff --git a/src/utils/VertexPicker/index.ts b/src/utils/VertexPicker/index.ts index 178ef4c34..c0c95a6dd 100644 --- a/src/utils/VertexPicker/index.ts +++ b/src/utils/VertexPicker/index.ts @@ -161,11 +161,12 @@ export class VertexPicker } private setupEvents(active: boolean) { - const container = this._components.ui.viewerContainer; + const container = this.components.renderer.get().domElement.parentElement; + if (!container) return; if (active) { container.addEventListener("mousemove", this.update); } else { - container.addEventListener("mousemove", this.update); + container.removeEventListener("mousemove", this.update); } } }