@d5techs/3dgs-lib 1.4.74 → 1.4.75
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 +34 -36
- package/dist/3dgs-lib.cjs.map +1 -1
- package/dist/3dgs-lib.js +34 -36
- package/dist/3dgs-lib.js.map +1 -1
- package/dist/editor/SplatEditor.d.ts +2 -3
- package/package.json +1 -1
package/dist/3dgs-lib.js
CHANGED
|
@@ -809,6 +809,7 @@ const _OrbitControls = class _OrbitControls {
|
|
|
809
809
|
onKeyDown(e) {
|
|
810
810
|
var _a2;
|
|
811
811
|
if (!this.enabled) return;
|
|
812
|
+
if (e.ctrlKey || e.metaKey || e.altKey) return;
|
|
812
813
|
const tag = (_a2 = e.target) == null ? void 0 : _a2.tagName;
|
|
813
814
|
if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT") return;
|
|
814
815
|
const key = e.key.toLowerCase();
|
|
@@ -18245,52 +18246,49 @@ class SplatEditor {
|
|
|
18245
18246
|
this.editHistory.add(editOp);
|
|
18246
18247
|
}
|
|
18247
18248
|
/**
|
|
18248
|
-
*
|
|
18249
|
+
* 球选择:在屏幕空间判断 splat 是否在圆形区域内
|
|
18249
18250
|
*/
|
|
18250
18251
|
selectBySphere(op, centerPx, radiusPx) {
|
|
18251
|
-
|
|
18252
|
-
|
|
18253
|
-
|
|
18254
|
-
const
|
|
18255
|
-
|
|
18256
|
-
const
|
|
18257
|
-
const
|
|
18258
|
-
const
|
|
18252
|
+
this.ensureProjection();
|
|
18253
|
+
const proj = this.projectedPositions;
|
|
18254
|
+
if (!proj) return;
|
|
18255
|
+
const w = this.container.clientWidth;
|
|
18256
|
+
const h = this.container.clientHeight;
|
|
18257
|
+
const cx = centerPx.x / w;
|
|
18258
|
+
const cy = centerPx.y / h;
|
|
18259
|
+
const rx = radiusPx / w;
|
|
18260
|
+
const ry = radiusPx / h;
|
|
18261
|
+
const rx2 = rx * rx;
|
|
18262
|
+
const ry2 = ry * ry;
|
|
18259
18263
|
const editOp = new SelectOp(this.splatState, op, (i) => {
|
|
18260
|
-
|
|
18261
|
-
const
|
|
18262
|
-
|
|
18263
|
-
const
|
|
18264
|
-
|
|
18265
|
-
const wz = modelMat[2] * lx + modelMat[6] * ly + modelMat[10] * lz + modelMat[14];
|
|
18266
|
-
const dx = wx - cx, dy = wy - cy, dz = wz - cz;
|
|
18267
|
-
return dx * dx + dy * dy + dz * dz < r2;
|
|
18264
|
+
const b = i * 3;
|
|
18265
|
+
const sx = proj[b], sy = proj[b + 1], sz = proj[b + 2];
|
|
18266
|
+
if (sz <= 0 || sz >= 1) return false;
|
|
18267
|
+
const dx = sx - cx, dy = sy - cy;
|
|
18268
|
+
return dx * dx / rx2 + dy * dy / ry2 <= 1;
|
|
18268
18269
|
});
|
|
18269
18270
|
this.editHistory.add(editOp);
|
|
18270
18271
|
}
|
|
18271
18272
|
/**
|
|
18272
|
-
*
|
|
18273
|
-
* X/Y 半宽由屏幕拖拽距离转换,Z 半深度取 max(halfW, halfH)
|
|
18273
|
+
* 盒选择:在屏幕空间判断 splat 是否在矩形区域内
|
|
18274
18274
|
*/
|
|
18275
18275
|
selectByBox(op, centerPx, halfWPx, halfHPx) {
|
|
18276
|
-
|
|
18277
|
-
|
|
18278
|
-
|
|
18279
|
-
const
|
|
18280
|
-
const
|
|
18281
|
-
const
|
|
18282
|
-
const
|
|
18283
|
-
|
|
18284
|
-
const
|
|
18285
|
-
const
|
|
18276
|
+
this.ensureProjection();
|
|
18277
|
+
const proj = this.projectedPositions;
|
|
18278
|
+
if (!proj) return;
|
|
18279
|
+
const w = this.container.clientWidth;
|
|
18280
|
+
const h = this.container.clientHeight;
|
|
18281
|
+
const cx = centerPx.x / w;
|
|
18282
|
+
const cy = centerPx.y / h;
|
|
18283
|
+
const hw = halfWPx / w;
|
|
18284
|
+
const hh = halfHPx / h;
|
|
18285
|
+
const left = cx - hw, right = cx + hw;
|
|
18286
|
+
const top = cy - hh, bottom = cy + hh;
|
|
18286
18287
|
const editOp = new SelectOp(this.splatState, op, (i) => {
|
|
18287
|
-
|
|
18288
|
-
const
|
|
18289
|
-
|
|
18290
|
-
|
|
18291
|
-
const wy = modelMat[1] * lx + modelMat[5] * ly + modelMat[9] * lz + modelMat[13];
|
|
18292
|
-
const wz = modelMat[2] * lx + modelMat[6] * ly + modelMat[10] * lz + modelMat[14];
|
|
18293
|
-
return Math.abs(wx - cx) < hx && Math.abs(wy - cy) < hy && Math.abs(wz - cz) < hz;
|
|
18288
|
+
const b = i * 3;
|
|
18289
|
+
const sx = proj[b], sy = proj[b + 1], sz = proj[b + 2];
|
|
18290
|
+
if (sz <= 0 || sz >= 1) return false;
|
|
18291
|
+
return sx >= left && sx <= right && sy >= top && sy <= bottom;
|
|
18294
18292
|
});
|
|
18295
18293
|
this.editHistory.add(editOp);
|
|
18296
18294
|
}
|