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

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
@@ -2720,6 +2720,7 @@ class FreelookVirtualCamera extends VirtualCamera {
2720
2720
  } else if (e.deltaY < 0) {
2721
2721
  this._targetSpringLength *= this._calculateDistanceScale(0.85);
2722
2722
  }
2723
+ this._calculateTargetSpringArm();
2723
2724
  }
2724
2725
  _onTouchStart(e) {
2725
2726
  if (!SystemInfo.isMobile) return;
@@ -2746,6 +2747,7 @@ class FreelookVirtualCamera extends VirtualCamera {
2746
2747
  __center.copy(__loc0).add(__loc1).multiplyScalar(0.5);
2747
2748
  this._calculatePanDelta(__panDelta, __preCenter, __center);
2748
2749
  this._calculateTargetLookAt(__panDelta);
2750
+ this._calculateTargetSpringArm();
2749
2751
  this._preLoc0.copy(__loc0);
2750
2752
  this._preLoc1.copy(__loc1);
2751
2753
  } else if (touches.length > 0) {
@@ -2767,7 +2769,7 @@ class FreelookVirtualCamera extends VirtualCamera {
2767
2769
  _calculateRotatelDelta(out, loc0, loc1) {
2768
2770
  this._tempRotateSmoothing = this.rotateSmoothing;
2769
2771
  const domElement = this.viewer.canvas;
2770
- out.copy(loc1).sub(loc0).multiplyScalar(this.rotateSpeed * 2 * Math.PI / domElement.height);
2772
+ out.copy(loc1).sub(loc0).multiplyScalar(this.rotateSpeed * 2 * Math.PI / domElement.clientHeight);
2771
2773
  out.y = -out.y;
2772
2774
  if (this.forbidX) {
2773
2775
  out.x = 0;
@@ -2780,7 +2782,7 @@ class FreelookVirtualCamera extends VirtualCamera {
2780
2782
  _calculatePanDelta(out, loc0, loc1) {
2781
2783
  this._tempRotateSmoothing = this.rotateSmoothing;
2782
2784
  const domElement = this.viewer.canvas;
2783
- out.copy(loc1).sub(loc0).multiplyScalar(this.panSpeed / domElement.height);
2785
+ out.copy(loc1).sub(loc0).multiplyScalar(this.panSpeed / domElement.clientHeight);
2784
2786
  if (this.forbidPanX) {
2785
2787
  out.x = 0;
2786
2788
  }
@@ -2873,7 +2875,7 @@ class FreelookVirtualCamera extends VirtualCamera {
2873
2875
  this._spherical = new three.Spherical(1, Math.PI / 2);
2874
2876
  this._lookAt = new three.Vector3();
2875
2877
  this._tempSmoothing = 6;
2876
- this._tempRotateSmoothing = 6;
2878
+ this._tempRotateSmoothing = 8;
2877
2879
  this._targetTheta = 0;
2878
2880
  this._targetPhi = 0;
2879
2881
  this._targetSpringLength = 1;
@@ -2888,7 +2890,7 @@ class FreelookVirtualCamera extends VirtualCamera {
2888
2890
  this.panSpeed = 1;
2889
2891
  this.rotateSpeed = 1;
2890
2892
  this.smoothing = 5;
2891
- this.rotateSmoothing = 5;
2893
+ this.rotateSmoothing = 8;
2892
2894
  this.phiMin = ESP;
2893
2895
  this.phiMax = Math.PI - ESP;
2894
2896
  this.thetaMin = -Infinity;
@@ -4561,6 +4563,9 @@ class Viewer extends EventEmitter {
4561
4563
  static getMesh(node, name, group = false) {
4562
4564
  return Viewer._getObjectValue(node.userData.meshes, name, group);
4563
4565
  }
4566
+ get instanceId() {
4567
+ return this._instanceId;
4568
+ }
4564
4569
  get root() {
4565
4570
  return this._root;
4566
4571
  }
@@ -4931,6 +4936,7 @@ class Viewer extends EventEmitter {
4931
4936
  position: new three.Vector3(0, 0, 4)
4932
4937
  }, targetFrameRate = -1, fixedFrameTime = false, colorSpace = three.SRGBColorSpace, toneMapping = three.LinearToneMapping, toneMappingExposure = 1, maxDPR = 1.5, path = "", resourcePath = "", dracoPath = "https://www.gstatic.com/draco/v1/decoders/", orientation = exports.Orientation.AUTO, loader = {}, tasker = {}, ...webglOpts } = {}){
4933
4938
  super();
4939
+ this._instanceId = Viewer._instanceCount++;
4934
4940
  this._dpr = 1;
4935
4941
  this._width = 1;
4936
4942
  this._height = 1;
@@ -5005,6 +5011,7 @@ Viewer._shadowCameraKeys = [
5005
5011
  Viewer.__emtpyObject = {};
5006
5012
  Viewer.fullscreenMesh = new three.Mesh(Viewer.createFullscreenTriangle());
5007
5013
  Viewer.fullscreenCamera = new three.OrthographicCamera(-1, 1, 1, -1, 0, 1);
5014
+ Viewer._instanceCount = 0;
5008
5015
 
5009
5016
  class MergeRefectPass {
5010
5017
  get envMapTarget() {