iflow-engine-base-3d 3.11.6 → 3.11.7
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/assets//350/267/263/350/267/263/345/215/241.glb +0 -0
- package/dist/assets//351/227/250/350/264/264.glb +0 -0
- package/dist/bim-engine-sdk.es.js +1 -1
- package/dist/bim-engine-sdk.umd.js +20 -20
- package/dist/chunks/{engine-3d-CiOcOaBI.js → engine-3d-C7t4h5ek.js} +531 -452
- package/dist/chunks/{sdk-runtime-BmnLG3N7.js → sdk-runtime-ADCm2tCl.js} +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as ni, G as de, P as st, O as
|
|
2
|
-
import { W as oe, C as
|
|
1
|
+
import { S as ni, G as de, P as st, O as ve, M as R, V as h, T as tn, C as jn, W as si, a as Kn, b as Ke, N as oi, c as Yn, d as Ue, e as H, Q as De, E as nn, R as ae, f as sn, g as on, B as Y, h as ri, A as Xn, i as G, j as O, I as X, k as kt, l as zt, m as rn, n as an, L as xt, o as $n, p as Zn, q as Jn, r as yi, D as he, s as Mi, t as Qn, F as es, u as Fe, v as ln, w as cn, x as ai, y as ts, z as hn, H as we, J as is, K as ot, U as ns, X as ss, Y as os, Z as rs, _ as Le, $ as bt, a0 as dn, a1 as Z, a2 as ge, a3 as as, a4 as Je, a5 as Oe, a6 as ls, a7 as Ct, a8 as St, a9 as ke, aa as at, ab as cs, ac as un, ad as qt, ae as Et, af as hs, ag as je, ah as ds, ai as us, aj as pn, ak as mn, al as Pt, am as jt, an as ps, ao as vi, ap as Kt, aq as At, ar as rt, as as ms, at as gs, au as wi, av as fs, aw as xi, ax as ys, ay as Ms, az as vs, aA as ws, aB as xs, aC as bs, aD as Cs, aE as Ss, aF as Es, aG as Ps, aH as As, aI as bi } from "./three-vendor-ox3_iXFc.js";
|
|
2
|
+
import { W as oe, C as Ts, L as Tt, B as Ci, g as Ae, a as _s, E as Ds, r as Is } from "./sdk-runtime-ADCm2tCl.js";
|
|
3
3
|
import { r as W, g as Ls } from "./sdk-assets-BbXNfc5u.js";
|
|
4
4
|
import { a as gn, J as Yt, c as ks, b as zs, P as Bt, q as Bs, k as Rs, n as Si, E as Ei, S as Fs } from "./sdk-vendor-DYgn7sFs.js";
|
|
5
5
|
class Os {
|
|
@@ -11,7 +11,7 @@ class Os {
|
|
|
11
11
|
t.name = "groupEdge", this.scene.add(t);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
var
|
|
14
|
+
var vt = /* @__PURE__ */ ((a) => (a.PERSPECTIVE = "perspective", a.ORTHOGRAPHIC = "orthographic", a))(vt || {});
|
|
15
15
|
class ce {
|
|
16
16
|
static MIN_VISIBLE_HEIGHT = 1e-4;
|
|
17
17
|
static MIN_CAMERA_DISTANCE = 1e-4;
|
|
@@ -26,7 +26,7 @@ class ce {
|
|
|
26
26
|
1e3
|
|
27
27
|
), this.perspectiveCamera.position.set(2, 2, 2), this.perspectiveCamera.lookAt(0, 0, 0);
|
|
28
28
|
const t = 50, i = this.engine.container.clientWidth / this.engine.container.clientHeight;
|
|
29
|
-
this.orthographicCamera = new
|
|
29
|
+
this.orthographicCamera = new ve(
|
|
30
30
|
t * i / -2,
|
|
31
31
|
t * i / 2,
|
|
32
32
|
t / 2,
|
|
@@ -130,7 +130,7 @@ class ce {
|
|
|
130
130
|
const e = this.engine.camera;
|
|
131
131
|
if (!e)
|
|
132
132
|
return;
|
|
133
|
-
const t = e.position.clone(), i = this.engine.controls.target.clone(), n = e.quaternion.clone(), s = e.up.clone(), o = this.perspectiveCamera, r = this.getViewDirection(t, i, n), l = e instanceof
|
|
133
|
+
const t = e.position.clone(), i = this.engine.controls.target.clone(), n = e.quaternion.clone(), s = e.up.clone(), o = this.perspectiveCamera, r = this.getViewDirection(t, i, n), l = e instanceof ve ? this.getOrthographicVisibleHeight(e) : this.getPerspectiveVisibleHeight(e, i), c = R.degToRad(o.getEffectiveFOV() * 0.5), d = Math.max(
|
|
134
134
|
l / (2 * Math.tan(c)),
|
|
135
135
|
ce.MIN_CAMERA_DISTANCE
|
|
136
136
|
);
|
|
@@ -292,7 +292,7 @@ class Hs {
|
|
|
292
292
|
renderer;
|
|
293
293
|
watermark;
|
|
294
294
|
constructor(e) {
|
|
295
|
-
this.engine = e, this.renderer = null, this.watermark = new
|
|
295
|
+
this.engine = e, this.renderer = null, this.watermark = new Ts(tn);
|
|
296
296
|
}
|
|
297
297
|
createRenderer() {
|
|
298
298
|
const { width: e, height: t } = this.engine.deviceModule.getContainerSize();
|
|
@@ -323,7 +323,7 @@ const Vs = { type: "change" }, Pi = { type: "start" }, Ai = { type: "end" }, K =
|
|
|
323
323
|
DOLLY: 2,
|
|
324
324
|
TOUCH_ROTATE: 3,
|
|
325
325
|
TOUCH_DOLLY_PAN: 4
|
|
326
|
-
}, Ft = new h(1, 0, 0), Us = new h(0, 1, 0), Gs = new h(0, 0, 1), Ge = new h(), pt = new h(), me = new h(), j = new h(), be = new h(), se = new h(), Ce = new h(), Ws = new h(), mt = new De(), Ot = new De(),
|
|
326
|
+
}, Ft = new h(1, 0, 0), Us = new h(0, 1, 0), Gs = new h(0, 0, 1), Ge = new h(), pt = new h(), me = new h(), j = new h(), be = new h(), se = new h(), Ce = new h(), Ws = new h(), mt = new De(), Ot = new De(), Ti = /* @__PURE__ */ new Set([
|
|
327
327
|
"KeyW",
|
|
328
328
|
"KeyA",
|
|
329
329
|
"KeyS",
|
|
@@ -340,7 +340,7 @@ const Vs = { type: "change" }, Pi = { type: "start" }, Ai = { type: "end" }, K =
|
|
|
340
340
|
function gt(a, e, t) {
|
|
341
341
|
return Math.max(e, Math.min(t, a));
|
|
342
342
|
}
|
|
343
|
-
function
|
|
343
|
+
function _i(a) {
|
|
344
344
|
return {
|
|
345
345
|
width: Math.max(a?.clientWidth || 1, 1),
|
|
346
346
|
height: Math.max(a?.clientHeight || 1, 1)
|
|
@@ -458,7 +458,7 @@ class fn extends Yn {
|
|
|
458
458
|
Ge.copy(n).sub(i), Ge.lengthSq() < K && Ge.set(0, 0, Math.max(this.minDistance, 1)), pt.copy(this.target).sub(i), se.copy(this.target).sub(n).normalize(), Math.abs(e) > K && (mt.setFromAxisAngle(this._referenceUp, -e), Ge.applyQuaternion(mt), pt.applyQuaternion(mt), se.applyQuaternion(mt).normalize()), j.copy(this._getStableRightAxis(se)), Math.abs(t) > K && j.lengthSq() > K && (Ot.setFromAxisAngle(j, -t), Ge.applyQuaternion(Ot), pt.applyQuaternion(Ot)), n.copy(i).add(Ge), this.target.copy(i).add(pt);
|
|
459
459
|
}
|
|
460
460
|
_applyPan(e, t) {
|
|
461
|
-
const { width: i, height: n } =
|
|
461
|
+
const { width: i, height: n } = _i(this.domElement);
|
|
462
462
|
j.copy(Ft).applyQuaternion(this.object.quaternion).normalize(), be.copy(Us).applyQuaternion(this.object.quaternion).normalize();
|
|
463
463
|
let s = 0, o = 0;
|
|
464
464
|
if (this.object.isPerspectiveCamera) {
|
|
@@ -553,7 +553,7 @@ class fn extends Yn {
|
|
|
553
553
|
if (!this.enabled)
|
|
554
554
|
return;
|
|
555
555
|
const t = e.code || e.key;
|
|
556
|
-
if (this.object?.isPerspectiveCamera &&
|
|
556
|
+
if (this.object?.isPerspectiveCamera && Ti.has(t)) {
|
|
557
557
|
Di(e.target) || (this._pressedKeys.add(t), this._startKeyboardMoveLoop(), e.preventDefault());
|
|
558
558
|
return;
|
|
559
559
|
}
|
|
@@ -576,7 +576,7 @@ class fn extends Yn {
|
|
|
576
576
|
}
|
|
577
577
|
_handleKeyUp(e) {
|
|
578
578
|
const t = e.code || e.key;
|
|
579
|
-
|
|
579
|
+
Ti.has(t) && (this._pressedKeys.delete(t), this._pressedKeys.size === 0 && this._stopKeyboardMoveLoop(), this.object?.isPerspectiveCamera && !Di(e.target) && e.preventDefault());
|
|
580
580
|
}
|
|
581
581
|
_handleTouchStart() {
|
|
582
582
|
const e = Array.from(this._pointers.values());
|
|
@@ -625,7 +625,7 @@ class fn extends Yn {
|
|
|
625
625
|
_queueRotate(e, t) {
|
|
626
626
|
if (!this.enableRotate || !this.domElement)
|
|
627
627
|
return;
|
|
628
|
-
const { height: i } =
|
|
628
|
+
const { height: i } = _i(this.domElement), n = Rt / i;
|
|
629
629
|
this._rotateVelocity.x += e * n * this.rotateSpeed, this._rotateVelocity.y += t * n * this.rotateSpeed;
|
|
630
630
|
}
|
|
631
631
|
_queuePan(e, t) {
|
|
@@ -1452,11 +1452,11 @@ class Li extends nn {
|
|
|
1452
1452
|
});
|
|
1453
1453
|
}
|
|
1454
1454
|
}
|
|
1455
|
-
const Xt = "__isModelUrlGroup",
|
|
1456
|
-
function
|
|
1455
|
+
const Xt = "__isModelUrlGroup", _t = "__modelDepthBias", yn = 4;
|
|
1456
|
+
function Mn(a) {
|
|
1457
1457
|
return a.__modelGroupMap instanceof Map || (a.__modelGroupMap = /* @__PURE__ */ new Map()), a.__modelGroupMap;
|
|
1458
1458
|
}
|
|
1459
|
-
function
|
|
1459
|
+
function vn(a) {
|
|
1460
1460
|
return a.__modelObjectIndexMap instanceof Map || (a.__modelObjectIndexMap = /* @__PURE__ */ new Map()), a.__modelObjectIndexMap;
|
|
1461
1461
|
}
|
|
1462
1462
|
function $t(a, e) {
|
|
@@ -1475,7 +1475,7 @@ function Dt(a, e, t) {
|
|
|
1475
1475
|
i != null && (Array.isArray(i.urls) || (i.urls = []), i.urls.includes(t) || i.urls.push(t));
|
|
1476
1476
|
}
|
|
1477
1477
|
function Ne(a, e) {
|
|
1478
|
-
const t =
|
|
1478
|
+
const t = Mn(a), i = t.get(e);
|
|
1479
1479
|
if (i && i.parent != null)
|
|
1480
1480
|
return i;
|
|
1481
1481
|
const n = hi(a, e);
|
|
@@ -1493,7 +1493,7 @@ function Ye(a, e) {
|
|
|
1493
1493
|
if (t != null)
|
|
1494
1494
|
return t;
|
|
1495
1495
|
const i = new de();
|
|
1496
|
-
$t(i, e), a.scene.add(i),
|
|
1496
|
+
$t(i, e), a.scene.add(i), Mn(a).set(e, i);
|
|
1497
1497
|
const s = hi(a, e);
|
|
1498
1498
|
return s != null && (s.group = i), i;
|
|
1499
1499
|
}
|
|
@@ -1542,7 +1542,7 @@ function $s(a) {
|
|
|
1542
1542
|
}
|
|
1543
1543
|
function pi(a, e, t) {
|
|
1544
1544
|
const i = typeof t == "number" ? t : $s(a);
|
|
1545
|
-
return e.index = i,
|
|
1545
|
+
return e.index = i, vn(a).set(i, e), i;
|
|
1546
1546
|
}
|
|
1547
1547
|
function wn(a) {
|
|
1548
1548
|
return Array.isArray(a) ? a : a != null ? [a] : [];
|
|
@@ -1554,8 +1554,8 @@ function mi(a, e) {
|
|
|
1554
1554
|
const t = typeof e == "number" ? e : a?.index, i = Zs(t);
|
|
1555
1555
|
wn(a?.material).forEach((n) => {
|
|
1556
1556
|
n.userData = n.userData ?? {};
|
|
1557
|
-
const s = n.userData[
|
|
1558
|
-
n.userData[
|
|
1557
|
+
const s = n.userData[_t] ?? {};
|
|
1558
|
+
n.userData[_t] = {
|
|
1559
1559
|
...s,
|
|
1560
1560
|
enabled: !0,
|
|
1561
1561
|
factor: 1,
|
|
@@ -1566,8 +1566,8 @@ function mi(a, e) {
|
|
|
1566
1566
|
function ki(a, e) {
|
|
1567
1567
|
wn(a?.material).forEach((t) => {
|
|
1568
1568
|
t.userData = t.userData ?? {};
|
|
1569
|
-
const i = t.userData[
|
|
1570
|
-
t.userData[
|
|
1569
|
+
const i = t.userData[_t] ?? {}, n = i.enabled ? i.units : t.polygonOffsetUnits ?? 0, s = i.enabled ? i.factor : t.polygonOffsetFactor ?? 1;
|
|
1570
|
+
t.userData[_t] = {
|
|
1571
1571
|
...i,
|
|
1572
1572
|
edgeActive: e
|
|
1573
1573
|
}, i.enabled || e ? (t.polygonOffset = !1, t.polygonOffsetFactor = s, t.polygonOffsetUnits = n + (e ? yn : 0)) : t.polygonOffset = !1, t.needsUpdate = !0;
|
|
@@ -1576,7 +1576,7 @@ function ki(a, e) {
|
|
|
1576
1576
|
function Lt(a, e) {
|
|
1577
1577
|
if (!Number.isFinite(e))
|
|
1578
1578
|
return;
|
|
1579
|
-
const t =
|
|
1579
|
+
const t = vn(a), i = t.get(e);
|
|
1580
1580
|
if (i && i.parent != null)
|
|
1581
1581
|
return i;
|
|
1582
1582
|
i && i.parent == null && t.delete(e);
|
|
@@ -1597,62 +1597,62 @@ class Js {
|
|
|
1597
1597
|
r || (r = [0, 0, []]);
|
|
1598
1598
|
const l = He(n, s), c = this.getModelSnapCache(s, o, r);
|
|
1599
1599
|
n.camera.updateMatrixWorld(!0);
|
|
1600
|
-
const d = new G().multiplyMatrices(n.camera.projectionMatrix, n.camera.matrixWorldInverse), u = n.renderer.domElement.clientWidth, g = n.renderer.domElement.clientHeight, m = new H(t.offsetX, t.offsetY), w = new kt(),
|
|
1601
|
-
let
|
|
1600
|
+
const d = new G().multiplyMatrices(n.camera.projectionMatrix, n.camera.matrixWorldInverse), u = n.renderer.domElement.clientWidth, g = n.renderer.domElement.clientHeight, m = new H(t.offsetX, t.offsetY), w = new kt(), M = new h(), b = new h(), p = new H(), x = new H(), C = new h();
|
|
1601
|
+
let T = "face", E = null, k = null, B = 100;
|
|
1602
1602
|
if (i != null) {
|
|
1603
1603
|
const I = e.point.clone(), V = e.normal || (e.face ? e.face.normal : null);
|
|
1604
1604
|
if (V && e.object?.matrixWorld?.elements) {
|
|
1605
1605
|
const $ = V.clone().transformDirection(e.object.matrixWorld).normalize(), f = new h().subVectors(i, I).dot($), y = i.clone().sub($.clone().multiplyScalar(f)), P = this.projectWorldPointToScreen(y, d, u, g, p, w);
|
|
1606
1606
|
if (P != null) {
|
|
1607
|
-
const
|
|
1608
|
-
|
|
1607
|
+
const _ = this.getDistanceSq(P.x, P.y, m.x, m.y);
|
|
1608
|
+
_ < B * 4 && (B = _, E = {
|
|
1609
1609
|
point: y,
|
|
1610
|
-
distanceSq:
|
|
1610
|
+
distanceSq: _,
|
|
1611
1611
|
pointxy: P.clone(),
|
|
1612
1612
|
style: "vertical"
|
|
1613
|
-
},
|
|
1613
|
+
}, T = "point");
|
|
1614
1614
|
}
|
|
1615
1615
|
}
|
|
1616
1616
|
}
|
|
1617
1617
|
for (let I = 0; I < c.localPoints.length; I += 3) {
|
|
1618
|
-
if (
|
|
1618
|
+
if (M.set(c.localPoints[I], c.localPoints[I + 1], c.localPoints[I + 2]).applyMatrix4(l), n.clipping && !n.clipping.isPointInClippingRange(M))
|
|
1619
1619
|
continue;
|
|
1620
|
-
const V = this.projectWorldPointToScreen(
|
|
1620
|
+
const V = this.projectWorldPointToScreen(M, d, u, g, p, w);
|
|
1621
1621
|
if (V == null)
|
|
1622
1622
|
continue;
|
|
1623
1623
|
const $ = this.getDistanceSq(V.x, V.y, m.x, m.y);
|
|
1624
1624
|
$ < B && (B = $, E = {
|
|
1625
|
-
point:
|
|
1625
|
+
point: M.clone(),
|
|
1626
1626
|
distanceSq: $,
|
|
1627
1627
|
pointxy: V.clone(),
|
|
1628
1628
|
style: "rect"
|
|
1629
1629
|
});
|
|
1630
1630
|
}
|
|
1631
1631
|
for (let I = 0; I < c.localCenters.length; I += 3) {
|
|
1632
|
-
if (
|
|
1632
|
+
if (M.set(c.localCenters[I], c.localCenters[I + 1], c.localCenters[I + 2]).applyMatrix4(l), n.clipping && !n.clipping.isPointInClippingRange(M))
|
|
1633
1633
|
continue;
|
|
1634
|
-
const V = this.projectWorldPointToScreen(
|
|
1634
|
+
const V = this.projectWorldPointToScreen(M, d, u, g, p, w);
|
|
1635
1635
|
if (V == null)
|
|
1636
1636
|
continue;
|
|
1637
1637
|
const $ = this.getDistanceSq(V.x, V.y, m.x, m.y);
|
|
1638
1638
|
$ < B && (B = $, E = {
|
|
1639
|
-
point:
|
|
1639
|
+
point: M.clone(),
|
|
1640
1640
|
distanceSq: $,
|
|
1641
1641
|
pointxy: V.clone(),
|
|
1642
1642
|
style: "default"
|
|
1643
1643
|
});
|
|
1644
1644
|
}
|
|
1645
1645
|
if (E != null)
|
|
1646
|
-
|
|
1646
|
+
T = "point";
|
|
1647
1647
|
else {
|
|
1648
1648
|
for (let I = 0; I < c.localLines.length; I += 6) {
|
|
1649
|
-
|
|
1650
|
-
const V = this.projectWorldPointToScreen(
|
|
1649
|
+
M.set(c.localLines[I], c.localLines[I + 1], c.localLines[I + 2]).applyMatrix4(l), b.set(c.localLines[I + 3], c.localLines[I + 4], c.localLines[I + 5]).applyMatrix4(l);
|
|
1650
|
+
const V = this.projectWorldPointToScreen(M, d, u, g, p, w), $ = this.projectWorldPointToScreen(b, d, u, g, x, w);
|
|
1651
1651
|
if (V == null || $ == null)
|
|
1652
1652
|
continue;
|
|
1653
1653
|
const S = this.pointToLineProjection(m, V, $), f = this.pointToLineDistanceSq(m, V, $);
|
|
1654
1654
|
if (f < B) {
|
|
1655
|
-
const y = this.pointToLineProjection3D(S,
|
|
1655
|
+
const y = this.pointToLineProjection3D(S, M, b, d, C);
|
|
1656
1656
|
if (n.clipping && !n.clipping.isPointInClippingRange(y))
|
|
1657
1657
|
continue;
|
|
1658
1658
|
k = {
|
|
@@ -1665,9 +1665,9 @@ class Js {
|
|
|
1665
1665
|
}, B = f;
|
|
1666
1666
|
}
|
|
1667
1667
|
}
|
|
1668
|
-
k != null && (
|
|
1668
|
+
k != null && (T = "line");
|
|
1669
1669
|
}
|
|
1670
|
-
return
|
|
1670
|
+
return T === "point" && E != null ? (this.renderPointCandidate(E), e.point = E.point, e) : T === "line" && k != null ? (this.renderLineCandidate(k), e.point = k.point, e) : (this.renderFaceCandidate(e), e);
|
|
1671
1671
|
}
|
|
1672
1672
|
/**
|
|
1673
1673
|
* 将模型边数据压平缓存,避免鼠标移动时反复拼装点、线和中点数组。
|
|
@@ -1681,8 +1681,8 @@ class Js {
|
|
|
1681
1681
|
s.forEach((w) => {
|
|
1682
1682
|
if (w?.[0] == null || w?.[1] == null)
|
|
1683
1683
|
return;
|
|
1684
|
-
const
|
|
1685
|
-
r[d++] =
|
|
1684
|
+
const M = w[0], b = w[1];
|
|
1685
|
+
r[d++] = M.X, r[d++] = M.Z, r[d++] = -M.Y, l[u++] = (M.X + b.X) * 0.5, l[u++] = (M.Z + b.Z) * 0.5, l[u++] = (-M.Y - b.Y) * 0.5, c[g++] = M.X, c[g++] = M.Z, c[g++] = -M.Y, c[g++] = b.X, c[g++] = b.Z, c[g++] = -b.Y;
|
|
1686
1686
|
});
|
|
1687
1687
|
const m = {
|
|
1688
1688
|
source: s,
|
|
@@ -1807,19 +1807,19 @@ function gi(a) {
|
|
|
1807
1807
|
mouseMoveFrame: null,
|
|
1808
1808
|
latestMouseMoveEvent: null
|
|
1809
1809
|
}, t = 800, i = 28, n = 132, s = 44, o = 168, r = new Js(a);
|
|
1810
|
-
e.handle_catch = function(
|
|
1810
|
+
e.handle_catch = function(v, A, z = !0, N = !0) {
|
|
1811
1811
|
const U = e.options;
|
|
1812
1812
|
e.options = {
|
|
1813
1813
|
...U ?? {},
|
|
1814
1814
|
showCatch: z
|
|
1815
1815
|
};
|
|
1816
1816
|
try {
|
|
1817
|
-
return Ze(
|
|
1817
|
+
return Ze(v, A, !0, N);
|
|
1818
1818
|
} finally {
|
|
1819
1819
|
e.options = U;
|
|
1820
1820
|
}
|
|
1821
|
-
}, e.init = function(
|
|
1822
|
-
e.self != null && e.self.disActive != null && e.self.type !=
|
|
1821
|
+
}, e.init = function(v, A) {
|
|
1822
|
+
e.self != null && e.self.disActive != null && e.self.type != v.type && e.self.disActive(), e.self = v, A == null && (A = {
|
|
1823
1823
|
showCatch: !1
|
|
1824
1824
|
}), p(), e.clearLastPoint(), e.options = A, e.isClickSimpleModel = !0;
|
|
1825
1825
|
}, e.render = function() {
|
|
@@ -1829,22 +1829,22 @@ function gi(a) {
|
|
|
1829
1829
|
e.mouseMoveFrame != null && (cancelAnimationFrame(e.mouseMoveFrame), e.mouseMoveFrame = null), e.latestMouseMoveEvent = null;
|
|
1830
1830
|
}
|
|
1831
1831
|
e.active = function() {
|
|
1832
|
-
a.renderer.domElement.addEventListener("mousedown", y), a.renderer.domElement.addEventListener("mouseup",
|
|
1832
|
+
a.renderer.domElement.addEventListener("mousedown", y), a.renderer.domElement.addEventListener("mouseup", _), a.renderer.domElement.addEventListener("mousemove", P), a.renderer.domElement.addEventListener("touchstart", Q, { capture: !0, passive: !1 }), a.renderer.domElement.addEventListener("touchend", J, { capture: !0, passive: !1 }), a.renderer.domElement.addEventListener("touchcancel", J, { capture: !0, passive: !1 }), a.renderer.domElement.addEventListener("touchmove", fe, { capture: !0, passive: !1 }), a.renderer.domElement.addEventListener("pointerdown", Ee, !0), a.renderer.domElement.addEventListener("pointermove", $e, !0), a.renderer.domElement.addEventListener("pointerup", Be, !0), a.renderer.domElement.addEventListener("pointercancel", Be, !0), window.addEventListener("keydown", c), window.addEventListener("keyup", d);
|
|
1833
1833
|
}, e.disActive = function() {
|
|
1834
|
-
p(), l(), V(), a.renderer.domElement.removeEventListener("mousedown", y), a.renderer.domElement.removeEventListener("mouseup",
|
|
1834
|
+
p(), l(), V(), a.renderer.domElement.removeEventListener("mousedown", y), a.renderer.domElement.removeEventListener("mouseup", _), a.renderer.domElement.removeEventListener("mousemove", P), a.renderer.domElement.removeEventListener("touchstart", Q, !0), a.renderer.domElement.removeEventListener("touchend", J, !0), a.renderer.domElement.removeEventListener("touchcancel", J, !0), a.renderer.domElement.removeEventListener("touchmove", fe, !0), a.renderer.domElement.removeEventListener("pointerdown", Ee, !0), a.renderer.domElement.removeEventListener("pointermove", $e, !0), a.renderer.domElement.removeEventListener("pointerup", Be, !0), a.renderer.domElement.removeEventListener("pointercancel", Be, !0), window.removeEventListener("keydown", c), window.removeEventListener("keyup", d);
|
|
1835
1835
|
};
|
|
1836
|
-
function c(
|
|
1837
|
-
(
|
|
1836
|
+
function c(v) {
|
|
1837
|
+
(v.keyCode === 8 || v.keyCode === 46) && e.self && e.self.handelKeyDeleteDown != null && e.self.handelKeyDeleteDown(), v.keyCode === 27 && e.self && e.self.handelKeyEscDown != null && e.self.handelKeyEscDown(), v.keyCode === 13 && e.self && e.self.handelKeyEnterDown != null && e.self.handelKeyEnterDown(), v.keyCode === 32 && e.self && e.self.handelKeySpaceDown != null && e.self.handelKeySpaceDown(v), v.key === "Control" && e.self && e.self.handelKeyCtrlDown != null && e.self.handelKeyCtrlDown(), v.key === "Delete" && e.self && e.self.handelKeyDeleteDown != null && e.self.handelKeyDeleteDown(), v.key === "Shift" && e.self && e.self.handelKeyShiftDown != null && e.self.handelKeyShiftDown(), v.key === "Meta" && e.self && e.self.handelKeyMetaDown != null && e.self.handelKeyMetaDown();
|
|
1838
1838
|
}
|
|
1839
|
-
function d(
|
|
1840
|
-
|
|
1839
|
+
function d(v) {
|
|
1840
|
+
v.key === "Alt" && e.self && e.self.handelKeyAltUp != null && e.self.handelKeyAltUp(), v.key === "Tab" && e.self && e.self.handelKeyTabUp != null && e.self.handelKeyTabUp(), v.key === "Control" && e.self && e.self.handelKeyCtrlUp != null && e.self.handelKeyCtrlUp(), v.key === "Shift" && e.self && e.self.handelKeyShiftUp != null && e.self.handelKeyShiftUp(), v.key === "Meta" && e.self && e.self.handelKeyMetaUp != null && e.self.handelKeyMetaUp(), v.key === "Command" && e.self && e.self.handelKeyCommandUp != null && e.self.handelKeyCommandUp(), v.key === "Windows" && e.self && e.self.handelKeyWindowsUp != null && e.self.handelKeyWindowsUp();
|
|
1841
1841
|
}
|
|
1842
|
-
function u(
|
|
1842
|
+
function u(v) {
|
|
1843
1843
|
const A = new H(), z = a.renderer.domElement.clientWidth, N = a.renderer.domElement.clientHeight;
|
|
1844
|
-
return A.x =
|
|
1844
|
+
return A.x = v.offsetX / z * 2 - 1, A.y = -(v.offsetY / N) * 2 + 1, A;
|
|
1845
1845
|
}
|
|
1846
|
-
function g(
|
|
1847
|
-
const A = new ae(), z = u(
|
|
1846
|
+
function g(v) {
|
|
1847
|
+
const A = new ae(), z = u(v);
|
|
1848
1848
|
return A.setFromCamera(z, a.camera), A;
|
|
1849
1849
|
}
|
|
1850
1850
|
function m() {
|
|
@@ -1853,115 +1853,115 @@ function gi(a) {
|
|
|
1853
1853
|
function w() {
|
|
1854
1854
|
return m() && e.options?.showCatch === !0;
|
|
1855
1855
|
}
|
|
1856
|
-
function v
|
|
1857
|
-
const A = typeof TouchEvent < "u" &&
|
|
1856
|
+
function M(v) {
|
|
1857
|
+
const A = typeof TouchEvent < "u" && v?.originalEvent instanceof TouchEvent;
|
|
1858
1858
|
return w() && !A;
|
|
1859
1859
|
}
|
|
1860
1860
|
function b() {
|
|
1861
1861
|
e.touchLongPressTimer != null && (clearTimeout(e.touchLongPressTimer), e.touchLongPressTimer = null);
|
|
1862
1862
|
}
|
|
1863
1863
|
function p() {
|
|
1864
|
-
b(), I(),
|
|
1864
|
+
b(), I(), T(), e.touchLongPressActive = !1, e.touchLatestEvent = null, e.touchStartPosition = null, e.touchInputMode = null, e.touchPointerId = null;
|
|
1865
1865
|
}
|
|
1866
|
-
function x(
|
|
1867
|
-
|
|
1866
|
+
function x(v) {
|
|
1867
|
+
v?.preventDefault?.(), v?.stopPropagation?.(), v?.stopImmediatePropagation?.();
|
|
1868
1868
|
}
|
|
1869
1869
|
function C() {
|
|
1870
|
-
const
|
|
1871
|
-
!
|
|
1872
|
-
controls:
|
|
1873
|
-
enabled:
|
|
1874
|
-
},
|
|
1870
|
+
const v = a?.controls;
|
|
1871
|
+
!v || e.touchControlsSnapshot || (e.touchControlsSnapshot = {
|
|
1872
|
+
controls: v,
|
|
1873
|
+
enabled: v.enabled !== !1
|
|
1874
|
+
}, v.enabled = !1);
|
|
1875
1875
|
}
|
|
1876
|
-
function
|
|
1877
|
-
const
|
|
1878
|
-
|
|
1876
|
+
function T() {
|
|
1877
|
+
const v = e.touchControlsSnapshot;
|
|
1878
|
+
v && (v.controls && (E(v.controls), v.controls.enabled = v.enabled), e.touchControlsSnapshot = null);
|
|
1879
1879
|
}
|
|
1880
|
-
function E(
|
|
1881
|
-
|
|
1880
|
+
function E(v) {
|
|
1881
|
+
v?._pointers?.clear?.(), typeof v?.state == "number" && (v.state = -1), v._isInteracting = !1, v._touchDistance = 0, e.touchPointerId != null && v.domElement?.releasePointerCapture?.(e.touchPointerId);
|
|
1882
1882
|
}
|
|
1883
|
-
function k(
|
|
1884
|
-
const A =
|
|
1883
|
+
function k(v) {
|
|
1884
|
+
const A = v.touches[0] || v.changedTouches[0];
|
|
1885
1885
|
return A ? new H(A.clientX, A.clientY) : null;
|
|
1886
1886
|
}
|
|
1887
1887
|
function B() {
|
|
1888
1888
|
if (e.touchMagnifierCanvas)
|
|
1889
1889
|
return e.touchMagnifierCanvas;
|
|
1890
|
-
const
|
|
1891
|
-
return
|
|
1890
|
+
const v = document.createElement("canvas"), A = Math.max(1, window.devicePixelRatio || 1);
|
|
1891
|
+
return v.width = n * A, v.height = n * A, v.style.position = "fixed", v.style.width = `${n}px`, v.style.height = `${n}px`, v.style.borderRadius = "50%", v.style.border = "2px solid rgba(0, 255, 247, 0.95)", v.style.boxShadow = "0 8px 22px rgba(0, 0, 0, 0.32)", v.style.pointerEvents = "none", v.style.zIndex = "1002", v.style.display = "none", v.style.background = "#111", document.body.appendChild(v), e.touchMagnifierCanvas = v, e.touchMagnifierContext = v.getContext("2d"), v;
|
|
1892
1892
|
}
|
|
1893
1893
|
function I() {
|
|
1894
|
-
const
|
|
1895
|
-
|
|
1894
|
+
const v = e.touchMagnifierCanvas;
|
|
1895
|
+
v && (v.style.display = "none");
|
|
1896
1896
|
}
|
|
1897
1897
|
function V() {
|
|
1898
1898
|
e.touchMagnifierCanvas?.remove?.(), e.touchMagnifierCanvas = null, e.touchMagnifierContext = null;
|
|
1899
1899
|
}
|
|
1900
|
-
function $(
|
|
1900
|
+
function $(v, A, z, N, U, le) {
|
|
1901
1901
|
const ue = a?.catchSvg;
|
|
1902
1902
|
if (!ue?.childElementCount) return;
|
|
1903
1903
|
const pe = a?.reactBoundingClientRect ?? A.getBoundingClientRect(), Re = (te) => {
|
|
1904
|
-
const [
|
|
1905
|
-
return Number.isFinite(
|
|
1904
|
+
const [Te, Ve] = te.split(",").map(Number);
|
|
1905
|
+
return Number.isFinite(Te) && Number.isFinite(Ve) ? [(Te - pe.left - z) / U * n * le, (Ve - pe.top - N) / U * n * le] : null;
|
|
1906
1906
|
};
|
|
1907
1907
|
Array.from(ue.children).forEach((te) => {
|
|
1908
|
-
const
|
|
1909
|
-
xe.length < 2 || (
|
|
1908
|
+
const Te = te.tagName.toLowerCase(), xe = (Te === "line" ? [`${te.getAttribute("x1")},${te.getAttribute("y1")}`, `${te.getAttribute("x2")},${te.getAttribute("y2")}`].map(Re) : (te.getAttribute("points") || "").trim().split(/\s+/).map(Re)).filter(Boolean);
|
|
1909
|
+
xe.length < 2 || (v.beginPath(), v.strokeStyle = te.getAttribute("stroke") || "rgb(8, 223, 215)", v.fillStyle = te.getAttribute("fill") || "transparent", v.lineWidth = Number(te.getAttribute("stroke-width") || 2) * le, v.moveTo(xe[0][0], xe[0][1]), xe.slice(1).forEach(([dt, ut]) => v.lineTo(dt, ut)), Te === "polygon" && (v.closePath(), ["none", "transparent"].includes(String(v.fillStyle)) || v.fill()), v.stroke());
|
|
1910
1910
|
});
|
|
1911
1911
|
}
|
|
1912
|
-
function S(
|
|
1912
|
+
function S(v) {
|
|
1913
1913
|
const A = a?.renderer?.domElement, z = B(), N = e.touchMagnifierContext;
|
|
1914
1914
|
if (!A || !z || !N)
|
|
1915
1915
|
return;
|
|
1916
|
-
const U =
|
|
1916
|
+
const U = v?.catch?.point, le = U && (a?.worldToScreen ?? new oe(a.camera, a.renderer, a.scene)), ue = le?.worldToScreenIfVisible?.(U) ?? le?.worldToScreen?.(U);
|
|
1917
1917
|
if (!ue || !Number.isFinite(ue.x) || !Number.isFinite(ue.y) || ue.x < 0 || ue.y < 0 || ue.x > A.clientWidth || ue.y > A.clientHeight) {
|
|
1918
1918
|
I();
|
|
1919
1919
|
return;
|
|
1920
1920
|
}
|
|
1921
1921
|
const pe = z.width / n, Re = Math.min(
|
|
1922
1922
|
window.innerWidth - n / 2 - 8,
|
|
1923
|
-
Math.max(n / 2 + 8,
|
|
1923
|
+
Math.max(n / 2 + 8, v.clientX)
|
|
1924
1924
|
), te = Math.min(
|
|
1925
1925
|
window.innerHeight - n - 8,
|
|
1926
|
-
Math.max(8,
|
|
1926
|
+
Math.max(8, v.clientY - o)
|
|
1927
1927
|
);
|
|
1928
1928
|
z.style.left = `${Re - n / 2}px`, z.style.top = `${te}px`, z.style.display = "block";
|
|
1929
|
-
const
|
|
1929
|
+
const Te = A.width / Math.max(1, A.clientWidth), Ve = A.height / Math.max(1, A.clientHeight), xe = s, dt = Math.max(0, Math.min(A.clientWidth - xe, ue.x - xe / 2)), ut = Math.max(0, Math.min(A.clientHeight - xe, ue.y - xe / 2));
|
|
1930
1930
|
N.save(), N.clearRect(0, 0, z.width, z.height), N.beginPath(), N.arc(z.width / 2, z.height / 2, z.width / 2, 0, Math.PI * 2), N.clip(), N.fillStyle = window.getComputedStyle(A.parentElement ?? document.body).backgroundColor || "#dfe8f2", N.fillRect(0, 0, z.width, z.height);
|
|
1931
1931
|
try {
|
|
1932
|
-
N.drawImage(A, dt *
|
|
1932
|
+
N.drawImage(A, dt * Te, ut * Ve, xe * Te, xe * Ve, 0, 0, z.width, z.height), $(N, A, dt, ut, xe, pe);
|
|
1933
1933
|
} catch {
|
|
1934
1934
|
I(), N.restore();
|
|
1935
1935
|
return;
|
|
1936
1936
|
}
|
|
1937
1937
|
N.strokeStyle = "rgba(0, 255, 247, 0.9)", N.lineWidth = 1.5 * pe, N.beginPath(), N.moveTo(z.width / 2 - 10 * pe, z.height / 2), N.lineTo(z.width / 2 + 10 * pe, z.height / 2), N.moveTo(z.width / 2, z.height / 2 - 10 * pe), N.lineTo(z.width / 2, z.height / 2 + 10 * pe), N.stroke(), N.restore();
|
|
1938
1938
|
}
|
|
1939
|
-
function f(
|
|
1940
|
-
const U = g(
|
|
1941
|
-
if (
|
|
1942
|
-
const le = Ze(U,
|
|
1943
|
-
|
|
1939
|
+
function f(v, A = !1, z = !1, N = !0) {
|
|
1940
|
+
const U = g(v);
|
|
1941
|
+
if (v.raycaster = U, A) {
|
|
1942
|
+
const le = Ze(U, v, z, N);
|
|
1943
|
+
v.catch = le;
|
|
1944
1944
|
}
|
|
1945
1945
|
}
|
|
1946
|
-
function y(
|
|
1947
|
-
v
|
|
1946
|
+
function y(v) {
|
|
1947
|
+
M(v) || (e.mouseDownTime = Date.now(), e.mouseDownPosition = new h(v.offsetX, v.offsetY, 0), e.self && e.self.handleMouseDown != null && v.button == 0 && (f(v, !0, !0), v.catch != null && (a.engineStatus.highlightModels == null || a.engineStatus.highlightModels.length == 0) && a.controlModule.orbitControls.origin.set(v.catch.point.x, v.catch.point.y, v.catch.point.z), e.self.handleMouseDown(v)));
|
|
1948
1948
|
}
|
|
1949
|
-
function P(
|
|
1950
|
-
v
|
|
1949
|
+
function P(v) {
|
|
1950
|
+
M(v) || e.self && e.self.handleMouseMove != null && (e.latestMouseMoveEvent = v, e.mouseMoveFrame == null && (e.mouseMoveFrame = requestAnimationFrame(() => {
|
|
1951
1951
|
const A = e.latestMouseMoveEvent;
|
|
1952
1952
|
e.latestMouseMoveEvent = null, e.mouseMoveFrame = null, A && (a.engineStatus.isFree && f(A, !0, !0, e.isClickSimpleModel), e.self.handleMouseMove(A));
|
|
1953
1953
|
})));
|
|
1954
1954
|
}
|
|
1955
|
-
function
|
|
1956
|
-
if (v
|
|
1955
|
+
function _(v) {
|
|
1956
|
+
if (M(v))
|
|
1957
1957
|
return;
|
|
1958
|
-
const A = Date.now(), z = A - e.mouseDownTime, N = new h(
|
|
1959
|
-
e.self && e.self.handleMouseUp != null &&
|
|
1958
|
+
const A = Date.now(), z = A - e.mouseDownTime, N = new h(v.offsetX, v.offsetY, 0);
|
|
1959
|
+
e.self && e.self.handleMouseUp != null && v.button == 0 && (f(v, !1, !1, !1), e.self.handleMouseUp(v));
|
|
1960
1960
|
const U = N.distanceTo(e.mouseDownPosition);
|
|
1961
|
-
(z < 100 || U == 0) && e.self && e.self.handleMouseClick != null && (f(
|
|
1961
|
+
(z < 100 || U == 0) && e.self && e.self.handleMouseClick != null && (f(v, !0, !0, !1), A - e.lastClickTime < 200 ? e.self.handleMouseDoubleClick != null && v.button == 0 && e.self.handleMouseDoubleClick(v) : e.self.handleMouseClick != null && v.button == 0 ? e.self.handleMouseClick(v) : e.self.handleRightMouseClick != null && v.button == 2 && e.self.handleRightMouseClick(v), e.lastClickTime = Date.now());
|
|
1962
1962
|
}
|
|
1963
|
-
function D(
|
|
1964
|
-
const A =
|
|
1963
|
+
function D(v) {
|
|
1964
|
+
const A = v.touches[0] || v.changedTouches[0];
|
|
1965
1965
|
if (!A)
|
|
1966
1966
|
return null;
|
|
1967
1967
|
const N = a.renderer.domElement.getBoundingClientRect(), U = A.clientX - N.left, le = A.clientY - N.top;
|
|
@@ -1972,91 +1972,91 @@ function gi(a) {
|
|
|
1972
1972
|
// 模拟左键
|
|
1973
1973
|
clientX: A.clientX,
|
|
1974
1974
|
clientY: A.clientY,
|
|
1975
|
-
preventDefault: () =>
|
|
1976
|
-
stopPropagation: () =>
|
|
1977
|
-
originalEvent:
|
|
1975
|
+
preventDefault: () => v.preventDefault(),
|
|
1976
|
+
stopPropagation: () => v.stopPropagation(),
|
|
1977
|
+
originalEvent: v
|
|
1978
1978
|
// 保留原始触摸事件
|
|
1979
1979
|
};
|
|
1980
1980
|
}
|
|
1981
|
-
function L(
|
|
1981
|
+
function L(v) {
|
|
1982
1982
|
const z = a.renderer.domElement.getBoundingClientRect();
|
|
1983
1983
|
return {
|
|
1984
|
-
offsetX:
|
|
1985
|
-
offsetY:
|
|
1986
|
-
button:
|
|
1987
|
-
clientX:
|
|
1988
|
-
clientY:
|
|
1989
|
-
preventDefault: () =>
|
|
1990
|
-
stopPropagation: () =>
|
|
1991
|
-
originalEvent:
|
|
1984
|
+
offsetX: v.clientX - z.left,
|
|
1985
|
+
offsetY: v.clientY - z.top,
|
|
1986
|
+
button: v.button ?? 0,
|
|
1987
|
+
clientX: v.clientX,
|
|
1988
|
+
clientY: v.clientY,
|
|
1989
|
+
preventDefault: () => v.preventDefault(),
|
|
1990
|
+
stopPropagation: () => v.stopPropagation(),
|
|
1991
|
+
originalEvent: v
|
|
1992
1992
|
};
|
|
1993
1993
|
}
|
|
1994
|
-
function F(
|
|
1995
|
-
p(), e.touchInputMode = z, e.touchPointerId = N, e.touchLatestEvent =
|
|
1994
|
+
function F(v, A, z, N = null) {
|
|
1995
|
+
p(), e.touchInputMode = z, e.touchPointerId = N, e.touchLatestEvent = v, e.touchStartPosition = A, e.touchLongPressTimer = window.setTimeout(() => {
|
|
1996
1996
|
const U = e.touchLatestEvent;
|
|
1997
1997
|
U && (e.touchLongPressActive = !0, C(), e.mouseDownTime = Date.now(), e.mouseDownPosition = new h(U.offsetX, U.offsetY, 0), e.self?.handleMouseMove != null && (f(U, !0, !0, e.isClickSimpleModel), e.self.handleMouseMove(U)), S(U));
|
|
1998
1998
|
}, t);
|
|
1999
1999
|
}
|
|
2000
|
-
function q(
|
|
2001
|
-
e.touchLatestEvent =
|
|
2000
|
+
function q(v, A) {
|
|
2001
|
+
e.touchLatestEvent = v;
|
|
2002
2002
|
const z = e.touchStartPosition;
|
|
2003
|
-
!e.touchLongPressActive && z && A && z.distanceTo(A) > i && b(), e.touchLongPressActive && (e.self?.handleMouseMove != null && (f(
|
|
2003
|
+
!e.touchLongPressActive && z && A && z.distanceTo(A) > i && b(), e.touchLongPressActive && (e.self?.handleMouseMove != null && (f(v, !0, !0, e.isClickSimpleModel), e.self.handleMouseMove(v)), S(v));
|
|
2004
2004
|
}
|
|
2005
|
-
function ne(
|
|
2006
|
-
b(), e.touchLongPressActive && (f(
|
|
2005
|
+
function ne(v) {
|
|
2006
|
+
b(), e.touchLongPressActive && (f(v, !0, !0, e.isClickSimpleModel), e.self?.handleMouseClick != null && e.self.handleMouseClick(v), e.self?.handleMouseUp != null && e.self.handleMouseUp(v)), p();
|
|
2007
2007
|
}
|
|
2008
|
-
function Q(
|
|
2009
|
-
if (
|
|
2008
|
+
function Q(v) {
|
|
2009
|
+
if (v.preventDefault(), v.touches.length !== 1) {
|
|
2010
2010
|
p();
|
|
2011
2011
|
return;
|
|
2012
2012
|
}
|
|
2013
|
-
const A = D(
|
|
2013
|
+
const A = D(v);
|
|
2014
2014
|
if (A) {
|
|
2015
2015
|
if (w()) {
|
|
2016
|
-
F(A, k(
|
|
2016
|
+
F(A, k(v) ?? new H(A.clientX, A.clientY), "touch");
|
|
2017
2017
|
return;
|
|
2018
2018
|
}
|
|
2019
2019
|
y(A);
|
|
2020
2020
|
}
|
|
2021
2021
|
}
|
|
2022
|
-
function fe(
|
|
2023
|
-
if (
|
|
2022
|
+
function fe(v) {
|
|
2023
|
+
if (v.preventDefault(), v.touches.length !== 1) {
|
|
2024
2024
|
p();
|
|
2025
2025
|
return;
|
|
2026
2026
|
}
|
|
2027
|
-
const A = D(
|
|
2027
|
+
const A = D(v);
|
|
2028
2028
|
if (A) {
|
|
2029
2029
|
if (w()) {
|
|
2030
|
-
e.touchLongPressActive && x(
|
|
2030
|
+
e.touchLongPressActive && x(v), q(A, k(v));
|
|
2031
2031
|
return;
|
|
2032
2032
|
}
|
|
2033
2033
|
P(A);
|
|
2034
2034
|
}
|
|
2035
2035
|
}
|
|
2036
|
-
function J(
|
|
2037
|
-
|
|
2038
|
-
const A = D(
|
|
2036
|
+
function J(v) {
|
|
2037
|
+
v.preventDefault();
|
|
2038
|
+
const A = D(v);
|
|
2039
2039
|
if (A) {
|
|
2040
2040
|
if (w()) {
|
|
2041
|
-
e.touchLongPressActive && x(
|
|
2041
|
+
e.touchLongPressActive && x(v), ne(A);
|
|
2042
2042
|
return;
|
|
2043
2043
|
}
|
|
2044
|
-
|
|
2044
|
+
_(A);
|
|
2045
2045
|
}
|
|
2046
2046
|
}
|
|
2047
|
-
function Ee(
|
|
2048
|
-
if (
|
|
2047
|
+
function Ee(v) {
|
|
2048
|
+
if (v.pointerType !== "touch" || !w() || v.isPrimary === !1)
|
|
2049
2049
|
return;
|
|
2050
|
-
const A = L(
|
|
2051
|
-
F(A, new H(
|
|
2050
|
+
const A = L(v);
|
|
2051
|
+
F(A, new H(v.clientX, v.clientY), "pointer", v.pointerId);
|
|
2052
2052
|
}
|
|
2053
|
-
function $e(
|
|
2054
|
-
|
|
2053
|
+
function $e(v) {
|
|
2054
|
+
v.pointerType !== "touch" || !w() || (e.touchLongPressActive && x(v), e.touchInputMode === "pointer" && (e.touchPointerId != null && v.pointerId !== e.touchPointerId || q(L(v), new H(v.clientX, v.clientY))));
|
|
2055
2055
|
}
|
|
2056
|
-
function Be(
|
|
2057
|
-
|
|
2056
|
+
function Be(v) {
|
|
2057
|
+
v.pointerType !== "touch" || !w() || (e.touchLongPressActive && x(v), e.touchInputMode === "pointer" && (e.touchPointerId != null && v.pointerId !== e.touchPointerId || ne(L(v))));
|
|
2058
2058
|
}
|
|
2059
|
-
function Ze(
|
|
2059
|
+
function Ze(v, A, z = !1, N = !0) {
|
|
2060
2060
|
if (!a.engineStatus.isFree && z == !1) {
|
|
2061
2061
|
a.hoverHighLight.clearHighlight();
|
|
2062
2062
|
return;
|
|
@@ -2064,12 +2064,12 @@ function gi(a) {
|
|
|
2064
2064
|
if (a.engineStatus.editorMode == "simple")
|
|
2065
2065
|
return;
|
|
2066
2066
|
a.catchSvg.innerHTML = "";
|
|
2067
|
-
let U = a.octreeBox.rayInterationModel(
|
|
2067
|
+
let U = a.octreeBox.rayInterationModel(v, z, N);
|
|
2068
2068
|
if (U = a.clipping?.filterIntersectionsByClipping(U) ?? U, U.length !== 0)
|
|
2069
2069
|
return e.options.showCatch ? r.applySnapPreview(U[0], A, e.lastPoint) : U[0];
|
|
2070
2070
|
}
|
|
2071
|
-
return e.setLastPoint = function(
|
|
2072
|
-
e.lastPoint =
|
|
2071
|
+
return e.setLastPoint = function(v) {
|
|
2072
|
+
e.lastPoint = v;
|
|
2073
2073
|
}, e.clearLastPoint = function() {
|
|
2074
2074
|
e.lastPoint = null;
|
|
2075
2075
|
}, e;
|
|
@@ -2310,8 +2310,8 @@ class Qs {
|
|
|
2310
2310
|
}
|
|
2311
2311
|
bindMovePad(e) {
|
|
2312
2312
|
const t = e.querySelector(".bim-mobile-roam-move-knob"), i = (s) => {
|
|
2313
|
-
const o = e.getBoundingClientRect(), r = Math.min(o.width, o.height) * 0.5, l = r * 0.48, c = r * 0.22, d = s.clientX - o.left - r, u = s.clientY - o.top - r, g = Math.hypot(d, u), m = Math.min(g, l), w = g > l ? l / g : 1,
|
|
2314
|
-
t && (t.style.transform = `translate(${
|
|
2313
|
+
const o = e.getBoundingClientRect(), r = Math.min(o.width, o.height) * 0.5, l = r * 0.48, c = r * 0.22, d = s.clientX - o.left - r, u = s.clientY - o.top - r, g = Math.hypot(d, u), m = Math.min(g, l), w = g > l ? l / g : 1, M = d * w, b = u * w;
|
|
2314
|
+
t && (t.style.transform = `translate(${M}px, ${b}px)`);
|
|
2315
2315
|
const p = [];
|
|
2316
2316
|
u < -c ? p.push("w") : u > c && p.push("s"), d < -c ? p.push("a") : d > c && p.push("d"), this.mobileMoveIntensity = p.length === 0 ? 0 : Math.max(0, Math.min(1, (m - c) / (l - c))), this.updateMobileMoveKeys(p);
|
|
2317
2317
|
};
|
|
@@ -2478,23 +2478,23 @@ class to {
|
|
|
2478
2478
|
samples: 32,
|
|
2479
2479
|
rings: 3,
|
|
2480
2480
|
radiusExponent: 2
|
|
2481
|
-
}), this.applyClippingToAmbientOcclusionPass(this.gtaoPass), this.composer.addPass(this.gtaoPass), this.ssaoPass = new
|
|
2481
|
+
}), this.applyClippingToAmbientOcclusionPass(this.gtaoPass), this.composer.addPass(this.gtaoPass), this.ssaoPass = new Mi(i, n, e, t), this.ssaoPass.kernelRadius = 8, this.ssaoPass.minDistance = 5e-3, this.ssaoPass.maxDistance = 0.1, this.ssaoPass.output = Mi.OUTPUT.Default, this.ssaoPass.enabled = !1, this.applyClippingToAmbientOcclusionPass(this.ssaoPass), this.composer.addPass(this.ssaoPass), this.saturationPass = new zt(eo), this.saturationPass.uniforms.saturation.value = bn, this.saturationPass.uniforms.contrast.value = Cn, this.saturationPass.enabled = !1, this.composer.addPass(this.saturationPass), this.outputPass = new Qn(), this.outputPass.enabled = !0, this.composer.addPass(this.outputPass), this.fxaaPass = new zt(es), this.fxaaPass.material.uniforms.resolution.value.x = 1 / (e * o), this.fxaaPass.material.uniforms.resolution.value.y = 1 / (t * o), this.fxaaPass.enabled = !1, this.composer.addPass(this.fxaaPass);
|
|
2482
2482
|
}
|
|
2483
2483
|
}
|
|
2484
2484
|
function io(a, e, t, i) {
|
|
2485
|
-
const r = a.models.find((
|
|
2485
|
+
const r = a.models.find((M) => M.url == t);
|
|
2486
2486
|
if (r == null)
|
|
2487
2487
|
return;
|
|
2488
|
-
const l = Ye(a, t), c = e.circularMeps, d = e.rectMeps?.filter((
|
|
2489
|
-
x:
|
|
2490
|
-
y:
|
|
2491
|
-
z: -
|
|
2492
|
-
},
|
|
2488
|
+
const l = Ye(a, t), c = e.circularMeps, d = e.rectMeps?.filter((M) => M.type === "风管"), u = e.rectMeps?.filter((M) => M.type === "桥架"), g = e.ellipseMeps, m = (M) => (M.color = M.color.split(",").map((b) => parseInt(b) / 255), M.color = new Fe().setRGB(M.color[0], M.color[1], M.color[2], Ke), M.position = {
|
|
2489
|
+
x: M.startPoint.X * 0.3048 + 0,
|
|
2490
|
+
y: M.startPoint.Z * 0.3048 + 0,
|
|
2491
|
+
z: -M.startPoint.Y * 0.3048 + 0
|
|
2492
|
+
}, M.rotation = { x: 0, y: 0, z: 0 }, M), w = (M, b) => {
|
|
2493
2493
|
if (!Array.isArray(b) || b.length === 0)
|
|
2494
2494
|
return;
|
|
2495
|
-
const p = b.map((C) => m(C)), x = no(
|
|
2496
|
-
x != null && p.forEach((C,
|
|
2497
|
-
C.indexes = [[x,
|
|
2495
|
+
const p = b.map((C) => m(C)), x = no(M, l, p, t, a);
|
|
2496
|
+
x != null && p.forEach((C, T) => {
|
|
2497
|
+
C.indexes = [[x, T, 0, 0]], r.nodesMap.set(Number(C.id), C);
|
|
2498
2498
|
});
|
|
2499
2499
|
};
|
|
2500
2500
|
w("Circle", c), w("Rect", d), w("Ellipse", g), w("Bridge", u);
|
|
@@ -2532,25 +2532,25 @@ function no(a, e, t, i, n) {
|
|
|
2532
2532
|
mi(r, l);
|
|
2533
2533
|
const c = [], d = [];
|
|
2534
2534
|
for (let g = 0; g < t.length; g++) {
|
|
2535
|
-
const m = t[g], w = new h(m.startPoint.X, 0, -m.startPoint.Y),
|
|
2536
|
-
let x = 0, C = 0,
|
|
2537
|
-
if (Math.abs(
|
|
2535
|
+
const m = t[g], w = new h(m.startPoint.X, 0, -m.startPoint.Y), M = new h(m.endPoint.X, 0, -m.endPoint.Y), b = new h(m.startPoint.X, m.startPoint.Z, -m.startPoint.Y), p = new h(m.endPoint.X, m.endPoint.Z, -m.endPoint.Y);
|
|
2536
|
+
let x = 0, C = 0, T = 0;
|
|
2537
|
+
if (Math.abs(M.clone().sub(w.clone()).z) < 0.01 && Math.abs(M.clone().sub(w.clone()).x) < 0.01) {
|
|
2538
2538
|
if (x = (m.startPoint.Z > m.endPoint.Z ? 1 : -1) * Math.PI * 0.5, m.base_x != null) {
|
|
2539
2539
|
const F = new h(m.base_x.X, 0, -m.base_x.Y);
|
|
2540
2540
|
C = (F.clone().cross(new h(0, 0, 1)).y <= 0 ? 1 : -1) * F.angleTo(new h(0, 0, 1)) + Math.PI * 0.5;
|
|
2541
2541
|
}
|
|
2542
2542
|
} else
|
|
2543
|
-
C = (
|
|
2544
|
-
const E = new G(), k = new sn(x, C,
|
|
2543
|
+
C = (M.clone().sub(w.clone()).cross(new h(0, 0, 1)).y > 0 ? -1 : 1) * M.clone().sub(w.clone()).angleTo(new h(0, 0, 1)), x = (m.startPoint.Z > m.endPoint.Z ? 1 : -1) * M.clone().sub(w.clone()).angleTo(p.clone().sub(b.clone()));
|
|
2544
|
+
const E = new G(), k = new sn(x, C, T, "YXZ"), B = E.clone().makeRotationFromEuler(k);
|
|
2545
2545
|
let I, V;
|
|
2546
2546
|
a === "Circle" ? (I = m.diameter, V = m.diameter) : (I = m.width, V = m.height);
|
|
2547
2547
|
const $ = E.clone().makeScale(I, V, m.length);
|
|
2548
2548
|
E.multiplyMatrices(B, $), E.setPosition(m.position.x, m.position.y, m.position.z), r.setMatrixAt(g, E.clone()), r.setColorAt(g, m.color), r.geometry.computeBoundingBox();
|
|
2549
|
-
const S = r.geometry.boundingBox.min.clone().applyMatrix4(E.clone()), f = r.geometry.boundingBox.max.clone().applyMatrix4(E.clone()), y = new h(Math.min(S.x, f.x), Math.min(S.y, f.y), Math.min(S.z, f.z)), P = new h(Math.max(S.x, f.x), Math.max(S.y, f.y), Math.max(S.z, f.z)),
|
|
2549
|
+
const S = r.geometry.boundingBox.min.clone().applyMatrix4(E.clone()), f = r.geometry.boundingBox.max.clone().applyMatrix4(E.clone()), y = new h(Math.min(S.x, f.x), Math.min(S.y, f.y), Math.min(S.z, f.z)), P = new h(Math.max(S.x, f.x), Math.max(S.y, f.y), Math.max(S.z, f.z)), _ = y.clone().add(P.clone()).multiplyScalar(0.5), D = {
|
|
2550
2550
|
name: m.name,
|
|
2551
2551
|
min: y,
|
|
2552
2552
|
max: P,
|
|
2553
|
-
center:
|
|
2553
|
+
center: _,
|
|
2554
2554
|
dbid: g,
|
|
2555
2555
|
materialName: s.material.name
|
|
2556
2556
|
};
|
|
@@ -2647,24 +2647,24 @@ function po(a, e = {}) {
|
|
|
2647
2647
|
}
|
|
2648
2648
|
}
|
|
2649
2649
|
let Qe = null, et = null, Bi = null;
|
|
2650
|
-
const mo = 8, Pn = 24, go = 24, fo = 64, yo = 240,
|
|
2650
|
+
const mo = 8, Pn = 24, go = 24, fo = 64, yo = 240, Mo = 2, vo = 10;
|
|
2651
2651
|
function An() {
|
|
2652
2652
|
return W("draco/", import.meta.url);
|
|
2653
2653
|
}
|
|
2654
|
-
function
|
|
2654
|
+
function Tn() {
|
|
2655
2655
|
return W("basis/", import.meta.url);
|
|
2656
2656
|
}
|
|
2657
2657
|
function wo() {
|
|
2658
2658
|
return Qe == null && (Qe = new os(), Qe.setDecoderPath(An()), Qe.preload()), Qe;
|
|
2659
2659
|
}
|
|
2660
2660
|
function xo(a) {
|
|
2661
|
-
return et == null && (et = new rs(), et.setTranscoderPath(
|
|
2661
|
+
return et == null && (et = new rs(), et.setTranscoderPath(Tn())), Bi !== a && (et.detectSupport(a), Bi = a), et;
|
|
2662
2662
|
}
|
|
2663
2663
|
function bo(a) {
|
|
2664
2664
|
const e = new ri();
|
|
2665
2665
|
return e.setDRACOLoader(wo()), e.setMeshoptDecoder(ss), a?.renderer?.capabilities != null && typeof a.renderer.getContext == "function" && e.setKTX2Loader(xo(a.renderer)), e;
|
|
2666
2666
|
}
|
|
2667
|
-
function
|
|
2667
|
+
function _n() {
|
|
2668
2668
|
return new Promise((a) => {
|
|
2669
2669
|
if (typeof requestAnimationFrame == "function") {
|
|
2670
2670
|
requestAnimationFrame(() => a());
|
|
@@ -2684,11 +2684,11 @@ async function ze(a, e, t) {
|
|
|
2684
2684
|
if (e)
|
|
2685
2685
|
return t;
|
|
2686
2686
|
const i = performance.now();
|
|
2687
|
-
return So(a) || i - t >= mo ? (await
|
|
2687
|
+
return So(a) || i - t >= mo ? (await _n(), performance.now()) : t;
|
|
2688
2688
|
}
|
|
2689
2689
|
function Eo(a, e) {
|
|
2690
2690
|
return new Promise((t, i) => {
|
|
2691
|
-
|
|
2691
|
+
Tt(a, (n) => {
|
|
2692
2692
|
if (n == null) {
|
|
2693
2693
|
i(new Error(`[loadLightModel] empty zip json: ${a}`));
|
|
2694
2694
|
return;
|
|
@@ -2728,11 +2728,11 @@ function Ao(a) {
|
|
|
2728
2728
|
function Zt(a) {
|
|
2729
2729
|
return JSON.parse(Ao(a));
|
|
2730
2730
|
}
|
|
2731
|
-
function
|
|
2731
|
+
function To(a, e) {
|
|
2732
2732
|
const t = Dn(a, e);
|
|
2733
2733
|
return t == null || t.dir ? Promise.resolve(null) : t.async("arraybuffer");
|
|
2734
2734
|
}
|
|
2735
|
-
function
|
|
2735
|
+
function _o(a, e) {
|
|
2736
2736
|
return new Promise((t, i) => {
|
|
2737
2737
|
bo(a).parse(e, Ls(import.meta.url), t, i);
|
|
2738
2738
|
});
|
|
@@ -2807,12 +2807,12 @@ async function ko(a, e, t, i) {
|
|
|
2807
2807
|
continue;
|
|
2808
2808
|
const w = new G();
|
|
2809
2809
|
w.elements = g.matrix;
|
|
2810
|
-
const
|
|
2811
|
-
|
|
2810
|
+
const M = m.geometry.clone();
|
|
2811
|
+
M.applyMatrix4(w), M.computeBoundingBox(), M.attributes.position.count > 2e4 && po(M, {
|
|
2812
2812
|
setBoundingSphere: !0
|
|
2813
2813
|
});
|
|
2814
|
-
const b = new O(
|
|
2815
|
-
g.box =
|
|
2814
|
+
const b = new O(M, m.material);
|
|
2815
|
+
g.box = M.boundingBox?.clone(), g.mesh = b, b.name = Number(c), b.glb = g.glb, b.url = e.url, M.attributes.position != null && o.push(b), l++, l % Pn === 0 && (r = await ze(a, i, r));
|
|
2816
2816
|
}
|
|
2817
2817
|
}
|
|
2818
2818
|
return o;
|
|
@@ -2862,20 +2862,20 @@ async function No(a, e, t, i) {
|
|
|
2862
2862
|
if (u.length === 0)
|
|
2863
2863
|
continue;
|
|
2864
2864
|
const g = $o(u[0].material, e);
|
|
2865
|
-
let m = Fo(e, a, r, g), w = 0,
|
|
2866
|
-
m = null, m != null ? (w = Array.isArray(m.geometrys) ? m.geometrys.length : 0,
|
|
2865
|
+
let m = Fo(e, a, r, g), w = 0, M = 0;
|
|
2866
|
+
m = null, m != null ? (w = Array.isArray(m.geometrys) ? m.geometrys.length : 0, M = Oi(m.geometry), Oo(m, u)) : m = Ro(a, e, r, u, g);
|
|
2867
2867
|
const b = /* @__PURE__ */ new Map();
|
|
2868
|
-
let p =
|
|
2868
|
+
let p = M;
|
|
2869
2869
|
u.forEach((x, C) => {
|
|
2870
|
-
const
|
|
2871
|
-
if (k.push([p, p + E]), b.set(
|
|
2872
|
-
const B = s.nodesMap.get(
|
|
2870
|
+
const T = Number(x.name), E = Oi(x.geometry), k = b.get(T) ?? [];
|
|
2871
|
+
if (k.push([p, p + E]), b.set(T, k), s?.nodesMap?.has(T)) {
|
|
2872
|
+
const B = s.nodesMap.get(T);
|
|
2873
2873
|
B.indexes == null && (B.indexes = []), B.indexes.push([m.index, w + C, p, p + E]);
|
|
2874
2874
|
}
|
|
2875
2875
|
p += E;
|
|
2876
2876
|
}), m.indexes == null && (m.indexes = /* @__PURE__ */ new Map()), b.forEach((x, C) => {
|
|
2877
|
-
const
|
|
2878
|
-
|
|
2877
|
+
const T = m.indexes.get(C) ?? [];
|
|
2878
|
+
T.push(...x), m.indexes.set(C, T);
|
|
2879
2879
|
}), e.requestComposerRender?.(), o = await ze(e, i, o);
|
|
2880
2880
|
}
|
|
2881
2881
|
}
|
|
@@ -2901,10 +2901,10 @@ async function Vo(a, e, t, i, n, s) {
|
|
|
2901
2901
|
let u = performance.now();
|
|
2902
2902
|
const g = [];
|
|
2903
2903
|
for (let m = 0; m < n.length; m++) {
|
|
2904
|
-
const w = n[m],
|
|
2905
|
-
|
|
2906
|
-
const b = Ho(i,
|
|
2907
|
-
if (b != null && (w.box = b.clone()), r.setMatrixAt(m,
|
|
2904
|
+
const w = n[m], M = new G();
|
|
2905
|
+
M.elements = w.matrix;
|
|
2906
|
+
const b = Ho(i, M);
|
|
2907
|
+
if (b != null && (w.box = b.clone()), r.setMatrixAt(m, M), r.matrixs || (r.matrixs = []), r.matrixs.push(M.clone()), g.push(M.clone()), o.nodesMap.has(w.id)) {
|
|
2908
2908
|
const p = o.nodesMap.get(w.id);
|
|
2909
2909
|
p.indexes == null && (p.indexes = []), p.indexes.push([c, m, 0, 0]), b != null && p?.info != null && (p.info.box instanceof Y ? p.info.box.union(b) : p.info.box = b.clone());
|
|
2910
2910
|
} else
|
|
@@ -2962,11 +2962,11 @@ async function Wo(a, e, t, i) {
|
|
|
2962
2962
|
l.nodesMap == null && (l.nodesMap = /* @__PURE__ */ new Map());
|
|
2963
2963
|
let c = performance.now();
|
|
2964
2964
|
const d = Object.keys(r);
|
|
2965
|
-
for (const
|
|
2966
|
-
const b = r[
|
|
2965
|
+
for (const M of d) {
|
|
2966
|
+
const b = r[M];
|
|
2967
2967
|
for (let p = 0; p < b.length; p++) {
|
|
2968
2968
|
const x = b[p];
|
|
2969
|
-
if (x.glb =
|
|
2969
|
+
if (x.glb = M, l.nodesMap.has(x.id) === !1)
|
|
2970
2970
|
l.nodesMap.set(x.id, { infos: [x] });
|
|
2971
2971
|
else {
|
|
2972
2972
|
if (!l.nodesMap.get(x.id).infos)
|
|
@@ -2976,29 +2976,29 @@ async function Wo(a, e, t, i) {
|
|
|
2976
2976
|
(p + 1) % Pn === 0 && (c = await ze(a, i, c));
|
|
2977
2977
|
}
|
|
2978
2978
|
}
|
|
2979
|
-
const u = async (
|
|
2980
|
-
let b = await
|
|
2979
|
+
const u = async (M) => {
|
|
2980
|
+
let b = await To(s, [`/${M}.glb`, `${M}.glb`, M + ".glb"]);
|
|
2981
2981
|
if (b == null) {
|
|
2982
2982
|
console.error("[loadLightModel] glb not found in zip", {
|
|
2983
2983
|
modelUrl: e.url,
|
|
2984
2984
|
lodPath: t.path,
|
|
2985
|
-
glbKey: `${
|
|
2985
|
+
glbKey: `${M}.glb`,
|
|
2986
2986
|
availableFiles: Object.keys(s.files)
|
|
2987
2987
|
});
|
|
2988
2988
|
return;
|
|
2989
2989
|
}
|
|
2990
2990
|
try {
|
|
2991
|
-
const p = await
|
|
2992
|
-
b = null, t.glbs[
|
|
2991
|
+
const p = await _o(a, b);
|
|
2992
|
+
b = null, t.glbs[M] = p.scene.children, t.glbs[M].forEach((x) => {
|
|
2993
2993
|
x.matrixWorld;
|
|
2994
|
-
}), await Io(a, t.glbs[
|
|
2994
|
+
}), await Io(a, t.glbs[M], i);
|
|
2995
2995
|
} catch (p) {
|
|
2996
2996
|
console.error("[loadLightModel] failed to load glb", {
|
|
2997
2997
|
modelUrl: e.url,
|
|
2998
2998
|
lodPath: t.path,
|
|
2999
|
-
glbKey: `${
|
|
2999
|
+
glbKey: `${M}.glb`,
|
|
3000
3000
|
dracoDecoderPath: An(),
|
|
3001
|
-
basisTranscoderPath:
|
|
3001
|
+
basisTranscoderPath: Tn(),
|
|
3002
3002
|
error: p
|
|
3003
3003
|
});
|
|
3004
3004
|
} finally {
|
|
@@ -3006,11 +3006,11 @@ async function Wo(a, e, t, i) {
|
|
|
3006
3006
|
}
|
|
3007
3007
|
};
|
|
3008
3008
|
let g = 0;
|
|
3009
|
-
const m = Math.min(
|
|
3009
|
+
const m = Math.min(Mo, d.length);
|
|
3010
3010
|
await Promise.all(Array.from({ length: m }, async () => {
|
|
3011
3011
|
for (; g < d.length; ) {
|
|
3012
|
-
const
|
|
3013
|
-
await u(
|
|
3012
|
+
const M = d[g++];
|
|
3013
|
+
await u(M);
|
|
3014
3014
|
}
|
|
3015
3015
|
})), console.log(`[loadLightModel] 所有 GLB 加载完成 ${Date.now() - window.startTime}ms`);
|
|
3016
3016
|
const w = await Fi(s, ["/instances.json", "instances.json"]);
|
|
@@ -3024,20 +3024,20 @@ function qo(a, e, t) {
|
|
|
3024
3024
|
if (t.boundingBox || (t.boundingBox = new Y(), t.boundingBox.min = new h(t.octreeBox.min.X, t.octreeBox.min.Z, -t.octreeBox.min.Y), t.boundingBox.max = new h(t.octreeBox.max.X, t.octreeBox.max.Z, -t.octreeBox.max.Y)), !t.maxSize)
|
|
3025
3025
|
return 1e3;
|
|
3026
3026
|
const i = t.boundingBox, n = i.min, s = i.max, o = n.clone().add(s.clone()).multiplyScalar(0.5), r = n.distanceTo(s), l = new h(), c = new h(), d = new h(), u = new h();
|
|
3027
|
-
if (e.getWorldDirection(d), e.getWorldPosition(u), e.matrixWorld.extractBasis(l, c, new h()), e instanceof
|
|
3028
|
-
const p = Math.max((e.top - e.bottom) / e.zoom, 1e-6), x = a?.cameraModule?.perspectiveCamera?.getEffectiveFOV?.() ?? 20, C = R.degToRad(x * 0.5),
|
|
3029
|
-
u.copy(o).add(d.clone().multiplyScalar(-
|
|
3027
|
+
if (e.getWorldDirection(d), e.getWorldPosition(u), e.matrixWorld.extractBasis(l, c, new h()), e instanceof ve) {
|
|
3028
|
+
const p = Math.max((e.top - e.bottom) / e.zoom, 1e-6), x = a?.cameraModule?.perspectiveCamera?.getEffectiveFOV?.() ?? 20, C = R.degToRad(x * 0.5), T = C > 0 ? p / (2 * Math.tan(C)) : p;
|
|
3029
|
+
u.copy(o).add(d.clone().multiplyScalar(-T));
|
|
3030
3030
|
}
|
|
3031
3031
|
if (u.distanceTo(o) <= r * 0.5)
|
|
3032
3032
|
return 1e3;
|
|
3033
3033
|
const g = o.clone().sub(u).dot(d);
|
|
3034
3034
|
if (g <= 0)
|
|
3035
3035
|
return 0;
|
|
3036
|
-
const m = u.clone().add(d.multiplyScalar(Math.max(g, r))), w = m.clone().add(l.setLength(t.maxSize)),
|
|
3037
|
-
return
|
|
3036
|
+
const m = u.clone().add(d.multiplyScalar(Math.max(g, r))), w = m.clone().add(l.setLength(t.maxSize)), M = new oe(e, a.renderer, a.scene).worldToScreen(m), b = new oe(e, a.renderer, a.scene).worldToScreen(w);
|
|
3037
|
+
return M.distanceTo(b);
|
|
3038
3038
|
}
|
|
3039
3039
|
async function jo(a, e, t, i) {
|
|
3040
|
-
t.maxSize < 1e6 && t.path != "/lod0" && (!(qo(a, a.camera, t) >=
|
|
3040
|
+
t.maxSize < 1e6 && t.path != "/lod0" && (!(qo(a, a.camera, t) >= vo) || t.status === !0) || (await Wo(a, e, t, i), t.loadSuccess === !0 && await Go(a, e, t, i));
|
|
3041
3041
|
}
|
|
3042
3042
|
function Ko(a, e, t) {
|
|
3043
3043
|
if (zn(e.loadStatus.modelMep))
|
|
@@ -3046,7 +3046,7 @@ function Ko(a, e, t) {
|
|
|
3046
3046
|
if (i == null)
|
|
3047
3047
|
return;
|
|
3048
3048
|
e.loadStatus.modelMep = "loading", i.modelMep == null && (i.modelMep = {}), (async () => {
|
|
3049
|
-
t || await
|
|
3049
|
+
t || await _n(), io(a, i.modelMep, e.url), e.loadStatus.modelMep = !0, kn(a);
|
|
3050
3050
|
})().catch((s) => {
|
|
3051
3051
|
e.loadStatus.modelMep = !1, console.error("[loadLightModel] failed to load mep model", s);
|
|
3052
3052
|
});
|
|
@@ -3440,7 +3440,7 @@ class or {
|
|
|
3440
3440
|
});
|
|
3441
3441
|
}
|
|
3442
3442
|
}
|
|
3443
|
-
const it = 1, Vt = 1, rr = 1800, Vi = 1024, ar = 1.35, lr = 20, cr = 1200, Ut = 0.5, hr = 10, dr = 0.08, Gt = 500, Ui = 5e4, Gi = 120, ur = 5e4, Wi = 0.12, pr = 8, mr = 0.75, qi = 5e-5, gr = 15e-4, fr = 2.5, yr = 2.4,
|
|
3443
|
+
const it = 1, Vt = 1, rr = 1800, Vi = 1024, ar = 1.35, lr = 20, cr = 1200, Ut = 0.5, hr = 10, dr = 0.08, Gt = 500, Ui = 5e4, Gi = 120, ur = 5e4, Wi = 0.12, pr = 8, mr = 0.75, qi = 5e-5, gr = 15e-4, fr = 2.5, yr = 2.4, Mr = 4.5, vr = 0.94, wr = 0.995, xr = 80, br = 0.06, Cr = 8, Sr = new h(-1, 4, 2).normalize();
|
|
3444
3444
|
class Er {
|
|
3445
3445
|
// 引擎实例,要求至少提供 scene、controls、octreeBox 等运行时对象。
|
|
3446
3446
|
engine;
|
|
@@ -3493,7 +3493,7 @@ class Er {
|
|
|
3493
3493
|
*/
|
|
3494
3494
|
updateDirectionalShadow(e) {
|
|
3495
3495
|
const t = this.getShadowDirectionalLight();
|
|
3496
|
-
if (!t || !(t.shadow.camera instanceof
|
|
3496
|
+
if (!t || !(t.shadow.camera instanceof ve))
|
|
3497
3497
|
return;
|
|
3498
3498
|
const i = t.shadow.camera, n = this.getSceneBoundingBox();
|
|
3499
3499
|
this.updateShadowCasterPolicy(n);
|
|
@@ -3519,7 +3519,7 @@ class Er {
|
|
|
3519
3519
|
m,
|
|
3520
3520
|
u,
|
|
3521
3521
|
t.shadow.mapSize.width
|
|
3522
|
-
),
|
|
3522
|
+
), M = this.getShadowDisplayIntensity(
|
|
3523
3523
|
e,
|
|
3524
3524
|
m,
|
|
3525
3525
|
u,
|
|
@@ -3532,8 +3532,8 @@ class Er {
|
|
|
3532
3532
|
w,
|
|
3533
3533
|
o,
|
|
3534
3534
|
u
|
|
3535
|
-
), x = Math.abs(u - this.lastShadowHalfSize) > 0.5, C = Math.abs(p.near - this.lastShadowNear) > 1,
|
|
3536
|
-
!x && !C && !
|
|
3535
|
+
), x = Math.abs(u - this.lastShadowHalfSize) > 0.5, C = Math.abs(p.near - this.lastShadowNear) > 1, T = Math.abs(p.far - this.lastShadowFar) > 1, E = b.distanceToSquared(this.lastLightPosition) > 0.25, k = w.distanceToSquared(this.lastLightTarget) > 0.25, B = Math.abs(M - this.lastShadowIntensity) > 0.01;
|
|
3536
|
+
!x && !C && !T && !E && !k && !B || (t.position.copy(b), t.target.position.copy(w), t.target.updateMatrixWorld(!0), t.updateMatrixWorld(!0), i.left = -u, i.right = u, i.top = u, i.bottom = -u, i.near = p.near, i.far = p.far, i.updateProjectionMatrix(), this.updateShadowBias(t, u, p), t.shadow.intensity = M, t.shadow.needsUpdate = !0, this.lastShadowHalfSize = u, this.lastShadowNear = p.near, this.lastShadowFar = p.far, this.lastLightPosition.copy(b), this.lastLightTarget.copy(w), this.lastShadowIntensity = M);
|
|
3537
3537
|
}
|
|
3538
3538
|
/**
|
|
3539
3539
|
* 计算场景范围对阴影相机半边长的贡献。
|
|
@@ -3700,7 +3700,7 @@ class Er {
|
|
|
3700
3700
|
getCameraHalfExtent(e, t) {
|
|
3701
3701
|
if (!e)
|
|
3702
3702
|
return 0;
|
|
3703
|
-
if (e instanceof
|
|
3703
|
+
if (e instanceof ve) {
|
|
3704
3704
|
const i = Math.max(e.zoom, 1e-6), n = Math.max((e.top - e.bottom) / (2 * i), 1), s = Math.max((e.right - e.left) / (2 * i), 1);
|
|
3705
3705
|
return Math.max(s, n);
|
|
3706
3706
|
}
|
|
@@ -3747,7 +3747,7 @@ class Er {
|
|
|
3747
3747
|
const s = i * 2 / Math.max(n, 1), o = 1 - R.smoothstep(
|
|
3748
3748
|
s,
|
|
3749
3749
|
yr,
|
|
3750
|
-
|
|
3750
|
+
Mr
|
|
3751
3751
|
);
|
|
3752
3752
|
let r = 1;
|
|
3753
3753
|
if (e) {
|
|
@@ -3756,7 +3756,7 @@ class Er {
|
|
|
3756
3756
|
const c = Math.abs(l.dot(t.clone().normalize()));
|
|
3757
3757
|
r = 1 - R.smoothstep(
|
|
3758
3758
|
c,
|
|
3759
|
-
|
|
3759
|
+
vr,
|
|
3760
3760
|
wr
|
|
3761
3761
|
);
|
|
3762
3762
|
}
|
|
@@ -3969,8 +3969,8 @@ class Pr {
|
|
|
3969
3969
|
let g = c.clone().sub(l).normalize();
|
|
3970
3970
|
c = c.clone().sub(g.clone().setLength(0.5));
|
|
3971
3971
|
const m = () => {
|
|
3972
|
-
const w = performance.now() - u,
|
|
3973
|
-
r.position.lerpVectors(l, c, b),
|
|
3972
|
+
const w = performance.now() - u, M = Math.min(w / d, 1), b = M < 0.5 ? 2 * M * M : 1 - Math.pow(-2 * M + 2, 2) / 2;
|
|
3973
|
+
r.position.lerpVectors(l, c, b), M < 1 ? requestAnimationFrame(m) : this.engine.controlModule.firstPersonControls.setCameraHeight(r.position.y);
|
|
3974
3974
|
};
|
|
3975
3975
|
this.clearModelHighlightBeforeCameraFlight(), requestAnimationFrame(m);
|
|
3976
3976
|
return;
|
|
@@ -4378,7 +4378,7 @@ class Ar {
|
|
|
4378
4378
|
const c = this.getSceneModel(l[0]);
|
|
4379
4379
|
c instanceof X ? n.has(l[0]) ? n.get(l[0])?.push(l[1]) : n.set(l[0], [l[1]]) : (this.split_merge_model(c), c.geometry.groups[l[1]].materialIndex = 1);
|
|
4380
4380
|
});
|
|
4381
|
-
}),
|
|
4381
|
+
}), Tr(n, this.engine);
|
|
4382
4382
|
let s = this.engine.engineStatus.highlightModels.find((o) => o.url == t.url);
|
|
4383
4383
|
s != null ? s.ids.push(...t.ids) : this.engine.engineStatus.highlightModels.push(t);
|
|
4384
4384
|
}), this.updateMaterial(), this.syncHighlightModelEdges();
|
|
@@ -4732,7 +4732,7 @@ class Ar {
|
|
|
4732
4732
|
const c = this.getSceneModel(l[0]);
|
|
4733
4733
|
c instanceof X ? n.has(l[0]) ? n.get(l[0])?.push(l[1]) : n.set(l[0], [l[1]]) : (this.split_merge_model(c), c.geometry.groups[l[1]].materialIndex = 2);
|
|
4734
4734
|
});
|
|
4735
|
-
}),
|
|
4735
|
+
}), _r(n, this.engine);
|
|
4736
4736
|
let s = this.engine.engineStatus.translucentModels.find((o) => o.url == t.url);
|
|
4737
4737
|
s != null ? s.ids.push(...t.ids) : this.engine.engineStatus.translucentModels.push({
|
|
4738
4738
|
url: t.url,
|
|
@@ -4801,7 +4801,7 @@ class Ar {
|
|
|
4801
4801
|
}
|
|
4802
4802
|
// ***************************************************** 设置模型颜色 ***************************************************** //
|
|
4803
4803
|
}
|
|
4804
|
-
function
|
|
4804
|
+
function Tr(a, e) {
|
|
4805
4805
|
a.forEach((t, i) => {
|
|
4806
4806
|
const n = ht(e, i);
|
|
4807
4807
|
if (!(n instanceof X))
|
|
@@ -4856,7 +4856,7 @@ function ji(a, e, t) {
|
|
|
4856
4856
|
});
|
|
4857
4857
|
});
|
|
4858
4858
|
}
|
|
4859
|
-
function
|
|
4859
|
+
function _r(a, e) {
|
|
4860
4860
|
a.forEach((t, i) => {
|
|
4861
4861
|
const n = ht(e, i);
|
|
4862
4862
|
if (!(n instanceof X))
|
|
@@ -5229,7 +5229,7 @@ function zr(a, e, t) {
|
|
|
5229
5229
|
i.visible = !0;
|
|
5230
5230
|
let n = null, s = 0, o, r, l = [];
|
|
5231
5231
|
i.init = function() {
|
|
5232
|
-
o || (C(),
|
|
5232
|
+
o || (C(), T(), V());
|
|
5233
5233
|
}, i.Hide = function() {
|
|
5234
5234
|
o.style.display = "none", i.visible = !1;
|
|
5235
5235
|
}, i.Show = function() {
|
|
@@ -5253,7 +5253,7 @@ function zr(a, e, t) {
|
|
|
5253
5253
|
function w(f, y) {
|
|
5254
5254
|
!f || !y || (f._referenceUp?.copy && y._referenceUp && f._referenceUp.copy(y._referenceUp).normalize(), f._viewRight?.copy && y._viewRight && f._viewRight.copy(y._viewRight).normalize());
|
|
5255
5255
|
}
|
|
5256
|
-
function
|
|
5256
|
+
function M() {
|
|
5257
5257
|
if (!i.camera || !e.camera)
|
|
5258
5258
|
return;
|
|
5259
5259
|
i.camera.quaternion.copy(e.camera.quaternion), i.camera.up.copy(e.camera.up);
|
|
@@ -5266,9 +5266,9 @@ function zr(a, e, t) {
|
|
|
5266
5266
|
function p(f, y) {
|
|
5267
5267
|
if (!f || !y)
|
|
5268
5268
|
return;
|
|
5269
|
-
const P = y.target,
|
|
5270
|
-
if (y._referenceUp?.copy && y._referenceUp.copy(D),
|
|
5271
|
-
const L = new h().crossVectors(
|
|
5269
|
+
const P = y.target, _ = P?.clone?.().sub(f.position), D = f.up.clone().normalize();
|
|
5270
|
+
if (y._referenceUp?.copy && y._referenceUp.copy(D), _?.lengthSq?.() > 1e-6 && y._viewRight?.copy) {
|
|
5271
|
+
const L = new h().crossVectors(_.clone().normalize(), D);
|
|
5272
5272
|
L.lengthSq() > 1e-6 ? y._viewRight.copy(L.normalize()) : y._viewRight.set(1, 0, 0).applyQuaternion(f.quaternion).normalize();
|
|
5273
5273
|
}
|
|
5274
5274
|
y._rotateVelocity?.set?.(0, 0), y._panVelocity?.set?.(0, 0), typeof y._zoomVelocity == "number" && (y._zoomVelocity = 0), y._mouseStart?.set?.(0, 0), y._touchCenter?.set?.(0, 0), typeof y._touchDistance == "number" && (y._touchDistance = 0), y._pointers?.clear?.(), y._isInteracting = !1, y.state = -1, y._lastPosition?.copy?.(f.position), y._lastTarget?.copy?.(P), y._lastUp?.copy?.(f.up), y._lastQuaternion?.copy?.(f.quaternion), typeof y._lastZoom == "number" && (y._lastZoom = f.zoom), y.saveState?.();
|
|
@@ -5277,7 +5277,7 @@ function zr(a, e, t) {
|
|
|
5277
5277
|
if (E)
|
|
5278
5278
|
i.orbitControls && i.orbitControls.update();
|
|
5279
5279
|
else {
|
|
5280
|
-
i.camera.quaternion.copy(e.camera.quaternion),
|
|
5280
|
+
i.camera.quaternion.copy(e.camera.quaternion), M();
|
|
5281
5281
|
const f = new h(0, 0, 1).applyQuaternion(e.camera.quaternion);
|
|
5282
5282
|
i.camera.position.copy(f.multiplyScalar(100));
|
|
5283
5283
|
}
|
|
@@ -5285,17 +5285,17 @@ function zr(a, e, t) {
|
|
|
5285
5285
|
}, i.ToggleDirectionView = function(f) {
|
|
5286
5286
|
var y = new h(0, 0, 0), P = null;
|
|
5287
5287
|
f == "top" ? (y = new h(0, 1, 0), P = new h(0, 0, -1)) : f == "down" || f == "button" ? (y = new h(0, -1, 0), P = new h(0, 0, 1)) : f == "front" ? y = new h(0, 0, 1) : f == "left" ? y = new h(-1, 0, 0) : f == "back" ? y = new h(0, 0, -1) : f == "right" ? y = new h(1, 0, 0) : f == "top_front" ? y = new h(1, 1, 0) : f == "top_left" ? y = new h(0, 1, -1) : f == "top_back" ? y = new h(-1, 1, 0) : f == "top_right" ? y = new h(0, 1, 1) : f == "down_front" ? y = new h(1, -1, 0) : f == "down_left" ? y = new h(0, -1, -1) : f == "down_back" ? y = new h(-1, -1, 0) : f == "down_right" ? y = new h(0, -1, 1) : f == "front_right" ? y = new h(1, 0, 1) : f == "right_back" ? y = new h(-1, 0, 1) : f == "back_left" ? y = new h(-1, 0, -1) : f == "left_front" ? y = new h(1, 0, -1) : f == "top_left_front" ? y = new h(1, 1, -1) : f == "top_front_right" ? y = new h(1, 1, 1) : f == "top_right_back" ? y = new h(-1, 1, 1) : f == "top_back_left" ? y = new h(-1, 1, -1) : f == "button_left_front" ? y = new h(1, -1, -1) : f == "button_front_right" ? y = new h(1, -1, 1) : f == "button_right_back" ? y = new h(-1, 1, 1) : f == "button_back_left" && (y = new h(-1, -1, -1));
|
|
5288
|
-
var
|
|
5288
|
+
var _ = a.octreeBox.getBoundingBox(), D = _.min, L = _.max, F = D.clone().add(L.clone()).multiplyScalar(0.5), q = F.clone().add(y.multiplyScalar(1 * L.distanceTo(D)));
|
|
5289
5289
|
x(e.camera.position, q, a.controls.target.clone(), F, null, null, 1e3, null, P);
|
|
5290
5290
|
}, i.GetCameraPose = function() {
|
|
5291
|
-
var f = e.camera.quaternion, y = e.camera.position, P = a.controls.target,
|
|
5291
|
+
var f = e.camera.quaternion, y = e.camera.position, P = a.controls.target, _ = {
|
|
5292
5292
|
quaternion: f,
|
|
5293
5293
|
position: y,
|
|
5294
5294
|
target: P
|
|
5295
5295
|
};
|
|
5296
|
-
return
|
|
5296
|
+
return _;
|
|
5297
5297
|
}, i.ReductionCameraPose = function(f, y = 1e3, P) {
|
|
5298
|
-
var
|
|
5298
|
+
var _ = new De(
|
|
5299
5299
|
f.quaternion._x,
|
|
5300
5300
|
f.quaternion._y,
|
|
5301
5301
|
f.quaternion._z,
|
|
@@ -5308,7 +5308,7 @@ function zr(a, e, t) {
|
|
|
5308
5308
|
a.controls.target.clone(),
|
|
5309
5309
|
L,
|
|
5310
5310
|
e.camera.quaternion,
|
|
5311
|
-
|
|
5311
|
+
_,
|
|
5312
5312
|
y,
|
|
5313
5313
|
(q) => {
|
|
5314
5314
|
P && (F || (P(q), F = !0));
|
|
@@ -5319,7 +5319,7 @@ function zr(a, e, t) {
|
|
|
5319
5319
|
}, i.CameraGoHome = function(f = 1e3) {
|
|
5320
5320
|
const y = new h(0, 1, 0);
|
|
5321
5321
|
g(y), m(y);
|
|
5322
|
-
var P = a.octreeBox.getBoundingBox(),
|
|
5322
|
+
var P = a.octreeBox.getBoundingBox(), _ = a.clipping?.getClippedBoundingBox?.(P), D = _ && !_.isEmpty() ? _ : P, L = D.min.clone().add(D.max.clone()).multiplyScalar(0.5);
|
|
5323
5323
|
let F = new h(1, 1, 1);
|
|
5324
5324
|
var q = P.max.distanceTo(P.min), ne = Math.max(q / 1e5, 0.01), Q = D.max.distanceTo(D.min), fe = L.clone().add(F.multiplyScalar(Q * 0.8));
|
|
5325
5325
|
if (e.camera.isOrthographicCamera) {
|
|
@@ -5344,7 +5344,7 @@ function zr(a, e, t) {
|
|
|
5344
5344
|
let Re = function() {
|
|
5345
5345
|
n = requestAnimationFrame(Re), pe.update();
|
|
5346
5346
|
};
|
|
5347
|
-
var y = f.min.clone().add(f.max.clone()).multiplyScalar(0.5), P = e.camera.position.clone().sub(a.controls.target.clone()).normalize(),
|
|
5347
|
+
var y = f.min.clone().add(f.max.clone()).multiplyScalar(0.5), P = e.camera.position.clone().sub(a.controls.target.clone()).normalize(), _ = e.camera.position.distanceTo(a.controls.target), D = y.clone().add(P.multiplyScalar(_)), L = e.camera.zoom, F = new h(1, 0, 0).applyQuaternion(e.camera.quaternion), q = new h(0, 1, 0).applyQuaternion(e.camera.quaternion), ne = [
|
|
5348
5348
|
new h(f.min.x, f.min.y, f.min.z),
|
|
5349
5349
|
new h(f.max.x, f.min.y, f.min.z),
|
|
5350
5350
|
new h(f.min.x, f.max.y, f.min.z),
|
|
@@ -5358,8 +5358,8 @@ function zr(a, e, t) {
|
|
|
5358
5358
|
var Be = $e.dot(F), Ze = $e.dot(q);
|
|
5359
5359
|
Q = Math.min(Q, Be), fe = Math.max(fe, Be), J = Math.min(J, Ze), Ee = Math.max(Ee, Ze);
|
|
5360
5360
|
}
|
|
5361
|
-
var
|
|
5362
|
-
L = Math.min(z /
|
|
5361
|
+
var v = (fe - Q) / 2, A = (Ee - J) / 2, z = (e.camera.right - e.camera.left) / 2, N = (e.camera.top - e.camera.bottom) / 2;
|
|
5362
|
+
L = Math.min(z / v, N / A) * 0.75;
|
|
5363
5363
|
var U = e.camera.position.clone(), le = a.controls.target.clone(), ue = e.camera.zoom, pe = new Je.Tween({
|
|
5364
5364
|
x1: U.x,
|
|
5365
5365
|
y1: U.y,
|
|
@@ -5388,12 +5388,12 @@ function zr(a, e, t) {
|
|
|
5388
5388
|
}), pe.easing(Je.Easing.Cubic.InOut), c(), pe.start(), Re();
|
|
5389
5389
|
} else {
|
|
5390
5390
|
var y = f.min.clone().add(f.max.clone()).multiplyScalar(0.5);
|
|
5391
|
-
let
|
|
5392
|
-
var D = y.clone().add(
|
|
5391
|
+
let Te = e.camera.position.clone().sub(a.controls.target.clone()).normalize();
|
|
5392
|
+
var D = y.clone().add(Te.multiplyScalar(2 * f.max.distanceTo(f.min)));
|
|
5393
5393
|
x(e.camera.position, D, a.controls.target.clone(), y);
|
|
5394
5394
|
}
|
|
5395
5395
|
};
|
|
5396
|
-
function x(f, y, P,
|
|
5396
|
+
function x(f, y, P, _, D, L, F = 1e3, q, ne) {
|
|
5397
5397
|
var Q;
|
|
5398
5398
|
D && L ? (Q = new Je.Tween({
|
|
5399
5399
|
x1: f.x,
|
|
@@ -5424,11 +5424,11 @@ function zr(a, e, t) {
|
|
|
5424
5424
|
// 新的相机位置y
|
|
5425
5425
|
z1: y.z,
|
|
5426
5426
|
// 新的相机位置z
|
|
5427
|
-
x2:
|
|
5427
|
+
x2: _.x,
|
|
5428
5428
|
// 新的控制中心点位置x
|
|
5429
|
-
y2:
|
|
5429
|
+
y2: _.y,
|
|
5430
5430
|
// 新的控制中心点位置x
|
|
5431
|
-
z2:
|
|
5431
|
+
z2: _.z,
|
|
5432
5432
|
// 新的控制中心点位置x
|
|
5433
5433
|
_x: L._x,
|
|
5434
5434
|
// 新的相机quaternion
|
|
@@ -5461,11 +5461,11 @@ function zr(a, e, t) {
|
|
|
5461
5461
|
// 新的相机位置y
|
|
5462
5462
|
z1: y.z,
|
|
5463
5463
|
// 新的相机位置z
|
|
5464
|
-
x2:
|
|
5464
|
+
x2: _.x,
|
|
5465
5465
|
// 新的控制中心点位置x
|
|
5466
|
-
y2:
|
|
5466
|
+
y2: _.y,
|
|
5467
5467
|
// 新的控制中心点位置x
|
|
5468
|
-
z2:
|
|
5468
|
+
z2: _.z
|
|
5469
5469
|
// 新的控制中心点位置x
|
|
5470
5470
|
},
|
|
5471
5471
|
F
|
|
@@ -5491,8 +5491,8 @@ function zr(a, e, t) {
|
|
|
5491
5491
|
var f = document.createElement("div");
|
|
5492
5492
|
f.className = "homeViewWrapper", f.style.backgroundImage = `url(${W("/assets/viewcube/home.png", import.meta.url)})`, f.addEventListener("mousedown", function() {
|
|
5493
5493
|
a.viewCube.cameraGoHome(500);
|
|
5494
|
-
}), o.appendChild(f), r.addEventListener("mousedown", function(
|
|
5495
|
-
|
|
5494
|
+
}), o.appendChild(f), r.addEventListener("mousedown", function(_) {
|
|
5495
|
+
_.stopPropagation(), cameraToggle.classList.contains("show") ? (y(), console.log("隐藏功能按钮")) : (P(), console.log("显示功能按钮"));
|
|
5496
5496
|
});
|
|
5497
5497
|
function y() {
|
|
5498
5498
|
cameraToggle.classList.remove("show"), screenshot.classList.remove("show"), fullscreen.classList.remove("show");
|
|
@@ -5501,10 +5501,10 @@ function zr(a, e, t) {
|
|
|
5501
5501
|
cameraToggle.classList.add("show"), screenshot.classList.add("show"), fullscreen.classList.add("show");
|
|
5502
5502
|
}
|
|
5503
5503
|
}
|
|
5504
|
-
function
|
|
5504
|
+
function T() {
|
|
5505
5505
|
i.sceneOrtho = Lr();
|
|
5506
|
-
var P = t.clientWidth,
|
|
5507
|
-
i.camera = new
|
|
5506
|
+
var P = t.clientWidth, _ = t.clientWidth, f = P > _ ? P / _ : _ / P, y = 300;
|
|
5507
|
+
i.camera = new ve(
|
|
5508
5508
|
y * f / -2,
|
|
5509
5509
|
y * f / 2,
|
|
5510
5510
|
y / 2,
|
|
@@ -5512,10 +5512,10 @@ function zr(a, e, t) {
|
|
|
5512
5512
|
0.01,
|
|
5513
5513
|
1e4
|
|
5514
5514
|
);
|
|
5515
|
-
var P = o.clientWidth,
|
|
5515
|
+
var P = o.clientWidth, _ = o.clientHeight, D = new si({
|
|
5516
5516
|
alpha: !0
|
|
5517
5517
|
});
|
|
5518
|
-
D.setSize(P,
|
|
5518
|
+
D.setSize(P, _), D.setClearAlpha(0), i.sceneOrtho.renderer = D;
|
|
5519
5519
|
let L = new bt(16777215, 0.8);
|
|
5520
5520
|
i.sceneOrtho.add(L), kr(o, D), i.orbitControls = new fn(a, i.camera, o), i.orbitControls.enableZoom = !1, i.orbitControls.enablePan = !1, i.orbitControls.enableDamping = !0, i.orbitControls.dampingFactor = 0.1, i.orbitControls.rotateSpeed = 0.5, i.orbitControls.addEventListener("start", k), i.orbitControls.addEventListener("change", B), i.orbitControls.addEventListener("end", I);
|
|
5521
5521
|
}
|
|
@@ -5575,12 +5575,12 @@ function zr(a, e, t) {
|
|
|
5575
5575
|
});
|
|
5576
5576
|
var P = new O(new Ct(110, 110, 110), y);
|
|
5577
5577
|
i.sceneOrtho.add(P), $(122);
|
|
5578
|
-
let
|
|
5578
|
+
let _ = { x: 0, y: 0 };
|
|
5579
5579
|
o.addEventListener("mousedown", (D) => {
|
|
5580
|
-
|
|
5580
|
+
_.x = D.clientX, _.y = D.clientY;
|
|
5581
5581
|
}), o.addEventListener("mouseup", (D) => {
|
|
5582
5582
|
if (E) return;
|
|
5583
|
-
const L = D.clientX -
|
|
5583
|
+
const L = D.clientX - _.x, F = D.clientY - _.y;
|
|
5584
5584
|
if (Math.sqrt(L * L + F * F) > 5) return;
|
|
5585
5585
|
var ne = {};
|
|
5586
5586
|
ne.x = D.offsetX / o.clientWidth * 2 - 1, ne.y = -(D.offsetY / o.clientHeight) * 2 + 1;
|
|
@@ -5643,7 +5643,7 @@ function zr(a, e, t) {
|
|
|
5643
5643
|
c: 75,
|
|
5644
5644
|
point: new h(0, -y, 0)
|
|
5645
5645
|
}
|
|
5646
|
-
],
|
|
5646
|
+
], _ = [
|
|
5647
5647
|
{
|
|
5648
5648
|
name: "top_right_back",
|
|
5649
5649
|
a: 30,
|
|
@@ -5787,8 +5787,8 @@ function zr(a, e, t) {
|
|
|
5787
5787
|
}
|
|
5788
5788
|
], L = 0; L < P.length; L++)
|
|
5789
5789
|
l.push(S(P[L]));
|
|
5790
|
-
for (var L = 0; L <
|
|
5791
|
-
l.push(S(
|
|
5790
|
+
for (var L = 0; L < _.length; L++)
|
|
5791
|
+
l.push(S(_[L]));
|
|
5792
5792
|
for (var L = 0; L < D.length; L++)
|
|
5793
5793
|
l.push(S(D[L]));
|
|
5794
5794
|
}
|
|
@@ -5797,8 +5797,8 @@ function zr(a, e, t) {
|
|
|
5797
5797
|
color: "blue",
|
|
5798
5798
|
transparent: !0,
|
|
5799
5799
|
opacity: 0.01
|
|
5800
|
-
}),
|
|
5801
|
-
let D = y.applyMatrix4(
|
|
5800
|
+
}), _ = new G().makeTranslation(f.point.x, f.point.y, f.point.z);
|
|
5801
|
+
let D = y.applyMatrix4(_), L = new O(D, P);
|
|
5802
5802
|
return L.name = f.name, i.sceneOrtho.add(L), L;
|
|
5803
5803
|
}
|
|
5804
5804
|
return i.ToggleCameraType = function() {
|
|
@@ -5810,8 +5810,8 @@ function zr(a, e, t) {
|
|
|
5810
5810
|
return;
|
|
5811
5811
|
}
|
|
5812
5812
|
a.renderer.render(e, e.camera);
|
|
5813
|
-
const y = a.renderer.domElement.toDataURL("image/png"), P = document.createElement("a"),
|
|
5814
|
-
P.download = `screenshot_${
|
|
5813
|
+
const y = a.renderer.domElement.toDataURL("image/png"), P = document.createElement("a"), _ = (/* @__PURE__ */ new Date()).toISOString().replaceAll(/[:.]/g, "-");
|
|
5814
|
+
P.download = `screenshot_${_}.png`, P.href = y, P.click(), console.log("截图已保存");
|
|
5815
5815
|
} catch (f) {
|
|
5816
5816
|
console.error("截图失败:", f);
|
|
5817
5817
|
}
|
|
@@ -5977,45 +5977,45 @@ function Rr(a) {
|
|
|
5977
5977
|
return;
|
|
5978
5978
|
const y = He(a, S.url);
|
|
5979
5979
|
(S.lods ?? []).forEach((P) => {
|
|
5980
|
-
let
|
|
5981
|
-
b(t,
|
|
5980
|
+
let _ = P.octreeBox;
|
|
5981
|
+
b(t, _, S, f, y);
|
|
5982
5982
|
});
|
|
5983
5983
|
});
|
|
5984
|
-
const w = o.map((S) =>
|
|
5984
|
+
const w = o.map((S) => T(S)).filter((S) => S instanceof O);
|
|
5985
5985
|
lo(t);
|
|
5986
|
-
const
|
|
5987
|
-
return co(t),
|
|
5988
|
-
function b(S, f, y, P,
|
|
5986
|
+
const M = t.intersectObjects(w, !1).map(B);
|
|
5987
|
+
return co(t), M;
|
|
5988
|
+
function b(S, f, y, P, _) {
|
|
5989
5989
|
if (f == null)
|
|
5990
5990
|
return;
|
|
5991
5991
|
if (!f.threeBox) {
|
|
5992
5992
|
let F = new h(f.min.X * 0.3048, f.min.Z * 0.3048, -f.min.Y * 0.3048), q = new h(f.max.X * 0.3048, f.max.Z * 0.3048, -f.max.Y * 0.3048), ne = new h(Math.min(F.x, q.x), Math.min(F.y, q.y), Math.min(F.z, q.z)), Q = new h(Math.max(q.x, F.x), Math.max(q.y, F.y), Math.max(q.z, F.z));
|
|
5993
|
-
f.threeBox = new Y(ne, Q).applyMatrix4(
|
|
5993
|
+
f.threeBox = new Y(ne, Q).applyMatrix4(_);
|
|
5994
5994
|
}
|
|
5995
5995
|
const D = f.threeBox, L = S.ray.intersectsBox(D);
|
|
5996
5996
|
if (!(L == null || L == !1) && c?.doesBoxIntersectClippingRange?.(D) !== !1)
|
|
5997
5997
|
if (f.children == null || f.children.length == 0) {
|
|
5998
5998
|
if (f.elements != null)
|
|
5999
5999
|
for (let F of f.elements)
|
|
6000
|
-
p(F, y, P,
|
|
6000
|
+
p(F, y, P, _);
|
|
6001
6001
|
} else {
|
|
6002
6002
|
if (f.elements != null)
|
|
6003
6003
|
for (let F of f.elements)
|
|
6004
|
-
p(F, y, P,
|
|
6004
|
+
p(F, y, P, _);
|
|
6005
6005
|
for (let F of f.children)
|
|
6006
|
-
b(S, F, y, P,
|
|
6006
|
+
b(S, F, y, P, _);
|
|
6007
6007
|
}
|
|
6008
6008
|
}
|
|
6009
6009
|
function p(S, f, y, P) {
|
|
6010
6010
|
if (!a.engineStatus.isFree && i == !1 || V(f.url, S))
|
|
6011
6011
|
return;
|
|
6012
|
-
const
|
|
6013
|
-
if (
|
|
6014
|
-
if (
|
|
6015
|
-
|
|
6012
|
+
const _ = y.nodesMap.get(S);
|
|
6013
|
+
if (_ != null) {
|
|
6014
|
+
if (_.infos != null)
|
|
6015
|
+
_.infos.forEach((D) => {
|
|
6016
6016
|
x(D.mesh, P);
|
|
6017
6017
|
});
|
|
6018
|
-
else if (
|
|
6018
|
+
else if (_.info != null)
|
|
6019
6019
|
return;
|
|
6020
6020
|
}
|
|
6021
6021
|
}
|
|
@@ -6028,10 +6028,10 @@ function Rr(a) {
|
|
|
6028
6028
|
const P = I(S, f);
|
|
6029
6029
|
if (P == null || c?.doesBoxIntersectClippingRange?.(P) === !1)
|
|
6030
6030
|
return;
|
|
6031
|
-
const
|
|
6032
|
-
|
|
6031
|
+
const _ = t.ray.intersectBox(P, l);
|
|
6032
|
+
_ != null && (r.add(y), o.push({
|
|
6033
6033
|
key: y,
|
|
6034
|
-
distanceSq: t.ray.origin.distanceToSquared(
|
|
6034
|
+
distanceSq: t.ray.origin.distanceToSquared(_),
|
|
6035
6035
|
kind: "mesh",
|
|
6036
6036
|
mesh: S
|
|
6037
6037
|
}), C());
|
|
@@ -6042,25 +6042,25 @@ function Rr(a) {
|
|
|
6042
6042
|
S != null && r.delete(S.key);
|
|
6043
6043
|
}
|
|
6044
6044
|
}
|
|
6045
|
-
function
|
|
6045
|
+
function T(S) {
|
|
6046
6046
|
return S.kind === "mesh" ? S.mesh : S.kind === "instance" ? E(S.node, S.indexInfo, S.url, S.modelMatrix) : null;
|
|
6047
6047
|
}
|
|
6048
6048
|
function E(S, f, y, P) {
|
|
6049
6049
|
if (!Array.isArray(f) || f.length < 2 || S?.info == null)
|
|
6050
6050
|
return null;
|
|
6051
|
-
const
|
|
6052
|
-
if (!(
|
|
6051
|
+
const _ = Lt(a, f[0]);
|
|
6052
|
+
if (!(_ instanceof X) || _.geometry == null)
|
|
6053
6053
|
return null;
|
|
6054
6054
|
const D = f[1];
|
|
6055
|
-
if (n &&
|
|
6055
|
+
if (n && _.geometry.attributes.position.count >= 2e3)
|
|
6056
6056
|
return null;
|
|
6057
|
-
const L = k(
|
|
6057
|
+
const L = k(_, D);
|
|
6058
6058
|
if (L == null)
|
|
6059
6059
|
return null;
|
|
6060
6060
|
P.clone().multiply(L), S.info.__pickMeshes instanceof Map || (S.info.__pickMeshes = /* @__PURE__ */ new Map());
|
|
6061
6061
|
const F = `${f[0]}:${D}`;
|
|
6062
6062
|
let q = S.info.__pickMeshes.get(F);
|
|
6063
|
-
return q instanceof O || (q = new O(
|
|
6063
|
+
return q instanceof O || (q = new O(_.geometry, _.material), S.info.__pickMeshes.set(F, q)), q.userData.__instancePickMeta = {
|
|
6064
6064
|
url: y,
|
|
6065
6065
|
id: S.info.id,
|
|
6066
6066
|
instanceId: D,
|
|
@@ -6270,7 +6270,7 @@ class Fr {
|
|
|
6270
6270
|
d.dot(u.normalize()) < 0 && d.negate();
|
|
6271
6271
|
const m = n.clone().sub(d.multiplyScalar(c));
|
|
6272
6272
|
t.position.copy(m), i.target && i.target.copy(n), t.lookAt(n), i.update();
|
|
6273
|
-
} else if (t instanceof
|
|
6273
|
+
} else if (t instanceof ve) {
|
|
6274
6274
|
const l = o * 1.2, c = this.engine.renderer?.domElement, d = c ? c.width / c.height : 1;
|
|
6275
6275
|
t.left = -l * d / 2, t.right = l * d / 2, t.top = l / 2, t.bottom = -l / 2, t.updateProjectionMatrix();
|
|
6276
6276
|
const u = new h();
|
|
@@ -6323,7 +6323,7 @@ class Hr {
|
|
|
6323
6323
|
if (!e || !t)
|
|
6324
6324
|
return;
|
|
6325
6325
|
let i = 0.5;
|
|
6326
|
-
if (e instanceof
|
|
6326
|
+
if (e instanceof ve) {
|
|
6327
6327
|
const n = (e.top - e.bottom) / e.zoom, s = t.domElement.clientHeight || 1;
|
|
6328
6328
|
i = 30 * n / s;
|
|
6329
6329
|
}
|
|
@@ -6713,10 +6713,10 @@ class fi {
|
|
|
6713
6713
|
Array.isArray(e) ? e.forEach((t) => t.dispose()) : e.dispose(), this.groundGroup.remove(this.groundMesh), this.groundMesh = null, this.isWaterAddon = !1;
|
|
6714
6714
|
}
|
|
6715
6715
|
}
|
|
6716
|
-
const
|
|
6716
|
+
const _e = "0", Vr = !0, Un = 0.2, Ur = 0.35;
|
|
6717
6717
|
class Gr {
|
|
6718
6718
|
engine;
|
|
6719
|
-
currentHdrId =
|
|
6719
|
+
currentHdrId = _e;
|
|
6720
6720
|
isVisible = Vr;
|
|
6721
6721
|
currentIntensity = Un;
|
|
6722
6722
|
currentTexture = null;
|
|
@@ -6763,8 +6763,8 @@ class Gr {
|
|
|
6763
6763
|
console.warn(`[Hdr] HDR id "${e}" not found`);
|
|
6764
6764
|
return;
|
|
6765
6765
|
}
|
|
6766
|
-
if (e ===
|
|
6767
|
-
this._clearHdr(), this.currentHdrId =
|
|
6766
|
+
if (e === _e || !t.url) {
|
|
6767
|
+
this._clearHdr(), this.currentHdrId = _e, this._requestRender();
|
|
6768
6768
|
return;
|
|
6769
6769
|
}
|
|
6770
6770
|
if (this.textureCache.has(e)) {
|
|
@@ -6788,7 +6788,7 @@ class Gr {
|
|
|
6788
6788
|
return this.isVisible;
|
|
6789
6789
|
}
|
|
6790
6790
|
setIntensity(e) {
|
|
6791
|
-
this.currentIntensity = e, !(!this.engine.scene || this.currentHdrId ===
|
|
6791
|
+
this.currentIntensity = e, !(!this.engine.scene || this.currentHdrId === _e) && (this.engine.scene.environmentIntensity = e, this._updateSkyboxIntensity(), this._requestRender());
|
|
6792
6792
|
}
|
|
6793
6793
|
getIntensity() {
|
|
6794
6794
|
return this.currentIntensity;
|
|
@@ -6820,7 +6820,7 @@ class Gr {
|
|
|
6820
6820
|
t.dispose(), this.currentEnvironmentTexture = i, this.engine.scene.background = null, this.engine.scene.environment = i, this.engine.scene.environmentIntensity = this.currentIntensity, this.engine.renderer.toneMapping = oi, this.engine.renderer.toneMappingExposure = this.previousToneMappingExposure > 0 ? this.previousToneMappingExposure : li, this._removeSkybox(), this._createSkybox(e), this._setAmbientLightIntensity(this._getHdrAmbientLightIntensity());
|
|
6821
6821
|
}
|
|
6822
6822
|
_captureSceneState() {
|
|
6823
|
-
this.currentHdrId !==
|
|
6823
|
+
this.currentHdrId !== _e || !this.engine.scene || (this.previousBackground = this.engine.scene.background, this.previousEnvironment = this.engine.scene.environment, this.previousBackgroundIntensity = this.engine.scene.backgroundIntensity ?? 1, this.previousEnvironmentIntensity = this.engine.scene.environmentIntensity ?? 1, this.previousAmbientLightIntensity = this._getAmbientLightIntensity(), this.previousToneMapping = this.engine.renderer?.toneMapping ?? je, this.previousToneMappingExposure = this.engine.renderer?.toneMappingExposure ?? 1);
|
|
6824
6824
|
}
|
|
6825
6825
|
_createSkybox(e) {
|
|
6826
6826
|
if (!this.engine.scene) return;
|
|
@@ -7104,7 +7104,7 @@ function Qr(a, e) {
|
|
|
7104
7104
|
return a instanceof h ? a.clone() : e?.min && e?.max ? e.min.clone().add(e.max).multiplyScalar(0.5) : new h();
|
|
7105
7105
|
}
|
|
7106
7106
|
function ea(a, e, t) {
|
|
7107
|
-
if (a instanceof
|
|
7107
|
+
if (a instanceof ve)
|
|
7108
7108
|
return Math.max((a.top - a.bottom) / Math.max(a.zoom, 1e-6), 1);
|
|
7109
7109
|
const i = a, n = Qr(e, t), s = i.position.distanceTo(n), o = typeof i.getEffectiveFOV == "function" ? i.getEffectiveFOV() : i.fov, r = R.degToRad(o * 0.5);
|
|
7110
7110
|
return Math.max(2 * s * Math.tan(r), 1);
|
|
@@ -7226,7 +7226,7 @@ class ia {
|
|
|
7226
7226
|
}
|
|
7227
7227
|
loadZipJsonAsync(e, t) {
|
|
7228
7228
|
return new Promise((i, n) => {
|
|
7229
|
-
|
|
7229
|
+
Tt(
|
|
7230
7230
|
e,
|
|
7231
7231
|
(s) => {
|
|
7232
7232
|
if (s == null) {
|
|
@@ -7410,8 +7410,8 @@ class ia {
|
|
|
7410
7410
|
for (let g = o; g < r; g += 3) {
|
|
7411
7411
|
const m = Math.floor(u / 6), w = u % 6 >= 3;
|
|
7412
7412
|
if (c[m] && c[m].length === 2) {
|
|
7413
|
-
const
|
|
7414
|
-
d[g] =
|
|
7413
|
+
const M = w ? c[m][1] : c[m][0];
|
|
7414
|
+
d[g] = M.X, d[g + 1] = M.Z, d[g + 2] = -M.Y;
|
|
7415
7415
|
}
|
|
7416
7416
|
u += 3;
|
|
7417
7417
|
}
|
|
@@ -7636,7 +7636,7 @@ class na {
|
|
|
7636
7636
|
return;
|
|
7637
7637
|
}
|
|
7638
7638
|
const e = new ps();
|
|
7639
|
-
e.scale.setScalar(this.skyScale), e.name = this.skyName, this.sky = e, this.engine.scene.add(e), this._captureSceneState(), this._expandCameraFarForSky(), this.engine.renderer && (this.engine.renderer.toneMapping =
|
|
7639
|
+
e.scale.setScalar(this.skyScale), e.name = this.skyName, this.sky = e, this.engine.scene.add(e), this._captureSceneState(), this._expandCameraFarForSky(), this.engine.renderer && (this.engine.renderer.toneMapping = vi, this.engine.scene.background = null), this._applyParamsToSky();
|
|
7640
7640
|
}
|
|
7641
7641
|
close(e = !0) {
|
|
7642
7642
|
this.sky && (this._restoreCameraFar(), this._restoreSceneState(e), e ? (this.engine?.scene?.remove(this.sky), this.sky.material.dispose(), this.sky.geometry.dispose(), this.sky = null) : this.sky.visible = !1);
|
|
@@ -7708,7 +7708,7 @@ class na {
|
|
|
7708
7708
|
const e = this.sky.material.uniforms;
|
|
7709
7709
|
this._setUniformValue(e, "turbidity", this.params.turbidity), this._setUniformValue(e, "rayleigh", this.params.rayleigh), this._setUniformValue(e, "mieCoefficient", this.params.mieCoefficient), this._setUniformValue(e, "mieDirectionalG", this.params.mieDirectionalG), this._setUniformValue(e, "cloudCoverage", this.params.cloudCoverage), this._setUniformValue(e, "cloudDensity", this.params.cloudDensity), this._setUniformValue(e, "cloudElevation", this.params.cloudElevation), this._setUniformValue(e, "showSunDisc", this.params.showSunDisc ? 1 : 0);
|
|
7710
7710
|
const t = R.degToRad(90 - this.params.elevation), i = R.degToRad(this.params.azimuth);
|
|
7711
|
-
this.sun.setFromSphericalCoords(1, t, i), this._setUniformValue(e, "sunPosition", this.sun), this.engine?.renderer && (this.engine.renderer.toneMapping =
|
|
7711
|
+
this.sun.setFromSphericalCoords(1, t, i), this._setUniformValue(e, "sunPosition", this.sun), this.engine?.renderer && (this.engine.renderer.toneMapping = vi, this.engine.renderer.toneMappingExposure = this._getEffectiveExposure(), this.sky.visible && this._refreshEnvironmentMap());
|
|
7712
7712
|
}
|
|
7713
7713
|
_captureSceneState() {
|
|
7714
7714
|
this.hasCapturedSceneState || !this.engine?.scene || (this.previousBackground = this.engine.scene.background, this.previousEnvironment = this.engine.scene.environment, this.previousBackgroundIntensity = this.engine.scene.backgroundIntensity ?? 1, this.previousEnvironmentIntensity = this.engine.scene.environmentIntensity ?? 1, this.previousToneMapping = this.engine.renderer?.toneMapping ?? je, this.previousToneMappingExposure = this.engine.renderer?.toneMappingExposure ?? 1, this.hasCapturedSceneState = !0);
|
|
@@ -7860,7 +7860,7 @@ class sa {
|
|
|
7860
7860
|
this.settings = this._readCurrentSettingsFromModules();
|
|
7861
7861
|
}
|
|
7862
7862
|
_buildDefaultSettingsFromModules() {
|
|
7863
|
-
const e = this.engine.composerModule?.saturationPass?.uniforms?.saturation?.value, t = this.engine.composerModule?.saturationPass?.uniforms?.contrast?.value, i = this.engine.composerModule?.gtaoPass?.blendIntensity, n = this.engine.renderer?.toneMappingExposure, s = this.engine.modelEdge?.getOpacity?.(), o = this.engine.hdr?.getCurrentHdrId?.() ??
|
|
7863
|
+
const e = this.engine.composerModule?.saturationPass?.uniforms?.saturation?.value, t = this.engine.composerModule?.saturationPass?.uniforms?.contrast?.value, i = this.engine.composerModule?.gtaoPass?.blendIntensity, n = this.engine.renderer?.toneMappingExposure, s = this.engine.modelEdge?.getOpacity?.(), o = this.engine.hdr?.getCurrentHdrId?.() ?? _e, r = this.engine.hdr?.getIntensity?.(), l = this.engine.skyManager?.getIntensity?.(), c = this.engine.skyManager?.getCurrentPreset?.() ?? ti, d = this.engine.skyManager?.isActive?.() === !0;
|
|
7864
7864
|
return {
|
|
7865
7865
|
render: {
|
|
7866
7866
|
mode: this._toRenderMode(this.engine.engineModelModule?.getCurrentMode?.()),
|
|
@@ -7880,7 +7880,7 @@ class sa {
|
|
|
7880
7880
|
groundHeight: this.engine.ground?.getHeight?.() ?? Hn
|
|
7881
7881
|
},
|
|
7882
7882
|
environment: {
|
|
7883
|
-
type: d ? "sky" : o !==
|
|
7883
|
+
type: d ? "sky" : o !== _e ? "hdr" : "none",
|
|
7884
7884
|
hdrId: o,
|
|
7885
7885
|
hdrIntensity: this._unitToPercent(r, Un),
|
|
7886
7886
|
skyPreset: c,
|
|
@@ -7910,7 +7910,7 @@ class sa {
|
|
|
7910
7910
|
groundHeight: this.engine.ground?.getHeight?.() ?? this.settings.display.groundHeight
|
|
7911
7911
|
},
|
|
7912
7912
|
environment: {
|
|
7913
|
-
type: u ? "sky" : o !==
|
|
7913
|
+
type: u ? "sky" : o !== _e ? "hdr" : "none",
|
|
7914
7914
|
hdrId: o,
|
|
7915
7915
|
hdrIntensity: this._unitToPercent(r, this.settings.environment.hdrIntensity / 100),
|
|
7916
7916
|
skyPreset: c,
|
|
@@ -7958,12 +7958,12 @@ class sa {
|
|
|
7958
7958
|
* 搴旂敤鐜璁剧疆銆? * 鍏堝叧闂綋鍓?HDR 鍜屽ぉ绌猴紝鍐嶆牴鎹被鍨嬮噸鏂板惎鐢ㄣ€? * 浣跨敤鐗堟湰鍙锋満鍒堕槻姝㈠娆″紓姝ヨ皟鐢ㄤ箣闂寸殑绔炴€佹潯浠躲€? */
|
|
7959
7959
|
async _applyEnvironmentSettings(e) {
|
|
7960
7960
|
const t = ++this.environmentApplyVersion;
|
|
7961
|
-
if (await this.engine.hdr?.setHdr(
|
|
7961
|
+
if (await this.engine.hdr?.setHdr(_e), t === this.environmentApplyVersion && (this.engine.skyManager?.close(!0), t === this.environmentApplyVersion))
|
|
7962
7962
|
switch (e.type) {
|
|
7963
7963
|
case "none":
|
|
7964
7964
|
break;
|
|
7965
7965
|
case "hdr":
|
|
7966
|
-
if (e.hdrId !==
|
|
7966
|
+
if (e.hdrId !== _e) {
|
|
7967
7967
|
if (await this.engine.hdr?.setHdr(e.hdrId), t !== this.environmentApplyVersion) {
|
|
7968
7968
|
this._applyEnvironmentSettings(this._clone(this.settings.environment));
|
|
7969
7969
|
return;
|
|
@@ -8082,7 +8082,7 @@ class Ie {
|
|
|
8082
8082
|
this.engine.measure.annotationData.normalAnnotation.forEach((p) => {
|
|
8083
8083
|
b(p);
|
|
8084
8084
|
}), this.engine.measure.annotationData.elevationAnnotation.forEach((p) => {
|
|
8085
|
-
|
|
8085
|
+
M(p);
|
|
8086
8086
|
}), this.engine.measure.annotationData.coordinateAnnotation.forEach((p) => {
|
|
8087
8087
|
w(p);
|
|
8088
8088
|
}), this.engine.measure.annotationData.angleAnnotation.forEach((p) => {
|
|
@@ -8114,14 +8114,14 @@ class Ie {
|
|
|
8114
8114
|
e.clearHighlight(), p.container.getElementsByTagName("svg")[0].classList.add("Hight"), p.highlight = !0, e.engine.events.trigger(ee.MeasureClick, p);
|
|
8115
8115
|
}), p.isSelect && (p.container.getElementsByTagName("svg")[0].classList.add("Hight"), p.highlight = !0);
|
|
8116
8116
|
}
|
|
8117
|
-
let x = i(p.point1), C = i(p.point2),
|
|
8118
|
-
if (x == null || C == null ||
|
|
8117
|
+
let x = i(p.point1), C = i(p.point2), T = i(p.point3);
|
|
8118
|
+
if (x == null || C == null || T == null) {
|
|
8119
8119
|
n(p, !1);
|
|
8120
8120
|
return;
|
|
8121
8121
|
}
|
|
8122
8122
|
n(p, !0);
|
|
8123
8123
|
let E = p.container;
|
|
8124
|
-
E.getElementsByTagName("circle")[0].setAttribute("cx", x.x), E.getElementsByTagName("circle")[0].setAttribute("cy", x.y), E.getElementsByTagName("circle")[1].setAttribute("cx", C.x), E.getElementsByTagName("circle")[1].setAttribute("cy", C.y), E.getElementsByTagName("circle")[2].setAttribute("cx",
|
|
8124
|
+
E.getElementsByTagName("circle")[0].setAttribute("cx", x.x), E.getElementsByTagName("circle")[0].setAttribute("cy", x.y), E.getElementsByTagName("circle")[1].setAttribute("cx", C.x), E.getElementsByTagName("circle")[1].setAttribute("cy", C.y), E.getElementsByTagName("circle")[2].setAttribute("cx", T.x), E.getElementsByTagName("circle")[2].setAttribute("cy", T.y), E.getElementsByTagName("polyline")[0].setAttribute("points", x.x + "," + x.y + " " + C.x + "," + C.y), E.getElementsByTagName("polyline")[1].setAttribute("points", C.x + "," + C.y + " " + T.x + "," + T.y);
|
|
8125
8125
|
let k = C.x, B = C.y - 30;
|
|
8126
8126
|
E.getElementsByTagName("rect")[0].setAttribute("x", k - 40), E.getElementsByTagName("rect")[0].setAttribute("y", B - 12.5), E.getElementsByTagName("text")[0].setAttribute("x", k), E.getElementsByTagName("text")[0].setAttribute("y", B + 4), E.getElementsByTagName("text")[0].innerHTML = p.text, E.style.top = "0px", E.style.left = "0px";
|
|
8127
8127
|
}
|
|
@@ -8143,21 +8143,21 @@ class Ie {
|
|
|
8143
8143
|
}
|
|
8144
8144
|
if (!p.points || p.points.length < 2)
|
|
8145
8145
|
return;
|
|
8146
|
-
let x = [], C = 0,
|
|
8146
|
+
let x = [], C = 0, T = 0;
|
|
8147
8147
|
for (let S = 0; S < p.points.length; S++) {
|
|
8148
8148
|
let f = i(p.points[S]);
|
|
8149
8149
|
if (f == null) {
|
|
8150
8150
|
n(p, !1);
|
|
8151
8151
|
return;
|
|
8152
8152
|
}
|
|
8153
|
-
x.push(f), C += f.x,
|
|
8153
|
+
x.push(f), C += f.x, T += f.y;
|
|
8154
8154
|
}
|
|
8155
|
-
n(p, !0), C = C / x.length,
|
|
8155
|
+
n(p, !0), C = C / x.length, T = T / x.length;
|
|
8156
8156
|
let E = x.map((S) => S.x + "," + S.y).join(" "), k = [...x];
|
|
8157
8157
|
x.length >= 3 && k.push(x[0]);
|
|
8158
8158
|
let B = k.map((S) => S.x + "," + S.y).join(" "), I = p.container;
|
|
8159
8159
|
I.getElementsByTagName("polygon")[0].setAttribute("points", x.length >= 3 ? E : ""), I.getElementsByTagName("polyline")[0].setAttribute("points", B);
|
|
8160
|
-
let V = C, $ =
|
|
8160
|
+
let V = C, $ = T;
|
|
8161
8161
|
I.getElementsByTagName("rect")[0].setAttribute("x", V - 40), I.getElementsByTagName("rect")[0].setAttribute("y", $ - 12.5), I.getElementsByTagName("text")[0].setAttribute("x", V + 10), I.getElementsByTagName("text")[0].setAttribute("y", $ + 4), I.getElementsByTagName("text")[0].innerHTML = e.getMeasureText(p.text, 2), I.style.top = "0px", I.style.left = "0px";
|
|
8162
8162
|
}
|
|
8163
8163
|
function m(p) {
|
|
@@ -8186,10 +8186,10 @@ class Ie {
|
|
|
8186
8186
|
return;
|
|
8187
8187
|
}
|
|
8188
8188
|
n(p, !0);
|
|
8189
|
-
let
|
|
8190
|
-
|
|
8189
|
+
let T = p.container;
|
|
8190
|
+
T.getElementsByTagName("polyline")[0].setAttribute("points", x.x + "," + x.y + " " + C.x + "," + C.y);
|
|
8191
8191
|
let E = (x.x + C.x) / 2, k = (x.y + C.y) / 2 - 30;
|
|
8192
|
-
|
|
8192
|
+
T.getElementsByTagName("rect")[0].setAttribute("x", E - 50), T.getElementsByTagName("rect")[0].setAttribute("y", k - 12.5), T.getElementsByTagName("text")[0].setAttribute("x", E), T.getElementsByTagName("text")[0].setAttribute("y", k + 4), T.getElementsByTagName("text")[0].innerHTML = p.text, T.style.top = "0px", T.style.left = "0px";
|
|
8193
8193
|
}
|
|
8194
8194
|
function w(p) {
|
|
8195
8195
|
if (p.container == null) {
|
|
@@ -8214,21 +8214,21 @@ class Ie {
|
|
|
8214
8214
|
return;
|
|
8215
8215
|
}
|
|
8216
8216
|
n(p, !0), x.style.top = "0px", x.style.left = "0px";
|
|
8217
|
-
let
|
|
8218
|
-
|
|
8217
|
+
let T = x.getElementsByTagName("circle")[0];
|
|
8218
|
+
T && (T.setAttribute("cx", C.x), T.setAttribute("cy", C.y));
|
|
8219
8219
|
let E = x.getElementsByTagName("rect"), k = x.getElementsByTagName("text"), B = -55;
|
|
8220
8220
|
E[0] && (E[0].setAttribute("x", C.x + 10), E[0].setAttribute("y", C.y + 10 + B)), k[0] && (k[0].setAttribute("x", C.x + 10 + 50), k[0].setAttribute("y", C.y + 10 + 16 + B)), E[1] && (E[1].setAttribute("x", C.x + 10), E[1].setAttribute("y", C.y + 10 + 30 + B)), k[1] && (k[1].setAttribute("x", C.x + 10 + 50), k[1].setAttribute("y", C.y + 10 + 46 + B)), E[2] && (E[2].setAttribute("x", C.x + 10), E[2].setAttribute("y", C.y + 10 + 60 + B)), k[2] && (k[2].setAttribute("x", C.x + 10 + 50), k[2].setAttribute("y", C.y + 10 + 76 + B)), k[0] && (k[0].innerHTML = "X: " + e.getMeasureText(p.textX, 1)), k[1] && (k[1].innerHTML = "Y: " + e.getMeasureText(-p.textZ, 1)), k[2] && (k[2].innerHTML = "Z: " + e.getMeasureText(p.textY, 1));
|
|
8221
8221
|
}
|
|
8222
|
-
function
|
|
8222
|
+
function M(p) {
|
|
8223
8223
|
if (p.container == null) {
|
|
8224
|
-
let
|
|
8224
|
+
let T = [
|
|
8225
8225
|
'<svg width="100" height="50" class="measureSvg">',
|
|
8226
8226
|
'<rect x="0" y="0" width="100" height="25" class="measureBack" />',
|
|
8227
8227
|
'<text x="50" y="16" text-anchor="middle" class="measureLabel"> ' + e.getMeasureText(p.text, 1) + "</text>",
|
|
8228
8228
|
'<polyline class="measureLine" stroke-width="2" points="80,32 0,32 16,48 32,32" style="fill: none; opacity: 1;"/>',
|
|
8229
8229
|
"</svg>"
|
|
8230
8230
|
].join("");
|
|
8231
|
-
p.container = document.createElement("div"), p.container.className = "elevation-annotation", p.container.id = p.id, p.container.style.position = "absolute", p.container.style.pointerEvents = "none", p.container.innerHTML =
|
|
8231
|
+
p.container = document.createElement("div"), p.container.className = "elevation-annotation", p.container.id = p.id, p.container.style.position = "absolute", p.container.style.pointerEvents = "none", p.container.innerHTML = T, e.engine.measure.annotationContainer.appendChild(p.container), p.container.getElementsByTagName("svg")[0].addEventListener("click", function() {
|
|
8232
8232
|
e.clearHighlight(), p.container.getElementsByTagName("svg")[0].classList.add("Hight"), p.highlight = !0, e.engine.events.trigger(ee.MeasureClick, p);
|
|
8233
8233
|
}), p.isSelect && (p.container.getElementsByTagName("svg")[0].classList.add("Hight"), p.highlight = !0);
|
|
8234
8234
|
}
|
|
@@ -8260,12 +8260,12 @@ class Ie {
|
|
|
8260
8260
|
return;
|
|
8261
8261
|
} else
|
|
8262
8262
|
x.style.display = "block";
|
|
8263
|
-
let C = i(p.point1),
|
|
8264
|
-
if (C == null ||
|
|
8263
|
+
let C = i(p.point1), T = i(p.point2);
|
|
8264
|
+
if (C == null || T == null) {
|
|
8265
8265
|
n(p, !1);
|
|
8266
8266
|
return;
|
|
8267
8267
|
}
|
|
8268
|
-
n(p, !0), x.getElementsByTagName("polyline")[0].setAttribute("points", C.x + "," + C.y + " " +
|
|
8268
|
+
n(p, !0), x.getElementsByTagName("polyline")[0].setAttribute("points", C.x + "," + C.y + " " + T.x + "," + T.y), x.getElementsByTagName("circle")[0].setAttribute("cx", C.x), x.getElementsByTagName("circle")[0].setAttribute("cy", C.y), x.getElementsByTagName("circle")[1].setAttribute("cx", T.x), x.getElementsByTagName("circle")[1].setAttribute("cy", T.y), x.getElementsByTagName("rect")[0].setAttribute("x", C.x * 0.5 + T.x * 0.5 - 40), x.getElementsByTagName("rect")[0].setAttribute("y", C.y * 0.5 + T.y * 0.5 - 12.5), x.getElementsByTagName("text")[0].setAttribute("x", C.x * 0.5 + T.x * 0.5 + 50 - 40), x.getElementsByTagName("text")[0].setAttribute("y", C.y * 0.5 + T.y * 0.5 + 16 - 12.5), x.getElementsByTagName("text")[0].innerHTML = e.getMeasureText(p.text, 1), x.style.top = "0px", x.style.left = "0px";
|
|
8269
8269
|
}
|
|
8270
8270
|
}
|
|
8271
8271
|
}
|
|
@@ -9537,8 +9537,8 @@ class ma {
|
|
|
9537
9537
|
m.setAttribute("position", new rt(u, 3));
|
|
9538
9538
|
let w = this.meshs.find((p) => p.name === n + "Line");
|
|
9539
9539
|
w == null ? (w = new at(m, g), w.name = n + "Line", e.add(w), this.meshs.push(w)) : (w.geometry = m, w.material = g);
|
|
9540
|
-
const
|
|
9541
|
-
t.forEach((p) =>
|
|
9540
|
+
const M = new h();
|
|
9541
|
+
t.forEach((p) => M.add(p)), M.multiplyScalar(1 / t.length), this.updateFaceTransformControl(n, i, M, s);
|
|
9542
9542
|
const b = this.engine.sectionPlane.find((p) => p.name == n);
|
|
9543
9543
|
b && b.setFromNormalAndCoplanarPoint(i.clone().setLength(-1), o);
|
|
9544
9544
|
}
|
|
@@ -9761,13 +9761,13 @@ class ga {
|
|
|
9761
9761
|
);
|
|
9762
9762
|
this.center = o.clone();
|
|
9763
9763
|
const r = t?.clone() ?? o.clone().add(n.clone().multiplyScalar(e)), { tangent: l, bitangent: c } = this.getPlaneBasis(n), d = this.getBoxCorners(this.box), u = this.box.min.distanceTo(this.box.max), g = Math.max(u * 0.02, 0.01);
|
|
9764
|
-
let m = 1 / 0, w = -1 / 0,
|
|
9764
|
+
let m = 1 / 0, w = -1 / 0, M = 1 / 0, b = -1 / 0;
|
|
9765
9765
|
d.forEach((E) => {
|
|
9766
9766
|
const k = E.clone().sub(r), B = k.dot(l), I = k.dot(c);
|
|
9767
|
-
m = Math.min(m, B), w = Math.max(w, B),
|
|
9768
|
-
}), m -= g, w += g,
|
|
9769
|
-
const p = r.clone().add(l.clone().multiplyScalar(m)).add(c.clone().multiplyScalar(
|
|
9770
|
-
this.current_center = r.clone(), this.createFace(i, [p, x, C,
|
|
9767
|
+
m = Math.min(m, B), w = Math.max(w, B), M = Math.min(M, I), b = Math.max(b, I);
|
|
9768
|
+
}), m -= g, w += g, M -= g, b += g;
|
|
9769
|
+
const p = r.clone().add(l.clone().multiplyScalar(m)).add(c.clone().multiplyScalar(M)), x = r.clone().add(l.clone().multiplyScalar(w)).add(c.clone().multiplyScalar(M)), C = r.clone().add(l.clone().multiplyScalar(w)).add(c.clone().multiplyScalar(b)), T = r.clone().add(l.clone().multiplyScalar(m)).add(c.clone().multiplyScalar(b));
|
|
9770
|
+
this.current_center = r.clone(), this.createFace(i, [p, x, C, T], n, "face"), this.updateTransformControl(s), this.updateRotateControl(s);
|
|
9771
9771
|
}
|
|
9772
9772
|
createFace(e, t, i, n) {
|
|
9773
9773
|
const s = new we(), o = new Float32Array([
|
|
@@ -9785,15 +9785,15 @@ class ga {
|
|
|
9785
9785
|
t[3].z
|
|
9786
9786
|
]), r = this.getEffectiveNormal(i), l = this.getDirectionSign() === 1 ? [0, 1, 2, 0, 2, 3] : [0, 2, 1, 0, 3, 2];
|
|
9787
9787
|
s.setAttribute("position", new rt(o, 3)), s.setIndex(l), s.computeVertexNormals();
|
|
9788
|
-
let c = this.meshs.find((
|
|
9788
|
+
let c = this.meshs.find((M) => M.name == n);
|
|
9789
9789
|
if (c == null) {
|
|
9790
|
-
const
|
|
9790
|
+
const M = new ge({
|
|
9791
9791
|
color: 65280,
|
|
9792
9792
|
transparent: !0,
|
|
9793
9793
|
opacity: this.idleOpacity,
|
|
9794
9794
|
side: he
|
|
9795
9795
|
});
|
|
9796
|
-
|
|
9796
|
+
M.polygonOffset = !0, M.polygonOffsetFactor = 1, M.polygonOffsetUnits = 4, c = new O(s, M), c.name = n, e.add(c), this.meshs.push(c);
|
|
9797
9797
|
} else
|
|
9798
9798
|
c.geometry = s;
|
|
9799
9799
|
c.normal = r.clone();
|
|
@@ -9815,9 +9815,9 @@ class ga {
|
|
|
9815
9815
|
t[0].z
|
|
9816
9816
|
]), u = new ke({ color: 255 }), g = new we();
|
|
9817
9817
|
g.setAttribute("position", new rt(d, 3));
|
|
9818
|
-
let m = this.meshs.find((
|
|
9818
|
+
let m = this.meshs.find((M) => M.name == n + "Line");
|
|
9819
9819
|
m == null ? (m = new at(g, u), m.name = n + "Line", e.add(m), this.meshs.push(m)) : (m.geometry = g, m.material = u);
|
|
9820
|
-
const w = this.engine.sectionPlane.find((
|
|
9820
|
+
const w = this.engine.sectionPlane.find((M) => M.name == n);
|
|
9821
9821
|
w && this.current_center && w.setFromNormalAndCoplanarPoint(
|
|
9822
9822
|
r,
|
|
9823
9823
|
this.current_center
|
|
@@ -10213,8 +10213,8 @@ class ya {
|
|
|
10213
10213
|
if (s.length === 0)
|
|
10214
10214
|
return;
|
|
10215
10215
|
const o = i.min.distanceTo(i.max), r = o * 5, l = 0.1, c = this.createPlaneBrush(e, r, l), d = [];
|
|
10216
|
-
for (const
|
|
10217
|
-
const b = this.createWorldBrushFromMesh(
|
|
10216
|
+
for (const M of s.slice(0, this.maxCandidates)) {
|
|
10217
|
+
const b = this.createWorldBrushFromMesh(M);
|
|
10218
10218
|
if (b != null)
|
|
10219
10219
|
try {
|
|
10220
10220
|
const x = this.evaluator.evaluate(b, c, gs)?.geometry;
|
|
@@ -10230,7 +10230,7 @@ class ya {
|
|
|
10230
10230
|
if (c.geometry.dispose(), d.length === 0)
|
|
10231
10231
|
return;
|
|
10232
10232
|
const u = ot(d, !1);
|
|
10233
|
-
if (d.forEach((
|
|
10233
|
+
if (d.forEach((M) => M.dispose()), !u)
|
|
10234
10234
|
return;
|
|
10235
10235
|
this.applyPlanarUv(u, e);
|
|
10236
10236
|
const g = this.getFaceOffsetDistance(o), m = this.getFaceOffsetSign();
|
|
@@ -10406,15 +10406,15 @@ class ya {
|
|
|
10406
10406
|
const n = e.index ? e.toNonIndexed() : e.clone(), s = n.getAttribute("position");
|
|
10407
10407
|
if (!s || s.count < 3)
|
|
10408
10408
|
return n.dispose(), null;
|
|
10409
|
-
const o = t.normal.clone().normalize(), r = new h(), l = new h(), c = new h(), d = new h(), u = new h(), g = new h(), m = new h(), w = new h(),
|
|
10410
|
-
for (let
|
|
10411
|
-
if (d.fromBufferAttribute(s,
|
|
10409
|
+
const o = t.normal.clone().normalize(), r = new h(), l = new h(), c = new h(), d = new h(), u = new h(), g = new h(), m = new h(), w = new h(), M = new h(), b = Math.max(i * 0.35, 1e-4), p = Math.max(i * 0.7, 1e-4), x = [];
|
|
10410
|
+
for (let T = 0; T < s.count; T += 3) {
|
|
10411
|
+
if (d.fromBufferAttribute(s, T), u.fromBufferAttribute(s, T + 1), g.fromBufferAttribute(s, T + 2), l.subVectors(u, d), c.subVectors(g, d), r.crossVectors(l, c), r.lengthSq() < 1e-14 || (r.normalize(), Math.abs(r.dot(o)) < 0.9))
|
|
10412
10412
|
continue;
|
|
10413
10413
|
const E = t.distanceToPoint(d), k = t.distanceToPoint(u), B = t.distanceToPoint(g), I = Math.min(E, k, B);
|
|
10414
10414
|
if (Math.max(E, k, B) - I > b)
|
|
10415
10415
|
continue;
|
|
10416
10416
|
const $ = (E + k + B) / 3;
|
|
10417
|
-
Math.abs($) > p || $ < 0 || (m.copy(d).addScaledVector(o, -E), w.copy(u).addScaledVector(o, -k),
|
|
10417
|
+
Math.abs($) > p || $ < 0 || (m.copy(d).addScaledVector(o, -E), w.copy(u).addScaledVector(o, -k), M.copy(g).addScaledVector(o, -B), r.dot(o) <= 0 ? (x.push(m.x, m.y, m.z), x.push(w.x, w.y, w.z), x.push(M.x, M.y, M.z)) : (x.push(m.x, m.y, m.z), x.push(M.x, M.y, M.z), x.push(w.x, w.y, w.z)));
|
|
10418
10418
|
}
|
|
10419
10419
|
if (n.dispose(), x.length < 9)
|
|
10420
10420
|
return null;
|
|
@@ -10429,8 +10429,8 @@ class ya {
|
|
|
10429
10429
|
let l = 1 / 0, c = -1 / 0, d = 1 / 0, u = -1 / 0;
|
|
10430
10430
|
for (let w = 0; w < i.count; w++) {
|
|
10431
10431
|
o.fromBufferAttribute(i, w);
|
|
10432
|
-
const
|
|
10433
|
-
r[p] =
|
|
10432
|
+
const M = o.dot(n), b = o.dot(s), p = w * 2;
|
|
10433
|
+
r[p] = M, r[p + 1] = b, l = Math.min(l, M), c = Math.max(c, M), d = Math.min(d, b), u = Math.max(u, b);
|
|
10434
10434
|
}
|
|
10435
10435
|
const g = Math.max(c - l, 1e-6), m = Math.max(u - d, 1e-6);
|
|
10436
10436
|
for (let w = 0; w < r.length; w += 2)
|
|
@@ -10445,7 +10445,7 @@ class ya {
|
|
|
10445
10445
|
return { tangent: l, bitangent: c };
|
|
10446
10446
|
}
|
|
10447
10447
|
}
|
|
10448
|
-
class
|
|
10448
|
+
class Ma {
|
|
10449
10449
|
engine;
|
|
10450
10450
|
clippingTolerance = 1e-4;
|
|
10451
10451
|
sectionBox;
|
|
@@ -10681,7 +10681,7 @@ class va {
|
|
|
10681
10681
|
});
|
|
10682
10682
|
}
|
|
10683
10683
|
}
|
|
10684
|
-
class
|
|
10684
|
+
class va {
|
|
10685
10685
|
engine;
|
|
10686
10686
|
constructor(e) {
|
|
10687
10687
|
this.engine = e;
|
|
@@ -10777,7 +10777,7 @@ class xa {
|
|
|
10777
10777
|
// 通过构件,属性名获取构件属性
|
|
10778
10778
|
getModelPropertiesWithName(e, t, i, n) {
|
|
10779
10779
|
let s = this.extended.get(e), o = this.engine.engineStatus.models.find((l) => l.url === e);
|
|
10780
|
-
o.properties == null ? (Dt(this.engine, e, e + "/property"),
|
|
10780
|
+
o.properties == null ? (Dt(this.engine, e, e + "/property"), Tt(
|
|
10781
10781
|
e + "/property",
|
|
10782
10782
|
(l) => {
|
|
10783
10783
|
let c = JSON.parse(l);
|
|
@@ -10802,7 +10802,7 @@ class xa {
|
|
|
10802
10802
|
// 查询构件属性
|
|
10803
10803
|
getModelProperties(e, t, i) {
|
|
10804
10804
|
let n = this.extended.get(e), s = this.engine.engineStatus.models.find((r) => r.url === e);
|
|
10805
|
-
s.properties == null && (Dt(this.engine, e, e + "/property"),
|
|
10805
|
+
s.properties == null && (Dt(this.engine, e, e + "/property"), Tt(
|
|
10806
10806
|
e + "/property",
|
|
10807
10807
|
(r) => {
|
|
10808
10808
|
let l = JSON.parse(r);
|
|
@@ -10818,13 +10818,13 @@ class xa {
|
|
|
10818
10818
|
let d = [], u = r.models[l];
|
|
10819
10819
|
u == null && (u = r.models[l.toString() || ""]);
|
|
10820
10820
|
let g = u.map((w) => w[0]);
|
|
10821
|
-
g = g.filter((w,
|
|
10822
|
-
let
|
|
10821
|
+
g = g.filter((w, M) => g.indexOf(w) === M), g.forEach((w) => {
|
|
10822
|
+
let M = {
|
|
10823
10823
|
name: r.categorys[w],
|
|
10824
10824
|
children: []
|
|
10825
10825
|
};
|
|
10826
|
-
d.push(
|
|
10827
|
-
|
|
10826
|
+
d.push(M), u.filter((b) => b[0] === w).forEach((b) => {
|
|
10827
|
+
M.children.push({
|
|
10828
10828
|
name: r.names[b[1]],
|
|
10829
10829
|
value: r.values[b[2]]
|
|
10830
10830
|
});
|
|
@@ -10857,9 +10857,9 @@ class xa {
|
|
|
10857
10857
|
構造: 9,
|
|
10858
10858
|
分析性質: 10
|
|
10859
10859
|
};
|
|
10860
|
-
d.sort((w,
|
|
10860
|
+
d.sort((w, M) => {
|
|
10861
10861
|
const b = m[w.name] ?? 99;
|
|
10862
|
-
return (m[
|
|
10862
|
+
return (m[M.name] ?? 99) - b;
|
|
10863
10863
|
}), c?.({
|
|
10864
10864
|
properties: d,
|
|
10865
10865
|
materials: d
|
|
@@ -11544,7 +11544,7 @@ class Aa {
|
|
|
11544
11544
|
init() {
|
|
11545
11545
|
this.miniMapContainer = document.createElement("div"), this.miniMapContainer.style.position = "absolute", this.applyContainerPosition(), this.miniMapContainer.style.width = `${this.currentMapWidth}px`, this.miniMapContainer.style.height = `${this.currentMapHeight}px`, this.miniMapContainer.style.border = "2px solid rgba(255, 255, 255, 0.4)", this.miniMapContainer.style.borderRadius = "4px", this.miniMapContainer.style.overflow = "hidden", this.miniMapContainer.style.display = "none", this.miniMapContainer.style.pointerEvents = "auto", this.miniMapContainer.style.touchAction = "none", this.miniMapContainer.style.cursor = "crosshair", this.engine.container.appendChild(this.miniMapContainer), this.miniMapRenderer = new si({ alpha: !0, antialias: !1 }), this.miniMapRenderer.setSize(this.currentMapWidth, this.currentMapHeight), this.miniMapRenderer.setPixelRatio(window.devicePixelRatio), this.miniMapRenderer.setClearColor(1710638, 0.85), this.miniMapContainer.appendChild(this.miniMapRenderer.domElement);
|
|
11546
11546
|
const e = window.devicePixelRatio || 1;
|
|
11547
|
-
this.overlayCanvas = document.createElement("canvas"), this.overlayCanvas.width = this.currentMapWidth * e, this.overlayCanvas.height = this.currentMapHeight * e, this.overlayCanvas.style.position = "absolute", this.overlayCanvas.style.top = "0", this.overlayCanvas.style.left = "0", this.overlayCanvas.style.width = `${this.currentMapWidth}px`, this.overlayCanvas.style.height = `${this.currentMapHeight}px`, this.overlayCanvas.style.pointerEvents = "none", this.miniMapContainer.appendChild(this.overlayCanvas), this.overlayCtx = this.overlayCanvas.getContext("2d"), this.overlayCtx && this.overlayCtx.scale(e, e), this.initLevelSelectors(), this.initResizeHandle(), this.initSizeToggleButton(), this.miniMapCamera = new
|
|
11547
|
+
this.overlayCanvas = document.createElement("canvas"), this.overlayCanvas.width = this.currentMapWidth * e, this.overlayCanvas.height = this.currentMapHeight * e, this.overlayCanvas.style.position = "absolute", this.overlayCanvas.style.top = "0", this.overlayCanvas.style.left = "0", this.overlayCanvas.style.width = `${this.currentMapWidth}px`, this.overlayCanvas.style.height = `${this.currentMapHeight}px`, this.overlayCanvas.style.pointerEvents = "none", this.miniMapContainer.appendChild(this.overlayCanvas), this.overlayCtx = this.overlayCanvas.getContext("2d"), this.overlayCtx && this.overlayCtx.scale(e, e), this.initLevelSelectors(), this.initResizeHandle(), this.initSizeToggleButton(), this.miniMapCamera = new ve(
|
|
11548
11548
|
-this.currentHalfSize,
|
|
11549
11549
|
this.currentHalfSize,
|
|
11550
11550
|
this.currentHalfSize,
|
|
@@ -11856,8 +11856,8 @@ class Aa {
|
|
|
11856
11856
|
c > Math.PI && (c -= 2 * Math.PI), c < -Math.PI && (c += 2 * Math.PI);
|
|
11857
11857
|
const d = n.target ? Math.max(i.position.distanceTo(n.target), 1e-3) : 10, u = this.engine.controlModule?.firstPersonControls, g = this.getThirdPersonControl();
|
|
11858
11858
|
if (u?.enabled) {
|
|
11859
|
-
const
|
|
11860
|
-
i.quaternion.premultiply(b), i.up.copy(
|
|
11859
|
+
const M = new h(0, 1, 0), b = new De().setFromAxisAngle(M, -c);
|
|
11860
|
+
i.quaternion.premultiply(b), i.up.copy(M), i.updateMatrixWorld(!0);
|
|
11861
11861
|
const p = i.position.clone().add(i.getWorldDirection(new h()).multiplyScalar(d));
|
|
11862
11862
|
n.target?.copy(p), u.syncRotationStateFromCamera?.(), u.syncSharedTargetFromCamera?.();
|
|
11863
11863
|
return;
|
|
@@ -11881,8 +11881,8 @@ class Aa {
|
|
|
11881
11881
|
e.save(), e.translate(s, o), e.rotate(l);
|
|
11882
11882
|
const u = e.createRadialGradient(0, 0, 1, 0, 0, c);
|
|
11883
11883
|
u.addColorStop(0, "rgba(0, 230, 130, 0.9)"), u.addColorStop(1, "rgba(0, 230, 130, 0)");
|
|
11884
|
-
const g = -Math.sin(d) * c, m = -Math.cos(d) * c, w = Math.sin(d) * c,
|
|
11885
|
-
e.beginPath(), e.moveTo(0, 0), e.lineTo(g, m), e.lineTo(w,
|
|
11884
|
+
const g = -Math.sin(d) * c, m = -Math.cos(d) * c, w = Math.sin(d) * c, M = -Math.cos(d) * c;
|
|
11885
|
+
e.beginPath(), e.moveTo(0, 0), e.lineTo(g, m), e.lineTo(w, M), e.closePath(), e.fillStyle = u, e.fill(), e.fillStyle = "rgba(255, 255, 255, 0.95)", e.strokeStyle = "rgba(0, 200, 110, 0.9)", e.lineWidth = 1.5, e.beginPath(), e.arc(0, 0, 4, 0, Math.PI * 2), e.fill(), e.stroke(), e.restore();
|
|
11886
11886
|
}
|
|
11887
11887
|
show() {
|
|
11888
11888
|
this.isVisible = !0;
|
|
@@ -11925,7 +11925,7 @@ class Aa {
|
|
|
11925
11925
|
this.miniMapContainer && (this.miniMapContainer.removeEventListener("wheel", this.onWheel), this.miniMapContainer.removeEventListener("mousedown", this.onMouseDown), this.miniMapContainer.removeEventListener("mousemove", this.onMouseMove), this.miniMapContainer.removeEventListener("mouseup", this.onMouseUp), this.miniMapContainer.removeEventListener("pointerdown", this.onMouseDown), this.miniMapContainer.removeEventListener("pointermove", this.onMouseMove), this.miniMapContainer.removeEventListener("pointerup", this.onMouseUp), this.miniMapContainer.removeEventListener("pointercancel", this.onMouseUp), this.miniMapContainer.removeEventListener("mouseenter", this.onMouseEnter), this.miniMapContainer.removeEventListener("mouseleave", this.onMouseLeave)), window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("mouseup", this.onMouseUp), window.removeEventListener("pointermove", this.onMouseMove), window.removeEventListener("pointerup", this.onMouseUp), window.removeEventListener("pointercancel", this.onMouseUp), window.removeEventListener("resize", this.onWindowResize), this.sizeToggleButton?.removeEventListener("click", this.onSizeToggleClick), this.resizeHandle?.removeEventListener("mousedown", this.onResizeHandleMouseDown), this.resizeHandle?.removeEventListener("pointerdown", this.onResizeHandleMouseDown), this.modelSelect?.removeEventListener("change", this.onModelChange), this.levelSelect?.removeEventListener("change", this.onLevelChange), this.engine.events?.off?.(this.loadingCompletedEventName, this.onLoadingCompleted), this.miniMapRenderer && (this.miniMapRenderer.dispose(), this.miniMapRenderer = null), this.miniMapContainer && (this.miniMapContainer.remove(), this.miniMapContainer = null), this.miniMapCamera = null, this.overlayCtx = null, this.overlayCanvas = null, this.levelToolbar = null, this.sizeToggleButton = null, this.resizeHandle = null, this.modelSelect = null, this.levelSelect = null, this.levelModels = [], this.levelDataSignature = "", this.selectedModelUrl = null;
|
|
11926
11926
|
}
|
|
11927
11927
|
}
|
|
11928
|
-
class
|
|
11928
|
+
class Ta {
|
|
11929
11929
|
engine;
|
|
11930
11930
|
constructor(e) {
|
|
11931
11931
|
this.engine = e;
|
|
@@ -12136,7 +12136,7 @@ class _a {
|
|
|
12136
12136
|
const r = t ? this.toVector3(t) : i.clone().add(n), l = this.buildSafeUpDirection(n, s, o.up);
|
|
12137
12137
|
o.position.copy(i), o.up.copy(l), o.lookAt(r), o.updateMatrix(), o.updateMatrixWorld(!0);
|
|
12138
12138
|
const c = {
|
|
12139
|
-
type: this.engine.cameraModule?.getCameraType?.() ??
|
|
12139
|
+
type: this.engine.cameraModule?.getCameraType?.() ?? vt.PERSPECTIVE,
|
|
12140
12140
|
position: this.getPoint(i),
|
|
12141
12141
|
rotation: {
|
|
12142
12142
|
x: o.rotation.x,
|
|
@@ -12151,7 +12151,7 @@ class _a {
|
|
|
12151
12151
|
},
|
|
12152
12152
|
target: this.getPoint(r)
|
|
12153
12153
|
};
|
|
12154
|
-
o instanceof
|
|
12154
|
+
o instanceof ve && (c.zoom = o.zoom, c.orthographicHeight = this.engine.cameraModule.getOrthographicVisibleHeight(o)), this.restoreCameraPose(c), this.syncOrbitOrigin(c.target);
|
|
12155
12155
|
}
|
|
12156
12156
|
zoomToIssueModel(e, t) {
|
|
12157
12157
|
const i = this.resolveModelBox(e);
|
|
@@ -12199,7 +12199,7 @@ class _a {
|
|
|
12199
12199
|
if (!e || !e.position)
|
|
12200
12200
|
return null;
|
|
12201
12201
|
const i = this.engine.camera, n = {
|
|
12202
|
-
type: e.type ?? this.engine.cameraModule?.getCameraType?.() ??
|
|
12202
|
+
type: e.type ?? this.engine.cameraModule?.getCameraType?.() ?? vt.PERSPECTIVE,
|
|
12203
12203
|
position: e.position,
|
|
12204
12204
|
rotation: e.rotation ?? { x: 0, y: 0, z: 0 },
|
|
12205
12205
|
quaternion: e.quaternion ?? { x: 0, y: 0, z: 0, w: 1 },
|
|
@@ -12212,7 +12212,7 @@ class _a {
|
|
|
12212
12212
|
y: 0,
|
|
12213
12213
|
z: 0,
|
|
12214
12214
|
w: 1
|
|
12215
|
-
}), i instanceof
|
|
12215
|
+
}), i instanceof ve && n.type === vt.ORTHOGRAPHIC && (n.zoom = e.zoom ?? i.zoom, n.orthographicHeight = e.orthographicHeight ?? this.engine.cameraModule.getOrthographicVisibleHeight(i)), n;
|
|
12216
12216
|
}
|
|
12217
12217
|
buildSafeUpDirection(e, t, i) {
|
|
12218
12218
|
const n = t.lengthSq() > 0 ? t.clone() : i.clone().normalize();
|
|
@@ -12222,7 +12222,7 @@ class _a {
|
|
|
12222
12222
|
return Math.abs(s.dot(e)) < 0.999 ? s : new h(1, 0, 0);
|
|
12223
12223
|
}
|
|
12224
12224
|
}
|
|
12225
|
-
class
|
|
12225
|
+
class _a {
|
|
12226
12226
|
engine;
|
|
12227
12227
|
constructor(e) {
|
|
12228
12228
|
}
|
|
@@ -12553,14 +12553,14 @@ class ka {
|
|
|
12553
12553
|
}
|
|
12554
12554
|
// 打开视图
|
|
12555
12555
|
openView(e, t) {
|
|
12556
|
-
let i = this.engine.models.find((
|
|
12556
|
+
let i = this.engine.models.find((M) => M.url === e)?.views;
|
|
12557
12557
|
if (!i) return;
|
|
12558
12558
|
const s = [
|
|
12559
12559
|
...i.CeilingPlans ?? [],
|
|
12560
12560
|
...i.Elevations ?? [],
|
|
12561
12561
|
...i.FloorPlans ?? [],
|
|
12562
12562
|
...i.Sections ?? []
|
|
12563
|
-
].find((
|
|
12563
|
+
].find((M) => M.id === t || M.Id === t);
|
|
12564
12564
|
if (!s) return;
|
|
12565
12565
|
let o = { X: 0, Y: 0, Z: 0 }, r = 1, l = 1, c = null;
|
|
12566
12566
|
s.ViewType == "天花平面" ? (o = { X: 0, Y: 0, Z: s.Evevation }, l = -1, r = -1, c = new h(0, 0, 1)) : s.ViewType == "楼层平面" ? (o = { X: 0, Y: 0, Z: s.Evevation }, r = -1, l = -1, c = new h(0, 0, -1)) : s.ViewType == "立面视图" ? (o = s.Origin || s.origin, l = 1) : s.ViewType == "剖面视图" && (o = s.Origin || s.origin, r = -1, l = -1);
|
|
@@ -12577,11 +12577,11 @@ class ka {
|
|
|
12577
12577
|
const i = this.toRevitVector(e.Min || e.min), n = this.toRevitVector(e.Max || e.max), s = e.Transform || e.transform, o = this.toRevitVector(s?.Origin || s?.origin), r = this.toRevitVector(s?.BasisX || s?.basisX), l = this.toRevitVector(s?.BasisY || s?.basisY), c = this.toRevitVector(s?.BasisZ || s?.basisZ);
|
|
12578
12578
|
if (!i || !n || !o || !r || !l || !c)
|
|
12579
12579
|
return null;
|
|
12580
|
-
const d = this.toEnginePoint(o), u = t.clone().sub(d), g = this.shouldCorrectViewRangeOrigin(u) ? u : new h(), m = (
|
|
12581
|
-
const b = o.clone().add(r.clone().multiplyScalar(
|
|
12580
|
+
const d = this.toEnginePoint(o), u = t.clone().sub(d), g = this.shouldCorrectViewRangeOrigin(u) ? u : new h(), m = (M) => {
|
|
12581
|
+
const b = o.clone().add(r.clone().multiplyScalar(M.x)).add(l.clone().multiplyScalar(M.y)).add(c.clone().multiplyScalar(M.z));
|
|
12582
12582
|
return this.toEnginePoint(b).add(g);
|
|
12583
|
-
}, w = (
|
|
12584
|
-
const b = r.clone().multiplyScalar(
|
|
12583
|
+
}, w = (M) => {
|
|
12584
|
+
const b = r.clone().multiplyScalar(M.x).add(l.clone().multiplyScalar(M.y)).add(c.clone().multiplyScalar(M.z));
|
|
12585
12585
|
return this.toEngineDirection(b).normalize();
|
|
12586
12586
|
};
|
|
12587
12587
|
return [
|
|
@@ -12760,8 +12760,8 @@ class Xa {
|
|
|
12760
12760
|
{ type: "text", label: "文字" },
|
|
12761
12761
|
{ type: "cloudline", label: "云线" }
|
|
12762
12762
|
].forEach((w) => {
|
|
12763
|
-
const
|
|
12764
|
-
|
|
12763
|
+
const M = this.createIconButton(w.label, Va[w.type]);
|
|
12764
|
+
M.onclick = () => this.handlers.onDrawTypeChange(w.type), this.drawButtons[w.type] = M, i.appendChild(M);
|
|
12765
12765
|
});
|
|
12766
12766
|
const s = document.createElement("div");
|
|
12767
12767
|
s.style.position = "relative", s.style.display = "flex", s.style.alignItems = "center", this.colorTrigger = document.createElement("button"), this.colorTrigger.type = "button", this.colorTrigger.title = "颜色", this.colorTrigger.style.width = "32px", this.colorTrigger.style.height = "24px", this.colorTrigger.style.padding = "2px", this.colorTrigger.style.border = "1px solid #d9d9d9", this.colorTrigger.style.borderRadius = "4px", this.colorTrigger.style.background = "#ffffff", this.colorTrigger.style.cursor = "pointer", this.colorTrigger.style.display = "flex", this.colorTrigger.style.alignItems = "center", this.colorTrigger.style.justifyContent = "center", this.colorTrigger.onclick = () => this.setColorPresetVisible(!this.isColorPresetOpen);
|
|
@@ -12771,10 +12771,10 @@ class Xa {
|
|
|
12771
12771
|
}, s.appendChild(this.colorInput), this.colorPresetPanel = document.createElement("div"), this.colorPresetPanel.style.position = "absolute", this.colorPresetPanel.style.top = "30px", this.colorPresetPanel.style.left = "0", this.colorPresetPanel.style.display = "none", this.colorPresetPanel.style.padding = "8px", this.colorPresetPanel.style.background = "#ffffff", this.colorPresetPanel.style.border = "1px solid #d9d9d9", this.colorPresetPanel.style.borderRadius = "6px", this.colorPresetPanel.style.boxShadow = "0 6px 18px rgba(0, 0, 0, 0.14)", this.colorPresetPanel.style.zIndex = "20", this.colorPresetPanel.style.width = "152px";
|
|
12772
12772
|
const r = document.createElement("div");
|
|
12773
12773
|
r.style.display = "grid", r.style.gridTemplateColumns = "repeat(5, 1fr)", r.style.gap = "6px", Ha.forEach((w) => {
|
|
12774
|
-
const
|
|
12775
|
-
|
|
12774
|
+
const M = document.createElement("button");
|
|
12775
|
+
M.type = "button", M.title = w, M.style.width = "22px", M.style.height = "22px", M.style.padding = "0", M.style.border = "1px solid #d9d9d9", M.style.borderRadius = "4px", M.style.background = w, M.style.cursor = "pointer", M.onclick = () => {
|
|
12776
12776
|
this.updateColorControl(w), this.handlers.onColorChange(w), this.setColorPresetVisible(!1);
|
|
12777
|
-
}, r.appendChild(
|
|
12777
|
+
}, r.appendChild(M);
|
|
12778
12778
|
}), this.colorPresetPanel.appendChild(r);
|
|
12779
12779
|
const l = document.createElement("button");
|
|
12780
12780
|
l.type = "button", l.textContent = "自定义", l.style.marginTop = "8px", l.style.width = "100%", l.style.height = "26px", l.style.border = "1px solid #d9d9d9", l.style.borderRadius = "4px", l.style.background = "#ffffff", l.style.color = "#333333", l.style.cursor = "pointer", l.onclick = () => this.openNativeColorPicker(), this.colorPresetPanel.appendChild(l), s.appendChild(this.colorPresetPanel), this.updateColorControl(t.stroke), i.appendChild(this.createField("", s)), this.strokeWidthInput = document.createElement("input"), this.strokeWidthInput.type = "number", this.strokeWidthInput.min = "1", this.strokeWidthInput.max = "20", this.strokeWidthInput.step = "1", this.strokeWidthInput.value = String(t.strokeWidth), this.strokeWidthInput.style.width = "46px", this.strokeWidthInput.oninput = () => this.handlers.onStrokeWidthChange(this.strokeWidthInput.value), i.appendChild(this.createField("", this.strokeWidthInput, Wa, "线宽")), this.fontSizeInput = document.createElement("input"), this.fontSizeInput.type = "number", this.fontSizeInput.min = "10", this.fontSizeInput.max = "96", this.fontSizeInput.step = "1", this.fontSizeInput.value = String(t.fontSize), this.fontSizeInput.style.width = "46px", this.fontSizeInput.oninput = () => this.handlers.onFontSizeChange(this.fontSizeInput.value), i.appendChild(this.createField("", this.fontSizeInput, qa, "字号")), this.distanceButton = this.createIconButton("测量", Ua), this.distanceButton.onclick = () => this.handlers.onMeasureToggle(), i.appendChild(this.distanceButton);
|
|
@@ -12786,8 +12786,8 @@ class Xa {
|
|
|
12786
12786
|
u.onclick = () => this.handlers.onCancel(), u.style.background = "#ff4d4f", u.style.borderColor = "#ff4d4f", u.style.color = "#ffffff", i.appendChild(u);
|
|
12787
12787
|
const g = this.createTextButton("✔", "确定");
|
|
12788
12788
|
g.onclick = () => this.handlers.onConfirm(), g.style.background = "#52c41a", g.style.borderColor = "#52c41a", g.style.color = "#ffffff", i.appendChild(g), this.measureSubPanel = document.createElement("div"), this.measureSubPanel.style.display = "none", this.measureSubPanel.style.alignItems = "center", this.measureSubPanel.style.gap = "6px", this.measureSubPanel.style.flexWrap = "wrap", this.measureSubPanel.style.paddingTop = "2px", Ka.forEach((w) => {
|
|
12789
|
-
const
|
|
12790
|
-
|
|
12789
|
+
const M = this.createSmallIconButton(w.label, Ya[w.type]);
|
|
12790
|
+
M.onclick = () => this.handlers.onMeasureTypeChange(w.type), this.measureTypeButtons[w.type] = M, this.measureSubPanel.appendChild(M);
|
|
12791
12791
|
}), this.editPanel.appendChild(i), this.editPanel.appendChild(this.measureSubPanel);
|
|
12792
12792
|
const m = this.createTextButton("关闭", "关闭");
|
|
12793
12793
|
m.onclick = () => this.handlers.onClose(), this.viewPanel.appendChild(m), this.root.appendChild(this.editPanel), this.root.appendChild(this.viewPanel), this.disabledMask = document.createElement("div"), this.disabledMask.style.position = "absolute", this.disabledMask.style.inset = "0", this.disabledMask.style.display = "none", this.disabledMask.style.background = "rgba(255, 255, 255, 0.55)", this.disabledMask.style.backdropFilter = "blur(1px)", this.disabledMask.style.cursor = "not-allowed", this.disabledMask.style.pointerEvents = "auto", this.disabledMask.style.zIndex = "10", this.root.appendChild(this.disabledMask), document.addEventListener("pointerdown", this.onDocumentPointerDown), this.setMode("edit");
|
|
@@ -13305,7 +13305,7 @@ class $a {
|
|
|
13305
13305
|
});
|
|
13306
13306
|
return V.annotationType = "arrow", V;
|
|
13307
13307
|
}
|
|
13308
|
-
const l = s / r, c = o / r, d = -c, u = l, g = Math.max(10, i.strokeWidth * 6), m = g * 0.72, w = t.x - l * g,
|
|
13308
|
+
const l = s / r, c = o / r, d = -c, u = l, g = Math.max(10, i.strokeWidth * 6), m = g * 0.72, w = t.x - l * g, M = t.y - c * g, b = w + d * (m * 0.5), p = M + u * (m * 0.5), x = w - d * (m * 0.5), C = M - u * (m * 0.5), T = new Bt([e.x, e.y, t.x, t.y], {
|
|
13309
13309
|
stroke: i.stroke,
|
|
13310
13310
|
strokeWidth: i.strokeWidth,
|
|
13311
13311
|
fill: "",
|
|
@@ -13319,7 +13319,7 @@ class $a {
|
|
|
13319
13319
|
selectable: !1,
|
|
13320
13320
|
evented: !1,
|
|
13321
13321
|
objectCaching: !1
|
|
13322
|
-
}), B = new Si([
|
|
13322
|
+
}), B = new Si([T, k], {
|
|
13323
13323
|
selectable: n,
|
|
13324
13324
|
evented: n,
|
|
13325
13325
|
objectCaching: !1
|
|
@@ -13368,9 +13368,9 @@ class $a {
|
|
|
13368
13368
|
const l = e[r - 1], c = e[r], d = c.x - l.x, u = c.y - l.y, g = Math.sqrt(d * d + u * u);
|
|
13369
13369
|
if (g < 0.1)
|
|
13370
13370
|
continue;
|
|
13371
|
-
const m = -u / g, w = d / g,
|
|
13372
|
-
for (let b = 1; b <=
|
|
13373
|
-
const p = b /
|
|
13371
|
+
const m = -u / g, w = d / g, M = Math.max(1, Math.round(g / n));
|
|
13372
|
+
for (let b = 1; b <= M; b++) {
|
|
13373
|
+
const p = b / M, x = l.x + d * p, C = l.y + u * p, T = o % 2 === 0 ? -1 : 1, E = x + m * i * T, k = C + w * i * T;
|
|
13374
13374
|
s += ` Q ${E} ${k} ${x} ${C}`, o++;
|
|
13375
13375
|
}
|
|
13376
13376
|
}
|
|
@@ -14289,7 +14289,7 @@ class el {
|
|
|
14289
14289
|
worldToScreen;
|
|
14290
14290
|
raycaster = new ae();
|
|
14291
14291
|
constructor(e) {
|
|
14292
|
-
this.engine = e, this.worldToScreen = new oe(e.camera, e.renderer, e.scene), this.manager = new
|
|
14292
|
+
this.engine = e, this.worldToScreen = new oe(e.camera, e.renderer, e.scene), this.manager = new _s({
|
|
14293
14293
|
container: e.container,
|
|
14294
14294
|
className: "bim-engine-label-container bim-engine-label-container-3d",
|
|
14295
14295
|
projectCoordinate: (t) => this.projectCoordinate(t),
|
|
@@ -14354,12 +14354,12 @@ class el {
|
|
|
14354
14354
|
function wt(a) {
|
|
14355
14355
|
return a.map((e) => ({ x: e.x, y: e.y, z: e.z }));
|
|
14356
14356
|
}
|
|
14357
|
-
function
|
|
14357
|
+
function Me(a) {
|
|
14358
14358
|
return new h(a.x, a.y, a.z);
|
|
14359
14359
|
}
|
|
14360
14360
|
function yt(a) {
|
|
14361
14361
|
const e = new h();
|
|
14362
|
-
return a.length === 0 ? e : (a.forEach((t) => e.add(
|
|
14362
|
+
return a.length === 0 ? e : (a.forEach((t) => e.add(Me(t))), e.multiplyScalar(1 / a.length));
|
|
14363
14363
|
}
|
|
14364
14364
|
function tl(a) {
|
|
14365
14365
|
const e = new h();
|
|
@@ -14370,7 +14370,7 @@ function tl(a) {
|
|
|
14370
14370
|
return e.normalize();
|
|
14371
14371
|
}
|
|
14372
14372
|
function Qi(a) {
|
|
14373
|
-
const e = a.map((c) =>
|
|
14373
|
+
const e = a.map((c) => Me(c)), t = e[0].clone(), i = e.length > 1 ? e[1].clone().sub(t).normalize() : new h(1, 0, 0);
|
|
14374
14374
|
let n = tl(e);
|
|
14375
14375
|
n.lengthSq() < 1e-8 && (n = new h(0, 1, 0));
|
|
14376
14376
|
const s = new h().crossVectors(n, i).normalize(), o = new h().crossVectors(s, n).normalize(), r = e.map((c) => {
|
|
@@ -14443,7 +14443,7 @@ class rl {
|
|
|
14443
14443
|
}
|
|
14444
14444
|
/** 点位支持图标、底环、波纹、光柱等常用告警标记效果。 */
|
|
14445
14445
|
buildPoint(e) {
|
|
14446
|
-
const t =
|
|
14446
|
+
const t = Me(e.instance.points[0]), i = e.instance.style, n = e.instance.effect, s = i.point ?? {};
|
|
14447
14447
|
if (e.instance.root.position.copy(t), s.icon) {
|
|
14448
14448
|
const r = new un({
|
|
14449
14449
|
map: this.textureLoader.load(s.icon),
|
|
@@ -14514,9 +14514,9 @@ class rl {
|
|
|
14514
14514
|
}
|
|
14515
14515
|
/** 线标记用 TubeGeometry 拉出体积,便于承载渐变和流动特效。 */
|
|
14516
14516
|
buildPolyline(e) {
|
|
14517
|
-
const t = e.instance.points.map((c) =>
|
|
14517
|
+
const t = e.instance.points.map((c) => Me(c)), i = new Ms();
|
|
14518
14518
|
for (let c = 0; c < t.length - 1; c += 1)
|
|
14519
|
-
i.add(new
|
|
14519
|
+
i.add(new vs(t[c], t[c + 1]));
|
|
14520
14520
|
const n = Math.max(e.instance.style.lineWidth ?? 0.18, 0.02), s = new ws(i, Math.max(32, t.length * 14), n, 10, !1);
|
|
14521
14521
|
s.computeBoundingBox();
|
|
14522
14522
|
const o = s.boundingBox ?? new Y(new h(0, 0, 0), new h(1, 1, 1)), r = this.materialFactory.createSurfaceMaterial({
|
|
@@ -14583,7 +14583,7 @@ class rl {
|
|
|
14583
14583
|
buildBox(e) {
|
|
14584
14584
|
if (e.instance.points.length < 2)
|
|
14585
14585
|
return;
|
|
14586
|
-
const t =
|
|
14586
|
+
const t = Me(e.instance.points[0]), i = Me(e.instance.points[1]), n = t.clone().min(i), s = t.clone().max(i), o = s.clone().sub(n), r = n.clone().add(s).multiplyScalar(0.5), l = new Ct(o.x || 0.1, o.y || 0.1, o.z || 0.1);
|
|
14587
14587
|
l.computeBoundingBox();
|
|
14588
14588
|
const c = l.boundingBox ?? new Y(
|
|
14589
14589
|
new h(-0.5, -0.5, -0.5),
|
|
@@ -14615,7 +14615,7 @@ class rl {
|
|
|
14615
14615
|
const i = e.instance.effect.layers.count ?? 3, n = e.instance.effect.layers.offsetY ?? 3;
|
|
14616
14616
|
for (let s = 1; s <= i; s += 1) {
|
|
14617
14617
|
const o = e.instance.points.map((l) => {
|
|
14618
|
-
const c =
|
|
14618
|
+
const c = Me(l).add(t.clone().multiplyScalar(n * s));
|
|
14619
14619
|
return { x: c.x, y: c.y, z: c.z };
|
|
14620
14620
|
}), r = this.createLoopLine(
|
|
14621
14621
|
o,
|
|
@@ -14627,7 +14627,7 @@ class rl {
|
|
|
14627
14627
|
}
|
|
14628
14628
|
/** 闭合轮廓线用于面边框、围栏层线以及体外框。 */
|
|
14629
14629
|
createLoopLine(e, t, i) {
|
|
14630
|
-
const n = new we().setFromPoints(e.map((r) =>
|
|
14630
|
+
const n = new we().setFromPoints(e.map((r) => Me(r))), s = new ke({
|
|
14631
14631
|
color: t,
|
|
14632
14632
|
transparent: !0,
|
|
14633
14633
|
opacity: 0.94,
|
|
@@ -14679,7 +14679,7 @@ class al {
|
|
|
14679
14679
|
if (this.engine.camera instanceof st) {
|
|
14680
14680
|
const r = this.engine.camera.position.distanceTo(s), l = R.degToRad(this.engine.camera.fov);
|
|
14681
14681
|
o = 2 * Math.tan(l * 0.5) * r / Math.max(n.clientHeight, 1) * i;
|
|
14682
|
-
} else this.engine.camera instanceof
|
|
14682
|
+
} else this.engine.camera instanceof ve && (o = Math.abs(this.engine.camera.top - this.engine.camera.bottom) / Math.max(this.engine.camera.zoom, 1e-6) / Math.max(n.clientHeight, 1) * i);
|
|
14683
14683
|
t.scale.set(o, o, 1);
|
|
14684
14684
|
}
|
|
14685
14685
|
}
|
|
@@ -15119,15 +15119,15 @@ class pl {
|
|
|
15119
15119
|
const t = e.instance.panel?.anchor ?? ol(e.instance.type), i = e.instance.panel?.offset ?? {};
|
|
15120
15120
|
let n = new h();
|
|
15121
15121
|
if (e.instance.type === "point")
|
|
15122
|
-
n.copy(
|
|
15122
|
+
n.copy(Me(e.instance.points[0])), t === "top" && (n.y += e.volumeHeight ?? e.instance.style.point?.anchorY ?? 0);
|
|
15123
15123
|
else if (e.instance.type === "polyline")
|
|
15124
|
-
t === "start" ? n.copy(
|
|
15124
|
+
t === "start" ? n.copy(Me(e.instance.points[0])) : t === "end" ? n.copy(Me(e.instance.points[e.instance.points.length - 1])) : e.anchorCurve ? n.copy(e.anchorCurve.getPoint(0.5)) : n.copy(yt(e.instance.points));
|
|
15125
15125
|
else if (e.instance.type === "polygon")
|
|
15126
15126
|
n.copy(yt(e.instance.points));
|
|
15127
15127
|
else if (e.instance.type === "extrudePolygon")
|
|
15128
15128
|
n.copy(yt(e.instance.points)), t === "top" && e.anchorNormal && n.add(e.anchorNormal.clone().multiplyScalar(e.volumeHeight ?? 0));
|
|
15129
15129
|
else if (e.instance.type === "box" && (n.copy(yt(e.instance.points)), t === "top" && e.instance.points.length >= 2)) {
|
|
15130
|
-
const s =
|
|
15130
|
+
const s = Me(e.instance.points[0]), o = Me(e.instance.points[1]);
|
|
15131
15131
|
n.y = Math.max(s.y, o.y);
|
|
15132
15132
|
}
|
|
15133
15133
|
return n.add(new h(i.x ?? 0, i.y ?? 0, i.z ?? 0)), n;
|
|
@@ -15259,13 +15259,13 @@ function fl(a) {
|
|
|
15259
15259
|
points: wt(a.instance.points),
|
|
15260
15260
|
visible: a.instance.visible,
|
|
15261
15261
|
selectable: a.instance.selectable,
|
|
15262
|
-
style:
|
|
15263
|
-
effect:
|
|
15264
|
-
panel: a.instance.panel ?
|
|
15265
|
-
data:
|
|
15262
|
+
style: Mt(a.instance.style),
|
|
15263
|
+
effect: Mt(a.instance.effect),
|
|
15264
|
+
panel: a.instance.panel ? Mt(a.instance.panel) : void 0,
|
|
15265
|
+
data: Mt(a.instance.data)
|
|
15266
15266
|
};
|
|
15267
15267
|
}
|
|
15268
|
-
function
|
|
15268
|
+
function Mt(a) {
|
|
15269
15269
|
return a === void 0 ? a : JSON.parse(JSON.stringify(a));
|
|
15270
15270
|
}
|
|
15271
15271
|
class yl {
|
|
@@ -15458,7 +15458,7 @@ class yl {
|
|
|
15458
15458
|
this.engine.events?.trigger?.(e, t);
|
|
15459
15459
|
}
|
|
15460
15460
|
}
|
|
15461
|
-
class
|
|
15461
|
+
class Ml {
|
|
15462
15462
|
constructor(e) {
|
|
15463
15463
|
this.engine = e;
|
|
15464
15464
|
}
|
|
@@ -15579,7 +15579,8 @@ class vl {
|
|
|
15579
15579
|
return "x" in e ? new h(e.x, e.y, e.z) : new h(e.X, e.Y, e.Z);
|
|
15580
15580
|
}
|
|
15581
15581
|
}
|
|
15582
|
-
|
|
15582
|
+
const vl = 1e-3, wl = 0.65, xl = 1;
|
|
15583
|
+
class bl {
|
|
15583
15584
|
engine;
|
|
15584
15585
|
loader = new ri();
|
|
15585
15586
|
modelList = /* @__PURE__ */ new Map();
|
|
@@ -15587,9 +15588,11 @@ class Ml {
|
|
|
15587
15588
|
transformControl = null;
|
|
15588
15589
|
transformHelper = null;
|
|
15589
15590
|
selectedModelId = null;
|
|
15591
|
+
copiedModelData = null;
|
|
15590
15592
|
editingEnabled = !1;
|
|
15591
15593
|
isRestoring = !1;
|
|
15592
15594
|
isUndoing = !1;
|
|
15595
|
+
isPasting = !1;
|
|
15593
15596
|
pendingModelIds = /* @__PURE__ */ new Set();
|
|
15594
15597
|
bimHighlightDisabledBeforeEditing = null;
|
|
15595
15598
|
selectionPointerDown = null;
|
|
@@ -15603,6 +15606,10 @@ class Ml {
|
|
|
15603
15606
|
dispose() {
|
|
15604
15607
|
this.engine.renderer?.domElement?.removeEventListener("pointerdown", this.onPointerDown), this.engine.renderer?.domElement?.removeEventListener("pointerup", this.onPointerUp), window.removeEventListener("keydown", this.onKeyDown), this.transformControl?.detach(), this.transformHelper?.parent?.remove(this.transformHelper), this.modelList.forEach((e) => this.removeObject(e.object)), this.modelList.clear(), this.modelTransforms.length = 0, this.disableModelEditing();
|
|
15605
15608
|
}
|
|
15609
|
+
/** 每帧同步相机切换后的控制柄相机与尺寸,避免透视模式仍按正交投影显示。 */
|
|
15610
|
+
update() {
|
|
15611
|
+
this.syncTransformControlCamera();
|
|
15612
|
+
}
|
|
15606
15613
|
/**
|
|
15607
15614
|
* 加载 GLB 并放入场景。未指定 position 时,调用方需在开启捕捉的视图中单击确认落点。
|
|
15608
15615
|
*/
|
|
@@ -15615,25 +15622,34 @@ class Ml {
|
|
|
15615
15622
|
this.pendingModelIds.add(t);
|
|
15616
15623
|
try {
|
|
15617
15624
|
if (e.position) {
|
|
15618
|
-
const
|
|
15619
|
-
return this.saveHistory(), await this.loadRecord(
|
|
15620
|
-
}
|
|
15621
|
-
this.enableModelEditing(), this.clearSelection();
|
|
15622
|
-
const i = await this.createRecord(this.normalizeData({ ...e, id: t, position: [0, 0, 0], materials: [] }));
|
|
15623
|
-
i.object.visible = !1, this.engine.scene?.add(i.object);
|
|
15624
|
-
try {
|
|
15625
|
-
const n = await this.pickPlacementPoint((s) => {
|
|
15626
|
-
i.object.visible = s != null, s && i.object.position.copy(s), this.requestRender();
|
|
15627
|
-
});
|
|
15628
|
-
i.data.position = n, i.object.position.fromArray(n), i.object.visible = !0, this.saveHistory(), this.addRecord(i);
|
|
15629
|
-
} catch (n) {
|
|
15630
|
-
throw this.removeObject(i.object), n;
|
|
15625
|
+
const i = this.normalizeData({ ...e, id: t, materials: [] });
|
|
15626
|
+
return this.saveHistory(), await this.loadRecord(i), this.editModel(t), this.cloneData(i);
|
|
15631
15627
|
}
|
|
15632
|
-
return this.
|
|
15628
|
+
return await this.placePreparedModel(this.normalizeData({ ...e, id: t, position: [0, 0, 0], materials: [] }));
|
|
15633
15629
|
} finally {
|
|
15634
15630
|
this.pendingModelIds.delete(t);
|
|
15635
15631
|
}
|
|
15636
15632
|
}
|
|
15633
|
+
/** 以预览方式放置已准备好的模型数据;预览未确认前不会写入模型列表或历史。 */
|
|
15634
|
+
async placePreparedModel(e) {
|
|
15635
|
+
this.enableModelEditing(), this.clearSelection();
|
|
15636
|
+
const t = await this.createRecord(e);
|
|
15637
|
+
t.object.visible = !1, this.engine.scene?.add(t.object);
|
|
15638
|
+
try {
|
|
15639
|
+
const i = await this.pickPlacementPoint(
|
|
15640
|
+
(n) => {
|
|
15641
|
+
t.object.visible = n != null, n && t.object.position.copy(n.position), this.requestRender();
|
|
15642
|
+
},
|
|
15643
|
+
() => {
|
|
15644
|
+
t.object.rotateOnWorldAxis(new h(0, 1, 0), Math.PI / 2), t.data.rotation = t.object.rotation.toArray(), this.requestRender();
|
|
15645
|
+
}
|
|
15646
|
+
);
|
|
15647
|
+
t.data.position = i.position.toArray(), t.object.position.copy(i.position), t.object.visible = !0, this.saveHistory(), this.addRecord(t);
|
|
15648
|
+
} catch (i) {
|
|
15649
|
+
throw this.removeObject(t.object), i;
|
|
15650
|
+
}
|
|
15651
|
+
return this.editModel(e.id), this.cloneData(t.data);
|
|
15652
|
+
}
|
|
15637
15653
|
/** 选中模型并显示指定模式的操作柄;未传模式时沿用移动模式。 */
|
|
15638
15654
|
editModel(e, t = "translate") {
|
|
15639
15655
|
const i = this.modelList.get(e);
|
|
@@ -15652,6 +15668,23 @@ class Ml {
|
|
|
15652
15668
|
getSelectedModelId() {
|
|
15653
15669
|
return this.selectedModelId;
|
|
15654
15670
|
}
|
|
15671
|
+
/** 复制当前显示操作柄的模型配置,供 Ctrl/Command+V 或 pasteModel 使用。 */
|
|
15672
|
+
copySelectedModel() {
|
|
15673
|
+
this.syncSelectedTransform();
|
|
15674
|
+
const e = this.selectedModelId ? this.modelList.get(this.selectedModelId) : null;
|
|
15675
|
+
return e ? (this.copiedModelData = this.cloneData(e.data), !0) : !1;
|
|
15676
|
+
}
|
|
15677
|
+
/** 将已复制模型作为捕捉预览粘贴;确认落点后生成具有新 ID 的独立模型。 */
|
|
15678
|
+
async pasteModel() {
|
|
15679
|
+
if (!this.copiedModelData || this.isPasting) return null;
|
|
15680
|
+
const e = this.createId();
|
|
15681
|
+
this.isPasting = !0, this.pendingModelIds.add(e);
|
|
15682
|
+
try {
|
|
15683
|
+
return await this.placePreparedModel(this.normalizeData({ ...this.cloneData(this.copiedModelData), id: e, position: [0, 0, 0] }));
|
|
15684
|
+
} finally {
|
|
15685
|
+
this.pendingModelIds.delete(e), this.isPasting = !1;
|
|
15686
|
+
}
|
|
15687
|
+
}
|
|
15655
15688
|
/** 按材质槽位或精确名称替换贴图;同名材质会一并替换并持久化。 */
|
|
15656
15689
|
async replaceMaterial(e, t, i) {
|
|
15657
15690
|
const n = this.requireRecord(e);
|
|
@@ -15746,36 +15779,57 @@ class Ml {
|
|
|
15746
15779
|
o.colorSpace = Ke, s.map = o, s.needsUpdate = !0;
|
|
15747
15780
|
}
|
|
15748
15781
|
ensureTransformControl() {
|
|
15749
|
-
|
|
15782
|
+
if (this.transformControl) {
|
|
15783
|
+
this.syncTransformControlCamera();
|
|
15784
|
+
return;
|
|
15785
|
+
}
|
|
15786
|
+
!this.engine.camera || !this.engine.renderer || !this.engine.scene || (this.transformControl = new At(this.engine.camera, this.engine.renderer.domElement), this.transformControl.addEventListener("dragging-changed", (e) => {
|
|
15750
15787
|
this.engine.controls && (this.engine.controls.enabled = !e.value), e.value ? this.saveHistory() : this.syncSelectedTransform();
|
|
15751
|
-
}), this.transformControl.addEventListener("objectChange", () => this.requestRender()), this.transformHelper = this.transformControl.getHelper(), this.transformHelper.visible = !1, this.engine.scene.add(this.transformHelper));
|
|
15788
|
+
}), this.transformControl.addEventListener("objectChange", () => this.requestRender()), this.transformHelper = this.transformControl.getHelper(), this.transformHelper.visible = !1, this.engine.scene.add(this.transformHelper), this.syncTransformControlCamera());
|
|
15789
|
+
}
|
|
15790
|
+
/** 透视相机使用更小的屏幕尺寸系数,正交相机维持原有尺寸。 */
|
|
15791
|
+
syncTransformControlCamera() {
|
|
15792
|
+
!this.transformControl || !this.engine.camera || (this.transformControl.camera = this.engine.camera, this.transformControl.size = this.engine.camera.isPerspectiveCamera ? wl : xl);
|
|
15752
15793
|
}
|
|
15753
15794
|
/** 使用引擎统一的捕捉器等待用户单击,并在取消或完成后恢复常规交互。 */
|
|
15754
|
-
pickPlacementPoint(e) {
|
|
15755
|
-
const
|
|
15756
|
-
return !
|
|
15757
|
-
let
|
|
15758
|
-
const
|
|
15759
|
-
|
|
15760
|
-
},
|
|
15795
|
+
pickPlacementPoint(e, t) {
|
|
15796
|
+
const i = this.engine.handelBehaved;
|
|
15797
|
+
return !i?.init || !i?.active || !i?.disActive ? Promise.reject(new Error("放置模型失败:引擎捕捉交互尚未初始化。")) : new Promise((n, s) => {
|
|
15798
|
+
let o = !1;
|
|
15799
|
+
const r = (c) => {
|
|
15800
|
+
o || (o = !0, i.disActive(), this.engine.catchSvg && (this.engine.catchSvg.innerHTML = ""), this.engine.interactionModule?.init?.(), this.engine.interactionModule?.active?.(), c());
|
|
15801
|
+
}, l = {
|
|
15761
15802
|
type: "model-place",
|
|
15762
15803
|
// 捕捉器只会为声明了移动回调的行为刷新吸附预览。
|
|
15763
|
-
handleMouseMove: (
|
|
15764
|
-
handleMouseClick: (
|
|
15765
|
-
const
|
|
15766
|
-
|
|
15804
|
+
handleMouseMove: (c) => e?.(this.getPlacementPoint(c?.catch)),
|
|
15805
|
+
handleMouseClick: (c) => {
|
|
15806
|
+
const d = this.getPlacementPoint(c?.catch);
|
|
15807
|
+
d && r(() => n(d));
|
|
15767
15808
|
},
|
|
15768
15809
|
handelKeyEscDown: () => {
|
|
15769
|
-
|
|
15810
|
+
r(() => s(new Error("已取消第三方模型放置。")));
|
|
15811
|
+
},
|
|
15812
|
+
// 放置预览时,空格键以世界 Y 轴为基准每次旋转 90°。
|
|
15813
|
+
handelKeySpaceDown: (c) => {
|
|
15814
|
+
c.preventDefault(), t?.();
|
|
15770
15815
|
},
|
|
15771
15816
|
// 被另一个捕捉工具替换时,同样结束当前 Promise,避免调用方永久等待。
|
|
15772
15817
|
disActive: () => {
|
|
15773
|
-
|
|
15818
|
+
r(() => s(new Error("第三方模型放置已被其他交互操作取消。")));
|
|
15774
15819
|
}
|
|
15775
15820
|
};
|
|
15776
|
-
|
|
15821
|
+
i.init(l, { showCatch: !0 }), i.active();
|
|
15777
15822
|
});
|
|
15778
15823
|
}
|
|
15824
|
+
/** 将捕捉点转换为最终放置点:沿世界法线外移 1mm,防止 GLB 与 BIM 面片重叠。 */
|
|
15825
|
+
getPlacementPoint(e) {
|
|
15826
|
+
const t = e?.point;
|
|
15827
|
+
if (!(t instanceof h)) return null;
|
|
15828
|
+
const i = t.clone(), n = e?.normal ?? e?.face?.normal;
|
|
15829
|
+
if (n == null) return { position: i, normal: null };
|
|
15830
|
+
const s = n.clone(), o = e?.matrix ?? e?.object?.matrixWorld;
|
|
15831
|
+
return o && s.transformDirection(o), s.lengthSq() < 1e-10 ? { position: i, normal: null } : (s.normalize(), i.addScaledVector(s, vl), { position: i, normal: s });
|
|
15832
|
+
}
|
|
15779
15833
|
handlePointerDown(e) {
|
|
15780
15834
|
if (!(!this.editingEnabled || !this.engine.camera || !this.engine.renderer)) {
|
|
15781
15835
|
if (this.transformControl?.axis != null) {
|
|
@@ -15801,8 +15855,20 @@ class Ml {
|
|
|
15801
15855
|
for (; r && !r.userData.modelPlaceId; ) r = r.parent;
|
|
15802
15856
|
r?.userData.modelPlaceId ? this.editModel(r.userData.modelPlaceId) : this.clearSelection();
|
|
15803
15857
|
}
|
|
15804
|
-
/**
|
|
15858
|
+
/** 处理第三方模型编辑快捷键:复制粘贴、删除、Tab 切换、Esc 和 Ctrl/Command+Z。 */
|
|
15805
15859
|
handleKeyDown(e) {
|
|
15860
|
+
if (this.isCopyShortcut(e)) {
|
|
15861
|
+
e.preventDefault(), this.copySelectedModel();
|
|
15862
|
+
return;
|
|
15863
|
+
}
|
|
15864
|
+
if (this.isPasteShortcut(e)) {
|
|
15865
|
+
e.preventDefault(), this.pasteModel().catch((t) => console.error("第三方模型粘贴失败:", t));
|
|
15866
|
+
return;
|
|
15867
|
+
}
|
|
15868
|
+
if (this.isDeleteShortcut(e)) {
|
|
15869
|
+
e.preventDefault(), this.deleteModel(this.selectedModelId);
|
|
15870
|
+
return;
|
|
15871
|
+
}
|
|
15806
15872
|
if (this.isUndoShortcut(e)) {
|
|
15807
15873
|
e.preventDefault(), this.undo().catch((t) => console.error("第三方模型撤回失败:", t));
|
|
15808
15874
|
return;
|
|
@@ -15815,15 +15881,28 @@ class Ml {
|
|
|
15815
15881
|
}
|
|
15816
15882
|
/** Ctrl+Z / Command+Z 仅在非文本输入焦点且存在历史时接管,避免影响表单编辑。 */
|
|
15817
15883
|
isUndoShortcut(e) {
|
|
15818
|
-
|
|
15884
|
+
return !e.ctrlKey && !e.metaKey || e.shiftKey || e.altKey || e.key.toLowerCase() !== "z" || this.isTextInputTarget(e) ? !1 : this.modelTransforms.length > 0 && !this.isUndoing;
|
|
15885
|
+
}
|
|
15886
|
+
/** Ctrl/Command+C 仅复制当前操作柄所属的第三方模型。 */
|
|
15887
|
+
isCopyShortcut(e) {
|
|
15888
|
+
return (e.ctrlKey || e.metaKey) && !e.shiftKey && !e.altKey && e.key.toLowerCase() === "c" && !this.isTextInputTarget(e) && this.selectedModelId != null;
|
|
15889
|
+
}
|
|
15890
|
+
/** Ctrl/Command+V 以捕捉预览方式粘贴,避免新旧模型直接重叠。 */
|
|
15891
|
+
isPasteShortcut(e) {
|
|
15892
|
+
return (e.ctrlKey || e.metaKey) && !e.shiftKey && !e.altKey && e.key.toLowerCase() === "v" && !this.isTextInputTarget(e) && this.copiedModelData != null && !this.isPasting;
|
|
15893
|
+
}
|
|
15894
|
+
/** Delete 键删除当前操作模型;文本输入焦点保留原生删除行为。 */
|
|
15895
|
+
isDeleteShortcut(e) {
|
|
15896
|
+
return e.key === "Delete" && !e.ctrlKey && !e.metaKey && !e.altKey && !this.isTextInputTarget(e) && this.selectedModelId != null;
|
|
15897
|
+
}
|
|
15898
|
+
/** 判断是否正处于表单输入,避免劫持浏览器原生编辑快捷键。 */
|
|
15899
|
+
isTextInputTarget(e) {
|
|
15819
15900
|
const t = e.target;
|
|
15820
|
-
return t?.isContentEditable || ["INPUT", "TEXTAREA", "SELECT"].includes(t?.tagName ?? "")
|
|
15901
|
+
return !!(t?.isContentEditable || ["INPUT", "TEXTAREA", "SELECT"].includes(t?.tagName ?? ""));
|
|
15821
15902
|
}
|
|
15822
15903
|
/** 仅在操作柄实际显示且非文本输入焦点时接管 Tab,避免破坏常规表单焦点导航。 */
|
|
15823
15904
|
isTransformModeShortcut(e) {
|
|
15824
|
-
|
|
15825
|
-
const t = e.target;
|
|
15826
|
-
return t?.isContentEditable || ["INPUT", "TEXTAREA", "SELECT"].includes(t?.tagName ?? "") ? !1 : this.editingEnabled && this.selectedModelId != null && this.transformHelper?.visible === !0;
|
|
15905
|
+
return e.key !== "Tab" || e.ctrlKey || e.metaKey || e.altKey || this.isTextInputTarget(e) ? !1 : this.editingEnabled && this.selectedModelId != null && this.transformHelper?.visible === !0;
|
|
15827
15906
|
}
|
|
15828
15907
|
/** 按移动、旋转、缩放顺序循环切换;Shift+Tab 可反向切换。 */
|
|
15829
15908
|
switchTransformMode(e) {
|
|
@@ -15897,7 +15976,7 @@ class Ml {
|
|
|
15897
15976
|
this.engine.requestComposerRender?.();
|
|
15898
15977
|
}
|
|
15899
15978
|
}
|
|
15900
|
-
class
|
|
15979
|
+
class Tl {
|
|
15901
15980
|
// 引擎参数
|
|
15902
15981
|
options;
|
|
15903
15982
|
deviceType;
|
|
@@ -16008,11 +16087,11 @@ class El {
|
|
|
16008
16087
|
const o = this.renderer;
|
|
16009
16088
|
o.interactionCullingEnabled = !0, o.interactionActive = !1, o.interactionRenderScene = this.scene, o.interactionFrameBudgetMs = this.options.interactionFrameBudgetMs ?? 6, o.interactionSkipShadows = this.options.interactionSkipShadows ?? !0;
|
|
16010
16089
|
}
|
|
16011
|
-
this.controlModule = new Qs(this), this.controlModule.switchDefaultMode(), this.controls = this.controlModule.orbitControls, this.clipping = new
|
|
16090
|
+
this.controlModule = new Qs(this), this.controlModule.switchDefaultMode(), this.controls = this.controlModule.orbitControls, this.clipping = new Ma(this), this.clipping.init(), this.composerModule = new to(this), this.composerModule.init(), this.events = new or();
|
|
16012
16091
|
const t = this.events.trigger.bind(this.events);
|
|
16013
16092
|
this.events.trigger = ((o, r) => {
|
|
16014
16093
|
t(o, r), String(o) !== String(ye.EngineBusy) && this.requestComposerRender();
|
|
16015
|
-
}), this.engineStatus = new sr(this), this.engineStatus.init(), this.loaderModule = new Se(this), this.lightModule = new Er(this), this.lightModule.init(), this.viewCube = new Br(this), this.viewCube.init(), this.options.showViewCube == !1 && this.viewCube.hide(), this.octreeBox = Rr(this), this.rangeScale = new Fr(this), this.rangeScale.init(), this.setting = new sa(this), this.engineModelModule.init(), this.handelBehaved = gi(this), this.modelMapperBatch = new Ea(this), this.measure = new pa(this), this.modelToolModule = new Ar(this), this.modelLink3d = new Qa(this, this.options.linkOptions ?? {}), this.modelLink3d.init(), this.modelProperties = new xa(this), this.search = new Sa(this), this.interactionModule = new Pr(this), this.interactionModule.init(), this.interactionModule.active(), this.hoverHighLight = new It(this), this.modelEdge = new ia(this), this.modelTree = new
|
|
16094
|
+
}), this.engineStatus = new sr(this), this.engineStatus.init(), this.loaderModule = new Se(this), this.lightModule = new Er(this), this.lightModule.init(), this.viewCube = new Br(this), this.viewCube.init(), this.options.showViewCube == !1 && this.viewCube.hide(), this.octreeBox = Rr(this), this.rangeScale = new Fr(this), this.rangeScale.init(), this.setting = new sa(this), this.engineModelModule.init(), this.handelBehaved = gi(this), this.modelMapperBatch = new Ea(this), this.measure = new pa(this), this.modelToolModule = new Ar(this), this.modelLink3d = new Qa(this, this.options.linkOptions ?? {}), this.modelLink3d.init(), this.modelProperties = new xa(this), this.search = new Sa(this), this.interactionModule = new Pr(this), this.interactionModule.init(), this.interactionModule.active(), this.hoverHighLight = new It(this), this.modelEdge = new ia(this), this.modelTree = new va(this), this.viewTree = new ka(this), this.merge2d = new za(this), this.engineInfo = new wa(this), this.pathRoaming = new Pa(this), this.pathRoaming.init(), this.oneClickEncoding = new La(this), this.minMap = new Aa(this), this.linkElement2d3d = new Da(this), this.linkView2d3d = new Ia(this), this.grid = new Hr(this), this.level = new jr(this), this.issueReport = new Ta(this), this.fabricDraw = new $a(this), this.drawingPin = new Za(this), this.label = new el(this), this.annotation3d = new yl(this), this.calibration = new Ml(this), this.modelPlace = new bl(this), this.text = new _a(this), this.hdr = new Gr(this), this.ground = new fi(this), this.ground.init(), this.skyManager = new na(this), this.setting.init(), this.worldToScreen = new oe(this.camera, this.renderer, this.scene), this.options.showStats && (this.stats = new Fs(), this.stats.showPanel(0), this.stats.dom.style.position = "absolute", this.stats.dom.style.top = "0px", this.stats.dom.style.left = "0px", this.stats.dom.style.zIndex = "1000", this.container.appendChild(this.stats.dom));
|
|
16016
16095
|
let i = document.createElement("div");
|
|
16017
16096
|
i.className = "versionText", this.versionEl = i, this.updateVersionDisplay(), this.container.appendChild(i);
|
|
16018
16097
|
let n = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
@@ -16033,7 +16112,7 @@ class El {
|
|
|
16033
16112
|
this.animationId = null;
|
|
16034
16113
|
return;
|
|
16035
16114
|
}
|
|
16036
|
-
this.stats && this.stats.begin(), this.modelEdge?.update?.(), this.composerModule && (!this.suppressComposerRenderWhenFree || this.pendingComposerRender) && (this.composerModule.composer.render(), this.renderModule?.drawWatermark(), this.pendingComposerRender = !1), this.viewCube && this.viewCube.cubeTool.RenderScene(), this.measure.update(), this.ground.update(), this.skyManager.update(), this.hoverHighLight.update(), this.controlModule.update(), this.minMap.update(), this.grid.update(), this.level.update(), this.text && this.text.update(), this.label && this.label.update(), this.annotation3d && this.annotation3d.updateFrame(1 / 60), this.stats && this.stats.end(), this._fpsFrameCount++;
|
|
16115
|
+
this.stats && this.stats.begin(), this.modelEdge?.update?.(), this.composerModule && (!this.suppressComposerRenderWhenFree || this.pendingComposerRender) && (this.composerModule.composer.render(), this.renderModule?.drawWatermark(), this.pendingComposerRender = !1), this.viewCube && this.viewCube.cubeTool.RenderScene(), this.measure.update(), this.ground.update(), this.skyManager.update(), this.hoverHighLight.update(), this.controlModule.update(), this.modelPlace?.update?.(), this.minMap.update(), this.grid.update(), this.level.update(), this.text && this.text.update(), this.label && this.label.update(), this.annotation3d && this.annotation3d.updateFrame(1 / 60), this.stats && this.stats.end(), this._fpsFrameCount++;
|
|
16037
16116
|
const o = performance.now();
|
|
16038
16117
|
if (o - this._fpsLastCheck >= this._fpsCheckInterval) {
|
|
16039
16118
|
const r = o - this._fpsLastCheck, l = this._fpsFrameCount / r * 1e3;
|
|
@@ -16301,5 +16380,5 @@ class El {
|
|
|
16301
16380
|
}
|
|
16302
16381
|
}
|
|
16303
16382
|
export {
|
|
16304
|
-
|
|
16383
|
+
Tl as E
|
|
16305
16384
|
};
|