From 744af0effbd5eebe871e54b06c8a73b73ed19f15 Mon Sep 17 00:00:00 2001 From: ijlal99 Date: Wed, 20 Nov 2024 02:10:14 +0500 Subject: [PATCH] XEOK-146 Use isSceneModelEntity instead of instanceOf SceneModelEntity --- src/viewer/scene/marker/Marker.js | 2 +- src/viewer/scene/model/SceneModelEntity.js | 5 +++++ types/viewer/scene/models/SceneModelEntity.d.ts | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/viewer/scene/marker/Marker.js b/src/viewer/scene/marker/Marker.js index b4eaa194da..7277140e47 100644 --- a/src/viewer/scene/marker/Marker.js +++ b/src/viewer/scene/marker/Marker.js @@ -212,7 +212,7 @@ class Marker extends Component { } this._entity = entity; if (this._entity) { - if (this._entity instanceof SceneModelEntity) { + if (this._entity.isSceneModelEntity) { this._onEntityModelDestroyed = this._entity.model.on("destroyed", () => { // SceneModelEntity does not fire events, and cannot exist beyond its VBOSceneModel this._entity = null; // Marker now may become visible, if it was synched to invisible Entity this._onEntityModelDestroyed = null; diff --git a/src/viewer/scene/model/SceneModelEntity.js b/src/viewer/scene/model/SceneModelEntity.js index b2a4052a1c..1057adff4e 100644 --- a/src/viewer/scene/model/SceneModelEntity.js +++ b/src/viewer/scene/model/SceneModelEntity.js @@ -34,6 +34,11 @@ export class SceneModelEntity { */ this.model = model; + /** + * Identifies if it's a SceneModelEntity + */ + this.isSceneModelEntity = true; + /** * The {@link SceneModelMesh}es belonging to this SceneModelEntity. * diff --git a/types/viewer/scene/models/SceneModelEntity.d.ts b/types/viewer/scene/models/SceneModelEntity.d.ts index 6a6a5ff963..6eee46206d 100644 --- a/types/viewer/scene/models/SceneModelEntity.d.ts +++ b/types/viewer/scene/models/SceneModelEntity.d.ts @@ -411,6 +411,12 @@ export declare abstract class SceneModelEntity implements Entity { */ meshes : SceneModelMesh[]; + + /** + * Identifies if it's a SceneModelEntity + */ + isSceneModelEntity: boolean; + /** * Destroys this SceneModelEntity. */