@inweb/viewer-three 26.12.5 → 26.12.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -35313,7 +35313,6 @@ void main() {
35313
35313
  }
35314
35314
 
35315
35315
  function resetView(viewer) {
35316
- const reset = viewer.getComponent("ResetComponent");
35317
35316
  viewer.executeCommand("setActiveDragger");
35318
35317
  viewer.executeCommand("clearSlices");
35319
35318
  viewer.executeCommand("clearOverlay");
@@ -35322,7 +35321,6 @@ void main() {
35322
35321
  viewer.executeCommand("showAll");
35323
35322
  viewer.executeCommand("explode", 0);
35324
35323
  viewer.executeCommand("zoomToExtents", true);
35325
- reset.resetCameraPosition();
35326
35324
  viewer.emit({ type: "resetview" });
35327
35325
  }
35328
35326
 
@@ -36896,19 +36894,22 @@ void main() {
36896
36894
  direction: this.viewer.camera.getWorldDirection(new Vector3()),
36897
36895
  };
36898
36896
  };
36897
+ this.resetCameraPosition = () => {
36898
+ if (this.savedCameraPosition) {
36899
+ this.viewer.camera.position.copy(this.savedCameraPosition.position);
36900
+ this.viewer.camera.up.copy(this.savedCameraPosition.up);
36901
+ this.viewer.camera.lookAt(this.savedCameraPosition.position.clone().add(this.savedCameraPosition.direction));
36902
+ this.viewer.camera.updateProjectionMatrix();
36903
+ }
36904
+ };
36899
36905
  this.viewer = viewer;
36900
36906
  this.viewer.addEventListener("databasechunk", this.onDatabaseChunk);
36907
+ this.viewer.on("resetview", this.resetCameraPosition);
36901
36908
  }
36902
36909
  dispose() {
36910
+ this.viewer.off("resetview", this.resetCameraPosition);
36903
36911
  this.viewer.removeEventListener("databasechunk", this.onDatabaseChunk);
36904
36912
  }
36905
- resetCameraPosition() {
36906
- if (this.savedCameraPosition) {
36907
- this.viewer.camera.position.copy(this.savedCameraPosition.position);
36908
- this.viewer.camera.up.copy(this.savedCameraPosition.up);
36909
- this.viewer.camera.lookAt(this.savedCameraPosition.position.clone().add(this.savedCameraPosition.direction));
36910
- }
36911
- }
36912
36913
  }
36913
36914
 
36914
36915
  const components = componentsRegistry("threejs");