@xviewer.js/core 1.0.0-alpha.52 → 1.0.0-alpha.54

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
@@ -1481,19 +1481,13 @@ class Lens {
1481
1481
  }
1482
1482
  }
1483
1483
  __decorate([
1484
- property({
1485
- dir: "lens"
1486
- })
1484
+ property
1487
1485
  ], Lens.prototype, "fov", void 0);
1488
1486
  __decorate([
1489
- property({
1490
- dir: "lens"
1491
- })
1487
+ property
1492
1488
  ], Lens.prototype, "near", void 0);
1493
1489
  __decorate([
1494
- property({
1495
- dir: "lens"
1496
- })
1490
+ property
1497
1491
  ], Lens.prototype, "far", void 0);
1498
1492
  class VirtualCamera extends Component {
1499
1493
  get finalPosition() {
@@ -2718,6 +2712,7 @@ class FreelookVirtualCamera extends VirtualCamera {
2718
2712
  } else if (e.deltaY < 0) {
2719
2713
  this._targetSpringLength *= this._calculateDistanceScale(0.85);
2720
2714
  }
2715
+ this._calculateTargetSpringArm();
2721
2716
  }
2722
2717
  _onTouchStart(e) {
2723
2718
  if (!SystemInfo.isMobile) return;
@@ -2744,6 +2739,7 @@ class FreelookVirtualCamera extends VirtualCamera {
2744
2739
  __center.copy(__loc0).add(__loc1).multiplyScalar(0.5);
2745
2740
  this._calculatePanDelta(__panDelta, __preCenter, __center);
2746
2741
  this._calculateTargetLookAt(__panDelta);
2742
+ this._calculateTargetSpringArm();
2747
2743
  this._preLoc0.copy(__loc0);
2748
2744
  this._preLoc1.copy(__loc1);
2749
2745
  } else if (touches.length > 0) {
@@ -2765,7 +2761,7 @@ class FreelookVirtualCamera extends VirtualCamera {
2765
2761
  _calculateRotatelDelta(out, loc0, loc1) {
2766
2762
  this._tempRotateSmoothing = this.rotateSmoothing;
2767
2763
  const domElement = this.viewer.canvas;
2768
- out.copy(loc1).sub(loc0).multiplyScalar(this.rotateSpeed * 2 * Math.PI / domElement.height);
2764
+ out.copy(loc1).sub(loc0).multiplyScalar(this.rotateSpeed * 2 * Math.PI / domElement.clientHeight);
2769
2765
  out.y = -out.y;
2770
2766
  if (this.forbidX) {
2771
2767
  out.x = 0;
@@ -2778,7 +2774,7 @@ class FreelookVirtualCamera extends VirtualCamera {
2778
2774
  _calculatePanDelta(out, loc0, loc1) {
2779
2775
  this._tempRotateSmoothing = this.rotateSmoothing;
2780
2776
  const domElement = this.viewer.canvas;
2781
- out.copy(loc1).sub(loc0).multiplyScalar(this.panSpeed / domElement.height);
2777
+ out.copy(loc1).sub(loc0).multiplyScalar(this.panSpeed / domElement.clientHeight);
2782
2778
  if (this.forbidPanX) {
2783
2779
  out.x = 0;
2784
2780
  }
@@ -2868,10 +2864,10 @@ class FreelookVirtualCamera extends VirtualCamera {
2868
2864
  this._touchID = -1;
2869
2865
  this._preLoc0 = new Vector2();
2870
2866
  this._preLoc1 = new Vector2();
2871
- this._spherical = new Spherical(1, Math.PI / 2);
2867
+ this._spherical = new Spherical(2, Math.PI / 2);
2872
2868
  this._lookAt = new Vector3();
2873
2869
  this._tempSmoothing = 6;
2874
- this._tempRotateSmoothing = 6;
2870
+ this._tempRotateSmoothing = 8;
2875
2871
  this._targetTheta = 0;
2876
2872
  this._targetPhi = 0;
2877
2873
  this._targetSpringLength = 1;
@@ -2886,7 +2882,7 @@ class FreelookVirtualCamera extends VirtualCamera {
2886
2882
  this.panSpeed = 1;
2887
2883
  this.rotateSpeed = 1;
2888
2884
  this.smoothing = 5;
2889
- this.rotateSmoothing = 5;
2885
+ this.rotateSmoothing = 8;
2890
2886
  this.phiMin = ESP;
2891
2887
  this.phiMax = Math.PI - ESP;
2892
2888
  this.thetaMin = -Infinity;
@@ -4559,6 +4555,9 @@ class Viewer extends EventEmitter {
4559
4555
  static getMesh(node, name, group = false) {
4560
4556
  return Viewer._getObjectValue(node.userData.meshes, name, group);
4561
4557
  }
4558
+ get instanceId() {
4559
+ return this._instanceId;
4560
+ }
4562
4561
  get root() {
4563
4562
  return this._root;
4564
4563
  }
@@ -4929,6 +4928,7 @@ class Viewer extends EventEmitter {
4929
4928
  position: new Vector3(0, 0, 4)
4930
4929
  }, targetFrameRate = -1, fixedFrameTime = false, colorSpace = SRGBColorSpace, toneMapping = LinearToneMapping, toneMappingExposure = 1, maxDPR = 1.5, path = "", resourcePath = "", dracoPath = "https://www.gstatic.com/draco/v1/decoders/", orientation = Orientation.AUTO, loader = {}, tasker = {}, ...webglOpts } = {}){
4931
4930
  super();
4931
+ this._instanceId = Viewer._instanceCount++;
4932
4932
  this._dpr = 1;
4933
4933
  this._width = 1;
4934
4934
  this._height = 1;
@@ -5003,6 +5003,7 @@ Viewer._shadowCameraKeys = [
5003
5003
  Viewer.__emtpyObject = {};
5004
5004
  Viewer.fullscreenMesh = new Mesh(Viewer.createFullscreenTriangle());
5005
5005
  Viewer.fullscreenCamera = new OrthographicCamera(-1, 1, 1, -1, 0, 1);
5006
+ Viewer._instanceCount = 0;
5006
5007
 
5007
5008
  class MergeRefectPass {
5008
5009
  get envMapTarget() {