rayzee 9.4.0 → 9.4.1

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.
package/dist/rayzee.es.js CHANGED
@@ -29226,7 +29226,7 @@ function Jv(e, t, n, r) {
29226
29226
  }
29227
29227
  //#endregion
29228
29228
  //#region src/version.js
29229
- var Yv = "9.4.0", Xv = 1e4, Zv = 15e5;
29229
+ var Yv = "9.4.1", Xv = 1e4, Zv = 15e5;
29230
29230
  function Qv(e, t, n = Xv) {
29231
29231
  return e >= n && t / Zv < e / 3;
29232
29232
  }
@@ -42508,18 +42508,7 @@ var EO = class extends Mn {
42508
42508
  }), this.currentCameraIndex = t, t === 0 && this._defaultCameraState) {
42509
42509
  let e = this._defaultCameraState;
42510
42510
  this.camera.position.copy(e.position), this.camera.quaternion.copy(e.quaternion), this.camera.scale.copy(e.scale ?? UO), this.camera.fov = e.fov, this.camera.near = e.near, this.camera.far = e.far, this.camera.updateProjectionMatrix(), this.camera.updateMatrixWorld(!0), this.controls && e.target && (this.controls.target.copy(e.target), this.controls.update());
42511
- } else {
42512
- let e = this.cameras[t];
42513
- if (this.camera.position.copy(e.position), this.camera.quaternion.copy(e.quaternion), this.camera.scale.copy(e.scale), e.isPerspectiveCamera && (this.camera.fov = e.fov), this.camera.near = e.near, this.camera.far = e.far, this.camera.updateProjectionMatrix(), this.camera.updateMatrixWorld(!0), this.controls) {
42514
- let t = e.userData?.__rayzeeOrbitTarget;
42515
- if (t) this.controls.target.copy(t);
42516
- else {
42517
- let t = new ur(0, 0, -1).applyQuaternion(e.quaternion), r = n || 5;
42518
- this.controls.target.copy(this.camera.position).addScaledVector(t, r);
42519
- }
42520
- this.controls.update();
42521
- }
42522
- }
42511
+ } else this._placeAt(this.cameras[t], n);
42523
42512
  this.resetAutoFocus();
42524
42513
  let o = this.cameras[t], s = o?.userData?.__rayzeeEffects;
42525
42514
  this._showOrthographic(s ? s.orthoHeight : WO(o)), this._applyEffects(s), r?.(), i?.(), this.dispatchEvent({
@@ -42530,6 +42519,26 @@ var EO = class extends Mn {
42530
42519
  cameraProjection: this._getSettings?.("cameraProjection")
42531
42520
  });
42532
42521
  }
42522
+ resetView() {
42523
+ let e = this.currentCameraIndex > 0 ? this.cameras[this.currentCameraIndex] : null;
42524
+ if (!e) {
42525
+ this.controls.reset();
42526
+ return;
42527
+ }
42528
+ this._placeAt(e, this._getSettings?.("focusDistance"));
42529
+ let t = WO(e);
42530
+ this.camera.orthographic && this._setView(!0, t ? t / 2 : this.camera.orthoHalfHeight), this._onReset?.();
42531
+ }
42532
+ _placeAt(e, t) {
42533
+ if (this.camera.position.copy(e.position), this.camera.quaternion.copy(e.quaternion), this.camera.scale.copy(e.scale), e.isPerspectiveCamera && (this.camera.fov = e.fov), this.camera.near = e.near, this.camera.far = e.far, this.camera.updateProjectionMatrix(), this.camera.updateMatrixWorld(!0), !this.controls) return;
42534
+ let n = e.userData?.__rayzeeOrbitTarget;
42535
+ if (n) this.controls.target.copy(n);
42536
+ else {
42537
+ let n = new ur(0, 0, -1).applyQuaternion(e.quaternion);
42538
+ this.controls.target.copy(this.camera.position).addScaledVector(n, t || 5);
42539
+ }
42540
+ this.controls.update();
42541
+ }
42533
42542
  _showOrthographic(e) {
42534
42543
  e > 0 ? this._setView(!0, e / 2) : this._setView(!1);
42535
42544
  let t = this._getSettings?.("cameraProjection"), n = e > 0 ? "orthographic" : t === "orthographic" ? "perspective" : t;