@d5techs/3dgs-lib 1.4.32 → 1.4.33

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/3dgs-lib.js CHANGED
@@ -623,7 +623,7 @@ const _OrbitControls = class _OrbitControls {
623
623
  __publicField(this, "maxPhi", Math.PI - 0.01);
624
624
  // 灵敏度
625
625
  __publicField(this, "rotateSpeed", 5e-3);
626
- __publicField(this, "zoomSpeed", 15e-4);
626
+ __publicField(this, "zoomSpeed", 5e-4);
627
627
  __publicField(this, "panSpeed", 5e-3);
628
628
  // 移动端触摸灵敏度
629
629
  __publicField(this, "touchZoomSpeed", 0.01);
@@ -788,6 +788,8 @@ const _OrbitControls = class _OrbitControls {
788
788
  const zoomDelta = normalizedDelta * this.zoomSpeed;
789
789
  if (this.enableDamping) {
790
790
  this.deltaDistance += zoomDelta * this.dampingFactor;
791
+ const maxAccum = 120 * this.zoomSpeed * this.dampingFactor * 3;
792
+ this.deltaDistance = Math.sign(this.deltaDistance) * Math.min(Math.abs(this.deltaDistance), maxAccum);
791
793
  } else {
792
794
  this.distance *= Math.exp(zoomDelta);
793
795
  this.distance = Math.max(
@@ -1103,28 +1105,15 @@ const _OrbitControls = class _OrbitControls {
1103
1105
  const fovRad = this.camera.fov;
1104
1106
  const halfFov = fovRad / 2;
1105
1107
  const marginFactor = 1.5;
1106
- const totalDistance = radius / Math.tan(halfFov) * marginFactor;
1107
- const surfaceOffset = radius * 0.85;
1108
- const sinPhi = Math.sin(this.phi);
1109
- const cosPhi = Math.cos(this.phi);
1110
- const sinTheta = Math.sin(this.theta);
1111
- const cosTheta = Math.cos(this.theta);
1112
- const offsetTarget = [
1113
- center[0] + sinPhi * sinTheta * surfaceOffset,
1114
- center[1] + cosPhi * surfaceOffset,
1115
- center[2] + sinPhi * cosTheta * surfaceOffset
1116
- ];
1117
- const adjustedDistance = Math.max(
1118
- this.minDistance,
1119
- totalDistance - surfaceOffset
1120
- );
1108
+ const targetDistance = radius / Math.tan(halfFov) * marginFactor;
1109
+ const clampedDistance = Math.max(this.minDistance, targetDistance);
1121
1110
  if (animate) {
1122
- this.animateToFrame(offsetTarget, adjustedDistance);
1111
+ this.animateToFrame(center, clampedDistance);
1123
1112
  } else {
1124
- this.camera.target[0] = offsetTarget[0];
1125
- this.camera.target[1] = offsetTarget[1];
1126
- this.camera.target[2] = offsetTarget[2];
1127
- this.distance = adjustedDistance;
1113
+ this.camera.target[0] = center[0];
1114
+ this.camera.target[1] = center[1];
1115
+ this.camera.target[2] = center[2];
1116
+ this.distance = clampedDistance;
1128
1117
  this.applySpherical();
1129
1118
  }
1130
1119
  }