@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/module.js CHANGED
@@ -2718,6 +2718,7 @@ class FreelookVirtualCamera extends VirtualCamera {
2718
2718
  } else if (e.deltaY < 0) {
2719
2719
  this._targetSpringLength *= this._calculateDistanceScale(0.85);
2720
2720
  }
2721
+ this._calculateTargetSpringArm();
2721
2722
  }
2722
2723
  _onTouchStart(e) {
2723
2724
  if (!SystemInfo.isMobile) return;
@@ -2744,6 +2745,7 @@ class FreelookVirtualCamera extends VirtualCamera {
2744
2745
  __center.copy(__loc0).add(__loc1).multiplyScalar(0.5);
2745
2746
  this._calculatePanDelta(__panDelta, __preCenter, __center);
2746
2747
  this._calculateTargetLookAt(__panDelta);
2748
+ this._calculateTargetSpringArm();
2747
2749
  this._preLoc0.copy(__loc0);
2748
2750
  this._preLoc1.copy(__loc1);
2749
2751
  } else if (touches.length > 0) {
@@ -2765,7 +2767,7 @@ class FreelookVirtualCamera extends VirtualCamera {
2765
2767
  _calculateRotatelDelta(out, loc0, loc1) {
2766
2768
  this._tempRotateSmoothing = this.rotateSmoothing;
2767
2769
  const domElement = this.viewer.canvas;
2768
- out.copy(loc1).sub(loc0).multiplyScalar(this.rotateSpeed * 2 * Math.PI / domElement.height);
2770
+ out.copy(loc1).sub(loc0).multiplyScalar(this.rotateSpeed * 2 * Math.PI / domElement.clientHeight);
2769
2771
  out.y = -out.y;
2770
2772
  if (this.forbidX) {
2771
2773
  out.x = 0;
@@ -2778,7 +2780,7 @@ class FreelookVirtualCamera extends VirtualCamera {
2778
2780
  _calculatePanDelta(out, loc0, loc1) {
2779
2781
  this._tempRotateSmoothing = this.rotateSmoothing;
2780
2782
  const domElement = this.viewer.canvas;
2781
- out.copy(loc1).sub(loc0).multiplyScalar(this.panSpeed / domElement.height);
2783
+ out.copy(loc1).sub(loc0).multiplyScalar(this.panSpeed / domElement.clientHeight);
2782
2784
  if (this.forbidPanX) {
2783
2785
  out.x = 0;
2784
2786
  }
@@ -2871,7 +2873,7 @@ class FreelookVirtualCamera extends VirtualCamera {
2871
2873
  this._spherical = new Spherical(1, Math.PI / 2);
2872
2874
  this._lookAt = new Vector3();
2873
2875
  this._tempSmoothing = 6;
2874
- this._tempRotateSmoothing = 6;
2876
+ this._tempRotateSmoothing = 8;
2875
2877
  this._targetTheta = 0;
2876
2878
  this._targetPhi = 0;
2877
2879
  this._targetSpringLength = 1;
@@ -2886,7 +2888,7 @@ class FreelookVirtualCamera extends VirtualCamera {
2886
2888
  this.panSpeed = 1;
2887
2889
  this.rotateSpeed = 1;
2888
2890
  this.smoothing = 5;
2889
- this.rotateSmoothing = 5;
2891
+ this.rotateSmoothing = 8;
2890
2892
  this.phiMin = ESP;
2891
2893
  this.phiMax = Math.PI - ESP;
2892
2894
  this.thetaMin = -Infinity;
@@ -4559,6 +4561,9 @@ class Viewer extends EventEmitter {
4559
4561
  static getMesh(node, name, group = false) {
4560
4562
  return Viewer._getObjectValue(node.userData.meshes, name, group);
4561
4563
  }
4564
+ get instanceId() {
4565
+ return this._instanceId;
4566
+ }
4562
4567
  get root() {
4563
4568
  return this._root;
4564
4569
  }
@@ -4929,6 +4934,7 @@ class Viewer extends EventEmitter {
4929
4934
  position: new Vector3(0, 0, 4)
4930
4935
  }, 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
4936
  super();
4937
+ this._instanceId = Viewer._instanceCount++;
4932
4938
  this._dpr = 1;
4933
4939
  this._width = 1;
4934
4940
  this._height = 1;
@@ -5003,6 +5009,7 @@ Viewer._shadowCameraKeys = [
5003
5009
  Viewer.__emtpyObject = {};
5004
5010
  Viewer.fullscreenMesh = new Mesh(Viewer.createFullscreenTriangle());
5005
5011
  Viewer.fullscreenCamera = new OrthographicCamera(-1, 1, 1, -1, 0, 1);
5012
+ Viewer._instanceCount = 0;
5006
5013
 
5007
5014
  class MergeRefectPass {
5008
5015
  get envMapTarget() {