bimatter-viewer-react 0.6.5 → 0.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
import e, { createContext as t, forwardRef as n, memo as r, useCallback as i, useContext as a, useEffect as o, useImperativeHandle as s, useMemo as c, useRef as l, useState as u } from "react";
|
|
2
2
|
import { Canvas as d, useFrame as f, useThree as p } from "@react-three/fiber";
|
|
3
3
|
import { CameraControls as m, Stats as h } from "@react-three/drei";
|
|
4
|
-
import { Box3 as g, BoxGeometry as _, BufferAttribute as v, BufferGeometry as y, CanvasTexture as b, Color as x, ConeGeometry as S, DataTexture as C, DoubleSide as w, DynamicDrawUsage as T, Float32BufferAttribute as E, Group as D, Line as O, Line3 as ee, LineBasicMaterial as te, LineDashedMaterial as ne, LineSegments as k, LinearFilter as A, LinearMipmapLinearFilter as j, MathUtils as M, Matrix4 as N, Mesh as P, MeshBasicMaterial as F, MeshLambertMaterial as re, NearestFilter as ie, Object3D as ae, OrthographicCamera as oe, PerspectiveCamera as se, Plane as I, RGBAFormat as
|
|
5
|
-
import { useStore as
|
|
6
|
-
import { createStore as
|
|
7
|
-
import { CONTAINED as
|
|
8
|
-
import { Fragment as
|
|
9
|
-
import
|
|
4
|
+
import { Box3 as g, BoxGeometry as _, BufferAttribute as v, BufferGeometry as y, CanvasTexture as b, Color as x, ConeGeometry as S, DataTexture as C, DoubleSide as w, DynamicDrawUsage as T, Float32BufferAttribute as E, Group as D, Line as O, Line3 as ee, LineBasicMaterial as te, LineDashedMaterial as ne, LineSegments as k, LinearFilter as A, LinearMipmapLinearFilter as j, MathUtils as M, Matrix4 as N, Mesh as P, MeshBasicMaterial as F, MeshLambertMaterial as re, NearestFilter as ie, Object3D as ae, OrthographicCamera as oe, PerspectiveCamera as se, Plane as I, RGBAFormat as L, RepeatWrapping as ce, SRGBColorSpace as R, ShapeUtils as le, Sphere as ue, SphereGeometry as de, Sprite as fe, SpriteMaterial as pe, Uint32BufferAttribute as me, UnsignedByteType as he, Vector2 as z, Vector3 as B } from "three";
|
|
5
|
+
import { useStore as ge } from "zustand";
|
|
6
|
+
import { createStore as _e } from "zustand/vanilla";
|
|
7
|
+
import { CONTAINED as ve, INTERSECTED as ye, MeshBVH as be, NOT_INTERSECTED as xe, acceleratedRaycast as Se } from "three-mesh-bvh";
|
|
8
|
+
import { Fragment as Ce, jsx as V, jsxs as H } from "react/jsx-runtime";
|
|
9
|
+
import we from "pako";
|
|
10
10
|
//#region src/viewer/store/ViewerStoreContext.ts
|
|
11
|
-
var
|
|
11
|
+
var Te = t(null);
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/viewer/store/useViewerStore.ts
|
|
14
|
-
function
|
|
15
|
-
return
|
|
14
|
+
function U(e) {
|
|
15
|
+
return ge(Ee(), e);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
let e = a(
|
|
17
|
+
function Ee() {
|
|
18
|
+
let e = a(Te);
|
|
19
19
|
if (!e) throw Error("useViewerStore must be used inside ViewerStoreProvider");
|
|
20
20
|
return e;
|
|
21
21
|
}
|
|
22
22
|
//#endregion
|
|
23
23
|
//#region src/viewer/store/ViewerStore.ts
|
|
24
|
-
var
|
|
24
|
+
var De = "rgb(17, 148, 189)", Oe = "rgb(104, 198, 227)", ke = {
|
|
25
25
|
bottom: !0,
|
|
26
26
|
left: !0,
|
|
27
27
|
right: !0,
|
|
28
28
|
top: !0,
|
|
29
29
|
visible: !0
|
|
30
30
|
};
|
|
31
|
-
function
|
|
32
|
-
return
|
|
31
|
+
function Ae() {
|
|
32
|
+
return _e((e) => ({
|
|
33
33
|
api: null,
|
|
34
34
|
defaultHotkeysEnabled: !0,
|
|
35
|
-
gridAxesVisibility:
|
|
35
|
+
gridAxesVisibility: ke,
|
|
36
36
|
modelNames: {},
|
|
37
37
|
modelProps: {},
|
|
38
38
|
modelStructure: {},
|
|
39
|
-
preselectionColor:
|
|
39
|
+
preselectionColor: Oe,
|
|
40
40
|
selected: {},
|
|
41
|
-
selectionColor:
|
|
41
|
+
selectionColor: De,
|
|
42
42
|
selectionInteractionDisabled: !1,
|
|
43
43
|
showNavCube: !0,
|
|
44
44
|
showStats: !1,
|
|
@@ -119,66 +119,66 @@ function je() {
|
|
|
119
119
|
}
|
|
120
120
|
}));
|
|
121
121
|
}
|
|
122
|
-
var
|
|
123
|
-
function
|
|
124
|
-
let e = new C(new Uint8Array(256 * 4), 256, 1,
|
|
125
|
-
return e.magFilter = ie, e.minFilter = ie, e.generateMipmaps = !1, e.needsUpdate = !0,
|
|
122
|
+
var je = 2;
|
|
123
|
+
function Me() {
|
|
124
|
+
let e = new C(new Uint8Array(256 * 4), 256, 1, L, he);
|
|
125
|
+
return e.magFilter = ie, e.minFilter = ie, e.generateMipmaps = !1, e.needsUpdate = !0, Pe(e, 1, new x(De)), e;
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function Ne(e) {
|
|
128
128
|
return `${e.r.toFixed(6)}:${e.g.toFixed(6)}:${e.b.toFixed(6)}`;
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function Pe(e, t, n) {
|
|
131
131
|
let r = e.image.data, i = t * 4;
|
|
132
132
|
r[i] = Math.round(n.r * 255), r[i + 1] = Math.round(n.g * 255), r[i + 2] = Math.round(n.b * 255), r[i + 3] = 255, e.needsUpdate = !0;
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function Fe(e) {
|
|
135
135
|
return e.mesh.geometry.attributes.colorIndex;
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function Ie(e) {
|
|
138
138
|
let t = e.mesh.geometry.attributes.ids;
|
|
139
139
|
if (!t) return null;
|
|
140
140
|
let n = new v(new Uint8Array(t.count), 1);
|
|
141
141
|
return e.mesh.geometry.setAttribute("colorIndex", n), n;
|
|
142
142
|
}
|
|
143
|
-
function
|
|
144
|
-
let n =
|
|
145
|
-
return n || t === 0 ? n :
|
|
143
|
+
function Le(e, t) {
|
|
144
|
+
let n = Fe(e);
|
|
145
|
+
return n || t === 0 ? n : Ie(e);
|
|
146
146
|
}
|
|
147
|
-
function
|
|
148
|
-
|
|
147
|
+
function Re(e) {
|
|
148
|
+
Fe(e) && e.mesh.geometry.deleteAttribute("colorIndex");
|
|
149
149
|
}
|
|
150
|
-
function
|
|
150
|
+
function ze(e, t, n) {
|
|
151
151
|
let r = e.get(t);
|
|
152
152
|
return !r && n && (r = /* @__PURE__ */ new Set(), e.set(t, r)), r;
|
|
153
153
|
}
|
|
154
|
-
function
|
|
155
|
-
let n =
|
|
154
|
+
function Be(e, t) {
|
|
155
|
+
let n = Le(e.record, t);
|
|
156
156
|
if (!n) return !1;
|
|
157
157
|
let r = n.array;
|
|
158
158
|
return e.vertexRanges.forEach(({ count: e, start: n }) => {
|
|
159
159
|
r.fill(t, n, n + e);
|
|
160
160
|
}), n.needsUpdate = !0, !0;
|
|
161
161
|
}
|
|
162
|
-
function
|
|
162
|
+
function Ve(e, t, n, r, i) {
|
|
163
163
|
e && e.forEach((e) => {
|
|
164
164
|
if (e.record.modelID !== t) return;
|
|
165
|
-
let a =
|
|
166
|
-
r === 0 ? (o?.delete(n), o?.size || (i.delete(e.record),
|
|
165
|
+
let a = Be(e, r), o = ze(i, e.record, r !== 0 && a);
|
|
166
|
+
r === 0 ? (o?.delete(n), o?.size || (i.delete(e.record), Re(e.record))) : a && o?.add(n);
|
|
167
167
|
});
|
|
168
168
|
}
|
|
169
|
-
function
|
|
169
|
+
function He(e, t, n) {
|
|
170
170
|
let r = /* @__PURE__ */ new Set();
|
|
171
171
|
return e.elementIndex.forEach((e, i) => {
|
|
172
172
|
n.has(i) || e.some((e) => e.record.modelID === t) && r.add(i);
|
|
173
173
|
}), r;
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function Ue(e) {
|
|
176
176
|
let t = /* @__PURE__ */ new Set();
|
|
177
177
|
return Object.entries(e).forEach(([e, n]) => {
|
|
178
178
|
n.forEach((n) => t.add(`${e}:${n}`));
|
|
179
179
|
}), t;
|
|
180
180
|
}
|
|
181
|
-
function
|
|
181
|
+
function We(e, t) {
|
|
182
182
|
let n = /* @__PURE__ */ new Map(), r = (e) => {
|
|
183
183
|
let [t, r] = e.split(":").map(Number), i = n.get(t);
|
|
184
184
|
i || (i = /* @__PURE__ */ new Set(), n.set(t, i)), i.add(r);
|
|
@@ -189,28 +189,28 @@ function Ge(e, t) {
|
|
|
189
189
|
t.has(e) || r(e);
|
|
190
190
|
}), n;
|
|
191
191
|
}
|
|
192
|
-
function
|
|
193
|
-
let t =
|
|
192
|
+
function Ge(e) {
|
|
193
|
+
let t = U((e) => e.selected), n = U((e) => e.selectionColor), r = c(() => Me(), []), a = l(/* @__PURE__ */ new Map()), s = l(je), u = l(/* @__PURE__ */ new Map()), d = l(t), f = l(/* @__PURE__ */ new Set()), p = l(/* @__PURE__ */ new WeakMap());
|
|
194
194
|
o(() => {
|
|
195
195
|
d.current = t;
|
|
196
196
|
}, [t]), o(() => () => r.dispose(), [r]), o(() => {
|
|
197
|
-
|
|
197
|
+
Pe(r, 1, new x(n));
|
|
198
198
|
}, [r, n]);
|
|
199
199
|
let m = i((e, t) => d.current[e]?.has(t) ? 1 : u.current.get(e)?.get(t) ?? 0, []), h = i((t, n) => {
|
|
200
200
|
let r = e.buildIndex();
|
|
201
201
|
n.forEach((e) => {
|
|
202
|
-
|
|
202
|
+
Ve(r.elementIndex.get(e), t, e, m(t, e), p.current);
|
|
203
203
|
});
|
|
204
204
|
}, [e, m]), g = i((e) => {
|
|
205
|
-
let t = new x(e), n =
|
|
205
|
+
let t = new x(e), n = Ne(t), i = a.current.get(n);
|
|
206
206
|
if (i !== void 0) return i;
|
|
207
207
|
let o = s.current;
|
|
208
208
|
if (o >= 256) throw Error("Element color palette is full. Maximum colors: 255.");
|
|
209
|
-
return a.current.set(n, o), s.current += 1,
|
|
209
|
+
return a.current.set(n, o), s.current += 1, Pe(r, o, t), o;
|
|
210
210
|
}, [r]);
|
|
211
211
|
o(() => {
|
|
212
|
-
let e =
|
|
213
|
-
|
|
212
|
+
let e = Ue(t);
|
|
213
|
+
We(f.current, e).forEach((e, t) => {
|
|
214
214
|
h(t, Array.from(e));
|
|
215
215
|
}), f.current = e;
|
|
216
216
|
}, [h, t]);
|
|
@@ -221,7 +221,7 @@ function Ke(e) {
|
|
|
221
221
|
let i = e.buildIndex(), a = /* @__PURE__ */ new Set(), o = Object.entries(n);
|
|
222
222
|
o.forEach(([, e]) => {
|
|
223
223
|
e.forEach((e) => a.add(e));
|
|
224
|
-
}), r !== void 0 && _(t, Array.from(
|
|
224
|
+
}), r !== void 0 && _(t, Array.from(He(i, t, a)), r), o.forEach(([e, n]) => {
|
|
225
225
|
_(t, n, e);
|
|
226
226
|
});
|
|
227
227
|
}, [e, _]), y = i((e, t) => {
|
|
@@ -249,12 +249,12 @@ function Ke(e) {
|
|
|
249
249
|
t.forEach((t) => r(Number(e), t));
|
|
250
250
|
}), n.forEach((e, n) => {
|
|
251
251
|
e.forEach((e) => {
|
|
252
|
-
|
|
252
|
+
Ve(t.elementIndex.get(e), n, e, m(n, e), p.current);
|
|
253
253
|
});
|
|
254
254
|
});
|
|
255
255
|
}, [e, m]), w = i(() => {
|
|
256
256
|
e.buildIndex().records.forEach((e) => {
|
|
257
|
-
p.current.delete(e),
|
|
257
|
+
p.current.delete(e), Re(e);
|
|
258
258
|
}), p.current = /* @__PURE__ */ new WeakMap(), u.current.clear(), C();
|
|
259
259
|
}, [C, e]);
|
|
260
260
|
return {
|
|
@@ -280,25 +280,27 @@ function Ke(e) {
|
|
|
280
280
|
}
|
|
281
281
|
//#endregion
|
|
282
282
|
//#region src/viewer/SelectableMesh.tsx
|
|
283
|
-
P.prototype.raycast =
|
|
284
|
-
var qe = e.memo(function({ colorPaletteTexture: e, material: t, materialMode: n = "quality", data: r, isIfcSpace: i = !1, meshMatrix: a, useDoubleSideMaterial: s = !1 }) {
|
|
285
|
-
let u = l(null), d =
|
|
283
|
+
P.prototype.raycast = Se;
|
|
284
|
+
var Ke = 1 / 1.5, qe = e.memo(function({ colorPaletteTexture: e, material: t, materialMode: n = "quality", data: r, isIfcSpace: i = !1, meshMatrix: a, useDoubleSideMaterial: s = !1 }) {
|
|
285
|
+
let u = l(null), d = U((e) => e.preselectionColor), f = l(d);
|
|
286
286
|
f.current = d;
|
|
287
287
|
let p = c(() => {
|
|
288
|
-
let r =
|
|
289
|
-
|
|
288
|
+
let r = new x(t.r, t.g, t.b);
|
|
289
|
+
n === "performance" && r.multiplyScalar(Ke);
|
|
290
|
+
let i = {
|
|
291
|
+
color: r.clone(),
|
|
290
292
|
transparent: !!(t.opacity && t.opacity != 1),
|
|
291
293
|
opacity: t.opacity ?? 1
|
|
292
|
-
},
|
|
293
|
-
...
|
|
294
|
+
}, a = s ? {
|
|
295
|
+
...i,
|
|
294
296
|
side: w
|
|
295
|
-
} :
|
|
296
|
-
return
|
|
297
|
-
...
|
|
297
|
+
} : i, o = n === "performance" ? new F(a) : new re(a), c = o;
|
|
298
|
+
return c.defaultAttributeValues = {
|
|
299
|
+
...c.defaultAttributeValues,
|
|
298
300
|
colorIndex: [0]
|
|
299
|
-
},
|
|
300
|
-
let
|
|
301
|
-
|
|
301
|
+
}, o.onBeforeCompile = (t) => {
|
|
302
|
+
let n = new x(f.current);
|
|
303
|
+
t.uniforms.baseColor = { value: r.clone() }, t.uniforms.preSelectionColor = { value: n }, t.uniforms.preSelectionId = { value: -1 }, t.uniforms.elementColorPalette = { value: e }, t.vertexShader = t.vertexShader.replace("#include <common>", "\n #include <common>\n attribute float colorIndex;\n attribute uint ids;\n flat varying float vColorIndex;\n flat varying float vPreselectId;\n "), t.vertexShader = t.vertexShader.replace("#include <begin_vertex>", "\n #include <begin_vertex>\n vColorIndex = colorIndex;\n vPreselectId = float(ids);\n "), t.fragmentShader = t.fragmentShader.replace("#include <common>", "\n #include <common>\n uniform vec3 baseColor;\n uniform vec3 preSelectionColor;\n uniform sampler2D elementColorPalette;\n flat varying float vPreselectId;\n flat varying float vColorIndex;\n uniform float preSelectionId;\n "), t.fragmentShader = t.fragmentShader.replace("vec4 diffuseColor = vec4( diffuse, opacity );", `
|
|
302
304
|
vec4 diffuseColor;
|
|
303
305
|
if(preSelectionId == vPreselectId && abs(vColorIndex - 1.0) > 0.5){
|
|
304
306
|
diffuseColor = vec4(preSelectionColor, 1.0);
|
|
@@ -313,8 +315,8 @@ var qe = e.memo(function({ colorPaletteTexture: e, material: t, materialMode: n
|
|
|
313
315
|
else{
|
|
314
316
|
diffuseColor = vec4(baseColor, opacity);
|
|
315
317
|
}
|
|
316
|
-
`),
|
|
317
|
-
},
|
|
318
|
+
`), o.userData.shader = t;
|
|
319
|
+
}, o;
|
|
318
320
|
}, [
|
|
319
321
|
e,
|
|
320
322
|
t,
|
|
@@ -326,11 +328,11 @@ var qe = e.memo(function({ colorPaletteTexture: e, material: t, materialMode: n
|
|
|
326
328
|
e && (e.value instanceof x ? e.value.set(d) : e.value = new x(d));
|
|
327
329
|
}, [p, d]), o(() => {
|
|
328
330
|
if (!u.current) return;
|
|
329
|
-
let e = u.current.geometry, t = new
|
|
331
|
+
let e = u.current.geometry, t = new be(e, { indirect: !0 });
|
|
330
332
|
return Object.assign(e, { boundsTree: t }), () => {
|
|
331
333
|
p.dispose(), Object.assign(e, { boundsTree: null });
|
|
332
334
|
};
|
|
333
|
-
}, [p]), /* @__PURE__ */
|
|
335
|
+
}, [p]), /* @__PURE__ */ H("mesh", {
|
|
334
336
|
matrix: a,
|
|
335
337
|
matrixAutoUpdate: !1,
|
|
336
338
|
name: i ? "space" : void 0,
|
|
@@ -340,24 +342,24 @@ var qe = e.memo(function({ colorPaletteTexture: e, material: t, materialMode: n
|
|
|
340
342
|
let t = e.object;
|
|
341
343
|
t.preselected &&= !1;
|
|
342
344
|
},
|
|
343
|
-
children: [/* @__PURE__ */
|
|
344
|
-
/* @__PURE__ */
|
|
345
|
+
children: [/* @__PURE__ */ H("bufferGeometry", { children: [
|
|
346
|
+
/* @__PURE__ */ V("bufferAttribute", {
|
|
345
347
|
attach: "attributes-position",
|
|
346
348
|
args: [r.pos, 3]
|
|
347
349
|
}),
|
|
348
|
-
r.norm && /* @__PURE__ */
|
|
350
|
+
r.norm && /* @__PURE__ */ V("bufferAttribute", {
|
|
349
351
|
attach: "attributes-normal",
|
|
350
352
|
args: [r.norm, 3]
|
|
351
353
|
}),
|
|
352
|
-
/* @__PURE__ */
|
|
354
|
+
/* @__PURE__ */ V("bufferAttribute", {
|
|
353
355
|
attach: "attributes-ids",
|
|
354
356
|
args: [r.ids, 1]
|
|
355
357
|
}),
|
|
356
|
-
/* @__PURE__ */
|
|
358
|
+
/* @__PURE__ */ V("bufferAttribute", {
|
|
357
359
|
attach: "index",
|
|
358
360
|
args: [r.ind, 1]
|
|
359
361
|
})
|
|
360
|
-
] }), /* @__PURE__ */
|
|
362
|
+
] }), /* @__PURE__ */ V("primitive", { object: p })]
|
|
361
363
|
});
|
|
362
364
|
}), Je = 10, Ye = "#1d2733", Xe = 2, Ze = .05, Qe = "\0", $e = /* @__PURE__ */ new Map();
|
|
363
365
|
function et() {
|
|
@@ -371,7 +373,7 @@ function tt(e, t, n, r) {
|
|
|
371
373
|
let u = o.measureText(t), d = u.actualBoundingBoxAscent || r * .8, f = u.actualBoundingBoxDescent || r * .2, p = Math.max(1, Math.ceil(u.width + c * 2)), m = Math.max(1, Math.ceil(d + f + l * 2));
|
|
372
374
|
a.width = Math.ceil(p * i), a.height = Math.ceil(m * i), o.scale(i, i), o.clearRect(0, 0, p, m), o.font = s, o.fillStyle = n, o.textAlign = "left", o.textBaseline = "alphabetic", o.fillText(t, c, l + d);
|
|
373
375
|
let h = new b(a);
|
|
374
|
-
return h.colorSpace =
|
|
376
|
+
return h.colorSpace = R, h.generateMipmaps = !1, h.magFilter = A, h.minFilter = A, h.needsUpdate = !0, {
|
|
375
377
|
disposeTimer: null,
|
|
376
378
|
height: m,
|
|
377
379
|
key: e,
|
|
@@ -408,18 +410,18 @@ function at(e, t) {
|
|
|
408
410
|
let n = e[t];
|
|
409
411
|
return n === void 0 ? 0 : Number.isFinite(n) ? n : null;
|
|
410
412
|
}
|
|
411
|
-
function
|
|
413
|
+
function W(e, t) {
|
|
412
414
|
return at(e, t) ?? 0;
|
|
413
415
|
}
|
|
414
416
|
function ot(e) {
|
|
415
417
|
let t = at(e, "x"), n = at(e, "y"), r = at(e, "z");
|
|
416
|
-
return t === null || n === null || r === null ? null : new
|
|
418
|
+
return t === null || n === null || r === null ? null : new B(t, n, r);
|
|
417
419
|
}
|
|
418
420
|
function st(e, t) {
|
|
419
421
|
return [
|
|
420
|
-
|
|
421
|
-
t !== void 0 && Number.isFinite(t) ? t :
|
|
422
|
-
|
|
422
|
+
W(e, "x"),
|
|
423
|
+
t !== void 0 && Number.isFinite(t) ? t : W(e, "y"),
|
|
424
|
+
W(e, "z")
|
|
423
425
|
];
|
|
424
426
|
}
|
|
425
427
|
function ct(e) {
|
|
@@ -471,8 +473,8 @@ function dt({ flattenToFloor: e, grids: t, showBottom: n, showLeft: r, showRight
|
|
|
471
473
|
e.startSide,
|
|
472
474
|
e.endSide,
|
|
473
475
|
e.name,
|
|
474
|
-
|
|
475
|
-
|
|
476
|
+
W(e.loc, "x"),
|
|
477
|
+
W(e.loc, "z"),
|
|
476
478
|
e.points[0].x,
|
|
477
479
|
e.points[0].z,
|
|
478
480
|
e.points[1].x,
|
|
@@ -482,7 +484,7 @@ function dt({ flattenToFloor: e, grids: t, showBottom: n, showLeft: r, showRight
|
|
|
482
484
|
}), Array.from(c.values());
|
|
483
485
|
}
|
|
484
486
|
function ft(e, t) {
|
|
485
|
-
return new
|
|
487
|
+
return new B(...st(e.loc, t));
|
|
486
488
|
}
|
|
487
489
|
function pt({ cameraPosition: e, floorY: t, line: n, showBottom: r, showLeft: i, showRight: a, showTop: o }) {
|
|
488
490
|
let s = {
|
|
@@ -498,7 +500,7 @@ function mt({ endpoint: e, labelOffset: t, line: n }) {
|
|
|
498
500
|
return i.y = 0, i.lengthSq() === 0 && i.set(1, 0, 0), i.normalize().multiplyScalar(t), e === "start" && i.negate(), r.add(i);
|
|
499
501
|
}
|
|
500
502
|
function ht(e, t) {
|
|
501
|
-
let n = new
|
|
503
|
+
let n = new B(), r = 0;
|
|
502
504
|
return e.forEach((e) => {
|
|
503
505
|
let i = ft(e, t);
|
|
504
506
|
e.points.forEach((e) => {
|
|
@@ -527,11 +529,11 @@ function _t({ color: e, fontSize: t, position: n, text: r }) {
|
|
|
527
529
|
]), f(({ camera: e, size: t }) => {
|
|
528
530
|
let n = s.current;
|
|
529
531
|
n && it(n, c, e, t.height);
|
|
530
|
-
}), /* @__PURE__ */
|
|
532
|
+
}), /* @__PURE__ */ V("sprite", {
|
|
531
533
|
ref: s,
|
|
532
534
|
position: n,
|
|
533
535
|
renderOrder: 2,
|
|
534
|
-
children: /* @__PURE__ */
|
|
536
|
+
children: /* @__PURE__ */ V("spriteMaterial", {
|
|
535
537
|
alphaTest: .1,
|
|
536
538
|
depthTest: !0,
|
|
537
539
|
depthWrite: !1,
|
|
@@ -556,14 +558,14 @@ function vt({ cameraPosition: e, color: t, floorY: n, fontSize: r, labelOffset:
|
|
|
556
558
|
labelOffset: i,
|
|
557
559
|
line: a
|
|
558
560
|
}) : null;
|
|
559
|
-
return o(() => () => f.dispose(), [f]), /* @__PURE__ */
|
|
561
|
+
return o(() => () => f.dispose(), [f]), /* @__PURE__ */ H("lineSegments", {
|
|
560
562
|
geometry: f,
|
|
561
563
|
position: st(a.loc, n),
|
|
562
|
-
children: [/* @__PURE__ */
|
|
564
|
+
children: [/* @__PURE__ */ V("lineBasicMaterial", {
|
|
563
565
|
color: t,
|
|
564
566
|
depthWrite: !1,
|
|
565
567
|
linewidth: 2
|
|
566
|
-
}), m && /* @__PURE__ */
|
|
568
|
+
}), m && /* @__PURE__ */ V(_t, {
|
|
567
569
|
color: t,
|
|
568
570
|
fontSize: r,
|
|
569
571
|
position: m,
|
|
@@ -572,7 +574,7 @@ function vt({ cameraPosition: e, color: t, floorY: n, fontSize: r, labelOffset:
|
|
|
572
574
|
});
|
|
573
575
|
}
|
|
574
576
|
function yt({ color: e, floorY: t, fontSize: n = Je, grids: r, labelOffset: i = Xe, showBottom: a = !0, showLeft: o = !0, showRight: s = !0, showTop: d = !0, visible: m = !0 }) {
|
|
575
|
-
let h = p((e) => e.camera), g = l(null), [_, v] = u(() => new
|
|
577
|
+
let h = p((e) => e.camera), g = l(null), [_, v] = u(() => new B()), y = lt(e), b = c(() => r ? dt({
|
|
576
578
|
flattenToFloor: t !== void 0,
|
|
577
579
|
grids: r,
|
|
578
580
|
showBottom: a,
|
|
@@ -597,10 +599,10 @@ function yt({ color: e, floorY: t, fontSize: n = Je, grids: r, labelOffset: i =
|
|
|
597
599
|
if (!e) return;
|
|
598
600
|
let t = h.position.clone();
|
|
599
601
|
e.worldToLocal(t), !(t.distanceToSquared(_) < Ze) && v(t);
|
|
600
|
-
}), !m || !b.length ? null : /* @__PURE__ */
|
|
602
|
+
}), !m || !b.length ? null : /* @__PURE__ */ V("group", {
|
|
601
603
|
ref: g,
|
|
602
604
|
userData: { modelGrids: !0 },
|
|
603
|
-
children: b.map((e) => /* @__PURE__ */
|
|
605
|
+
children: b.map((e) => /* @__PURE__ */ V(vt, {
|
|
604
606
|
cameraPosition: _,
|
|
605
607
|
color: y,
|
|
606
608
|
floorY: t,
|
|
@@ -615,9 +617,9 @@ function yt({ color: e, floorY: t, fontSize: n = Je, grids: r, labelOffset: i =
|
|
|
615
617
|
e.startSide,
|
|
616
618
|
e.endSide,
|
|
617
619
|
e.name,
|
|
618
|
-
|
|
619
|
-
t ??
|
|
620
|
-
|
|
620
|
+
W(e.loc, "x"),
|
|
621
|
+
t ?? W(e.loc, "y"),
|
|
622
|
+
W(e.loc, "z"),
|
|
621
623
|
e.points[0].x,
|
|
622
624
|
e.points[0].y,
|
|
623
625
|
e.points[0].z,
|
|
@@ -646,13 +648,13 @@ function Ct(e) {
|
|
|
646
648
|
return e.coordinationMatrix ?? Object.values(e.data)[0]?.matrix;
|
|
647
649
|
}
|
|
648
650
|
function wt({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r, materialMode: i }) {
|
|
649
|
-
let a =
|
|
651
|
+
let a = U((e) => e.gridAxesVisibility), o = c(() => {
|
|
650
652
|
if (!r) return {
|
|
651
653
|
data: [],
|
|
652
654
|
coordinationMatrix: null,
|
|
653
655
|
floorY: 0
|
|
654
656
|
};
|
|
655
|
-
let e = Object.values(r.data).some((e) => !!e.matrix) ? t?.clone() ?? St(r) : null, i = Infinity, a = new
|
|
657
|
+
let e = Object.values(r.data).some((e) => !!e.matrix) ? t?.clone() ?? St(r) : null, i = Infinity, a = new B();
|
|
656
658
|
return {
|
|
657
659
|
data: Object.values(r.data).map((e) => {
|
|
658
660
|
let t = (xt(e.matrix) ?? new N()).clone().invert(), r = e.mat, o = e.pos;
|
|
@@ -673,13 +675,13 @@ function wt({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
|
|
|
673
675
|
r,
|
|
674
676
|
n
|
|
675
677
|
]);
|
|
676
|
-
if (!r) return /* @__PURE__ */
|
|
678
|
+
if (!r) return /* @__PURE__ */ V(Ce, {});
|
|
677
679
|
let s = i ?? r.renderSettings?.materialMode ?? "quality", l = r.renderSettings?.useDoubleSideMaterial === !0;
|
|
678
|
-
return /* @__PURE__ */
|
|
680
|
+
return /* @__PURE__ */ H("group", {
|
|
679
681
|
matrix: o.coordinationMatrix ?? bt,
|
|
680
682
|
matrixAutoUpdate: !1,
|
|
681
683
|
userData: { modelID: n },
|
|
682
|
-
children: [o.data.map(({ data: t, isIfcSpace: n, key: r, material: i, meshMatrix: a }) => /* @__PURE__ */
|
|
684
|
+
children: [o.data.map(({ data: t, isIfcSpace: n, key: r, material: i, meshMatrix: a }) => /* @__PURE__ */ V(qe, {
|
|
683
685
|
colorPaletteTexture: e,
|
|
684
686
|
material: i,
|
|
685
687
|
materialMode: s,
|
|
@@ -687,7 +689,7 @@ function wt({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
|
|
|
687
689
|
isIfcSpace: n,
|
|
688
690
|
meshMatrix: a,
|
|
689
691
|
useDoubleSideMaterial: l
|
|
690
|
-
}, r)), /* @__PURE__ */
|
|
692
|
+
}, r)), /* @__PURE__ */ V(yt, {
|
|
691
693
|
floorY: o.floorY,
|
|
692
694
|
grids: r.grids,
|
|
693
695
|
showBottom: a.bottom,
|
|
@@ -803,7 +805,7 @@ function Pt(e, t) {
|
|
|
803
805
|
}
|
|
804
806
|
function Ft(e) {
|
|
805
807
|
let t = e.geometry;
|
|
806
|
-
Object.assign(t, { boundsTree: void 0 }), e.geometry.index?.count && Object.assign(t, { boundsTree: new
|
|
808
|
+
Object.assign(t, { boundsTree: void 0 }), e.geometry.index?.count && Object.assign(t, { boundsTree: new be(e.geometry, { indirect: !0 }) });
|
|
807
809
|
}
|
|
808
810
|
function It(e, t, n = !0) {
|
|
809
811
|
e.mesh.geometry.setIndex(new v(t, 1)), n && Ft(e.mesh);
|
|
@@ -835,7 +837,7 @@ function Ut(e, t, n) {
|
|
|
835
837
|
function Wt(e, t, n) {
|
|
836
838
|
e && console.log(`${t}:`, Date.now() - n, "ms");
|
|
837
839
|
}
|
|
838
|
-
function
|
|
840
|
+
function G(e, t, n, r) {
|
|
839
841
|
let { hiddenIds: i, originalIndex: a, triangleRanges: o } = e, s = Bt(i, t, n, e.isIfcSpace);
|
|
840
842
|
if (e.visibleStateKey === s) return;
|
|
841
843
|
if (!i.size && !n) {
|
|
@@ -863,18 +865,18 @@ function W(e, t, n, r) {
|
|
|
863
865
|
}
|
|
864
866
|
r || (e.originalBoundsTree = null), It(e, u), e.visibleStateKey = s;
|
|
865
867
|
}
|
|
866
|
-
function
|
|
868
|
+
function K(e, t) {
|
|
867
869
|
return e.isolatedIdsByModel ? e.isolatedIdsByModel.get(t.modelID) ?? /* @__PURE__ */ new Set() : e.isolatedIds;
|
|
868
870
|
}
|
|
869
871
|
function Gt(e) {
|
|
870
|
-
let t =
|
|
872
|
+
let t = U((e) => e.selected), n = U((e) => e.resetSelected), r = U((e) => e.showStats), a = U((e) => e.userDevice) === "pc", o = e.buildIndex, s = i(() => Array.from(o().elementIndex.keys()), [o]), c = i(() => o().ifcSpacesVisible, [o]), l = i((e) => {
|
|
871
873
|
let t = Date.now(), n = o(), i = /* @__PURE__ */ new Set();
|
|
872
874
|
e.forEach((e) => {
|
|
873
875
|
let t = n.elementIndex.get(e);
|
|
874
876
|
t && t.forEach(({ record: t }) => {
|
|
875
877
|
Ut(t, e, i);
|
|
876
878
|
});
|
|
877
|
-
}), i.forEach((e) =>
|
|
879
|
+
}), i.forEach((e) => G(e, n.ifcSpacesVisible, K(n, e), a)), Wt(r, "hideByIds", t);
|
|
878
880
|
}, [
|
|
879
881
|
o,
|
|
880
882
|
a,
|
|
@@ -886,7 +888,7 @@ function Gt(e) {
|
|
|
886
888
|
n && n.forEach(({ record: n }) => {
|
|
887
889
|
n.modelID === e && Ut(n, t, s);
|
|
888
890
|
});
|
|
889
|
-
}), s.forEach((e) =>
|
|
891
|
+
}), s.forEach((e) => G(e, i.ifcSpacesVisible, K(i, e), a)), n(), Wt(r, "hideSelected", e);
|
|
890
892
|
}, [
|
|
891
893
|
o,
|
|
892
894
|
a,
|
|
@@ -900,14 +902,14 @@ function Gt(e) {
|
|
|
900
902
|
t && t.forEach(({ record: t }) => {
|
|
901
903
|
t.hiddenIds.delete(e) && i.add(t);
|
|
902
904
|
});
|
|
903
|
-
}), i.forEach((e) =>
|
|
905
|
+
}), i.forEach((e) => G(e, n.ifcSpacesVisible, K(n, e), a)), Wt(r, "showByIds", t);
|
|
904
906
|
}, [
|
|
905
907
|
o,
|
|
906
908
|
a,
|
|
907
909
|
r
|
|
908
910
|
]), f = i((e) => {
|
|
909
911
|
let t = Date.now(), n = o();
|
|
910
|
-
n.isolatedIdsByModel = null, n.isolatedIds = new Set(e), n.records.forEach((e) =>
|
|
912
|
+
n.isolatedIdsByModel = null, n.isolatedIds = new Set(e), n.records.forEach((e) => G(e, n.ifcSpacesVisible, K(n, e), a)), Wt(r, "isolateByIds", t);
|
|
911
913
|
}, [
|
|
912
914
|
o,
|
|
913
915
|
a,
|
|
@@ -917,7 +919,7 @@ function Gt(e) {
|
|
|
917
919
|
Ht(t, (e, t) => {
|
|
918
920
|
let n = i.get(e);
|
|
919
921
|
n || (n = /* @__PURE__ */ new Set(), i.set(e, n)), n.add(t);
|
|
920
|
-
}), n.isolatedIdsByModel = i, n.isolatedIds = null, n.records.forEach((e) =>
|
|
922
|
+
}), n.isolatedIdsByModel = i, n.isolatedIds = null, n.records.forEach((e) => G(e, n.ifcSpacesVisible, K(n, e), a)), Wt(r, "isolateSelected", e);
|
|
921
923
|
}, [
|
|
922
924
|
o,
|
|
923
925
|
a,
|
|
@@ -925,7 +927,7 @@ function Gt(e) {
|
|
|
925
927
|
r
|
|
926
928
|
]), m = i(() => {
|
|
927
929
|
let e = Date.now(), t = o();
|
|
928
|
-
t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) =>
|
|
930
|
+
t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => G(e, t.ifcSpacesVisible, K(t, e), a)), Wt(r, "resetIsolation", e);
|
|
929
931
|
}, [
|
|
930
932
|
o,
|
|
931
933
|
a,
|
|
@@ -933,7 +935,7 @@ function Gt(e) {
|
|
|
933
935
|
]), h = i((e) => {
|
|
934
936
|
let t = o();
|
|
935
937
|
t.ifcSpacesVisible !== e && (t.ifcSpacesVisible = e, t.records.forEach((e) => {
|
|
936
|
-
e.isIfcSpace &&
|
|
938
|
+
e.isIfcSpace && G(e, t.ifcSpacesVisible, K(t, e), a);
|
|
937
939
|
}));
|
|
938
940
|
}, [o, a]), g = i(() => {
|
|
939
941
|
h(!c());
|
|
@@ -951,7 +953,7 @@ function Gt(e) {
|
|
|
951
953
|
showAll: i(() => {
|
|
952
954
|
let e = Date.now(), t = o();
|
|
953
955
|
t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => {
|
|
954
|
-
e.hiddenIds.clear(),
|
|
956
|
+
e.hiddenIds.clear(), G(e, t.ifcSpacesVisible, K(t, e), a);
|
|
955
957
|
}), Wt(r, "showAll", e);
|
|
956
958
|
}, [
|
|
957
959
|
o,
|
|
@@ -986,15 +988,15 @@ function cn(e) {
|
|
|
986
988
|
return e;
|
|
987
989
|
}
|
|
988
990
|
function ln(e) {
|
|
989
|
-
return Math.abs(e.normal.y) < .9 ? new
|
|
991
|
+
return Math.abs(e.normal.y) < .9 ? new B(0, 1, 0) : new B(1, 0, 0);
|
|
990
992
|
}
|
|
991
993
|
function un(e, t) {
|
|
992
994
|
return e.clone().addScaledVector(t.normal, -e.dot(t.normal));
|
|
993
995
|
}
|
|
994
996
|
function dn(e, t) {
|
|
995
|
-
let n = t ? un(t, e) : new
|
|
997
|
+
let n = t ? un(t, e) : new B(), r = n.lengthSq() > an ? n.normalize() : ln(e).cross(e.normal).normalize(), i = e.normal.clone().cross(r).normalize();
|
|
996
998
|
return {
|
|
997
|
-
origin: e.coplanarPoint(new
|
|
999
|
+
origin: e.coplanarPoint(new B()),
|
|
998
1000
|
u: r,
|
|
999
1001
|
v: i
|
|
1000
1002
|
};
|
|
@@ -1027,7 +1029,7 @@ function hn(e) {
|
|
|
1027
1029
|
r.stroke();
|
|
1028
1030
|
}
|
|
1029
1031
|
let i = new b(n);
|
|
1030
|
-
return i.anisotropy = Math.max(1, e), i.magFilter = A, i.minFilter = j, i.wrapS =
|
|
1032
|
+
return i.anisotropy = Math.max(1, e), i.magFilter = A, i.minFilter = j, i.wrapS = ce, i.wrapT = ce, i.needsUpdate = !0, i;
|
|
1031
1033
|
}
|
|
1032
1034
|
var gn = class {
|
|
1033
1035
|
active;
|
|
@@ -1042,12 +1044,12 @@ var gn = class {
|
|
|
1042
1044
|
inverseMatrix = new N();
|
|
1043
1045
|
localPlane = new I();
|
|
1044
1046
|
tempLine = new ee();
|
|
1045
|
-
tempVector = new
|
|
1046
|
-
tempVector1 = new
|
|
1047
|
-
tempAxisX = new
|
|
1048
|
-
tempAxisY = new
|
|
1049
|
-
tempAxisZ = new
|
|
1050
|
-
worldPoint = new
|
|
1047
|
+
tempVector = new B();
|
|
1048
|
+
tempVector1 = new B();
|
|
1049
|
+
tempAxisX = new B();
|
|
1050
|
+
tempAxisY = new B();
|
|
1051
|
+
tempAxisZ = new B();
|
|
1052
|
+
worldPoint = new B();
|
|
1051
1053
|
capClippingPlanesKey = "";
|
|
1052
1054
|
capShader = null;
|
|
1053
1055
|
closeGapTolerance = Jt;
|
|
@@ -1122,15 +1124,27 @@ var gn = class {
|
|
|
1122
1124
|
createCapGeometry() {
|
|
1123
1125
|
let e = new y(), t = this.getModelWorldBox();
|
|
1124
1126
|
if (!t) return e;
|
|
1125
|
-
let n = t.getSize(new
|
|
1127
|
+
let n = t.getSize(new B()).length();
|
|
1126
1128
|
this.tolerance = Math.max(Jt, n * Yt), this.closeGapTolerance = Math.max(this.tolerance * Zt, n * Xt);
|
|
1127
|
-
let r = dn(this.plane, this.getModelHatchReferenceDirection()), i = this.
|
|
1128
|
-
if (e.setAttribute("position", new E(
|
|
1129
|
-
let t = new Uint32Array(
|
|
1129
|
+
let r = dn(this.plane, this.getModelHatchReferenceDirection()), i = this.context.getEdgeSegmentsForPlane(this.plane), a = i ? this.getCapSegmentsFromEdgeSegments(i, r) : this.getCapSegments(r), o = this.getClosedContours(a), s = this.getHatchSpacing(n), { elementIDs: c, modelIDs: l, positions: u, uvs: d } = this.triangulateContours(o, r, s);
|
|
1130
|
+
if (e.setAttribute("position", new E(u, 3)), e.setAttribute("uv", new E(d, 2)), e.setAttribute("ids", new me(c, 1)), e.setAttribute("modelID", new me(l, 1)), e.setAttribute("colorIndex", new v(new Uint8Array(c.length), 1)), c.length) {
|
|
1131
|
+
let t = new Uint32Array(c.length);
|
|
1130
1132
|
for (let e = 0; e < t.length; e++) t[e] = e;
|
|
1131
|
-
e.setIndex(new
|
|
1133
|
+
e.setIndex(new me(t, 1));
|
|
1132
1134
|
}
|
|
1133
|
-
return
|
|
1135
|
+
return u.length && (e.computeVertexNormals(), e.computeBoundingSphere()), e;
|
|
1136
|
+
}
|
|
1137
|
+
getCapSegmentsFromEdgeSegments(e, t) {
|
|
1138
|
+
let n = [];
|
|
1139
|
+
return e.forEach((e) => {
|
|
1140
|
+
let r = this.getPlanePoint(this.tempVector.set(e.ax, e.ay, e.az), t), i = this.getPlanePoint(this.tempVector.set(e.bx, e.by, e.bz), t);
|
|
1141
|
+
r.distanceToSquared(i) <= this.tolerance ** 2 || n.push({
|
|
1142
|
+
a: r,
|
|
1143
|
+
b: i,
|
|
1144
|
+
elementID: e.elementID,
|
|
1145
|
+
modelID: e.modelID
|
|
1146
|
+
});
|
|
1147
|
+
}), n;
|
|
1134
1148
|
}
|
|
1135
1149
|
getCapSegments(e) {
|
|
1136
1150
|
let t = [];
|
|
@@ -1169,7 +1183,7 @@ var gn = class {
|
|
|
1169
1183
|
return this.tempLine.start.copy(e.a), this.tempLine.end.copy(e.b), n(this.localPlane.intersectLine(this.tempLine, this.tempVector)), this.tempLine.start.copy(e.b), this.tempLine.end.copy(e.c), n(this.localPlane.intersectLine(this.tempLine, this.tempVector)), this.tempLine.start.copy(e.c), this.tempLine.end.copy(e.a), n(this.localPlane.intersectLine(this.tempLine, this.tempVector)), t;
|
|
1170
1184
|
}
|
|
1171
1185
|
getPlanePoint(e, t) {
|
|
1172
|
-
return this.worldPoint.copy(e).sub(t.origin), new
|
|
1186
|
+
return this.worldPoint.copy(e).sub(t.origin), new z(this.worldPoint.dot(t.u), this.worldPoint.dot(t.v));
|
|
1173
1187
|
}
|
|
1174
1188
|
getClosedContours(e) {
|
|
1175
1189
|
let t = /* @__PURE__ */ new Map();
|
|
@@ -1282,7 +1296,7 @@ var gn = class {
|
|
|
1282
1296
|
triangulateContours(e, t, n) {
|
|
1283
1297
|
let r = [], i = [], a = [], o = [];
|
|
1284
1298
|
return e.forEach(({ elementID: e, modelID: s, points: c }) => {
|
|
1285
|
-
|
|
1299
|
+
le.triangulateShape(c, []).forEach(([l, u, d]) => {
|
|
1286
1300
|
this.pushContourVertex(a, r, i, o, c[l], t, n, e, s), this.pushContourVertex(a, r, i, o, c[u], t, n, e, s), this.pushContourVertex(a, r, i, o, c[d], t, n, e, s);
|
|
1287
1301
|
});
|
|
1288
1302
|
}), {
|
|
@@ -1336,7 +1350,7 @@ function Sn(e, t) {
|
|
|
1336
1350
|
return r.array.set(n.array), e.geometry.setAttribute("position", r), n = r, n;
|
|
1337
1351
|
}
|
|
1338
1352
|
function Cn(e) {
|
|
1339
|
-
return e.filter((e) => e.parent && e.geometry.index?.count);
|
|
1353
|
+
return e.filter((e) => e.parent && e.visible && e.geometry.index?.count);
|
|
1340
1354
|
}
|
|
1341
1355
|
var wn = class {
|
|
1342
1356
|
active;
|
|
@@ -1347,10 +1361,11 @@ var wn = class {
|
|
|
1347
1361
|
inverseMatrix = new N();
|
|
1348
1362
|
localPlane = new I();
|
|
1349
1363
|
tempLine = new ee();
|
|
1350
|
-
tempVector = new
|
|
1351
|
-
tempVector1 = new
|
|
1352
|
-
tempVector2 = new
|
|
1353
|
-
tempVector3 = new
|
|
1364
|
+
tempVector = new B();
|
|
1365
|
+
tempVector1 = new B();
|
|
1366
|
+
tempVector2 = new B();
|
|
1367
|
+
tempVector3 = new B();
|
|
1368
|
+
intersectionSegments = [];
|
|
1354
1369
|
constructor(e, t) {
|
|
1355
1370
|
this.context = e, this.plane = t, this.active = e.getActive() && e.getEdgesActive(), e.edges.forEach((e) => {
|
|
1356
1371
|
let n = e.material.clippingPlanes ?? [];
|
|
@@ -1390,8 +1405,11 @@ var wn = class {
|
|
|
1390
1405
|
toggle() {
|
|
1391
1406
|
this.setVisible(!this.active);
|
|
1392
1407
|
}
|
|
1408
|
+
getIntersectionSegments() {
|
|
1409
|
+
return this.intersectionSegments;
|
|
1410
|
+
}
|
|
1393
1411
|
update() {
|
|
1394
|
-
this.active && (this.syncMeshes(), this.lines.forEach((e, t) => {
|
|
1412
|
+
this.active && (this.syncMeshes(), this.intersectionSegments.length = 0, this.lines.forEach((e, t) => {
|
|
1395
1413
|
let n = t.geometry.boundsTree;
|
|
1396
1414
|
if (!n) {
|
|
1397
1415
|
e.geometry.setDrawRange(0, 0);
|
|
@@ -1403,20 +1421,42 @@ var wn = class {
|
|
|
1403
1421
|
};
|
|
1404
1422
|
n.shapecast({
|
|
1405
1423
|
intersectsBounds: (e) => this.localPlane.intersectsBox(e),
|
|
1406
|
-
intersectsTriangle: (e) => {
|
|
1407
|
-
let
|
|
1408
|
-
this.tempLine.start.copy(e.a), this.tempLine.end.copy(e.b), this.localPlane.intersectLine(this.tempLine, this.tempVector) && (a(this.tempVector),
|
|
1424
|
+
intersectsTriangle: (e, n) => {
|
|
1425
|
+
let o = 0;
|
|
1426
|
+
if (this.tempLine.start.copy(e.a), this.tempLine.end.copy(e.b), this.localPlane.intersectLine(this.tempLine, this.tempVector) && (a(this.tempVector), o++), this.tempLine.start.copy(e.b), this.tempLine.end.copy(e.c), this.localPlane.intersectLine(this.tempLine, this.tempVector) && (a(this.tempVector), o++), this.tempLine.start.copy(e.c), this.tempLine.end.copy(e.a), this.localPlane.intersectLine(this.tempLine, this.tempVector) && (a(this.tempVector), o++), o === 3 && (this.tempVector1.fromBufferAttribute(i, r - 3), this.tempVector2.fromBufferAttribute(i, r - 2), this.tempVector3.fromBufferAttribute(i, r - 1), this.tempVector3.equals(this.tempVector1) || this.tempVector3.equals(this.tempVector2) ? (o--, r--) : this.tempVector1.equals(this.tempVector2) && (i.setXYZ(r - 2, this.tempVector3.x, this.tempVector3.y, this.tempVector3.z), o--, r--)), o !== 2) {
|
|
1427
|
+
r -= o;
|
|
1428
|
+
return;
|
|
1429
|
+
}
|
|
1430
|
+
let s = this.getTriangleElementID(t, n);
|
|
1431
|
+
if (s === null) return;
|
|
1432
|
+
let c = this.context.getObjectModelID(t);
|
|
1433
|
+
this.tempVector1.fromBufferAttribute(i, r - 2), this.tempVector2.fromBufferAttribute(i, r - 1), this.tempVector1.applyMatrix4(t.matrixWorld), this.tempVector2.applyMatrix4(t.matrixWorld), this.intersectionSegments.push({
|
|
1434
|
+
ax: this.tempVector1.x,
|
|
1435
|
+
ay: this.tempVector1.y,
|
|
1436
|
+
az: this.tempVector1.z,
|
|
1437
|
+
bx: this.tempVector2.x,
|
|
1438
|
+
by: this.tempVector2.y,
|
|
1439
|
+
bz: this.tempVector2.z,
|
|
1440
|
+
elementID: s,
|
|
1441
|
+
modelID: c
|
|
1442
|
+
});
|
|
1409
1443
|
}
|
|
1410
1444
|
}), e.geometry.setDrawRange(0, r), e.position.set(0, 0, 0), i.needsUpdate = !0;
|
|
1411
1445
|
}));
|
|
1412
1446
|
}
|
|
1413
|
-
|
|
1447
|
+
getTriangleElementID(e, t) {
|
|
1448
|
+
let n = e.geometry.index, r = e.geometry.attributes.ids, i = t * 3;
|
|
1449
|
+
if (!n || !r || i >= n.count) return null;
|
|
1450
|
+
let a = n.getX(i);
|
|
1451
|
+
return a >= r.count ? null : r.getX(a);
|
|
1452
|
+
}
|
|
1453
|
+
}, Tn = "#0b2f5f", En = "#0b2f5f", Dn = 0, On = "#1f7ae0", kn = .22, An = .01, jn = .025, Mn = .015, Nn = .02, Pn = 1e-7, Fn = .25, In = .15, Ln = .25, Rn = 1e-5, zn = .2, Bn = 1, q = 1;
|
|
1414
1454
|
function Vn(e, t) {
|
|
1415
1455
|
let n = t.getBoundingClientRect();
|
|
1416
|
-
return new
|
|
1456
|
+
return new z((e.clientX - n.left) / n.width * 2 - 1, -((e.clientY - n.top) / n.height) * 2 + 1);
|
|
1417
1457
|
}
|
|
1418
1458
|
function Hn(e) {
|
|
1419
|
-
let t = e.getSize(new
|
|
1459
|
+
let t = e.getSize(new B());
|
|
1420
1460
|
return Math.max(Ln, t.length() * An);
|
|
1421
1461
|
}
|
|
1422
1462
|
var Un = class extends ae {
|
|
@@ -1428,10 +1468,10 @@ var Un = class extends ae {
|
|
|
1428
1468
|
border;
|
|
1429
1469
|
context;
|
|
1430
1470
|
location;
|
|
1431
|
-
localHitPoint = new
|
|
1471
|
+
localHitPoint = new B();
|
|
1432
1472
|
normal;
|
|
1433
1473
|
planeMesh;
|
|
1434
|
-
pointer = new
|
|
1474
|
+
pointer = new z();
|
|
1435
1475
|
layout;
|
|
1436
1476
|
polygon = [];
|
|
1437
1477
|
dragState = null;
|
|
@@ -1557,7 +1597,7 @@ var Un = class extends ae {
|
|
|
1557
1597
|
getPointerPointOnPlane(e, t) {
|
|
1558
1598
|
let n = this.context.getDomElement();
|
|
1559
1599
|
this.pointer.copy(Vn(e, n));
|
|
1560
|
-
let r = this.context.getRaycaster(), i = new
|
|
1600
|
+
let r = this.context.getRaycaster(), i = new B();
|
|
1561
1601
|
return r.setFromCamera(this.pointer, this.context.getCamera()), r.ray.intersectPlane(t, i);
|
|
1562
1602
|
}
|
|
1563
1603
|
onPointerDown = (e) => {
|
|
@@ -1565,7 +1605,7 @@ var Un = class extends ae {
|
|
|
1565
1605
|
let t = this.getPointerIntersection(e);
|
|
1566
1606
|
if (!t) return;
|
|
1567
1607
|
this.stopHelperPriorityEvent(e), this.context.clearHelpersHover(this), this.setHovered(!0), this.context.setHelperDragActive(!0), this.context.setCapsDragActive(!0), this.context.requestCapsDragIdleUpdate(), this.context.setSelectionInteractionDisabled(!0);
|
|
1568
|
-
let n = new
|
|
1608
|
+
let n = new B();
|
|
1569
1609
|
this.context.getCamera().getWorldDirection(n), n.normalize();
|
|
1570
1610
|
let r = new I().setFromNormalAndCoplanarPoint(n, t.point);
|
|
1571
1611
|
this.dragState = {
|
|
@@ -1592,7 +1632,7 @@ var Un = class extends ae {
|
|
|
1592
1632
|
this.plane.copy(this.dragState.planeStart).translate(r), this.helper.position.copy(this.dragState.helperStart).add(r), this.context.requestHelpersUpdate(), this.context.requestEdgesUpdate(), this.context.requestCapsDragIdleUpdate();
|
|
1593
1633
|
};
|
|
1594
1634
|
onPointerUp = (e) => {
|
|
1595
|
-
this.dragState && (this.stopHelperPriorityEvent(e), this.dragState = null, this.context.setHelperDragActive(!1), this.context.setControlsEnabled(!0), this.context.setCapsDragActive(!1), this.context.updateHelpers(),
|
|
1635
|
+
this.dragState && (this.stopHelperPriorityEvent(e), this.dragState = null, this.context.setHelperDragActive(!1), this.context.setControlsEnabled(!0), this.context.setCapsDragActive(!1), this.context.updateHelpers(), window.setTimeout(() => {
|
|
1596
1636
|
this.context.setSelectionInteractionDisabled(!1);
|
|
1597
1637
|
}, 0));
|
|
1598
1638
|
};
|
|
@@ -1685,27 +1725,27 @@ var Un = class extends ae {
|
|
|
1685
1725
|
getHelperLayout() {
|
|
1686
1726
|
let e = this.getModelWorldBox();
|
|
1687
1727
|
if (!e || e.isEmpty()) return {
|
|
1688
|
-
height:
|
|
1689
|
-
maxU:
|
|
1690
|
-
maxV:
|
|
1691
|
-
minU: -
|
|
1692
|
-
minV: -
|
|
1693
|
-
width:
|
|
1728
|
+
height: q,
|
|
1729
|
+
maxU: q / 2,
|
|
1730
|
+
maxV: q / 2,
|
|
1731
|
+
minU: -q / 2,
|
|
1732
|
+
minV: -q / 2,
|
|
1733
|
+
width: q
|
|
1694
1734
|
};
|
|
1695
|
-
let t = this.getPlaneBasis(), n = this.helper.position, r = this.getBoxCorners(e), i = new
|
|
1735
|
+
let t = this.getPlaneBasis(), n = this.helper.position, r = this.getBoxCorners(e), i = new B(), a = new B(), o = Infinity, s = -Infinity, c = Infinity, l = -Infinity;
|
|
1696
1736
|
if (r.forEach((e) => {
|
|
1697
1737
|
this.plane.projectPoint(e, i), a.copy(i).sub(n);
|
|
1698
1738
|
let r = a.dot(t.u), u = a.dot(t.v);
|
|
1699
1739
|
o = Math.min(o, r), s = Math.max(s, r), c = Math.min(c, u), l = Math.max(l, u);
|
|
1700
1740
|
}), !Number.isFinite(o) || !Number.isFinite(s) || !Number.isFinite(c) || !Number.isFinite(l)) return {
|
|
1701
|
-
height:
|
|
1702
|
-
maxU:
|
|
1703
|
-
maxV:
|
|
1704
|
-
minU: -
|
|
1705
|
-
minV: -
|
|
1706
|
-
width:
|
|
1741
|
+
height: q,
|
|
1742
|
+
maxU: q / 2,
|
|
1743
|
+
maxV: q / 2,
|
|
1744
|
+
minU: -q / 2,
|
|
1745
|
+
minV: -q / 2,
|
|
1746
|
+
width: q
|
|
1707
1747
|
};
|
|
1708
|
-
let u = Hn(e), d = o - u, f = s + u, p = c - u, m = l + u, h = Math.max(
|
|
1748
|
+
let u = Hn(e), d = o - u, f = s + u, p = c - u, m = l + u, h = Math.max(q, f - d), g = Math.max(q, m - p), _ = (d + f) / 2, v = (p + m) / 2;
|
|
1709
1749
|
return {
|
|
1710
1750
|
height: g,
|
|
1711
1751
|
maxU: _ + h / 2,
|
|
@@ -1716,7 +1756,7 @@ var Un = class extends ae {
|
|
|
1716
1756
|
};
|
|
1717
1757
|
}
|
|
1718
1758
|
getPlaneBasis() {
|
|
1719
|
-
let e = (Math.abs(this.normal.y) < .9 ? new
|
|
1759
|
+
let e = (Math.abs(this.normal.y) < .9 ? new B(0, 1, 0) : new B(1, 0, 0)).cross(this.normal).normalize();
|
|
1720
1760
|
return {
|
|
1721
1761
|
u: e,
|
|
1722
1762
|
v: this.normal.clone().cross(e).normalize()
|
|
@@ -1736,14 +1776,14 @@ var Un = class extends ae {
|
|
|
1736
1776
|
}
|
|
1737
1777
|
getBoxCorners(e) {
|
|
1738
1778
|
return [
|
|
1739
|
-
new
|
|
1740
|
-
new
|
|
1741
|
-
new
|
|
1742
|
-
new
|
|
1743
|
-
new
|
|
1744
|
-
new
|
|
1745
|
-
new
|
|
1746
|
-
new
|
|
1779
|
+
new B(e.min.x, e.min.y, e.min.z),
|
|
1780
|
+
new B(e.min.x, e.min.y, e.max.z),
|
|
1781
|
+
new B(e.min.x, e.max.y, e.min.z),
|
|
1782
|
+
new B(e.min.x, e.max.y, e.max.z),
|
|
1783
|
+
new B(e.max.x, e.min.y, e.min.z),
|
|
1784
|
+
new B(e.max.x, e.min.y, e.max.z),
|
|
1785
|
+
new B(e.max.x, e.max.y, e.min.z),
|
|
1786
|
+
new B(e.max.x, e.max.y, e.max.z)
|
|
1747
1787
|
];
|
|
1748
1788
|
}
|
|
1749
1789
|
}, Wn = 250;
|
|
@@ -1835,6 +1875,12 @@ var Yn = class {
|
|
|
1835
1875
|
getMeshes() {
|
|
1836
1876
|
return Kn(this.context.modelRef.current);
|
|
1837
1877
|
}
|
|
1878
|
+
getObjectModelID(e) {
|
|
1879
|
+
return qn(e);
|
|
1880
|
+
}
|
|
1881
|
+
getEdgeSegmentsForPlane(e) {
|
|
1882
|
+
return this.edgesActive ? this.edges.find((t) => t.plane === e && t.active)?.getIntersectionSegments() ?? null : null;
|
|
1883
|
+
}
|
|
1838
1884
|
getSelectableObjects() {
|
|
1839
1885
|
return this.caps.map((e) => e.getSelectableObject()).filter((e) => e.visible);
|
|
1840
1886
|
}
|
|
@@ -1863,11 +1909,11 @@ var Yn = class {
|
|
|
1863
1909
|
this.helperDragActive = e;
|
|
1864
1910
|
}
|
|
1865
1911
|
setCapsDragActive(e) {
|
|
1866
|
-
this.capsDragActive !== e && (this.clearCapsDragIdleTimeout(), this.capsDragActive = e, this.caps.forEach((t) => t.setVisible(this.active && this.capsActive && !e)), !e && this.active && this.capsActive && this.updateCaps());
|
|
1912
|
+
this.capsDragActive !== e && (this.clearCapsDragIdleTimeout(), this.capsDragActive = e, this.caps.forEach((t) => t.setVisible(this.active && this.capsActive && !e)), !e && this.active && this.capsActive && (this.flushEdgesUpdate(), this.updateCaps()));
|
|
1867
1913
|
}
|
|
1868
1914
|
requestCapsDragIdleUpdate() {
|
|
1869
1915
|
!this.active || !this.capsActive || !this.capsDragActive || !this.caps.length || (this.clearCapsDragIdleTimeout(), this.caps.forEach((e) => e.setVisible(!1)), this.capsDragIdleTimeout = window.setTimeout(() => {
|
|
1870
|
-
this.capsDragIdleTimeout = null, !(!this.active || !this.capsDragActive) && (this.caps.forEach((e) => {
|
|
1916
|
+
this.capsDragIdleTimeout = null, !(!this.active || !this.capsDragActive) && (this.flushEdgesUpdate(), this.caps.forEach((e) => {
|
|
1871
1917
|
e.setVisible(!0), e.update();
|
|
1872
1918
|
}), this.updateCapsVisualState());
|
|
1873
1919
|
}, Wn));
|
|
@@ -1898,7 +1944,7 @@ var Yn = class {
|
|
|
1898
1944
|
}), e.isEmpty() ? null : e;
|
|
1899
1945
|
}
|
|
1900
1946
|
getSelectedWorldBox() {
|
|
1901
|
-
let e = this.context.viewerStore.getState().selected, t = new g(), n = new
|
|
1947
|
+
let e = this.context.viewerStore.getState().selected, t = new g(), n = new B();
|
|
1902
1948
|
return this.getMeshes().forEach((r) => {
|
|
1903
1949
|
let i = e[qn(r)];
|
|
1904
1950
|
if (!i?.size) return;
|
|
@@ -1946,30 +1992,30 @@ var Yn = class {
|
|
|
1946
1992
|
createClippingRectangle(e = !1) {
|
|
1947
1993
|
let t = e ? this.getSelectedWorldBox() : this.getModelWorldBox();
|
|
1948
1994
|
if (!t) return [];
|
|
1949
|
-
let n = Hn(t), r = t.min.clone().addScalar(-n), i = t.max.clone().addScalar(n), a = t.getCenter(new
|
|
1995
|
+
let n = Hn(t), r = t.min.clone().addScalar(-n), i = t.max.clone().addScalar(n), a = t.getCenter(new B()), o = [
|
|
1950
1996
|
{
|
|
1951
|
-
normal: new
|
|
1952
|
-
point: new
|
|
1997
|
+
normal: new B(1, 0, 0),
|
|
1998
|
+
point: new B(r.x, a.y, a.z)
|
|
1953
1999
|
},
|
|
1954
2000
|
{
|
|
1955
|
-
normal: new
|
|
1956
|
-
point: new
|
|
2001
|
+
normal: new B(-1, 0, 0),
|
|
2002
|
+
point: new B(i.x, a.y, a.z)
|
|
1957
2003
|
},
|
|
1958
2004
|
{
|
|
1959
|
-
normal: new
|
|
1960
|
-
point: new
|
|
2005
|
+
normal: new B(0, 1, 0),
|
|
2006
|
+
point: new B(a.x, r.y, a.z)
|
|
1961
2007
|
},
|
|
1962
2008
|
{
|
|
1963
|
-
normal: new
|
|
1964
|
-
point: new
|
|
2009
|
+
normal: new B(0, -1, 0),
|
|
2010
|
+
point: new B(a.x, i.y, a.z)
|
|
1965
2011
|
},
|
|
1966
2012
|
{
|
|
1967
|
-
normal: new
|
|
1968
|
-
point: new
|
|
2013
|
+
normal: new B(0, 0, 1),
|
|
2014
|
+
point: new B(a.x, a.y, r.z)
|
|
1969
2015
|
},
|
|
1970
2016
|
{
|
|
1971
|
-
normal: new
|
|
1972
|
-
point: new
|
|
2017
|
+
normal: new B(0, 0, -1),
|
|
2018
|
+
point: new B(a.x, a.y, i.z)
|
|
1973
2019
|
}
|
|
1974
2020
|
].map(({ normal: e, point: t }) => ({
|
|
1975
2021
|
normal: e,
|
|
@@ -1981,10 +2027,12 @@ var Yn = class {
|
|
|
1981
2027
|
}), this.updateHelpers(), o.map(({ plane: e }) => e.clone());
|
|
1982
2028
|
}
|
|
1983
2029
|
addPlane(e, t, n) {
|
|
1984
|
-
if (this.active || this.setActive(!0), this.planes.push(e), new Un(this, e, t, n),
|
|
2030
|
+
if (this.active || this.setActive(!0), this.planes.push(e), new Un(this, e, t, n), this.edgesActive) {
|
|
1985
2031
|
let t = new wn(this, e);
|
|
1986
2032
|
t.create(), t.update();
|
|
1987
2033
|
}
|
|
2034
|
+
let r = new gn(this, e);
|
|
2035
|
+
r.setVisible(this.active && this.capsActive && !this.capsDragActive), this.updateHelpers(), this.updateCaps(r), this.updateMaterials();
|
|
1988
2036
|
}
|
|
1989
2037
|
deleteAllPlanes() {
|
|
1990
2038
|
this.active = !1, this.capsDragActive = !1, this.helperDragActive = !1, this.clearCapsDragIdleTimeout(), this.context.renderer.localClippingEnabled = !1, this.updateEdgesFrame !== null && (cancelAnimationFrame(this.updateEdgesFrame), this.updateEdgesFrame = null), this.updateHelpersFrame !== null && (cancelAnimationFrame(this.updateHelpersFrame), this.updateHelpersFrame = null), this.helpers.forEach((e) => e.dispose()), this.caps.forEach((e) => e.dispose()), this.edges.forEach((e) => e.dispose()), this.helpers = [], this.caps = [], this.edges = [], this.planes = [], this.updateMaterials();
|
|
@@ -1993,13 +2041,16 @@ var Yn = class {
|
|
|
1993
2041
|
this.helpersActive !== e && (this.helpersActive = e, this.helpers.forEach((e) => e.setVisible(this.active && this.helpersActive)));
|
|
1994
2042
|
}
|
|
1995
2043
|
setCapsActive(e) {
|
|
1996
|
-
this.capsActive !== e && (this.capsActive = e, this.caps.forEach((t) => t.setVisible(this.active && e && !this.capsDragActive)), this.active && e && !this.capsDragActive && this.updateCaps());
|
|
2044
|
+
this.capsActive !== e && (this.capsActive = e, this.caps.forEach((t) => t.setVisible(this.active && e && !this.capsDragActive)), this.active && e && !this.capsDragActive && (this.flushEdgesUpdate(), this.updateCaps()));
|
|
1997
2045
|
}
|
|
1998
2046
|
setEdgesActive(e) {
|
|
1999
|
-
|
|
2047
|
+
if (this.edgesActive === e) return;
|
|
2048
|
+
this.edgesActive = e;
|
|
2049
|
+
let t = !1;
|
|
2050
|
+
e && this.edges.length !== this.planes.length && (t = !0, this.edges.forEach((e) => e.dispose()), this.edges = [], this.planes.forEach((e) => {
|
|
2000
2051
|
let t = new wn(this, e);
|
|
2001
2052
|
t.create(), t.update();
|
|
2002
|
-
})), this.edges.forEach((t) => t.setVisible(this.active && e)));
|
|
2053
|
+
})), this.edges.forEach((t) => t.setVisible(this.active && e)), this.active && e && (t || this.updateEdges(), this.capsActive && !this.capsDragActive && this.updateCaps());
|
|
2003
2054
|
}
|
|
2004
2055
|
updateEdges() {
|
|
2005
2056
|
this.edgesActive && this.edges.forEach((e) => e.update());
|
|
@@ -2007,8 +2058,10 @@ var Yn = class {
|
|
|
2007
2058
|
flushEdgesUpdate() {
|
|
2008
2059
|
this.updateEdgesFrame !== null && (cancelAnimationFrame(this.updateEdgesFrame), this.updateEdgesFrame = null), this.updateEdges();
|
|
2009
2060
|
}
|
|
2010
|
-
updateCaps() {
|
|
2011
|
-
this.capsActive && (this.capsDragActive || this.caps.forEach((
|
|
2061
|
+
updateCaps(e) {
|
|
2062
|
+
this.capsActive && (this.capsDragActive || this.caps.forEach((t) => {
|
|
2063
|
+
t !== e && t.update();
|
|
2064
|
+
}));
|
|
2012
2065
|
}
|
|
2013
2066
|
updateHelpers() {
|
|
2014
2067
|
this.helpers.forEach((e) => e.updateClipping());
|
|
@@ -2024,14 +2077,14 @@ var Yn = class {
|
|
|
2024
2077
|
}));
|
|
2025
2078
|
}
|
|
2026
2079
|
syncWithModel() {
|
|
2027
|
-
this.updateMaterials(), this.
|
|
2080
|
+
this.updateMaterials(), this.edges.forEach((e) => e.syncMeshes()), this.updateEdges(), this.caps.forEach((e) => e.syncMeshes()), this.updateHelpers();
|
|
2028
2081
|
}
|
|
2029
2082
|
dispose() {
|
|
2030
2083
|
this.clearCapsDragIdleTimeout(), this.deleteAllPlanes();
|
|
2031
2084
|
}
|
|
2032
2085
|
};
|
|
2033
2086
|
function Xn(e, t, n) {
|
|
2034
|
-
let r = p((e) => e.camera), i = p((e) => e.gl), a = p((e) => e.raycaster), s = p((e) => e.scene), l =
|
|
2087
|
+
let r = p((e) => e.camera), i = p((e) => e.gl), a = p((e) => e.raycaster), s = p((e) => e.scene), l = Ee(), u = c(() => new Yn({
|
|
2035
2088
|
camera: r,
|
|
2036
2089
|
cameraUtils: n,
|
|
2037
2090
|
controlRef: t,
|
|
@@ -2110,7 +2163,7 @@ function Xn(e, t, n) {
|
|
|
2110
2163
|
var Zn = 1e-6;
|
|
2111
2164
|
function Qn(e, t) {
|
|
2112
2165
|
let n = t.getBoundingClientRect();
|
|
2113
|
-
return n.width <= 0 || n.height <= 0 || e.clientX < n.left || e.clientX > n.right || e.clientY < n.top || e.clientY > n.bottom ? null : new
|
|
2166
|
+
return n.width <= 0 || n.height <= 0 || e.clientX < n.left || e.clientX > n.right || e.clientY < n.top || e.clientY > n.bottom ? null : new z((e.clientX - n.left) / n.width * 2 - 1, -((e.clientY - n.top) / n.height) * 2 + 1);
|
|
2114
2167
|
}
|
|
2115
2168
|
function $n(e, t) {
|
|
2116
2169
|
return t.every((t) => t.distanceToPoint(e) >= -Zn);
|
|
@@ -2124,7 +2177,7 @@ function er(e) {
|
|
|
2124
2177
|
return !0;
|
|
2125
2178
|
}
|
|
2126
2179
|
function tr(e) {
|
|
2127
|
-
let t = p((e) => e.camera), n = p((e) => e.gl), r = p((e) => e.raycaster), a = l(null), s = l(null), u = l(new
|
|
2180
|
+
let t = p((e) => e.camera), n = p((e) => e.gl), r = p((e) => e.raycaster), a = l(null), s = l(null), u = l(new z()), d = i((e) => {
|
|
2128
2181
|
a.current = e;
|
|
2129
2182
|
}, []), f = i(() => {
|
|
2130
2183
|
let e = a.current;
|
|
@@ -2182,7 +2235,7 @@ function sr(e) {
|
|
|
2182
2235
|
let a = r.measureText(e), o = a.actualBoundingBoxAscent || nr * .8, s = a.actualBoundingBoxDescent || nr * .2, c = Math.max(1, Math.ceil(a.width + rr * 2)), l = Math.max(1, Math.ceil(o + s + ir * 2));
|
|
2183
2236
|
n.width = Math.ceil(c * t), n.height = Math.ceil(l * t), r.scale(t, t), r.clearRect(0, 0, c, l), r.fillStyle = "rgba(255, 255, 255, 0.86)", r.strokeStyle = "rgba(29, 39, 51, 0.22)", r.lineWidth = 1, r.beginPath(), r.roundRect(.5, .5, c - 1, l - 1, 4), r.fill(), r.stroke(), r.font = i, r.fillStyle = "#111827", r.textAlign = "center", r.textBaseline = "middle", r.fillText(e, c / 2, l / 2);
|
|
2184
2237
|
let u = new b(n);
|
|
2185
|
-
return u.colorSpace =
|
|
2238
|
+
return u.colorSpace = R, u.generateMipmaps = !1, u.magFilter = A, u.minFilter = A, u.needsUpdate = !0, {
|
|
2186
2239
|
height: l,
|
|
2187
2240
|
texture: u,
|
|
2188
2241
|
width: c
|
|
@@ -2264,7 +2317,7 @@ var cr = class e {
|
|
|
2264
2317
|
n.position.copy(e), n.scale.copy(this.endpointBaseScale), n.lookAt(t), n.renderOrder = 4, this.endpointMeshes.push(n), this.root.add(n);
|
|
2265
2318
|
}
|
|
2266
2319
|
createLabelSprite() {
|
|
2267
|
-
let e = new
|
|
2320
|
+
let e = new fe(new pe({
|
|
2268
2321
|
depthTest: !1,
|
|
2269
2322
|
depthWrite: !1,
|
|
2270
2323
|
transparent: !0
|
|
@@ -2340,7 +2393,7 @@ var hr = class e {
|
|
|
2340
2393
|
depthTest: !1,
|
|
2341
2394
|
depthWrite: !1
|
|
2342
2395
|
});
|
|
2343
|
-
endpointScale = new
|
|
2396
|
+
endpointScale = new B(1, 1, 1);
|
|
2344
2397
|
lineMaterial = new ne({
|
|
2345
2398
|
color: lr,
|
|
2346
2399
|
dashSize: .2,
|
|
@@ -2357,7 +2410,7 @@ var hr = class e {
|
|
|
2357
2410
|
}));
|
|
2358
2411
|
root = new D();
|
|
2359
2412
|
snapDistance = ur;
|
|
2360
|
-
startPoint = new
|
|
2413
|
+
startPoint = new B();
|
|
2361
2414
|
unit = "m";
|
|
2362
2415
|
constructor(e) {
|
|
2363
2416
|
this.context = e, this.root.name = "BimatterDimensions", this.previewMarker.renderOrder = 5, this.previewMarker.visible = !1, this.root.add(this.previewMarker), this.context.scene.add(this.root);
|
|
@@ -2504,7 +2557,7 @@ var hr = class e {
|
|
|
2504
2557
|
e.face.b,
|
|
2505
2558
|
e.face.c
|
|
2506
2559
|
].map((n) => {
|
|
2507
|
-
let r = new
|
|
2560
|
+
let r = new B(t.getX(n), t.getY(n), t.getZ(n));
|
|
2508
2561
|
return e.object.localToWorld(r);
|
|
2509
2562
|
}).filter((t) => t.distanceTo(e.point) <= this.snapDistance && $n(t, n));
|
|
2510
2563
|
return r.length ? r.reduce((t, n) => n.distanceTo(e.point) < t.distanceTo(e.point) ? n : t) : e.point.clone();
|
|
@@ -2563,11 +2616,11 @@ var hr = class e {
|
|
|
2563
2616
|
return n.translate(0, -e / 2, 0), n.rotateX(-Math.PI / 2), n;
|
|
2564
2617
|
}
|
|
2565
2618
|
static createPreviewGeometry() {
|
|
2566
|
-
return new
|
|
2619
|
+
return new de(.5, 16, 12);
|
|
2567
2620
|
}
|
|
2568
2621
|
};
|
|
2569
2622
|
function gr(e, t, n, r) {
|
|
2570
|
-
let i = p((e) => e.camera), a = p((e) => e.gl), s = p((e) => e.scene), l = p((e) => e.size), u =
|
|
2623
|
+
let i = p((e) => e.camera), a = p((e) => e.gl), s = p((e) => e.scene), l = p((e) => e.size), u = Ee(), d = c(() => new hr({
|
|
2571
2624
|
camera: i,
|
|
2572
2625
|
cameraUtils: n,
|
|
2573
2626
|
controlRef: t,
|
|
@@ -2638,7 +2691,7 @@ function _r(e) {
|
|
|
2638
2691
|
return e instanceof HTMLElement ? e.isContentEditable || e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement : !1;
|
|
2639
2692
|
}
|
|
2640
2693
|
function vr() {
|
|
2641
|
-
let e =
|
|
2694
|
+
let e = U((e) => e.api), t = U((e) => e.defaultHotkeysEnabled);
|
|
2642
2695
|
o(() => {
|
|
2643
2696
|
if (!t) return;
|
|
2644
2697
|
let n = (t) => {
|
|
@@ -2651,7 +2704,7 @@ function vr() {
|
|
|
2651
2704
|
}
|
|
2652
2705
|
//#endregion
|
|
2653
2706
|
//#region src/viewer/Selector/SelectionBox.ts
|
|
2654
|
-
var yr = new
|
|
2707
|
+
var yr = new B(), br = new B(), J = new z(), xr = new B(), Sr = new B(), Cr = new B(), wr = new B(), Tr = new B(), Er = new B(), Dr = new B();
|
|
2655
2708
|
function Or(e) {
|
|
2656
2709
|
let t = e;
|
|
2657
2710
|
for (; t;) {
|
|
@@ -2746,18 +2799,18 @@ function Vr(e, t, n, r) {
|
|
|
2746
2799
|
function Hr(e, t, n) {
|
|
2747
2800
|
return zr(e.x, e.y, t.x, t.y, n.minX, n.minY, n.maxX, n.minY) || zr(e.x, e.y, t.x, t.y, n.maxX, n.minY, n.maxX, n.maxY) || zr(e.x, e.y, t.x, t.y, n.maxX, n.maxY, n.minX, n.maxY) || zr(e.x, e.y, t.x, t.y, n.minX, n.maxY, n.minX, n.minY);
|
|
2748
2801
|
}
|
|
2749
|
-
function Ur(e, t, n, r, i = new
|
|
2802
|
+
function Ur(e, t, n, r, i = new z()) {
|
|
2750
2803
|
let a = yr.copy(t).applyMatrix4(e.matrixWorld).project(n);
|
|
2751
2804
|
return i.set((a.x + 1) / 2 * r.width + r.left, (-a.y + 1) / 2 * r.height + r.top);
|
|
2752
2805
|
}
|
|
2753
2806
|
function Wr(e, t, n, r, i) {
|
|
2754
2807
|
let a = Infinity, o = -Infinity, s = Infinity, c = -Infinity, l = 0;
|
|
2755
|
-
for (let u = 0; u < 2; u++) for (let d = 0; d < 2; d++) for (let f = 0; f < 2; f++) br.set(u ? t.max.x : t.min.x, d ? t.max.y : t.min.y, f ? t.max.z : t.min.z), Ur(e, br, r, i,
|
|
2756
|
-
return o < n.minX || a > n.maxX || c < n.minY || s > n.maxY ?
|
|
2808
|
+
for (let u = 0; u < 2; u++) for (let d = 0; d < 2; d++) for (let f = 0; f < 2; f++) br.set(u ? t.max.x : t.min.x, d ? t.max.y : t.min.y, f ? t.max.z : t.min.z), Ur(e, br, r, i, J), a = Math.min(a, J.x), o = Math.max(o, J.x), s = Math.min(s, J.y), c = Math.max(c, J.y), Ir(J, n) && (l += 1);
|
|
2809
|
+
return o < n.minX || a > n.maxX || c < n.minY || s > n.maxY ? xe : l === 8 ? ve : ye;
|
|
2757
2810
|
}
|
|
2758
2811
|
function Gr(e, t, n, r) {
|
|
2759
2812
|
let i = Infinity, a = -Infinity, o = Infinity, s = -Infinity;
|
|
2760
|
-
for (let c = 0; c < 2; c++) for (let l = 0; l < 2; l++) for (let u = 0; u < 2; u++) br.set(c ? t.max.x : t.min.x, l ? t.max.y : t.min.y, u ? t.max.z : t.min.z), Ur(e, br, n, r,
|
|
2813
|
+
for (let c = 0; c < 2; c++) for (let l = 0; l < 2; l++) for (let u = 0; u < 2; u++) br.set(c ? t.max.x : t.min.x, l ? t.max.y : t.min.y, u ? t.max.z : t.min.z), Ur(e, br, n, r, J), i = Math.min(i, J.x), a = Math.max(a, J.x), o = Math.min(o, J.y), s = Math.max(s, J.y);
|
|
2761
2814
|
return {
|
|
2762
2815
|
minX: i,
|
|
2763
2816
|
minY: o,
|
|
@@ -2790,7 +2843,7 @@ function Xr(e, t, n, r = []) {
|
|
|
2790
2843
|
r.length && (Tr.fromBufferAttribute(s, a.getX(c)), Er.fromBufferAttribute(s, a.getX(c + 1)), Dr.fromBufferAttribute(s, a.getX(c + 2)), !jr(e, Tr, Er, Dr, r)) || Jr(n, Or(e), o.getX(a.getX(c)));
|
|
2791
2844
|
}
|
|
2792
2845
|
function Zr({ model: e, camera: t, viewport: n, rect: r, candidateIdsByModel: i, clippingPlanes: a, profile: o }) {
|
|
2793
|
-
let s = performance.now(), c = /* @__PURE__ */ new Map(), l = new
|
|
2846
|
+
let s = performance.now(), c = /* @__PURE__ */ new Map(), l = new B();
|
|
2794
2847
|
e.traverse((e) => {
|
|
2795
2848
|
let s = e;
|
|
2796
2849
|
if (!s.isMesh || !kr(s)) return;
|
|
@@ -2948,7 +3001,7 @@ function ui(e) {
|
|
|
2948
3001
|
};
|
|
2949
3002
|
}
|
|
2950
3003
|
function di(e, t, n, r, i, a) {
|
|
2951
|
-
let s = l("end"), c =
|
|
3004
|
+
let s = l("end"), c = U((e) => e.selected), u = U((e) => e.setSelected), d = U((e) => e.addSelected), f = U((e) => e.removeSelected), m = U((e) => e.showStats), h = Ee(), g = l(null), _ = l(null), v = l(!1), y = l(!1), b = l("add"), x = l(null), S = l(!1), C = l(0), w = l(null), T = l(null), E = () => h.getState().selectionInteractionDisabled, D = (e) => {
|
|
2952
3005
|
if (r) {
|
|
2953
3006
|
r(e);
|
|
2954
3007
|
return;
|
|
@@ -2985,7 +3038,7 @@ function di(e, t, n, r, i, a) {
|
|
|
2985
3038
|
O();
|
|
2986
3039
|
return;
|
|
2987
3040
|
}
|
|
2988
|
-
let t =
|
|
3041
|
+
let t = R(e);
|
|
2989
3042
|
O(), t && ee(t.modelID, t.elementID);
|
|
2990
3043
|
};
|
|
2991
3044
|
function k() {
|
|
@@ -3034,7 +3087,7 @@ function di(e, t, n, r, i, a) {
|
|
|
3034
3087
|
s.current = "end";
|
|
3035
3088
|
return;
|
|
3036
3089
|
}
|
|
3037
|
-
let n = t.shiftKey, r = t.ctrlKey, i =
|
|
3090
|
+
let n = t.shiftKey, r = t.ctrlKey, i = R(t), a, o = oi(e), l = null;
|
|
3038
3091
|
if (i && (o = i.modelID, l = i.hit.point, a = i.elementID), r) {
|
|
3039
3092
|
a !== void 0 && f(o, [a]);
|
|
3040
3093
|
return;
|
|
@@ -3044,14 +3097,14 @@ function di(e, t, n, r, i, a) {
|
|
|
3044
3097
|
}
|
|
3045
3098
|
u(o, a === void 0 ? [] : [a], !0), l && D(l);
|
|
3046
3099
|
}, ae = (e) => {
|
|
3047
|
-
E() || e.button !== 0 || !e.shiftKey && !e.ctrlKey || (g.current = new
|
|
3100
|
+
E() || e.button !== 0 || !e.shiftKey && !e.ctrlKey || (g.current = new z(e.clientX, e.clientY), b.current = e.ctrlKey ? "remove" : "add", v.current = !1, t.current && (t.current.enabled = !1));
|
|
3048
3101
|
}, oe = (e) => {
|
|
3049
3102
|
if (E()) {
|
|
3050
3103
|
te();
|
|
3051
3104
|
return;
|
|
3052
3105
|
}
|
|
3053
3106
|
if (!g.current) return;
|
|
3054
|
-
let t = new
|
|
3107
|
+
let t = new z(e.clientX, e.clientY), n = Math.abs(t.x - g.current.x), r = Math.abs(t.y - g.current.y);
|
|
3055
3108
|
n < 6 && r < 6 || (v.current ||= !0, e.preventDefault(), ti(_, g.current, t));
|
|
3056
3109
|
}, se = (r) => {
|
|
3057
3110
|
if (E()) {
|
|
@@ -3060,7 +3113,7 @@ function di(e, t, n, r, i, a) {
|
|
|
3060
3113
|
}
|
|
3061
3114
|
if (!g.current) return;
|
|
3062
3115
|
j.current = F();
|
|
3063
|
-
let i = v.current, a = new
|
|
3116
|
+
let i = v.current, a = new z(r.clientX, r.clientY), o = Pr(g.current, a), s = Fr(g.current, a);
|
|
3064
3117
|
if (g.current = null, v.current = !1, ni(_), t.current && setTimeout(() => {
|
|
3065
3118
|
t.current && (t.current.enabled = !0);
|
|
3066
3119
|
}, 100), !i) return;
|
|
@@ -3089,14 +3142,14 @@ function di(e, t, n, r, i, a) {
|
|
|
3089
3142
|
object: r,
|
|
3090
3143
|
recursive: !0
|
|
3091
3144
|
}) : [];
|
|
3092
|
-
},
|
|
3145
|
+
}, L = () => i?.().filter((e) => e.visible) ?? [], ce = (e, t) => {
|
|
3093
3146
|
let n = I(e, t);
|
|
3094
3147
|
for (let e of n) {
|
|
3095
3148
|
let t = ui(e);
|
|
3096
3149
|
if (t) return t;
|
|
3097
3150
|
}
|
|
3098
3151
|
return null;
|
|
3099
|
-
},
|
|
3152
|
+
}, R = (t) => ce(t, L()) || ce(t, e.current);
|
|
3100
3153
|
o(() => {
|
|
3101
3154
|
let e = t.current;
|
|
3102
3155
|
if (!e) return;
|
|
@@ -3122,14 +3175,14 @@ function di(e, t, n, r, i, a) {
|
|
|
3122
3175
|
}
|
|
3123
3176
|
//#endregion
|
|
3124
3177
|
//#region src/viewer/Camera/useCameraFit.tsx
|
|
3125
|
-
var fi = new
|
|
3178
|
+
var fi = new B(1, 1, 1).normalize(), pi = 1.18;
|
|
3126
3179
|
function mi() {
|
|
3127
3180
|
let { camera: e } = p();
|
|
3128
3181
|
return i((t, n, r) => {
|
|
3129
3182
|
if (!t.current || !(e instanceof se)) return;
|
|
3130
3183
|
let i = new g().setFromObject(t.current);
|
|
3131
3184
|
if (i.isEmpty()) return;
|
|
3132
|
-
let a = i.getCenter(new
|
|
3185
|
+
let a = i.getCenter(new B()), o = i.getBoundingSphere(new ue()), s = M.degToRad(e.fov), c = 2 * Math.atan(Math.tan(s / 2) * e.aspect), l = Math.min(s, c), u = o.radius / Math.sin(l / 2) * pi;
|
|
3133
3186
|
e.position.copy(a).addScaledVector(fi, u), e.up.set(0, 1, 0), e.lookAt(a), e.updateProjectionMatrix();
|
|
3134
3187
|
let d = n.current;
|
|
3135
3188
|
d && (d.cancel(), d.setFocalOffset(0, 0, 0, !1), d.setLookAt(e.position.x, e.position.y, e.position.z, a.x, a.y, a.z, !1)), r.current && (r.current.position.copy(a).addScaledVector(fi, u * .8), r.current.lookAt(a));
|
|
@@ -3138,8 +3191,8 @@ function mi() {
|
|
|
3138
3191
|
//#endregion
|
|
3139
3192
|
//#region src/viewer/store/ViewerStoreProvider.tsx
|
|
3140
3193
|
function hi({ children: e, store: t }) {
|
|
3141
|
-
let [n] = u(() => t ??
|
|
3142
|
-
return /* @__PURE__ */
|
|
3194
|
+
let [n] = u(() => t ?? Ae());
|
|
3195
|
+
return /* @__PURE__ */ V(Te.Provider, {
|
|
3143
3196
|
value: n,
|
|
3144
3197
|
children: e
|
|
3145
3198
|
});
|
|
@@ -3171,19 +3224,19 @@ function wi(e, t) {
|
|
|
3171
3224
|
return t;
|
|
3172
3225
|
}
|
|
3173
3226
|
}
|
|
3174
|
-
function
|
|
3227
|
+
function Y(e) {
|
|
3175
3228
|
return typeof e == "string" && e.trim() ? e : null;
|
|
3176
3229
|
}
|
|
3177
3230
|
function Ti(e) {
|
|
3178
3231
|
let t = Si(e.props) ? e.props : {};
|
|
3179
|
-
return
|
|
3232
|
+
return Y(e.type ?? e.Type ?? t.type ?? t.Type) ?? vi;
|
|
3180
3233
|
}
|
|
3181
3234
|
function Ei(e) {
|
|
3182
3235
|
let t = Si(e.props) ? e.props : {};
|
|
3183
|
-
return
|
|
3236
|
+
return Y(e.guid ?? e.GlobalId ?? e.globalId ?? t.guid ?? t.GlobalId ?? t.globalId) ?? "";
|
|
3184
3237
|
}
|
|
3185
3238
|
function Di(e, t) {
|
|
3186
|
-
return
|
|
3239
|
+
return Y(e.Name) ?? Y(e.name) ?? Y(e.DisplayName) ?? Y(e.displayName) ?? `Property ${t + 1}`;
|
|
3187
3240
|
}
|
|
3188
3241
|
function Oi(e) {
|
|
3189
3242
|
for (let t of [
|
|
@@ -3209,7 +3262,7 @@ function Oi(e) {
|
|
|
3209
3262
|
].includes(e)));
|
|
3210
3263
|
}
|
|
3211
3264
|
function ki(e, t) {
|
|
3212
|
-
return
|
|
3265
|
+
return Y(e.name) ?? Y(e.Name) ?? `Set ${t + 1}`;
|
|
3213
3266
|
}
|
|
3214
3267
|
function Ai(e) {
|
|
3215
3268
|
let t = e.props;
|
|
@@ -3443,17 +3496,17 @@ function ra(e, t = {}) {
|
|
|
3443
3496
|
}
|
|
3444
3497
|
//#endregion
|
|
3445
3498
|
//#region src/viewer/api/ViewerPropertiesApi.ts
|
|
3446
|
-
function
|
|
3499
|
+
function X(e) {
|
|
3447
3500
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
3448
3501
|
}
|
|
3449
3502
|
function ia(e, t) {
|
|
3450
3503
|
return Object.prototype.hasOwnProperty.call(e, t);
|
|
3451
3504
|
}
|
|
3452
3505
|
function aa(e) {
|
|
3453
|
-
return
|
|
3506
|
+
return X(e);
|
|
3454
3507
|
}
|
|
3455
3508
|
function oa(e) {
|
|
3456
|
-
return Array.isArray(e) ? e.filter(aa) :
|
|
3509
|
+
return Array.isArray(e) ? e.filter(aa) : X(e) ? Object.values(e).filter(aa) : [];
|
|
3457
3510
|
}
|
|
3458
3511
|
function sa(e) {
|
|
3459
3512
|
if (typeof e == "number" && Number.isFinite(e)) return e;
|
|
@@ -3480,7 +3533,7 @@ function la(e) {
|
|
|
3480
3533
|
return [];
|
|
3481
3534
|
}
|
|
3482
3535
|
function ua(e) {
|
|
3483
|
-
let t =
|
|
3536
|
+
let t = X(e.props) ? e.props : {}, n = e.type ?? e.Type ?? t.type ?? t.Type;
|
|
3484
3537
|
return typeof n == "string" ? n : "";
|
|
3485
3538
|
}
|
|
3486
3539
|
function da(e) {
|
|
@@ -3506,7 +3559,7 @@ function ha(e, t) {
|
|
|
3506
3559
|
children: oa(t),
|
|
3507
3560
|
name: `Model ${e}`,
|
|
3508
3561
|
type: "Model"
|
|
3509
|
-
} :
|
|
3562
|
+
} : X(t) ? ca(t) !== null || typeof t.name == "string" || typeof t.Name == "string" || typeof t.type == "string" || typeof t.Type == "string" || Array.isArray(t.children) ? t : {
|
|
3510
3563
|
children: oa(t),
|
|
3511
3564
|
name: `Model ${e}`,
|
|
3512
3565
|
type: "Model"
|
|
@@ -3550,7 +3603,7 @@ function xa(e, t, n) {
|
|
|
3550
3603
|
return e[t]?.[n];
|
|
3551
3604
|
}
|
|
3552
3605
|
function Sa(e) {
|
|
3553
|
-
return typeof e == "string" ? e :
|
|
3606
|
+
return typeof e == "string" ? e : X(e) && typeof e.value == "string" ? e.value : "";
|
|
3554
3607
|
}
|
|
3555
3608
|
function Ca(e, t) {
|
|
3556
3609
|
return Sa(e.Name) || Sa(e.name) || Sa(e.DisplayName) || Sa(e.displayName) || `Property ${t + 1}`;
|
|
@@ -3586,13 +3639,13 @@ function Ea(e, t) {
|
|
|
3586
3639
|
}
|
|
3587
3640
|
function Da(e, t) {
|
|
3588
3641
|
let n = e.props;
|
|
3589
|
-
if (
|
|
3642
|
+
if (X(n)) {
|
|
3590
3643
|
let e = Ea(n, t);
|
|
3591
3644
|
if (e !== void 0) return e;
|
|
3592
3645
|
}
|
|
3593
3646
|
if (Array.isArray(n)) for (let e = 0; e < n.length; e += 1) {
|
|
3594
3647
|
let r = n[e];
|
|
3595
|
-
if (!
|
|
3648
|
+
if (!X(r)) continue;
|
|
3596
3649
|
let i = r;
|
|
3597
3650
|
if (Ca(i, e) === t) return wa(i);
|
|
3598
3651
|
}
|
|
@@ -3604,7 +3657,7 @@ function Oa(e, t, n) {
|
|
|
3604
3657
|
let r = e.sets?.find((e) => Ta(e) === n);
|
|
3605
3658
|
return r ? Da(r, t) : void 0;
|
|
3606
3659
|
}
|
|
3607
|
-
if (
|
|
3660
|
+
if (X(e.props)) {
|
|
3608
3661
|
let n = Ea(e.props, t);
|
|
3609
3662
|
if (n !== void 0) return n;
|
|
3610
3663
|
}
|
|
@@ -4115,7 +4168,7 @@ var ja = "BMT", Ma = 1, Na = {
|
|
|
4115
4168
|
return this.deflateBytes(new Uint8Array(e.buffer, e.byteOffset, e.byteLength));
|
|
4116
4169
|
}
|
|
4117
4170
|
deflateBytes(e) {
|
|
4118
|
-
return
|
|
4171
|
+
return we.deflate(e);
|
|
4119
4172
|
}
|
|
4120
4173
|
encodeText(e) {
|
|
4121
4174
|
return this.textEncoder.encode(e);
|
|
@@ -4517,9 +4570,9 @@ var no = class {
|
|
|
4517
4570
|
}
|
|
4518
4571
|
}, ro = class {
|
|
4519
4572
|
decodeBuffer(e) {
|
|
4520
|
-
return this.textDecoder.decode(
|
|
4573
|
+
return this.textDecoder.decode(we.inflate(e));
|
|
4521
4574
|
}
|
|
4522
|
-
decoder =
|
|
4575
|
+
decoder = we;
|
|
4523
4576
|
textDecoder = new TextDecoder("utf-8");
|
|
4524
4577
|
ChunkType = {
|
|
4525
4578
|
PROP: 1,
|
|
@@ -5095,7 +5148,7 @@ var Yo = new class {
|
|
|
5095
5148
|
}
|
|
5096
5149
|
return i;
|
|
5097
5150
|
}
|
|
5098
|
-
}(), Xo = .5, Zo = .04,
|
|
5151
|
+
}(), Xo = .5, Zo = .04, Z = .16, Qo = Z, Q = Xo * 2 - Z * 2, $o = Xo - Zo / 2, es = Xo - Z / 2, ts = Xo - Qo / 2, ns = .63, rs = "#dfe6ec", is = 260, as = 52, os = .17, ss = new g(), cs = new ue(), ls = [
|
|
5099
5152
|
{
|
|
5100
5153
|
direction: [
|
|
5101
5154
|
0,
|
|
@@ -5109,8 +5162,8 @@ var Yo = new class {
|
|
|
5109
5162
|
$o
|
|
5110
5163
|
],
|
|
5111
5164
|
scale: [
|
|
5112
|
-
|
|
5113
|
-
|
|
5165
|
+
Q,
|
|
5166
|
+
Q,
|
|
5114
5167
|
Zo
|
|
5115
5168
|
],
|
|
5116
5169
|
title: "Front",
|
|
@@ -5134,8 +5187,8 @@ var Yo = new class {
|
|
|
5134
5187
|
0
|
|
5135
5188
|
],
|
|
5136
5189
|
scale: [
|
|
5137
|
-
|
|
5138
|
-
|
|
5190
|
+
Q,
|
|
5191
|
+
Q,
|
|
5139
5192
|
Zo
|
|
5140
5193
|
],
|
|
5141
5194
|
title: "Back",
|
|
@@ -5160,8 +5213,8 @@ var Yo = new class {
|
|
|
5160
5213
|
],
|
|
5161
5214
|
scale: [
|
|
5162
5215
|
Zo,
|
|
5163
|
-
|
|
5164
|
-
|
|
5216
|
+
Q,
|
|
5217
|
+
Q
|
|
5165
5218
|
],
|
|
5166
5219
|
title: "Right",
|
|
5167
5220
|
type: "face"
|
|
@@ -5185,8 +5238,8 @@ var Yo = new class {
|
|
|
5185
5238
|
],
|
|
5186
5239
|
scale: [
|
|
5187
5240
|
Zo,
|
|
5188
|
-
|
|
5189
|
-
|
|
5241
|
+
Q,
|
|
5242
|
+
Q
|
|
5190
5243
|
],
|
|
5191
5244
|
title: "Left",
|
|
5192
5245
|
type: "face"
|
|
@@ -5209,9 +5262,9 @@ var Yo = new class {
|
|
|
5209
5262
|
0
|
|
5210
5263
|
],
|
|
5211
5264
|
scale: [
|
|
5212
|
-
|
|
5265
|
+
Q,
|
|
5213
5266
|
Zo,
|
|
5214
|
-
|
|
5267
|
+
Q
|
|
5215
5268
|
],
|
|
5216
5269
|
title: "Top",
|
|
5217
5270
|
type: "face"
|
|
@@ -5234,15 +5287,15 @@ var Yo = new class {
|
|
|
5234
5287
|
0
|
|
5235
5288
|
],
|
|
5236
5289
|
scale: [
|
|
5237
|
-
|
|
5290
|
+
Q,
|
|
5238
5291
|
Zo,
|
|
5239
|
-
|
|
5292
|
+
Q
|
|
5240
5293
|
],
|
|
5241
5294
|
title: "Bottom",
|
|
5242
5295
|
type: "face"
|
|
5243
5296
|
}
|
|
5244
5297
|
];
|
|
5245
|
-
function
|
|
5298
|
+
function us() {
|
|
5246
5299
|
let e = [], t = [-1, 1];
|
|
5247
5300
|
return t.forEach((n) => {
|
|
5248
5301
|
t.forEach((t) => {
|
|
@@ -5258,9 +5311,9 @@ function ls() {
|
|
|
5258
5311
|
t * es
|
|
5259
5312
|
],
|
|
5260
5313
|
scale: [
|
|
5314
|
+
Q,
|
|
5261
5315
|
Z,
|
|
5262
|
-
|
|
5263
|
-
X
|
|
5316
|
+
Z
|
|
5264
5317
|
],
|
|
5265
5318
|
title: `${n > 0 ? "Top" : "Bottom"} ${t > 0 ? "Front" : "Back"}`,
|
|
5266
5319
|
type: "edge"
|
|
@@ -5280,9 +5333,9 @@ function ls() {
|
|
|
5280
5333
|
t * es
|
|
5281
5334
|
],
|
|
5282
5335
|
scale: [
|
|
5283
|
-
X,
|
|
5284
5336
|
Z,
|
|
5285
|
-
|
|
5337
|
+
Q,
|
|
5338
|
+
Z
|
|
5286
5339
|
],
|
|
5287
5340
|
title: `${n > 0 ? "Right" : "Left"} ${t > 0 ? "Front" : "Back"}`,
|
|
5288
5341
|
type: "edge"
|
|
@@ -5302,9 +5355,9 @@ function ls() {
|
|
|
5302
5355
|
0
|
|
5303
5356
|
],
|
|
5304
5357
|
scale: [
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5358
|
+
Z,
|
|
5359
|
+
Z,
|
|
5360
|
+
Q
|
|
5308
5361
|
],
|
|
5309
5362
|
title: `${t > 0 ? "Top" : "Bottom"} ${n > 0 ? "Right" : "Left"}`,
|
|
5310
5363
|
type: "edge"
|
|
@@ -5312,7 +5365,7 @@ function ls() {
|
|
|
5312
5365
|
});
|
|
5313
5366
|
}), e;
|
|
5314
5367
|
}
|
|
5315
|
-
function
|
|
5368
|
+
function ds() {
|
|
5316
5369
|
let e = [], t = [-1, 1];
|
|
5317
5370
|
return t.forEach((n) => {
|
|
5318
5371
|
t.forEach((r) => {
|
|
@@ -5340,16 +5393,16 @@ function us() {
|
|
|
5340
5393
|
});
|
|
5341
5394
|
}), e;
|
|
5342
5395
|
}
|
|
5343
|
-
function
|
|
5396
|
+
function fs(e) {
|
|
5344
5397
|
e.stopPropagation(), e.nativeEvent.stopPropagation(), e.nativeEvent.stopImmediatePropagation?.();
|
|
5345
5398
|
}
|
|
5346
|
-
function
|
|
5399
|
+
function ps(e) {
|
|
5347
5400
|
return e ? "#4f7fa3" : rs;
|
|
5348
5401
|
}
|
|
5349
|
-
function
|
|
5402
|
+
function ms(e) {
|
|
5350
5403
|
return e ? 1 : .96;
|
|
5351
5404
|
}
|
|
5352
|
-
function
|
|
5405
|
+
function hs(e, t) {
|
|
5353
5406
|
let n = document.createElement("canvas"), r = n.getContext("2d");
|
|
5354
5407
|
if (!r) throw Error("Could not create navigation cube label context");
|
|
5355
5408
|
let i = `600 ${as}px system-ui, "Segoe UI", sans-serif`;
|
|
@@ -5357,17 +5410,17 @@ function ms(e, t) {
|
|
|
5357
5410
|
let a = r.measureText(e), o = a.actualBoundingBoxAscent || as * .8, s = a.actualBoundingBoxDescent || as * .2, c = Math.ceil(a.width + 36), l = Math.ceil(o + s + 20);
|
|
5358
5411
|
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);
|
|
5359
5412
|
let u = new b(n);
|
|
5360
|
-
return u.colorSpace =
|
|
5413
|
+
return u.colorSpace = R, u.generateMipmaps = !1, u.magFilter = A, u.minFilter = A, u.needsUpdate = !0, {
|
|
5361
5414
|
aspect: c / l,
|
|
5362
5415
|
texture: u
|
|
5363
5416
|
};
|
|
5364
5417
|
}
|
|
5365
|
-
function
|
|
5366
|
-
let { aspect: i, texture: a } = c(() =>
|
|
5367
|
-
return o(() => () => a.dispose(), [a]), /* @__PURE__ */
|
|
5418
|
+
function gs({ color: e, label: t, position: n, rotation: r }) {
|
|
5419
|
+
let { aspect: i, texture: a } = c(() => hs(t, e), [e, t]);
|
|
5420
|
+
return o(() => () => a.dispose(), [a]), /* @__PURE__ */ H("mesh", {
|
|
5368
5421
|
position: n,
|
|
5369
5422
|
rotation: r,
|
|
5370
|
-
children: [/* @__PURE__ */
|
|
5423
|
+
children: [/* @__PURE__ */ V("planeGeometry", { args: [os * i, os] }), /* @__PURE__ */ V("meshBasicMaterial", {
|
|
5371
5424
|
alphaTest: .1,
|
|
5372
5425
|
depthWrite: !1,
|
|
5373
5426
|
map: a,
|
|
@@ -5376,54 +5429,54 @@ function hs({ color: e, label: t, position: n, rotation: r }) {
|
|
|
5376
5429
|
})]
|
|
5377
5430
|
});
|
|
5378
5431
|
}
|
|
5379
|
-
function
|
|
5380
|
-
return Math.abs(e.y) > .9 ? new
|
|
5432
|
+
function _s(e) {
|
|
5433
|
+
return Math.abs(e.y) > .9 ? new B(0, 0, e.y > 0 ? -1 : 1) : new B(0, 1, 0);
|
|
5381
5434
|
}
|
|
5382
|
-
function
|
|
5435
|
+
function vs(e, t) {
|
|
5383
5436
|
let n = e.current;
|
|
5384
|
-
return !n || (n.updateWorldMatrix(!0, !0), ss.setFromObject(n), ss.isEmpty()) ? (
|
|
5437
|
+
return !n || (n.updateWorldMatrix(!0, !0), ss.setFromObject(n), ss.isEmpty()) ? (cs.center.copy(t), cs.radius = 10, cs) : (ss.getBoundingSphere(cs), (!Number.isFinite(cs.radius) || cs.radius <= 0) && (cs.radius = 10), cs);
|
|
5385
5438
|
}
|
|
5386
|
-
function
|
|
5387
|
-
return e.current?.getTarget(new
|
|
5439
|
+
function ys(e) {
|
|
5440
|
+
return e.current?.getTarget(new B()) ?? new B();
|
|
5388
5441
|
}
|
|
5389
|
-
function
|
|
5390
|
-
let a =
|
|
5442
|
+
function bs({ camera: e, controlRef: t, direction: n, modelRef: r, transitionRef: i }) {
|
|
5443
|
+
let a = ys(t), o = vs(r, a), s = o.center.clone(), c = new B(...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);
|
|
5391
5444
|
t.current?.cancel(), t.current?.setFocalOffset(0, 0, 0, !1), i.current = {
|
|
5392
5445
|
endPosition: d,
|
|
5393
5446
|
endTarget: s,
|
|
5394
|
-
endUp:
|
|
5447
|
+
endUp: _s(c),
|
|
5395
5448
|
startPosition: e.position.clone(),
|
|
5396
5449
|
startTarget: a,
|
|
5397
5450
|
startTime: performance.now(),
|
|
5398
5451
|
startUp: e.up.clone()
|
|
5399
5452
|
};
|
|
5400
5453
|
}
|
|
5401
|
-
function
|
|
5454
|
+
function xs({ action: e, onPick: t }) {
|
|
5402
5455
|
let [n, r] = u(!1);
|
|
5403
|
-
return /* @__PURE__ */
|
|
5456
|
+
return /* @__PURE__ */ H("group", {
|
|
5404
5457
|
position: e.position,
|
|
5405
|
-
onClick:
|
|
5458
|
+
onClick: fs,
|
|
5406
5459
|
onPointerDown: (n) => {
|
|
5407
|
-
|
|
5460
|
+
fs(n), t(e);
|
|
5408
5461
|
},
|
|
5409
5462
|
onPointerEnter: (e) => {
|
|
5410
|
-
|
|
5463
|
+
fs(e), r(!0);
|
|
5411
5464
|
},
|
|
5412
5465
|
onPointerLeave: (e) => {
|
|
5413
|
-
|
|
5466
|
+
fs(e), r(!1);
|
|
5414
5467
|
},
|
|
5415
|
-
children: [/* @__PURE__ */
|
|
5468
|
+
children: [/* @__PURE__ */ H("mesh", {
|
|
5416
5469
|
scale: e.scale,
|
|
5417
|
-
children: [/* @__PURE__ */
|
|
5470
|
+
children: [/* @__PURE__ */ V("boxGeometry", { args: [
|
|
5418
5471
|
1,
|
|
5419
5472
|
1,
|
|
5420
5473
|
1
|
|
5421
|
-
] }), /* @__PURE__ */
|
|
5422
|
-
color:
|
|
5423
|
-
opacity:
|
|
5474
|
+
] }), /* @__PURE__ */ V("meshBasicMaterial", {
|
|
5475
|
+
color: ps(n),
|
|
5476
|
+
opacity: ms(n),
|
|
5424
5477
|
transparent: !0
|
|
5425
5478
|
})]
|
|
5426
|
-
}), e.label && /* @__PURE__ */
|
|
5479
|
+
}), e.label && /* @__PURE__ */ V(gs, {
|
|
5427
5480
|
color: n ? "#ffffff" : "#50606f",
|
|
5428
5481
|
label: e.label,
|
|
5429
5482
|
position: [
|
|
@@ -5435,11 +5488,11 @@ function bs({ action: e, onPick: t }) {
|
|
|
5435
5488
|
})]
|
|
5436
5489
|
});
|
|
5437
5490
|
}
|
|
5438
|
-
function
|
|
5491
|
+
function Ss({ active: e = !0, cameraRef: t, controlRef: n, modelRef: r }) {
|
|
5439
5492
|
let i = l(null), a = l(null), o = c(() => [
|
|
5440
|
-
...
|
|
5441
|
-
...
|
|
5442
|
-
...
|
|
5493
|
+
...ls,
|
|
5494
|
+
...us(),
|
|
5495
|
+
...ds()
|
|
5443
5496
|
], []);
|
|
5444
5497
|
return f(() => {
|
|
5445
5498
|
if (!e) return;
|
|
@@ -5450,18 +5503,18 @@ function xs({ active: e = !0, cameraRef: t, controlRef: n, modelRef: r }) {
|
|
|
5450
5503
|
if (!o) return;
|
|
5451
5504
|
let s = performance.now() - o.startTime, c = Math.min(s / is, 1), l = 1 - (1 - c) ** 3, u = n.current;
|
|
5452
5505
|
if (r.position.lerpVectors(o.startPosition, o.endPosition, l), r.up.lerpVectors(o.startUp, o.endUp, l), u) {
|
|
5453
|
-
let e = new
|
|
5506
|
+
let e = new B().lerpVectors(o.startTarget, o.endTarget, l);
|
|
5454
5507
|
u.setLookAt(r.position.x, r.position.y, r.position.z, e.x, e.y, e.z, !1);
|
|
5455
5508
|
} else r.lookAt(o.endTarget);
|
|
5456
5509
|
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);
|
|
5457
|
-
}), e ? /* @__PURE__ */
|
|
5510
|
+
}), e ? /* @__PURE__ */ V("group", {
|
|
5458
5511
|
ref: i,
|
|
5459
5512
|
scale: ns,
|
|
5460
|
-
children: o.map((e) => /* @__PURE__ */
|
|
5513
|
+
children: o.map((e) => /* @__PURE__ */ V(xs, {
|
|
5461
5514
|
action: e,
|
|
5462
5515
|
onPick: (e) => {
|
|
5463
5516
|
let i = t.current;
|
|
5464
|
-
i &&
|
|
5517
|
+
i && bs({
|
|
5465
5518
|
camera: i,
|
|
5466
5519
|
controlRef: n,
|
|
5467
5520
|
direction: e.direction,
|
|
@@ -5474,13 +5527,13 @@ function xs({ active: e = !0, cameraRef: t, controlRef: n, modelRef: r }) {
|
|
|
5474
5527
|
}
|
|
5475
5528
|
//#endregion
|
|
5476
5529
|
//#region src/viewer/Viewer.tsx
|
|
5477
|
-
var
|
|
5530
|
+
var Cs = class {
|
|
5478
5531
|
sceneApi = null;
|
|
5479
5532
|
get = () => this.sceneApi;
|
|
5480
5533
|
set = (e) => {
|
|
5481
5534
|
this.sceneApi = e;
|
|
5482
5535
|
};
|
|
5483
|
-
},
|
|
5536
|
+
}, ws = {
|
|
5484
5537
|
bottom: 16,
|
|
5485
5538
|
height: 96,
|
|
5486
5539
|
pointerEvents: "auto",
|
|
@@ -5489,11 +5542,11 @@ var Ss = class {
|
|
|
5489
5542
|
touchAction: "none",
|
|
5490
5543
|
width: 96,
|
|
5491
5544
|
zIndex: 2
|
|
5492
|
-
},
|
|
5545
|
+
}, Ts = {
|
|
5493
5546
|
height: "100%",
|
|
5494
5547
|
position: "relative",
|
|
5495
5548
|
width: "100%"
|
|
5496
|
-
},
|
|
5549
|
+
}, Es = {
|
|
5497
5550
|
far: 50,
|
|
5498
5551
|
near: .1,
|
|
5499
5552
|
position: [
|
|
@@ -5502,49 +5555,49 @@ var Ss = class {
|
|
|
5502
5555
|
10
|
|
5503
5556
|
],
|
|
5504
5557
|
zoom: 72
|
|
5505
|
-
},
|
|
5558
|
+
}, Ds = {
|
|
5506
5559
|
alpha: !0,
|
|
5507
5560
|
antialias: !0
|
|
5508
|
-
},
|
|
5561
|
+
}, Os = {
|
|
5509
5562
|
alpha: !0,
|
|
5510
5563
|
antialias: !1,
|
|
5511
5564
|
powerPreference: "high-performance"
|
|
5512
|
-
},
|
|
5565
|
+
}, ks = {
|
|
5513
5566
|
antialias: !1,
|
|
5514
5567
|
powerPreference: "high-performance"
|
|
5515
|
-
},
|
|
5516
|
-
function
|
|
5568
|
+
}, As = .1, js = .02, Ms = 150, Ns = .75, Ps = .6, Fs = 1e3, Is = 50, Ls = 1.25, Rs = .08, zs = 1.2, Bs = 2, Vs = new g(), Hs = new ue(), $ = new B(), Us = new B(), Ws = new B();
|
|
5569
|
+
function Gs(e, t) {
|
|
5517
5570
|
return Array.isArray(e) ? [Math.min(e[0], t), Math.min(e[1], t)] : typeof e == "number" ? Math.min(e, t) : t;
|
|
5518
5571
|
}
|
|
5519
|
-
function
|
|
5572
|
+
function Ks() {
|
|
5520
5573
|
let e = navigator, t = navigator.userAgent.toLowerCase(), n = navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1, r = window.matchMedia?.("(pointer: coarse)").matches ?? !1;
|
|
5521
5574
|
return e.userAgentData?.mobile || n || /android|iphone|ipad|ipod|mobile|tablet/.test(t) || navigator.maxTouchPoints > 1 && r ? "mobile" : "pc";
|
|
5522
5575
|
}
|
|
5523
|
-
function
|
|
5524
|
-
let t =
|
|
5525
|
-
return t ? Math.max(t.radius *
|
|
5576
|
+
function qs(e) {
|
|
5577
|
+
let t = Js(e);
|
|
5578
|
+
return t ? Math.max(t.radius * js, As) : As;
|
|
5526
5579
|
}
|
|
5527
|
-
function
|
|
5528
|
-
if (!e || (
|
|
5529
|
-
let t =
|
|
5580
|
+
function Js(e) {
|
|
5581
|
+
if (!e || (Vs.setFromObject(e), Vs.isEmpty())) return null;
|
|
5582
|
+
let t = Vs.getBoundingSphere(Hs);
|
|
5530
5583
|
return !Number.isFinite(t.radius) || t.radius <= 0 ? null : t;
|
|
5531
5584
|
}
|
|
5532
|
-
function
|
|
5585
|
+
function Ys(e) {
|
|
5533
5586
|
return e.type === "Group" && typeof e.userData.modelID == "number";
|
|
5534
5587
|
}
|
|
5535
|
-
function
|
|
5536
|
-
return e?.children.filter(
|
|
5588
|
+
function Xs(e) {
|
|
5589
|
+
return e?.children.filter(Ys) ?? [];
|
|
5537
5590
|
}
|
|
5538
|
-
function
|
|
5539
|
-
return
|
|
5591
|
+
function Zs(e, t) {
|
|
5592
|
+
return Xs(e).find((e) => e.userData.modelID === t) ?? null;
|
|
5540
5593
|
}
|
|
5541
|
-
function
|
|
5542
|
-
let n =
|
|
5594
|
+
function Qs(e, t) {
|
|
5595
|
+
let n = Js(t);
|
|
5543
5596
|
if (!n) return;
|
|
5544
|
-
let r = Math.max(
|
|
5597
|
+
let r = Math.max(Fs, n.radius * Is, e.near + 1);
|
|
5545
5598
|
Math.abs(e.far - r) < 1 || (e.far = r, e.updateProjectionMatrix());
|
|
5546
5599
|
}
|
|
5547
|
-
function
|
|
5600
|
+
function $s(e, t, n, r, i) {
|
|
5548
5601
|
let a = n.elementIndex.get(i);
|
|
5549
5602
|
a && a.forEach((n) => {
|
|
5550
5603
|
let { record: i, vertexRanges: a } = n;
|
|
@@ -5556,41 +5609,41 @@ function Xs(e, t, n, r, i) {
|
|
|
5556
5609
|
}));
|
|
5557
5610
|
});
|
|
5558
5611
|
}
|
|
5559
|
-
function
|
|
5560
|
-
let n = new g(), r = new
|
|
5612
|
+
function ec(e, t) {
|
|
5613
|
+
let n = new g(), r = new B();
|
|
5561
5614
|
return Object.entries(e).forEach(([e, i]) => {
|
|
5562
5615
|
let a = Number(e);
|
|
5563
5616
|
i.forEach((e) => {
|
|
5564
|
-
|
|
5617
|
+
$s(n, r, t, a, e);
|
|
5565
5618
|
});
|
|
5566
5619
|
}), n.isEmpty() ? null : n;
|
|
5567
5620
|
}
|
|
5568
|
-
function
|
|
5569
|
-
let t = e.getSize(
|
|
5570
|
-
return Number.isFinite(n) && n > 0 ? n *
|
|
5621
|
+
function tc(e) {
|
|
5622
|
+
let t = e.getSize(Ws), n = Math.max(t.x, t.y, t.z);
|
|
5623
|
+
return Number.isFinite(n) && n > 0 ? n * Rs : As;
|
|
5571
5624
|
}
|
|
5572
|
-
function
|
|
5573
|
-
let r = Math.max(
|
|
5574
|
-
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(),
|
|
5625
|
+
function nc(e, t, n) {
|
|
5626
|
+
let r = Math.max(As, (Number.isFinite(n) ? n : As) * Ls), i = t.position.distanceTo(e);
|
|
5627
|
+
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(), Us.copy(t.position).addScaledVector($, r));
|
|
5575
5628
|
}
|
|
5576
|
-
function
|
|
5577
|
-
let y = p((e) => e.camera), b = p((e) => e.gl), x = Nt(s), S = Gt(x), { colorPaletteTexture: C, colorUtils: w } =
|
|
5629
|
+
function rc({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, materialMode: a, modelRef: s, modelsData: u, onReady: d, onCameraDprModeChange: f, publicApi: g, setSceneApi: _, usePerformanceMoving: v }) {
|
|
5630
|
+
let y = p((e) => e.camera), b = p((e) => e.gl), x = Nt(s), S = Gt(x), { colorPaletteTexture: C, colorUtils: w } = Ge(x), T = tr(s), E = Xn(s, n, T), D = gr(s, n, T, E.getSelectableObjects), O = c(() => new La(), []), ee = S.buildIndex, te = x.resetIndex, ne = w.applyStoredColors, k = mi(), A = l(null), j = l(null), M = l(null), N = l(!1), P = U((e) => e.showStats), F = c(() => {
|
|
5578
5631
|
let e = Object.keys(u).sort((e, t) => Number(e) - Number(t));
|
|
5579
5632
|
for (let t of e) {
|
|
5580
5633
|
let e = Ct(u[Number(t)]);
|
|
5581
5634
|
if (e) return e;
|
|
5582
5635
|
}
|
|
5583
5636
|
return null;
|
|
5584
|
-
}, [u]), re = c(() => xt(F ?? void 0), [F]), ie = c(() => Object.entries(u).map(([e, t]) => [Number(e), t]), [u]), ae = i(() => {
|
|
5585
|
-
n.current && (n.current.minDistance =
|
|
5586
|
-
}, [n, s]),
|
|
5637
|
+
}, [u]), re = c(() => xt(F ?? void 0), [F]), ie = c(() => Object.entries(u).map(([e, t]) => [Number(e), t]), [u]), ae = a !== "performance", I = i(() => {
|
|
5638
|
+
n.current && (n.current.minDistance = qs(s.current));
|
|
5639
|
+
}, [n, s]), L = i((e, t = !1) => {
|
|
5587
5640
|
let r = n.current;
|
|
5588
5641
|
if (!r) return !1;
|
|
5589
|
-
let i = t ?
|
|
5642
|
+
let i = t ? nc(e, y, r.minDistance) : e;
|
|
5590
5643
|
return r.cancel(), r.setOrbitPoint(i.x, i.y, i.z), !0;
|
|
5591
5644
|
}, [y, n]), ce = i((e) => {
|
|
5592
|
-
A.current = e.clone(),
|
|
5593
|
-
}, [
|
|
5645
|
+
A.current = e.clone(), L(e, !0);
|
|
5646
|
+
}, [L]), R = i(() => {
|
|
5594
5647
|
A.current = null, k(s, n, r);
|
|
5595
5648
|
}, [
|
|
5596
5649
|
n,
|
|
@@ -5600,11 +5653,11 @@ function ec({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, materi
|
|
|
5600
5653
|
]), le = i((e, t = !1) => {
|
|
5601
5654
|
let r = n.current;
|
|
5602
5655
|
if (!r) return;
|
|
5603
|
-
let i =
|
|
5656
|
+
let i = ec(e, x.buildIndex());
|
|
5604
5657
|
if (!i) return;
|
|
5605
|
-
let a = i.getCenter(new
|
|
5658
|
+
let a = i.getCenter(new B());
|
|
5606
5659
|
if (A.current = a.clone(), r.cancel(), t) {
|
|
5607
|
-
let e =
|
|
5660
|
+
let e = tc(i);
|
|
5608
5661
|
r.fitToBox(i, !0, {
|
|
5609
5662
|
paddingBottom: e,
|
|
5610
5663
|
paddingLeft: e,
|
|
@@ -5612,13 +5665,13 @@ function ec({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, materi
|
|
|
5612
5665
|
paddingTop: e
|
|
5613
5666
|
}).then(() => {
|
|
5614
5667
|
let e = A.current;
|
|
5615
|
-
e &&
|
|
5668
|
+
e && L(e, !0);
|
|
5616
5669
|
});
|
|
5617
5670
|
return;
|
|
5618
5671
|
}
|
|
5619
|
-
|
|
5672
|
+
L(a, !0);
|
|
5620
5673
|
}, [
|
|
5621
|
-
|
|
5674
|
+
L,
|
|
5622
5675
|
n,
|
|
5623
5676
|
x
|
|
5624
5677
|
]), ue = c(() => {
|
|
@@ -5651,7 +5704,7 @@ function ec({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, materi
|
|
|
5651
5704
|
let i = () => {
|
|
5652
5705
|
e(), f("wake"), j.current = window.setTimeout(() => {
|
|
5653
5706
|
j.current = null, f("move"), M.current === null && (M.current = E.getEdgesActive()), M.current && E.setEdgesActive(!1);
|
|
5654
|
-
},
|
|
5707
|
+
}, Ms);
|
|
5655
5708
|
}, a = () => {
|
|
5656
5709
|
e(), t(), f("sleep");
|
|
5657
5710
|
};
|
|
@@ -5666,19 +5719,19 @@ function ec({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, materi
|
|
|
5666
5719
|
]), di(s, n, T, ce, E.getSelectableObjects, E.setCapsPreselection), vr(), o(() => {
|
|
5667
5720
|
let e = b.domElement, t = (e) => {
|
|
5668
5721
|
let t = A.current;
|
|
5669
|
-
t && e.button === 0 && (e.ctrlKey || e.metaKey || e.shiftKey ||
|
|
5722
|
+
t && e.button === 0 && (e.ctrlKey || e.metaKey || e.shiftKey || L(t, !0));
|
|
5670
5723
|
};
|
|
5671
5724
|
return e.addEventListener("pointerdown", t, !0), () => {
|
|
5672
5725
|
e.removeEventListener("pointerdown", t, !0);
|
|
5673
5726
|
};
|
|
5674
|
-
}, [
|
|
5727
|
+
}, [L, b]), o(() => (T.setClippingSource(E), () => {
|
|
5675
5728
|
T.setClippingSource(null);
|
|
5676
5729
|
}), [T, E]), o(() => (t.current = y, () => {
|
|
5677
5730
|
t.current === y && (t.current = null);
|
|
5678
5731
|
}), [y, t]), o(() => {
|
|
5679
5732
|
if (!s.current) return;
|
|
5680
5733
|
let t = requestAnimationFrame(() => {
|
|
5681
|
-
s.current?.updateMatrixWorld(!0), (y instanceof se || y instanceof oe) &&
|
|
5734
|
+
s.current?.updateMatrixWorld(!0), (y instanceof se || y instanceof oe) && Qs(y, s.current), I(), te(), ee(), ne(), E.syncWithModel(), D.syncWithModel(), e && R();
|
|
5682
5735
|
});
|
|
5683
5736
|
return () => cancelAnimationFrame(t);
|
|
5684
5737
|
}, [
|
|
@@ -5689,12 +5742,12 @@ function ec({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, materi
|
|
|
5689
5742
|
E,
|
|
5690
5743
|
n,
|
|
5691
5744
|
D,
|
|
5692
|
-
|
|
5745
|
+
R,
|
|
5693
5746
|
r,
|
|
5694
5747
|
s,
|
|
5695
5748
|
u,
|
|
5696
5749
|
te,
|
|
5697
|
-
|
|
5750
|
+
I
|
|
5698
5751
|
]), o(() => {
|
|
5699
5752
|
let e = () => {
|
|
5700
5753
|
E.getActive() && E.syncWithModel();
|
|
@@ -5703,7 +5756,7 @@ function ec({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, materi
|
|
|
5703
5756
|
};
|
|
5704
5757
|
return _({
|
|
5705
5758
|
camera: {
|
|
5706
|
-
fitCamera:
|
|
5759
|
+
fitCamera: R,
|
|
5707
5760
|
getIntersection: T.getIntersection
|
|
5708
5761
|
},
|
|
5709
5762
|
clipping: {
|
|
@@ -5752,8 +5805,8 @@ function ec({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, materi
|
|
|
5752
5805
|
geometryUtils: {
|
|
5753
5806
|
getAllIds: S.getAllIds,
|
|
5754
5807
|
getIfcSpacesVisibility: S.getIfcSpacesVisibility,
|
|
5755
|
-
getModelGeometry: (e) =>
|
|
5756
|
-
getModelsGeometry: () =>
|
|
5808
|
+
getModelGeometry: (e) => Zs(s.current, e),
|
|
5809
|
+
getModelsGeometry: () => Xs(s.current),
|
|
5757
5810
|
hideByIds: (e) => t(() => S.hideByIds(e)),
|
|
5758
5811
|
hideSelected: () => t(S.hideSelected),
|
|
5759
5812
|
isolateByIds: (e) => t(() => S.isolateByIds(e)),
|
|
@@ -5773,7 +5826,7 @@ function ec({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, materi
|
|
|
5773
5826
|
n,
|
|
5774
5827
|
ue,
|
|
5775
5828
|
D,
|
|
5776
|
-
|
|
5829
|
+
R,
|
|
5777
5830
|
S,
|
|
5778
5831
|
r,
|
|
5779
5832
|
s,
|
|
@@ -5781,12 +5834,11 @@ function ec({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, materi
|
|
|
5781
5834
|
g,
|
|
5782
5835
|
_,
|
|
5783
5836
|
le
|
|
5784
|
-
]), /* @__PURE__ */
|
|
5785
|
-
/* @__PURE__ */
|
|
5786
|
-
intensity:
|
|
5837
|
+
]), /* @__PURE__ */ H(Ce, { children: [
|
|
5838
|
+
ae && /* @__PURE__ */ H(Ce, { children: [/* @__PURE__ */ V("ambientLight", {
|
|
5839
|
+
intensity: zs,
|
|
5787
5840
|
color: "#ffffff"
|
|
5788
|
-
}),
|
|
5789
|
-
/* @__PURE__ */ B("directionalLight", {
|
|
5841
|
+
}), /* @__PURE__ */ V("directionalLight", {
|
|
5790
5842
|
ref: r,
|
|
5791
5843
|
position: [
|
|
5792
5844
|
10,
|
|
@@ -5794,12 +5846,12 @@ function ec({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, materi
|
|
|
5794
5846
|
10
|
|
5795
5847
|
],
|
|
5796
5848
|
color: "#ffffff",
|
|
5797
|
-
intensity:
|
|
5798
|
-
}),
|
|
5799
|
-
P && /* @__PURE__ */
|
|
5800
|
-
/* @__PURE__ */
|
|
5849
|
+
intensity: Bs
|
|
5850
|
+
})] }),
|
|
5851
|
+
P && /* @__PURE__ */ V(h, {}),
|
|
5852
|
+
/* @__PURE__ */ V("group", {
|
|
5801
5853
|
ref: s,
|
|
5802
|
-
children: ie.map(([e, t]) => /* @__PURE__ */
|
|
5854
|
+
children: ie.map(([e, t]) => /* @__PURE__ */ V(Tt, {
|
|
5803
5855
|
colorPaletteTexture: C,
|
|
5804
5856
|
coordinationMatrix: re,
|
|
5805
5857
|
data: t,
|
|
@@ -5807,17 +5859,17 @@ function ec({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, materi
|
|
|
5807
5859
|
modelID: e
|
|
5808
5860
|
}, e))
|
|
5809
5861
|
}),
|
|
5810
|
-
/* @__PURE__ */
|
|
5862
|
+
/* @__PURE__ */ V(m, {
|
|
5811
5863
|
dollyToCursor: !0,
|
|
5812
|
-
draggingSmoothTime: .04,
|
|
5813
5864
|
infinityDolly: !0,
|
|
5814
|
-
minDistance:
|
|
5865
|
+
minDistance: As,
|
|
5815
5866
|
ref: n,
|
|
5816
|
-
|
|
5867
|
+
draggingSmoothTime: .03,
|
|
5868
|
+
smoothTime: .05
|
|
5817
5869
|
})
|
|
5818
5870
|
] });
|
|
5819
5871
|
}
|
|
5820
|
-
function
|
|
5872
|
+
function ic({ autoFitCamera: e = !0, camera: t = {
|
|
5821
5873
|
position: [
|
|
5822
5874
|
10,
|
|
5823
5875
|
10,
|
|
@@ -5825,9 +5877,9 @@ function tc({ autoFitCamera: e = !0, camera: t = {
|
|
|
5825
5877
|
],
|
|
5826
5878
|
fov: 50
|
|
5827
5879
|
}, 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, usePerformanceMoving: _ = !1 }) {
|
|
5828
|
-
let v = l(null), y = l(null), b = l(null), x = l(null), [S, C] = u(), w =
|
|
5880
|
+
let v = l(null), y = l(null), b = l(null), x = l(null), [S, C] = u(), w = Ee(), T = U((e) => e.setModelNames), E = U((e) => e.setModelProps), D = U((e) => e.setModelStructure), O = U((e) => e.setShowNavCube), ee = U((e) => e.setShowStats), te = U((e) => e.setUserDevice), ne = U((e) => e.showNavCube), k = a ?? S, A = f ? Gs(n, 1) : n, j = Gs(A, f ? Ps : Ns), M = s ?? (f ? "performance" : void 0), [N, P] = u("sleep");
|
|
5829
5881
|
return o(() => {
|
|
5830
|
-
te(
|
|
5882
|
+
te(Ks());
|
|
5831
5883
|
}, [te]), o(() => {
|
|
5832
5884
|
ee(!!g);
|
|
5833
5885
|
}, [ee, g]), o(() => {
|
|
@@ -5857,15 +5909,15 @@ function tc({ autoFitCamera: e = !0, camera: t = {
|
|
|
5857
5909
|
a,
|
|
5858
5910
|
i,
|
|
5859
5911
|
r
|
|
5860
|
-
]), k ? /* @__PURE__ */
|
|
5861
|
-
style:
|
|
5862
|
-
children: [/* @__PURE__ */
|
|
5912
|
+
]), k ? /* @__PURE__ */ H("div", {
|
|
5913
|
+
style: Ts,
|
|
5914
|
+
children: [/* @__PURE__ */ V(d, {
|
|
5863
5915
|
camera: t,
|
|
5864
5916
|
dpr: _ && N === "move" ? j : A,
|
|
5865
|
-
gl: f ?
|
|
5866
|
-
children: /* @__PURE__ */
|
|
5917
|
+
gl: f ? ks : void 0,
|
|
5918
|
+
children: /* @__PURE__ */ V(hi, {
|
|
5867
5919
|
store: w,
|
|
5868
|
-
children: /* @__PURE__ */
|
|
5920
|
+
children: /* @__PURE__ */ V(rc, {
|
|
5869
5921
|
autoFitCamera: e,
|
|
5870
5922
|
cameraRef: v,
|
|
5871
5923
|
controlRef: y,
|
|
@@ -5880,14 +5932,14 @@ function tc({ autoFitCamera: e = !0, camera: t = {
|
|
|
5880
5932
|
usePerformanceMoving: _
|
|
5881
5933
|
})
|
|
5882
5934
|
})
|
|
5883
|
-
}), ne && /* @__PURE__ */
|
|
5884
|
-
style:
|
|
5885
|
-
children: /* @__PURE__ */
|
|
5886
|
-
camera:
|
|
5935
|
+
}), ne && /* @__PURE__ */ V("div", {
|
|
5936
|
+
style: ws,
|
|
5937
|
+
children: /* @__PURE__ */ V(d, {
|
|
5938
|
+
camera: Es,
|
|
5887
5939
|
dpr: A,
|
|
5888
|
-
gl: f ?
|
|
5940
|
+
gl: f ? Os : Ds,
|
|
5889
5941
|
orthographic: !0,
|
|
5890
|
-
children: /* @__PURE__ */
|
|
5942
|
+
children: /* @__PURE__ */ V(Ss, {
|
|
5891
5943
|
active: !0,
|
|
5892
5944
|
cameraRef: v,
|
|
5893
5945
|
controlRef: y,
|
|
@@ -5895,10 +5947,10 @@ function tc({ autoFitCamera: e = !0, camera: t = {
|
|
|
5895
5947
|
})
|
|
5896
5948
|
})
|
|
5897
5949
|
})]
|
|
5898
|
-
}) : /* @__PURE__ */
|
|
5950
|
+
}) : /* @__PURE__ */ V(Ce, {});
|
|
5899
5951
|
}
|
|
5900
|
-
var
|
|
5901
|
-
let [n] = u(
|
|
5952
|
+
var ac = n(function(e, t) {
|
|
5953
|
+
let [n] = u(Ae), r = l(!1), a = l(!1), d = c(() => new Cs(), []), { defaultSelected: f, onSelectedChange: p, selected: m } = e, h = i((e) => {
|
|
5902
5954
|
d.set(e);
|
|
5903
5955
|
}, [d]), g = c(() => to(n, d.get), [d, n]);
|
|
5904
5956
|
return s(t, () => g, [g]), o(() => (n.getState().setApi(g), () => {
|
|
@@ -5915,15 +5967,15 @@ var nc = n(function(e, t) {
|
|
|
5915
5967
|
if (p) return n.subscribe((e, t) => {
|
|
5916
5968
|
e.selected !== t.selected && (a.current || p($a(e.selected)));
|
|
5917
5969
|
});
|
|
5918
|
-
}, [p, n]), /* @__PURE__ */
|
|
5970
|
+
}, [p, n]), /* @__PURE__ */ V(hi, {
|
|
5919
5971
|
store: n,
|
|
5920
|
-
children: /* @__PURE__ */
|
|
5972
|
+
children: /* @__PURE__ */ V(ic, {
|
|
5921
5973
|
...e,
|
|
5922
5974
|
publicApi: g,
|
|
5923
5975
|
setSceneApi: h
|
|
5924
5976
|
})
|
|
5925
5977
|
});
|
|
5926
5978
|
});
|
|
5927
|
-
|
|
5979
|
+
ac.displayName = "Viewer";
|
|
5928
5980
|
//#endregion
|
|
5929
|
-
export { ro as BMTLoader, La as BmtConverter, za as ConvertIfcFileToBmt, Ba as ConvertToBmt, cr as DimensionLine, hr as DimensionsUtils, Qa as FilteredElementsCollector, yt as ModelGrids,
|
|
5981
|
+
export { ro as BMTLoader, La as BmtConverter, za as ConvertIfcFileToBmt, Ba as ConvertToBmt, cr as DimensionLine, hr as DimensionsUtils, Qa as FilteredElementsCollector, yt as ModelGrids, Ss as NavigationCube, ac as Viewer, hi as ViewerStoreProvider, Ra as bmtConverter, ko as convertIfcFilesToBmtInWorker, Ao as createBmtConverterWorker, mo as createBmtWorker, Ho as createIfcWorker, Ae as createViewerStore, ra as exportExcel, ea as exportModelPropertiesToExcel, po as loadBmtModelsInWorker, Vo as loadIfcModelsInWorker, Yo as loader, gr as useDimensionsUtils, U as useViewerStore, Ee as useViewerStoreApi };
|