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