Skip to content

Commit

Permalink
XEOK-146 Use isSceneModelEntity instead of instanceOf SceneModelEntity
Browse files Browse the repository at this point in the history
  • Loading branch information
ijlal99 committed Nov 19, 2024
1 parent 0c7fcc8 commit 744af0e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/viewer/scene/marker/Marker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions src/viewer/scene/model/SceneModelEntity.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
6 changes: 6 additions & 0 deletions types/viewer/scene/models/SceneModelEntity.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,12 @@ export declare abstract class SceneModelEntity implements Entity {
*/
meshes : SceneModelMesh[];


/**
* Identifies if it's a SceneModelEntity
*/
isSceneModelEntity: boolean;

/**
* Destroys this SceneModelEntity.
*/
Expand Down

0 comments on commit 744af0e

Please sign in to comment.