@d5techs/3dgs-lib 1.4.33 → 1.4.34
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 +29 -1
- package/dist/3dgs-lib.cjs.map +1 -1
- package/dist/3dgs-lib.js +29 -1
- package/dist/3dgs-lib.js.map +1 -1
- package/dist/core/OrbitControls.d.ts +4 -0
- package/package.json +1 -1
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",
|
|
626
|
+
__publicField(this, "zoomSpeed", 1e-3);
|
|
627
627
|
__publicField(this, "panSpeed", 5e-3);
|
|
628
628
|
// 移动端触摸灵敏度
|
|
629
629
|
__publicField(this, "touchZoomSpeed", 0.01);
|
|
@@ -1093,6 +1093,24 @@ const _OrbitControls = class _OrbitControls {
|
|
|
1093
1093
|
this.camera.target[2] = z;
|
|
1094
1094
|
this.applySpherical();
|
|
1095
1095
|
}
|
|
1096
|
+
/**
|
|
1097
|
+
* 将 target 移到新位置,但保持相机世界坐标不变(重算 distance/theta/phi)
|
|
1098
|
+
*/
|
|
1099
|
+
setTargetKeepPosition(x, y, z) {
|
|
1100
|
+
this.clearVelocity();
|
|
1101
|
+
const dx = this.camera.position[0] - x;
|
|
1102
|
+
const dy = this.camera.position[1] - y;
|
|
1103
|
+
const dz = this.camera.position[2] - z;
|
|
1104
|
+
const newDist = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
1105
|
+
if (newDist < this.minDistance) return;
|
|
1106
|
+
this.camera.target[0] = x;
|
|
1107
|
+
this.camera.target[1] = y;
|
|
1108
|
+
this.camera.target[2] = z;
|
|
1109
|
+
this.distance = newDist;
|
|
1110
|
+
this.theta = Math.atan2(dx, dz);
|
|
1111
|
+
this.phi = Math.acos(Math.min(1, Math.max(-1, dy / newDist)));
|
|
1112
|
+
this.applySpherical();
|
|
1113
|
+
}
|
|
1096
1114
|
getTarget() {
|
|
1097
1115
|
return [
|
|
1098
1116
|
this.camera.target[0],
|
|
@@ -18785,6 +18803,16 @@ class App {
|
|
|
18785
18803
|
return false;
|
|
18786
18804
|
}
|
|
18787
18805
|
this.controls.frameModel(bbox.center, bbox.radius, animate);
|
|
18806
|
+
if (!animate) {
|
|
18807
|
+
const rect = this.canvas.getBoundingClientRect();
|
|
18808
|
+
const hit = this.pickSplatPosition(
|
|
18809
|
+
rect.left + rect.width / 2,
|
|
18810
|
+
rect.top + rect.height / 2
|
|
18811
|
+
);
|
|
18812
|
+
if (hit) {
|
|
18813
|
+
this.controls.setTargetKeepPosition(hit[0], hit[1], hit[2]);
|
|
18814
|
+
}
|
|
18815
|
+
}
|
|
18788
18816
|
return true;
|
|
18789
18817
|
}
|
|
18790
18818
|
// ============================================
|