bimatter-viewer-react 0.11.3 → 0.11.5
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/{IFCLoader-N1C1bJ4O.js → IFCLoader-CQYQx4TL.js} +64 -41
- package/lib/Loaders/IFCLoader/PropertySerializer.d.ts +3 -0
- package/lib/assets/{BmtConverterWorker-C90sCwAT.js → BmtConverterWorker-D6_8Zn9y.js} +1 -1
- package/lib/assets/{IFCWorker-pZu61wpO.js → IFCWorker-CfepOBoh.js} +1 -1
- package/lib/index.js +459 -409
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -868,7 +868,7 @@ var qn = "BMT", Jn = 1, Yn = {
|
|
|
868
868
|
}
|
|
869
869
|
async getIfcLoader(e) {
|
|
870
870
|
if (!this.ifcLoader) {
|
|
871
|
-
let { IFCLoader: e } = await import("./IFCLoader-
|
|
871
|
+
let { IFCLoader: e } = await import("./IFCLoader-CQYQx4TL.js");
|
|
872
872
|
this.ifcLoader = new e();
|
|
873
873
|
}
|
|
874
874
|
return this.configureIfcLoader(this.ifcLoader, e), this.ifcLoader;
|
|
@@ -2117,7 +2117,7 @@ function Br() {
|
|
|
2117
2117
|
//#endregion
|
|
2118
2118
|
//#region src/viewer/workers/BmtConverterWorker.ts?worker
|
|
2119
2119
|
function Vr(e) {
|
|
2120
|
-
return new Worker("" + new URL("assets/BmtConverterWorker-
|
|
2120
|
+
return new Worker("" + new URL("assets/BmtConverterWorker-D6_8Zn9y.js", import.meta.url).href, { name: e?.name });
|
|
2121
2121
|
}
|
|
2122
2122
|
//#endregion
|
|
2123
2123
|
//#region src/viewer/workers/BmtConverterWorkerClient.ts
|
|
@@ -2235,7 +2235,7 @@ function ni() {
|
|
|
2235
2235
|
//#endregion
|
|
2236
2236
|
//#region src/viewer/workers/IFCWorker.ts?worker
|
|
2237
2237
|
function ri(e) {
|
|
2238
|
-
return new Worker("" + new URL("assets/IFCWorker-
|
|
2238
|
+
return new Worker("" + new URL("assets/IFCWorker-CfepOBoh.js", import.meta.url).href, { name: e?.name });
|
|
2239
2239
|
}
|
|
2240
2240
|
//#endregion
|
|
2241
2241
|
//#region src/viewer/workers/IFCWorkerClient.ts
|
|
@@ -2370,7 +2370,7 @@ var xi = new class {
|
|
|
2370
2370
|
}
|
|
2371
2371
|
async getIfcLoader(e = {}) {
|
|
2372
2372
|
if (!this.ifcLoader) {
|
|
2373
|
-
let { IFCLoader: e } = await import("./IFCLoader-
|
|
2373
|
+
let { IFCLoader: e } = await import("./IFCLoader-CQYQx4TL.js");
|
|
2374
2374
|
this.ifcLoader = new e();
|
|
2375
2375
|
}
|
|
2376
2376
|
return this.ifcLoader.useIfcSpace = e.useIfcSpace ?? this.useIfcSpace, e.chunk !== void 0 && (this.ifcLoader.chunk = e.chunk), e.maxMeshBytes !== void 0 && (this.ifcLoader.maxMeshBytes = e.maxMeshBytes), this.ifcLoader.mergeVertices = e.mergeVertices ?? !0, e.wasmPath !== void 0 && (this.ifcLoader.wasmPath = e.wasmPath), this.ifcLoader;
|
|
@@ -9598,8 +9598,8 @@ var Ju = u.memo(function({ colorPaletteTexture: e, material: t, materialMode: n
|
|
|
9598
9598
|
object: f
|
|
9599
9599
|
}), /* @__PURE__ */ W("primitive", { object: v })]
|
|
9600
9600
|
});
|
|
9601
|
-
}), Yu = new R(), Xu = /* @__PURE__ */ new WeakMap();
|
|
9602
|
-
function
|
|
9601
|
+
}), Yu = new R(), Xu = /* @__PURE__ */ new WeakMap(), Zu = /* @__PURE__ */ new WeakMap();
|
|
9602
|
+
function Qu(e) {
|
|
9603
9603
|
if (!e) return null;
|
|
9604
9604
|
try {
|
|
9605
9605
|
let t = JSON.parse(e);
|
|
@@ -9608,20 +9608,20 @@ function Zu(e) {
|
|
|
9608
9608
|
return console.warn("Model matrix parsing error", e), null;
|
|
9609
9609
|
}
|
|
9610
9610
|
}
|
|
9611
|
-
function Qu(e) {
|
|
9612
|
-
return Zu($u(e));
|
|
9613
|
-
}
|
|
9614
9611
|
function $u(e) {
|
|
9612
|
+
return Qu(ed(e));
|
|
9613
|
+
}
|
|
9614
|
+
function ed(e) {
|
|
9615
9615
|
if (e.coordinationMatrix) return e.coordinationMatrix;
|
|
9616
9616
|
for (let t in e.data) {
|
|
9617
9617
|
let n = e.data[Number(t)]?.matrix;
|
|
9618
9618
|
if (n) return n;
|
|
9619
9619
|
}
|
|
9620
9620
|
}
|
|
9621
|
-
function
|
|
9621
|
+
function td(e, t) {
|
|
9622
9622
|
let n = e.matrix ?? t ?? "", r = Xu.get(e);
|
|
9623
9623
|
if (r && r.sourceMatrixKey === n) return r;
|
|
9624
|
-
let i = (
|
|
9624
|
+
let i = (Qu(n) ?? new R()).clone().invert(), a = e.pos, o = new U(), s = Infinity;
|
|
9625
9625
|
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
9626
|
let c = {
|
|
9627
9627
|
floorY: s,
|
|
@@ -9630,23 +9630,72 @@ function ed(e, t) {
|
|
|
9630
9630
|
};
|
|
9631
9631
|
return Xu.set(e, c), c;
|
|
9632
9632
|
}
|
|
9633
|
-
function
|
|
9633
|
+
function nd(e, t) {
|
|
9634
|
+
let n = e[t];
|
|
9635
|
+
return n === void 0 ? 0 : Number.isFinite(n) ? n : null;
|
|
9636
|
+
}
|
|
9637
|
+
function rd(e, t, n) {
|
|
9638
|
+
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");
|
|
9639
|
+
if (r === null || i === null || a === null || o === null || s === null || c === null) return null;
|
|
9640
|
+
let l = new U(r + o, i + s, a + c).applyMatrix4(n);
|
|
9641
|
+
return {
|
|
9642
|
+
x: l.x,
|
|
9643
|
+
y: l.y,
|
|
9644
|
+
z: l.z
|
|
9645
|
+
};
|
|
9646
|
+
}
|
|
9647
|
+
function id(e, t, n) {
|
|
9648
|
+
let r = {};
|
|
9649
|
+
return Object.entries(e).forEach(([e, i]) => {
|
|
9650
|
+
let a = i.map((e) => rd(e, t, n)).filter((e) => e !== null);
|
|
9651
|
+
a.length >= 2 && (r[e] = a);
|
|
9652
|
+
}), r;
|
|
9653
|
+
}
|
|
9654
|
+
function ad(e, t) {
|
|
9655
|
+
return {
|
|
9656
|
+
loc: {
|
|
9657
|
+
x: 0,
|
|
9658
|
+
y: 0,
|
|
9659
|
+
z: 0
|
|
9660
|
+
},
|
|
9661
|
+
points: {
|
|
9662
|
+
u: id(e.points.u, e.loc, t),
|
|
9663
|
+
v: id(e.points.v, e.loc, t)
|
|
9664
|
+
}
|
|
9665
|
+
};
|
|
9666
|
+
}
|
|
9667
|
+
function od(e, t) {
|
|
9668
|
+
if (!e || !t) return e;
|
|
9669
|
+
let n = Zu.get(e);
|
|
9670
|
+
if (n && n.sourceMatrixKey === t) return n.grids;
|
|
9671
|
+
let r = Qu(t);
|
|
9672
|
+
if (!r) return e;
|
|
9673
|
+
let i = r.clone().invert(), a = {};
|
|
9674
|
+
return Object.entries(e).forEach(([e, t]) => {
|
|
9675
|
+
a[e] = ad(t, i);
|
|
9676
|
+
}), Zu.set(e, {
|
|
9677
|
+
grids: a,
|
|
9678
|
+
sourceMatrixKey: t
|
|
9679
|
+
}), a;
|
|
9680
|
+
}
|
|
9681
|
+
function sd({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r, loadGeneration: i, materialMode: a, onUploadComplete: o, onUploadProgress: s, useWebGPU: c = !1 }) {
|
|
9634
9682
|
let l = G((e) => e.gridAxesVisibility), u = b(() => {
|
|
9635
9683
|
if (!r) return {
|
|
9636
9684
|
data: [],
|
|
9637
9685
|
coordinationMatrix: null,
|
|
9638
|
-
floorY: 0
|
|
9686
|
+
floorY: 0,
|
|
9687
|
+
grids: void 0
|
|
9639
9688
|
};
|
|
9640
9689
|
let e = !1;
|
|
9641
9690
|
for (let t in r.data) if (r.data[Number(t)]?.matrix) {
|
|
9642
9691
|
e = !0;
|
|
9643
9692
|
break;
|
|
9644
9693
|
}
|
|
9645
|
-
let i = r.coordinationMatrix, a =
|
|
9694
|
+
let i = r.coordinationMatrix ?? ed(r), a = $u(r), o = e || a ? t?.clone() ?? a : null, s = Infinity, c = [];
|
|
9646
9695
|
for (let e in r.data) {
|
|
9647
9696
|
let t = r.data[Number(e)];
|
|
9648
9697
|
if (!t) continue;
|
|
9649
|
-
let a =
|
|
9698
|
+
let a = td(t, i), o = t.mat;
|
|
9650
9699
|
s = Math.min(s, a.floorY), c.push({
|
|
9651
9700
|
data: t,
|
|
9652
9701
|
isIfcSpace: !!t.isIfcSpace,
|
|
@@ -9659,7 +9708,8 @@ function td({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
|
|
|
9659
9708
|
return {
|
|
9660
9709
|
data: c,
|
|
9661
9710
|
coordinationMatrix: o,
|
|
9662
|
-
floorY: Number.isFinite(s) ? s : 0
|
|
9711
|
+
floorY: Number.isFinite(s) ? s : 0,
|
|
9712
|
+
grids: od(r.grids, i)
|
|
9663
9713
|
};
|
|
9664
9714
|
}, [
|
|
9665
9715
|
t,
|
|
@@ -9708,7 +9758,7 @@ function td({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
|
|
|
9708
9758
|
useDoubleSideMaterial: y
|
|
9709
9759
|
}, t.key)), /* @__PURE__ */ W(Su, {
|
|
9710
9760
|
floorY: u.floorY,
|
|
9711
|
-
grids:
|
|
9761
|
+
grids: u.grids,
|
|
9712
9762
|
showBottom: l.bottom,
|
|
9713
9763
|
showLeft: l.left,
|
|
9714
9764
|
showRight: l.right,
|
|
@@ -9717,10 +9767,10 @@ function td({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
|
|
|
9717
9767
|
})]
|
|
9718
9768
|
});
|
|
9719
9769
|
}
|
|
9720
|
-
var
|
|
9770
|
+
var cd = m(sd);
|
|
9721
9771
|
//#endregion
|
|
9722
9772
|
//#region src/viewer/utils/GeometryUtils/useGeometryIndex.ts
|
|
9723
|
-
function
|
|
9773
|
+
function ld() {
|
|
9724
9774
|
return {
|
|
9725
9775
|
elementBounds: /* @__PURE__ */ new Map(),
|
|
9726
9776
|
elementIndex: /* @__PURE__ */ new Map(),
|
|
@@ -9732,16 +9782,16 @@ function rd() {
|
|
|
9732
9782
|
version: ""
|
|
9733
9783
|
};
|
|
9734
9784
|
}
|
|
9735
|
-
function
|
|
9785
|
+
function ud(e, t, n, r) {
|
|
9736
9786
|
let i = e.get(t);
|
|
9737
9787
|
i || (i = /* @__PURE__ */ new Map(), e.set(t, i));
|
|
9738
9788
|
let a = i.get(n);
|
|
9739
9789
|
a || (a = new A(), i.set(n, a)), a.expandByPoint(r);
|
|
9740
9790
|
}
|
|
9741
|
-
function
|
|
9791
|
+
function dd(e) {
|
|
9742
9792
|
return e instanceof Uint16Array || e instanceof Uint32Array ? e : e.length > 65535 ? new Uint32Array(e) : new Uint16Array(e);
|
|
9743
9793
|
}
|
|
9744
|
-
function
|
|
9794
|
+
function fd(e, t, n, r) {
|
|
9745
9795
|
let i = n.get(e);
|
|
9746
9796
|
if (i) return i;
|
|
9747
9797
|
i = {
|
|
@@ -9751,20 +9801,20 @@ function od(e, t, n, r) {
|
|
|
9751
9801
|
let a = r.get(e);
|
|
9752
9802
|
return a || (a = [], r.set(e, a)), a.push(i), i;
|
|
9753
9803
|
}
|
|
9754
|
-
function
|
|
9755
|
-
n &&
|
|
9804
|
+
function pd(e, t, n, r, i, a) {
|
|
9805
|
+
n && fd(e, r, i, a).vertexRanges.push({
|
|
9756
9806
|
count: n,
|
|
9757
9807
|
start: t
|
|
9758
9808
|
});
|
|
9759
9809
|
}
|
|
9760
|
-
function
|
|
9761
|
-
n && (
|
|
9810
|
+
function md(e, t, n, r, i, a) {
|
|
9811
|
+
n && (fd(e, r, i, a), r.triangleRanges.push({
|
|
9762
9812
|
count: n,
|
|
9763
9813
|
id: e,
|
|
9764
9814
|
start: t
|
|
9765
9815
|
}));
|
|
9766
9816
|
}
|
|
9767
|
-
function
|
|
9817
|
+
function hd(e) {
|
|
9768
9818
|
let t = e;
|
|
9769
9819
|
for (; t;) {
|
|
9770
9820
|
let e = t.userData.modelID;
|
|
@@ -9773,10 +9823,10 @@ function ld(e) {
|
|
|
9773
9823
|
}
|
|
9774
9824
|
return 0;
|
|
9775
9825
|
}
|
|
9776
|
-
function
|
|
9826
|
+
function gd(e) {
|
|
9777
9827
|
return e.name === "space" || e.userData.isIfcSpace === !0;
|
|
9778
9828
|
}
|
|
9779
|
-
function
|
|
9829
|
+
function _d(e) {
|
|
9780
9830
|
if (!e) return "";
|
|
9781
9831
|
let t = [];
|
|
9782
9832
|
return e.traverse((e) => {
|
|
@@ -9788,18 +9838,18 @@ function dd(e) {
|
|
|
9788
9838
|
t.push(e.uuid, n.uuid, String(n.attributes.ids?.count ?? 0), String(n.attributes.position?.count ?? 0));
|
|
9789
9839
|
}), t.join(":");
|
|
9790
9840
|
}
|
|
9791
|
-
function
|
|
9792
|
-
let t = x(
|
|
9841
|
+
function vd(e) {
|
|
9842
|
+
let t = x(ld()), n = h(() => {
|
|
9793
9843
|
let n = e.current, r = t.current;
|
|
9794
9844
|
if (!n) return r;
|
|
9795
|
-
let i =
|
|
9845
|
+
let i = _d(n);
|
|
9796
9846
|
if (r.indexedModel === n && r.records.size && r.version === i) return r;
|
|
9797
9847
|
let a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set(), c = new U();
|
|
9798
9848
|
return n.updateMatrixWorld(!0), n.traverse((e) => {
|
|
9799
9849
|
if (!(e instanceof z)) return;
|
|
9800
9850
|
let t = e, n = t.geometry, i = n.index, l = n.attributes.ids;
|
|
9801
9851
|
if (!i || !l) return;
|
|
9802
|
-
let u = n.attributes.position, d =
|
|
9852
|
+
let u = n.attributes.position, d = hd(t), f = gd(t), p = dd(i.array), m = {
|
|
9803
9853
|
hiddenIds: /* @__PURE__ */ new Set(),
|
|
9804
9854
|
initialVisible: t.visible,
|
|
9805
9855
|
isIfcSpace: f,
|
|
@@ -9812,16 +9862,16 @@ function fd(e) {
|
|
|
9812
9862
|
}, h = /* @__PURE__ */ new Map(), g = null, _ = 0, v = p.length / 3;
|
|
9813
9863
|
for (let e = 0; e < v; e++) {
|
|
9814
9864
|
let t = l.getX(p[e * 3]);
|
|
9815
|
-
g === null ? (g = t, _ = e) : t !== g && (
|
|
9865
|
+
g === null ? (g = t, _ = e) : t !== g && (md(g, _, e - _, m, h, a), g = t, _ = e);
|
|
9816
9866
|
}
|
|
9817
|
-
g !== null &&
|
|
9867
|
+
g !== null && md(g, _, v - _, m, h, a);
|
|
9818
9868
|
let y = null, b = 0, x = u ? Math.min(l.count, u.count) : l.count;
|
|
9819
9869
|
u && t.updateWorldMatrix(!0, !1);
|
|
9820
9870
|
for (let e = 0; e < l.count; e++) {
|
|
9821
9871
|
let n = l.getX(e);
|
|
9822
|
-
u && e < x && (c.fromBufferAttribute(u, e).applyMatrix4(t.matrixWorld), Number.isFinite(c.x + c.y + c.z) &&
|
|
9872
|
+
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
9873
|
}
|
|
9824
|
-
y !== null &&
|
|
9874
|
+
y !== null && pd(y, b, l.count - b, m, h, a), s.add(m), f && !r.ifcSpacesVisible && (t.visible = !1);
|
|
9825
9875
|
}), t.current = {
|
|
9826
9876
|
elementBounds: o,
|
|
9827
9877
|
elementIndex: a,
|
|
@@ -9833,7 +9883,7 @@ function fd(e) {
|
|
|
9833
9883
|
version: i
|
|
9834
9884
|
}, t.current;
|
|
9835
9885
|
}, [e]), r = h(() => {
|
|
9836
|
-
t.current =
|
|
9886
|
+
t.current = ld();
|
|
9837
9887
|
}, []);
|
|
9838
9888
|
return b(() => ({
|
|
9839
9889
|
buildIndex: n,
|
|
@@ -9842,112 +9892,112 @@ function fd(e) {
|
|
|
9842
9892
|
}
|
|
9843
9893
|
//#endregion
|
|
9844
9894
|
//#region src/viewer/utils/GeometryUtils/useGeometryUtils.ts
|
|
9845
|
-
var
|
|
9846
|
-
function
|
|
9895
|
+
var yd = -1;
|
|
9896
|
+
function bd(e, t) {
|
|
9847
9897
|
return e instanceof Uint32Array ? new Uint32Array(t) : new Uint16Array(t);
|
|
9848
9898
|
}
|
|
9849
|
-
function
|
|
9899
|
+
function xd(e) {
|
|
9850
9900
|
let t = e.geometry;
|
|
9851
9901
|
Object.assign(t, { boundsTree: void 0 }), e.geometry.index?.count && Object.assign(t, { boundsTree: new ft(e.geometry, { indirect: !0 }) });
|
|
9852
9902
|
}
|
|
9853
|
-
function
|
|
9854
|
-
e.mesh.geometry.setIndex(new j(t, 1)), n &&
|
|
9903
|
+
function Sd(e, t, n = !0) {
|
|
9904
|
+
e.mesh.geometry.setIndex(new j(t, 1)), n && xd(e.mesh);
|
|
9855
9905
|
}
|
|
9856
|
-
function
|
|
9906
|
+
function Cd(e, t) {
|
|
9857
9907
|
return e.initialVisible && (!e.isIfcSpace || t);
|
|
9858
9908
|
}
|
|
9859
|
-
function
|
|
9909
|
+
function wd(e, t) {
|
|
9860
9910
|
let n = e.mesh.geometry, r = n.index?.array;
|
|
9861
|
-
e.mesh.visible =
|
|
9911
|
+
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
9912
|
}
|
|
9863
|
-
function
|
|
9913
|
+
function Td(e) {
|
|
9864
9914
|
return e === null ? "*" : e.size ? Array.from(e).sort((e, t) => e - t).join(",") : "";
|
|
9865
9915
|
}
|
|
9866
|
-
function
|
|
9867
|
-
return `h:${
|
|
9916
|
+
function Ed(e, t, n, r) {
|
|
9917
|
+
return `h:${Td(e)}|i:${Td(n)}|s:${r ? Number(t) : ""}`;
|
|
9868
9918
|
}
|
|
9869
|
-
function
|
|
9919
|
+
function Dd(e, t, n) {
|
|
9870
9920
|
return !t.has(e) && (!n || n.has(e));
|
|
9871
9921
|
}
|
|
9872
|
-
function
|
|
9922
|
+
function Od(e, t) {
|
|
9873
9923
|
Object.entries(e).forEach(([e, n]) => {
|
|
9874
9924
|
n.forEach((n) => t(Number(e), n));
|
|
9875
9925
|
});
|
|
9876
9926
|
}
|
|
9877
|
-
function
|
|
9927
|
+
function kd(e, t, n) {
|
|
9878
9928
|
e.hiddenIds.has(t) || (e.hiddenIds.add(t), n.add(e));
|
|
9879
9929
|
}
|
|
9880
|
-
function
|
|
9930
|
+
function Ad(e, t, n) {
|
|
9881
9931
|
e && console.log(`${t}:`, Date.now() - n, "ms");
|
|
9882
9932
|
}
|
|
9883
|
-
function
|
|
9884
|
-
let { hiddenIds: i, originalIndex: a, triangleRanges: o } = e, s =
|
|
9933
|
+
function jd(e, t, n, r) {
|
|
9934
|
+
let { hiddenIds: i, originalIndex: a, triangleRanges: o } = e, s = Ed(i, t, n, e.isIfcSpace);
|
|
9885
9935
|
if (e.visibleStateKey === s) return;
|
|
9886
9936
|
if (!i.size && !n) {
|
|
9887
|
-
|
|
9937
|
+
wd(e, t), e.visibleStateKey = s;
|
|
9888
9938
|
return;
|
|
9889
9939
|
}
|
|
9890
9940
|
let c = 0, l = 0;
|
|
9891
9941
|
if (o.forEach(({ count: e, id: t }) => {
|
|
9892
|
-
|
|
9942
|
+
Dd(t, i, n) ? c += e * 3 : l += e * 3;
|
|
9893
9943
|
}), !c) {
|
|
9894
|
-
|
|
9944
|
+
wd(e, t), e.mesh.visible = !1, e.visibleStateKey = s;
|
|
9895
9945
|
return;
|
|
9896
9946
|
}
|
|
9897
9947
|
if (!l) {
|
|
9898
|
-
|
|
9948
|
+
wd(e, t), e.visibleStateKey = s;
|
|
9899
9949
|
return;
|
|
9900
9950
|
}
|
|
9901
|
-
e.mesh.visible =
|
|
9902
|
-
let u =
|
|
9951
|
+
e.mesh.visible = Cd(e, t);
|
|
9952
|
+
let u = bd(a, c), d = 0;
|
|
9903
9953
|
for (let e = 0; e < o.length; e++) {
|
|
9904
9954
|
let { count: t, id: r, start: s } = o[e];
|
|
9905
|
-
if (!
|
|
9955
|
+
if (!Dd(r, i, n)) continue;
|
|
9906
9956
|
let c = s * 3, l = c + t * 3;
|
|
9907
9957
|
u.set(a.subarray(c, l), d), d += t * 3;
|
|
9908
9958
|
}
|
|
9909
|
-
r || (e.originalBoundsTree = null),
|
|
9959
|
+
r || (e.originalBoundsTree = null), Sd(e, u), e.visibleStateKey = s;
|
|
9910
9960
|
}
|
|
9911
|
-
function
|
|
9961
|
+
function Md(e, t) {
|
|
9912
9962
|
return e.isolatedIdsByModel ? e.isolatedIdsByModel.get(t.modelID) ?? /* @__PURE__ */ new Set() : e.isolatedIds;
|
|
9913
9963
|
}
|
|
9914
|
-
function
|
|
9964
|
+
function Nd(e) {
|
|
9915
9965
|
let t = [];
|
|
9916
9966
|
return e?.children.forEach((e) => {
|
|
9917
9967
|
e instanceof I && typeof e.userData.modelID == "number" && t.push(e);
|
|
9918
9968
|
}), t;
|
|
9919
9969
|
}
|
|
9920
|
-
function
|
|
9970
|
+
function Pd(e) {
|
|
9921
9971
|
let t = e.userData.trueNorthBaseMatrix;
|
|
9922
9972
|
if (t instanceof R) return t;
|
|
9923
9973
|
let n = e.matrix.clone();
|
|
9924
9974
|
return e.userData.trueNorthBaseMatrix = n, n;
|
|
9925
9975
|
}
|
|
9926
|
-
function
|
|
9927
|
-
let n = Number(e.userData.trueNorthAngle ?? 0), r =
|
|
9928
|
-
!t && Number.isFinite(n) && n !== 0 && r.multiply(new R().makeRotationY(n *
|
|
9976
|
+
function Fd(e, t) {
|
|
9977
|
+
let n = Number(e.userData.trueNorthAngle ?? 0), r = Pd(e).clone();
|
|
9978
|
+
!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
9979
|
}
|
|
9930
|
-
function
|
|
9980
|
+
function Id(e) {
|
|
9931
9981
|
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
9982
|
let t = Date.now(), n = a(), o = /* @__PURE__ */ new Set();
|
|
9933
9983
|
e.forEach((e) => {
|
|
9934
9984
|
let t = n.elementIndex.get(e);
|
|
9935
9985
|
t && t.forEach(({ record: t }) => {
|
|
9936
|
-
|
|
9986
|
+
kd(t, e, o);
|
|
9937
9987
|
});
|
|
9938
|
-
}), o.forEach((e) =>
|
|
9988
|
+
}), o.forEach((e) => jd(e, n.ifcSpacesVisible, Md(n, e), i)), Ad(r, "hideByIds", t);
|
|
9939
9989
|
}, [
|
|
9940
9990
|
a,
|
|
9941
9991
|
i,
|
|
9942
9992
|
r
|
|
9943
9993
|
]), l = h(() => {
|
|
9944
9994
|
let e = Date.now(), o = a(), s = /* @__PURE__ */ new Set();
|
|
9945
|
-
|
|
9995
|
+
Od(t, (e, t) => {
|
|
9946
9996
|
let n = o.elementIndex.get(t);
|
|
9947
9997
|
n && n.forEach(({ record: n }) => {
|
|
9948
|
-
n.modelID === e &&
|
|
9998
|
+
n.modelID === e && kd(n, t, s);
|
|
9949
9999
|
});
|
|
9950
|
-
}), s.forEach((e) =>
|
|
10000
|
+
}), s.forEach((e) => jd(e, o.ifcSpacesVisible, Md(o, e), i)), n(), Ad(r, "hideSelected", e);
|
|
9951
10001
|
}, [
|
|
9952
10002
|
a,
|
|
9953
10003
|
i,
|
|
@@ -9961,24 +10011,24 @@ function Ad(e) {
|
|
|
9961
10011
|
t && t.forEach(({ record: t }) => {
|
|
9962
10012
|
t.hiddenIds.delete(e) && o.add(t);
|
|
9963
10013
|
});
|
|
9964
|
-
}), o.forEach((e) =>
|
|
10014
|
+
}), o.forEach((e) => jd(e, n.ifcSpacesVisible, Md(n, e), i)), Ad(r, "showByIds", t);
|
|
9965
10015
|
}, [
|
|
9966
10016
|
a,
|
|
9967
10017
|
i,
|
|
9968
10018
|
r
|
|
9969
10019
|
]), d = h((e) => {
|
|
9970
10020
|
let t = Date.now(), n = a();
|
|
9971
|
-
n.isolatedIdsByModel = null, n.isolatedIds = new Set(e), n.records.forEach((e) =>
|
|
10021
|
+
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
10022
|
}, [
|
|
9973
10023
|
a,
|
|
9974
10024
|
i,
|
|
9975
10025
|
r
|
|
9976
10026
|
]), f = h(() => {
|
|
9977
10027
|
let e = Date.now(), n = a(), o = /* @__PURE__ */ new Map();
|
|
9978
|
-
|
|
10028
|
+
Od(t, (e, t) => {
|
|
9979
10029
|
let n = o.get(e);
|
|
9980
10030
|
n || (n = /* @__PURE__ */ new Set(), o.set(e, n)), n.add(t);
|
|
9981
|
-
}), n.isolatedIdsByModel = o, n.isolatedIds = null, n.records.forEach((e) =>
|
|
10031
|
+
}), n.isolatedIdsByModel = o, n.isolatedIds = null, n.records.forEach((e) => jd(e, n.ifcSpacesVisible, Md(n, e), i)), Ad(r, "isolateSelected", e);
|
|
9982
10032
|
}, [
|
|
9983
10033
|
a,
|
|
9984
10034
|
i,
|
|
@@ -9986,7 +10036,7 @@ function Ad(e) {
|
|
|
9986
10036
|
r
|
|
9987
10037
|
]), p = h(() => {
|
|
9988
10038
|
let e = Date.now(), t = a();
|
|
9989
|
-
t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) =>
|
|
10039
|
+
t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => jd(e, t.ifcSpacesVisible, Md(t, e), i)), Ad(r, "resetIsolation", e);
|
|
9990
10040
|
}, [
|
|
9991
10041
|
a,
|
|
9992
10042
|
i,
|
|
@@ -9994,7 +10044,7 @@ function Ad(e) {
|
|
|
9994
10044
|
]), m = h((e) => {
|
|
9995
10045
|
let t = a();
|
|
9996
10046
|
t.ifcSpacesVisible !== e && (t.ifcSpacesVisible = e, t.records.forEach((e) => {
|
|
9997
|
-
e.isIfcSpace &&
|
|
10047
|
+
e.isIfcSpace && jd(e, t.ifcSpacesVisible, Md(t, e), i);
|
|
9998
10048
|
}));
|
|
9999
10049
|
}, [a, i]), g = h(() => {
|
|
10000
10050
|
m(!s());
|
|
@@ -10012,8 +10062,8 @@ function Ad(e) {
|
|
|
10012
10062
|
showAll: h(() => {
|
|
10013
10063
|
let e = Date.now(), t = a();
|
|
10014
10064
|
t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => {
|
|
10015
|
-
e.hiddenIds.clear(),
|
|
10016
|
-
}),
|
|
10065
|
+
e.hiddenIds.clear(), jd(e, t.ifcSpacesVisible, Md(t, e), i);
|
|
10066
|
+
}), Ad(r, "showAll", e);
|
|
10017
10067
|
}, [
|
|
10018
10068
|
a,
|
|
10019
10069
|
i,
|
|
@@ -10022,23 +10072,23 @@ function Ad(e) {
|
|
|
10022
10072
|
showByIds: u,
|
|
10023
10073
|
toggleIIfcSpacesVisibility: g,
|
|
10024
10074
|
useTrueNorth: h((t = !0) => {
|
|
10025
|
-
let n =
|
|
10026
|
-
n.length && (n.forEach((e) =>
|
|
10075
|
+
let n = Nd(a().indexedModel);
|
|
10076
|
+
n.length && (n.forEach((e) => Fd(e, t)), e.resetIndex());
|
|
10027
10077
|
}, [a, e])
|
|
10028
10078
|
};
|
|
10029
10079
|
}
|
|
10030
10080
|
//#endregion
|
|
10031
10081
|
//#region src/viewer/utils/ClippingUtils/PlaneHelper.ts
|
|
10032
|
-
var
|
|
10033
|
-
function
|
|
10082
|
+
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;
|
|
10083
|
+
function ef(e, t) {
|
|
10034
10084
|
let n = t.getBoundingClientRect();
|
|
10035
10085
|
return new H((e.clientX - n.left) / n.width * 2 - 1, -((e.clientY - n.top) / n.height) * 2 + 1);
|
|
10036
10086
|
}
|
|
10037
|
-
function
|
|
10087
|
+
function tf(e) {
|
|
10038
10088
|
let t = e.getSize(new U());
|
|
10039
|
-
return Math.max(
|
|
10089
|
+
return Math.max(Yd, t.length() * Hd);
|
|
10040
10090
|
}
|
|
10041
|
-
var
|
|
10091
|
+
var nf = class extends ke {
|
|
10042
10092
|
helper = new I();
|
|
10043
10093
|
borderMaterial;
|
|
10044
10094
|
material;
|
|
@@ -10058,15 +10108,15 @@ var Xd = class extends ke {
|
|
|
10058
10108
|
listenersActive = !1;
|
|
10059
10109
|
constructor(e, t, n, r) {
|
|
10060
10110
|
super(), this.context = e, this.plane = t, this.location = n.clone(), this.normal = r.clone().normalize(), this.material = new Ce({
|
|
10061
|
-
color:
|
|
10111
|
+
color: Rd,
|
|
10062
10112
|
depthWrite: !1,
|
|
10063
|
-
opacity:
|
|
10113
|
+
opacity: zd,
|
|
10064
10114
|
side: ue,
|
|
10065
10115
|
transparent: !0
|
|
10066
10116
|
}), this.helper.position.copy(this.location), this.applyPlaneOrientation(), this.layout = this.getHelperLayout();
|
|
10067
|
-
let i = Math.max(
|
|
10117
|
+
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
10118
|
this.borderMaterial = new ve({
|
|
10069
|
-
color:
|
|
10119
|
+
color: Ld,
|
|
10070
10120
|
dashSize: i,
|
|
10071
10121
|
depthWrite: !1,
|
|
10072
10122
|
gapSize: a
|
|
@@ -10097,7 +10147,7 @@ var Xd = class extends ke {
|
|
|
10097
10147
|
}
|
|
10098
10148
|
updateBorderDash() {
|
|
10099
10149
|
let e = Math.min(this.layout.width, this.layout.height);
|
|
10100
|
-
this.borderMaterial.dashSize = Math.max(
|
|
10150
|
+
this.borderMaterial.dashSize = Math.max(qd, e * Ud), this.borderMaterial.gapSize = Math.max(Jd, e * Wd), this.borderMaterial.needsUpdate = !0;
|
|
10101
10151
|
}
|
|
10102
10152
|
addEventListeners() {
|
|
10103
10153
|
if (this.listenersActive) return;
|
|
@@ -10159,10 +10209,10 @@ var Xd = class extends ke {
|
|
|
10159
10209
|
return !1;
|
|
10160
10210
|
}
|
|
10161
10211
|
getEdgeInteractionWidth() {
|
|
10162
|
-
return Math.min(
|
|
10212
|
+
return Math.min(Qd, Math.max(Zd, Math.min(this.layout.width, this.layout.height) * Gd));
|
|
10163
10213
|
}
|
|
10164
10214
|
getDragDistanceEpsilon() {
|
|
10165
|
-
return Math.max(
|
|
10215
|
+
return Math.max(Xd, Math.min(this.layout.width, this.layout.height) * Kd);
|
|
10166
10216
|
}
|
|
10167
10217
|
getPointToSegmentDistanceSquared(e, t, n) {
|
|
10168
10218
|
let r = n.x - t.x, i = n.y - t.y, a = r * r + i * i;
|
|
@@ -10175,7 +10225,7 @@ var Xd = class extends ke {
|
|
|
10175
10225
|
}
|
|
10176
10226
|
getPointerPointOnPlane(e, t) {
|
|
10177
10227
|
let n = this.context.getDomElement();
|
|
10178
|
-
this.pointer.copy(
|
|
10228
|
+
this.pointer.copy(ef(e, n));
|
|
10179
10229
|
let r = this.context.getRaycaster(), i = new U();
|
|
10180
10230
|
return r.setFromCamera(this.pointer, this.context.getCamera()), r.ray.intersectPlane(t, i);
|
|
10181
10231
|
}
|
|
@@ -10228,7 +10278,7 @@ var Xd = class extends ke {
|
|
|
10228
10278
|
t && (this.context.clearHelpersHover(this), this.hasHelperPriority(e) && this.stopHelperPriorityEvent(e)), this.hovered !== t && this.setHovered(t);
|
|
10229
10279
|
}
|
|
10230
10280
|
setHovered(e) {
|
|
10231
|
-
this.hovered = e, this.material.color.set(e ?
|
|
10281
|
+
this.hovered = e, this.material.color.set(e ? Bd : Rd), this.material.opacity = e ? Vd : zd, this.material.needsUpdate = !0;
|
|
10232
10282
|
}
|
|
10233
10283
|
createPlaneMesh() {
|
|
10234
10284
|
let e = new z(new re(), this.material);
|
|
@@ -10304,12 +10354,12 @@ var Xd = class extends ke {
|
|
|
10304
10354
|
getHelperLayout() {
|
|
10305
10355
|
let e = this.getModelWorldBox();
|
|
10306
10356
|
if (!e || e.isEmpty()) return {
|
|
10307
|
-
height:
|
|
10308
|
-
maxU:
|
|
10309
|
-
maxV:
|
|
10310
|
-
minU:
|
|
10311
|
-
minV:
|
|
10312
|
-
width:
|
|
10357
|
+
height: $d,
|
|
10358
|
+
maxU: $d / 2,
|
|
10359
|
+
maxV: $d / 2,
|
|
10360
|
+
minU: -$d / 2,
|
|
10361
|
+
minV: -$d / 2,
|
|
10362
|
+
width: $d
|
|
10313
10363
|
};
|
|
10314
10364
|
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
10365
|
if (r.forEach((e) => {
|
|
@@ -10317,14 +10367,14 @@ var Xd = class extends ke {
|
|
|
10317
10367
|
let r = a.dot(t.u), u = a.dot(t.v);
|
|
10318
10368
|
o = Math.min(o, r), s = Math.max(s, r), c = Math.min(c, u), l = Math.max(l, u);
|
|
10319
10369
|
}), !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:
|
|
10370
|
+
height: $d,
|
|
10371
|
+
maxU: $d / 2,
|
|
10372
|
+
maxV: $d / 2,
|
|
10373
|
+
minU: -$d / 2,
|
|
10374
|
+
minV: -$d / 2,
|
|
10375
|
+
width: $d
|
|
10326
10376
|
};
|
|
10327
|
-
let u =
|
|
10377
|
+
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
10378
|
return {
|
|
10329
10379
|
height: g,
|
|
10330
10380
|
maxU: _ + h / 2,
|
|
@@ -10365,8 +10415,8 @@ var Xd = class extends ke {
|
|
|
10365
10415
|
new U(e.max.x, e.max.y, e.max.z)
|
|
10366
10416
|
];
|
|
10367
10417
|
}
|
|
10368
|
-
},
|
|
10369
|
-
function
|
|
10418
|
+
}, rf = 250, af = "#a9a9a9", of = new U(0, 0, -1), sf = "__bimatterCameraMotionHidden";
|
|
10419
|
+
function cf(e, t) {
|
|
10370
10420
|
if (Array.isArray(e)) {
|
|
10371
10421
|
e.forEach((e) => {
|
|
10372
10422
|
e.clippingPlanes = t, e.needsUpdate = !0;
|
|
@@ -10375,13 +10425,13 @@ function tf(e, t) {
|
|
|
10375
10425
|
}
|
|
10376
10426
|
e.clippingPlanes = t, e.needsUpdate = !0;
|
|
10377
10427
|
}
|
|
10378
|
-
function
|
|
10428
|
+
function lf(e) {
|
|
10379
10429
|
let t = [];
|
|
10380
10430
|
return e?.traverse((e) => {
|
|
10381
10431
|
e instanceof z && (!e.geometry.index || !e.geometry.attributes.ids || t.push(e));
|
|
10382
10432
|
}), t;
|
|
10383
10433
|
}
|
|
10384
|
-
function
|
|
10434
|
+
function uf(e) {
|
|
10385
10435
|
let t = e;
|
|
10386
10436
|
for (; t;) {
|
|
10387
10437
|
let e = t.userData.modelID;
|
|
@@ -10390,14 +10440,14 @@ function rf(e) {
|
|
|
10390
10440
|
}
|
|
10391
10441
|
return 0;
|
|
10392
10442
|
}
|
|
10393
|
-
function
|
|
10443
|
+
function df(e, t, n) {
|
|
10394
10444
|
let r = e;
|
|
10395
10445
|
r && (r.isClippingGroup = n, r.enabled = n && t.length > 0, r.clipIntersection = !1, r.clipShadows = !1, r.clippingPlanes = n ? t : []);
|
|
10396
10446
|
}
|
|
10397
|
-
function
|
|
10447
|
+
function ff(e, t) {
|
|
10398
10448
|
return t.clone().transformDirection(e.matrixWorld).normalize();
|
|
10399
10449
|
}
|
|
10400
|
-
function
|
|
10450
|
+
function pf(e) {
|
|
10401
10451
|
if (!e) return null;
|
|
10402
10452
|
if ("x" in e) {
|
|
10403
10453
|
let t = new U(e.x, e.y, e.z);
|
|
@@ -10406,7 +10456,7 @@ function sf(e) {
|
|
|
10406
10456
|
let t = new U(e[0], e[1], e[2]);
|
|
10407
10457
|
return Number.isFinite(t.x + t.y + t.z) ? t : null;
|
|
10408
10458
|
}
|
|
10409
|
-
var
|
|
10459
|
+
var mf = class {
|
|
10410
10460
|
planes = [];
|
|
10411
10461
|
caps = [];
|
|
10412
10462
|
edges = [];
|
|
@@ -10414,7 +10464,7 @@ var cf = class {
|
|
|
10414
10464
|
active = !1;
|
|
10415
10465
|
capsActive = !0;
|
|
10416
10466
|
capsCameraMotionActive = !1;
|
|
10417
|
-
capsColor =
|
|
10467
|
+
capsColor = af;
|
|
10418
10468
|
context;
|
|
10419
10469
|
edgesActive = !0;
|
|
10420
10470
|
edgesCameraMotionActive = !1;
|
|
@@ -10471,13 +10521,13 @@ var cf = class {
|
|
|
10471
10521
|
return this.context.controlRef;
|
|
10472
10522
|
}
|
|
10473
10523
|
getMeshes() {
|
|
10474
|
-
return
|
|
10524
|
+
return lf(this.context.modelRef.current);
|
|
10475
10525
|
}
|
|
10476
10526
|
getPlanVisualObjects() {
|
|
10477
|
-
return [...this.caps.map((e) => e.getObject()).filter((e) => e.visible || e.userData[
|
|
10527
|
+
return [...this.caps.map((e) => e.getObject()).filter((e) => e.visible || e.userData[sf]), ...this.edges.flatMap((e) => e.getObjects(!0))];
|
|
10478
10528
|
}
|
|
10479
10529
|
getObjectModelID(e) {
|
|
10480
|
-
return
|
|
10530
|
+
return uf(e);
|
|
10481
10531
|
}
|
|
10482
10532
|
getEdgeSegmentsForPlane(e) {
|
|
10483
10533
|
return this.edgesActive ? this.edges.find((t) => t.plane === e && t.active)?.getIntersectionSegments() ?? null : null;
|
|
@@ -10516,12 +10566,12 @@ var cf = class {
|
|
|
10516
10566
|
if (this.capsCameraMotionActive !== e) {
|
|
10517
10567
|
if (this.capsCameraMotionActive = e, e) {
|
|
10518
10568
|
this.clearCapsDragIdleTimeout(), this.caps.forEach((e) => {
|
|
10519
|
-
e.getObject().userData[
|
|
10569
|
+
e.getObject().userData[sf] = !0, e.setVisible(!1);
|
|
10520
10570
|
}), this.context.onVisualChange?.();
|
|
10521
10571
|
return;
|
|
10522
10572
|
}
|
|
10523
10573
|
this.caps.forEach((e) => {
|
|
10524
|
-
delete e.getObject().userData[
|
|
10574
|
+
delete e.getObject().userData[sf], e.setVisible(this.active && this.capsActive && !this.capsDragActive);
|
|
10525
10575
|
}), this.context.onVisualChange?.();
|
|
10526
10576
|
}
|
|
10527
10577
|
}
|
|
@@ -10536,7 +10586,7 @@ var cf = class {
|
|
|
10536
10586
|
this.capsDragIdleTimeout = null, !(!this.active || !this.capsDragActive || this.capsCameraMotionActive) && (this.flushEdgesUpdate(), this.caps.forEach((e) => {
|
|
10537
10587
|
e.setVisible(!0), e.update();
|
|
10538
10588
|
}), this.updateCapsVisualState());
|
|
10539
|
-
},
|
|
10589
|
+
}, rf));
|
|
10540
10590
|
}
|
|
10541
10591
|
clearCapsDragIdleTimeout() {
|
|
10542
10592
|
this.capsDragIdleTimeout !== null && (window.clearTimeout(this.capsDragIdleTimeout), this.capsDragIdleTimeout = null);
|
|
@@ -10566,7 +10616,7 @@ var cf = class {
|
|
|
10566
10616
|
getSelectedWorldBox() {
|
|
10567
10617
|
let e = this.context.viewerStore.getState().selected, t = new A(), n = new U();
|
|
10568
10618
|
return this.getMeshes().forEach((r) => {
|
|
10569
|
-
let i = e[
|
|
10619
|
+
let i = e[uf(r)];
|
|
10570
10620
|
if (!i?.size) return;
|
|
10571
10621
|
let a = r.geometry.attributes.ids, o = r.geometry.attributes.position;
|
|
10572
10622
|
if (!a || !o) return;
|
|
@@ -10584,8 +10634,8 @@ var cf = class {
|
|
|
10584
10634
|
}
|
|
10585
10635
|
updateMaterials() {
|
|
10586
10636
|
let e = this.active ? this.planes : [];
|
|
10587
|
-
|
|
10588
|
-
|
|
10637
|
+
df(this.context.modelRef.current, e, this.context.useWebGPU), this.getMeshes().forEach((t) => {
|
|
10638
|
+
cf(t.material, e);
|
|
10589
10639
|
}), this.context.camera.updateMatrixWorld();
|
|
10590
10640
|
}
|
|
10591
10641
|
setActive(e) {
|
|
@@ -10604,13 +10654,13 @@ var cf = class {
|
|
|
10604
10654
|
recursive: !1
|
|
10605
10655
|
});
|
|
10606
10656
|
if (!n?.face) return null;
|
|
10607
|
-
let r = n.point.clone(), i =
|
|
10657
|
+
let r = n.point.clone(), i = ff(n.object, n.face.normal);
|
|
10608
10658
|
r.add(i.clone().multiplyScalar(.001));
|
|
10609
10659
|
let a = new Me().setFromNormalAndCoplanarPoint(i.clone().negate(), r);
|
|
10610
10660
|
return this.addPlane(a, r, i), a.clone();
|
|
10611
10661
|
}
|
|
10612
10662
|
createPlaneFromPointAndNormal(e, t) {
|
|
10613
|
-
let n = typeof e == "number" ? this.getPointFromZ(e) :
|
|
10663
|
+
let n = typeof e == "number" ? this.getPointFromZ(e) : pf(e), r = pf(t ?? (typeof e == "number" ? of : void 0));
|
|
10614
10664
|
if (!n || !r || r.lengthSq() === 0) return null;
|
|
10615
10665
|
r.normalize();
|
|
10616
10666
|
let i = new Me().setFromNormalAndCoplanarPoint(r, n);
|
|
@@ -10619,7 +10669,7 @@ var cf = class {
|
|
|
10619
10669
|
createClippingRectangle(e = !1) {
|
|
10620
10670
|
let t = e ? this.getSelectedWorldBox() : this.getModelWorldBox();
|
|
10621
10671
|
if (!t) return [];
|
|
10622
|
-
let n =
|
|
10672
|
+
let n = tf(t), r = t.min.clone().addScalar(-n), i = t.max.clone().addScalar(n), a = t.getCenter(new U()), o = [
|
|
10623
10673
|
{
|
|
10624
10674
|
normal: new U(1, 0, 0),
|
|
10625
10675
|
point: new U(r.x, a.y, a.z)
|
|
@@ -10659,7 +10709,7 @@ var cf = class {
|
|
|
10659
10709
|
return new U(t?.x ?? 0, t?.y ?? 0, e);
|
|
10660
10710
|
}
|
|
10661
10711
|
addPlane(e, t, n) {
|
|
10662
|
-
if (this.active || this.setActive(!0), this.planes.push(e), new
|
|
10712
|
+
if (this.active || this.setActive(!0), this.planes.push(e), new nf(this, e, t, n), this.edgesActive) {
|
|
10663
10713
|
let t = new ul(this, e);
|
|
10664
10714
|
t.create(), t.update();
|
|
10665
10715
|
}
|
|
@@ -10718,9 +10768,9 @@ var cf = class {
|
|
|
10718
10768
|
this.clearCapsDragIdleTimeout(), this.deleteAllPlanes();
|
|
10719
10769
|
}
|
|
10720
10770
|
};
|
|
10721
|
-
function
|
|
10771
|
+
function hf(e, t, n, r = !1, i) {
|
|
10722
10772
|
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
|
|
10773
|
+
u.current ||= new mf({
|
|
10724
10774
|
camera: a,
|
|
10725
10775
|
cameraUtils: n,
|
|
10726
10776
|
controlRef: t,
|
|
@@ -10801,15 +10851,15 @@ function lf(e, t, n, r = !1, i) {
|
|
|
10801
10851
|
}
|
|
10802
10852
|
//#endregion
|
|
10803
10853
|
//#region src/viewer/utils/Hotkeys/useHotkeysUtils.tsx
|
|
10804
|
-
function
|
|
10854
|
+
function gf(e) {
|
|
10805
10855
|
return e instanceof HTMLElement ? e.isContentEditable || e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement : !1;
|
|
10806
10856
|
}
|
|
10807
|
-
function
|
|
10857
|
+
function _f(e = !0) {
|
|
10808
10858
|
let t = G((e) => e.api), n = G((e) => e.defaultHotkeysEnabled);
|
|
10809
10859
|
_(() => {
|
|
10810
10860
|
if (!e || !n) return;
|
|
10811
10861
|
let r = (e) => {
|
|
10812
|
-
|
|
10862
|
+
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
10863
|
};
|
|
10814
10864
|
return window.addEventListener("keydown", r), () => {
|
|
10815
10865
|
window.removeEventListener("keydown", r);
|
|
@@ -10822,8 +10872,8 @@ function df(e = !0) {
|
|
|
10822
10872
|
}
|
|
10823
10873
|
//#endregion
|
|
10824
10874
|
//#region src/viewer/Selector/SelectionBox.ts
|
|
10825
|
-
var
|
|
10826
|
-
function
|
|
10875
|
+
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();
|
|
10876
|
+
function Of(e) {
|
|
10827
10877
|
let t = e;
|
|
10828
10878
|
for (; t;) {
|
|
10829
10879
|
let e = t.modelID ?? t.userData.modelID;
|
|
@@ -10832,7 +10882,7 @@ function Sf(e) {
|
|
|
10832
10882
|
}
|
|
10833
10883
|
return 0;
|
|
10834
10884
|
}
|
|
10835
|
-
function
|
|
10885
|
+
function kf(e) {
|
|
10836
10886
|
let t = e;
|
|
10837
10887
|
for (; t;) {
|
|
10838
10888
|
if (!t.visible) return !1;
|
|
@@ -10840,16 +10890,16 @@ function Cf(e) {
|
|
|
10840
10890
|
}
|
|
10841
10891
|
return !0;
|
|
10842
10892
|
}
|
|
10843
|
-
function
|
|
10844
|
-
return n.length ? (
|
|
10893
|
+
function Af(e, t, n) {
|
|
10894
|
+
return n.length ? (xf.copy(t).applyMatrix4(e.matrixWorld), Rs(xf, n)) : !0;
|
|
10845
10895
|
}
|
|
10846
|
-
function
|
|
10847
|
-
return i.length ? (
|
|
10848
|
-
let t = e.distanceToPoint(
|
|
10896
|
+
function jf(e, t, n, r, i) {
|
|
10897
|
+
return i.length ? (Sf.copy(t).applyMatrix4(e.matrixWorld), Cf.copy(n).applyMatrix4(e.matrixWorld), wf.copy(r).applyMatrix4(e.matrixWorld), i.every((e) => {
|
|
10898
|
+
let t = e.distanceToPoint(Sf), n = e.distanceToPoint(Cf), r = e.distanceToPoint(wf);
|
|
10849
10899
|
return !(t < -1e-6 && n < -1e-6 && r < -1e-6);
|
|
10850
10900
|
})) : !0;
|
|
10851
10901
|
}
|
|
10852
|
-
function
|
|
10902
|
+
function Mf(e) {
|
|
10853
10903
|
let t = e.getBoundingClientRect();
|
|
10854
10904
|
return {
|
|
10855
10905
|
height: t.height,
|
|
@@ -10858,7 +10908,7 @@ function Ef(e) {
|
|
|
10858
10908
|
width: t.width
|
|
10859
10909
|
};
|
|
10860
10910
|
}
|
|
10861
|
-
function
|
|
10911
|
+
function Nf(e) {
|
|
10862
10912
|
return {
|
|
10863
10913
|
boundsCheckMs: 0,
|
|
10864
10914
|
candidateIds: 0,
|
|
@@ -10884,7 +10934,7 @@ function Df(e) {
|
|
|
10884
10934
|
triangleProjectionMs: 0
|
|
10885
10935
|
};
|
|
10886
10936
|
}
|
|
10887
|
-
function
|
|
10937
|
+
function Pf(e, t) {
|
|
10888
10938
|
return {
|
|
10889
10939
|
minX: Math.min(e.x, t.x),
|
|
10890
10940
|
minY: Math.min(e.y, t.y),
|
|
@@ -10892,43 +10942,43 @@ function Of(e, t) {
|
|
|
10892
10942
|
maxY: Math.max(e.y, t.y)
|
|
10893
10943
|
};
|
|
10894
10944
|
}
|
|
10895
|
-
function
|
|
10945
|
+
function Ff(e, t) {
|
|
10896
10946
|
return t.x >= e.x ? "contains" : "intersects";
|
|
10897
10947
|
}
|
|
10898
|
-
function
|
|
10899
|
-
return
|
|
10948
|
+
function If(e, t) {
|
|
10949
|
+
return Lf(e.x, e.y, t);
|
|
10900
10950
|
}
|
|
10901
|
-
function
|
|
10951
|
+
function Lf(e, t, n) {
|
|
10902
10952
|
return e >= n.minX && e <= n.maxX && t >= n.minY && t <= n.maxY;
|
|
10903
10953
|
}
|
|
10904
|
-
function
|
|
10954
|
+
function Rf(e, t, n, r, i, a) {
|
|
10905
10955
|
return (a - t) * (n - e) > (r - t) * (i - e);
|
|
10906
10956
|
}
|
|
10907
|
-
function
|
|
10908
|
-
return
|
|
10957
|
+
function zf(e, t, n, r, i, a, o, s) {
|
|
10958
|
+
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
10959
|
}
|
|
10910
|
-
function
|
|
10960
|
+
function Bf(e, t, n, r, i) {
|
|
10911
10961
|
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
10962
|
return s >= 0 && c >= 0 && s + c <= 2 * a * o;
|
|
10913
10963
|
}
|
|
10914
|
-
function
|
|
10915
|
-
return
|
|
10964
|
+
function Vf(e, t, n, r) {
|
|
10965
|
+
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
10966
|
}
|
|
10917
|
-
function
|
|
10918
|
-
return
|
|
10967
|
+
function Hf(e, t, n) {
|
|
10968
|
+
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
10969
|
}
|
|
10920
|
-
function
|
|
10921
|
-
let a =
|
|
10970
|
+
function Uf(e, t, n, r, i = new H()) {
|
|
10971
|
+
let a = vf.copy(t).applyMatrix4(e.matrixWorld).project(n);
|
|
10922
10972
|
return i.set((a.x + 1) / 2 * r.width + r.left, (-a.y + 1) / 2 * r.height + r.top);
|
|
10923
10973
|
}
|
|
10924
|
-
function
|
|
10974
|
+
function Wf(e, t, n, r, i) {
|
|
10925
10975
|
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++)
|
|
10976
|
+
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
10977
|
return o < n.minX || a > n.maxX || c < n.minY || s > n.maxY ? pt : l === 8 ? ut : dt;
|
|
10928
10978
|
}
|
|
10929
|
-
function
|
|
10979
|
+
function Gf(e, t, n, r) {
|
|
10930
10980
|
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++)
|
|
10981
|
+
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
10982
|
return {
|
|
10933
10983
|
minX: i,
|
|
10934
10984
|
minY: o,
|
|
@@ -10936,41 +10986,41 @@ function zf(e, t, n, r) {
|
|
|
10936
10986
|
maxY: s
|
|
10937
10987
|
};
|
|
10938
10988
|
}
|
|
10939
|
-
function
|
|
10989
|
+
function Kf(e, t) {
|
|
10940
10990
|
return !(e.maxX < t.minX || e.minX > t.maxX || e.maxY < t.minY || e.minY > t.maxY);
|
|
10941
10991
|
}
|
|
10942
|
-
function
|
|
10992
|
+
function qf(e, t, n, r) {
|
|
10943
10993
|
e.geometry.boundingBox || e.geometry.computeBoundingBox();
|
|
10944
10994
|
let i = e.geometry.boundingBox;
|
|
10945
|
-
return i ?
|
|
10995
|
+
return i ? Kf(Gf(e, i, n, r), t) : !0;
|
|
10946
10996
|
}
|
|
10947
|
-
function
|
|
10997
|
+
function Jf(e, t, n) {
|
|
10948
10998
|
let r = e.get(t);
|
|
10949
10999
|
r || (r = /* @__PURE__ */ new Set(), e.set(t, r)), r.add(n);
|
|
10950
11000
|
}
|
|
10951
|
-
function
|
|
11001
|
+
function Yf(e) {
|
|
10952
11002
|
let t = 0;
|
|
10953
11003
|
return e.forEach((e) => {
|
|
10954
11004
|
t += e.size;
|
|
10955
11005
|
}), t;
|
|
10956
11006
|
}
|
|
10957
|
-
function
|
|
11007
|
+
function Xf(e, t, n, r = []) {
|
|
10958
11008
|
let i = e.geometry, a = i.index, o = i.attributes.ids, s = i.attributes.position;
|
|
10959
11009
|
if (!a || !o || !s) return;
|
|
10960
11010
|
let c = t * 3;
|
|
10961
|
-
r.length && (
|
|
11011
|
+
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
11012
|
}
|
|
10963
|
-
function
|
|
11013
|
+
function Zf({ model: e, camera: t, viewport: n, rect: r, candidateIdsByModel: i, clippingPlanes: a, profile: o }) {
|
|
10964
11014
|
let s = performance.now(), c = /* @__PURE__ */ new Map(), l = new U();
|
|
10965
11015
|
e.traverse((e) => {
|
|
10966
11016
|
let s = e;
|
|
10967
|
-
if (!s.isMesh || !
|
|
11017
|
+
if (!s.isMesh || !kf(s)) return;
|
|
10968
11018
|
let u = s.geometry.attributes.ids, d = s.geometry.attributes.position;
|
|
10969
11019
|
if (!(!u || !d)) {
|
|
10970
11020
|
o && (o.containedVerticesVisited += u.count);
|
|
10971
11021
|
for (let e = 0; e < u.count; e++) {
|
|
10972
|
-
let f =
|
|
10973
|
-
if (!i.get(f)?.has(p) || (l.fromBufferAttribute(d, e), !
|
|
11022
|
+
let f = Of(s), p = u.getX(e);
|
|
11023
|
+
if (!i.get(f)?.has(p) || (l.fromBufferAttribute(d, e), !Af(s, l, a))) continue;
|
|
10974
11024
|
o && (o.containedCandidateVertices += 1);
|
|
10975
11025
|
let m = `${f}:${p}`, h = c.get(m);
|
|
10976
11026
|
h || (h = {
|
|
@@ -10978,23 +11028,23 @@ function Gf({ model: e, camera: t, viewport: n, rect: r, candidateIdsByModel: i,
|
|
|
10978
11028
|
inside: 0,
|
|
10979
11029
|
modelID: f,
|
|
10980
11030
|
total: 0
|
|
10981
|
-
}, c.set(m, h)), h.total += 1,
|
|
11031
|
+
}, c.set(m, h)), h.total += 1, If(Uf(s, l, t, n), r) && (h.inside += 1);
|
|
10982
11032
|
}
|
|
10983
11033
|
}
|
|
10984
11034
|
});
|
|
10985
11035
|
let u = /* @__PURE__ */ new Map();
|
|
10986
11036
|
return c.forEach((e) => {
|
|
10987
|
-
e.total > 0 && e.total === e.inside &&
|
|
11037
|
+
e.total > 0 && e.total === e.inside && Jf(u, e.modelID, e.id);
|
|
10988
11038
|
}), o && (o.containedIdsMs += performance.now() - s), u;
|
|
10989
11039
|
}
|
|
10990
|
-
function
|
|
11040
|
+
function Qf({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect: i, mode: a, profile: o }) {
|
|
10991
11041
|
let s = performance.now(), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
|
|
10992
11042
|
if (!e) return c;
|
|
10993
|
-
let u =
|
|
11043
|
+
let u = Mf(r), d = performance.now();
|
|
10994
11044
|
e.updateMatrixWorld(!0), t.updateMatrixWorld(), o && (o.matrixUpdateMs += performance.now() - d), e.traverse((e) => {
|
|
10995
11045
|
let r = e;
|
|
10996
11046
|
if (!r.isMesh) return;
|
|
10997
|
-
if (o && (o.meshCount += 1), !
|
|
11047
|
+
if (o && (o.meshCount += 1), !kf(r)) {
|
|
10998
11048
|
o && (o.skippedMeshCount += 1);
|
|
10999
11049
|
return;
|
|
11000
11050
|
}
|
|
@@ -11003,7 +11053,7 @@ function Kf({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
|
|
|
11003
11053
|
o && (o.skippedMeshCount += 1);
|
|
11004
11054
|
return;
|
|
11005
11055
|
}
|
|
11006
|
-
let d = performance.now(), f =
|
|
11056
|
+
let d = performance.now(), f = qf(r, i, t, u);
|
|
11007
11057
|
if (o && (o.boundsCheckMs += performance.now() - d), !f) {
|
|
11008
11058
|
o && (o.skippedMeshCount += 1);
|
|
11009
11059
|
return;
|
|
@@ -11011,26 +11061,26 @@ function Kf({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
|
|
|
11011
11061
|
let p = performance.now();
|
|
11012
11062
|
s.shapecast({
|
|
11013
11063
|
intersectsBounds: (e) => {
|
|
11014
|
-
let n = performance.now(), a =
|
|
11064
|
+
let n = performance.now(), a = Wf(r, e, i, t, u);
|
|
11015
11065
|
return o && (o.intersectsBoundsCalls += 1, o.intersectsBoundsMs += performance.now() - n), a;
|
|
11016
11066
|
},
|
|
11017
11067
|
intersectsRange: (e, t, i) => {
|
|
11018
11068
|
let u = performance.now();
|
|
11019
11069
|
if (o && (o.intersectsRangeCalls += 1), !i) return o && (o.intersectsRangeMs += performance.now() - u), !1;
|
|
11020
|
-
for (let i = e; i < e + t; i++)
|
|
11070
|
+
for (let i = e; i < e + t; i++) Xf(r, s.resolveTriangleIndex(i), a === "contains" ? l : c, n);
|
|
11021
11071
|
return o && (o.intersectsRangeMs += performance.now() - u), !1;
|
|
11022
11072
|
},
|
|
11023
11073
|
intersectsTriangle: (e, s, d) => {
|
|
11024
11074
|
let f = performance.now();
|
|
11025
11075
|
if (o && (o.intersectsTriangleCalls += 1), !d) {
|
|
11026
|
-
let n = performance.now(), a =
|
|
11027
|
-
if (o && (o.triangleProjectionMs += performance.now() - n), !
|
|
11076
|
+
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);
|
|
11077
|
+
if (o && (o.triangleProjectionMs += performance.now() - n), !Vf(a, s, c, i)) return o && (o.intersectsTriangleMs += performance.now() - f), !1;
|
|
11028
11078
|
}
|
|
11029
|
-
return a === "contains" ?
|
|
11079
|
+
return a === "contains" ? Xf(r, s, l, n) : Xf(r, s, c, n), o && (o.intersectsTriangleMs += performance.now() - f), !1;
|
|
11030
11080
|
}
|
|
11031
11081
|
}), o && (o.shapecastMs += performance.now() - p);
|
|
11032
11082
|
});
|
|
11033
|
-
let f = a === "contains" ?
|
|
11083
|
+
let f = a === "contains" ? Zf({
|
|
11034
11084
|
model: e,
|
|
11035
11085
|
camera: t,
|
|
11036
11086
|
clippingPlanes: n,
|
|
@@ -11039,19 +11089,19 @@ function Kf({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
|
|
|
11039
11089
|
candidateIdsByModel: l,
|
|
11040
11090
|
profile: o
|
|
11041
11091
|
}) : c;
|
|
11042
|
-
return o && (o.candidateIds =
|
|
11092
|
+
return o && (o.candidateIds = Yf(l), o.selectedIds = Yf(f), o.totalMs = performance.now() - s), f;
|
|
11043
11093
|
}
|
|
11044
|
-
function
|
|
11045
|
-
let t =
|
|
11094
|
+
function $f(e) {
|
|
11095
|
+
let t = Nf(e.mode);
|
|
11046
11096
|
return {
|
|
11047
|
-
ids:
|
|
11097
|
+
ids: Qf({
|
|
11048
11098
|
...e,
|
|
11049
11099
|
profile: t
|
|
11050
11100
|
}),
|
|
11051
11101
|
profile: t
|
|
11052
11102
|
};
|
|
11053
11103
|
}
|
|
11054
|
-
function
|
|
11104
|
+
function ep(e) {
|
|
11055
11105
|
return e === "contains" ? {
|
|
11056
11106
|
border: "rgb(37, 99, 235)",
|
|
11057
11107
|
background: "rgba(37, 99, 235, 0.16)"
|
|
@@ -11060,40 +11110,40 @@ function Jf(e) {
|
|
|
11060
11110
|
background: "rgba(22, 163, 74, 0.16)"
|
|
11061
11111
|
};
|
|
11062
11112
|
}
|
|
11063
|
-
function
|
|
11064
|
-
let r =
|
|
11113
|
+
function tp(e, t, n) {
|
|
11114
|
+
let r = ep(Ff(t, n));
|
|
11065
11115
|
if (!e.current) {
|
|
11066
11116
|
let t = document.createElement("div");
|
|
11067
11117
|
t.style.position = "fixed", t.style.pointerEvents = "none", t.style.zIndex = "10", e.current = t, document.body.appendChild(t);
|
|
11068
11118
|
}
|
|
11069
|
-
let i =
|
|
11119
|
+
let i = Pf(t, n);
|
|
11070
11120
|
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
11121
|
}
|
|
11072
|
-
function
|
|
11122
|
+
function np(e) {
|
|
11073
11123
|
e.current?.remove(), e.current = null;
|
|
11074
11124
|
}
|
|
11075
11125
|
//#endregion
|
|
11076
11126
|
//#region src/viewer/Selector/useSelector.tsx
|
|
11077
|
-
var
|
|
11078
|
-
function
|
|
11079
|
-
if (Array.isArray(e)) return e.flatMap((e) =>
|
|
11127
|
+
var rp = 40;
|
|
11128
|
+
function ip(e) {
|
|
11129
|
+
if (Array.isArray(e)) return e.flatMap((e) => ip(e));
|
|
11080
11130
|
let t = e.userData;
|
|
11081
11131
|
return t.shaders ? Array.from(t.shaders) : t.shader ? [t.shader] : [];
|
|
11082
11132
|
}
|
|
11083
|
-
function
|
|
11133
|
+
function ap(e) {
|
|
11084
11134
|
let t = x(e);
|
|
11085
11135
|
return t.current = e, t;
|
|
11086
11136
|
}
|
|
11087
|
-
function
|
|
11088
|
-
|
|
11137
|
+
function op(e, t) {
|
|
11138
|
+
ip(e)?.forEach((e) => {
|
|
11089
11139
|
let n = e.uniforms.preSelectionId;
|
|
11090
11140
|
n && (n.value = t);
|
|
11091
11141
|
});
|
|
11092
11142
|
}
|
|
11093
|
-
function
|
|
11143
|
+
function sp(e) {
|
|
11094
11144
|
return Number(e.current?.modelID ?? 0);
|
|
11095
11145
|
}
|
|
11096
|
-
function
|
|
11146
|
+
function cp(e) {
|
|
11097
11147
|
let t = e;
|
|
11098
11148
|
for (; t;) {
|
|
11099
11149
|
let e = t.modelID ?? t.userData.modelID;
|
|
@@ -11102,7 +11152,7 @@ function np(e) {
|
|
|
11102
11152
|
}
|
|
11103
11153
|
return 0;
|
|
11104
11154
|
}
|
|
11105
|
-
function
|
|
11155
|
+
function lp(e) {
|
|
11106
11156
|
let t = e;
|
|
11107
11157
|
for (; t;) {
|
|
11108
11158
|
if (!t.visible) return !1;
|
|
@@ -11110,7 +11160,7 @@ function rp(e) {
|
|
|
11110
11160
|
}
|
|
11111
11161
|
return !0;
|
|
11112
11162
|
}
|
|
11113
|
-
function
|
|
11163
|
+
function up(e) {
|
|
11114
11164
|
if (!e) return "";
|
|
11115
11165
|
let t = [
|
|
11116
11166
|
e.uuid,
|
|
@@ -11123,24 +11173,24 @@ function ip(e) {
|
|
|
11123
11173
|
});
|
|
11124
11174
|
}), t.join(":");
|
|
11125
11175
|
}
|
|
11126
|
-
function
|
|
11127
|
-
if (!
|
|
11176
|
+
function dp(e) {
|
|
11177
|
+
if (!lp(e.object) || !(e.object instanceof z) || e.faceIndex === void 0 || e.faceIndex === null) return !1;
|
|
11128
11178
|
let t = e.object.geometry;
|
|
11129
11179
|
return !!(t.index && t.attributes.ids);
|
|
11130
11180
|
}
|
|
11131
|
-
function
|
|
11132
|
-
if (!
|
|
11181
|
+
function fp(e) {
|
|
11182
|
+
if (!dp(e)) return null;
|
|
11133
11183
|
let t = e.object, n = t.geometry, r = n.index.getX(e.faceIndex * 3), i = n.attributes.ids;
|
|
11134
11184
|
if (r >= i.count) return null;
|
|
11135
11185
|
let a = n.attributes.modelID;
|
|
11136
11186
|
return {
|
|
11137
11187
|
elementID: i.getX(r),
|
|
11138
11188
|
hit: e,
|
|
11139
|
-
modelID: a ? a.getX(r) :
|
|
11189
|
+
modelID: a ? a.getX(r) : cp(t)
|
|
11140
11190
|
};
|
|
11141
11191
|
}
|
|
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 =
|
|
11192
|
+
function pp(e, t, n, r, i, a, o, s = 0) {
|
|
11193
|
+
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
11194
|
meshesByModel: /* @__PURE__ */ new Map(),
|
|
11145
11195
|
root: null,
|
|
11146
11196
|
version: ""
|
|
@@ -11154,12 +11204,12 @@ function sp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11154
11204
|
let n = t.current;
|
|
11155
11205
|
n && (n.cancel(), n.setOrbitPoint(e.x, e.y, e.z));
|
|
11156
11206
|
}, M = () => {
|
|
11157
|
-
let t = e.current, n =
|
|
11207
|
+
let t = e.current, n = up(t), r = A.current;
|
|
11158
11208
|
if (r.root !== t || r.version !== n) {
|
|
11159
11209
|
let e = /* @__PURE__ */ new Map();
|
|
11160
11210
|
return t?.traverse((t) => {
|
|
11161
11211
|
if (!(t instanceof z) || !t.geometry.index || !t.geometry.attributes.ids) return;
|
|
11162
|
-
let n =
|
|
11212
|
+
let n = cp(t), r = e.get(n) ?? [];
|
|
11163
11213
|
r.push(t), e.set(n, r);
|
|
11164
11214
|
}), A.current = {
|
|
11165
11215
|
meshesByModel: e,
|
|
@@ -11170,7 +11220,7 @@ function sp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11170
11220
|
return r;
|
|
11171
11221
|
}, oe = () => Array.from(M().meshesByModel.values()).flat(), se = (e) => M().meshesByModel.get(e) ?? [], ce = (e) => {
|
|
11172
11222
|
e && se(e.modelID).forEach((e) => {
|
|
11173
|
-
e.preselected = !1,
|
|
11223
|
+
e.preselected = !1, op(e.material, -1);
|
|
11174
11224
|
});
|
|
11175
11225
|
}, le = () => {
|
|
11176
11226
|
a?.(null), ce(te.current), te.current = null;
|
|
@@ -11185,13 +11235,13 @@ function sp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11185
11235
|
elementID: t,
|
|
11186
11236
|
modelID: e
|
|
11187
11237
|
}), se(e).forEach((e) => {
|
|
11188
|
-
e.preselected = !0,
|
|
11238
|
+
e.preselected = !0, op(e.material, t);
|
|
11189
11239
|
}), te.current = {
|
|
11190
11240
|
elementID: t,
|
|
11191
11241
|
modelID: e
|
|
11192
11242
|
});
|
|
11193
11243
|
}, de = () => {
|
|
11194
|
-
v.current = null, b.current = !1,
|
|
11244
|
+
v.current = null, b.current = !1, np(y), t.current && (t.current.enabled = !0);
|
|
11195
11245
|
}, N = (e) => {
|
|
11196
11246
|
if (re()) {
|
|
11197
11247
|
ie(), le();
|
|
@@ -11233,7 +11283,7 @@ function sp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11233
11283
|
return;
|
|
11234
11284
|
}
|
|
11235
11285
|
if (O.current = e, E.current !== null) return;
|
|
11236
|
-
let t = fe() - T.current, n = Math.max(0,
|
|
11286
|
+
let t = fe() - T.current, n = Math.max(0, rp - t);
|
|
11237
11287
|
E.current = window.setTimeout(() => {
|
|
11238
11288
|
E.current = null;
|
|
11239
11289
|
let e = O.current;
|
|
@@ -11270,7 +11320,7 @@ function sp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11270
11320
|
c.current = "end";
|
|
11271
11321
|
return;
|
|
11272
11322
|
}
|
|
11273
|
-
let n = t.shiftKey, r = t.ctrlKey, i = Se(t), a, o =
|
|
11323
|
+
let n = t.shiftKey, r = t.ctrlKey, i = Se(t), a, o = sp(e), s = null;
|
|
11274
11324
|
if (i && (o = i.modelID, s = i.hit.point, a = i.elementID), r) {
|
|
11275
11325
|
a !== void 0 && f(o, [a]);
|
|
11276
11326
|
return;
|
|
@@ -11288,7 +11338,7 @@ function sp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11288
11338
|
}
|
|
11289
11339
|
if (!v.current) return;
|
|
11290
11340
|
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(),
|
|
11341
|
+
n < 6 && r < 6 || (b.current ||= !0, e.preventDefault(), tp(y, v.current, t));
|
|
11292
11342
|
}, ye = (r) => {
|
|
11293
11343
|
if (ne()) {
|
|
11294
11344
|
de();
|
|
@@ -11296,12 +11346,12 @@ function sp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11296
11346
|
}
|
|
11297
11347
|
if (!v.current) return;
|
|
11298
11348
|
F.current = me();
|
|
11299
|
-
let i = b.current, a = new H(r.clientX, r.clientY), o =
|
|
11300
|
-
if (v.current = null, b.current = !1,
|
|
11349
|
+
let i = b.current, a = new H(r.clientX, r.clientY), o = Pf(v.current, a), s = Ff(v.current, a);
|
|
11350
|
+
if (v.current = null, b.current = !1, np(y), t.current && setTimeout(() => {
|
|
11301
11351
|
t.current && (t.current.enabled = !0);
|
|
11302
11352
|
}, 100), !i) return;
|
|
11303
11353
|
S.current = !0, r.preventDefault();
|
|
11304
|
-
let { ids: c, profile: l } =
|
|
11354
|
+
let { ids: c, profile: l } = $f({
|
|
11305
11355
|
model: e.current,
|
|
11306
11356
|
camera: pe,
|
|
11307
11357
|
clippingPlanes: n.getActiveClippingPlanes(),
|
|
@@ -11321,7 +11371,7 @@ function sp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11321
11371
|
let i = Array.isArray(t) ? t.filter((e) => e.visible) : t ? [t] : [];
|
|
11322
11372
|
return i.length ? n.getIntersection(!1, {
|
|
11323
11373
|
event: e,
|
|
11324
|
-
filter:
|
|
11374
|
+
filter: dp,
|
|
11325
11375
|
firstHitOnly: r,
|
|
11326
11376
|
object: i,
|
|
11327
11377
|
recursive: !0
|
|
@@ -11329,11 +11379,11 @@ function sp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11329
11379
|
}, be = () => i?.().filter((e) => e.visible) ?? [], xe = (e, t) => {
|
|
11330
11380
|
let n = L(e, t, !0);
|
|
11331
11381
|
for (let e of n) {
|
|
11332
|
-
let t =
|
|
11382
|
+
let t = fp(e);
|
|
11333
11383
|
if (t) return t;
|
|
11334
11384
|
}
|
|
11335
11385
|
return null;
|
|
11336
|
-
}, Se = (e) => xe(e, be()) || xe(e, oe()), R =
|
|
11386
|
+
}, Se = (e) => xe(e, be()) || xe(e, oe()), R = ap({
|
|
11337
11387
|
clearPreselection: le,
|
|
11338
11388
|
onBoxPointerDown: _e,
|
|
11339
11389
|
onBoxPointerMove: ve,
|
|
@@ -11365,7 +11415,7 @@ function sp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11365
11415
|
e.ctrlKey && e.preventDefault();
|
|
11366
11416
|
}
|
|
11367
11417
|
return () => {
|
|
11368
|
-
|
|
11418
|
+
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
11419
|
};
|
|
11370
11420
|
}, [
|
|
11371
11421
|
t,
|
|
@@ -11377,30 +11427,30 @@ function sp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11377
11427
|
}
|
|
11378
11428
|
//#endregion
|
|
11379
11429
|
//#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(
|
|
11430
|
+
var mp = new U(1, 1, 1).normalize(), hp = 1.18, gp = .001, _p = .001, vp = 4, yp = 1.45;
|
|
11431
|
+
function bp(e, t) {
|
|
11432
|
+
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
11433
|
e.left = -i / 2, e.right = i / 2, e.top = r / 2, e.bottom = -r / 2;
|
|
11384
11434
|
}
|
|
11385
|
-
function
|
|
11435
|
+
function xp(e, t) {
|
|
11386
11436
|
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) *
|
|
11437
|
+
return t / Math.sin(Math.min(n, r) / 2) * hp;
|
|
11388
11438
|
}
|
|
11389
|
-
function
|
|
11439
|
+
function Sp() {
|
|
11390
11440
|
let { camera: e } = D();
|
|
11391
11441
|
return h((t, n, r) => {
|
|
11392
11442
|
if (!t.current || !(e instanceof je) && !(e instanceof Ae)) return;
|
|
11393
11443
|
let i = new A().setFromObject(t.current);
|
|
11394
11444
|
if (i.isEmpty()) return;
|
|
11395
|
-
let a = i.getCenter(new U()), o = i.getBoundingSphere(new We()), s = n.current, c = e instanceof je ?
|
|
11445
|
+
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
11446
|
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 *
|
|
11447
|
+
let l = a.clone().addScaledVector(mp, c);
|
|
11448
|
+
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
11449
|
}, [e]);
|
|
11400
11450
|
}
|
|
11401
11451
|
//#endregion
|
|
11402
11452
|
//#region src/viewer/Camera/FirstPersonControls.tsx
|
|
11403
|
-
var
|
|
11453
|
+
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
11454
|
"KeyW",
|
|
11405
11455
|
"KeyA",
|
|
11406
11456
|
"KeyS",
|
|
@@ -11409,62 +11459,62 @@ var _p = 1, vp = .004, yp = -Math.PI / 2 + .01, bp = Math.PI / 2 - .01, xp = .24
|
|
|
11409
11459
|
"ShiftRight",
|
|
11410
11460
|
"ControlLeft",
|
|
11411
11461
|
"ControlRight"
|
|
11412
|
-
]),
|
|
11413
|
-
function
|
|
11462
|
+
]), Ip = new Set(["AltLeft", "AltRight"]), Lp = new U(), Rp = new U(), zp = new U(), Bp = new U(), Vp = new U(0, -1, 0);
|
|
11463
|
+
function Hp(e, t) {
|
|
11414
11464
|
return typeof e == "number" && Number.isFinite(e) ? e : t;
|
|
11415
11465
|
}
|
|
11416
|
-
function
|
|
11466
|
+
function Up(e, t, n) {
|
|
11417
11467
|
return Math.min(n, Math.max(t, e));
|
|
11418
11468
|
}
|
|
11419
|
-
function
|
|
11420
|
-
return
|
|
11469
|
+
function Wp(e, t, n, r) {
|
|
11470
|
+
return Up(Hp(e, t), n, r);
|
|
11421
11471
|
}
|
|
11422
|
-
function
|
|
11472
|
+
function Gp(e) {
|
|
11423
11473
|
if (!(e instanceof HTMLElement)) return !1;
|
|
11424
11474
|
let t = e.tagName.toLowerCase();
|
|
11425
11475
|
return e.isContentEditable || t === "input" || t === "textarea" || t === "select";
|
|
11426
11476
|
}
|
|
11427
|
-
function
|
|
11477
|
+
function Kp(e) {
|
|
11428
11478
|
if (!e) return {
|
|
11429
|
-
eyeHeight:
|
|
11430
|
-
groundMaxDistance:
|
|
11431
|
-
moveSpeed:
|
|
11479
|
+
eyeHeight: Mp,
|
|
11480
|
+
groundMaxDistance: Mp * Pp,
|
|
11481
|
+
moveSpeed: Op
|
|
11432
11482
|
};
|
|
11433
11483
|
let t = new A().setFromObject(e);
|
|
11434
11484
|
if (t.isEmpty()) return {
|
|
11435
|
-
eyeHeight:
|
|
11436
|
-
groundMaxDistance:
|
|
11437
|
-
moveSpeed:
|
|
11485
|
+
eyeHeight: Mp,
|
|
11486
|
+
groundMaxDistance: Mp * Pp,
|
|
11487
|
+
moveSpeed: Op
|
|
11438
11488
|
};
|
|
11439
|
-
let n = t.getBoundingSphere(new We()).radius, r = Math.min(
|
|
11489
|
+
let n = t.getBoundingSphere(new We()).radius, r = Math.min(Np, Math.max(Mp, n * jp));
|
|
11440
11490
|
return {
|
|
11441
11491
|
eyeHeight: r,
|
|
11442
|
-
groundMaxDistance: r *
|
|
11443
|
-
moveSpeed: Math.min(
|
|
11492
|
+
groundMaxDistance: r * Pp,
|
|
11493
|
+
moveSpeed: Math.min(kp, Math.max(Op, n * Dp))
|
|
11444
11494
|
};
|
|
11445
11495
|
}
|
|
11446
|
-
function
|
|
11447
|
-
let n =
|
|
11496
|
+
function qp(e, t) {
|
|
11497
|
+
let n = Kp(e), r = Wp(t.eyeHeight, n.eyeHeight, .01, Np), i = Wp(t.groundSnapDistanceRatio, Pp, .1, 100);
|
|
11448
11498
|
return {
|
|
11449
11499
|
eyeHeight: r,
|
|
11450
|
-
groundCheckInterval: Math.round(
|
|
11500
|
+
groundCheckInterval: Math.round(Wp(t.groundCheckInterval, Cp, 1, 120)),
|
|
11451
11501
|
groundMaxDistance: r * i,
|
|
11452
|
-
lookSensitivity:
|
|
11453
|
-
moveSpeed:
|
|
11502
|
+
lookSensitivity: Wp(t.lookSensitivity, wp, 1e-4, .1),
|
|
11503
|
+
moveSpeed: Wp(t.speed, n.moveSpeed, .01, kp)
|
|
11454
11504
|
};
|
|
11455
11505
|
}
|
|
11456
|
-
function
|
|
11457
|
-
return e.getWorldDirection(
|
|
11506
|
+
function Jp(e) {
|
|
11507
|
+
return e.getWorldDirection(Lp), Lp.y = 0, Lp.lengthSq() === 0 && Lp.set(0, 0, -1), Lp.normalize();
|
|
11458
11508
|
}
|
|
11459
|
-
function
|
|
11460
|
-
return
|
|
11509
|
+
function Yp(e) {
|
|
11510
|
+
return Rp.copy(e).cross(Xp).normalize(), Rp.lengthSq() === 0 && Rp.set(1, 0, 0), Rp;
|
|
11461
11511
|
}
|
|
11462
|
-
var
|
|
11463
|
-
function
|
|
11512
|
+
var Xp = new U(0, 1, 0);
|
|
11513
|
+
function Zp(e, t) {
|
|
11464
11514
|
let n = t.current;
|
|
11465
|
-
n && (e.getWorldDirection(
|
|
11515
|
+
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
11516
|
}
|
|
11467
|
-
function
|
|
11517
|
+
function Qp(e) {
|
|
11468
11518
|
return e.find((e) => {
|
|
11469
11519
|
let t = e.object;
|
|
11470
11520
|
for (; t;) {
|
|
@@ -11474,42 +11524,42 @@ function Kp(e) {
|
|
|
11474
11524
|
return !0;
|
|
11475
11525
|
});
|
|
11476
11526
|
}
|
|
11477
|
-
function
|
|
11478
|
-
let n =
|
|
11479
|
-
return
|
|
11527
|
+
function $p(e, t) {
|
|
11528
|
+
let n = Yp(Jp(e));
|
|
11529
|
+
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
11530
|
}
|
|
11481
|
-
function
|
|
11531
|
+
function em(e) {
|
|
11482
11532
|
return e.has("ShiftLeft") || e.has("ShiftRight") || e.has("ControlLeft") || e.has("ControlRight");
|
|
11483
11533
|
}
|
|
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(
|
|
11534
|
+
function tm({ active: e, activeRef: t, controlRef: n, modelRef: r, settings: i }) {
|
|
11535
|
+
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
11536
|
pitch: 0,
|
|
11487
11537
|
yaw: 0
|
|
11488
11538
|
}), C = x(null), w = b(() => new Le(), []);
|
|
11489
11539
|
return _(() => {
|
|
11490
11540
|
t.current = e;
|
|
11491
11541
|
}, [e, t]), _(() => {
|
|
11492
|
-
let e =
|
|
11542
|
+
let e = qp(r.current, i);
|
|
11493
11543
|
d.current = e.eyeHeight, m.current = e.groundCheckInterval, p.current = e.groundMaxDistance, h.current = e.lookSensitivity, y.current = e.moveSpeed;
|
|
11494
11544
|
}, [r, i]), _(() => {
|
|
11495
11545
|
let e = o.domElement, i = e.style.outline, c = e.style.userSelect;
|
|
11496
11546
|
e.tabIndex = Math.max(e.tabIndex, 0), e.style.outline = "none", e.style.userSelect = "none";
|
|
11497
11547
|
let _ = (e, t) => {
|
|
11498
11548
|
let n = S.current, r = h.current;
|
|
11499
|
-
n.yaw -= e * r, n.pitch -= t * r, n.pitch = Math.max(
|
|
11549
|
+
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
11550
|
}, b = () => {
|
|
11501
11551
|
l.current !== null && (cancelAnimationFrame(l.current), l.current = null);
|
|
11502
11552
|
}, x = (e) => {
|
|
11503
11553
|
if (!t.current) return;
|
|
11504
11554
|
n.current?.cancel(), n.current && (n.current.enabled = !1);
|
|
11505
|
-
let i =
|
|
11555
|
+
let i = $p(a, u.current);
|
|
11506
11556
|
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 && !
|
|
11557
|
+
let o = v.current ? Ap : 1;
|
|
11558
|
+
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
11559
|
let e = w, t = e.firstHitOnly;
|
|
11510
|
-
e.firstHitOnly = !0, w.set(a.position,
|
|
11560
|
+
e.firstHitOnly = !0, w.set(a.position, Vp), w.far = p.current;
|
|
11511
11561
|
try {
|
|
11512
|
-
let e =
|
|
11562
|
+
let e = Qp(r.current ? w.intersectObject(r.current, !0) : []);
|
|
11513
11563
|
e && (a.position.y = e.point.y + d.current);
|
|
11514
11564
|
} finally {
|
|
11515
11565
|
e.firstHitOnly = t, w.far = Infinity;
|
|
@@ -11533,18 +11583,18 @@ function Yp({ active: e, activeRef: t, controlRef: n, modelRef: r, settings: i }
|
|
|
11533
11583
|
}, D = (n) => {
|
|
11534
11584
|
t.current && document.pointerLockElement === e && _(n.movementX, n.movementY);
|
|
11535
11585
|
}, O = (e) => {
|
|
11536
|
-
if (t.current && !
|
|
11537
|
-
if (
|
|
11586
|
+
if (t.current && !Gp(e.target)) {
|
|
11587
|
+
if (Ip.has(e.code)) {
|
|
11538
11588
|
e.repeat || (v.current = !v.current), e.preventDefault(), e.stopPropagation();
|
|
11539
11589
|
return;
|
|
11540
11590
|
}
|
|
11541
|
-
|
|
11591
|
+
Fp.has(e.code) && (e.preventDefault(), e.stopPropagation(), u.current.add(e.code), C(), s());
|
|
11542
11592
|
}
|
|
11543
11593
|
}, te = (e) => {
|
|
11544
|
-
|
|
11594
|
+
Fp.has(e.code) && (u.current.delete(e.code), u.current.size || b());
|
|
11545
11595
|
};
|
|
11546
11596
|
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(),
|
|
11597
|
+
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
11598
|
};
|
|
11549
11599
|
}, [
|
|
11550
11600
|
a,
|
|
@@ -11564,14 +11614,14 @@ function Yp({ active: e, activeRef: t, controlRef: n, modelRef: r, settings: i }
|
|
|
11564
11614
|
C.current = c.getState().preselectionEnabled, c.getState().setPreselectionEnabled(!1);
|
|
11565
11615
|
let l = n.current;
|
|
11566
11616
|
l && (l.enabled = !1, l.cancel());
|
|
11567
|
-
let f =
|
|
11617
|
+
let f = qp(r.current, i);
|
|
11568
11618
|
d.current = f.eyeHeight, m.current = f.groundCheckInterval, p.current = f.groundMaxDistance, h.current = f.lookSensitivity, y.current = f.moveSpeed;
|
|
11569
11619
|
let g = new N().setFromQuaternion(a.quaternion, "YXZ");
|
|
11570
11620
|
return S.current = {
|
|
11571
11621
|
pitch: g.x,
|
|
11572
11622
|
yaw: g.y
|
|
11573
11623
|
}, () => {
|
|
11574
|
-
u.current.clear(), t(), document.pointerLockElement === o.domElement && document.exitPointerLock(),
|
|
11624
|
+
u.current.clear(), t(), document.pointerLockElement === o.domElement && document.exitPointerLock(), Zp(a, n), s();
|
|
11575
11625
|
};
|
|
11576
11626
|
}, [
|
|
11577
11627
|
e,
|
|
@@ -11586,8 +11636,8 @@ function Yp({ active: e, activeRef: t, controlRef: n, modelRef: r, settings: i }
|
|
|
11586
11636
|
}
|
|
11587
11637
|
//#endregion
|
|
11588
11638
|
//#region src/viewer/ViewerComponents/ViewerScene.tsx
|
|
11589
|
-
var
|
|
11590
|
-
function
|
|
11639
|
+
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();
|
|
11640
|
+
function wm(e = !1) {
|
|
11591
11641
|
return {
|
|
11592
11642
|
active: e,
|
|
11593
11643
|
finalFitDone: !1,
|
|
@@ -11595,23 +11645,23 @@ function vm(e = !1) {
|
|
|
11595
11645
|
userInteractedAfterFirstFit: !1
|
|
11596
11646
|
};
|
|
11597
11647
|
}
|
|
11598
|
-
function
|
|
11648
|
+
function Tm(e) {
|
|
11599
11649
|
let t = [];
|
|
11600
11650
|
return e?.traverse((e) => {
|
|
11601
11651
|
e instanceof z && e.geometry.attributes.ids && t.push(e);
|
|
11602
11652
|
}), t;
|
|
11603
11653
|
}
|
|
11604
|
-
function
|
|
11654
|
+
function Em(e) {
|
|
11605
11655
|
let t = e.geometry.index?.count;
|
|
11606
11656
|
return t === void 0 ? (e.geometry.attributes.position?.count ?? 0) / 3 : t / 3;
|
|
11607
11657
|
}
|
|
11608
|
-
function
|
|
11609
|
-
return e.reduce((e, t) => e +
|
|
11658
|
+
function Dm(e) {
|
|
11659
|
+
return e.reduce((e, t) => e + Em(t), 0);
|
|
11610
11660
|
}
|
|
11611
|
-
function
|
|
11612
|
-
return
|
|
11661
|
+
function Om(e) {
|
|
11662
|
+
return Dm(e) > sm;
|
|
11613
11663
|
}
|
|
11614
|
-
function
|
|
11664
|
+
function km(e, t) {
|
|
11615
11665
|
if (t <= 0 || !e.length) return [];
|
|
11616
11666
|
let n = [...e];
|
|
11617
11667
|
for (let e = n.length - 1; e > 0 && n.length - e <= t; e--) {
|
|
@@ -11620,10 +11670,10 @@ function Cm(e, t) {
|
|
|
11620
11670
|
}
|
|
11621
11671
|
return n.slice(-t);
|
|
11622
11672
|
}
|
|
11623
|
-
function
|
|
11673
|
+
function Am(e, t) {
|
|
11624
11674
|
if (t <= 0) return null;
|
|
11625
|
-
let n =
|
|
11626
|
-
if (!
|
|
11675
|
+
let n = Tm(e);
|
|
11676
|
+
if (!Om(n)) return null;
|
|
11627
11677
|
let r = n.filter((e) => e.visible);
|
|
11628
11678
|
if (r.length < 2) return null;
|
|
11629
11679
|
let i = Math.min(r.length, Math.round(r.length * t));
|
|
@@ -11636,87 +11686,87 @@ function wm(e, t) {
|
|
|
11636
11686
|
}
|
|
11637
11687
|
o.push(e);
|
|
11638
11688
|
});
|
|
11639
|
-
let s = [...
|
|
11640
|
-
return c > 0 && s.push(...
|
|
11689
|
+
let s = [...km(o, i)], c = i - s.length;
|
|
11690
|
+
return c > 0 && s.push(...km(a, c)), s.length ? {
|
|
11641
11691
|
hiddenMeshes: s,
|
|
11642
11692
|
root: e
|
|
11643
11693
|
} : null;
|
|
11644
11694
|
}
|
|
11645
|
-
function
|
|
11695
|
+
function jm(e) {
|
|
11646
11696
|
let t = /* @__PURE__ */ new Map(), n = 0;
|
|
11647
11697
|
return e.hiddenMeshes.forEach((e) => {
|
|
11648
11698
|
e.parent && (t.set(e, e.visible), e.visible && (e.userData[dl] = !0, e.visible = !1, n++));
|
|
11649
11699
|
}), n ? t : null;
|
|
11650
11700
|
}
|
|
11651
|
-
function
|
|
11701
|
+
function Mm(e) {
|
|
11652
11702
|
e?.forEach((e, t) => {
|
|
11653
11703
|
delete t.userData[dl], t.visible = e;
|
|
11654
11704
|
});
|
|
11655
11705
|
}
|
|
11656
|
-
function
|
|
11657
|
-
let t =
|
|
11658
|
-
return t ? Math.max(t.radius *
|
|
11706
|
+
function Nm(e) {
|
|
11707
|
+
let t = Fm(e);
|
|
11708
|
+
return t ? Math.max(t.radius * rm, nm) : nm;
|
|
11659
11709
|
}
|
|
11660
|
-
function
|
|
11710
|
+
function Pm(e) {
|
|
11661
11711
|
if (e.dollyToCursor = !0, e.camera instanceof Ae) {
|
|
11662
11712
|
e.mouseButtons.middle = Fs.ACTION.ZOOM, e.mouseButtons.wheel = Fs.ACTION.ZOOM, e.touches.two = Fs.ACTION.TOUCH_ZOOM_TRUCK, e.infinityDolly = !1;
|
|
11663
11713
|
return;
|
|
11664
11714
|
}
|
|
11665
11715
|
e.mouseButtons.middle = Fs.ACTION.DOLLY, e.mouseButtons.wheel = Fs.ACTION.DOLLY, e.touches.two = Fs.ACTION.TOUCH_DOLLY_TRUCK, e.infinityDolly = !0;
|
|
11666
11716
|
}
|
|
11667
|
-
function
|
|
11668
|
-
if (!e || (
|
|
11669
|
-
let t =
|
|
11717
|
+
function Fm(e) {
|
|
11718
|
+
if (!e || (ym.setFromObject(e), ym.isEmpty())) return null;
|
|
11719
|
+
let t = ym.getBoundingSphere(bm);
|
|
11670
11720
|
return !Number.isFinite(t.radius) || t.radius <= 0 ? null : t;
|
|
11671
11721
|
}
|
|
11672
|
-
function
|
|
11722
|
+
function Im(e) {
|
|
11673
11723
|
return e.type === "Group" && typeof e.userData.modelID == "number";
|
|
11674
11724
|
}
|
|
11675
|
-
function
|
|
11676
|
-
return e?.children.filter(
|
|
11725
|
+
function Lm(e) {
|
|
11726
|
+
return e?.children.filter(Im) ?? [];
|
|
11677
11727
|
}
|
|
11678
|
-
function
|
|
11679
|
-
return
|
|
11728
|
+
function Rm(e, t) {
|
|
11729
|
+
return Lm(e).find((e) => e.userData.modelID === t) ?? null;
|
|
11680
11730
|
}
|
|
11681
|
-
function
|
|
11731
|
+
function zm(e) {
|
|
11682
11732
|
return e instanceof Ae ? "orthographic" : "perspective";
|
|
11683
11733
|
}
|
|
11684
|
-
function
|
|
11734
|
+
function Bm(e) {
|
|
11685
11735
|
return e instanceof je || e instanceof Ae;
|
|
11686
11736
|
}
|
|
11687
|
-
function
|
|
11737
|
+
function Vm(e) {
|
|
11688
11738
|
return e.height > 0 ? e.width / e.height : 1;
|
|
11689
11739
|
}
|
|
11690
|
-
function
|
|
11691
|
-
return Math.max(
|
|
11740
|
+
function Hm(e) {
|
|
11741
|
+
return Math.max(um, (e.top - e.bottom) / Math.max(e.zoom, 1e-4));
|
|
11692
11742
|
}
|
|
11693
|
-
function
|
|
11694
|
-
let r = Math.max(
|
|
11743
|
+
function Um(e, t, n) {
|
|
11744
|
+
let r = Math.max(um, n) * Math.max(e.zoom, 1e-4), i = r * t;
|
|
11695
11745
|
e.left = -i / 2, e.right = i / 2, e.top = r / 2, e.bottom = -r / 2, e.updateProjectionMatrix();
|
|
11696
11746
|
}
|
|
11697
|
-
function
|
|
11698
|
-
if (e instanceof Ae) return
|
|
11747
|
+
function Wm(e, t) {
|
|
11748
|
+
if (e instanceof Ae) return Hm(e);
|
|
11699
11749
|
if (e instanceof je) {
|
|
11700
|
-
let n = Math.max(
|
|
11750
|
+
let n = Math.max(lm, e.position.distanceTo(t));
|
|
11701
11751
|
return 2 * Math.tan(Se.degToRad(e.fov) / 2) * n;
|
|
11702
11752
|
}
|
|
11703
11753
|
return 1;
|
|
11704
11754
|
}
|
|
11705
|
-
function
|
|
11706
|
-
let n =
|
|
11755
|
+
function Gm(e, t) {
|
|
11756
|
+
let n = Vm(t);
|
|
11707
11757
|
if (e instanceof je) {
|
|
11708
11758
|
e.aspect = n, e.updateProjectionMatrix();
|
|
11709
11759
|
return;
|
|
11710
11760
|
}
|
|
11711
|
-
e instanceof Ae &&
|
|
11761
|
+
e instanceof Ae && Um(e, n, Hm(e));
|
|
11712
11762
|
}
|
|
11713
|
-
function
|
|
11714
|
-
let n =
|
|
11763
|
+
function Km(e, t) {
|
|
11764
|
+
let n = Fm(t);
|
|
11715
11765
|
if (!n) return;
|
|
11716
|
-
let r = Math.max(
|
|
11766
|
+
let r = Math.max(dm, n.radius * fm, e.near + 1);
|
|
11717
11767
|
Math.abs(e.far - r) < 1 || (e.far = r, e.updateProjectionMatrix());
|
|
11718
11768
|
}
|
|
11719
|
-
function
|
|
11769
|
+
function qm(e, t) {
|
|
11720
11770
|
let n = new A();
|
|
11721
11771
|
return Object.entries(e).forEach(([e, r]) => {
|
|
11722
11772
|
let i = Number(e), a = t.elementBounds.get(i);
|
|
@@ -11726,16 +11776,16 @@ function Vm(e, t) {
|
|
|
11726
11776
|
});
|
|
11727
11777
|
}), n.isEmpty() ? null : n;
|
|
11728
11778
|
}
|
|
11729
|
-
function
|
|
11730
|
-
let t = e.getSize(
|
|
11731
|
-
return Number.isFinite(n) && n > 0 ? n *
|
|
11779
|
+
function Jm(e) {
|
|
11780
|
+
let t = e.getSize(Cm), n = Math.max(t.x, t.y, t.z);
|
|
11781
|
+
return Number.isFinite(n) && n > 0 ? n * _m : nm;
|
|
11732
11782
|
}
|
|
11733
|
-
function
|
|
11734
|
-
let r = Math.max(
|
|
11735
|
-
return Number.isFinite(i) && i >= r ? e : (
|
|
11783
|
+
function Ym(e, t, n) {
|
|
11784
|
+
let r = Math.max(nm, (Number.isFinite(n) ? n : nm) * gm), i = t.position.distanceTo(e);
|
|
11785
|
+
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
11786
|
}
|
|
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 =
|
|
11787
|
+
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 }) {
|
|
11788
|
+
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
11789
|
N.setCapsPreselection(e), w();
|
|
11740
11790
|
}, [N, w]);
|
|
11741
11791
|
_(() => {
|
|
@@ -11778,7 +11828,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
11778
11828
|
I,
|
|
11779
11829
|
me,
|
|
11780
11830
|
he
|
|
11781
|
-
]), _e = b(() => new $n(), []), ve = oe.buildIndex, ye = M.resetIndex, L = ce.applyStoredColors, be =
|
|
11831
|
+
]), _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
11832
|
_(() => {
|
|
11783
11833
|
let e = new Set(Object.keys(c).map((e) => Number(e)));
|
|
11784
11834
|
Oe.current.forEach((t) => {
|
|
@@ -11786,7 +11836,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
11786
11836
|
}), Oe.current = e;
|
|
11787
11837
|
}, [ce, c]);
|
|
11788
11838
|
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 =
|
|
11839
|
+
Be.current !== i && (Be.current = i, Ve.current.clear(), B.current = wm(), Me.current = null);
|
|
11790
11840
|
let $e = h((e, t, n) => {
|
|
11791
11841
|
let r = Ve.current.get(e) ?? 0;
|
|
11792
11842
|
Ve.current.set(e, t), n > 0 && t >= n && r < n && Ue((e) => e + 1);
|
|
@@ -11799,10 +11849,10 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
11799
11849
|
if (!t || e.camera.uuid !== t.cameraUuid) return !1;
|
|
11800
11850
|
Ne.current = null, e.cancel(), e.updateCameraUp();
|
|
11801
11851
|
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),
|
|
11852
|
+
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
11853
|
}, [j, s]), tt = h((e) => {
|
|
11804
11854
|
let t = n;
|
|
11805
|
-
t.current !== e && (t.current = e, e && (e.minDistance =
|
|
11855
|
+
t.current !== e && (t.current = e, e && (e.minDistance = Nm(s.current), Pm(e), et(e)), Ge((e) => e + 1));
|
|
11806
11856
|
}, [
|
|
11807
11857
|
n,
|
|
11808
11858
|
s,
|
|
@@ -11817,7 +11867,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
11817
11867
|
...e
|
|
11818
11868
|
}));
|
|
11819
11869
|
}, []), 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),
|
|
11870
|
+
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
11871
|
}, [
|
|
11822
11872
|
N,
|
|
11823
11873
|
j,
|
|
@@ -11855,7 +11905,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
11855
11905
|
s,
|
|
11856
11906
|
k
|
|
11857
11907
|
]), _(() => {
|
|
11858
|
-
|
|
11908
|
+
Gm(A, ae), j();
|
|
11859
11909
|
}, [
|
|
11860
11910
|
A,
|
|
11861
11911
|
j,
|
|
@@ -11873,11 +11923,11 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
11873
11923
|
let dt = b(() => {
|
|
11874
11924
|
let e = Object.keys(c).sort((e, t) => Number(e) - Number(t));
|
|
11875
11925
|
for (let t of e) {
|
|
11876
|
-
let e =
|
|
11926
|
+
let e = ed(c[Number(t)]);
|
|
11877
11927
|
if (e) return e;
|
|
11878
11928
|
}
|
|
11879
11929
|
return null;
|
|
11880
|
-
}, [c]), ft = b(() =>
|
|
11930
|
+
}, [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
11931
|
Ee.current = mt, De.current = ht, ke.current = l, _(() => {
|
|
11882
11932
|
let e = new Set(mt);
|
|
11883
11933
|
Ve.current.forEach((t, n) => {
|
|
@@ -11885,11 +11935,11 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
11885
11935
|
});
|
|
11886
11936
|
}, [mt]);
|
|
11887
11937
|
let gt = o !== "performance", _t = h(() => {
|
|
11888
|
-
n.current && (n.current.minDistance =
|
|
11938
|
+
n.current && (n.current.minDistance = Nm(s.current));
|
|
11889
11939
|
}, [n, s]), vt = h((e, t = !1) => {
|
|
11890
11940
|
let r = n.current;
|
|
11891
11941
|
if (!r) return !1;
|
|
11892
|
-
let i = t ?
|
|
11942
|
+
let i = t ? Ym(e, A, r.minDistance) : e;
|
|
11893
11943
|
return r.cancel(), r.setOrbitPoint(i.x, i.y, i.z), !0;
|
|
11894
11944
|
}, [A, n]), yt = h((e) => {
|
|
11895
11945
|
xe.current = e.clone(), vt(e, !0);
|
|
@@ -11901,18 +11951,18 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
11901
11951
|
a,
|
|
11902
11952
|
s
|
|
11903
11953
|
]), xt = h((e) => {
|
|
11904
|
-
if (!
|
|
11905
|
-
if (
|
|
11954
|
+
if (!Bm(A)) return null;
|
|
11955
|
+
if (zm(A) === e) return A;
|
|
11906
11956
|
let r = n.current, i = new U(), a = new U();
|
|
11907
11957
|
r ? (r.getTarget(i, !0), r.getPosition(a, !0)) : (A.getWorldDirection(i), a.copy(A.position), i.add(a));
|
|
11908
11958
|
let o = a.clone().sub(i);
|
|
11909
|
-
o.lengthSq() <
|
|
11910
|
-
let s =
|
|
11959
|
+
o.lengthSq() < lm * lm && A.getWorldDirection(o).multiplyScalar(-1), o.lengthSq() < lm * lm && o.copy(vm), o.normalize();
|
|
11960
|
+
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
11961
|
if (d.manual = !0, d instanceof je) {
|
|
11912
11962
|
let e = c / (2 * Math.tan(Se.degToRad(d.fov) * .5));
|
|
11913
11963
|
a.copy(i).addScaledVector(o, e);
|
|
11914
11964
|
}
|
|
11915
|
-
return d.position.copy(a), d.up.copy(A.up), d.layers.mask = A.layers.mask, d.lookAt(i), d.updateMatrixWorld(!0),
|
|
11965
|
+
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
11966
|
cameraUuid: d.uuid,
|
|
11917
11967
|
position: a.clone(),
|
|
11918
11968
|
target: i.clone(),
|
|
@@ -11928,10 +11978,10 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
11928
11978
|
ae.height,
|
|
11929
11979
|
ae.width
|
|
11930
11980
|
]), St = h(() => {
|
|
11931
|
-
let e =
|
|
11981
|
+
let e = zm(A) === "perspective" ? "orthographic" : "perspective";
|
|
11932
11982
|
return xt(e), e;
|
|
11933
11983
|
}, [A, xt]), Ct = h((e, t, { createClippingPlane: r = !0 } = {}) => {
|
|
11934
|
-
let i = xt("orthographic") ?? (
|
|
11984
|
+
let i = xt("orthographic") ?? (Bm(A) ? A : null);
|
|
11935
11985
|
if (!i) return null;
|
|
11936
11986
|
let a = e.clone().normalize(), o = !1;
|
|
11937
11987
|
Fe.current += 1, ut(!0), N.setHelpersActive(!1), r && N.createPlaneFromPointAndNormal(wl(a), a.normal.clone());
|
|
@@ -11966,10 +12016,10 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
11966
12016
|
ae
|
|
11967
12017
|
]);
|
|
11968
12018
|
_(() => {
|
|
11969
|
-
if (!u || ze.current || !s.current || !
|
|
12019
|
+
if (!u || ze.current || !s.current || !Bm(A)) return;
|
|
11970
12020
|
let e = u.clone().normalize();
|
|
11971
12021
|
ze.current = !0;
|
|
11972
|
-
let t = xt("orthographic") ?? (
|
|
12022
|
+
let t = xt("orthographic") ?? (Bm(A) ? A : null);
|
|
11973
12023
|
t && (ut(!0), N.setHelpersActive(!1), N.createPlaneFromPointAndNormal(wl(e), e.normal.clone()), requestAnimationFrame(() => {
|
|
11974
12024
|
Cl({
|
|
11975
12025
|
camera: t,
|
|
@@ -12001,14 +12051,14 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12001
12051
|
}, []), Tt = h((t) => {
|
|
12002
12052
|
if (!t) return !1;
|
|
12003
12053
|
let n = wt();
|
|
12004
|
-
if (!e || !r) return n || (B.current =
|
|
12054
|
+
if (!e || !r) return n || (B.current = wm()), !1;
|
|
12005
12055
|
let i = B.current;
|
|
12006
12056
|
if (n) {
|
|
12007
|
-
i.active || (B.current =
|
|
12057
|
+
i.active || (B.current = wm(!0));
|
|
12008
12058
|
let e = B.current;
|
|
12009
12059
|
return e.firstFitDone ? !1 : (e.firstFitDone = !0, !0);
|
|
12010
12060
|
}
|
|
12011
|
-
return i.active ? i.finalFitDone ? !1 : i.firstFitDone && i.userInteractedAfterFirstFit ? (B.current =
|
|
12061
|
+
return i.active ? i.finalFitDone ? !1 : i.firstFitDone && i.userInteractedAfterFirstFit ? (B.current = wm(), !1) : (i.finalFitDone = !0, !0) : !0;
|
|
12012
12062
|
}, [
|
|
12013
12063
|
e,
|
|
12014
12064
|
r,
|
|
@@ -12016,11 +12066,11 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12016
12066
|
]), Dt = h((e, t = !1) => {
|
|
12017
12067
|
let r = n.current;
|
|
12018
12068
|
if (!r) return;
|
|
12019
|
-
let i =
|
|
12069
|
+
let i = qm(e, M.buildIndex());
|
|
12020
12070
|
if (!i) return;
|
|
12021
12071
|
let a = i.getCenter(new U());
|
|
12022
12072
|
if (xe.current = a.clone(), r.cancel(), t) {
|
|
12023
|
-
let e =
|
|
12073
|
+
let e = Jm(i);
|
|
12024
12074
|
r.fitToBox(i, !0, {
|
|
12025
12075
|
paddingBottom: e,
|
|
12026
12076
|
paddingLeft: e,
|
|
@@ -12055,7 +12105,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12055
12105
|
let e = () => {
|
|
12056
12106
|
R.current !== null && (window.clearTimeout(R.current), R.current = null);
|
|
12057
12107
|
}, t = () => {
|
|
12058
|
-
Te.current && (
|
|
12108
|
+
Te.current && (Mm(Te.current), Te.current = null, j());
|
|
12059
12109
|
};
|
|
12060
12110
|
if (!te) {
|
|
12061
12111
|
e(), t(), N.setCapsCameraMotionActive(!1), N.setEdgesCameraMotionActive?.(!1), v("sleep");
|
|
@@ -12070,7 +12120,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12070
12120
|
return;
|
|
12071
12121
|
}
|
|
12072
12122
|
R.current = null, v("move"), N.setCapsCameraMotionActive(!0), N.setEdgesCameraMotionActive?.(!0);
|
|
12073
|
-
},
|
|
12123
|
+
}, im));
|
|
12074
12124
|
}, a = () => {
|
|
12075
12125
|
e(), t(), N.setCapsCameraMotionActive(!1), N.setEdgesCameraMotionActive?.(!1), v("sleep");
|
|
12076
12126
|
};
|
|
@@ -12090,11 +12140,11 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12090
12140
|
}, t = () => {
|
|
12091
12141
|
Ce.current !== null && (window.clearTimeout(Ce.current), Ce.current = null);
|
|
12092
12142
|
}, r = (n = !1) => {
|
|
12093
|
-
e(), Te.current && (
|
|
12143
|
+
e(), Te.current && (Mm(Te.current), Te.current = null, j()), n && (t(), we.current = null);
|
|
12094
12144
|
}, i = () => {
|
|
12095
12145
|
t(), Ce.current = window.setTimeout(() => {
|
|
12096
12146
|
Ce.current = null, we.current = null;
|
|
12097
|
-
},
|
|
12147
|
+
}, om);
|
|
12098
12148
|
};
|
|
12099
12149
|
if (!te) {
|
|
12100
12150
|
r(!0);
|
|
@@ -12104,13 +12154,13 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12104
12154
|
if (!a) return;
|
|
12105
12155
|
let o = () => {
|
|
12106
12156
|
if (z.current = null, Ie.current || Te.current) return;
|
|
12107
|
-
s.current?.updateMatrixWorld(!0), (!we.current || we.current.root !== s.current) && (we.current =
|
|
12157
|
+
s.current?.updateMatrixWorld(!0), (!we.current || we.current.root !== s.current) && (we.current = Am(s.current, Qe));
|
|
12108
12158
|
let e = we.current;
|
|
12109
12159
|
if (!e) return;
|
|
12110
|
-
let t =
|
|
12160
|
+
let t = jm(e);
|
|
12111
12161
|
t && (Te.current = t, j());
|
|
12112
12162
|
}, c = () => {
|
|
12113
|
-
Ie.current || (t(), !Te.current && z.current === null && (z.current = window.setTimeout(o,
|
|
12163
|
+
Ie.current || (t(), !Te.current && z.current === null && (z.current = window.setTimeout(o, am)));
|
|
12114
12164
|
}, l = () => {
|
|
12115
12165
|
r(), i();
|
|
12116
12166
|
};
|
|
@@ -12125,7 +12175,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12125
12175
|
Qe,
|
|
12126
12176
|
te
|
|
12127
12177
|
]), _(() => {
|
|
12128
|
-
l && !Le.current && (B.current =
|
|
12178
|
+
l && !Le.current && (B.current = wm(!0)), Le.current = l;
|
|
12129
12179
|
}, [l]), _(() => {
|
|
12130
12180
|
let e = n.current, t = ne.domElement, r = () => {
|
|
12131
12181
|
let e = B.current;
|
|
@@ -12140,7 +12190,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12140
12190
|
ne
|
|
12141
12191
|
]);
|
|
12142
12192
|
let kt = h(() => !wt(), [wt]);
|
|
12143
|
-
return
|
|
12193
|
+
return pp(s, n, de, yt, N.getSelectableObjects, fe, kt, We), _f(), _(() => {
|
|
12144
12194
|
let e = ne.domElement, t = (e) => {
|
|
12145
12195
|
let t = xe.current;
|
|
12146
12196
|
t && e.button === 0 && (e.ctrlKey || e.metaKey || e.shiftKey || vt(t, !0));
|
|
@@ -12161,11 +12211,11 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12161
12211
|
if (!e) {
|
|
12162
12212
|
let e = B.current;
|
|
12163
12213
|
if (e.active && e.firstFitDone && e.userInteractedAfterFirstFit) {
|
|
12164
|
-
B.current =
|
|
12214
|
+
B.current = wm();
|
|
12165
12215
|
return;
|
|
12166
12216
|
}
|
|
12167
12217
|
}
|
|
12168
|
-
bt(), e || (B.current =
|
|
12218
|
+
bt(), e || (B.current = wm());
|
|
12169
12219
|
}, c = () => {
|
|
12170
12220
|
if (e) {
|
|
12171
12221
|
if (!k) {
|
|
@@ -12186,7 +12236,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12186
12236
|
}
|
|
12187
12237
|
}, l = () => {
|
|
12188
12238
|
if (n !== null) return;
|
|
12189
|
-
let e =
|
|
12239
|
+
let e = hm, t = () => {
|
|
12190
12240
|
if (r) {
|
|
12191
12241
|
n = null;
|
|
12192
12242
|
return;
|
|
@@ -12204,7 +12254,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12204
12254
|
n = requestAnimationFrame(t);
|
|
12205
12255
|
}, u = (e) => {
|
|
12206
12256
|
if (r || !s.current) return;
|
|
12207
|
-
s.current.updateMatrixWorld(!0), (A instanceof je || A instanceof Ae) &&
|
|
12257
|
+
s.current.updateMatrixWorld(!0), (A instanceof je || A instanceof Ae) && Km(A, s.current), _t(), ye();
|
|
12208
12258
|
let n = ve();
|
|
12209
12259
|
if (!n.records.size && e > 0) {
|
|
12210
12260
|
t = requestAnimationFrame(() => u(e - 1));
|
|
@@ -12212,7 +12262,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12212
12262
|
}
|
|
12213
12263
|
L(), N.syncWithModel(), P.syncWithModel(), n.records.size > 0 && !wt() && l(), Me.current !== A.uuid && Tt(n.records.size > 0) && c();
|
|
12214
12264
|
};
|
|
12215
|
-
return a(() => u(k ?
|
|
12265
|
+
return a(() => u(k ? mm : pm)), () => {
|
|
12216
12266
|
r = !0, t !== null && cancelAnimationFrame(t), n !== null && cancelAnimationFrame(n);
|
|
12217
12267
|
};
|
|
12218
12268
|
}, [
|
|
@@ -12248,7 +12298,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12248
12298
|
camera: {
|
|
12249
12299
|
fitCamera: bt,
|
|
12250
12300
|
getIntersection: de.getIntersection,
|
|
12251
|
-
getProjection: () =>
|
|
12301
|
+
getProjection: () => zm(A),
|
|
12252
12302
|
setFirstPersonControlActive: it,
|
|
12253
12303
|
setFirstPersonControlSettings: at,
|
|
12254
12304
|
setProjection: xt,
|
|
@@ -12316,8 +12366,8 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12316
12366
|
geometryUtils: {
|
|
12317
12367
|
getAllIds: oe.getAllIds,
|
|
12318
12368
|
getIfcSpacesVisibility: oe.getIfcSpacesVisibility,
|
|
12319
|
-
getModelGeometry: (e) =>
|
|
12320
|
-
getModelsGeometry: () =>
|
|
12369
|
+
getModelGeometry: (e) => Rm(s.current, e),
|
|
12370
|
+
getModelsGeometry: () => Lm(s.current),
|
|
12321
12371
|
hideByIds: (e) => t(() => oe.hideByIds(e)),
|
|
12322
12372
|
hideSelected: () => t(oe.hideSelected),
|
|
12323
12373
|
isolateByIds: (e) => t(() => oe.isolateByIds(e)),
|
|
@@ -12379,7 +12429,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12379
12429
|
V && /* @__PURE__ */ W(ct, {}),
|
|
12380
12430
|
/* @__PURE__ */ W("group", {
|
|
12381
12431
|
ref: H,
|
|
12382
|
-
children: pt.map(([e, t]) => /* @__PURE__ */ W(
|
|
12432
|
+
children: pt.map(([e, t]) => /* @__PURE__ */ W(cd, {
|
|
12383
12433
|
colorPaletteTexture: se,
|
|
12384
12434
|
coordinationMatrix: ft,
|
|
12385
12435
|
data: t,
|
|
@@ -12392,7 +12442,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12392
12442
|
}, e))
|
|
12393
12443
|
}),
|
|
12394
12444
|
ge.layer,
|
|
12395
|
-
/* @__PURE__ */ W(
|
|
12445
|
+
/* @__PURE__ */ W(tm, {
|
|
12396
12446
|
active: Ke,
|
|
12397
12447
|
activeRef: Xe,
|
|
12398
12448
|
controlRef: n,
|
|
@@ -12400,10 +12450,10 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12400
12450
|
settings: Je
|
|
12401
12451
|
}),
|
|
12402
12452
|
!Ke && /* @__PURE__ */ W(ot, {
|
|
12403
|
-
camera:
|
|
12453
|
+
camera: Bm(A) ? A : void 0,
|
|
12404
12454
|
dollyToCursor: !0,
|
|
12405
12455
|
infinityDolly: A instanceof je,
|
|
12406
|
-
minDistance:
|
|
12456
|
+
minDistance: nm,
|
|
12407
12457
|
ref: tt,
|
|
12408
12458
|
draggingSmoothTime: .03,
|
|
12409
12459
|
smoothTime: .05
|
|
@@ -12412,8 +12462,8 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12412
12462
|
}
|
|
12413
12463
|
//#endregion
|
|
12414
12464
|
//#region src/viewer/Viewer.tsx
|
|
12415
|
-
var
|
|
12416
|
-
function
|
|
12465
|
+
var Zm = .75, Qm = .6;
|
|
12466
|
+
function $m(e, t, n) {
|
|
12417
12467
|
let r = e?.[t.modelID] ?? {
|
|
12418
12468
|
coordinationMatrix: t.coordinationMatrix ?? t.geometry.matrix ?? void 0,
|
|
12419
12469
|
data: {},
|
|
@@ -12438,11 +12488,11 @@ function qm(e, t, n) {
|
|
|
12438
12488
|
}
|
|
12439
12489
|
};
|
|
12440
12490
|
}
|
|
12441
|
-
function
|
|
12491
|
+
function eh(e) {
|
|
12442
12492
|
let t = {};
|
|
12443
12493
|
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
12494
|
}
|
|
12445
|
-
function
|
|
12495
|
+
function th(e, t, n) {
|
|
12446
12496
|
let r = { ...e ?? {} };
|
|
12447
12497
|
return Object.entries(t).forEach(([t, i]) => {
|
|
12448
12498
|
let a = Number(t);
|
|
@@ -12455,22 +12505,22 @@ function Ym(e, t, n) {
|
|
|
12455
12505
|
});
|
|
12456
12506
|
}), r;
|
|
12457
12507
|
}
|
|
12458
|
-
function
|
|
12508
|
+
function nh(e, t) {
|
|
12459
12509
|
if (!e || !Object.prototype.hasOwnProperty.call(e, t)) return e;
|
|
12460
12510
|
let n = { ...e };
|
|
12461
12511
|
return delete n[t], Object.keys(n).length ? n : void 0;
|
|
12462
12512
|
}
|
|
12463
|
-
function
|
|
12513
|
+
function rh(e, t) {
|
|
12464
12514
|
return Array.isArray(e) ? [Math.min(e[0], t), Math.min(e[1], t)] : typeof e == "number" ? Math.min(e, t) : t;
|
|
12465
12515
|
}
|
|
12466
|
-
function
|
|
12516
|
+
function ih(e) {
|
|
12467
12517
|
return Array.isArray(e) ? [Math.max(e[0], 2), Math.max(e[1], 2)] : typeof e == "number" ? Math.max(e, 2) : 2;
|
|
12468
12518
|
}
|
|
12469
|
-
function
|
|
12519
|
+
function ah() {
|
|
12470
12520
|
let e = navigator, t = navigator.userAgent.toLowerCase(), n = navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1, r = window.matchMedia?.("(pointer: coarse)").matches ?? !1;
|
|
12471
12521
|
return e.userAgentData?.mobile || n || /android|iphone|ipad|ipod|mobile|tablet/.test(t) || navigator.maxTouchPoints > 1 && r ? "mobile" : "pc";
|
|
12472
12522
|
}
|
|
12473
|
-
function
|
|
12523
|
+
function oh({ autoFitCamera: e = !0, camera: t = {
|
|
12474
12524
|
position: [
|
|
12475
12525
|
10,
|
|
12476
12526
|
10,
|
|
@@ -12481,7 +12531,7 @@ function eh({ autoFitCamera: e = !0, camera: t = {
|
|
|
12481
12531
|
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
12532
|
lastProgress: 0,
|
|
12483
12533
|
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 ?
|
|
12534
|
+
}), 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
12535
|
F.current.forEach((e) => {
|
|
12486
12536
|
e();
|
|
12487
12537
|
});
|
|
@@ -12611,9 +12661,9 @@ function eh({ autoFitCamera: e = !0, camera: t = {
|
|
|
12611
12661
|
return t?.(r), r;
|
|
12612
12662
|
});
|
|
12613
12663
|
}, []), Ze = h((e, t, n) => {
|
|
12614
|
-
V((t) =>
|
|
12664
|
+
V((t) => $m(t, e, n), t);
|
|
12615
12665
|
}, [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 =
|
|
12666
|
+
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
12667
|
f || fe.current !== u || (f = !0, j(!1));
|
|
12618
12668
|
}, h = () => {
|
|
12619
12669
|
p || fe.current !== u || (p = !0, a?.(!1));
|
|
@@ -12644,7 +12694,7 @@ function eh({ autoFitCamera: e = !0, camera: t = {
|
|
|
12644
12694
|
});
|
|
12645
12695
|
if (fe.current !== u) return r;
|
|
12646
12696
|
let a = Object.fromEntries(Object.entries(r).filter(([e]) => !N.current.has(Number(e))));
|
|
12647
|
-
return V((e) => t ?
|
|
12697
|
+
return V((e) => t ? th(e, a, N.current) : {
|
|
12648
12698
|
...e ?? {},
|
|
12649
12699
|
...a
|
|
12650
12700
|
}, s), m(), Object.keys(a).length > 0 && await Je(u), h(), r;
|
|
@@ -12662,7 +12712,7 @@ function eh({ autoFitCamera: e = !0, camera: t = {
|
|
|
12662
12712
|
]), $e = h((e) => {
|
|
12663
12713
|
if (!Number.isFinite(e)) return;
|
|
12664
12714
|
N.current.add(e);
|
|
12665
|
-
let t = oe.current, n =
|
|
12715
|
+
let t = oe.current, n = nh(t, e);
|
|
12666
12716
|
n !== t && (oe.current = n, A(n), de.current?.(n)), L.getState().removeModelState(e);
|
|
12667
12717
|
}, [L]), H = b(() => ({
|
|
12668
12718
|
getData: () => oe.current,
|
|
@@ -12677,7 +12727,7 @@ function eh({ autoFitCamera: e = !0, camera: t = {
|
|
|
12677
12727
|
$e
|
|
12678
12728
|
]);
|
|
12679
12729
|
return _(() => (p(H), () => p(null)), [H, p]), _(() => {
|
|
12680
|
-
Ce(
|
|
12730
|
+
Ce(ah());
|
|
12681
12731
|
}, [Ce]), _(() => {
|
|
12682
12732
|
z(!!y);
|
|
12683
12733
|
}, [z, y]), _(() => {
|
|
@@ -12727,7 +12777,7 @@ function eh({ autoFitCamera: e = !0, camera: t = {
|
|
|
12727
12777
|
onReady: Ge
|
|
12728
12778
|
}),
|
|
12729
12779
|
/* @__PURE__ */ W(Io, { active: T }),
|
|
12730
|
-
/* @__PURE__ */ W(
|
|
12780
|
+
/* @__PURE__ */ W(Xm, {
|
|
12731
12781
|
autoFitCamera: e,
|
|
12732
12782
|
cameraRef: E,
|
|
12733
12783
|
controlRef: D,
|
|
@@ -12775,7 +12825,7 @@ function eh({ autoFitCamera: e = !0, camera: t = {
|
|
|
12775
12825
|
})]
|
|
12776
12826
|
}) : /* @__PURE__ */ W(nt, {});
|
|
12777
12827
|
}
|
|
12778
|
-
var
|
|
12828
|
+
var sh = p(function(e, t) {
|
|
12779
12829
|
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
12830
|
a.set(e);
|
|
12781
12831
|
}, [a]), d = b(() => new qo(), []), f = h((e) => {
|
|
@@ -12804,7 +12854,7 @@ var th = p(function(e, t) {
|
|
|
12804
12854
|
});
|
|
12805
12855
|
}, [c, n]), /* @__PURE__ */ W(Tt, {
|
|
12806
12856
|
store: n,
|
|
12807
|
-
children: /* @__PURE__ */ W(
|
|
12857
|
+
children: /* @__PURE__ */ W(oh, {
|
|
12808
12858
|
...e,
|
|
12809
12859
|
publicApi: m,
|
|
12810
12860
|
setModelsApi: f,
|
|
@@ -12813,6 +12863,6 @@ var th = p(function(e, t) {
|
|
|
12813
12863
|
})
|
|
12814
12864
|
});
|
|
12815
12865
|
});
|
|
12816
|
-
|
|
12866
|
+
sh.displayName = "Viewer";
|
|
12817
12867
|
//#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,
|
|
12868
|
+
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 };
|