Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XEOK-146 Use isSceneModelEntity instead of instanceOf SceneModelEntity #1739

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading