@xviewer.js/core 1.0.0-alpha.35 → 1.0.0-alpha.36

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/main.js CHANGED
@@ -2626,7 +2626,8 @@ class FreelookVirtualCamera extends VirtualCamera {
2626
2626
  return this._lookAt;
2627
2627
  }
2628
2628
  set lookAt(v) {
2629
- this._lookAt = this._targetLookAt = v;
2629
+ this._lookAt.copy(v);
2630
+ this._targetLookAt.copy(v);
2630
2631
  }
2631
2632
  get springLength() {
2632
2633
  return this._spherical.radius;
@@ -2672,13 +2673,12 @@ class FreelookVirtualCamera extends VirtualCamera {
2672
2673
  reset() {
2673
2674
  this._button = -1;
2674
2675
  this._touchID = -1;
2675
- this._setSpherical(this.node.position, this.lookAt);
2676
+ this._setSpherical(this.node.position, this._lookAt);
2676
2677
  }
2677
2678
  _setSpherical(position, lookAt) {
2678
2679
  const { __posDelta } = FreelookVirtualCamera;
2679
2680
  __posDelta.copy(position).sub(lookAt);
2680
2681
  this._spherical.setFromVector3(__posDelta);
2681
- this._targetSpherical.copy(this._spherical);
2682
2682
  }
2683
2683
  _onPointerDown(e) {
2684
2684
  if (SystemInfo.isMobile) return;
@@ -2707,12 +2707,10 @@ class FreelookVirtualCamera extends VirtualCamera {
2707
2707
  this._preLoc0.copy(__loc0);
2708
2708
  }
2709
2709
  _onMouseWheel(e) {
2710
- if (this.lookAt) {
2711
- if (e.deltaY > 0) {
2712
- this._targetSpringLength *= this._calculateDistanceScale(1 / 0.85);
2713
- } else if (e.deltaY < 0) {
2714
- this._targetSpringLength *= this._calculateDistanceScale(0.85);
2715
- }
2710
+ if (e.deltaY > 0) {
2711
+ this._targetSpringLength *= this._calculateDistanceScale(1 / 0.85);
2712
+ } else if (e.deltaY < 0) {
2713
+ this._targetSpringLength *= this._calculateDistanceScale(0.85);
2716
2714
  }
2717
2715
  }
2718
2716
  _onTouchStart(e) {
@@ -2807,7 +2805,7 @@ class FreelookVirtualCamera extends VirtualCamera {
2807
2805
  this._targetPhi = clamp(this._targetPhi, this.phiMin, this.phiMax);
2808
2806
  this._targetSpringLength = clamp(this._targetSpringLength, this.distanceMin, this.distanceMax);
2809
2807
  }
2810
- gotoPOI({ springLength = this._targetSpringLength, theta = this._targetTheta, phi = this._targetPhi, lookAt = this.lookAt, fov = this.lens.fov, smoothing = this.smoothing }) {
2808
+ gotoPOI({ springLength = this._targetSpringLength, theta = this._targetTheta, phi = this._targetPhi, lookAt = this._lookAt, fov = this.lens.fov, smoothing = this.smoothing }) {
2811
2809
  this._targetFov = fov;
2812
2810
  this._tempSmoothing = smoothing;
2813
2811
  this._targetSpringLength = springLength;
@@ -2826,7 +2824,7 @@ class FreelookVirtualCamera extends VirtualCamera {
2826
2824
  this._spherical.radius = FInterpTo(this._spherical.radius, this._targetSpringLength, dt, smoothing);
2827
2825
  this.lens.fov = FInterpTo(this.lens.fov, this._targetFov, dt, smoothing);
2828
2826
  VInterpTo(this._lookAt, this._targetLookAt, dt, smoothing);
2829
- this.node.position.setFromSpherical(this._spherical).add(this.lookAt);
2827
+ this.node.position.setFromSpherical(this._spherical).add(this._lookAt);
2830
2828
  this.node.lookAt(this._lookAt);
2831
2829
  }
2832
2830
  constructor(...args){
@@ -2843,7 +2841,6 @@ class FreelookVirtualCamera extends VirtualCamera {
2843
2841
  this._targetSpringLength = 1;
2844
2842
  this._targetFov = this.fov;
2845
2843
  this._targetLookAt = new three.Vector3();
2846
- this._targetSpherical = new three.Spherical();
2847
2844
  this.forbidX = false;
2848
2845
  this.forbidY = false;
2849
2846
  this.forbidZ = false;