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