@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.
@@ -2289,7 +2289,6 @@ function regenerateAll(viewer) {
2289
2289
  }
2290
2290
 
2291
2291
  function resetView(viewer) {
2292
- const reset = viewer.getComponent("ResetComponent");
2293
2292
  viewer.executeCommand("setActiveDragger");
2294
2293
  viewer.executeCommand("clearSlices");
2295
2294
  viewer.executeCommand("clearOverlay");
@@ -2298,7 +2297,6 @@ function resetView(viewer) {
2298
2297
  viewer.executeCommand("showAll");
2299
2298
  viewer.executeCommand("explode", 0);
2300
2299
  viewer.executeCommand("zoomToExtents", true);
2301
- reset.resetCameraPosition();
2302
2300
  viewer.emit({ type: "resetview" });
2303
2301
  }
2304
2302
 
@@ -3233,19 +3231,22 @@ class ResetComponent {
3233
3231
  direction: this.viewer.camera.getWorldDirection(new Vector3()),
3234
3232
  };
3235
3233
  };
3234
+ this.resetCameraPosition = () => {
3235
+ if (this.savedCameraPosition) {
3236
+ this.viewer.camera.position.copy(this.savedCameraPosition.position);
3237
+ this.viewer.camera.up.copy(this.savedCameraPosition.up);
3238
+ this.viewer.camera.lookAt(this.savedCameraPosition.position.clone().add(this.savedCameraPosition.direction));
3239
+ this.viewer.camera.updateProjectionMatrix();
3240
+ }
3241
+ };
3236
3242
  this.viewer = viewer;
3237
3243
  this.viewer.addEventListener("databasechunk", this.onDatabaseChunk);
3244
+ this.viewer.on("resetview", this.resetCameraPosition);
3238
3245
  }
3239
3246
  dispose() {
3247
+ this.viewer.off("resetview", this.resetCameraPosition);
3240
3248
  this.viewer.removeEventListener("databasechunk", this.onDatabaseChunk);
3241
3249
  }
3242
- resetCameraPosition() {
3243
- if (this.savedCameraPosition) {
3244
- this.viewer.camera.position.copy(this.savedCameraPosition.position);
3245
- this.viewer.camera.up.copy(this.savedCameraPosition.up);
3246
- this.viewer.camera.lookAt(this.savedCameraPosition.position.clone().add(this.savedCameraPosition.direction));
3247
- }
3248
- }
3249
3250
  }
3250
3251
 
3251
3252
  const components = componentsRegistry("threejs");