bimatter-viewer-react 0.11.4 → 0.11.6
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/lib/api/ViewerApi.d.ts +2 -0
- package/lib/index.js +464 -405
- package/lib/utils/GeometryUtils/useGeometryUtils.d.ts +2 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1631,6 +1631,9 @@ function Or(e, t, n, r) {
|
|
|
1631
1631
|
}
|
|
1632
1632
|
},
|
|
1633
1633
|
geometryUtils: {
|
|
1634
|
+
get indexesState() {
|
|
1635
|
+
return t()?.geometryUtils.indexesState ?? null;
|
|
1636
|
+
},
|
|
1634
1637
|
getAllIds: () => t()?.geometryUtils.getAllIds() ?? [],
|
|
1635
1638
|
getIfcSpacesVisibility: () => t()?.geometryUtils.getIfcSpacesVisibility() ?? !1,
|
|
1636
1639
|
getModelGeometry: (e) => t()?.geometryUtils.getModelGeometry(e) ?? null,
|
|
@@ -9598,8 +9601,8 @@ var Ju = u.memo(function({ colorPaletteTexture: e, material: t, materialMode: n
|
|
|
9598
9601
|
object: f
|
|
9599
9602
|
}), /* @__PURE__ */ W("primitive", { object: v })]
|
|
9600
9603
|
});
|
|
9601
|
-
}), Yu = new R(), Xu = /* @__PURE__ */ new WeakMap();
|
|
9602
|
-
function
|
|
9604
|
+
}), Yu = new R(), Xu = /* @__PURE__ */ new WeakMap(), Zu = /* @__PURE__ */ new WeakMap();
|
|
9605
|
+
function Qu(e) {
|
|
9603
9606
|
if (!e) return null;
|
|
9604
9607
|
try {
|
|
9605
9608
|
let t = JSON.parse(e);
|
|
@@ -9608,20 +9611,20 @@ function Zu(e) {
|
|
|
9608
9611
|
return console.warn("Model matrix parsing error", e), null;
|
|
9609
9612
|
}
|
|
9610
9613
|
}
|
|
9611
|
-
function Qu(e) {
|
|
9612
|
-
return Zu($u(e));
|
|
9613
|
-
}
|
|
9614
9614
|
function $u(e) {
|
|
9615
|
+
return Qu(ed(e));
|
|
9616
|
+
}
|
|
9617
|
+
function ed(e) {
|
|
9615
9618
|
if (e.coordinationMatrix) return e.coordinationMatrix;
|
|
9616
9619
|
for (let t in e.data) {
|
|
9617
9620
|
let n = e.data[Number(t)]?.matrix;
|
|
9618
9621
|
if (n) return n;
|
|
9619
9622
|
}
|
|
9620
9623
|
}
|
|
9621
|
-
function
|
|
9624
|
+
function td(e, t) {
|
|
9622
9625
|
let n = e.matrix ?? t ?? "", r = Xu.get(e);
|
|
9623
9626
|
if (r && r.sourceMatrixKey === n) return r;
|
|
9624
|
-
let i = (
|
|
9627
|
+
let i = (Qu(n) ?? new R()).clone().invert(), a = e.pos, o = new U(), s = Infinity;
|
|
9625
9628
|
for (let e = 0; e < a.length; e += 3) o.set(a[e], a[e + 1], a[e + 2]).applyMatrix4(i), Number.isFinite(o.y) && (s = Math.min(s, o.y));
|
|
9626
9629
|
let c = {
|
|
9627
9630
|
floorY: s,
|
|
@@ -9630,23 +9633,72 @@ function ed(e, t) {
|
|
|
9630
9633
|
};
|
|
9631
9634
|
return Xu.set(e, c), c;
|
|
9632
9635
|
}
|
|
9633
|
-
function
|
|
9636
|
+
function nd(e, t) {
|
|
9637
|
+
let n = e[t];
|
|
9638
|
+
return n === void 0 ? 0 : Number.isFinite(n) ? n : null;
|
|
9639
|
+
}
|
|
9640
|
+
function rd(e, t, n) {
|
|
9641
|
+
let r = nd(e, "x"), i = nd(e, "y"), a = nd(e, "z"), o = nd(t, "x"), s = nd(t, "y"), c = nd(t, "z");
|
|
9642
|
+
if (r === null || i === null || a === null || o === null || s === null || c === null) return null;
|
|
9643
|
+
let l = new U(r + o, i + s, a + c).applyMatrix4(n);
|
|
9644
|
+
return {
|
|
9645
|
+
x: l.x,
|
|
9646
|
+
y: l.y,
|
|
9647
|
+
z: l.z
|
|
9648
|
+
};
|
|
9649
|
+
}
|
|
9650
|
+
function id(e, t, n) {
|
|
9651
|
+
let r = {};
|
|
9652
|
+
return Object.entries(e).forEach(([e, i]) => {
|
|
9653
|
+
let a = i.map((e) => rd(e, t, n)).filter((e) => e !== null);
|
|
9654
|
+
a.length >= 2 && (r[e] = a);
|
|
9655
|
+
}), r;
|
|
9656
|
+
}
|
|
9657
|
+
function ad(e, t) {
|
|
9658
|
+
return {
|
|
9659
|
+
loc: {
|
|
9660
|
+
x: 0,
|
|
9661
|
+
y: 0,
|
|
9662
|
+
z: 0
|
|
9663
|
+
},
|
|
9664
|
+
points: {
|
|
9665
|
+
u: id(e.points.u, e.loc, t),
|
|
9666
|
+
v: id(e.points.v, e.loc, t)
|
|
9667
|
+
}
|
|
9668
|
+
};
|
|
9669
|
+
}
|
|
9670
|
+
function od(e, t) {
|
|
9671
|
+
if (!e || !t) return e;
|
|
9672
|
+
let n = Zu.get(e);
|
|
9673
|
+
if (n && n.sourceMatrixKey === t) return n.grids;
|
|
9674
|
+
let r = Qu(t);
|
|
9675
|
+
if (!r) return e;
|
|
9676
|
+
let i = r.clone().invert(), a = {};
|
|
9677
|
+
return Object.entries(e).forEach(([e, t]) => {
|
|
9678
|
+
a[e] = ad(t, i);
|
|
9679
|
+
}), Zu.set(e, {
|
|
9680
|
+
grids: a,
|
|
9681
|
+
sourceMatrixKey: t
|
|
9682
|
+
}), a;
|
|
9683
|
+
}
|
|
9684
|
+
function sd({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r, loadGeneration: i, materialMode: a, onUploadComplete: o, onUploadProgress: s, useWebGPU: c = !1 }) {
|
|
9634
9685
|
let l = G((e) => e.gridAxesVisibility), u = b(() => {
|
|
9635
9686
|
if (!r) return {
|
|
9636
9687
|
data: [],
|
|
9637
9688
|
coordinationMatrix: null,
|
|
9638
|
-
floorY: 0
|
|
9689
|
+
floorY: 0,
|
|
9690
|
+
grids: void 0
|
|
9639
9691
|
};
|
|
9640
9692
|
let e = !1;
|
|
9641
9693
|
for (let t in r.data) if (r.data[Number(t)]?.matrix) {
|
|
9642
9694
|
e = !0;
|
|
9643
9695
|
break;
|
|
9644
9696
|
}
|
|
9645
|
-
let i = r.coordinationMatrix, a =
|
|
9697
|
+
let i = r.coordinationMatrix ?? ed(r), a = $u(r), o = e || a ? t?.clone() ?? a : null, s = Infinity, c = [];
|
|
9646
9698
|
for (let e in r.data) {
|
|
9647
9699
|
let t = r.data[Number(e)];
|
|
9648
9700
|
if (!t) continue;
|
|
9649
|
-
let a =
|
|
9701
|
+
let a = td(t, i), o = t.mat;
|
|
9650
9702
|
s = Math.min(s, a.floorY), c.push({
|
|
9651
9703
|
data: t,
|
|
9652
9704
|
isIfcSpace: !!t.isIfcSpace,
|
|
@@ -9659,7 +9711,8 @@ function td({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
|
|
|
9659
9711
|
return {
|
|
9660
9712
|
data: c,
|
|
9661
9713
|
coordinationMatrix: o,
|
|
9662
|
-
floorY: Number.isFinite(s) ? s : 0
|
|
9714
|
+
floorY: Number.isFinite(s) ? s : 0,
|
|
9715
|
+
grids: od(r.grids, i)
|
|
9663
9716
|
};
|
|
9664
9717
|
}, [
|
|
9665
9718
|
t,
|
|
@@ -9708,7 +9761,7 @@ function td({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
|
|
|
9708
9761
|
useDoubleSideMaterial: y
|
|
9709
9762
|
}, t.key)), /* @__PURE__ */ W(Su, {
|
|
9710
9763
|
floorY: u.floorY,
|
|
9711
|
-
grids:
|
|
9764
|
+
grids: u.grids,
|
|
9712
9765
|
showBottom: l.bottom,
|
|
9713
9766
|
showLeft: l.left,
|
|
9714
9767
|
showRight: l.right,
|
|
@@ -9717,10 +9770,10 @@ function td({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
|
|
|
9717
9770
|
})]
|
|
9718
9771
|
});
|
|
9719
9772
|
}
|
|
9720
|
-
var
|
|
9773
|
+
var cd = m(sd);
|
|
9721
9774
|
//#endregion
|
|
9722
9775
|
//#region src/viewer/utils/GeometryUtils/useGeometryIndex.ts
|
|
9723
|
-
function
|
|
9776
|
+
function ld() {
|
|
9724
9777
|
return {
|
|
9725
9778
|
elementBounds: /* @__PURE__ */ new Map(),
|
|
9726
9779
|
elementIndex: /* @__PURE__ */ new Map(),
|
|
@@ -9732,16 +9785,16 @@ function rd() {
|
|
|
9732
9785
|
version: ""
|
|
9733
9786
|
};
|
|
9734
9787
|
}
|
|
9735
|
-
function
|
|
9788
|
+
function ud(e, t, n, r) {
|
|
9736
9789
|
let i = e.get(t);
|
|
9737
9790
|
i || (i = /* @__PURE__ */ new Map(), e.set(t, i));
|
|
9738
9791
|
let a = i.get(n);
|
|
9739
9792
|
a || (a = new A(), i.set(n, a)), a.expandByPoint(r);
|
|
9740
9793
|
}
|
|
9741
|
-
function
|
|
9794
|
+
function dd(e) {
|
|
9742
9795
|
return e instanceof Uint16Array || e instanceof Uint32Array ? e : e.length > 65535 ? new Uint32Array(e) : new Uint16Array(e);
|
|
9743
9796
|
}
|
|
9744
|
-
function
|
|
9797
|
+
function fd(e, t, n, r) {
|
|
9745
9798
|
let i = n.get(e);
|
|
9746
9799
|
if (i) return i;
|
|
9747
9800
|
i = {
|
|
@@ -9751,20 +9804,20 @@ function od(e, t, n, r) {
|
|
|
9751
9804
|
let a = r.get(e);
|
|
9752
9805
|
return a || (a = [], r.set(e, a)), a.push(i), i;
|
|
9753
9806
|
}
|
|
9754
|
-
function
|
|
9755
|
-
n &&
|
|
9807
|
+
function pd(e, t, n, r, i, a) {
|
|
9808
|
+
n && fd(e, r, i, a).vertexRanges.push({
|
|
9756
9809
|
count: n,
|
|
9757
9810
|
start: t
|
|
9758
9811
|
});
|
|
9759
9812
|
}
|
|
9760
|
-
function
|
|
9761
|
-
n && (
|
|
9813
|
+
function md(e, t, n, r, i, a) {
|
|
9814
|
+
n && (fd(e, r, i, a), r.triangleRanges.push({
|
|
9762
9815
|
count: n,
|
|
9763
9816
|
id: e,
|
|
9764
9817
|
start: t
|
|
9765
9818
|
}));
|
|
9766
9819
|
}
|
|
9767
|
-
function
|
|
9820
|
+
function hd(e) {
|
|
9768
9821
|
let t = e;
|
|
9769
9822
|
for (; t;) {
|
|
9770
9823
|
let e = t.userData.modelID;
|
|
@@ -9773,10 +9826,10 @@ function ld(e) {
|
|
|
9773
9826
|
}
|
|
9774
9827
|
return 0;
|
|
9775
9828
|
}
|
|
9776
|
-
function
|
|
9829
|
+
function gd(e) {
|
|
9777
9830
|
return e.name === "space" || e.userData.isIfcSpace === !0;
|
|
9778
9831
|
}
|
|
9779
|
-
function
|
|
9832
|
+
function _d(e) {
|
|
9780
9833
|
if (!e) return "";
|
|
9781
9834
|
let t = [];
|
|
9782
9835
|
return e.traverse((e) => {
|
|
@@ -9788,18 +9841,18 @@ function dd(e) {
|
|
|
9788
9841
|
t.push(e.uuid, n.uuid, String(n.attributes.ids?.count ?? 0), String(n.attributes.position?.count ?? 0));
|
|
9789
9842
|
}), t.join(":");
|
|
9790
9843
|
}
|
|
9791
|
-
function
|
|
9792
|
-
let t = x(
|
|
9844
|
+
function vd(e) {
|
|
9845
|
+
let t = x(ld()), n = h(() => {
|
|
9793
9846
|
let n = e.current, r = t.current;
|
|
9794
9847
|
if (!n) return r;
|
|
9795
|
-
let i =
|
|
9848
|
+
let i = _d(n);
|
|
9796
9849
|
if (r.indexedModel === n && r.records.size && r.version === i) return r;
|
|
9797
9850
|
let a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set(), c = new U();
|
|
9798
9851
|
return n.updateMatrixWorld(!0), n.traverse((e) => {
|
|
9799
9852
|
if (!(e instanceof z)) return;
|
|
9800
9853
|
let t = e, n = t.geometry, i = n.index, l = n.attributes.ids;
|
|
9801
9854
|
if (!i || !l) return;
|
|
9802
|
-
let u = n.attributes.position, d =
|
|
9855
|
+
let u = n.attributes.position, d = hd(t), f = gd(t), p = dd(i.array), m = {
|
|
9803
9856
|
hiddenIds: /* @__PURE__ */ new Set(),
|
|
9804
9857
|
initialVisible: t.visible,
|
|
9805
9858
|
isIfcSpace: f,
|
|
@@ -9812,16 +9865,16 @@ function fd(e) {
|
|
|
9812
9865
|
}, h = /* @__PURE__ */ new Map(), g = null, _ = 0, v = p.length / 3;
|
|
9813
9866
|
for (let e = 0; e < v; e++) {
|
|
9814
9867
|
let t = l.getX(p[e * 3]);
|
|
9815
|
-
g === null ? (g = t, _ = e) : t !== g && (
|
|
9868
|
+
g === null ? (g = t, _ = e) : t !== g && (md(g, _, e - _, m, h, a), g = t, _ = e);
|
|
9816
9869
|
}
|
|
9817
|
-
g !== null &&
|
|
9870
|
+
g !== null && md(g, _, v - _, m, h, a);
|
|
9818
9871
|
let y = null, b = 0, x = u ? Math.min(l.count, u.count) : l.count;
|
|
9819
9872
|
u && t.updateWorldMatrix(!0, !1);
|
|
9820
9873
|
for (let e = 0; e < l.count; e++) {
|
|
9821
9874
|
let n = l.getX(e);
|
|
9822
|
-
u && e < x && (c.fromBufferAttribute(u, e).applyMatrix4(t.matrixWorld), Number.isFinite(c.x + c.y + c.z) &&
|
|
9875
|
+
u && e < x && (c.fromBufferAttribute(u, e).applyMatrix4(t.matrixWorld), Number.isFinite(c.x + c.y + c.z) && ud(o, d, n, c)), y === null ? (y = n, b = e) : n !== y && (pd(y, b, e - b, m, h, a), y = n, b = e);
|
|
9823
9876
|
}
|
|
9824
|
-
y !== null &&
|
|
9877
|
+
y !== null && pd(y, b, l.count - b, m, h, a), s.add(m), f && !r.ifcSpacesVisible && (t.visible = !1);
|
|
9825
9878
|
}), t.current = {
|
|
9826
9879
|
elementBounds: o,
|
|
9827
9880
|
elementIndex: a,
|
|
@@ -9833,7 +9886,7 @@ function fd(e) {
|
|
|
9833
9886
|
version: i
|
|
9834
9887
|
}, t.current;
|
|
9835
9888
|
}, [e]), r = h(() => {
|
|
9836
|
-
t.current =
|
|
9889
|
+
t.current = ld();
|
|
9837
9890
|
}, []);
|
|
9838
9891
|
return b(() => ({
|
|
9839
9892
|
buildIndex: n,
|
|
@@ -9842,112 +9895,112 @@ function fd(e) {
|
|
|
9842
9895
|
}
|
|
9843
9896
|
//#endregion
|
|
9844
9897
|
//#region src/viewer/utils/GeometryUtils/useGeometryUtils.ts
|
|
9845
|
-
var
|
|
9846
|
-
function
|
|
9898
|
+
var yd = -1;
|
|
9899
|
+
function bd(e, t) {
|
|
9847
9900
|
return e instanceof Uint32Array ? new Uint32Array(t) : new Uint16Array(t);
|
|
9848
9901
|
}
|
|
9849
|
-
function
|
|
9902
|
+
function xd(e) {
|
|
9850
9903
|
let t = e.geometry;
|
|
9851
9904
|
Object.assign(t, { boundsTree: void 0 }), e.geometry.index?.count && Object.assign(t, { boundsTree: new ft(e.geometry, { indirect: !0 }) });
|
|
9852
9905
|
}
|
|
9853
|
-
function
|
|
9854
|
-
e.mesh.geometry.setIndex(new j(t, 1)), n &&
|
|
9906
|
+
function Sd(e, t, n = !0) {
|
|
9907
|
+
e.mesh.geometry.setIndex(new j(t, 1)), n && xd(e.mesh);
|
|
9855
9908
|
}
|
|
9856
|
-
function
|
|
9909
|
+
function Cd(e, t) {
|
|
9857
9910
|
return e.initialVisible && (!e.isIfcSpace || t);
|
|
9858
9911
|
}
|
|
9859
|
-
function
|
|
9912
|
+
function wd(e, t) {
|
|
9860
9913
|
let n = e.mesh.geometry, r = n.index?.array;
|
|
9861
|
-
e.mesh.visible =
|
|
9914
|
+
e.mesh.visible = Cd(e, t), r !== e.originalIndex && Sd(e, e.originalIndex, !1), e.originalBoundsTree ? Object.assign(n, { boundsTree: e.originalBoundsTree }) : (xd(e.mesh), e.originalBoundsTree = e.mesh.geometry.boundsTree ?? null);
|
|
9862
9915
|
}
|
|
9863
|
-
function
|
|
9916
|
+
function Td(e) {
|
|
9864
9917
|
return e === null ? "*" : e.size ? Array.from(e).sort((e, t) => e - t).join(",") : "";
|
|
9865
9918
|
}
|
|
9866
|
-
function
|
|
9867
|
-
return `h:${
|
|
9919
|
+
function Ed(e, t, n, r) {
|
|
9920
|
+
return `h:${Td(e)}|i:${Td(n)}|s:${r ? Number(t) : ""}`;
|
|
9868
9921
|
}
|
|
9869
|
-
function
|
|
9922
|
+
function Dd(e, t, n) {
|
|
9870
9923
|
return !t.has(e) && (!n || n.has(e));
|
|
9871
9924
|
}
|
|
9872
|
-
function
|
|
9925
|
+
function Od(e, t) {
|
|
9873
9926
|
Object.entries(e).forEach(([e, n]) => {
|
|
9874
9927
|
n.forEach((n) => t(Number(e), n));
|
|
9875
9928
|
});
|
|
9876
9929
|
}
|
|
9877
|
-
function
|
|
9930
|
+
function kd(e, t, n) {
|
|
9878
9931
|
e.hiddenIds.has(t) || (e.hiddenIds.add(t), n.add(e));
|
|
9879
9932
|
}
|
|
9880
|
-
function
|
|
9933
|
+
function Ad(e, t, n) {
|
|
9881
9934
|
e && console.log(`${t}:`, Date.now() - n, "ms");
|
|
9882
9935
|
}
|
|
9883
|
-
function
|
|
9884
|
-
let { hiddenIds: i, originalIndex: a, triangleRanges: o } = e, s =
|
|
9936
|
+
function jd(e, t, n, r) {
|
|
9937
|
+
let { hiddenIds: i, originalIndex: a, triangleRanges: o } = e, s = Ed(i, t, n, e.isIfcSpace);
|
|
9885
9938
|
if (e.visibleStateKey === s) return;
|
|
9886
9939
|
if (!i.size && !n) {
|
|
9887
|
-
|
|
9940
|
+
wd(e, t), e.visibleStateKey = s;
|
|
9888
9941
|
return;
|
|
9889
9942
|
}
|
|
9890
9943
|
let c = 0, l = 0;
|
|
9891
9944
|
if (o.forEach(({ count: e, id: t }) => {
|
|
9892
|
-
|
|
9945
|
+
Dd(t, i, n) ? c += e * 3 : l += e * 3;
|
|
9893
9946
|
}), !c) {
|
|
9894
|
-
|
|
9947
|
+
wd(e, t), e.mesh.visible = !1, e.visibleStateKey = s;
|
|
9895
9948
|
return;
|
|
9896
9949
|
}
|
|
9897
9950
|
if (!l) {
|
|
9898
|
-
|
|
9951
|
+
wd(e, t), e.visibleStateKey = s;
|
|
9899
9952
|
return;
|
|
9900
9953
|
}
|
|
9901
|
-
e.mesh.visible =
|
|
9902
|
-
let u =
|
|
9954
|
+
e.mesh.visible = Cd(e, t);
|
|
9955
|
+
let u = bd(a, c), d = 0;
|
|
9903
9956
|
for (let e = 0; e < o.length; e++) {
|
|
9904
9957
|
let { count: t, id: r, start: s } = o[e];
|
|
9905
|
-
if (!
|
|
9958
|
+
if (!Dd(r, i, n)) continue;
|
|
9906
9959
|
let c = s * 3, l = c + t * 3;
|
|
9907
9960
|
u.set(a.subarray(c, l), d), d += t * 3;
|
|
9908
9961
|
}
|
|
9909
|
-
r || (e.originalBoundsTree = null),
|
|
9962
|
+
r || (e.originalBoundsTree = null), Sd(e, u), e.visibleStateKey = s;
|
|
9910
9963
|
}
|
|
9911
|
-
function
|
|
9964
|
+
function Md(e, t) {
|
|
9912
9965
|
return e.isolatedIdsByModel ? e.isolatedIdsByModel.get(t.modelID) ?? /* @__PURE__ */ new Set() : e.isolatedIds;
|
|
9913
9966
|
}
|
|
9914
|
-
function
|
|
9967
|
+
function Nd(e) {
|
|
9915
9968
|
let t = [];
|
|
9916
9969
|
return e?.children.forEach((e) => {
|
|
9917
9970
|
e instanceof I && typeof e.userData.modelID == "number" && t.push(e);
|
|
9918
9971
|
}), t;
|
|
9919
9972
|
}
|
|
9920
|
-
function
|
|
9973
|
+
function Pd(e) {
|
|
9921
9974
|
let t = e.userData.trueNorthBaseMatrix;
|
|
9922
9975
|
if (t instanceof R) return t;
|
|
9923
9976
|
let n = e.matrix.clone();
|
|
9924
9977
|
return e.userData.trueNorthBaseMatrix = n, n;
|
|
9925
9978
|
}
|
|
9926
|
-
function
|
|
9927
|
-
let n = Number(e.userData.trueNorthAngle ?? 0), r =
|
|
9928
|
-
!t && Number.isFinite(n) && n !== 0 && r.multiply(new R().makeRotationY(n *
|
|
9979
|
+
function Fd(e, t) {
|
|
9980
|
+
let n = Number(e.userData.trueNorthAngle ?? 0), r = Pd(e).clone();
|
|
9981
|
+
!t && Number.isFinite(n) && n !== 0 && r.multiply(new R().makeRotationY(n * yd)), e.matrix.copy(r), e.matrixAutoUpdate = !1, e.updateMatrixWorld(!0), e.userData.trueNorthEnabled = t, e.userData.geometryTransformVersion = (Number(e.userData.geometryTransformVersion) || 0) + 1;
|
|
9929
9982
|
}
|
|
9930
|
-
function
|
|
9983
|
+
function Id(e) {
|
|
9931
9984
|
let t = G((e) => e.selected), n = G((e) => e.resetSelected), r = G((e) => e.showStats), i = G((e) => e.userDevice) === "pc", a = e.buildIndex, o = h(() => Array.from(a().elementIndex.keys()), [a]), s = h(() => a().ifcSpacesVisible, [a]), c = h((e) => {
|
|
9932
9985
|
let t = Date.now(), n = a(), o = /* @__PURE__ */ new Set();
|
|
9933
9986
|
e.forEach((e) => {
|
|
9934
9987
|
let t = n.elementIndex.get(e);
|
|
9935
9988
|
t && t.forEach(({ record: t }) => {
|
|
9936
|
-
|
|
9989
|
+
kd(t, e, o);
|
|
9937
9990
|
});
|
|
9938
|
-
}), o.forEach((e) =>
|
|
9991
|
+
}), o.forEach((e) => jd(e, n.ifcSpacesVisible, Md(n, e), i)), Ad(r, "hideByIds", t);
|
|
9939
9992
|
}, [
|
|
9940
9993
|
a,
|
|
9941
9994
|
i,
|
|
9942
9995
|
r
|
|
9943
9996
|
]), l = h(() => {
|
|
9944
9997
|
let e = Date.now(), o = a(), s = /* @__PURE__ */ new Set();
|
|
9945
|
-
|
|
9998
|
+
Od(t, (e, t) => {
|
|
9946
9999
|
let n = o.elementIndex.get(t);
|
|
9947
10000
|
n && n.forEach(({ record: n }) => {
|
|
9948
|
-
n.modelID === e &&
|
|
10001
|
+
n.modelID === e && kd(n, t, s);
|
|
9949
10002
|
});
|
|
9950
|
-
}), s.forEach((e) =>
|
|
10003
|
+
}), s.forEach((e) => jd(e, o.ifcSpacesVisible, Md(o, e), i)), n(), Ad(r, "hideSelected", e);
|
|
9951
10004
|
}, [
|
|
9952
10005
|
a,
|
|
9953
10006
|
i,
|
|
@@ -9961,24 +10014,24 @@ function Ad(e) {
|
|
|
9961
10014
|
t && t.forEach(({ record: t }) => {
|
|
9962
10015
|
t.hiddenIds.delete(e) && o.add(t);
|
|
9963
10016
|
});
|
|
9964
|
-
}), o.forEach((e) =>
|
|
10017
|
+
}), o.forEach((e) => jd(e, n.ifcSpacesVisible, Md(n, e), i)), Ad(r, "showByIds", t);
|
|
9965
10018
|
}, [
|
|
9966
10019
|
a,
|
|
9967
10020
|
i,
|
|
9968
10021
|
r
|
|
9969
10022
|
]), d = h((e) => {
|
|
9970
10023
|
let t = Date.now(), n = a();
|
|
9971
|
-
n.isolatedIdsByModel = null, n.isolatedIds = new Set(e), n.records.forEach((e) =>
|
|
10024
|
+
n.isolatedIdsByModel = null, n.isolatedIds = new Set(e), n.records.forEach((e) => jd(e, n.ifcSpacesVisible, Md(n, e), i)), Ad(r, "isolateByIds", t);
|
|
9972
10025
|
}, [
|
|
9973
10026
|
a,
|
|
9974
10027
|
i,
|
|
9975
10028
|
r
|
|
9976
10029
|
]), f = h(() => {
|
|
9977
10030
|
let e = Date.now(), n = a(), o = /* @__PURE__ */ new Map();
|
|
9978
|
-
|
|
10031
|
+
Od(t, (e, t) => {
|
|
9979
10032
|
let n = o.get(e);
|
|
9980
10033
|
n || (n = /* @__PURE__ */ new Set(), o.set(e, n)), n.add(t);
|
|
9981
|
-
}), n.isolatedIdsByModel = o, n.isolatedIds = null, n.records.forEach((e) =>
|
|
10034
|
+
}), n.isolatedIdsByModel = o, n.isolatedIds = null, n.records.forEach((e) => jd(e, n.ifcSpacesVisible, Md(n, e), i)), Ad(r, "isolateSelected", e);
|
|
9982
10035
|
}, [
|
|
9983
10036
|
a,
|
|
9984
10037
|
i,
|
|
@@ -9986,7 +10039,7 @@ function Ad(e) {
|
|
|
9986
10039
|
r
|
|
9987
10040
|
]), p = h(() => {
|
|
9988
10041
|
let e = Date.now(), t = a();
|
|
9989
|
-
t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) =>
|
|
10042
|
+
t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => jd(e, t.ifcSpacesVisible, Md(t, e), i)), Ad(r, "resetIsolation", e);
|
|
9990
10043
|
}, [
|
|
9991
10044
|
a,
|
|
9992
10045
|
i,
|
|
@@ -9994,13 +10047,16 @@ function Ad(e) {
|
|
|
9994
10047
|
]), m = h((e) => {
|
|
9995
10048
|
let t = a();
|
|
9996
10049
|
t.ifcSpacesVisible !== e && (t.ifcSpacesVisible = e, t.records.forEach((e) => {
|
|
9997
|
-
e.isIfcSpace &&
|
|
10050
|
+
e.isIfcSpace && jd(e, t.ifcSpacesVisible, Md(t, e), i);
|
|
9998
10051
|
}));
|
|
9999
10052
|
}, [a, i]), g = h(() => {
|
|
10000
10053
|
m(!s());
|
|
10001
10054
|
}, [s, m]);
|
|
10002
10055
|
return {
|
|
10003
10056
|
buildIndex: a,
|
|
10057
|
+
get indexesState() {
|
|
10058
|
+
return a();
|
|
10059
|
+
},
|
|
10004
10060
|
getAllIds: o,
|
|
10005
10061
|
getIfcSpacesVisibility: s,
|
|
10006
10062
|
hideByIds: c,
|
|
@@ -10012,8 +10068,8 @@ function Ad(e) {
|
|
|
10012
10068
|
showAll: h(() => {
|
|
10013
10069
|
let e = Date.now(), t = a();
|
|
10014
10070
|
t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => {
|
|
10015
|
-
e.hiddenIds.clear(),
|
|
10016
|
-
}),
|
|
10071
|
+
e.hiddenIds.clear(), jd(e, t.ifcSpacesVisible, Md(t, e), i);
|
|
10072
|
+
}), Ad(r, "showAll", e);
|
|
10017
10073
|
}, [
|
|
10018
10074
|
a,
|
|
10019
10075
|
i,
|
|
@@ -10022,23 +10078,23 @@ function Ad(e) {
|
|
|
10022
10078
|
showByIds: u,
|
|
10023
10079
|
toggleIIfcSpacesVisibility: g,
|
|
10024
10080
|
useTrueNorth: h((t = !0) => {
|
|
10025
|
-
let n =
|
|
10026
|
-
n.length && (n.forEach((e) =>
|
|
10081
|
+
let n = Nd(a().indexedModel);
|
|
10082
|
+
n.length && (n.forEach((e) => Fd(e, t)), e.resetIndex());
|
|
10027
10083
|
}, [a, e])
|
|
10028
10084
|
};
|
|
10029
10085
|
}
|
|
10030
10086
|
//#endregion
|
|
10031
10087
|
//#region src/viewer/utils/ClippingUtils/PlaneHelper.ts
|
|
10032
|
-
var
|
|
10033
|
-
function
|
|
10088
|
+
var Ld = "#0b2f5f", Rd = "#0b2f5f", zd = 0, Bd = "#165eb0", Vd = .3, Hd = .01, Ud = .025, Wd = .015, Gd = .02, Kd = 1e-7, qd = .25, Jd = .15, Yd = .25, Xd = 1e-5, Zd = .2, Qd = 1, $d = 1;
|
|
10089
|
+
function ef(e, t) {
|
|
10034
10090
|
let n = t.getBoundingClientRect();
|
|
10035
10091
|
return new H((e.clientX - n.left) / n.width * 2 - 1, -((e.clientY - n.top) / n.height) * 2 + 1);
|
|
10036
10092
|
}
|
|
10037
|
-
function
|
|
10093
|
+
function tf(e) {
|
|
10038
10094
|
let t = e.getSize(new U());
|
|
10039
|
-
return Math.max(
|
|
10095
|
+
return Math.max(Yd, t.length() * Hd);
|
|
10040
10096
|
}
|
|
10041
|
-
var
|
|
10097
|
+
var nf = class extends ke {
|
|
10042
10098
|
helper = new I();
|
|
10043
10099
|
borderMaterial;
|
|
10044
10100
|
material;
|
|
@@ -10058,15 +10114,15 @@ var Xd = class extends ke {
|
|
|
10058
10114
|
listenersActive = !1;
|
|
10059
10115
|
constructor(e, t, n, r) {
|
|
10060
10116
|
super(), this.context = e, this.plane = t, this.location = n.clone(), this.normal = r.clone().normalize(), this.material = new Ce({
|
|
10061
|
-
color:
|
|
10117
|
+
color: Rd,
|
|
10062
10118
|
depthWrite: !1,
|
|
10063
|
-
opacity:
|
|
10119
|
+
opacity: zd,
|
|
10064
10120
|
side: ue,
|
|
10065
10121
|
transparent: !0
|
|
10066
10122
|
}), this.helper.position.copy(this.location), this.applyPlaneOrientation(), this.layout = this.getHelperLayout();
|
|
10067
|
-
let i = Math.max(
|
|
10123
|
+
let i = Math.max(qd, Math.min(this.layout.width, this.layout.height) * Ud), a = Math.max(Jd, Math.min(this.layout.width, this.layout.height) * Wd);
|
|
10068
10124
|
this.borderMaterial = new ve({
|
|
10069
|
-
color:
|
|
10125
|
+
color: Ld,
|
|
10070
10126
|
dashSize: i,
|
|
10071
10127
|
depthWrite: !1,
|
|
10072
10128
|
gapSize: a
|
|
@@ -10097,7 +10153,7 @@ var Xd = class extends ke {
|
|
|
10097
10153
|
}
|
|
10098
10154
|
updateBorderDash() {
|
|
10099
10155
|
let e = Math.min(this.layout.width, this.layout.height);
|
|
10100
|
-
this.borderMaterial.dashSize = Math.max(
|
|
10156
|
+
this.borderMaterial.dashSize = Math.max(qd, e * Ud), this.borderMaterial.gapSize = Math.max(Jd, e * Wd), this.borderMaterial.needsUpdate = !0;
|
|
10101
10157
|
}
|
|
10102
10158
|
addEventListeners() {
|
|
10103
10159
|
if (this.listenersActive) return;
|
|
@@ -10159,10 +10215,10 @@ var Xd = class extends ke {
|
|
|
10159
10215
|
return !1;
|
|
10160
10216
|
}
|
|
10161
10217
|
getEdgeInteractionWidth() {
|
|
10162
|
-
return Math.min(
|
|
10218
|
+
return Math.min(Qd, Math.max(Zd, Math.min(this.layout.width, this.layout.height) * Gd));
|
|
10163
10219
|
}
|
|
10164
10220
|
getDragDistanceEpsilon() {
|
|
10165
|
-
return Math.max(
|
|
10221
|
+
return Math.max(Xd, Math.min(this.layout.width, this.layout.height) * Kd);
|
|
10166
10222
|
}
|
|
10167
10223
|
getPointToSegmentDistanceSquared(e, t, n) {
|
|
10168
10224
|
let r = n.x - t.x, i = n.y - t.y, a = r * r + i * i;
|
|
@@ -10175,7 +10231,7 @@ var Xd = class extends ke {
|
|
|
10175
10231
|
}
|
|
10176
10232
|
getPointerPointOnPlane(e, t) {
|
|
10177
10233
|
let n = this.context.getDomElement();
|
|
10178
|
-
this.pointer.copy(
|
|
10234
|
+
this.pointer.copy(ef(e, n));
|
|
10179
10235
|
let r = this.context.getRaycaster(), i = new U();
|
|
10180
10236
|
return r.setFromCamera(this.pointer, this.context.getCamera()), r.ray.intersectPlane(t, i);
|
|
10181
10237
|
}
|
|
@@ -10228,7 +10284,7 @@ var Xd = class extends ke {
|
|
|
10228
10284
|
t && (this.context.clearHelpersHover(this), this.hasHelperPriority(e) && this.stopHelperPriorityEvent(e)), this.hovered !== t && this.setHovered(t);
|
|
10229
10285
|
}
|
|
10230
10286
|
setHovered(e) {
|
|
10231
|
-
this.hovered = e, this.material.color.set(e ?
|
|
10287
|
+
this.hovered = e, this.material.color.set(e ? Bd : Rd), this.material.opacity = e ? Vd : zd, this.material.needsUpdate = !0;
|
|
10232
10288
|
}
|
|
10233
10289
|
createPlaneMesh() {
|
|
10234
10290
|
let e = new z(new re(), this.material);
|
|
@@ -10304,12 +10360,12 @@ var Xd = class extends ke {
|
|
|
10304
10360
|
getHelperLayout() {
|
|
10305
10361
|
let e = this.getModelWorldBox();
|
|
10306
10362
|
if (!e || e.isEmpty()) return {
|
|
10307
|
-
height:
|
|
10308
|
-
maxU:
|
|
10309
|
-
maxV:
|
|
10310
|
-
minU:
|
|
10311
|
-
minV:
|
|
10312
|
-
width:
|
|
10363
|
+
height: $d,
|
|
10364
|
+
maxU: $d / 2,
|
|
10365
|
+
maxV: $d / 2,
|
|
10366
|
+
minU: -$d / 2,
|
|
10367
|
+
minV: -$d / 2,
|
|
10368
|
+
width: $d
|
|
10313
10369
|
};
|
|
10314
10370
|
let t = this.getPlaneBasis(), n = this.helper.position, r = this.getBoxCorners(e), i = new U(), a = new U(), o = Infinity, s = -Infinity, c = Infinity, l = -Infinity;
|
|
10315
10371
|
if (r.forEach((e) => {
|
|
@@ -10317,14 +10373,14 @@ var Xd = class extends ke {
|
|
|
10317
10373
|
let r = a.dot(t.u), u = a.dot(t.v);
|
|
10318
10374
|
o = Math.min(o, r), s = Math.max(s, r), c = Math.min(c, u), l = Math.max(l, u);
|
|
10319
10375
|
}), !Number.isFinite(o) || !Number.isFinite(s) || !Number.isFinite(c) || !Number.isFinite(l)) return {
|
|
10320
|
-
height:
|
|
10321
|
-
maxU:
|
|
10322
|
-
maxV:
|
|
10323
|
-
minU:
|
|
10324
|
-
minV:
|
|
10325
|
-
width:
|
|
10376
|
+
height: $d,
|
|
10377
|
+
maxU: $d / 2,
|
|
10378
|
+
maxV: $d / 2,
|
|
10379
|
+
minU: -$d / 2,
|
|
10380
|
+
minV: -$d / 2,
|
|
10381
|
+
width: $d
|
|
10326
10382
|
};
|
|
10327
|
-
let u =
|
|
10383
|
+
let u = tf(e), d = o - u, f = s + u, p = c - u, m = l + u, h = Math.max($d, f - d), g = Math.max($d, m - p), _ = (d + f) / 2, v = (p + m) / 2;
|
|
10328
10384
|
return {
|
|
10329
10385
|
height: g,
|
|
10330
10386
|
maxU: _ + h / 2,
|
|
@@ -10365,8 +10421,8 @@ var Xd = class extends ke {
|
|
|
10365
10421
|
new U(e.max.x, e.max.y, e.max.z)
|
|
10366
10422
|
];
|
|
10367
10423
|
}
|
|
10368
|
-
},
|
|
10369
|
-
function
|
|
10424
|
+
}, rf = 250, af = "#a9a9a9", of = new U(0, 0, -1), sf = "__bimatterCameraMotionHidden";
|
|
10425
|
+
function cf(e, t) {
|
|
10370
10426
|
if (Array.isArray(e)) {
|
|
10371
10427
|
e.forEach((e) => {
|
|
10372
10428
|
e.clippingPlanes = t, e.needsUpdate = !0;
|
|
@@ -10375,13 +10431,13 @@ function tf(e, t) {
|
|
|
10375
10431
|
}
|
|
10376
10432
|
e.clippingPlanes = t, e.needsUpdate = !0;
|
|
10377
10433
|
}
|
|
10378
|
-
function
|
|
10434
|
+
function lf(e) {
|
|
10379
10435
|
let t = [];
|
|
10380
10436
|
return e?.traverse((e) => {
|
|
10381
10437
|
e instanceof z && (!e.geometry.index || !e.geometry.attributes.ids || t.push(e));
|
|
10382
10438
|
}), t;
|
|
10383
10439
|
}
|
|
10384
|
-
function
|
|
10440
|
+
function uf(e) {
|
|
10385
10441
|
let t = e;
|
|
10386
10442
|
for (; t;) {
|
|
10387
10443
|
let e = t.userData.modelID;
|
|
@@ -10390,14 +10446,14 @@ function rf(e) {
|
|
|
10390
10446
|
}
|
|
10391
10447
|
return 0;
|
|
10392
10448
|
}
|
|
10393
|
-
function
|
|
10449
|
+
function df(e, t, n) {
|
|
10394
10450
|
let r = e;
|
|
10395
10451
|
r && (r.isClippingGroup = n, r.enabled = n && t.length > 0, r.clipIntersection = !1, r.clipShadows = !1, r.clippingPlanes = n ? t : []);
|
|
10396
10452
|
}
|
|
10397
|
-
function
|
|
10453
|
+
function ff(e, t) {
|
|
10398
10454
|
return t.clone().transformDirection(e.matrixWorld).normalize();
|
|
10399
10455
|
}
|
|
10400
|
-
function
|
|
10456
|
+
function pf(e) {
|
|
10401
10457
|
if (!e) return null;
|
|
10402
10458
|
if ("x" in e) {
|
|
10403
10459
|
let t = new U(e.x, e.y, e.z);
|
|
@@ -10406,7 +10462,7 @@ function sf(e) {
|
|
|
10406
10462
|
let t = new U(e[0], e[1], e[2]);
|
|
10407
10463
|
return Number.isFinite(t.x + t.y + t.z) ? t : null;
|
|
10408
10464
|
}
|
|
10409
|
-
var
|
|
10465
|
+
var mf = class {
|
|
10410
10466
|
planes = [];
|
|
10411
10467
|
caps = [];
|
|
10412
10468
|
edges = [];
|
|
@@ -10414,7 +10470,7 @@ var cf = class {
|
|
|
10414
10470
|
active = !1;
|
|
10415
10471
|
capsActive = !0;
|
|
10416
10472
|
capsCameraMotionActive = !1;
|
|
10417
|
-
capsColor =
|
|
10473
|
+
capsColor = af;
|
|
10418
10474
|
context;
|
|
10419
10475
|
edgesActive = !0;
|
|
10420
10476
|
edgesCameraMotionActive = !1;
|
|
@@ -10471,13 +10527,13 @@ var cf = class {
|
|
|
10471
10527
|
return this.context.controlRef;
|
|
10472
10528
|
}
|
|
10473
10529
|
getMeshes() {
|
|
10474
|
-
return
|
|
10530
|
+
return lf(this.context.modelRef.current);
|
|
10475
10531
|
}
|
|
10476
10532
|
getPlanVisualObjects() {
|
|
10477
|
-
return [...this.caps.map((e) => e.getObject()).filter((e) => e.visible || e.userData[
|
|
10533
|
+
return [...this.caps.map((e) => e.getObject()).filter((e) => e.visible || e.userData[sf]), ...this.edges.flatMap((e) => e.getObjects(!0))];
|
|
10478
10534
|
}
|
|
10479
10535
|
getObjectModelID(e) {
|
|
10480
|
-
return
|
|
10536
|
+
return uf(e);
|
|
10481
10537
|
}
|
|
10482
10538
|
getEdgeSegmentsForPlane(e) {
|
|
10483
10539
|
return this.edgesActive ? this.edges.find((t) => t.plane === e && t.active)?.getIntersectionSegments() ?? null : null;
|
|
@@ -10516,12 +10572,12 @@ var cf = class {
|
|
|
10516
10572
|
if (this.capsCameraMotionActive !== e) {
|
|
10517
10573
|
if (this.capsCameraMotionActive = e, e) {
|
|
10518
10574
|
this.clearCapsDragIdleTimeout(), this.caps.forEach((e) => {
|
|
10519
|
-
e.getObject().userData[
|
|
10575
|
+
e.getObject().userData[sf] = !0, e.setVisible(!1);
|
|
10520
10576
|
}), this.context.onVisualChange?.();
|
|
10521
10577
|
return;
|
|
10522
10578
|
}
|
|
10523
10579
|
this.caps.forEach((e) => {
|
|
10524
|
-
delete e.getObject().userData[
|
|
10580
|
+
delete e.getObject().userData[sf], e.setVisible(this.active && this.capsActive && !this.capsDragActive);
|
|
10525
10581
|
}), this.context.onVisualChange?.();
|
|
10526
10582
|
}
|
|
10527
10583
|
}
|
|
@@ -10536,7 +10592,7 @@ var cf = class {
|
|
|
10536
10592
|
this.capsDragIdleTimeout = null, !(!this.active || !this.capsDragActive || this.capsCameraMotionActive) && (this.flushEdgesUpdate(), this.caps.forEach((e) => {
|
|
10537
10593
|
e.setVisible(!0), e.update();
|
|
10538
10594
|
}), this.updateCapsVisualState());
|
|
10539
|
-
},
|
|
10595
|
+
}, rf));
|
|
10540
10596
|
}
|
|
10541
10597
|
clearCapsDragIdleTimeout() {
|
|
10542
10598
|
this.capsDragIdleTimeout !== null && (window.clearTimeout(this.capsDragIdleTimeout), this.capsDragIdleTimeout = null);
|
|
@@ -10566,7 +10622,7 @@ var cf = class {
|
|
|
10566
10622
|
getSelectedWorldBox() {
|
|
10567
10623
|
let e = this.context.viewerStore.getState().selected, t = new A(), n = new U();
|
|
10568
10624
|
return this.getMeshes().forEach((r) => {
|
|
10569
|
-
let i = e[
|
|
10625
|
+
let i = e[uf(r)];
|
|
10570
10626
|
if (!i?.size) return;
|
|
10571
10627
|
let a = r.geometry.attributes.ids, o = r.geometry.attributes.position;
|
|
10572
10628
|
if (!a || !o) return;
|
|
@@ -10584,8 +10640,8 @@ var cf = class {
|
|
|
10584
10640
|
}
|
|
10585
10641
|
updateMaterials() {
|
|
10586
10642
|
let e = this.active ? this.planes : [];
|
|
10587
|
-
|
|
10588
|
-
|
|
10643
|
+
df(this.context.modelRef.current, e, this.context.useWebGPU), this.getMeshes().forEach((t) => {
|
|
10644
|
+
cf(t.material, e);
|
|
10589
10645
|
}), this.context.camera.updateMatrixWorld();
|
|
10590
10646
|
}
|
|
10591
10647
|
setActive(e) {
|
|
@@ -10604,13 +10660,13 @@ var cf = class {
|
|
|
10604
10660
|
recursive: !1
|
|
10605
10661
|
});
|
|
10606
10662
|
if (!n?.face) return null;
|
|
10607
|
-
let r = n.point.clone(), i =
|
|
10663
|
+
let r = n.point.clone(), i = ff(n.object, n.face.normal);
|
|
10608
10664
|
r.add(i.clone().multiplyScalar(.001));
|
|
10609
10665
|
let a = new Me().setFromNormalAndCoplanarPoint(i.clone().negate(), r);
|
|
10610
10666
|
return this.addPlane(a, r, i), a.clone();
|
|
10611
10667
|
}
|
|
10612
10668
|
createPlaneFromPointAndNormal(e, t) {
|
|
10613
|
-
let n = typeof e == "number" ? this.getPointFromZ(e) :
|
|
10669
|
+
let n = typeof e == "number" ? this.getPointFromZ(e) : pf(e), r = pf(t ?? (typeof e == "number" ? of : void 0));
|
|
10614
10670
|
if (!n || !r || r.lengthSq() === 0) return null;
|
|
10615
10671
|
r.normalize();
|
|
10616
10672
|
let i = new Me().setFromNormalAndCoplanarPoint(r, n);
|
|
@@ -10619,7 +10675,7 @@ var cf = class {
|
|
|
10619
10675
|
createClippingRectangle(e = !1) {
|
|
10620
10676
|
let t = e ? this.getSelectedWorldBox() : this.getModelWorldBox();
|
|
10621
10677
|
if (!t) return [];
|
|
10622
|
-
let n =
|
|
10678
|
+
let n = tf(t), r = t.min.clone().addScalar(-n), i = t.max.clone().addScalar(n), a = t.getCenter(new U()), o = [
|
|
10623
10679
|
{
|
|
10624
10680
|
normal: new U(1, 0, 0),
|
|
10625
10681
|
point: new U(r.x, a.y, a.z)
|
|
@@ -10659,7 +10715,7 @@ var cf = class {
|
|
|
10659
10715
|
return new U(t?.x ?? 0, t?.y ?? 0, e);
|
|
10660
10716
|
}
|
|
10661
10717
|
addPlane(e, t, n) {
|
|
10662
|
-
if (this.active || this.setActive(!0), this.planes.push(e), new
|
|
10718
|
+
if (this.active || this.setActive(!0), this.planes.push(e), new nf(this, e, t, n), this.edgesActive) {
|
|
10663
10719
|
let t = new ul(this, e);
|
|
10664
10720
|
t.create(), t.update();
|
|
10665
10721
|
}
|
|
@@ -10718,9 +10774,9 @@ var cf = class {
|
|
|
10718
10774
|
this.clearCapsDragIdleTimeout(), this.deleteAllPlanes();
|
|
10719
10775
|
}
|
|
10720
10776
|
};
|
|
10721
|
-
function
|
|
10777
|
+
function hf(e, t, n, r = !1, i) {
|
|
10722
10778
|
let a = D((e) => e.camera), o = D((e) => e.gl), s = D((e) => e.raycaster), c = D((e) => e.scene), l = Et(), u = x(null);
|
|
10723
|
-
u.current ||= new
|
|
10779
|
+
u.current ||= new mf({
|
|
10724
10780
|
camera: a,
|
|
10725
10781
|
cameraUtils: n,
|
|
10726
10782
|
controlRef: t,
|
|
@@ -10801,15 +10857,15 @@ function lf(e, t, n, r = !1, i) {
|
|
|
10801
10857
|
}
|
|
10802
10858
|
//#endregion
|
|
10803
10859
|
//#region src/viewer/utils/Hotkeys/useHotkeysUtils.tsx
|
|
10804
|
-
function
|
|
10860
|
+
function gf(e) {
|
|
10805
10861
|
return e instanceof HTMLElement ? e.isContentEditable || e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement : !1;
|
|
10806
10862
|
}
|
|
10807
|
-
function
|
|
10863
|
+
function _f(e = !0) {
|
|
10808
10864
|
let t = G((e) => e.api), n = G((e) => e.defaultHotkeysEnabled);
|
|
10809
10865
|
_(() => {
|
|
10810
10866
|
if (!e || !n) return;
|
|
10811
10867
|
let r = (e) => {
|
|
10812
|
-
|
|
10868
|
+
gf(e.target) || (e.code === "KeyI" && t?.geometryUtils.isolateSelected(), e.code === "KeyH" && t?.geometryUtils.hideSelected(), e.code === "KeyC" && t?.geometryUtils.showAll(), e.code === "KeyP" && t?.clipping.createPlane(), e.code === "KeyM" && t?.dimensions.toggle(), e.code === "KeyN" && t?.notes.toggleNodeMode(), t?.notes.getNodeModeActive() && (e.code === "Digit1" && (e.preventDefault(), t.notes.createMarkupCloud()), e.code === "Digit2" && (e.preventDefault(), t.notes.createComment())));
|
|
10813
10869
|
};
|
|
10814
10870
|
return window.addEventListener("keydown", r), () => {
|
|
10815
10871
|
window.removeEventListener("keydown", r);
|
|
@@ -10822,8 +10878,8 @@ function df(e = !0) {
|
|
|
10822
10878
|
}
|
|
10823
10879
|
//#endregion
|
|
10824
10880
|
//#region src/viewer/Selector/SelectionBox.ts
|
|
10825
|
-
var
|
|
10826
|
-
function
|
|
10881
|
+
var vf = new U(), yf = new U(), bf = new H(), xf = new U(), Sf = new U(), Cf = new U(), wf = new U(), Tf = new U(), Ef = new U(), Df = new U();
|
|
10882
|
+
function Of(e) {
|
|
10827
10883
|
let t = e;
|
|
10828
10884
|
for (; t;) {
|
|
10829
10885
|
let e = t.modelID ?? t.userData.modelID;
|
|
@@ -10832,7 +10888,7 @@ function Sf(e) {
|
|
|
10832
10888
|
}
|
|
10833
10889
|
return 0;
|
|
10834
10890
|
}
|
|
10835
|
-
function
|
|
10891
|
+
function kf(e) {
|
|
10836
10892
|
let t = e;
|
|
10837
10893
|
for (; t;) {
|
|
10838
10894
|
if (!t.visible) return !1;
|
|
@@ -10840,16 +10896,16 @@ function Cf(e) {
|
|
|
10840
10896
|
}
|
|
10841
10897
|
return !0;
|
|
10842
10898
|
}
|
|
10843
|
-
function
|
|
10844
|
-
return n.length ? (
|
|
10899
|
+
function Af(e, t, n) {
|
|
10900
|
+
return n.length ? (xf.copy(t).applyMatrix4(e.matrixWorld), Rs(xf, n)) : !0;
|
|
10845
10901
|
}
|
|
10846
|
-
function
|
|
10847
|
-
return i.length ? (
|
|
10848
|
-
let t = e.distanceToPoint(
|
|
10902
|
+
function jf(e, t, n, r, i) {
|
|
10903
|
+
return i.length ? (Sf.copy(t).applyMatrix4(e.matrixWorld), Cf.copy(n).applyMatrix4(e.matrixWorld), wf.copy(r).applyMatrix4(e.matrixWorld), i.every((e) => {
|
|
10904
|
+
let t = e.distanceToPoint(Sf), n = e.distanceToPoint(Cf), r = e.distanceToPoint(wf);
|
|
10849
10905
|
return !(t < -1e-6 && n < -1e-6 && r < -1e-6);
|
|
10850
10906
|
})) : !0;
|
|
10851
10907
|
}
|
|
10852
|
-
function
|
|
10908
|
+
function Mf(e) {
|
|
10853
10909
|
let t = e.getBoundingClientRect();
|
|
10854
10910
|
return {
|
|
10855
10911
|
height: t.height,
|
|
@@ -10858,7 +10914,7 @@ function Ef(e) {
|
|
|
10858
10914
|
width: t.width
|
|
10859
10915
|
};
|
|
10860
10916
|
}
|
|
10861
|
-
function
|
|
10917
|
+
function Nf(e) {
|
|
10862
10918
|
return {
|
|
10863
10919
|
boundsCheckMs: 0,
|
|
10864
10920
|
candidateIds: 0,
|
|
@@ -10884,7 +10940,7 @@ function Df(e) {
|
|
|
10884
10940
|
triangleProjectionMs: 0
|
|
10885
10941
|
};
|
|
10886
10942
|
}
|
|
10887
|
-
function
|
|
10943
|
+
function Pf(e, t) {
|
|
10888
10944
|
return {
|
|
10889
10945
|
minX: Math.min(e.x, t.x),
|
|
10890
10946
|
minY: Math.min(e.y, t.y),
|
|
@@ -10892,43 +10948,43 @@ function Of(e, t) {
|
|
|
10892
10948
|
maxY: Math.max(e.y, t.y)
|
|
10893
10949
|
};
|
|
10894
10950
|
}
|
|
10895
|
-
function
|
|
10951
|
+
function Ff(e, t) {
|
|
10896
10952
|
return t.x >= e.x ? "contains" : "intersects";
|
|
10897
10953
|
}
|
|
10898
|
-
function
|
|
10899
|
-
return
|
|
10954
|
+
function If(e, t) {
|
|
10955
|
+
return Lf(e.x, e.y, t);
|
|
10900
10956
|
}
|
|
10901
|
-
function
|
|
10957
|
+
function Lf(e, t, n) {
|
|
10902
10958
|
return e >= n.minX && e <= n.maxX && t >= n.minY && t <= n.maxY;
|
|
10903
10959
|
}
|
|
10904
|
-
function
|
|
10960
|
+
function Rf(e, t, n, r, i, a) {
|
|
10905
10961
|
return (a - t) * (n - e) > (r - t) * (i - e);
|
|
10906
10962
|
}
|
|
10907
|
-
function
|
|
10908
|
-
return
|
|
10963
|
+
function zf(e, t, n, r, i, a, o, s) {
|
|
10964
|
+
return Rf(e, t, i, a, o, s) !== Rf(n, r, i, a, o, s) && Rf(e, t, n, r, i, a) !== Rf(e, t, n, r, o, s);
|
|
10909
10965
|
}
|
|
10910
|
-
function
|
|
10966
|
+
function Bf(e, t, n, r, i) {
|
|
10911
10967
|
let a = .5 * (-r.y * i.x + n.y * (-r.x + i.x) + n.x * (r.y - i.y) + r.x * i.y), o = a < 0 ? -1 : 1, s = (n.y * i.x - n.x * i.y + (i.y - n.y) * e + (n.x - i.x) * t) * o, c = (n.x * r.y - n.y * r.x + (n.y - r.y) * e + (r.x - n.x) * t) * o;
|
|
10912
10968
|
return s >= 0 && c >= 0 && s + c <= 2 * a * o;
|
|
10913
10969
|
}
|
|
10914
|
-
function
|
|
10915
|
-
return
|
|
10970
|
+
function Vf(e, t, n, r) {
|
|
10971
|
+
return If(e, r) || If(t, r) || If(n, r) || Bf(r.minX, r.minY, e, t, n) || Bf(r.maxX, r.minY, e, t, n) || Bf(r.maxX, r.maxY, e, t, n) || Bf(r.minX, r.maxY, e, t, n) ? !0 : Hf(e, t, r) || Hf(t, n, r) || Hf(n, e, r);
|
|
10916
10972
|
}
|
|
10917
|
-
function
|
|
10918
|
-
return
|
|
10973
|
+
function Hf(e, t, n) {
|
|
10974
|
+
return zf(e.x, e.y, t.x, t.y, n.minX, n.minY, n.maxX, n.minY) || zf(e.x, e.y, t.x, t.y, n.maxX, n.minY, n.maxX, n.maxY) || zf(e.x, e.y, t.x, t.y, n.maxX, n.maxY, n.minX, n.maxY) || zf(e.x, e.y, t.x, t.y, n.minX, n.maxY, n.minX, n.minY);
|
|
10919
10975
|
}
|
|
10920
|
-
function
|
|
10921
|
-
let a =
|
|
10976
|
+
function Uf(e, t, n, r, i = new H()) {
|
|
10977
|
+
let a = vf.copy(t).applyMatrix4(e.matrixWorld).project(n);
|
|
10922
10978
|
return i.set((a.x + 1) / 2 * r.width + r.left, (-a.y + 1) / 2 * r.height + r.top);
|
|
10923
10979
|
}
|
|
10924
|
-
function
|
|
10980
|
+
function Wf(e, t, n, r, i) {
|
|
10925
10981
|
let a = Infinity, o = -Infinity, s = Infinity, c = -Infinity, l = 0;
|
|
10926
|
-
for (let u = 0; u < 2; u++) for (let d = 0; d < 2; d++) for (let f = 0; f < 2; f++)
|
|
10982
|
+
for (let u = 0; u < 2; u++) for (let d = 0; d < 2; d++) for (let f = 0; f < 2; f++) yf.set(u ? t.max.x : t.min.x, d ? t.max.y : t.min.y, f ? t.max.z : t.min.z), Uf(e, yf, r, i, bf), a = Math.min(a, bf.x), o = Math.max(o, bf.x), s = Math.min(s, bf.y), c = Math.max(c, bf.y), If(bf, n) && (l += 1);
|
|
10927
10983
|
return o < n.minX || a > n.maxX || c < n.minY || s > n.maxY ? pt : l === 8 ? ut : dt;
|
|
10928
10984
|
}
|
|
10929
|
-
function
|
|
10985
|
+
function Gf(e, t, n, r) {
|
|
10930
10986
|
let i = Infinity, a = -Infinity, o = Infinity, s = -Infinity;
|
|
10931
|
-
for (let c = 0; c < 2; c++) for (let l = 0; l < 2; l++) for (let u = 0; u < 2; u++)
|
|
10987
|
+
for (let c = 0; c < 2; c++) for (let l = 0; l < 2; l++) for (let u = 0; u < 2; u++) yf.set(c ? t.max.x : t.min.x, l ? t.max.y : t.min.y, u ? t.max.z : t.min.z), Uf(e, yf, n, r, bf), i = Math.min(i, bf.x), a = Math.max(a, bf.x), o = Math.min(o, bf.y), s = Math.max(s, bf.y);
|
|
10932
10988
|
return {
|
|
10933
10989
|
minX: i,
|
|
10934
10990
|
minY: o,
|
|
@@ -10936,41 +10992,41 @@ function zf(e, t, n, r) {
|
|
|
10936
10992
|
maxY: s
|
|
10937
10993
|
};
|
|
10938
10994
|
}
|
|
10939
|
-
function
|
|
10995
|
+
function Kf(e, t) {
|
|
10940
10996
|
return !(e.maxX < t.minX || e.minX > t.maxX || e.maxY < t.minY || e.minY > t.maxY);
|
|
10941
10997
|
}
|
|
10942
|
-
function
|
|
10998
|
+
function qf(e, t, n, r) {
|
|
10943
10999
|
e.geometry.boundingBox || e.geometry.computeBoundingBox();
|
|
10944
11000
|
let i = e.geometry.boundingBox;
|
|
10945
|
-
return i ?
|
|
11001
|
+
return i ? Kf(Gf(e, i, n, r), t) : !0;
|
|
10946
11002
|
}
|
|
10947
|
-
function
|
|
11003
|
+
function Jf(e, t, n) {
|
|
10948
11004
|
let r = e.get(t);
|
|
10949
11005
|
r || (r = /* @__PURE__ */ new Set(), e.set(t, r)), r.add(n);
|
|
10950
11006
|
}
|
|
10951
|
-
function
|
|
11007
|
+
function Yf(e) {
|
|
10952
11008
|
let t = 0;
|
|
10953
11009
|
return e.forEach((e) => {
|
|
10954
11010
|
t += e.size;
|
|
10955
11011
|
}), t;
|
|
10956
11012
|
}
|
|
10957
|
-
function
|
|
11013
|
+
function Xf(e, t, n, r = []) {
|
|
10958
11014
|
let i = e.geometry, a = i.index, o = i.attributes.ids, s = i.attributes.position;
|
|
10959
11015
|
if (!a || !o || !s) return;
|
|
10960
11016
|
let c = t * 3;
|
|
10961
|
-
r.length && (
|
|
11017
|
+
r.length && (Tf.fromBufferAttribute(s, a.getX(c)), Ef.fromBufferAttribute(s, a.getX(c + 1)), Df.fromBufferAttribute(s, a.getX(c + 2)), !jf(e, Tf, Ef, Df, r)) || Jf(n, Of(e), o.getX(a.getX(c)));
|
|
10962
11018
|
}
|
|
10963
|
-
function
|
|
11019
|
+
function Zf({ model: e, camera: t, viewport: n, rect: r, candidateIdsByModel: i, clippingPlanes: a, profile: o }) {
|
|
10964
11020
|
let s = performance.now(), c = /* @__PURE__ */ new Map(), l = new U();
|
|
10965
11021
|
e.traverse((e) => {
|
|
10966
11022
|
let s = e;
|
|
10967
|
-
if (!s.isMesh || !
|
|
11023
|
+
if (!s.isMesh || !kf(s)) return;
|
|
10968
11024
|
let u = s.geometry.attributes.ids, d = s.geometry.attributes.position;
|
|
10969
11025
|
if (!(!u || !d)) {
|
|
10970
11026
|
o && (o.containedVerticesVisited += u.count);
|
|
10971
11027
|
for (let e = 0; e < u.count; e++) {
|
|
10972
|
-
let f =
|
|
10973
|
-
if (!i.get(f)?.has(p) || (l.fromBufferAttribute(d, e), !
|
|
11028
|
+
let f = Of(s), p = u.getX(e);
|
|
11029
|
+
if (!i.get(f)?.has(p) || (l.fromBufferAttribute(d, e), !Af(s, l, a))) continue;
|
|
10974
11030
|
o && (o.containedCandidateVertices += 1);
|
|
10975
11031
|
let m = `${f}:${p}`, h = c.get(m);
|
|
10976
11032
|
h || (h = {
|
|
@@ -10978,23 +11034,23 @@ function Gf({ model: e, camera: t, viewport: n, rect: r, candidateIdsByModel: i,
|
|
|
10978
11034
|
inside: 0,
|
|
10979
11035
|
modelID: f,
|
|
10980
11036
|
total: 0
|
|
10981
|
-
}, c.set(m, h)), h.total += 1,
|
|
11037
|
+
}, c.set(m, h)), h.total += 1, If(Uf(s, l, t, n), r) && (h.inside += 1);
|
|
10982
11038
|
}
|
|
10983
11039
|
}
|
|
10984
11040
|
});
|
|
10985
11041
|
let u = /* @__PURE__ */ new Map();
|
|
10986
11042
|
return c.forEach((e) => {
|
|
10987
|
-
e.total > 0 && e.total === e.inside &&
|
|
11043
|
+
e.total > 0 && e.total === e.inside && Jf(u, e.modelID, e.id);
|
|
10988
11044
|
}), o && (o.containedIdsMs += performance.now() - s), u;
|
|
10989
11045
|
}
|
|
10990
|
-
function
|
|
11046
|
+
function Qf({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect: i, mode: a, profile: o }) {
|
|
10991
11047
|
let s = performance.now(), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
|
|
10992
11048
|
if (!e) return c;
|
|
10993
|
-
let u =
|
|
11049
|
+
let u = Mf(r), d = performance.now();
|
|
10994
11050
|
e.updateMatrixWorld(!0), t.updateMatrixWorld(), o && (o.matrixUpdateMs += performance.now() - d), e.traverse((e) => {
|
|
10995
11051
|
let r = e;
|
|
10996
11052
|
if (!r.isMesh) return;
|
|
10997
|
-
if (o && (o.meshCount += 1), !
|
|
11053
|
+
if (o && (o.meshCount += 1), !kf(r)) {
|
|
10998
11054
|
o && (o.skippedMeshCount += 1);
|
|
10999
11055
|
return;
|
|
11000
11056
|
}
|
|
@@ -11003,7 +11059,7 @@ function Kf({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
|
|
|
11003
11059
|
o && (o.skippedMeshCount += 1);
|
|
11004
11060
|
return;
|
|
11005
11061
|
}
|
|
11006
|
-
let d = performance.now(), f =
|
|
11062
|
+
let d = performance.now(), f = qf(r, i, t, u);
|
|
11007
11063
|
if (o && (o.boundsCheckMs += performance.now() - d), !f) {
|
|
11008
11064
|
o && (o.skippedMeshCount += 1);
|
|
11009
11065
|
return;
|
|
@@ -11011,26 +11067,26 @@ function Kf({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
|
|
|
11011
11067
|
let p = performance.now();
|
|
11012
11068
|
s.shapecast({
|
|
11013
11069
|
intersectsBounds: (e) => {
|
|
11014
|
-
let n = performance.now(), a =
|
|
11070
|
+
let n = performance.now(), a = Wf(r, e, i, t, u);
|
|
11015
11071
|
return o && (o.intersectsBoundsCalls += 1, o.intersectsBoundsMs += performance.now() - n), a;
|
|
11016
11072
|
},
|
|
11017
11073
|
intersectsRange: (e, t, i) => {
|
|
11018
11074
|
let u = performance.now();
|
|
11019
11075
|
if (o && (o.intersectsRangeCalls += 1), !i) return o && (o.intersectsRangeMs += performance.now() - u), !1;
|
|
11020
|
-
for (let i = e; i < e + t; i++)
|
|
11076
|
+
for (let i = e; i < e + t; i++) Xf(r, s.resolveTriangleIndex(i), a === "contains" ? l : c, n);
|
|
11021
11077
|
return o && (o.intersectsRangeMs += performance.now() - u), !1;
|
|
11022
11078
|
},
|
|
11023
11079
|
intersectsTriangle: (e, s, d) => {
|
|
11024
11080
|
let f = performance.now();
|
|
11025
11081
|
if (o && (o.intersectsTriangleCalls += 1), !d) {
|
|
11026
|
-
let n = performance.now(), a =
|
|
11027
|
-
if (o && (o.triangleProjectionMs += performance.now() - n), !
|
|
11082
|
+
let n = performance.now(), a = Uf(r, e.a, t, u), s = Uf(r, e.b, t, u), c = Uf(r, e.c, t, u);
|
|
11083
|
+
if (o && (o.triangleProjectionMs += performance.now() - n), !Vf(a, s, c, i)) return o && (o.intersectsTriangleMs += performance.now() - f), !1;
|
|
11028
11084
|
}
|
|
11029
|
-
return a === "contains" ?
|
|
11085
|
+
return a === "contains" ? Xf(r, s, l, n) : Xf(r, s, c, n), o && (o.intersectsTriangleMs += performance.now() - f), !1;
|
|
11030
11086
|
}
|
|
11031
11087
|
}), o && (o.shapecastMs += performance.now() - p);
|
|
11032
11088
|
});
|
|
11033
|
-
let f = a === "contains" ?
|
|
11089
|
+
let f = a === "contains" ? Zf({
|
|
11034
11090
|
model: e,
|
|
11035
11091
|
camera: t,
|
|
11036
11092
|
clippingPlanes: n,
|
|
@@ -11039,19 +11095,19 @@ function Kf({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
|
|
|
11039
11095
|
candidateIdsByModel: l,
|
|
11040
11096
|
profile: o
|
|
11041
11097
|
}) : c;
|
|
11042
|
-
return o && (o.candidateIds =
|
|
11098
|
+
return o && (o.candidateIds = Yf(l), o.selectedIds = Yf(f), o.totalMs = performance.now() - s), f;
|
|
11043
11099
|
}
|
|
11044
|
-
function
|
|
11045
|
-
let t =
|
|
11100
|
+
function $f(e) {
|
|
11101
|
+
let t = Nf(e.mode);
|
|
11046
11102
|
return {
|
|
11047
|
-
ids:
|
|
11103
|
+
ids: Qf({
|
|
11048
11104
|
...e,
|
|
11049
11105
|
profile: t
|
|
11050
11106
|
}),
|
|
11051
11107
|
profile: t
|
|
11052
11108
|
};
|
|
11053
11109
|
}
|
|
11054
|
-
function
|
|
11110
|
+
function ep(e) {
|
|
11055
11111
|
return e === "contains" ? {
|
|
11056
11112
|
border: "rgb(37, 99, 235)",
|
|
11057
11113
|
background: "rgba(37, 99, 235, 0.16)"
|
|
@@ -11060,40 +11116,40 @@ function Jf(e) {
|
|
|
11060
11116
|
background: "rgba(22, 163, 74, 0.16)"
|
|
11061
11117
|
};
|
|
11062
11118
|
}
|
|
11063
|
-
function
|
|
11064
|
-
let r =
|
|
11119
|
+
function tp(e, t, n) {
|
|
11120
|
+
let r = ep(Ff(t, n));
|
|
11065
11121
|
if (!e.current) {
|
|
11066
11122
|
let t = document.createElement("div");
|
|
11067
11123
|
t.style.position = "fixed", t.style.pointerEvents = "none", t.style.zIndex = "10", e.current = t, document.body.appendChild(t);
|
|
11068
11124
|
}
|
|
11069
|
-
let i =
|
|
11125
|
+
let i = Pf(t, n);
|
|
11070
11126
|
e.current.style.border = `1px solid ${r.border}`, e.current.style.background = r.background, e.current.style.left = `${i.minX}px`, e.current.style.top = `${i.minY}px`, e.current.style.width = `${i.maxX - i.minX}px`, e.current.style.height = `${i.maxY - i.minY}px`;
|
|
11071
11127
|
}
|
|
11072
|
-
function
|
|
11128
|
+
function np(e) {
|
|
11073
11129
|
e.current?.remove(), e.current = null;
|
|
11074
11130
|
}
|
|
11075
11131
|
//#endregion
|
|
11076
11132
|
//#region src/viewer/Selector/useSelector.tsx
|
|
11077
|
-
var
|
|
11078
|
-
function
|
|
11079
|
-
if (Array.isArray(e)) return e.flatMap((e) =>
|
|
11133
|
+
var rp = 40;
|
|
11134
|
+
function ip(e) {
|
|
11135
|
+
if (Array.isArray(e)) return e.flatMap((e) => ip(e));
|
|
11080
11136
|
let t = e.userData;
|
|
11081
11137
|
return t.shaders ? Array.from(t.shaders) : t.shader ? [t.shader] : [];
|
|
11082
11138
|
}
|
|
11083
|
-
function
|
|
11139
|
+
function ap(e) {
|
|
11084
11140
|
let t = x(e);
|
|
11085
11141
|
return t.current = e, t;
|
|
11086
11142
|
}
|
|
11087
|
-
function
|
|
11088
|
-
|
|
11143
|
+
function op(e, t) {
|
|
11144
|
+
ip(e)?.forEach((e) => {
|
|
11089
11145
|
let n = e.uniforms.preSelectionId;
|
|
11090
11146
|
n && (n.value = t);
|
|
11091
11147
|
});
|
|
11092
11148
|
}
|
|
11093
|
-
function
|
|
11149
|
+
function sp(e) {
|
|
11094
11150
|
return Number(e.current?.modelID ?? 0);
|
|
11095
11151
|
}
|
|
11096
|
-
function
|
|
11152
|
+
function cp(e) {
|
|
11097
11153
|
let t = e;
|
|
11098
11154
|
for (; t;) {
|
|
11099
11155
|
let e = t.modelID ?? t.userData.modelID;
|
|
@@ -11102,7 +11158,7 @@ function np(e) {
|
|
|
11102
11158
|
}
|
|
11103
11159
|
return 0;
|
|
11104
11160
|
}
|
|
11105
|
-
function
|
|
11161
|
+
function lp(e) {
|
|
11106
11162
|
let t = e;
|
|
11107
11163
|
for (; t;) {
|
|
11108
11164
|
if (!t.visible) return !1;
|
|
@@ -11110,7 +11166,7 @@ function rp(e) {
|
|
|
11110
11166
|
}
|
|
11111
11167
|
return !0;
|
|
11112
11168
|
}
|
|
11113
|
-
function
|
|
11169
|
+
function up(e) {
|
|
11114
11170
|
if (!e) return "";
|
|
11115
11171
|
let t = [
|
|
11116
11172
|
e.uuid,
|
|
@@ -11123,24 +11179,24 @@ function ip(e) {
|
|
|
11123
11179
|
});
|
|
11124
11180
|
}), t.join(":");
|
|
11125
11181
|
}
|
|
11126
|
-
function
|
|
11127
|
-
if (!
|
|
11182
|
+
function dp(e) {
|
|
11183
|
+
if (!lp(e.object) || !(e.object instanceof z) || e.faceIndex === void 0 || e.faceIndex === null) return !1;
|
|
11128
11184
|
let t = e.object.geometry;
|
|
11129
11185
|
return !!(t.index && t.attributes.ids);
|
|
11130
11186
|
}
|
|
11131
|
-
function
|
|
11132
|
-
if (!
|
|
11187
|
+
function fp(e) {
|
|
11188
|
+
if (!dp(e)) return null;
|
|
11133
11189
|
let t = e.object, n = t.geometry, r = n.index.getX(e.faceIndex * 3), i = n.attributes.ids;
|
|
11134
11190
|
if (r >= i.count) return null;
|
|
11135
11191
|
let a = n.attributes.modelID;
|
|
11136
11192
|
return {
|
|
11137
11193
|
elementID: i.getX(r),
|
|
11138
11194
|
hit: e,
|
|
11139
|
-
modelID: a ? a.getX(r) :
|
|
11195
|
+
modelID: a ? a.getX(r) : cp(t)
|
|
11140
11196
|
};
|
|
11141
11197
|
}
|
|
11142
|
-
function
|
|
11143
|
-
let c = x("end"), l = G((e) => e.selected), u = G((e) => e.setSelected), d = G((e) => e.addSelected), f = G((e) => e.removeSelected), p = G((e) => e.showStats), m = G((e) => e.preselectionEnabled), h =
|
|
11198
|
+
function pp(e, t, n, r, i, a, o, s = 0) {
|
|
11199
|
+
let c = x("end"), l = G((e) => e.selected), u = G((e) => e.setSelected), d = G((e) => e.addSelected), f = G((e) => e.removeSelected), p = G((e) => e.showStats), m = G((e) => e.preselectionEnabled), h = ap(m), g = Et(), v = x(null), y = x(null), b = x(!1), S = x(!1), C = x("add"), w = x(null), ee = x(!1), T = x(0), E = x(null), O = x(null), te = x(null), k = x(m), A = x({
|
|
11144
11200
|
meshesByModel: /* @__PURE__ */ new Map(),
|
|
11145
11201
|
root: null,
|
|
11146
11202
|
version: ""
|
|
@@ -11154,12 +11210,12 @@ function sp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11154
11210
|
let n = t.current;
|
|
11155
11211
|
n && (n.cancel(), n.setOrbitPoint(e.x, e.y, e.z));
|
|
11156
11212
|
}, M = () => {
|
|
11157
|
-
let t = e.current, n =
|
|
11213
|
+
let t = e.current, n = up(t), r = A.current;
|
|
11158
11214
|
if (r.root !== t || r.version !== n) {
|
|
11159
11215
|
let e = /* @__PURE__ */ new Map();
|
|
11160
11216
|
return t?.traverse((t) => {
|
|
11161
11217
|
if (!(t instanceof z) || !t.geometry.index || !t.geometry.attributes.ids) return;
|
|
11162
|
-
let n =
|
|
11218
|
+
let n = cp(t), r = e.get(n) ?? [];
|
|
11163
11219
|
r.push(t), e.set(n, r);
|
|
11164
11220
|
}), A.current = {
|
|
11165
11221
|
meshesByModel: e,
|
|
@@ -11170,7 +11226,7 @@ function sp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11170
11226
|
return r;
|
|
11171
11227
|
}, oe = () => Array.from(M().meshesByModel.values()).flat(), se = (e) => M().meshesByModel.get(e) ?? [], ce = (e) => {
|
|
11172
11228
|
e && se(e.modelID).forEach((e) => {
|
|
11173
|
-
e.preselected = !1,
|
|
11229
|
+
e.preselected = !1, op(e.material, -1);
|
|
11174
11230
|
});
|
|
11175
11231
|
}, le = () => {
|
|
11176
11232
|
a?.(null), ce(te.current), te.current = null;
|
|
@@ -11185,13 +11241,13 @@ function sp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11185
11241
|
elementID: t,
|
|
11186
11242
|
modelID: e
|
|
11187
11243
|
}), se(e).forEach((e) => {
|
|
11188
|
-
e.preselected = !0,
|
|
11244
|
+
e.preselected = !0, op(e.material, t);
|
|
11189
11245
|
}), te.current = {
|
|
11190
11246
|
elementID: t,
|
|
11191
11247
|
modelID: e
|
|
11192
11248
|
});
|
|
11193
11249
|
}, de = () => {
|
|
11194
|
-
v.current = null, b.current = !1,
|
|
11250
|
+
v.current = null, b.current = !1, np(y), t.current && (t.current.enabled = !0);
|
|
11195
11251
|
}, N = (e) => {
|
|
11196
11252
|
if (re()) {
|
|
11197
11253
|
ie(), le();
|
|
@@ -11233,7 +11289,7 @@ function sp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11233
11289
|
return;
|
|
11234
11290
|
}
|
|
11235
11291
|
if (O.current = e, E.current !== null) return;
|
|
11236
|
-
let t = fe() - T.current, n = Math.max(0,
|
|
11292
|
+
let t = fe() - T.current, n = Math.max(0, rp - t);
|
|
11237
11293
|
E.current = window.setTimeout(() => {
|
|
11238
11294
|
E.current = null;
|
|
11239
11295
|
let e = O.current;
|
|
@@ -11270,7 +11326,7 @@ function sp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11270
11326
|
c.current = "end";
|
|
11271
11327
|
return;
|
|
11272
11328
|
}
|
|
11273
|
-
let n = t.shiftKey, r = t.ctrlKey, i = Se(t), a, o =
|
|
11329
|
+
let n = t.shiftKey, r = t.ctrlKey, i = Se(t), a, o = sp(e), s = null;
|
|
11274
11330
|
if (i && (o = i.modelID, s = i.hit.point, a = i.elementID), r) {
|
|
11275
11331
|
a !== void 0 && f(o, [a]);
|
|
11276
11332
|
return;
|
|
@@ -11288,7 +11344,7 @@ function sp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11288
11344
|
}
|
|
11289
11345
|
if (!v.current) return;
|
|
11290
11346
|
let t = new H(e.clientX, e.clientY), n = Math.abs(t.x - v.current.x), r = Math.abs(t.y - v.current.y);
|
|
11291
|
-
n < 6 && r < 6 || (b.current ||= !0, e.preventDefault(),
|
|
11347
|
+
n < 6 && r < 6 || (b.current ||= !0, e.preventDefault(), tp(y, v.current, t));
|
|
11292
11348
|
}, ye = (r) => {
|
|
11293
11349
|
if (ne()) {
|
|
11294
11350
|
de();
|
|
@@ -11296,12 +11352,12 @@ function sp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11296
11352
|
}
|
|
11297
11353
|
if (!v.current) return;
|
|
11298
11354
|
F.current = me();
|
|
11299
|
-
let i = b.current, a = new H(r.clientX, r.clientY), o =
|
|
11300
|
-
if (v.current = null, b.current = !1,
|
|
11355
|
+
let i = b.current, a = new H(r.clientX, r.clientY), o = Pf(v.current, a), s = Ff(v.current, a);
|
|
11356
|
+
if (v.current = null, b.current = !1, np(y), t.current && setTimeout(() => {
|
|
11301
11357
|
t.current && (t.current.enabled = !0);
|
|
11302
11358
|
}, 100), !i) return;
|
|
11303
11359
|
S.current = !0, r.preventDefault();
|
|
11304
|
-
let { ids: c, profile: l } =
|
|
11360
|
+
let { ids: c, profile: l } = $f({
|
|
11305
11361
|
model: e.current,
|
|
11306
11362
|
camera: pe,
|
|
11307
11363
|
clippingPlanes: n.getActiveClippingPlanes(),
|
|
@@ -11321,7 +11377,7 @@ function sp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11321
11377
|
let i = Array.isArray(t) ? t.filter((e) => e.visible) : t ? [t] : [];
|
|
11322
11378
|
return i.length ? n.getIntersection(!1, {
|
|
11323
11379
|
event: e,
|
|
11324
|
-
filter:
|
|
11380
|
+
filter: dp,
|
|
11325
11381
|
firstHitOnly: r,
|
|
11326
11382
|
object: i,
|
|
11327
11383
|
recursive: !0
|
|
@@ -11329,11 +11385,11 @@ function sp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11329
11385
|
}, be = () => i?.().filter((e) => e.visible) ?? [], xe = (e, t) => {
|
|
11330
11386
|
let n = L(e, t, !0);
|
|
11331
11387
|
for (let e of n) {
|
|
11332
|
-
let t =
|
|
11388
|
+
let t = fp(e);
|
|
11333
11389
|
if (t) return t;
|
|
11334
11390
|
}
|
|
11335
11391
|
return null;
|
|
11336
|
-
}, Se = (e) => xe(e, be()) || xe(e, oe()), R =
|
|
11392
|
+
}, Se = (e) => xe(e, be()) || xe(e, oe()), R = ap({
|
|
11337
11393
|
clearPreselection: le,
|
|
11338
11394
|
onBoxPointerDown: _e,
|
|
11339
11395
|
onBoxPointerMove: ve,
|
|
@@ -11365,7 +11421,7 @@ function sp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11365
11421
|
e.ctrlKey && e.preventDefault();
|
|
11366
11422
|
}
|
|
11367
11423
|
return () => {
|
|
11368
|
-
|
|
11424
|
+
np(y), E.current !== null && (window.clearTimeout(E.current), E.current = null), O.current = null, R.current.clearPreselection(), e?.removeEventListener("controlstart", p), e?.removeEventListener("update", u), n.removeEventListener("pointerdown", r), n.removeEventListener("pointermove", i), window.removeEventListener("pointerup", a), window.removeEventListener("pointerup", o), n.removeEventListener("contextmenu", g), n.removeEventListener("pointerup", h), n.removeEventListener("pointerdown", f), m && (n.removeEventListener("pointermove", s), n.removeEventListener("pointerleave", l));
|
|
11369
11425
|
};
|
|
11370
11426
|
}, [
|
|
11371
11427
|
t,
|
|
@@ -11377,30 +11433,30 @@ function sp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11377
11433
|
}
|
|
11378
11434
|
//#endregion
|
|
11379
11435
|
//#region src/viewer/Camera/useCameraFit.tsx
|
|
11380
|
-
var
|
|
11381
|
-
function
|
|
11382
|
-
let n = e.top === e.bottom ? 1 : Math.abs((e.right - e.left) / (e.top - e.bottom)), r = Math.max(
|
|
11436
|
+
var mp = new U(1, 1, 1).normalize(), hp = 1.18, gp = .001, _p = .001, vp = 4, yp = 1.45;
|
|
11437
|
+
function bp(e, t) {
|
|
11438
|
+
let n = e.top === e.bottom ? 1 : Math.abs((e.right - e.left) / (e.top - e.bottom)), r = Math.max(_p, t) * Math.max(e.zoom, 1e-4), i = r * n;
|
|
11383
11439
|
e.left = -i / 2, e.right = i / 2, e.top = r / 2, e.bottom = -r / 2;
|
|
11384
11440
|
}
|
|
11385
|
-
function
|
|
11441
|
+
function xp(e, t) {
|
|
11386
11442
|
let n = Se.degToRad(e.fov), r = 2 * Math.atan(Math.tan(n / 2) * e.aspect);
|
|
11387
|
-
return t / Math.sin(Math.min(n, r) / 2) *
|
|
11443
|
+
return t / Math.sin(Math.min(n, r) / 2) * hp;
|
|
11388
11444
|
}
|
|
11389
|
-
function
|
|
11445
|
+
function Sp() {
|
|
11390
11446
|
let { camera: e } = D();
|
|
11391
11447
|
return h((t, n, r) => {
|
|
11392
11448
|
if (!t.current || !(e instanceof je) && !(e instanceof Ae)) return;
|
|
11393
11449
|
let i = new A().setFromObject(t.current);
|
|
11394
11450
|
if (i.isEmpty()) return;
|
|
11395
|
-
let a = i.getCenter(new U()), o = i.getBoundingSphere(new We()), s = n.current, c = e instanceof je ?
|
|
11451
|
+
let a = i.getCenter(new U()), o = i.getBoundingSphere(new We()), s = n.current, c = e instanceof je ? xp(e, o.radius) : Math.max(o.radius * vp, gp);
|
|
11396
11452
|
e.up.set(0, 1, 0);
|
|
11397
|
-
let l = a.clone().addScaledVector(
|
|
11398
|
-
s ? (s.cancel(), s.updateCameraUp(), s.setFocalOffset(0, 0, 0, !1), s.setLookAt(l.x, l.y, l.z, a.x, a.y, a.z, !1), e instanceof Ae && s.fitToSphere(new We(a, o.radius *
|
|
11453
|
+
let l = a.clone().addScaledVector(mp, c);
|
|
11454
|
+
s ? (s.cancel(), s.updateCameraUp(), s.setFocalOffset(0, 0, 0, !1), s.setLookAt(l.x, l.y, l.z, a.x, a.y, a.z, !1), e instanceof Ae && s.fitToSphere(new We(a, o.radius * yp), !1), s.update(0), e.updateMatrixWorld(!0)) : (e.position.copy(l), e.lookAt(a)), e instanceof Ae && (s || (e.zoom = 1, bp(e, o.radius * 2 * yp))), e.updateProjectionMatrix(), e.updateMatrixWorld(!0), r.current && (r.current.position.copy(a).addScaledVector(mp, c * .8), r.current.lookAt(a));
|
|
11399
11455
|
}, [e]);
|
|
11400
11456
|
}
|
|
11401
11457
|
//#endregion
|
|
11402
11458
|
//#region src/viewer/Camera/FirstPersonControls.tsx
|
|
11403
|
-
var
|
|
11459
|
+
var Cp = 1, wp = .004, Tp = -Math.PI / 2 + .01, Ep = Math.PI / 2 - .01, Dp = .24, Op = 4, kp = 1e4, Ap = .5, jp = .01, Mp = 1.5, Np = 1500, Pp = 3, Fp = new Set([
|
|
11404
11460
|
"KeyW",
|
|
11405
11461
|
"KeyA",
|
|
11406
11462
|
"KeyS",
|
|
@@ -11409,62 +11465,62 @@ var _p = 1, vp = .004, yp = -Math.PI / 2 + .01, bp = Math.PI / 2 - .01, xp = .24
|
|
|
11409
11465
|
"ShiftRight",
|
|
11410
11466
|
"ControlLeft",
|
|
11411
11467
|
"ControlRight"
|
|
11412
|
-
]),
|
|
11413
|
-
function
|
|
11468
|
+
]), Ip = new Set(["AltLeft", "AltRight"]), Lp = new U(), Rp = new U(), zp = new U(), Bp = new U(), Vp = new U(0, -1, 0);
|
|
11469
|
+
function Hp(e, t) {
|
|
11414
11470
|
return typeof e == "number" && Number.isFinite(e) ? e : t;
|
|
11415
11471
|
}
|
|
11416
|
-
function
|
|
11472
|
+
function Up(e, t, n) {
|
|
11417
11473
|
return Math.min(n, Math.max(t, e));
|
|
11418
11474
|
}
|
|
11419
|
-
function
|
|
11420
|
-
return
|
|
11475
|
+
function Wp(e, t, n, r) {
|
|
11476
|
+
return Up(Hp(e, t), n, r);
|
|
11421
11477
|
}
|
|
11422
|
-
function
|
|
11478
|
+
function Gp(e) {
|
|
11423
11479
|
if (!(e instanceof HTMLElement)) return !1;
|
|
11424
11480
|
let t = e.tagName.toLowerCase();
|
|
11425
11481
|
return e.isContentEditable || t === "input" || t === "textarea" || t === "select";
|
|
11426
11482
|
}
|
|
11427
|
-
function
|
|
11483
|
+
function Kp(e) {
|
|
11428
11484
|
if (!e) return {
|
|
11429
|
-
eyeHeight:
|
|
11430
|
-
groundMaxDistance:
|
|
11431
|
-
moveSpeed:
|
|
11485
|
+
eyeHeight: Mp,
|
|
11486
|
+
groundMaxDistance: Mp * Pp,
|
|
11487
|
+
moveSpeed: Op
|
|
11432
11488
|
};
|
|
11433
11489
|
let t = new A().setFromObject(e);
|
|
11434
11490
|
if (t.isEmpty()) return {
|
|
11435
|
-
eyeHeight:
|
|
11436
|
-
groundMaxDistance:
|
|
11437
|
-
moveSpeed:
|
|
11491
|
+
eyeHeight: Mp,
|
|
11492
|
+
groundMaxDistance: Mp * Pp,
|
|
11493
|
+
moveSpeed: Op
|
|
11438
11494
|
};
|
|
11439
|
-
let n = t.getBoundingSphere(new We()).radius, r = Math.min(
|
|
11495
|
+
let n = t.getBoundingSphere(new We()).radius, r = Math.min(Np, Math.max(Mp, n * jp));
|
|
11440
11496
|
return {
|
|
11441
11497
|
eyeHeight: r,
|
|
11442
|
-
groundMaxDistance: r *
|
|
11443
|
-
moveSpeed: Math.min(
|
|
11498
|
+
groundMaxDistance: r * Pp,
|
|
11499
|
+
moveSpeed: Math.min(kp, Math.max(Op, n * Dp))
|
|
11444
11500
|
};
|
|
11445
11501
|
}
|
|
11446
|
-
function
|
|
11447
|
-
let n =
|
|
11502
|
+
function qp(e, t) {
|
|
11503
|
+
let n = Kp(e), r = Wp(t.eyeHeight, n.eyeHeight, .01, Np), i = Wp(t.groundSnapDistanceRatio, Pp, .1, 100);
|
|
11448
11504
|
return {
|
|
11449
11505
|
eyeHeight: r,
|
|
11450
|
-
groundCheckInterval: Math.round(
|
|
11506
|
+
groundCheckInterval: Math.round(Wp(t.groundCheckInterval, Cp, 1, 120)),
|
|
11451
11507
|
groundMaxDistance: r * i,
|
|
11452
|
-
lookSensitivity:
|
|
11453
|
-
moveSpeed:
|
|
11508
|
+
lookSensitivity: Wp(t.lookSensitivity, wp, 1e-4, .1),
|
|
11509
|
+
moveSpeed: Wp(t.speed, n.moveSpeed, .01, kp)
|
|
11454
11510
|
};
|
|
11455
11511
|
}
|
|
11456
|
-
function
|
|
11457
|
-
return e.getWorldDirection(
|
|
11512
|
+
function Jp(e) {
|
|
11513
|
+
return e.getWorldDirection(Lp), Lp.y = 0, Lp.lengthSq() === 0 && Lp.set(0, 0, -1), Lp.normalize();
|
|
11458
11514
|
}
|
|
11459
|
-
function
|
|
11460
|
-
return
|
|
11515
|
+
function Yp(e) {
|
|
11516
|
+
return Rp.copy(e).cross(Xp).normalize(), Rp.lengthSq() === 0 && Rp.set(1, 0, 0), Rp;
|
|
11461
11517
|
}
|
|
11462
|
-
var
|
|
11463
|
-
function
|
|
11518
|
+
var Xp = new U(0, 1, 0);
|
|
11519
|
+
function Zp(e, t) {
|
|
11464
11520
|
let n = t.current;
|
|
11465
|
-
n && (e.getWorldDirection(
|
|
11521
|
+
n && (e.getWorldDirection(Bp), Bp.add(e.position), n.enabled = !0, n.cancel(), n.updateCameraUp(), n.setLookAt(e.position.x, e.position.y, e.position.z, Bp.x, Bp.y, Bp.z, !1), n.stop(), n.update(0));
|
|
11466
11522
|
}
|
|
11467
|
-
function
|
|
11523
|
+
function Qp(e) {
|
|
11468
11524
|
return e.find((e) => {
|
|
11469
11525
|
let t = e.object;
|
|
11470
11526
|
for (; t;) {
|
|
@@ -11474,42 +11530,42 @@ function Kp(e) {
|
|
|
11474
11530
|
return !0;
|
|
11475
11531
|
});
|
|
11476
11532
|
}
|
|
11477
|
-
function
|
|
11478
|
-
let n =
|
|
11479
|
-
return
|
|
11533
|
+
function $p(e, t) {
|
|
11534
|
+
let n = Yp(Jp(e));
|
|
11535
|
+
return zp.set(0, 0, 0), t.has("KeyW") && (e.getWorldDirection(Lp), zp.add(Lp)), t.has("KeyS") && (e.getWorldDirection(Lp), zp.sub(Lp)), t.has("KeyD") && zp.add(n), t.has("KeyA") && zp.sub(n), (t.has("ShiftLeft") || t.has("ShiftRight")) && zp.add(Xp), (t.has("ControlLeft") || t.has("ControlRight")) && zp.sub(Xp), zp;
|
|
11480
11536
|
}
|
|
11481
|
-
function
|
|
11537
|
+
function em(e) {
|
|
11482
11538
|
return e.has("ShiftLeft") || e.has("ShiftRight") || e.has("ControlLeft") || e.has("ControlRight");
|
|
11483
11539
|
}
|
|
11484
|
-
function
|
|
11485
|
-
let a = D((e) => e.camera), o = D((e) => e.gl), s = D((e) => e.invalidate), c = Et(), l = x(null), u = x(/* @__PURE__ */ new Set()), d = x(
|
|
11540
|
+
function tm({ active: e, activeRef: t, controlRef: n, modelRef: r, settings: i }) {
|
|
11541
|
+
let a = D((e) => e.camera), o = D((e) => e.gl), s = D((e) => e.invalidate), c = Et(), l = x(null), u = x(/* @__PURE__ */ new Set()), d = x(Mp), f = x(0), p = x(Mp * Pp), m = x(Cp), h = x(wp), g = x(!1), v = x(!1), y = x(Op), S = x({
|
|
11486
11542
|
pitch: 0,
|
|
11487
11543
|
yaw: 0
|
|
11488
11544
|
}), C = x(null), w = b(() => new Le(), []);
|
|
11489
11545
|
return _(() => {
|
|
11490
11546
|
t.current = e;
|
|
11491
11547
|
}, [e, t]), _(() => {
|
|
11492
|
-
let e =
|
|
11548
|
+
let e = qp(r.current, i);
|
|
11493
11549
|
d.current = e.eyeHeight, m.current = e.groundCheckInterval, p.current = e.groundMaxDistance, h.current = e.lookSensitivity, y.current = e.moveSpeed;
|
|
11494
11550
|
}, [r, i]), _(() => {
|
|
11495
11551
|
let e = o.domElement, i = e.style.outline, c = e.style.userSelect;
|
|
11496
11552
|
e.tabIndex = Math.max(e.tabIndex, 0), e.style.outline = "none", e.style.userSelect = "none";
|
|
11497
11553
|
let _ = (e, t) => {
|
|
11498
11554
|
let n = S.current, r = h.current;
|
|
11499
|
-
n.yaw -= e * r, n.pitch -= t * r, n.pitch = Math.max(
|
|
11555
|
+
n.yaw -= e * r, n.pitch -= t * r, n.pitch = Math.max(Tp, Math.min(Ep, n.pitch)), a.quaternion.setFromEuler(new N(n.pitch, n.yaw, 0, "YXZ")), a.updateMatrixWorld(), s();
|
|
11500
11556
|
}, b = () => {
|
|
11501
11557
|
l.current !== null && (cancelAnimationFrame(l.current), l.current = null);
|
|
11502
11558
|
}, x = (e) => {
|
|
11503
11559
|
if (!t.current) return;
|
|
11504
11560
|
n.current?.cancel(), n.current && (n.current.enabled = !1);
|
|
11505
|
-
let i =
|
|
11561
|
+
let i = $p(a, u.current);
|
|
11506
11562
|
if (i.lengthSq() === 0) return;
|
|
11507
|
-
let o = v.current ?
|
|
11508
|
-
if (i.normalize().multiplyScalar(y.current * o * e), a.position.add(i), f.current += 1, v.current && !
|
|
11563
|
+
let o = v.current ? Ap : 1;
|
|
11564
|
+
if (i.normalize().multiplyScalar(y.current * o * e), a.position.add(i), f.current += 1, v.current && !em(u.current) && f.current % m.current === 0) {
|
|
11509
11565
|
let e = w, t = e.firstHitOnly;
|
|
11510
|
-
e.firstHitOnly = !0, w.set(a.position,
|
|
11566
|
+
e.firstHitOnly = !0, w.set(a.position, Vp), w.far = p.current;
|
|
11511
11567
|
try {
|
|
11512
|
-
let e =
|
|
11568
|
+
let e = Qp(r.current ? w.intersectObject(r.current, !0) : []);
|
|
11513
11569
|
e && (a.position.y = e.point.y + d.current);
|
|
11514
11570
|
} finally {
|
|
11515
11571
|
e.firstHitOnly = t, w.far = Infinity;
|
|
@@ -11533,18 +11589,18 @@ function Yp({ active: e, activeRef: t, controlRef: n, modelRef: r, settings: i }
|
|
|
11533
11589
|
}, D = (n) => {
|
|
11534
11590
|
t.current && document.pointerLockElement === e && _(n.movementX, n.movementY);
|
|
11535
11591
|
}, O = (e) => {
|
|
11536
|
-
if (t.current && !
|
|
11537
|
-
if (
|
|
11592
|
+
if (t.current && !Gp(e.target)) {
|
|
11593
|
+
if (Ip.has(e.code)) {
|
|
11538
11594
|
e.repeat || (v.current = !v.current), e.preventDefault(), e.stopPropagation();
|
|
11539
11595
|
return;
|
|
11540
11596
|
}
|
|
11541
|
-
|
|
11597
|
+
Fp.has(e.code) && (e.preventDefault(), e.stopPropagation(), u.current.add(e.code), C(), s());
|
|
11542
11598
|
}
|
|
11543
11599
|
}, te = (e) => {
|
|
11544
|
-
|
|
11600
|
+
Fp.has(e.code) && (u.current.delete(e.code), u.current.size || b());
|
|
11545
11601
|
};
|
|
11546
11602
|
return e.addEventListener("pointerdown", ee, !0), e.addEventListener("pointermove", E, !0), window.addEventListener("pointerup", T, !0), window.addEventListener("mousemove", D), window.addEventListener("keydown", O, !0), window.addEventListener("keyup", te, !0), () => {
|
|
11547
|
-
e.removeEventListener("pointerdown", ee, !0), e.removeEventListener("pointermove", E, !0), window.removeEventListener("pointerup", T, !0), window.removeEventListener("mousemove", D), window.removeEventListener("keydown", O, !0), window.removeEventListener("keyup", te, !0), b(), e.style.outline = i, e.style.userSelect = c, g.current = !1, u.current.clear(), document.pointerLockElement === e && document.exitPointerLock(),
|
|
11603
|
+
e.removeEventListener("pointerdown", ee, !0), e.removeEventListener("pointermove", E, !0), window.removeEventListener("pointerup", T, !0), window.removeEventListener("mousemove", D), window.removeEventListener("keydown", O, !0), window.removeEventListener("keyup", te, !0), b(), e.style.outline = i, e.style.userSelect = c, g.current = !1, u.current.clear(), document.pointerLockElement === e && document.exitPointerLock(), Zp(a, n), s();
|
|
11548
11604
|
};
|
|
11549
11605
|
}, [
|
|
11550
11606
|
a,
|
|
@@ -11564,14 +11620,14 @@ function Yp({ active: e, activeRef: t, controlRef: n, modelRef: r, settings: i }
|
|
|
11564
11620
|
C.current = c.getState().preselectionEnabled, c.getState().setPreselectionEnabled(!1);
|
|
11565
11621
|
let l = n.current;
|
|
11566
11622
|
l && (l.enabled = !1, l.cancel());
|
|
11567
|
-
let f =
|
|
11623
|
+
let f = qp(r.current, i);
|
|
11568
11624
|
d.current = f.eyeHeight, m.current = f.groundCheckInterval, p.current = f.groundMaxDistance, h.current = f.lookSensitivity, y.current = f.moveSpeed;
|
|
11569
11625
|
let g = new N().setFromQuaternion(a.quaternion, "YXZ");
|
|
11570
11626
|
return S.current = {
|
|
11571
11627
|
pitch: g.x,
|
|
11572
11628
|
yaw: g.y
|
|
11573
11629
|
}, () => {
|
|
11574
|
-
u.current.clear(), t(), document.pointerLockElement === o.domElement && document.exitPointerLock(),
|
|
11630
|
+
u.current.clear(), t(), document.pointerLockElement === o.domElement && document.exitPointerLock(), Zp(a, n), s();
|
|
11575
11631
|
};
|
|
11576
11632
|
}, [
|
|
11577
11633
|
e,
|
|
@@ -11586,8 +11642,8 @@ function Yp({ active: e, activeRef: t, controlRef: n, modelRef: r, settings: i }
|
|
|
11586
11642
|
}
|
|
11587
11643
|
//#endregion
|
|
11588
11644
|
//#region src/viewer/ViewerComponents/ViewerScene.tsx
|
|
11589
|
-
var
|
|
11590
|
-
function
|
|
11645
|
+
var nm = .1, rm = .02, im = 150, am = 150, om = 500, sm = 5e6, cm = 50, lm = .001, um = .001, dm = 1e3, fm = 50, pm = 30, mm = 240, hm = 7, gm = 1.25, _m = .08, vm = new U(1, 1, 1).normalize(), ym = new A(), bm = new We(), xm = new U(), Sm = new U(), Cm = new U();
|
|
11646
|
+
function wm(e = !1) {
|
|
11591
11647
|
return {
|
|
11592
11648
|
active: e,
|
|
11593
11649
|
finalFitDone: !1,
|
|
@@ -11595,23 +11651,23 @@ function vm(e = !1) {
|
|
|
11595
11651
|
userInteractedAfterFirstFit: !1
|
|
11596
11652
|
};
|
|
11597
11653
|
}
|
|
11598
|
-
function
|
|
11654
|
+
function Tm(e) {
|
|
11599
11655
|
let t = [];
|
|
11600
11656
|
return e?.traverse((e) => {
|
|
11601
11657
|
e instanceof z && e.geometry.attributes.ids && t.push(e);
|
|
11602
11658
|
}), t;
|
|
11603
11659
|
}
|
|
11604
|
-
function
|
|
11660
|
+
function Em(e) {
|
|
11605
11661
|
let t = e.geometry.index?.count;
|
|
11606
11662
|
return t === void 0 ? (e.geometry.attributes.position?.count ?? 0) / 3 : t / 3;
|
|
11607
11663
|
}
|
|
11608
|
-
function
|
|
11609
|
-
return e.reduce((e, t) => e +
|
|
11664
|
+
function Dm(e) {
|
|
11665
|
+
return e.reduce((e, t) => e + Em(t), 0);
|
|
11610
11666
|
}
|
|
11611
|
-
function
|
|
11612
|
-
return
|
|
11667
|
+
function Om(e) {
|
|
11668
|
+
return Dm(e) > sm;
|
|
11613
11669
|
}
|
|
11614
|
-
function
|
|
11670
|
+
function km(e, t) {
|
|
11615
11671
|
if (t <= 0 || !e.length) return [];
|
|
11616
11672
|
let n = [...e];
|
|
11617
11673
|
for (let e = n.length - 1; e > 0 && n.length - e <= t; e--) {
|
|
@@ -11620,10 +11676,10 @@ function Cm(e, t) {
|
|
|
11620
11676
|
}
|
|
11621
11677
|
return n.slice(-t);
|
|
11622
11678
|
}
|
|
11623
|
-
function
|
|
11679
|
+
function Am(e, t) {
|
|
11624
11680
|
if (t <= 0) return null;
|
|
11625
|
-
let n =
|
|
11626
|
-
if (!
|
|
11681
|
+
let n = Tm(e);
|
|
11682
|
+
if (!Om(n)) return null;
|
|
11627
11683
|
let r = n.filter((e) => e.visible);
|
|
11628
11684
|
if (r.length < 2) return null;
|
|
11629
11685
|
let i = Math.min(r.length, Math.round(r.length * t));
|
|
@@ -11636,87 +11692,87 @@ function wm(e, t) {
|
|
|
11636
11692
|
}
|
|
11637
11693
|
o.push(e);
|
|
11638
11694
|
});
|
|
11639
|
-
let s = [...
|
|
11640
|
-
return c > 0 && s.push(...
|
|
11695
|
+
let s = [...km(o, i)], c = i - s.length;
|
|
11696
|
+
return c > 0 && s.push(...km(a, c)), s.length ? {
|
|
11641
11697
|
hiddenMeshes: s,
|
|
11642
11698
|
root: e
|
|
11643
11699
|
} : null;
|
|
11644
11700
|
}
|
|
11645
|
-
function
|
|
11701
|
+
function jm(e) {
|
|
11646
11702
|
let t = /* @__PURE__ */ new Map(), n = 0;
|
|
11647
11703
|
return e.hiddenMeshes.forEach((e) => {
|
|
11648
11704
|
e.parent && (t.set(e, e.visible), e.visible && (e.userData[dl] = !0, e.visible = !1, n++));
|
|
11649
11705
|
}), n ? t : null;
|
|
11650
11706
|
}
|
|
11651
|
-
function
|
|
11707
|
+
function Mm(e) {
|
|
11652
11708
|
e?.forEach((e, t) => {
|
|
11653
11709
|
delete t.userData[dl], t.visible = e;
|
|
11654
11710
|
});
|
|
11655
11711
|
}
|
|
11656
|
-
function
|
|
11657
|
-
let t =
|
|
11658
|
-
return t ? Math.max(t.radius *
|
|
11712
|
+
function Nm(e) {
|
|
11713
|
+
let t = Fm(e);
|
|
11714
|
+
return t ? Math.max(t.radius * rm, nm) : nm;
|
|
11659
11715
|
}
|
|
11660
|
-
function
|
|
11716
|
+
function Pm(e) {
|
|
11661
11717
|
if (e.dollyToCursor = !0, e.camera instanceof Ae) {
|
|
11662
11718
|
e.mouseButtons.middle = Fs.ACTION.ZOOM, e.mouseButtons.wheel = Fs.ACTION.ZOOM, e.touches.two = Fs.ACTION.TOUCH_ZOOM_TRUCK, e.infinityDolly = !1;
|
|
11663
11719
|
return;
|
|
11664
11720
|
}
|
|
11665
11721
|
e.mouseButtons.middle = Fs.ACTION.DOLLY, e.mouseButtons.wheel = Fs.ACTION.DOLLY, e.touches.two = Fs.ACTION.TOUCH_DOLLY_TRUCK, e.infinityDolly = !0;
|
|
11666
11722
|
}
|
|
11667
|
-
function
|
|
11668
|
-
if (!e || (
|
|
11669
|
-
let t =
|
|
11723
|
+
function Fm(e) {
|
|
11724
|
+
if (!e || (ym.setFromObject(e), ym.isEmpty())) return null;
|
|
11725
|
+
let t = ym.getBoundingSphere(bm);
|
|
11670
11726
|
return !Number.isFinite(t.radius) || t.radius <= 0 ? null : t;
|
|
11671
11727
|
}
|
|
11672
|
-
function
|
|
11728
|
+
function Im(e) {
|
|
11673
11729
|
return e.type === "Group" && typeof e.userData.modelID == "number";
|
|
11674
11730
|
}
|
|
11675
|
-
function
|
|
11676
|
-
return e?.children.filter(
|
|
11731
|
+
function Lm(e) {
|
|
11732
|
+
return e?.children.filter(Im) ?? [];
|
|
11677
11733
|
}
|
|
11678
|
-
function
|
|
11679
|
-
return
|
|
11734
|
+
function Rm(e, t) {
|
|
11735
|
+
return Lm(e).find((e) => e.userData.modelID === t) ?? null;
|
|
11680
11736
|
}
|
|
11681
|
-
function
|
|
11737
|
+
function zm(e) {
|
|
11682
11738
|
return e instanceof Ae ? "orthographic" : "perspective";
|
|
11683
11739
|
}
|
|
11684
|
-
function
|
|
11740
|
+
function Bm(e) {
|
|
11685
11741
|
return e instanceof je || e instanceof Ae;
|
|
11686
11742
|
}
|
|
11687
|
-
function
|
|
11743
|
+
function Vm(e) {
|
|
11688
11744
|
return e.height > 0 ? e.width / e.height : 1;
|
|
11689
11745
|
}
|
|
11690
|
-
function
|
|
11691
|
-
return Math.max(
|
|
11746
|
+
function Hm(e) {
|
|
11747
|
+
return Math.max(um, (e.top - e.bottom) / Math.max(e.zoom, 1e-4));
|
|
11692
11748
|
}
|
|
11693
|
-
function
|
|
11694
|
-
let r = Math.max(
|
|
11749
|
+
function Um(e, t, n) {
|
|
11750
|
+
let r = Math.max(um, n) * Math.max(e.zoom, 1e-4), i = r * t;
|
|
11695
11751
|
e.left = -i / 2, e.right = i / 2, e.top = r / 2, e.bottom = -r / 2, e.updateProjectionMatrix();
|
|
11696
11752
|
}
|
|
11697
|
-
function
|
|
11698
|
-
if (e instanceof Ae) return
|
|
11753
|
+
function Wm(e, t) {
|
|
11754
|
+
if (e instanceof Ae) return Hm(e);
|
|
11699
11755
|
if (e instanceof je) {
|
|
11700
|
-
let n = Math.max(
|
|
11756
|
+
let n = Math.max(lm, e.position.distanceTo(t));
|
|
11701
11757
|
return 2 * Math.tan(Se.degToRad(e.fov) / 2) * n;
|
|
11702
11758
|
}
|
|
11703
11759
|
return 1;
|
|
11704
11760
|
}
|
|
11705
|
-
function
|
|
11706
|
-
let n =
|
|
11761
|
+
function Gm(e, t) {
|
|
11762
|
+
let n = Vm(t);
|
|
11707
11763
|
if (e instanceof je) {
|
|
11708
11764
|
e.aspect = n, e.updateProjectionMatrix();
|
|
11709
11765
|
return;
|
|
11710
11766
|
}
|
|
11711
|
-
e instanceof Ae &&
|
|
11767
|
+
e instanceof Ae && Um(e, n, Hm(e));
|
|
11712
11768
|
}
|
|
11713
|
-
function
|
|
11714
|
-
let n =
|
|
11769
|
+
function Km(e, t) {
|
|
11770
|
+
let n = Fm(t);
|
|
11715
11771
|
if (!n) return;
|
|
11716
|
-
let r = Math.max(
|
|
11772
|
+
let r = Math.max(dm, n.radius * fm, e.near + 1);
|
|
11717
11773
|
Math.abs(e.far - r) < 1 || (e.far = r, e.updateProjectionMatrix());
|
|
11718
11774
|
}
|
|
11719
|
-
function
|
|
11775
|
+
function qm(e, t) {
|
|
11720
11776
|
let n = new A();
|
|
11721
11777
|
return Object.entries(e).forEach(([e, r]) => {
|
|
11722
11778
|
let i = Number(e), a = t.elementBounds.get(i);
|
|
@@ -11726,16 +11782,16 @@ function Vm(e, t) {
|
|
|
11726
11782
|
});
|
|
11727
11783
|
}), n.isEmpty() ? null : n;
|
|
11728
11784
|
}
|
|
11729
|
-
function
|
|
11730
|
-
let t = e.getSize(
|
|
11731
|
-
return Number.isFinite(n) && n > 0 ? n *
|
|
11785
|
+
function Jm(e) {
|
|
11786
|
+
let t = e.getSize(Cm), n = Math.max(t.x, t.y, t.z);
|
|
11787
|
+
return Number.isFinite(n) && n > 0 ? n * _m : nm;
|
|
11732
11788
|
}
|
|
11733
|
-
function
|
|
11734
|
-
let r = Math.max(
|
|
11735
|
-
return Number.isFinite(i) && i >= r ? e : (
|
|
11789
|
+
function Ym(e, t, n) {
|
|
11790
|
+
let r = Math.max(nm, (Number.isFinite(n) ? n : nm) * gm), i = t.position.distanceTo(e);
|
|
11791
|
+
return Number.isFinite(i) && i >= r ? e : (xm.copy(e).sub(t.position), (!Number.isFinite(xm.x + xm.y + xm.z) || xm.lengthSq() === 0) && t.getWorldDirection(xm), xm.lengthSq() === 0 && xm.set(0, 0, -1), xm.normalize(), Sm.copy(t.position).addScaledVector(xm, r));
|
|
11736
11792
|
}
|
|
11737
|
-
function
|
|
11738
|
-
let A = D((e) => e.camera), ne = D((e) => e.gl), j = D((e) => e.invalidate), re = D((e) => e.scene), ie = D((e) => e.set), ae = D((e) => e.size), M =
|
|
11793
|
+
function Xm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadGeneration: i, lightRef: a, materialMode: o, modelRef: s, modelsData: c, modelsLoading: l, initialPlanPlane: u, createPlanComment: d, createPlanMarkupCloud: f, deleteAllPlanNotes: p, onReady: m, onModelsReady: g, onCameraDprModeChange: v, publicApi: C, invalidatePlanViews: w, setPlanPreselectionHandler: ee, setPlanVisualObjectsGetter: T, setSceneApi: E, setPlanNotesModeActive: O, usePerformanceMoving: te, useWebGPU: k }) {
|
|
11794
|
+
let A = D((e) => e.camera), ne = D((e) => e.gl), j = D((e) => e.invalidate), re = D((e) => e.scene), ie = D((e) => e.set), ae = D((e) => e.size), M = vd(s), oe = Id(M), { colorPaletteTexture: se, colorUtils: ce } = Ru(M), le = Et(), ue = G((e) => e.selected), de = Bs(s), N = hf(s, n, de, k, w), fe = h((e) => {
|
|
11739
11795
|
N.setCapsPreselection(e), w();
|
|
11740
11796
|
}, [N, w]);
|
|
11741
11797
|
_(() => {
|
|
@@ -11778,7 +11834,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
11778
11834
|
I,
|
|
11779
11835
|
me,
|
|
11780
11836
|
he
|
|
11781
|
-
]), _e = b(() => new $n(), []), ve = oe.buildIndex, ye = M.resetIndex, L = ce.applyStoredColors, be =
|
|
11837
|
+
]), _e = b(() => new $n(), []), ve = oe.buildIndex, ye = M.resetIndex, L = ce.applyStoredColors, be = Sp(), xe = x(null), R = x(null), z = x(null), Ce = x(null), we = x(null), Te = x(null), B = x(wm()), Ee = x([]), De = x(/* @__PURE__ */ new Map()), Oe = x(/* @__PURE__ */ new Set()), ke = x(l), Me = x(null), Ne = x(null), Pe = x(null), Fe = x(0), Ie = x(!1), Le = x(l), Re = x(!1), ze = x(!1), Be = x(i), Ve = x(/* @__PURE__ */ new Map()), [He, Ue] = S(0), [We, Ge] = S(0);
|
|
11782
11838
|
_(() => {
|
|
11783
11839
|
let e = new Set(Object.keys(c).map((e) => Number(e)));
|
|
11784
11840
|
Oe.current.forEach((t) => {
|
|
@@ -11786,7 +11842,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
11786
11842
|
}), Oe.current = e;
|
|
11787
11843
|
}, [ce, c]);
|
|
11788
11844
|
let [Ke, qe] = S(!1), [Je, Ye] = S({}), Xe = x(!1), V = G((e) => e.showStats), Ze = G((e) => e.lighting), Qe = G((e) => e.performanceMovingFactor);
|
|
11789
|
-
Be.current !== i && (Be.current = i, Ve.current.clear(), B.current =
|
|
11845
|
+
Be.current !== i && (Be.current = i, Ve.current.clear(), B.current = wm(), Me.current = null);
|
|
11790
11846
|
let $e = h((e, t, n) => {
|
|
11791
11847
|
let r = Ve.current.get(e) ?? 0;
|
|
11792
11848
|
Ve.current.set(e, t), n > 0 && t >= n && r < n && Ue((e) => e + 1);
|
|
@@ -11799,10 +11855,10 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
11799
11855
|
if (!t || e.camera.uuid !== t.cameraUuid) return !1;
|
|
11800
11856
|
Ne.current = null, e.cancel(), e.updateCameraUp();
|
|
11801
11857
|
let n = e;
|
|
11802
|
-
return e.zoomTo(t.zoom, !1), e.setFocalOffset(0, 0, 0, !1), e.setLookAt(t.position.x, t.position.y, t.position.z, t.target.x, t.target.y, t.target.z, !1),
|
|
11858
|
+
return e.zoomTo(t.zoom, !1), e.setFocalOffset(0, 0, 0, !1), e.setLookAt(t.position.x, t.position.y, t.position.z, t.target.x, t.target.y, t.target.z, !1), Pm(e), e.minDistance = Nm(s.current), e.stop(), e.update(0), n.saveState?.(), j(), !0;
|
|
11803
11859
|
}, [j, s]), tt = h((e) => {
|
|
11804
11860
|
let t = n;
|
|
11805
|
-
t.current !== e && (t.current = e, e && (e.minDistance =
|
|
11861
|
+
t.current !== e && (t.current = e, e && (e.minDistance = Nm(s.current), Pm(e), et(e)), Ge((e) => e + 1));
|
|
11806
11862
|
}, [
|
|
11807
11863
|
n,
|
|
11808
11864
|
s,
|
|
@@ -11817,7 +11873,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
11817
11873
|
...e
|
|
11818
11874
|
}));
|
|
11819
11875
|
}, []), st = h(() => {
|
|
11820
|
-
R.current !== null && (window.clearTimeout(R.current), R.current = null), z.current !== null && (window.clearTimeout(z.current), z.current = null), Ce.current !== null && (window.clearTimeout(Ce.current), Ce.current = null),
|
|
11876
|
+
R.current !== null && (window.clearTimeout(R.current), R.current = null), z.current !== null && (window.clearTimeout(z.current), z.current = null), Ce.current !== null && (window.clearTimeout(Ce.current), Ce.current = null), Mm(Te.current), Te.current = null, we.current = null, N.setCapsCameraMotionActive(!1), N.setEdgesCameraMotionActive?.(!1), v("sleep"), j();
|
|
11821
11877
|
}, [
|
|
11822
11878
|
N,
|
|
11823
11879
|
j,
|
|
@@ -11855,7 +11911,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
11855
11911
|
s,
|
|
11856
11912
|
k
|
|
11857
11913
|
]), _(() => {
|
|
11858
|
-
|
|
11914
|
+
Gm(A, ae), j();
|
|
11859
11915
|
}, [
|
|
11860
11916
|
A,
|
|
11861
11917
|
j,
|
|
@@ -11873,11 +11929,11 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
11873
11929
|
let dt = b(() => {
|
|
11874
11930
|
let e = Object.keys(c).sort((e, t) => Number(e) - Number(t));
|
|
11875
11931
|
for (let t of e) {
|
|
11876
|
-
let e =
|
|
11932
|
+
let e = ed(c[Number(t)]);
|
|
11877
11933
|
if (e) return e;
|
|
11878
11934
|
}
|
|
11879
11935
|
return null;
|
|
11880
|
-
}, [c]), ft = b(() =>
|
|
11936
|
+
}, [c]), ft = b(() => Qu(dt ?? void 0), [dt]), pt = b(() => Object.entries(c).map(([e, t]) => [Number(e), t]), [c]), mt = b(() => pt.map(([e]) => e), [pt]), ht = b(() => new Map(pt.map(([e, t]) => [e, Object.keys(t.data).length])), [pt]);
|
|
11881
11937
|
Ee.current = mt, De.current = ht, ke.current = l, _(() => {
|
|
11882
11938
|
let e = new Set(mt);
|
|
11883
11939
|
Ve.current.forEach((t, n) => {
|
|
@@ -11885,11 +11941,11 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
11885
11941
|
});
|
|
11886
11942
|
}, [mt]);
|
|
11887
11943
|
let gt = o !== "performance", _t = h(() => {
|
|
11888
|
-
n.current && (n.current.minDistance =
|
|
11944
|
+
n.current && (n.current.minDistance = Nm(s.current));
|
|
11889
11945
|
}, [n, s]), vt = h((e, t = !1) => {
|
|
11890
11946
|
let r = n.current;
|
|
11891
11947
|
if (!r) return !1;
|
|
11892
|
-
let i = t ?
|
|
11948
|
+
let i = t ? Ym(e, A, r.minDistance) : e;
|
|
11893
11949
|
return r.cancel(), r.setOrbitPoint(i.x, i.y, i.z), !0;
|
|
11894
11950
|
}, [A, n]), yt = h((e) => {
|
|
11895
11951
|
xe.current = e.clone(), vt(e, !0);
|
|
@@ -11901,18 +11957,18 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
11901
11957
|
a,
|
|
11902
11958
|
s
|
|
11903
11959
|
]), xt = h((e) => {
|
|
11904
|
-
if (!
|
|
11905
|
-
if (
|
|
11960
|
+
if (!Bm(A)) return null;
|
|
11961
|
+
if (zm(A) === e) return A;
|
|
11906
11962
|
let r = n.current, i = new U(), a = new U();
|
|
11907
11963
|
r ? (r.getTarget(i, !0), r.getPosition(a, !0)) : (A.getWorldDirection(i), a.copy(A.position), i.add(a));
|
|
11908
11964
|
let o = a.clone().sub(i);
|
|
11909
|
-
o.lengthSq() <
|
|
11910
|
-
let s =
|
|
11965
|
+
o.lengthSq() < lm * lm && A.getWorldDirection(o).multiplyScalar(-1), o.lengthSq() < lm * lm && o.copy(vm), o.normalize();
|
|
11966
|
+
let s = Vm(ae), c = Wm(A, i), l = A.near, u = A.far, d = e === "orthographic" ? new Ae(-s * c * .5, s * c * .5, c * .5, -c * .5, l, u) : new je(cm, s, l, u);
|
|
11911
11967
|
if (d.manual = !0, d instanceof je) {
|
|
11912
11968
|
let e = c / (2 * Math.tan(Se.degToRad(d.fov) * .5));
|
|
11913
11969
|
a.copy(i).addScaledVector(o, e);
|
|
11914
11970
|
}
|
|
11915
|
-
return d.position.copy(a), d.up.copy(A.up), d.layers.mask = A.layers.mask, d.lookAt(i), d.updateMatrixWorld(!0),
|
|
11971
|
+
return d.position.copy(a), d.up.copy(A.up), d.layers.mask = A.layers.mask, d.lookAt(i), d.updateMatrixWorld(!0), Gm(d, ae), Ne.current = {
|
|
11916
11972
|
cameraUuid: d.uuid,
|
|
11917
11973
|
position: a.clone(),
|
|
11918
11974
|
target: i.clone(),
|
|
@@ -11928,10 +11984,10 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
11928
11984
|
ae.height,
|
|
11929
11985
|
ae.width
|
|
11930
11986
|
]), St = h(() => {
|
|
11931
|
-
let e =
|
|
11987
|
+
let e = zm(A) === "perspective" ? "orthographic" : "perspective";
|
|
11932
11988
|
return xt(e), e;
|
|
11933
11989
|
}, [A, xt]), Ct = h((e, t, { createClippingPlane: r = !0 } = {}) => {
|
|
11934
|
-
let i = xt("orthographic") ?? (
|
|
11990
|
+
let i = xt("orthographic") ?? (Bm(A) ? A : null);
|
|
11935
11991
|
if (!i) return null;
|
|
11936
11992
|
let a = e.clone().normalize(), o = !1;
|
|
11937
11993
|
Fe.current += 1, ut(!0), N.setHelpersActive(!1), r && N.createPlaneFromPointAndNormal(wl(a), a.normal.clone());
|
|
@@ -11966,10 +12022,10 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
11966
12022
|
ae
|
|
11967
12023
|
]);
|
|
11968
12024
|
_(() => {
|
|
11969
|
-
if (!u || ze.current || !s.current || !
|
|
12025
|
+
if (!u || ze.current || !s.current || !Bm(A)) return;
|
|
11970
12026
|
let e = u.clone().normalize();
|
|
11971
12027
|
ze.current = !0;
|
|
11972
|
-
let t = xt("orthographic") ?? (
|
|
12028
|
+
let t = xt("orthographic") ?? (Bm(A) ? A : null);
|
|
11973
12029
|
t && (ut(!0), N.setHelpersActive(!1), N.createPlaneFromPointAndNormal(wl(e), e.normal.clone()), requestAnimationFrame(() => {
|
|
11974
12030
|
Cl({
|
|
11975
12031
|
camera: t,
|
|
@@ -12001,14 +12057,14 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12001
12057
|
}, []), Tt = h((t) => {
|
|
12002
12058
|
if (!t) return !1;
|
|
12003
12059
|
let n = wt();
|
|
12004
|
-
if (!e || !r) return n || (B.current =
|
|
12060
|
+
if (!e || !r) return n || (B.current = wm()), !1;
|
|
12005
12061
|
let i = B.current;
|
|
12006
12062
|
if (n) {
|
|
12007
|
-
i.active || (B.current =
|
|
12063
|
+
i.active || (B.current = wm(!0));
|
|
12008
12064
|
let e = B.current;
|
|
12009
12065
|
return e.firstFitDone ? !1 : (e.firstFitDone = !0, !0);
|
|
12010
12066
|
}
|
|
12011
|
-
return i.active ? i.finalFitDone ? !1 : i.firstFitDone && i.userInteractedAfterFirstFit ? (B.current =
|
|
12067
|
+
return i.active ? i.finalFitDone ? !1 : i.firstFitDone && i.userInteractedAfterFirstFit ? (B.current = wm(), !1) : (i.finalFitDone = !0, !0) : !0;
|
|
12012
12068
|
}, [
|
|
12013
12069
|
e,
|
|
12014
12070
|
r,
|
|
@@ -12016,11 +12072,11 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12016
12072
|
]), Dt = h((e, t = !1) => {
|
|
12017
12073
|
let r = n.current;
|
|
12018
12074
|
if (!r) return;
|
|
12019
|
-
let i =
|
|
12075
|
+
let i = qm(e, M.buildIndex());
|
|
12020
12076
|
if (!i) return;
|
|
12021
12077
|
let a = i.getCenter(new U());
|
|
12022
12078
|
if (xe.current = a.clone(), r.cancel(), t) {
|
|
12023
|
-
let e =
|
|
12079
|
+
let e = Jm(i);
|
|
12024
12080
|
r.fitToBox(i, !0, {
|
|
12025
12081
|
paddingBottom: e,
|
|
12026
12082
|
paddingLeft: e,
|
|
@@ -12055,7 +12111,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12055
12111
|
let e = () => {
|
|
12056
12112
|
R.current !== null && (window.clearTimeout(R.current), R.current = null);
|
|
12057
12113
|
}, t = () => {
|
|
12058
|
-
Te.current && (
|
|
12114
|
+
Te.current && (Mm(Te.current), Te.current = null, j());
|
|
12059
12115
|
};
|
|
12060
12116
|
if (!te) {
|
|
12061
12117
|
e(), t(), N.setCapsCameraMotionActive(!1), N.setEdgesCameraMotionActive?.(!1), v("sleep");
|
|
@@ -12070,7 +12126,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12070
12126
|
return;
|
|
12071
12127
|
}
|
|
12072
12128
|
R.current = null, v("move"), N.setCapsCameraMotionActive(!0), N.setEdgesCameraMotionActive?.(!0);
|
|
12073
|
-
},
|
|
12129
|
+
}, im));
|
|
12074
12130
|
}, a = () => {
|
|
12075
12131
|
e(), t(), N.setCapsCameraMotionActive(!1), N.setEdgesCameraMotionActive?.(!1), v("sleep");
|
|
12076
12132
|
};
|
|
@@ -12090,11 +12146,11 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12090
12146
|
}, t = () => {
|
|
12091
12147
|
Ce.current !== null && (window.clearTimeout(Ce.current), Ce.current = null);
|
|
12092
12148
|
}, r = (n = !1) => {
|
|
12093
|
-
e(), Te.current && (
|
|
12149
|
+
e(), Te.current && (Mm(Te.current), Te.current = null, j()), n && (t(), we.current = null);
|
|
12094
12150
|
}, i = () => {
|
|
12095
12151
|
t(), Ce.current = window.setTimeout(() => {
|
|
12096
12152
|
Ce.current = null, we.current = null;
|
|
12097
|
-
},
|
|
12153
|
+
}, om);
|
|
12098
12154
|
};
|
|
12099
12155
|
if (!te) {
|
|
12100
12156
|
r(!0);
|
|
@@ -12104,13 +12160,13 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12104
12160
|
if (!a) return;
|
|
12105
12161
|
let o = () => {
|
|
12106
12162
|
if (z.current = null, Ie.current || Te.current) return;
|
|
12107
|
-
s.current?.updateMatrixWorld(!0), (!we.current || we.current.root !== s.current) && (we.current =
|
|
12163
|
+
s.current?.updateMatrixWorld(!0), (!we.current || we.current.root !== s.current) && (we.current = Am(s.current, Qe));
|
|
12108
12164
|
let e = we.current;
|
|
12109
12165
|
if (!e) return;
|
|
12110
|
-
let t =
|
|
12166
|
+
let t = jm(e);
|
|
12111
12167
|
t && (Te.current = t, j());
|
|
12112
12168
|
}, c = () => {
|
|
12113
|
-
Ie.current || (t(), !Te.current && z.current === null && (z.current = window.setTimeout(o,
|
|
12169
|
+
Ie.current || (t(), !Te.current && z.current === null && (z.current = window.setTimeout(o, am)));
|
|
12114
12170
|
}, l = () => {
|
|
12115
12171
|
r(), i();
|
|
12116
12172
|
};
|
|
@@ -12125,7 +12181,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12125
12181
|
Qe,
|
|
12126
12182
|
te
|
|
12127
12183
|
]), _(() => {
|
|
12128
|
-
l && !Le.current && (B.current =
|
|
12184
|
+
l && !Le.current && (B.current = wm(!0)), Le.current = l;
|
|
12129
12185
|
}, [l]), _(() => {
|
|
12130
12186
|
let e = n.current, t = ne.domElement, r = () => {
|
|
12131
12187
|
let e = B.current;
|
|
@@ -12140,7 +12196,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12140
12196
|
ne
|
|
12141
12197
|
]);
|
|
12142
12198
|
let kt = h(() => !wt(), [wt]);
|
|
12143
|
-
return
|
|
12199
|
+
return pp(s, n, de, yt, N.getSelectableObjects, fe, kt, We), _f(), _(() => {
|
|
12144
12200
|
let e = ne.domElement, t = (e) => {
|
|
12145
12201
|
let t = xe.current;
|
|
12146
12202
|
t && e.button === 0 && (e.ctrlKey || e.metaKey || e.shiftKey || vt(t, !0));
|
|
@@ -12161,11 +12217,11 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12161
12217
|
if (!e) {
|
|
12162
12218
|
let e = B.current;
|
|
12163
12219
|
if (e.active && e.firstFitDone && e.userInteractedAfterFirstFit) {
|
|
12164
|
-
B.current =
|
|
12220
|
+
B.current = wm();
|
|
12165
12221
|
return;
|
|
12166
12222
|
}
|
|
12167
12223
|
}
|
|
12168
|
-
bt(), e || (B.current =
|
|
12224
|
+
bt(), e || (B.current = wm());
|
|
12169
12225
|
}, c = () => {
|
|
12170
12226
|
if (e) {
|
|
12171
12227
|
if (!k) {
|
|
@@ -12186,7 +12242,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12186
12242
|
}
|
|
12187
12243
|
}, l = () => {
|
|
12188
12244
|
if (n !== null) return;
|
|
12189
|
-
let e =
|
|
12245
|
+
let e = hm, t = () => {
|
|
12190
12246
|
if (r) {
|
|
12191
12247
|
n = null;
|
|
12192
12248
|
return;
|
|
@@ -12204,7 +12260,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12204
12260
|
n = requestAnimationFrame(t);
|
|
12205
12261
|
}, u = (e) => {
|
|
12206
12262
|
if (r || !s.current) return;
|
|
12207
|
-
s.current.updateMatrixWorld(!0), (A instanceof je || A instanceof Ae) &&
|
|
12263
|
+
s.current.updateMatrixWorld(!0), (A instanceof je || A instanceof Ae) && Km(A, s.current), _t(), ye();
|
|
12208
12264
|
let n = ve();
|
|
12209
12265
|
if (!n.records.size && e > 0) {
|
|
12210
12266
|
t = requestAnimationFrame(() => u(e - 1));
|
|
@@ -12212,7 +12268,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12212
12268
|
}
|
|
12213
12269
|
L(), N.syncWithModel(), P.syncWithModel(), n.records.size > 0 && !wt() && l(), Me.current !== A.uuid && Tt(n.records.size > 0) && c();
|
|
12214
12270
|
};
|
|
12215
|
-
return a(() => u(k ?
|
|
12271
|
+
return a(() => u(k ? mm : pm)), () => {
|
|
12216
12272
|
r = !0, t !== null && cancelAnimationFrame(t), n !== null && cancelAnimationFrame(n);
|
|
12217
12273
|
};
|
|
12218
12274
|
}, [
|
|
@@ -12248,7 +12304,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12248
12304
|
camera: {
|
|
12249
12305
|
fitCamera: bt,
|
|
12250
12306
|
getIntersection: de.getIntersection,
|
|
12251
|
-
getProjection: () =>
|
|
12307
|
+
getProjection: () => zm(A),
|
|
12252
12308
|
setFirstPersonControlActive: it,
|
|
12253
12309
|
setFirstPersonControlSettings: at,
|
|
12254
12310
|
setProjection: xt,
|
|
@@ -12314,10 +12370,13 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12314
12370
|
toggleNoteMode: ge.toggleNoteMode
|
|
12315
12371
|
},
|
|
12316
12372
|
geometryUtils: {
|
|
12373
|
+
get indexesState() {
|
|
12374
|
+
return oe.indexesState;
|
|
12375
|
+
},
|
|
12317
12376
|
getAllIds: oe.getAllIds,
|
|
12318
12377
|
getIfcSpacesVisibility: oe.getIfcSpacesVisibility,
|
|
12319
|
-
getModelGeometry: (e) =>
|
|
12320
|
-
getModelsGeometry: () =>
|
|
12378
|
+
getModelGeometry: (e) => Rm(s.current, e),
|
|
12379
|
+
getModelsGeometry: () => Lm(s.current),
|
|
12321
12380
|
hideByIds: (e) => t(() => oe.hideByIds(e)),
|
|
12322
12381
|
hideSelected: () => t(oe.hideSelected),
|
|
12323
12382
|
isolateByIds: (e) => t(() => oe.isolateByIds(e)),
|
|
@@ -12379,7 +12438,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12379
12438
|
V && /* @__PURE__ */ W(ct, {}),
|
|
12380
12439
|
/* @__PURE__ */ W("group", {
|
|
12381
12440
|
ref: H,
|
|
12382
|
-
children: pt.map(([e, t]) => /* @__PURE__ */ W(
|
|
12441
|
+
children: pt.map(([e, t]) => /* @__PURE__ */ W(cd, {
|
|
12383
12442
|
colorPaletteTexture: se,
|
|
12384
12443
|
coordinationMatrix: ft,
|
|
12385
12444
|
data: t,
|
|
@@ -12392,7 +12451,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12392
12451
|
}, e))
|
|
12393
12452
|
}),
|
|
12394
12453
|
ge.layer,
|
|
12395
|
-
/* @__PURE__ */ W(
|
|
12454
|
+
/* @__PURE__ */ W(tm, {
|
|
12396
12455
|
active: Ke,
|
|
12397
12456
|
activeRef: Xe,
|
|
12398
12457
|
controlRef: n,
|
|
@@ -12400,10 +12459,10 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12400
12459
|
settings: Je
|
|
12401
12460
|
}),
|
|
12402
12461
|
!Ke && /* @__PURE__ */ W(ot, {
|
|
12403
|
-
camera:
|
|
12462
|
+
camera: Bm(A) ? A : void 0,
|
|
12404
12463
|
dollyToCursor: !0,
|
|
12405
12464
|
infinityDolly: A instanceof je,
|
|
12406
|
-
minDistance:
|
|
12465
|
+
minDistance: nm,
|
|
12407
12466
|
ref: tt,
|
|
12408
12467
|
draggingSmoothTime: .03,
|
|
12409
12468
|
smoothTime: .05
|
|
@@ -12412,8 +12471,8 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12412
12471
|
}
|
|
12413
12472
|
//#endregion
|
|
12414
12473
|
//#region src/viewer/Viewer.tsx
|
|
12415
|
-
var
|
|
12416
|
-
function
|
|
12474
|
+
var Zm = .75, Qm = .6;
|
|
12475
|
+
function $m(e, t, n) {
|
|
12417
12476
|
let r = e?.[t.modelID] ?? {
|
|
12418
12477
|
coordinationMatrix: t.coordinationMatrix ?? t.geometry.matrix ?? void 0,
|
|
12419
12478
|
data: {},
|
|
@@ -12438,11 +12497,11 @@ function qm(e, t, n) {
|
|
|
12438
12497
|
}
|
|
12439
12498
|
};
|
|
12440
12499
|
}
|
|
12441
|
-
function
|
|
12500
|
+
function eh(e) {
|
|
12442
12501
|
let t = {};
|
|
12443
12502
|
return e.materialMode !== void 0 && (t.materialMode = e.materialMode), e.uploadMode !== void 0 && (t.uploadMode = e.uploadMode), e.useDoubleSideMaterial !== void 0 && (t.useDoubleSideMaterial = e.useDoubleSideMaterial), Object.keys(t).length ? t : void 0;
|
|
12444
12503
|
}
|
|
12445
|
-
function
|
|
12504
|
+
function th(e, t, n) {
|
|
12446
12505
|
let r = { ...e ?? {} };
|
|
12447
12506
|
return Object.entries(t).forEach(([t, i]) => {
|
|
12448
12507
|
let a = Number(t);
|
|
@@ -12455,22 +12514,22 @@ function Ym(e, t, n) {
|
|
|
12455
12514
|
});
|
|
12456
12515
|
}), r;
|
|
12457
12516
|
}
|
|
12458
|
-
function
|
|
12517
|
+
function nh(e, t) {
|
|
12459
12518
|
if (!e || !Object.prototype.hasOwnProperty.call(e, t)) return e;
|
|
12460
12519
|
let n = { ...e };
|
|
12461
12520
|
return delete n[t], Object.keys(n).length ? n : void 0;
|
|
12462
12521
|
}
|
|
12463
|
-
function
|
|
12522
|
+
function rh(e, t) {
|
|
12464
12523
|
return Array.isArray(e) ? [Math.min(e[0], t), Math.min(e[1], t)] : typeof e == "number" ? Math.min(e, t) : t;
|
|
12465
12524
|
}
|
|
12466
|
-
function
|
|
12525
|
+
function ih(e) {
|
|
12467
12526
|
return Array.isArray(e) ? [Math.max(e[0], 2), Math.max(e[1], 2)] : typeof e == "number" ? Math.max(e, 2) : 2;
|
|
12468
12527
|
}
|
|
12469
|
-
function
|
|
12528
|
+
function ah() {
|
|
12470
12529
|
let e = navigator, t = navigator.userAgent.toLowerCase(), n = navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1, r = window.matchMedia?.("(pointer: coarse)").matches ?? !1;
|
|
12471
12530
|
return e.userAgentData?.mobile || n || /android|iphone|ipad|ipod|mobile|tablet/.test(t) || navigator.maxTouchPoints > 1 && r ? "mobile" : "pc";
|
|
12472
12531
|
}
|
|
12473
|
-
function
|
|
12532
|
+
function oh({ autoFitCamera: e = !0, camera: t = {
|
|
12474
12533
|
position: [
|
|
12475
12534
|
10,
|
|
12476
12535
|
10,
|
|
@@ -12481,7 +12540,7 @@ function eh({ autoFitCamera: e = !0, camera: t = {
|
|
|
12481
12540
|
let E = x(null), D = x(null), O = x(null), te = x(null), [k, A] = S(), [ne, j] = S(!1), [re, ie] = S(!0), [ae, M] = S(null), oe = x(void 0), se = x(!1), ce = x(null), le = x(null), ue = x({
|
|
12482
12541
|
lastProgress: 0,
|
|
12483
12542
|
requestID: 0
|
|
12484
|
-
}), de = x(null), N = x(/* @__PURE__ */ new Set()), fe = x(0), P = x(/* @__PURE__ */ new Map()), F = x(/* @__PURE__ */ new Set()), pe = x(/* @__PURE__ */ new Set()), I = x(!1), me = x(null), he = x(null), ge = x(/* @__PURE__ */ new Set()), _e = x(/* @__PURE__ */ new Map()), ve = x(!T), ye = x(/* @__PURE__ */ new Set()), L = Et(), be = G((e) => e.setModelNames), xe = G((e) => e.setModelProps), Se = G((e) => e.setModelStructure), R = G((e) => e.setShowNavCube), z = G((e) => e.setShowStats), Ce = G((e) => e.setUserDevice), we = G((e) => e.showNavCube), Te = ne, B = Te ? k ?? s : s ?? k, Ee = r ?? re, De = u ?
|
|
12543
|
+
}), de = x(null), N = x(/* @__PURE__ */ new Set()), fe = x(0), P = x(/* @__PURE__ */ new Map()), F = x(/* @__PURE__ */ new Set()), pe = x(/* @__PURE__ */ new Set()), I = x(!1), me = x(null), he = x(null), ge = x(/* @__PURE__ */ new Set()), _e = x(/* @__PURE__ */ new Map()), ve = x(!T), ye = x(/* @__PURE__ */ new Set()), L = Et(), be = G((e) => e.setModelNames), xe = G((e) => e.setModelProps), Se = G((e) => e.setModelStructure), R = G((e) => e.setShowNavCube), z = G((e) => e.setShowStats), Ce = G((e) => e.setUserDevice), we = G((e) => e.showNavCube), Te = ne, B = Te ? k ?? s : s ?? k, Ee = r ?? re, De = u ? rh(n, 1) : n, Oe = rh(De, u ? Qm : Zm), ke = c ?? (u ? "performance" : void 0), [Ae, je] = S("sleep"), Me = ih(De), Ne = b(() => T ? Po({ performanceMode: u }) : u ? Go : void 0, [u, T]), Pe = u ? Wo : Uo, Fe = h(() => {
|
|
12485
12544
|
F.current.forEach((e) => {
|
|
12486
12545
|
e();
|
|
12487
12546
|
});
|
|
@@ -12611,9 +12670,9 @@ function eh({ autoFitCamera: e = !0, camera: t = {
|
|
|
12611
12670
|
return t?.(r), r;
|
|
12612
12671
|
});
|
|
12613
12672
|
}, []), Ze = h((e, t, n) => {
|
|
12614
|
-
V((t) =>
|
|
12673
|
+
V((t) => $m(t, e, n), t);
|
|
12615
12674
|
}, [V]), Qe = h(async (e, t = {}) => {
|
|
12616
|
-
let { clearViewer: n = !1, fitToView: r = !0, onChunk: i, onModelLoadingChange: a, onModelProgress: o, onModelsDataChange: s, onProgress: c, ...l } = t, u = fe.current + 1, d =
|
|
12675
|
+
let { clearViewer: n = !1, fitToView: r = !0, onChunk: i, onModelLoadingChange: a, onModelProgress: o, onModelsDataChange: s, onProgress: c, ...l } = t, u = fe.current + 1, d = eh(l), f = !1, p = !1, m = () => {
|
|
12617
12676
|
f || fe.current !== u || (f = !0, j(!1));
|
|
12618
12677
|
}, h = () => {
|
|
12619
12678
|
p || fe.current !== u || (p = !0, a?.(!1));
|
|
@@ -12644,7 +12703,7 @@ function eh({ autoFitCamera: e = !0, camera: t = {
|
|
|
12644
12703
|
});
|
|
12645
12704
|
if (fe.current !== u) return r;
|
|
12646
12705
|
let a = Object.fromEntries(Object.entries(r).filter(([e]) => !N.current.has(Number(e))));
|
|
12647
|
-
return V((e) => t ?
|
|
12706
|
+
return V((e) => t ? th(e, a, N.current) : {
|
|
12648
12707
|
...e ?? {},
|
|
12649
12708
|
...a
|
|
12650
12709
|
}, s), m(), Object.keys(a).length > 0 && await Je(u), h(), r;
|
|
@@ -12662,7 +12721,7 @@ function eh({ autoFitCamera: e = !0, camera: t = {
|
|
|
12662
12721
|
]), $e = h((e) => {
|
|
12663
12722
|
if (!Number.isFinite(e)) return;
|
|
12664
12723
|
N.current.add(e);
|
|
12665
|
-
let t = oe.current, n =
|
|
12724
|
+
let t = oe.current, n = nh(t, e);
|
|
12666
12725
|
n !== t && (oe.current = n, A(n), de.current?.(n)), L.getState().removeModelState(e);
|
|
12667
12726
|
}, [L]), H = b(() => ({
|
|
12668
12727
|
getData: () => oe.current,
|
|
@@ -12677,7 +12736,7 @@ function eh({ autoFitCamera: e = !0, camera: t = {
|
|
|
12677
12736
|
$e
|
|
12678
12737
|
]);
|
|
12679
12738
|
return _(() => (p(H), () => p(null)), [H, p]), _(() => {
|
|
12680
|
-
Ce(
|
|
12739
|
+
Ce(ah());
|
|
12681
12740
|
}, [Ce]), _(() => {
|
|
12682
12741
|
z(!!y);
|
|
12683
12742
|
}, [z, y]), _(() => {
|
|
@@ -12727,7 +12786,7 @@ function eh({ autoFitCamera: e = !0, camera: t = {
|
|
|
12727
12786
|
onReady: Ge
|
|
12728
12787
|
}),
|
|
12729
12788
|
/* @__PURE__ */ W(Io, { active: T }),
|
|
12730
|
-
/* @__PURE__ */ W(
|
|
12789
|
+
/* @__PURE__ */ W(Xm, {
|
|
12731
12790
|
autoFitCamera: e,
|
|
12732
12791
|
cameraRef: E,
|
|
12733
12792
|
controlRef: D,
|
|
@@ -12775,7 +12834,7 @@ function eh({ autoFitCamera: e = !0, camera: t = {
|
|
|
12775
12834
|
})]
|
|
12776
12835
|
}) : /* @__PURE__ */ W(nt, {});
|
|
12777
12836
|
}
|
|
12778
|
-
var
|
|
12837
|
+
var sh = p(function(e, t) {
|
|
12779
12838
|
let [n] = S(Ct), r = x(!1), i = x(!1), a = b(() => new Ko(), []), o = b(() => new Jo(), []), { defaultSelected: s, onSelectedChange: c, selected: l } = e, u = h((e) => {
|
|
12780
12839
|
a.set(e);
|
|
12781
12840
|
}, [a]), d = b(() => new qo(), []), f = h((e) => {
|
|
@@ -12804,7 +12863,7 @@ var th = p(function(e, t) {
|
|
|
12804
12863
|
});
|
|
12805
12864
|
}, [c, n]), /* @__PURE__ */ W(Tt, {
|
|
12806
12865
|
store: n,
|
|
12807
|
-
children: /* @__PURE__ */ W(
|
|
12866
|
+
children: /* @__PURE__ */ W(oh, {
|
|
12808
12867
|
...e,
|
|
12809
12868
|
publicApi: m,
|
|
12810
12869
|
setModelsApi: f,
|
|
@@ -12813,6 +12872,6 @@ var th = p(function(e, t) {
|
|
|
12813
12872
|
})
|
|
12814
12873
|
});
|
|
12815
12874
|
});
|
|
12816
|
-
|
|
12875
|
+
sh.displayName = "Viewer";
|
|
12817
12876
|
//#endregion
|
|
12818
|
-
export { Ar as BMTLoader, $n as BmtConverter, tr as ConvertIfcFileToBmt, nr as ConvertToBmt, qs as DimensionLine, nc as DimensionsUtils, mr as FilteredElementsCollector, Su as ModelGrids, ea as NavigationCube,
|
|
12877
|
+
export { Ar as BMTLoader, $n as BmtConverter, tr as ConvertIfcFileToBmt, nr as ConvertToBmt, qs as DimensionLine, nc as DimensionsUtils, mr as FilteredElementsCollector, Su as ModelGrids, ea as NavigationCube, sh as Viewer, Tt as ViewerStoreProvider, er as bmtConverter, ti as convertIfcFilesToBmtInWorker, ni as createBmtConverterWorker, Br as createBmtWorker, mi as createIfcWorker, Ct as createViewerStore, gn as exportExcel, pn as exportModelPropertiesToExcel, zr as loadBmtModelsInWorker, pi as loadIfcModelsInWorker, xi as loader, rc as useDimensionsUtils, G as useViewerStore, Et as useViewerStoreApi };
|