bimatter-viewer-react 1.0.0 → 1.0.1
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/Model.d.ts +3 -2
- package/lib/SelectableMesh.d.ts +7 -2
- package/lib/WebGpuSelectableMesh.d.ts +1 -1
- package/lib/index.js +1132 -1060
- package/lib/sharedMeshMaterials.d.ts +24 -0
- package/lib/utils/ClippingUtils/ClippingUtils.d.ts +6 -0
- package/lib/workers/WorkerErrors.d.ts +6 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import e, { Suspense as t, createContext as n, forwardRef as r, memo as i, useCallback as a, useContext as o, useEffect as s, useImperativeHandle as c, useLayoutEffect as l, useMemo as u, useRef as d, useState as f } from "react";
|
|
2
2
|
import { createRoot as p } from "react-dom/client";
|
|
3
3
|
import { Canvas as m, useFrame as h, useThree as g } from "@react-three/fiber";
|
|
4
|
-
import { Box3 as _, BoxGeometry as v, BufferAttribute as y, BufferGeometry as b, CanvasTexture as x, CatmullRomCurve3 as S, Color as C, ConeGeometry as w, DataTexture as T, DoubleSide as E, DynamicDrawUsage as
|
|
4
|
+
import { Box3 as _, BoxGeometry as v, BufferAttribute as y, BufferGeometry as b, CanvasTexture as x, CatmullRomCurve3 as S, Color as C, ConeGeometry as w, DataTexture as T, DoubleSide as E, DynamicDrawUsage as D, Euler as O, Float32BufferAttribute as k, Group as A, Line as j, Line3 as M, LineBasicMaterial as ee, LineDashedMaterial as N, LineSegments as te, LinearFilter as ne, MathUtils as re, Matrix4 as P, Mesh as F, MeshBasicMaterial as I, MeshLambertMaterial as ie, NearestFilter as ae, Object3D as oe, OrthographicCamera as se, PerspectiveCamera as L, Plane as ce, RGBAFormat as le, Ray as R, Raycaster as z, SRGBColorSpace as B, ShapeUtils as ue, Sphere as de, SphereGeometry as fe, Sprite as pe, SpriteMaterial as me, TubeGeometry as V, Uint32BufferAttribute as he, UnsignedByteType as ge, Vector2 as H, Vector3 as U } from "three";
|
|
5
5
|
import { createStore as _e } from "zustand/vanilla";
|
|
6
6
|
import { Fragment as ve, jsx as W, jsxs as ye } from "react/jsx-runtime";
|
|
7
7
|
import { useStore as be } from "zustand";
|
|
@@ -1179,7 +1179,7 @@ var Cn = "BMT", wn = 1, Tn = {
|
|
|
1179
1179
|
let t = /* @__PURE__ */ new Map();
|
|
1180
1180
|
return (Array.isArray(e) ? e : [e]).forEach((e) => {
|
|
1181
1181
|
e.traverse((e) => {
|
|
1182
|
-
if (!(e instanceof
|
|
1182
|
+
if (!(e instanceof F) || !this.isIfcSpaceObject(e)) return;
|
|
1183
1183
|
let n = this.getObjectModelID(e);
|
|
1184
1184
|
if (n === null) return;
|
|
1185
1185
|
let r = e.geometry.getAttribute("ids");
|
|
@@ -1193,7 +1193,7 @@ var Cn = "BMT", wn = 1, Tn = {
|
|
|
1193
1193
|
addVisibleIdsFromObject3D(e, t) {
|
|
1194
1194
|
(Array.isArray(e) ? e : [e]).forEach((e) => {
|
|
1195
1195
|
e.traverse((e) => {
|
|
1196
|
-
if (!(e instanceof
|
|
1196
|
+
if (!(e instanceof F) || !this.isObjectVisible(e)) return;
|
|
1197
1197
|
let n = this.getObjectModelID(e);
|
|
1198
1198
|
if (n === null) return;
|
|
1199
1199
|
let r = e.geometry.getAttribute("ids");
|
|
@@ -2116,18 +2116,30 @@ function dr(e) {
|
|
|
2116
2116
|
return new Worker("" + new URL("assets/BMTWorker-B5pcLJyM.js", import.meta.url).href, { name: e?.name });
|
|
2117
2117
|
}
|
|
2118
2118
|
//#endregion
|
|
2119
|
+
//#region src/viewer/workers/WorkerErrors.ts
|
|
2120
|
+
function fr(e, t) {
|
|
2121
|
+
if (t.error instanceof Error) return t.error;
|
|
2122
|
+
let n = [
|
|
2123
|
+
t.message || "Unknown worker error (the worker script may have failed to load; check its request in the Network tab)",
|
|
2124
|
+
t.filename ? `file: ${t.filename}` : "",
|
|
2125
|
+
t.lineno ? `line: ${t.lineno}` : "",
|
|
2126
|
+
t.colno ? `column: ${t.colno}` : ""
|
|
2127
|
+
].filter(Boolean);
|
|
2128
|
+
return /* @__PURE__ */ Error(`${e} failed: ${n.join(", ")}`);
|
|
2129
|
+
}
|
|
2130
|
+
//#endregion
|
|
2119
2131
|
//#region src/viewer/workers/BvhWorker.ts?worker
|
|
2120
|
-
function
|
|
2132
|
+
function pr(e) {
|
|
2121
2133
|
return new Worker("" + new URL("assets/BvhWorker-BIP1xLJx.js", import.meta.url).href, { name: e?.name });
|
|
2122
2134
|
}
|
|
2123
2135
|
//#endregion
|
|
2124
2136
|
//#region src/viewer/workers/BvhWorkerPool.ts
|
|
2125
|
-
var
|
|
2126
|
-
function
|
|
2137
|
+
var mr = 3, hr = 1e4, gr = /* @__PURE__ */ new WeakMap(), _r = /* @__PURE__ */ new WeakSet();
|
|
2138
|
+
function vr() {
|
|
2127
2139
|
let e = globalThis.navigator?.hardwareConcurrency ?? 4;
|
|
2128
|
-
return Math.max(1, Math.min(
|
|
2140
|
+
return Math.max(1, Math.min(mr, e - 2));
|
|
2129
2141
|
}
|
|
2130
|
-
var
|
|
2142
|
+
var yr = class {
|
|
2131
2143
|
idleTimeout = null;
|
|
2132
2144
|
nextTaskID = 0;
|
|
2133
2145
|
queue = [];
|
|
@@ -2160,12 +2172,12 @@ var vr = class {
|
|
|
2160
2172
|
this.scheduleIdleTermination();
|
|
2161
2173
|
}
|
|
2162
2174
|
getIdleWorker() {
|
|
2163
|
-
return this.workers.find((e) => !e.task) || (this.workers.length >=
|
|
2175
|
+
return this.workers.find((e) => !e.task) || (this.workers.length >= vr() ? null : this.createWorker());
|
|
2164
2176
|
}
|
|
2165
2177
|
createWorker() {
|
|
2166
2178
|
let e = {
|
|
2167
2179
|
task: null,
|
|
2168
|
-
worker: new
|
|
2180
|
+
worker: new pr()
|
|
2169
2181
|
};
|
|
2170
2182
|
return e.worker.addEventListener("message", (t) => {
|
|
2171
2183
|
let n = e.task;
|
|
@@ -2180,44 +2192,44 @@ var vr = class {
|
|
|
2180
2192
|
scheduleIdleTermination() {
|
|
2181
2193
|
this.queue.length || this.workers.some(({ task: e }) => e) || (this.clearIdleTimeout(), this.idleTimeout = setTimeout(() => {
|
|
2182
2194
|
this.idleTimeout = null, !(this.queue.length || this.workers.some(({ task: e }) => e)) && (this.workers.forEach(({ worker: e }) => e.terminate()), this.workers = []);
|
|
2183
|
-
},
|
|
2195
|
+
}, hr));
|
|
2184
2196
|
}
|
|
2185
|
-
},
|
|
2186
|
-
function
|
|
2197
|
+
}, br = null;
|
|
2198
|
+
function xr(e, t) {
|
|
2187
2199
|
if (typeof Worker > "u") return Promise.resolve(null);
|
|
2188
2200
|
try {
|
|
2189
|
-
return
|
|
2201
|
+
return br ??= new yr(), br.request(e, t);
|
|
2190
2202
|
} catch (e) {
|
|
2191
2203
|
return console.warn("BVH worker pool is unavailable", e), Promise.resolve(null);
|
|
2192
2204
|
}
|
|
2193
2205
|
}
|
|
2194
|
-
function xr(e, t) {
|
|
2195
|
-
return hr.set(e, t), t;
|
|
2196
|
-
}
|
|
2197
2206
|
function Sr(e, t) {
|
|
2198
|
-
return gr.
|
|
2207
|
+
return gr.set(e, t), t;
|
|
2199
2208
|
}
|
|
2200
|
-
function Cr(e) {
|
|
2201
|
-
return
|
|
2209
|
+
function Cr(e, t) {
|
|
2210
|
+
return _r.add(e), Sr(e, t.then((t) => (t && (e.boundsTree ??= t), t)));
|
|
2202
2211
|
}
|
|
2203
2212
|
function wr(e) {
|
|
2204
|
-
return
|
|
2213
|
+
return _r.has(e);
|
|
2214
|
+
}
|
|
2215
|
+
function Tr(e) {
|
|
2216
|
+
return gr.get(e) ?? null;
|
|
2205
2217
|
}
|
|
2206
2218
|
//#endregion
|
|
2207
2219
|
//#region src/viewer/workers/BMTWorkerClient.ts
|
|
2208
|
-
function
|
|
2220
|
+
function Er() {
|
|
2209
2221
|
return globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random()}`;
|
|
2210
2222
|
}
|
|
2211
|
-
function
|
|
2223
|
+
function Dr(e) {
|
|
2212
2224
|
return Array.isArray(e) ? e : [e];
|
|
2213
2225
|
}
|
|
2214
|
-
function
|
|
2226
|
+
function Or(e) {
|
|
2215
2227
|
return e.split(/[?#]/)[0].split(/[\\/]/).pop() || "model.bmt";
|
|
2216
2228
|
}
|
|
2217
|
-
function
|
|
2229
|
+
function kr(e) {
|
|
2218
2230
|
return typeof e == "string" ? {
|
|
2219
2231
|
kind: "url",
|
|
2220
|
-
name:
|
|
2232
|
+
name: Or(e),
|
|
2221
2233
|
url: new URL(e, globalThis.location.href).href
|
|
2222
2234
|
} : e instanceof File ? {
|
|
2223
2235
|
file: e,
|
|
@@ -2228,18 +2240,18 @@ function Or(e) {
|
|
|
2228
2240
|
kind: "buffer"
|
|
2229
2241
|
};
|
|
2230
2242
|
}
|
|
2231
|
-
function
|
|
2243
|
+
function Ar(e) {
|
|
2232
2244
|
return e.map((e) => e.kind === "buffer" ? e.buffer : null).filter((e) => e instanceof ArrayBuffer);
|
|
2233
2245
|
}
|
|
2234
|
-
function
|
|
2246
|
+
function jr() {
|
|
2235
2247
|
return new dr();
|
|
2236
2248
|
}
|
|
2237
|
-
function
|
|
2249
|
+
function Mr(e) {
|
|
2238
2250
|
return { streamGeometryChunks: e.streamGeometryChunks ?? !!e.onChunk };
|
|
2239
2251
|
}
|
|
2240
|
-
function
|
|
2241
|
-
let n = t.worker ??
|
|
2242
|
-
options:
|
|
2252
|
+
function Nr(e, t = {}) {
|
|
2253
|
+
let n = t.worker ?? jr(), r = t.terminateOnComplete ?? !t.worker, i = t.collectChunks ?? !0, a = Dr(e).map(kr), o = Er(), s = {}, c = {
|
|
2254
|
+
options: Mr(t),
|
|
2243
2255
|
sources: a,
|
|
2244
2256
|
taskId: o,
|
|
2245
2257
|
type: "load-bmt-model"
|
|
@@ -2248,7 +2260,7 @@ function Mr(e, t = {}) {
|
|
|
2248
2260
|
let u = () => {
|
|
2249
2261
|
n.removeEventListener("message", f), n.removeEventListener("error", d), r && n.terminate();
|
|
2250
2262
|
}, d = (e) => {
|
|
2251
|
-
u(), l(
|
|
2263
|
+
u(), l(fr("BMT worker", e));
|
|
2252
2264
|
}, f = (n) => {
|
|
2253
2265
|
let r = n.data;
|
|
2254
2266
|
if (r.taskId !== o) return;
|
|
@@ -2258,7 +2270,7 @@ function Mr(e, t = {}) {
|
|
|
2258
2270
|
}
|
|
2259
2271
|
if (r.type === "chunk") {
|
|
2260
2272
|
let { geometry: e, geometryID: n, modelIndex: a } = r.chunk;
|
|
2261
|
-
r.bvhSource &&
|
|
2273
|
+
r.bvhSource && Cr(e, xr(r.bvhSource.pos, r.bvhSource.ind)), i && (s[a] ??= {}, s[a][n] = e), t.onChunk?.(r.chunk);
|
|
2262
2274
|
return;
|
|
2263
2275
|
}
|
|
2264
2276
|
if (u(), r.type === "complete") {
|
|
@@ -2277,39 +2289,39 @@ function Mr(e, t = {}) {
|
|
|
2277
2289
|
let a = Error(r.error.message);
|
|
2278
2290
|
r.error.stack && (a.stack = r.error.stack), l(a);
|
|
2279
2291
|
};
|
|
2280
|
-
n.addEventListener("message", f), n.addEventListener("error", d), n.postMessage(c,
|
|
2292
|
+
n.addEventListener("message", f), n.addEventListener("error", d), n.postMessage(c, Ar(a));
|
|
2281
2293
|
});
|
|
2282
2294
|
}
|
|
2283
|
-
function
|
|
2284
|
-
return
|
|
2295
|
+
function Pr() {
|
|
2296
|
+
return jr();
|
|
2285
2297
|
}
|
|
2286
2298
|
//#endregion
|
|
2287
2299
|
//#region src/viewer/workers/BmtConverterWorker.ts?worker
|
|
2288
|
-
function
|
|
2300
|
+
function Fr(e) {
|
|
2289
2301
|
return new Worker("" + new URL("assets/BmtConverterWorker-D1SGs9qm.js", import.meta.url).href, { name: e?.name });
|
|
2290
2302
|
}
|
|
2291
2303
|
//#endregion
|
|
2292
2304
|
//#region src/viewer/workers/BmtConverterWorkerClient.ts
|
|
2293
|
-
function
|
|
2305
|
+
function Ir() {
|
|
2294
2306
|
return globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random()}`;
|
|
2295
2307
|
}
|
|
2296
|
-
function
|
|
2308
|
+
function Lr(e) {
|
|
2297
2309
|
return Array.isArray(e) ? e : [e];
|
|
2298
2310
|
}
|
|
2299
|
-
function
|
|
2311
|
+
function Rr(e) {
|
|
2300
2312
|
return e.split(/[?#]/)[0].split(/[\\/]/).pop() || "model.ifc";
|
|
2301
2313
|
}
|
|
2302
|
-
function
|
|
2314
|
+
function zr() {
|
|
2303
2315
|
return globalThis.document?.baseURI ?? globalThis.location.href;
|
|
2304
2316
|
}
|
|
2305
|
-
function
|
|
2317
|
+
function Br(e) {
|
|
2306
2318
|
let t = e ?? "ifc-parser.wasm";
|
|
2307
|
-
return /^(https?:|blob:|data:)/i.test(t) ? t : new URL(t,
|
|
2319
|
+
return /^(https?:|blob:|data:)/i.test(t) ? t : new URL(t, zr()).href;
|
|
2308
2320
|
}
|
|
2309
|
-
function
|
|
2321
|
+
function Vr(e) {
|
|
2310
2322
|
return typeof e == "string" ? {
|
|
2311
2323
|
kind: "url",
|
|
2312
|
-
name:
|
|
2324
|
+
name: Rr(e),
|
|
2313
2325
|
url: new URL(e, globalThis.location.href).href
|
|
2314
2326
|
} : e instanceof File ? {
|
|
2315
2327
|
file: e,
|
|
@@ -2320,13 +2332,13 @@ function Br(e) {
|
|
|
2320
2332
|
kind: "buffer"
|
|
2321
2333
|
};
|
|
2322
2334
|
}
|
|
2323
|
-
function
|
|
2335
|
+
function Hr(e) {
|
|
2324
2336
|
return e.map((e) => e.kind === "buffer" ? e.buffer : null).filter((e) => e instanceof ArrayBuffer);
|
|
2325
2337
|
}
|
|
2326
|
-
function
|
|
2327
|
-
return new
|
|
2338
|
+
function Ur() {
|
|
2339
|
+
return new Fr();
|
|
2328
2340
|
}
|
|
2329
|
-
function
|
|
2341
|
+
function Wr(e) {
|
|
2330
2342
|
return {
|
|
2331
2343
|
chunk: e.chunk,
|
|
2332
2344
|
coordinationMatrix: e.coordinationMatrix,
|
|
@@ -2338,38 +2350,28 @@ function Ur(e) {
|
|
|
2338
2350
|
useIfcSpace: e.useIfcSpace,
|
|
2339
2351
|
useMinVersion: e.useMinVersion,
|
|
2340
2352
|
visibleIdsByModel: e.visibleIdsByModel,
|
|
2341
|
-
wasmPath:
|
|
2353
|
+
wasmPath: Br(e.wasmPath)
|
|
2342
2354
|
};
|
|
2343
2355
|
}
|
|
2344
|
-
function
|
|
2356
|
+
function Gr(e) {
|
|
2345
2357
|
let t = new Uint8Array(e.bytes.byteLength);
|
|
2346
2358
|
return t.set(e.bytes), {
|
|
2347
2359
|
...e,
|
|
2348
2360
|
blob: new Blob([t.buffer], { type: e.mimeType })
|
|
2349
2361
|
};
|
|
2350
2362
|
}
|
|
2351
|
-
function
|
|
2363
|
+
function Kr(e) {
|
|
2352
2364
|
return {
|
|
2353
|
-
files: e.result.files.map(
|
|
2365
|
+
files: e.result.files.map(Gr),
|
|
2354
2366
|
models: e.result.models
|
|
2355
2367
|
};
|
|
2356
2368
|
}
|
|
2357
|
-
function Kr(e) {
|
|
2358
|
-
if (e.error instanceof Error) return e.error;
|
|
2359
|
-
let t = [
|
|
2360
|
-
e.message || "Unknown worker error",
|
|
2361
|
-
e.filename ? `file: ${e.filename}` : "",
|
|
2362
|
-
e.lineno ? `line: ${e.lineno}` : "",
|
|
2363
|
-
e.colno ? `column: ${e.colno}` : ""
|
|
2364
|
-
].filter(Boolean);
|
|
2365
|
-
return /* @__PURE__ */ Error(`BMT converter worker failed: ${t.join(", ")}`);
|
|
2366
|
-
}
|
|
2367
2369
|
function qr(e) {
|
|
2368
2370
|
return /* @__PURE__ */ Error(`BMT converter worker response could not be cloned: ${String(e.data ?? "unknown message error")}`);
|
|
2369
2371
|
}
|
|
2370
2372
|
function Jr(e, t = {}) {
|
|
2371
|
-
let n = t.worker ??
|
|
2372
|
-
options:
|
|
2373
|
+
let n = t.worker ?? Ur(), r = t.terminateOnComplete ?? !t.worker, i = Lr(e).map(Vr), a = Ir(), o = {
|
|
2374
|
+
options: Wr(t),
|
|
2373
2375
|
sources: i,
|
|
2374
2376
|
taskId: a,
|
|
2375
2377
|
type: "convert-ifc-to-bmt"
|
|
@@ -2378,7 +2380,7 @@ function Jr(e, t = {}) {
|
|
|
2378
2380
|
let c = () => {
|
|
2379
2381
|
n.removeEventListener("message", d), n.removeEventListener("error", l), n.removeEventListener("messageerror", u), r && n.terminate();
|
|
2380
2382
|
}, l = (e) => {
|
|
2381
|
-
c(), s(
|
|
2383
|
+
c(), s(fr("BMT converter worker", e));
|
|
2382
2384
|
}, u = (e) => {
|
|
2383
2385
|
c(), s(qr(e));
|
|
2384
2386
|
}, d = (n) => {
|
|
@@ -2389,17 +2391,17 @@ function Jr(e, t = {}) {
|
|
|
2389
2391
|
return;
|
|
2390
2392
|
}
|
|
2391
2393
|
if (c(), r.type === "complete") {
|
|
2392
|
-
e(
|
|
2394
|
+
e(Kr(r));
|
|
2393
2395
|
return;
|
|
2394
2396
|
}
|
|
2395
2397
|
let i = Error(r.error.message);
|
|
2396
2398
|
r.error.stack && (i.stack = r.error.stack), s(i);
|
|
2397
2399
|
};
|
|
2398
|
-
n.addEventListener("message", d), n.addEventListener("error", l), n.addEventListener("messageerror", u), n.postMessage(o,
|
|
2400
|
+
n.addEventListener("message", d), n.addEventListener("error", l), n.addEventListener("messageerror", u), n.postMessage(o, Hr(i));
|
|
2399
2401
|
});
|
|
2400
2402
|
}
|
|
2401
2403
|
function Yr() {
|
|
2402
|
-
return
|
|
2404
|
+
return Ur();
|
|
2403
2405
|
}
|
|
2404
2406
|
//#endregion
|
|
2405
2407
|
//#region src/viewer/workers/IFCWorker.ts?worker
|
|
@@ -2468,7 +2470,7 @@ function oi(e, t = {}) {
|
|
|
2468
2470
|
let u = () => {
|
|
2469
2471
|
n.removeEventListener("message", f), n.removeEventListener("error", d), r && n.terminate();
|
|
2470
2472
|
}, d = (e) => {
|
|
2471
|
-
u(), l(
|
|
2473
|
+
u(), l(fr("IFC worker", e));
|
|
2472
2474
|
}, f = (n) => {
|
|
2473
2475
|
let r = n.data;
|
|
2474
2476
|
if (r.taskId !== o) return;
|
|
@@ -2478,7 +2480,7 @@ function oi(e, t = {}) {
|
|
|
2478
2480
|
}
|
|
2479
2481
|
if (r.type === "chunk") {
|
|
2480
2482
|
let { geometry: e, geometryID: n, modelIndex: a } = r.chunk;
|
|
2481
|
-
r.bvhSource &&
|
|
2483
|
+
r.bvhSource && Cr(e, xr(r.bvhSource.pos, r.bvhSource.ind)), i && (s[a] ??= {}, s[a][n] = e), t.onChunk?.(r.chunk);
|
|
2482
2484
|
return;
|
|
2483
2485
|
}
|
|
2484
2486
|
if (u(), r.type === "complete") {
|
|
@@ -2639,7 +2641,7 @@ var vi = new class {
|
|
|
2639
2641
|
}))[0];
|
|
2640
2642
|
}
|
|
2641
2643
|
async loadBmtModelInWorker(e, t, n, r, i) {
|
|
2642
|
-
let a = (await
|
|
2644
|
+
let a = (await Nr(e, {
|
|
2643
2645
|
collectChunks: n.collectWorkerChunks,
|
|
2644
2646
|
onChunk: r,
|
|
2645
2647
|
onProgress: i,
|
|
@@ -2965,7 +2967,7 @@ function Ui(e, t) {
|
|
|
2965
2967
|
let a = r.measureText(e), o = a.actualBoundingBoxAscent || Ai * .8, s = a.actualBoundingBoxDescent || Ai * .2, c = Math.ceil(a.width + 36), l = Math.ceil(o + s + 20);
|
|
2966
2968
|
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);
|
|
2967
2969
|
let u = new x(n);
|
|
2968
|
-
return u.colorSpace = B, u.generateMipmaps = !1, u.magFilter =
|
|
2970
|
+
return u.colorSpace = B, u.generateMipmaps = !1, u.magFilter = ne, u.minFilter = ne, u.anisotropy = Mi, u.needsUpdate = !0, {
|
|
2969
2971
|
aspect: c / l,
|
|
2970
2972
|
texture: u
|
|
2971
2973
|
};
|
|
@@ -3452,8 +3454,8 @@ function ja(e, t, n, r, i = Infinity, a, o) {
|
|
|
3452
3454
|
u = e.x - p, d = e.y - m, f = e.z - h;
|
|
3453
3455
|
let S = (n.x + s * p) * a, C = (n.y + s * m) * a, w = (n.z + s * h) * a;
|
|
3454
3456
|
n.x = (n.x - s * S) * l, n.y = (n.y - s * C) * l, n.z = (n.z - s * w) * l, o.x = u + (p + S) * l, o.y = d + (m + C) * l, o.z = f + (h + w) * l;
|
|
3455
|
-
let T = g - e.x, E = _ - e.y,
|
|
3456
|
-
return T *
|
|
3457
|
+
let T = g - e.x, E = _ - e.y, D = v - e.z, O = o.x - g, k = o.y - _, A = o.z - v;
|
|
3458
|
+
return T * O + E * k + D * A > 0 && (o.x = g, o.y = _, o.z = v, n.x = (o.x - g) / a, n.y = (o.y - _) / a, n.z = (o.z - v) / a), o;
|
|
3457
3459
|
}
|
|
3458
3460
|
function Ma(e, t) {
|
|
3459
3461
|
t.set(0, 0), e.forEach((e) => {
|
|
@@ -4266,7 +4268,7 @@ function po() {
|
|
|
4266
4268
|
return typeof window > "u" ? 1 : Math.min(window.devicePixelRatio || 1, 2);
|
|
4267
4269
|
}
|
|
4268
4270
|
function mo(e, t) {
|
|
4269
|
-
return e instanceof
|
|
4271
|
+
return e instanceof se ? (e.top - e.bottom) / e.zoom : e instanceof L ? 2 * Math.tan(e.fov * Math.PI / 360) * Math.max(t, .001) : Math.max(t, 1);
|
|
4270
4272
|
}
|
|
4271
4273
|
function ho(e) {
|
|
4272
4274
|
let t = po(), n = document.createElement("canvas"), r = n.getContext("2d");
|
|
@@ -4276,7 +4278,7 @@ function ho(e) {
|
|
|
4276
4278
|
let a = r.measureText(e), o = a.actualBoundingBoxAscent || lo * .8, s = a.actualBoundingBoxDescent || lo * .2, c = Math.max(1, Math.ceil(a.width + uo * 2)), l = Math.max(1, Math.ceil(o + s + fo * 2));
|
|
4277
4279
|
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);
|
|
4278
4280
|
let u = new x(n);
|
|
4279
|
-
return u.colorSpace = B, u.generateMipmaps = !1, u.magFilter =
|
|
4281
|
+
return u.colorSpace = B, u.generateMipmaps = !1, u.magFilter = ne, u.minFilter = ne, u.needsUpdate = !0, {
|
|
4280
4282
|
height: l,
|
|
4281
4283
|
texture: u,
|
|
4282
4284
|
width: c
|
|
@@ -4286,7 +4288,7 @@ var go = class e {
|
|
|
4286
4288
|
static scale = 1;
|
|
4287
4289
|
static scaleFactor = .015;
|
|
4288
4290
|
static units = "m";
|
|
4289
|
-
root = new
|
|
4291
|
+
root = new A();
|
|
4290
4292
|
start;
|
|
4291
4293
|
endpointMeshes = [];
|
|
4292
4294
|
boundingMesh = null;
|
|
@@ -4305,14 +4307,14 @@ var go = class e {
|
|
|
4305
4307
|
labelTexture = null;
|
|
4306
4308
|
labelWidth = 1;
|
|
4307
4309
|
constructor({ boundingMaterial: e, endpointGeometry: t, endpointMaterial: n, endpointScale: r, lineMaterial: i, root: a, start: o, end: s }) {
|
|
4308
|
-
this.boundingMaterial = e, this.endpointGeometry = t, this.endpointMaterial = n, this.endpointBaseScale = r.clone(), this.lineMaterial = i, this.ownerRoot = a, this.start = o.clone(), this.end = s.clone(), this.root.renderOrder = 4, this.lineGeometry.setAttribute("position", new
|
|
4310
|
+
this.boundingMaterial = e, this.endpointGeometry = t, this.endpointMaterial = n, this.endpointBaseScale = r.clone(), this.lineMaterial = i, this.ownerRoot = a, this.start = o.clone(), this.end = s.clone(), this.root.renderOrder = 4, this.lineGeometry.setAttribute("position", new k([
|
|
4309
4311
|
this.start.x,
|
|
4310
4312
|
this.start.y,
|
|
4311
4313
|
this.start.z,
|
|
4312
4314
|
this.end.x,
|
|
4313
4315
|
this.end.y,
|
|
4314
4316
|
this.end.z
|
|
4315
|
-
], 3)), this.line = new
|
|
4317
|
+
], 3)), this.line = new j(this.lineGeometry, this.lineMaterial), this.line.renderOrder = 4, this.line.computeLineDistances(), this.root.add(this.line), this.addEndpointMeshes(), this.labelSprite = this.createLabelSprite(), this.root.add(this.labelSprite), this.updateLabel(), this.updatePositions(), this.ownerRoot.add(this.root);
|
|
4316
4318
|
}
|
|
4317
4319
|
get length() {
|
|
4318
4320
|
return this.start.distanceTo(this.end);
|
|
@@ -4354,7 +4356,7 @@ var go = class e {
|
|
|
4354
4356
|
this.addEndpointMesh(this.start, this.end), this.addEndpointMesh(this.end, this.start);
|
|
4355
4357
|
}
|
|
4356
4358
|
addEndpointMesh(e, t) {
|
|
4357
|
-
let n = new
|
|
4359
|
+
let n = new F(this.endpointGeometry, this.endpointMaterial);
|
|
4358
4360
|
n.position.copy(e), n.scale.copy(this.endpointBaseScale), n.lookAt(t), n.renderOrder = 4, this.endpointMeshes.push(n), this.root.add(n);
|
|
4359
4361
|
}
|
|
4360
4362
|
createLabelSprite() {
|
|
@@ -4366,7 +4368,7 @@ var go = class e {
|
|
|
4366
4368
|
return e.renderOrder = 5, e;
|
|
4367
4369
|
}
|
|
4368
4370
|
createBoundingBoxMesh() {
|
|
4369
|
-
let e = new
|
|
4371
|
+
let e = new F(new v(1, 1, Math.max(this.length, .001)), this.boundingMaterial);
|
|
4370
4372
|
return e.renderOrder = 3, e;
|
|
4371
4373
|
}
|
|
4372
4374
|
getTextContent() {
|
|
@@ -4408,7 +4410,7 @@ function xo(e, t) {
|
|
|
4408
4410
|
function So(e) {
|
|
4409
4411
|
let t = [];
|
|
4410
4412
|
return e?.traverse((e) => {
|
|
4411
|
-
e instanceof
|
|
4413
|
+
e instanceof F && e.geometry.attributes.position && t.push(e);
|
|
4412
4414
|
}), t;
|
|
4413
4415
|
}
|
|
4414
4416
|
function Co(e, t, n) {
|
|
@@ -4424,7 +4426,7 @@ var To = class e {
|
|
|
4424
4426
|
axis = null;
|
|
4425
4427
|
shiftAxis = null;
|
|
4426
4428
|
tabAxisOverride = !1;
|
|
4427
|
-
boundingMaterial = new
|
|
4429
|
+
boundingMaterial = new I({
|
|
4428
4430
|
color: 0,
|
|
4429
4431
|
depthTest: !1,
|
|
4430
4432
|
depthWrite: !1,
|
|
@@ -4435,13 +4437,13 @@ var To = class e {
|
|
|
4435
4437
|
currentDimension = null;
|
|
4436
4438
|
dimensions = [];
|
|
4437
4439
|
endpointGeometry = e.createEndpointGeometry();
|
|
4438
|
-
endpointMaterial = new
|
|
4440
|
+
endpointMaterial = new I({
|
|
4439
4441
|
color: _o,
|
|
4440
4442
|
depthTest: !1,
|
|
4441
4443
|
depthWrite: !1
|
|
4442
4444
|
});
|
|
4443
4445
|
endpointScale = new U(1, 1, 1);
|
|
4444
|
-
lineMaterial = new
|
|
4446
|
+
lineMaterial = new N({
|
|
4445
4447
|
color: _o,
|
|
4446
4448
|
dashSize: .2,
|
|
4447
4449
|
depthTest: !1,
|
|
@@ -4455,7 +4457,7 @@ var To = class e {
|
|
|
4455
4457
|
pointerNdc = new H();
|
|
4456
4458
|
projectedPoint = new U();
|
|
4457
4459
|
previewMarkerCameraDirection = new U();
|
|
4458
|
-
previewMarker = new
|
|
4460
|
+
previewMarker = new F(e.createPreviewGeometry(), new I({
|
|
4459
4461
|
color: 0,
|
|
4460
4462
|
depthTest: !1,
|
|
4461
4463
|
depthWrite: !1
|
|
@@ -4464,7 +4466,7 @@ var To = class e {
|
|
|
4464
4466
|
rayDirection = new U();
|
|
4465
4467
|
rayPlane = new ce();
|
|
4466
4468
|
rayPoint = new U();
|
|
4467
|
-
root = new
|
|
4469
|
+
root = new A();
|
|
4468
4470
|
snapDistance = vo;
|
|
4469
4471
|
startPoint = new U();
|
|
4470
4472
|
unit = "m";
|
|
@@ -4635,7 +4637,7 @@ var To = class e {
|
|
|
4635
4637
|
}
|
|
4636
4638
|
getClosestVertex(e) {
|
|
4637
4639
|
let t = this.context.cameraUtils.getActiveClippingPlanes(), n = this.getExtraSnapPoints(e.point, t);
|
|
4638
|
-
if (this.context.preferExtraSnapPoints && n.length || !(e.object instanceof
|
|
4640
|
+
if (this.context.preferExtraSnapPoints && n.length || !(e.object instanceof F) || !e.face) return this.getClosestPoint(n, e.point);
|
|
4639
4641
|
let r = e.object.geometry.attributes.position;
|
|
4640
4642
|
return r && n.push(...[
|
|
4641
4643
|
e.face.a,
|
|
@@ -4884,7 +4886,7 @@ function Xo(e, t) {
|
|
|
4884
4886
|
function Zo(e) {
|
|
4885
4887
|
let t = [];
|
|
4886
4888
|
return e?.traverse((e) => {
|
|
4887
|
-
e instanceof
|
|
4889
|
+
e instanceof F && e.visible && e.geometry.attributes.position && (e.userData.isBimatterNote || t.push(e));
|
|
4888
4890
|
}), t;
|
|
4889
4891
|
}
|
|
4890
4892
|
function Qo(e) {
|
|
@@ -4912,7 +4914,7 @@ function ts(e, t, n, r) {
|
|
|
4912
4914
|
$o(b, p, m, a.clone().negate(), v, _), $o(b, m, h, i, y, _), $o(b, h, g, a, v, _), $o(b, g, p, i.clone().negate(), y, _), b.push(b[0].clone());
|
|
4913
4915
|
let x = new V(new S(b, !0, "catmullrom", .35), Math.max(b.length * 2, 80), Ao, 6, !0);
|
|
4914
4916
|
x.computeBoundingSphere();
|
|
4915
|
-
let C = new
|
|
4917
|
+
let C = new F(x, new I({
|
|
4916
4918
|
color: Yo(r),
|
|
4917
4919
|
depthTest: !1,
|
|
4918
4920
|
depthWrite: !1,
|
|
@@ -5025,7 +5027,7 @@ function is({ note: e, onContentChange: t, onOffsetChange: n }) {
|
|
|
5025
5027
|
fontSize: 12,
|
|
5026
5028
|
lineHeight: 1.35,
|
|
5027
5029
|
resize: "none"
|
|
5028
|
-
},
|
|
5030
|
+
}, D = a(() => {
|
|
5029
5031
|
let e = r.current;
|
|
5030
5032
|
if (!e) return;
|
|
5031
5033
|
let t = e.getBoundingClientRect(), n = Math.max(t.width || e.offsetWidth || 1, 1), i = Math.max(t.height || e.offsetHeight || 1, 1);
|
|
@@ -5041,28 +5043,28 @@ function is({ note: e, onContentChange: t, onOffsetChange: n }) {
|
|
|
5041
5043
|
e.id,
|
|
5042
5044
|
n
|
|
5043
5045
|
]);
|
|
5044
|
-
let
|
|
5046
|
+
let O = a((e) => {
|
|
5045
5047
|
let t = u.current;
|
|
5046
5048
|
t && (e.preventDefault(), c.current(i.current, {
|
|
5047
5049
|
x: t.startOffset.x + e.clientX - t.startX,
|
|
5048
5050
|
y: t.startOffset.y + e.clientY - t.startY
|
|
5049
5051
|
}));
|
|
5050
|
-
}, []),
|
|
5051
|
-
u.current && (u.current = null, document.removeEventListener("pointermove",
|
|
5052
|
-
}, [
|
|
5052
|
+
}, []), k = a(() => {
|
|
5053
|
+
u.current && (u.current = null, document.removeEventListener("pointermove", O), document.removeEventListener("pointerup", k), document.removeEventListener("pointercancel", k));
|
|
5054
|
+
}, [O]), A = a((e) => {
|
|
5053
5055
|
e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement || e.target instanceof HTMLButtonElement || (e.preventDefault(), e.stopPropagation(), e.nativeEvent.stopImmediatePropagation?.(), e.currentTarget.setPointerCapture?.(e.pointerId), u.current = {
|
|
5054
5056
|
startOffset: { ...o.current },
|
|
5055
5057
|
startX: e.clientX,
|
|
5056
5058
|
startY: e.clientY
|
|
5057
|
-
}, document.addEventListener("pointermove",
|
|
5058
|
-
}, [
|
|
5059
|
+
}, document.addEventListener("pointermove", O), document.addEventListener("pointerup", k), document.addEventListener("pointercancel", k));
|
|
5060
|
+
}, [O, k]);
|
|
5059
5061
|
return l(() => {
|
|
5060
5062
|
let e = r.current;
|
|
5061
5063
|
if (!e) return;
|
|
5062
|
-
|
|
5064
|
+
D();
|
|
5063
5065
|
let t = 0, n = requestAnimationFrame(() => {
|
|
5064
|
-
|
|
5065
|
-
}), i = typeof ResizeObserver < "u" ? new ResizeObserver(
|
|
5066
|
+
D(), t = requestAnimationFrame(D);
|
|
5067
|
+
}), i = typeof ResizeObserver < "u" ? new ResizeObserver(D) : null;
|
|
5066
5068
|
return i?.observe(e), () => {
|
|
5067
5069
|
cancelAnimationFrame(n), t && cancelAnimationFrame(t), i?.disconnect();
|
|
5068
5070
|
};
|
|
@@ -5070,10 +5072,10 @@ function is({ note: e, onContentChange: t, onOffsetChange: n }) {
|
|
|
5070
5072
|
e.settings?.render,
|
|
5071
5073
|
e.text,
|
|
5072
5074
|
e.title,
|
|
5073
|
-
|
|
5075
|
+
D
|
|
5074
5076
|
]), s(() => () => {
|
|
5075
|
-
document.removeEventListener("pointermove",
|
|
5076
|
-
}, [
|
|
5077
|
+
document.removeEventListener("pointermove", O), document.removeEventListener("pointerup", k), document.removeEventListener("pointercancel", k);
|
|
5078
|
+
}, [O, k]), /* @__PURE__ */ W(De, {
|
|
5077
5079
|
center: !1,
|
|
5078
5080
|
position: e.point.toArray(),
|
|
5079
5081
|
transform: !1,
|
|
@@ -5090,10 +5092,10 @@ function is({ note: e, onContentChange: t, onOffsetChange: n }) {
|
|
|
5090
5092
|
/* @__PURE__ */ ye("div", {
|
|
5091
5093
|
ref: r,
|
|
5092
5094
|
style: x,
|
|
5093
|
-
onPointerDownCapture:
|
|
5095
|
+
onPointerDownCapture: A,
|
|
5094
5096
|
children: [/* @__PURE__ */ W("div", {
|
|
5095
5097
|
style: S,
|
|
5096
|
-
onPointerDownCapture:
|
|
5098
|
+
onPointerDownCapture: A,
|
|
5097
5099
|
children: /* @__PURE__ */ W("div", { style: C })
|
|
5098
5100
|
}), e.settings?.render ? /* @__PURE__ */ W(ns, { content: e.settings.render }) : /* @__PURE__ */ ye(ve, { children: [/* @__PURE__ */ W("input", {
|
|
5099
5101
|
style: T,
|
|
@@ -5125,7 +5127,7 @@ var as = class {
|
|
|
5125
5127
|
screenRayDirection = new U();
|
|
5126
5128
|
screenPlanePoint = new U();
|
|
5127
5129
|
raycaster = new z();
|
|
5128
|
-
root = new
|
|
5130
|
+
root = new A();
|
|
5129
5131
|
updateHtmlNotes;
|
|
5130
5132
|
constructor(e, t) {
|
|
5131
5133
|
this.context = e, this.updateHtmlNotes = t, this.root.name = "BimatterNotes", this.context.scene.add(this.root);
|
|
@@ -5276,7 +5278,7 @@ var as = class {
|
|
|
5276
5278
|
if (!t) return null;
|
|
5277
5279
|
let n = this.context.camera;
|
|
5278
5280
|
if (n.updateMatrixWorld(), n instanceof L) this.screenRay.origin.setFromMatrixPosition(n.matrixWorld), this.screenRayDirection.set(t.x, t.y, .5).unproject(n).sub(this.screenRay.origin).normalize();
|
|
5279
|
-
else if (n instanceof
|
|
5281
|
+
else if (n instanceof se) this.screenRay.origin.set(t.x, t.y, 0).unproject(n), n.getWorldDirection(this.screenRayDirection).normalize();
|
|
5280
5282
|
else return null;
|
|
5281
5283
|
return this.screenRay.direction.copy(this.screenRayDirection), this.screenRay.intersectPlane(this.cloudPlane, this.screenPlanePoint);
|
|
5282
5284
|
}
|
|
@@ -5392,7 +5394,7 @@ function os(e, t) {
|
|
|
5392
5394
|
}
|
|
5393
5395
|
//#endregion
|
|
5394
5396
|
//#region src/viewer/utils/ClippingUtils/ClippingCaps.ts
|
|
5395
|
-
|
|
5397
|
+
F.prototype.raycast = We;
|
|
5396
5398
|
var ss = 1e-5, cs = 1e-6, ls = 2e-5, us = 50, ds = 1e-6, fs = 2;
|
|
5397
5399
|
function ps(e) {
|
|
5398
5400
|
return !(!e.parent || !e.visible || !e.geometry.index?.count);
|
|
@@ -5453,12 +5455,12 @@ var ws = class {
|
|
|
5453
5455
|
capMaterial;
|
|
5454
5456
|
capMesh;
|
|
5455
5457
|
context;
|
|
5456
|
-
root = new
|
|
5458
|
+
root = new A();
|
|
5457
5459
|
box = new _();
|
|
5458
5460
|
meshBox = new _();
|
|
5459
|
-
inverseMatrix = new
|
|
5461
|
+
inverseMatrix = new P();
|
|
5460
5462
|
localPlane = new ce();
|
|
5461
|
-
tempLine = new
|
|
5463
|
+
tempLine = new M();
|
|
5462
5464
|
tempVector = new U();
|
|
5463
5465
|
tempVector1 = new U();
|
|
5464
5466
|
worldPoint = new U();
|
|
@@ -5473,7 +5475,7 @@ var ws = class {
|
|
|
5473
5475
|
colorIndex: [0],
|
|
5474
5476
|
ids: [0],
|
|
5475
5477
|
modelID: [0]
|
|
5476
|
-
}, this.updateBaseMaterialColor(), e.getUseWebGPU() ? this.setupWebGpuCapMaterial() : this.setupCapMaterialShader(), this.capMesh = new
|
|
5478
|
+
}, this.updateBaseMaterialColor(), e.getUseWebGPU() ? this.setupWebGpuCapMaterial() : this.setupCapMaterialShader(), this.capMesh = new F(new b(), this.capMaterial), this.capMesh.frustumCulled = !1, this.capMesh.renderOrder = fs, this.root.add(this.capMesh), this.root.visible = this.active, this.root.name = "clipping-caps", this.root.renderOrder = fs, this.context.getScene().add(this.root), this.context.caps.push(this), this.update();
|
|
5477
5479
|
}
|
|
5478
5480
|
createCapMaterial() {
|
|
5479
5481
|
return this.context.getUseWebGPU() ? new Me({
|
|
@@ -5482,7 +5484,7 @@ var ws = class {
|
|
|
5482
5484
|
opacity: 1,
|
|
5483
5485
|
side: E,
|
|
5484
5486
|
transparent: !1
|
|
5485
|
-
}) : new
|
|
5487
|
+
}) : new I({
|
|
5486
5488
|
color: this.context.getCapsColor(),
|
|
5487
5489
|
depthWrite: !0,
|
|
5488
5490
|
opacity: 1,
|
|
@@ -5589,7 +5591,7 @@ var ws = class {
|
|
|
5589
5591
|
let n = t.getSize(new U()).length();
|
|
5590
5592
|
this.tolerance = Math.max(ss, n * cs), this.closeGapTolerance = Math.max(this.tolerance * us, n * ls);
|
|
5591
5593
|
let r = gs(this.plane), i = this.context.getEdgeSegmentsForPlane(this.plane), a = i ? this.getCapSegmentsFromEdgeSegments(i, r) : this.getCapSegments(r), o = this.getClosedContours(a), { elementIDs: s, modelIDs: c, positions: l } = this.triangulateContours(o, r);
|
|
5592
|
-
if (e.setAttribute("position", new
|
|
5594
|
+
if (e.setAttribute("position", new k(l, 3)), e.setAttribute("ids", new he(s, 1)), e.setAttribute("modelID", new he(c, 1)), e.setAttribute("colorIndex", xs(s.length, this.context.getUseWebGPU())), s.length) {
|
|
5593
5595
|
let t = new Uint32Array(s.length);
|
|
5594
5596
|
for (let e = 0; e < t.length; e++) t[e] = e;
|
|
5595
5597
|
e.setIndex(new he(t, 1));
|
|
@@ -5777,7 +5779,7 @@ var ws = class {
|
|
|
5777
5779
|
}, Ts = 1024, Es = 1, Ds = "__bimatterCameraMotionHidden";
|
|
5778
5780
|
function Os(e) {
|
|
5779
5781
|
let t = new y(new Float32Array(e * 3), 3, !1);
|
|
5780
|
-
return t.setUsage(
|
|
5782
|
+
return t.setUsage(D), t;
|
|
5781
5783
|
}
|
|
5782
5784
|
function ks(e) {
|
|
5783
5785
|
return Math.max(1, Math.ceil((e.geometry.index?.count ?? 0) / 3));
|
|
@@ -5785,7 +5787,7 @@ function ks(e) {
|
|
|
5785
5787
|
function As(e, t) {
|
|
5786
5788
|
let n = new b(), r = Math.ceil(Math.min(Math.max(Ts, ks(t) * .05), 32768));
|
|
5787
5789
|
n.setAttribute("position", Os(r)), n.setDrawRange(0, 0);
|
|
5788
|
-
let i = new
|
|
5790
|
+
let i = new te(n, e);
|
|
5789
5791
|
return i.frustumCulled = !1, i.renderOrder = Es, i.visible = !1, i;
|
|
5790
5792
|
}
|
|
5791
5793
|
function js(e, t) {
|
|
@@ -5803,9 +5805,9 @@ var Ns = class {
|
|
|
5803
5805
|
plane;
|
|
5804
5806
|
context;
|
|
5805
5807
|
lines = /* @__PURE__ */ new Map();
|
|
5806
|
-
inverseMatrix = new
|
|
5808
|
+
inverseMatrix = new P();
|
|
5807
5809
|
localPlane = new ce();
|
|
5808
|
-
tempLine = new
|
|
5810
|
+
tempLine = new M();
|
|
5809
5811
|
tempVector = new U();
|
|
5810
5812
|
tempVector1 = new U();
|
|
5811
5813
|
tempVector2 = new U();
|
|
@@ -5816,7 +5818,7 @@ var Ns = class {
|
|
|
5816
5818
|
this.context = e, this.plane = t, this.active = e.getActive() && e.getEdgesActive(), e.edges.forEach((e) => {
|
|
5817
5819
|
let n = e.material.clippingPlanes ?? [];
|
|
5818
5820
|
e.plane === t || n.includes(t) || (e.material.clippingPlanes = [...n, t], e.material.needsUpdate = !0);
|
|
5819
|
-
}), this.material = new
|
|
5821
|
+
}), this.material = new ee({
|
|
5820
5822
|
clippingPlanes: [],
|
|
5821
5823
|
color: "black",
|
|
5822
5824
|
depthTest: !0,
|
|
@@ -5915,7 +5917,7 @@ var Ns = class {
|
|
|
5915
5917
|
}
|
|
5916
5918
|
}, Ps = "__bimatterCameraMotionHidden", Fs = .001, Is = .001, Ls = 1.18, Rs = 4, zs = "__bimatterPlanSourceObject";
|
|
5917
5919
|
function Bs(e) {
|
|
5918
|
-
return e instanceof L || e instanceof
|
|
5920
|
+
return e instanceof L || e instanceof se;
|
|
5919
5921
|
}
|
|
5920
5922
|
function Vs(e) {
|
|
5921
5923
|
return e.width / Math.max(e.height, 1);
|
|
@@ -5956,7 +5958,7 @@ function Ks({ camera: e, controls: t, invalidate: n, model: r, plane: i, size: a
|
|
|
5956
5958
|
let c = i.clone().normalize(), l = (o && o.lengthSq() > 0 ? o.clone().normalize() : c.normal.clone()).negate();
|
|
5957
5959
|
l.lengthSq() === 0 && l.set(0, 0, -1), l.normalize();
|
|
5958
5960
|
let u = s.getCenter(new U()), d = c.projectPoint(u, new U()), f = s.getBoundingSphere(new de()), p = Math.max(f.radius * Rs, Fs), m = d.clone().addScaledVector(l, -p), h = Ws(l);
|
|
5959
|
-
if (e.up.copy(h), e.position.copy(m), e.lookAt(d), e instanceof
|
|
5961
|
+
if (e.up.copy(h), e.position.copy(m), e.lookAt(d), e instanceof se && (e.zoom = 1, Hs(e, Vs(a), Gs(s, l, h, Vs(a)) * Ls)), e.updateProjectionMatrix(), e.updateMatrixWorld(!0), t && t.camera.uuid === e.uuid) {
|
|
5960
5962
|
let n = t;
|
|
5961
5963
|
t.cancel(), t.updateCameraUp(), t.setFocalOffset(0, 0, 0, !1), t.setLookAt(m.x, m.y, m.z, d.x, d.y, d.z, !1), t.infinityDolly = e instanceof L, t.stop(), t.update(0), n.saveState?.();
|
|
5962
5964
|
}
|
|
@@ -6022,7 +6024,7 @@ function $s(e, t, n) {
|
|
|
6022
6024
|
}
|
|
6023
6025
|
function ec(e, { ignoreCameraMotionVisibility: t = !1, rootInWorldSpace: n = !1, skipLineSegments: r = !1 } = {}) {
|
|
6024
6026
|
let i = (a) => {
|
|
6025
|
-
if (r && a instanceof
|
|
6027
|
+
if (r && a instanceof te) return null;
|
|
6026
6028
|
let o = a.clone(!1), s = o, c = a;
|
|
6027
6029
|
o.name = a.name, n && a === e ? (a.updateWorldMatrix(!0, !1), o.matrix.copy(a.matrixWorld), o.matrix.decompose(o.position, o.quaternion, o.scale), o.matrixAutoUpdate = !1) : (o.matrix.copy(a.matrix), o.matrixAutoUpdate = a.matrixAutoUpdate, o.position.copy(a.position), o.quaternion.copy(a.quaternion), o.scale.copy(a.scale));
|
|
6028
6030
|
try {
|
|
@@ -6044,7 +6046,7 @@ function ec(e, { ignoreCameraMotionVisibility: t = !1, rootInWorldSpace: n = !1,
|
|
|
6044
6046
|
t && o.add(t);
|
|
6045
6047
|
}), o;
|
|
6046
6048
|
};
|
|
6047
|
-
return { root: i(e) ?? new
|
|
6049
|
+
return { root: i(e) ?? new oe() };
|
|
6048
6050
|
}
|
|
6049
6051
|
var tc = new H();
|
|
6050
6052
|
function nc(e, t) {
|
|
@@ -6073,7 +6075,7 @@ function ac(e, t, n, r, i, a) {
|
|
|
6073
6075
|
}
|
|
6074
6076
|
function oc(e, t) {
|
|
6075
6077
|
let n = e.object;
|
|
6076
|
-
if (!(n instanceof
|
|
6078
|
+
if (!(n instanceof F) || e.faceIndex === void 0 || e.faceIndex === null) return null;
|
|
6077
6079
|
let r = (Array.isArray(n.material) ? n.material : [n.material]).find((e) => e.clippingPlanes?.length)?.clippingPlanes ?? t;
|
|
6078
6080
|
if (r.length && !oo(e.point, r)) return null;
|
|
6079
6081
|
let i = n.geometry, a = i.index, o = i.attributes.ids;
|
|
@@ -6089,7 +6091,7 @@ function oc(e, t) {
|
|
|
6089
6091
|
function sc(e, t, n) {
|
|
6090
6092
|
e.forEach((e) => {
|
|
6091
6093
|
e.traverse((e) => {
|
|
6092
|
-
if (!(e instanceof
|
|
6094
|
+
if (!(e instanceof F)) return;
|
|
6093
6095
|
t >= 0 && Qs(e.material, -1, -1);
|
|
6094
6096
|
let r = e.geometry.attributes.modelID ? t : Zs(e);
|
|
6095
6097
|
t >= 0 && r !== t || Qs(e.material, t, n);
|
|
@@ -6099,14 +6101,14 @@ function sc(e, t, n) {
|
|
|
6099
6101
|
function cc(e) {
|
|
6100
6102
|
let t = [];
|
|
6101
6103
|
return e.traverse((e) => {
|
|
6102
|
-
e instanceof
|
|
6104
|
+
e instanceof F && (!e.geometry.index || !e.geometry.attributes.ids || t.push(e));
|
|
6103
6105
|
}), t;
|
|
6104
6106
|
}
|
|
6105
6107
|
function lc(e) {
|
|
6106
6108
|
let t = [];
|
|
6107
6109
|
return e.forEach((e) => {
|
|
6108
6110
|
e.traverse((e) => {
|
|
6109
|
-
e instanceof
|
|
6111
|
+
e instanceof F && e.geometry.attributes.position && t.push(e);
|
|
6110
6112
|
});
|
|
6111
6113
|
}), t;
|
|
6112
6114
|
}
|
|
@@ -6115,7 +6117,7 @@ function dc(e, t, n) {
|
|
|
6115
6117
|
let r = n * n, i = [];
|
|
6116
6118
|
return e.forEach((e) => {
|
|
6117
6119
|
e.updateMatrixWorld(!0), e.traverse((e) => {
|
|
6118
|
-
if (!(e instanceof
|
|
6120
|
+
if (!(e instanceof F) || !e.visible) return;
|
|
6119
6121
|
let n = e.geometry.attributes.position;
|
|
6120
6122
|
if (n) for (let a = 0; a < n.count; a++) uc.fromBufferAttribute(n, a).applyMatrix4(e.matrixWorld), !(uc.distanceToSquared(t) > r) && i.push(uc.clone());
|
|
6121
6123
|
});
|
|
@@ -6132,7 +6134,7 @@ function pc(e, t) {
|
|
|
6132
6134
|
let n = /* @__PURE__ */ new Set();
|
|
6133
6135
|
return e.forEach((e) => {
|
|
6134
6136
|
e.traverse((e) => {
|
|
6135
|
-
e instanceof
|
|
6137
|
+
e instanceof F && fc(e.material, n, t);
|
|
6136
6138
|
});
|
|
6137
6139
|
}), Array.from(n);
|
|
6138
6140
|
}
|
|
@@ -6166,65 +6168,65 @@ function gc({ clippingPlanes: e, modelRoot: t, plane: n, scene: r, useWebGPU: i,
|
|
|
6166
6168
|
};
|
|
6167
6169
|
}
|
|
6168
6170
|
function _c({ getExtraObjects: e, onPreselectionChange: t, plane: n, registerInvalidate: r, registerNotesApi: i, sourceModel: o, useLocalClippingVisuals: c = !1, useWebGPU: l, viewNormal: p }) {
|
|
6169
|
-
let m = g((e) => e.camera), _ = g((e) => e.gl), v = g((e) => e.invalidate), y = g((e) => e.raycaster), b = g((e) => e.scene), x = g((e) => e.size), S = d(null), C = nt(), w = G((e) => e.selected), T = G((e) => e.dimensionsActive), E = G((e) => e.preselectionColor),
|
|
6171
|
+
let m = g((e) => e.camera), _ = g((e) => e.gl), v = g((e) => e.invalidate), y = g((e) => e.raycaster), b = g((e) => e.scene), x = g((e) => e.size), S = d(null), C = nt(), w = G((e) => e.selected), T = G((e) => e.dimensionsActive), E = G((e) => e.preselectionColor), D = G((e) => e.selectionColor), O = u(() => ec(o, {
|
|
6170
6172
|
ignoreCameraMotionVisibility: !0,
|
|
6171
6173
|
skipLineSegments: !0
|
|
6172
|
-
}), [o]),
|
|
6174
|
+
}), [o]), k = d(O.root), A = co(k), [j, M] = f([]), ee = d([]), N = d(null), [te, ne] = f(() => e()), re = d(""), P = u(() => te.map((e) => ec(e, {
|
|
6173
6175
|
ignoreCameraMotionVisibility: !0,
|
|
6174
6176
|
rootInWorldSpace: !0
|
|
6175
|
-
}).root), [
|
|
6176
|
-
|
|
6177
|
-
...
|
|
6178
|
-
...
|
|
6177
|
+
}).root), [te]), F = d(P), I = u(() => [
|
|
6178
|
+
O.root,
|
|
6179
|
+
...P,
|
|
6180
|
+
...j
|
|
6179
6181
|
], [
|
|
6180
|
-
|
|
6181
|
-
|
|
6182
|
-
|
|
6183
|
-
]),
|
|
6184
|
-
|
|
6185
|
-
...
|
|
6186
|
-
...
|
|
6182
|
+
j,
|
|
6183
|
+
P,
|
|
6184
|
+
O.root
|
|
6185
|
+
]), ie = u(() => [
|
|
6186
|
+
O.root,
|
|
6187
|
+
...P,
|
|
6188
|
+
...j
|
|
6187
6189
|
], [
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
]),
|
|
6192
|
-
let r = n.projectPoint(e,
|
|
6190
|
+
j,
|
|
6191
|
+
P,
|
|
6192
|
+
O.root
|
|
6193
|
+
]), ae = a(() => lc([...P, ...j]), [j, P]), oe = a(() => lc([...P, ...j]), [j, P]), se = d(new U()), L = a((e, t) => {
|
|
6194
|
+
let r = n.projectPoint(e, se.current), i = ee.current.flatMap((e) => (e.getObject().updateMatrixWorld(!0), e.getSnapPoints(r, t))), a = dc([...P, ...j], r, t);
|
|
6193
6195
|
return [...i, ...a];
|
|
6194
6196
|
}, [
|
|
6195
|
-
|
|
6197
|
+
j,
|
|
6196
6198
|
n,
|
|
6197
|
-
|
|
6198
|
-
]), ce = a((e, t) => n.projectPoint(e, t), [n]), le = Eo(
|
|
6199
|
+
P
|
|
6200
|
+
]), ce = a((e, t) => n.projectPoint(e, t), [n]), le = Eo(k, S, A, ae, L, {
|
|
6199
6201
|
disableSelectionInteraction: !1,
|
|
6200
|
-
getPrioritySnapObjects:
|
|
6202
|
+
getPrioritySnapObjects: oe,
|
|
6201
6203
|
onChange: v,
|
|
6202
6204
|
preferExtraSnapPoints: !0,
|
|
6203
6205
|
previewMarkerOffset: u(() => n.normal.clone().multiplyScalar(.12), [n]),
|
|
6204
6206
|
previewMarkerScaleFactor: 2.2,
|
|
6205
6207
|
projectPoint: ce
|
|
6206
|
-
}), R = os(
|
|
6208
|
+
}), R = os(k, {
|
|
6207
6209
|
is2DView: !0,
|
|
6208
6210
|
onChange: v
|
|
6209
6211
|
}), z = d(!1), B = d(!1);
|
|
6210
|
-
s(() => (
|
|
6211
|
-
|
|
6212
|
-
}), [
|
|
6212
|
+
s(() => (k.current = O.root, () => {
|
|
6213
|
+
k.current === O.root && (k.current = null);
|
|
6214
|
+
}), [O.root]), s(() => (A.setClippingSource({
|
|
6213
6215
|
getActive: () => !0,
|
|
6214
6216
|
getPlanes: () => [n]
|
|
6215
|
-
}), () =>
|
|
6217
|
+
}), () => A.setClippingSource(null)), [A, n]), s(() => {
|
|
6216
6218
|
le.setActive(T), v();
|
|
6217
6219
|
}, [
|
|
6218
6220
|
T,
|
|
6219
6221
|
le,
|
|
6220
6222
|
v
|
|
6221
6223
|
]), s(() => {
|
|
6222
|
-
T && (sc(
|
|
6224
|
+
T && (sc(I, -1, -1), t?.(null), v());
|
|
6223
6225
|
}, [
|
|
6224
6226
|
T,
|
|
6225
6227
|
v,
|
|
6226
6228
|
t,
|
|
6227
|
-
|
|
6229
|
+
I
|
|
6228
6230
|
]), s(() => r?.(v), [v, r]), s(() => i?.(R), [R, i]), s(() => {
|
|
6229
6231
|
let e = _.domElement.parentElement;
|
|
6230
6232
|
if (!e) return;
|
|
@@ -6245,49 +6247,49 @@ function _c({ getExtraObjects: e, onPreselectionChange: t, plane: n, registerInv
|
|
|
6245
6247
|
v,
|
|
6246
6248
|
R
|
|
6247
6249
|
]), s(() => {
|
|
6248
|
-
|
|
6249
|
-
}, [
|
|
6250
|
+
F.current = P;
|
|
6251
|
+
}, [P]), s(() => {
|
|
6250
6252
|
if (!c) return;
|
|
6251
6253
|
let e = gc({
|
|
6252
|
-
clippingPlanes: pc([
|
|
6253
|
-
modelRoot:
|
|
6254
|
+
clippingPlanes: pc([O.root, ...F.current], n),
|
|
6255
|
+
modelRoot: O.root,
|
|
6254
6256
|
plane: n,
|
|
6255
6257
|
scene: b,
|
|
6256
6258
|
useWebGPU: l,
|
|
6257
6259
|
viewerStore: C
|
|
6258
6260
|
});
|
|
6259
|
-
|
|
6261
|
+
N.current = e;
|
|
6260
6262
|
let t = new Ns(e, n);
|
|
6261
6263
|
t.create(), t.update();
|
|
6262
6264
|
let r = new ws(e, n);
|
|
6263
|
-
return r.setPreselection(null),
|
|
6264
|
-
|
|
6265
|
+
return r.setPreselection(null), ee.current = [r], M(e.caps.map((e) => e.getObject()).filter((e) => e.visible)), v(), () => {
|
|
6266
|
+
ee.current = [], N.current === e && (N.current = null), M([]), r.dispose(), t.dispose(), v();
|
|
6265
6267
|
};
|
|
6266
6268
|
}, [
|
|
6267
6269
|
v,
|
|
6268
6270
|
n,
|
|
6269
6271
|
b,
|
|
6270
|
-
|
|
6272
|
+
O.root,
|
|
6271
6273
|
c,
|
|
6272
6274
|
l,
|
|
6273
6275
|
C
|
|
6274
6276
|
]), s(() => {
|
|
6275
6277
|
if (!c) return;
|
|
6276
|
-
let e =
|
|
6277
|
-
e && hc(e, n, pc([
|
|
6278
|
+
let e = N.current;
|
|
6279
|
+
e && hc(e, n, pc([O.root, ...P], n)) && v();
|
|
6278
6280
|
}, [
|
|
6279
6281
|
v,
|
|
6280
6282
|
n,
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
+
P,
|
|
6284
|
+
O.root,
|
|
6283
6285
|
c
|
|
6284
6286
|
]), s(() => {
|
|
6285
|
-
|
|
6287
|
+
ee.current.forEach((e) => e.updateVisualState()), v();
|
|
6286
6288
|
}, [
|
|
6287
6289
|
v,
|
|
6288
6290
|
E,
|
|
6289
6291
|
w,
|
|
6290
|
-
|
|
6292
|
+
D
|
|
6291
6293
|
]);
|
|
6292
6294
|
let ue = a((e) => {
|
|
6293
6295
|
let t = rc(e);
|
|
@@ -6305,7 +6307,7 @@ function _c({ getExtraObjects: e, onPreselectionChange: t, plane: n, registerInv
|
|
|
6305
6307
|
}
|
|
6306
6308
|
if (T) return;
|
|
6307
6309
|
e.stopPropagation?.();
|
|
6308
|
-
let t = ac(e,
|
|
6310
|
+
let t = ac(e, ie, m, _.domElement, [n], y);
|
|
6309
6311
|
if (!t) {
|
|
6310
6312
|
C.getState().setSelection({});
|
|
6311
6313
|
return;
|
|
@@ -6317,24 +6319,24 @@ function _c({ getExtraObjects: e, onPreselectionChange: t, plane: n, registerInv
|
|
|
6317
6319
|
_,
|
|
6318
6320
|
n,
|
|
6319
6321
|
y,
|
|
6320
|
-
|
|
6322
|
+
ie,
|
|
6321
6323
|
C
|
|
6322
6324
|
]), me = a(() => {
|
|
6323
|
-
T || (sc(
|
|
6325
|
+
T || (sc(I, -1, -1), t?.(null), v());
|
|
6324
6326
|
}, [
|
|
6325
6327
|
T,
|
|
6326
6328
|
v,
|
|
6327
6329
|
t,
|
|
6328
|
-
|
|
6330
|
+
I
|
|
6329
6331
|
]), V = a((e) => {
|
|
6330
6332
|
if (de(e) || T) return;
|
|
6331
6333
|
e.stopPropagation?.();
|
|
6332
|
-
let r = ac(e,
|
|
6334
|
+
let r = ac(e, ie, m, _.domElement, [n], y);
|
|
6333
6335
|
if (!r) {
|
|
6334
|
-
sc(
|
|
6336
|
+
sc(I, -1, -1), t?.(null), v();
|
|
6335
6337
|
return;
|
|
6336
6338
|
}
|
|
6337
|
-
sc(
|
|
6339
|
+
sc(I, r.modelID, r.elementID), t?.({
|
|
6338
6340
|
elementID: r.elementID,
|
|
6339
6341
|
modelID: r.modelID
|
|
6340
6342
|
}), v();
|
|
@@ -6346,16 +6348,16 @@ function _c({ getExtraObjects: e, onPreselectionChange: t, plane: n, registerInv
|
|
|
6346
6348
|
v,
|
|
6347
6349
|
t,
|
|
6348
6350
|
n,
|
|
6349
|
-
|
|
6351
|
+
I,
|
|
6350
6352
|
y,
|
|
6351
|
-
|
|
6353
|
+
ie
|
|
6352
6354
|
]);
|
|
6353
6355
|
return h(() => {
|
|
6354
6356
|
let t = e(), n = ic(t);
|
|
6355
|
-
|
|
6357
|
+
re.current !== n && (re.current = n, ne(t));
|
|
6356
6358
|
}), s(() => {
|
|
6357
6359
|
v();
|
|
6358
|
-
}, [
|
|
6360
|
+
}, [te, v]), s(() => {
|
|
6359
6361
|
let e = _, t = e.localClippingEnabled, r = e.clippingPlanes;
|
|
6360
6362
|
return e.localClippingEnabled = !0, e.clippingPlanes = [n], () => {
|
|
6361
6363
|
e.localClippingEnabled = t, e.clippingPlanes = r;
|
|
@@ -6365,7 +6367,7 @@ function _c({ getExtraObjects: e, onPreselectionChange: t, plane: n, registerInv
|
|
|
6365
6367
|
camera: m,
|
|
6366
6368
|
controls: S.current,
|
|
6367
6369
|
invalidate: v,
|
|
6368
|
-
model:
|
|
6370
|
+
model: O.root,
|
|
6369
6371
|
plane: n,
|
|
6370
6372
|
size: x,
|
|
6371
6373
|
viewNormal: p
|
|
@@ -6374,20 +6376,20 @@ function _c({ getExtraObjects: e, onPreselectionChange: t, plane: n, registerInv
|
|
|
6374
6376
|
m,
|
|
6375
6377
|
v,
|
|
6376
6378
|
n,
|
|
6377
|
-
|
|
6379
|
+
O.root,
|
|
6378
6380
|
x,
|
|
6379
6381
|
p
|
|
6380
6382
|
]), /* @__PURE__ */ ye(ve, { children: [
|
|
6381
6383
|
/* @__PURE__ */ W("ambientLight", { intensity: 1.2 }),
|
|
6382
6384
|
/* @__PURE__ */ W("primitive", {
|
|
6383
|
-
object:
|
|
6385
|
+
object: O.root,
|
|
6384
6386
|
onClick: pe,
|
|
6385
6387
|
onPointerDown: ue,
|
|
6386
6388
|
onPointerLeave: me,
|
|
6387
6389
|
onPointerMove: V,
|
|
6388
6390
|
onPointerUp: fe
|
|
6389
6391
|
}),
|
|
6390
|
-
|
|
6392
|
+
P.map((e) => /* @__PURE__ */ W("primitive", {
|
|
6391
6393
|
object: e,
|
|
6392
6394
|
onClick: pe,
|
|
6393
6395
|
onPointerDown: ue,
|
|
@@ -6395,7 +6397,7 @@ function _c({ getExtraObjects: e, onPreselectionChange: t, plane: n, registerInv
|
|
|
6395
6397
|
onPointerMove: V,
|
|
6396
6398
|
onPointerUp: fe
|
|
6397
6399
|
}, e.uuid)),
|
|
6398
|
-
|
|
6400
|
+
j.map((e) => /* @__PURE__ */ W("primitive", {
|
|
6399
6401
|
object: e,
|
|
6400
6402
|
onClick: pe,
|
|
6401
6403
|
onPointerDown: ue,
|
|
@@ -6478,7 +6480,7 @@ function Ec(e, t, n, r) {
|
|
|
6478
6480
|
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));
|
|
6479
6481
|
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);
|
|
6480
6482
|
let h = new x(a);
|
|
6481
|
-
return h.colorSpace = B, h.generateMipmaps = !1, h.magFilter =
|
|
6483
|
+
return h.colorSpace = B, h.generateMipmaps = !1, h.magFilter = ne, h.minFilter = ne, h.needsUpdate = !0, {
|
|
6482
6484
|
disposeTimer: null,
|
|
6483
6485
|
height: m,
|
|
6484
6486
|
key: e,
|
|
@@ -6740,72 +6742,99 @@ function Gc({ color: e, floorY: t, fontSize: n = yc, grids: r, labelOffset: i =
|
|
|
6740
6742
|
].join("_")))
|
|
6741
6743
|
});
|
|
6742
6744
|
}
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
+
//#endregion
|
|
6746
|
+
//#region src/viewer/sharedMeshMaterials.ts
|
|
6747
|
+
var Kc = class {
|
|
6748
|
+
materials = /* @__PURE__ */ new Map();
|
|
6749
|
+
get(e, t) {
|
|
6750
|
+
let n = this.materials.get(e);
|
|
6751
|
+
return n || (n = t(), this.materials.set(e, n)), n;
|
|
6752
|
+
}
|
|
6753
|
+
dispose() {
|
|
6754
|
+
this.materials.forEach((e) => e.dispose());
|
|
6755
|
+
}
|
|
6756
|
+
};
|
|
6757
|
+
function qc(e, t, n, r, i) {
|
|
6758
|
+
return [
|
|
6759
|
+
e,
|
|
6760
|
+
t.uuid,
|
|
6761
|
+
n.r,
|
|
6762
|
+
n.g,
|
|
6763
|
+
n.b,
|
|
6764
|
+
n.opacity,
|
|
6765
|
+
r,
|
|
6766
|
+
i
|
|
6767
|
+
].join("|");
|
|
6768
|
+
}
|
|
6769
|
+
function Jc(e, t) {
|
|
6770
|
+
!t || e.clippingPlanes === t || !t.length && !e.clippingPlanes?.length || (e.clippingPlanes = t, e.needsUpdate = !0);
|
|
6771
|
+
}
|
|
6772
|
+
var Yc = 2;
|
|
6773
|
+
function Xc() {
|
|
6745
6774
|
let e = new T(new Uint8Array(256 * 4), 256, 1, le, ge);
|
|
6746
|
-
return e.magFilter =
|
|
6775
|
+
return e.magFilter = ae, e.minFilter = ae, e.generateMipmaps = !1, e.needsUpdate = !0, Qc(e, 1, new C(Ge)), e;
|
|
6747
6776
|
}
|
|
6748
|
-
function
|
|
6777
|
+
function Zc(e) {
|
|
6749
6778
|
return `${e.r.toFixed(6)}:${e.g.toFixed(6)}:${e.b.toFixed(6)}`;
|
|
6750
6779
|
}
|
|
6751
|
-
function
|
|
6780
|
+
function Qc(e, t, n) {
|
|
6752
6781
|
let r = e.image.data, i = t * 4;
|
|
6753
6782
|
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;
|
|
6754
6783
|
}
|
|
6755
|
-
function
|
|
6784
|
+
function $c(e) {
|
|
6756
6785
|
return e.mesh.geometry.attributes.colorIndex;
|
|
6757
6786
|
}
|
|
6758
|
-
function
|
|
6787
|
+
function el(e) {
|
|
6759
6788
|
let t = e.mesh.geometry.attributes.ids;
|
|
6760
6789
|
if (!t) return null;
|
|
6761
6790
|
let n = new y(e.mesh.userData.useUint32ColorIndex === !0 ? new Uint32Array(t.count) : new Uint8Array(t.count), 1);
|
|
6762
6791
|
return e.mesh.geometry.setAttribute("colorIndex", n), n;
|
|
6763
6792
|
}
|
|
6764
|
-
function
|
|
6765
|
-
let n =
|
|
6766
|
-
return n || t === 0 ? n :
|
|
6793
|
+
function tl(e, t) {
|
|
6794
|
+
let n = $c(e);
|
|
6795
|
+
return n || t === 0 ? n : el(e);
|
|
6767
6796
|
}
|
|
6768
|
-
function
|
|
6769
|
-
e.mesh.userData.keepColorIndexAttribute !== !0 &&
|
|
6797
|
+
function nl(e) {
|
|
6798
|
+
e.mesh.userData.keepColorIndexAttribute !== !0 && $c(e) && e.mesh.geometry.deleteAttribute("colorIndex");
|
|
6770
6799
|
}
|
|
6771
|
-
function
|
|
6800
|
+
function rl(e, t, n) {
|
|
6772
6801
|
let r = e.get(t);
|
|
6773
6802
|
return !r && n && (r = /* @__PURE__ */ new Set(), e.set(t, r)), r;
|
|
6774
6803
|
}
|
|
6775
|
-
function
|
|
6804
|
+
function il(e, t, n) {
|
|
6776
6805
|
let r = e.get(t);
|
|
6777
6806
|
return !r && n && (r = /* @__PURE__ */ new Set(), e.set(t, r)), r;
|
|
6778
6807
|
}
|
|
6779
|
-
function
|
|
6780
|
-
let n =
|
|
6808
|
+
function al(e, t) {
|
|
6809
|
+
let n = tl(e.record, t);
|
|
6781
6810
|
if (!n) return !1;
|
|
6782
6811
|
let r = n.array;
|
|
6783
6812
|
return e.vertexRanges.forEach(({ count: e, start: n }) => {
|
|
6784
6813
|
r.fill(t, n, n + e);
|
|
6785
6814
|
}), n.needsUpdate = !0, !0;
|
|
6786
6815
|
}
|
|
6787
|
-
function
|
|
6816
|
+
function ol(e, t, n, r, i, a) {
|
|
6788
6817
|
e && e.forEach((e) => {
|
|
6789
6818
|
if (e.record.modelID !== t) return;
|
|
6790
|
-
let o =
|
|
6791
|
-
r === 0 ? (s?.delete(n), s?.size || (i.delete(e.record),
|
|
6792
|
-
let c =
|
|
6819
|
+
let o = al(e, r), s = rl(i, e.record, r !== 0 && o);
|
|
6820
|
+
r === 0 ? (s?.delete(n), s?.size || (i.delete(e.record), nl(e.record))) : o && s?.add(n);
|
|
6821
|
+
let c = il(a, e.record, r === 1 && o);
|
|
6793
6822
|
r === 1 && o ? c?.add(n) : (c?.delete(n), c?.size || a.delete(e.record)), e.record.mesh.userData.isSelected = !!c?.size;
|
|
6794
6823
|
});
|
|
6795
6824
|
}
|
|
6796
|
-
function
|
|
6825
|
+
function sl(e, t, n) {
|
|
6797
6826
|
let r = /* @__PURE__ */ new Set();
|
|
6798
6827
|
return e.elementIndex.forEach((e, i) => {
|
|
6799
6828
|
n.has(i) || e.some((e) => e.record.modelID === t) && r.add(i);
|
|
6800
6829
|
}), r;
|
|
6801
6830
|
}
|
|
6802
|
-
function
|
|
6831
|
+
function cl(e) {
|
|
6803
6832
|
let t = /* @__PURE__ */ new Set();
|
|
6804
6833
|
return Object.entries(e).forEach(([e, n]) => {
|
|
6805
6834
|
n.forEach((n) => t.add(`${e}:${n}`));
|
|
6806
6835
|
}), t;
|
|
6807
6836
|
}
|
|
6808
|
-
function
|
|
6837
|
+
function ll(e, t) {
|
|
6809
6838
|
let n = /* @__PURE__ */ new Map(), r = (e) => {
|
|
6810
6839
|
let [t, r] = e.split(":").map(Number), i = n.get(t);
|
|
6811
6840
|
i || (i = /* @__PURE__ */ new Set(), n.set(t, i)), i.add(r);
|
|
@@ -6816,28 +6845,28 @@ function ol(e, t) {
|
|
|
6816
6845
|
t.has(e) || r(e);
|
|
6817
6846
|
}), n;
|
|
6818
6847
|
}
|
|
6819
|
-
function
|
|
6820
|
-
let t = G((e) => e.selected), n = G((e) => e.selectionColor), r = u(() =>
|
|
6848
|
+
function ul(e) {
|
|
6849
|
+
let t = G((e) => e.selected), n = G((e) => e.selectionColor), r = u(() => Xc(), []), i = d(/* @__PURE__ */ new Map()), o = d(Yc), c = d(/* @__PURE__ */ new Map()), l = d(t), f = d(/* @__PURE__ */ new Set()), p = d(/* @__PURE__ */ new WeakMap()), m = d(/* @__PURE__ */ new WeakMap());
|
|
6821
6850
|
s(() => {
|
|
6822
6851
|
l.current = t;
|
|
6823
6852
|
}, [t]), s(() => () => r.dispose(), [r]), s(() => {
|
|
6824
|
-
|
|
6853
|
+
Qc(r, 1, new C(n));
|
|
6825
6854
|
}, [r, n]);
|
|
6826
6855
|
let h = a((e, t) => l.current[e]?.has(t) ? 1 : c.current.get(e)?.get(t) ?? 0, []), g = a((t, n) => {
|
|
6827
6856
|
let r = e.buildIndex();
|
|
6828
6857
|
n.forEach((e) => {
|
|
6829
|
-
|
|
6858
|
+
ol(r.elementIndex.get(e), t, e, h(t, e), p.current, m.current);
|
|
6830
6859
|
});
|
|
6831
6860
|
}, [e, h]), _ = a((e) => {
|
|
6832
|
-
let t = new C(e), n =
|
|
6861
|
+
let t = new C(e), n = Zc(t), a = i.current.get(n);
|
|
6833
6862
|
if (a !== void 0) return a;
|
|
6834
6863
|
let s = o.current;
|
|
6835
6864
|
if (s >= 256) throw Error("Element color palette is full. Maximum colors: 255.");
|
|
6836
|
-
return i.current.set(n, s), o.current += 1,
|
|
6865
|
+
return i.current.set(n, s), o.current += 1, Qc(r, s, t), s;
|
|
6837
6866
|
}, [r]);
|
|
6838
6867
|
s(() => {
|
|
6839
|
-
let e =
|
|
6840
|
-
|
|
6868
|
+
let e = cl(t);
|
|
6869
|
+
ll(f.current, e).forEach((e, t) => {
|
|
6841
6870
|
g(t, Array.from(e));
|
|
6842
6871
|
}), f.current = e;
|
|
6843
6872
|
}, [g, t]);
|
|
@@ -6848,7 +6877,7 @@ function sl(e) {
|
|
|
6848
6877
|
let i = e.buildIndex(), a = /* @__PURE__ */ new Set(), o = Object.entries(n);
|
|
6849
6878
|
o.forEach(([, e]) => {
|
|
6850
6879
|
e.forEach((e) => a.add(e));
|
|
6851
|
-
}), r !== void 0 && v(t, Array.from(
|
|
6880
|
+
}), r !== void 0 && v(t, Array.from(sl(i, t, a)), r), o.forEach(([e, n]) => {
|
|
6852
6881
|
v(t, n, e);
|
|
6853
6882
|
});
|
|
6854
6883
|
}, [e, v]), b = a((e, t) => {
|
|
@@ -6876,12 +6905,12 @@ function sl(e) {
|
|
|
6876
6905
|
t.forEach((t) => r(Number(e), t));
|
|
6877
6906
|
}), n.forEach((e, n) => {
|
|
6878
6907
|
e.forEach((e) => {
|
|
6879
|
-
|
|
6908
|
+
ol(t.elementIndex.get(e), n, e, h(n, e), p.current, m.current);
|
|
6880
6909
|
});
|
|
6881
6910
|
});
|
|
6882
6911
|
}, [e, h]), T = a(() => {
|
|
6883
6912
|
e.buildIndex().records.forEach((e) => {
|
|
6884
|
-
p.current.delete(e), m.current.delete(e), e.mesh.userData.isSelected = !1,
|
|
6913
|
+
p.current.delete(e), m.current.delete(e), e.mesh.userData.isSelected = !1, nl(e);
|
|
6885
6914
|
}), p.current = /* @__PURE__ */ new WeakMap(), m.current = /* @__PURE__ */ new WeakMap(), c.current.clear(), w();
|
|
6886
6915
|
}, [w, e]);
|
|
6887
6916
|
return {
|
|
@@ -6907,11 +6936,11 @@ function sl(e) {
|
|
|
6907
6936
|
}
|
|
6908
6937
|
//#endregion
|
|
6909
6938
|
//#region src/viewer/utils/GeometryUtils/meshBoundsTree.ts
|
|
6910
|
-
var
|
|
6911
|
-
function
|
|
6912
|
-
return
|
|
6939
|
+
var dl = "viewerOriginalBoundsTree";
|
|
6940
|
+
function fl(e) {
|
|
6941
|
+
return Tr(e) || Sr(e, xr(e.pos.slice(), e.ind.slice()));
|
|
6913
6942
|
}
|
|
6914
|
-
function
|
|
6943
|
+
function pl(e, t) {
|
|
6915
6944
|
if (t) try {
|
|
6916
6945
|
return He.deserialize(t, e, { setIndex: !1 });
|
|
6917
6946
|
} catch (e) {
|
|
@@ -6919,48 +6948,48 @@ function ul(e, t) {
|
|
|
6919
6948
|
}
|
|
6920
6949
|
return new He(e, { indirect: !0 });
|
|
6921
6950
|
}
|
|
6922
|
-
function
|
|
6923
|
-
return !!e.boundsTree ||
|
|
6951
|
+
function ml(e) {
|
|
6952
|
+
return !!e.boundsTree || wr(e);
|
|
6924
6953
|
}
|
|
6925
|
-
function
|
|
6926
|
-
let n = e.userData[
|
|
6954
|
+
function hl(e, t) {
|
|
6955
|
+
let n = e.userData[dl];
|
|
6927
6956
|
return n?.indexLength === t.length ? n.boundsTree : null;
|
|
6928
6957
|
}
|
|
6929
|
-
function
|
|
6958
|
+
function gl(e, t, n) {
|
|
6930
6959
|
let r = !1, i = (i) => {
|
|
6931
6960
|
if (r) return;
|
|
6932
|
-
let a =
|
|
6933
|
-
t.userData[
|
|
6961
|
+
let a = pl(t, i);
|
|
6962
|
+
t.userData[dl] = {
|
|
6934
6963
|
boundsTree: a,
|
|
6935
6964
|
indexLength: e.ind.length
|
|
6936
6965
|
}, t.index?.count === e.ind.length && Object.assign(t, { boundsTree: a }), n();
|
|
6937
6966
|
};
|
|
6938
|
-
return e.boundsTree ? i(e.boundsTree) :
|
|
6939
|
-
r = !0, delete t.userData[
|
|
6967
|
+
return e.boundsTree ? i(e.boundsTree) : fl(e).then(i, () => i(null)), () => {
|
|
6968
|
+
r = !0, delete t.userData[dl], Object.assign(t, { boundsTree: null });
|
|
6940
6969
|
};
|
|
6941
6970
|
}
|
|
6942
6971
|
//#endregion
|
|
6943
6972
|
//#region src/viewer/utils/GeometryUtils/progressiveDrawRange.ts
|
|
6944
|
-
var
|
|
6945
|
-
function
|
|
6973
|
+
var _l = 10;
|
|
6974
|
+
function vl(e) {
|
|
6946
6975
|
return e.index?.count ?? e.getAttribute("position")?.count ?? 0;
|
|
6947
6976
|
}
|
|
6948
|
-
function
|
|
6977
|
+
function yl(e, t) {
|
|
6949
6978
|
if (e <= 3) return e;
|
|
6950
|
-
let n = Math.min(1, Math.max(0, t /
|
|
6979
|
+
let n = Math.min(1, Math.max(0, t / _l)), r = Math.ceil(e * n), i = Math.ceil(r / 3) * 3;
|
|
6951
6980
|
return Math.min(e, Math.max(3, i));
|
|
6952
6981
|
}
|
|
6953
|
-
function
|
|
6954
|
-
let t =
|
|
6955
|
-
t && e.setDrawRange(0,
|
|
6982
|
+
function bl(e) {
|
|
6983
|
+
let t = vl(e);
|
|
6984
|
+
t && e.setDrawRange(0, yl(t, 1));
|
|
6956
6985
|
}
|
|
6957
|
-
function
|
|
6958
|
-
let n =
|
|
6986
|
+
function xl(e, t) {
|
|
6987
|
+
let n = vl(e);
|
|
6959
6988
|
if (!n) return t?.(), () => {};
|
|
6960
|
-
if (
|
|
6989
|
+
if (bl(e), typeof requestAnimationFrame != "function") return e.setDrawRange(0, n), t?.(), () => {};
|
|
6961
6990
|
let r = null, i = 1, a = !1, o = () => {
|
|
6962
6991
|
if (!a) {
|
|
6963
|
-
if (i += 1, e.setDrawRange(0,
|
|
6992
|
+
if (i += 1, e.setDrawRange(0, yl(n, i)), i >= _l) {
|
|
6964
6993
|
e.setDrawRange(0, n), t?.();
|
|
6965
6994
|
return;
|
|
6966
6995
|
}
|
|
@@ -6973,19 +7002,19 @@ function vl(e, t) {
|
|
|
6973
7002
|
}
|
|
6974
7003
|
//#endregion
|
|
6975
7004
|
//#region src/viewer/SelectableMesh.tsx
|
|
6976
|
-
|
|
6977
|
-
var
|
|
6978
|
-
function
|
|
7005
|
+
F.prototype.raycast = We;
|
|
7006
|
+
var Sl = 1 / 1.5;
|
|
7007
|
+
function Cl(e, t) {
|
|
6979
7008
|
let n = e.userData, r = n.shaders ?? /* @__PURE__ */ new Set();
|
|
6980
7009
|
r.add(t), n.shader = t, n.shaders = r;
|
|
6981
7010
|
}
|
|
6982
|
-
function
|
|
7011
|
+
function wl(e) {
|
|
6983
7012
|
let t = e.userData;
|
|
6984
7013
|
return t.shaders ? Array.from(t.shaders) : t.shader ? [t.shader] : [];
|
|
6985
7014
|
}
|
|
6986
|
-
function
|
|
7015
|
+
function Tl({ colorPaletteTexture: e, material: t, materialMode: n = "quality", preselectionColor: r, useDoubleSideMaterial: i = !1 }) {
|
|
6987
7016
|
let a = new C(t.r, t.g, t.b);
|
|
6988
|
-
n === "performance" && a.multiplyScalar(
|
|
7017
|
+
n === "performance" && a.multiplyScalar(Sl);
|
|
6989
7018
|
let o = {
|
|
6990
7019
|
color: a.clone(),
|
|
6991
7020
|
transparent: !!(t.opacity && t.opacity != 1),
|
|
@@ -6993,7 +7022,7 @@ function Sl({ colorPaletteTexture: e, material: t, materialMode: n = "quality",
|
|
|
6993
7022
|
}, s = i ? {
|
|
6994
7023
|
...o,
|
|
6995
7024
|
side: E
|
|
6996
|
-
} : o, c = n === "performance" ? new
|
|
7025
|
+
} : o, c = n === "performance" ? new I(s) : new ie(s), l = c;
|
|
6997
7026
|
return l.defaultAttributeValues = {
|
|
6998
7027
|
...l.defaultAttributeValues,
|
|
6999
7028
|
colorIndex: [0]
|
|
@@ -7014,93 +7043,105 @@ function Sl({ colorPaletteTexture: e, material: t, materialMode: n = "quality",
|
|
|
7014
7043
|
else{
|
|
7015
7044
|
diffuseColor = vec4(baseColor, opacity);
|
|
7016
7045
|
}
|
|
7017
|
-
`),
|
|
7046
|
+
`), Cl(c, t);
|
|
7018
7047
|
}, c;
|
|
7019
7048
|
}
|
|
7020
|
-
function
|
|
7021
|
-
|
|
7049
|
+
function El(e, t) {
|
|
7050
|
+
wl(e).forEach((e) => {
|
|
7022
7051
|
let n = e.uniforms.preSelectionColor;
|
|
7023
7052
|
n && (n.value instanceof C ? n.value.set(t) : n.value = new C(t));
|
|
7024
7053
|
});
|
|
7025
7054
|
}
|
|
7026
|
-
var
|
|
7027
|
-
let
|
|
7028
|
-
|
|
7029
|
-
let
|
|
7030
|
-
let e =
|
|
7031
|
-
!
|
|
7032
|
-
}, []),
|
|
7033
|
-
|
|
7034
|
-
|
|
7035
|
-
|
|
7036
|
-
|
|
7037
|
-
|
|
7038
|
-
|
|
7055
|
+
var Dl = e.memo(function({ colorPaletteTexture: e, material: t, materialCache: n, materialMode: r = "quality", data: i, getClippingPlanes: o, isIfcSpace: c = !1, meshMatrix: f, onReady: p, readyKey: m, useDoubleSideMaterial: h = !1 }) {
|
|
7056
|
+
let g = d(null), _ = d(p), v = d(m), y = d(!1), b = d(!1), x = G((e) => e.preselectionColor), S = d(x);
|
|
7057
|
+
_.current = p, v.current = m, S.current = x;
|
|
7058
|
+
let C = a(() => {
|
|
7059
|
+
let e = v.current;
|
|
7060
|
+
!y.current || !b.current || e === void 0 || _.current?.(e);
|
|
7061
|
+
}, []), w = u(() => ml(i), [i]), T = u(() => {
|
|
7062
|
+
let i = () => Tl({
|
|
7063
|
+
colorPaletteTexture: e,
|
|
7064
|
+
material: t,
|
|
7065
|
+
materialMode: r,
|
|
7066
|
+
preselectionColor: S.current,
|
|
7067
|
+
useDoubleSideMaterial: h
|
|
7068
|
+
}), a = n ? n.get(qc("webgl", e, t, r, h), i) : i();
|
|
7069
|
+
return Jc(a, o?.()), a;
|
|
7070
|
+
}, [
|
|
7039
7071
|
e,
|
|
7072
|
+
o,
|
|
7040
7073
|
t,
|
|
7041
7074
|
n,
|
|
7042
|
-
|
|
7075
|
+
r,
|
|
7076
|
+
h
|
|
7043
7077
|
]);
|
|
7044
7078
|
return s(() => {
|
|
7045
|
-
|
|
7046
|
-
}, [
|
|
7047
|
-
!
|
|
7048
|
-
}, [
|
|
7049
|
-
let e =
|
|
7079
|
+
El(T, x);
|
|
7080
|
+
}, [T, x]), s(() => {
|
|
7081
|
+
if (!n) return () => T.dispose();
|
|
7082
|
+
}, [T, n]), s(() => {
|
|
7083
|
+
let e = g.current?.geometry;
|
|
7084
|
+
return () => e?.dispose();
|
|
7085
|
+
}, []), l(() => {
|
|
7086
|
+
!w || !g.current || bl(g.current.geometry);
|
|
7087
|
+
}, [i, w]), s(() => {
|
|
7088
|
+
let e = g.current?.geometry;
|
|
7050
7089
|
if (e) {
|
|
7051
|
-
if (!
|
|
7052
|
-
e.setDrawRange(0, Infinity),
|
|
7090
|
+
if (!w) {
|
|
7091
|
+
e.setDrawRange(0, Infinity), b.current = !0, C();
|
|
7053
7092
|
return;
|
|
7054
7093
|
}
|
|
7055
|
-
return
|
|
7056
|
-
|
|
7094
|
+
return b.current = !1, xl(e, () => {
|
|
7095
|
+
b.current = !0, C();
|
|
7057
7096
|
});
|
|
7058
7097
|
}
|
|
7059
7098
|
}, [
|
|
7060
|
-
|
|
7061
|
-
|
|
7062
|
-
|
|
7099
|
+
i,
|
|
7100
|
+
C,
|
|
7101
|
+
w
|
|
7063
7102
|
]), s(() => {
|
|
7064
|
-
if (
|
|
7065
|
-
|
|
7103
|
+
if (g.current) return y.current = !1, gl(i, g.current.geometry, () => {
|
|
7104
|
+
y.current = !0, C();
|
|
7066
7105
|
});
|
|
7067
|
-
}, [
|
|
7068
|
-
|
|
7069
|
-
}, [
|
|
7106
|
+
}, [i, C]), s(() => {
|
|
7107
|
+
C();
|
|
7108
|
+
}, [C, m]), /* @__PURE__ */ W("mesh", {
|
|
7070
7109
|
frustumCulled: !0,
|
|
7071
|
-
|
|
7110
|
+
dispose: null,
|
|
7111
|
+
material: T,
|
|
7112
|
+
matrix: f,
|
|
7072
7113
|
matrixAutoUpdate: !1,
|
|
7073
|
-
name:
|
|
7074
|
-
ref:
|
|
7075
|
-
visible: !
|
|
7076
|
-
userData: { isIfcSpace:
|
|
7114
|
+
name: c ? "space" : void 0,
|
|
7115
|
+
ref: g,
|
|
7116
|
+
visible: !c,
|
|
7117
|
+
userData: { isIfcSpace: c },
|
|
7077
7118
|
onPointerLeave: (e) => {
|
|
7078
7119
|
let t = e.object;
|
|
7079
7120
|
t.preselected &&= !1;
|
|
7080
7121
|
},
|
|
7081
|
-
children:
|
|
7122
|
+
children: /* @__PURE__ */ ye("bufferGeometry", { children: [
|
|
7082
7123
|
/* @__PURE__ */ W("bufferAttribute", {
|
|
7083
7124
|
attach: "attributes-position",
|
|
7084
|
-
args: [
|
|
7125
|
+
args: [i.pos, 3]
|
|
7085
7126
|
}),
|
|
7086
|
-
|
|
7127
|
+
i.norm && /* @__PURE__ */ W("bufferAttribute", {
|
|
7087
7128
|
attach: "attributes-normal",
|
|
7088
|
-
args: [
|
|
7129
|
+
args: [i.norm, 3]
|
|
7089
7130
|
}),
|
|
7090
7131
|
/* @__PURE__ */ W("bufferAttribute", {
|
|
7091
7132
|
attach: "attributes-ids",
|
|
7092
|
-
args: [
|
|
7133
|
+
args: [i.ids, 1]
|
|
7093
7134
|
}),
|
|
7094
7135
|
/* @__PURE__ */ W("bufferAttribute", {
|
|
7095
7136
|
attach: "index",
|
|
7096
|
-
args: [
|
|
7137
|
+
args: [i.ind, 1]
|
|
7097
7138
|
})
|
|
7098
|
-
] })
|
|
7139
|
+
] })
|
|
7099
7140
|
});
|
|
7100
|
-
}),
|
|
7101
|
-
function
|
|
7141
|
+
}), Ol = 1 / 1.5;
|
|
7142
|
+
function kl({ colorPaletteTexture: e, material: t, materialMode: n, preselectionColor: r, selectionColor: i, useDoubleSideMaterial: a }) {
|
|
7102
7143
|
let o = new C(t.r, t.g, t.b);
|
|
7103
|
-
n === "performance" && o.multiplyScalar(
|
|
7144
|
+
n === "performance" && o.multiplyScalar(Ol);
|
|
7104
7145
|
let s = t.opacity ?? 1, c = {
|
|
7105
7146
|
color: o.clone(),
|
|
7106
7147
|
opacity: s,
|
|
@@ -7122,7 +7163,7 @@ function El({ colorPaletteTexture: e, material: t, materialMode: n, preselection
|
|
|
7122
7163
|
selectionColor: h
|
|
7123
7164
|
} }, u.userData.shaders = new Set([u.userData.shader]), u;
|
|
7124
7165
|
}
|
|
7125
|
-
function
|
|
7166
|
+
function Al(e, { preselectionColor: t, selectionColor: n }) {
|
|
7126
7167
|
let r = e.userData, i = r.shaders ? Array.from(r.shaders) : r.shader ? [r.shader] : [], a = (e, t) => {
|
|
7127
7168
|
i.forEach((n) => {
|
|
7128
7169
|
let r = n.uniforms?.[e];
|
|
@@ -7131,81 +7172,90 @@ function Dl(e, { preselectionColor: t, selectionColor: n }) {
|
|
|
7131
7172
|
};
|
|
7132
7173
|
a("preSelectionColor", t), a("selectionColor", n);
|
|
7133
7174
|
}
|
|
7134
|
-
var
|
|
7135
|
-
let
|
|
7136
|
-
|
|
7137
|
-
let
|
|
7138
|
-
let e =
|
|
7139
|
-
!
|
|
7140
|
-
}, []),
|
|
7175
|
+
var jl = e.memo(function({ colorPaletteTexture: e, material: t, materialCache: n, materialMode: r = "quality", data: i, getClippingPlanes: o, isIfcSpace: c = !1, meshMatrix: l, onReady: f, readyKey: p, useDoubleSideMaterial: m = !1 }) {
|
|
7176
|
+
let h = d(null), g = d(f), _ = d(p), v = d(!1), x = d(!1), S = u(() => new Uint32Array(i.ids.length), [i.ids]);
|
|
7177
|
+
g.current = f, _.current = p;
|
|
7178
|
+
let C = a(() => {
|
|
7179
|
+
let e = _.current;
|
|
7180
|
+
!v.current || !x.current || e === void 0 || g.current?.(e);
|
|
7181
|
+
}, []), w = u(() => ml(i), [i]), T = u(() => {
|
|
7141
7182
|
let e = new b();
|
|
7142
|
-
return e.setAttribute("position", new y(
|
|
7183
|
+
return e.setAttribute("position", new y(i.pos, 3)), i.norm && e.setAttribute("normal", new y(i.norm, 3)), e.setAttribute("ids", new y(i.ids, 1)), e.setAttribute("colorIndex", new y(S, 1)), e.setIndex(new y(i.ind, 1)), r !== "performance" && !e.attributes.normal && e.computeVertexNormals(), w && bl(e), e;
|
|
7143
7184
|
}, [
|
|
7144
|
-
|
|
7185
|
+
S,
|
|
7186
|
+
i,
|
|
7145
7187
|
r,
|
|
7146
|
-
|
|
7147
|
-
|
|
7148
|
-
|
|
7149
|
-
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
|
|
7153
|
-
|
|
7154
|
-
|
|
7155
|
-
|
|
7156
|
-
|
|
7157
|
-
|
|
7158
|
-
|
|
7159
|
-
|
|
7188
|
+
w
|
|
7189
|
+
]), E = G((e) => e.preselectionColor), D = G((e) => e.selectionColor), O = d(E);
|
|
7190
|
+
O.current = E;
|
|
7191
|
+
let k = d(D);
|
|
7192
|
+
k.current = D;
|
|
7193
|
+
let A = u(() => {
|
|
7194
|
+
let i = () => kl({
|
|
7195
|
+
colorPaletteTexture: e,
|
|
7196
|
+
material: t,
|
|
7197
|
+
materialMode: r,
|
|
7198
|
+
preselectionColor: O.current,
|
|
7199
|
+
selectionColor: k.current,
|
|
7200
|
+
useDoubleSideMaterial: m
|
|
7201
|
+
}), a = n ? n.get(qc("webgpu", e, t, r, m), i) : i();
|
|
7202
|
+
return Jc(a, o?.()), a;
|
|
7203
|
+
}, [
|
|
7160
7204
|
e,
|
|
7205
|
+
o,
|
|
7161
7206
|
t,
|
|
7162
7207
|
n,
|
|
7163
|
-
|
|
7208
|
+
r,
|
|
7209
|
+
m
|
|
7164
7210
|
]);
|
|
7165
7211
|
return s(() => {
|
|
7166
|
-
|
|
7167
|
-
preselectionColor:
|
|
7168
|
-
selectionColor:
|
|
7212
|
+
Al(A, {
|
|
7213
|
+
preselectionColor: E,
|
|
7214
|
+
selectionColor: D
|
|
7169
7215
|
});
|
|
7170
7216
|
}, [
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
7217
|
+
A,
|
|
7218
|
+
E,
|
|
7219
|
+
D
|
|
7174
7220
|
]), s(() => {
|
|
7175
|
-
if (!
|
|
7176
|
-
|
|
7221
|
+
if (!w) {
|
|
7222
|
+
T.setDrawRange(0, Infinity), x.current = !0, C();
|
|
7177
7223
|
return;
|
|
7178
7224
|
}
|
|
7179
|
-
return
|
|
7180
|
-
|
|
7225
|
+
return x.current = !1, xl(T, () => {
|
|
7226
|
+
x.current = !0, C();
|
|
7181
7227
|
});
|
|
7182
7228
|
}, [
|
|
7229
|
+
T,
|
|
7183
7230
|
C,
|
|
7184
|
-
|
|
7185
|
-
S
|
|
7231
|
+
w
|
|
7186
7232
|
]), s(() => {
|
|
7187
|
-
|
|
7188
|
-
let e =
|
|
7189
|
-
|
|
7233
|
+
v.current = !1;
|
|
7234
|
+
let e = gl(i, T, () => {
|
|
7235
|
+
v.current = !0, C();
|
|
7190
7236
|
});
|
|
7191
7237
|
return () => {
|
|
7192
|
-
e(),
|
|
7238
|
+
e(), T.dispose();
|
|
7193
7239
|
};
|
|
7194
7240
|
}, [
|
|
7195
|
-
|
|
7196
|
-
|
|
7197
|
-
|
|
7241
|
+
i,
|
|
7242
|
+
T,
|
|
7243
|
+
C
|
|
7198
7244
|
]), s(() => {
|
|
7199
|
-
|
|
7200
|
-
}, [
|
|
7245
|
+
C();
|
|
7246
|
+
}, [C, p]), s(() => {
|
|
7247
|
+
if (!n) return () => A.dispose();
|
|
7248
|
+
}, [A, n]), /* @__PURE__ */ W("mesh", {
|
|
7201
7249
|
frustumCulled: !0,
|
|
7202
|
-
|
|
7250
|
+
dispose: null,
|
|
7251
|
+
material: A,
|
|
7252
|
+
matrix: l,
|
|
7203
7253
|
matrixAutoUpdate: !1,
|
|
7204
|
-
name:
|
|
7205
|
-
ref:
|
|
7206
|
-
visible: !
|
|
7254
|
+
name: c ? "space" : void 0,
|
|
7255
|
+
ref: h,
|
|
7256
|
+
visible: !c,
|
|
7207
7257
|
userData: {
|
|
7208
|
-
isIfcSpace:
|
|
7258
|
+
isIfcSpace: c,
|
|
7209
7259
|
keepColorIndexAttribute: !0,
|
|
7210
7260
|
useUint32ColorIndex: !0
|
|
7211
7261
|
},
|
|
@@ -7213,56 +7263,71 @@ var Ol = e.memo(function({ colorPaletteTexture: e, material: t, materialMode: n
|
|
|
7213
7263
|
let t = e.object;
|
|
7214
7264
|
t.preselected &&= !1;
|
|
7215
7265
|
},
|
|
7216
|
-
children:
|
|
7266
|
+
children: /* @__PURE__ */ W("primitive", {
|
|
7217
7267
|
attach: "geometry",
|
|
7218
|
-
object:
|
|
7219
|
-
})
|
|
7268
|
+
object: T
|
|
7269
|
+
})
|
|
7220
7270
|
});
|
|
7221
|
-
}),
|
|
7222
|
-
function
|
|
7271
|
+
}), Ml = -1;
|
|
7272
|
+
function Nl(e, t, n) {
|
|
7223
7273
|
let r = e.clone();
|
|
7224
|
-
return !n && Number.isFinite(t) && t !== 0 && r.multiply(new
|
|
7274
|
+
return !n && Number.isFinite(t) && t !== 0 && r.multiply(new P().makeRotationY(t * Ml)), r;
|
|
7225
7275
|
}
|
|
7226
7276
|
//#endregion
|
|
7227
7277
|
//#region src/viewer/Model.tsx
|
|
7228
|
-
var
|
|
7229
|
-
function
|
|
7278
|
+
var Pl = new P(), Fl = /* @__PURE__ */ new WeakMap(), Il = /* @__PURE__ */ new WeakMap();
|
|
7279
|
+
function Ll(e) {
|
|
7230
7280
|
if (!e) return null;
|
|
7231
7281
|
try {
|
|
7232
7282
|
let t = JSON.parse(e);
|
|
7233
|
-
return !Array.isArray(t) || t.length !== 16 ? null : new
|
|
7283
|
+
return !Array.isArray(t) || t.length !== 16 ? null : new P().fromArray(t);
|
|
7234
7284
|
} catch (e) {
|
|
7235
7285
|
return console.warn("Model matrix parsing error", e), null;
|
|
7236
7286
|
}
|
|
7237
7287
|
}
|
|
7238
|
-
function
|
|
7239
|
-
return
|
|
7288
|
+
function Rl(e) {
|
|
7289
|
+
return Ll(zl(e));
|
|
7240
7290
|
}
|
|
7241
|
-
function
|
|
7291
|
+
function zl(e) {
|
|
7242
7292
|
if (e.coordinationMatrix) return e.coordinationMatrix;
|
|
7243
7293
|
for (let t in e.data) {
|
|
7244
7294
|
let n = e.data[Number(t)]?.matrix;
|
|
7245
7295
|
if (n) return n;
|
|
7246
7296
|
}
|
|
7247
7297
|
}
|
|
7248
|
-
function
|
|
7249
|
-
let n =
|
|
7298
|
+
function Bl(e, t) {
|
|
7299
|
+
let n = new U(), r = Infinity;
|
|
7300
|
+
for (let i = 0; i < e.length; i += 3) n.set(e[i], e[i + 1], e[i + 2]).applyMatrix4(t), Number.isFinite(n.y) && (r = Math.min(r, n.y));
|
|
7301
|
+
return r;
|
|
7302
|
+
}
|
|
7303
|
+
function Vl(e, t) {
|
|
7304
|
+
let n = t.elements;
|
|
7305
|
+
if (n[1] !== 0 || n[9] !== 0 || n[3] !== 0 || n[7] !== 0 || n[11] !== 0 || n[15] !== 1) return Bl(e, t);
|
|
7306
|
+
let r = Infinity, i = -Infinity;
|
|
7307
|
+
for (let t = 0; t < e.length; t += 3) {
|
|
7308
|
+
let n = e[t + 1];
|
|
7309
|
+
!Number.isFinite(e[t]) || !Number.isFinite(n) || !Number.isFinite(e[t + 2]) || (n < r && (r = n), n > i && (i = n));
|
|
7310
|
+
}
|
|
7311
|
+
if (r > i) return Infinity;
|
|
7312
|
+
let a = n[5] >= 0 ? n[5] * r + n[13] : n[5] * i + n[13];
|
|
7313
|
+
return Number.isFinite(a) ? a : Bl(e, t);
|
|
7314
|
+
}
|
|
7315
|
+
function Hl(e, t) {
|
|
7316
|
+
let n = e.matrix ?? t ?? "", r = Fl.get(e);
|
|
7250
7317
|
if (r && r.sourceMatrixKey === n) return r;
|
|
7251
|
-
let i = (
|
|
7252
|
-
|
|
7253
|
-
let c = {
|
|
7254
|
-
floorY: s,
|
|
7318
|
+
let i = (Ll(n) ?? new P()).clone().invert(), a = {
|
|
7319
|
+
floorY: Vl(e.pos, i),
|
|
7255
7320
|
meshMatrix: i,
|
|
7256
7321
|
sourceMatrixKey: n
|
|
7257
7322
|
};
|
|
7258
|
-
return
|
|
7323
|
+
return Fl.set(e, a), a;
|
|
7259
7324
|
}
|
|
7260
|
-
function
|
|
7325
|
+
function Ul(e, t) {
|
|
7261
7326
|
let n = e[t];
|
|
7262
7327
|
return n === void 0 ? 0 : Number.isFinite(n) ? n : null;
|
|
7263
7328
|
}
|
|
7264
|
-
function
|
|
7265
|
-
let r =
|
|
7329
|
+
function Wl(e, t, n) {
|
|
7330
|
+
let r = Ul(e, "x"), i = Ul(e, "y"), a = Ul(e, "z"), o = Ul(t, "x"), s = Ul(t, "y"), c = Ul(t, "z");
|
|
7266
7331
|
if (r === null || i === null || a === null || o === null || s === null || c === null) return null;
|
|
7267
7332
|
let l = new U(r + o, i + s, a + c).applyMatrix4(n);
|
|
7268
7333
|
return {
|
|
@@ -7271,14 +7336,14 @@ function zl(e, t, n) {
|
|
|
7271
7336
|
z: l.z
|
|
7272
7337
|
};
|
|
7273
7338
|
}
|
|
7274
|
-
function
|
|
7339
|
+
function Gl(e, t, n) {
|
|
7275
7340
|
let r = {};
|
|
7276
7341
|
return Object.entries(e).forEach(([e, i]) => {
|
|
7277
|
-
let a = i.map((e) =>
|
|
7342
|
+
let a = i.map((e) => Wl(e, t, n)).filter((e) => e !== null);
|
|
7278
7343
|
a.length >= 2 && (r[e] = a);
|
|
7279
7344
|
}), r;
|
|
7280
7345
|
}
|
|
7281
|
-
function
|
|
7346
|
+
function Kl(e, t) {
|
|
7282
7347
|
return {
|
|
7283
7348
|
loc: {
|
|
7284
7349
|
x: 0,
|
|
@@ -7286,27 +7351,27 @@ function Vl(e, t) {
|
|
|
7286
7351
|
z: 0
|
|
7287
7352
|
},
|
|
7288
7353
|
points: {
|
|
7289
|
-
u:
|
|
7290
|
-
v:
|
|
7354
|
+
u: Gl(e.points.u, e.loc, t),
|
|
7355
|
+
v: Gl(e.points.v, e.loc, t)
|
|
7291
7356
|
}
|
|
7292
7357
|
};
|
|
7293
7358
|
}
|
|
7294
|
-
function
|
|
7359
|
+
function ql(e, t) {
|
|
7295
7360
|
if (!e || !t) return e;
|
|
7296
|
-
let n =
|
|
7361
|
+
let n = Il.get(e);
|
|
7297
7362
|
if (n && n.sourceMatrixKey === t) return n.grids;
|
|
7298
|
-
let r =
|
|
7363
|
+
let r = Ll(t);
|
|
7299
7364
|
if (!r) return e;
|
|
7300
7365
|
let i = r.clone().invert(), a = {};
|
|
7301
7366
|
return Object.entries(e).forEach(([e, t]) => {
|
|
7302
|
-
a[e] =
|
|
7303
|
-
}),
|
|
7367
|
+
a[e] = Kl(t, i);
|
|
7368
|
+
}), Il.set(e, {
|
|
7304
7369
|
grids: a,
|
|
7305
7370
|
sourceMatrixKey: t
|
|
7306
7371
|
}), a;
|
|
7307
7372
|
}
|
|
7308
|
-
function
|
|
7309
|
-
let
|
|
7373
|
+
function Jl({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r, getClippingPlanes: i, loadGeneration: o, materialMode: c, onUploadComplete: l, onUploadProgress: p, trueNorthEnabled: m = !0, useWebGPU: h = !1 }) {
|
|
7374
|
+
let g = G((e) => e.gridAxesVisibility), _ = u(() => {
|
|
7310
7375
|
if (!r) return {
|
|
7311
7376
|
data: [],
|
|
7312
7377
|
coordinationMatrix: null,
|
|
@@ -7318,11 +7383,11 @@ function Ul({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
|
|
|
7318
7383
|
e = !0;
|
|
7319
7384
|
break;
|
|
7320
7385
|
}
|
|
7321
|
-
let i = r.coordinationMatrix ??
|
|
7386
|
+
let i = r.coordinationMatrix ?? zl(r), a = Rl(r), o = e || a ? t?.clone() ?? a : null, s = Infinity, c = [];
|
|
7322
7387
|
for (let e in r.data) {
|
|
7323
7388
|
let t = r.data[Number(e)];
|
|
7324
7389
|
if (!t) continue;
|
|
7325
|
-
let a =
|
|
7390
|
+
let a = Hl(t, i), o = t.mat;
|
|
7326
7391
|
s = Math.min(s, a.floorY), c.push({
|
|
7327
7392
|
data: t,
|
|
7328
7393
|
isIfcSpace: !!t.isIfcSpace,
|
|
@@ -7336,69 +7401,71 @@ function Ul({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
|
|
|
7336
7401
|
data: c,
|
|
7337
7402
|
coordinationMatrix: o,
|
|
7338
7403
|
floorY: Number.isFinite(s) ? s : 0,
|
|
7339
|
-
grids:
|
|
7404
|
+
grids: ql(r.grids, i)
|
|
7340
7405
|
};
|
|
7341
7406
|
}, [
|
|
7342
7407
|
t,
|
|
7343
7408
|
r,
|
|
7344
7409
|
n
|
|
7345
|
-
]),
|
|
7346
|
-
loadGeneration:
|
|
7410
|
+
]), v = d({
|
|
7411
|
+
loadGeneration: o,
|
|
7347
7412
|
readyMeshKeys: /* @__PURE__ */ new Set()
|
|
7348
|
-
}),
|
|
7349
|
-
|
|
7350
|
-
loadGeneration:
|
|
7413
|
+
}), y = d(l), b = d(p), x = d(o), S = d(_.data.length);
|
|
7414
|
+
y.current = l, b.current = p, x.current = o, S.current = _.data.length, v.current.loadGeneration !== o && (v.current = {
|
|
7415
|
+
loadGeneration: o,
|
|
7351
7416
|
readyMeshKeys: /* @__PURE__ */ new Set()
|
|
7352
7417
|
});
|
|
7353
|
-
let
|
|
7354
|
-
let t =
|
|
7418
|
+
let C = a((e) => {
|
|
7419
|
+
let t = v.current, r = x.current;
|
|
7355
7420
|
if (t.loadGeneration !== r || !e.startsWith(`${r}:`) || t.readyMeshKeys.has(e)) return;
|
|
7356
7421
|
t.readyMeshKeys.add(e);
|
|
7357
|
-
let i = t.readyMeshKeys.size, a =
|
|
7358
|
-
|
|
7359
|
-
}, [n]);
|
|
7360
|
-
if (!r) return /* @__PURE__ */ W(ve, {});
|
|
7361
|
-
let
|
|
7422
|
+
let i = t.readyMeshKeys.size, a = S.current;
|
|
7423
|
+
b.current?.(n, i, a), i >= a && y.current?.(n, i);
|
|
7424
|
+
}, [n]), [w] = f(() => new Kc());
|
|
7425
|
+
if (s(() => () => w.dispose(), [w]), !r) return /* @__PURE__ */ W(ve, {});
|
|
7426
|
+
let T = c ?? r.renderSettings?.materialMode ?? "quality", E = r.renderSettings?.useDoubleSideMaterial === !0, D = h ? jl : Dl, O = _.coordinationMatrix ?? Pl, k = typeof r.trueNorthAngle == "number" && Number.isFinite(r.trueNorthAngle) ? r.trueNorthAngle : 0;
|
|
7362
7427
|
return /* @__PURE__ */ ye("group", {
|
|
7363
|
-
matrix:
|
|
7428
|
+
matrix: Nl(O, k, m),
|
|
7364
7429
|
matrixAutoUpdate: !1,
|
|
7365
7430
|
userData: u(() => ({
|
|
7366
7431
|
geometryTransformVersion: 0,
|
|
7367
7432
|
modelID: n,
|
|
7368
|
-
trueNorthAngle:
|
|
7369
|
-
trueNorthBaseMatrix:
|
|
7370
|
-
trueNorthEnabled:
|
|
7433
|
+
trueNorthAngle: k,
|
|
7434
|
+
trueNorthBaseMatrix: O.clone(),
|
|
7435
|
+
trueNorthEnabled: m
|
|
7371
7436
|
}), [
|
|
7372
|
-
|
|
7437
|
+
O,
|
|
7373
7438
|
n,
|
|
7374
|
-
|
|
7375
|
-
|
|
7439
|
+
k,
|
|
7440
|
+
m
|
|
7376
7441
|
]),
|
|
7377
|
-
children: [
|
|
7442
|
+
children: [_.data.map((t) => /* @__PURE__ */ W(D, {
|
|
7378
7443
|
colorPaletteTexture: e,
|
|
7379
7444
|
data: t.data,
|
|
7445
|
+
getClippingPlanes: i,
|
|
7380
7446
|
isIfcSpace: t.isIfcSpace,
|
|
7381
7447
|
material: t.material,
|
|
7382
|
-
|
|
7448
|
+
materialCache: w,
|
|
7449
|
+
materialMode: T,
|
|
7383
7450
|
meshMatrix: t.meshMatrix,
|
|
7384
|
-
onReady:
|
|
7385
|
-
readyKey: `${
|
|
7386
|
-
useDoubleSideMaterial:
|
|
7451
|
+
onReady: C,
|
|
7452
|
+
readyKey: `${o}:${t.key}`,
|
|
7453
|
+
useDoubleSideMaterial: E
|
|
7387
7454
|
}, t.key)), /* @__PURE__ */ W(Gc, {
|
|
7388
|
-
floorY:
|
|
7389
|
-
grids:
|
|
7390
|
-
showBottom:
|
|
7391
|
-
showLeft:
|
|
7392
|
-
showRight:
|
|
7393
|
-
showTop:
|
|
7394
|
-
visible:
|
|
7455
|
+
floorY: _.floorY,
|
|
7456
|
+
grids: _.grids,
|
|
7457
|
+
showBottom: g.bottom,
|
|
7458
|
+
showLeft: g.left,
|
|
7459
|
+
showRight: g.right,
|
|
7460
|
+
showTop: g.top,
|
|
7461
|
+
visible: g.visible
|
|
7395
7462
|
})]
|
|
7396
7463
|
});
|
|
7397
7464
|
}
|
|
7398
|
-
var
|
|
7465
|
+
var Yl = i(Jl);
|
|
7399
7466
|
//#endregion
|
|
7400
7467
|
//#region src/viewer/utils/GeometryUtils/useGeometryIndex.ts
|
|
7401
|
-
function
|
|
7468
|
+
function Xl() {
|
|
7402
7469
|
return {
|
|
7403
7470
|
elementBounds: /* @__PURE__ */ new Map(),
|
|
7404
7471
|
elementIndex: /* @__PURE__ */ new Map(),
|
|
@@ -7410,13 +7477,13 @@ function Gl() {
|
|
|
7410
7477
|
version: ""
|
|
7411
7478
|
};
|
|
7412
7479
|
}
|
|
7413
|
-
function
|
|
7480
|
+
function Zl(e) {
|
|
7414
7481
|
return e instanceof Uint16Array || e instanceof Uint32Array ? e : e.length > 65535 ? new Uint32Array(e) : new Uint16Array(e);
|
|
7415
7482
|
}
|
|
7416
|
-
function
|
|
7483
|
+
function Ql(e) {
|
|
7417
7484
|
return "isInterleavedBufferAttribute" in e ? null : e.array;
|
|
7418
7485
|
}
|
|
7419
|
-
function
|
|
7486
|
+
function $l(e) {
|
|
7420
7487
|
let t = e;
|
|
7421
7488
|
for (; t;) {
|
|
7422
7489
|
let e = t.userData.modelID;
|
|
@@ -7425,30 +7492,30 @@ function Jl(e) {
|
|
|
7425
7492
|
}
|
|
7426
7493
|
return 0;
|
|
7427
7494
|
}
|
|
7428
|
-
function
|
|
7495
|
+
function eu(e) {
|
|
7429
7496
|
return e.name === "space" || e.userData.isIfcSpace === !0;
|
|
7430
7497
|
}
|
|
7431
|
-
function
|
|
7498
|
+
function tu(e) {
|
|
7432
7499
|
let t = e.userData.removedElementIds;
|
|
7433
7500
|
if (t instanceof Set) return t;
|
|
7434
7501
|
let n = /* @__PURE__ */ new Set();
|
|
7435
7502
|
return e.userData.removedElementIds = n, n;
|
|
7436
7503
|
}
|
|
7437
|
-
function
|
|
7504
|
+
function nu(e, t) {
|
|
7438
7505
|
let n = t.elements;
|
|
7439
7506
|
for (let t = 0; t < 16; t++) if (e[t] !== n[t]) return !1;
|
|
7440
7507
|
return !0;
|
|
7441
7508
|
}
|
|
7442
|
-
function
|
|
7509
|
+
function ru(e, t, n) {
|
|
7443
7510
|
let r = n.get(e);
|
|
7444
7511
|
return r || (r = {
|
|
7445
7512
|
record: t,
|
|
7446
7513
|
vertexRanges: []
|
|
7447
7514
|
}, n.set(e, r), r);
|
|
7448
7515
|
}
|
|
7449
|
-
function
|
|
7450
|
-
let { originalIndex: r, removedIds: i } = e, a =
|
|
7451
|
-
l === null || t <= u || (
|
|
7516
|
+
function iu(e, t, n) {
|
|
7517
|
+
let { originalIndex: r, removedIds: i } = e, a = Ql(t), o = (e) => a ? a[e] : t.getX(e), s = r.length / 3, c = i.size > 0, l = null, u = 0, d = (t) => {
|
|
7518
|
+
l === null || t <= u || (ru(l, e, n), e.triangleRanges.push({
|
|
7452
7519
|
count: t - u,
|
|
7453
7520
|
id: l,
|
|
7454
7521
|
start: u
|
|
@@ -7464,10 +7531,10 @@ function $l(e, t, n) {
|
|
|
7464
7531
|
}
|
|
7465
7532
|
d(s);
|
|
7466
7533
|
}
|
|
7467
|
-
function
|
|
7468
|
-
let a = /* @__PURE__ */ new Map(), { removedIds: o } = t, s = o.size > 0, c =
|
|
7534
|
+
function au(e, t, n, r, i) {
|
|
7535
|
+
let a = /* @__PURE__ */ new Map(), { removedIds: o } = t, s = o.size > 0, c = Ql(n), l = r && Ql(r), u = n.count, d = r ? Math.min(u, r.count) : 0, f = e.matrixWorld.elements, p = null, m = 0, h = Infinity, g = Infinity, v = Infinity, y = -Infinity, b = -Infinity, x = -Infinity, S = (e) => {
|
|
7469
7536
|
if (p !== null) {
|
|
7470
|
-
if (i && e > m &&
|
|
7537
|
+
if (i && e > m && ru(p, t, i).vertexRanges.push({
|
|
7471
7538
|
count: e - m,
|
|
7472
7539
|
start: m
|
|
7473
7540
|
}), h <= y) {
|
|
@@ -7494,29 +7561,29 @@ function eu(e, t, n, r, i) {
|
|
|
7494
7561
|
}
|
|
7495
7562
|
return S(u), a;
|
|
7496
7563
|
}
|
|
7497
|
-
function
|
|
7564
|
+
function ou(e, t, n) {
|
|
7498
7565
|
let r = e.get(t);
|
|
7499
7566
|
r || (r = /* @__PURE__ */ new Set(), e.set(t, r));
|
|
7500
7567
|
for (let e of n) r.add(e);
|
|
7501
7568
|
}
|
|
7502
|
-
function
|
|
7503
|
-
let t = d(
|
|
7569
|
+
function su(e) {
|
|
7570
|
+
let t = d(Xl()), n = d(/* @__PURE__ */ new Map()), r = d(/* @__PURE__ */ new WeakMap()), i = d(0), o = a((e, t, i) => {
|
|
7504
7571
|
let a = e.geometry, o = a.index, s = a.attributes.ids;
|
|
7505
7572
|
if (!o || !s) return;
|
|
7506
|
-
let c = a.attributes.position, l =
|
|
7573
|
+
let c = a.attributes.position, l = eu(e), u = Zl(o.array), d = {
|
|
7507
7574
|
hiddenIds: /* @__PURE__ */ new Set(),
|
|
7508
7575
|
initialVisible: !0,
|
|
7509
7576
|
isIfcSpace: l,
|
|
7510
7577
|
mesh: e,
|
|
7511
|
-
modelID:
|
|
7512
|
-
originalBoundsTree:
|
|
7578
|
+
modelID: $l(e),
|
|
7579
|
+
originalBoundsTree: hl(a, u) ?? a.boundsTree ?? null,
|
|
7513
7580
|
originalIndex: u,
|
|
7514
|
-
removedIds:
|
|
7581
|
+
removedIds: tu(e),
|
|
7515
7582
|
visibleStateKey: "",
|
|
7516
7583
|
triangleRanges: []
|
|
7517
7584
|
}, f = /* @__PURE__ */ new Map();
|
|
7518
|
-
|
|
7519
|
-
let p =
|
|
7585
|
+
iu(d, s, f);
|
|
7586
|
+
let p = au(e, d, s, c, f), m = {
|
|
7520
7587
|
elementBounds: p,
|
|
7521
7588
|
elementEntries: f,
|
|
7522
7589
|
geometry: a,
|
|
@@ -7528,7 +7595,7 @@ function nu(e) {
|
|
|
7528
7595
|
f.forEach((e, n) => {
|
|
7529
7596
|
let r = t.elementIndex.get(n);
|
|
7530
7597
|
r || (r = [], t.elementIndex.set(n, r)), r.push(e);
|
|
7531
|
-
}),
|
|
7598
|
+
}), ou(i, d.modelID, p.keys()), l && (e.visible = t.ifcSpacesVisible), t.records.add(d), n.current.set(e, m), r.current.set(d, m);
|
|
7532
7599
|
}, []), s = a((e, t, i) => {
|
|
7533
7600
|
let { record: a } = e;
|
|
7534
7601
|
e.elementEntries.forEach((e, n) => {
|
|
@@ -7536,7 +7603,7 @@ function nu(e) {
|
|
|
7536
7603
|
if (!r) return;
|
|
7537
7604
|
let i = r.filter((t) => t !== e);
|
|
7538
7605
|
i.length ? t.elementIndex.set(n, i) : t.elementIndex.delete(n);
|
|
7539
|
-
}),
|
|
7606
|
+
}), ou(i, a.modelID, e.elementBounds.keys()), t.records.delete(a), n.current.delete(a.mesh), r.current.delete(a);
|
|
7540
7607
|
}, []), c = a((e, t) => {
|
|
7541
7608
|
t.forEach((t, n) => {
|
|
7542
7609
|
let i = e.elementBounds.get(n);
|
|
@@ -7552,17 +7619,17 @@ function nu(e) {
|
|
|
7552
7619
|
}, []), l = a(() => {
|
|
7553
7620
|
let r = e.current, a = t.current;
|
|
7554
7621
|
if (!r) return a;
|
|
7555
|
-
a.indexedModel !== r && (n.current.clear(), a =
|
|
7622
|
+
a.indexedModel !== r && (n.current.clear(), a = Xl(), a.indexedModel = r, t.current = a), r.updateMatrixWorld(!0);
|
|
7556
7623
|
let l = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Map(), d = !1;
|
|
7557
7624
|
return r.traverse((e) => {
|
|
7558
|
-
if (!(e instanceof
|
|
7625
|
+
if (!(e instanceof F)) return;
|
|
7559
7626
|
let t = e, r = t.geometry, i = r.attributes.ids;
|
|
7560
7627
|
if (!r.index || !i) return;
|
|
7561
7628
|
l.add(t);
|
|
7562
7629
|
let c = n.current.get(t);
|
|
7563
|
-
if (c && c.geometry === r && c.idsAttribute === i && c.positionAttribute === r.attributes.position && c.record.modelID ===
|
|
7630
|
+
if (c && c.geometry === r && c.idsAttribute === i && c.positionAttribute === r.attributes.position && c.record.modelID === $l(t)) {
|
|
7564
7631
|
let { record: e } = c;
|
|
7565
|
-
e.originalBoundsTree ||=
|
|
7632
|
+
e.originalBoundsTree ||= hl(r, e.originalIndex), nu(c.matrixWorld, t.matrixWorld) || (ou(u, e.modelID, c.elementBounds.keys()), c.elementBounds = au(t, e, c.idsAttribute, c.positionAttribute, null), c.matrixWorld = t.matrixWorld.elements.slice(), ou(u, e.modelID, c.elementBounds.keys()), d = !0);
|
|
7566
7633
|
return;
|
|
7567
7634
|
}
|
|
7568
7635
|
c && s(c, a, u), o(t, a, u), d = !0;
|
|
@@ -7575,7 +7642,7 @@ function nu(e) {
|
|
|
7575
7642
|
s,
|
|
7576
7643
|
c
|
|
7577
7644
|
]), f = a(() => {
|
|
7578
|
-
n.current.clear(), t.current =
|
|
7645
|
+
n.current.clear(), t.current = Xl();
|
|
7579
7646
|
}, []);
|
|
7580
7647
|
return u(() => ({
|
|
7581
7648
|
buildIndex: l,
|
|
@@ -7584,79 +7651,79 @@ function nu(e) {
|
|
|
7584
7651
|
}
|
|
7585
7652
|
//#endregion
|
|
7586
7653
|
//#region src/viewer/utils/GeometryUtils/useGeometryUtils.ts
|
|
7587
|
-
function
|
|
7654
|
+
function cu(e, t) {
|
|
7588
7655
|
return e instanceof Uint32Array ? new Uint32Array(t) : new Uint16Array(t);
|
|
7589
7656
|
}
|
|
7590
|
-
function
|
|
7657
|
+
function lu(e) {
|
|
7591
7658
|
let t = e.geometry;
|
|
7592
7659
|
Object.assign(t, { boundsTree: void 0 }), e.geometry.index?.count && Object.assign(t, { boundsTree: new He(e.geometry, { indirect: !0 }) });
|
|
7593
7660
|
}
|
|
7594
|
-
function
|
|
7595
|
-
e.mesh.geometry.setIndex(new y(t, 1)), n &&
|
|
7661
|
+
function uu(e, t, n = !0) {
|
|
7662
|
+
e.mesh.geometry.setIndex(new y(t, 1)), n && lu(e.mesh);
|
|
7596
7663
|
}
|
|
7597
|
-
function
|
|
7664
|
+
function du(e, t) {
|
|
7598
7665
|
return e.initialVisible && (!e.isIfcSpace || t);
|
|
7599
7666
|
}
|
|
7600
|
-
function
|
|
7667
|
+
function fu(e, t) {
|
|
7601
7668
|
let n = e.mesh.geometry, r = n.index?.array;
|
|
7602
|
-
e.mesh.visible =
|
|
7669
|
+
e.mesh.visible = du(e, t), r !== e.originalIndex && uu(e, e.originalIndex, !1), e.originalBoundsTree ? Object.assign(n, { boundsTree: e.originalBoundsTree }) : (lu(e.mesh), e.originalBoundsTree = e.mesh.geometry.boundsTree ?? null);
|
|
7603
7670
|
}
|
|
7604
|
-
function
|
|
7671
|
+
function pu(e) {
|
|
7605
7672
|
return e === null ? "*" : e.size ? Array.from(e).sort((e, t) => e - t).join(",") : "";
|
|
7606
7673
|
}
|
|
7607
|
-
function
|
|
7608
|
-
return `h:${
|
|
7674
|
+
function mu(e, t, n, r) {
|
|
7675
|
+
return `h:${pu(e)}|i:${pu(n)}|s:${r ? Number(t) : ""}`;
|
|
7609
7676
|
}
|
|
7610
|
-
function
|
|
7677
|
+
function hu(e, t, n) {
|
|
7611
7678
|
return !t.has(e) && (!n || n.has(e));
|
|
7612
7679
|
}
|
|
7613
|
-
function
|
|
7680
|
+
function gu(e, t) {
|
|
7614
7681
|
Object.entries(e).forEach(([e, n]) => {
|
|
7615
7682
|
n.forEach((n) => t(Number(e), n));
|
|
7616
7683
|
});
|
|
7617
7684
|
}
|
|
7618
|
-
function
|
|
7685
|
+
function _u(e, t, n) {
|
|
7619
7686
|
e.hiddenIds.has(t) || (e.hiddenIds.add(t), n.add(e));
|
|
7620
7687
|
}
|
|
7621
|
-
function
|
|
7688
|
+
function vu(e, t, n) {
|
|
7622
7689
|
e && console.log(`${t}:`, Date.now() - n, "ms");
|
|
7623
7690
|
}
|
|
7624
|
-
function
|
|
7625
|
-
let { hiddenIds: i, originalIndex: a, triangleRanges: o } = e, s =
|
|
7691
|
+
function yu(e, t, n, r) {
|
|
7692
|
+
let { hiddenIds: i, originalIndex: a, triangleRanges: o } = e, s = mu(i, t, n, e.isIfcSpace);
|
|
7626
7693
|
if (e.visibleStateKey === s) return;
|
|
7627
7694
|
if (!i.size && !n) {
|
|
7628
|
-
|
|
7695
|
+
fu(e, t), e.visibleStateKey = s;
|
|
7629
7696
|
return;
|
|
7630
7697
|
}
|
|
7631
7698
|
let c = 0, l = 0;
|
|
7632
7699
|
if (o.forEach(({ count: e, id: t }) => {
|
|
7633
|
-
|
|
7700
|
+
hu(t, i, n) ? c += e * 3 : l += e * 3;
|
|
7634
7701
|
}), !c) {
|
|
7635
|
-
|
|
7702
|
+
fu(e, t), e.mesh.visible = !1, e.visibleStateKey = s;
|
|
7636
7703
|
return;
|
|
7637
7704
|
}
|
|
7638
7705
|
if (!l) {
|
|
7639
|
-
|
|
7706
|
+
fu(e, t), e.visibleStateKey = s;
|
|
7640
7707
|
return;
|
|
7641
7708
|
}
|
|
7642
|
-
e.mesh.visible =
|
|
7643
|
-
let u =
|
|
7709
|
+
e.mesh.visible = du(e, t);
|
|
7710
|
+
let u = cu(a, c), d = 0;
|
|
7644
7711
|
for (let e = 0; e < o.length; e++) {
|
|
7645
7712
|
let { count: t, id: r, start: s } = o[e];
|
|
7646
|
-
if (!
|
|
7713
|
+
if (!hu(r, i, n)) continue;
|
|
7647
7714
|
let c = s * 3, l = c + t * 3;
|
|
7648
7715
|
u.set(a.subarray(c, l), d), d += t * 3;
|
|
7649
7716
|
}
|
|
7650
|
-
r || (e.originalBoundsTree = null),
|
|
7717
|
+
r || (e.originalBoundsTree = null), uu(e, u), e.visibleStateKey = s;
|
|
7651
7718
|
}
|
|
7652
|
-
function
|
|
7719
|
+
function bu(e, t, n) {
|
|
7653
7720
|
let r = e.elementIndex.get(n);
|
|
7654
7721
|
if (!r) return;
|
|
7655
7722
|
let i = r.filter(({ record: e }) => e.modelID !== t);
|
|
7656
7723
|
i.length ? e.elementIndex.set(n, i) : e.elementIndex.delete(n);
|
|
7657
7724
|
}
|
|
7658
|
-
function
|
|
7659
|
-
let n =
|
|
7725
|
+
function xu(e, t) {
|
|
7726
|
+
let n = tu(e.mesh), r = !1;
|
|
7660
7727
|
if (t.forEach((t) => {
|
|
7661
7728
|
e.hiddenIds.delete(t), !n.has(t) && (n.add(t), r = !0);
|
|
7662
7729
|
}), !r) return !1;
|
|
@@ -7669,53 +7736,53 @@ function gu(e, t) {
|
|
|
7669
7736
|
start: a
|
|
7670
7737
|
}), a += e, o += e * 3);
|
|
7671
7738
|
});
|
|
7672
|
-
let s =
|
|
7739
|
+
let s = cu(e.originalIndex, o), c = 0;
|
|
7673
7740
|
return e.triangleRanges.forEach(({ count: t, id: r, start: i }) => {
|
|
7674
7741
|
if (n.has(r)) return;
|
|
7675
7742
|
let a = i * 3, o = a + t * 3;
|
|
7676
7743
|
s.set(e.originalIndex.subarray(a, o), c), c += t * 3;
|
|
7677
7744
|
}), e.originalBoundsTree = null, e.originalIndex = s, e.triangleRanges = i, e.visibleStateKey = "", !0;
|
|
7678
7745
|
}
|
|
7679
|
-
function
|
|
7746
|
+
function Su(e, t) {
|
|
7680
7747
|
return e.isolatedIdsByModel ? e.isolatedIdsByModel.get(t.modelID) ?? /* @__PURE__ */ new Set() : e.isolatedIds;
|
|
7681
7748
|
}
|
|
7682
|
-
function
|
|
7749
|
+
function Cu(e) {
|
|
7683
7750
|
let t = [];
|
|
7684
7751
|
return e?.children.forEach((e) => {
|
|
7685
|
-
e instanceof
|
|
7752
|
+
e instanceof A && typeof e.userData.modelID == "number" && t.push(e);
|
|
7686
7753
|
}), t;
|
|
7687
7754
|
}
|
|
7688
|
-
function
|
|
7755
|
+
function wu(e) {
|
|
7689
7756
|
let t = e.userData.trueNorthBaseMatrix;
|
|
7690
|
-
if (t instanceof
|
|
7757
|
+
if (t instanceof P) return t;
|
|
7691
7758
|
let n = e.matrix.clone();
|
|
7692
7759
|
return e.userData.trueNorthBaseMatrix = n, n;
|
|
7693
7760
|
}
|
|
7694
|
-
function
|
|
7695
|
-
let n = Number(e.userData.trueNorthAngle ?? 0), r =
|
|
7761
|
+
function Tu(e, t) {
|
|
7762
|
+
let n = Number(e.userData.trueNorthAngle ?? 0), r = Nl(wu(e), n, t);
|
|
7696
7763
|
e.matrix.copy(r), e.matrixAutoUpdate = !1, e.updateMatrixWorld(!0), e.userData.trueNorthEnabled = t, e.userData.geometryTransformVersion = (Number(e.userData.geometryTransformVersion) || 0) + 1;
|
|
7697
7764
|
}
|
|
7698
|
-
function
|
|
7765
|
+
function Eu(e) {
|
|
7699
7766
|
let t = G((e) => e.selected), n = G((e) => e.resetSelected), r = G((e) => e.showStats), i = G((e) => e.userDevice) === "pc", o = e.buildIndex, s = a(() => Array.from(o().elementIndex.keys()), [o]), c = a(() => o().ifcSpacesVisible, [o]), l = a((e, t) => {
|
|
7700
7767
|
let n = Date.now(), a = o(), s = /* @__PURE__ */ new Set();
|
|
7701
7768
|
t.forEach((t) => {
|
|
7702
7769
|
let n = a.elementIndex.get(t);
|
|
7703
7770
|
n && n.forEach(({ record: n }) => {
|
|
7704
|
-
n.modelID === e &&
|
|
7771
|
+
n.modelID === e && _u(n, t, s);
|
|
7705
7772
|
});
|
|
7706
|
-
}), s.forEach((e) =>
|
|
7773
|
+
}), s.forEach((e) => yu(e, a.ifcSpacesVisible, Su(a, e), i)), vu(r, "hideByIds", n);
|
|
7707
7774
|
}, [
|
|
7708
7775
|
o,
|
|
7709
7776
|
i,
|
|
7710
7777
|
r
|
|
7711
7778
|
]), u = a(() => {
|
|
7712
7779
|
let e = Date.now(), a = o(), s = /* @__PURE__ */ new Set();
|
|
7713
|
-
|
|
7780
|
+
gu(t, (e, t) => {
|
|
7714
7781
|
let n = a.elementIndex.get(t);
|
|
7715
7782
|
n && n.forEach(({ record: n }) => {
|
|
7716
|
-
n.modelID === e &&
|
|
7783
|
+
n.modelID === e && _u(n, t, s);
|
|
7717
7784
|
});
|
|
7718
|
-
}), s.forEach((e) =>
|
|
7785
|
+
}), s.forEach((e) => yu(e, a.ifcSpacesVisible, Su(a, e), i)), n(), vu(r, "hideSelected", e);
|
|
7719
7786
|
}, [
|
|
7720
7787
|
o,
|
|
7721
7788
|
i,
|
|
@@ -7729,14 +7796,14 @@ function xu(e) {
|
|
|
7729
7796
|
n && n.forEach(({ record: n }) => {
|
|
7730
7797
|
n.modelID === e && n.hiddenIds.delete(t) && s.add(n);
|
|
7731
7798
|
});
|
|
7732
|
-
}), s.forEach((e) =>
|
|
7799
|
+
}), s.forEach((e) => yu(e, a.ifcSpacesVisible, Su(a, e), i)), vu(r, "showByIds", n);
|
|
7733
7800
|
}, [
|
|
7734
7801
|
o,
|
|
7735
7802
|
i,
|
|
7736
7803
|
r
|
|
7737
7804
|
]), f = a((e, t) => {
|
|
7738
7805
|
let n = Date.now(), a = o();
|
|
7739
|
-
a.isolatedIdsByModel = new Map([[e, new Set(t)]]), a.isolatedIds = null, a.records.forEach((e) =>
|
|
7806
|
+
a.isolatedIdsByModel = new Map([[e, new Set(t)]]), a.isolatedIds = null, a.records.forEach((e) => yu(e, a.ifcSpacesVisible, Su(a, e), i)), vu(r, "isolateByIds", n);
|
|
7740
7807
|
}, [
|
|
7741
7808
|
o,
|
|
7742
7809
|
i,
|
|
@@ -7751,24 +7818,24 @@ function xu(e) {
|
|
|
7751
7818
|
t.modelID === e && c.add(t);
|
|
7752
7819
|
});
|
|
7753
7820
|
}), !c.size) {
|
|
7754
|
-
|
|
7821
|
+
vu(r, "removeByIds", n);
|
|
7755
7822
|
return;
|
|
7756
7823
|
}
|
|
7757
7824
|
c.forEach((e) => {
|
|
7758
|
-
|
|
7825
|
+
xu(e, s);
|
|
7759
7826
|
}), s.forEach((t) => {
|
|
7760
|
-
|
|
7761
|
-
}), c.forEach((e) =>
|
|
7827
|
+
bu(a, e, t), a.elementBounds.get(e)?.delete(t), a.isolatedIds?.delete(t), a.isolatedIdsByModel?.get(e)?.delete(t);
|
|
7828
|
+
}), c.forEach((e) => yu(e, a.ifcSpacesVisible, Su(a, e), i)), vu(r, "removeByIds", n);
|
|
7762
7829
|
}, [
|
|
7763
7830
|
o,
|
|
7764
7831
|
i,
|
|
7765
7832
|
r
|
|
7766
7833
|
]), m = a(() => {
|
|
7767
7834
|
let e = Date.now(), n = o(), a = /* @__PURE__ */ new Map();
|
|
7768
|
-
|
|
7835
|
+
gu(t, (e, t) => {
|
|
7769
7836
|
let n = a.get(e);
|
|
7770
7837
|
n || (n = /* @__PURE__ */ new Set(), a.set(e, n)), n.add(t);
|
|
7771
|
-
}), n.isolatedIdsByModel = a, n.isolatedIds = null, n.records.forEach((e) =>
|
|
7838
|
+
}), n.isolatedIdsByModel = a, n.isolatedIds = null, n.records.forEach((e) => yu(e, n.ifcSpacesVisible, Su(n, e), i)), vu(r, "isolateSelected", e);
|
|
7772
7839
|
}, [
|
|
7773
7840
|
o,
|
|
7774
7841
|
i,
|
|
@@ -7776,7 +7843,7 @@ function xu(e) {
|
|
|
7776
7843
|
r
|
|
7777
7844
|
]), h = a(() => {
|
|
7778
7845
|
let e = Date.now(), t = o();
|
|
7779
|
-
t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) =>
|
|
7846
|
+
t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => yu(e, t.ifcSpacesVisible, Su(t, e), i)), vu(r, "resetIsolation", e);
|
|
7780
7847
|
}, [
|
|
7781
7848
|
o,
|
|
7782
7849
|
i,
|
|
@@ -7784,7 +7851,7 @@ function xu(e) {
|
|
|
7784
7851
|
]), g = a((e) => {
|
|
7785
7852
|
let t = o();
|
|
7786
7853
|
t.ifcSpacesVisible !== e && (t.ifcSpacesVisible = e, t.records.forEach((e) => {
|
|
7787
|
-
e.isIfcSpace &&
|
|
7854
|
+
e.isIfcSpace && yu(e, t.ifcSpacesVisible, Su(t, e), i);
|
|
7788
7855
|
}));
|
|
7789
7856
|
}, [o, i]), _ = a(() => {
|
|
7790
7857
|
g(!c());
|
|
@@ -7806,8 +7873,8 @@ function xu(e) {
|
|
|
7806
7873
|
showAll: a(() => {
|
|
7807
7874
|
let e = Date.now(), t = o();
|
|
7808
7875
|
t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => {
|
|
7809
|
-
e.hiddenIds.clear(),
|
|
7810
|
-
}),
|
|
7876
|
+
e.hiddenIds.clear(), yu(e, t.ifcSpacesVisible, Su(t, e), i);
|
|
7877
|
+
}), vu(r, "showAll", e);
|
|
7811
7878
|
}, [
|
|
7812
7879
|
o,
|
|
7813
7880
|
i,
|
|
@@ -7816,24 +7883,24 @@ function xu(e) {
|
|
|
7816
7883
|
showByIds: d,
|
|
7817
7884
|
toggleIIfcSpacesVisibility: _,
|
|
7818
7885
|
useTrueNorth: a((t = !0) => {
|
|
7819
|
-
let n =
|
|
7820
|
-
n.length && (n.forEach((e) =>
|
|
7886
|
+
let n = Cu(o().indexedModel);
|
|
7887
|
+
n.length && (n.forEach((e) => Tu(e, t)), e.resetIndex());
|
|
7821
7888
|
}, [o, e])
|
|
7822
7889
|
};
|
|
7823
7890
|
}
|
|
7824
7891
|
//#endregion
|
|
7825
7892
|
//#region src/viewer/utils/ClippingUtils/PlaneHelper.ts
|
|
7826
|
-
var
|
|
7827
|
-
function
|
|
7893
|
+
var Du = "#0b2f5f", Ou = "#0b2f5f", ku = 0, Au = "#165eb0", ju = .3, Mu = .01, Nu = .025, Pu = .015, Fu = .02, Iu = 1e-7, Lu = .25, Ru = .15, zu = .25, Bu = 1e-5, Vu = .2, Hu = 1, Uu = 1;
|
|
7894
|
+
function Wu(e, t) {
|
|
7828
7895
|
let n = t.getBoundingClientRect();
|
|
7829
7896
|
return new H((e.clientX - n.left) / n.width * 2 - 1, -((e.clientY - n.top) / n.height) * 2 + 1);
|
|
7830
7897
|
}
|
|
7831
|
-
function
|
|
7898
|
+
function Gu(e) {
|
|
7832
7899
|
let t = e.getSize(new U());
|
|
7833
|
-
return Math.max(
|
|
7900
|
+
return Math.max(zu, t.length() * Mu);
|
|
7834
7901
|
}
|
|
7835
|
-
var
|
|
7836
|
-
helper = new
|
|
7902
|
+
var Ku = class extends oe {
|
|
7903
|
+
helper = new A();
|
|
7837
7904
|
borderMaterial;
|
|
7838
7905
|
material;
|
|
7839
7906
|
plane;
|
|
@@ -7851,16 +7918,16 @@ var Vu = class extends se {
|
|
|
7851
7918
|
hovered = !1;
|
|
7852
7919
|
listenersActive = !1;
|
|
7853
7920
|
constructor(e, t, n, r) {
|
|
7854
|
-
super(), this.context = e, this.plane = t, this.location = n.clone(), this.normal = r.clone().normalize(), this.material = new
|
|
7855
|
-
color:
|
|
7921
|
+
super(), this.context = e, this.plane = t, this.location = n.clone(), this.normal = r.clone().normalize(), this.material = new I({
|
|
7922
|
+
color: Ou,
|
|
7856
7923
|
depthWrite: !1,
|
|
7857
|
-
opacity:
|
|
7924
|
+
opacity: ku,
|
|
7858
7925
|
side: E,
|
|
7859
7926
|
transparent: !0
|
|
7860
7927
|
}), this.helper.position.copy(this.location), this.applyPlaneOrientation(), this.layout = this.getHelperLayout();
|
|
7861
|
-
let i = Math.max(
|
|
7862
|
-
this.borderMaterial = new
|
|
7863
|
-
color:
|
|
7928
|
+
let i = Math.max(Lu, Math.min(this.layout.width, this.layout.height) * Nu), a = Math.max(Ru, Math.min(this.layout.width, this.layout.height) * Pu);
|
|
7929
|
+
this.borderMaterial = new N({
|
|
7930
|
+
color: Du,
|
|
7864
7931
|
dashSize: i,
|
|
7865
7932
|
depthWrite: !1,
|
|
7866
7933
|
gapSize: a
|
|
@@ -7891,7 +7958,7 @@ var Vu = class extends se {
|
|
|
7891
7958
|
}
|
|
7892
7959
|
updateBorderDash() {
|
|
7893
7960
|
let e = Math.min(this.layout.width, this.layout.height);
|
|
7894
|
-
this.borderMaterial.dashSize = Math.max(
|
|
7961
|
+
this.borderMaterial.dashSize = Math.max(Lu, e * Nu), this.borderMaterial.gapSize = Math.max(Ru, e * Pu), this.borderMaterial.needsUpdate = !0;
|
|
7895
7962
|
}
|
|
7896
7963
|
addEventListeners() {
|
|
7897
7964
|
if (this.listenersActive) return;
|
|
@@ -7934,7 +8001,7 @@ var Vu = class extends se {
|
|
|
7934
8001
|
hasModelIntersection(e) {
|
|
7935
8002
|
return !!this.context.getCameraUtils().getIntersection(!0, {
|
|
7936
8003
|
event: e,
|
|
7937
|
-
filter: (e) => !(e.object instanceof
|
|
8004
|
+
filter: (e) => !(e.object instanceof F) || e.faceIndex === void 0 || e.faceIndex === null ? !1 : !!(e.object.geometry.index && e.object.geometry.attributes.ids),
|
|
7938
8005
|
object: this.context.getMeshes(),
|
|
7939
8006
|
recursive: !1
|
|
7940
8007
|
});
|
|
@@ -7953,10 +8020,10 @@ var Vu = class extends se {
|
|
|
7953
8020
|
return !1;
|
|
7954
8021
|
}
|
|
7955
8022
|
getEdgeInteractionWidth() {
|
|
7956
|
-
return Math.min(
|
|
8023
|
+
return Math.min(Hu, Math.max(Vu, Math.min(this.layout.width, this.layout.height) * Fu));
|
|
7957
8024
|
}
|
|
7958
8025
|
getDragDistanceEpsilon() {
|
|
7959
|
-
return Math.max(
|
|
8026
|
+
return Math.max(Bu, Math.min(this.layout.width, this.layout.height) * Iu);
|
|
7960
8027
|
}
|
|
7961
8028
|
getPointToSegmentDistanceSquared(e, t, n) {
|
|
7962
8029
|
let r = n.x - t.x, i = n.y - t.y, a = r * r + i * i;
|
|
@@ -7969,7 +8036,7 @@ var Vu = class extends se {
|
|
|
7969
8036
|
}
|
|
7970
8037
|
getPointerPointOnPlane(e, t) {
|
|
7971
8038
|
let n = this.context.getDomElement();
|
|
7972
|
-
this.pointer.copy(
|
|
8039
|
+
this.pointer.copy(Wu(e, n));
|
|
7973
8040
|
let r = this.context.getRaycaster(), i = new U();
|
|
7974
8041
|
return r.setFromCamera(this.pointer, this.context.getCamera()), r.ray.intersectPlane(t, i);
|
|
7975
8042
|
}
|
|
@@ -8022,14 +8089,14 @@ var Vu = class extends se {
|
|
|
8022
8089
|
t && (this.context.clearHelpersHover(this), this.hasHelperPriority(e) && this.stopHelperPriorityEvent(e)), this.hovered !== t && this.setHovered(t);
|
|
8023
8090
|
}
|
|
8024
8091
|
setHovered(e) {
|
|
8025
|
-
this.hovered = e, this.material.color.set(e ?
|
|
8092
|
+
this.hovered = e, this.material.color.set(e ? Au : Ou), this.material.opacity = e ? ju : ku, this.material.needsUpdate = !0;
|
|
8026
8093
|
}
|
|
8027
8094
|
createPlaneMesh() {
|
|
8028
|
-
let e = new
|
|
8095
|
+
let e = new F(new b(), this.material);
|
|
8029
8096
|
return e.renderOrder = 2, e;
|
|
8030
8097
|
}
|
|
8031
8098
|
createBorder() {
|
|
8032
|
-
let e = new
|
|
8099
|
+
let e = new te(new b(), this.borderMaterial);
|
|
8033
8100
|
return e.renderOrder = 3, e;
|
|
8034
8101
|
}
|
|
8035
8102
|
replaceGeometry(e, t) {
|
|
@@ -8044,7 +8111,7 @@ var Vu = class extends se {
|
|
|
8044
8111
|
n.push(t.x, t.y, 0, i.x, i.y, 0, a.x, a.y, 0);
|
|
8045
8112
|
}
|
|
8046
8113
|
}
|
|
8047
|
-
return t.setAttribute("position", new
|
|
8114
|
+
return t.setAttribute("position", new k(n, 3)), n.length && t.computeBoundingSphere(), t;
|
|
8048
8115
|
}
|
|
8049
8116
|
createBorderGeometry(e) {
|
|
8050
8117
|
let t = new b(), n = [];
|
|
@@ -8052,7 +8119,7 @@ var Vu = class extends se {
|
|
|
8052
8119
|
let r = e[t], i = e[(t + 1) % e.length];
|
|
8053
8120
|
n.push(r.x, r.y, 0, i.x, i.y, 0);
|
|
8054
8121
|
}
|
|
8055
|
-
return t.setAttribute("position", new
|
|
8122
|
+
return t.setAttribute("position", new k(n, 3)), n.length && t.computeBoundingSphere(), t;
|
|
8056
8123
|
}
|
|
8057
8124
|
getClippedPolygon() {
|
|
8058
8125
|
let e = this.getPlaneBasis(), t = [
|
|
@@ -8098,12 +8165,12 @@ var Vu = class extends se {
|
|
|
8098
8165
|
getHelperLayout() {
|
|
8099
8166
|
let e = this.getModelWorldBox();
|
|
8100
8167
|
if (!e || e.isEmpty()) return {
|
|
8101
|
-
height:
|
|
8102
|
-
maxU:
|
|
8103
|
-
maxV:
|
|
8104
|
-
minU: -
|
|
8105
|
-
minV: -
|
|
8106
|
-
width:
|
|
8168
|
+
height: Uu,
|
|
8169
|
+
maxU: Uu / 2,
|
|
8170
|
+
maxV: Uu / 2,
|
|
8171
|
+
minU: -Uu / 2,
|
|
8172
|
+
minV: -Uu / 2,
|
|
8173
|
+
width: Uu
|
|
8107
8174
|
};
|
|
8108
8175
|
let t = this.getPlaneBasis(), n = this.helper.position, r = this.getBoxCorners(e), i = new U(), a = new U(), o = Infinity, s = -Infinity, c = Infinity, l = -Infinity;
|
|
8109
8176
|
if (r.forEach((e) => {
|
|
@@ -8111,14 +8178,14 @@ var Vu = class extends se {
|
|
|
8111
8178
|
let r = a.dot(t.u), u = a.dot(t.v);
|
|
8112
8179
|
o = Math.min(o, r), s = Math.max(s, r), c = Math.min(c, u), l = Math.max(l, u);
|
|
8113
8180
|
}), !Number.isFinite(o) || !Number.isFinite(s) || !Number.isFinite(c) || !Number.isFinite(l)) return {
|
|
8114
|
-
height:
|
|
8115
|
-
maxU:
|
|
8116
|
-
maxV:
|
|
8117
|
-
minU: -
|
|
8118
|
-
minV: -
|
|
8119
|
-
width:
|
|
8181
|
+
height: Uu,
|
|
8182
|
+
maxU: Uu / 2,
|
|
8183
|
+
maxV: Uu / 2,
|
|
8184
|
+
minU: -Uu / 2,
|
|
8185
|
+
minV: -Uu / 2,
|
|
8186
|
+
width: Uu
|
|
8120
8187
|
};
|
|
8121
|
-
let u =
|
|
8188
|
+
let u = Gu(e), d = o - u, f = s + u, p = c - u, m = l + u, h = Math.max(Uu, f - d), g = Math.max(Uu, m - p), _ = (d + f) / 2, v = (p + m) / 2;
|
|
8122
8189
|
return {
|
|
8123
8190
|
height: g,
|
|
8124
8191
|
maxU: _ + h / 2,
|
|
@@ -8136,7 +8203,7 @@ var Vu = class extends se {
|
|
|
8136
8203
|
};
|
|
8137
8204
|
}
|
|
8138
8205
|
applyPlaneOrientation() {
|
|
8139
|
-
let e = this.getPlaneBasis(), t = new
|
|
8206
|
+
let e = this.getPlaneBasis(), t = new P().makeBasis(e.u, e.v, this.normal);
|
|
8140
8207
|
this.helper.quaternion.setFromRotationMatrix(t);
|
|
8141
8208
|
}
|
|
8142
8209
|
getModelWorldBox() {
|
|
@@ -8159,8 +8226,8 @@ var Vu = class extends se {
|
|
|
8159
8226
|
new U(e.max.x, e.max.y, e.max.z)
|
|
8160
8227
|
];
|
|
8161
8228
|
}
|
|
8162
|
-
},
|
|
8163
|
-
function
|
|
8229
|
+
}, qu = 250, Ju = "#a9a9a9", Yu = new U(0, 0, -1), Xu = "__bimatterCameraMotionHidden";
|
|
8230
|
+
function Zu(e, t) {
|
|
8164
8231
|
if (Array.isArray(e)) {
|
|
8165
8232
|
e.forEach((e) => {
|
|
8166
8233
|
e.clippingPlanes = t, e.needsUpdate = !0;
|
|
@@ -8169,13 +8236,13 @@ function Ku(e, t) {
|
|
|
8169
8236
|
}
|
|
8170
8237
|
e.clippingPlanes = t, e.needsUpdate = !0;
|
|
8171
8238
|
}
|
|
8172
|
-
function
|
|
8239
|
+
function Qu(e) {
|
|
8173
8240
|
let t = [];
|
|
8174
8241
|
return e?.traverse((e) => {
|
|
8175
|
-
e instanceof
|
|
8242
|
+
e instanceof F && (!e.geometry.index || !e.geometry.attributes.ids || t.push(e));
|
|
8176
8243
|
}), t;
|
|
8177
8244
|
}
|
|
8178
|
-
function
|
|
8245
|
+
function $u(e) {
|
|
8179
8246
|
let t = e;
|
|
8180
8247
|
for (; t;) {
|
|
8181
8248
|
let e = t.userData.modelID;
|
|
@@ -8184,14 +8251,14 @@ function Ju(e) {
|
|
|
8184
8251
|
}
|
|
8185
8252
|
return 0;
|
|
8186
8253
|
}
|
|
8187
|
-
function
|
|
8254
|
+
function ed(e, t, n) {
|
|
8188
8255
|
let r = e;
|
|
8189
8256
|
r && (r.isClippingGroup = n, r.enabled = n && t.length > 0, r.clipIntersection = !1, r.clipShadows = !1, r.clippingPlanes = n ? t : []);
|
|
8190
8257
|
}
|
|
8191
|
-
function
|
|
8258
|
+
function td(e, t) {
|
|
8192
8259
|
return t.clone().transformDirection(e.matrixWorld).normalize();
|
|
8193
8260
|
}
|
|
8194
|
-
function
|
|
8261
|
+
function nd(e) {
|
|
8195
8262
|
if (!e) return null;
|
|
8196
8263
|
if ("x" in e) {
|
|
8197
8264
|
let t = new U(e.x, e.y, e.z);
|
|
@@ -8200,7 +8267,7 @@ function Zu(e) {
|
|
|
8200
8267
|
let t = new U(e[0], e[1], e[2]);
|
|
8201
8268
|
return Number.isFinite(t.x + t.y + t.z) ? t : null;
|
|
8202
8269
|
}
|
|
8203
|
-
var
|
|
8270
|
+
var rd = class {
|
|
8204
8271
|
planes = [];
|
|
8205
8272
|
caps = [];
|
|
8206
8273
|
edges = [];
|
|
@@ -8208,7 +8275,7 @@ var Qu = class {
|
|
|
8208
8275
|
active = !1;
|
|
8209
8276
|
capsActive = !0;
|
|
8210
8277
|
capsCameraMotionActive = !1;
|
|
8211
|
-
capsColor =
|
|
8278
|
+
capsColor = Ju;
|
|
8212
8279
|
context;
|
|
8213
8280
|
edgesActive = !0;
|
|
8214
8281
|
edgesCameraMotionActive = !1;
|
|
@@ -8265,13 +8332,13 @@ var Qu = class {
|
|
|
8265
8332
|
return this.context.controlRef;
|
|
8266
8333
|
}
|
|
8267
8334
|
getMeshes() {
|
|
8268
|
-
return
|
|
8335
|
+
return Qu(this.context.modelRef.current);
|
|
8269
8336
|
}
|
|
8270
8337
|
getPlanVisualObjects() {
|
|
8271
|
-
return [...this.caps.map((e) => e.getObject()).filter((e) => e.visible || e.userData[
|
|
8338
|
+
return [...this.caps.map((e) => e.getObject()).filter((e) => e.visible || e.userData[Xu]), ...this.edges.flatMap((e) => e.getObjects(!0))];
|
|
8272
8339
|
}
|
|
8273
8340
|
getObjectModelID(e) {
|
|
8274
|
-
return
|
|
8341
|
+
return $u(e);
|
|
8275
8342
|
}
|
|
8276
8343
|
getEdgeSegmentsForPlane(e) {
|
|
8277
8344
|
return this.edgesActive ? this.edges.find((t) => t.plane === e && t.active)?.getIntersectionSegments() ?? null : null;
|
|
@@ -8310,12 +8377,12 @@ var Qu = class {
|
|
|
8310
8377
|
if (this.capsCameraMotionActive !== e) {
|
|
8311
8378
|
if (this.capsCameraMotionActive = e, e) {
|
|
8312
8379
|
this.clearCapsDragIdleTimeout(), this.caps.forEach((e) => {
|
|
8313
|
-
e.getObject().userData[
|
|
8380
|
+
e.getObject().userData[Xu] = !0, e.setVisible(!1);
|
|
8314
8381
|
}), this.context.onVisualChange?.();
|
|
8315
8382
|
return;
|
|
8316
8383
|
}
|
|
8317
8384
|
this.caps.forEach((e) => {
|
|
8318
|
-
delete e.getObject().userData[
|
|
8385
|
+
delete e.getObject().userData[Xu], e.setVisible(this.active && this.capsActive && !this.capsDragActive);
|
|
8319
8386
|
}), this.context.onVisualChange?.();
|
|
8320
8387
|
}
|
|
8321
8388
|
}
|
|
@@ -8330,7 +8397,7 @@ var Qu = class {
|
|
|
8330
8397
|
this.capsDragIdleTimeout = null, !(!this.active || !this.capsDragActive || this.capsCameraMotionActive) && (this.flushEdgesUpdate(), this.caps.forEach((e) => {
|
|
8331
8398
|
e.setVisible(!0), e.update();
|
|
8332
8399
|
}), this.updateCapsVisualState());
|
|
8333
|
-
},
|
|
8400
|
+
}, qu));
|
|
8334
8401
|
}
|
|
8335
8402
|
clearCapsDragIdleTimeout() {
|
|
8336
8403
|
this.capsDragIdleTimeout !== null && (window.clearTimeout(this.capsDragIdleTimeout), this.capsDragIdleTimeout = null);
|
|
@@ -8360,7 +8427,7 @@ var Qu = class {
|
|
|
8360
8427
|
getSelectedWorldBox() {
|
|
8361
8428
|
let e = this.context.viewerStore.getState().selected, t = new _(), n = new U();
|
|
8362
8429
|
return this.getMeshes().forEach((r) => {
|
|
8363
|
-
let i = e[
|
|
8430
|
+
let i = e[$u(r)];
|
|
8364
8431
|
if (!i?.size) return;
|
|
8365
8432
|
let a = r.geometry.attributes.ids, o = r.geometry.attributes.position;
|
|
8366
8433
|
if (!a || !o) return;
|
|
@@ -8376,10 +8443,13 @@ var Qu = class {
|
|
|
8376
8443
|
setSelectionInteractionDisabled(e) {
|
|
8377
8444
|
this.context.viewerStore.getState().setSelectionInteractionDisabled(e);
|
|
8378
8445
|
}
|
|
8446
|
+
getMaterialPlanes() {
|
|
8447
|
+
return this.active ? this.planes : [];
|
|
8448
|
+
}
|
|
8379
8449
|
updateMaterials() {
|
|
8380
|
-
let e = this.
|
|
8381
|
-
|
|
8382
|
-
|
|
8450
|
+
let e = this.getMaterialPlanes();
|
|
8451
|
+
ed(this.context.modelRef.current, e, this.context.useWebGPU), this.getMeshes().forEach((t) => {
|
|
8452
|
+
Zu(t.material, e);
|
|
8383
8453
|
}), this.context.camera.updateMatrixWorld();
|
|
8384
8454
|
}
|
|
8385
8455
|
setActive(e) {
|
|
@@ -8398,13 +8468,13 @@ var Qu = class {
|
|
|
8398
8468
|
recursive: !1
|
|
8399
8469
|
});
|
|
8400
8470
|
if (!n?.face) return null;
|
|
8401
|
-
let r = n.point.clone(), i =
|
|
8471
|
+
let r = n.point.clone(), i = td(n.object, n.face.normal);
|
|
8402
8472
|
r.add(i.clone().multiplyScalar(.001));
|
|
8403
8473
|
let a = new ce().setFromNormalAndCoplanarPoint(i.clone().negate(), r);
|
|
8404
8474
|
return this.addPlane(a, r, i), a.clone();
|
|
8405
8475
|
}
|
|
8406
8476
|
createPlaneFromPointAndNormal(e, t) {
|
|
8407
|
-
let n = typeof e == "number" ? this.getPointFromZ(e) :
|
|
8477
|
+
let n = typeof e == "number" ? this.getPointFromZ(e) : nd(e), r = nd(t ?? (typeof e == "number" ? Yu : void 0));
|
|
8408
8478
|
if (!n || !r || r.lengthSq() === 0) return null;
|
|
8409
8479
|
r.normalize();
|
|
8410
8480
|
let i = new ce().setFromNormalAndCoplanarPoint(r, n);
|
|
@@ -8413,7 +8483,7 @@ var Qu = class {
|
|
|
8413
8483
|
createClippingRectangle(e = !1) {
|
|
8414
8484
|
let t = e ? this.getSelectedWorldBox() : this.getModelWorldBox();
|
|
8415
8485
|
if (!t) return [];
|
|
8416
|
-
let n =
|
|
8486
|
+
let n = Gu(t), r = t.min.clone().addScalar(-n), i = t.max.clone().addScalar(n), a = t.getCenter(new U()), o = [
|
|
8417
8487
|
{
|
|
8418
8488
|
normal: new U(1, 0, 0),
|
|
8419
8489
|
point: new U(r.x, a.y, a.z)
|
|
@@ -8453,7 +8523,7 @@ var Qu = class {
|
|
|
8453
8523
|
return new U(t?.x ?? 0, t?.y ?? 0, e);
|
|
8454
8524
|
}
|
|
8455
8525
|
addPlane(e, t, n) {
|
|
8456
|
-
if (this.active || this.setActive(!0), this.planes.push(e), new
|
|
8526
|
+
if (this.active || this.setActive(!0), this.planes.push(e), new Ku(this, e, t, n), this.edgesActive) {
|
|
8457
8527
|
let t = new Ns(this, e);
|
|
8458
8528
|
t.create(), t.update();
|
|
8459
8529
|
}
|
|
@@ -8512,9 +8582,9 @@ var Qu = class {
|
|
|
8512
8582
|
this.clearCapsDragIdleTimeout(), this.deleteAllPlanes();
|
|
8513
8583
|
}
|
|
8514
8584
|
};
|
|
8515
|
-
function
|
|
8585
|
+
function id(e, t, n, r = !1, i) {
|
|
8516
8586
|
let a = g((e) => e.camera), o = g((e) => e.gl), c = g((e) => e.raycaster), l = g((e) => e.scene), f = nt(), p = d(null);
|
|
8517
|
-
p.current ||= new
|
|
8587
|
+
p.current ||= new rd({
|
|
8518
8588
|
camera: a,
|
|
8519
8589
|
cameraUtils: n,
|
|
8520
8590
|
controlRef: t,
|
|
@@ -8575,6 +8645,7 @@ function $u(e, t, n, r = !1, i) {
|
|
|
8575
8645
|
getCapsColor: () => m.getCapsColor(),
|
|
8576
8646
|
getEdgesActive: () => m.getEdgesActive(),
|
|
8577
8647
|
getHelpersActive: () => m.getHelpersActive(),
|
|
8648
|
+
getMaterialPlanes: () => m.getMaterialPlanes(),
|
|
8578
8649
|
getPlanes: () => m.getPlanes(),
|
|
8579
8650
|
getPlanVisualObjects: () => m.getPlanVisualObjects(),
|
|
8580
8651
|
setActive: (e) => m.setActive(e),
|
|
@@ -8595,15 +8666,15 @@ function $u(e, t, n, r = !1, i) {
|
|
|
8595
8666
|
}
|
|
8596
8667
|
//#endregion
|
|
8597
8668
|
//#region src/viewer/utils/Hotkeys/useHotkeysUtils.tsx
|
|
8598
|
-
function
|
|
8669
|
+
function ad(e) {
|
|
8599
8670
|
return e instanceof HTMLElement ? e.isContentEditable || e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement : !1;
|
|
8600
8671
|
}
|
|
8601
|
-
function
|
|
8672
|
+
function od(e = !0) {
|
|
8602
8673
|
let t = G((e) => e.api), n = G((e) => e.defaultHotkeysEnabled);
|
|
8603
8674
|
s(() => {
|
|
8604
8675
|
if (!e || !n) return;
|
|
8605
8676
|
let r = (e) => {
|
|
8606
|
-
|
|
8677
|
+
ad(e.target) || (e.code === "KeyI" && t?.geometryUtils.isolateSelected(), e.code === "KeyH" && t?.geometryUtils.hideSelected(), e.code === "KeyC" && t?.geometryUtils.showAll(), e.code === "KeyP" && t?.clipping.createPlane(), e.code === "KeyM" && t?.dimensions.toggle(), e.code === "KeyN" && t?.notes.toggleNodeMode(), t?.notes.getNodeModeActive() && (e.code === "Digit1" && (e.preventDefault(), t.notes.createMarkupCloud()), e.code === "Digit2" && (e.preventDefault(), t.notes.createComment())));
|
|
8607
8678
|
};
|
|
8608
8679
|
return window.addEventListener("keydown", r), () => {
|
|
8609
8680
|
window.removeEventListener("keydown", r);
|
|
@@ -8616,7 +8687,7 @@ function td(e = !0) {
|
|
|
8616
8687
|
}
|
|
8617
8688
|
//#endregion
|
|
8618
8689
|
//#region src/viewer/Selector/SelectionBox.ts
|
|
8619
|
-
var
|
|
8690
|
+
var sd = [
|
|
8620
8691
|
[0, 1],
|
|
8621
8692
|
[2, 3],
|
|
8622
8693
|
[4, 5],
|
|
@@ -8629,13 +8700,13 @@ var nd = [
|
|
|
8629
8700
|
[1, 5],
|
|
8630
8701
|
[2, 6],
|
|
8631
8702
|
[3, 7]
|
|
8632
|
-
],
|
|
8703
|
+
], cd = new Float64Array(24), ld = new Float64Array(9), ud = new Float64Array(12), dd = [
|
|
8633
8704
|
new H(),
|
|
8634
8705
|
new H(),
|
|
8635
8706
|
new H(),
|
|
8636
8707
|
new H()
|
|
8637
|
-
],
|
|
8638
|
-
function
|
|
8708
|
+
], fd = new U(), pd = new U(), md = new U(), hd = new U(), gd = new U(), _d = new U(), vd = new U();
|
|
8709
|
+
function yd(e) {
|
|
8639
8710
|
let t = e;
|
|
8640
8711
|
for (; t;) {
|
|
8641
8712
|
let e = t.modelID ?? t.userData.modelID;
|
|
@@ -8644,7 +8715,7 @@ function md(e) {
|
|
|
8644
8715
|
}
|
|
8645
8716
|
return 0;
|
|
8646
8717
|
}
|
|
8647
|
-
function
|
|
8718
|
+
function bd(e) {
|
|
8648
8719
|
let t = e;
|
|
8649
8720
|
for (; t;) {
|
|
8650
8721
|
if (!t.visible) return !1;
|
|
@@ -8652,16 +8723,16 @@ function hd(e) {
|
|
|
8652
8723
|
}
|
|
8653
8724
|
return !0;
|
|
8654
8725
|
}
|
|
8655
|
-
function
|
|
8656
|
-
return n.length ? (
|
|
8726
|
+
function xd(e, t, n) {
|
|
8727
|
+
return n.length ? (fd.copy(t).applyMatrix4(e.matrixWorld), oo(fd, n)) : !0;
|
|
8657
8728
|
}
|
|
8658
|
-
function
|
|
8659
|
-
return i.length ? (
|
|
8660
|
-
let t = e.distanceToPoint(
|
|
8729
|
+
function Sd(e, t, n, r, i) {
|
|
8730
|
+
return i.length ? (pd.copy(t).applyMatrix4(e.matrixWorld), md.copy(n).applyMatrix4(e.matrixWorld), hd.copy(r).applyMatrix4(e.matrixWorld), i.every((e) => {
|
|
8731
|
+
let t = e.distanceToPoint(pd), n = e.distanceToPoint(md), r = e.distanceToPoint(hd);
|
|
8661
8732
|
return !(t < -1e-6 && n < -1e-6 && r < -1e-6);
|
|
8662
8733
|
})) : !0;
|
|
8663
8734
|
}
|
|
8664
|
-
function
|
|
8735
|
+
function Cd(e) {
|
|
8665
8736
|
let t = e.getBoundingClientRect();
|
|
8666
8737
|
return {
|
|
8667
8738
|
height: t.height,
|
|
@@ -8670,7 +8741,7 @@ function vd(e) {
|
|
|
8670
8741
|
width: t.width
|
|
8671
8742
|
};
|
|
8672
8743
|
}
|
|
8673
|
-
function
|
|
8744
|
+
function wd(e) {
|
|
8674
8745
|
return {
|
|
8675
8746
|
boundsCheckMs: 0,
|
|
8676
8747
|
candidateIds: 0,
|
|
@@ -8696,7 +8767,7 @@ function yd(e) {
|
|
|
8696
8767
|
triangleProjectionMs: 0
|
|
8697
8768
|
};
|
|
8698
8769
|
}
|
|
8699
|
-
function
|
|
8770
|
+
function Td(e, t) {
|
|
8700
8771
|
return {
|
|
8701
8772
|
minX: Math.min(e.x, t.x),
|
|
8702
8773
|
minY: Math.min(e.y, t.y),
|
|
@@ -8704,152 +8775,152 @@ function bd(e, t) {
|
|
|
8704
8775
|
maxY: Math.max(e.y, t.y)
|
|
8705
8776
|
};
|
|
8706
8777
|
}
|
|
8707
|
-
function
|
|
8778
|
+
function Ed(e, t) {
|
|
8708
8779
|
return t.x >= e.x ? "contains" : "intersects";
|
|
8709
8780
|
}
|
|
8710
|
-
function
|
|
8711
|
-
return
|
|
8781
|
+
function Dd(e, t) {
|
|
8782
|
+
return Od(e.x, e.y, t);
|
|
8712
8783
|
}
|
|
8713
|
-
function
|
|
8784
|
+
function Od(e, t, n) {
|
|
8714
8785
|
return e >= n.minX && e <= n.maxX && t >= n.minY && t <= n.maxY;
|
|
8715
8786
|
}
|
|
8716
|
-
function
|
|
8787
|
+
function kd(e, t, n, r, i, a) {
|
|
8717
8788
|
return (a - t) * (n - e) > (r - t) * (i - e);
|
|
8718
8789
|
}
|
|
8719
|
-
function
|
|
8720
|
-
return
|
|
8790
|
+
function Ad(e, t, n, r, i, a, o, s) {
|
|
8791
|
+
return kd(e, t, i, a, o, s) !== kd(n, r, i, a, o, s) && kd(e, t, n, r, i, a) !== kd(e, t, n, r, o, s);
|
|
8721
8792
|
}
|
|
8722
|
-
function
|
|
8793
|
+
function jd(e, t, n, r, i) {
|
|
8723
8794
|
let a = .5 * (-r.y * i.x + n.y * (-r.x + i.x) + n.x * (r.y - i.y) + r.x * i.y), o = a < 0 ? -1 : 1, s = (n.y * i.x - n.x * i.y + (i.y - n.y) * e + (n.x - i.x) * t) * o, c = (n.x * r.y - n.y * r.x + (n.y - r.y) * e + (r.x - n.x) * t) * o;
|
|
8724
8795
|
return s >= 0 && c >= 0 && s + c <= 2 * a * o;
|
|
8725
8796
|
}
|
|
8726
|
-
function
|
|
8727
|
-
return
|
|
8797
|
+
function Md(e, t, n, r) {
|
|
8798
|
+
return Dd(e, r) || Dd(t, r) || Dd(n, r) || jd(r.minX, r.minY, e, t, n) || jd(r.maxX, r.minY, e, t, n) || jd(r.maxX, r.maxY, e, t, n) || jd(r.minX, r.maxY, e, t, n) ? !0 : Nd(e, t, r) || Nd(t, n, r) || Nd(n, e, r);
|
|
8728
8799
|
}
|
|
8729
|
-
function
|
|
8730
|
-
return
|
|
8800
|
+
function Nd(e, t, n) {
|
|
8801
|
+
return Ad(e.x, e.y, t.x, t.y, n.minX, n.minY, n.maxX, n.minY) || Ad(e.x, e.y, t.x, t.y, n.maxX, n.minY, n.maxX, n.maxY) || Ad(e.x, e.y, t.x, t.y, n.maxX, n.maxY, n.minX, n.maxY) || Ad(e.x, e.y, t.x, t.y, n.minX, n.maxY, n.minX, n.minY);
|
|
8731
8802
|
}
|
|
8732
|
-
function
|
|
8803
|
+
function Pd(e, t) {
|
|
8733
8804
|
return {
|
|
8734
8805
|
...t,
|
|
8735
|
-
meshMatrix: new
|
|
8806
|
+
meshMatrix: new P(),
|
|
8736
8807
|
minW: e.isPerspectiveCamera ? e.near : -Infinity,
|
|
8737
|
-
viewProjection: new
|
|
8808
|
+
viewProjection: new P().multiplyMatrices(e.projectionMatrix, e.matrixWorldInverse)
|
|
8738
8809
|
};
|
|
8739
8810
|
}
|
|
8740
|
-
function
|
|
8811
|
+
function Fd(e, t) {
|
|
8741
8812
|
e.meshMatrix.multiplyMatrices(e.viewProjection, t.matrixWorld);
|
|
8742
8813
|
}
|
|
8743
|
-
function
|
|
8814
|
+
function Id(e, t, n, r, i, a) {
|
|
8744
8815
|
let o = e.meshMatrix.elements;
|
|
8745
8816
|
i[a] = o[0] * t + o[4] * n + o[8] * r + o[12], i[a + 1] = o[1] * t + o[5] * n + o[9] * r + o[13], i[a + 2] = o[3] * t + o[7] * n + o[11] * r + o[15];
|
|
8746
8817
|
}
|
|
8747
|
-
function
|
|
8818
|
+
function Ld(e, t, n) {
|
|
8748
8819
|
return (t / n + 1) / 2 * e.width + e.left;
|
|
8749
8820
|
}
|
|
8750
|
-
function
|
|
8821
|
+
function Rd(e, t, n) {
|
|
8751
8822
|
return (-t / n + 1) / 2 * e.height + e.top;
|
|
8752
8823
|
}
|
|
8753
|
-
function
|
|
8754
|
-
|
|
8755
|
-
let a =
|
|
8756
|
-
return a < e.minW ? !1 :
|
|
8824
|
+
function zd(e, t, n, r, i) {
|
|
8825
|
+
Id(e, n, r, i, ld, 0);
|
|
8826
|
+
let a = ld[2];
|
|
8827
|
+
return a < e.minW ? !1 : Od(Ld(e, ld[0], a), Rd(e, ld[1], a), t);
|
|
8757
8828
|
}
|
|
8758
|
-
function
|
|
8829
|
+
function Bd(e, t, n) {
|
|
8759
8830
|
let { minW: r } = n, i = 0;
|
|
8760
|
-
for (let t = 0; t < 8; t++)
|
|
8831
|
+
for (let t = 0; t < 8; t++) Id(n, t & 1 ? e.max.x : e.min.x, t & 2 ? e.max.y : e.min.y, t & 4 ? e.max.z : e.min.z, cd, t * 3), cd[t * 3 + 2] < r && i++;
|
|
8761
8832
|
if (i === 8) return Ue;
|
|
8762
8833
|
let a = Infinity, o = -Infinity, s = Infinity, c = -Infinity, l = 0;
|
|
8763
8834
|
for (let e = 0; e < 8; e++) {
|
|
8764
|
-
let i =
|
|
8835
|
+
let i = cd[e * 3 + 2];
|
|
8765
8836
|
if (i < r) continue;
|
|
8766
|
-
let u =
|
|
8767
|
-
a = Math.min(a, u), o = Math.max(o, u), s = Math.min(s, d), c = Math.max(c, d),
|
|
8837
|
+
let u = Ld(n, cd[e * 3], i), d = Rd(n, cd[e * 3 + 1], i);
|
|
8838
|
+
a = Math.min(a, u), o = Math.max(o, u), s = Math.min(s, d), c = Math.max(c, d), Od(u, d, t) && l++;
|
|
8768
8839
|
}
|
|
8769
|
-
if (i) for (let [e, t] of
|
|
8770
|
-
let i =
|
|
8840
|
+
if (i) for (let [e, t] of sd) {
|
|
8841
|
+
let i = cd[e * 3 + 2], l = cd[t * 3 + 2];
|
|
8771
8842
|
if (i < r == l < r) continue;
|
|
8772
|
-
let u = (r - i) / (l - i), d =
|
|
8843
|
+
let u = (r - i) / (l - i), d = Ld(n, cd[e * 3] + u * (cd[t * 3] - cd[e * 3]), r), f = Rd(n, cd[e * 3 + 1] + u * (cd[t * 3 + 1] - cd[e * 3 + 1]), r);
|
|
8773
8844
|
a = Math.min(a, d), o = Math.max(o, d), s = Math.min(s, f), c = Math.max(c, f);
|
|
8774
8845
|
}
|
|
8775
8846
|
return o < t.minX || a > t.maxX || c < t.minY || s > t.maxY ? Ue : !i && l === 8 ? Be : Ve;
|
|
8776
8847
|
}
|
|
8777
|
-
function
|
|
8848
|
+
function Vd(e, t) {
|
|
8778
8849
|
let { minW: n } = e, r = 0;
|
|
8779
8850
|
for (let e = 0; e < 3; e++) {
|
|
8780
|
-
let t = (e + 1) % 3, i =
|
|
8781
|
-
if (i >= n && (
|
|
8851
|
+
let t = (e + 1) % 3, i = ld[e * 3 + 2], a = ld[t * 3 + 2];
|
|
8852
|
+
if (i >= n && (ud[r * 3] = ld[e * 3], ud[r * 3 + 1] = ld[e * 3 + 1], ud[r * 3 + 2] = i, r++), i >= n != a >= n) {
|
|
8782
8853
|
let o = (n - i) / (a - i);
|
|
8783
|
-
|
|
8854
|
+
ud[r * 3] = ld[e * 3] + o * (ld[t * 3] - ld[e * 3]), ud[r * 3 + 1] = ld[e * 3 + 1] + o * (ld[t * 3 + 1] - ld[e * 3 + 1]), ud[r * 3 + 2] = n, r++;
|
|
8784
8855
|
}
|
|
8785
8856
|
}
|
|
8786
8857
|
if (r < 3) return !1;
|
|
8787
8858
|
for (let t = 0; t < r; t++) {
|
|
8788
|
-
let n =
|
|
8789
|
-
|
|
8859
|
+
let n = ud[t * 3 + 2];
|
|
8860
|
+
dd[t].set(Ld(e, ud[t * 3], n), Rd(e, ud[t * 3 + 1], n));
|
|
8790
8861
|
}
|
|
8791
|
-
for (let e = 1; e < r - 1; e++) if (
|
|
8862
|
+
for (let e = 1; e < r - 1; e++) if (Md(dd[0], dd[e], dd[e + 1], t)) return !0;
|
|
8792
8863
|
return !1;
|
|
8793
8864
|
}
|
|
8794
|
-
function
|
|
8865
|
+
function Hd(e) {
|
|
8795
8866
|
return "isInterleavedBufferAttribute" in e ? null : e.array;
|
|
8796
8867
|
}
|
|
8797
|
-
function
|
|
8868
|
+
function Ud(e, t, n) {
|
|
8798
8869
|
let { indexArray: r, positionArray: i, positionAttr: a } = e;
|
|
8799
8870
|
for (let e = 0; e < 3; e++) {
|
|
8800
8871
|
let o = r[t * 3 + e];
|
|
8801
|
-
i ?
|
|
8872
|
+
i ? Id(n, i[o * 3], i[o * 3 + 1], i[o * 3 + 2], ld, e * 3) : Id(n, a.getX(o), a.getY(o), a.getZ(o), ld, e * 3);
|
|
8802
8873
|
}
|
|
8803
8874
|
}
|
|
8804
|
-
function
|
|
8875
|
+
function Wd(e, t, n) {
|
|
8805
8876
|
let r = e.get(t);
|
|
8806
8877
|
r || (r = /* @__PURE__ */ new Set(), e.set(t, r)), r.add(n);
|
|
8807
8878
|
}
|
|
8808
|
-
function
|
|
8879
|
+
function Gd(e) {
|
|
8809
8880
|
let t = 0;
|
|
8810
8881
|
return e.forEach((e) => {
|
|
8811
8882
|
t += e.size;
|
|
8812
8883
|
}), t;
|
|
8813
8884
|
}
|
|
8814
|
-
function
|
|
8885
|
+
function Kd(e, t, n, r) {
|
|
8815
8886
|
let { idsAttr: i, indexArray: a, mesh: o, modelID: s, positionAttr: c } = e, l = t * 3;
|
|
8816
|
-
r.length && (
|
|
8887
|
+
r.length && (gd.fromBufferAttribute(c, a[l]), _d.fromBufferAttribute(c, a[l + 1]), vd.fromBufferAttribute(c, a[l + 2]), !Sd(o, gd, _d, vd, r)) || Wd(n, s, i.getX(a[l]));
|
|
8817
8888
|
}
|
|
8818
|
-
function
|
|
8889
|
+
function qd({ model: e, projection: t, rect: n, candidateIdsByModel: r, clippingPlanes: i, profile: a }) {
|
|
8819
8890
|
let o = performance.now(), s = /* @__PURE__ */ new Map(), c = new U();
|
|
8820
8891
|
e.traverse((e) => {
|
|
8821
8892
|
let o = e;
|
|
8822
|
-
if (!o.isMesh || !
|
|
8893
|
+
if (!o.isMesh || !bd(o)) return;
|
|
8823
8894
|
let l = o.geometry.attributes.ids, u = o.geometry.attributes.position;
|
|
8824
8895
|
if (!l || !u) return;
|
|
8825
|
-
let d =
|
|
8896
|
+
let d = yd(o), f = r.get(d);
|
|
8826
8897
|
if (!f?.size) return;
|
|
8827
8898
|
let p = s.get(d);
|
|
8828
|
-
p || (p = /* @__PURE__ */ new Map(), s.set(d, p)),
|
|
8829
|
-
let m =
|
|
8899
|
+
p || (p = /* @__PURE__ */ new Map(), s.set(d, p)), Fd(t, o);
|
|
8900
|
+
let m = Hd(l), h = Hd(u), g = Math.min(l.count, u.count), _ = -1, v = !1;
|
|
8830
8901
|
a && (a.containedVerticesVisited += l.count);
|
|
8831
8902
|
for (let e = 0; e < g; e++) {
|
|
8832
8903
|
let r = m ? m[e] : l.getX(e);
|
|
8833
|
-
r !== _ && (_ = r, v = f.has(r)), !(!v || p.get(r) === !1) && (h ? c.set(h[e * 3], h[e * 3 + 1], h[e * 3 + 2]) : c.fromBufferAttribute(u, e),
|
|
8904
|
+
r !== _ && (_ = r, v = f.has(r)), !(!v || p.get(r) === !1) && (h ? c.set(h[e * 3], h[e * 3 + 1], h[e * 3 + 2]) : c.fromBufferAttribute(u, e), xd(o, c, i) && (a && (a.containedCandidateVertices += 1), p.set(r, zd(t, n, c.x, c.y, c.z))));
|
|
8834
8905
|
}
|
|
8835
8906
|
});
|
|
8836
8907
|
let l = /* @__PURE__ */ new Map();
|
|
8837
8908
|
return s.forEach((e, t) => {
|
|
8838
8909
|
e.forEach((e, n) => {
|
|
8839
|
-
e &&
|
|
8910
|
+
e && Wd(l, t, n);
|
|
8840
8911
|
});
|
|
8841
8912
|
}), a && (a.containedIdsMs += performance.now() - o), l;
|
|
8842
8913
|
}
|
|
8843
|
-
function
|
|
8914
|
+
function Jd({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect: i, mode: a, profile: o }) {
|
|
8844
8915
|
let s = performance.now(), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
|
|
8845
8916
|
if (!e) return c;
|
|
8846
|
-
let u =
|
|
8917
|
+
let u = Cd(r), d = performance.now();
|
|
8847
8918
|
e.updateMatrixWorld(!0), t.updateMatrixWorld(), o && (o.matrixUpdateMs += performance.now() - d);
|
|
8848
|
-
let f =
|
|
8919
|
+
let f = Pd(t, u);
|
|
8849
8920
|
e.traverse((e) => {
|
|
8850
8921
|
let t = e;
|
|
8851
8922
|
if (!t.isMesh) return;
|
|
8852
|
-
if (o && (o.meshCount += 1), !
|
|
8923
|
+
if (o && (o.meshCount += 1), !bd(t)) {
|
|
8853
8924
|
o && (o.skippedMeshCount += 1);
|
|
8854
8925
|
return;
|
|
8855
8926
|
}
|
|
@@ -8858,10 +8929,10 @@ function Ud({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
|
|
|
8858
8929
|
o && (o.skippedMeshCount += 1);
|
|
8859
8930
|
return;
|
|
8860
8931
|
}
|
|
8861
|
-
|
|
8932
|
+
Fd(f, t);
|
|
8862
8933
|
let p = performance.now();
|
|
8863
8934
|
r.boundingBox || r.computeBoundingBox();
|
|
8864
|
-
let m = !r.boundingBox ||
|
|
8935
|
+
let m = !r.boundingBox || Bd(r.boundingBox, i, f) !== Ue;
|
|
8865
8936
|
if (o && (o.boundsCheckMs += performance.now() - p), !m) {
|
|
8866
8937
|
o && (o.skippedMeshCount += 1);
|
|
8867
8938
|
return;
|
|
@@ -8870,13 +8941,13 @@ function Ud({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
|
|
|
8870
8941
|
idsAttr: u,
|
|
8871
8942
|
indexArray: r.index.array,
|
|
8872
8943
|
mesh: t,
|
|
8873
|
-
modelID:
|
|
8874
|
-
positionArray:
|
|
8944
|
+
modelID: yd(t),
|
|
8945
|
+
positionArray: Hd(d),
|
|
8875
8946
|
positionAttr: d
|
|
8876
8947
|
}, g = a === "contains" ? l : c, _ = performance.now();
|
|
8877
8948
|
s.shapecast({
|
|
8878
8949
|
intersectsBounds: (e) => {
|
|
8879
|
-
let t = performance.now(), n =
|
|
8950
|
+
let t = performance.now(), n = Bd(e, i, f);
|
|
8880
8951
|
return o && (o.intersectsBoundsCalls += 1, o.intersectsBoundsMs += performance.now() - t), n;
|
|
8881
8952
|
},
|
|
8882
8953
|
intersectsRange: (e, t, r) => {
|
|
@@ -8885,17 +8956,17 @@ function Ud({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
|
|
|
8885
8956
|
let e = s.resolveTriangleIndex(a);
|
|
8886
8957
|
if (!r) {
|
|
8887
8958
|
let t = performance.now();
|
|
8888
|
-
|
|
8889
|
-
let n =
|
|
8959
|
+
Ud(h, e, f);
|
|
8960
|
+
let n = Vd(f, i);
|
|
8890
8961
|
if (o && (o.intersectsTriangleCalls += 1, o.triangleProjectionMs += performance.now() - t), !n) continue;
|
|
8891
8962
|
}
|
|
8892
|
-
|
|
8963
|
+
Kd(h, e, g, n);
|
|
8893
8964
|
}
|
|
8894
8965
|
return o && (o.intersectsRangeCalls += 1, o.intersectsRangeMs += performance.now() - a), !1;
|
|
8895
8966
|
}
|
|
8896
8967
|
}), o && (o.shapecastMs += performance.now() - _);
|
|
8897
8968
|
});
|
|
8898
|
-
let p = a === "contains" ?
|
|
8969
|
+
let p = a === "contains" ? qd({
|
|
8899
8970
|
model: e,
|
|
8900
8971
|
clippingPlanes: n,
|
|
8901
8972
|
projection: f,
|
|
@@ -8903,19 +8974,19 @@ function Ud({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
|
|
|
8903
8974
|
candidateIdsByModel: l,
|
|
8904
8975
|
profile: o
|
|
8905
8976
|
}) : c;
|
|
8906
|
-
return o && (o.candidateIds =
|
|
8977
|
+
return o && (o.candidateIds = Gd(l), o.selectedIds = Gd(p), o.totalMs = performance.now() - s), p;
|
|
8907
8978
|
}
|
|
8908
|
-
function
|
|
8909
|
-
let t =
|
|
8979
|
+
function Yd(e) {
|
|
8980
|
+
let t = wd(e.mode);
|
|
8910
8981
|
return {
|
|
8911
|
-
ids:
|
|
8982
|
+
ids: Jd({
|
|
8912
8983
|
...e,
|
|
8913
8984
|
profile: t
|
|
8914
8985
|
}),
|
|
8915
8986
|
profile: t
|
|
8916
8987
|
};
|
|
8917
8988
|
}
|
|
8918
|
-
function
|
|
8989
|
+
function Xd(e) {
|
|
8919
8990
|
return e === "contains" ? {
|
|
8920
8991
|
border: "rgb(37, 99, 235)",
|
|
8921
8992
|
background: "rgba(37, 99, 235, 0.16)"
|
|
@@ -8924,40 +8995,40 @@ function Gd(e) {
|
|
|
8924
8995
|
background: "rgba(22, 163, 74, 0.16)"
|
|
8925
8996
|
};
|
|
8926
8997
|
}
|
|
8927
|
-
function
|
|
8928
|
-
let r =
|
|
8998
|
+
function Zd(e, t, n) {
|
|
8999
|
+
let r = Xd(Ed(t, n));
|
|
8929
9000
|
if (!e.current) {
|
|
8930
9001
|
let t = document.createElement("div");
|
|
8931
9002
|
t.style.position = "fixed", t.style.pointerEvents = "none", t.style.zIndex = "10", e.current = t, document.body.appendChild(t);
|
|
8932
9003
|
}
|
|
8933
|
-
let i =
|
|
9004
|
+
let i = Td(t, n);
|
|
8934
9005
|
e.current.style.border = `1px solid ${r.border}`, e.current.style.background = r.background, e.current.style.left = `${i.minX}px`, e.current.style.top = `${i.minY}px`, e.current.style.width = `${i.maxX - i.minX}px`, e.current.style.height = `${i.maxY - i.minY}px`;
|
|
8935
9006
|
}
|
|
8936
|
-
function
|
|
9007
|
+
function Qd(e) {
|
|
8937
9008
|
e.current?.remove(), e.current = null;
|
|
8938
9009
|
}
|
|
8939
9010
|
//#endregion
|
|
8940
9011
|
//#region src/viewer/Selector/useSelector.tsx
|
|
8941
|
-
var
|
|
8942
|
-
function
|
|
8943
|
-
if (Array.isArray(e)) return e.flatMap((e) =>
|
|
9012
|
+
var $d = 40;
|
|
9013
|
+
function ef(e) {
|
|
9014
|
+
if (Array.isArray(e)) return e.flatMap((e) => ef(e));
|
|
8944
9015
|
let t = e.userData;
|
|
8945
9016
|
return t.shaders ? Array.from(t.shaders) : t.shader ? [t.shader] : [];
|
|
8946
9017
|
}
|
|
8947
|
-
function
|
|
9018
|
+
function tf(e) {
|
|
8948
9019
|
let t = d(e);
|
|
8949
9020
|
return t.current = e, t;
|
|
8950
9021
|
}
|
|
8951
|
-
function
|
|
8952
|
-
|
|
9022
|
+
function nf(e, t) {
|
|
9023
|
+
ef(e)?.forEach((e) => {
|
|
8953
9024
|
let n = e.uniforms.preSelectionId;
|
|
8954
9025
|
n && (n.value = t);
|
|
8955
9026
|
});
|
|
8956
9027
|
}
|
|
8957
|
-
function
|
|
9028
|
+
function rf(e) {
|
|
8958
9029
|
return Number(e.current?.modelID ?? 0);
|
|
8959
9030
|
}
|
|
8960
|
-
function
|
|
9031
|
+
function af(e) {
|
|
8961
9032
|
let t = e;
|
|
8962
9033
|
for (; t;) {
|
|
8963
9034
|
let e = t.modelID ?? t.userData.modelID;
|
|
@@ -8966,7 +9037,7 @@ function $d(e) {
|
|
|
8966
9037
|
}
|
|
8967
9038
|
return 0;
|
|
8968
9039
|
}
|
|
8969
|
-
function
|
|
9040
|
+
function of(e) {
|
|
8970
9041
|
let t = e;
|
|
8971
9042
|
for (; t;) {
|
|
8972
9043
|
if (!t.visible) return !1;
|
|
@@ -8974,7 +9045,7 @@ function ef(e) {
|
|
|
8974
9045
|
}
|
|
8975
9046
|
return !0;
|
|
8976
9047
|
}
|
|
8977
|
-
function
|
|
9048
|
+
function sf(e) {
|
|
8978
9049
|
if (!e) return "";
|
|
8979
9050
|
let t = [
|
|
8980
9051
|
e.uuid,
|
|
@@ -8987,121 +9058,121 @@ function tf(e) {
|
|
|
8987
9058
|
});
|
|
8988
9059
|
}), t.join(":");
|
|
8989
9060
|
}
|
|
8990
|
-
function
|
|
8991
|
-
if (!
|
|
9061
|
+
function cf(e) {
|
|
9062
|
+
if (!of(e.object) || !(e.object instanceof F) || e.faceIndex === void 0 || e.faceIndex === null) return !1;
|
|
8992
9063
|
let t = e.object.geometry;
|
|
8993
9064
|
return !!(t.index && t.attributes.ids);
|
|
8994
9065
|
}
|
|
8995
|
-
function
|
|
8996
|
-
if (!
|
|
9066
|
+
function lf(e) {
|
|
9067
|
+
if (!cf(e)) return null;
|
|
8997
9068
|
let t = e.object, n = t.geometry, r = n.index.getX(e.faceIndex * 3), i = n.attributes.ids;
|
|
8998
9069
|
if (r >= i.count) return null;
|
|
8999
9070
|
let a = n.attributes.modelID;
|
|
9000
9071
|
return {
|
|
9001
9072
|
elementID: i.getX(r),
|
|
9002
9073
|
hit: e,
|
|
9003
|
-
modelID: a ? a.getX(r) :
|
|
9074
|
+
modelID: a ? a.getX(r) : af(t)
|
|
9004
9075
|
};
|
|
9005
9076
|
}
|
|
9006
|
-
function
|
|
9007
|
-
let l = d("end"), u = G((e) => e.selected), f = G((e) => e.setSelected), p = G((e) => e.addSelected), m = G((e) => e.removeSelected), h = G((e) => e.showStats), _ = G((e) => e.preselectionEnabled), v =
|
|
9077
|
+
function uf(e, t, n, r, i, a, o, c = 0) {
|
|
9078
|
+
let l = d("end"), u = G((e) => e.selected), f = G((e) => e.setSelected), p = G((e) => e.addSelected), m = G((e) => e.removeSelected), h = G((e) => e.showStats), _ = G((e) => e.preselectionEnabled), v = tf(_), y = nt(), b = d(null), x = d(null), S = d(!1), C = d(!1), w = d("add"), T = d(null), E = d(!1), D = d(0), O = d(null), k = d(null), A = d(null), j = d(_), M = d({
|
|
9008
9079
|
meshesByModel: /* @__PURE__ */ new Map(),
|
|
9009
9080
|
root: null,
|
|
9010
9081
|
version: ""
|
|
9011
|
-
}),
|
|
9012
|
-
|
|
9013
|
-
},
|
|
9082
|
+
}), ee = () => y.getState().selectionInteractionDisabled, N = () => v.current && (o?.() ?? !0), te = () => l.current !== "end", ne = () => {
|
|
9083
|
+
k.current = null, O.current !== null && (window.clearTimeout(O.current), O.current = null);
|
|
9084
|
+
}, re = (e) => {
|
|
9014
9085
|
if (r) {
|
|
9015
9086
|
r(e);
|
|
9016
9087
|
return;
|
|
9017
9088
|
}
|
|
9018
9089
|
let n = t.current;
|
|
9019
9090
|
n && (n.cancel(), n.setOrbitPoint(e.x, e.y, e.z));
|
|
9020
|
-
},
|
|
9021
|
-
let t = e.current, n =
|
|
9091
|
+
}, P = () => {
|
|
9092
|
+
let t = e.current, n = sf(t), r = M.current;
|
|
9022
9093
|
if (r.root !== t || r.version !== n) {
|
|
9023
9094
|
let e = /* @__PURE__ */ new Map();
|
|
9024
9095
|
return t?.traverse((t) => {
|
|
9025
|
-
if (!(t instanceof
|
|
9026
|
-
let n =
|
|
9096
|
+
if (!(t instanceof F) || !t.geometry.index || !t.geometry.attributes.ids) return;
|
|
9097
|
+
let n = af(t), r = e.get(n) ?? [];
|
|
9027
9098
|
r.push(t), e.set(n, r);
|
|
9028
|
-
}),
|
|
9099
|
+
}), M.current = {
|
|
9029
9100
|
meshesByModel: e,
|
|
9030
9101
|
root: t,
|
|
9031
9102
|
version: n
|
|
9032
|
-
},
|
|
9103
|
+
}, M.current;
|
|
9033
9104
|
}
|
|
9034
9105
|
return r;
|
|
9035
|
-
},
|
|
9036
|
-
e &&
|
|
9037
|
-
e.preselected = !1,
|
|
9106
|
+
}, I = () => Array.from(P().meshesByModel.values()).flat(), ie = (e) => P().meshesByModel.get(e) ?? [], ae = (e) => {
|
|
9107
|
+
e && ie(e.modelID).forEach((e) => {
|
|
9108
|
+
e.preselected = !1, nf(e.material, -1);
|
|
9038
9109
|
});
|
|
9039
|
-
},
|
|
9040
|
-
a?.(null),
|
|
9110
|
+
}, oe = () => {
|
|
9111
|
+
a?.(null), ae(A.current), A.current = null;
|
|
9041
9112
|
};
|
|
9042
9113
|
s(() => {
|
|
9043
|
-
let e =
|
|
9044
|
-
|
|
9114
|
+
let e = j.current;
|
|
9115
|
+
j.current = _, !(!e || _) && (ne(), oe());
|
|
9045
9116
|
}, [_]);
|
|
9046
|
-
let
|
|
9047
|
-
let n =
|
|
9048
|
-
n?.modelID === e && n.elementID === t || (
|
|
9117
|
+
let se = (e, t) => {
|
|
9118
|
+
let n = A.current;
|
|
9119
|
+
n?.modelID === e && n.elementID === t || (ae(n), a?.({
|
|
9049
9120
|
elementID: t,
|
|
9050
9121
|
modelID: e
|
|
9051
|
-
}),
|
|
9052
|
-
e.preselected = !0,
|
|
9053
|
-
}),
|
|
9122
|
+
}), ie(e).forEach((e) => {
|
|
9123
|
+
e.preselected = !0, nf(e.material, t);
|
|
9124
|
+
}), A.current = {
|
|
9054
9125
|
elementID: t,
|
|
9055
9126
|
modelID: e
|
|
9056
9127
|
});
|
|
9057
9128
|
}, L = () => {
|
|
9058
|
-
b.current = null, S.current = !1,
|
|
9129
|
+
b.current = null, S.current = !1, Qd(x), t.current && (t.current.enabled = !0);
|
|
9059
9130
|
}, ce = (e) => {
|
|
9060
|
-
if (
|
|
9061
|
-
|
|
9131
|
+
if (te()) {
|
|
9132
|
+
ne(), oe();
|
|
9062
9133
|
return;
|
|
9063
9134
|
}
|
|
9064
|
-
if (!
|
|
9065
|
-
|
|
9135
|
+
if (!N()) {
|
|
9136
|
+
oe();
|
|
9066
9137
|
return;
|
|
9067
9138
|
}
|
|
9068
|
-
if (
|
|
9069
|
-
|
|
9139
|
+
if (ee()) {
|
|
9140
|
+
oe();
|
|
9070
9141
|
return;
|
|
9071
9142
|
}
|
|
9072
9143
|
if (b.current) {
|
|
9073
|
-
|
|
9144
|
+
oe();
|
|
9074
9145
|
return;
|
|
9075
9146
|
}
|
|
9076
9147
|
let t = ve(e);
|
|
9077
9148
|
if (!t) {
|
|
9078
|
-
|
|
9149
|
+
oe();
|
|
9079
9150
|
return;
|
|
9080
9151
|
}
|
|
9081
|
-
|
|
9152
|
+
se(t.modelID, t.elementID);
|
|
9082
9153
|
};
|
|
9083
9154
|
function le() {
|
|
9084
9155
|
return performance.now();
|
|
9085
9156
|
}
|
|
9086
9157
|
let R = (e) => {
|
|
9087
|
-
if (
|
|
9088
|
-
|
|
9158
|
+
if (te()) {
|
|
9159
|
+
ne(), oe();
|
|
9089
9160
|
return;
|
|
9090
9161
|
}
|
|
9091
|
-
if (!
|
|
9092
|
-
|
|
9162
|
+
if (!N()) {
|
|
9163
|
+
ne(), oe();
|
|
9093
9164
|
return;
|
|
9094
9165
|
}
|
|
9095
|
-
if (
|
|
9096
|
-
|
|
9166
|
+
if (ee()) {
|
|
9167
|
+
ne(), oe();
|
|
9097
9168
|
return;
|
|
9098
9169
|
}
|
|
9099
|
-
if (
|
|
9100
|
-
let t = le() -
|
|
9101
|
-
|
|
9102
|
-
|
|
9103
|
-
let e =
|
|
9104
|
-
|
|
9170
|
+
if (k.current = e, O.current !== null) return;
|
|
9171
|
+
let t = le() - D.current, n = Math.max(0, $d - t);
|
|
9172
|
+
O.current = window.setTimeout(() => {
|
|
9173
|
+
O.current = null;
|
|
9174
|
+
let e = k.current;
|
|
9175
|
+
k.current = null, e && (D.current = performance.now(), ce(e));
|
|
9105
9176
|
}, n);
|
|
9106
9177
|
}, z = d(null);
|
|
9107
9178
|
s(() => {
|
|
@@ -9120,8 +9191,8 @@ function af(e, t, n, r, i, a, o, c = 0) {
|
|
|
9120
9191
|
let t = ue.domElement.getBoundingClientRect();
|
|
9121
9192
|
return e.clientX >= t.left && e.clientX <= t.right && e.clientY >= t.top && e.clientY <= t.bottom;
|
|
9122
9193
|
}, pe = (t) => {
|
|
9123
|
-
if (
|
|
9124
|
-
E.current = !1, C.current = !1,
|
|
9194
|
+
if (ee()) {
|
|
9195
|
+
E.current = !1, C.current = !1, oe();
|
|
9125
9196
|
return;
|
|
9126
9197
|
}
|
|
9127
9198
|
if (!E.current) return;
|
|
@@ -9134,38 +9205,38 @@ function af(e, t, n, r, i, a, o, c = 0) {
|
|
|
9134
9205
|
l.current = "end";
|
|
9135
9206
|
return;
|
|
9136
9207
|
}
|
|
9137
|
-
let n = t.shiftKey, r = t.ctrlKey, i = ve(t), a, o =
|
|
9208
|
+
let n = t.shiftKey, r = t.ctrlKey, i = ve(t), a, o = rf(e), s = null;
|
|
9138
9209
|
if (i && (o = i.modelID, s = i.hit.point, a = i.elementID), r) {
|
|
9139
9210
|
a !== void 0 && m(o, [a]);
|
|
9140
9211
|
return;
|
|
9141
9212
|
} else if (n) {
|
|
9142
|
-
a !== void 0 && (u[o]?.has(a) ?? !1 ? m(o, [a]) : (p(o, [a]), s &&
|
|
9213
|
+
a !== void 0 && (u[o]?.has(a) ?? !1 ? m(o, [a]) : (p(o, [a]), s && re(s)));
|
|
9143
9214
|
return;
|
|
9144
9215
|
}
|
|
9145
|
-
f(o, a === void 0 ? [] : [a], !0), s &&
|
|
9216
|
+
f(o, a === void 0 ? [] : [a], !0), s && re(s);
|
|
9146
9217
|
}, me = (e) => {
|
|
9147
|
-
|
|
9218
|
+
ee() || e.button !== 0 || !e.shiftKey && !e.ctrlKey || (b.current = new H(e.clientX, e.clientY), w.current = e.ctrlKey ? "remove" : "add", S.current = !1, t.current && (t.current.enabled = !1));
|
|
9148
9219
|
}, V = (e) => {
|
|
9149
|
-
if (
|
|
9220
|
+
if (ee()) {
|
|
9150
9221
|
L();
|
|
9151
9222
|
return;
|
|
9152
9223
|
}
|
|
9153
9224
|
if (!b.current) return;
|
|
9154
9225
|
let t = new H(e.clientX, e.clientY), n = Math.abs(t.x - b.current.x), r = Math.abs(t.y - b.current.y);
|
|
9155
|
-
n < 6 && r < 6 || (S.current ||= !0, e.preventDefault(),
|
|
9226
|
+
n < 6 && r < 6 || (S.current ||= !0, e.preventDefault(), Zd(x, b.current, t));
|
|
9156
9227
|
}, he = (r) => {
|
|
9157
|
-
if (
|
|
9228
|
+
if (ee()) {
|
|
9158
9229
|
L();
|
|
9159
9230
|
return;
|
|
9160
9231
|
}
|
|
9161
9232
|
if (!b.current) return;
|
|
9162
9233
|
z.current = de();
|
|
9163
|
-
let i = S.current, a = new H(r.clientX, r.clientY), o =
|
|
9164
|
-
if (b.current = null, S.current = !1,
|
|
9234
|
+
let i = S.current, a = new H(r.clientX, r.clientY), o = Td(b.current, a), s = Ed(b.current, a);
|
|
9235
|
+
if (b.current = null, S.current = !1, Qd(x), t.current && setTimeout(() => {
|
|
9165
9236
|
t.current && (t.current.enabled = !0);
|
|
9166
9237
|
}, 100), !i) return;
|
|
9167
9238
|
C.current = !0, r.preventDefault();
|
|
9168
|
-
let { ids: c, profile: l } =
|
|
9239
|
+
let { ids: c, profile: l } = Yd({
|
|
9169
9240
|
model: e.current,
|
|
9170
9241
|
camera: B,
|
|
9171
9242
|
clippingPlanes: n.getActiveClippingPlanes(),
|
|
@@ -9185,7 +9256,7 @@ function af(e, t, n, r, i, a, o, c = 0) {
|
|
|
9185
9256
|
let i = Array.isArray(t) ? t.filter((e) => e.visible) : t ? [t] : [];
|
|
9186
9257
|
return i.length ? n.getIntersection(!1, {
|
|
9187
9258
|
event: e,
|
|
9188
|
-
filter:
|
|
9259
|
+
filter: cf,
|
|
9189
9260
|
firstHitOnly: r,
|
|
9190
9261
|
object: i,
|
|
9191
9262
|
recursive: !0
|
|
@@ -9193,12 +9264,12 @@ function af(e, t, n, r, i, a, o, c = 0) {
|
|
|
9193
9264
|
}, U = () => i?.().filter((e) => e.visible) ?? [], _e = (e, t) => {
|
|
9194
9265
|
let n = ge(e, t, !0);
|
|
9195
9266
|
for (let e of n) {
|
|
9196
|
-
let t =
|
|
9267
|
+
let t = lf(e);
|
|
9197
9268
|
if (t) return t;
|
|
9198
9269
|
}
|
|
9199
9270
|
return null;
|
|
9200
|
-
}, ve = (e) => _e(e, U()) || _e(e,
|
|
9201
|
-
clearPreselection:
|
|
9271
|
+
}, ve = (e) => _e(e, U()) || _e(e, I()), W = tf({
|
|
9272
|
+
clearPreselection: oe,
|
|
9202
9273
|
onBoxPointerDown: me,
|
|
9203
9274
|
onBoxPointerMove: V,
|
|
9204
9275
|
onBoxPointerUp: he,
|
|
@@ -9212,7 +9283,7 @@ function af(e, t, n, r, i, a, o, c = 0) {
|
|
|
9212
9283
|
typeof l.current == "number" ? l.current += 1 : l.current === "start" && (l.current = 1);
|
|
9213
9284
|
}
|
|
9214
9285
|
function d() {
|
|
9215
|
-
l.current = "start",
|
|
9286
|
+
l.current = "start", ne(), oe();
|
|
9216
9287
|
}
|
|
9217
9288
|
function f(e) {
|
|
9218
9289
|
E.current = e.button === 0 || e.ctrlKey, d();
|
|
@@ -9229,7 +9300,7 @@ function af(e, t, n, r, i, a, o, c = 0) {
|
|
|
9229
9300
|
e.ctrlKey && e.preventDefault();
|
|
9230
9301
|
}
|
|
9231
9302
|
return () => {
|
|
9232
|
-
|
|
9303
|
+
Qd(x), O.current !== null && (window.clearTimeout(O.current), O.current = null), k.current = null, W.current.clearPreselection(), e?.removeEventListener("controlstart", p), e?.removeEventListener("update", u), n.removeEventListener("pointerdown", r), n.removeEventListener("pointermove", i), window.removeEventListener("pointerup", a), window.removeEventListener("pointerup", o), n.removeEventListener("contextmenu", h), n.removeEventListener("pointerup", m), n.removeEventListener("pointerdown", f), _ && (n.removeEventListener("pointermove", s), n.removeEventListener("pointerleave", c));
|
|
9233
9304
|
};
|
|
9234
9305
|
}, [
|
|
9235
9306
|
t,
|
|
@@ -9241,30 +9312,30 @@ function af(e, t, n, r, i, a, o, c = 0) {
|
|
|
9241
9312
|
}
|
|
9242
9313
|
//#endregion
|
|
9243
9314
|
//#region src/viewer/Camera/useCameraFit.tsx
|
|
9244
|
-
var
|
|
9245
|
-
function
|
|
9246
|
-
let n = e.top === e.bottom ? 1 : Math.abs((e.right - e.left) / (e.top - e.bottom)), r = Math.max(
|
|
9315
|
+
var df = new U(1, 1, 1).normalize(), ff = 1.18, pf = .001, mf = .001, hf = 4, gf = 1.45;
|
|
9316
|
+
function _f(e, t) {
|
|
9317
|
+
let n = e.top === e.bottom ? 1 : Math.abs((e.right - e.left) / (e.top - e.bottom)), r = Math.max(mf, t) * Math.max(e.zoom, 1e-4), i = r * n;
|
|
9247
9318
|
e.left = -i / 2, e.right = i / 2, e.top = r / 2, e.bottom = -r / 2;
|
|
9248
9319
|
}
|
|
9249
|
-
function
|
|
9250
|
-
let n =
|
|
9251
|
-
return t / Math.sin(Math.min(n, r) / 2) *
|
|
9320
|
+
function vf(e, t) {
|
|
9321
|
+
let n = re.degToRad(e.fov), r = 2 * Math.atan(Math.tan(n / 2) * e.aspect);
|
|
9322
|
+
return t / Math.sin(Math.min(n, r) / 2) * ff;
|
|
9252
9323
|
}
|
|
9253
|
-
function
|
|
9324
|
+
function yf() {
|
|
9254
9325
|
let { camera: e } = g();
|
|
9255
9326
|
return a((t, n, r) => {
|
|
9256
|
-
if (!t.current || !(e instanceof L) && !(e instanceof
|
|
9327
|
+
if (!t.current || !(e instanceof L) && !(e instanceof se)) return;
|
|
9257
9328
|
let i = new _().setFromObject(t.current);
|
|
9258
9329
|
if (i.isEmpty()) return;
|
|
9259
|
-
let a = i.getCenter(new U()), o = i.getBoundingSphere(new de()), s = n.current, c = e instanceof L ?
|
|
9330
|
+
let a = i.getCenter(new U()), o = i.getBoundingSphere(new de()), s = n.current, c = e instanceof L ? vf(e, o.radius) : Math.max(o.radius * hf, pf);
|
|
9260
9331
|
e.up.set(0, 1, 0);
|
|
9261
|
-
let l = a.clone().addScaledVector(
|
|
9262
|
-
s ? (s.cancel(), s.updateCameraUp(), s.setFocalOffset(0, 0, 0, !1), s.setLookAt(l.x, l.y, l.z, a.x, a.y, a.z, !1), e instanceof
|
|
9332
|
+
let l = a.clone().addScaledVector(df, c);
|
|
9333
|
+
s ? (s.cancel(), s.updateCameraUp(), s.setFocalOffset(0, 0, 0, !1), s.setLookAt(l.x, l.y, l.z, a.x, a.y, a.z, !1), e instanceof se && s.fitToSphere(new de(a, o.radius * gf), !1), s.update(0), e.updateMatrixWorld(!0)) : (e.position.copy(l), e.lookAt(a)), e instanceof se && (s || (e.zoom = 1, _f(e, o.radius * 2 * gf))), e.updateProjectionMatrix(), e.updateMatrixWorld(!0), r.current && (r.current.position.copy(a).addScaledVector(df, c * .8), r.current.lookAt(a));
|
|
9263
9334
|
}, [e]);
|
|
9264
9335
|
}
|
|
9265
9336
|
//#endregion
|
|
9266
9337
|
//#region src/viewer/Camera/FirstPersonControls.tsx
|
|
9267
|
-
var
|
|
9338
|
+
var bf = 1, xf = .004, Sf = -Math.PI / 2 + .01, Cf = Math.PI / 2 - .01, wf = .24, Tf = 4, Ef = 1e4, Df = .5, Of = .01, kf = 1.5, Af = 1500, jf = 3, Mf = new Set([
|
|
9268
9339
|
"KeyW",
|
|
9269
9340
|
"KeyA",
|
|
9270
9341
|
"KeyS",
|
|
@@ -9273,62 +9344,62 @@ var hf = 1, gf = .004, _f = -Math.PI / 2 + .01, vf = Math.PI / 2 - .01, yf = .24
|
|
|
9273
9344
|
"ShiftRight",
|
|
9274
9345
|
"ControlLeft",
|
|
9275
9346
|
"ControlRight"
|
|
9276
|
-
]),
|
|
9277
|
-
function
|
|
9347
|
+
]), Nf = new Set(["AltLeft", "AltRight"]), Pf = new U(), Ff = new U(), If = new U(), Lf = new U(), Rf = new U(0, -1, 0);
|
|
9348
|
+
function zf(e, t) {
|
|
9278
9349
|
return typeof e == "number" && Number.isFinite(e) ? e : t;
|
|
9279
9350
|
}
|
|
9280
|
-
function
|
|
9351
|
+
function Bf(e, t, n) {
|
|
9281
9352
|
return Math.min(n, Math.max(t, e));
|
|
9282
9353
|
}
|
|
9283
|
-
function
|
|
9284
|
-
return
|
|
9354
|
+
function Vf(e, t, n, r) {
|
|
9355
|
+
return Bf(zf(e, t), n, r);
|
|
9285
9356
|
}
|
|
9286
|
-
function
|
|
9357
|
+
function Hf(e) {
|
|
9287
9358
|
if (!(e instanceof HTMLElement)) return !1;
|
|
9288
9359
|
let t = e.tagName.toLowerCase();
|
|
9289
9360
|
return e.isContentEditable || t === "input" || t === "textarea" || t === "select";
|
|
9290
9361
|
}
|
|
9291
|
-
function
|
|
9362
|
+
function Uf(e) {
|
|
9292
9363
|
if (!e) return {
|
|
9293
|
-
eyeHeight:
|
|
9294
|
-
groundMaxDistance:
|
|
9295
|
-
moveSpeed:
|
|
9364
|
+
eyeHeight: kf,
|
|
9365
|
+
groundMaxDistance: kf * jf,
|
|
9366
|
+
moveSpeed: Tf
|
|
9296
9367
|
};
|
|
9297
9368
|
let t = new _().setFromObject(e);
|
|
9298
9369
|
if (t.isEmpty()) return {
|
|
9299
|
-
eyeHeight:
|
|
9300
|
-
groundMaxDistance:
|
|
9301
|
-
moveSpeed:
|
|
9370
|
+
eyeHeight: kf,
|
|
9371
|
+
groundMaxDistance: kf * jf,
|
|
9372
|
+
moveSpeed: Tf
|
|
9302
9373
|
};
|
|
9303
|
-
let n = t.getBoundingSphere(new de()).radius, r = Math.min(
|
|
9374
|
+
let n = t.getBoundingSphere(new de()).radius, r = Math.min(Af, Math.max(kf, n * Of));
|
|
9304
9375
|
return {
|
|
9305
9376
|
eyeHeight: r,
|
|
9306
|
-
groundMaxDistance: r *
|
|
9307
|
-
moveSpeed: Math.min(
|
|
9377
|
+
groundMaxDistance: r * jf,
|
|
9378
|
+
moveSpeed: Math.min(Ef, Math.max(Tf, n * wf))
|
|
9308
9379
|
};
|
|
9309
9380
|
}
|
|
9310
|
-
function
|
|
9311
|
-
let n =
|
|
9381
|
+
function Wf(e, t) {
|
|
9382
|
+
let n = Uf(e), r = Vf(t.eyeHeight, n.eyeHeight, .01, Af), i = Vf(t.groundSnapDistanceRatio, jf, .1, 100);
|
|
9312
9383
|
return {
|
|
9313
9384
|
eyeHeight: r,
|
|
9314
|
-
groundCheckInterval: Math.round(
|
|
9385
|
+
groundCheckInterval: Math.round(Vf(t.groundCheckInterval, bf, 1, 120)),
|
|
9315
9386
|
groundMaxDistance: r * i,
|
|
9316
|
-
lookSensitivity:
|
|
9317
|
-
moveSpeed:
|
|
9387
|
+
lookSensitivity: Vf(t.lookSensitivity, xf, 1e-4, .1),
|
|
9388
|
+
moveSpeed: Vf(t.speed, n.moveSpeed, .01, Ef)
|
|
9318
9389
|
};
|
|
9319
9390
|
}
|
|
9320
|
-
function
|
|
9321
|
-
return e.getWorldDirection(
|
|
9391
|
+
function Gf(e) {
|
|
9392
|
+
return e.getWorldDirection(Pf), Pf.y = 0, Pf.lengthSq() === 0 && Pf.set(0, 0, -1), Pf.normalize();
|
|
9322
9393
|
}
|
|
9323
|
-
function
|
|
9324
|
-
return
|
|
9394
|
+
function Kf(e) {
|
|
9395
|
+
return Ff.copy(e).cross(qf).normalize(), Ff.lengthSq() === 0 && Ff.set(1, 0, 0), Ff;
|
|
9325
9396
|
}
|
|
9326
|
-
var
|
|
9327
|
-
function
|
|
9397
|
+
var qf = new U(0, 1, 0);
|
|
9398
|
+
function Jf(e, t) {
|
|
9328
9399
|
let n = t.current;
|
|
9329
|
-
n && (e.getWorldDirection(
|
|
9400
|
+
n && (e.getWorldDirection(Lf), Lf.add(e.position), n.enabled = !0, n.cancel(), n.updateCameraUp(), n.setLookAt(e.position.x, e.position.y, e.position.z, Lf.x, Lf.y, Lf.z, !1), n.stop(), n.update(0));
|
|
9330
9401
|
}
|
|
9331
|
-
function
|
|
9402
|
+
function Yf(e) {
|
|
9332
9403
|
return e.find((e) => {
|
|
9333
9404
|
let t = e.object;
|
|
9334
9405
|
for (; t;) {
|
|
@@ -9338,42 +9409,42 @@ function Wf(e) {
|
|
|
9338
9409
|
return !0;
|
|
9339
9410
|
});
|
|
9340
9411
|
}
|
|
9341
|
-
function
|
|
9342
|
-
let n =
|
|
9343
|
-
return
|
|
9412
|
+
function Xf(e, t) {
|
|
9413
|
+
let n = Kf(Gf(e));
|
|
9414
|
+
return If.set(0, 0, 0), t.has("KeyW") && (e.getWorldDirection(Pf), If.add(Pf)), t.has("KeyS") && (e.getWorldDirection(Pf), If.sub(Pf)), t.has("KeyD") && If.add(n), t.has("KeyA") && If.sub(n), (t.has("ShiftLeft") || t.has("ShiftRight")) && If.add(qf), (t.has("ControlLeft") || t.has("ControlRight")) && If.sub(qf), If;
|
|
9344
9415
|
}
|
|
9345
|
-
function
|
|
9416
|
+
function Zf(e) {
|
|
9346
9417
|
return e.has("ShiftLeft") || e.has("ShiftRight") || e.has("ControlLeft") || e.has("ControlRight");
|
|
9347
9418
|
}
|
|
9348
|
-
function
|
|
9349
|
-
let a = g((e) => e.camera), o = g((e) => e.gl), c = g((e) => e.invalidate), l = nt(), f = d(null), p = d(/* @__PURE__ */ new Set()), m = d(
|
|
9419
|
+
function Qf({ active: e, activeRef: t, controlRef: n, modelRef: r, settings: i }) {
|
|
9420
|
+
let a = g((e) => e.camera), o = g((e) => e.gl), c = g((e) => e.invalidate), l = nt(), f = d(null), p = d(/* @__PURE__ */ new Set()), m = d(kf), h = d(0), _ = d(kf * jf), v = d(bf), y = d(xf), b = d(!1), x = d(!1), S = d(Tf), C = d({
|
|
9350
9421
|
pitch: 0,
|
|
9351
9422
|
yaw: 0
|
|
9352
9423
|
}), w = d(null), T = u(() => new z(), []);
|
|
9353
9424
|
return s(() => {
|
|
9354
9425
|
t.current = e;
|
|
9355
9426
|
}, [e, t]), s(() => {
|
|
9356
|
-
let e =
|
|
9427
|
+
let e = Wf(r.current, i);
|
|
9357
9428
|
m.current = e.eyeHeight, v.current = e.groundCheckInterval, _.current = e.groundMaxDistance, y.current = e.lookSensitivity, S.current = e.moveSpeed;
|
|
9358
9429
|
}, [r, i]), s(() => {
|
|
9359
9430
|
let e = o.domElement, i = e.style.outline, s = e.style.userSelect;
|
|
9360
9431
|
e.tabIndex = Math.max(e.tabIndex, 0), e.style.outline = "none", e.style.userSelect = "none";
|
|
9361
9432
|
let l = (e, t) => {
|
|
9362
9433
|
let n = C.current, r = y.current;
|
|
9363
|
-
n.yaw -= e * r, n.pitch -= t * r, n.pitch = Math.max(
|
|
9434
|
+
n.yaw -= e * r, n.pitch -= t * r, n.pitch = Math.max(Sf, Math.min(Cf, n.pitch)), a.quaternion.setFromEuler(new O(n.pitch, n.yaw, 0, "YXZ")), a.updateMatrixWorld(), c();
|
|
9364
9435
|
}, u = () => {
|
|
9365
9436
|
f.current !== null && (cancelAnimationFrame(f.current), f.current = null);
|
|
9366
9437
|
}, d = (e) => {
|
|
9367
9438
|
if (!t.current) return;
|
|
9368
9439
|
n.current?.cancel(), n.current && (n.current.enabled = !1);
|
|
9369
|
-
let i =
|
|
9440
|
+
let i = Xf(a, p.current);
|
|
9370
9441
|
if (i.lengthSq() === 0) return;
|
|
9371
|
-
let o = x.current ?
|
|
9372
|
-
if (i.normalize().multiplyScalar(S.current * o * e), a.position.add(i), h.current += 1, x.current && !
|
|
9442
|
+
let o = x.current ? Df : 1;
|
|
9443
|
+
if (i.normalize().multiplyScalar(S.current * o * e), a.position.add(i), h.current += 1, x.current && !Zf(p.current) && h.current % v.current === 0) {
|
|
9373
9444
|
let e = T, t = e.firstHitOnly;
|
|
9374
|
-
e.firstHitOnly = !0, T.set(a.position,
|
|
9445
|
+
e.firstHitOnly = !0, T.set(a.position, Rf), T.far = _.current;
|
|
9375
9446
|
try {
|
|
9376
|
-
let e =
|
|
9447
|
+
let e = Yf(r.current ? T.intersectObject(r.current, !0) : []);
|
|
9377
9448
|
e && (a.position.y = e.point.y + m.current);
|
|
9378
9449
|
} finally {
|
|
9379
9450
|
e.firstHitOnly = t, T.far = Infinity;
|
|
@@ -9392,23 +9463,23 @@ function qf({ active: e, activeRef: t, controlRef: n, modelRef: r, settings: i }
|
|
|
9392
9463
|
t.current && (e.focus(), b.current = !0, document.pointerLockElement !== e && e.requestPointerLock?.());
|
|
9393
9464
|
}, E = () => {
|
|
9394
9465
|
b.current = !1;
|
|
9395
|
-
},
|
|
9466
|
+
}, D = (n) => {
|
|
9396
9467
|
t.current && document.pointerLockElement !== e && b.current && (n.preventDefault(), n.stopPropagation(), l(n.movementX, n.movementY));
|
|
9397
|
-
},
|
|
9468
|
+
}, k = (n) => {
|
|
9398
9469
|
t.current && document.pointerLockElement === e && l(n.movementX, n.movementY);
|
|
9399
|
-
},
|
|
9400
|
-
if (t.current && !
|
|
9401
|
-
if (
|
|
9470
|
+
}, A = (e) => {
|
|
9471
|
+
if (t.current && !Hf(e.target)) {
|
|
9472
|
+
if (Nf.has(e.code)) {
|
|
9402
9473
|
e.repeat || (x.current = !x.current), e.preventDefault(), e.stopPropagation();
|
|
9403
9474
|
return;
|
|
9404
9475
|
}
|
|
9405
|
-
|
|
9476
|
+
Mf.has(e.code) && (e.preventDefault(), e.stopPropagation(), p.current.add(e.code), g(), c());
|
|
9406
9477
|
}
|
|
9407
|
-
},
|
|
9408
|
-
|
|
9478
|
+
}, j = (e) => {
|
|
9479
|
+
Mf.has(e.code) && (p.current.delete(e.code), p.current.size || u());
|
|
9409
9480
|
};
|
|
9410
|
-
return e.addEventListener("pointerdown", w, !0), e.addEventListener("pointermove",
|
|
9411
|
-
e.removeEventListener("pointerdown", w, !0), e.removeEventListener("pointermove",
|
|
9481
|
+
return e.addEventListener("pointerdown", w, !0), e.addEventListener("pointermove", D, !0), window.addEventListener("pointerup", E, !0), window.addEventListener("mousemove", k), window.addEventListener("keydown", A, !0), window.addEventListener("keyup", j, !0), () => {
|
|
9482
|
+
e.removeEventListener("pointerdown", w, !0), e.removeEventListener("pointermove", D, !0), window.removeEventListener("pointerup", E, !0), window.removeEventListener("mousemove", k), window.removeEventListener("keydown", A, !0), window.removeEventListener("keyup", j, !0), u(), e.style.outline = i, e.style.userSelect = s, b.current = !1, p.current.clear(), document.pointerLockElement === e && document.exitPointerLock(), Jf(a, n), c();
|
|
9412
9483
|
};
|
|
9413
9484
|
}, [
|
|
9414
9485
|
a,
|
|
@@ -9428,14 +9499,14 @@ function qf({ active: e, activeRef: t, controlRef: n, modelRef: r, settings: i }
|
|
|
9428
9499
|
w.current = l.getState().preselectionEnabled, l.getState().setPreselectionEnabled(!1);
|
|
9429
9500
|
let s = n.current;
|
|
9430
9501
|
s && (s.enabled = !1, s.cancel());
|
|
9431
|
-
let u =
|
|
9502
|
+
let u = Wf(r.current, i);
|
|
9432
9503
|
m.current = u.eyeHeight, v.current = u.groundCheckInterval, _.current = u.groundMaxDistance, y.current = u.lookSensitivity, S.current = u.moveSpeed;
|
|
9433
|
-
let d = new
|
|
9504
|
+
let d = new O().setFromQuaternion(a.quaternion, "YXZ");
|
|
9434
9505
|
return C.current = {
|
|
9435
9506
|
pitch: d.x,
|
|
9436
9507
|
yaw: d.y
|
|
9437
9508
|
}, () => {
|
|
9438
|
-
p.current.clear(), t(), document.pointerLockElement === o.domElement && document.exitPointerLock(),
|
|
9509
|
+
p.current.clear(), t(), document.pointerLockElement === o.domElement && document.exitPointerLock(), Jf(a, n), c();
|
|
9439
9510
|
};
|
|
9440
9511
|
}, [
|
|
9441
9512
|
e,
|
|
@@ -9450,8 +9521,8 @@ function qf({ active: e, activeRef: t, controlRef: n, modelRef: r, settings: i }
|
|
|
9450
9521
|
}
|
|
9451
9522
|
//#endregion
|
|
9452
9523
|
//#region src/viewer/ViewerComponents/ViewerScene.tsx
|
|
9453
|
-
var
|
|
9454
|
-
function
|
|
9524
|
+
var $f = .1, ep = .02, tp = 150, np = 150, rp = 500, ip = 5e6, ap = 50, op = .001, sp = .001, cp = 1e3, lp = 50, up = 30, dp = 240, fp = 7, pp = 1.25, mp = .08, hp = new U(1, 1, 1).normalize(), gp = new _(), _p = new de(), vp = new U(), yp = new U(), bp = new U();
|
|
9525
|
+
function xp(e = !1) {
|
|
9455
9526
|
return {
|
|
9456
9527
|
active: e,
|
|
9457
9528
|
finalFitDone: !1,
|
|
@@ -9459,23 +9530,23 @@ function gp(e = !1) {
|
|
|
9459
9530
|
userInteractedAfterFirstFit: !1
|
|
9460
9531
|
};
|
|
9461
9532
|
}
|
|
9462
|
-
function
|
|
9533
|
+
function Sp(e) {
|
|
9463
9534
|
let t = [];
|
|
9464
9535
|
return e?.traverse((e) => {
|
|
9465
|
-
e instanceof
|
|
9536
|
+
e instanceof F && e.geometry.attributes.ids && t.push(e);
|
|
9466
9537
|
}), t;
|
|
9467
9538
|
}
|
|
9468
|
-
function
|
|
9539
|
+
function Cp(e) {
|
|
9469
9540
|
let t = e.geometry.index?.count;
|
|
9470
9541
|
return t === void 0 ? (e.geometry.attributes.position?.count ?? 0) / 3 : t / 3;
|
|
9471
9542
|
}
|
|
9472
|
-
function
|
|
9473
|
-
return e.reduce((e, t) => e +
|
|
9543
|
+
function wp(e) {
|
|
9544
|
+
return e.reduce((e, t) => e + Cp(t), 0);
|
|
9474
9545
|
}
|
|
9475
|
-
function
|
|
9476
|
-
return
|
|
9546
|
+
function Tp(e) {
|
|
9547
|
+
return wp(e) > ip;
|
|
9477
9548
|
}
|
|
9478
|
-
function
|
|
9549
|
+
function Ep(e, t) {
|
|
9479
9550
|
if (t <= 0 || !e.length) return [];
|
|
9480
9551
|
let n = [...e];
|
|
9481
9552
|
for (let e = n.length - 1; e > 0 && n.length - e <= t; e--) {
|
|
@@ -9484,10 +9555,10 @@ function xp(e, t) {
|
|
|
9484
9555
|
}
|
|
9485
9556
|
return n.slice(-t);
|
|
9486
9557
|
}
|
|
9487
|
-
function
|
|
9558
|
+
function Dp(e, t) {
|
|
9488
9559
|
if (t <= 0) return null;
|
|
9489
|
-
let n =
|
|
9490
|
-
if (!
|
|
9560
|
+
let n = Sp(e);
|
|
9561
|
+
if (!Tp(n)) return null;
|
|
9491
9562
|
let r = n.filter((e) => e.visible);
|
|
9492
9563
|
if (r.length < 2) return null;
|
|
9493
9564
|
let i = Math.min(r.length, Math.round(r.length * t));
|
|
@@ -9500,87 +9571,87 @@ function Sp(e, t) {
|
|
|
9500
9571
|
}
|
|
9501
9572
|
o.push(e);
|
|
9502
9573
|
});
|
|
9503
|
-
let s = [...
|
|
9504
|
-
return c > 0 && s.push(...
|
|
9574
|
+
let s = [...Ep(o, i)], c = i - s.length;
|
|
9575
|
+
return c > 0 && s.push(...Ep(a, c)), s.length ? {
|
|
9505
9576
|
hiddenMeshes: s,
|
|
9506
9577
|
root: e
|
|
9507
9578
|
} : null;
|
|
9508
9579
|
}
|
|
9509
|
-
function
|
|
9580
|
+
function Op(e) {
|
|
9510
9581
|
let t = /* @__PURE__ */ new Map(), n = 0;
|
|
9511
9582
|
return e.hiddenMeshes.forEach((e) => {
|
|
9512
9583
|
e.parent && (t.set(e, e.visible), e.visible && (e.userData[Ps] = !0, e.visible = !1, n++));
|
|
9513
9584
|
}), n ? t : null;
|
|
9514
9585
|
}
|
|
9515
|
-
function
|
|
9586
|
+
function kp(e) {
|
|
9516
9587
|
e?.forEach((e, t) => {
|
|
9517
9588
|
delete t.userData[Ps], t.visible = e;
|
|
9518
9589
|
});
|
|
9519
9590
|
}
|
|
9520
|
-
function
|
|
9521
|
-
let t =
|
|
9522
|
-
return t ? Math.max(t.radius *
|
|
9591
|
+
function Ap(e) {
|
|
9592
|
+
let t = Mp(e);
|
|
9593
|
+
return t ? Math.max(t.radius * ep, $f) : $f;
|
|
9523
9594
|
}
|
|
9524
|
-
function
|
|
9525
|
-
if (e.dollyToCursor = !0, e.camera instanceof
|
|
9595
|
+
function jp(e) {
|
|
9596
|
+
if (e.dollyToCursor = !0, e.camera instanceof se) {
|
|
9526
9597
|
e.mouseButtons.middle = $.ACTION.ZOOM, e.mouseButtons.wheel = $.ACTION.ZOOM, e.touches.two = $.ACTION.TOUCH_ZOOM_TRUCK, e.infinityDolly = !1;
|
|
9527
9598
|
return;
|
|
9528
9599
|
}
|
|
9529
9600
|
e.mouseButtons.middle = $.ACTION.DOLLY, e.mouseButtons.wheel = $.ACTION.DOLLY, e.touches.two = $.ACTION.TOUCH_DOLLY_TRUCK, e.infinityDolly = !0;
|
|
9530
9601
|
}
|
|
9531
|
-
function
|
|
9532
|
-
if (!e || (
|
|
9533
|
-
let t =
|
|
9602
|
+
function Mp(e) {
|
|
9603
|
+
if (!e || (gp.setFromObject(e), gp.isEmpty())) return null;
|
|
9604
|
+
let t = gp.getBoundingSphere(_p);
|
|
9534
9605
|
return !Number.isFinite(t.radius) || t.radius <= 0 ? null : t;
|
|
9535
9606
|
}
|
|
9536
|
-
function
|
|
9607
|
+
function Np(e) {
|
|
9537
9608
|
return e.type === "Group" && typeof e.userData.modelID == "number";
|
|
9538
9609
|
}
|
|
9539
|
-
function
|
|
9540
|
-
return e?.children.filter(
|
|
9610
|
+
function Pp(e) {
|
|
9611
|
+
return e?.children.filter(Np) ?? [];
|
|
9541
9612
|
}
|
|
9542
|
-
function
|
|
9543
|
-
return
|
|
9613
|
+
function Fp(e, t) {
|
|
9614
|
+
return Pp(e).find((e) => e.userData.modelID === t) ?? null;
|
|
9544
9615
|
}
|
|
9545
|
-
function
|
|
9546
|
-
return e instanceof
|
|
9616
|
+
function Ip(e) {
|
|
9617
|
+
return e instanceof se ? "orthographic" : "perspective";
|
|
9547
9618
|
}
|
|
9548
|
-
function
|
|
9549
|
-
return e instanceof L || e instanceof
|
|
9619
|
+
function Lp(e) {
|
|
9620
|
+
return e instanceof L || e instanceof se;
|
|
9550
9621
|
}
|
|
9551
|
-
function
|
|
9622
|
+
function Rp(e) {
|
|
9552
9623
|
return e.height > 0 ? e.width / e.height : 1;
|
|
9553
9624
|
}
|
|
9554
|
-
function
|
|
9555
|
-
return Math.max(
|
|
9625
|
+
function zp(e) {
|
|
9626
|
+
return Math.max(sp, (e.top - e.bottom) / Math.max(e.zoom, 1e-4));
|
|
9556
9627
|
}
|
|
9557
|
-
function
|
|
9558
|
-
let r = Math.max(
|
|
9628
|
+
function Bp(e, t, n) {
|
|
9629
|
+
let r = Math.max(sp, n) * Math.max(e.zoom, 1e-4), i = r * t;
|
|
9559
9630
|
e.left = -i / 2, e.right = i / 2, e.top = r / 2, e.bottom = -r / 2, e.updateProjectionMatrix();
|
|
9560
9631
|
}
|
|
9561
|
-
function
|
|
9562
|
-
if (e instanceof
|
|
9632
|
+
function Vp(e, t) {
|
|
9633
|
+
if (e instanceof se) return zp(e);
|
|
9563
9634
|
if (e instanceof L) {
|
|
9564
|
-
let n = Math.max(
|
|
9565
|
-
return 2 * Math.tan(
|
|
9635
|
+
let n = Math.max(op, e.position.distanceTo(t));
|
|
9636
|
+
return 2 * Math.tan(re.degToRad(e.fov) / 2) * n;
|
|
9566
9637
|
}
|
|
9567
9638
|
return 1;
|
|
9568
9639
|
}
|
|
9569
|
-
function
|
|
9570
|
-
let n =
|
|
9640
|
+
function Hp(e, t) {
|
|
9641
|
+
let n = Rp(t);
|
|
9571
9642
|
if (e instanceof L) {
|
|
9572
9643
|
e.aspect = n, e.updateProjectionMatrix();
|
|
9573
9644
|
return;
|
|
9574
9645
|
}
|
|
9575
|
-
e instanceof
|
|
9646
|
+
e instanceof se && Bp(e, n, zp(e));
|
|
9576
9647
|
}
|
|
9577
|
-
function
|
|
9578
|
-
let n =
|
|
9648
|
+
function Up(e, t) {
|
|
9649
|
+
let n = Mp(t);
|
|
9579
9650
|
if (!n) return;
|
|
9580
|
-
let r = Math.max(
|
|
9651
|
+
let r = Math.max(cp, n.radius * lp, e.near + 1);
|
|
9581
9652
|
Math.abs(e.far - r) < 1 || (e.far = r, e.updateProjectionMatrix());
|
|
9582
9653
|
}
|
|
9583
|
-
function
|
|
9654
|
+
function Wp(e, t) {
|
|
9584
9655
|
let n = new _();
|
|
9585
9656
|
return Object.entries(e).forEach(([e, r]) => {
|
|
9586
9657
|
let i = Number(e), a = t.elementBounds.get(i);
|
|
@@ -9590,35 +9661,35 @@ function zp(e, t) {
|
|
|
9590
9661
|
});
|
|
9591
9662
|
}), n.isEmpty() ? null : n;
|
|
9592
9663
|
}
|
|
9593
|
-
function
|
|
9594
|
-
let t = e.getSize(
|
|
9595
|
-
return Number.isFinite(n) && n > 0 ? n *
|
|
9664
|
+
function Gp(e) {
|
|
9665
|
+
let t = e.getSize(bp), n = Math.max(t.x, t.y, t.z);
|
|
9666
|
+
return Number.isFinite(n) && n > 0 ? n * mp : $f;
|
|
9596
9667
|
}
|
|
9597
|
-
function
|
|
9598
|
-
let r = Math.max(
|
|
9599
|
-
return Number.isFinite(i) && i >= r ? e : (
|
|
9668
|
+
function Kp(e, t, n) {
|
|
9669
|
+
let r = Math.max($f, (Number.isFinite(n) ? n : $f) * pp), i = t.position.distanceTo(e);
|
|
9670
|
+
return Number.isFinite(i) && i >= r ? e : (vp.copy(e).sub(t.position), (!Number.isFinite(vp.x + vp.y + vp.z) || vp.lengthSq() === 0) && t.getWorldDirection(vp), vp.lengthSq() === 0 && vp.set(0, 0, -1), vp.normalize(), yp.copy(t.position).addScaledVector(vp, r));
|
|
9600
9671
|
}
|
|
9601
|
-
var
|
|
9602
|
-
let
|
|
9672
|
+
var qp = i(function({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadGeneration: i, lightRef: o, materialMode: c, modelRef: p, modelsData: m, modelsLoading: h, initialPlanPlane: _, createPlanComment: v, createPlanMarkupCloud: y, deleteAllPlanNotes: b, onReady: x, onModelsReady: S, onCameraDprModeChange: C, publicApi: w, invalidatePlanViews: T, setPlanPreselectionHandler: E, setPlanVisualObjectsGetter: D, setSceneApi: O, setPlanNotesModeActive: k, usePerformanceMoving: A, useWebGPU: j }) {
|
|
9673
|
+
let M = g((e) => e.camera), ee = g((e) => e.gl), N = g((e) => e.invalidate), te = g((e) => e.scene), ne = g((e) => e.set), P = g((e) => e.size), F = su(p), I = Eu(F), { colorPaletteTexture: ie, colorUtils: ae } = ul(F), oe = nt(), ce = G((e) => e.selected), le = co(p), R = id(p, n, le, j, T), z = a((e) => {
|
|
9603
9674
|
R.setCapsPreselection(e), T();
|
|
9604
9675
|
}, [R, T]);
|
|
9605
9676
|
s(() => {
|
|
9606
9677
|
T();
|
|
9607
|
-
}, [T, ce]), s(() => (
|
|
9608
|
-
z(e),
|
|
9678
|
+
}, [T, ce]), s(() => (D(() => R.getPlanVisualObjects()), () => D(null)), [R, D]), s(() => (E((e) => {
|
|
9679
|
+
z(e), N();
|
|
9609
9680
|
}), () => E(null)), [
|
|
9610
9681
|
R,
|
|
9611
|
-
|
|
9682
|
+
N,
|
|
9612
9683
|
z,
|
|
9613
9684
|
E
|
|
9614
9685
|
]);
|
|
9615
9686
|
let B = Eo(p, n, le, R.getSelectableObjects, R.getSnapPoints), ue = a((e) => {
|
|
9616
|
-
B.setActive(e),
|
|
9617
|
-
}, [B,
|
|
9687
|
+
B.setActive(e), oe.getState().setDimensionsActive(e);
|
|
9688
|
+
}, [B, oe]), de = a(() => {
|
|
9618
9689
|
ue(!B.getActive());
|
|
9619
9690
|
}, [B, ue]), fe = os(p), pe = a((e) => {
|
|
9620
|
-
fe.setNodeModeActive(e),
|
|
9621
|
-
}, [fe,
|
|
9691
|
+
fe.setNodeModeActive(e), k(e);
|
|
9692
|
+
}, [fe, k]), me = a(() => {
|
|
9622
9693
|
pe(!fe.getNodeModeActive());
|
|
9623
9694
|
}, [fe, pe]), V = u(() => ({
|
|
9624
9695
|
...fe,
|
|
@@ -9642,31 +9713,31 @@ var Hp = i(function({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView:
|
|
|
9642
9713
|
fe,
|
|
9643
9714
|
pe,
|
|
9644
9715
|
me
|
|
9645
|
-
]), he = u(() => new kn(), []), ge =
|
|
9716
|
+
]), he = u(() => new kn(), []), ge = I.buildIndex, H = ae.applyStoredColors, _e = yf(), be = d(null), xe = d(null), Se = d(null), Ce = d(null), we = d(null), Te = d(null), De = d(xp()), ke = d([]), Ae = d(/* @__PURE__ */ new Map()), je = d(/* @__PURE__ */ new Set()), Me = d(h), Ne = d(null), Pe = d(null), Fe = d(null), Ie = d(0), Le = d(!1), Re = d(h), ze = d(!1), Be = d(!1), Ve = d(i), He = d(/* @__PURE__ */ new Map()), [Ue, We] = f(0), [Ge, Ke] = f(0), [qe, Je] = f(!0);
|
|
9646
9717
|
s(() => {
|
|
9647
9718
|
let e = new Set(Object.keys(m).map((e) => Number(e)));
|
|
9648
9719
|
je.current.forEach((t) => {
|
|
9649
|
-
e.has(t) ||
|
|
9720
|
+
e.has(t) || ae.clearModelColors(t);
|
|
9650
9721
|
}), je.current = e;
|
|
9651
|
-
}, [
|
|
9722
|
+
}, [ae, m]);
|
|
9652
9723
|
let [Ye, Xe] = f(!1), [Ze, Qe] = f({}), $e = d(!1), et = G((e) => e.showStats), tt = G((e) => e.lighting), rt = G((e) => e.performanceMovingFactor);
|
|
9653
|
-
Ve.current !== i && (Ve.current = i, He.current.clear(), De.current =
|
|
9724
|
+
Ve.current !== i && (Ve.current = i, He.current.clear(), De.current = xp(), Ne.current = null);
|
|
9654
9725
|
let it = a((e, t, n) => {
|
|
9655
9726
|
let r = He.current.get(e) ?? 0;
|
|
9656
9727
|
He.current.set(e, t), n > 0 && t >= n && r < n && We((e) => e + 1);
|
|
9657
9728
|
}, []), at = a((e) => {
|
|
9658
9729
|
if (p.current = e, !e) return;
|
|
9659
9730
|
let t = e;
|
|
9660
|
-
t.isClippingGroup =
|
|
9661
|
-
}, [p,
|
|
9731
|
+
t.isClippingGroup = j, t.enabled = !1, t.clipIntersection = !1, t.clipShadows = !1, t.clippingPlanes = [];
|
|
9732
|
+
}, [p, j]), ot = a((e) => {
|
|
9662
9733
|
let t = Pe.current;
|
|
9663
9734
|
if (!t || e.camera.uuid !== t.cameraUuid) return !1;
|
|
9664
9735
|
Pe.current = null, e.cancel(), e.updateCameraUp();
|
|
9665
9736
|
let n = e;
|
|
9666
|
-
return e.zoomTo(t.zoom, !1), e.setFocalOffset(0, 0, 0, !1), e.setLookAt(t.position.x, t.position.y, t.position.z, t.target.x, t.target.y, t.target.z, !1),
|
|
9667
|
-
}, [
|
|
9737
|
+
return e.zoomTo(t.zoom, !1), e.setFocalOffset(0, 0, 0, !1), e.setLookAt(t.position.x, t.position.y, t.position.z, t.target.x, t.target.y, t.target.z, !1), jp(e), e.minDistance = Ap(p.current), e.stop(), e.update(0), n.saveState?.(), N(), !0;
|
|
9738
|
+
}, [N, p]), st = a((e) => {
|
|
9668
9739
|
let t = n;
|
|
9669
|
-
t.current !== e && (t.current = e, e && (e.minDistance =
|
|
9740
|
+
t.current !== e && (t.current = e, e && (e.minDistance = Ap(p.current), jp(e), ot(e)), Ke((e) => e + 1));
|
|
9670
9741
|
}, [
|
|
9671
9742
|
n,
|
|
9672
9743
|
p,
|
|
@@ -9681,10 +9752,10 @@ var Hp = i(function({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView:
|
|
|
9681
9752
|
...e
|
|
9682
9753
|
}));
|
|
9683
9754
|
}, []), ut = a(() => {
|
|
9684
|
-
xe.current !== null && (window.clearTimeout(xe.current), xe.current = null), Se.current !== null && (window.clearTimeout(Se.current), Se.current = null), Ce.current !== null && (window.clearTimeout(Ce.current), Ce.current = null),
|
|
9755
|
+
xe.current !== null && (window.clearTimeout(xe.current), xe.current = null), Se.current !== null && (window.clearTimeout(Se.current), Se.current = null), Ce.current !== null && (window.clearTimeout(Ce.current), Ce.current = null), kp(Te.current), Te.current = null, we.current = null, R.setCapsCameraMotionActive(!1), R.setEdgesCameraMotionActive?.(!1), C("sleep"), N();
|
|
9685
9756
|
}, [
|
|
9686
9757
|
R,
|
|
9687
|
-
|
|
9758
|
+
N,
|
|
9688
9759
|
C
|
|
9689
9760
|
]), dt = a((e) => {
|
|
9690
9761
|
let t = n.current;
|
|
@@ -9717,19 +9788,19 @@ var Hp = i(function({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView:
|
|
|
9717
9788
|
}, [
|
|
9718
9789
|
R,
|
|
9719
9790
|
p,
|
|
9720
|
-
|
|
9791
|
+
j
|
|
9721
9792
|
]), s(() => {
|
|
9722
|
-
|
|
9793
|
+
Hp(M, P), N();
|
|
9723
9794
|
}, [
|
|
9724
|
-
j,
|
|
9725
9795
|
M,
|
|
9726
|
-
N
|
|
9727
|
-
|
|
9796
|
+
N,
|
|
9797
|
+
P.height,
|
|
9798
|
+
P.width
|
|
9728
9799
|
]), l(() => {
|
|
9729
9800
|
let e = n.current;
|
|
9730
9801
|
e && ot(e);
|
|
9731
9802
|
}, [
|
|
9732
|
-
|
|
9803
|
+
M,
|
|
9733
9804
|
n,
|
|
9734
9805
|
Ge,
|
|
9735
9806
|
ot
|
|
@@ -9737,11 +9808,11 @@ var Hp = i(function({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView:
|
|
|
9737
9808
|
let pt = u(() => {
|
|
9738
9809
|
let e = Object.keys(m).sort((e, t) => Number(e) - Number(t));
|
|
9739
9810
|
for (let t of e) {
|
|
9740
|
-
let e =
|
|
9811
|
+
let e = zl(m[Number(t)]);
|
|
9741
9812
|
if (e) return e;
|
|
9742
9813
|
}
|
|
9743
9814
|
return null;
|
|
9744
|
-
}, [m]), mt = u(() =>
|
|
9815
|
+
}, [m]), mt = u(() => Ll(pt ?? void 0), [pt]), ht = u(() => Object.entries(m).map(([e, t]) => [Number(e), t]), [m]), gt = u(() => ht.map(([e]) => e), [ht]), _t = u(() => new Map(ht.map(([e, t]) => [e, Object.keys(t.data).length])), [ht]);
|
|
9745
9816
|
ke.current = gt, Ae.current = _t, Me.current = h, s(() => {
|
|
9746
9817
|
let e = new Set(gt);
|
|
9747
9818
|
He.current.forEach((t, n) => {
|
|
@@ -9749,13 +9820,13 @@ var Hp = i(function({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView:
|
|
|
9749
9820
|
});
|
|
9750
9821
|
}, [gt]);
|
|
9751
9822
|
let vt = c !== "performance", yt = a(() => {
|
|
9752
|
-
n.current && (n.current.minDistance =
|
|
9823
|
+
n.current && (n.current.minDistance = Ap(p.current));
|
|
9753
9824
|
}, [n, p]), bt = a((e, t = !1) => {
|
|
9754
9825
|
let r = n.current;
|
|
9755
9826
|
if (!r) return !1;
|
|
9756
|
-
let i = t ?
|
|
9827
|
+
let i = t ? Kp(e, M, r.minDistance) : e;
|
|
9757
9828
|
return r.cancel(), r.setOrbitPoint(i.x, i.y, i.z), !0;
|
|
9758
|
-
}, [
|
|
9829
|
+
}, [M, n]), xt = a((e) => {
|
|
9759
9830
|
be.current = e.clone(), bt(e, !0);
|
|
9760
9831
|
}, [bt]), St = a(() => {
|
|
9761
9832
|
be.current = null, _e(p, n, o);
|
|
@@ -9765,47 +9836,47 @@ var Hp = i(function({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView:
|
|
|
9765
9836
|
o,
|
|
9766
9837
|
p
|
|
9767
9838
|
]), Ct = a((e) => {
|
|
9768
|
-
if (!
|
|
9769
|
-
if (
|
|
9839
|
+
if (!Lp(M)) return null;
|
|
9840
|
+
if (Ip(M) === e) return M;
|
|
9770
9841
|
let r = n.current, i = new U(), a = new U();
|
|
9771
|
-
r ? (r.getTarget(i, !0), r.getPosition(a, !0)) : (
|
|
9842
|
+
r ? (r.getTarget(i, !0), r.getPosition(a, !0)) : (M.getWorldDirection(i), a.copy(M.position), i.add(a));
|
|
9772
9843
|
let o = a.clone().sub(i);
|
|
9773
|
-
o.lengthSq() <
|
|
9774
|
-
let s =
|
|
9844
|
+
o.lengthSq() < op * op && M.getWorldDirection(o).multiplyScalar(-1), o.lengthSq() < op * op && o.copy(hp), o.normalize();
|
|
9845
|
+
let s = Rp(P), c = Vp(M, i), l = M.near, u = M.far, d = e === "orthographic" ? new se(-s * c * .5, s * c * .5, c * .5, -c * .5, l, u) : new L(ap, s, l, u);
|
|
9775
9846
|
if (d.manual = !0, d instanceof L) {
|
|
9776
|
-
let e = c / (2 * Math.tan(
|
|
9847
|
+
let e = c / (2 * Math.tan(re.degToRad(d.fov) * .5));
|
|
9777
9848
|
a.copy(i).addScaledVector(o, e);
|
|
9778
9849
|
}
|
|
9779
|
-
return d.position.copy(a), d.up.copy(
|
|
9850
|
+
return d.position.copy(a), d.up.copy(M.up), d.layers.mask = M.layers.mask, d.lookAt(i), d.updateMatrixWorld(!0), Hp(d, P), Pe.current = {
|
|
9780
9851
|
cameraUuid: d.uuid,
|
|
9781
9852
|
position: a.clone(),
|
|
9782
9853
|
target: i.clone(),
|
|
9783
9854
|
zoom: d.zoom
|
|
9784
|
-
}, r?.cancel(), Ne.current = d.uuid, t.current = d,
|
|
9855
|
+
}, r?.cancel(), Ne.current = d.uuid, t.current = d, ne({ camera: d }), N(), d;
|
|
9785
9856
|
}, [
|
|
9786
|
-
|
|
9857
|
+
M,
|
|
9787
9858
|
t,
|
|
9788
9859
|
n,
|
|
9789
|
-
|
|
9860
|
+
N,
|
|
9790
9861
|
p,
|
|
9791
|
-
|
|
9792
|
-
|
|
9793
|
-
|
|
9862
|
+
ne,
|
|
9863
|
+
P.height,
|
|
9864
|
+
P.width
|
|
9794
9865
|
]), wt = a(() => {
|
|
9795
|
-
let e =
|
|
9866
|
+
let e = Ip(M) === "perspective" ? "orthographic" : "perspective";
|
|
9796
9867
|
return Ct(e), e;
|
|
9797
|
-
}, [
|
|
9798
|
-
let i = Ct("orthographic") ?? (
|
|
9868
|
+
}, [M, Ct]), Tt = a((e, t, { createClippingPlane: r = !0 } = {}) => {
|
|
9869
|
+
let i = Ct("orthographic") ?? (Lp(M) ? M : null);
|
|
9799
9870
|
if (!i) return null;
|
|
9800
9871
|
let a = e.clone().normalize(), o = !1;
|
|
9801
9872
|
Ie.current += 1, ft(!0), R.setHelpersActive(!1), r && R.createPlaneFromPointAndNormal(qs(a), a.normal.clone());
|
|
9802
9873
|
let s = Ks({
|
|
9803
9874
|
camera: i,
|
|
9804
9875
|
controls: n.current,
|
|
9805
|
-
invalidate:
|
|
9876
|
+
invalidate: N,
|
|
9806
9877
|
model: p.current,
|
|
9807
9878
|
plane: a,
|
|
9808
|
-
size:
|
|
9879
|
+
size: P,
|
|
9809
9880
|
viewNormal: t
|
|
9810
9881
|
});
|
|
9811
9882
|
return s ? (Pe.current = {
|
|
@@ -9820,40 +9891,40 @@ var Hp = i(function({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView:
|
|
|
9820
9891
|
plane: a.clone()
|
|
9821
9892
|
}) : (Ie.current = Math.max(0, Ie.current - 1), Ie.current || ft(!1), null);
|
|
9822
9893
|
}, [
|
|
9823
|
-
|
|
9894
|
+
M,
|
|
9824
9895
|
R,
|
|
9825
9896
|
n,
|
|
9826
|
-
|
|
9897
|
+
N,
|
|
9827
9898
|
p,
|
|
9828
9899
|
Ct,
|
|
9829
9900
|
ft,
|
|
9830
|
-
|
|
9901
|
+
P
|
|
9831
9902
|
]);
|
|
9832
9903
|
s(() => {
|
|
9833
|
-
if (!_ || Be.current || !p.current || !
|
|
9904
|
+
if (!_ || Be.current || !p.current || !Lp(M)) return;
|
|
9834
9905
|
let e = _.clone().normalize();
|
|
9835
9906
|
Be.current = !0;
|
|
9836
|
-
let t = Ct("orthographic") ?? (
|
|
9907
|
+
let t = Ct("orthographic") ?? (Lp(M) ? M : null);
|
|
9837
9908
|
t && (ft(!0), R.setHelpersActive(!1), R.createPlaneFromPointAndNormal(qs(e), e.normal.clone()), requestAnimationFrame(() => {
|
|
9838
9909
|
Ks({
|
|
9839
9910
|
camera: t,
|
|
9840
9911
|
controls: n.current,
|
|
9841
|
-
invalidate:
|
|
9912
|
+
invalidate: N,
|
|
9842
9913
|
model: p.current,
|
|
9843
9914
|
plane: e,
|
|
9844
|
-
size:
|
|
9915
|
+
size: P
|
|
9845
9916
|
});
|
|
9846
9917
|
}));
|
|
9847
9918
|
}, [
|
|
9848
|
-
|
|
9919
|
+
M,
|
|
9849
9920
|
R,
|
|
9850
9921
|
n,
|
|
9851
9922
|
_,
|
|
9852
|
-
|
|
9923
|
+
N,
|
|
9853
9924
|
p,
|
|
9854
9925
|
Ct,
|
|
9855
9926
|
ft,
|
|
9856
|
-
|
|
9927
|
+
P
|
|
9857
9928
|
]);
|
|
9858
9929
|
let Et = a(() => {
|
|
9859
9930
|
if (Me.current) return !0;
|
|
@@ -9865,14 +9936,14 @@ var Hp = i(function({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView:
|
|
|
9865
9936
|
}, []), Dt = a((t) => {
|
|
9866
9937
|
if (!t) return !1;
|
|
9867
9938
|
let n = Et();
|
|
9868
|
-
if (!e || !r) return n || (De.current =
|
|
9939
|
+
if (!e || !r) return n || (De.current = xp()), !1;
|
|
9869
9940
|
let i = De.current;
|
|
9870
9941
|
if (n) {
|
|
9871
|
-
i.active || (De.current =
|
|
9942
|
+
i.active || (De.current = xp(!0));
|
|
9872
9943
|
let e = De.current;
|
|
9873
9944
|
return e.firstFitDone ? !1 : (e.firstFitDone = !0, !0);
|
|
9874
9945
|
}
|
|
9875
|
-
return i.active ? i.finalFitDone ? !1 : i.firstFitDone && i.userInteractedAfterFirstFit ? (De.current =
|
|
9946
|
+
return i.active ? i.finalFitDone ? !1 : i.firstFitDone && i.userInteractedAfterFirstFit ? (De.current = xp(), !1) : (i.finalFitDone = !0, !0) : !0;
|
|
9876
9947
|
}, [
|
|
9877
9948
|
e,
|
|
9878
9949
|
r,
|
|
@@ -9880,11 +9951,11 @@ var Hp = i(function({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView:
|
|
|
9880
9951
|
]), Ot = a((e, t = !1) => {
|
|
9881
9952
|
let r = n.current;
|
|
9882
9953
|
if (!r) return;
|
|
9883
|
-
let i =
|
|
9954
|
+
let i = Wp(e, F.buildIndex());
|
|
9884
9955
|
if (!i) return;
|
|
9885
9956
|
let a = i.getCenter(new U());
|
|
9886
9957
|
if (be.current = a.clone(), r.cancel(), t) {
|
|
9887
|
-
let e =
|
|
9958
|
+
let e = Gp(i);
|
|
9888
9959
|
r.fitToBox(i, !0, {
|
|
9889
9960
|
paddingBottom: e,
|
|
9890
9961
|
paddingLeft: e,
|
|
@@ -9900,7 +9971,7 @@ var Hp = i(function({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView:
|
|
|
9900
9971
|
}, [
|
|
9901
9972
|
bt,
|
|
9902
9973
|
n,
|
|
9903
|
-
|
|
9974
|
+
F
|
|
9904
9975
|
]), kt = u(() => {
|
|
9905
9976
|
let e = (e) => ({
|
|
9906
9977
|
...e,
|
|
@@ -9919,9 +9990,9 @@ var Hp = i(function({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView:
|
|
|
9919
9990
|
let e = () => {
|
|
9920
9991
|
xe.current !== null && (window.clearTimeout(xe.current), xe.current = null);
|
|
9921
9992
|
}, t = () => {
|
|
9922
|
-
Te.current && (
|
|
9993
|
+
Te.current && (kp(Te.current), Te.current = null, N());
|
|
9923
9994
|
};
|
|
9924
|
-
if (!
|
|
9995
|
+
if (!A) {
|
|
9925
9996
|
e(), t(), R.setCapsCameraMotionActive(!1), R.setEdgesCameraMotionActive?.(!1), C("sleep");
|
|
9926
9997
|
return;
|
|
9927
9998
|
}
|
|
@@ -9934,7 +10005,7 @@ var Hp = i(function({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView:
|
|
|
9934
10005
|
return;
|
|
9935
10006
|
}
|
|
9936
10007
|
xe.current = null, C("move"), R.setCapsCameraMotionActive(!0), R.setEdgesCameraMotionActive?.(!0);
|
|
9937
|
-
},
|
|
10008
|
+
}, tp));
|
|
9938
10009
|
}, a = () => {
|
|
9939
10010
|
e(), t(), R.setCapsCameraMotionActive(!1), R.setEdgesCameraMotionActive?.(!1), C("sleep");
|
|
9940
10011
|
};
|
|
@@ -9945,22 +10016,22 @@ var Hp = i(function({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView:
|
|
|
9945
10016
|
R,
|
|
9946
10017
|
n,
|
|
9947
10018
|
Ge,
|
|
9948
|
-
|
|
10019
|
+
N,
|
|
9949
10020
|
C,
|
|
9950
|
-
|
|
10021
|
+
A
|
|
9951
10022
|
]), s(() => {
|
|
9952
10023
|
let e = () => {
|
|
9953
10024
|
Se.current !== null && (window.clearTimeout(Se.current), Se.current = null);
|
|
9954
10025
|
}, t = () => {
|
|
9955
10026
|
Ce.current !== null && (window.clearTimeout(Ce.current), Ce.current = null);
|
|
9956
10027
|
}, r = (n = !1) => {
|
|
9957
|
-
e(), Te.current && (
|
|
10028
|
+
e(), Te.current && (kp(Te.current), Te.current = null, N()), n && (t(), we.current = null);
|
|
9958
10029
|
}, i = () => {
|
|
9959
10030
|
t(), Ce.current = window.setTimeout(() => {
|
|
9960
10031
|
Ce.current = null, we.current = null;
|
|
9961
|
-
},
|
|
10032
|
+
}, rp);
|
|
9962
10033
|
};
|
|
9963
|
-
if (!
|
|
10034
|
+
if (!A) {
|
|
9964
10035
|
r(!0);
|
|
9965
10036
|
return;
|
|
9966
10037
|
}
|
|
@@ -9968,13 +10039,13 @@ var Hp = i(function({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView:
|
|
|
9968
10039
|
if (!a) return;
|
|
9969
10040
|
let o = () => {
|
|
9970
10041
|
if (Se.current = null, Le.current || Te.current) return;
|
|
9971
|
-
p.current?.updateMatrixWorld(!0), (!we.current || we.current.root !== p.current) && (we.current =
|
|
10042
|
+
p.current?.updateMatrixWorld(!0), (!we.current || we.current.root !== p.current) && (we.current = Dp(p.current, rt));
|
|
9972
10043
|
let e = we.current;
|
|
9973
10044
|
if (!e) return;
|
|
9974
|
-
let t =
|
|
9975
|
-
t && (Te.current = t,
|
|
10045
|
+
let t = Op(e);
|
|
10046
|
+
t && (Te.current = t, N());
|
|
9976
10047
|
}, s = () => {
|
|
9977
|
-
Le.current || (t(), !Te.current && Se.current === null && (Se.current = window.setTimeout(o,
|
|
10048
|
+
Le.current || (t(), !Te.current && Se.current === null && (Se.current = window.setTimeout(o, np)));
|
|
9978
10049
|
}, c = () => {
|
|
9979
10050
|
r(), i();
|
|
9980
10051
|
};
|
|
@@ -9984,14 +10055,14 @@ var Hp = i(function({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView:
|
|
|
9984
10055
|
}, [
|
|
9985
10056
|
n,
|
|
9986
10057
|
Ge,
|
|
9987
|
-
|
|
10058
|
+
N,
|
|
9988
10059
|
p,
|
|
9989
10060
|
rt,
|
|
9990
|
-
|
|
10061
|
+
A
|
|
9991
10062
|
]), s(() => {
|
|
9992
|
-
h && !Re.current && (De.current =
|
|
10063
|
+
h && !Re.current && (De.current = xp(!0)), Re.current = h;
|
|
9993
10064
|
}, [h]), s(() => {
|
|
9994
|
-
let e = n.current, t =
|
|
10065
|
+
let e = n.current, t = ee.domElement, r = () => {
|
|
9995
10066
|
let e = De.current;
|
|
9996
10067
|
!e.active || !e.firstFitDone || (e.userInteractedAfterFirstFit = !0);
|
|
9997
10068
|
};
|
|
@@ -10001,22 +10072,22 @@ var Hp = i(function({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView:
|
|
|
10001
10072
|
}, [
|
|
10002
10073
|
n,
|
|
10003
10074
|
Ge,
|
|
10004
|
-
|
|
10075
|
+
ee
|
|
10005
10076
|
]);
|
|
10006
10077
|
let At = a(() => !Et(), [Et]);
|
|
10007
|
-
return
|
|
10008
|
-
let e =
|
|
10078
|
+
return uf(p, n, le, xt, R.getSelectableObjects, z, At, Ge), od(), s(() => {
|
|
10079
|
+
let e = ee.domElement, t = (e) => {
|
|
10009
10080
|
let t = be.current;
|
|
10010
10081
|
t && e.button === 0 && (e.ctrlKey || e.metaKey || e.shiftKey || bt(t, !0));
|
|
10011
10082
|
};
|
|
10012
10083
|
return e.addEventListener("pointerdown", t, !0), () => {
|
|
10013
10084
|
e.removeEventListener("pointerdown", t, !0);
|
|
10014
10085
|
};
|
|
10015
|
-
}, [bt,
|
|
10086
|
+
}, [bt, ee]), s(() => (le.setClippingSource(R), () => {
|
|
10016
10087
|
le.setClippingSource(null);
|
|
10017
|
-
}), [le, R]), s(() => (t.current =
|
|
10018
|
-
t.current ===
|
|
10019
|
-
}), [
|
|
10088
|
+
}), [le, R]), s(() => (t.current = M, () => {
|
|
10089
|
+
t.current === M && (t.current = null);
|
|
10090
|
+
}), [M, t]), s(() => {
|
|
10020
10091
|
if (!p.current) return;
|
|
10021
10092
|
let t = null, n = null, r = !1, a = (e) => {
|
|
10022
10093
|
t = requestAnimationFrame(e);
|
|
@@ -10025,32 +10096,32 @@ var Hp = i(function({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView:
|
|
|
10025
10096
|
if (!e) {
|
|
10026
10097
|
let e = De.current;
|
|
10027
10098
|
if (e.active && e.firstFitDone && e.userInteractedAfterFirstFit) {
|
|
10028
|
-
De.current =
|
|
10099
|
+
De.current = xp();
|
|
10029
10100
|
return;
|
|
10030
10101
|
}
|
|
10031
10102
|
}
|
|
10032
|
-
St(), e || (De.current =
|
|
10103
|
+
St(), e || (De.current = xp());
|
|
10033
10104
|
}, s = () => {
|
|
10034
10105
|
if (e) {
|
|
10035
|
-
if (!
|
|
10106
|
+
if (!j) {
|
|
10036
10107
|
o();
|
|
10037
10108
|
return;
|
|
10038
10109
|
}
|
|
10039
10110
|
a(() => {
|
|
10040
10111
|
r || !p.current || (p.current.updateMatrixWorld(!0), (async () => {
|
|
10041
|
-
let e =
|
|
10112
|
+
let e = ee;
|
|
10042
10113
|
if (typeof e.compileAsync == "function") try {
|
|
10043
|
-
await e.compileAsync(
|
|
10114
|
+
await e.compileAsync(te, M);
|
|
10044
10115
|
} catch {}
|
|
10045
10116
|
r || !p.current || a(() => {
|
|
10046
|
-
r || !p.current || (p.current.updateMatrixWorld(!0), o(),
|
|
10117
|
+
r || !p.current || (p.current.updateMatrixWorld(!0), o(), N());
|
|
10047
10118
|
});
|
|
10048
10119
|
})());
|
|
10049
10120
|
});
|
|
10050
10121
|
}
|
|
10051
10122
|
}, c = () => {
|
|
10052
10123
|
if (n !== null) return;
|
|
10053
|
-
let e =
|
|
10124
|
+
let e = fp, t = () => {
|
|
10054
10125
|
if (r) {
|
|
10055
10126
|
n = null;
|
|
10056
10127
|
return;
|
|
@@ -10068,51 +10139,51 @@ var Hp = i(function({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView:
|
|
|
10068
10139
|
n = requestAnimationFrame(t);
|
|
10069
10140
|
}, l = (e) => {
|
|
10070
10141
|
if (r || !p.current) return;
|
|
10071
|
-
p.current.updateMatrixWorld(!0), (
|
|
10142
|
+
p.current.updateMatrixWorld(!0), (M instanceof L || M instanceof se) && Up(M, p.current), yt();
|
|
10072
10143
|
let n = ge();
|
|
10073
10144
|
if (!n.records.size && e > 0) {
|
|
10074
10145
|
t = requestAnimationFrame(() => l(e - 1));
|
|
10075
10146
|
return;
|
|
10076
10147
|
}
|
|
10077
10148
|
let i = Et();
|
|
10078
|
-
i ? R.getActive() && R.updateMaterials() : (H(), R.syncWithModel()), B.syncWithModel(), n.records.size > 0 && !i && c(), Ne.current !==
|
|
10149
|
+
i ? R.getActive() && R.updateMaterials() : (H(), R.syncWithModel()), B.syncWithModel(), n.records.size > 0 && !i && c(), Ne.current !== M.uuid && Dt(n.records.size > 0) && s();
|
|
10079
10150
|
};
|
|
10080
|
-
return a(() => l(
|
|
10151
|
+
return a(() => l(j ? dp : up)), () => {
|
|
10081
10152
|
r = !0, t !== null && cancelAnimationFrame(t), n !== null && cancelAnimationFrame(n);
|
|
10082
10153
|
};
|
|
10083
10154
|
}, [
|
|
10084
10155
|
H,
|
|
10085
10156
|
e,
|
|
10086
10157
|
ge,
|
|
10087
|
-
|
|
10158
|
+
M,
|
|
10088
10159
|
R,
|
|
10089
10160
|
n,
|
|
10090
10161
|
B,
|
|
10091
10162
|
St,
|
|
10092
10163
|
Et,
|
|
10093
10164
|
o,
|
|
10094
|
-
|
|
10165
|
+
ee,
|
|
10095
10166
|
p,
|
|
10096
10167
|
m,
|
|
10097
10168
|
h,
|
|
10098
10169
|
Ue,
|
|
10099
10170
|
i,
|
|
10100
10171
|
S,
|
|
10101
|
-
|
|
10172
|
+
te,
|
|
10102
10173
|
Dt,
|
|
10103
10174
|
yt,
|
|
10104
|
-
|
|
10175
|
+
j
|
|
10105
10176
|
]), s(() => {
|
|
10106
10177
|
let e = () => {
|
|
10107
10178
|
R.getActive() && R.syncWithModel();
|
|
10108
10179
|
}, t = (t) => {
|
|
10109
10180
|
t(), e();
|
|
10110
10181
|
};
|
|
10111
|
-
return
|
|
10182
|
+
return O({
|
|
10112
10183
|
camera: {
|
|
10113
10184
|
fitCamera: St,
|
|
10114
10185
|
getIntersection: le.getIntersection,
|
|
10115
|
-
getProjection: () =>
|
|
10186
|
+
getProjection: () => Ip(M),
|
|
10116
10187
|
setFirstPersonControlActive: ct,
|
|
10117
10188
|
setFirstPersonControlSettings: lt,
|
|
10118
10189
|
setProjection: Ct,
|
|
@@ -10139,12 +10210,12 @@ var Hp = i(function({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView:
|
|
|
10139
10210
|
updateMaterials: R.updateMaterials
|
|
10140
10211
|
},
|
|
10141
10212
|
colors: {
|
|
10142
|
-
clearAllColors:
|
|
10143
|
-
clearColor:
|
|
10144
|
-
clearModelColors:
|
|
10145
|
-
rebuildByColors:
|
|
10146
|
-
rebuildModelByColors:
|
|
10147
|
-
setColor:
|
|
10213
|
+
clearAllColors: ae.clearAllColors,
|
|
10214
|
+
clearColor: ae.clearColor,
|
|
10215
|
+
clearModelColors: ae.clearModelColors,
|
|
10216
|
+
rebuildByColors: ae.rebuildByColors,
|
|
10217
|
+
rebuildModelByColors: ae.rebuildModelByColors,
|
|
10218
|
+
setColor: ae.setColor
|
|
10148
10219
|
},
|
|
10149
10220
|
converter: kt,
|
|
10150
10221
|
dimensions: {
|
|
@@ -10179,40 +10250,40 @@ var Hp = i(function({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView:
|
|
|
10179
10250
|
},
|
|
10180
10251
|
geometryUtils: {
|
|
10181
10252
|
get indexesState() {
|
|
10182
|
-
return
|
|
10253
|
+
return I.indexesState;
|
|
10183
10254
|
},
|
|
10184
|
-
getAllIds:
|
|
10185
|
-
getIfcSpacesVisibility:
|
|
10186
|
-
getModelGeometry: (e) =>
|
|
10187
|
-
getModelsGeometry: () =>
|
|
10188
|
-
hideByIds: (e, n) => t(() =>
|
|
10189
|
-
hideSelected: () => t(
|
|
10190
|
-
isolateByIds: (e, n) => t(() =>
|
|
10191
|
-
isolateSelected: () => t(
|
|
10192
|
-
removeByIds: (e, n) => t(() =>
|
|
10193
|
-
resetIsolation: () => t(
|
|
10194
|
-
setIfcSpacesVisibility: (e) => t(() =>
|
|
10195
|
-
showAll: () => t(
|
|
10196
|
-
showByIds: (e, n) => t(() =>
|
|
10197
|
-
toggleIIfcSpacesVisibility: () => t(
|
|
10255
|
+
getAllIds: I.getAllIds,
|
|
10256
|
+
getIfcSpacesVisibility: I.getIfcSpacesVisibility,
|
|
10257
|
+
getModelGeometry: (e) => Fp(p.current, e),
|
|
10258
|
+
getModelsGeometry: () => Pp(p.current),
|
|
10259
|
+
hideByIds: (e, n) => t(() => I.hideByIds(e, n)),
|
|
10260
|
+
hideSelected: () => t(I.hideSelected),
|
|
10261
|
+
isolateByIds: (e, n) => t(() => I.isolateByIds(e, n)),
|
|
10262
|
+
isolateSelected: () => t(I.isolateSelected),
|
|
10263
|
+
removeByIds: (e, n) => t(() => I.removeByIds(e, n)),
|
|
10264
|
+
resetIsolation: () => t(I.resetIsolation),
|
|
10265
|
+
setIfcSpacesVisibility: (e) => t(() => I.setIfcSpacesVisibility(e)),
|
|
10266
|
+
showAll: () => t(I.showAll),
|
|
10267
|
+
showByIds: (e, n) => t(() => I.showByIds(e, n)),
|
|
10268
|
+
toggleIIfcSpacesVisibility: () => t(I.toggleIIfcSpacesVisibility),
|
|
10198
10269
|
useTrueNorth: (e = !0) => {
|
|
10199
|
-
Je(e), t(() =>
|
|
10270
|
+
Je(e), t(() => I.useTrueNorth(e));
|
|
10200
10271
|
}
|
|
10201
10272
|
},
|
|
10202
10273
|
plans: { createPlan: Tt },
|
|
10203
10274
|
selector: { setTargetToSelection: Ot }
|
|
10204
|
-
}), ze.current || (ze.current = !0, x?.(w)), () =>
|
|
10275
|
+
}), ze.current || (ze.current = !0, x?.(w)), () => O(null);
|
|
10205
10276
|
}, [
|
|
10206
|
-
|
|
10277
|
+
M,
|
|
10207
10278
|
R,
|
|
10208
10279
|
le,
|
|
10209
|
-
|
|
10280
|
+
ae,
|
|
10210
10281
|
n,
|
|
10211
10282
|
kt,
|
|
10212
10283
|
Tt,
|
|
10213
10284
|
B,
|
|
10214
10285
|
St,
|
|
10215
|
-
|
|
10286
|
+
I,
|
|
10216
10287
|
o,
|
|
10217
10288
|
p,
|
|
10218
10289
|
V,
|
|
@@ -10222,12 +10293,12 @@ var Hp = i(function({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView:
|
|
|
10222
10293
|
ue,
|
|
10223
10294
|
ct,
|
|
10224
10295
|
lt,
|
|
10225
|
-
|
|
10296
|
+
O,
|
|
10226
10297
|
Ot,
|
|
10227
10298
|
de,
|
|
10228
10299
|
wt
|
|
10229
10300
|
]), /* @__PURE__ */ ye(ve, { children: [
|
|
10230
|
-
vt && (
|
|
10301
|
+
vt && (j ? /* @__PURE__ */ W(ca, {
|
|
10231
10302
|
ambientColor: tt.ambient.color,
|
|
10232
10303
|
ambientIntensity: tt.ambient.intensity,
|
|
10233
10304
|
directionalColor: tt.directional.color,
|
|
@@ -10249,20 +10320,21 @@ var Hp = i(function({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView:
|
|
|
10249
10320
|
et && /* @__PURE__ */ W(Oe, {}),
|
|
10250
10321
|
/* @__PURE__ */ W("group", {
|
|
10251
10322
|
ref: at,
|
|
10252
|
-
children: ht.map(([e, t]) => /* @__PURE__ */ W(
|
|
10253
|
-
colorPaletteTexture:
|
|
10323
|
+
children: ht.map(([e, t]) => /* @__PURE__ */ W(Yl, {
|
|
10324
|
+
colorPaletteTexture: ie,
|
|
10254
10325
|
coordinationMatrix: mt,
|
|
10255
10326
|
data: t,
|
|
10327
|
+
getClippingPlanes: R.getMaterialPlanes,
|
|
10256
10328
|
loadGeneration: i,
|
|
10257
10329
|
materialMode: c,
|
|
10258
10330
|
modelID: e,
|
|
10259
10331
|
onUploadProgress: it,
|
|
10260
10332
|
trueNorthEnabled: qe,
|
|
10261
|
-
useWebGPU:
|
|
10333
|
+
useWebGPU: j
|
|
10262
10334
|
}, e))
|
|
10263
10335
|
}),
|
|
10264
10336
|
V.layer,
|
|
10265
|
-
/* @__PURE__ */ W(
|
|
10337
|
+
/* @__PURE__ */ W(Qf, {
|
|
10266
10338
|
active: Ye,
|
|
10267
10339
|
activeRef: $e,
|
|
10268
10340
|
controlRef: n,
|
|
@@ -10270,21 +10342,21 @@ var Hp = i(function({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView:
|
|
|
10270
10342
|
settings: Ze
|
|
10271
10343
|
}),
|
|
10272
10344
|
!Ye && /* @__PURE__ */ W(Ee, {
|
|
10273
|
-
camera:
|
|
10345
|
+
camera: Lp(M) ? M : void 0,
|
|
10274
10346
|
dollyToCursor: !0,
|
|
10275
|
-
infinityDolly:
|
|
10276
|
-
minDistance:
|
|
10347
|
+
infinityDolly: M instanceof L,
|
|
10348
|
+
minDistance: $f,
|
|
10277
10349
|
ref: st,
|
|
10278
10350
|
draggingSmoothTime: .03,
|
|
10279
10351
|
smoothTime: .05
|
|
10280
|
-
},
|
|
10352
|
+
}, M.uuid)
|
|
10281
10353
|
] });
|
|
10282
|
-
}),
|
|
10283
|
-
function
|
|
10354
|
+
}), Jp = .75, Yp = .6, Xp = 16 * 1024 * 1024;
|
|
10355
|
+
function Zp(e) {
|
|
10284
10356
|
let { geometry: t } = e;
|
|
10285
10357
|
return t.pos.byteLength + t.ids.byteLength + t.ind.byteLength + (t.norm?.byteLength ?? 0);
|
|
10286
10358
|
}
|
|
10287
|
-
function
|
|
10359
|
+
function Qp(e, t) {
|
|
10288
10360
|
let n = { ...e ?? {} }, r = /* @__PURE__ */ new Set();
|
|
10289
10361
|
return t.forEach(({ chunk: e, renderSettings: t }) => {
|
|
10290
10362
|
let i = n[e.modelID];
|
|
@@ -10309,7 +10381,7 @@ function qp(e, t) {
|
|
|
10309
10381
|
}), n[e.modelID] = a;
|
|
10310
10382
|
}), n;
|
|
10311
10383
|
}
|
|
10312
|
-
function
|
|
10384
|
+
function $p(e) {
|
|
10313
10385
|
if (typeof requestAnimationFrame != "function" || document.visibilityState === "hidden") {
|
|
10314
10386
|
let t = window.setTimeout(e, 0);
|
|
10315
10387
|
return { cancel: () => window.clearTimeout(t) };
|
|
@@ -10317,11 +10389,11 @@ function Jp(e) {
|
|
|
10317
10389
|
let t = requestAnimationFrame(e);
|
|
10318
10390
|
return { cancel: () => cancelAnimationFrame(t) };
|
|
10319
10391
|
}
|
|
10320
|
-
function
|
|
10392
|
+
function em(e) {
|
|
10321
10393
|
let t = {};
|
|
10322
10394
|
return e.materialMode !== void 0 && (t.materialMode = e.materialMode), e.uploadMode !== void 0 && (t.uploadMode = e.uploadMode), e.useDoubleSideMaterial !== void 0 && (t.useDoubleSideMaterial = e.useDoubleSideMaterial), Object.keys(t).length ? t : void 0;
|
|
10323
10395
|
}
|
|
10324
|
-
function
|
|
10396
|
+
function tm(e, t, n) {
|
|
10325
10397
|
let r = { ...e ?? {} };
|
|
10326
10398
|
return Object.entries(t).forEach(([t, i]) => {
|
|
10327
10399
|
let a = Number(t);
|
|
@@ -10334,22 +10406,22 @@ function Xp(e, t, n) {
|
|
|
10334
10406
|
});
|
|
10335
10407
|
}), r;
|
|
10336
10408
|
}
|
|
10337
|
-
function
|
|
10409
|
+
function nm(e, t) {
|
|
10338
10410
|
if (!e || !Object.prototype.hasOwnProperty.call(e, t)) return e;
|
|
10339
10411
|
let n = { ...e };
|
|
10340
10412
|
return delete n[t], Object.keys(n).length ? n : void 0;
|
|
10341
10413
|
}
|
|
10342
|
-
function
|
|
10414
|
+
function rm(e, t) {
|
|
10343
10415
|
return Array.isArray(e) ? [Math.min(e[0], t), Math.min(e[1], t)] : typeof e == "number" ? Math.min(e, t) : t;
|
|
10344
10416
|
}
|
|
10345
|
-
function
|
|
10417
|
+
function im(e) {
|
|
10346
10418
|
return Array.isArray(e) ? [Math.max(e[0], 2), Math.max(e[1], 2)] : typeof e == "number" ? Math.max(e, 2) : 2;
|
|
10347
10419
|
}
|
|
10348
|
-
function
|
|
10420
|
+
function am() {
|
|
10349
10421
|
let e = navigator, t = navigator.userAgent.toLowerCase(), n = navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1, r = window.matchMedia?.("(pointer: coarse)").matches ?? !1;
|
|
10350
10422
|
return e.userAgentData?.mobile || n || /android|iphone|ipad|ipod|mobile|tablet/.test(t) || navigator.maxTouchPoints > 1 && r ? "mobile" : "pc";
|
|
10351
10423
|
}
|
|
10352
|
-
function
|
|
10424
|
+
function om({ autoFitCamera: e = !0, camera: n = {
|
|
10353
10425
|
position: [
|
|
10354
10426
|
10,
|
|
10355
10427
|
10,
|
|
@@ -10357,10 +10429,10 @@ function tm({ autoFitCamera: e = !0, camera: n = {
|
|
|
10357
10429
|
],
|
|
10358
10430
|
fov: 50
|
|
10359
10431
|
}, dpr: r = window.devicePixelRatio, fitToView: i, initialPlanPlane: o = null, modelUrls: c, modelSources: l, modelsData: h, materialMode: g, onReady: _, performanceMode: v = !1, publicApi: y, setModelsApi: b, setPlansContainerFactory: x, setSceneApi: S, showNavCube: C, showStats: w, usePerformanceMoving: T = !1, useWebGPU: E = !1 }) {
|
|
10360
|
-
let
|
|
10432
|
+
let D = d(null), O = d(null), k = d(null), A = d(null), [j, M] = f(), [ee, N] = f(!1), [te, ne] = f(!0), re = d(void 0), P = d(void 0), F = d([]), I = d(null), ie = d(/* @__PURE__ */ new Set()), ae = d(_), oe = d(!1), se = d(null), L = d(null), ce = d({
|
|
10361
10433
|
lastProgress: 0,
|
|
10362
10434
|
requestID: 0
|
|
10363
|
-
}), le = d(null), R = d(/* @__PURE__ */ new Set()), z = d(0), B = d(/* @__PURE__ */ new Map()), ue = d(/* @__PURE__ */ new Set()), de = d(/* @__PURE__ */ new Set()), fe = d(!1), pe = d(null), me = d(null), V = d(/* @__PURE__ */ new Set()), he = d(/* @__PURE__ */ new Map()), ge = d(!E), H = d(/* @__PURE__ */ new Set()), U = nt(), _e = G((e) => e.setModelNames), be = G((e) => e.setModelProps), xe = G((e) => e.setModelStructure), Se = G((e) => e.setShowNavCube), Ce = G((e) => e.setShowStats), we = G((e) => e.setUserDevice), Te = G((e) => e.showNavCube), Ee =
|
|
10435
|
+
}), le = d(null), R = d(/* @__PURE__ */ new Set()), z = d(0), B = d(/* @__PURE__ */ new Map()), ue = d(/* @__PURE__ */ new Set()), de = d(/* @__PURE__ */ new Set()), fe = d(!1), pe = d(null), me = d(null), V = d(/* @__PURE__ */ new Set()), he = d(/* @__PURE__ */ new Map()), ge = d(!E), H = d(/* @__PURE__ */ new Set()), U = nt(), _e = G((e) => e.setModelNames), be = G((e) => e.setModelProps), xe = G((e) => e.setModelStructure), Se = G((e) => e.setShowNavCube), Ce = G((e) => e.setShowStats), we = G((e) => e.setUserDevice), Te = G((e) => e.showNavCube), Ee = ee, De = Ee ? j ?? h : h ?? j, Oe = i ?? te, ke = v ? rm(r, 1) : r, Ae = rm(ke, v ? Yp : Jp), je = g ?? (v ? "performance" : void 0), [Me, Ne] = f("sleep"), Pe = im(ke), Fe = u(() => E ? ia({ performanceMode: v }) : v ? ha : void 0, [v, E]), Ie = v ? ma : pa, Le = a(() => {
|
|
10364
10436
|
ue.current.forEach((e) => {
|
|
10365
10437
|
e();
|
|
10366
10438
|
});
|
|
@@ -10387,7 +10459,7 @@ function tm({ autoFitCamera: e = !0, camera: n = {
|
|
|
10387
10459
|
t.setNodeModeActive(e);
|
|
10388
10460
|
});
|
|
10389
10461
|
}, []), We = a((e, t, n, i) => {
|
|
10390
|
-
let a =
|
|
10462
|
+
let a = k.current;
|
|
10391
10463
|
if (!a) return null;
|
|
10392
10464
|
B.current.get(t)?.handle.dispose();
|
|
10393
10465
|
let o = p(t), s = (i ? Js(a, i) : e).clone().normalize(), c = {
|
|
@@ -10461,14 +10533,14 @@ function tm({ autoFitCamera: e = !0, camera: n = {
|
|
|
10461
10533
|
e.forEach((e) => e());
|
|
10462
10534
|
}), he.current.clear(), V.current.clear();
|
|
10463
10535
|
}, []), s(() => {
|
|
10464
|
-
|
|
10536
|
+
re.current = De;
|
|
10465
10537
|
}, [De]), s(() => {
|
|
10466
|
-
|
|
10538
|
+
oe.current = Ee;
|
|
10467
10539
|
}, [Ee]), s(() => {
|
|
10468
|
-
|
|
10540
|
+
ae.current = _;
|
|
10469
10541
|
}, [_]);
|
|
10470
10542
|
let Ze = a((e) => {
|
|
10471
|
-
|
|
10543
|
+
ae.current?.(e);
|
|
10472
10544
|
}, []);
|
|
10473
10545
|
s(() => {
|
|
10474
10546
|
ge.current = !E, E || (H.current.forEach((e) => e()), H.current.clear());
|
|
@@ -10480,19 +10552,19 @@ function tm({ autoFitCamera: e = !0, camera: n = {
|
|
|
10480
10552
|
...e,
|
|
10481
10553
|
progress: n
|
|
10482
10554
|
};
|
|
10483
|
-
t.lastProgress = r.progress,
|
|
10555
|
+
t.lastProgress = r.progress, se.current = r, t.onModelProgress?.(r), t.onProgress?.(r);
|
|
10484
10556
|
}, []), $e = a((e, t) => {
|
|
10485
|
-
|
|
10557
|
+
P.current = e, re.current = e, M(e), t?.(e);
|
|
10486
10558
|
}, []), et = a(() => {
|
|
10487
|
-
|
|
10559
|
+
ie.current.forEach((e) => e()), ie.current.clear();
|
|
10488
10560
|
}, []), rt = a(() => {
|
|
10489
|
-
|
|
10561
|
+
I.current?.cancel(), I.current = null, F.current = [], et();
|
|
10490
10562
|
}, [et]);
|
|
10491
10563
|
s(() => rt, [rt]);
|
|
10492
10564
|
let it = a(() => {
|
|
10493
10565
|
z.current += 1, rt(), he.current.forEach((e) => {
|
|
10494
10566
|
e.forEach((e) => e());
|
|
10495
|
-
}), he.current.clear(), V.current.clear(),
|
|
10567
|
+
}), he.current.clear(), V.current.clear(), N(!1), se.current = null, L.current = null, ce.current = {
|
|
10496
10568
|
lastProgress: 0,
|
|
10497
10569
|
requestID: z.current
|
|
10498
10570
|
}, R.current.clear(), $e(void 0, le.current ?? void 0), U.getState().setSelection({}), U.getState().setModelNames({}), U.getState().setModelProps({}), U.getState().setModelStructure({});
|
|
@@ -10501,49 +10573,49 @@ function tm({ autoFitCamera: e = !0, camera: n = {
|
|
|
10501
10573
|
$e,
|
|
10502
10574
|
U
|
|
10503
10575
|
]), at = a((e, t) => {
|
|
10504
|
-
let n =
|
|
10576
|
+
let n = P.current, r = e(n);
|
|
10505
10577
|
r !== n && $e(r, t);
|
|
10506
10578
|
}, [$e]), ot = a(() => {
|
|
10507
10579
|
let e = () => {
|
|
10508
|
-
|
|
10509
|
-
let t =
|
|
10580
|
+
I.current = null;
|
|
10581
|
+
let t = F.current, n = 0, r = 0;
|
|
10510
10582
|
for (; r < t.length;) {
|
|
10511
|
-
let e =
|
|
10512
|
-
if (r > 0 && n + e >
|
|
10583
|
+
let e = Zp(t[r].chunk);
|
|
10584
|
+
if (r > 0 && n + e > Xp) break;
|
|
10513
10585
|
n += e, r++;
|
|
10514
10586
|
}
|
|
10515
10587
|
let i = t.splice(0, r).filter(({ chunk: e, requestID: t }) => z.current === t && !R.current.has(e.modelID));
|
|
10516
|
-
if (i.length && at((e) =>
|
|
10517
|
-
|
|
10588
|
+
if (i.length && at((e) => Qp(e, i), i[i.length - 1].onModelsDataChange), t.length) {
|
|
10589
|
+
I.current = $p(e);
|
|
10518
10590
|
return;
|
|
10519
10591
|
}
|
|
10520
10592
|
et();
|
|
10521
10593
|
};
|
|
10522
10594
|
e();
|
|
10523
10595
|
}, [et, at]), st = a((e) => {
|
|
10524
|
-
|
|
10525
|
-
}, [ot]), ct = a(() =>
|
|
10526
|
-
|
|
10596
|
+
F.current.push(e), I.current ??= $p(ot);
|
|
10597
|
+
}, [ot]), ct = a(() => F.current.length ? new Promise((e) => {
|
|
10598
|
+
ie.current.add(e);
|
|
10527
10599
|
}) : Promise.resolve(), []), lt = a(async (e, t = {}) => {
|
|
10528
|
-
let { clearViewer: n = !1, fitToView: r = !0, onChunk: i, onModelLoadingChange: a, onModelProgress: o, onModelsDataChange: s, onProgress: c, ...l } = t, u = z.current + 1, d =
|
|
10529
|
-
f || z.current !== u || (f = !0,
|
|
10600
|
+
let { clearViewer: n = !1, fitToView: r = !0, onChunk: i, onModelLoadingChange: a, onModelProgress: o, onModelsDataChange: s, onProgress: c, ...l } = t, u = z.current + 1, d = em(l), f = !1, p = !1, m = () => {
|
|
10601
|
+
f || z.current !== u || (f = !0, N(!1));
|
|
10530
10602
|
}, h = () => {
|
|
10531
10603
|
p || z.current !== u || (p = !0, a?.(!1));
|
|
10532
10604
|
};
|
|
10533
10605
|
z.current = u, rt(), he.current.forEach((e) => {
|
|
10534
10606
|
e.forEach((e) => e());
|
|
10535
|
-
}), he.current.clear(), V.current.clear(),
|
|
10607
|
+
}), he.current.clear(), V.current.clear(), se.current = null, L.current = null, ce.current = {
|
|
10536
10608
|
lastProgress: 0,
|
|
10537
10609
|
onModelProgress: o,
|
|
10538
10610
|
onProgress: c,
|
|
10539
10611
|
requestID: u
|
|
10540
|
-
}, s && (le.current = s),
|
|
10612
|
+
}, s && (le.current = s), ne(r), N(!0), o?.(null), a?.(!0), U.getState().setSelection({}), n && (R.current.clear(), $e({}, s));
|
|
10541
10613
|
let g = (e) => {
|
|
10542
10614
|
L.current = e, Qe(e);
|
|
10543
10615
|
};
|
|
10544
10616
|
try {
|
|
10545
10617
|
let t = !!l.useWorker;
|
|
10546
|
-
E && (!n && !
|
|
10618
|
+
E && (!n && !re.current && $e({}, s), await Je());
|
|
10547
10619
|
let r = await vi.loadModel(e, {
|
|
10548
10620
|
...l,
|
|
10549
10621
|
...t ? {
|
|
@@ -10561,7 +10633,7 @@ function tm({ autoFitCamera: e = !0, camera: n = {
|
|
|
10561
10633
|
});
|
|
10562
10634
|
if (z.current !== u || (await ct(), z.current !== u)) return r;
|
|
10563
10635
|
let a = Object.fromEntries(Object.entries(r).filter(([e]) => !R.current.has(Number(e))));
|
|
10564
|
-
return at((e) => t ?
|
|
10636
|
+
return at((e) => t ? tm(e, a, R.current) : {
|
|
10565
10637
|
...e ?? {},
|
|
10566
10638
|
...a
|
|
10567
10639
|
}, s), m(), Object.keys(a).length > 0 && await Xe(u), h(), r;
|
|
@@ -10582,12 +10654,12 @@ function tm({ autoFitCamera: e = !0, camera: n = {
|
|
|
10582
10654
|
]), ut = a((e) => {
|
|
10583
10655
|
if (!Number.isFinite(e)) return;
|
|
10584
10656
|
R.current.add(e);
|
|
10585
|
-
let t =
|
|
10657
|
+
let t = re.current, n = nm(t, e);
|
|
10586
10658
|
n !== t && $e(n, le.current ?? void 0), U.getState().removeModelState(e);
|
|
10587
10659
|
}, [$e, U]), dt = u(() => ({
|
|
10588
|
-
getData: () =>
|
|
10589
|
-
getLoading: () =>
|
|
10590
|
-
getProgress: () =>
|
|
10660
|
+
getData: () => re.current,
|
|
10661
|
+
getLoading: () => oe.current,
|
|
10662
|
+
getProgress: () => se.current,
|
|
10591
10663
|
loadModels: lt,
|
|
10592
10664
|
reset: it,
|
|
10593
10665
|
unloadModel: ut
|
|
@@ -10597,7 +10669,7 @@ function tm({ autoFitCamera: e = !0, camera: n = {
|
|
|
10597
10669
|
ut
|
|
10598
10670
|
]);
|
|
10599
10671
|
return s(() => (b(dt), () => b(null)), [dt, b]), s(() => {
|
|
10600
|
-
we(
|
|
10672
|
+
we(am());
|
|
10601
10673
|
}, [we]), s(() => {
|
|
10602
10674
|
Ce(!!w);
|
|
10603
10675
|
}, [Ce, w]), s(() => {
|
|
@@ -10647,15 +10719,15 @@ function tm({ autoFitCamera: e = !0, camera: n = {
|
|
|
10647
10719
|
onReady: qe
|
|
10648
10720
|
}),
|
|
10649
10721
|
/* @__PURE__ */ W(oa, { active: E }),
|
|
10650
|
-
/* @__PURE__ */ W(
|
|
10722
|
+
/* @__PURE__ */ W(qp, {
|
|
10651
10723
|
autoFitCamera: e,
|
|
10652
|
-
cameraRef:
|
|
10653
|
-
controlRef:
|
|
10724
|
+
cameraRef: D,
|
|
10725
|
+
controlRef: O,
|
|
10654
10726
|
fitToView: Oe,
|
|
10655
10727
|
loadGeneration: z.current,
|
|
10656
|
-
lightRef:
|
|
10728
|
+
lightRef: A,
|
|
10657
10729
|
materialMode: je,
|
|
10658
|
-
modelRef:
|
|
10730
|
+
modelRef: k,
|
|
10659
10731
|
modelsData: De,
|
|
10660
10732
|
modelsLoading: Ee,
|
|
10661
10733
|
initialPlanPlane: o,
|
|
@@ -10687,15 +10759,15 @@ function tm({ autoFitCamera: e = !0, camera: n = {
|
|
|
10687
10759
|
orthographic: !0,
|
|
10688
10760
|
children: /* @__PURE__ */ W(Zi, {
|
|
10689
10761
|
active: !0,
|
|
10690
|
-
cameraRef:
|
|
10691
|
-
controlRef:
|
|
10692
|
-
modelRef:
|
|
10762
|
+
cameraRef: D,
|
|
10763
|
+
controlRef: O,
|
|
10764
|
+
modelRef: k
|
|
10693
10765
|
})
|
|
10694
10766
|
}, "nav-cube-webgl")
|
|
10695
10767
|
})]
|
|
10696
10768
|
}) : /* @__PURE__ */ W(ve, {});
|
|
10697
10769
|
}
|
|
10698
|
-
var
|
|
10770
|
+
var sm = r(function(e, t) {
|
|
10699
10771
|
let [n] = f($e), r = d(!1), i = d(!1), o = u(() => new ga(), []), l = u(() => new va(), []), { defaultSelected: p, onSelectedChange: m, selected: h } = e, g = a((e) => {
|
|
10700
10772
|
o.set(e);
|
|
10701
10773
|
}, [o]), _ = u(() => new _a(), []), v = a((e) => {
|
|
@@ -10724,7 +10796,7 @@ var nm = r(function(e, t) {
|
|
|
10724
10796
|
});
|
|
10725
10797
|
}, [m, n]), /* @__PURE__ */ W(tt, {
|
|
10726
10798
|
store: n,
|
|
10727
|
-
children: /* @__PURE__ */ W(
|
|
10799
|
+
children: /* @__PURE__ */ W(om, {
|
|
10728
10800
|
...e,
|
|
10729
10801
|
publicApi: b,
|
|
10730
10802
|
setModelsApi: v,
|
|
@@ -10733,6 +10805,6 @@ var nm = r(function(e, t) {
|
|
|
10733
10805
|
})
|
|
10734
10806
|
});
|
|
10735
10807
|
});
|
|
10736
|
-
|
|
10808
|
+
sm.displayName = "Viewer";
|
|
10737
10809
|
//#endregion
|
|
10738
|
-
export { or as BMTLoader, kn as BmtConverter, jn as ConvertIfcFileToBmt, Mn as ConvertToBmt, go as DimensionLine, To as DimensionsUtils, Wn as FilteredElementsCollector, Gc as ModelGrids, Zi as NavigationCube,
|
|
10810
|
+
export { or as BMTLoader, kn as BmtConverter, jn as ConvertIfcFileToBmt, Mn as ConvertToBmt, go as DimensionLine, To as DimensionsUtils, Wn as FilteredElementsCollector, Gc as ModelGrids, Zi as NavigationCube, sm as Viewer, tt as ViewerStoreProvider, An as bmtConverter, Jr as convertIfcFilesToBmtInWorker, Yr as createBmtConverterWorker, Pr as createBmtWorker, si as createIfcWorker, $e as createViewerStore, Gt as exportExcel, Ht as exportModelPropertiesToExcel, Nr as loadBmtModelsInWorker, oi as loadIfcModelsInWorker, vi as loader, Eo as useDimensionsUtils, G as useViewerStore, nt as useViewerStoreApi };
|