bimatter-viewer-react 0.6.1 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/ViewerApi.d.ts +3 -1
- package/lib/index.js +152 -133
- package/package.json +1 -1
package/lib/api/ViewerApi.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ColorRepresentation } from "three";
|
|
1
|
+
import type { ColorRepresentation, Group } from "three";
|
|
2
2
|
import type { SelectedStore, UserDevice, ViewerGridAxesVisibility, ViewerGridAxisSide, ViewerStoreApi } from "../store/ViewerStore";
|
|
3
3
|
import { type ViewerPropertiesApi } from "./ViewerPropertiesApi";
|
|
4
4
|
import type { ViewerClippingApi } from "../utils/ClippingUtils";
|
|
@@ -15,6 +15,8 @@ export type ViewerSelection = Record<number, number[]>;
|
|
|
15
15
|
export type ViewerGeometryUtilsApi = {
|
|
16
16
|
getAllIds: () => number[];
|
|
17
17
|
getIfcSpacesVisibility: () => boolean;
|
|
18
|
+
getModelGeometry: (modelID: number) => Group | null;
|
|
19
|
+
getModelsGeometry: () => Group[];
|
|
18
20
|
hideByIds: (ids: number[]) => void;
|
|
19
21
|
hideSelected: () => void;
|
|
20
22
|
isolateByIds: (ids: number[]) => void;
|
package/lib/index.js
CHANGED
|
@@ -3924,6 +3924,8 @@ function ba(e, t) {
|
|
|
3924
3924
|
geometryUtils: {
|
|
3925
3925
|
getAllIds: () => t()?.geometryUtils.getAllIds() ?? [],
|
|
3926
3926
|
getIfcSpacesVisibility: () => t()?.geometryUtils.getIfcSpacesVisibility() ?? !1,
|
|
3927
|
+
getModelGeometry: (e) => t()?.geometryUtils.getModelGeometry(e) ?? null,
|
|
3928
|
+
getModelsGeometry: () => t()?.geometryUtils.getModelsGeometry() ?? [],
|
|
3927
3929
|
hideByIds: (e) => {
|
|
3928
3930
|
t()?.geometryUtils.hideByIds(e);
|
|
3929
3931
|
},
|
|
@@ -4621,7 +4623,7 @@ var mo = new class {
|
|
|
4621
4623
|
}
|
|
4622
4624
|
return i;
|
|
4623
4625
|
}
|
|
4624
|
-
}(), ho = .5,
|
|
4626
|
+
}(), ho = .5, go = .04, X = .16, _o = X, Z = ho * 2 - X * 2, vo = ho - go / 2, yo = ho - X / 2, bo = ho - _o / 2, xo = .63, So = "#dfe6ec", Co = 260, wo = 52, To = .17, Eo = new g(), Q = new de(), Do = [
|
|
4625
4627
|
{
|
|
4626
4628
|
direction: [
|
|
4627
4629
|
0,
|
|
@@ -4632,12 +4634,12 @@ var mo = new class {
|
|
|
4632
4634
|
position: [
|
|
4633
4635
|
0,
|
|
4634
4636
|
0,
|
|
4635
|
-
|
|
4637
|
+
vo
|
|
4636
4638
|
],
|
|
4637
4639
|
scale: [
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4640
|
+
Z,
|
|
4641
|
+
Z,
|
|
4642
|
+
go
|
|
4641
4643
|
],
|
|
4642
4644
|
title: "Front",
|
|
4643
4645
|
type: "face"
|
|
@@ -4652,7 +4654,7 @@ var mo = new class {
|
|
|
4652
4654
|
position: [
|
|
4653
4655
|
0,
|
|
4654
4656
|
0,
|
|
4655
|
-
-
|
|
4657
|
+
-vo
|
|
4656
4658
|
],
|
|
4657
4659
|
rotation: [
|
|
4658
4660
|
0,
|
|
@@ -4660,9 +4662,9 @@ var mo = new class {
|
|
|
4660
4662
|
0
|
|
4661
4663
|
],
|
|
4662
4664
|
scale: [
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4665
|
+
Z,
|
|
4666
|
+
Z,
|
|
4667
|
+
go
|
|
4666
4668
|
],
|
|
4667
4669
|
title: "Back",
|
|
4668
4670
|
type: "face"
|
|
@@ -4675,7 +4677,7 @@ var mo = new class {
|
|
|
4675
4677
|
],
|
|
4676
4678
|
label: "right",
|
|
4677
4679
|
position: [
|
|
4678
|
-
|
|
4680
|
+
vo,
|
|
4679
4681
|
0,
|
|
4680
4682
|
0
|
|
4681
4683
|
],
|
|
@@ -4685,9 +4687,9 @@ var mo = new class {
|
|
|
4685
4687
|
0
|
|
4686
4688
|
],
|
|
4687
4689
|
scale: [
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4690
|
+
go,
|
|
4691
|
+
Z,
|
|
4692
|
+
Z
|
|
4691
4693
|
],
|
|
4692
4694
|
title: "Right",
|
|
4693
4695
|
type: "face"
|
|
@@ -4700,7 +4702,7 @@ var mo = new class {
|
|
|
4700
4702
|
],
|
|
4701
4703
|
label: "left",
|
|
4702
4704
|
position: [
|
|
4703
|
-
-
|
|
4705
|
+
-vo,
|
|
4704
4706
|
0,
|
|
4705
4707
|
0
|
|
4706
4708
|
],
|
|
@@ -4710,9 +4712,9 @@ var mo = new class {
|
|
|
4710
4712
|
0
|
|
4711
4713
|
],
|
|
4712
4714
|
scale: [
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4715
|
+
go,
|
|
4716
|
+
Z,
|
|
4717
|
+
Z
|
|
4716
4718
|
],
|
|
4717
4719
|
title: "Left",
|
|
4718
4720
|
type: "face"
|
|
@@ -4726,7 +4728,7 @@ var mo = new class {
|
|
|
4726
4728
|
label: "top",
|
|
4727
4729
|
position: [
|
|
4728
4730
|
0,
|
|
4729
|
-
|
|
4731
|
+
vo,
|
|
4730
4732
|
0
|
|
4731
4733
|
],
|
|
4732
4734
|
rotation: [
|
|
@@ -4735,9 +4737,9 @@ var mo = new class {
|
|
|
4735
4737
|
0
|
|
4736
4738
|
],
|
|
4737
4739
|
scale: [
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4740
|
+
Z,
|
|
4741
|
+
go,
|
|
4742
|
+
Z
|
|
4741
4743
|
],
|
|
4742
4744
|
title: "Top",
|
|
4743
4745
|
type: "face"
|
|
@@ -4751,7 +4753,7 @@ var mo = new class {
|
|
|
4751
4753
|
label: "bot",
|
|
4752
4754
|
position: [
|
|
4753
4755
|
0,
|
|
4754
|
-
-
|
|
4756
|
+
-vo,
|
|
4755
4757
|
0
|
|
4756
4758
|
],
|
|
4757
4759
|
rotation: [
|
|
@@ -4760,15 +4762,15 @@ var mo = new class {
|
|
|
4760
4762
|
0
|
|
4761
4763
|
],
|
|
4762
4764
|
scale: [
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4765
|
+
Z,
|
|
4766
|
+
go,
|
|
4767
|
+
Z
|
|
4766
4768
|
],
|
|
4767
4769
|
title: "Bottom",
|
|
4768
4770
|
type: "face"
|
|
4769
4771
|
}
|
|
4770
4772
|
];
|
|
4771
|
-
function
|
|
4773
|
+
function Oo() {
|
|
4772
4774
|
let e = [], t = [-1, 1];
|
|
4773
4775
|
return t.forEach((n) => {
|
|
4774
4776
|
t.forEach((t) => {
|
|
@@ -4780,13 +4782,13 @@ function Do() {
|
|
|
4780
4782
|
],
|
|
4781
4783
|
position: [
|
|
4782
4784
|
0,
|
|
4783
|
-
n *
|
|
4784
|
-
t *
|
|
4785
|
+
n * yo,
|
|
4786
|
+
t * yo
|
|
4785
4787
|
],
|
|
4786
4788
|
scale: [
|
|
4787
|
-
Q,
|
|
4788
4789
|
Z,
|
|
4789
|
-
|
|
4790
|
+
X,
|
|
4791
|
+
X
|
|
4790
4792
|
],
|
|
4791
4793
|
title: `${n > 0 ? "Top" : "Bottom"} ${t > 0 ? "Front" : "Back"}`,
|
|
4792
4794
|
type: "edge"
|
|
@@ -4801,14 +4803,14 @@ function Do() {
|
|
|
4801
4803
|
t
|
|
4802
4804
|
],
|
|
4803
4805
|
position: [
|
|
4804
|
-
n *
|
|
4806
|
+
n * yo,
|
|
4805
4807
|
0,
|
|
4806
|
-
t *
|
|
4808
|
+
t * yo
|
|
4807
4809
|
],
|
|
4808
4810
|
scale: [
|
|
4811
|
+
X,
|
|
4809
4812
|
Z,
|
|
4810
|
-
|
|
4811
|
-
Z
|
|
4813
|
+
X
|
|
4812
4814
|
],
|
|
4813
4815
|
title: `${n > 0 ? "Right" : "Left"} ${t > 0 ? "Front" : "Back"}`,
|
|
4814
4816
|
type: "edge"
|
|
@@ -4823,14 +4825,14 @@ function Do() {
|
|
|
4823
4825
|
0
|
|
4824
4826
|
],
|
|
4825
4827
|
position: [
|
|
4826
|
-
n *
|
|
4827
|
-
t *
|
|
4828
|
+
n * yo,
|
|
4829
|
+
t * yo,
|
|
4828
4830
|
0
|
|
4829
4831
|
],
|
|
4830
4832
|
scale: [
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4833
|
+
X,
|
|
4834
|
+
X,
|
|
4835
|
+
Z
|
|
4834
4836
|
],
|
|
4835
4837
|
title: `${t > 0 ? "Top" : "Bottom"} ${n > 0 ? "Right" : "Left"}`,
|
|
4836
4838
|
type: "edge"
|
|
@@ -4838,7 +4840,7 @@ function Do() {
|
|
|
4838
4840
|
});
|
|
4839
4841
|
}), e;
|
|
4840
4842
|
}
|
|
4841
|
-
function
|
|
4843
|
+
function ko() {
|
|
4842
4844
|
let e = [], t = [-1, 1];
|
|
4843
4845
|
return t.forEach((n) => {
|
|
4844
4846
|
t.forEach((r) => {
|
|
@@ -4850,14 +4852,14 @@ function Oo() {
|
|
|
4850
4852
|
t
|
|
4851
4853
|
],
|
|
4852
4854
|
position: [
|
|
4853
|
-
n *
|
|
4854
|
-
r *
|
|
4855
|
-
t *
|
|
4855
|
+
n * bo,
|
|
4856
|
+
r * bo,
|
|
4857
|
+
t * bo
|
|
4856
4858
|
],
|
|
4857
4859
|
scale: [
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4860
|
+
_o,
|
|
4861
|
+
_o,
|
|
4862
|
+
_o
|
|
4861
4863
|
],
|
|
4862
4864
|
title: `${r > 0 ? "Top" : "Bottom"} ${n > 0 ? "Right" : "Left"} ${t > 0 ? "Front" : "Back"}`,
|
|
4863
4865
|
type: "corner"
|
|
@@ -4866,21 +4868,21 @@ function Oo() {
|
|
|
4866
4868
|
});
|
|
4867
4869
|
}), e;
|
|
4868
4870
|
}
|
|
4869
|
-
function ko(e) {
|
|
4870
|
-
e.stopPropagation(), e.nativeEvent.stopPropagation(), e.nativeEvent.stopImmediatePropagation?.();
|
|
4871
|
-
}
|
|
4872
4871
|
function Ao(e) {
|
|
4873
|
-
|
|
4872
|
+
e.stopPropagation(), e.nativeEvent.stopPropagation(), e.nativeEvent.stopImmediatePropagation?.();
|
|
4874
4873
|
}
|
|
4875
4874
|
function jo(e) {
|
|
4875
|
+
return e ? "#4f7fa3" : So;
|
|
4876
|
+
}
|
|
4877
|
+
function Mo(e) {
|
|
4876
4878
|
return e ? 1 : .96;
|
|
4877
4879
|
}
|
|
4878
|
-
function
|
|
4880
|
+
function No(e, t) {
|
|
4879
4881
|
let n = document.createElement("canvas"), r = n.getContext("2d");
|
|
4880
4882
|
if (!r) throw Error("Could not create navigation cube label context");
|
|
4881
|
-
let i = `600 ${
|
|
4883
|
+
let i = `600 ${wo}px system-ui, "Segoe UI", sans-serif`;
|
|
4882
4884
|
r.font = i;
|
|
4883
|
-
let a = r.measureText(e), o = a.actualBoundingBoxAscent ||
|
|
4885
|
+
let a = r.measureText(e), o = a.actualBoundingBoxAscent || wo * .8, s = a.actualBoundingBoxDescent || wo * .2, c = Math.ceil(a.width + 36), l = Math.ceil(o + s + 20);
|
|
4884
4886
|
n.width = c, n.height = l, r.clearRect(0, 0, c, l), r.font = i, r.fillStyle = t, r.textAlign = "center", r.textBaseline = "alphabetic", r.fillText(e, c / 2, 10 + o);
|
|
4885
4887
|
let u = new b(n);
|
|
4886
4888
|
return u.colorSpace = ue, u.generateMipmaps = !1, u.magFilter = A, u.minFilter = A, u.needsUpdate = !0, {
|
|
@@ -4888,12 +4890,12 @@ function Mo(e, t) {
|
|
|
4888
4890
|
texture: u
|
|
4889
4891
|
};
|
|
4890
4892
|
}
|
|
4891
|
-
function
|
|
4892
|
-
let { aspect: i, texture: a } = c(() =>
|
|
4893
|
+
function Po({ color: e, label: t, position: n, rotation: r }) {
|
|
4894
|
+
let { aspect: i, texture: a } = c(() => No(t, e), [e, t]);
|
|
4893
4895
|
return o(() => () => a.dispose(), [a]), /* @__PURE__ */ R("mesh", {
|
|
4894
4896
|
position: n,
|
|
4895
4897
|
rotation: r,
|
|
4896
|
-
children: [/* @__PURE__ */ L("planeGeometry", { args: [
|
|
4898
|
+
children: [/* @__PURE__ */ L("planeGeometry", { args: [To * i, To] }), /* @__PURE__ */ L("meshBasicMaterial", {
|
|
4897
4899
|
alphaTest: .1,
|
|
4898
4900
|
depthWrite: !1,
|
|
4899
4901
|
map: a,
|
|
@@ -4902,41 +4904,41 @@ function No({ color: e, label: t, position: n, rotation: r }) {
|
|
|
4902
4904
|
})]
|
|
4903
4905
|
});
|
|
4904
4906
|
}
|
|
4905
|
-
function
|
|
4907
|
+
function Fo(e) {
|
|
4906
4908
|
return Math.abs(e.y) > .9 ? new I(0, 0, e.y > 0 ? -1 : 1) : new I(0, 1, 0);
|
|
4907
4909
|
}
|
|
4908
|
-
function
|
|
4910
|
+
function Io(e, t) {
|
|
4909
4911
|
let n = e.current;
|
|
4910
|
-
return !n || (n.updateWorldMatrix(!0, !0),
|
|
4912
|
+
return !n || (n.updateWorldMatrix(!0, !0), Eo.setFromObject(n), Eo.isEmpty()) ? (Q.center.copy(t), Q.radius = 10, Q) : (Eo.getBoundingSphere(Q), (!Number.isFinite(Q.radius) || Q.radius <= 0) && (Q.radius = 10), Q);
|
|
4911
4913
|
}
|
|
4912
|
-
function
|
|
4914
|
+
function Lo(e) {
|
|
4913
4915
|
return e.current?.getTarget(new I()) ?? new I();
|
|
4914
4916
|
}
|
|
4915
|
-
function
|
|
4916
|
-
let a =
|
|
4917
|
+
function Ro({ camera: e, controlRef: t, direction: n, modelRef: r, transitionRef: i }) {
|
|
4918
|
+
let a = Lo(t), o = Io(r, a), s = o.center.clone(), c = new I(...n).normalize(), l = e.position.distanceTo(a), u = Number.isFinite(l) && l > o.radius * .5 ? l : o.radius * 2.4, d = s.clone().addScaledVector(c, u);
|
|
4917
4919
|
t.current?.cancel(), t.current?.setFocalOffset(0, 0, 0, !1), i.current = {
|
|
4918
4920
|
endPosition: d,
|
|
4919
4921
|
endTarget: s,
|
|
4920
|
-
endUp:
|
|
4922
|
+
endUp: Fo(c),
|
|
4921
4923
|
startPosition: e.position.clone(),
|
|
4922
4924
|
startTarget: a,
|
|
4923
4925
|
startTime: performance.now(),
|
|
4924
4926
|
startUp: e.up.clone()
|
|
4925
4927
|
};
|
|
4926
4928
|
}
|
|
4927
|
-
function
|
|
4929
|
+
function zo({ action: e, onPick: t }) {
|
|
4928
4930
|
let [n, r] = u(!1);
|
|
4929
4931
|
return /* @__PURE__ */ R("group", {
|
|
4930
4932
|
position: e.position,
|
|
4931
|
-
onClick:
|
|
4933
|
+
onClick: Ao,
|
|
4932
4934
|
onPointerDown: (n) => {
|
|
4933
|
-
|
|
4935
|
+
Ao(n), t(e);
|
|
4934
4936
|
},
|
|
4935
4937
|
onPointerEnter: (e) => {
|
|
4936
|
-
|
|
4938
|
+
Ao(e), r(!0);
|
|
4937
4939
|
},
|
|
4938
4940
|
onPointerLeave: (e) => {
|
|
4939
|
-
|
|
4941
|
+
Ao(e), r(!1);
|
|
4940
4942
|
},
|
|
4941
4943
|
children: [/* @__PURE__ */ R("mesh", {
|
|
4942
4944
|
scale: e.scale,
|
|
@@ -4945,11 +4947,11 @@ function Ro({ action: e, onPick: t }) {
|
|
|
4945
4947
|
1,
|
|
4946
4948
|
1
|
|
4947
4949
|
] }), /* @__PURE__ */ L("meshBasicMaterial", {
|
|
4948
|
-
color:
|
|
4949
|
-
opacity:
|
|
4950
|
+
color: jo(n),
|
|
4951
|
+
opacity: Mo(n),
|
|
4950
4952
|
transparent: !0
|
|
4951
4953
|
})]
|
|
4952
|
-
}), e.label && /* @__PURE__ */ L(
|
|
4954
|
+
}), e.label && /* @__PURE__ */ L(Po, {
|
|
4953
4955
|
color: n ? "#ffffff" : "#50606f",
|
|
4954
4956
|
label: e.label,
|
|
4955
4957
|
position: [
|
|
@@ -4961,11 +4963,11 @@ function Ro({ action: e, onPick: t }) {
|
|
|
4961
4963
|
})]
|
|
4962
4964
|
});
|
|
4963
4965
|
}
|
|
4964
|
-
function
|
|
4966
|
+
function Bo({ active: e = !0, cameraRef: t, controlRef: n, modelRef: r }) {
|
|
4965
4967
|
let i = l(null), a = l(null), o = c(() => [
|
|
4966
|
-
...
|
|
4967
|
-
...
|
|
4968
|
-
...
|
|
4968
|
+
...Do,
|
|
4969
|
+
...Oo(),
|
|
4970
|
+
...ko()
|
|
4969
4971
|
], []);
|
|
4970
4972
|
return f(() => {
|
|
4971
4973
|
if (!e) return;
|
|
@@ -4974,7 +4976,7 @@ function zo({ active: e = !0, cameraRef: t, controlRef: n, modelRef: r }) {
|
|
|
4974
4976
|
i.current && i.current.quaternion.copy(r.quaternion).invert();
|
|
4975
4977
|
let o = a.current;
|
|
4976
4978
|
if (!o) return;
|
|
4977
|
-
let s = performance.now() - o.startTime, c = Math.min(s /
|
|
4979
|
+
let s = performance.now() - o.startTime, c = Math.min(s / Co, 1), l = 1 - (1 - c) ** 3, u = n.current;
|
|
4978
4980
|
if (r.position.lerpVectors(o.startPosition, o.endPosition, l), r.up.lerpVectors(o.startUp, o.endUp, l), u) {
|
|
4979
4981
|
let e = new I().lerpVectors(o.startTarget, o.endTarget, l);
|
|
4980
4982
|
u.setLookAt(r.position.x, r.position.y, r.position.z, e.x, e.y, e.z, !1);
|
|
@@ -4982,12 +4984,12 @@ function zo({ active: e = !0, cameraRef: t, controlRef: n, modelRef: r }) {
|
|
|
4982
4984
|
c >= 1 && (r.up.copy(o.endUp), u?.setLookAt(o.endPosition.x, o.endPosition.y, o.endPosition.z, o.endTarget.x, o.endTarget.y, o.endTarget.z, !1), a.current = null);
|
|
4983
4985
|
}), e ? /* @__PURE__ */ L("group", {
|
|
4984
4986
|
ref: i,
|
|
4985
|
-
scale:
|
|
4986
|
-
children: o.map((e) => /* @__PURE__ */ L(
|
|
4987
|
+
scale: xo,
|
|
4988
|
+
children: o.map((e) => /* @__PURE__ */ L(zo, {
|
|
4987
4989
|
action: e,
|
|
4988
4990
|
onPick: (e) => {
|
|
4989
4991
|
let i = t.current;
|
|
4990
|
-
i &&
|
|
4992
|
+
i && Ro({
|
|
4991
4993
|
camera: i,
|
|
4992
4994
|
controlRef: n,
|
|
4993
4995
|
direction: e.direction,
|
|
@@ -5000,13 +5002,13 @@ function zo({ active: e = !0, cameraRef: t, controlRef: n, modelRef: r }) {
|
|
|
5000
5002
|
}
|
|
5001
5003
|
//#endregion
|
|
5002
5004
|
//#region src/viewer/Viewer.tsx
|
|
5003
|
-
var
|
|
5005
|
+
var Vo = class {
|
|
5004
5006
|
sceneApi = null;
|
|
5005
5007
|
get = () => this.sceneApi;
|
|
5006
5008
|
set = (e) => {
|
|
5007
5009
|
this.sceneApi = e;
|
|
5008
5010
|
};
|
|
5009
|
-
},
|
|
5011
|
+
}, Ho = {
|
|
5010
5012
|
bottom: 16,
|
|
5011
5013
|
height: 96,
|
|
5012
5014
|
pointerEvents: "auto",
|
|
@@ -5015,11 +5017,11 @@ var Bo = class {
|
|
|
5015
5017
|
touchAction: "none",
|
|
5016
5018
|
width: 96,
|
|
5017
5019
|
zIndex: 2
|
|
5018
|
-
},
|
|
5020
|
+
}, Uo = {
|
|
5019
5021
|
height: "100%",
|
|
5020
5022
|
position: "relative",
|
|
5021
5023
|
width: "100%"
|
|
5022
|
-
},
|
|
5024
|
+
}, Wo = {
|
|
5023
5025
|
far: 50,
|
|
5024
5026
|
near: .1,
|
|
5025
5027
|
position: [
|
|
@@ -5028,40 +5030,49 @@ var Bo = class {
|
|
|
5028
5030
|
10
|
|
5029
5031
|
],
|
|
5030
5032
|
zoom: 72
|
|
5031
|
-
},
|
|
5033
|
+
}, Go = {
|
|
5032
5034
|
alpha: !0,
|
|
5033
5035
|
antialias: !0
|
|
5034
|
-
},
|
|
5036
|
+
}, Ko = {
|
|
5035
5037
|
alpha: !0,
|
|
5036
5038
|
antialias: !1,
|
|
5037
5039
|
powerPreference: "high-performance"
|
|
5038
|
-
},
|
|
5040
|
+
}, qo = {
|
|
5039
5041
|
antialias: !1,
|
|
5040
5042
|
powerPreference: "high-performance"
|
|
5041
|
-
},
|
|
5042
|
-
function
|
|
5043
|
+
}, Jo = .1, Yo = .02, Xo = 1e3, Zo = 50, Qo = 1.25, $o = .08, es = new g(), ts = new de(), $ = new I(), ns = new I(), rs = new I();
|
|
5044
|
+
function is(e, t) {
|
|
5043
5045
|
return Array.isArray(e) ? [Math.min(e[0], t), Math.min(e[1], t)] : typeof e == "number" ? Math.min(e, t) : t;
|
|
5044
5046
|
}
|
|
5045
|
-
function
|
|
5047
|
+
function as() {
|
|
5046
5048
|
let e = navigator, t = navigator.userAgent.toLowerCase(), n = navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1, r = window.matchMedia?.("(pointer: coarse)").matches ?? !1;
|
|
5047
5049
|
return e.userAgentData?.mobile || n || /android|iphone|ipad|ipod|mobile|tablet/.test(t) || navigator.maxTouchPoints > 1 && r ? "mobile" : "pc";
|
|
5048
5050
|
}
|
|
5049
|
-
function
|
|
5050
|
-
let t =
|
|
5051
|
-
return t ? Math.max(t.radius *
|
|
5051
|
+
function os(e) {
|
|
5052
|
+
let t = ss(e);
|
|
5053
|
+
return t ? Math.max(t.radius * Yo, Jo) : Jo;
|
|
5052
5054
|
}
|
|
5053
|
-
function
|
|
5054
|
-
if (!e || (
|
|
5055
|
-
let t =
|
|
5055
|
+
function ss(e) {
|
|
5056
|
+
if (!e || (es.setFromObject(e), es.isEmpty())) return null;
|
|
5057
|
+
let t = es.getBoundingSphere(ts);
|
|
5056
5058
|
return !Number.isFinite(t.radius) || t.radius <= 0 ? null : t;
|
|
5057
5059
|
}
|
|
5058
|
-
function
|
|
5059
|
-
|
|
5060
|
+
function cs(e) {
|
|
5061
|
+
return e.type === "Group" && typeof e.userData.modelID == "number";
|
|
5062
|
+
}
|
|
5063
|
+
function ls(e) {
|
|
5064
|
+
return e?.children.filter(cs) ?? [];
|
|
5065
|
+
}
|
|
5066
|
+
function us(e, t) {
|
|
5067
|
+
return ls(e).find((e) => e.userData.modelID === t) ?? null;
|
|
5068
|
+
}
|
|
5069
|
+
function ds(e, t) {
|
|
5070
|
+
let n = ss(t);
|
|
5060
5071
|
if (!n) return;
|
|
5061
|
-
let r = Math.max(
|
|
5072
|
+
let r = Math.max(Xo, n.radius * Zo, e.near + 1);
|
|
5062
5073
|
Math.abs(e.far - r) < 1 || (e.far = r, e.updateProjectionMatrix());
|
|
5063
5074
|
}
|
|
5064
|
-
function
|
|
5075
|
+
function fs(e, t, n, r, i) {
|
|
5065
5076
|
let a = n.elementIndex.get(i);
|
|
5066
5077
|
a && a.forEach((n) => {
|
|
5067
5078
|
let { record: i, vertexRanges: a } = n;
|
|
@@ -5073,20 +5084,24 @@ function os(e, t, n, r, i) {
|
|
|
5073
5084
|
}));
|
|
5074
5085
|
});
|
|
5075
5086
|
}
|
|
5076
|
-
function
|
|
5087
|
+
function ps(e, t) {
|
|
5077
5088
|
let n = new g(), r = new I();
|
|
5078
5089
|
return Object.entries(e).forEach(([e, i]) => {
|
|
5079
5090
|
let a = Number(e);
|
|
5080
5091
|
i.forEach((e) => {
|
|
5081
|
-
|
|
5092
|
+
fs(n, r, t, a, e);
|
|
5082
5093
|
});
|
|
5083
5094
|
}), n.isEmpty() ? null : n;
|
|
5084
5095
|
}
|
|
5085
|
-
function
|
|
5086
|
-
let t = e.getSize(
|
|
5087
|
-
return Number.isFinite(n) && n > 0 ? n *
|
|
5096
|
+
function ms(e) {
|
|
5097
|
+
let t = e.getSize(rs), n = Math.max(t.x, t.y, t.z);
|
|
5098
|
+
return Number.isFinite(n) && n > 0 ? n * $o : Jo;
|
|
5099
|
+
}
|
|
5100
|
+
function hs(e, t, n) {
|
|
5101
|
+
let r = Math.max(Jo, (Number.isFinite(n) ? n : Jo) * Qo), i = t.position.distanceTo(e);
|
|
5102
|
+
return Number.isFinite(i) && i >= r ? e : ($.copy(e).sub(t.position), (!Number.isFinite($.x + $.y + $.z) || $.lengthSq() === 0) && t.getWorldDirection($), $.lengthSq() === 0 && $.set(0, 0, -1), $.normalize(), ns.copy(t.position).addScaledVector($, r));
|
|
5088
5103
|
}
|
|
5089
|
-
function
|
|
5104
|
+
function gs({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, materialMode: a, modelRef: s, modelsData: u, onReady: d, publicApi: f, setSceneApi: g }) {
|
|
5090
5105
|
let _ = p((e) => e.camera), v = p((e) => e.gl), y = Mt(s), b = Ut(y), { colorPaletteTexture: x, colorUtils: S } = Ge(y), C = Bn(s), w = vn(s, n, C), T = Nn(s, n, C), E = c(() => new ra(), []), D = b.buildIndex, ee = y.resetIndex, te = S.applyStoredColors, ne = Fr(), O = l(null), k = l(!1), A = z((e) => e.showStats), re = c(() => {
|
|
5091
5106
|
let e = Object.keys(u).sort((e, t) => Number(e) - Number(t));
|
|
5092
5107
|
for (let t of e) {
|
|
@@ -5095,12 +5110,14 @@ function ls({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, materi
|
|
|
5095
5110
|
}
|
|
5096
5111
|
return null;
|
|
5097
5112
|
}, [u]), j = c(() => bt(re ?? void 0), [re]), M = c(() => Object.entries(u).map(([e, t]) => [Number(e), t]), [u]), N = i(() => {
|
|
5098
|
-
n.current && (n.current.minDistance =
|
|
5099
|
-
}, [n, s]), P = i((e) => {
|
|
5100
|
-
let
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5113
|
+
n.current && (n.current.minDistance = os(s.current));
|
|
5114
|
+
}, [n, s]), P = i((e, t = !1) => {
|
|
5115
|
+
let r = n.current;
|
|
5116
|
+
if (!r) return !1;
|
|
5117
|
+
let i = t ? hs(e, _, r.minDistance) : e;
|
|
5118
|
+
return r.cancel(), r.setOrbitPoint(i.x, i.y, i.z), !0;
|
|
5119
|
+
}, [_, n]), ie = i((e) => {
|
|
5120
|
+
O.current = e.clone(), P(e, !0);
|
|
5104
5121
|
}, [P]), ae = i(() => {
|
|
5105
5122
|
O.current = null, ne(s, n, r);
|
|
5106
5123
|
}, [
|
|
@@ -5111,11 +5128,11 @@ function ls({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, materi
|
|
|
5111
5128
|
]), ce = i((e, t = !1) => {
|
|
5112
5129
|
let r = n.current;
|
|
5113
5130
|
if (!r) return;
|
|
5114
|
-
let i =
|
|
5131
|
+
let i = ps(e, y.buildIndex());
|
|
5115
5132
|
if (!i) return;
|
|
5116
5133
|
let a = i.getCenter(new I());
|
|
5117
5134
|
if (O.current = a.clone(), r.cancel(), t) {
|
|
5118
|
-
let e =
|
|
5135
|
+
let e = ms(i);
|
|
5119
5136
|
r.fitToBox(i, !0, {
|
|
5120
5137
|
paddingBottom: e,
|
|
5121
5138
|
paddingLeft: e,
|
|
@@ -5123,11 +5140,11 @@ function ls({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, materi
|
|
|
5123
5140
|
paddingTop: e
|
|
5124
5141
|
}).then(() => {
|
|
5125
5142
|
let e = O.current;
|
|
5126
|
-
e &&
|
|
5143
|
+
e && P(e, !0);
|
|
5127
5144
|
});
|
|
5128
5145
|
return;
|
|
5129
5146
|
}
|
|
5130
|
-
P(a);
|
|
5147
|
+
P(a, !0);
|
|
5131
5148
|
}, [
|
|
5132
5149
|
P,
|
|
5133
5150
|
n,
|
|
@@ -5149,7 +5166,7 @@ function ls({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, materi
|
|
|
5149
5166
|
return Mr(s, n, C, ie), Fn(), o(() => {
|
|
5150
5167
|
let e = v.domElement, t = (e) => {
|
|
5151
5168
|
let t = O.current;
|
|
5152
|
-
t && e.button === 0 && (e.ctrlKey || e.metaKey || e.shiftKey || P(t));
|
|
5169
|
+
t && e.button === 0 && (e.ctrlKey || e.metaKey || e.shiftKey || P(t, !0));
|
|
5153
5170
|
};
|
|
5154
5171
|
return e.addEventListener("pointerdown", t, !0), () => {
|
|
5155
5172
|
e.removeEventListener("pointerdown", t, !0);
|
|
@@ -5161,7 +5178,7 @@ function ls({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, materi
|
|
|
5161
5178
|
}), [_, t]), o(() => {
|
|
5162
5179
|
if (!s.current) return;
|
|
5163
5180
|
let t = requestAnimationFrame(() => {
|
|
5164
|
-
s.current?.updateMatrixWorld(!0), (_ instanceof se || _ instanceof oe) &&
|
|
5181
|
+
s.current?.updateMatrixWorld(!0), (_ instanceof se || _ instanceof oe) && ds(_, s.current), N(), ee(), D(), te(), w.syncWithModel(), T.syncWithModel(), e && ae();
|
|
5165
5182
|
});
|
|
5166
5183
|
return () => cancelAnimationFrame(t);
|
|
5167
5184
|
}, [
|
|
@@ -5233,6 +5250,8 @@ function ls({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, materi
|
|
|
5233
5250
|
geometryUtils: {
|
|
5234
5251
|
getAllIds: b.getAllIds,
|
|
5235
5252
|
getIfcSpacesVisibility: b.getIfcSpacesVisibility,
|
|
5253
|
+
getModelGeometry: (e) => us(s.current, e),
|
|
5254
|
+
getModelsGeometry: () => ls(s.current),
|
|
5236
5255
|
hideByIds: (e) => t(() => b.hideByIds(e)),
|
|
5237
5256
|
hideSelected: () => t(b.hideSelected),
|
|
5238
5257
|
isolateByIds: (e) => t(() => b.isolateByIds(e)),
|
|
@@ -5290,13 +5309,13 @@ function ls({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, materi
|
|
|
5290
5309
|
dollyToCursor: !0,
|
|
5291
5310
|
draggingSmoothTime: .04,
|
|
5292
5311
|
infinityDolly: !0,
|
|
5293
|
-
minDistance:
|
|
5312
|
+
minDistance: Jo,
|
|
5294
5313
|
ref: n,
|
|
5295
5314
|
smoothTime: .12
|
|
5296
5315
|
})
|
|
5297
5316
|
] });
|
|
5298
5317
|
}
|
|
5299
|
-
function
|
|
5318
|
+
function _s({ autoFitCamera: e = !0, camera: t = {
|
|
5300
5319
|
position: [
|
|
5301
5320
|
10,
|
|
5302
5321
|
10,
|
|
@@ -5304,9 +5323,9 @@ function us({ autoFitCamera: e = !0, camera: t = {
|
|
|
5304
5323
|
],
|
|
5305
5324
|
fov: 50
|
|
5306
5325
|
}, dpr: n = window.devicePixelRatio, modelUrls: r, modelSources: i, modelsData: a, materialMode: s, onReady: c, performanceMode: f = !1, publicApi: p, setSceneApi: m, showNavCube: h, showStats: g }) {
|
|
5307
|
-
let _ = l(null), v = l(null), y = l(null), b = l(null), [x, S] = u(), C = Ee(), w = z((e) => e.setModelNames), T = z((e) => e.setModelProps), E = z((e) => e.setModelStructure), D = z((e) => e.setShowNavCube), ee = z((e) => e.setShowStats), te = z((e) => e.setUserDevice), ne = z((e) => e.showNavCube), O = a ?? x, k = f ?
|
|
5326
|
+
let _ = l(null), v = l(null), y = l(null), b = l(null), [x, S] = u(), C = Ee(), w = z((e) => e.setModelNames), T = z((e) => e.setModelProps), E = z((e) => e.setModelStructure), D = z((e) => e.setShowNavCube), ee = z((e) => e.setShowStats), te = z((e) => e.setUserDevice), ne = z((e) => e.showNavCube), O = a ?? x, k = f ? is(n, 1) : n, A = s ?? (f ? "performance" : void 0);
|
|
5308
5327
|
return o(() => {
|
|
5309
|
-
te(
|
|
5328
|
+
te(as());
|
|
5310
5329
|
}, [te]), o(() => {
|
|
5311
5330
|
ee(!!g);
|
|
5312
5331
|
}, [ee, g]), o(() => {
|
|
@@ -5337,14 +5356,14 @@ function us({ autoFitCamera: e = !0, camera: t = {
|
|
|
5337
5356
|
i,
|
|
5338
5357
|
r
|
|
5339
5358
|
]), O ? /* @__PURE__ */ R("div", {
|
|
5340
|
-
style:
|
|
5359
|
+
style: Uo,
|
|
5341
5360
|
children: [/* @__PURE__ */ L(d, {
|
|
5342
5361
|
camera: t,
|
|
5343
5362
|
dpr: k,
|
|
5344
|
-
gl: f ?
|
|
5363
|
+
gl: f ? qo : void 0,
|
|
5345
5364
|
children: /* @__PURE__ */ L(Ir, {
|
|
5346
5365
|
store: C,
|
|
5347
|
-
children: /* @__PURE__ */ L(
|
|
5366
|
+
children: /* @__PURE__ */ L(gs, {
|
|
5348
5367
|
autoFitCamera: e,
|
|
5349
5368
|
cameraRef: _,
|
|
5350
5369
|
controlRef: v,
|
|
@@ -5358,13 +5377,13 @@ function us({ autoFitCamera: e = !0, camera: t = {
|
|
|
5358
5377
|
})
|
|
5359
5378
|
})
|
|
5360
5379
|
}), ne && /* @__PURE__ */ L("div", {
|
|
5361
|
-
style:
|
|
5380
|
+
style: Ho,
|
|
5362
5381
|
children: /* @__PURE__ */ L(d, {
|
|
5363
|
-
camera:
|
|
5382
|
+
camera: Wo,
|
|
5364
5383
|
dpr: k,
|
|
5365
|
-
gl: f ?
|
|
5384
|
+
gl: f ? Ko : Go,
|
|
5366
5385
|
orthographic: !0,
|
|
5367
|
-
children: /* @__PURE__ */ L(
|
|
5386
|
+
children: /* @__PURE__ */ L(Bo, {
|
|
5368
5387
|
active: !0,
|
|
5369
5388
|
cameraRef: _,
|
|
5370
5389
|
controlRef: v,
|
|
@@ -5374,8 +5393,8 @@ function us({ autoFitCamera: e = !0, camera: t = {
|
|
|
5374
5393
|
})]
|
|
5375
5394
|
}) : /* @__PURE__ */ L(Ce, {});
|
|
5376
5395
|
}
|
|
5377
|
-
var
|
|
5378
|
-
let [n] = u(Ae), r = l(!1), a = l(!1), d = c(() => new
|
|
5396
|
+
var vs = n(function(e, t) {
|
|
5397
|
+
let [n] = u(Ae), r = l(!1), a = l(!1), d = c(() => new Vo(), []), { defaultSelected: f, onSelectedChange: p, selected: m } = e, h = i((e) => {
|
|
5379
5398
|
d.set(e);
|
|
5380
5399
|
}, [d]), g = c(() => ba(n, d.get), [d, n]);
|
|
5381
5400
|
return s(t, () => g, [g]), o(() => (n.getState().setApi(g), () => {
|
|
@@ -5394,13 +5413,13 @@ var ds = n(function(e, t) {
|
|
|
5394
5413
|
});
|
|
5395
5414
|
}, [p, n]), /* @__PURE__ */ L(Ir, {
|
|
5396
5415
|
store: n,
|
|
5397
|
-
children: /* @__PURE__ */ L(
|
|
5416
|
+
children: /* @__PURE__ */ L(_s, {
|
|
5398
5417
|
...e,
|
|
5399
5418
|
publicApi: g,
|
|
5400
5419
|
setSceneApi: h
|
|
5401
5420
|
})
|
|
5402
5421
|
});
|
|
5403
5422
|
});
|
|
5404
|
-
|
|
5423
|
+
vs.displayName = "Viewer";
|
|
5405
5424
|
//#endregion
|
|
5406
|
-
export { Sa as BMTLoader, ra as BmtConverter, aa as ConvertIfcFileToBmt, oa as ConvertToBmt, Tn as DimensionLine, Mn as DimensionsUtils, _a as FilteredElementsCollector, vt as ModelGrids,
|
|
5425
|
+
export { Sa as BMTLoader, ra as BmtConverter, aa as ConvertIfcFileToBmt, oa as ConvertToBmt, Tn as DimensionLine, Mn as DimensionsUtils, _a as FilteredElementsCollector, vt as ModelGrids, Bo as NavigationCube, vs as Viewer, Ir as ViewerStoreProvider, ia as bmtConverter, qa as convertIfcFilesToBmtInWorker, Ja as createBmtConverterWorker, Ma as createBmtWorker, oo as createIfcWorker, Ae as createViewerStore, wi as exportExcel, xi as exportModelPropertiesToExcel, ja as loadBmtModelsInWorker, ao as loadIfcModelsInWorker, mo as loader, Nn as useDimensionsUtils, z as useViewerStore, Ee as useViewerStoreApi };
|