bimatter-viewer-react 0.11.7 → 0.11.8
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/Loaders/BmtLoader.d.ts +6 -0
- package/lib/assets/BMTWorker-B6cln5F6.js +1 -0
- package/lib/assets/IFCWorker-F0BNIuiz.js +6 -0
- package/lib/index.js +512 -462
- package/lib/utils/GeometryUtils/progressiveDrawRange.d.ts +3 -0
- package/lib/workers/WorkerMeshBvh.d.ts +3 -0
- package/package.json +1 -1
- package/lib/assets/BMTWorker-4FHDYd-p.js +0 -1
- package/lib/assets/IFCWorker-CfepOBoh.js +0 -6
package/lib/index.js
CHANGED
|
@@ -2038,7 +2038,7 @@ var Or = class {
|
|
|
2038
2038
|
//#endregion
|
|
2039
2039
|
//#region src/viewer/workers/BMTWorker.ts?worker
|
|
2040
2040
|
function Ar(e) {
|
|
2041
|
-
return new Worker("" + new URL("assets/BMTWorker-
|
|
2041
|
+
return new Worker("" + new URL("assets/BMTWorker-B6cln5F6.js", import.meta.url).href, { name: e?.name });
|
|
2042
2042
|
}
|
|
2043
2043
|
//#endregion
|
|
2044
2044
|
//#region src/viewer/workers/BMTWorkerClient.ts
|
|
@@ -2241,7 +2241,7 @@ function ti() {
|
|
|
2241
2241
|
//#endregion
|
|
2242
2242
|
//#region src/viewer/workers/IFCWorker.ts?worker
|
|
2243
2243
|
function ni(e) {
|
|
2244
|
-
return new Worker("" + new URL("assets/IFCWorker-
|
|
2244
|
+
return new Worker("" + new URL("assets/IFCWorker-F0BNIuiz.js", import.meta.url).href, { name: e?.name });
|
|
2245
2245
|
}
|
|
2246
2246
|
//#endregion
|
|
2247
2247
|
//#region src/viewer/workers/IFCWorkerClient.ts
|
|
@@ -9405,20 +9405,52 @@ function Ru(e) {
|
|
|
9405
9405
|
};
|
|
9406
9406
|
}
|
|
9407
9407
|
//#endregion
|
|
9408
|
+
//#region src/viewer/utils/GeometryUtils/progressiveDrawRange.ts
|
|
9409
|
+
var zu = 10;
|
|
9410
|
+
function Bu(e) {
|
|
9411
|
+
return e.index?.count ?? e.getAttribute("position")?.count ?? 0;
|
|
9412
|
+
}
|
|
9413
|
+
function Vu(e, t) {
|
|
9414
|
+
if (e <= 3) return e;
|
|
9415
|
+
let n = Math.min(1, Math.max(0, t / zu)), r = Math.ceil(e * n), i = Math.ceil(r / 3) * 3;
|
|
9416
|
+
return Math.min(e, Math.max(3, i));
|
|
9417
|
+
}
|
|
9418
|
+
function Hu(e) {
|
|
9419
|
+
let t = Bu(e);
|
|
9420
|
+
t && e.setDrawRange(0, Vu(t, 1));
|
|
9421
|
+
}
|
|
9422
|
+
function Uu(e, t) {
|
|
9423
|
+
let n = Bu(e);
|
|
9424
|
+
if (!n) return t?.(), () => {};
|
|
9425
|
+
if (Hu(e), typeof requestAnimationFrame != "function") return e.setDrawRange(0, n), t?.(), () => {};
|
|
9426
|
+
let r = null, i = 1, a = !1, o = () => {
|
|
9427
|
+
if (!a) {
|
|
9428
|
+
if (i += 1, e.setDrawRange(0, Vu(n, i)), i >= zu) {
|
|
9429
|
+
e.setDrawRange(0, n), t?.();
|
|
9430
|
+
return;
|
|
9431
|
+
}
|
|
9432
|
+
r = requestAnimationFrame(o);
|
|
9433
|
+
}
|
|
9434
|
+
};
|
|
9435
|
+
return r = requestAnimationFrame(o), () => {
|
|
9436
|
+
a = !0, r !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(r);
|
|
9437
|
+
};
|
|
9438
|
+
}
|
|
9439
|
+
//#endregion
|
|
9408
9440
|
//#region src/viewer/SelectableMesh.tsx
|
|
9409
9441
|
B.prototype.raycast = pt;
|
|
9410
|
-
var
|
|
9411
|
-
function
|
|
9442
|
+
var Wu = 1 / 1.5;
|
|
9443
|
+
function Gu(e, t) {
|
|
9412
9444
|
let n = e.userData, r = n.shaders ?? /* @__PURE__ */ new Set();
|
|
9413
9445
|
r.add(t), n.shader = t, n.shaders = r;
|
|
9414
9446
|
}
|
|
9415
|
-
function
|
|
9447
|
+
function Ku(e) {
|
|
9416
9448
|
let t = e.userData;
|
|
9417
9449
|
return t.shaders ? Array.from(t.shaders) : t.shader ? [t.shader] : [];
|
|
9418
9450
|
}
|
|
9419
|
-
function
|
|
9451
|
+
function qu({ colorPaletteTexture: e, material: t, materialMode: n = "quality", preselectionColor: r, useDoubleSideMaterial: i = !1 }) {
|
|
9420
9452
|
let a = new M(t.r, t.g, t.b);
|
|
9421
|
-
n === "performance" && a.multiplyScalar(
|
|
9453
|
+
n === "performance" && a.multiplyScalar(Wu);
|
|
9422
9454
|
let o = {
|
|
9423
9455
|
color: a.clone(),
|
|
9424
9456
|
transparent: !!(t.opacity && t.opacity != 1),
|
|
@@ -9447,19 +9479,19 @@ function Hu({ colorPaletteTexture: e, material: t, materialMode: n = "quality",
|
|
|
9447
9479
|
else{
|
|
9448
9480
|
diffuseColor = vec4(baseColor, opacity);
|
|
9449
9481
|
}
|
|
9450
|
-
`),
|
|
9482
|
+
`), Gu(c, t);
|
|
9451
9483
|
}, c;
|
|
9452
9484
|
}
|
|
9453
|
-
function
|
|
9454
|
-
|
|
9485
|
+
function Ju(e, t) {
|
|
9486
|
+
Ku(e).forEach((e) => {
|
|
9455
9487
|
let n = e.uniforms.preSelectionColor;
|
|
9456
9488
|
n && (n.value instanceof M ? n.value.set(t) : n.value = new M(t));
|
|
9457
9489
|
});
|
|
9458
9490
|
}
|
|
9459
|
-
var
|
|
9491
|
+
var Yu = u.memo(function({ colorPaletteTexture: e, material: t, materialMode: n = "quality", data: r, isIfcSpace: i = !1, meshMatrix: a, onReady: o, readyKey: s, useDoubleSideMaterial: c = !1 }) {
|
|
9460
9492
|
let l = x(null), u = x(o), d = K((e) => e.preselectionColor), f = x(d);
|
|
9461
9493
|
u.current = o, f.current = d;
|
|
9462
|
-
let p = b(() =>
|
|
9494
|
+
let p = b(() => qu({
|
|
9463
9495
|
colorPaletteTexture: e,
|
|
9464
9496
|
material: t,
|
|
9465
9497
|
materialMode: n,
|
|
@@ -9472,14 +9504,24 @@ var Wu = u.memo(function({ colorPaletteTexture: e, material: t, materialMode: n
|
|
|
9472
9504
|
c
|
|
9473
9505
|
]);
|
|
9474
9506
|
return _(() => {
|
|
9475
|
-
|
|
9476
|
-
}, [p, d]),
|
|
9507
|
+
Ju(p, d);
|
|
9508
|
+
}, [p, d]), y(() => {
|
|
9509
|
+
!r.boundsTree || !l.current || Hu(l.current.geometry);
|
|
9510
|
+
}, [r.boundsTree]), _(() => {
|
|
9477
9511
|
if (!l.current) return;
|
|
9478
|
-
let e = l.current.geometry, t = new dt(e, { indirect: !0 });
|
|
9479
|
-
|
|
9480
|
-
|
|
9512
|
+
let e = l.current.geometry, t = r.boundsTree ? dt.deserialize(r.boundsTree, e, { setIndex: !1 }) : new dt(e, { indirect: !0 });
|
|
9513
|
+
Object.assign(e, { boundsTree: t });
|
|
9514
|
+
let n = () => {
|
|
9515
|
+
s !== void 0 && u.current?.(s);
|
|
9516
|
+
}, i = r.boundsTree ? Uu(e, n) : void 0;
|
|
9517
|
+
return r.boundsTree || (e.setDrawRange(0, Infinity), n()), () => {
|
|
9518
|
+
i?.(), p.dispose(), Object.assign(e, { boundsTree: null });
|
|
9481
9519
|
};
|
|
9482
|
-
}, [
|
|
9520
|
+
}, [
|
|
9521
|
+
r.boundsTree,
|
|
9522
|
+
p,
|
|
9523
|
+
s
|
|
9524
|
+
]), /* @__PURE__ */ nt("mesh", {
|
|
9483
9525
|
frustumCulled: !0,
|
|
9484
9526
|
matrix: a,
|
|
9485
9527
|
matrixAutoUpdate: !1,
|
|
@@ -9509,10 +9551,10 @@ var Wu = u.memo(function({ colorPaletteTexture: e, material: t, materialMode: n
|
|
|
9509
9551
|
})
|
|
9510
9552
|
] }), /* @__PURE__ */ G("primitive", { object: p })]
|
|
9511
9553
|
});
|
|
9512
|
-
}),
|
|
9513
|
-
function
|
|
9554
|
+
}), Xu = 1 / 1.5;
|
|
9555
|
+
function Zu({ colorPaletteTexture: e, material: t, materialMode: u, preselectionColor: d, selectionColor: f, useDoubleSideMaterial: p }) {
|
|
9514
9556
|
let m = new M(t.r, t.g, t.b);
|
|
9515
|
-
u === "performance" && m.multiplyScalar(
|
|
9557
|
+
u === "performance" && m.multiplyScalar(Xu);
|
|
9516
9558
|
let h = t.opacity ?? 1, g = {
|
|
9517
9559
|
color: m.clone(),
|
|
9518
9560
|
opacity: h,
|
|
@@ -9534,7 +9576,7 @@ function Ku({ colorPaletteTexture: e, material: t, materialMode: u, preselection
|
|
|
9534
9576
|
selectionColor: C
|
|
9535
9577
|
} }, v.userData.shaders = new Set([v.userData.shader]), v;
|
|
9536
9578
|
}
|
|
9537
|
-
function
|
|
9579
|
+
function Qu(e, { preselectionColor: t, selectionColor: n }) {
|
|
9538
9580
|
let r = e.userData, i = r.shaders ? Array.from(r.shaders) : r.shader ? [r.shader] : [], a = (e, t) => {
|
|
9539
9581
|
i.forEach((n) => {
|
|
9540
9582
|
let r = n.uniforms?.[e];
|
|
@@ -9543,12 +9585,12 @@ function qu(e, { preselectionColor: t, selectionColor: n }) {
|
|
|
9543
9585
|
};
|
|
9544
9586
|
a("preSelectionColor", t), a("selectionColor", n);
|
|
9545
9587
|
}
|
|
9546
|
-
var
|
|
9588
|
+
var $u = u.memo(function({ colorPaletteTexture: e, material: t, materialMode: n = "quality", data: r, isIfcSpace: i = !1, meshMatrix: a, onReady: o, readyKey: s, useDoubleSideMaterial: c = !1 }) {
|
|
9547
9589
|
let l = x(null), u = x(o), d = b(() => new Uint32Array(r.ids.length), [r.ids]);
|
|
9548
9590
|
u.current = o;
|
|
9549
9591
|
let f = b(() => {
|
|
9550
9592
|
let e = new re();
|
|
9551
|
-
return e.setAttribute("position", new j(r.pos, 3)), r.norm && e.setAttribute("normal", new j(r.norm, 3)), e.setAttribute("ids", new j(r.ids, 1)), e.setAttribute("colorIndex", new j(d, 1)), e.setIndex(new j(r.ind, 1)), n !== "performance" && !e.attributes.normal && e.computeVertexNormals(), e;
|
|
9593
|
+
return e.setAttribute("position", new j(r.pos, 3)), r.norm && e.setAttribute("normal", new j(r.norm, 3)), e.setAttribute("ids", new j(r.ids, 1)), e.setAttribute("colorIndex", new j(d, 1)), e.setIndex(new j(r.ind, 1)), n !== "performance" && !e.attributes.normal && e.computeVertexNormals(), r.boundsTree && Hu(e), e;
|
|
9552
9594
|
}, [
|
|
9553
9595
|
d,
|
|
9554
9596
|
r,
|
|
@@ -9557,7 +9599,7 @@ var Ju = u.memo(function({ colorPaletteTexture: e, material: t, materialMode: n
|
|
|
9557
9599
|
h.current = p;
|
|
9558
9600
|
let g = x(m);
|
|
9559
9601
|
g.current = m;
|
|
9560
|
-
let v = b(() =>
|
|
9602
|
+
let v = b(() => Zu({
|
|
9561
9603
|
colorPaletteTexture: e,
|
|
9562
9604
|
material: t,
|
|
9563
9605
|
materialMode: n,
|
|
@@ -9571,7 +9613,7 @@ var Ju = u.memo(function({ colorPaletteTexture: e, material: t, materialMode: n
|
|
|
9571
9613
|
c
|
|
9572
9614
|
]);
|
|
9573
9615
|
return _(() => {
|
|
9574
|
-
|
|
9616
|
+
Qu(v, {
|
|
9575
9617
|
preselectionColor: p,
|
|
9576
9618
|
selectionColor: m
|
|
9577
9619
|
});
|
|
@@ -9580,11 +9622,19 @@ var Ju = u.memo(function({ colorPaletteTexture: e, material: t, materialMode: n
|
|
|
9580
9622
|
p,
|
|
9581
9623
|
m
|
|
9582
9624
|
]), _(() => {
|
|
9583
|
-
let e = new dt(f, { indirect: !0 });
|
|
9584
|
-
|
|
9585
|
-
|
|
9625
|
+
let e = r.boundsTree ? dt.deserialize(r.boundsTree, f, { setIndex: !1 }) : new dt(f, { indirect: !0 });
|
|
9626
|
+
Object.assign(f, { boundsTree: e });
|
|
9627
|
+
let t = () => {
|
|
9628
|
+
s !== void 0 && u.current?.(s);
|
|
9629
|
+
}, n = r.boundsTree ? Uu(f, t) : void 0;
|
|
9630
|
+
return r.boundsTree || (f.setDrawRange(0, Infinity), t()), () => {
|
|
9631
|
+
n?.(), Object.assign(f, { boundsTree: null }), f.dispose();
|
|
9586
9632
|
};
|
|
9587
|
-
}, [
|
|
9633
|
+
}, [
|
|
9634
|
+
r.boundsTree,
|
|
9635
|
+
f,
|
|
9636
|
+
s
|
|
9637
|
+
]), _(() => () => v.dispose(), [v]), /* @__PURE__ */ nt("mesh", {
|
|
9588
9638
|
frustumCulled: !0,
|
|
9589
9639
|
matrix: a,
|
|
9590
9640
|
matrixAutoUpdate: !1,
|
|
@@ -9604,8 +9654,8 @@ var Ju = u.memo(function({ colorPaletteTexture: e, material: t, materialMode: n
|
|
|
9604
9654
|
object: f
|
|
9605
9655
|
}), /* @__PURE__ */ G("primitive", { object: v })]
|
|
9606
9656
|
});
|
|
9607
|
-
}),
|
|
9608
|
-
function
|
|
9657
|
+
}), ed = new z(), td = /* @__PURE__ */ new WeakMap(), nd = /* @__PURE__ */ new WeakMap();
|
|
9658
|
+
function rd(e) {
|
|
9609
9659
|
if (!e) return null;
|
|
9610
9660
|
try {
|
|
9611
9661
|
let t = JSON.parse(e);
|
|
@@ -9614,34 +9664,34 @@ function Qu(e) {
|
|
|
9614
9664
|
return console.warn("Model matrix parsing error", e), null;
|
|
9615
9665
|
}
|
|
9616
9666
|
}
|
|
9617
|
-
function
|
|
9618
|
-
return
|
|
9667
|
+
function id(e) {
|
|
9668
|
+
return rd(ad(e));
|
|
9619
9669
|
}
|
|
9620
|
-
function
|
|
9670
|
+
function ad(e) {
|
|
9621
9671
|
if (e.coordinationMatrix) return e.coordinationMatrix;
|
|
9622
9672
|
for (let t in e.data) {
|
|
9623
9673
|
let n = e.data[Number(t)]?.matrix;
|
|
9624
9674
|
if (n) return n;
|
|
9625
9675
|
}
|
|
9626
9676
|
}
|
|
9627
|
-
function
|
|
9628
|
-
let n = e.matrix ?? t ?? "", r =
|
|
9677
|
+
function od(e, t) {
|
|
9678
|
+
let n = e.matrix ?? t ?? "", r = td.get(e);
|
|
9629
9679
|
if (r && r.sourceMatrixKey === n) return r;
|
|
9630
|
-
let i = (
|
|
9680
|
+
let i = (rd(n) ?? new z()).clone().invert(), a = e.pos, o = new W(), s = Infinity;
|
|
9631
9681
|
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));
|
|
9632
9682
|
let c = {
|
|
9633
9683
|
floorY: s,
|
|
9634
9684
|
meshMatrix: i,
|
|
9635
9685
|
sourceMatrixKey: n
|
|
9636
9686
|
};
|
|
9637
|
-
return
|
|
9687
|
+
return td.set(e, c), c;
|
|
9638
9688
|
}
|
|
9639
|
-
function
|
|
9689
|
+
function sd(e, t) {
|
|
9640
9690
|
let n = e[t];
|
|
9641
9691
|
return n === void 0 ? 0 : Number.isFinite(n) ? n : null;
|
|
9642
9692
|
}
|
|
9643
|
-
function
|
|
9644
|
-
let r =
|
|
9693
|
+
function cd(e, t, n) {
|
|
9694
|
+
let r = sd(e, "x"), i = sd(e, "y"), a = sd(e, "z"), o = sd(t, "x"), s = sd(t, "y"), c = sd(t, "z");
|
|
9645
9695
|
if (r === null || i === null || a === null || o === null || s === null || c === null) return null;
|
|
9646
9696
|
let l = new W(r + o, i + s, a + c).applyMatrix4(n);
|
|
9647
9697
|
return {
|
|
@@ -9650,14 +9700,14 @@ function rd(e, t, n) {
|
|
|
9650
9700
|
z: l.z
|
|
9651
9701
|
};
|
|
9652
9702
|
}
|
|
9653
|
-
function
|
|
9703
|
+
function ld(e, t, n) {
|
|
9654
9704
|
let r = {};
|
|
9655
9705
|
return Object.entries(e).forEach(([e, i]) => {
|
|
9656
|
-
let a = i.map((e) =>
|
|
9706
|
+
let a = i.map((e) => cd(e, t, n)).filter((e) => e !== null);
|
|
9657
9707
|
a.length >= 2 && (r[e] = a);
|
|
9658
9708
|
}), r;
|
|
9659
9709
|
}
|
|
9660
|
-
function
|
|
9710
|
+
function ud(e, t) {
|
|
9661
9711
|
return {
|
|
9662
9712
|
loc: {
|
|
9663
9713
|
x: 0,
|
|
@@ -9665,26 +9715,26 @@ function ad(e, t) {
|
|
|
9665
9715
|
z: 0
|
|
9666
9716
|
},
|
|
9667
9717
|
points: {
|
|
9668
|
-
u:
|
|
9669
|
-
v:
|
|
9718
|
+
u: ld(e.points.u, e.loc, t),
|
|
9719
|
+
v: ld(e.points.v, e.loc, t)
|
|
9670
9720
|
}
|
|
9671
9721
|
};
|
|
9672
9722
|
}
|
|
9673
|
-
function
|
|
9723
|
+
function dd(e, t) {
|
|
9674
9724
|
if (!e || !t) return e;
|
|
9675
|
-
let n =
|
|
9725
|
+
let n = nd.get(e);
|
|
9676
9726
|
if (n && n.sourceMatrixKey === t) return n.grids;
|
|
9677
|
-
let r =
|
|
9727
|
+
let r = rd(t);
|
|
9678
9728
|
if (!r) return e;
|
|
9679
9729
|
let i = r.clone().invert(), a = {};
|
|
9680
9730
|
return Object.entries(e).forEach(([e, t]) => {
|
|
9681
|
-
a[e] =
|
|
9682
|
-
}),
|
|
9731
|
+
a[e] = ud(t, i);
|
|
9732
|
+
}), nd.set(e, {
|
|
9683
9733
|
grids: a,
|
|
9684
9734
|
sourceMatrixKey: t
|
|
9685
9735
|
}), a;
|
|
9686
9736
|
}
|
|
9687
|
-
function
|
|
9737
|
+
function fd({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r, loadGeneration: i, materialMode: a, onUploadComplete: o, onUploadProgress: s, useWebGPU: c = !1 }) {
|
|
9688
9738
|
let l = K((e) => e.gridAxesVisibility), u = b(() => {
|
|
9689
9739
|
if (!r) return {
|
|
9690
9740
|
data: [],
|
|
@@ -9697,11 +9747,11 @@ function sd({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
|
|
|
9697
9747
|
e = !0;
|
|
9698
9748
|
break;
|
|
9699
9749
|
}
|
|
9700
|
-
let i = r.coordinationMatrix ??
|
|
9750
|
+
let i = r.coordinationMatrix ?? ad(r), a = id(r), o = e || a ? t?.clone() ?? a : null, s = Infinity, c = [];
|
|
9701
9751
|
for (let e in r.data) {
|
|
9702
9752
|
let t = r.data[Number(e)];
|
|
9703
9753
|
if (!t) continue;
|
|
9704
|
-
let a =
|
|
9754
|
+
let a = od(t, i), o = t.mat;
|
|
9705
9755
|
s = Math.min(s, a.floorY), c.push({
|
|
9706
9756
|
data: t,
|
|
9707
9757
|
isIfcSpace: !!t.isIfcSpace,
|
|
@@ -9715,7 +9765,7 @@ function sd({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
|
|
|
9715
9765
|
data: c,
|
|
9716
9766
|
coordinationMatrix: o,
|
|
9717
9767
|
floorY: Number.isFinite(s) ? s : 0,
|
|
9718
|
-
grids:
|
|
9768
|
+
grids: dd(r.grids, i)
|
|
9719
9769
|
};
|
|
9720
9770
|
}, [
|
|
9721
9771
|
t,
|
|
@@ -9737,7 +9787,7 @@ function sd({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
|
|
|
9737
9787
|
p.current?.(r, i), r >= i && f.current?.(r);
|
|
9738
9788
|
}, []);
|
|
9739
9789
|
if (!r) return /* @__PURE__ */ G(tt, {});
|
|
9740
|
-
let v = a ?? r.renderSettings?.materialMode ?? "quality", y = r.renderSettings?.useDoubleSideMaterial === !0, S = c ?
|
|
9790
|
+
let v = a ?? r.renderSettings?.materialMode ?? "quality", y = r.renderSettings?.useDoubleSideMaterial === !0, S = c ? $u : Yu, C = u.coordinationMatrix ?? ed, w = typeof r.trueNorthAngle == "number" && Number.isFinite(r.trueNorthAngle) ? r.trueNorthAngle : 0;
|
|
9741
9791
|
return /* @__PURE__ */ nt("group", {
|
|
9742
9792
|
matrix: C,
|
|
9743
9793
|
matrixAutoUpdate: !1,
|
|
@@ -9773,10 +9823,10 @@ function sd({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
|
|
|
9773
9823
|
})]
|
|
9774
9824
|
});
|
|
9775
9825
|
}
|
|
9776
|
-
var
|
|
9826
|
+
var pd = m(fd);
|
|
9777
9827
|
//#endregion
|
|
9778
9828
|
//#region src/viewer/utils/GeometryUtils/useGeometryIndex.ts
|
|
9779
|
-
function
|
|
9829
|
+
function md() {
|
|
9780
9830
|
return {
|
|
9781
9831
|
elementBounds: /* @__PURE__ */ new Map(),
|
|
9782
9832
|
elementIndex: /* @__PURE__ */ new Map(),
|
|
@@ -9788,16 +9838,16 @@ function ld() {
|
|
|
9788
9838
|
version: ""
|
|
9789
9839
|
};
|
|
9790
9840
|
}
|
|
9791
|
-
function
|
|
9841
|
+
function hd(e, t, n, r) {
|
|
9792
9842
|
let i = e.get(t);
|
|
9793
9843
|
i || (i = /* @__PURE__ */ new Map(), e.set(t, i));
|
|
9794
9844
|
let a = i.get(n);
|
|
9795
9845
|
a || (a = new A(), i.set(n, a)), a.expandByPoint(r);
|
|
9796
9846
|
}
|
|
9797
|
-
function
|
|
9847
|
+
function gd(e) {
|
|
9798
9848
|
return e instanceof Uint16Array || e instanceof Uint32Array ? e : e.length > 65535 ? new Uint32Array(e) : new Uint16Array(e);
|
|
9799
9849
|
}
|
|
9800
|
-
function
|
|
9850
|
+
function _d(e, t, n, r) {
|
|
9801
9851
|
let i = n.get(e);
|
|
9802
9852
|
if (i) return i;
|
|
9803
9853
|
i = {
|
|
@@ -9807,20 +9857,20 @@ function fd(e, t, n, r) {
|
|
|
9807
9857
|
let a = r.get(e);
|
|
9808
9858
|
return a || (a = [], r.set(e, a)), a.push(i), i;
|
|
9809
9859
|
}
|
|
9810
|
-
function
|
|
9811
|
-
n &&
|
|
9860
|
+
function vd(e, t, n, r, i, a) {
|
|
9861
|
+
n && _d(e, r, i, a).vertexRanges.push({
|
|
9812
9862
|
count: n,
|
|
9813
9863
|
start: t
|
|
9814
9864
|
});
|
|
9815
9865
|
}
|
|
9816
|
-
function
|
|
9817
|
-
n && (
|
|
9866
|
+
function yd(e, t, n, r, i, a) {
|
|
9867
|
+
n && (_d(e, r, i, a), r.triangleRanges.push({
|
|
9818
9868
|
count: n,
|
|
9819
9869
|
id: e,
|
|
9820
9870
|
start: t
|
|
9821
9871
|
}));
|
|
9822
9872
|
}
|
|
9823
|
-
function
|
|
9873
|
+
function bd(e) {
|
|
9824
9874
|
let t = e;
|
|
9825
9875
|
for (; t;) {
|
|
9826
9876
|
let e = t.userData.modelID;
|
|
@@ -9829,16 +9879,16 @@ function hd(e) {
|
|
|
9829
9879
|
}
|
|
9830
9880
|
return 0;
|
|
9831
9881
|
}
|
|
9832
|
-
function
|
|
9882
|
+
function xd(e) {
|
|
9833
9883
|
return e.name === "space" || e.userData.isIfcSpace === !0;
|
|
9834
9884
|
}
|
|
9835
|
-
function
|
|
9885
|
+
function Sd(e) {
|
|
9836
9886
|
let t = e.userData.removedElementIds;
|
|
9837
9887
|
if (t instanceof Set) return t;
|
|
9838
9888
|
let n = /* @__PURE__ */ new Set();
|
|
9839
9889
|
return e.userData.removedElementIds = n, n;
|
|
9840
9890
|
}
|
|
9841
|
-
function
|
|
9891
|
+
function Cd(e) {
|
|
9842
9892
|
if (!e) return "";
|
|
9843
9893
|
let t = [];
|
|
9844
9894
|
return e.traverse((e) => {
|
|
@@ -9846,22 +9896,22 @@ function vd(e) {
|
|
|
9846
9896
|
typeof n == "number" && typeof r == "number" && t.push("model-transform", String(n), String(r));
|
|
9847
9897
|
}), e.traverse((e) => {
|
|
9848
9898
|
if (!(e instanceof B)) return;
|
|
9849
|
-
let n = e.geometry, r =
|
|
9899
|
+
let n = e.geometry, r = Sd(e);
|
|
9850
9900
|
t.push(e.uuid, n.uuid, String(n.attributes.ids?.count ?? 0), String(n.attributes.position?.count ?? 0)), r.size && t.push("removed", Array.from(r).sort((e, t) => e - t).join(","));
|
|
9851
9901
|
}), t.join(":");
|
|
9852
9902
|
}
|
|
9853
|
-
function
|
|
9854
|
-
let t = x(
|
|
9903
|
+
function wd(e) {
|
|
9904
|
+
let t = x(md()), n = h(() => {
|
|
9855
9905
|
let n = e.current, r = t.current;
|
|
9856
9906
|
if (!n) return r;
|
|
9857
|
-
let i =
|
|
9907
|
+
let i = Cd(n);
|
|
9858
9908
|
if (r.indexedModel === n && r.records.size && r.version === i) return r;
|
|
9859
9909
|
let a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set(), c = new W();
|
|
9860
9910
|
return n.updateMatrixWorld(!0), n.traverse((e) => {
|
|
9861
9911
|
if (!(e instanceof B)) return;
|
|
9862
9912
|
let t = e, n = t.geometry, i = n.index, l = n.attributes.ids;
|
|
9863
9913
|
if (!i || !l) return;
|
|
9864
|
-
let u = n.attributes.position, d =
|
|
9914
|
+
let u = n.attributes.position, d = bd(t), f = xd(t), p = Sd(t), m = gd(i.array), h = {
|
|
9865
9915
|
hiddenIds: /* @__PURE__ */ new Set(),
|
|
9866
9916
|
initialVisible: t.visible,
|
|
9867
9917
|
isIfcSpace: f,
|
|
@@ -9876,23 +9926,23 @@ function yd(e) {
|
|
|
9876
9926
|
for (let e = 0; e < y; e++) {
|
|
9877
9927
|
let t = l.getX(m[e * 3]);
|
|
9878
9928
|
if (p.has(t)) {
|
|
9879
|
-
_ !== null &&
|
|
9929
|
+
_ !== null && yd(_, v, e - v, h, g, a), _ = null, v = e + 1;
|
|
9880
9930
|
continue;
|
|
9881
9931
|
}
|
|
9882
|
-
_ === null ? (_ = t, v = e) : t !== _ && (
|
|
9932
|
+
_ === null ? (_ = t, v = e) : t !== _ && (yd(_, v, e - v, h, g, a), _ = t, v = e);
|
|
9883
9933
|
}
|
|
9884
|
-
_ !== null &&
|
|
9934
|
+
_ !== null && yd(_, v, y - v, h, g, a);
|
|
9885
9935
|
let b = null, x = 0, S = u ? Math.min(l.count, u.count) : l.count;
|
|
9886
9936
|
u && t.updateWorldMatrix(!0, !1);
|
|
9887
9937
|
for (let e = 0; e < l.count; e++) {
|
|
9888
9938
|
let n = l.getX(e);
|
|
9889
9939
|
if (p.has(n)) {
|
|
9890
|
-
b !== null &&
|
|
9940
|
+
b !== null && vd(b, x, e - x, h, g, a), b = null, x = e + 1;
|
|
9891
9941
|
continue;
|
|
9892
9942
|
}
|
|
9893
|
-
u && e < S && (c.fromBufferAttribute(u, e).applyMatrix4(t.matrixWorld), Number.isFinite(c.x + c.y + c.z) &&
|
|
9943
|
+
u && e < S && (c.fromBufferAttribute(u, e).applyMatrix4(t.matrixWorld), Number.isFinite(c.x + c.y + c.z) && hd(o, d, n, c)), b === null ? (b = n, x = e) : n !== b && (vd(b, x, e - x, h, g, a), b = n, x = e);
|
|
9894
9944
|
}
|
|
9895
|
-
b !== null &&
|
|
9945
|
+
b !== null && vd(b, x, l.count - x, h, g, a), s.add(h), f && !r.ifcSpacesVisible && (t.visible = !1);
|
|
9896
9946
|
}), t.current = {
|
|
9897
9947
|
elementBounds: o,
|
|
9898
9948
|
elementIndex: a,
|
|
@@ -9904,7 +9954,7 @@ function yd(e) {
|
|
|
9904
9954
|
version: i
|
|
9905
9955
|
}, t.current;
|
|
9906
9956
|
}, [e]), r = h(() => {
|
|
9907
|
-
t.current =
|
|
9957
|
+
t.current = md();
|
|
9908
9958
|
}, []);
|
|
9909
9959
|
return b(() => ({
|
|
9910
9960
|
buildIndex: n,
|
|
@@ -9913,80 +9963,80 @@ function yd(e) {
|
|
|
9913
9963
|
}
|
|
9914
9964
|
//#endregion
|
|
9915
9965
|
//#region src/viewer/utils/GeometryUtils/useGeometryUtils.ts
|
|
9916
|
-
var
|
|
9917
|
-
function
|
|
9966
|
+
var Td = -1;
|
|
9967
|
+
function Ed(e, t) {
|
|
9918
9968
|
return e instanceof Uint32Array ? new Uint32Array(t) : new Uint16Array(t);
|
|
9919
9969
|
}
|
|
9920
|
-
function
|
|
9970
|
+
function Dd(e) {
|
|
9921
9971
|
let t = e.geometry;
|
|
9922
9972
|
Object.assign(t, { boundsTree: void 0 }), e.geometry.index?.count && Object.assign(t, { boundsTree: new dt(e.geometry, { indirect: !0 }) });
|
|
9923
9973
|
}
|
|
9924
|
-
function
|
|
9925
|
-
e.mesh.geometry.setIndex(new j(t, 1)), n &&
|
|
9974
|
+
function Od(e, t, n = !0) {
|
|
9975
|
+
e.mesh.geometry.setIndex(new j(t, 1)), n && Dd(e.mesh);
|
|
9926
9976
|
}
|
|
9927
|
-
function
|
|
9977
|
+
function kd(e, t) {
|
|
9928
9978
|
return e.initialVisible && (!e.isIfcSpace || t);
|
|
9929
9979
|
}
|
|
9930
|
-
function
|
|
9980
|
+
function Ad(e, t) {
|
|
9931
9981
|
let n = e.mesh.geometry, r = n.index?.array;
|
|
9932
|
-
e.mesh.visible =
|
|
9982
|
+
e.mesh.visible = kd(e, t), r !== e.originalIndex && Od(e, e.originalIndex, !1), e.originalBoundsTree ? Object.assign(n, { boundsTree: e.originalBoundsTree }) : (Dd(e.mesh), e.originalBoundsTree = e.mesh.geometry.boundsTree ?? null);
|
|
9933
9983
|
}
|
|
9934
|
-
function
|
|
9984
|
+
function jd(e) {
|
|
9935
9985
|
return e === null ? "*" : e.size ? Array.from(e).sort((e, t) => e - t).join(",") : "";
|
|
9936
9986
|
}
|
|
9937
|
-
function
|
|
9938
|
-
return `h:${
|
|
9987
|
+
function Md(e, t, n, r) {
|
|
9988
|
+
return `h:${jd(e)}|i:${jd(n)}|s:${r ? Number(t) : ""}`;
|
|
9939
9989
|
}
|
|
9940
|
-
function
|
|
9990
|
+
function Nd(e, t, n) {
|
|
9941
9991
|
return !t.has(e) && (!n || n.has(e));
|
|
9942
9992
|
}
|
|
9943
|
-
function
|
|
9993
|
+
function Pd(e, t) {
|
|
9944
9994
|
Object.entries(e).forEach(([e, n]) => {
|
|
9945
9995
|
n.forEach((n) => t(Number(e), n));
|
|
9946
9996
|
});
|
|
9947
9997
|
}
|
|
9948
|
-
function
|
|
9998
|
+
function Fd(e, t, n) {
|
|
9949
9999
|
e.hiddenIds.has(t) || (e.hiddenIds.add(t), n.add(e));
|
|
9950
10000
|
}
|
|
9951
|
-
function
|
|
10001
|
+
function Id(e, t, n) {
|
|
9952
10002
|
e && console.log(`${t}:`, Date.now() - n, "ms");
|
|
9953
10003
|
}
|
|
9954
|
-
function
|
|
9955
|
-
let { hiddenIds: i, originalIndex: a, triangleRanges: o } = e, s =
|
|
10004
|
+
function Ld(e, t, n, r) {
|
|
10005
|
+
let { hiddenIds: i, originalIndex: a, triangleRanges: o } = e, s = Md(i, t, n, e.isIfcSpace);
|
|
9956
10006
|
if (e.visibleStateKey === s) return;
|
|
9957
10007
|
if (!i.size && !n) {
|
|
9958
|
-
|
|
10008
|
+
Ad(e, t), e.visibleStateKey = s;
|
|
9959
10009
|
return;
|
|
9960
10010
|
}
|
|
9961
10011
|
let c = 0, l = 0;
|
|
9962
10012
|
if (o.forEach(({ count: e, id: t }) => {
|
|
9963
|
-
|
|
10013
|
+
Nd(t, i, n) ? c += e * 3 : l += e * 3;
|
|
9964
10014
|
}), !c) {
|
|
9965
|
-
|
|
10015
|
+
Ad(e, t), e.mesh.visible = !1, e.visibleStateKey = s;
|
|
9966
10016
|
return;
|
|
9967
10017
|
}
|
|
9968
10018
|
if (!l) {
|
|
9969
|
-
|
|
10019
|
+
Ad(e, t), e.visibleStateKey = s;
|
|
9970
10020
|
return;
|
|
9971
10021
|
}
|
|
9972
|
-
e.mesh.visible =
|
|
9973
|
-
let u =
|
|
10022
|
+
e.mesh.visible = kd(e, t);
|
|
10023
|
+
let u = Ed(a, c), d = 0;
|
|
9974
10024
|
for (let e = 0; e < o.length; e++) {
|
|
9975
10025
|
let { count: t, id: r, start: s } = o[e];
|
|
9976
|
-
if (!
|
|
10026
|
+
if (!Nd(r, i, n)) continue;
|
|
9977
10027
|
let c = s * 3, l = c + t * 3;
|
|
9978
10028
|
u.set(a.subarray(c, l), d), d += t * 3;
|
|
9979
10029
|
}
|
|
9980
|
-
r || (e.originalBoundsTree = null),
|
|
10030
|
+
r || (e.originalBoundsTree = null), Od(e, u), e.visibleStateKey = s;
|
|
9981
10031
|
}
|
|
9982
|
-
function
|
|
10032
|
+
function Rd(e, t, n) {
|
|
9983
10033
|
let r = e.elementIndex.get(n);
|
|
9984
10034
|
if (!r) return;
|
|
9985
10035
|
let i = r.filter(({ record: e }) => e.modelID !== t);
|
|
9986
10036
|
i.length ? e.elementIndex.set(n, i) : e.elementIndex.delete(n);
|
|
9987
10037
|
}
|
|
9988
|
-
function
|
|
9989
|
-
let n =
|
|
10038
|
+
function zd(e, t) {
|
|
10039
|
+
let n = Sd(e.mesh), r = !1;
|
|
9990
10040
|
if (t.forEach((t) => {
|
|
9991
10041
|
e.hiddenIds.delete(t), !n.has(t) && (n.add(t), r = !0);
|
|
9992
10042
|
}), !r) return !1;
|
|
@@ -9999,53 +10049,53 @@ function Pd(e, t) {
|
|
|
9999
10049
|
start: a
|
|
10000
10050
|
}), a += e, o += e * 3);
|
|
10001
10051
|
});
|
|
10002
|
-
let s =
|
|
10052
|
+
let s = Ed(e.originalIndex, o), c = 0;
|
|
10003
10053
|
return e.triangleRanges.forEach(({ count: t, id: r, start: i }) => {
|
|
10004
10054
|
if (n.has(r)) return;
|
|
10005
10055
|
let a = i * 3, o = a + t * 3;
|
|
10006
10056
|
s.set(e.originalIndex.subarray(a, o), c), c += t * 3;
|
|
10007
10057
|
}), e.originalBoundsTree = null, e.originalIndex = s, e.triangleRanges = i, e.visibleStateKey = "", !0;
|
|
10008
10058
|
}
|
|
10009
|
-
function
|
|
10059
|
+
function Bd(e, t) {
|
|
10010
10060
|
return e.isolatedIdsByModel ? e.isolatedIdsByModel.get(t.modelID) ?? /* @__PURE__ */ new Set() : e.isolatedIds;
|
|
10011
10061
|
}
|
|
10012
|
-
function
|
|
10062
|
+
function Vd(e) {
|
|
10013
10063
|
let t = [];
|
|
10014
10064
|
return e?.children.forEach((e) => {
|
|
10015
10065
|
e instanceof L && typeof e.userData.modelID == "number" && t.push(e);
|
|
10016
10066
|
}), t;
|
|
10017
10067
|
}
|
|
10018
|
-
function
|
|
10068
|
+
function Hd(e) {
|
|
10019
10069
|
let t = e.userData.trueNorthBaseMatrix;
|
|
10020
10070
|
if (t instanceof z) return t;
|
|
10021
10071
|
let n = e.matrix.clone();
|
|
10022
10072
|
return e.userData.trueNorthBaseMatrix = n, n;
|
|
10023
10073
|
}
|
|
10024
|
-
function
|
|
10025
|
-
let n = Number(e.userData.trueNorthAngle ?? 0), r =
|
|
10026
|
-
!t && Number.isFinite(n) && n !== 0 && r.multiply(new z().makeRotationY(n *
|
|
10074
|
+
function Ud(e, t) {
|
|
10075
|
+
let n = Number(e.userData.trueNorthAngle ?? 0), r = Hd(e).clone();
|
|
10076
|
+
!t && Number.isFinite(n) && n !== 0 && r.multiply(new z().makeRotationY(n * Td)), e.matrix.copy(r), e.matrixAutoUpdate = !1, e.updateMatrixWorld(!0), e.userData.trueNorthEnabled = t, e.userData.geometryTransformVersion = (Number(e.userData.geometryTransformVersion) || 0) + 1;
|
|
10027
10077
|
}
|
|
10028
|
-
function
|
|
10078
|
+
function Wd(e) {
|
|
10029
10079
|
let t = K((e) => e.selected), n = K((e) => e.resetSelected), r = K((e) => e.showStats), i = K((e) => e.userDevice) === "pc", a = e.buildIndex, o = h(() => Array.from(a().elementIndex.keys()), [a]), s = h(() => a().ifcSpacesVisible, [a]), c = h((e, t) => {
|
|
10030
10080
|
let n = Date.now(), o = a(), s = /* @__PURE__ */ new Set();
|
|
10031
10081
|
t.forEach((t) => {
|
|
10032
10082
|
let n = o.elementIndex.get(t);
|
|
10033
10083
|
n && n.forEach(({ record: n }) => {
|
|
10034
|
-
n.modelID === e &&
|
|
10084
|
+
n.modelID === e && Fd(n, t, s);
|
|
10035
10085
|
});
|
|
10036
|
-
}), s.forEach((e) =>
|
|
10086
|
+
}), s.forEach((e) => Ld(e, o.ifcSpacesVisible, Bd(o, e), i)), Id(r, "hideByIds", n);
|
|
10037
10087
|
}, [
|
|
10038
10088
|
a,
|
|
10039
10089
|
i,
|
|
10040
10090
|
r
|
|
10041
10091
|
]), l = h(() => {
|
|
10042
10092
|
let e = Date.now(), o = a(), s = /* @__PURE__ */ new Set();
|
|
10043
|
-
|
|
10093
|
+
Pd(t, (e, t) => {
|
|
10044
10094
|
let n = o.elementIndex.get(t);
|
|
10045
10095
|
n && n.forEach(({ record: n }) => {
|
|
10046
|
-
n.modelID === e &&
|
|
10096
|
+
n.modelID === e && Fd(n, t, s);
|
|
10047
10097
|
});
|
|
10048
|
-
}), s.forEach((e) =>
|
|
10098
|
+
}), s.forEach((e) => Ld(e, o.ifcSpacesVisible, Bd(o, e), i)), n(), Id(r, "hideSelected", e);
|
|
10049
10099
|
}, [
|
|
10050
10100
|
a,
|
|
10051
10101
|
i,
|
|
@@ -10059,14 +10109,14 @@ function zd(e) {
|
|
|
10059
10109
|
n && n.forEach(({ record: n }) => {
|
|
10060
10110
|
n.modelID === e && n.hiddenIds.delete(t) && s.add(n);
|
|
10061
10111
|
});
|
|
10062
|
-
}), s.forEach((e) =>
|
|
10112
|
+
}), s.forEach((e) => Ld(e, o.ifcSpacesVisible, Bd(o, e), i)), Id(r, "showByIds", n);
|
|
10063
10113
|
}, [
|
|
10064
10114
|
a,
|
|
10065
10115
|
i,
|
|
10066
10116
|
r
|
|
10067
10117
|
]), d = h((e, t) => {
|
|
10068
10118
|
let n = Date.now(), o = a();
|
|
10069
|
-
o.isolatedIdsByModel = new Map([[e, new Set(t)]]), o.isolatedIds = null, o.records.forEach((e) =>
|
|
10119
|
+
o.isolatedIdsByModel = new Map([[e, new Set(t)]]), o.isolatedIds = null, o.records.forEach((e) => Ld(e, o.ifcSpacesVisible, Bd(o, e), i)), Id(r, "isolateByIds", n);
|
|
10070
10120
|
}, [
|
|
10071
10121
|
a,
|
|
10072
10122
|
i,
|
|
@@ -10081,24 +10131,24 @@ function zd(e) {
|
|
|
10081
10131
|
t.modelID === e && c.add(t);
|
|
10082
10132
|
});
|
|
10083
10133
|
}), !c.size) {
|
|
10084
|
-
|
|
10134
|
+
Id(r, "removeByIds", n);
|
|
10085
10135
|
return;
|
|
10086
10136
|
}
|
|
10087
10137
|
c.forEach((e) => {
|
|
10088
|
-
|
|
10138
|
+
zd(e, s);
|
|
10089
10139
|
}), s.forEach((t) => {
|
|
10090
|
-
|
|
10091
|
-
}), c.forEach((e) =>
|
|
10140
|
+
Rd(o, e, t), o.elementBounds.get(e)?.delete(t), o.isolatedIds?.delete(t), o.isolatedIdsByModel?.get(e)?.delete(t);
|
|
10141
|
+
}), c.forEach((e) => Ld(e, o.ifcSpacesVisible, Bd(o, e), i)), Id(r, "removeByIds", n);
|
|
10092
10142
|
}, [
|
|
10093
10143
|
a,
|
|
10094
10144
|
i,
|
|
10095
10145
|
r
|
|
10096
10146
|
]), p = h(() => {
|
|
10097
10147
|
let e = Date.now(), n = a(), o = /* @__PURE__ */ new Map();
|
|
10098
|
-
|
|
10148
|
+
Pd(t, (e, t) => {
|
|
10099
10149
|
let n = o.get(e);
|
|
10100
10150
|
n || (n = /* @__PURE__ */ new Set(), o.set(e, n)), n.add(t);
|
|
10101
|
-
}), n.isolatedIdsByModel = o, n.isolatedIds = null, n.records.forEach((e) =>
|
|
10151
|
+
}), n.isolatedIdsByModel = o, n.isolatedIds = null, n.records.forEach((e) => Ld(e, n.ifcSpacesVisible, Bd(n, e), i)), Id(r, "isolateSelected", e);
|
|
10102
10152
|
}, [
|
|
10103
10153
|
a,
|
|
10104
10154
|
i,
|
|
@@ -10106,7 +10156,7 @@ function zd(e) {
|
|
|
10106
10156
|
r
|
|
10107
10157
|
]), m = h(() => {
|
|
10108
10158
|
let e = Date.now(), t = a();
|
|
10109
|
-
t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) =>
|
|
10159
|
+
t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => Ld(e, t.ifcSpacesVisible, Bd(t, e), i)), Id(r, "resetIsolation", e);
|
|
10110
10160
|
}, [
|
|
10111
10161
|
a,
|
|
10112
10162
|
i,
|
|
@@ -10114,7 +10164,7 @@ function zd(e) {
|
|
|
10114
10164
|
]), g = h((e) => {
|
|
10115
10165
|
let t = a();
|
|
10116
10166
|
t.ifcSpacesVisible !== e && (t.ifcSpacesVisible = e, t.records.forEach((e) => {
|
|
10117
|
-
e.isIfcSpace &&
|
|
10167
|
+
e.isIfcSpace && Ld(e, t.ifcSpacesVisible, Bd(t, e), i);
|
|
10118
10168
|
}));
|
|
10119
10169
|
}, [a, i]), _ = h(() => {
|
|
10120
10170
|
g(!s());
|
|
@@ -10136,8 +10186,8 @@ function zd(e) {
|
|
|
10136
10186
|
showAll: h(() => {
|
|
10137
10187
|
let e = Date.now(), t = a();
|
|
10138
10188
|
t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => {
|
|
10139
|
-
e.hiddenIds.clear(),
|
|
10140
|
-
}),
|
|
10189
|
+
e.hiddenIds.clear(), Ld(e, t.ifcSpacesVisible, Bd(t, e), i);
|
|
10190
|
+
}), Id(r, "showAll", e);
|
|
10141
10191
|
}, [
|
|
10142
10192
|
a,
|
|
10143
10193
|
i,
|
|
@@ -10146,23 +10196,23 @@ function zd(e) {
|
|
|
10146
10196
|
showByIds: u,
|
|
10147
10197
|
toggleIIfcSpacesVisibility: _,
|
|
10148
10198
|
useTrueNorth: h((t = !0) => {
|
|
10149
|
-
let n =
|
|
10150
|
-
n.length && (n.forEach((e) =>
|
|
10199
|
+
let n = Vd(a().indexedModel);
|
|
10200
|
+
n.length && (n.forEach((e) => Ud(e, t)), e.resetIndex());
|
|
10151
10201
|
}, [a, e])
|
|
10152
10202
|
};
|
|
10153
10203
|
}
|
|
10154
10204
|
//#endregion
|
|
10155
10205
|
//#region src/viewer/utils/ClippingUtils/PlaneHelper.ts
|
|
10156
|
-
var
|
|
10157
|
-
function
|
|
10206
|
+
var Gd = "#0b2f5f", Kd = "#0b2f5f", qd = 0, Jd = "#165eb0", Yd = .3, Xd = .01, Zd = .025, Qd = .015, $d = .02, ef = 1e-7, tf = .25, nf = .15, rf = .25, af = 1e-5, of = .2, sf = 1, cf = 1;
|
|
10207
|
+
function lf(e, t) {
|
|
10158
10208
|
let n = t.getBoundingClientRect();
|
|
10159
10209
|
return new U((e.clientX - n.left) / n.width * 2 - 1, -((e.clientY - n.top) / n.height) * 2 + 1);
|
|
10160
10210
|
}
|
|
10161
|
-
function
|
|
10211
|
+
function uf(e) {
|
|
10162
10212
|
let t = e.getSize(new W());
|
|
10163
|
-
return Math.max(
|
|
10213
|
+
return Math.max(rf, t.length() * Xd);
|
|
10164
10214
|
}
|
|
10165
|
-
var
|
|
10215
|
+
var df = class extends Oe {
|
|
10166
10216
|
helper = new L();
|
|
10167
10217
|
borderMaterial;
|
|
10168
10218
|
material;
|
|
@@ -10182,15 +10232,15 @@ var of = class extends Oe {
|
|
|
10182
10232
|
listenersActive = !1;
|
|
10183
10233
|
constructor(e, t, n, r) {
|
|
10184
10234
|
super(), this.context = e, this.plane = t, this.location = n.clone(), this.normal = r.clone().normalize(), this.material = new Se({
|
|
10185
|
-
color:
|
|
10235
|
+
color: Kd,
|
|
10186
10236
|
depthWrite: !1,
|
|
10187
|
-
opacity:
|
|
10237
|
+
opacity: qd,
|
|
10188
10238
|
side: le,
|
|
10189
10239
|
transparent: !0
|
|
10190
10240
|
}), this.helper.position.copy(this.location), this.applyPlaneOrientation(), this.layout = this.getHelperLayout();
|
|
10191
|
-
let i = Math.max(
|
|
10241
|
+
let i = Math.max(tf, Math.min(this.layout.width, this.layout.height) * Zd), a = Math.max(nf, Math.min(this.layout.width, this.layout.height) * Qd);
|
|
10192
10242
|
this.borderMaterial = new _e({
|
|
10193
|
-
color:
|
|
10243
|
+
color: Gd,
|
|
10194
10244
|
dashSize: i,
|
|
10195
10245
|
depthWrite: !1,
|
|
10196
10246
|
gapSize: a
|
|
@@ -10221,7 +10271,7 @@ var of = class extends Oe {
|
|
|
10221
10271
|
}
|
|
10222
10272
|
updateBorderDash() {
|
|
10223
10273
|
let e = Math.min(this.layout.width, this.layout.height);
|
|
10224
|
-
this.borderMaterial.dashSize = Math.max(
|
|
10274
|
+
this.borderMaterial.dashSize = Math.max(tf, e * Zd), this.borderMaterial.gapSize = Math.max(nf, e * Qd), this.borderMaterial.needsUpdate = !0;
|
|
10225
10275
|
}
|
|
10226
10276
|
addEventListeners() {
|
|
10227
10277
|
if (this.listenersActive) return;
|
|
@@ -10283,10 +10333,10 @@ var of = class extends Oe {
|
|
|
10283
10333
|
return !1;
|
|
10284
10334
|
}
|
|
10285
10335
|
getEdgeInteractionWidth() {
|
|
10286
|
-
return Math.min(
|
|
10336
|
+
return Math.min(sf, Math.max(of, Math.min(this.layout.width, this.layout.height) * $d));
|
|
10287
10337
|
}
|
|
10288
10338
|
getDragDistanceEpsilon() {
|
|
10289
|
-
return Math.max(
|
|
10339
|
+
return Math.max(af, Math.min(this.layout.width, this.layout.height) * ef);
|
|
10290
10340
|
}
|
|
10291
10341
|
getPointToSegmentDistanceSquared(e, t, n) {
|
|
10292
10342
|
let r = n.x - t.x, i = n.y - t.y, a = r * r + i * i;
|
|
@@ -10299,7 +10349,7 @@ var of = class extends Oe {
|
|
|
10299
10349
|
}
|
|
10300
10350
|
getPointerPointOnPlane(e, t) {
|
|
10301
10351
|
let n = this.context.getDomElement();
|
|
10302
|
-
this.pointer.copy(
|
|
10352
|
+
this.pointer.copy(lf(e, n));
|
|
10303
10353
|
let r = this.context.getRaycaster(), i = new W();
|
|
10304
10354
|
return r.setFromCamera(this.pointer, this.context.getCamera()), r.ray.intersectPlane(t, i);
|
|
10305
10355
|
}
|
|
@@ -10352,7 +10402,7 @@ var of = class extends Oe {
|
|
|
10352
10402
|
t && (this.context.clearHelpersHover(this), this.hasHelperPriority(e) && this.stopHelperPriorityEvent(e)), this.hovered !== t && this.setHovered(t);
|
|
10353
10403
|
}
|
|
10354
10404
|
setHovered(e) {
|
|
10355
|
-
this.hovered = e, this.material.color.set(e ?
|
|
10405
|
+
this.hovered = e, this.material.color.set(e ? Jd : Kd), this.material.opacity = e ? Yd : qd, this.material.needsUpdate = !0;
|
|
10356
10406
|
}
|
|
10357
10407
|
createPlaneMesh() {
|
|
10358
10408
|
let e = new B(new re(), this.material);
|
|
@@ -10428,12 +10478,12 @@ var of = class extends Oe {
|
|
|
10428
10478
|
getHelperLayout() {
|
|
10429
10479
|
let e = this.getModelWorldBox();
|
|
10430
10480
|
if (!e || e.isEmpty()) return {
|
|
10431
|
-
height:
|
|
10432
|
-
maxU:
|
|
10433
|
-
maxV:
|
|
10434
|
-
minU: -
|
|
10435
|
-
minV: -
|
|
10436
|
-
width:
|
|
10481
|
+
height: cf,
|
|
10482
|
+
maxU: cf / 2,
|
|
10483
|
+
maxV: cf / 2,
|
|
10484
|
+
minU: -cf / 2,
|
|
10485
|
+
minV: -cf / 2,
|
|
10486
|
+
width: cf
|
|
10437
10487
|
};
|
|
10438
10488
|
let t = this.getPlaneBasis(), n = this.helper.position, r = this.getBoxCorners(e), i = new W(), a = new W(), o = Infinity, s = -Infinity, c = Infinity, l = -Infinity;
|
|
10439
10489
|
if (r.forEach((e) => {
|
|
@@ -10441,14 +10491,14 @@ var of = class extends Oe {
|
|
|
10441
10491
|
let r = a.dot(t.u), u = a.dot(t.v);
|
|
10442
10492
|
o = Math.min(o, r), s = Math.max(s, r), c = Math.min(c, u), l = Math.max(l, u);
|
|
10443
10493
|
}), !Number.isFinite(o) || !Number.isFinite(s) || !Number.isFinite(c) || !Number.isFinite(l)) return {
|
|
10444
|
-
height:
|
|
10445
|
-
maxU:
|
|
10446
|
-
maxV:
|
|
10447
|
-
minU: -
|
|
10448
|
-
minV: -
|
|
10449
|
-
width:
|
|
10494
|
+
height: cf,
|
|
10495
|
+
maxU: cf / 2,
|
|
10496
|
+
maxV: cf / 2,
|
|
10497
|
+
minU: -cf / 2,
|
|
10498
|
+
minV: -cf / 2,
|
|
10499
|
+
width: cf
|
|
10450
10500
|
};
|
|
10451
|
-
let u =
|
|
10501
|
+
let u = uf(e), d = o - u, f = s + u, p = c - u, m = l + u, h = Math.max(cf, f - d), g = Math.max(cf, m - p), _ = (d + f) / 2, v = (p + m) / 2;
|
|
10452
10502
|
return {
|
|
10453
10503
|
height: g,
|
|
10454
10504
|
maxU: _ + h / 2,
|
|
@@ -10489,8 +10539,8 @@ var of = class extends Oe {
|
|
|
10489
10539
|
new W(e.max.x, e.max.y, e.max.z)
|
|
10490
10540
|
];
|
|
10491
10541
|
}
|
|
10492
|
-
},
|
|
10493
|
-
function
|
|
10542
|
+
}, ff = 250, pf = "#a9a9a9", mf = new W(0, 0, -1), hf = "__bimatterCameraMotionHidden";
|
|
10543
|
+
function gf(e, t) {
|
|
10494
10544
|
if (Array.isArray(e)) {
|
|
10495
10545
|
e.forEach((e) => {
|
|
10496
10546
|
e.clippingPlanes = t, e.needsUpdate = !0;
|
|
@@ -10499,13 +10549,13 @@ function df(e, t) {
|
|
|
10499
10549
|
}
|
|
10500
10550
|
e.clippingPlanes = t, e.needsUpdate = !0;
|
|
10501
10551
|
}
|
|
10502
|
-
function
|
|
10552
|
+
function _f(e) {
|
|
10503
10553
|
let t = [];
|
|
10504
10554
|
return e?.traverse((e) => {
|
|
10505
10555
|
e instanceof B && (!e.geometry.index || !e.geometry.attributes.ids || t.push(e));
|
|
10506
10556
|
}), t;
|
|
10507
10557
|
}
|
|
10508
|
-
function
|
|
10558
|
+
function vf(e) {
|
|
10509
10559
|
let t = e;
|
|
10510
10560
|
for (; t;) {
|
|
10511
10561
|
let e = t.userData.modelID;
|
|
@@ -10514,14 +10564,14 @@ function pf(e) {
|
|
|
10514
10564
|
}
|
|
10515
10565
|
return 0;
|
|
10516
10566
|
}
|
|
10517
|
-
function
|
|
10567
|
+
function yf(e, t, n) {
|
|
10518
10568
|
let r = e;
|
|
10519
10569
|
r && (r.isClippingGroup = n, r.enabled = n && t.length > 0, r.clipIntersection = !1, r.clipShadows = !1, r.clippingPlanes = n ? t : []);
|
|
10520
10570
|
}
|
|
10521
|
-
function
|
|
10571
|
+
function bf(e, t) {
|
|
10522
10572
|
return t.clone().transformDirection(e.matrixWorld).normalize();
|
|
10523
10573
|
}
|
|
10524
|
-
function
|
|
10574
|
+
function xf(e) {
|
|
10525
10575
|
if (!e) return null;
|
|
10526
10576
|
if ("x" in e) {
|
|
10527
10577
|
let t = new W(e.x, e.y, e.z);
|
|
@@ -10530,7 +10580,7 @@ function gf(e) {
|
|
|
10530
10580
|
let t = new W(e[0], e[1], e[2]);
|
|
10531
10581
|
return Number.isFinite(t.x + t.y + t.z) ? t : null;
|
|
10532
10582
|
}
|
|
10533
|
-
var
|
|
10583
|
+
var Sf = class {
|
|
10534
10584
|
planes = [];
|
|
10535
10585
|
caps = [];
|
|
10536
10586
|
edges = [];
|
|
@@ -10538,7 +10588,7 @@ var _f = class {
|
|
|
10538
10588
|
active = !1;
|
|
10539
10589
|
capsActive = !0;
|
|
10540
10590
|
capsCameraMotionActive = !1;
|
|
10541
|
-
capsColor =
|
|
10591
|
+
capsColor = pf;
|
|
10542
10592
|
context;
|
|
10543
10593
|
edgesActive = !0;
|
|
10544
10594
|
edgesCameraMotionActive = !1;
|
|
@@ -10595,13 +10645,13 @@ var _f = class {
|
|
|
10595
10645
|
return this.context.controlRef;
|
|
10596
10646
|
}
|
|
10597
10647
|
getMeshes() {
|
|
10598
|
-
return
|
|
10648
|
+
return _f(this.context.modelRef.current);
|
|
10599
10649
|
}
|
|
10600
10650
|
getPlanVisualObjects() {
|
|
10601
|
-
return [...this.caps.map((e) => e.getObject()).filter((e) => e.visible || e.userData[
|
|
10651
|
+
return [...this.caps.map((e) => e.getObject()).filter((e) => e.visible || e.userData[hf]), ...this.edges.flatMap((e) => e.getObjects(!0))];
|
|
10602
10652
|
}
|
|
10603
10653
|
getObjectModelID(e) {
|
|
10604
|
-
return
|
|
10654
|
+
return vf(e);
|
|
10605
10655
|
}
|
|
10606
10656
|
getEdgeSegmentsForPlane(e) {
|
|
10607
10657
|
return this.edgesActive ? this.edges.find((t) => t.plane === e && t.active)?.getIntersectionSegments() ?? null : null;
|
|
@@ -10640,12 +10690,12 @@ var _f = class {
|
|
|
10640
10690
|
if (this.capsCameraMotionActive !== e) {
|
|
10641
10691
|
if (this.capsCameraMotionActive = e, e) {
|
|
10642
10692
|
this.clearCapsDragIdleTimeout(), this.caps.forEach((e) => {
|
|
10643
|
-
e.getObject().userData[
|
|
10693
|
+
e.getObject().userData[hf] = !0, e.setVisible(!1);
|
|
10644
10694
|
}), this.context.onVisualChange?.();
|
|
10645
10695
|
return;
|
|
10646
10696
|
}
|
|
10647
10697
|
this.caps.forEach((e) => {
|
|
10648
|
-
delete e.getObject().userData[
|
|
10698
|
+
delete e.getObject().userData[hf], e.setVisible(this.active && this.capsActive && !this.capsDragActive);
|
|
10649
10699
|
}), this.context.onVisualChange?.();
|
|
10650
10700
|
}
|
|
10651
10701
|
}
|
|
@@ -10660,7 +10710,7 @@ var _f = class {
|
|
|
10660
10710
|
this.capsDragIdleTimeout = null, !(!this.active || !this.capsDragActive || this.capsCameraMotionActive) && (this.flushEdgesUpdate(), this.caps.forEach((e) => {
|
|
10661
10711
|
e.setVisible(!0), e.update();
|
|
10662
10712
|
}), this.updateCapsVisualState());
|
|
10663
|
-
},
|
|
10713
|
+
}, ff));
|
|
10664
10714
|
}
|
|
10665
10715
|
clearCapsDragIdleTimeout() {
|
|
10666
10716
|
this.capsDragIdleTimeout !== null && (window.clearTimeout(this.capsDragIdleTimeout), this.capsDragIdleTimeout = null);
|
|
@@ -10690,7 +10740,7 @@ var _f = class {
|
|
|
10690
10740
|
getSelectedWorldBox() {
|
|
10691
10741
|
let e = this.context.viewerStore.getState().selected, t = new A(), n = new W();
|
|
10692
10742
|
return this.getMeshes().forEach((r) => {
|
|
10693
|
-
let i = e[
|
|
10743
|
+
let i = e[vf(r)];
|
|
10694
10744
|
if (!i?.size) return;
|
|
10695
10745
|
let a = r.geometry.attributes.ids, o = r.geometry.attributes.position;
|
|
10696
10746
|
if (!a || !o) return;
|
|
@@ -10708,8 +10758,8 @@ var _f = class {
|
|
|
10708
10758
|
}
|
|
10709
10759
|
updateMaterials() {
|
|
10710
10760
|
let e = this.active ? this.planes : [];
|
|
10711
|
-
|
|
10712
|
-
|
|
10761
|
+
yf(this.context.modelRef.current, e, this.context.useWebGPU), this.getMeshes().forEach((t) => {
|
|
10762
|
+
gf(t.material, e);
|
|
10713
10763
|
}), this.context.camera.updateMatrixWorld();
|
|
10714
10764
|
}
|
|
10715
10765
|
setActive(e) {
|
|
@@ -10728,13 +10778,13 @@ var _f = class {
|
|
|
10728
10778
|
recursive: !1
|
|
10729
10779
|
});
|
|
10730
10780
|
if (!n?.face) return null;
|
|
10731
|
-
let r = n.point.clone(), i =
|
|
10781
|
+
let r = n.point.clone(), i = bf(n.object, n.face.normal);
|
|
10732
10782
|
r.add(i.clone().multiplyScalar(.001));
|
|
10733
10783
|
let a = new je().setFromNormalAndCoplanarPoint(i.clone().negate(), r);
|
|
10734
10784
|
return this.addPlane(a, r, i), a.clone();
|
|
10735
10785
|
}
|
|
10736
10786
|
createPlaneFromPointAndNormal(e, t) {
|
|
10737
|
-
let n = typeof e == "number" ? this.getPointFromZ(e) :
|
|
10787
|
+
let n = typeof e == "number" ? this.getPointFromZ(e) : xf(e), r = xf(t ?? (typeof e == "number" ? mf : void 0));
|
|
10738
10788
|
if (!n || !r || r.lengthSq() === 0) return null;
|
|
10739
10789
|
r.normalize();
|
|
10740
10790
|
let i = new je().setFromNormalAndCoplanarPoint(r, n);
|
|
@@ -10743,7 +10793,7 @@ var _f = class {
|
|
|
10743
10793
|
createClippingRectangle(e = !1) {
|
|
10744
10794
|
let t = e ? this.getSelectedWorldBox() : this.getModelWorldBox();
|
|
10745
10795
|
if (!t) return [];
|
|
10746
|
-
let n =
|
|
10796
|
+
let n = uf(t), r = t.min.clone().addScalar(-n), i = t.max.clone().addScalar(n), a = t.getCenter(new W()), o = [
|
|
10747
10797
|
{
|
|
10748
10798
|
normal: new W(1, 0, 0),
|
|
10749
10799
|
point: new W(r.x, a.y, a.z)
|
|
@@ -10783,7 +10833,7 @@ var _f = class {
|
|
|
10783
10833
|
return new W(t?.x ?? 0, t?.y ?? 0, e);
|
|
10784
10834
|
}
|
|
10785
10835
|
addPlane(e, t, n) {
|
|
10786
|
-
if (this.active || this.setActive(!0), this.planes.push(e), new
|
|
10836
|
+
if (this.active || this.setActive(!0), this.planes.push(e), new df(this, e, t, n), this.edgesActive) {
|
|
10787
10837
|
let t = new ul(this, e);
|
|
10788
10838
|
t.create(), t.update();
|
|
10789
10839
|
}
|
|
@@ -10842,9 +10892,9 @@ var _f = class {
|
|
|
10842
10892
|
this.clearCapsDragIdleTimeout(), this.deleteAllPlanes();
|
|
10843
10893
|
}
|
|
10844
10894
|
};
|
|
10845
|
-
function
|
|
10895
|
+
function Cf(e, t, n, r = !1, i) {
|
|
10846
10896
|
let a = D((e) => e.camera), o = D((e) => e.gl), s = D((e) => e.raycaster), c = D((e) => e.scene), l = Tt(), u = x(null);
|
|
10847
|
-
u.current ||= new
|
|
10897
|
+
u.current ||= new Sf({
|
|
10848
10898
|
camera: a,
|
|
10849
10899
|
cameraUtils: n,
|
|
10850
10900
|
controlRef: t,
|
|
@@ -10925,15 +10975,15 @@ function vf(e, t, n, r = !1, i) {
|
|
|
10925
10975
|
}
|
|
10926
10976
|
//#endregion
|
|
10927
10977
|
//#region src/viewer/utils/Hotkeys/useHotkeysUtils.tsx
|
|
10928
|
-
function
|
|
10978
|
+
function wf(e) {
|
|
10929
10979
|
return e instanceof HTMLElement ? e.isContentEditable || e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement : !1;
|
|
10930
10980
|
}
|
|
10931
|
-
function
|
|
10981
|
+
function Tf(e = !0) {
|
|
10932
10982
|
let t = K((e) => e.api), n = K((e) => e.defaultHotkeysEnabled);
|
|
10933
10983
|
_(() => {
|
|
10934
10984
|
if (!e || !n) return;
|
|
10935
10985
|
let r = (e) => {
|
|
10936
|
-
|
|
10986
|
+
wf(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())));
|
|
10937
10987
|
};
|
|
10938
10988
|
return window.addEventListener("keydown", r), () => {
|
|
10939
10989
|
window.removeEventListener("keydown", r);
|
|
@@ -10946,8 +10996,8 @@ function bf(e = !0) {
|
|
|
10946
10996
|
}
|
|
10947
10997
|
//#endregion
|
|
10948
10998
|
//#region src/viewer/Selector/SelectionBox.ts
|
|
10949
|
-
var
|
|
10950
|
-
function
|
|
10999
|
+
var Ef = new W(), Df = new W(), Of = new U(), kf = new W(), Af = new W(), jf = new W(), Mf = new W(), Nf = new W(), Pf = new W(), Ff = new W();
|
|
11000
|
+
function If(e) {
|
|
10951
11001
|
let t = e;
|
|
10952
11002
|
for (; t;) {
|
|
10953
11003
|
let e = t.modelID ?? t.userData.modelID;
|
|
@@ -10956,7 +11006,7 @@ function jf(e) {
|
|
|
10956
11006
|
}
|
|
10957
11007
|
return 0;
|
|
10958
11008
|
}
|
|
10959
|
-
function
|
|
11009
|
+
function Lf(e) {
|
|
10960
11010
|
let t = e;
|
|
10961
11011
|
for (; t;) {
|
|
10962
11012
|
if (!t.visible) return !1;
|
|
@@ -10964,16 +11014,16 @@ function Mf(e) {
|
|
|
10964
11014
|
}
|
|
10965
11015
|
return !0;
|
|
10966
11016
|
}
|
|
10967
|
-
function
|
|
10968
|
-
return n.length ? (
|
|
11017
|
+
function Rf(e, t, n) {
|
|
11018
|
+
return n.length ? (kf.copy(t).applyMatrix4(e.matrixWorld), Rs(kf, n)) : !0;
|
|
10969
11019
|
}
|
|
10970
|
-
function
|
|
10971
|
-
return i.length ? (
|
|
10972
|
-
let t = e.distanceToPoint(
|
|
11020
|
+
function zf(e, t, n, r, i) {
|
|
11021
|
+
return i.length ? (Af.copy(t).applyMatrix4(e.matrixWorld), jf.copy(n).applyMatrix4(e.matrixWorld), Mf.copy(r).applyMatrix4(e.matrixWorld), i.every((e) => {
|
|
11022
|
+
let t = e.distanceToPoint(Af), n = e.distanceToPoint(jf), r = e.distanceToPoint(Mf);
|
|
10973
11023
|
return !(t < -1e-6 && n < -1e-6 && r < -1e-6);
|
|
10974
11024
|
})) : !0;
|
|
10975
11025
|
}
|
|
10976
|
-
function
|
|
11026
|
+
function Bf(e) {
|
|
10977
11027
|
let t = e.getBoundingClientRect();
|
|
10978
11028
|
return {
|
|
10979
11029
|
height: t.height,
|
|
@@ -10982,7 +11032,7 @@ function Ff(e) {
|
|
|
10982
11032
|
width: t.width
|
|
10983
11033
|
};
|
|
10984
11034
|
}
|
|
10985
|
-
function
|
|
11035
|
+
function Vf(e) {
|
|
10986
11036
|
return {
|
|
10987
11037
|
boundsCheckMs: 0,
|
|
10988
11038
|
candidateIds: 0,
|
|
@@ -11008,7 +11058,7 @@ function If(e) {
|
|
|
11008
11058
|
triangleProjectionMs: 0
|
|
11009
11059
|
};
|
|
11010
11060
|
}
|
|
11011
|
-
function
|
|
11061
|
+
function Hf(e, t) {
|
|
11012
11062
|
return {
|
|
11013
11063
|
minX: Math.min(e.x, t.x),
|
|
11014
11064
|
minY: Math.min(e.y, t.y),
|
|
@@ -11016,43 +11066,43 @@ function Lf(e, t) {
|
|
|
11016
11066
|
maxY: Math.max(e.y, t.y)
|
|
11017
11067
|
};
|
|
11018
11068
|
}
|
|
11019
|
-
function
|
|
11069
|
+
function Uf(e, t) {
|
|
11020
11070
|
return t.x >= e.x ? "contains" : "intersects";
|
|
11021
11071
|
}
|
|
11022
|
-
function
|
|
11023
|
-
return
|
|
11072
|
+
function Wf(e, t) {
|
|
11073
|
+
return Gf(e.x, e.y, t);
|
|
11024
11074
|
}
|
|
11025
|
-
function
|
|
11075
|
+
function Gf(e, t, n) {
|
|
11026
11076
|
return e >= n.minX && e <= n.maxX && t >= n.minY && t <= n.maxY;
|
|
11027
11077
|
}
|
|
11028
|
-
function
|
|
11078
|
+
function Kf(e, t, n, r, i, a) {
|
|
11029
11079
|
return (a - t) * (n - e) > (r - t) * (i - e);
|
|
11030
11080
|
}
|
|
11031
|
-
function
|
|
11032
|
-
return
|
|
11081
|
+
function qf(e, t, n, r, i, a, o, s) {
|
|
11082
|
+
return Kf(e, t, i, a, o, s) !== Kf(n, r, i, a, o, s) && Kf(e, t, n, r, i, a) !== Kf(e, t, n, r, o, s);
|
|
11033
11083
|
}
|
|
11034
|
-
function
|
|
11084
|
+
function Jf(e, t, n, r, i) {
|
|
11035
11085
|
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;
|
|
11036
11086
|
return s >= 0 && c >= 0 && s + c <= 2 * a * o;
|
|
11037
11087
|
}
|
|
11038
|
-
function
|
|
11039
|
-
return
|
|
11088
|
+
function Yf(e, t, n, r) {
|
|
11089
|
+
return Wf(e, r) || Wf(t, r) || Wf(n, r) || Jf(r.minX, r.minY, e, t, n) || Jf(r.maxX, r.minY, e, t, n) || Jf(r.maxX, r.maxY, e, t, n) || Jf(r.minX, r.maxY, e, t, n) ? !0 : Xf(e, t, r) || Xf(t, n, r) || Xf(n, e, r);
|
|
11040
11090
|
}
|
|
11041
|
-
function
|
|
11042
|
-
return
|
|
11091
|
+
function Xf(e, t, n) {
|
|
11092
|
+
return qf(e.x, e.y, t.x, t.y, n.minX, n.minY, n.maxX, n.minY) || qf(e.x, e.y, t.x, t.y, n.maxX, n.minY, n.maxX, n.maxY) || qf(e.x, e.y, t.x, t.y, n.maxX, n.maxY, n.minX, n.maxY) || qf(e.x, e.y, t.x, t.y, n.minX, n.maxY, n.minX, n.minY);
|
|
11043
11093
|
}
|
|
11044
|
-
function
|
|
11045
|
-
let a =
|
|
11094
|
+
function Zf(e, t, n, r, i = new U()) {
|
|
11095
|
+
let a = Ef.copy(t).applyMatrix4(e.matrixWorld).project(n);
|
|
11046
11096
|
return i.set((a.x + 1) / 2 * r.width + r.left, (-a.y + 1) / 2 * r.height + r.top);
|
|
11047
11097
|
}
|
|
11048
|
-
function
|
|
11098
|
+
function Qf(e, t, n, r, i) {
|
|
11049
11099
|
let a = Infinity, o = -Infinity, s = Infinity, c = -Infinity, l = 0;
|
|
11050
|
-
for (let u = 0; u < 2; u++) for (let d = 0; d < 2; d++) for (let f = 0; f < 2; f++)
|
|
11100
|
+
for (let u = 0; u < 2; u++) for (let d = 0; d < 2; d++) for (let f = 0; f < 2; f++) Df.set(u ? t.max.x : t.min.x, d ? t.max.y : t.min.y, f ? t.max.z : t.min.z), Zf(e, Df, r, i, Of), a = Math.min(a, Of.x), o = Math.max(o, Of.x), s = Math.min(s, Of.y), c = Math.max(c, Of.y), Wf(Of, n) && (l += 1);
|
|
11051
11101
|
return o < n.minX || a > n.maxX || c < n.minY || s > n.maxY ? ft : l === 8 ? lt : ut;
|
|
11052
11102
|
}
|
|
11053
|
-
function
|
|
11103
|
+
function $f(e, t, n, r) {
|
|
11054
11104
|
let i = Infinity, a = -Infinity, o = Infinity, s = -Infinity;
|
|
11055
|
-
for (let c = 0; c < 2; c++) for (let l = 0; l < 2; l++) for (let u = 0; u < 2; u++)
|
|
11105
|
+
for (let c = 0; c < 2; c++) for (let l = 0; l < 2; l++) for (let u = 0; u < 2; u++) Df.set(c ? t.max.x : t.min.x, l ? t.max.y : t.min.y, u ? t.max.z : t.min.z), Zf(e, Df, n, r, Of), i = Math.min(i, Of.x), a = Math.max(a, Of.x), o = Math.min(o, Of.y), s = Math.max(s, Of.y);
|
|
11056
11106
|
return {
|
|
11057
11107
|
minX: i,
|
|
11058
11108
|
minY: o,
|
|
@@ -11060,41 +11110,41 @@ function Jf(e, t, n, r) {
|
|
|
11060
11110
|
maxY: s
|
|
11061
11111
|
};
|
|
11062
11112
|
}
|
|
11063
|
-
function
|
|
11113
|
+
function ep(e, t) {
|
|
11064
11114
|
return !(e.maxX < t.minX || e.minX > t.maxX || e.maxY < t.minY || e.minY > t.maxY);
|
|
11065
11115
|
}
|
|
11066
|
-
function
|
|
11116
|
+
function tp(e, t, n, r) {
|
|
11067
11117
|
e.geometry.boundingBox || e.geometry.computeBoundingBox();
|
|
11068
11118
|
let i = e.geometry.boundingBox;
|
|
11069
|
-
return i ?
|
|
11119
|
+
return i ? ep($f(e, i, n, r), t) : !0;
|
|
11070
11120
|
}
|
|
11071
|
-
function
|
|
11121
|
+
function np(e, t, n) {
|
|
11072
11122
|
let r = e.get(t);
|
|
11073
11123
|
r || (r = /* @__PURE__ */ new Set(), e.set(t, r)), r.add(n);
|
|
11074
11124
|
}
|
|
11075
|
-
function
|
|
11125
|
+
function rp(e) {
|
|
11076
11126
|
let t = 0;
|
|
11077
11127
|
return e.forEach((e) => {
|
|
11078
11128
|
t += e.size;
|
|
11079
11129
|
}), t;
|
|
11080
11130
|
}
|
|
11081
|
-
function
|
|
11131
|
+
function ip(e, t, n, r = []) {
|
|
11082
11132
|
let i = e.geometry, a = i.index, o = i.attributes.ids, s = i.attributes.position;
|
|
11083
11133
|
if (!a || !o || !s) return;
|
|
11084
11134
|
let c = t * 3;
|
|
11085
|
-
r.length && (
|
|
11135
|
+
r.length && (Nf.fromBufferAttribute(s, a.getX(c)), Pf.fromBufferAttribute(s, a.getX(c + 1)), Ff.fromBufferAttribute(s, a.getX(c + 2)), !zf(e, Nf, Pf, Ff, r)) || np(n, If(e), o.getX(a.getX(c)));
|
|
11086
11136
|
}
|
|
11087
|
-
function
|
|
11137
|
+
function ap({ model: e, camera: t, viewport: n, rect: r, candidateIdsByModel: i, clippingPlanes: a, profile: o }) {
|
|
11088
11138
|
let s = performance.now(), c = /* @__PURE__ */ new Map(), l = new W();
|
|
11089
11139
|
e.traverse((e) => {
|
|
11090
11140
|
let s = e;
|
|
11091
|
-
if (!s.isMesh || !
|
|
11141
|
+
if (!s.isMesh || !Lf(s)) return;
|
|
11092
11142
|
let u = s.geometry.attributes.ids, d = s.geometry.attributes.position;
|
|
11093
11143
|
if (!(!u || !d)) {
|
|
11094
11144
|
o && (o.containedVerticesVisited += u.count);
|
|
11095
11145
|
for (let e = 0; e < u.count; e++) {
|
|
11096
|
-
let f =
|
|
11097
|
-
if (!i.get(f)?.has(p) || (l.fromBufferAttribute(d, e), !
|
|
11146
|
+
let f = If(s), p = u.getX(e);
|
|
11147
|
+
if (!i.get(f)?.has(p) || (l.fromBufferAttribute(d, e), !Rf(s, l, a))) continue;
|
|
11098
11148
|
o && (o.containedCandidateVertices += 1);
|
|
11099
11149
|
let m = `${f}:${p}`, h = c.get(m);
|
|
11100
11150
|
h || (h = {
|
|
@@ -11102,23 +11152,23 @@ function ep({ model: e, camera: t, viewport: n, rect: r, candidateIdsByModel: i,
|
|
|
11102
11152
|
inside: 0,
|
|
11103
11153
|
modelID: f,
|
|
11104
11154
|
total: 0
|
|
11105
|
-
}, c.set(m, h)), h.total += 1,
|
|
11155
|
+
}, c.set(m, h)), h.total += 1, Wf(Zf(s, l, t, n), r) && (h.inside += 1);
|
|
11106
11156
|
}
|
|
11107
11157
|
}
|
|
11108
11158
|
});
|
|
11109
11159
|
let u = /* @__PURE__ */ new Map();
|
|
11110
11160
|
return c.forEach((e) => {
|
|
11111
|
-
e.total > 0 && e.total === e.inside &&
|
|
11161
|
+
e.total > 0 && e.total === e.inside && np(u, e.modelID, e.id);
|
|
11112
11162
|
}), o && (o.containedIdsMs += performance.now() - s), u;
|
|
11113
11163
|
}
|
|
11114
|
-
function
|
|
11164
|
+
function op({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect: i, mode: a, profile: o }) {
|
|
11115
11165
|
let s = performance.now(), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
|
|
11116
11166
|
if (!e) return c;
|
|
11117
|
-
let u =
|
|
11167
|
+
let u = Bf(r), d = performance.now();
|
|
11118
11168
|
e.updateMatrixWorld(!0), t.updateMatrixWorld(), o && (o.matrixUpdateMs += performance.now() - d), e.traverse((e) => {
|
|
11119
11169
|
let r = e;
|
|
11120
11170
|
if (!r.isMesh) return;
|
|
11121
|
-
if (o && (o.meshCount += 1), !
|
|
11171
|
+
if (o && (o.meshCount += 1), !Lf(r)) {
|
|
11122
11172
|
o && (o.skippedMeshCount += 1);
|
|
11123
11173
|
return;
|
|
11124
11174
|
}
|
|
@@ -11127,7 +11177,7 @@ function tp({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
|
|
|
11127
11177
|
o && (o.skippedMeshCount += 1);
|
|
11128
11178
|
return;
|
|
11129
11179
|
}
|
|
11130
|
-
let d = performance.now(), f =
|
|
11180
|
+
let d = performance.now(), f = tp(r, i, t, u);
|
|
11131
11181
|
if (o && (o.boundsCheckMs += performance.now() - d), !f) {
|
|
11132
11182
|
o && (o.skippedMeshCount += 1);
|
|
11133
11183
|
return;
|
|
@@ -11135,26 +11185,26 @@ function tp({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
|
|
|
11135
11185
|
let p = performance.now();
|
|
11136
11186
|
s.shapecast({
|
|
11137
11187
|
intersectsBounds: (e) => {
|
|
11138
|
-
let n = performance.now(), a =
|
|
11188
|
+
let n = performance.now(), a = Qf(r, e, i, t, u);
|
|
11139
11189
|
return o && (o.intersectsBoundsCalls += 1, o.intersectsBoundsMs += performance.now() - n), a;
|
|
11140
11190
|
},
|
|
11141
11191
|
intersectsRange: (e, t, i) => {
|
|
11142
11192
|
let u = performance.now();
|
|
11143
11193
|
if (o && (o.intersectsRangeCalls += 1), !i) return o && (o.intersectsRangeMs += performance.now() - u), !1;
|
|
11144
|
-
for (let i = e; i < e + t; i++)
|
|
11194
|
+
for (let i = e; i < e + t; i++) ip(r, s.resolveTriangleIndex(i), a === "contains" ? l : c, n);
|
|
11145
11195
|
return o && (o.intersectsRangeMs += performance.now() - u), !1;
|
|
11146
11196
|
},
|
|
11147
11197
|
intersectsTriangle: (e, s, d) => {
|
|
11148
11198
|
let f = performance.now();
|
|
11149
11199
|
if (o && (o.intersectsTriangleCalls += 1), !d) {
|
|
11150
|
-
let n = performance.now(), a =
|
|
11151
|
-
if (o && (o.triangleProjectionMs += performance.now() - n), !
|
|
11200
|
+
let n = performance.now(), a = Zf(r, e.a, t, u), s = Zf(r, e.b, t, u), c = Zf(r, e.c, t, u);
|
|
11201
|
+
if (o && (o.triangleProjectionMs += performance.now() - n), !Yf(a, s, c, i)) return o && (o.intersectsTriangleMs += performance.now() - f), !1;
|
|
11152
11202
|
}
|
|
11153
|
-
return a === "contains" ?
|
|
11203
|
+
return a === "contains" ? ip(r, s, l, n) : ip(r, s, c, n), o && (o.intersectsTriangleMs += performance.now() - f), !1;
|
|
11154
11204
|
}
|
|
11155
11205
|
}), o && (o.shapecastMs += performance.now() - p);
|
|
11156
11206
|
});
|
|
11157
|
-
let f = a === "contains" ?
|
|
11207
|
+
let f = a === "contains" ? ap({
|
|
11158
11208
|
model: e,
|
|
11159
11209
|
camera: t,
|
|
11160
11210
|
clippingPlanes: n,
|
|
@@ -11163,19 +11213,19 @@ function tp({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
|
|
|
11163
11213
|
candidateIdsByModel: l,
|
|
11164
11214
|
profile: o
|
|
11165
11215
|
}) : c;
|
|
11166
|
-
return o && (o.candidateIds =
|
|
11216
|
+
return o && (o.candidateIds = rp(l), o.selectedIds = rp(f), o.totalMs = performance.now() - s), f;
|
|
11167
11217
|
}
|
|
11168
|
-
function
|
|
11169
|
-
let t =
|
|
11218
|
+
function sp(e) {
|
|
11219
|
+
let t = Vf(e.mode);
|
|
11170
11220
|
return {
|
|
11171
|
-
ids:
|
|
11221
|
+
ids: op({
|
|
11172
11222
|
...e,
|
|
11173
11223
|
profile: t
|
|
11174
11224
|
}),
|
|
11175
11225
|
profile: t
|
|
11176
11226
|
};
|
|
11177
11227
|
}
|
|
11178
|
-
function
|
|
11228
|
+
function cp(e) {
|
|
11179
11229
|
return e === "contains" ? {
|
|
11180
11230
|
border: "rgb(37, 99, 235)",
|
|
11181
11231
|
background: "rgba(37, 99, 235, 0.16)"
|
|
@@ -11184,40 +11234,40 @@ function rp(e) {
|
|
|
11184
11234
|
background: "rgba(22, 163, 74, 0.16)"
|
|
11185
11235
|
};
|
|
11186
11236
|
}
|
|
11187
|
-
function
|
|
11188
|
-
let r =
|
|
11237
|
+
function lp(e, t, n) {
|
|
11238
|
+
let r = cp(Uf(t, n));
|
|
11189
11239
|
if (!e.current) {
|
|
11190
11240
|
let t = document.createElement("div");
|
|
11191
11241
|
t.style.position = "fixed", t.style.pointerEvents = "none", t.style.zIndex = "10", e.current = t, document.body.appendChild(t);
|
|
11192
11242
|
}
|
|
11193
|
-
let i =
|
|
11243
|
+
let i = Hf(t, n);
|
|
11194
11244
|
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`;
|
|
11195
11245
|
}
|
|
11196
|
-
function
|
|
11246
|
+
function up(e) {
|
|
11197
11247
|
e.current?.remove(), e.current = null;
|
|
11198
11248
|
}
|
|
11199
11249
|
//#endregion
|
|
11200
11250
|
//#region src/viewer/Selector/useSelector.tsx
|
|
11201
|
-
var
|
|
11202
|
-
function
|
|
11203
|
-
if (Array.isArray(e)) return e.flatMap((e) =>
|
|
11251
|
+
var dp = 40;
|
|
11252
|
+
function fp(e) {
|
|
11253
|
+
if (Array.isArray(e)) return e.flatMap((e) => fp(e));
|
|
11204
11254
|
let t = e.userData;
|
|
11205
11255
|
return t.shaders ? Array.from(t.shaders) : t.shader ? [t.shader] : [];
|
|
11206
11256
|
}
|
|
11207
|
-
function
|
|
11257
|
+
function pp(e) {
|
|
11208
11258
|
let t = x(e);
|
|
11209
11259
|
return t.current = e, t;
|
|
11210
11260
|
}
|
|
11211
|
-
function
|
|
11212
|
-
|
|
11261
|
+
function mp(e, t) {
|
|
11262
|
+
fp(e)?.forEach((e) => {
|
|
11213
11263
|
let n = e.uniforms.preSelectionId;
|
|
11214
11264
|
n && (n.value = t);
|
|
11215
11265
|
});
|
|
11216
11266
|
}
|
|
11217
|
-
function
|
|
11267
|
+
function hp(e) {
|
|
11218
11268
|
return Number(e.current?.modelID ?? 0);
|
|
11219
11269
|
}
|
|
11220
|
-
function
|
|
11270
|
+
function gp(e) {
|
|
11221
11271
|
let t = e;
|
|
11222
11272
|
for (; t;) {
|
|
11223
11273
|
let e = t.modelID ?? t.userData.modelID;
|
|
@@ -11226,7 +11276,7 @@ function dp(e) {
|
|
|
11226
11276
|
}
|
|
11227
11277
|
return 0;
|
|
11228
11278
|
}
|
|
11229
|
-
function
|
|
11279
|
+
function _p(e) {
|
|
11230
11280
|
let t = e;
|
|
11231
11281
|
for (; t;) {
|
|
11232
11282
|
if (!t.visible) return !1;
|
|
@@ -11234,7 +11284,7 @@ function fp(e) {
|
|
|
11234
11284
|
}
|
|
11235
11285
|
return !0;
|
|
11236
11286
|
}
|
|
11237
|
-
function
|
|
11287
|
+
function vp(e) {
|
|
11238
11288
|
if (!e) return "";
|
|
11239
11289
|
let t = [
|
|
11240
11290
|
e.uuid,
|
|
@@ -11247,24 +11297,24 @@ function pp(e) {
|
|
|
11247
11297
|
});
|
|
11248
11298
|
}), t.join(":");
|
|
11249
11299
|
}
|
|
11250
|
-
function
|
|
11251
|
-
if (!
|
|
11300
|
+
function yp(e) {
|
|
11301
|
+
if (!_p(e.object) || !(e.object instanceof B) || e.faceIndex === void 0 || e.faceIndex === null) return !1;
|
|
11252
11302
|
let t = e.object.geometry;
|
|
11253
11303
|
return !!(t.index && t.attributes.ids);
|
|
11254
11304
|
}
|
|
11255
|
-
function
|
|
11256
|
-
if (!
|
|
11305
|
+
function bp(e) {
|
|
11306
|
+
if (!yp(e)) return null;
|
|
11257
11307
|
let t = e.object, n = t.geometry, r = n.index.getX(e.faceIndex * 3), i = n.attributes.ids;
|
|
11258
11308
|
if (r >= i.count) return null;
|
|
11259
11309
|
let a = n.attributes.modelID;
|
|
11260
11310
|
return {
|
|
11261
11311
|
elementID: i.getX(r),
|
|
11262
11312
|
hit: e,
|
|
11263
|
-
modelID: a ? a.getX(r) :
|
|
11313
|
+
modelID: a ? a.getX(r) : gp(t)
|
|
11264
11314
|
};
|
|
11265
11315
|
}
|
|
11266
|
-
function
|
|
11267
|
-
let c = x("end"), l = K((e) => e.selected), u = K((e) => e.setSelected), d = K((e) => e.addSelected), f = K((e) => e.removeSelected), p = K((e) => e.showStats), m = K((e) => e.preselectionEnabled), h =
|
|
11316
|
+
function xp(e, t, n, r, i, a, o, s = 0) {
|
|
11317
|
+
let c = x("end"), l = K((e) => e.selected), u = K((e) => e.setSelected), d = K((e) => e.addSelected), f = K((e) => e.removeSelected), p = K((e) => e.showStats), m = K((e) => e.preselectionEnabled), h = pp(m), g = Tt(), 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({
|
|
11268
11318
|
meshesByModel: /* @__PURE__ */ new Map(),
|
|
11269
11319
|
root: null,
|
|
11270
11320
|
version: ""
|
|
@@ -11278,12 +11328,12 @@ function gp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11278
11328
|
let n = t.current;
|
|
11279
11329
|
n && (n.cancel(), n.setOrbitPoint(e.x, e.y, e.z));
|
|
11280
11330
|
}, M = () => {
|
|
11281
|
-
let t = e.current, n =
|
|
11331
|
+
let t = e.current, n = vp(t), r = A.current;
|
|
11282
11332
|
if (r.root !== t || r.version !== n) {
|
|
11283
11333
|
let e = /* @__PURE__ */ new Map();
|
|
11284
11334
|
return t?.traverse((t) => {
|
|
11285
11335
|
if (!(t instanceof B) || !t.geometry.index || !t.geometry.attributes.ids) return;
|
|
11286
|
-
let n =
|
|
11336
|
+
let n = gp(t), r = e.get(n) ?? [];
|
|
11287
11337
|
r.push(t), e.set(n, r);
|
|
11288
11338
|
}), A.current = {
|
|
11289
11339
|
meshesByModel: e,
|
|
@@ -11294,7 +11344,7 @@ function gp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11294
11344
|
return r;
|
|
11295
11345
|
}, N = () => Array.from(M().meshesByModel.values()).flat(), oe = (e) => M().meshesByModel.get(e) ?? [], se = (e) => {
|
|
11296
11346
|
e && oe(e.modelID).forEach((e) => {
|
|
11297
|
-
e.preselected = !1,
|
|
11347
|
+
e.preselected = !1, mp(e.material, -1);
|
|
11298
11348
|
});
|
|
11299
11349
|
}, ce = () => {
|
|
11300
11350
|
a?.(null), se(te.current), te.current = null;
|
|
@@ -11309,13 +11359,13 @@ function gp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11309
11359
|
elementID: t,
|
|
11310
11360
|
modelID: e
|
|
11311
11361
|
}), oe(e).forEach((e) => {
|
|
11312
|
-
e.preselected = !0,
|
|
11362
|
+
e.preselected = !0, mp(e.material, t);
|
|
11313
11363
|
}), te.current = {
|
|
11314
11364
|
elementID: t,
|
|
11315
11365
|
modelID: e
|
|
11316
11366
|
});
|
|
11317
11367
|
}, ue = () => {
|
|
11318
|
-
v.current = null, b.current = !1,
|
|
11368
|
+
v.current = null, b.current = !1, up(y), t.current && (t.current.enabled = !0);
|
|
11319
11369
|
}, P = (e) => {
|
|
11320
11370
|
if (re()) {
|
|
11321
11371
|
ie(), ce();
|
|
@@ -11357,7 +11407,7 @@ function gp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11357
11407
|
return;
|
|
11358
11408
|
}
|
|
11359
11409
|
if (O.current = e, E.current !== null) return;
|
|
11360
|
-
let t = de() - T.current, n = Math.max(0,
|
|
11410
|
+
let t = de() - T.current, n = Math.max(0, dp - t);
|
|
11361
11411
|
E.current = window.setTimeout(() => {
|
|
11362
11412
|
E.current = null;
|
|
11363
11413
|
let e = O.current;
|
|
@@ -11394,7 +11444,7 @@ function gp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11394
11444
|
c.current = "end";
|
|
11395
11445
|
return;
|
|
11396
11446
|
}
|
|
11397
|
-
let n = t.shiftKey, r = t.ctrlKey, i = xe(t), a, o =
|
|
11447
|
+
let n = t.shiftKey, r = t.ctrlKey, i = xe(t), a, o = hp(e), s = null;
|
|
11398
11448
|
if (i && (o = i.modelID, s = i.hit.point, a = i.elementID), r) {
|
|
11399
11449
|
a !== void 0 && f(o, [a]);
|
|
11400
11450
|
return;
|
|
@@ -11412,7 +11462,7 @@ function gp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11412
11462
|
}
|
|
11413
11463
|
if (!v.current) return;
|
|
11414
11464
|
let t = new U(e.clientX, e.clientY), n = Math.abs(t.x - v.current.x), r = Math.abs(t.y - v.current.y);
|
|
11415
|
-
n < 6 && r < 6 || (b.current ||= !0, e.preventDefault(),
|
|
11465
|
+
n < 6 && r < 6 || (b.current ||= !0, e.preventDefault(), lp(y, v.current, t));
|
|
11416
11466
|
}, ve = (r) => {
|
|
11417
11467
|
if (ne()) {
|
|
11418
11468
|
ue();
|
|
@@ -11420,12 +11470,12 @@ function gp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11420
11470
|
}
|
|
11421
11471
|
if (!v.current) return;
|
|
11422
11472
|
I.current = pe();
|
|
11423
|
-
let i = b.current, a = new U(r.clientX, r.clientY), o =
|
|
11424
|
-
if (v.current = null, b.current = !1,
|
|
11473
|
+
let i = b.current, a = new U(r.clientX, r.clientY), o = Hf(v.current, a), s = Uf(v.current, a);
|
|
11474
|
+
if (v.current = null, b.current = !1, up(y), t.current && setTimeout(() => {
|
|
11425
11475
|
t.current && (t.current.enabled = !0);
|
|
11426
11476
|
}, 100), !i) return;
|
|
11427
11477
|
S.current = !0, r.preventDefault();
|
|
11428
|
-
let { ids: c, profile: l } =
|
|
11478
|
+
let { ids: c, profile: l } = sp({
|
|
11429
11479
|
model: e.current,
|
|
11430
11480
|
camera: fe,
|
|
11431
11481
|
clippingPlanes: n.getActiveClippingPlanes(),
|
|
@@ -11445,7 +11495,7 @@ function gp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11445
11495
|
let i = Array.isArray(t) ? t.filter((e) => e.visible) : t ? [t] : [];
|
|
11446
11496
|
return i.length ? n.getIntersection(!1, {
|
|
11447
11497
|
event: e,
|
|
11448
|
-
filter:
|
|
11498
|
+
filter: yp,
|
|
11449
11499
|
firstHitOnly: r,
|
|
11450
11500
|
object: i,
|
|
11451
11501
|
recursive: !0
|
|
@@ -11453,11 +11503,11 @@ function gp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11453
11503
|
}, ye = () => i?.().filter((e) => e.visible) ?? [], be = (e, t) => {
|
|
11454
11504
|
let n = R(e, t, !0);
|
|
11455
11505
|
for (let e of n) {
|
|
11456
|
-
let t =
|
|
11506
|
+
let t = bp(e);
|
|
11457
11507
|
if (t) return t;
|
|
11458
11508
|
}
|
|
11459
11509
|
return null;
|
|
11460
|
-
}, xe = (e) => be(e, ye()) || be(e, N()), z =
|
|
11510
|
+
}, xe = (e) => be(e, ye()) || be(e, N()), z = pp({
|
|
11461
11511
|
clearPreselection: ce,
|
|
11462
11512
|
onBoxPointerDown: ge,
|
|
11463
11513
|
onBoxPointerMove: _e,
|
|
@@ -11489,7 +11539,7 @@ function gp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11489
11539
|
e.ctrlKey && e.preventDefault();
|
|
11490
11540
|
}
|
|
11491
11541
|
return () => {
|
|
11492
|
-
|
|
11542
|
+
up(y), E.current !== null && (window.clearTimeout(E.current), E.current = null), O.current = null, z.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));
|
|
11493
11543
|
};
|
|
11494
11544
|
}, [
|
|
11495
11545
|
t,
|
|
@@ -11501,30 +11551,30 @@ function gp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11501
11551
|
}
|
|
11502
11552
|
//#endregion
|
|
11503
11553
|
//#region src/viewer/Camera/useCameraFit.tsx
|
|
11504
|
-
var
|
|
11505
|
-
function
|
|
11506
|
-
let n = e.top === e.bottom ? 1 : Math.abs((e.right - e.left) / (e.top - e.bottom)), r = Math.max(
|
|
11554
|
+
var Sp = new W(1, 1, 1).normalize(), Cp = 1.18, wp = .001, Tp = .001, Ep = 4, Dp = 1.45;
|
|
11555
|
+
function Op(e, t) {
|
|
11556
|
+
let n = e.top === e.bottom ? 1 : Math.abs((e.right - e.left) / (e.top - e.bottom)), r = Math.max(Tp, t) * Math.max(e.zoom, 1e-4), i = r * n;
|
|
11507
11557
|
e.left = -i / 2, e.right = i / 2, e.top = r / 2, e.bottom = -r / 2;
|
|
11508
11558
|
}
|
|
11509
|
-
function
|
|
11559
|
+
function kp(e, t) {
|
|
11510
11560
|
let n = xe.degToRad(e.fov), r = 2 * Math.atan(Math.tan(n / 2) * e.aspect);
|
|
11511
|
-
return t / Math.sin(Math.min(n, r) / 2) *
|
|
11561
|
+
return t / Math.sin(Math.min(n, r) / 2) * Cp;
|
|
11512
11562
|
}
|
|
11513
|
-
function
|
|
11563
|
+
function Ap() {
|
|
11514
11564
|
let { camera: e } = D();
|
|
11515
11565
|
return h((t, n, r) => {
|
|
11516
11566
|
if (!t.current || !(e instanceof Ae) && !(e instanceof ke)) return;
|
|
11517
11567
|
let i = new A().setFromObject(t.current);
|
|
11518
11568
|
if (i.isEmpty()) return;
|
|
11519
|
-
let a = i.getCenter(new W()), o = i.getBoundingSphere(new Ue()), s = n.current, c = e instanceof Ae ?
|
|
11569
|
+
let a = i.getCenter(new W()), o = i.getBoundingSphere(new Ue()), s = n.current, c = e instanceof Ae ? kp(e, o.radius) : Math.max(o.radius * Ep, wp);
|
|
11520
11570
|
e.up.set(0, 1, 0);
|
|
11521
|
-
let l = a.clone().addScaledVector(
|
|
11522
|
-
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 ke && s.fitToSphere(new Ue(a, o.radius *
|
|
11571
|
+
let l = a.clone().addScaledVector(Sp, c);
|
|
11572
|
+
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 ke && s.fitToSphere(new Ue(a, o.radius * Dp), !1), s.update(0), e.updateMatrixWorld(!0)) : (e.position.copy(l), e.lookAt(a)), e instanceof ke && (s || (e.zoom = 1, Op(e, o.radius * 2 * Dp))), e.updateProjectionMatrix(), e.updateMatrixWorld(!0), r.current && (r.current.position.copy(a).addScaledVector(Sp, c * .8), r.current.lookAt(a));
|
|
11523
11573
|
}, [e]);
|
|
11524
11574
|
}
|
|
11525
11575
|
//#endregion
|
|
11526
11576
|
//#region src/viewer/Camera/FirstPersonControls.tsx
|
|
11527
|
-
var
|
|
11577
|
+
var jp = 1, Mp = .004, Np = -Math.PI / 2 + .01, Pp = Math.PI / 2 - .01, Fp = .24, Ip = 4, Lp = 1e4, Rp = .5, zp = .01, Bp = 1.5, Vp = 1500, Hp = 3, Up = new Set([
|
|
11528
11578
|
"KeyW",
|
|
11529
11579
|
"KeyA",
|
|
11530
11580
|
"KeyS",
|
|
@@ -11533,62 +11583,62 @@ var Ep = 1, Dp = .004, Op = -Math.PI / 2 + .01, kp = Math.PI / 2 - .01, Ap = .24
|
|
|
11533
11583
|
"ShiftRight",
|
|
11534
11584
|
"ControlLeft",
|
|
11535
11585
|
"ControlRight"
|
|
11536
|
-
]),
|
|
11537
|
-
function
|
|
11586
|
+
]), Wp = new Set(["AltLeft", "AltRight"]), Gp = new W(), Kp = new W(), qp = new W(), Jp = new W(), Yp = new W(0, -1, 0);
|
|
11587
|
+
function Xp(e, t) {
|
|
11538
11588
|
return typeof e == "number" && Number.isFinite(e) ? e : t;
|
|
11539
11589
|
}
|
|
11540
|
-
function
|
|
11590
|
+
function Zp(e, t, n) {
|
|
11541
11591
|
return Math.min(n, Math.max(t, e));
|
|
11542
11592
|
}
|
|
11543
|
-
function
|
|
11544
|
-
return
|
|
11593
|
+
function Qp(e, t, n, r) {
|
|
11594
|
+
return Zp(Xp(e, t), n, r);
|
|
11545
11595
|
}
|
|
11546
|
-
function
|
|
11596
|
+
function $p(e) {
|
|
11547
11597
|
if (!(e instanceof HTMLElement)) return !1;
|
|
11548
11598
|
let t = e.tagName.toLowerCase();
|
|
11549
11599
|
return e.isContentEditable || t === "input" || t === "textarea" || t === "select";
|
|
11550
11600
|
}
|
|
11551
|
-
function
|
|
11601
|
+
function em(e) {
|
|
11552
11602
|
if (!e) return {
|
|
11553
|
-
eyeHeight:
|
|
11554
|
-
groundMaxDistance:
|
|
11555
|
-
moveSpeed:
|
|
11603
|
+
eyeHeight: Bp,
|
|
11604
|
+
groundMaxDistance: Bp * Hp,
|
|
11605
|
+
moveSpeed: Ip
|
|
11556
11606
|
};
|
|
11557
11607
|
let t = new A().setFromObject(e);
|
|
11558
11608
|
if (t.isEmpty()) return {
|
|
11559
|
-
eyeHeight:
|
|
11560
|
-
groundMaxDistance:
|
|
11561
|
-
moveSpeed:
|
|
11609
|
+
eyeHeight: Bp,
|
|
11610
|
+
groundMaxDistance: Bp * Hp,
|
|
11611
|
+
moveSpeed: Ip
|
|
11562
11612
|
};
|
|
11563
|
-
let n = t.getBoundingSphere(new Ue()).radius, r = Math.min(
|
|
11613
|
+
let n = t.getBoundingSphere(new Ue()).radius, r = Math.min(Vp, Math.max(Bp, n * zp));
|
|
11564
11614
|
return {
|
|
11565
11615
|
eyeHeight: r,
|
|
11566
|
-
groundMaxDistance: r *
|
|
11567
|
-
moveSpeed: Math.min(
|
|
11616
|
+
groundMaxDistance: r * Hp,
|
|
11617
|
+
moveSpeed: Math.min(Lp, Math.max(Ip, n * Fp))
|
|
11568
11618
|
};
|
|
11569
11619
|
}
|
|
11570
|
-
function
|
|
11571
|
-
let n =
|
|
11620
|
+
function tm(e, t) {
|
|
11621
|
+
let n = em(e), r = Qp(t.eyeHeight, n.eyeHeight, .01, Vp), i = Qp(t.groundSnapDistanceRatio, Hp, .1, 100);
|
|
11572
11622
|
return {
|
|
11573
11623
|
eyeHeight: r,
|
|
11574
|
-
groundCheckInterval: Math.round(
|
|
11624
|
+
groundCheckInterval: Math.round(Qp(t.groundCheckInterval, jp, 1, 120)),
|
|
11575
11625
|
groundMaxDistance: r * i,
|
|
11576
|
-
lookSensitivity:
|
|
11577
|
-
moveSpeed:
|
|
11626
|
+
lookSensitivity: Qp(t.lookSensitivity, Mp, 1e-4, .1),
|
|
11627
|
+
moveSpeed: Qp(t.speed, n.moveSpeed, .01, Lp)
|
|
11578
11628
|
};
|
|
11579
11629
|
}
|
|
11580
|
-
function
|
|
11581
|
-
return e.getWorldDirection(
|
|
11630
|
+
function nm(e) {
|
|
11631
|
+
return e.getWorldDirection(Gp), Gp.y = 0, Gp.lengthSq() === 0 && Gp.set(0, 0, -1), Gp.normalize();
|
|
11582
11632
|
}
|
|
11583
|
-
function
|
|
11584
|
-
return
|
|
11633
|
+
function rm(e) {
|
|
11634
|
+
return Kp.copy(e).cross(im).normalize(), Kp.lengthSq() === 0 && Kp.set(1, 0, 0), Kp;
|
|
11585
11635
|
}
|
|
11586
|
-
var
|
|
11587
|
-
function
|
|
11636
|
+
var im = new W(0, 1, 0);
|
|
11637
|
+
function am(e, t) {
|
|
11588
11638
|
let n = t.current;
|
|
11589
|
-
n && (e.getWorldDirection(
|
|
11639
|
+
n && (e.getWorldDirection(Jp), Jp.add(e.position), n.enabled = !0, n.cancel(), n.updateCameraUp(), n.setLookAt(e.position.x, e.position.y, e.position.z, Jp.x, Jp.y, Jp.z, !1), n.stop(), n.update(0));
|
|
11590
11640
|
}
|
|
11591
|
-
function
|
|
11641
|
+
function om(e) {
|
|
11592
11642
|
return e.find((e) => {
|
|
11593
11643
|
let t = e.object;
|
|
11594
11644
|
for (; t;) {
|
|
@@ -11598,42 +11648,42 @@ function tm(e) {
|
|
|
11598
11648
|
return !0;
|
|
11599
11649
|
});
|
|
11600
11650
|
}
|
|
11601
|
-
function
|
|
11602
|
-
let n =
|
|
11603
|
-
return
|
|
11651
|
+
function sm(e, t) {
|
|
11652
|
+
let n = rm(nm(e));
|
|
11653
|
+
return qp.set(0, 0, 0), t.has("KeyW") && (e.getWorldDirection(Gp), qp.add(Gp)), t.has("KeyS") && (e.getWorldDirection(Gp), qp.sub(Gp)), t.has("KeyD") && qp.add(n), t.has("KeyA") && qp.sub(n), (t.has("ShiftLeft") || t.has("ShiftRight")) && qp.add(im), (t.has("ControlLeft") || t.has("ControlRight")) && qp.sub(im), qp;
|
|
11604
11654
|
}
|
|
11605
|
-
function
|
|
11655
|
+
function cm(e) {
|
|
11606
11656
|
return e.has("ShiftLeft") || e.has("ShiftRight") || e.has("ControlLeft") || e.has("ControlRight");
|
|
11607
11657
|
}
|
|
11608
|
-
function
|
|
11609
|
-
let a = D((e) => e.camera), o = D((e) => e.gl), s = D((e) => e.invalidate), c = Tt(), l = x(null), u = x(/* @__PURE__ */ new Set()), d = x(
|
|
11658
|
+
function lm({ active: e, activeRef: t, controlRef: n, modelRef: r, settings: i }) {
|
|
11659
|
+
let a = D((e) => e.camera), o = D((e) => e.gl), s = D((e) => e.invalidate), c = Tt(), l = x(null), u = x(/* @__PURE__ */ new Set()), d = x(Bp), f = x(0), p = x(Bp * Hp), m = x(jp), h = x(Mp), g = x(!1), v = x(!1), y = x(Ip), S = x({
|
|
11610
11660
|
pitch: 0,
|
|
11611
11661
|
yaw: 0
|
|
11612
11662
|
}), C = x(null), w = b(() => new Ie(), []);
|
|
11613
11663
|
return _(() => {
|
|
11614
11664
|
t.current = e;
|
|
11615
11665
|
}, [e, t]), _(() => {
|
|
11616
|
-
let e =
|
|
11666
|
+
let e = tm(r.current, i);
|
|
11617
11667
|
d.current = e.eyeHeight, m.current = e.groundCheckInterval, p.current = e.groundMaxDistance, h.current = e.lookSensitivity, y.current = e.moveSpeed;
|
|
11618
11668
|
}, [r, i]), _(() => {
|
|
11619
11669
|
let e = o.domElement, i = e.style.outline, c = e.style.userSelect;
|
|
11620
11670
|
e.tabIndex = Math.max(e.tabIndex, 0), e.style.outline = "none", e.style.userSelect = "none";
|
|
11621
11671
|
let _ = (e, t) => {
|
|
11622
11672
|
let n = S.current, r = h.current;
|
|
11623
|
-
n.yaw -= e * r, n.pitch -= t * r, n.pitch = Math.max(
|
|
11673
|
+
n.yaw -= e * r, n.pitch -= t * r, n.pitch = Math.max(Np, Math.min(Pp, n.pitch)), a.quaternion.setFromEuler(new P(n.pitch, n.yaw, 0, "YXZ")), a.updateMatrixWorld(), s();
|
|
11624
11674
|
}, b = () => {
|
|
11625
11675
|
l.current !== null && (cancelAnimationFrame(l.current), l.current = null);
|
|
11626
11676
|
}, x = (e) => {
|
|
11627
11677
|
if (!t.current) return;
|
|
11628
11678
|
n.current?.cancel(), n.current && (n.current.enabled = !1);
|
|
11629
|
-
let i =
|
|
11679
|
+
let i = sm(a, u.current);
|
|
11630
11680
|
if (i.lengthSq() === 0) return;
|
|
11631
|
-
let o = v.current ?
|
|
11632
|
-
if (i.normalize().multiplyScalar(y.current * o * e), a.position.add(i), f.current += 1, v.current && !
|
|
11681
|
+
let o = v.current ? Rp : 1;
|
|
11682
|
+
if (i.normalize().multiplyScalar(y.current * o * e), a.position.add(i), f.current += 1, v.current && !cm(u.current) && f.current % m.current === 0) {
|
|
11633
11683
|
let e = w, t = e.firstHitOnly;
|
|
11634
|
-
e.firstHitOnly = !0, w.set(a.position,
|
|
11684
|
+
e.firstHitOnly = !0, w.set(a.position, Yp), w.far = p.current;
|
|
11635
11685
|
try {
|
|
11636
|
-
let e =
|
|
11686
|
+
let e = om(r.current ? w.intersectObject(r.current, !0) : []);
|
|
11637
11687
|
e && (a.position.y = e.point.y + d.current);
|
|
11638
11688
|
} finally {
|
|
11639
11689
|
e.firstHitOnly = t, w.far = Infinity;
|
|
@@ -11657,18 +11707,18 @@ function im({ active: e, activeRef: t, controlRef: n, modelRef: r, settings: i }
|
|
|
11657
11707
|
}, D = (n) => {
|
|
11658
11708
|
t.current && document.pointerLockElement === e && _(n.movementX, n.movementY);
|
|
11659
11709
|
}, O = (e) => {
|
|
11660
|
-
if (t.current &&
|
|
11661
|
-
if (
|
|
11710
|
+
if (t.current && !$p(e.target)) {
|
|
11711
|
+
if (Wp.has(e.code)) {
|
|
11662
11712
|
e.repeat || (v.current = !v.current), e.preventDefault(), e.stopPropagation();
|
|
11663
11713
|
return;
|
|
11664
11714
|
}
|
|
11665
|
-
|
|
11715
|
+
Up.has(e.code) && (e.preventDefault(), e.stopPropagation(), u.current.add(e.code), C(), s());
|
|
11666
11716
|
}
|
|
11667
11717
|
}, te = (e) => {
|
|
11668
|
-
|
|
11718
|
+
Up.has(e.code) && (u.current.delete(e.code), u.current.size || b());
|
|
11669
11719
|
};
|
|
11670
11720
|
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), () => {
|
|
11671
|
-
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(),
|
|
11721
|
+
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(), am(a, n), s();
|
|
11672
11722
|
};
|
|
11673
11723
|
}, [
|
|
11674
11724
|
a,
|
|
@@ -11688,14 +11738,14 @@ function im({ active: e, activeRef: t, controlRef: n, modelRef: r, settings: i }
|
|
|
11688
11738
|
C.current = c.getState().preselectionEnabled, c.getState().setPreselectionEnabled(!1);
|
|
11689
11739
|
let l = n.current;
|
|
11690
11740
|
l && (l.enabled = !1, l.cancel());
|
|
11691
|
-
let f =
|
|
11741
|
+
let f = tm(r.current, i);
|
|
11692
11742
|
d.current = f.eyeHeight, m.current = f.groundCheckInterval, p.current = f.groundMaxDistance, h.current = f.lookSensitivity, y.current = f.moveSpeed;
|
|
11693
11743
|
let g = new P().setFromQuaternion(a.quaternion, "YXZ");
|
|
11694
11744
|
return S.current = {
|
|
11695
11745
|
pitch: g.x,
|
|
11696
11746
|
yaw: g.y
|
|
11697
11747
|
}, () => {
|
|
11698
|
-
u.current.clear(), t(), document.pointerLockElement === o.domElement && document.exitPointerLock(),
|
|
11748
|
+
u.current.clear(), t(), document.pointerLockElement === o.domElement && document.exitPointerLock(), am(a, n), s();
|
|
11699
11749
|
};
|
|
11700
11750
|
}, [
|
|
11701
11751
|
e,
|
|
@@ -11710,8 +11760,8 @@ function im({ active: e, activeRef: t, controlRef: n, modelRef: r, settings: i }
|
|
|
11710
11760
|
}
|
|
11711
11761
|
//#endregion
|
|
11712
11762
|
//#region src/viewer/ViewerComponents/ViewerScene.tsx
|
|
11713
|
-
var
|
|
11714
|
-
function
|
|
11763
|
+
var um = .1, dm = .02, fm = 150, pm = 150, mm = 500, hm = 5e6, gm = 50, _m = .001, vm = .001, ym = 1e3, bm = 50, xm = 30, Sm = 240, Cm = 7, wm = 1.25, Tm = .08, Em = new W(1, 1, 1).normalize(), Dm = new A(), Om = new Ue(), km = new W(), Am = new W(), jm = new W();
|
|
11764
|
+
function Mm(e = !1) {
|
|
11715
11765
|
return {
|
|
11716
11766
|
active: e,
|
|
11717
11767
|
finalFitDone: !1,
|
|
@@ -11719,23 +11769,23 @@ function Dm(e = !1) {
|
|
|
11719
11769
|
userInteractedAfterFirstFit: !1
|
|
11720
11770
|
};
|
|
11721
11771
|
}
|
|
11722
|
-
function
|
|
11772
|
+
function Nm(e) {
|
|
11723
11773
|
let t = [];
|
|
11724
11774
|
return e?.traverse((e) => {
|
|
11725
11775
|
e instanceof B && e.geometry.attributes.ids && t.push(e);
|
|
11726
11776
|
}), t;
|
|
11727
11777
|
}
|
|
11728
|
-
function
|
|
11778
|
+
function Pm(e) {
|
|
11729
11779
|
let t = e.geometry.index?.count;
|
|
11730
11780
|
return t === void 0 ? (e.geometry.attributes.position?.count ?? 0) / 3 : t / 3;
|
|
11731
11781
|
}
|
|
11732
|
-
function
|
|
11733
|
-
return e.reduce((e, t) => e +
|
|
11782
|
+
function Fm(e) {
|
|
11783
|
+
return e.reduce((e, t) => e + Pm(t), 0);
|
|
11734
11784
|
}
|
|
11735
|
-
function
|
|
11736
|
-
return
|
|
11785
|
+
function Im(e) {
|
|
11786
|
+
return Fm(e) > hm;
|
|
11737
11787
|
}
|
|
11738
|
-
function
|
|
11788
|
+
function Lm(e, t) {
|
|
11739
11789
|
if (t <= 0 || !e.length) return [];
|
|
11740
11790
|
let n = [...e];
|
|
11741
11791
|
for (let e = n.length - 1; e > 0 && n.length - e <= t; e--) {
|
|
@@ -11744,10 +11794,10 @@ function Mm(e, t) {
|
|
|
11744
11794
|
}
|
|
11745
11795
|
return n.slice(-t);
|
|
11746
11796
|
}
|
|
11747
|
-
function
|
|
11797
|
+
function Rm(e, t) {
|
|
11748
11798
|
if (t <= 0) return null;
|
|
11749
|
-
let n =
|
|
11750
|
-
if (!
|
|
11799
|
+
let n = Nm(e);
|
|
11800
|
+
if (!Im(n)) return null;
|
|
11751
11801
|
let r = n.filter((e) => e.visible);
|
|
11752
11802
|
if (r.length < 2) return null;
|
|
11753
11803
|
let i = Math.min(r.length, Math.round(r.length * t));
|
|
@@ -11760,87 +11810,87 @@ function Nm(e, t) {
|
|
|
11760
11810
|
}
|
|
11761
11811
|
o.push(e);
|
|
11762
11812
|
});
|
|
11763
|
-
let s = [...
|
|
11764
|
-
return c > 0 && s.push(...
|
|
11813
|
+
let s = [...Lm(o, i)], c = i - s.length;
|
|
11814
|
+
return c > 0 && s.push(...Lm(a, c)), s.length ? {
|
|
11765
11815
|
hiddenMeshes: s,
|
|
11766
11816
|
root: e
|
|
11767
11817
|
} : null;
|
|
11768
11818
|
}
|
|
11769
|
-
function
|
|
11819
|
+
function zm(e) {
|
|
11770
11820
|
let t = /* @__PURE__ */ new Map(), n = 0;
|
|
11771
11821
|
return e.hiddenMeshes.forEach((e) => {
|
|
11772
11822
|
e.parent && (t.set(e, e.visible), e.visible && (e.userData[dl] = !0, e.visible = !1, n++));
|
|
11773
11823
|
}), n ? t : null;
|
|
11774
11824
|
}
|
|
11775
|
-
function
|
|
11825
|
+
function Bm(e) {
|
|
11776
11826
|
e?.forEach((e, t) => {
|
|
11777
11827
|
delete t.userData[dl], t.visible = e;
|
|
11778
11828
|
});
|
|
11779
11829
|
}
|
|
11780
|
-
function
|
|
11781
|
-
let t =
|
|
11782
|
-
return t ? Math.max(t.radius *
|
|
11830
|
+
function Vm(e) {
|
|
11831
|
+
let t = Um(e);
|
|
11832
|
+
return t ? Math.max(t.radius * dm, um) : um;
|
|
11783
11833
|
}
|
|
11784
|
-
function
|
|
11834
|
+
function Hm(e) {
|
|
11785
11835
|
if (e.dollyToCursor = !0, e.camera instanceof ke) {
|
|
11786
11836
|
e.mouseButtons.middle = Fs.ACTION.ZOOM, e.mouseButtons.wheel = Fs.ACTION.ZOOM, e.touches.two = Fs.ACTION.TOUCH_ZOOM_TRUCK, e.infinityDolly = !1;
|
|
11787
11837
|
return;
|
|
11788
11838
|
}
|
|
11789
11839
|
e.mouseButtons.middle = Fs.ACTION.DOLLY, e.mouseButtons.wheel = Fs.ACTION.DOLLY, e.touches.two = Fs.ACTION.TOUCH_DOLLY_TRUCK, e.infinityDolly = !0;
|
|
11790
11840
|
}
|
|
11791
|
-
function
|
|
11792
|
-
if (!e || (
|
|
11793
|
-
let t =
|
|
11841
|
+
function Um(e) {
|
|
11842
|
+
if (!e || (Dm.setFromObject(e), Dm.isEmpty())) return null;
|
|
11843
|
+
let t = Dm.getBoundingSphere(Om);
|
|
11794
11844
|
return !Number.isFinite(t.radius) || t.radius <= 0 ? null : t;
|
|
11795
11845
|
}
|
|
11796
|
-
function
|
|
11846
|
+
function Wm(e) {
|
|
11797
11847
|
return e.type === "Group" && typeof e.userData.modelID == "number";
|
|
11798
11848
|
}
|
|
11799
|
-
function
|
|
11800
|
-
return e?.children.filter(
|
|
11849
|
+
function Gm(e) {
|
|
11850
|
+
return e?.children.filter(Wm) ?? [];
|
|
11801
11851
|
}
|
|
11802
|
-
function
|
|
11803
|
-
return
|
|
11852
|
+
function Km(e, t) {
|
|
11853
|
+
return Gm(e).find((e) => e.userData.modelID === t) ?? null;
|
|
11804
11854
|
}
|
|
11805
|
-
function
|
|
11855
|
+
function qm(e) {
|
|
11806
11856
|
return e instanceof ke ? "orthographic" : "perspective";
|
|
11807
11857
|
}
|
|
11808
|
-
function
|
|
11858
|
+
function Jm(e) {
|
|
11809
11859
|
return e instanceof Ae || e instanceof ke;
|
|
11810
11860
|
}
|
|
11811
|
-
function
|
|
11861
|
+
function Ym(e) {
|
|
11812
11862
|
return e.height > 0 ? e.width / e.height : 1;
|
|
11813
11863
|
}
|
|
11814
|
-
function
|
|
11815
|
-
return Math.max(
|
|
11864
|
+
function Xm(e) {
|
|
11865
|
+
return Math.max(vm, (e.top - e.bottom) / Math.max(e.zoom, 1e-4));
|
|
11816
11866
|
}
|
|
11817
|
-
function
|
|
11818
|
-
let r = Math.max(
|
|
11867
|
+
function Zm(e, t, n) {
|
|
11868
|
+
let r = Math.max(vm, n) * Math.max(e.zoom, 1e-4), i = r * t;
|
|
11819
11869
|
e.left = -i / 2, e.right = i / 2, e.top = r / 2, e.bottom = -r / 2, e.updateProjectionMatrix();
|
|
11820
11870
|
}
|
|
11821
|
-
function
|
|
11822
|
-
if (e instanceof ke) return
|
|
11871
|
+
function Qm(e, t) {
|
|
11872
|
+
if (e instanceof ke) return Xm(e);
|
|
11823
11873
|
if (e instanceof Ae) {
|
|
11824
|
-
let n = Math.max(
|
|
11874
|
+
let n = Math.max(_m, e.position.distanceTo(t));
|
|
11825
11875
|
return 2 * Math.tan(xe.degToRad(e.fov) / 2) * n;
|
|
11826
11876
|
}
|
|
11827
11877
|
return 1;
|
|
11828
11878
|
}
|
|
11829
|
-
function
|
|
11830
|
-
let n =
|
|
11879
|
+
function $m(e, t) {
|
|
11880
|
+
let n = Ym(t);
|
|
11831
11881
|
if (e instanceof Ae) {
|
|
11832
11882
|
e.aspect = n, e.updateProjectionMatrix();
|
|
11833
11883
|
return;
|
|
11834
11884
|
}
|
|
11835
|
-
e instanceof ke &&
|
|
11885
|
+
e instanceof ke && Zm(e, n, Xm(e));
|
|
11836
11886
|
}
|
|
11837
|
-
function
|
|
11838
|
-
let n =
|
|
11887
|
+
function eh(e, t) {
|
|
11888
|
+
let n = Um(t);
|
|
11839
11889
|
if (!n) return;
|
|
11840
|
-
let r = Math.max(
|
|
11890
|
+
let r = Math.max(ym, n.radius * bm, e.near + 1);
|
|
11841
11891
|
Math.abs(e.far - r) < 1 || (e.far = r, e.updateProjectionMatrix());
|
|
11842
11892
|
}
|
|
11843
|
-
function
|
|
11893
|
+
function th(e, t) {
|
|
11844
11894
|
let n = new A();
|
|
11845
11895
|
return Object.entries(e).forEach(([e, r]) => {
|
|
11846
11896
|
let i = Number(e), a = t.elementBounds.get(i);
|
|
@@ -11850,16 +11900,16 @@ function Xm(e, t) {
|
|
|
11850
11900
|
});
|
|
11851
11901
|
}), n.isEmpty() ? null : n;
|
|
11852
11902
|
}
|
|
11853
|
-
function
|
|
11854
|
-
let t = e.getSize(
|
|
11855
|
-
return Number.isFinite(n) && n > 0 ? n *
|
|
11903
|
+
function nh(e) {
|
|
11904
|
+
let t = e.getSize(jm), n = Math.max(t.x, t.y, t.z);
|
|
11905
|
+
return Number.isFinite(n) && n > 0 ? n * Tm : um;
|
|
11856
11906
|
}
|
|
11857
|
-
function
|
|
11858
|
-
let r = Math.max(
|
|
11859
|
-
return Number.isFinite(i) && i >= r ? e : (
|
|
11907
|
+
function rh(e, t, n) {
|
|
11908
|
+
let r = Math.max(um, (Number.isFinite(n) ? n : um) * wm), i = t.position.distanceTo(e);
|
|
11909
|
+
return Number.isFinite(i) && i >= r ? e : (km.copy(e).sub(t.position), (!Number.isFinite(km.x + km.y + km.z) || km.lengthSq() === 0) && t.getWorldDirection(km), km.lengthSq() === 0 && km.set(0, 0, -1), km.normalize(), Am.copy(t.position).addScaledVector(km, r));
|
|
11860
11910
|
}
|
|
11861
|
-
function
|
|
11862
|
-
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 =
|
|
11911
|
+
function ih({ 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 }) {
|
|
11912
|
+
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 = wd(s), N = Wd(M), { colorPaletteTexture: oe, colorUtils: se } = Ru(M), ce = Tt(), le = K((e) => e.selected), ue = Bs(s), P = Cf(s, n, ue, k, w), de = h((e) => {
|
|
11863
11913
|
P.setCapsPreselection(e), w();
|
|
11864
11914
|
}, [P, w]);
|
|
11865
11915
|
_(() => {
|
|
@@ -11902,7 +11952,7 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
11902
11952
|
L,
|
|
11903
11953
|
pe,
|
|
11904
11954
|
me
|
|
11905
|
-
]), ge = b(() => new Qn(), []), _e = N.buildIndex, ve = M.resetIndex, R = se.applyStoredColors, ye =
|
|
11955
|
+
]), ge = b(() => new Qn(), []), _e = N.buildIndex, ve = M.resetIndex, R = se.applyStoredColors, ye = Ap(), be = x(null), z = x(null), B = x(null), Se = x(null), Ce = x(null), we = x(null), V = x(Mm()), Te = x([]), Ee = x(/* @__PURE__ */ new Map()), De = x(/* @__PURE__ */ new Set()), Oe = x(l), je = x(null), Me = x(null), Ne = x(null), Pe = x(0), Fe = x(!1), Ie = x(l), Le = x(!1), Re = x(!1), ze = x(i), Be = x(/* @__PURE__ */ new Map()), [Ve, He] = S(0), [Ue, We] = S(0);
|
|
11906
11956
|
_(() => {
|
|
11907
11957
|
let e = new Set(Object.keys(c).map((e) => Number(e)));
|
|
11908
11958
|
De.current.forEach((t) => {
|
|
@@ -11910,7 +11960,7 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
11910
11960
|
}), De.current = e;
|
|
11911
11961
|
}, [se, c]);
|
|
11912
11962
|
let [Ge, Ke] = S(!1), [qe, Je] = S({}), Ye = x(!1), H = K((e) => e.showStats), Xe = K((e) => e.lighting), Ze = K((e) => e.performanceMovingFactor);
|
|
11913
|
-
ze.current !== i && (ze.current = i, Be.current.clear(), V.current =
|
|
11963
|
+
ze.current !== i && (ze.current = i, Be.current.clear(), V.current = Mm(), je.current = null);
|
|
11914
11964
|
let Qe = h((e, t, n) => {
|
|
11915
11965
|
let r = Be.current.get(e) ?? 0;
|
|
11916
11966
|
Be.current.set(e, t), n > 0 && t >= n && r < n && He((e) => e + 1);
|
|
@@ -11923,10 +11973,10 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
11923
11973
|
if (!t || e.camera.uuid !== t.cameraUuid) return !1;
|
|
11924
11974
|
Me.current = null, e.cancel(), e.updateCameraUp();
|
|
11925
11975
|
let n = e;
|
|
11926
|
-
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),
|
|
11976
|
+
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), Hm(e), e.minDistance = Vm(s.current), e.stop(), e.update(0), n.saveState?.(), j(), !0;
|
|
11927
11977
|
}, [j, s]), et = h((e) => {
|
|
11928
11978
|
let t = n;
|
|
11929
|
-
t.current !== e && (t.current = e, e && (e.minDistance =
|
|
11979
|
+
t.current !== e && (t.current = e, e && (e.minDistance = Vm(s.current), Hm(e), $e(e)), We((e) => e + 1));
|
|
11930
11980
|
}, [
|
|
11931
11981
|
n,
|
|
11932
11982
|
s,
|
|
@@ -11941,7 +11991,7 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
11941
11991
|
...e
|
|
11942
11992
|
}));
|
|
11943
11993
|
}, []), ot = h(() => {
|
|
11944
|
-
z.current !== null && (window.clearTimeout(z.current), z.current = null), B.current !== null && (window.clearTimeout(B.current), B.current = null), Se.current !== null && (window.clearTimeout(Se.current), Se.current = null),
|
|
11994
|
+
z.current !== null && (window.clearTimeout(z.current), z.current = null), B.current !== null && (window.clearTimeout(B.current), B.current = null), Se.current !== null && (window.clearTimeout(Se.current), Se.current = null), Bm(we.current), we.current = null, Ce.current = null, P.setCapsCameraMotionActive(!1), P.setEdgesCameraMotionActive?.(!1), v("sleep"), j();
|
|
11945
11995
|
}, [
|
|
11946
11996
|
P,
|
|
11947
11997
|
j,
|
|
@@ -11979,7 +12029,7 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
11979
12029
|
s,
|
|
11980
12030
|
k
|
|
11981
12031
|
]), _(() => {
|
|
11982
|
-
|
|
12032
|
+
$m(A, ae), j();
|
|
11983
12033
|
}, [
|
|
11984
12034
|
A,
|
|
11985
12035
|
j,
|
|
@@ -11997,11 +12047,11 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
11997
12047
|
let ut = b(() => {
|
|
11998
12048
|
let e = Object.keys(c).sort((e, t) => Number(e) - Number(t));
|
|
11999
12049
|
for (let t of e) {
|
|
12000
|
-
let e =
|
|
12050
|
+
let e = ad(c[Number(t)]);
|
|
12001
12051
|
if (e) return e;
|
|
12002
12052
|
}
|
|
12003
12053
|
return null;
|
|
12004
|
-
}, [c]), dt = b(() =>
|
|
12054
|
+
}, [c]), dt = b(() => rd(ut ?? void 0), [ut]), ft = b(() => Object.entries(c).map(([e, t]) => [Number(e), t]), [c]), pt = b(() => ft.map(([e]) => e), [ft]), mt = b(() => new Map(ft.map(([e, t]) => [e, Object.keys(t.data).length])), [ft]);
|
|
12005
12055
|
Te.current = pt, Ee.current = mt, Oe.current = l, _(() => {
|
|
12006
12056
|
let e = new Set(pt);
|
|
12007
12057
|
Be.current.forEach((t, n) => {
|
|
@@ -12009,11 +12059,11 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12009
12059
|
});
|
|
12010
12060
|
}, [pt]);
|
|
12011
12061
|
let ht = o !== "performance", gt = h(() => {
|
|
12012
|
-
n.current && (n.current.minDistance =
|
|
12062
|
+
n.current && (n.current.minDistance = Vm(s.current));
|
|
12013
12063
|
}, [n, s]), _t = h((e, t = !1) => {
|
|
12014
12064
|
let r = n.current;
|
|
12015
12065
|
if (!r) return !1;
|
|
12016
|
-
let i = t ?
|
|
12066
|
+
let i = t ? rh(e, A, r.minDistance) : e;
|
|
12017
12067
|
return r.cancel(), r.setOrbitPoint(i.x, i.y, i.z), !0;
|
|
12018
12068
|
}, [A, n]), vt = h((e) => {
|
|
12019
12069
|
be.current = e.clone(), _t(e, !0);
|
|
@@ -12025,18 +12075,18 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12025
12075
|
a,
|
|
12026
12076
|
s
|
|
12027
12077
|
]), bt = h((e) => {
|
|
12028
|
-
if (!
|
|
12029
|
-
if (
|
|
12078
|
+
if (!Jm(A)) return null;
|
|
12079
|
+
if (qm(A) === e) return A;
|
|
12030
12080
|
let r = n.current, i = new W(), a = new W();
|
|
12031
12081
|
r ? (r.getTarget(i, !0), r.getPosition(a, !0)) : (A.getWorldDirection(i), a.copy(A.position), i.add(a));
|
|
12032
12082
|
let o = a.clone().sub(i);
|
|
12033
|
-
o.lengthSq() <
|
|
12034
|
-
let s =
|
|
12083
|
+
o.lengthSq() < _m * _m && A.getWorldDirection(o).multiplyScalar(-1), o.lengthSq() < _m * _m && o.copy(Em), o.normalize();
|
|
12084
|
+
let s = Ym(ae), c = Qm(A, i), l = A.near, u = A.far, d = e === "orthographic" ? new ke(-s * c * .5, s * c * .5, c * .5, -c * .5, l, u) : new Ae(gm, s, l, u);
|
|
12035
12085
|
if (d.manual = !0, d instanceof Ae) {
|
|
12036
12086
|
let e = c / (2 * Math.tan(xe.degToRad(d.fov) * .5));
|
|
12037
12087
|
a.copy(i).addScaledVector(o, e);
|
|
12038
12088
|
}
|
|
12039
|
-
return d.position.copy(a), d.up.copy(A.up), d.layers.mask = A.layers.mask, d.lookAt(i), d.updateMatrixWorld(!0),
|
|
12089
|
+
return d.position.copy(a), d.up.copy(A.up), d.layers.mask = A.layers.mask, d.lookAt(i), d.updateMatrixWorld(!0), $m(d, ae), Me.current = {
|
|
12040
12090
|
cameraUuid: d.uuid,
|
|
12041
12091
|
position: a.clone(),
|
|
12042
12092
|
target: i.clone(),
|
|
@@ -12052,10 +12102,10 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12052
12102
|
ae.height,
|
|
12053
12103
|
ae.width
|
|
12054
12104
|
]), xt = h(() => {
|
|
12055
|
-
let e =
|
|
12105
|
+
let e = qm(A) === "perspective" ? "orthographic" : "perspective";
|
|
12056
12106
|
return bt(e), e;
|
|
12057
12107
|
}, [A, bt]), St = h((e, t, { createClippingPlane: r = !0 } = {}) => {
|
|
12058
|
-
let i = bt("orthographic") ?? (
|
|
12108
|
+
let i = bt("orthographic") ?? (Jm(A) ? A : null);
|
|
12059
12109
|
if (!i) return null;
|
|
12060
12110
|
let a = e.clone().normalize(), o = !1;
|
|
12061
12111
|
Pe.current += 1, lt(!0), P.setHelpersActive(!1), r && P.createPlaneFromPointAndNormal(wl(a), a.normal.clone());
|
|
@@ -12090,10 +12140,10 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12090
12140
|
ae
|
|
12091
12141
|
]);
|
|
12092
12142
|
_(() => {
|
|
12093
|
-
if (!u || Re.current || !s.current || !
|
|
12143
|
+
if (!u || Re.current || !s.current || !Jm(A)) return;
|
|
12094
12144
|
let e = u.clone().normalize();
|
|
12095
12145
|
Re.current = !0;
|
|
12096
|
-
let t = bt("orthographic") ?? (
|
|
12146
|
+
let t = bt("orthographic") ?? (Jm(A) ? A : null);
|
|
12097
12147
|
t && (lt(!0), P.setHelpersActive(!1), P.createPlaneFromPointAndNormal(wl(e), e.normal.clone()), requestAnimationFrame(() => {
|
|
12098
12148
|
Cl({
|
|
12099
12149
|
camera: t,
|
|
@@ -12125,14 +12175,14 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12125
12175
|
}, []), wt = h((t) => {
|
|
12126
12176
|
if (!t) return !1;
|
|
12127
12177
|
let n = Ct();
|
|
12128
|
-
if (!e || !r) return n || (V.current =
|
|
12178
|
+
if (!e || !r) return n || (V.current = Mm()), !1;
|
|
12129
12179
|
let i = V.current;
|
|
12130
12180
|
if (n) {
|
|
12131
|
-
i.active || (V.current =
|
|
12181
|
+
i.active || (V.current = Mm(!0));
|
|
12132
12182
|
let e = V.current;
|
|
12133
12183
|
return e.firstFitDone ? !1 : (e.firstFitDone = !0, !0);
|
|
12134
12184
|
}
|
|
12135
|
-
return i.active ? i.finalFitDone ? !1 : i.firstFitDone && i.userInteractedAfterFirstFit ? (V.current =
|
|
12185
|
+
return i.active ? i.finalFitDone ? !1 : i.firstFitDone && i.userInteractedAfterFirstFit ? (V.current = Mm(), !1) : (i.finalFitDone = !0, !0) : !0;
|
|
12136
12186
|
}, [
|
|
12137
12187
|
e,
|
|
12138
12188
|
r,
|
|
@@ -12140,11 +12190,11 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12140
12190
|
]), Et = h((e, t = !1) => {
|
|
12141
12191
|
let r = n.current;
|
|
12142
12192
|
if (!r) return;
|
|
12143
|
-
let i =
|
|
12193
|
+
let i = th(e, M.buildIndex());
|
|
12144
12194
|
if (!i) return;
|
|
12145
12195
|
let a = i.getCenter(new W());
|
|
12146
12196
|
if (be.current = a.clone(), r.cancel(), t) {
|
|
12147
|
-
let e =
|
|
12197
|
+
let e = nh(i);
|
|
12148
12198
|
r.fitToBox(i, !0, {
|
|
12149
12199
|
paddingBottom: e,
|
|
12150
12200
|
paddingLeft: e,
|
|
@@ -12179,7 +12229,7 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12179
12229
|
let e = () => {
|
|
12180
12230
|
z.current !== null && (window.clearTimeout(z.current), z.current = null);
|
|
12181
12231
|
}, t = () => {
|
|
12182
|
-
we.current && (
|
|
12232
|
+
we.current && (Bm(we.current), we.current = null, j());
|
|
12183
12233
|
};
|
|
12184
12234
|
if (!te) {
|
|
12185
12235
|
e(), t(), P.setCapsCameraMotionActive(!1), P.setEdgesCameraMotionActive?.(!1), v("sleep");
|
|
@@ -12194,7 +12244,7 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12194
12244
|
return;
|
|
12195
12245
|
}
|
|
12196
12246
|
z.current = null, v("move"), P.setCapsCameraMotionActive(!0), P.setEdgesCameraMotionActive?.(!0);
|
|
12197
|
-
},
|
|
12247
|
+
}, fm));
|
|
12198
12248
|
}, a = () => {
|
|
12199
12249
|
e(), t(), P.setCapsCameraMotionActive(!1), P.setEdgesCameraMotionActive?.(!1), v("sleep");
|
|
12200
12250
|
};
|
|
@@ -12214,11 +12264,11 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12214
12264
|
}, t = () => {
|
|
12215
12265
|
Se.current !== null && (window.clearTimeout(Se.current), Se.current = null);
|
|
12216
12266
|
}, r = (n = !1) => {
|
|
12217
|
-
e(), we.current && (
|
|
12267
|
+
e(), we.current && (Bm(we.current), we.current = null, j()), n && (t(), Ce.current = null);
|
|
12218
12268
|
}, i = () => {
|
|
12219
12269
|
t(), Se.current = window.setTimeout(() => {
|
|
12220
12270
|
Se.current = null, Ce.current = null;
|
|
12221
|
-
},
|
|
12271
|
+
}, mm);
|
|
12222
12272
|
};
|
|
12223
12273
|
if (!te) {
|
|
12224
12274
|
r(!0);
|
|
@@ -12228,13 +12278,13 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12228
12278
|
if (!a) return;
|
|
12229
12279
|
let o = () => {
|
|
12230
12280
|
if (B.current = null, Fe.current || we.current) return;
|
|
12231
|
-
s.current?.updateMatrixWorld(!0), (!Ce.current || Ce.current.root !== s.current) && (Ce.current =
|
|
12281
|
+
s.current?.updateMatrixWorld(!0), (!Ce.current || Ce.current.root !== s.current) && (Ce.current = Rm(s.current, Ze));
|
|
12232
12282
|
let e = Ce.current;
|
|
12233
12283
|
if (!e) return;
|
|
12234
|
-
let t =
|
|
12284
|
+
let t = zm(e);
|
|
12235
12285
|
t && (we.current = t, j());
|
|
12236
12286
|
}, c = () => {
|
|
12237
|
-
Fe.current || (t(), !we.current && B.current === null && (B.current = window.setTimeout(o,
|
|
12287
|
+
Fe.current || (t(), !we.current && B.current === null && (B.current = window.setTimeout(o, pm)));
|
|
12238
12288
|
}, l = () => {
|
|
12239
12289
|
r(), i();
|
|
12240
12290
|
};
|
|
@@ -12249,7 +12299,7 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12249
12299
|
Ze,
|
|
12250
12300
|
te
|
|
12251
12301
|
]), _(() => {
|
|
12252
|
-
l && !Ie.current && (V.current =
|
|
12302
|
+
l && !Ie.current && (V.current = Mm(!0)), Ie.current = l;
|
|
12253
12303
|
}, [l]), _(() => {
|
|
12254
12304
|
let e = n.current, t = ne.domElement, r = () => {
|
|
12255
12305
|
let e = V.current;
|
|
@@ -12264,7 +12314,7 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12264
12314
|
ne
|
|
12265
12315
|
]);
|
|
12266
12316
|
let Ot = h(() => !Ct(), [Ct]);
|
|
12267
|
-
return
|
|
12317
|
+
return xp(s, n, ue, vt, P.getSelectableObjects, de, Ot, Ue), Tf(), _(() => {
|
|
12268
12318
|
let e = ne.domElement, t = (e) => {
|
|
12269
12319
|
let t = be.current;
|
|
12270
12320
|
t && e.button === 0 && (e.ctrlKey || e.metaKey || e.shiftKey || _t(t, !0));
|
|
@@ -12285,11 +12335,11 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12285
12335
|
if (!e) {
|
|
12286
12336
|
let e = V.current;
|
|
12287
12337
|
if (e.active && e.firstFitDone && e.userInteractedAfterFirstFit) {
|
|
12288
|
-
V.current =
|
|
12338
|
+
V.current = Mm();
|
|
12289
12339
|
return;
|
|
12290
12340
|
}
|
|
12291
12341
|
}
|
|
12292
|
-
yt(), e || (V.current =
|
|
12342
|
+
yt(), e || (V.current = Mm());
|
|
12293
12343
|
}, c = () => {
|
|
12294
12344
|
if (e) {
|
|
12295
12345
|
if (!k) {
|
|
@@ -12310,7 +12360,7 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12310
12360
|
}
|
|
12311
12361
|
}, l = () => {
|
|
12312
12362
|
if (n !== null) return;
|
|
12313
|
-
let e =
|
|
12363
|
+
let e = Cm, t = () => {
|
|
12314
12364
|
if (r) {
|
|
12315
12365
|
n = null;
|
|
12316
12366
|
return;
|
|
@@ -12328,7 +12378,7 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12328
12378
|
n = requestAnimationFrame(t);
|
|
12329
12379
|
}, u = (e) => {
|
|
12330
12380
|
if (r || !s.current) return;
|
|
12331
|
-
s.current.updateMatrixWorld(!0), (A instanceof Ae || A instanceof ke) &&
|
|
12381
|
+
s.current.updateMatrixWorld(!0), (A instanceof Ae || A instanceof ke) && eh(A, s.current), gt(), ve();
|
|
12332
12382
|
let n = _e();
|
|
12333
12383
|
if (!n.records.size && e > 0) {
|
|
12334
12384
|
t = requestAnimationFrame(() => u(e - 1));
|
|
@@ -12336,7 +12386,7 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12336
12386
|
}
|
|
12337
12387
|
R(), P.syncWithModel(), F.syncWithModel(), n.records.size > 0 && !Ct() && l(), je.current !== A.uuid && wt(n.records.size > 0) && c();
|
|
12338
12388
|
};
|
|
12339
|
-
return a(() => u(k ?
|
|
12389
|
+
return a(() => u(k ? Sm : xm)), () => {
|
|
12340
12390
|
r = !0, t !== null && cancelAnimationFrame(t), n !== null && cancelAnimationFrame(n);
|
|
12341
12391
|
};
|
|
12342
12392
|
}, [
|
|
@@ -12372,7 +12422,7 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12372
12422
|
camera: {
|
|
12373
12423
|
fitCamera: yt,
|
|
12374
12424
|
getIntersection: ue.getIntersection,
|
|
12375
|
-
getProjection: () =>
|
|
12425
|
+
getProjection: () => qm(A),
|
|
12376
12426
|
setFirstPersonControlActive: rt,
|
|
12377
12427
|
setFirstPersonControlSettings: it,
|
|
12378
12428
|
setProjection: bt,
|
|
@@ -12443,8 +12493,8 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12443
12493
|
},
|
|
12444
12494
|
getAllIds: N.getAllIds,
|
|
12445
12495
|
getIfcSpacesVisibility: N.getIfcSpacesVisibility,
|
|
12446
|
-
getModelGeometry: (e) =>
|
|
12447
|
-
getModelsGeometry: () =>
|
|
12496
|
+
getModelGeometry: (e) => Km(s.current, e),
|
|
12497
|
+
getModelsGeometry: () => Gm(s.current),
|
|
12448
12498
|
hideByIds: (e, n) => t(() => N.hideByIds(e, n)),
|
|
12449
12499
|
hideSelected: () => t(N.hideSelected),
|
|
12450
12500
|
isolateByIds: (e, n) => t(() => N.isolateByIds(e, n)),
|
|
@@ -12507,7 +12557,7 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12507
12557
|
H && /* @__PURE__ */ G(st, {}),
|
|
12508
12558
|
/* @__PURE__ */ G("group", {
|
|
12509
12559
|
ref: U,
|
|
12510
|
-
children: ft.map(([e, t]) => /* @__PURE__ */ G(
|
|
12560
|
+
children: ft.map(([e, t]) => /* @__PURE__ */ G(pd, {
|
|
12511
12561
|
colorPaletteTexture: oe,
|
|
12512
12562
|
coordinationMatrix: dt,
|
|
12513
12563
|
data: t,
|
|
@@ -12520,7 +12570,7 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12520
12570
|
}, e))
|
|
12521
12571
|
}),
|
|
12522
12572
|
he.layer,
|
|
12523
|
-
/* @__PURE__ */ G(
|
|
12573
|
+
/* @__PURE__ */ G(lm, {
|
|
12524
12574
|
active: Ge,
|
|
12525
12575
|
activeRef: Ye,
|
|
12526
12576
|
controlRef: n,
|
|
@@ -12528,10 +12578,10 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12528
12578
|
settings: qe
|
|
12529
12579
|
}),
|
|
12530
12580
|
!Ge && /* @__PURE__ */ G(at, {
|
|
12531
|
-
camera:
|
|
12581
|
+
camera: Jm(A) ? A : void 0,
|
|
12532
12582
|
dollyToCursor: !0,
|
|
12533
12583
|
infinityDolly: A instanceof Ae,
|
|
12534
|
-
minDistance:
|
|
12584
|
+
minDistance: um,
|
|
12535
12585
|
ref: et,
|
|
12536
12586
|
draggingSmoothTime: .03,
|
|
12537
12587
|
smoothTime: .05
|
|
@@ -12540,8 +12590,8 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12540
12590
|
}
|
|
12541
12591
|
//#endregion
|
|
12542
12592
|
//#region src/viewer/Viewer.tsx
|
|
12543
|
-
var
|
|
12544
|
-
function
|
|
12593
|
+
var ah = .75, oh = .6;
|
|
12594
|
+
function sh(e, t, n) {
|
|
12545
12595
|
let r = e?.[t.modelID] ?? {
|
|
12546
12596
|
coordinationMatrix: t.coordinationMatrix ?? t.geometry.matrix ?? void 0,
|
|
12547
12597
|
data: {},
|
|
@@ -12566,11 +12616,11 @@ function nh(e, t, n) {
|
|
|
12566
12616
|
}
|
|
12567
12617
|
};
|
|
12568
12618
|
}
|
|
12569
|
-
function
|
|
12619
|
+
function ch(e) {
|
|
12570
12620
|
let t = {};
|
|
12571
12621
|
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;
|
|
12572
12622
|
}
|
|
12573
|
-
function
|
|
12623
|
+
function lh(e, t, n) {
|
|
12574
12624
|
let r = { ...e ?? {} };
|
|
12575
12625
|
return Object.entries(t).forEach(([t, i]) => {
|
|
12576
12626
|
let a = Number(t);
|
|
@@ -12583,22 +12633,22 @@ function ih(e, t, n) {
|
|
|
12583
12633
|
});
|
|
12584
12634
|
}), r;
|
|
12585
12635
|
}
|
|
12586
|
-
function
|
|
12636
|
+
function uh(e, t) {
|
|
12587
12637
|
if (!e || !Object.prototype.hasOwnProperty.call(e, t)) return e;
|
|
12588
12638
|
let n = { ...e };
|
|
12589
12639
|
return delete n[t], Object.keys(n).length ? n : void 0;
|
|
12590
12640
|
}
|
|
12591
|
-
function
|
|
12641
|
+
function dh(e, t) {
|
|
12592
12642
|
return Array.isArray(e) ? [Math.min(e[0], t), Math.min(e[1], t)] : typeof e == "number" ? Math.min(e, t) : t;
|
|
12593
12643
|
}
|
|
12594
|
-
function
|
|
12644
|
+
function fh(e) {
|
|
12595
12645
|
return Array.isArray(e) ? [Math.max(e[0], 2), Math.max(e[1], 2)] : typeof e == "number" ? Math.max(e, 2) : 2;
|
|
12596
12646
|
}
|
|
12597
|
-
function
|
|
12647
|
+
function ph() {
|
|
12598
12648
|
let e = navigator, t = navigator.userAgent.toLowerCase(), n = navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1, r = window.matchMedia?.("(pointer: coarse)").matches ?? !1;
|
|
12599
12649
|
return e.userAgentData?.mobile || n || /android|iphone|ipad|ipod|mobile|tablet/.test(t) || navigator.maxTouchPoints > 1 && r ? "mobile" : "pc";
|
|
12600
12650
|
}
|
|
12601
|
-
function
|
|
12651
|
+
function mh({ autoFitCamera: e = !0, camera: t = {
|
|
12602
12652
|
position: [
|
|
12603
12653
|
10,
|
|
12604
12654
|
10,
|
|
@@ -12609,7 +12659,7 @@ function lh({ autoFitCamera: e = !0, camera: t = {
|
|
|
12609
12659
|
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), N = x(void 0), oe = x(!1), se = x(null), ce = x(null), le = x({
|
|
12610
12660
|
lastProgress: 0,
|
|
12611
12661
|
requestID: 0
|
|
12612
|
-
}), ue = x(null), P = x(/* @__PURE__ */ new Set()), de = x(0), F = x(/* @__PURE__ */ new Map()), I = x(/* @__PURE__ */ new Set()), fe = x(/* @__PURE__ */ new Set()), L = x(!1), pe = x(null), me = x(null), he = x(/* @__PURE__ */ new Set()), ge = x(/* @__PURE__ */ new Map()), _e = x(!T), ve = x(/* @__PURE__ */ new Set()), R = Tt(), ye = K((e) => e.setModelNames), be = K((e) => e.setModelProps), xe = K((e) => e.setModelStructure), z = K((e) => e.setShowNavCube), B = K((e) => e.setShowStats), Se = K((e) => e.setUserDevice), Ce = K((e) => e.showNavCube), we = ne, V = we ? k ?? s : s ?? k, Te = r ?? re, Ee = u ?
|
|
12662
|
+
}), ue = x(null), P = x(/* @__PURE__ */ new Set()), de = x(0), F = x(/* @__PURE__ */ new Map()), I = x(/* @__PURE__ */ new Set()), fe = x(/* @__PURE__ */ new Set()), L = x(!1), pe = x(null), me = x(null), he = x(/* @__PURE__ */ new Set()), ge = x(/* @__PURE__ */ new Map()), _e = x(!T), ve = x(/* @__PURE__ */ new Set()), R = Tt(), ye = K((e) => e.setModelNames), be = K((e) => e.setModelProps), xe = K((e) => e.setModelStructure), z = K((e) => e.setShowNavCube), B = K((e) => e.setShowStats), Se = K((e) => e.setUserDevice), Ce = K((e) => e.showNavCube), we = ne, V = we ? k ?? s : s ?? k, Te = r ?? re, Ee = u ? dh(n, 1) : n, De = dh(Ee, u ? oh : ah), Oe = c ?? (u ? "performance" : void 0), [ke, Ae] = S("sleep"), je = fh(Ee), Me = b(() => T ? No({ performanceMode: u }) : u ? Wo : void 0, [u, T]), Ne = u ? Uo : Ho, Pe = h(() => {
|
|
12613
12663
|
I.current.forEach((e) => {
|
|
12614
12664
|
e();
|
|
12615
12665
|
});
|
|
@@ -12736,12 +12786,12 @@ function lh({ autoFitCamera: e = !0, camera: t = {
|
|
|
12736
12786
|
}, [R]), H = h((e, t) => {
|
|
12737
12787
|
A((n) => {
|
|
12738
12788
|
let r = e(n);
|
|
12739
|
-
return t?.(r), r;
|
|
12789
|
+
return r === n ? n : (N.current = r, t?.(r), r);
|
|
12740
12790
|
});
|
|
12741
12791
|
}, []), Xe = h((e, t, n) => {
|
|
12742
|
-
H((t) =>
|
|
12792
|
+
H((t) => sh(t, e, n), t);
|
|
12743
12793
|
}, [H]), Ze = h(async (e, t = {}) => {
|
|
12744
|
-
let { clearViewer: n = !1, fitToView: r = !0, onChunk: i, onModelLoadingChange: a, onModelProgress: o, onModelsDataChange: s, onProgress: c, ...l } = t, u = de.current + 1, d =
|
|
12794
|
+
let { clearViewer: n = !1, fitToView: r = !0, onChunk: i, onModelLoadingChange: a, onModelProgress: o, onModelsDataChange: s, onProgress: c, ...l } = t, u = de.current + 1, d = ch(l), f = !1, p = !1, m = () => {
|
|
12745
12795
|
f || de.current !== u || (f = !0, j(!1));
|
|
12746
12796
|
}, h = () => {
|
|
12747
12797
|
p || de.current !== u || (p = !0, a?.(!1));
|
|
@@ -12772,7 +12822,7 @@ function lh({ autoFitCamera: e = !0, camera: t = {
|
|
|
12772
12822
|
});
|
|
12773
12823
|
if (de.current !== u) return r;
|
|
12774
12824
|
let a = Object.fromEntries(Object.entries(r).filter(([e]) => !P.current.has(Number(e))));
|
|
12775
|
-
return H((e) => t ?
|
|
12825
|
+
return H((e) => t ? lh(e, a, P.current) : {
|
|
12776
12826
|
...e ?? {},
|
|
12777
12827
|
...a
|
|
12778
12828
|
}, s), m(), Object.keys(a).length > 0 && await qe(u), h(), r;
|
|
@@ -12790,7 +12840,7 @@ function lh({ autoFitCamera: e = !0, camera: t = {
|
|
|
12790
12840
|
]), Qe = h((e) => {
|
|
12791
12841
|
if (!Number.isFinite(e)) return;
|
|
12792
12842
|
P.current.add(e);
|
|
12793
|
-
let t = N.current, n =
|
|
12843
|
+
let t = N.current, n = uh(t, e);
|
|
12794
12844
|
n !== t && (N.current = n, A(n), ue.current?.(n)), R.getState().removeModelState(e);
|
|
12795
12845
|
}, [R]), U = b(() => ({
|
|
12796
12846
|
getData: () => N.current,
|
|
@@ -12805,7 +12855,7 @@ function lh({ autoFitCamera: e = !0, camera: t = {
|
|
|
12805
12855
|
Qe
|
|
12806
12856
|
]);
|
|
12807
12857
|
return _(() => (p(U), () => p(null)), [U, p]), _(() => {
|
|
12808
|
-
Se(
|
|
12858
|
+
Se(ph());
|
|
12809
12859
|
}, [Se]), _(() => {
|
|
12810
12860
|
B(!!y);
|
|
12811
12861
|
}, [B, y]), _(() => {
|
|
@@ -12855,7 +12905,7 @@ function lh({ autoFitCamera: e = !0, camera: t = {
|
|
|
12855
12905
|
onReady: We
|
|
12856
12906
|
}),
|
|
12857
12907
|
/* @__PURE__ */ G(Fo, { active: T }),
|
|
12858
|
-
/* @__PURE__ */ G(
|
|
12908
|
+
/* @__PURE__ */ G(ih, {
|
|
12859
12909
|
autoFitCamera: e,
|
|
12860
12910
|
cameraRef: E,
|
|
12861
12911
|
controlRef: D,
|
|
@@ -12903,7 +12953,7 @@ function lh({ autoFitCamera: e = !0, camera: t = {
|
|
|
12903
12953
|
})]
|
|
12904
12954
|
}) : /* @__PURE__ */ G(tt, {});
|
|
12905
12955
|
}
|
|
12906
|
-
var
|
|
12956
|
+
var hh = p(function(e, t) {
|
|
12907
12957
|
let [n] = S(St), r = x(!1), i = x(!1), a = b(() => new Go(), []), o = b(() => new qo(), []), { defaultSelected: s, onSelectedChange: c, selected: l } = e, u = h((e) => {
|
|
12908
12958
|
a.set(e);
|
|
12909
12959
|
}, [a]), d = b(() => new Ko(), []), f = h((e) => {
|
|
@@ -12932,7 +12982,7 @@ var uh = p(function(e, t) {
|
|
|
12932
12982
|
});
|
|
12933
12983
|
}, [c, n]), /* @__PURE__ */ G(wt, {
|
|
12934
12984
|
store: n,
|
|
12935
|
-
children: /* @__PURE__ */ G(
|
|
12985
|
+
children: /* @__PURE__ */ G(mh, {
|
|
12936
12986
|
...e,
|
|
12937
12987
|
publicApi: m,
|
|
12938
12988
|
setModelsApi: f,
|
|
@@ -12941,6 +12991,6 @@ var uh = p(function(e, t) {
|
|
|
12941
12991
|
})
|
|
12942
12992
|
});
|
|
12943
12993
|
});
|
|
12944
|
-
|
|
12994
|
+
hh.displayName = "Viewer";
|
|
12945
12995
|
//#endregion
|
|
12946
|
-
export { kr as BMTLoader, Qn as BmtConverter, er as ConvertIfcFileToBmt, tr as ConvertToBmt, qs as DimensionLine, nc as DimensionsUtils, pr as FilteredElementsCollector, Su as ModelGrids, $i as NavigationCube,
|
|
12996
|
+
export { kr as BMTLoader, Qn as BmtConverter, er as ConvertIfcFileToBmt, tr as ConvertToBmt, qs as DimensionLine, nc as DimensionsUtils, pr as FilteredElementsCollector, Su as ModelGrids, $i as NavigationCube, hh as Viewer, wt as ViewerStoreProvider, $n as bmtConverter, ei as convertIfcFilesToBmtInWorker, ti as createBmtConverterWorker, zr as createBmtWorker, pi as createIfcWorker, St as createViewerStore, hn as exportExcel, fn as exportModelPropertiesToExcel, Rr as loadBmtModelsInWorker, fi as loadIfcModelsInWorker, bi as loader, rc as useDimensionsUtils, K as useViewerStore, Tt as useViewerStoreApi };
|