@nebula-spatial/viewer 0.5.12 → 0.5.14
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/CHANGELOG.md +51 -0
- package/MATERIALX-LIBRARY-AUDIT.md +250 -0
- package/README.md +32 -34
- package/USD-VISUAL-MATERIAL-SUPPORT.md +57 -10
- package/dist/assets/types.d.ts +10 -1
- package/dist/{collision-debug-C-GfagYI.js → collision-debug-B2bN8P2g.js} +1 -1
- package/dist/{index-CPHfEIND.js → index-BSDalKkd.js} +846 -832
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{mjcf-visual-Coi35OaT.js → mjcf-visual-D6T3a1uQ.js} +1 -1
- package/dist/{mujoco-runtime-CciOWtJO.js → mujoco-runtime-CFQQsRmc.js} +1 -1
- package/dist/runtime-paths-Dj0itY6G.js +8 -0
- package/dist/{session-CoEU6ILc.js → session-BUarD9PA.js} +132 -129
- package/dist/{session-BwQqwtuW.js → session-Ciaw522_.js} +7 -7
- package/dist/simulation/usd-preload.d.ts +2 -0
- package/dist/simulation/usd-prewarm.d.ts +6 -0
- package/dist/{stage-C8MOE9K3.js → stage-CvP0yaff.js} +1 -1
- package/dist/{urdf-session-CCfMSB3h.js → urdf-session-DcGOHFg2.js} +5 -5
- package/dist/usd-session-DSFtJk4b.js +9634 -0
- package/dist/version.d.ts +1 -1
- package/dist/{xacro-kijvGy5n.js → xacro-bURYAikr.js} +1 -1
- package/draco/draco_decoder.wasm +0 -0
- package/draco/draco_wasm_wrapper.js +117 -0
- package/package.json +30 -4
- package/runtime-assets.d.mts +9 -0
- package/runtime-assets.mjs +11 -0
- package/vite.d.mts +7 -0
- package/vite.mjs +115 -0
- package/dist/usd-session-CR2K_zdJ.js +0 -8478
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var u = (r, e, t) =>
|
|
4
|
-
import { Texture as ot, Scene as
|
|
5
|
-
import { RoomEnvironment as
|
|
6
|
-
import { MapControls as
|
|
7
|
-
import { OrbitControls as
|
|
8
|
-
import { HDRLoader as
|
|
9
|
-
import { createCadDocumentSession as
|
|
10
|
-
import { CSS2DObject as
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
var jn = Object.defineProperty;
|
|
2
|
+
var Fn = (r, e, t) => e in r ? jn(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var u = (r, e, t) => Fn(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { Texture as ot, Scene as $e, OrthographicCamera as St, PlaneGeometry as tn, ShaderMaterial as nn, KeepStencilOp as ke, EqualStencilFunc as Qe, Matrix3 as rn, Mesh as ae, MeshBasicMaterial as Nt, ReplaceStencilOp as Se, AlwaysStencilFunc as Pt, DoubleSide as Ot, Color as tt, MathUtils as Y, EquirectangularReflectionMapping as Me, Matrix4 as ct, Euler as sn, MeshPhysicalMaterial as jt, FrontSide as zn, Vector3 as M, ShaderChunk as Ut, MOUSE as re, Object3D as an, Group as on, Raycaster as lt, Vector2 as J, Quaternion as it, WebGLRenderer as ln, PerspectiveCamera as dn, TOUCH as _t, Vector4 as $n, Plane as cn, WebGLRenderTarget as Vn, Box3 as Z, PMREMGenerator as Bn, TextureLoader as un, SRGBColorSpace as Ft, ACESFilmicToneMapping as Un, MeshStandardMaterial as _n, SphereGeometry as Hn, Sphere as Ht, UniformsUtils as qn, BoxHelper as Yn, Box3Helper as Wn, BoxGeometry as Gn, LineSegments as Xn, EdgesGeometry as Kn, LineBasicMaterial as Jn } from "three";
|
|
5
|
+
import { RoomEnvironment as Zn } from "three/addons/environments/RoomEnvironment.js";
|
|
6
|
+
import { MapControls as Qn } from "three/addons/controls/MapControls.js";
|
|
7
|
+
import { OrbitControls as er } from "three/addons/controls/OrbitControls.js";
|
|
8
|
+
import { HDRLoader as hn } from "three/addons/loaders/HDRLoader.js";
|
|
9
|
+
import { createCadDocumentSession as tr, getCadDocumentRenderResource as ir, formatCadInsertId as qt } from "@nebula-spatial/cad-loader";
|
|
10
|
+
import { CSS2DObject as nr, CSS2DRenderer as rr } from "three/addons/renderers/CSS2DRenderer.js";
|
|
11
|
+
import { viewerRuntimeAssetUrls as Yt } from "@nebula-spatial/viewer/runtime-assets";
|
|
12
|
+
import sr from "@mujoco/mujoco/mujoco.wasm?url";
|
|
13
|
+
const ar = "0.5.14", or = "@nebula-spatial/viewer", Wt = "__NEBULA_SPATIAL_VIEWER_BANNER_PRINTED__";
|
|
14
|
+
function Gt() {
|
|
15
|
+
const r = `%c ${or} %c v${ar} `;
|
|
15
16
|
console.log(r, "background:#111827;color:#ffffff;padding:4px 10px;border-radius:4px 0 0 4px;font-weight:700;", "background:#10B981;color:#ffffff;padding:4px 10px;border-radius:0 4px 4px 0;font-weight:700;");
|
|
16
17
|
}
|
|
17
18
|
try {
|
|
18
19
|
const r = globalThis;
|
|
19
|
-
r[
|
|
20
|
+
r[Wt] || (r[Wt] = !0, Gt());
|
|
20
21
|
} catch {
|
|
21
|
-
|
|
22
|
+
Gt();
|
|
22
23
|
}
|
|
23
|
-
const
|
|
24
|
+
const lr = [
|
|
24
25
|
"alphaMap",
|
|
25
26
|
"aoMap",
|
|
26
27
|
"bumpMap",
|
|
@@ -49,24 +50,24 @@ const ar = [
|
|
|
49
50
|
function nt(r, e) {
|
|
50
51
|
e.has(r) || (e.add(r), r.dispose());
|
|
51
52
|
}
|
|
52
|
-
function
|
|
53
|
+
function dr(r, e, t) {
|
|
53
54
|
if (e) {
|
|
54
55
|
const i = r;
|
|
55
|
-
for (const n of
|
|
56
|
+
for (const n of lr) {
|
|
56
57
|
const s = i[n];
|
|
57
58
|
s instanceof ot && nt(s, t);
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
nt(r, t);
|
|
61
62
|
}
|
|
62
|
-
function
|
|
63
|
+
function Xt(r, e = {}) {
|
|
63
64
|
const t = e.disposedResources ?? /* @__PURE__ */ new WeakSet(), i = e.disposeTextures !== !1;
|
|
64
65
|
r.traverse((n) => {
|
|
65
66
|
const s = n;
|
|
66
67
|
s.geometry && nt(s.geometry, t);
|
|
67
68
|
const a = Array.isArray(s.material) ? s.material : [s.material];
|
|
68
69
|
for (const o of a)
|
|
69
|
-
o &&
|
|
70
|
+
o && dr(o, i, t);
|
|
70
71
|
s.renderTarget && nt(s.renderTarget, t);
|
|
71
72
|
});
|
|
72
73
|
}
|
|
@@ -78,7 +79,7 @@ function pe(r) {
|
|
|
78
79
|
}
|
|
79
80
|
return !0;
|
|
80
81
|
}
|
|
81
|
-
const
|
|
82
|
+
const Kt = 31, Jt = "HDR_BACKDROP_BLUR", cr = (
|
|
82
83
|
/* glsl */
|
|
83
84
|
`
|
|
84
85
|
varying vec2 vUv;
|
|
@@ -88,7 +89,7 @@ const Xt = 31, Kt = "HDR_BACKDROP_BLUR", lr = (
|
|
|
88
89
|
gl_Position = vec4(position.xy, 1.0, 1.0);
|
|
89
90
|
}
|
|
90
91
|
`
|
|
91
|
-
),
|
|
92
|
+
), ur = (
|
|
92
93
|
/* glsl */
|
|
93
94
|
`
|
|
94
95
|
uniform sampler2D tEquirect;
|
|
@@ -131,24 +132,24 @@ const Xt = 31, Kt = "HDR_BACKDROP_BLUR", lr = (
|
|
|
131
132
|
}
|
|
132
133
|
`
|
|
133
134
|
);
|
|
134
|
-
class
|
|
135
|
+
class hr {
|
|
135
136
|
constructor() {
|
|
136
137
|
u(this, "candidates", []);
|
|
137
138
|
u(this, "activeCandidates", []);
|
|
138
|
-
u(this, "backdropScene", new
|
|
139
|
+
u(this, "backdropScene", new $e());
|
|
139
140
|
u(this, "backdropCamera", new St(-1, 1, 1, -1, 0, 1));
|
|
140
|
-
u(this, "backdropGeometry", new
|
|
141
|
-
u(this, "backdropMaterial", new
|
|
141
|
+
u(this, "backdropGeometry", new tn(2, 2));
|
|
142
|
+
u(this, "backdropMaterial", new nn({
|
|
142
143
|
name: "HdrTransparentBackdropMaterial",
|
|
143
144
|
uniforms: {
|
|
144
145
|
tEquirect: { value: null },
|
|
145
|
-
uvTransform: { value: new
|
|
146
|
+
uvTransform: { value: new rn() },
|
|
146
147
|
backgroundIntensity: { value: 1 },
|
|
147
148
|
blurriness: { value: 0 },
|
|
148
149
|
yawOffset: { value: 0 }
|
|
149
150
|
},
|
|
150
|
-
vertexShader:
|
|
151
|
-
fragmentShader:
|
|
151
|
+
vertexShader: cr,
|
|
152
|
+
fragmentShader: ur,
|
|
152
153
|
depthTest: !1,
|
|
153
154
|
depthWrite: !1,
|
|
154
155
|
stencilWrite: !0,
|
|
@@ -191,7 +192,7 @@ class cr {
|
|
|
191
192
|
const i = this.blurriness > 0;
|
|
192
193
|
this.blurriness = t, this.backdropMaterial.uniforms.blurriness.value = t;
|
|
193
194
|
const n = t > 0;
|
|
194
|
-
i !== n &&
|
|
195
|
+
i !== n && mr(this.backdropMaterial, n);
|
|
195
196
|
}
|
|
196
197
|
setRotationDegrees(e) {
|
|
197
198
|
if (!Number.isFinite(e)) return;
|
|
@@ -208,7 +209,7 @@ class cr {
|
|
|
208
209
|
const a = e.autoClear, o = e.getClearAlpha(), l = e.getClearColor(this.previousClearColor), d = t.background, c = t.overrideMaterial, p = i.layers.mask;
|
|
209
210
|
this.previousLayerMasks.length = 0;
|
|
210
211
|
for (const m of this.activeCandidates)
|
|
211
|
-
this.previousLayerMasks.push(m.layers.mask), m.layers.set(
|
|
212
|
+
this.previousLayerMasks.push(m.layers.mask), m.layers.set(Kt);
|
|
212
213
|
s.updateMatrix();
|
|
213
214
|
const h = this.backdropMaterial.uniforms;
|
|
214
215
|
h.tEquirect.value = s, h.uvTransform.value.copy(s.matrix), h.backgroundIntensity.value = t.backgroundIntensity, h.blurriness.value = this.blurriness, h.yawOffset.value = this.yawOffset;
|
|
@@ -216,7 +217,7 @@ class cr {
|
|
|
216
217
|
return e.autoClear = !1, e.setClearColor(
|
|
217
218
|
t.background instanceof tt ? t.background : l,
|
|
218
219
|
1
|
|
219
|
-
), e.clear(!0, !0, !0), t.background = null, t.overrideMaterial = this.maskMaterial, i.layers.set(
|
|
220
|
+
), e.clear(!0, !0, !0), t.background = null, t.overrideMaterial = this.maskMaterial, i.layers.set(Kt), e.render(t, i), t.overrideMaterial = null, e.render(this.backdropScene, this.backdropCamera), t.overrideMaterial = c, t.background = null, i.layers.mask = p, this.restoreCandidateLayers(), e.render(t, i), !0;
|
|
220
221
|
} finally {
|
|
221
222
|
this.restoreCandidateLayers(), i.layers.mask = p, t.overrideMaterial = c, t.background = d, e.autoClear = a, e.setClearColor(l, o);
|
|
222
223
|
}
|
|
@@ -228,7 +229,7 @@ class cr {
|
|
|
228
229
|
this.candidates.length = 0;
|
|
229
230
|
for (const t of e)
|
|
230
231
|
t.traverse((i) => {
|
|
231
|
-
i instanceof ae && i.visible && i.userData.hdrTransparentBackdrop !== !1 && pe(i) &&
|
|
232
|
+
i instanceof ae && i.visible && i.userData.hdrTransparentBackdrop !== !1 && pe(i) && pr(i.material) && this.candidates.push(i);
|
|
232
233
|
});
|
|
233
234
|
this.dirty = !1;
|
|
234
235
|
}
|
|
@@ -237,13 +238,13 @@ class cr {
|
|
|
237
238
|
this.activeCandidates[e].layers.mask = this.previousLayerMasks[e] ?? 1;
|
|
238
239
|
}
|
|
239
240
|
}
|
|
240
|
-
function
|
|
241
|
+
function pr(r) {
|
|
241
242
|
return (Array.isArray(r) ? r : [r]).some((t) => t.visible && t.transparent === !0);
|
|
242
243
|
}
|
|
243
|
-
function
|
|
244
|
-
e ? r.defines = { ...r.defines, [
|
|
244
|
+
function mr(r, e) {
|
|
245
|
+
e ? r.defines = { ...r.defines, [Jt]: "" } : r.defines && delete r.defines[Jt], r.needsUpdate = !0;
|
|
245
246
|
}
|
|
246
|
-
const
|
|
247
|
+
const Zt = "TRANSMISSION_BACKDROP_BLUR", fr = -9999, vr = -1e4, gr = (
|
|
247
248
|
/* glsl */
|
|
248
249
|
`
|
|
249
250
|
varying vec2 vUv;
|
|
@@ -253,7 +254,7 @@ const Jt = "TRANSMISSION_BACKDROP_BLUR", pr = -9999, mr = -1e4, fr = (
|
|
|
253
254
|
gl_Position = vec4(position.xy, 1.0, 1.0);
|
|
254
255
|
}
|
|
255
256
|
`
|
|
256
|
-
),
|
|
257
|
+
), br = (
|
|
257
258
|
/* glsl */
|
|
258
259
|
`
|
|
259
260
|
uniform sampler2D tEquirect;
|
|
@@ -305,11 +306,11 @@ const Jt = "TRANSMISSION_BACKDROP_BLUR", pr = -9999, mr = -1e4, fr = (
|
|
|
305
306
|
}
|
|
306
307
|
`
|
|
307
308
|
);
|
|
308
|
-
class
|
|
309
|
+
class yr {
|
|
309
310
|
constructor() {
|
|
310
311
|
u(this, "candidates", /* @__PURE__ */ new Set());
|
|
311
312
|
u(this, "proxies", /* @__PURE__ */ new Map());
|
|
312
|
-
u(this, "backdropGeometry", new
|
|
313
|
+
u(this, "backdropGeometry", new tn(2, 2));
|
|
313
314
|
u(this, "maskMaterial", new Nt({
|
|
314
315
|
name: "TransmissionHdrMaskMaterial",
|
|
315
316
|
colorWrite: !1,
|
|
@@ -324,18 +325,18 @@ class gr {
|
|
|
324
325
|
stencilZFail: Se,
|
|
325
326
|
stencilZPass: Se
|
|
326
327
|
}));
|
|
327
|
-
u(this, "backdropMaterial", new
|
|
328
|
+
u(this, "backdropMaterial", new nn({
|
|
328
329
|
name: "TransmissionHdrBackdropMaterial",
|
|
329
330
|
uniforms: {
|
|
330
331
|
tEquirect: { value: null },
|
|
331
|
-
environmentRotation: { value: new
|
|
332
|
+
environmentRotation: { value: new rn() },
|
|
332
333
|
cameraProjectionMatrixInverse: { value: new ct() },
|
|
333
334
|
cameraWorldMatrix: { value: new ct() },
|
|
334
335
|
environmentIntensity: { value: 1 },
|
|
335
336
|
blurriness: { value: 0 }
|
|
336
337
|
},
|
|
337
|
-
vertexShader:
|
|
338
|
-
fragmentShader:
|
|
338
|
+
vertexShader: gr,
|
|
339
|
+
fragmentShader: br,
|
|
339
340
|
depthTest: !1,
|
|
340
341
|
depthWrite: !1,
|
|
341
342
|
fog: !1,
|
|
@@ -348,13 +349,13 @@ class gr {
|
|
|
348
349
|
toneMapped: !0
|
|
349
350
|
}));
|
|
350
351
|
u(this, "backdropMesh", new ae(this.backdropGeometry, this.backdropMaterial));
|
|
351
|
-
u(this, "rotation", new
|
|
352
|
+
u(this, "rotation", new sn());
|
|
352
353
|
u(this, "rotationMatrix", new ct());
|
|
353
354
|
u(this, "blurriness", 0);
|
|
354
355
|
u(this, "dirty", !0);
|
|
355
356
|
u(this, "attachedScene", null);
|
|
356
357
|
u(this, "disposed", !1);
|
|
357
|
-
this.backdropMesh.name = "scene-runtime:transmission-hdr-backdrop", this.backdropMesh.frustumCulled = !1, this.backdropMesh.renderOrder =
|
|
358
|
+
this.backdropMesh.name = "scene-runtime:transmission-hdr-backdrop", this.backdropMesh.frustumCulled = !1, this.backdropMesh.renderOrder = fr, this.backdropMesh.raycast = () => {
|
|
358
359
|
}, this.backdropMesh.onBeforeRender = (e) => {
|
|
359
360
|
const t = e.getRenderTarget() !== null;
|
|
360
361
|
this.backdropMaterial.stencilWrite = !t, this.backdropMaterial.stencilFunc = t ? Pt : Qe;
|
|
@@ -369,7 +370,7 @@ class gr {
|
|
|
369
370
|
const i = this.blurriness > 0;
|
|
370
371
|
this.blurriness = t, this.backdropMaterial.uniforms.blurriness.value = t;
|
|
371
372
|
const n = t > 0;
|
|
372
|
-
i !== n &&
|
|
373
|
+
i !== n && wr(this.backdropMaterial, n);
|
|
373
374
|
}
|
|
374
375
|
prepare(e, t) {
|
|
375
376
|
if (this.disposed) return !1;
|
|
@@ -411,14 +412,14 @@ class gr {
|
|
|
411
412
|
const t = /* @__PURE__ */ new Set();
|
|
412
413
|
for (const i of e)
|
|
413
414
|
i.traverse((n) => {
|
|
414
|
-
n instanceof ae && n.userData.transmissionHdrBackdrop !== !1 && pe(n) &&
|
|
415
|
+
n instanceof ae && n.userData.transmissionHdrBackdrop !== !1 && pe(n) && xr(n.material) && t.add(n);
|
|
415
416
|
});
|
|
416
417
|
for (const [i, n] of this.proxies)
|
|
417
418
|
t.has(i) || (i.remove(n), this.proxies.delete(i));
|
|
418
419
|
for (const i of t) {
|
|
419
420
|
if (this.proxies.has(i)) continue;
|
|
420
421
|
const n = new ae(i.geometry, this.maskMaterial);
|
|
421
|
-
n.name = `${i.name || "transmission"}:hdr-mask`, n.layers.mask = i.layers.mask, n.frustumCulled = i.frustumCulled, n.renderOrder =
|
|
422
|
+
n.name = `${i.name || "transmission"}:hdr-mask`, n.layers.mask = i.layers.mask, n.frustumCulled = i.frustumCulled, n.renderOrder = vr, n.raycast = () => {
|
|
422
423
|
}, this.proxies.set(i, n);
|
|
423
424
|
}
|
|
424
425
|
this.candidates.clear();
|
|
@@ -426,15 +427,15 @@ class gr {
|
|
|
426
427
|
this.dirty = !1;
|
|
427
428
|
}
|
|
428
429
|
}
|
|
429
|
-
function
|
|
430
|
+
function xr(r) {
|
|
430
431
|
return (Array.isArray(r) ? r : [r]).some(
|
|
431
432
|
(t) => t.visible && t instanceof jt && t.transmission > 0
|
|
432
433
|
);
|
|
433
434
|
}
|
|
434
|
-
function
|
|
435
|
-
e ? r.defines = { ...r.defines, [
|
|
435
|
+
function wr(r, e) {
|
|
436
|
+
e ? r.defines = { ...r.defines, [Zt]: "" } : r.defines && delete r.defines[Zt], r.needsUpdate = !0;
|
|
436
437
|
}
|
|
437
|
-
class
|
|
438
|
+
class Cr {
|
|
438
439
|
constructor() {
|
|
439
440
|
u(this, "candidates", /* @__PURE__ */ new Set());
|
|
440
441
|
u(this, "temporarySides", /* @__PURE__ */ new Map());
|
|
@@ -446,7 +447,7 @@ class xr {
|
|
|
446
447
|
prepare(e) {
|
|
447
448
|
if (this.dirty && this.refreshCandidates(e), this.candidates.size === 0) return !1;
|
|
448
449
|
for (const t of this.candidates)
|
|
449
|
-
t.visible && t.transmission > 0 && t.thickness > 0 && t.side ===
|
|
450
|
+
t.visible && t.transmission > 0 && t.thickness > 0 && t.side === zn && (this.temporarySides.set(t, t.side), t.side = Ot);
|
|
450
451
|
return !0;
|
|
451
452
|
}
|
|
452
453
|
finish() {
|
|
@@ -468,7 +469,7 @@ class xr {
|
|
|
468
469
|
this.dirty = !1;
|
|
469
470
|
}
|
|
470
471
|
}
|
|
471
|
-
const
|
|
472
|
+
const Qt = "#include <transmission_pars_fragment>", ei = "#include <transmission_fragment>", Er = (
|
|
472
473
|
/* glsl */
|
|
473
474
|
`
|
|
474
475
|
vec4 getEeveeSphereProbeRefraction(
|
|
@@ -517,7 +518,7 @@ vec4 getEeveeSphereProbeRefraction(
|
|
|
517
518
|
}
|
|
518
519
|
`
|
|
519
520
|
);
|
|
520
|
-
class
|
|
521
|
+
class kr {
|
|
521
522
|
constructor() {
|
|
522
523
|
u(this, "assignments", []);
|
|
523
524
|
u(this, "replacements", /* @__PURE__ */ new Map());
|
|
@@ -540,9 +541,9 @@ class Cr {
|
|
|
540
541
|
const s = n.material, a = Array.isArray(s) ? s : [s];
|
|
541
542
|
let o = !1;
|
|
542
543
|
const l = a.map((d) => {
|
|
543
|
-
if (!(d instanceof jt) || d.transmission <= 0 || !
|
|
544
|
+
if (!(d instanceof jt) || d.transmission <= 0 || !Sr(d))
|
|
544
545
|
return d;
|
|
545
|
-
const c =
|
|
546
|
+
const c = Mr(n);
|
|
546
547
|
return c === null ? d : (o = !0, this.getReplacement(d, c));
|
|
547
548
|
});
|
|
548
549
|
o && (this.assignments.push({ mesh: n, original: s }), n.material = Array.isArray(s) ? l : l[0], t = !0);
|
|
@@ -568,21 +569,21 @@ class Cr {
|
|
|
568
569
|
let i = this.replacements.get(e);
|
|
569
570
|
i || (i = /* @__PURE__ */ new Map(), this.replacements.set(e, i));
|
|
570
571
|
let n = i.get(t);
|
|
571
|
-
return n || (n = e.clone(), n.thickness = t,
|
|
572
|
+
return n || (n = e.clone(), n.thickness = t, Pr(n), i.set(t, n), n);
|
|
572
573
|
}
|
|
573
574
|
}
|
|
574
|
-
function
|
|
575
|
+
function Sr(r) {
|
|
575
576
|
return r.userData.eeveeSphereProbeTransmission !== "thin";
|
|
576
577
|
}
|
|
577
|
-
function
|
|
578
|
+
function Pr(r) {
|
|
578
579
|
const e = r.onBeforeCompile, t = r.customProgramCacheKey;
|
|
579
580
|
r.onBeforeCompile = (i, n) => {
|
|
580
|
-
e.call(r, i, n), !(!i.fragmentShader.includes(
|
|
581
|
-
|
|
581
|
+
e.call(r, i, n), !(!i.fragmentShader.includes(Qt) || !i.fragmentShader.includes(ei)) && (i.fragmentShader = i.fragmentShader.replace(
|
|
582
|
+
Qt,
|
|
582
583
|
`${Ut.transmission_pars_fragment}
|
|
583
|
-
${
|
|
584
|
+
${Er}`
|
|
584
585
|
).replace(
|
|
585
|
-
|
|
586
|
+
ei,
|
|
586
587
|
Ut.transmission_fragment.replace(
|
|
587
588
|
"getIBLVolumeRefraction(",
|
|
588
589
|
"getEeveeSphereProbeRefraction("
|
|
@@ -590,7 +591,7 @@ ${wr}`
|
|
|
590
591
|
));
|
|
591
592
|
}, r.customProgramCacheKey = () => `${t.call(r)}|eevee-sphere-probe-v1`;
|
|
592
593
|
}
|
|
593
|
-
function
|
|
594
|
+
function Mr(r) {
|
|
594
595
|
const e = r.geometry;
|
|
595
596
|
e.boundingBox || e.computeBoundingBox();
|
|
596
597
|
const t = e.boundingBox;
|
|
@@ -598,7 +599,7 @@ function Sr(r) {
|
|
|
598
599
|
const i = t.getSize(new M()), n = Math.min(i.x, i.y, i.z);
|
|
599
600
|
return Number.isFinite(n) && n > 1e-6 ? n : null;
|
|
600
601
|
}
|
|
601
|
-
function
|
|
602
|
+
function Rr(r) {
|
|
602
603
|
const {
|
|
603
604
|
dxPx: e,
|
|
604
605
|
dyPx: t,
|
|
@@ -619,45 +620,45 @@ function Pr(r) {
|
|
|
619
620
|
z: 0
|
|
620
621
|
};
|
|
621
622
|
}
|
|
622
|
-
function
|
|
623
|
+
function Ar(r, e) {
|
|
623
624
|
return !Number.isFinite(r.x) || !Number.isFinite(r.y) || !Number.isFinite(r.z) || !Number.isFinite(e.x) || !Number.isFinite(e.y) || !Number.isFinite(e.z) ? { x: 0, y: 0, z: 0 } : {
|
|
624
625
|
x: r.x - e.x,
|
|
625
626
|
y: r.y - e.y,
|
|
626
627
|
z: 0
|
|
627
628
|
};
|
|
628
629
|
}
|
|
629
|
-
function
|
|
630
|
+
function Ir(r, e, t) {
|
|
630
631
|
if (!Number.isFinite(r.x) || !Number.isFinite(r.y) || !Number.isFinite(r.z))
|
|
631
632
|
return { x: 0, y: 0, z: 0 };
|
|
632
|
-
const i =
|
|
633
|
+
const i = Ar(e, t);
|
|
633
634
|
return {
|
|
634
635
|
x: r.x + i.x,
|
|
635
636
|
y: r.y + i.y,
|
|
636
637
|
z: r.z
|
|
637
638
|
};
|
|
638
639
|
}
|
|
639
|
-
const
|
|
640
|
-
function
|
|
640
|
+
const Lr = 0.35, Pe = 1, Dr = 1, Tr = 170;
|
|
641
|
+
function Ve(r, e, t) {
|
|
641
642
|
return Math.max(e, Math.min(t, r));
|
|
642
643
|
}
|
|
643
644
|
function me(r, e, t, i) {
|
|
644
645
|
const n = Number.isFinite(r) ? r : e;
|
|
645
|
-
return
|
|
646
|
+
return Ve(n, t, i);
|
|
646
647
|
}
|
|
647
|
-
function
|
|
648
|
-
return Number.isFinite(r) ?
|
|
648
|
+
function pn(r) {
|
|
649
|
+
return Number.isFinite(r) ? Ve(r, 0.1, 0.95) : Lr;
|
|
649
650
|
}
|
|
650
|
-
function
|
|
651
|
+
function Nr(r, e) {
|
|
651
652
|
return !Number.isFinite(r) || !Number.isFinite(e) || r <= 0 || e <= 0 ? 1 : r / e;
|
|
652
653
|
}
|
|
653
|
-
function
|
|
654
|
-
const e = me(r, 50,
|
|
654
|
+
function mn(r) {
|
|
655
|
+
const e = me(r, 50, Dr, Tr), t = Math.tan(e * Math.PI / 360);
|
|
655
656
|
return Math.max(t, 1e-4);
|
|
656
657
|
}
|
|
657
|
-
function
|
|
658
|
+
function Or(r) {
|
|
658
659
|
return Number.isFinite(r) ? Math.max(0.2, Math.abs(Math.sin(r))) : 0.2;
|
|
659
660
|
}
|
|
660
|
-
function
|
|
661
|
+
function jr(r) {
|
|
661
662
|
return Number.isFinite(r) ? {
|
|
662
663
|
sinAbs: Math.max(1e-4, Math.abs(Math.sin(r))),
|
|
663
664
|
cosAbs: Math.abs(Math.cos(r))
|
|
@@ -666,15 +667,15 @@ function Nr(r) {
|
|
|
666
667
|
cosAbs: Math.sqrt(1 - 0.2 * 0.2)
|
|
667
668
|
};
|
|
668
669
|
}
|
|
669
|
-
function
|
|
670
|
-
const i = Math.max(1e-4, 2 * r * e /
|
|
670
|
+
function fn(r, e, t) {
|
|
671
|
+
const i = Math.max(1e-4, 2 * r * e / Or(t)), { sinAbs: n, cosAbs: s } = jr(t), a = r * e, o = n * n - a * a * s * s;
|
|
671
672
|
if (!Number.isFinite(o) || o <= 1e-4)
|
|
672
673
|
return i;
|
|
673
674
|
const l = 2 * a * n / o;
|
|
674
675
|
return !Number.isFinite(l) || l <= 1e-4 ? i : l;
|
|
675
676
|
}
|
|
676
|
-
function
|
|
677
|
-
const e =
|
|
677
|
+
function Fr(r) {
|
|
678
|
+
const e = pn(r.ndcBand), t = r.useFixedOrientation ? r.fixedOrbitYaw : r.orbitYaw, i = r.useFixedOrientation ? r.fixedOrbitPitch : r.orbitPitch, n = Math.max(me(r.orthoFrustumSize, Pe, Pe, Number.MAX_VALUE), Pe), s = mn(r.perspectiveFovDeg), a = fn(e, s, i), o = me(r.orbitDistanceMin, 500, 1, Number.MAX_VALUE), l = Math.max(o, me(r.orbitDistanceMax, 2e5, o, Number.MAX_VALUE)), d = Ve(n / a, o, l);
|
|
678
679
|
return {
|
|
679
680
|
orbitTarget: { x: r.orthoCenterX, y: r.orthoCenterY, z: 0 },
|
|
680
681
|
orbitDistance: d,
|
|
@@ -682,25 +683,25 @@ function Or(r) {
|
|
|
682
683
|
orbitPitch: i
|
|
683
684
|
};
|
|
684
685
|
}
|
|
685
|
-
function
|
|
686
|
-
const e =
|
|
686
|
+
function zr(r) {
|
|
687
|
+
const e = Nr(r.viewportWidthPx, r.viewportHeightPx), t = pn(r.ndcBand), i = mn(r.perspectiveFovDeg), n = fn(t, i, r.orbitPitch), s = me(r.orthoFrustumMin, 1e3, Pe, Number.MAX_VALUE), a = Math.max(s, me(r.orthoFrustumMax, 1e5, s, Number.MAX_VALUE)), o = Math.max(me(r.orbitDistance, s, s, Number.MAX_VALUE), Pe), l = o * n, d = Number.isFinite(l) && l >= Pe ? l : Ve(o / Math.max(0.5, Math.min(2, e)), s, a);
|
|
687
688
|
return {
|
|
688
689
|
orthoCenterX: r.orbitTarget.x,
|
|
689
690
|
orthoCenterY: r.orbitTarget.y,
|
|
690
|
-
orthoFrustumSize:
|
|
691
|
+
orthoFrustumSize: Ve(d, s, a)
|
|
691
692
|
};
|
|
692
693
|
}
|
|
693
|
-
function
|
|
694
|
+
function $r(r) {
|
|
694
695
|
const e = Math.max(r.xmax - r.xmin, r.ymax - r.ymin, 1), t = Math.max(1e-4, Math.tan(r.fovDeg * Math.PI / 360)), i = Math.max(1e-4, Math.abs(Math.sin(r.orbitPitchRad))), n = Math.abs(Math.cos(r.orbitPitchRad)), s = r.ndcBand * t, a = i * i - s * s * n * n, o = Math.max(
|
|
695
696
|
1e-4,
|
|
696
697
|
2 * r.ndcBand * t / Math.max(0.2, i)
|
|
697
698
|
), l = Number.isFinite(a) && a > 1e-4 ? Math.max(1e-4, 2 * s * i / a) : o;
|
|
698
699
|
return e / l;
|
|
699
700
|
}
|
|
700
|
-
function
|
|
701
|
+
function Vr(r, e, t, i = 40) {
|
|
701
702
|
return e === 1 ? r * i : e === 2 ? r * t : r;
|
|
702
703
|
}
|
|
703
|
-
function
|
|
704
|
+
function Br(r) {
|
|
704
705
|
const { valuePx: e, ctrlKey: t, eventTimeMs: i, state: n, resetMs: s } = r, a = Math.abs(e), o = n.lastEventTimeMs === 0 ? 0 : i - n.lastEventTimeMs;
|
|
705
706
|
let l = n.type;
|
|
706
707
|
if (t)
|
|
@@ -719,7 +720,7 @@ function $r(r) {
|
|
|
719
720
|
type: l
|
|
720
721
|
};
|
|
721
722
|
}
|
|
722
|
-
function
|
|
723
|
+
function Ur(r, e, t) {
|
|
723
724
|
if (!Number.isFinite(r) || r === 0) return 1;
|
|
724
725
|
const i = e === "wheel" ? t.wheelZoomRate : t.trackpadZoomRate;
|
|
725
726
|
if (e === "wheel") {
|
|
@@ -731,19 +732,19 @@ function Vr(r, e, t) {
|
|
|
731
732
|
const s = 1 / t.maxScalePerFrame;
|
|
732
733
|
return Math.max(s, Math.min(t.maxScalePerFrame, n));
|
|
733
734
|
}
|
|
734
|
-
const ut = 500,
|
|
735
|
+
const ut = 500, ti = 2e5, ht = 0.95, ii = -Math.PI / 2, ni = Y.degToRad(55), _r = 1e3, Hr = 2e6;
|
|
735
736
|
function ge(r, e, t = 1e-4) {
|
|
736
737
|
return Math.abs(r - e) <= t;
|
|
737
738
|
}
|
|
738
|
-
class
|
|
739
|
+
class qr {
|
|
739
740
|
constructor() {
|
|
740
741
|
u(this, "orbitTarget", new M(0, 0, 0));
|
|
741
742
|
u(this, "orbitDistance", 14e3);
|
|
742
|
-
u(this, "orbitYaw",
|
|
743
|
-
u(this, "orbitPitch",
|
|
743
|
+
u(this, "orbitYaw", ii);
|
|
744
|
+
u(this, "orbitPitch", ni);
|
|
744
745
|
u(this, "enabled", !0);
|
|
745
746
|
u(this, "orbitDistanceMin", ut);
|
|
746
|
-
u(this, "orbitDistanceMax",
|
|
747
|
+
u(this, "orbitDistanceMax", ti);
|
|
747
748
|
u(this, "viewportSnapshotBefore3D", null);
|
|
748
749
|
u(this, "orbitSnapshotOn3DEntry", null);
|
|
749
750
|
u(this, "dragMode", null);
|
|
@@ -786,7 +787,7 @@ class _r {
|
|
|
786
787
|
if (!i) return;
|
|
787
788
|
const n = Math.max(1, (t == null ? void 0 : t.padding) ?? 1.15), s = e.getSize(new M()), a = e.getCenter(new M());
|
|
788
789
|
this.orbitTarget.set(a.x, a.y, a.z);
|
|
789
|
-
const o =
|
|
790
|
+
const o = $r({
|
|
790
791
|
xmin: e.min.x,
|
|
791
792
|
ymin: e.min.y,
|
|
792
793
|
xmax: e.max.x,
|
|
@@ -795,7 +796,7 @@ class _r {
|
|
|
795
796
|
orbitPitchRad: this.orbitPitch,
|
|
796
797
|
ndcBand: ht
|
|
797
798
|
}), l = i.camera3d.fov * Math.PI / 180, d = 2 * Math.atan(Math.tan(l / 2) * Math.max(i.camera3d.aspect, 1e-6)), c = Math.max(Math.min(l, d) / 2, 1e-6), p = Math.max(s.length() / 2, 1e-6) / Math.sin(c) * n, h = Math.max(o, p);
|
|
798
|
-
this.orbitDistanceMin = h < ut ? Math.max(h * 0.02, 1e-6) : ut, this.orbitDistanceMax = Math.max(
|
|
799
|
+
this.orbitDistanceMin = h < ut ? Math.max(h * 0.02, 1e-6) : ut, this.orbitDistanceMax = Math.max(ti, h * 20), this.orbitDistance = this.clampDistance(h), this.syncPerspectiveCamera();
|
|
799
800
|
}
|
|
800
801
|
getVisibleDocumentRect() {
|
|
801
802
|
const e = this.runtime;
|
|
@@ -865,7 +866,7 @@ class _r {
|
|
|
865
866
|
if (this.dragMode === "pan") {
|
|
866
867
|
const i = this.screenToGround(e.clientX, e.clientY);
|
|
867
868
|
if (this.groundPanAnchor && i) {
|
|
868
|
-
const n =
|
|
869
|
+
const n = Ir(this.orbitTarget, this.groundPanAnchor, i);
|
|
869
870
|
this.translateOrbit(n.x - this.orbitTarget.x, n.y - this.orbitTarget.y);
|
|
870
871
|
} else
|
|
871
872
|
this.panByScreenDelta(
|
|
@@ -885,15 +886,15 @@ class _r {
|
|
|
885
886
|
const t = this.runtime;
|
|
886
887
|
if (!t || t.viewMode !== "3d") return;
|
|
887
888
|
(d = e.preventDefault) == null || d.call(e);
|
|
888
|
-
const i = Math.max(1, t.canvasArea.clientHeight), n =
|
|
889
|
-
this.wheelClassifier =
|
|
889
|
+
const i = Math.max(1, t.canvasArea.clientHeight), n = Vr(e.deltaY, e.deltaMode, i);
|
|
890
|
+
this.wheelClassifier = Br({
|
|
890
891
|
valuePx: n,
|
|
891
892
|
ctrlKey: e.ctrlKey,
|
|
892
893
|
eventTimeMs: typeof performance > "u" ? Date.now() : performance.now(),
|
|
893
894
|
state: this.wheelClassifier,
|
|
894
895
|
resetMs: 400
|
|
895
896
|
});
|
|
896
|
-
const s = this.wheelClassifier.type ?? "trackpad", a = s === "wheel" ? Math.sign(n) * 100 : n, o =
|
|
897
|
+
const s = this.wheelClassifier.type ?? "trackpad", a = s === "wheel" ? Math.sign(n) * 100 : n, o = Ur(-a, s, {
|
|
897
898
|
trackpadZoomRate: 1 / 700,
|
|
898
899
|
wheelZoomRate: 1 / 3200,
|
|
899
900
|
maxScalePerFrame: 2
|
|
@@ -905,7 +906,7 @@ class _r {
|
|
|
905
906
|
panByScreenDelta(e, t) {
|
|
906
907
|
const i = this.runtime;
|
|
907
908
|
if (!i) return;
|
|
908
|
-
const n =
|
|
909
|
+
const n = Rr({
|
|
909
910
|
dxPx: e,
|
|
910
911
|
dyPx: t,
|
|
911
912
|
viewportWidthPx: Math.max(1, i.canvasArea.clientWidth),
|
|
@@ -937,7 +938,7 @@ class _r {
|
|
|
937
938
|
var o, l;
|
|
938
939
|
const t = this.runtime;
|
|
939
940
|
if (!t) return;
|
|
940
|
-
const i = t.camera2d, n = i.zoom > 0 ? i.zoom : 1, s = Math.max((i.top - i.bottom) / n, 1), a =
|
|
941
|
+
const i = t.camera2d, n = i.zoom > 0 ? i.zoom : 1, s = Math.max((i.top - i.bottom) / n, 1), a = Fr({
|
|
941
942
|
orthoCenterX: ((o = t.controls2d.target) == null ? void 0 : o.x) ?? i.position.x,
|
|
942
943
|
orthoCenterY: ((l = t.controls2d.target) == null ? void 0 : l.y) ?? i.position.y,
|
|
943
944
|
orthoFrustumSize: s,
|
|
@@ -949,8 +950,8 @@ class _r {
|
|
|
949
950
|
orbitDistanceMin: this.orbitDistanceMin,
|
|
950
951
|
orbitDistanceMax: this.orbitDistanceMax,
|
|
951
952
|
useFixedOrientation: e,
|
|
952
|
-
fixedOrbitYaw:
|
|
953
|
-
fixedOrbitPitch:
|
|
953
|
+
fixedOrbitYaw: ii,
|
|
954
|
+
fixedOrbitPitch: ni,
|
|
954
955
|
ndcBand: ht
|
|
955
956
|
});
|
|
956
957
|
this.orbitTarget.set(a.orbitTarget.x, a.orbitTarget.y, a.orbitTarget.z), this.orbitDistance = this.clampDistance(a.orbitDistance), this.orbitYaw = a.orbitYaw, this.orbitPitch = a.orbitPitch;
|
|
@@ -958,7 +959,7 @@ class _r {
|
|
|
958
959
|
sync2DFromOrbit() {
|
|
959
960
|
const e = this.runtime;
|
|
960
961
|
if (!e) return;
|
|
961
|
-
const t = e.camera2d, i = Math.max(1, e.canvasArea.clientWidth), n = Math.max(1, e.canvasArea.clientHeight), s = i / n, a = t.top - t.bottom, o = a > 0 ? a : 2, l = e.controls2d.minZoom > 0 ? e.controls2d.minZoom : 2e-3, d = Math.max(l, e.controls2d.maxZoom > 0 ? e.controls2d.maxZoom : 5e4), c = Math.max(1, o / d), p = Math.max(c, o / l), h =
|
|
962
|
+
const t = e.camera2d, i = Math.max(1, e.canvasArea.clientWidth), n = Math.max(1, e.canvasArea.clientHeight), s = i / n, a = t.top - t.bottom, o = a > 0 ? a : 2, l = e.controls2d.minZoom > 0 ? e.controls2d.minZoom : 2e-3, d = Math.max(l, e.controls2d.maxZoom > 0 ? e.controls2d.maxZoom : 5e4), c = Math.max(1, o / d), p = Math.max(c, o / l), h = zr({
|
|
962
963
|
orbitTarget: { x: this.orbitTarget.x, y: this.orbitTarget.y, z: this.orbitTarget.z },
|
|
963
964
|
orbitDistance: this.orbitDistance,
|
|
964
965
|
orbitYaw: this.orbitYaw,
|
|
@@ -990,7 +991,7 @@ class _r {
|
|
|
990
991
|
this.orbitTarget.y + this.orbitDistance * Math.sin(this.orbitYaw) * i,
|
|
991
992
|
this.orbitTarget.z + this.orbitDistance * Math.sin(this.orbitPitch)
|
|
992
993
|
);
|
|
993
|
-
t.camera3d.near = Math.min(
|
|
994
|
+
t.camera3d.near = Math.min(_r, Math.max(this.orbitDistance / 100, 1e-6)), t.camera3d.far = Math.max(Hr, this.orbitDistance * 20), t.setPerspectivePose(n, this.orbitTarget), e.sync2D !== !1 && this.sync2DFromOrbit();
|
|
994
995
|
}
|
|
995
996
|
capture2DSnapshot() {
|
|
996
997
|
const e = this.runtime;
|
|
@@ -1061,42 +1062,42 @@ class _r {
|
|
|
1061
1062
|
}
|
|
1062
1063
|
}
|
|
1063
1064
|
}
|
|
1064
|
-
const
|
|
1065
|
+
const Yr = new M(2.4, -2.7, 1.7), Wr = new M(0, 0, 0.65), Gr = Math.PI, Xr = !0, Kr = new M(1.25, -1.5, 0.85).normalize(), Jr = 1.25, Zr = 0.4, Qr = 12, es = 1e3, ts = 20, is = 0.1, ns = 0.2, vn = "left-rotate", rs = {
|
|
1065
1066
|
"left-rotate": { LEFT: re.ROTATE, MIDDLE: re.DOLLY, RIGHT: re.PAN },
|
|
1066
1067
|
"left-pan": { LEFT: re.PAN, MIDDLE: re.DOLLY, RIGHT: re.ROTATE }
|
|
1067
1068
|
};
|
|
1068
|
-
function
|
|
1069
|
-
const t = Math.max(r, 0.02), i = Y.degToRad(e), n = t / Math.sin(i * 0.5) *
|
|
1069
|
+
function ss({ radius: r, fovDeg: e }) {
|
|
1070
|
+
const t = Math.max(r, 0.02), i = Y.degToRad(e), n = t / Math.sin(i * 0.5) * Jr;
|
|
1070
1071
|
return {
|
|
1071
1072
|
distance: n,
|
|
1072
|
-
minDistance: Math.max(t *
|
|
1073
|
-
maxDistance: Math.max(t *
|
|
1073
|
+
minDistance: Math.max(t * Zr, 0.01),
|
|
1074
|
+
maxDistance: Math.max(t * Qr, 1),
|
|
1074
1075
|
near: Math.max(
|
|
1075
|
-
n /
|
|
1076
|
-
Math.min(
|
|
1076
|
+
n / es,
|
|
1077
|
+
Math.min(is, t * ns),
|
|
1077
1078
|
1e-4
|
|
1078
1079
|
),
|
|
1079
|
-
far: Math.max(n *
|
|
1080
|
+
far: Math.max(n * ts, 10)
|
|
1080
1081
|
};
|
|
1081
1082
|
}
|
|
1082
|
-
function
|
|
1083
|
+
function as(r, e, t) {
|
|
1083
1084
|
e.minDistance = t.minDistance, e.maxDistance = t.maxDistance, r.near = t.near, r.far = t.far, r.updateProjectionMatrix();
|
|
1084
1085
|
}
|
|
1085
|
-
function
|
|
1086
|
-
r.enableDamping =
|
|
1086
|
+
function ri(r, e, t = vn) {
|
|
1087
|
+
r.enableDamping = Xr, r.maxPolarAngle = Gr, r.dampingFactor = 0.1, r.enablePan = !0, r.screenSpacePanning = !0, r.mouseButtons = { ...rs[t] }, an.DEFAULT_UP.set(0, 0, 1), e.up.set(0, 0, 1);
|
|
1087
1088
|
}
|
|
1088
|
-
function
|
|
1089
|
+
function os(r, e, t, i) {
|
|
1089
1090
|
if (t.isEmpty()) return null;
|
|
1090
|
-
const n = t.getSize(new M()), s = t.getCenter(new M()), a = Math.max(n.length() * 0.5, 0.02), o =
|
|
1091
|
-
return e.target.copy(s), r.position.copy(s).addScaledVector(
|
|
1091
|
+
const n = t.getSize(new M()), s = t.getCenter(new M()), a = Math.max(n.length() * 0.5, 0.02), o = ss({ radius: a, fovDeg: i });
|
|
1092
|
+
return e.target.copy(s), r.position.copy(s).addScaledVector(Kr, o.distance), as(r, e, o), r.updateMatrixWorld(), e.update(), o;
|
|
1092
1093
|
}
|
|
1093
|
-
const
|
|
1094
|
-
class
|
|
1094
|
+
const ls = 1e3, ds = 2, cs = -1e4, us = 1e4, si = 1e3, hs = 2e6, ps = 1.15, ms = 1, fs = new sn(Math.PI / 2, 0, 0), vs = new it().setFromEuler(fs), gs = new M(0, 1, 0);
|
|
1095
|
+
class bs {
|
|
1095
1096
|
constructor(e) {
|
|
1096
1097
|
u(this, "canvasArea");
|
|
1097
1098
|
u(this, "canvas");
|
|
1098
|
-
u(this, "scene", new
|
|
1099
|
-
u(this, "overlayRoot", new
|
|
1099
|
+
u(this, "scene", new $e());
|
|
1100
|
+
u(this, "overlayRoot", new on());
|
|
1100
1101
|
u(this, "renderer");
|
|
1101
1102
|
u(this, "camera2d");
|
|
1102
1103
|
u(this, "camera3d");
|
|
@@ -1143,16 +1144,16 @@ class vs {
|
|
|
1143
1144
|
u(this, "hdrTransparentBackdropFailed", !1);
|
|
1144
1145
|
u(this, "transmissionHdrBackdrop", null);
|
|
1145
1146
|
u(this, "transmissionHdrBackdropFailed", !1);
|
|
1146
|
-
u(this, "volumeTransmission", new
|
|
1147
|
+
u(this, "volumeTransmission", new Cr());
|
|
1147
1148
|
u(this, "volumeTransmissionFailed", !1);
|
|
1148
|
-
u(this, "eeveeSphereProbeTransmission", new
|
|
1149
|
+
u(this, "eeveeSphereProbeTransmission", new kr());
|
|
1149
1150
|
u(this, "eeveeSphereProbeTransmissionFailed", !1);
|
|
1150
|
-
this.options = e, this.transparentHdrBackdropBlurriness = e.transparentHdrBackdropBlurriness ?? 0, this.canvasArea = e.canvasArea, this.canvas = e.canvas, this.viewModeValue = e.initialViewMode ?? "2d", this.navigationPolicyValue = e.navigationPolicy ?? "legacy", this.previewDragPreset = e.previewDragPreset ??
|
|
1151
|
+
this.options = e, this.transparentHdrBackdropBlurriness = e.transparentHdrBackdropBlurriness ?? 0, this.canvasArea = e.canvasArea, this.canvas = e.canvas, this.viewModeValue = e.initialViewMode ?? "2d", this.navigationPolicyValue = e.navigationPolicy ?? "legacy", this.previewDragPreset = e.previewDragPreset ?? vn, this.environmentBackgroundCapable = e.environment !== void 0 && e.environment !== "room", this.environmentRotationDegrees = oi(e.environmentRotation ?? 0), this.overlayRoot.name = "scene-runtime:overlays", this.scene.add(this.overlayRoot);
|
|
1151
1152
|
}
|
|
1152
1153
|
initialize() {
|
|
1153
1154
|
if (this.disposed) throw new Error("SceneRuntime has been disposed.");
|
|
1154
1155
|
if (this.initialized) return;
|
|
1155
|
-
const e = this.options.factories, t = (e == null ? void 0 : e.createRenderer) ?? ((l) => new
|
|
1156
|
+
const e = this.options.factories, t = (e == null ? void 0 : e.createRenderer) ?? ((l) => new ln(l)), i = (e == null ? void 0 : e.createMapControls) ?? ((l, d) => new Qn(l, d)), n = (e == null ? void 0 : e.createOrbitControls) ?? ((l, d) => new er(l, d));
|
|
1156
1157
|
this.renderer = t({
|
|
1157
1158
|
canvas: this.canvas,
|
|
1158
1159
|
antialias: this.options.antialias ?? !0,
|
|
@@ -1164,17 +1165,17 @@ class vs {
|
|
|
1164
1165
|
}), this.options.clearColor !== void 0 && this.renderer.setClearColor(new tt(this.options.clearColor));
|
|
1165
1166
|
const s = Math.max(1, this.canvasArea.clientWidth || 1), a = Math.max(1, this.canvasArea.clientHeight || 1), o = s / a;
|
|
1166
1167
|
if (this.renderer.setPixelRatio(this.readDevicePixelRatio()), this.renderer.setSize(s, a, !1), this.options.environment) {
|
|
1167
|
-
const l = (e == null ? void 0 : e.createEnvironment) ??
|
|
1168
|
-
this.scene.environmentIntensity =
|
|
1168
|
+
const l = (e == null ? void 0 : e.createEnvironment) ?? ai;
|
|
1169
|
+
this.scene.environmentIntensity = ms, this.applyEnvironmentRotations();
|
|
1169
1170
|
const d = ++this.environmentLoadGeneration, c = l(this.renderer, this.options.environment);
|
|
1170
|
-
|
|
1171
|
+
ys(c) ? c.then(
|
|
1171
1172
|
(p) => this.applyEnvironmentResource(p, d),
|
|
1172
1173
|
(p) => {
|
|
1173
1174
|
!this.disposed && d === this.environmentLoadGeneration && console.warn("Failed to load scene environment HDR.", p);
|
|
1174
1175
|
}
|
|
1175
1176
|
) : this.applyEnvironmentResource(c, d);
|
|
1176
1177
|
}
|
|
1177
|
-
this.camera2d = new St(-o, o, 1, -1,
|
|
1178
|
+
this.camera2d = new St(-o, o, 1, -1, cs, us), this.camera2d.position.set(0, 0, 1), this.camera2d.lookAt(0, 0, 0), this.camera3d = new dn(40, o, si, hs), this.camera3d.up.set(0, 0, 1), this.camera3d.position.set(1e4, 0, 1e4), this.camera3d.lookAt(0, 0, 0), this.controls2d = i(this.camera2d, this.renderer.domElement), this.controls2d.enableRotate = !1, this.controls2d.screenSpacePanning = !0, this.controls2d.zoomToCursor = !0, this.controls2d.minZoom = 2e-3, this.controls2d.maxZoom = 5e4, this.controls2d.mouseButtons = {
|
|
1178
1179
|
LEFT: re.PAN,
|
|
1179
1180
|
MIDDLE: re.DOLLY,
|
|
1180
1181
|
RIGHT: re.PAN
|
|
@@ -1224,10 +1225,10 @@ class vs {
|
|
|
1224
1225
|
var t, i;
|
|
1225
1226
|
if (this.controls3d) {
|
|
1226
1227
|
if (e === "viewer") {
|
|
1227
|
-
this.viewerOrbit ?? (this.viewerOrbit = new
|
|
1228
|
+
this.viewerOrbit ?? (this.viewerOrbit = new qr()), this.viewerOrbit.attach(this);
|
|
1228
1229
|
return;
|
|
1229
1230
|
}
|
|
1230
|
-
(t = this.viewerOrbit) == null || t.setEnabled(!1), (i = this.viewerOrbit) == null || i.dispose(), this.viewerOrbit = null, this.controls3d.enabled = e === "preview" && this.viewModeValue === "3d", e === "preview" && (
|
|
1231
|
+
(t = this.viewerOrbit) == null || t.setEnabled(!1), (i = this.viewerOrbit) == null || i.dispose(), this.viewerOrbit = null, this.controls3d.enabled = e === "preview" && this.viewModeValue === "3d", e === "preview" && (ri(this.controls3d, this.camera3d, this.previewDragPreset), this.camera3d.position.copy(Yr), this.controls3d.target.copy(Wr), this.controls3d.update());
|
|
1231
1232
|
}
|
|
1232
1233
|
}
|
|
1233
1234
|
/**
|
|
@@ -1236,7 +1237,7 @@ class vs {
|
|
|
1236
1237
|
* handed to OrbitControls.
|
|
1237
1238
|
*/
|
|
1238
1239
|
setPreviewDragPreset(e) {
|
|
1239
|
-
this.previewDragPreset !== e && (this.previewDragPreset = e, !(!this.initialized || this.navigationPolicyValue !== "preview") && (
|
|
1240
|
+
this.previewDragPreset !== e && (this.previewDragPreset = e, !(!this.initialized || this.navigationPolicyValue !== "preview") && (ri(this.controls3d, this.camera3d, e), this.requestRender()));
|
|
1240
1241
|
}
|
|
1241
1242
|
/**
|
|
1242
1243
|
* Drives OrbitControls once per frame. Damping mutates the camera inside
|
|
@@ -1258,7 +1259,7 @@ class vs {
|
|
|
1258
1259
|
async setEnvironment(e) {
|
|
1259
1260
|
var n;
|
|
1260
1261
|
if (this.disposed || !this.renderer) return !1;
|
|
1261
|
-
const t = ++this.environmentLoadGeneration, i = ((n = this.options.factories) == null ? void 0 : n.createEnvironment) ??
|
|
1262
|
+
const t = ++this.environmentLoadGeneration, i = ((n = this.options.factories) == null ? void 0 : n.createEnvironment) ?? ai;
|
|
1262
1263
|
try {
|
|
1263
1264
|
const s = await i(this.renderer, e), a = this.applyEnvironmentResource(s, t);
|
|
1264
1265
|
return a && (this.environmentBackgroundCapable = e !== "room"), a;
|
|
@@ -1275,7 +1276,7 @@ class vs {
|
|
|
1275
1276
|
setEnvironmentRotation(e) {
|
|
1276
1277
|
var i;
|
|
1277
1278
|
if (this.disposed || !Number.isFinite(e)) return !1;
|
|
1278
|
-
const t =
|
|
1279
|
+
const t = oi(e);
|
|
1279
1280
|
return t === this.environmentRotationDegrees || (this.environmentRotationDegrees = t, this.applyEnvironmentRotations(), (i = this.hdrTransparentBackdrop) == null || i.setRotationDegrees(this.environmentRotationDegrees), this.requestRender()), !0;
|
|
1280
1281
|
}
|
|
1281
1282
|
getEnvironmentRotation() {
|
|
@@ -1321,7 +1322,7 @@ class vs {
|
|
|
1321
1322
|
if (!this.mountedObjects.has(e) && e.parent !== this.scene) return !1;
|
|
1322
1323
|
e.removeFromParent(), this.mountedObjects.delete(e), this.markTransmissionCachesDirty();
|
|
1323
1324
|
const i = this.ownedObjects.delete(e);
|
|
1324
|
-
return (t.dispose === !0 || t.dispose === void 0 && i) &&
|
|
1325
|
+
return (t.dispose === !0 || t.dispose === void 0 && i) && Xt(e), this.requestRender(), !0;
|
|
1325
1326
|
}
|
|
1326
1327
|
setObjectVisible(e, t) {
|
|
1327
1328
|
e.visible !== t && (e.visible = t, this.markTransmissionCachesDirty(), this.requestRender());
|
|
@@ -1331,7 +1332,7 @@ class vs {
|
|
|
1331
1332
|
}
|
|
1332
1333
|
removeOverlay(e, t = {}) {
|
|
1333
1334
|
const i = this.overlays.get(e);
|
|
1334
|
-
return i ? (this.overlays.delete(e), i.object.removeFromParent(), (t.dispose === !0 || t.dispose === void 0 && i.owned) &&
|
|
1335
|
+
return i ? (this.overlays.delete(e), i.object.removeFromParent(), (t.dispose === !0 || t.dispose === void 0 && i.owned) && Xt(i.object), this.requestRender(), i.object) : null;
|
|
1335
1336
|
}
|
|
1336
1337
|
setHighlight(e, t = {}) {
|
|
1337
1338
|
if (!e) {
|
|
@@ -1362,13 +1363,13 @@ class vs {
|
|
|
1362
1363
|
let m = l / 2, f = d / 2;
|
|
1363
1364
|
m / f < h ? m = f * h : f = m / h, this.camera2d.left = -m, this.camera2d.right = m, this.camera2d.top = f, this.camera2d.bottom = -f, this.camera2d.zoom = 1, this.camera2d.position.set(s.x, s.y, Math.max(s.z + 1, 1)), this.camera2d.updateProjectionMatrix(), this.controls2d.target.copy(s), this.controls2d.update();
|
|
1364
1365
|
} else if (this.navigationPolicyValue === "preview")
|
|
1365
|
-
|
|
1366
|
+
os(this.camera3d, this.controls3d, i, this.camera3d.fov);
|
|
1366
1367
|
else if (this.viewerOrbit)
|
|
1367
1368
|
this.viewerOrbit.fit3D(i, { padding: a });
|
|
1368
1369
|
else {
|
|
1369
1370
|
const l = s.clone(), d = this.camera3d.fov * Math.PI / 180, c = 2 * Math.atan(Math.tan(d / 2) * Math.max(this.camera3d.aspect, 1e-6)), p = Math.max(n.length() / 2, 1e-6), h = Math.max(Math.min(d, c) / 2, 1e-6), m = p / Math.sin(h) * a, f = this.camera3d.position.clone().sub(this.controls3d.target);
|
|
1370
1371
|
f.lengthSq() <= 1e-12 && f.set(1, -1, 1), f.normalize(), this.controls3d.target.copy(l), this.camera3d.position.copy(l).addScaledVector(f, m), this.camera3d.lookAt(l), this.camera3d.near = Math.min(
|
|
1371
|
-
|
|
1372
|
+
si,
|
|
1372
1373
|
Math.max(m * 0.01, 1e-6)
|
|
1373
1374
|
), this.camera3d.updateProjectionMatrix(), this.controls3d.update();
|
|
1374
1375
|
}
|
|
@@ -1471,10 +1472,10 @@ class vs {
|
|
|
1471
1472
|
}
|
|
1472
1473
|
renderOrthographicPreview(e, t, i) {
|
|
1473
1474
|
var D;
|
|
1474
|
-
if (!this.renderer || this.disposed || t.parent || !
|
|
1475
|
-
const n = Math.max(1, Math.floor(e.clientWidth || e.width || 0)), s = Math.max(1, Math.floor(e.clientHeight || e.height || 0)), a = this.resolveRendererPixelRatio(), o = Math.min(2, a), l = Math.max(1, Math.floor(n * o)), d = Math.max(1, Math.floor(s * o)), c = l / a, p = d / a, h = Math.min(c, p), m = (i.minX + i.maxX) / 2, f = (i.minY + i.maxY) / 2, y = Math.max(i.maxX - i.minX, i.maxY - i.minY, 1) *
|
|
1475
|
+
if (!this.renderer || this.disposed || t.parent || !xs(i)) return !1;
|
|
1476
|
+
const n = Math.max(1, Math.floor(e.clientWidth || e.width || 0)), s = Math.max(1, Math.floor(e.clientHeight || e.height || 0)), a = this.resolveRendererPixelRatio(), o = Math.min(2, a), l = Math.max(1, Math.floor(n * o)), d = Math.max(1, Math.floor(s * o)), c = l / a, p = d / a, h = Math.min(c, p), m = (i.minX + i.maxX) / 2, f = (i.minY + i.maxY) / 2, y = Math.max(i.maxX - i.minX, i.maxY - i.minY, 1) * ps / 2, v = this.getOrCreatePreviewRenderTarget(l, d), g = this.getOrCreatePreviewCamera();
|
|
1476
1477
|
g.left = -y, g.right = y, g.top = y, g.bottom = -y, g.position.set(m, f, 1), g.up.copy(((D = this.camera2d) == null ? void 0 : D.up) ?? new M(0, 1, 0)), g.lookAt(m, f, 0), g.updateProjectionMatrix(), g.updateMatrixWorld(!0);
|
|
1477
|
-
const w = this.getOrCreatePreviewScene(), x = this.renderer, C = x.getRenderTarget(), k = x.getClearAlpha(), E = x.autoClear, P = new
|
|
1478
|
+
const w = this.getOrCreatePreviewScene(), x = this.renderer, C = x.getRenderTarget(), k = x.getClearAlpha(), E = x.autoClear, P = new $n();
|
|
1478
1479
|
x.getViewport(P);
|
|
1479
1480
|
const I = x.getScissorTest();
|
|
1480
1481
|
w.add(t);
|
|
@@ -1511,7 +1512,7 @@ class vs {
|
|
|
1511
1512
|
}
|
|
1512
1513
|
screenToWorldOnPlane(e, t, i = 0) {
|
|
1513
1514
|
const n = this.clientToNdc(e, t, this.pointerNdc);
|
|
1514
|
-
return !n || !this.activeCamera ? null : (this.raycaster.setFromCamera(n, this.activeCamera), this.raycaster.ray.intersectPlane(new
|
|
1515
|
+
return !n || !this.activeCamera ? null : (this.raycaster.setFromCamera(n, this.activeCamera), this.raycaster.ray.intersectPlane(new cn(new M(0, 0, 1), -i), new M()));
|
|
1515
1516
|
}
|
|
1516
1517
|
worldToClient(e, t = new J()) {
|
|
1517
1518
|
var a;
|
|
@@ -1553,7 +1554,7 @@ class vs {
|
|
|
1553
1554
|
startAnimation(e = {}) {
|
|
1554
1555
|
if (this.disposed || this.animationLoopActive) return;
|
|
1555
1556
|
this.animationLoopActive = !0, this.infoFrames = 0, this.infoLastTime = performance.now();
|
|
1556
|
-
const t = e.infoUpdateIntervalMs ??
|
|
1557
|
+
const t = e.infoUpdateIntervalMs ?? ls, i = (n = performance.now()) => {
|
|
1557
1558
|
var o, l, d, c, p, h, m, f, b;
|
|
1558
1559
|
if (!this.animationLoopActive || this.disposed) {
|
|
1559
1560
|
this.animationFrameId = null;
|
|
@@ -1632,10 +1633,10 @@ class vs {
|
|
|
1632
1633
|
}
|
|
1633
1634
|
}
|
|
1634
1635
|
getHdrTransparentBackdrop() {
|
|
1635
|
-
return this.hdrTransparentBackdrop || (this.hdrTransparentBackdrop = new
|
|
1636
|
+
return this.hdrTransparentBackdrop || (this.hdrTransparentBackdrop = new hr(), this.hdrTransparentBackdrop.setBlurriness(this.transparentHdrBackdropBlurriness), this.hdrTransparentBackdrop.setRotationDegrees(this.environmentRotationDegrees)), this.hdrTransparentBackdrop;
|
|
1636
1637
|
}
|
|
1637
1638
|
getTransmissionHdrBackdrop() {
|
|
1638
|
-
return this.transmissionHdrBackdrop || (this.transmissionHdrBackdrop = new
|
|
1639
|
+
return this.transmissionHdrBackdrop || (this.transmissionHdrBackdrop = new yr(), this.transmissionHdrBackdrop.setBlurriness(this.transparentHdrBackdropBlurriness)), this.transmissionHdrBackdrop;
|
|
1639
1640
|
}
|
|
1640
1641
|
markTransmissionCachesDirty() {
|
|
1641
1642
|
var e, t;
|
|
@@ -1645,7 +1646,7 @@ class vs {
|
|
|
1645
1646
|
this.applyUpRotation(this.scene.environmentRotation, this.environmentRotationDegrees), this.applyUpRotation(this.scene.backgroundRotation, this.environmentRotationDegrees);
|
|
1646
1647
|
}
|
|
1647
1648
|
applyUpRotation(e, t) {
|
|
1648
|
-
this.upRotationQuaternion.setFromAxisAngle(
|
|
1649
|
+
this.upRotationQuaternion.setFromAxisAngle(gs, Y.degToRad(t)), this.composedRotationQuaternion.copy(this.upRotationQuaternion).multiply(vs), e.setFromQuaternion(this.composedRotationQuaternion, "XYZ");
|
|
1649
1650
|
}
|
|
1650
1651
|
stopAnimation() {
|
|
1651
1652
|
this.animationLoopActive = !1, this.animationFrameId !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(this.animationFrameId), this.animationFrameId = null, this.lastFrameTime = null;
|
|
@@ -1664,14 +1665,14 @@ class vs {
|
|
|
1664
1665
|
return this.disposed || t !== this.environmentLoadGeneration ? (e.dispose(), !1) : ((i = this.environmentResource) == null || i.dispose(), this.environmentResource = e, this.scene.environment = e.texture, (n = this.hdrTransparentBackdrop) == null || n.markDirty(), (s = this.transmissionHdrBackdrop) == null || s.markDirty(), this.volumeTransmission.markDirty(), this.eeveeSphereProbeTransmission.markDirty(), this.requestRender(), !0);
|
|
1665
1666
|
}
|
|
1666
1667
|
getOrCreatePreviewScene() {
|
|
1667
|
-
return this.previewScene || (this.previewScene = new
|
|
1668
|
+
return this.previewScene || (this.previewScene = new $e()), this.previewScene;
|
|
1668
1669
|
}
|
|
1669
1670
|
getOrCreatePreviewCamera() {
|
|
1670
1671
|
return this.previewCamera || (this.previewCamera = new St(-1, 1, 1, -1, -1e6, 1e6)), this.previewCamera;
|
|
1671
1672
|
}
|
|
1672
1673
|
getOrCreatePreviewRenderTarget(e, t) {
|
|
1673
1674
|
var i;
|
|
1674
|
-
return this.previewRenderTarget && this.previewRenderTargetSize.width === e && this.previewRenderTargetSize.height === t ? this.previewRenderTarget : ((i = this.previewRenderTarget) == null || i.dispose(), this.previewRenderTarget = new
|
|
1675
|
+
return this.previewRenderTarget && this.previewRenderTargetSize.width === e && this.previewRenderTargetSize.height === t ? this.previewRenderTarget : ((i = this.previewRenderTarget) == null || i.dispose(), this.previewRenderTarget = new Vn(e, t), this.previewRenderTargetSize = { width: e, height: t }, this.previewRenderTarget);
|
|
1675
1676
|
}
|
|
1676
1677
|
getOrCreatePreviewPixelBuffer(e, t) {
|
|
1677
1678
|
const i = e * t * 4;
|
|
@@ -1701,11 +1702,11 @@ class vs {
|
|
|
1701
1702
|
}
|
|
1702
1703
|
readDevicePixelRatio() {
|
|
1703
1704
|
const e = globalThis.devicePixelRatio;
|
|
1704
|
-
return typeof e != "number" || !Number.isFinite(e) || e <= 0 ? 1 : Math.min(e,
|
|
1705
|
+
return typeof e != "number" || !Number.isFinite(e) || e <= 0 ? 1 : Math.min(e, ds);
|
|
1705
1706
|
}
|
|
1706
1707
|
resolveBox3(e) {
|
|
1707
1708
|
if (e instanceof Z) return e.clone();
|
|
1708
|
-
if (e instanceof
|
|
1709
|
+
if (e instanceof an) return new Z().setFromObject(e);
|
|
1709
1710
|
const { minX: t, minY: i, maxX: n, maxY: s } = e;
|
|
1710
1711
|
return ![t, i, n, s].every(Number.isFinite) || n < t || s < i ? null : new Z(new M(t, i, 0), new M(n, s, 0));
|
|
1711
1712
|
}
|
|
@@ -1724,9 +1725,9 @@ class vs {
|
|
|
1724
1725
|
});
|
|
1725
1726
|
}
|
|
1726
1727
|
}
|
|
1727
|
-
function
|
|
1728
|
+
function ai(r, e) {
|
|
1728
1729
|
if (e === "room") {
|
|
1729
|
-
const t = new
|
|
1730
|
+
const t = new Bn(r), i = new Zn(), n = t.fromScene(i);
|
|
1730
1731
|
return i.dispose(), t.dispose(), {
|
|
1731
1732
|
texture: n.texture,
|
|
1732
1733
|
dispose: () => n.dispose()
|
|
@@ -1734,31 +1735,31 @@ function si(r, e) {
|
|
|
1734
1735
|
}
|
|
1735
1736
|
if (e.url.trim().length === 0)
|
|
1736
1737
|
throw new Error("Scene environment requires a non-empty URL.");
|
|
1737
|
-
return e.type === "image" ? new
|
|
1738
|
+
return e.type === "image" ? new un().loadAsync(e.url).then((t) => (t.mapping = Me, t.colorSpace = Ft, {
|
|
1738
1739
|
texture: t,
|
|
1739
1740
|
dispose: () => t.dispose()
|
|
1740
|
-
})) : new
|
|
1741
|
+
})) : new hn().loadAsync(e.url).then((t) => (t.mapping = Me, {
|
|
1741
1742
|
texture: t,
|
|
1742
1743
|
dispose: () => t.dispose()
|
|
1743
1744
|
}));
|
|
1744
1745
|
}
|
|
1745
|
-
function
|
|
1746
|
+
function ys(r) {
|
|
1746
1747
|
return typeof (r == null ? void 0 : r.then) == "function";
|
|
1747
1748
|
}
|
|
1748
|
-
function
|
|
1749
|
+
function oi(r) {
|
|
1749
1750
|
if (!Number.isFinite(r)) return 0;
|
|
1750
1751
|
const e = r % 360;
|
|
1751
1752
|
return e < 0 ? e + 360 : e;
|
|
1752
1753
|
}
|
|
1753
|
-
function
|
|
1754
|
+
function xs(r) {
|
|
1754
1755
|
return Number.isFinite(r.minX) && Number.isFinite(r.minY) && Number.isFinite(r.maxX) && Number.isFinite(r.maxY) && r.maxX >= r.minX && r.maxY >= r.minY;
|
|
1755
1756
|
}
|
|
1756
|
-
const zt = 1,
|
|
1757
|
-
function
|
|
1758
|
-
return typeof globalThis.localStorage > "u" ?
|
|
1757
|
+
const zt = 1, ws = 1024, Cs = 16, Es = 1e9;
|
|
1758
|
+
function ks() {
|
|
1759
|
+
return typeof globalThis.localStorage > "u" ? Ss() : {
|
|
1759
1760
|
read(r) {
|
|
1760
1761
|
try {
|
|
1761
|
-
const e = globalThis.localStorage.getItem(
|
|
1762
|
+
const e = globalThis.localStorage.getItem(li(r));
|
|
1762
1763
|
return e ? JSON.parse(e) : null;
|
|
1763
1764
|
} catch {
|
|
1764
1765
|
return null;
|
|
@@ -1766,13 +1767,13 @@ function Cs() {
|
|
|
1766
1767
|
},
|
|
1767
1768
|
write(r, e) {
|
|
1768
1769
|
try {
|
|
1769
|
-
globalThis.localStorage.setItem(
|
|
1770
|
+
globalThis.localStorage.setItem(li(r), JSON.stringify(e));
|
|
1770
1771
|
} catch {
|
|
1771
1772
|
}
|
|
1772
1773
|
}
|
|
1773
1774
|
};
|
|
1774
1775
|
}
|
|
1775
|
-
function
|
|
1776
|
+
function Ss() {
|
|
1776
1777
|
const r = /* @__PURE__ */ new Map();
|
|
1777
1778
|
return {
|
|
1778
1779
|
read(e) {
|
|
@@ -1783,7 +1784,7 @@ function Es() {
|
|
|
1783
1784
|
}
|
|
1784
1785
|
};
|
|
1785
1786
|
}
|
|
1786
|
-
function
|
|
1787
|
+
function Ps(r, e) {
|
|
1787
1788
|
if (!r || !e) return null;
|
|
1788
1789
|
const t = r.read(e);
|
|
1789
1790
|
return $t(t) ? t : null;
|
|
@@ -1819,10 +1820,10 @@ function $t(r) {
|
|
|
1819
1820
|
}
|
|
1820
1821
|
return !1;
|
|
1821
1822
|
}
|
|
1822
|
-
function
|
|
1823
|
+
function Ms(r, e, t) {
|
|
1823
1824
|
!r || !e || r.write(e, t);
|
|
1824
1825
|
}
|
|
1825
|
-
function
|
|
1826
|
+
function Rs(r) {
|
|
1826
1827
|
return {
|
|
1827
1828
|
schemaVersion: zt,
|
|
1828
1829
|
viewMode: r.viewMode,
|
|
@@ -1830,36 +1831,36 @@ function Ps(r) {
|
|
|
1830
1831
|
...r.orbit ? { orbit: r.orbit } : {}
|
|
1831
1832
|
};
|
|
1832
1833
|
}
|
|
1833
|
-
function
|
|
1834
|
+
function As(r, e) {
|
|
1834
1835
|
if (!$t(r)) return null;
|
|
1835
|
-
const t =
|
|
1836
|
+
const t = Is(e);
|
|
1836
1837
|
if (r.viewMode === "2d") {
|
|
1837
1838
|
const n = r.orthographic;
|
|
1838
1839
|
if (!n) return null;
|
|
1839
1840
|
const s = (n.right - n.left) / n.zoom, a = (n.top - n.bottom) / n.zoom;
|
|
1840
|
-
return !Number.isFinite(s) || !Number.isFinite(a) || Math.max(s, a) > t || e && !
|
|
1841
|
+
return !Number.isFinite(s) || !Number.isFinite(a) || Math.max(s, a) > t || e && !Ls(n.positionX, n.positionY, s, a, e) ? null : r;
|
|
1841
1842
|
}
|
|
1842
1843
|
const i = r.orbit;
|
|
1843
|
-
return !i || e && !
|
|
1844
|
+
return !i || e && !Ds(i.targetX, i.targetY, e) ? null : r;
|
|
1844
1845
|
}
|
|
1845
|
-
function
|
|
1846
|
+
function Is(r) {
|
|
1846
1847
|
if (r) {
|
|
1847
1848
|
const e = Math.max(r.maxX - r.minX, r.maxY - r.minY);
|
|
1848
|
-
if (Number.isFinite(e) && e > 0) return e *
|
|
1849
|
+
if (Number.isFinite(e) && e > 0) return e * ws;
|
|
1849
1850
|
}
|
|
1850
|
-
return
|
|
1851
|
+
return Es;
|
|
1851
1852
|
}
|
|
1852
|
-
function
|
|
1853
|
+
function Ls(r, e, t, i, n) {
|
|
1853
1854
|
const s = t / 2, a = i / 2;
|
|
1854
1855
|
return !(r + s < n.minX || r - s > n.maxX || e + a < n.minY || e - a > n.maxY);
|
|
1855
1856
|
}
|
|
1856
|
-
function
|
|
1857
|
+
function Ds(r, e, t) {
|
|
1857
1858
|
const i = Math.max(t.maxX - t.minX, t.maxY - t.minY);
|
|
1858
1859
|
if (!Number.isFinite(i) || i <= 0) return !0;
|
|
1859
|
-
const n = i *
|
|
1860
|
+
const n = i * Cs;
|
|
1860
1861
|
return r >= t.minX - n && r <= t.maxX + n && e >= t.minY - n && e <= t.maxY + n;
|
|
1861
1862
|
}
|
|
1862
|
-
function
|
|
1863
|
+
function li(r) {
|
|
1863
1864
|
return `nebula-viewer:camera:v${zt}:${r}`;
|
|
1864
1865
|
}
|
|
1865
1866
|
function Ie(r) {
|
|
@@ -1868,11 +1869,11 @@ function Ie(r) {
|
|
|
1868
1869
|
new M(r.maxX, r.maxY, r.maxZ)
|
|
1869
1870
|
);
|
|
1870
1871
|
}
|
|
1871
|
-
function
|
|
1872
|
+
function gn(r) {
|
|
1872
1873
|
const [e, t, i] = r;
|
|
1873
1874
|
return (e & 255) << 16 | (t & 255) << 8 | i & 255;
|
|
1874
1875
|
}
|
|
1875
|
-
class
|
|
1876
|
+
class Ts {
|
|
1876
1877
|
constructor() {
|
|
1877
1878
|
u(this, "rows", []);
|
|
1878
1879
|
u(this, "allColor", null);
|
|
@@ -1895,7 +1896,7 @@ class Ls {
|
|
|
1895
1896
|
color: i.has(s.index) ? i.get(s.index) : this.allColor,
|
|
1896
1897
|
sourceColor: s.color
|
|
1897
1898
|
}));
|
|
1898
|
-
|
|
1899
|
+
Fs(this.rows, n) || (this.rows = n, this.revision += 1, t && this.onChange());
|
|
1899
1900
|
}
|
|
1900
1901
|
clear(e = !0) {
|
|
1901
1902
|
const t = this.rows.length > 0 || this.allColor !== null;
|
|
@@ -1952,7 +1953,7 @@ class Ls {
|
|
|
1952
1953
|
t && (this.allColor = e, this.revision += 1, this.onChange());
|
|
1953
1954
|
}
|
|
1954
1955
|
}
|
|
1955
|
-
class
|
|
1956
|
+
class Ns {
|
|
1956
1957
|
constructor() {
|
|
1957
1958
|
u(this, "usages", []);
|
|
1958
1959
|
u(this, "revision", 0);
|
|
@@ -1978,7 +1979,7 @@ class Ds {
|
|
|
1978
1979
|
canHighlight: n.canHighlight,
|
|
1979
1980
|
visible: n.visible
|
|
1980
1981
|
}));
|
|
1981
|
-
|
|
1982
|
+
zs(this.usages, i) || (this.usages = i, this.revision += 1, t && this.onChange());
|
|
1982
1983
|
}
|
|
1983
1984
|
clear(e = !0) {
|
|
1984
1985
|
const t = this.usages.length > 0;
|
|
@@ -2005,7 +2006,7 @@ class Ds {
|
|
|
2005
2006
|
t.length !== 0 && (this.renderNode.setInsertVisibleBatch(t), i && (this.visibilityRevision += 1, this.revision += 1, this.onChange()));
|
|
2006
2007
|
}
|
|
2007
2008
|
}
|
|
2008
|
-
class
|
|
2009
|
+
class Os {
|
|
2009
2010
|
constructor() {
|
|
2010
2011
|
u(this, "selection", null);
|
|
2011
2012
|
u(this, "details", null);
|
|
@@ -2023,7 +2024,7 @@ class Ts {
|
|
|
2023
2024
|
return !this.selection && !this.details && !this.textSelection && !this.textDetails ? !1 : (this.selection = null, this.details = null, this.textSelection = null, this.textDetails = null, this.revision += 1, !0);
|
|
2024
2025
|
}
|
|
2025
2026
|
}
|
|
2026
|
-
class
|
|
2027
|
+
class js {
|
|
2027
2028
|
constructor() {
|
|
2028
2029
|
u(this, "revision", 0);
|
|
2029
2030
|
u(this, "filename", null);
|
|
@@ -2065,7 +2066,7 @@ class Ns {
|
|
|
2065
2066
|
this.zoomLabel = Number.isFinite(p) && (p ?? 0) > 0 ? `${Math.round(p * 100)}%` : "", this.scaleRuler = {
|
|
2066
2067
|
visible: !0,
|
|
2067
2068
|
worldLength: c,
|
|
2068
|
-
lengthLabel:
|
|
2069
|
+
lengthLabel: $s(c, ((l = e.units) == null ? void 0 : l.source) ?? "mm")
|
|
2069
2070
|
}, this.orbitDistanceLabel = "";
|
|
2070
2071
|
} else {
|
|
2071
2072
|
const c = (d = e.host.runtime.captureCameraSnapshot()) == null ? void 0 : d.orbit;
|
|
@@ -2076,26 +2077,26 @@ class Ns {
|
|
|
2076
2077
|
return this.filename !== null || this.fileCount !== 0 || this.visibleLayerCount !== 0 || this.totalLayerCount !== 0 || this.statusMessage !== "" || this.zoomLabel !== "" || this.orbitDistanceLabel !== "" || this.scaleRuler !== null || this.viewportVertexCount !== 0 || this.drawCalls !== 0 || this.fps !== 0 || this.lineRenderMode !== "" || this.entityCount !== 0 || this.lineCount !== 0 || this.fillCount !== 0 || this.dotCount !== 0 || this.textCount !== 0 || this.renderableCount !== 0 || this.submittedVertexRefs !== 0 || this.blockVariantCount !== 0 || this.blockInstanceCount !== 0 || this.splitBlockLayerGroupCount !== 0 || this.renderDebugBreakdown.length > 0 || this.splitBlockLayerDetails.length > 0 || this.phase !== null ? (this.revision += 1, this.filename = null, this.fileCount = 0, this.visibleLayerCount = 0, this.totalLayerCount = 0, this.statusMessage = "", this.zoomLabel = "", this.orbitDistanceLabel = "", this.scaleRuler = null, this.viewportVertexCount = 0, this.drawCalls = 0, this.fps = 0, this.lineRenderMode = "", this.entityCount = 0, this.lineCount = 0, this.fillCount = 0, this.dotCount = 0, this.textCount = 0, this.renderableCount = 0, this.submittedVertexRefs = 0, this.blockVariantCount = 0, this.blockInstanceCount = 0, this.splitBlockLayerGroupCount = 0, this.renderDebugBreakdown = [], this.splitBlockLayerDetails = [], this.phase = null, !0) : !1;
|
|
2077
2078
|
}
|
|
2078
2079
|
}
|
|
2079
|
-
function
|
|
2080
|
+
function Fs(r, e) {
|
|
2080
2081
|
return r.length === e.length && r.every((t, i) => {
|
|
2081
2082
|
const n = e[i];
|
|
2082
2083
|
return n !== void 0 && t.index === n.index && t.name === n.name && t.visible === n.visible && t.color === n.color && t.sourceColor[0] === n.sourceColor[0] && t.sourceColor[1] === n.sourceColor[1] && t.sourceColor[2] === n.sourceColor[2];
|
|
2083
2084
|
});
|
|
2084
2085
|
}
|
|
2085
|
-
function
|
|
2086
|
+
function zs(r, e) {
|
|
2086
2087
|
return r.length === e.length && r.every((t, i) => {
|
|
2087
2088
|
const n = e[i];
|
|
2088
2089
|
return n !== void 0 && t.insertId === n.insertId && t.blockName === n.blockName && t.layerName === n.layerName && t.layerIndex === n.layerIndex && t.variantId === n.variantId && t.instanceId === n.instanceId && t.label === n.label && t.canHighlight === n.canHighlight && t.visible === n.visible;
|
|
2089
2090
|
});
|
|
2090
2091
|
}
|
|
2091
|
-
function
|
|
2092
|
+
function $s(r, e) {
|
|
2092
2093
|
if (e === "mm") {
|
|
2093
2094
|
if (r >= 1e6) return `${(r / 1e6).toFixed(2)} km`;
|
|
2094
2095
|
if (r >= 1e3) return `${(r / 1e3).toFixed(2)} m`;
|
|
2095
2096
|
}
|
|
2096
2097
|
return `${r.toFixed(2)}${e ? ` ${e}` : ""}`;
|
|
2097
2098
|
}
|
|
2098
|
-
function
|
|
2099
|
+
function di(r) {
|
|
2099
2100
|
return {
|
|
2100
2101
|
documentKey: r.documentKey,
|
|
2101
2102
|
filename: r.filename,
|
|
@@ -2107,13 +2108,13 @@ function li(r) {
|
|
|
2107
2108
|
units: r.units ?? { source: "mm" }
|
|
2108
2109
|
};
|
|
2109
2110
|
}
|
|
2110
|
-
const
|
|
2111
|
-
class
|
|
2111
|
+
const Vs = 160, ci = 5e3;
|
|
2112
|
+
class Bs {
|
|
2112
2113
|
constructor(e) {
|
|
2113
|
-
u(this, "layers", new
|
|
2114
|
-
u(this, "blocks", new
|
|
2115
|
-
u(this, "inspector", new
|
|
2116
|
-
u(this, "hud", new
|
|
2114
|
+
u(this, "layers", new Ts());
|
|
2115
|
+
u(this, "blocks", new Ns());
|
|
2116
|
+
u(this, "inspector", new Os());
|
|
2117
|
+
u(this, "hud", new js());
|
|
2117
2118
|
u(this, "document", null);
|
|
2118
2119
|
u(this, "loadTiming", null);
|
|
2119
2120
|
u(this, "capabilities", {
|
|
@@ -2147,10 +2148,10 @@ class $s {
|
|
|
2147
2148
|
this.assertActive(), this.closeInternal();
|
|
2148
2149
|
const i = ++this.openEpoch;
|
|
2149
2150
|
this.cameraSettled = !1, this.initialDemandSettled = !1, this.initialCameraRestored = !1, this.cameraChangedDuringInitialLoad = !1, this.loadTiming = null;
|
|
2150
|
-
const n = t.documentKey ??
|
|
2151
|
+
const n = t.documentKey ?? Ys(e);
|
|
2151
2152
|
let s;
|
|
2152
2153
|
try {
|
|
2153
|
-
s =
|
|
2154
|
+
s = tr(e, {
|
|
2154
2155
|
documentKey: n ?? void 0,
|
|
2155
2156
|
filename: t.filename,
|
|
2156
2157
|
loadAnnotations: t.loadAnnotations,
|
|
@@ -2170,7 +2171,7 @@ class $s {
|
|
|
2170
2171
|
throw this.emit("error", { ...Le(p, !0, e), error: p }), p;
|
|
2171
2172
|
}
|
|
2172
2173
|
this.session = s, this.loadTiming = s.loadTiming, this.statusMessage = "加载中…";
|
|
2173
|
-
const a =
|
|
2174
|
+
const a = ir(s);
|
|
2174
2175
|
this.renderNode = a, this.layers.bind(a, () => this.emit("layer-change", { layers: this.layers })), this.blocks.bind(a, () => this.emit("block-change", { blocks: this.blocks })), this.unsubscribers.push(
|
|
2175
2176
|
a.onChange(() => {
|
|
2176
2177
|
this.host.requestRender(), this.host.emitContentChange();
|
|
@@ -2239,7 +2240,7 @@ class $s {
|
|
|
2239
2240
|
name: "AbortError",
|
|
2240
2241
|
code: "E_SUPERSEDED"
|
|
2241
2242
|
});
|
|
2242
|
-
return this.layers.sync(s, !1), this.blocks.sync(s, !1), this.syncHud(t.filename ?? o.filename ?? null), this.initialCameraRestored = this.tryRestoreCamera(n, o.bounds), !this.initialCameraRestored && o.bounds && this.host.fitBox3(Ie(o.bounds)), this.cameraSettled = !0, this.syncDisplayContext(), this.document =
|
|
2243
|
+
return this.layers.sync(s, !1), this.blocks.sync(s, !1), this.syncHud(t.filename ?? o.filename ?? null), this.initialCameraRestored = this.tryRestoreCamera(n, o.bounds), !this.initialCameraRestored && o.bounds && this.host.fitBox3(Ie(o.bounds)), this.cameraSettled = !0, this.syncDisplayContext(), this.document = di({
|
|
2243
2244
|
documentKey: n,
|
|
2244
2245
|
filename: t.filename ?? o.filename ?? null,
|
|
2245
2246
|
phase: s.phase === "interactive" && !this.initialDemandSettled ? "initial-loading" : s.phase,
|
|
@@ -2318,11 +2319,11 @@ class $s {
|
|
|
2318
2319
|
return this.layers.getVisibilityRevision() + this.blocks.getVisibilityRevision();
|
|
2319
2320
|
}
|
|
2320
2321
|
setInsertSelection(e, t) {
|
|
2321
|
-
|
|
2322
|
+
Us(this.inspector.selection, e) && Hs(this.inspector.details, t) && !this.inspector.textSelection || (this.inspector.setSelection(e, t), this.emit("inspector-change", { inspector: this.inspector }));
|
|
2322
2323
|
}
|
|
2323
2324
|
/** @internal Used by the viewer's managed interaction pipeline. */
|
|
2324
2325
|
setTextSelectionInternal(e, t) {
|
|
2325
|
-
|
|
2326
|
+
_s(this.inspector.textSelection, e) && qs(this.inspector.textDetails, t) && !this.inspector.selection || (this.inspector.setTextSelection(e, t), this.emit("inspector-change", { inspector: this.inspector }));
|
|
2326
2327
|
}
|
|
2327
2328
|
getAuthoritativeBoundsBox() {
|
|
2328
2329
|
if (!this.session) return null;
|
|
@@ -2396,7 +2397,7 @@ class $s {
|
|
|
2396
2397
|
hud: e(this.hud),
|
|
2397
2398
|
loadTiming: e(this.loadTiming)
|
|
2398
2399
|
};
|
|
2399
|
-
return
|
|
2400
|
+
return bn(t);
|
|
2400
2401
|
}
|
|
2401
2402
|
fitDocument() {
|
|
2402
2403
|
this.assertActive();
|
|
@@ -2410,8 +2411,8 @@ class $s {
|
|
|
2410
2411
|
if (!e) return !1;
|
|
2411
2412
|
let { minX: t, minY: i, maxX: n, maxY: s } = e;
|
|
2412
2413
|
const a = n - t, o = s - i, l = Math.max(a, o);
|
|
2413
|
-
if (a > 0 && o > 0 && l <
|
|
2414
|
-
const c = (t + n) / 2, p = (i + s) / 2, h =
|
|
2414
|
+
if (a > 0 && o > 0 && l < ci) {
|
|
2415
|
+
const c = (t + n) / 2, p = (i + s) / 2, h = ci / 2;
|
|
2415
2416
|
t = c - h, i = p - h, n = c + h, s = p + h;
|
|
2416
2417
|
}
|
|
2417
2418
|
return this.host.fitBox3(Ie({
|
|
@@ -2434,7 +2435,7 @@ class $s {
|
|
|
2434
2435
|
tryRestoreCamera(e, t) {
|
|
2435
2436
|
const i = this.host.readCameraSnapshot(e);
|
|
2436
2437
|
if (!i) return !1;
|
|
2437
|
-
const n =
|
|
2438
|
+
const n = As(i, t);
|
|
2438
2439
|
return n ? this.host.applyCameraSnapshot(n, "restore") : !1;
|
|
2439
2440
|
}
|
|
2440
2441
|
persistCurrentCamera() {
|
|
@@ -2443,7 +2444,7 @@ class $s {
|
|
|
2443
2444
|
const e = this.host.runtime.captureCameraSnapshot();
|
|
2444
2445
|
e && this.host.persistCameraSnapshot(
|
|
2445
2446
|
this.document.documentKey,
|
|
2446
|
-
|
|
2447
|
+
Rs(e)
|
|
2447
2448
|
);
|
|
2448
2449
|
}
|
|
2449
2450
|
syncDisplayContext() {
|
|
@@ -2489,7 +2490,7 @@ class $s {
|
|
|
2489
2490
|
}
|
|
2490
2491
|
this.viewportDemandTimer === null && (this.viewportDemandTimer = globalThis.setTimeout(() => {
|
|
2491
2492
|
this.viewportDemandTimer = null, !(this.disposed || !this.session) && this.host.interaction === "active" && this.flushViewportDemand();
|
|
2492
|
-
}, Math.max(0, this.host.viewportDemandCoalesceMs ??
|
|
2493
|
+
}, Math.max(0, this.host.viewportDemandCoalesceMs ?? Vs)));
|
|
2493
2494
|
}
|
|
2494
2495
|
clearViewportDemandTimer() {
|
|
2495
2496
|
this.viewportDemandTimer !== null && (globalThis.clearTimeout(this.viewportDemandTimer), this.viewportDemandTimer = null);
|
|
@@ -2508,7 +2509,7 @@ class $s {
|
|
|
2508
2509
|
});
|
|
2509
2510
|
}
|
|
2510
2511
|
publishDocumentPhase(e) {
|
|
2511
|
-
this.document && (this.document =
|
|
2512
|
+
this.document && (this.document = di({
|
|
2512
2513
|
documentKey: this.document.documentKey,
|
|
2513
2514
|
filename: this.document.filename,
|
|
2514
2515
|
phase: e,
|
|
@@ -2526,19 +2527,19 @@ class $s {
|
|
|
2526
2527
|
if (this.disposed) throw new Error("Viewer has been disposed.");
|
|
2527
2528
|
}
|
|
2528
2529
|
}
|
|
2529
|
-
function
|
|
2530
|
+
function Us(r, e) {
|
|
2530
2531
|
return r === e || !!(r && e && r.documentKey === e.documentKey && r.id.layerIndex === e.id.layerIndex && r.id.variantId === e.id.variantId && r.id.instanceId === e.id.instanceId);
|
|
2531
2532
|
}
|
|
2532
|
-
function
|
|
2533
|
+
function _s(r, e) {
|
|
2533
2534
|
return r === e || !!(r && e && r.documentKey === e.documentKey && r.id.textId === e.id.textId);
|
|
2534
2535
|
}
|
|
2535
|
-
function
|
|
2536
|
+
function Hs(r, e) {
|
|
2536
2537
|
return r === e || !!(r && e && r.id.layerIndex === e.id.layerIndex && r.id.variantId === e.id.variantId && r.id.instanceId === e.id.instanceId && r.label === e.label && r.blockName === e.blockName && r.layerName === e.layerName && r.layerIndex === e.layerIndex && r.tx === e.tx && r.ty === e.ty && r.rotation === e.rotation && r.scaleX === e.scaleX && r.scaleY === e.scaleY && r.bbox.minX === e.bbox.minX && r.bbox.minY === e.bbox.minY && r.bbox.maxX === e.bbox.maxX && r.bbox.maxY === e.bbox.maxY);
|
|
2537
2538
|
}
|
|
2538
|
-
function
|
|
2539
|
+
function qs(r, e) {
|
|
2539
2540
|
return r === e || !!(r && e && r.id.textId === e.id.textId && r.content === e.content && r.x === e.x && r.y === e.y && r.height === e.height && r.rotation === e.rotation && r.layerName === e.layerName && r.layerIndex === e.layerIndex);
|
|
2540
2541
|
}
|
|
2541
|
-
function
|
|
2542
|
+
function Ys(r) {
|
|
2542
2543
|
let e = null;
|
|
2543
2544
|
if (typeof r == "string" ? e = r : typeof URL < "u" && r instanceof URL ? e = r.href : typeof r == "object" && r !== null && "kind" in r && r.kind === "url" && (e = r.url), !e) return null;
|
|
2544
2545
|
let t = 2166136261;
|
|
@@ -2546,19 +2547,19 @@ function Hs(r) {
|
|
|
2546
2547
|
t ^= e.charCodeAt(i), t = Math.imul(t, 16777619);
|
|
2547
2548
|
return `reference:src-${(t >>> 0).toString(16)}`;
|
|
2548
2549
|
}
|
|
2549
|
-
function
|
|
2550
|
+
function bn(r) {
|
|
2550
2551
|
if (!r || typeof r != "object") return r;
|
|
2551
2552
|
Object.freeze(r);
|
|
2552
2553
|
for (const e of Object.values(r))
|
|
2553
|
-
e && typeof e == "object" && !Object.isFrozen(e) &&
|
|
2554
|
+
e && typeof e == "object" && !Object.isFrozen(e) && bn(e);
|
|
2554
2555
|
return r;
|
|
2555
2556
|
}
|
|
2556
2557
|
function Le(r, e, t) {
|
|
2557
2558
|
const i = r.code, n = r.name, s = r.message.toLowerCase(), a = /external block|sidecar|variant .*fetch/.test(s), o = /annotation/.test(s), l = /font|troika/.test(s), d = i === "E_SUPERSEDED" ? "E_SUPERSEDED" : n === "AbortError" || i === "E_DISPOSED" ? "E_ABORTED" : a ? "E_SIDECAR_FETCH" : o ? "E_ANNOTATION" : l ? "E_FONT" : i === "E_SOURCE" ? "E_SOURCE" : i === "E_PACK_HTTP" || i === "E_PACK_NETWORK" ? "E_FETCH" : i === "E_HEADER" || i === "E_HEADER_JSON" || i === "E_UNSUPPORTED_PACK_VERSION" ? "E_PARSE_HEADER" : i === "E_WORKER" || i === "E_MAIN_BUFFER_PROTOCOL" || i === "E_MAIN_BUFFER_MISSING" || /worker/.test(s) ? "E_WORKER" : "E_PARSE_GEOMETRY";
|
|
2558
2559
|
return { code: d, stage: d === "E_FETCH" ? "source" : d === "E_PARSE_HEADER" ? "header" : d === "E_WORKER" ? "worker" : d === "E_PARSE_GEOMETRY" ? "geometry" : d === "E_SIDECAR_FETCH" ? "sidecar" : d === "E_ANNOTATION" ? "annotation" : d === "E_FONT" ? "font" : d === "E_ABORTED" || d === "E_SUPERSEDED" ? "lifecycle" : "source", fatal: e, source: t };
|
|
2559
2560
|
}
|
|
2560
|
-
const
|
|
2561
|
-
class
|
|
2561
|
+
const ui = 1;
|
|
2562
|
+
class Ws {
|
|
2562
2563
|
constructor(e) {
|
|
2563
2564
|
u(this, "startX", 0);
|
|
2564
2565
|
u(this, "startY", 0);
|
|
@@ -2603,13 +2604,13 @@ class qs {
|
|
|
2603
2604
|
this.release(), this.resetMotion(), this.startX = 0, this.startY = 0, this.lastX = 0, this.lastY = 0;
|
|
2604
2605
|
}
|
|
2605
2606
|
isTrackingPrimaryPointer(e) {
|
|
2606
|
-
return this.primaryPointerDown || (e &
|
|
2607
|
+
return this.primaryPointerDown || (e & ui) === ui;
|
|
2607
2608
|
}
|
|
2608
2609
|
}
|
|
2609
2610
|
function Mt(r, e) {
|
|
2610
2611
|
return `${r}:${e}`;
|
|
2611
2612
|
}
|
|
2612
|
-
class
|
|
2613
|
+
class Gs {
|
|
2613
2614
|
constructor() {
|
|
2614
2615
|
u(this, "expandedLayers", /* @__PURE__ */ new Set());
|
|
2615
2616
|
u(this, "expandedBlocks", /* @__PURE__ */ new Set());
|
|
@@ -2662,7 +2663,7 @@ function H(r) {
|
|
|
2662
2663
|
"'": "'"
|
|
2663
2664
|
})[e] ?? e);
|
|
2664
2665
|
}
|
|
2665
|
-
const
|
|
2666
|
+
const Xs = {
|
|
2666
2667
|
"panel.layers": "图层",
|
|
2667
2668
|
"panel.properties": "属性",
|
|
2668
2669
|
"panel.layers.aria": "图层面板",
|
|
@@ -2741,7 +2742,7 @@ const Ws = {
|
|
|
2741
2742
|
"status.parsing": "解析中…",
|
|
2742
2743
|
"status.incrementalLoading": "增量渲染中…",
|
|
2743
2744
|
"unit.mm": "mm"
|
|
2744
|
-
},
|
|
2745
|
+
}, Ks = {
|
|
2745
2746
|
"panel.layers": "Layers",
|
|
2746
2747
|
"panel.properties": "Properties",
|
|
2747
2748
|
"panel.layers.aria": "Layers panel",
|
|
@@ -2821,29 +2822,29 @@ const Ws = {
|
|
|
2821
2822
|
"status.incrementalLoading": "Rendering incrementally…",
|
|
2822
2823
|
"unit.mm": "mm"
|
|
2823
2824
|
};
|
|
2824
|
-
function
|
|
2825
|
+
function Js(r, e) {
|
|
2825
2826
|
return e ? r.replace(/\{([a-zA-Z0-9_]+)\}/g, (t, i) => {
|
|
2826
2827
|
const n = e[i];
|
|
2827
2828
|
return n === void 0 ? t : String(n);
|
|
2828
2829
|
}) : r;
|
|
2829
2830
|
}
|
|
2830
|
-
function
|
|
2831
|
+
function Zs(r) {
|
|
2831
2832
|
try {
|
|
2832
2833
|
return new Intl.NumberFormat(r, { maximumFractionDigits: 4, useGrouping: !1 });
|
|
2833
2834
|
} catch {
|
|
2834
2835
|
return new Intl.NumberFormat("zh-CN", { maximumFractionDigits: 4, useGrouping: !1 });
|
|
2835
2836
|
}
|
|
2836
2837
|
}
|
|
2837
|
-
function
|
|
2838
|
+
function Qs(r) {
|
|
2838
2839
|
try {
|
|
2839
2840
|
return new Intl.NumberFormat(r, { maximumFractionDigits: 0 });
|
|
2840
2841
|
} catch {
|
|
2841
2842
|
return new Intl.NumberFormat("zh-CN", { maximumFractionDigits: 0 });
|
|
2842
2843
|
}
|
|
2843
2844
|
}
|
|
2844
|
-
function
|
|
2845
|
+
function yn(r) {
|
|
2845
2846
|
var a;
|
|
2846
|
-
const e = ((a = r.locale) == null ? void 0 : a.trim()) || "zh-CN", t = e.toLowerCase().startsWith("en") ?
|
|
2847
|
+
const e = ((a = r.locale) == null ? void 0 : a.trim()) || "zh-CN", t = e.toLowerCase().startsWith("en") ? Ks : Xs, i = Zs(e), n = Qs(e), s = {
|
|
2847
2848
|
locale: e,
|
|
2848
2849
|
t(o, l) {
|
|
2849
2850
|
var p;
|
|
@@ -2855,7 +2856,7 @@ function gn(r) {
|
|
|
2855
2856
|
d = void 0;
|
|
2856
2857
|
}
|
|
2857
2858
|
const c = d ?? ((p = r.messages) == null ? void 0 : p[o]) ?? t[o] ?? o;
|
|
2858
|
-
return
|
|
2859
|
+
return Js(c, l);
|
|
2859
2860
|
},
|
|
2860
2861
|
formatNumber(o) {
|
|
2861
2862
|
return o == null || !Number.isFinite(o) ? "—" : i.format(o);
|
|
@@ -2884,17 +2885,17 @@ function gn(r) {
|
|
|
2884
2885
|
};
|
|
2885
2886
|
return s;
|
|
2886
2887
|
}
|
|
2887
|
-
const
|
|
2888
|
+
const ea = {
|
|
2888
2889
|
"加载中…": "status.loading",
|
|
2889
2890
|
"解析中…": "status.parsing",
|
|
2890
2891
|
"增量渲染中…": "status.incrementalLoading"
|
|
2891
2892
|
};
|
|
2892
|
-
function
|
|
2893
|
-
const t = r.trim(), i =
|
|
2893
|
+
function ta(r, e) {
|
|
2894
|
+
const t = r.trim(), i = ea[t];
|
|
2894
2895
|
return i ? e.t(i) : t;
|
|
2895
2896
|
}
|
|
2896
|
-
const Vt =
|
|
2897
|
-
function
|
|
2897
|
+
const Vt = yn({});
|
|
2898
|
+
function ia(r) {
|
|
2898
2899
|
const e = /* @__PURE__ */ new Map();
|
|
2899
2900
|
for (const i of r.usages) {
|
|
2900
2901
|
const n = e.get(i.layerIndex) ?? /* @__PURE__ */ new Map(), s = Mt(i.layerIndex, i.variantId);
|
|
@@ -2919,7 +2920,7 @@ function ea(r) {
|
|
|
2919
2920
|
t.set(i, [...n.values()]);
|
|
2920
2921
|
return t;
|
|
2921
2922
|
}
|
|
2922
|
-
function
|
|
2923
|
+
function na(r, e) {
|
|
2923
2924
|
return r ? e.toLowerCase().includes(r) : !0;
|
|
2924
2925
|
}
|
|
2925
2926
|
function rt(r, e, t) {
|
|
@@ -2928,17 +2929,17 @@ function rt(r, e, t) {
|
|
|
2928
2929
|
function et(r, e, t) {
|
|
2929
2930
|
r.classList.toggle("off", e === "none"), r.classList.toggle("mixed", e === "mixed"), r.textContent = e === "all" ? "●" : e === "none" ? "○" : "◐", r.title = e === "all" ? t.t("layer.hideBlock") : e === "none" ? t.t("layer.showBlockRestore") : t.t("layer.hideBlockKeep");
|
|
2930
2931
|
}
|
|
2931
|
-
function
|
|
2932
|
+
function ra(r) {
|
|
2932
2933
|
let e = 0;
|
|
2933
2934
|
for (const t of r) t.visible && (e += 1);
|
|
2934
2935
|
return e <= 0 ? "none" : e >= r.length ? "all" : "mixed";
|
|
2935
2936
|
}
|
|
2936
|
-
function
|
|
2937
|
+
function xn(r, e, t, i) {
|
|
2937
2938
|
if (!r) return !1;
|
|
2938
2939
|
const n = r.id;
|
|
2939
2940
|
return n.layerIndex !== e || n.variantId !== t ? !1 : i === void 0 ? !0 : n.instanceId === i;
|
|
2940
2941
|
}
|
|
2941
|
-
function
|
|
2942
|
+
function hi(r) {
|
|
2942
2943
|
const e = r.querySelector(".vui-lrow-insert.active") ?? r.querySelector(".vui-lrow-block.active");
|
|
2943
2944
|
if (!e) return !1;
|
|
2944
2945
|
const t = r.getBoundingClientRect(), i = e.getBoundingClientRect();
|
|
@@ -2946,7 +2947,7 @@ function ui(r) {
|
|
|
2946
2947
|
const n = i.top - t.top, s = r.scrollTop + n - (t.height - i.height) / 2;
|
|
2947
2948
|
return r.scrollTop = Math.max(0, s), !0;
|
|
2948
2949
|
}
|
|
2949
|
-
function
|
|
2950
|
+
function wn(r, e, t = 0) {
|
|
2950
2951
|
const i = () => {
|
|
2951
2952
|
const n = r.getBoundingClientRect(), s = e.getBoundingClientRect();
|
|
2952
2953
|
if (n.height <= 0) return;
|
|
@@ -2965,7 +2966,7 @@ function yn(r, e, t = 0) {
|
|
|
2965
2966
|
};
|
|
2966
2967
|
i(), typeof requestAnimationFrame == "function" && requestAnimationFrame(i);
|
|
2967
2968
|
}
|
|
2968
|
-
function
|
|
2969
|
+
function sa(r, e) {
|
|
2969
2970
|
const t = e.trim().toLowerCase();
|
|
2970
2971
|
r.querySelectorAll(".vui-lrow-wrap").forEach((i) => {
|
|
2971
2972
|
var o, l;
|
|
@@ -2975,7 +2976,7 @@ function na(r, e) {
|
|
|
2975
2976
|
i.style.display = a ? "" : "none";
|
|
2976
2977
|
});
|
|
2977
2978
|
}
|
|
2978
|
-
function
|
|
2979
|
+
function aa(r, e) {
|
|
2979
2980
|
if (r.querySelectorAll(".vui-lrow-block.active, .vui-lrow-insert.active").forEach((o) => {
|
|
2980
2981
|
o.classList.remove("active");
|
|
2981
2982
|
}), !e) return;
|
|
@@ -2988,27 +2989,27 @@ function ra(r, e) {
|
|
|
2988
2989
|
);
|
|
2989
2990
|
a && a.classList.add("active");
|
|
2990
2991
|
}
|
|
2991
|
-
function
|
|
2992
|
+
function oa(r, e, t, i = Vt) {
|
|
2992
2993
|
var l;
|
|
2993
2994
|
const n = new Map(e.map((d) => [d.index, d]));
|
|
2994
2995
|
r.querySelectorAll(".vui-lrow[data-layer-index]:not(.vui-lrow-all)").forEach((d) => {
|
|
2995
2996
|
const c = n.get(Number(d.dataset.layerIndex));
|
|
2996
2997
|
if (!c) return;
|
|
2997
2998
|
const p = d.querySelector(".vui-lrow-eye");
|
|
2998
|
-
p && (p.textContent = c.visible ? "●" : "○", p.title = c.visible ? i.t("layer.hide") : i.t("layer.show")), d.classList.toggle("off", !c.visible),
|
|
2999
|
+
p && (p.textContent = c.visible ? "●" : "○", p.title = c.visible ? i.t("layer.hide") : i.t("layer.show")), d.classList.toggle("off", !c.visible), Cn(d, Bt(c));
|
|
2999
3000
|
});
|
|
3000
|
-
const s = r.querySelector(".vui-lrow-all"), a = t === null ? "#c8c8c8" :
|
|
3001
|
+
const s = r.querySelector(".vui-lrow-all"), a = t === null ? "#c8c8c8" : Re(t);
|
|
3001
3002
|
(l = s == null ? void 0 : s.querySelector(".vui-lrow-clr")) == null || l.style.setProperty("background", a);
|
|
3002
3003
|
const o = s == null ? void 0 : s.querySelector('input[type="color"]');
|
|
3003
3004
|
o && o.value !== a && (o.value = a);
|
|
3004
3005
|
}
|
|
3005
|
-
function
|
|
3006
|
+
function la(r, e, t) {
|
|
3006
3007
|
var f;
|
|
3007
3008
|
const i = t.text ?? Vt;
|
|
3008
3009
|
e.resetForScope(t.scopeKey);
|
|
3009
|
-
const n = e.filterText.trim().toLowerCase(), s = t.layers.rows, a =
|
|
3010
|
+
const n = e.filterText.trim().toLowerCase(), s = t.layers.rows, a = ia(t.blocks);
|
|
3010
3011
|
if (r.list.replaceChildren(), r.count.textContent = String(s.length), s.length === 0) {
|
|
3011
|
-
r.list.appendChild(
|
|
3012
|
+
r.list.appendChild(ca(i.t("layer.empty")));
|
|
3012
3013
|
return;
|
|
3013
3014
|
}
|
|
3014
3015
|
const o = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set();
|
|
@@ -3036,8 +3037,8 @@ function aa(r, e, t) {
|
|
|
3036
3037
|
try {
|
|
3037
3038
|
if (t.setAllLayerColor) t.setAllLayerColor(y);
|
|
3038
3039
|
else for (const C of s) t.setLayerColor(C.index, y);
|
|
3039
|
-
const x = y === null ? "#c8c8c8" :
|
|
3040
|
-
(g = h.closest(".vui-lrow-clr")) == null || g.style.setProperty("background", x),
|
|
3040
|
+
const x = y === null ? "#c8c8c8" : Re(y);
|
|
3041
|
+
(g = h.closest(".vui-lrow-clr")) == null || g.style.setProperty("background", x), pi(r.list, s, y);
|
|
3041
3042
|
} finally {
|
|
3042
3043
|
(w = t.endLayerColorPreview) == null || w.call(t, h);
|
|
3043
3044
|
}
|
|
@@ -3047,21 +3048,21 @@ function aa(r, e, t) {
|
|
|
3047
3048
|
var y;
|
|
3048
3049
|
if (b.preventDefault(), b.stopPropagation(), t.setAllLayerColor) t.setAllLayerColor(null);
|
|
3049
3050
|
else for (const v of s) t.setLayerColor(v.index, null);
|
|
3050
|
-
(y = h == null ? void 0 : h.closest(".vui-lrow-clr")) == null || y.style.setProperty("background", "#c8c8c8"), h && (h.value = "#c8c8c8"),
|
|
3051
|
+
(y = h == null ? void 0 : h.closest(".vui-lrow-clr")) == null || y.style.setProperty("background", "#c8c8c8"), h && (h.value = "#c8c8c8"), pi(r.list, s, null);
|
|
3051
3052
|
}), r.list.appendChild(p);
|
|
3052
3053
|
for (const b of s)
|
|
3053
|
-
|
|
3054
|
-
c && e.needsSelectionReveal(c) && (
|
|
3055
|
-
e.needsSelectionReveal(c) &&
|
|
3054
|
+
na(n, b.name) && r.list.appendChild(da(b, e, t, a.get(b.index) ?? [], i));
|
|
3055
|
+
c && e.needsSelectionReveal(c) && (hi(r.list) && e.markSelectionRevealed(c), typeof requestAnimationFrame == "function" && requestAnimationFrame(() => {
|
|
3056
|
+
e.needsSelectionReveal(c) && hi(r.list) && e.markSelectionRevealed(c);
|
|
3056
3057
|
}));
|
|
3057
3058
|
}
|
|
3058
|
-
function
|
|
3059
|
+
function Re(r) {
|
|
3059
3060
|
return `#${r.toString(16).padStart(6, "0")}`;
|
|
3060
3061
|
}
|
|
3061
3062
|
function Bt(r) {
|
|
3062
|
-
return r.color !== null ?
|
|
3063
|
+
return r.color !== null ? Re(r.color) : Re(gn(r.sourceColor));
|
|
3063
3064
|
}
|
|
3064
|
-
function
|
|
3065
|
+
function Cn(r, e) {
|
|
3065
3066
|
var n;
|
|
3066
3067
|
(n = r.querySelector(".vui-lrow-dot")) == null || n.style.setProperty("background", e);
|
|
3067
3068
|
const t = r.querySelector(".vui-lrow-clr");
|
|
@@ -3069,14 +3070,14 @@ function xn(r, e) {
|
|
|
3069
3070
|
const i = r.querySelector('input[type="color"]');
|
|
3070
3071
|
i && i.value !== e && (i.value = e);
|
|
3071
3072
|
}
|
|
3072
|
-
function
|
|
3073
|
+
function pi(r, e, t) {
|
|
3073
3074
|
const i = new Map(e.map((n) => [n.index, n]));
|
|
3074
3075
|
r.querySelectorAll(".vui-lrow[data-layer-index]").forEach((n) => {
|
|
3075
3076
|
const s = i.get(Number(n.dataset.layerIndex));
|
|
3076
|
-
s &&
|
|
3077
|
+
s && Cn(n, t === null ? Bt(s) : Re(t));
|
|
3077
3078
|
});
|
|
3078
3079
|
}
|
|
3079
|
-
function
|
|
3080
|
+
function da(r, e, t, i, n) {
|
|
3080
3081
|
const s = i.length > 0, a = e.expandedLayers.has(r.index), o = Bt(r), l = document.createElement("div");
|
|
3081
3082
|
l.className = "vui-lrow-wrap";
|
|
3082
3083
|
const d = document.createElement("div");
|
|
@@ -3103,13 +3104,13 @@ function oa(r, e, t, i, n) {
|
|
|
3103
3104
|
else {
|
|
3104
3105
|
w = document.createElement("div"), w.className = "vui-lrow-blocks open";
|
|
3105
3106
|
for (const x of i)
|
|
3106
|
-
w.appendChild(
|
|
3107
|
+
w.appendChild(mi(x, e, t, n));
|
|
3107
3108
|
l.appendChild(w);
|
|
3108
3109
|
}
|
|
3109
3110
|
else {
|
|
3110
3111
|
w == null || w.classList.remove("open");
|
|
3111
3112
|
const x = l.closest(".vui-section-list") ?? l.parentElement;
|
|
3112
|
-
x &&
|
|
3113
|
+
x && wn(x, d, 0);
|
|
3113
3114
|
}
|
|
3114
3115
|
};
|
|
3115
3116
|
h.addEventListener("click", m);
|
|
@@ -3129,7 +3130,7 @@ function oa(r, e, t, i, n) {
|
|
|
3129
3130
|
}
|
|
3130
3131
|
}), y.addEventListener("click", (v) => v.stopPropagation()), b.addEventListener("contextmenu", (v) => {
|
|
3131
3132
|
v.preventDefault(), v.stopPropagation(), t.setLayerColor(r.index, null);
|
|
3132
|
-
const g =
|
|
3133
|
+
const g = Re(gn(r.sourceColor));
|
|
3133
3134
|
y.value = g, p.style.background = g, b.style.background = g;
|
|
3134
3135
|
}), b.appendChild(y), d.append(c, p, h, f, b), d.addEventListener("click", (v) => {
|
|
3135
3136
|
const g = v.target;
|
|
@@ -3140,15 +3141,15 @@ function oa(r, e, t, i, n) {
|
|
|
3140
3141
|
const v = document.createElement("div");
|
|
3141
3142
|
v.className = "vui-lrow-blocks open";
|
|
3142
3143
|
for (const g of i)
|
|
3143
|
-
v.appendChild(
|
|
3144
|
+
v.appendChild(mi(g, e, t, n));
|
|
3144
3145
|
l.appendChild(v);
|
|
3145
3146
|
}
|
|
3146
3147
|
return l;
|
|
3147
3148
|
}
|
|
3148
|
-
function
|
|
3149
|
+
function mi(r, e, t, i) {
|
|
3149
3150
|
const n = document.createElement("div");
|
|
3150
3151
|
n.className = "vui-lrow-block-wrap";
|
|
3151
|
-
const s = e.expandedBlocks.has(r.key), a =
|
|
3152
|
+
const s = e.expandedBlocks.has(r.key), a = ra(r.inserts), o = xn(t.selection, r.layerIndex, r.variantId), l = document.createElement("div");
|
|
3152
3153
|
l.className = `vui-lrow-block${o ? " active" : ""}${r.canHighlight ? "" : " disabled"}`, l.dataset.variantId = String(r.variantId), l.dataset.layerIndex = String(r.layerIndex), r.canHighlight || (l.title = i.t("layer.noHighlightBlock"));
|
|
3153
3154
|
const d = document.createElement("button");
|
|
3154
3155
|
d.type = "button", d.className = "vui-lrow-block-visibility", et(d, a, i), d.addEventListener("click", (f) => {
|
|
@@ -3186,11 +3187,11 @@ function pi(r, e, t, i) {
|
|
|
3186
3187
|
c.textContent = b ? "▼" : "▶";
|
|
3187
3188
|
let y = n.querySelector(":scope > .vui-lrow-inserts");
|
|
3188
3189
|
if (b)
|
|
3189
|
-
y ? y.classList.add("open") : (y =
|
|
3190
|
+
y ? y.classList.add("open") : (y = fi(r, e, t, d, i), n.appendChild(y));
|
|
3190
3191
|
else {
|
|
3191
3192
|
y == null || y.classList.remove("open");
|
|
3192
3193
|
const v = n.closest(".vui-section-list") ?? n.parentElement;
|
|
3193
|
-
v &&
|
|
3194
|
+
v && wn(v, l, 24);
|
|
3194
3195
|
}
|
|
3195
3196
|
};
|
|
3196
3197
|
c.addEventListener("click", p);
|
|
@@ -3201,14 +3202,14 @@ function pi(r, e, t, i) {
|
|
|
3201
3202
|
if (!r.canHighlight) return;
|
|
3202
3203
|
const f = r.inserts[0], b = `${r.layerIndex}:${r.variantId}:${f.instanceId}`;
|
|
3203
3204
|
e.markSelectionRevealed(b), t.selectInsert(f.insertId);
|
|
3204
|
-
}), n.appendChild(l), s && n.appendChild(
|
|
3205
|
+
}), n.appendChild(l), s && n.appendChild(fi(r, e, t, d, i)), n;
|
|
3205
3206
|
}
|
|
3206
|
-
function
|
|
3207
|
+
function fi(r, e, t, i, n) {
|
|
3207
3208
|
const s = document.createElement("div");
|
|
3208
3209
|
s.className = "vui-lrow-inserts open";
|
|
3209
3210
|
for (const a of r.inserts) {
|
|
3210
3211
|
const o = document.createElement("div");
|
|
3211
|
-
o.className = `vui-lrow-insert${
|
|
3212
|
+
o.className = `vui-lrow-insert${xn(t.selection, r.layerIndex, r.variantId, a.instanceId) ? " active" : ""}${a.canHighlight === !1 ? " disabled" : ""}`, o.dataset.layerIndex = String(r.layerIndex), o.dataset.variantId = String(r.variantId), o.dataset.instanceId = String(a.instanceId), o.dataset.insertId = a.insertId, a.canHighlight === !1 && (o.title = n.t("layer.noHighlightInsert"));
|
|
3212
3213
|
const l = document.createElement("button");
|
|
3213
3214
|
l.type = "button", l.className = "vui-lrow-insert-visibility", rt(l, a.visible, n), l.addEventListener("click", (c) => {
|
|
3214
3215
|
c.stopPropagation();
|
|
@@ -3231,49 +3232,49 @@ function mi(r, e, t, i, n) {
|
|
|
3231
3232
|
}
|
|
3232
3233
|
return s;
|
|
3233
3234
|
}
|
|
3234
|
-
function
|
|
3235
|
+
function ca(r) {
|
|
3235
3236
|
const e = document.createElement("div");
|
|
3236
3237
|
return e.className = "vui-empty-note", e.textContent = r, e;
|
|
3237
3238
|
}
|
|
3238
|
-
function
|
|
3239
|
+
function ua(r, e) {
|
|
3239
3240
|
const t = () => {
|
|
3240
3241
|
e(r.value);
|
|
3241
3242
|
};
|
|
3242
3243
|
return r.addEventListener("input", t), () => r.removeEventListener("input", t);
|
|
3243
3244
|
}
|
|
3244
|
-
function
|
|
3245
|
+
function vi(r, e, t = Vt, i = "mm") {
|
|
3245
3246
|
if (r.body.replaceChildren(), e.textSelection && e.textDetails) {
|
|
3246
|
-
Ce(r, !1),
|
|
3247
|
+
Ce(r, !1), pa(r.body, e.textDetails, t, i), gi(r.body);
|
|
3247
3248
|
return;
|
|
3248
3249
|
}
|
|
3249
3250
|
if (!e.selection || !e.details) {
|
|
3250
|
-
Ce(r, !1), r.body.appendChild(
|
|
3251
|
+
Ce(r, !1), r.body.appendChild(ma(t.t("property.empty")));
|
|
3251
3252
|
return;
|
|
3252
3253
|
}
|
|
3253
|
-
|
|
3254
|
+
ha(r.body, e.details, t, i), gi(r.body);
|
|
3254
3255
|
}
|
|
3255
3256
|
function Ce(r, e) {
|
|
3256
3257
|
if (!r.previewWrap || !r.previewCanvas || (r.previewWrap.hidden = !e, e)) return;
|
|
3257
3258
|
const t = r.previewCanvas.getContext("2d");
|
|
3258
3259
|
t == null || t.clearRect(0, 0, r.previewCanvas.width, r.previewCanvas.height);
|
|
3259
3260
|
}
|
|
3260
|
-
function
|
|
3261
|
-
|
|
3261
|
+
function ha(r, e, t, i) {
|
|
3262
|
+
En(r, t.t("property.insert"), e.blockName), Rt(r, t.t("property.basic"), (n) => {
|
|
3262
3263
|
q(n, t.t("property.block"), e.blockName), q(n, t.t("property.layer"), e.layerName), q(n, t.t("property.instance"), `#${e.id.instanceId}`), q(n, t.t("property.currentShape"), t.t("property.normalShape"));
|
|
3263
|
-
}),
|
|
3264
|
+
}), Rt(r, t.t("property.transform"), (n) => {
|
|
3264
3265
|
q(n, "X", t.formatUnit(e.tx, i)), q(n, "Y", t.formatUnit(e.ty, i)), q(n, t.t("property.rotation"), t.formatUnit(e.rotation, "°")), q(n, "Sx", t.formatNumber(e.scaleX)), q(n, "Sy", t.formatNumber(e.scaleY));
|
|
3265
3266
|
});
|
|
3266
3267
|
}
|
|
3267
|
-
function
|
|
3268
|
-
|
|
3268
|
+
function pa(r, e, t, i) {
|
|
3269
|
+
En(r, t.t("property.text"), e.content), Rt(r, t.t("property.basic"), (n) => {
|
|
3269
3270
|
q(n, t.t("property.layer"), e.layerName), q(n, t.t("property.content"), e.content), q(n, t.t("property.height"), t.formatUnit(e.height, i)), q(n, "X", t.formatUnit(e.x, i)), q(n, "Y", t.formatUnit(e.y, i)), q(n, t.t("property.rotation"), t.formatUnit(e.rotation, "°"));
|
|
3270
3271
|
});
|
|
3271
3272
|
}
|
|
3272
|
-
function
|
|
3273
|
+
function En(r, e, t) {
|
|
3273
3274
|
const i = document.createElement("div");
|
|
3274
3275
|
i.className = "vui-pp-section vui-pp-title-row", i.innerHTML = `<strong>${H(e)}</strong><span>·</span><span>${H(t)}</span>`, r.appendChild(i);
|
|
3275
3276
|
}
|
|
3276
|
-
function
|
|
3277
|
+
function Rt(r, e, t) {
|
|
3277
3278
|
const i = document.createElement("section");
|
|
3278
3279
|
i.className = "vui-pp-section";
|
|
3279
3280
|
const n = document.createElement("div");
|
|
@@ -3283,11 +3284,11 @@ function q(r, e, t) {
|
|
|
3283
3284
|
const i = document.createElement("div");
|
|
3284
3285
|
i.className = "vui-pp-row", i.innerHTML = `<span class="label">${H(e)}</span><span class="value" title="${H(t)}">${H(t)}</span>`, r.appendChild(i);
|
|
3285
3286
|
}
|
|
3286
|
-
function
|
|
3287
|
+
function ma(r) {
|
|
3287
3288
|
const e = document.createElement("div");
|
|
3288
3289
|
return e.className = "vui-empty-note", e.textContent = r, e;
|
|
3289
3290
|
}
|
|
3290
|
-
function
|
|
3291
|
+
function gi(r) {
|
|
3291
3292
|
if (r.querySelector('input:not([type="color"])'))
|
|
3292
3293
|
throw new Error("Property panel must not contain editable inputs");
|
|
3293
3294
|
if (r.querySelector('[contenteditable=""], [contenteditable="true"]'))
|
|
@@ -3295,17 +3296,17 @@ function vi(r) {
|
|
|
3295
3296
|
if (r.querySelector("textarea"))
|
|
3296
3297
|
throw new Error("Property panel must not contain textarea elements");
|
|
3297
3298
|
}
|
|
3298
|
-
const
|
|
3299
|
+
const fa = typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(globalThis) : (r) => globalThis.setTimeout(() => r(performance.now()), 16), va = typeof cancelAnimationFrame == "function" ? cancelAnimationFrame.bind(globalThis) : (r) => {
|
|
3299
3300
|
globalThis.clearTimeout(r);
|
|
3300
3301
|
};
|
|
3301
|
-
class
|
|
3302
|
+
class ga {
|
|
3302
3303
|
constructor(e) {
|
|
3303
3304
|
u(this, "onFlush");
|
|
3304
3305
|
u(this, "requestFrame");
|
|
3305
3306
|
u(this, "cancelFrame");
|
|
3306
3307
|
u(this, "pending", /* @__PURE__ */ new Map());
|
|
3307
3308
|
u(this, "scheduledHandle", null);
|
|
3308
|
-
this.onFlush = e.onFlush, this.requestFrame = e.requestFrame ??
|
|
3309
|
+
this.onFlush = e.onFlush, this.requestFrame = e.requestFrame ?? fa, this.cancelFrame = e.cancelFrame ?? va;
|
|
3309
3310
|
}
|
|
3310
3311
|
enqueue(e, t) {
|
|
3311
3312
|
this.pending.set(e, t), this.scheduledHandle === null && (this.scheduledHandle = this.requestFrame(() => {
|
|
@@ -3329,7 +3330,7 @@ class fa {
|
|
|
3329
3330
|
this.pending.clear(), this.scheduledHandle !== null && (this.cancelFrame(this.scheduledHandle), this.scheduledHandle = null);
|
|
3330
3331
|
}
|
|
3331
3332
|
}
|
|
3332
|
-
const
|
|
3333
|
+
const ba = `
|
|
3333
3334
|
:host {
|
|
3334
3335
|
display: block;
|
|
3335
3336
|
width: 100%;
|
|
@@ -4199,7 +4200,7 @@ button, input { font: inherit; }
|
|
|
4199
4200
|
.vui-infobar-content { max-width: calc(100vw - 48px); }
|
|
4200
4201
|
.vui-infobar-tools .vui-info-text { max-width: min(180px, 45vw); }
|
|
4201
4202
|
}
|
|
4202
|
-
`,
|
|
4203
|
+
`, ya = {
|
|
4203
4204
|
dark: `
|
|
4204
4205
|
:host, .vui-root[data-theme="dark"] {
|
|
4205
4206
|
--vui-bg: #0A0B0F;
|
|
@@ -4320,13 +4321,13 @@ function pt(r = "dark", e = {}) {
|
|
|
4320
4321
|
hudBackground: "--vui-hud-bg"
|
|
4321
4322
|
}, i = Object.entries(e).filter(([, n]) => typeof n == "string" && n.trim().length > 0).map(([n, s]) => `${t[n]}: ${s};`).join(`
|
|
4322
4323
|
`);
|
|
4323
|
-
return `${
|
|
4324
|
+
return `${ya[r]}${i ? `
|
|
4324
4325
|
:host, .vui-root[data-theme="${r}"] {
|
|
4325
4326
|
${i}
|
|
4326
4327
|
}
|
|
4327
|
-
` : ""}${
|
|
4328
|
+
` : ""}${ba}`;
|
|
4328
4329
|
}
|
|
4329
|
-
const
|
|
4330
|
+
const xa = {
|
|
4330
4331
|
layerPanel: !0,
|
|
4331
4332
|
propertyPanel: !0,
|
|
4332
4333
|
hud: !0,
|
|
@@ -4336,8 +4337,8 @@ const ba = {
|
|
|
4336
4337
|
infobarLineMode: !0,
|
|
4337
4338
|
infobarPhase: !0,
|
|
4338
4339
|
infobarDebug: !0
|
|
4339
|
-
},
|
|
4340
|
-
let
|
|
4340
|
+
}, bi = "property-panel:open", yi = "layer-panel:open", xi = 300, wi = 180, wa = 2;
|
|
4341
|
+
let Ca = 0;
|
|
4341
4342
|
function be(r, ...e) {
|
|
4342
4343
|
const t = document.createElement("div");
|
|
4343
4344
|
t.className = "vui-debug-row";
|
|
@@ -4346,7 +4347,7 @@ function be(r, ...e) {
|
|
|
4346
4347
|
const n = document.createElement("div");
|
|
4347
4348
|
return n.className = "vui-debug-value", n.append(...e), t.append(i, n), t;
|
|
4348
4349
|
}
|
|
4349
|
-
function
|
|
4350
|
+
function Ci(r, e, t) {
|
|
4350
4351
|
const i = document.createElement("div");
|
|
4351
4352
|
i.className = "vui-debug-spread";
|
|
4352
4353
|
const n = document.createElement("b");
|
|
@@ -4358,11 +4359,11 @@ function wi(r, e, t) {
|
|
|
4358
4359
|
}
|
|
4359
4360
|
return i;
|
|
4360
4361
|
}
|
|
4361
|
-
function
|
|
4362
|
+
function Ei(r) {
|
|
4362
4363
|
const e = document.createElement("div");
|
|
4363
4364
|
return e.className = "vui-debug-spread-list", e.append(...r), e;
|
|
4364
4365
|
}
|
|
4365
|
-
function
|
|
4366
|
+
function Ea(r, e) {
|
|
4366
4367
|
switch (r) {
|
|
4367
4368
|
case "created":
|
|
4368
4369
|
return e.t("status.created");
|
|
@@ -4380,7 +4381,7 @@ function wa(r, e) {
|
|
|
4380
4381
|
return "";
|
|
4381
4382
|
}
|
|
4382
4383
|
}
|
|
4383
|
-
function
|
|
4384
|
+
function ki(r) {
|
|
4384
4385
|
return (typeof r.composedPath == "function" ? r.composedPath() : [r.target]).some((t) => {
|
|
4385
4386
|
var a, o;
|
|
4386
4387
|
if (!t || typeof t != "object") return !1;
|
|
@@ -4390,11 +4391,11 @@ function Ei(r) {
|
|
|
4390
4391
|
return s === "" || s === "true" || s === "plaintext-only";
|
|
4391
4392
|
});
|
|
4392
4393
|
}
|
|
4393
|
-
class
|
|
4394
|
+
class ka {
|
|
4394
4395
|
constructor(e, t) {
|
|
4395
4396
|
u(this, "parts");
|
|
4396
4397
|
u(this, "text");
|
|
4397
|
-
u(this, "layerPanelState", new
|
|
4398
|
+
u(this, "layerPanelState", new Gs());
|
|
4398
4399
|
u(this, "shadow", null);
|
|
4399
4400
|
u(this, "layerPanelRefs", null);
|
|
4400
4401
|
u(this, "propertyPanelRefs", null);
|
|
@@ -4426,32 +4427,32 @@ class Ca {
|
|
|
4426
4427
|
u(this, "activeLayerColorPreview", null);
|
|
4427
4428
|
u(this, "renderedLayerRows", null);
|
|
4428
4429
|
u(this, "handleKeyDown", (e) => {
|
|
4429
|
-
if (this.disposed || e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey ||
|
|
4430
|
+
if (this.disposed || e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey || ki(e)) return;
|
|
4430
4431
|
const t = this.getFitShortcut();
|
|
4431
4432
|
t && e.key.toLowerCase() === t.toLowerCase() && this.host.fitSelectionOrDocument();
|
|
4432
4433
|
});
|
|
4433
4434
|
u(this, "handleKeyboardTargetPointerDown", (e) => {
|
|
4434
4435
|
var t, i;
|
|
4435
|
-
this.disposed ||
|
|
4436
|
+
this.disposed || ki(e) || (i = (t = this.keyboardTarget) == null ? void 0 : t.focus) == null || i.call(t, { preventScroll: !0 });
|
|
4436
4437
|
});
|
|
4437
4438
|
u(this, "unsubscribers", []);
|
|
4438
4439
|
u(this, "filterCleanup", null);
|
|
4439
4440
|
u(this, "disposed", !1);
|
|
4440
4441
|
u(this, "persistenceNamespace");
|
|
4441
|
-
u(this, "insertToggleScheduler", new
|
|
4442
|
+
u(this, "insertToggleScheduler", new ga({
|
|
4442
4443
|
onFlush: (e) => {
|
|
4443
4444
|
this.host.cad.blocks.batchToggleInserts(e);
|
|
4444
4445
|
}
|
|
4445
4446
|
}));
|
|
4446
4447
|
u(this, "refresh", () => {
|
|
4447
|
-
this.disposed || !this.active || (this.syncToolbarState(), this.renderLayerPanel(), this.propertyPanelRefs && this.parts.propertyPanel && (
|
|
4448
|
+
this.disposed || !this.active || (this.syncToolbarState(), this.renderLayerPanel(), this.propertyPanelRefs && this.parts.propertyPanel && (vi(this.propertyPanelRefs, this.host.cad.inspector, this.text, this.getCadUnit()), this.syncPropertyPanelSelectionState(), this.syncPropertyPanelPreview()), this.syncHud());
|
|
4448
4449
|
});
|
|
4449
4450
|
u(this, "syncHud", () => {
|
|
4450
4451
|
var e;
|
|
4451
4452
|
if (!(this.disposed || !this.active)) {
|
|
4452
4453
|
if (this.infobarRefs && this.parts.hud) {
|
|
4453
4454
|
const t = this.host.cad.hud;
|
|
4454
|
-
this.infobarRefs.file.textContent = t.filename ?? "", this.infobarRefs.file.title = t.filename ?? "", this.infobarRefs.file.hidden = !t.filename, this.infobarRefs.zoom.textContent = t.zoomLabel ? this.text.t("toolbar.zoom", { value: t.zoomLabel }) : "", this.infobarRefs.zoom.hidden = !t.zoomLabel, this.infobarRefs.vertices.textContent = t.viewportVertexCount > 0 ? this.text.t("toolbar.vertices", { value: this.text.formatInteger(t.viewportVertexCount) }) : "", this.infobarRefs.vertices.hidden = t.viewportVertexCount <= 0, this.infobarRefs.drawCalls.textContent = t.drawCalls > 0 ? this.text.t("toolbar.drawCalls", { value: this.text.formatInteger(t.drawCalls) }) : "", this.infobarRefs.drawCalls.hidden = t.drawCalls <= 0, this.infobarRefs.lineMode.textContent = this.parts.infobarLineMode && t.lineRenderMode ? this.text.t("toolbar.lineMode", { value: t.lineRenderMode.toUpperCase() }) : "", this.infobarRefs.lineMode.hidden = !this.infobarRefs.lineMode.textContent, this.infobarRefs.phase.textContent = this.parts.infobarPhase ?
|
|
4455
|
+
this.infobarRefs.file.textContent = t.filename ?? "", this.infobarRefs.file.title = t.filename ?? "", this.infobarRefs.file.hidden = !t.filename, this.infobarRefs.zoom.textContent = t.zoomLabel ? this.text.t("toolbar.zoom", { value: t.zoomLabel }) : "", this.infobarRefs.zoom.hidden = !t.zoomLabel, this.infobarRefs.vertices.textContent = t.viewportVertexCount > 0 ? this.text.t("toolbar.vertices", { value: this.text.formatInteger(t.viewportVertexCount) }) : "", this.infobarRefs.vertices.hidden = t.viewportVertexCount <= 0, this.infobarRefs.drawCalls.textContent = t.drawCalls > 0 ? this.text.t("toolbar.drawCalls", { value: this.text.formatInteger(t.drawCalls) }) : "", this.infobarRefs.drawCalls.hidden = t.drawCalls <= 0, this.infobarRefs.lineMode.textContent = this.parts.infobarLineMode && t.lineRenderMode ? this.text.t("toolbar.lineMode", { value: t.lineRenderMode.toUpperCase() }) : "", this.infobarRefs.lineMode.hidden = !this.infobarRefs.lineMode.textContent, this.infobarRefs.phase.textContent = this.parts.infobarPhase ? Ea(t.phase, this.text) : "", this.infobarRefs.phase.hidden = !this.infobarRefs.phase.textContent;
|
|
4455
4456
|
const i = Math.round(t.fps);
|
|
4456
4457
|
this.infobarRefs.fps.textContent = i > 0 ? this.text.t("toolbar.fps", { value: i }) : this.text.t("toolbar.fpsEmpty"), this.infobarRefs.fps.classList.toggle("hi", i >= 55), this.infobarRefs.fps.classList.toggle("mid", i >= 30 && i < 55), this.infobarRefs.fps.classList.toggle("low", i < 30);
|
|
4457
4458
|
const n = t.blockVariantCount > 0 || t.splitBlockLayerGroupCount > 0 || t.entityCount > 0;
|
|
@@ -4462,7 +4463,7 @@ class Ca {
|
|
|
4462
4463
|
blocks: this.text.formatInteger(t.blockVariantCount),
|
|
4463
4464
|
split: this.text.formatInteger(t.splitBlockLayerGroupCount)
|
|
4464
4465
|
});
|
|
4465
|
-
const s = t.renderDebugBreakdown.map((d) =>
|
|
4466
|
+
const s = t.renderDebugBreakdown.map((d) => Ci(
|
|
4466
4467
|
d.label,
|
|
4467
4468
|
this.text.t("toolbar.debug.breakdown", {
|
|
4468
4469
|
renderables: this.text.formatInteger(d.renderables),
|
|
@@ -4474,8 +4475,8 @@ class Ca {
|
|
|
4474
4475
|
calls: this.text.formatInteger(t.drawCalls)
|
|
4475
4476
|
})
|
|
4476
4477
|
];
|
|
4477
|
-
s.length > 0 && a.push(
|
|
4478
|
-
const o = t.splitBlockLayerDetails.map((d) =>
|
|
4478
|
+
s.length > 0 && a.push(Ei(s));
|
|
4479
|
+
const o = t.splitBlockLayerDetails.map((d) => Ci(
|
|
4479
4480
|
`${d.blockName} #${d.variantId}`,
|
|
4480
4481
|
this.text.t("toolbar.debug.spreadMeta", {
|
|
4481
4482
|
layers: this.text.formatInteger(d.layerCount),
|
|
@@ -4492,7 +4493,7 @@ class Ca {
|
|
|
4492
4493
|
const l = [this.text.t("toolbar.debug.splitLayerCount", {
|
|
4493
4494
|
count: this.text.formatInteger(t.splitBlockLayerGroupCount)
|
|
4494
4495
|
})];
|
|
4495
|
-
o.length > 0 && l.push(
|
|
4496
|
+
o.length > 0 && l.push(Ei(o)), this.infobarRefs.debugBody.replaceChildren(
|
|
4496
4497
|
be("" + this.text.t("toolbar.debug.submitted"), this.text.formatInteger(t.submittedVertexRefs)),
|
|
4497
4498
|
...t.lineRenderMode ? [be(this.text.t("toolbar.debug.lineMode"), t.lineRenderMode.toUpperCase())] : [],
|
|
4498
4499
|
be(this.text.t("toolbar.debug.layers"), this.text.t("toolbar.debug.layerCount", {
|
|
@@ -4512,7 +4513,7 @@ class Ca {
|
|
|
4512
4513
|
const t = this.host.cad.hud, i = t.fileCount > 0 ? this.text.t("toolbar.layerSummary", {
|
|
4513
4514
|
visible: this.text.formatInteger(t.visibleLayerCount),
|
|
4514
4515
|
total: this.text.formatInteger(t.totalLayerCount)
|
|
4515
|
-
}) : "", n =
|
|
4516
|
+
}) : "", n = ta(t.statusMessage, this.text);
|
|
4516
4517
|
this.toolbarInfoText.textContent = i && n ? `${i} | ${n}` : i || n;
|
|
4517
4518
|
}
|
|
4518
4519
|
this.scalebarRefs && (this.host.viewMode === "2d" && ((e = this.host.cad.hud.scaleRuler) != null && e.visible) ? (this.scalebarRefs.scaleBar.hidden = !1, this.scalebarRefs.scaleLabel.textContent = this.text.formatScaleLabel(
|
|
@@ -4523,7 +4524,7 @@ class Ca {
|
|
|
4523
4524
|
}
|
|
4524
4525
|
});
|
|
4525
4526
|
var i, n, s, a;
|
|
4526
|
-
this.host = e, this.options = t, this.parts = { ...
|
|
4527
|
+
this.host = e, this.options = t, this.parts = { ...xa, ...(i = t.cad) == null ? void 0 : i.parts }, this.themeValue = t.theme ?? "dark", this.text = yn({ ...t, unitFormatter: (n = t.cad) == null ? void 0 : n.unitFormatter }), this.persistenceNamespace = ((a = (s = t.cad) == null ? void 0 : s.persistenceKey) == null ? void 0 : a.trim()) || t.root.id.trim() || `instance-${++Ca}`;
|
|
4527
4528
|
}
|
|
4528
4529
|
mount() {
|
|
4529
4530
|
var o, l;
|
|
@@ -4717,8 +4718,8 @@ class Ca {
|
|
|
4717
4718
|
return l.type = "button", l.className = "vui-property-panel-toggle", l.addEventListener("click", () => this.setPropertyPanelOpen(e.classList.contains("closed"))), o.appendChild(l), e.append(o, t), this.propertyPanelShell = e, this.propertyPanelToggle = l, this.propertyPanelRefs = { body: a, previewWrap: n, previewCanvas: s }, e;
|
|
4718
4719
|
}
|
|
4719
4720
|
bindEvents() {
|
|
4720
|
-
this.layerPanelRefs && (this.filterCleanup =
|
|
4721
|
-
this.layerPanelState.filterText = e, this.layerPanelRefs &&
|
|
4721
|
+
this.layerPanelRefs && (this.filterCleanup = ua(this.layerPanelRefs.filterInput, (e) => {
|
|
4722
|
+
this.layerPanelState.filterText = e, this.layerPanelRefs && sa(this.layerPanelRefs.list, e);
|
|
4722
4723
|
})), this.unsubscribers.push(
|
|
4723
4724
|
this.host.cad.on("document-change", () => this.refresh()),
|
|
4724
4725
|
this.host.cad.on("layer-change", () => this.syncLayerChange()),
|
|
@@ -4726,9 +4727,9 @@ class Ca {
|
|
|
4726
4727
|
this.host.cad.on("inspector-change", () => {
|
|
4727
4728
|
if (this.layerPanelRefs && this.parts.layerPanel) {
|
|
4728
4729
|
const e = this.host.cad.inspector.selection, t = e == null ? void 0 : e.id, i = t ? `${t.layerIndex}:${t.variantId}:${t.instanceId}` : null;
|
|
4729
|
-
i && this.layerPanelState.needsSelectionReveal(i) ? this.renderLayerPanel() :
|
|
4730
|
+
i && this.layerPanelState.needsSelectionReveal(i) ? this.renderLayerPanel() : aa(this.layerPanelRefs.list, e);
|
|
4730
4731
|
}
|
|
4731
|
-
this.propertyPanelRefs && this.parts.propertyPanel && (
|
|
4732
|
+
this.propertyPanelRefs && this.parts.propertyPanel && (vi(this.propertyPanelRefs, this.host.cad.inspector, this.text, this.getCadUnit()), this.syncPropertyPanelSelectionState(), this.syncPropertyPanelPreview());
|
|
4732
4733
|
}),
|
|
4733
4734
|
this.host.cad.on("hud-change", () => this.syncHud()),
|
|
4734
4735
|
this.host.on("view-mode-change", () => {
|
|
@@ -4787,7 +4788,7 @@ class Ca {
|
|
|
4787
4788
|
return !!(e && e.isConnected && ((t = this.layerPanelRefs) != null && t.list.contains(e)));
|
|
4788
4789
|
}
|
|
4789
4790
|
renderLayerPanel() {
|
|
4790
|
-
!this.layerPanelRefs || !this.parts.layerPanel || (
|
|
4791
|
+
!this.layerPanelRefs || !this.parts.layerPanel || (la(this.layerPanelRefs, this.layerPanelState, this.createLayerPanelActions()), this.renderedLayerRows = this.host.cad.layers.rows);
|
|
4791
4792
|
}
|
|
4792
4793
|
syncLayerChange() {
|
|
4793
4794
|
if (!this.isLayerColorPreviewActive()) {
|
|
@@ -4795,7 +4796,7 @@ class Ca {
|
|
|
4795
4796
|
this.refresh();
|
|
4796
4797
|
return;
|
|
4797
4798
|
}
|
|
4798
|
-
|
|
4799
|
+
oa(
|
|
4799
4800
|
this.layerPanelRefs.list,
|
|
4800
4801
|
this.host.cad.layers.rows,
|
|
4801
4802
|
this.host.cad.layers.allColor,
|
|
@@ -4817,7 +4818,7 @@ class Ca {
|
|
|
4817
4818
|
var e;
|
|
4818
4819
|
if (((e = this.options.cad) == null ? void 0 : e.persistence) === !1) return !1;
|
|
4819
4820
|
try {
|
|
4820
|
-
return this.readState(
|
|
4821
|
+
return this.readState(bi) === "1";
|
|
4821
4822
|
} catch {
|
|
4822
4823
|
return !1;
|
|
4823
4824
|
}
|
|
@@ -4826,7 +4827,7 @@ class Ca {
|
|
|
4826
4827
|
var e;
|
|
4827
4828
|
if (((e = this.options.cad) == null ? void 0 : e.persistence) === !1) return !0;
|
|
4828
4829
|
try {
|
|
4829
|
-
return this.readState(
|
|
4830
|
+
return this.readState(yi) !== "0";
|
|
4830
4831
|
} catch {
|
|
4831
4832
|
return !0;
|
|
4832
4833
|
}
|
|
@@ -4839,7 +4840,7 @@ class Ca {
|
|
|
4839
4840
|
panel: this.text.t("panel.layers")
|
|
4840
4841
|
})), !!t && (this.emitUiLayoutChange(), ((s = this.options.cad) == null ? void 0 : s.persistence) !== !1)))
|
|
4841
4842
|
try {
|
|
4842
|
-
this.writeState(
|
|
4843
|
+
this.writeState(yi, e ? "1" : "0");
|
|
4843
4844
|
} catch {
|
|
4844
4845
|
}
|
|
4845
4846
|
}
|
|
@@ -4855,7 +4856,7 @@ class Ca {
|
|
|
4855
4856
|
panel: this.text.t("panel.properties")
|
|
4856
4857
|
})), (s = i.querySelector(".vui-property-panel")) == null || s.setAttribute("aria-hidden", String(!e)), e ? this.syncPropertyPanelPreview(!0) : (this.cancelPropertyPreviewRender(), this.propertyPanelRefs && Ce(this.propertyPanelRefs, !1)), !!t && (this.emitUiLayoutChange(), ((a = this.options.cad) == null ? void 0 : a.persistence) !== !1)))
|
|
4857
4858
|
try {
|
|
4858
|
-
this.writeState(
|
|
4859
|
+
this.writeState(bi, e ? "1" : "0");
|
|
4859
4860
|
} catch {
|
|
4860
4861
|
}
|
|
4861
4862
|
}
|
|
@@ -4953,7 +4954,7 @@ class Ca {
|
|
|
4953
4954
|
return (t = this.propertyPanelShell) != null && t.classList.contains("closed") ? !0 : !this.isPropertyPreviewLayoutReady(e);
|
|
4954
4955
|
}
|
|
4955
4956
|
isPropertyPreviewLayoutReady(e) {
|
|
4956
|
-
return e.clientWidth >=
|
|
4957
|
+
return e.clientWidth >= wi && e.clientHeight >= wi;
|
|
4957
4958
|
}
|
|
4958
4959
|
waitForPropertyPreviewLayout(e) {
|
|
4959
4960
|
if (this.isPropertyPreviewLayoutReady(e)) return Promise.resolve();
|
|
@@ -4975,24 +4976,24 @@ class Ca {
|
|
|
4975
4976
|
return;
|
|
4976
4977
|
}
|
|
4977
4978
|
if (v === o) {
|
|
4978
|
-
a += 1, a >=
|
|
4979
|
+
a += 1, a >= wa && h();
|
|
4979
4980
|
return;
|
|
4980
4981
|
}
|
|
4981
4982
|
o = v, a = 0;
|
|
4982
4983
|
}, f = (v) => {
|
|
4983
|
-
if (!
|
|
4984
|
+
if (!Sa(v)) return;
|
|
4984
4985
|
let g = !1;
|
|
4985
4986
|
const w = (C) => {
|
|
4986
4987
|
C.target !== v || C.propertyName !== "width" || x();
|
|
4987
4988
|
}, x = () => {
|
|
4988
4989
|
g || (g = !0, v.removeEventListener("transitionend", w), requestAnimationFrame(m));
|
|
4989
4990
|
};
|
|
4990
|
-
v.addEventListener("transitionend", w), l.push(window.setTimeout(x,
|
|
4991
|
+
v.addEventListener("transitionend", w), l.push(window.setTimeout(x, xi)), d.push(() => {
|
|
4991
4992
|
g || (g = !0, v.removeEventListener("transitionend", w));
|
|
4992
4993
|
});
|
|
4993
4994
|
}, b = () => {
|
|
4994
4995
|
m(), s || (c = requestAnimationFrame(b));
|
|
4995
|
-
}, y = window.setTimeout(h,
|
|
4996
|
+
}, y = window.setTimeout(h, xi);
|
|
4996
4997
|
f(i), f(t), c = requestAnimationFrame(b), this.propertyPreviewLayoutWaitAbort = () => {
|
|
4997
4998
|
s = !0, p();
|
|
4998
4999
|
};
|
|
@@ -5010,7 +5011,7 @@ class Ca {
|
|
|
5010
5011
|
this.propertyPreviewRenderHandle !== null && (cancelAnimationFrame(this.propertyPreviewRenderHandle), this.propertyPreviewRenderHandle = null), (e = this.propertyPreviewLayoutWaitAbort) == null || e.call(this), this.propertyPreviewLayoutWaitAbort = null;
|
|
5011
5012
|
}
|
|
5012
5013
|
}
|
|
5013
|
-
function
|
|
5014
|
+
function Sa(r) {
|
|
5014
5015
|
const e = getComputedStyle(r), t = e.transitionDuration.split(",").map((n) => n.trim()), i = e.transitionProperty.split(",").map((n) => n.trim());
|
|
5015
5016
|
for (let n = 0; n < i.length; n += 1) {
|
|
5016
5017
|
const s = i[n] ?? i[0] ?? "all";
|
|
@@ -5019,8 +5020,8 @@ function Ea(r) {
|
|
|
5019
5020
|
}
|
|
5020
5021
|
return !1;
|
|
5021
5022
|
}
|
|
5022
|
-
const
|
|
5023
|
-
class
|
|
5023
|
+
const Pa = ["left", "right", "top", "bottom"], _e = 0.5, Ma = /* @__PURE__ */ new Set(["cad", "scene"]);
|
|
5024
|
+
class Ra {
|
|
5024
5025
|
constructor(e) {
|
|
5025
5026
|
u(this, "zoneContainers", /* @__PURE__ */ new Map());
|
|
5026
5027
|
u(this, "mounts", /* @__PURE__ */ new Set());
|
|
@@ -5030,7 +5031,7 @@ class Pa {
|
|
|
5030
5031
|
u(this, "flags", { layerPanelOpen: !1, propertyPanelOpen: !1 });
|
|
5031
5032
|
u(this, "lastInsets", Object.freeze({ top: 0, right: 0, bottom: 0, left: 0 }));
|
|
5032
5033
|
u(this, "lastFlags", { layerPanelOpen: !1, propertyPanelOpen: !1 });
|
|
5033
|
-
u(this, "activeGroups",
|
|
5034
|
+
u(this, "activeGroups", Ma);
|
|
5034
5035
|
u(this, "warnedUnstableReference", !1);
|
|
5035
5036
|
u(this, "disposed", !1);
|
|
5036
5037
|
u(this, "frameHandle", null);
|
|
@@ -5121,7 +5122,7 @@ class Pa {
|
|
|
5121
5122
|
installZoneStyles(e, t) {
|
|
5122
5123
|
if (!e || typeof e.querySelector != "function" || typeof e.prepend != "function" || e.querySelector(`style[data-viewer-layout="${t}"]`)) return;
|
|
5123
5124
|
const i = document.createElement("style");
|
|
5124
|
-
i.dataset.viewerLayout = t, i.textContent =
|
|
5125
|
+
i.dataset.viewerLayout = t, i.textContent = La, e.append(i), this.installedStyles.push(i), ne(e) && (e.dataset.viewerLayoutHost = "", typeof getComputedStyle == "function" && getComputedStyle(e).position === "static" && (e.style.position = "relative"));
|
|
5125
5126
|
}
|
|
5126
5127
|
schedule() {
|
|
5127
5128
|
if (!(this.disposed || this.frameHandle !== null)) {
|
|
@@ -5138,7 +5139,7 @@ class Pa {
|
|
|
5138
5139
|
if (this.disposed) return;
|
|
5139
5140
|
const e = this.host.reference(), t = this.host.target();
|
|
5140
5141
|
if (!e || typeof e.getBoundingClientRect != "function") return;
|
|
5141
|
-
const i = e.getBoundingClientRect(), n = this.computeInsets(i), s = !
|
|
5142
|
+
const i = e.getBoundingClientRect(), n = this.computeInsets(i), s = !Ia(n, this.lastInsets), a = this.flags.layerPanelOpen !== this.lastFlags.layerPanelOpen || this.flags.propertyPanelOpen !== this.lastFlags.propertyPanelOpen;
|
|
5142
5143
|
!s && !a || (this.lastInsets = n, this.lastFlags = { ...this.flags }, s && this.assertStableReference(e, t) && this.applyInsets(t, n), this.host.onChange(n, this.lastFlags));
|
|
5143
5144
|
}
|
|
5144
5145
|
applyInsets(e, t) {
|
|
@@ -5157,9 +5158,9 @@ class Pa {
|
|
|
5157
5158
|
}
|
|
5158
5159
|
for (const i of this.zoneContainers.values()) {
|
|
5159
5160
|
const n = i.dataset.viewerZone;
|
|
5160
|
-
if (!(!n || !
|
|
5161
|
+
if (!(!n || !Pa.includes(n) || !this.isZoneVisible(i)))
|
|
5161
5162
|
for (const s of Array.from(i.children)) {
|
|
5162
|
-
if (!
|
|
5163
|
+
if (!Aa(s)) continue;
|
|
5163
5164
|
const a = s.getBoundingClientRect();
|
|
5164
5165
|
this.accumulateInset(
|
|
5165
5166
|
t,
|
|
@@ -5170,10 +5171,10 @@ class Pa {
|
|
|
5170
5171
|
}
|
|
5171
5172
|
}
|
|
5172
5173
|
return Object.freeze({
|
|
5173
|
-
top:
|
|
5174
|
-
right:
|
|
5175
|
-
bottom:
|
|
5176
|
-
left:
|
|
5174
|
+
top: He(t.top, e.height),
|
|
5175
|
+
right: He(t.right, e.width),
|
|
5176
|
+
bottom: He(t.bottom, e.height),
|
|
5177
|
+
left: He(t.left, e.width)
|
|
5177
5178
|
});
|
|
5178
5179
|
}
|
|
5179
5180
|
accumulateInset(e, t, i, n) {
|
|
@@ -5198,20 +5199,20 @@ function mt(r, e, t) {
|
|
|
5198
5199
|
function ne(r) {
|
|
5199
5200
|
return !!(r && typeof r == "object" && r.nodeType === 1);
|
|
5200
5201
|
}
|
|
5201
|
-
function
|
|
5202
|
+
function Aa(r) {
|
|
5202
5203
|
if (!ne(r) || r.hidden) return !1;
|
|
5203
5204
|
const e = typeof getComputedStyle == "function" ? getComputedStyle(r) : null;
|
|
5204
5205
|
return !(e && (e.display === "none" || e.visibility === "hidden"));
|
|
5205
5206
|
}
|
|
5206
|
-
function
|
|
5207
|
+
function He(r, e) {
|
|
5207
5208
|
if (!Number.isFinite(r)) return 0;
|
|
5208
5209
|
const t = e > 0 ? Math.min(r, e) : r;
|
|
5209
5210
|
return Math.max(0, Math.round(t * 2) / 2);
|
|
5210
5211
|
}
|
|
5211
|
-
function
|
|
5212
|
-
return Math.abs(r.top - e.top) <=
|
|
5212
|
+
function Ia(r, e) {
|
|
5213
|
+
return Math.abs(r.top - e.top) <= _e && Math.abs(r.right - e.right) <= _e && Math.abs(r.bottom - e.bottom) <= _e && Math.abs(r.left - e.left) <= _e;
|
|
5213
5214
|
}
|
|
5214
|
-
const
|
|
5215
|
+
const La = `
|
|
5215
5216
|
[data-viewer-zone] { position: absolute; pointer-events: none; z-index: 1; }
|
|
5216
5217
|
[data-viewer-zone] > * { pointer-events: auto; }
|
|
5217
5218
|
[data-viewer-zone="left"] { left: 0; top: 0; bottom: 0; }
|
|
@@ -5220,7 +5221,7 @@ const Ra = `
|
|
|
5220
5221
|
[data-viewer-zone="bottom"] { left: 0; right: 0; bottom: 0; }
|
|
5221
5222
|
[data-viewer-zone="overlay"] { inset: 0; }
|
|
5222
5223
|
[data-viewer-zone][data-viewer-zone-active="false"] { display: none; }
|
|
5223
|
-
`,
|
|
5224
|
+
`, Da = {
|
|
5224
5225
|
play: '<path d="m8 5 11 7-11 7Z"/>',
|
|
5225
5226
|
pause: '<path d="M8 5v14M16 5v14"/>',
|
|
5226
5227
|
reset: '<path d="M3 10a9 9 0 1 1 2.5 8M3 4v6h6"/>',
|
|
@@ -5239,9 +5240,9 @@ const Ra = `
|
|
|
5239
5240
|
moon: '<path d="M20.5 13A9 9 0 0 1 11 3.5 9 9 0 1 0 20.5 13Z"/>'
|
|
5240
5241
|
};
|
|
5241
5242
|
function dt(r) {
|
|
5242
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${
|
|
5243
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${Da[r]}</svg>`;
|
|
5243
5244
|
}
|
|
5244
|
-
const
|
|
5245
|
+
const Ta = {
|
|
5245
5246
|
filename: !0,
|
|
5246
5247
|
playback: !0,
|
|
5247
5248
|
reset: !0,
|
|
@@ -5254,8 +5255,8 @@ const La = {
|
|
|
5254
5255
|
collision: !0,
|
|
5255
5256
|
theme: !0
|
|
5256
5257
|
};
|
|
5257
|
-
function
|
|
5258
|
-
const t = { ...
|
|
5258
|
+
function Na(r, e) {
|
|
5259
|
+
const t = { ...Ta, ...e.parts }, i = document.createElement("nav");
|
|
5259
5260
|
i.className = "vpu-toolbar", i.dataset.theme = e.theme ?? "dark", i.setAttribute("aria-label", e.label);
|
|
5260
5261
|
const n = document.createElement("span");
|
|
5261
5262
|
n.className = "vpu-filename", n.hidden = !0;
|
|
@@ -5297,12 +5298,12 @@ function Da(r, e) {
|
|
|
5297
5298
|
var V;
|
|
5298
5299
|
(V = e.environment) == null || V.openPicker(L);
|
|
5299
5300
|
});
|
|
5300
|
-
L.setAttribute("aria-haspopup", "dialog"), L.setAttribute("aria-controls", "vpu-environment-picker"),
|
|
5301
|
+
L.setAttribute("aria-haspopup", "dialog"), L.setAttribute("aria-controls", "vpu-environment-picker"), Si(L, ((U = e.environment) == null ? void 0 : U.isPickerOpen()) ?? !1);
|
|
5301
5302
|
}
|
|
5302
5303
|
if (v && m(g, "ground") && h("ground", "ground", "显示地面", "ground", () => {
|
|
5303
5304
|
const L = r.asset.$readControl().groundVisible;
|
|
5304
5305
|
r.commands.setGroundVisible(!L);
|
|
5305
|
-
}), v && m(g, "collision") && h("collision", "collision",
|
|
5306
|
+
}), v && m(g, "collision") && h("collision", "collision", Pi(!1), "collision", () => {
|
|
5306
5307
|
const L = r.asset.$readControl().collisionVisible;
|
|
5307
5308
|
r.commands.setCollisionVisible(!L);
|
|
5308
5309
|
}), v && m(g, "theme")) {
|
|
@@ -5318,13 +5319,13 @@ function Da(r, e) {
|
|
|
5318
5319
|
i.hidden = s.childElementCount === 0 && n.hidden, b(r.asset.$readControl());
|
|
5319
5320
|
}, b = (v) => {
|
|
5320
5321
|
const g = l ? a.get(l) : void 0;
|
|
5321
|
-
g && (
|
|
5322
|
+
g && (qe(g.button, v.playing ? d.pause : d.play, v.playing ? "pause" : "play", v.playing), g.icon = v.playing ? "pause" : "play");
|
|
5322
5323
|
const w = a.get("ground");
|
|
5323
|
-
w &&
|
|
5324
|
+
w && qe(w.button, v.groundVisible ? "隐藏地面" : "显示地面", "ground", v.groundVisible);
|
|
5324
5325
|
const x = a.get("collision");
|
|
5325
|
-
x &&
|
|
5326
|
+
x && qe(x.button, Pi(v.collisionVisible), "collision", v.collisionVisible);
|
|
5326
5327
|
const C = a.get("upAxis");
|
|
5327
|
-
C &&
|
|
5328
|
+
C && qe(C.button, ja(v.upAxis), Oa(v.upAxis), v.upAxis === "y");
|
|
5328
5329
|
};
|
|
5329
5330
|
return {
|
|
5330
5331
|
element: i,
|
|
@@ -5332,7 +5333,7 @@ function Da(r, e) {
|
|
|
5332
5333
|
pressedChanged: () => b(r.asset.$readControl()),
|
|
5333
5334
|
pickerChanged: (v) => {
|
|
5334
5335
|
const g = a.get("environment");
|
|
5335
|
-
g &&
|
|
5336
|
+
g && Si(g.button, v);
|
|
5336
5337
|
},
|
|
5337
5338
|
environmentAnchor: () => {
|
|
5338
5339
|
var v;
|
|
@@ -5346,22 +5347,22 @@ function Da(r, e) {
|
|
|
5346
5347
|
}
|
|
5347
5348
|
};
|
|
5348
5349
|
}
|
|
5349
|
-
function
|
|
5350
|
+
function Si(r, e) {
|
|
5350
5351
|
r.setAttribute("aria-expanded", String(e)), r.classList.toggle("is-active", e);
|
|
5351
5352
|
}
|
|
5352
|
-
function
|
|
5353
|
+
function qe(r, e, t, i) {
|
|
5353
5354
|
r.innerHTML = dt(t), r.title = e, r.setAttribute("aria-label", e), r.setAttribute("aria-pressed", String(i)), r.classList.toggle("is-active", i);
|
|
5354
5355
|
}
|
|
5355
|
-
function
|
|
5356
|
+
function Oa(r) {
|
|
5356
5357
|
return r === "y" ? "upAxisY" : "upAxisZ";
|
|
5357
5358
|
}
|
|
5358
|
-
function
|
|
5359
|
+
function ja(r) {
|
|
5359
5360
|
return r === "y" ? "当前 Y-UP,点击切换为 Z-UP" : "当前 Z-UP,点击切换为 Y-UP";
|
|
5360
5361
|
}
|
|
5361
|
-
function
|
|
5362
|
+
function Pi(r) {
|
|
5362
5363
|
return `${r ? "隐藏碰撞代理" : "显示碰撞代理"}(青绿=精确代理,橙黄=碰撞源网格近似)`;
|
|
5363
5364
|
}
|
|
5364
|
-
class
|
|
5365
|
+
class Fa {
|
|
5365
5366
|
constructor(e, t, i = {}) {
|
|
5366
5367
|
u(this, "element");
|
|
5367
5368
|
u(this, "closeButton");
|
|
@@ -5393,7 +5394,7 @@ class Oa {
|
|
|
5393
5394
|
const s = document.createElement("header");
|
|
5394
5395
|
s.className = "vpu-environment-header";
|
|
5395
5396
|
const a = document.createElement("div");
|
|
5396
|
-
a.className = "vpu-environment-title", a.textContent = "环境纹理", this.closeButton =
|
|
5397
|
+
a.className = "vpu-environment-title", a.textContent = "环境纹理", this.closeButton = Mi("关闭环境选择", "close"), s.append(a, this.closeButton);
|
|
5397
5398
|
const o = document.createElement("label");
|
|
5398
5399
|
o.className = "vpu-environment-background", o.hidden = !this.showBackgroundToggle;
|
|
5399
5400
|
const l = document.createElement("span");
|
|
@@ -5401,7 +5402,7 @@ class Oa {
|
|
|
5401
5402
|
const d = document.createElement("span");
|
|
5402
5403
|
d.className = "vpu-environment-switch", this.backgroundToggle = document.createElement("input"), this.backgroundToggle.type = "checkbox", this.backgroundToggle.setAttribute("role", "switch"), this.backgroundToggle.setAttribute("aria-label", "显示环境背景");
|
|
5403
5404
|
const c = document.createElement("span");
|
|
5404
|
-
c.className = "vpu-environment-switch-track", c.setAttribute("aria-hidden", "true"), d.append(this.backgroundToggle, c), o.append(l, d), this.rotationPanel = document.createElement("div"), this.rotationPanel.className = "vpu-environment-rotations", this.rotation =
|
|
5405
|
+
c.className = "vpu-environment-switch-track", c.setAttribute("aria-hidden", "true"), d.append(this.backgroundToggle, c), o.append(l, d), this.rotationPanel = document.createElement("div"), this.rotationPanel.className = "vpu-environment-rotations", this.rotation = za("环境旋转", (f) => {
|
|
5405
5406
|
this.queueRotation(f);
|
|
5406
5407
|
}), this.rotationPanel.append(this.rotation.root);
|
|
5407
5408
|
const p = document.createElement("div");
|
|
@@ -5461,7 +5462,7 @@ class Oa {
|
|
|
5461
5462
|
var n, s;
|
|
5462
5463
|
if (this.disposed) return;
|
|
5463
5464
|
this.state = e;
|
|
5464
|
-
const t =
|
|
5465
|
+
const t = $a(e);
|
|
5465
5466
|
this.syncPresetCards(t);
|
|
5466
5467
|
const i = e.active === "default" ? e.activePresetIndex ?? 0 : null;
|
|
5467
5468
|
this.element.dataset.busy = String(e.loading), this.defaultCard.root.dataset.selected = String(i === 0), this.customCard.root.dataset.selected = String(e.active === "custom"), this.defaultCard.select.setAttribute("aria-pressed", String(i === 0)), this.customCard.select.setAttribute("aria-pressed", String(e.active === "custom")), this.defaultCard.name.textContent = ((n = t[0]) == null ? void 0 : n.name) ?? "默认环境", this.defaultCard.format.textContent = t[0] ? vt(t[0]) : "HDR";
|
|
@@ -5469,7 +5470,7 @@ class Oa {
|
|
|
5469
5470
|
const o = this.presetCards[a], l = t[a + 1];
|
|
5470
5471
|
o.root.dataset.selected = String(i === a + 1), o.select.setAttribute("aria-pressed", String(i === a + 1)), o.select.disabled = e.loading, o.name.textContent = (l == null ? void 0 : l.name) ?? `预设环境 ${a + 2}`, o.format.textContent = l ? vt(l) : "HDR";
|
|
5471
5472
|
}
|
|
5472
|
-
if (this.customCard.name.textContent = ((s = e.customEnvironment) == null ? void 0 : s.name) ?? "上传自定义环境", this.customCard.format.textContent = e.customEnvironment ? vt(e.customEnvironment) : "HDR / JPG / PNG", this.customCard.root.dataset.empty = String(!e.customEnvironment), this.customCard.replace.hidden = !e.customEnvironment, this.customCard.select.disabled = e.loading, this.defaultCard.select.disabled = e.loading, this.customCard.replace.disabled = e.loading, this.closeButton.disabled = e.loading, this.backgroundToggle.checked = e.backgroundVisible, this.rotation.input.value = String(e.rotation), this.rotation.output.value =
|
|
5473
|
+
if (this.customCard.name.textContent = ((s = e.customEnvironment) == null ? void 0 : s.name) ?? "上传自定义环境", this.customCard.format.textContent = e.customEnvironment ? vt(e.customEnvironment) : "HDR / JPG / PNG", this.customCard.root.dataset.empty = String(!e.customEnvironment), this.customCard.replace.hidden = !e.customEnvironment, this.customCard.select.disabled = e.loading, this.defaultCard.select.disabled = e.loading, this.customCard.replace.disabled = e.loading, this.closeButton.disabled = e.loading, this.backgroundToggle.checked = e.backgroundVisible, this.rotation.input.value = String(e.rotation), this.rotation.output.value = Sn(e.rotation), this.rotationPanel.hidden = !e.rotationAvailable, this.status.textContent = e.loading ? "正在应用环境..." : this.message, this.status.dataset.kind = this.message.startsWith("环境加载失败") ? "error" : "hint", !!this.opened) {
|
|
5473
5474
|
t[0] ? this.defaultPreview.load(this.defaultCard, t[0]) : this.defaultPreview.clear(this.defaultCard);
|
|
5474
5475
|
for (let a = 0; a < this.presetCards.length; a += 1) {
|
|
5475
5476
|
const o = t[a + 1], l = this.presetCards[a], d = this.presetPreviews[a];
|
|
@@ -5517,7 +5518,7 @@ class Oa {
|
|
|
5517
5518
|
d.className = "vpu-environment-meta";
|
|
5518
5519
|
const c = document.createElement("span");
|
|
5519
5520
|
c.className = "vpu-environment-name", d.append(c), n.append(s, d);
|
|
5520
|
-
const p = t ?
|
|
5521
|
+
const p = t ? Mi("更换自定义环境", "upload") : void 0;
|
|
5521
5522
|
return p && (p.className = "vpu-environment-replace", p.hidden = !0), i.append(n, l, ...p ? [p] : []), { root: i, select: n, canvas: a, fallback: o, format: l, name: c, replace: p };
|
|
5522
5523
|
}
|
|
5523
5524
|
async run(e, t = "") {
|
|
@@ -5564,7 +5565,7 @@ class ft {
|
|
|
5564
5565
|
const n = ++this.generation;
|
|
5565
5566
|
e.canvas.dataset.state = "loading";
|
|
5566
5567
|
try {
|
|
5567
|
-
const s = await
|
|
5568
|
+
const s = await Va(t);
|
|
5568
5569
|
if (n !== this.generation) {
|
|
5569
5570
|
s.dispose();
|
|
5570
5571
|
return;
|
|
@@ -5583,20 +5584,20 @@ class ft {
|
|
|
5583
5584
|
}
|
|
5584
5585
|
render(e, t) {
|
|
5585
5586
|
const i = this.ensureRenderer(e), n = this.scene, s = this.mesh.material;
|
|
5586
|
-
n.environment = t, s.envMap = t, s.needsUpdate = !0, i.render(n,
|
|
5587
|
+
n.environment = t, s.envMap = t, s.needsUpdate = !0, i.render(n, kn);
|
|
5587
5588
|
}
|
|
5588
5589
|
ensureRenderer(e) {
|
|
5589
5590
|
var a, o, l, d;
|
|
5590
5591
|
if (this.renderer && this.canvas === e) return this.renderer;
|
|
5591
5592
|
(a = this.mesh) == null || a.geometry.dispose(), (o = this.mesh) == null || o.material.dispose(), (l = this.renderer) == null || l.dispose(), (d = this.renderer) == null || d.forceContextLoss();
|
|
5592
|
-
const t = new
|
|
5593
|
-
t.setPixelRatio(1), t.setSize(128, 128, !1), t.outputColorSpace = Ft, t.toneMapping =
|
|
5594
|
-
const i = new
|
|
5593
|
+
const t = new ln({ canvas: e, alpha: !0, antialias: !0, powerPreference: "low-power" });
|
|
5594
|
+
t.setPixelRatio(1), t.setSize(128, 128, !1), t.outputColorSpace = Ft, t.toneMapping = Un, t.toneMappingExposure = 1.05;
|
|
5595
|
+
const i = new $e(), n = new _n({
|
|
5595
5596
|
color: 16777215,
|
|
5596
5597
|
metalness: 1,
|
|
5597
5598
|
roughness: 0.08,
|
|
5598
5599
|
envMapIntensity: 1.25
|
|
5599
|
-
}), s = new ae(new
|
|
5600
|
+
}), s = new ae(new Hn(0.92, 64, 40), n);
|
|
5600
5601
|
return i.add(s), this.renderer = t, this.canvas = e, this.scene = i, this.mesh = s, t;
|
|
5601
5602
|
}
|
|
5602
5603
|
clearTexture() {
|
|
@@ -5604,9 +5605,9 @@ class ft {
|
|
|
5604
5605
|
(e = this.texture) == null || e.dispose(), this.texture = null, this.scene && (this.scene.environment = null), this.mesh && (this.mesh.material.envMap = null);
|
|
5605
5606
|
}
|
|
5606
5607
|
}
|
|
5607
|
-
const
|
|
5608
|
-
|
|
5609
|
-
function
|
|
5608
|
+
const kn = new dn(32, 1, 0.1, 10);
|
|
5609
|
+
kn.position.set(0, 0, 3.4);
|
|
5610
|
+
function Mi(r, e) {
|
|
5610
5611
|
const t = document.createElement("button");
|
|
5611
5612
|
return t.type = "button", t.className = "vpu-environment-icon", t.innerHTML = dt(e), t.title = r, t.setAttribute("aria-label", r), t;
|
|
5612
5613
|
}
|
|
@@ -5614,7 +5615,7 @@ function vt(r) {
|
|
|
5614
5615
|
var e;
|
|
5615
5616
|
return r.type === "hdr" ? "HDR" : ((e = r.name.split(".").pop()) == null ? void 0 : e.toUpperCase()) ?? "IMAGE";
|
|
5616
5617
|
}
|
|
5617
|
-
function
|
|
5618
|
+
function za(r, e) {
|
|
5618
5619
|
const t = document.createElement("label");
|
|
5619
5620
|
t.className = "vpu-environment-rotation";
|
|
5620
5621
|
const i = document.createElement("span");
|
|
@@ -5624,35 +5625,35 @@ function ja(r, e) {
|
|
|
5624
5625
|
const s = document.createElement("output");
|
|
5625
5626
|
return s.className = "vpu-environment-rotation-value", s.value = "0°", n.addEventListener("input", () => {
|
|
5626
5627
|
const a = Number(n.value);
|
|
5627
|
-
s.value =
|
|
5628
|
+
s.value = Sn(a), e(a);
|
|
5628
5629
|
}), t.append(i, n, s), { root: t, input: n, output: s };
|
|
5629
5630
|
}
|
|
5630
|
-
function
|
|
5631
|
+
function Sn(r) {
|
|
5631
5632
|
return `${Math.round(r)}°`;
|
|
5632
5633
|
}
|
|
5633
|
-
function
|
|
5634
|
+
function $a(r) {
|
|
5634
5635
|
return r.environmentPresets.length > 0 ? r.environmentPresets : r.defaultEnvironment ? [r.defaultEnvironment] : [];
|
|
5635
5636
|
}
|
|
5636
|
-
async function
|
|
5637
|
+
async function Va(r) {
|
|
5637
5638
|
let e;
|
|
5638
|
-
return r.type === "hdr" ? e = await new
|
|
5639
|
+
return r.type === "hdr" ? e = await new hn().loadAsync(r.url) : (e = await new un().loadAsync(r.url), e.colorSpace = Ft), e.mapping = Me, e;
|
|
5639
5640
|
}
|
|
5640
|
-
const
|
|
5641
|
-
function
|
|
5642
|
-
if (!Number.isFinite(r) || r <= 0) return
|
|
5641
|
+
const je = 1;
|
|
5642
|
+
function Ql(r) {
|
|
5643
|
+
if (!Number.isFinite(r) || r <= 0) return je;
|
|
5643
5644
|
const e = r / 16, t = 10 ** Math.floor(Math.log10(e)), i = e / t;
|
|
5644
5645
|
return (i >= 5 ? 5 : i >= 2.5 ? 2.5 : i >= 2 ? 2 : 1) * t;
|
|
5645
5646
|
}
|
|
5646
|
-
function
|
|
5647
|
-
return
|
|
5647
|
+
function Ba(r) {
|
|
5648
|
+
return Ua(r);
|
|
5648
5649
|
}
|
|
5649
|
-
function
|
|
5650
|
-
return !Number.isFinite(r) || r <= 0 ? "" : r >= 1e3 ? `${
|
|
5650
|
+
function Ua(r) {
|
|
5651
|
+
return !Number.isFinite(r) || r <= 0 ? "" : r >= 1e3 ? `${Ye(r / 1e3)} km` : r >= 1 ? `${Ye(r)} m` : r >= 0.01 ? `${Ye(r * 100)} cm` : `${Ye(r * 1e3)} mm`;
|
|
5651
5652
|
}
|
|
5652
|
-
function
|
|
5653
|
+
function Ye(r) {
|
|
5653
5654
|
return Number(r.toFixed(r >= 10 ? 0 : r >= 1 ? 1 : 2)).toString();
|
|
5654
5655
|
}
|
|
5655
|
-
class
|
|
5656
|
+
class _a {
|
|
5656
5657
|
constructor(e, t = !0) {
|
|
5657
5658
|
u(this, "root");
|
|
5658
5659
|
u(this, "label");
|
|
@@ -5670,8 +5671,8 @@ class Ba {
|
|
|
5670
5671
|
update(e, t) {
|
|
5671
5672
|
var n;
|
|
5672
5673
|
const i = this.root.dataset.enabled !== "false" && (e == null ? void 0 : e.phase) === "ready" && (e.kind === "model" || e.kind === "simulation") && ((n = e.capabilities) == null ? void 0 : n.canToggleGround) === !0 && t.groundVisible;
|
|
5673
|
-
this.root.hidden = !i, i && (this.label.textContent =
|
|
5674
|
-
t.groundGridScale ??
|
|
5674
|
+
this.root.hidden = !i, i && (this.label.textContent = Ba(
|
|
5675
|
+
t.groundGridScale ?? je
|
|
5675
5676
|
));
|
|
5676
5677
|
}
|
|
5677
5678
|
themeChanged(e) {
|
|
@@ -5681,7 +5682,7 @@ class Ba {
|
|
|
5681
5682
|
this.disposed || (this.disposed = !0, this.root.remove());
|
|
5682
5683
|
}
|
|
5683
5684
|
}
|
|
5684
|
-
class
|
|
5685
|
+
class Ha {
|
|
5685
5686
|
constructor(e = "dark", t) {
|
|
5686
5687
|
u(this, "root");
|
|
5687
5688
|
u(this, "title");
|
|
@@ -5733,7 +5734,7 @@ class Ua {
|
|
|
5733
5734
|
return this.show("loading", ((a = e.message) == null ? void 0 : a.trim()) || "正在加载资产...", "", ""), !0;
|
|
5734
5735
|
const i = (((o = e.physics) == null ? void 0 : o.status) === "unavailable" ? e.physics.issue : null) ?? e.warning;
|
|
5735
5736
|
if (e.phase === "ready" && i) {
|
|
5736
|
-
const p = ((l = i.notice) == null ? void 0 : l.title) ??
|
|
5737
|
+
const p = ((l = i.notice) == null ? void 0 : l.title) ?? qa(i.stage);
|
|
5737
5738
|
return this.show("warning", p, ((d = i.notice) == null ? void 0 : d.summary) ?? "", i.message, (c = i.notice) == null ? void 0 : c.tone), !0;
|
|
5738
5739
|
}
|
|
5739
5740
|
return this.hide(), !1;
|
|
@@ -5774,10 +5775,10 @@ class Ua {
|
|
|
5774
5775
|
this.closeReport(), this.reportLink = null, !this.root.hidden && (this.root.hidden = !0, this.title.textContent = "", this.summary.textContent = "", this.summary.hidden = !0, this.detailLabel.hidden = !0, this.detail.textContent = "", this.detail.hidden = !0, this.toggle.hidden = !0);
|
|
5775
5776
|
}
|
|
5776
5777
|
}
|
|
5777
|
-
function
|
|
5778
|
+
function qa(r) {
|
|
5778
5779
|
return r === "physics-fallback" ? "视觉预览模式" : r === "visual-adaptation" ? "视觉适配信息" : r === "visual-material" ? "视觉材质近似" : r === "physics-validation" ? "物理定义无效" : "资产提示";
|
|
5779
5780
|
}
|
|
5780
|
-
const
|
|
5781
|
+
const Ya = `
|
|
5781
5782
|
.vpu-root {
|
|
5782
5783
|
position: absolute;
|
|
5783
5784
|
inset: 0;
|
|
@@ -6258,12 +6259,12 @@ const Ha = `
|
|
|
6258
6259
|
.vpu-joint-scene-dot,.vpu-joint-scene-pin,.vpu-joint-map-node { transition: none; }
|
|
6259
6260
|
}
|
|
6260
6261
|
`, st = /* @__PURE__ */ new Set(["revolute", "continuous", "prismatic"]);
|
|
6261
|
-
function
|
|
6262
|
+
function Pn(r) {
|
|
6262
6263
|
if (!st.has(r.type)) return !1;
|
|
6263
6264
|
const e = r.controlLimits ?? r.limits;
|
|
6264
6265
|
return !e || e.upper > e.lower;
|
|
6265
6266
|
}
|
|
6266
|
-
function
|
|
6267
|
+
function Fe(r) {
|
|
6267
6268
|
const e = new Map(r.map((c) => [c.id, c])), t = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set(), n = (c) => {
|
|
6268
6269
|
const p = t.get(c);
|
|
6269
6270
|
if (p !== void 0) return p;
|
|
@@ -6280,15 +6281,15 @@ function je(r) {
|
|
|
6280
6281
|
}, s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = [];
|
|
6281
6282
|
for (const c of r) {
|
|
6282
6283
|
const p = n(c.id);
|
|
6283
|
-
if (!(!p || !
|
|
6284
|
+
if (!(!p || !Pn(e.get(p))))
|
|
6284
6285
|
if (s.set(c.id, p), p !== c.id) {
|
|
6285
6286
|
let h = a.get(p);
|
|
6286
6287
|
h || (h = [], a.set(p, h)), h.push(c);
|
|
6287
6288
|
} else o.push(c);
|
|
6288
6289
|
}
|
|
6289
6290
|
const l = /* @__PURE__ */ new Map();
|
|
6290
|
-
for (const c of r) l.set(c.id,
|
|
6291
|
-
const d =
|
|
6291
|
+
for (const c of r) l.set(c.id, Xa(c));
|
|
6292
|
+
const d = Wa(r, o);
|
|
6292
6293
|
return {
|
|
6293
6294
|
drivers: o,
|
|
6294
6295
|
driverIds: s,
|
|
@@ -6300,7 +6301,7 @@ function je(r) {
|
|
|
6300
6301
|
grouped: d.filter((c) => c.joints.length >= 2).length >= 2
|
|
6301
6302
|
};
|
|
6302
6303
|
}
|
|
6303
|
-
function
|
|
6304
|
+
function Wa(r, e) {
|
|
6304
6305
|
if (!e.length) return [];
|
|
6305
6306
|
const t = new Map(r.map((p) => [p.id, p])), i = new Map(r.filter((p) => p.child !== null).map((p) => [p.child, p])), n = new Set(e.map((p) => p.id)), s = (p) => p.parentJointId !== void 0 ? t.get(p.parentJointId ?? "") : p.parent ? i.get(p.parent) : void 0, a = /* @__PURE__ */ new Map(), o = new Map(e.map((p) => [p.id, []]));
|
|
6306
6307
|
for (const p of e) {
|
|
@@ -6323,21 +6324,21 @@ function qa(r, e) {
|
|
|
6323
6324
|
const f = o.get(m.id);
|
|
6324
6325
|
m = f.length === 1 ? f[0] : void 0;
|
|
6325
6326
|
}
|
|
6326
|
-
l.push({ id: p.id, label:
|
|
6327
|
+
l.push({ id: p.id, label: Ga(h, p.parent ?? p.id), joints: h });
|
|
6327
6328
|
for (const f of o.get(h[h.length - 1].id)) c(f);
|
|
6328
6329
|
};
|
|
6329
6330
|
for (const p of e) a.has(p.id) || c(p);
|
|
6330
6331
|
for (const p of e) c(p);
|
|
6331
6332
|
return l;
|
|
6332
6333
|
}
|
|
6333
|
-
function
|
|
6334
|
+
function Ga(r, e) {
|
|
6334
6335
|
const t = `${e} ${r.map((n) => `${n.parent ?? ""} ${n.child ?? ""}`).join(" ")}`.toLowerCase();
|
|
6335
6336
|
if (/left|_l(?:\b|[_/])|\bl(?:\b|[_/])/.test(t)) return "Left";
|
|
6336
6337
|
if (/right|_r(?:\b|[_/])|\br(?:\b|[_/])/.test(t)) return "Right";
|
|
6337
6338
|
const i = e.split("/").filter(Boolean).pop();
|
|
6338
6339
|
return i ? i.replace(/[-_]+/g, " ") : "Chain";
|
|
6339
6340
|
}
|
|
6340
|
-
function
|
|
6341
|
+
function Xa(r) {
|
|
6341
6342
|
var e;
|
|
6342
6343
|
return (e = r.label) != null && e.trim() ? r.label.trim() : r.name.split("/").filter(Boolean).pop() ?? r.name;
|
|
6343
6344
|
}
|
|
@@ -6354,10 +6355,10 @@ function gt(r, e) {
|
|
|
6354
6355
|
return null;
|
|
6355
6356
|
n = o;
|
|
6356
6357
|
}
|
|
6357
|
-
return
|
|
6358
|
+
return Pn(n) && Number.isFinite(s) && Math.abs(s) >= 1e-8 ? { driver: n, via: i, gain: s } : null;
|
|
6358
6359
|
}
|
|
6359
6360
|
const le = (r, e, t) => Math.max(e, Math.min(t, r));
|
|
6360
|
-
class
|
|
6361
|
+
class Ka {
|
|
6361
6362
|
constructor(e, t) {
|
|
6362
6363
|
u(this, "view");
|
|
6363
6364
|
u(this, "handles", []);
|
|
@@ -6474,7 +6475,7 @@ class Ga {
|
|
|
6474
6475
|
}
|
|
6475
6476
|
}
|
|
6476
6477
|
}
|
|
6477
|
-
class
|
|
6478
|
+
class Ja {
|
|
6478
6479
|
constructor(e = "dark") {
|
|
6479
6480
|
u(this, "element", document.createElement("section"));
|
|
6480
6481
|
u(this, "body", document.createElement("div"));
|
|
@@ -6491,7 +6492,7 @@ class Xa {
|
|
|
6491
6492
|
u(this, "rows", /* @__PURE__ */ new Map());
|
|
6492
6493
|
u(this, "followerRows", /* @__PURE__ */ new Map());
|
|
6493
6494
|
u(this, "cards", /* @__PURE__ */ new Map());
|
|
6494
|
-
u(this, "plan",
|
|
6495
|
+
u(this, "plan", Fe([]));
|
|
6495
6496
|
u(this, "numberDrafts", /* @__PURE__ */ new Set());
|
|
6496
6497
|
u(this, "inspection", null);
|
|
6497
6498
|
u(this, "unsubscribe", null);
|
|
@@ -6507,9 +6508,9 @@ class Xa {
|
|
|
6507
6508
|
const i = Ai(t.dial, e);
|
|
6508
6509
|
if (i === null) return;
|
|
6509
6510
|
e.preventDefault(), e.stopPropagation();
|
|
6510
|
-
const n =
|
|
6511
|
+
const n = eo(i - t.previousAngle);
|
|
6511
6512
|
t.previousAngle = i;
|
|
6512
|
-
const s =
|
|
6513
|
+
const s = Ii(t.joint, t.value), a = t.joint.unit === "rad" ? t.value + n * Math.PI / 180 : t.value + n / 270 * (s.upper - s.lower), o = Math.max(s.lower, Math.min(s.upper, a));
|
|
6513
6514
|
!Number.isFinite(o) || o === t.value || (t.value = o, (l = this.inspection) == null || l.setJointValue(t.joint.id, o));
|
|
6514
6515
|
});
|
|
6515
6516
|
u(this, "endDialGesture", (e) => {
|
|
@@ -6529,7 +6530,7 @@ class Xa {
|
|
|
6529
6530
|
}), this.reset.textContent = "恢复默认姿态", this.reset.addEventListener("click", () => {
|
|
6530
6531
|
var s;
|
|
6531
6532
|
return (s = this.inspection) == null ? void 0 : s.resetPose();
|
|
6532
|
-
}), n.append(this.unitToggle, this.reset), this.hint.className = "vpu-joints-hint", this.list.className = "vpu-joints-list", this.body.append(this.selectedLabel, this.list, this.mapLabel, this.map), this.footer.className = "vpu-joints-footer", this.footer.append(n, this.hint), this.element.append(t, this.body, this.footer), this.layout = new
|
|
6533
|
+
}), n.append(this.unitToggle, this.reset), this.hint.className = "vpu-joints-hint", this.list.className = "vpu-joints-list", this.body.append(this.selectedLabel, this.list, this.mapLabel, this.map), this.footer.className = "vpu-joints-footer", this.footer.append(n, this.hint), this.element.append(t, this.body, this.footer), this.layout = new Ka(this.element, t), this.syncExpanded();
|
|
6533
6534
|
}
|
|
6534
6535
|
bind(e) {
|
|
6535
6536
|
var t;
|
|
@@ -6537,7 +6538,7 @@ class Xa {
|
|
|
6537
6538
|
e && this.render(e.getSnapshot());
|
|
6538
6539
|
return;
|
|
6539
6540
|
}
|
|
6540
|
-
if ((t = this.unsubscribe) == null || t.call(this), this.unsubscribe = null, this.stopDialGesture(), this.inspection = e, this.joints = [], this.rows.clear(), this.followerRows.clear(), this.cards.clear(), this.plan =
|
|
6541
|
+
if ((t = this.unsubscribe) == null || t.call(this), this.unsubscribe = null, this.stopDialGesture(), this.inspection = e, this.joints = [], this.rows.clear(), this.followerRows.clear(), this.cards.clear(), this.plan = Fe([]), this.numberDrafts.clear(), this.list.replaceChildren(), this.map.replaceChildren(), this.element.hidden = !e, !e) {
|
|
6541
6542
|
this.layout.refresh();
|
|
6542
6543
|
return;
|
|
6543
6544
|
}
|
|
@@ -6556,20 +6557,20 @@ class Xa {
|
|
|
6556
6557
|
render(e) {
|
|
6557
6558
|
var l, d, c;
|
|
6558
6559
|
const t = this.joints !== e.joints || this.element.hidden;
|
|
6559
|
-
this.joints !== e.joints && (this.joints = e.joints, this.plan =
|
|
6560
|
+
this.joints !== e.joints && (this.joints = e.joints, this.plan = Fe(e.joints), this.buildRows(this.plan), this.buildMap(this.plan));
|
|
6560
6561
|
const i = [...this.plan.followersByDriver.values()].reduce((p, h) => p + h.length, 0);
|
|
6561
6562
|
this.element.hidden = this.plan.drivers.length === 0, this.count.textContent = `${this.plan.drivers.length} 个可控${i ? ` · ${i} 个联动` : ""}`;
|
|
6562
6563
|
const n = (e.selectedJointId ? this.plan.driverIds.get(e.selectedJointId) : void 0) ?? ((l = this.plan.drivers[0]) == null ? void 0 : l.id);
|
|
6563
6564
|
this.mapLabel.textContent = this.plan.grouped ? "ALL JOINTS · by limb" : "ALL JOINTS";
|
|
6564
6565
|
const s = this.plan.drivers.find((p) => p.id === n);
|
|
6565
|
-
this.selectedLabel.textContent = s ? `SELECTED JOINT · ${this.plan.labels.get(s.id) ??
|
|
6566
|
+
this.selectedLabel.textContent = s ? `SELECTED JOINT · ${this.plan.labels.get(s.id) ?? We(s)}` : "SELECTED JOINT";
|
|
6566
6567
|
const a = e.playing && e.controlMode === "kinematic" && e.previewing === !0, o = e.playing && !a;
|
|
6567
6568
|
o && this.dialGesture && this.stopDialGesture(), this.hint.textContent = a ? "关节动画播放中,拖动或输入可暂停并调整;联动关节同步跟随。" : e.playing ? "仿真播放中,暂停后可手动调整关节。" : e.previewing ? "正在自动展示关节运动,结束后回到默认姿态。手动调整可立即中止展示。" : e.controlMode === "physics" ? "暂停中,拖动或输入目标位置,通过物理驱动调整关节;遇到有效碰撞会受阻。播放仿真时从默认姿态开始。" : e.controlMode === "kinematic" ? "暂停中,可直接点选并拖动三维关节点或相连部件,也可调节主驱动关节;联动关节同步跟随。" : "暂停中,可拖动或输入关节位置。", this.unitToggle.textContent = this.angleUnit === "deg" ? "°" : "rad", this.unitToggle.setAttribute("aria-pressed", String(this.angleUnit === "deg")), this.reset.disabled = o;
|
|
6568
6569
|
for (const p of this.plan.drivers) {
|
|
6569
|
-
const h = this.rows.get(p.id), m = p.unit === "rad" && this.angleUnit === "deg" ? 180 / Math.PI : 1, f = p.unit === "m" ? "m" : this.angleUnit === "deg" ? "°" : "rad", b = e.jointValues[p.id] ?? e.jointValues[p.name] ?? p.defaultValue, y = e.controlMode === "physics", v = y ? ((d = e.jointTargets) == null ? void 0 : d[p.id]) ?? ((c = e.jointTargets) == null ? void 0 : c[p.name]) ?? b : b, g =
|
|
6570
|
+
const h = this.rows.get(p.id), m = p.unit === "rad" && this.angleUnit === "deg" ? 180 / Math.PI : 1, f = p.unit === "m" ? "m" : this.angleUnit === "deg" ? "°" : "rad", b = e.jointValues[p.id] ?? e.jointValues[p.name] ?? p.defaultValue, y = e.controlMode === "physics", v = y ? ((d = e.jointTargets) == null ? void 0 : d[p.id]) ?? ((c = e.jointTargets) == null ? void 0 : c[p.name]) ?? b : b, g = Ii(p, v), w = o;
|
|
6570
6571
|
w && this.numberDrafts.delete(p.id), h.element.hidden = n !== p.id, h.element.classList.toggle("is-selected", n === p.id), h.slider.disabled = h.value.disabled = h.reset.disabled = w, h.dialKnobHit.style.pointerEvents = w ? "none" : "all", h.slider.min = h.value.min = String(g.lower * m), h.slider.max = h.value.max = String(g.upper * m), h.slider.value = String(v * m);
|
|
6571
6572
|
const x = h.value.getRootNode();
|
|
6572
|
-
if ((w || x.activeElement !== h.value || !this.numberDrafts.has(p.id)) && (h.value.value = _(v * m)), h.slider.dataset.factor = h.value.dataset.factor = String(m), h.unit.textContent = f, h.limits.textContent = `${_(g.lower * m)} — ${_(g.upper * m)} ${f}`, h.current.textContent = `${_(b * m)} ${f}`, h.rangeSummary.textContent = `${_(g.lower * m)} to ${_(g.upper * m)} ${f} · home ${_(p.defaultValue * m)} ${f}`, h.rangeSummary.title = h.rangeSummary.textContent,
|
|
6573
|
+
if ((w || x.activeElement !== h.value || !this.numberDrafts.has(p.id)) && (h.value.value = _(v * m)), h.slider.dataset.factor = h.value.dataset.factor = String(m), h.unit.textContent = f, h.limits.textContent = `${_(g.lower * m)} — ${_(g.upper * m)} ${f}`, h.current.textContent = `${_(b * m)} ${f}`, h.rangeSummary.textContent = `${_(g.lower * m)} to ${_(g.upper * m)} ${f} · home ${_(p.defaultValue * m)} ${f}`, h.rangeSummary.title = h.rangeSummary.textContent, Qa(h, p, b, g), h.feedback.hidden = !y, y) {
|
|
6573
6574
|
const k = Math.abs(b - v) > (p.unit === "rad" ? Math.PI / 1800 : 1e-4);
|
|
6574
6575
|
h.feedback.textContent = `实际 ${_(b * m)} ${f} · 目标 ${_(v * m)} ${f}${k ? "(尚未到达)" : ""}`, h.feedback.classList.toggle("is-pending", k), h.feedback.title = "实际位置由物理求解决定;尚未到达目标时,关节可能仍在运动或受到碰撞约束。";
|
|
6575
6576
|
}
|
|
@@ -6603,7 +6604,7 @@ class Xa {
|
|
|
6603
6604
|
const s = document.createElement("div");
|
|
6604
6605
|
s.className = "vpu-joint-heading";
|
|
6605
6606
|
const a = document.createElement("button");
|
|
6606
|
-
a.type = "button", a.className = "vpu-joint-name", a.textContent = e.labels.get(i.id) ??
|
|
6607
|
+
a.type = "button", a.className = "vpu-joint-name", a.textContent = e.labels.get(i.id) ?? We(i), a.title = `${i.name} · ${i.type}`, a.addEventListener("click", () => {
|
|
6607
6608
|
var j;
|
|
6608
6609
|
return (j = this.inspection) == null ? void 0 : j.select(i.id);
|
|
6609
6610
|
});
|
|
@@ -6639,7 +6640,7 @@ class Xa {
|
|
|
6639
6640
|
const x = document.createElement("div");
|
|
6640
6641
|
x.className = "vpu-joint-inspector-summary", x.append(s, v, g), w.append(l, x);
|
|
6641
6642
|
const C = document.createElement("small");
|
|
6642
|
-
C.className = "vpu-joint-relation", C.textContent = `${
|
|
6643
|
+
C.className = "vpu-joint-relation", C.textContent = `${Ge(i.parent)} → ${Ge(i.child)}`, C.title = `${i.parent ?? "世界"} → ${i.child ?? "未绑定"}`;
|
|
6643
6644
|
const k = document.createElement("div");
|
|
6644
6645
|
k.className = "vpu-joint-inputs";
|
|
6645
6646
|
const E = document.createElement("input");
|
|
@@ -6663,7 +6664,7 @@ class Xa {
|
|
|
6663
6664
|
const U = document.createElement("small");
|
|
6664
6665
|
U.className = "vpu-joint-feedback", U.hidden = !0;
|
|
6665
6666
|
const L = document.createElement("div");
|
|
6666
|
-
L.className = "vpu-joint-metadata", L.append(...
|
|
6667
|
+
L.className = "vpu-joint-metadata", L.append(...Za(i)), n.append(w, C, k, U, S, L);
|
|
6667
6668
|
const V = e.followersByDriver.get(i.id) ?? [];
|
|
6668
6669
|
if (V.length) {
|
|
6669
6670
|
const j = document.createElement("details");
|
|
@@ -6674,9 +6675,9 @@ class Xa {
|
|
|
6674
6675
|
const T = document.createElement("div");
|
|
6675
6676
|
T.className = "vpu-joint-follower", T.dataset.jointId = O.id;
|
|
6676
6677
|
const B = document.createElement("button");
|
|
6677
|
-
B.type = "button", B.className = "vpu-joint-name", B.textContent = e.labels.get(O.id) ??
|
|
6678
|
-
var
|
|
6679
|
-
return (
|
|
6678
|
+
B.type = "button", B.className = "vpu-joint-name", B.textContent = e.labels.get(O.id) ?? We(O), B.title = `${O.name} · 由 ${i.name} 控制`, B.addEventListener("click", () => {
|
|
6679
|
+
var Ue;
|
|
6680
|
+
return (Ue = this.inspection) == null ? void 0 : Ue.select(i.id);
|
|
6680
6681
|
});
|
|
6681
6682
|
const de = document.createElement("span");
|
|
6682
6683
|
de.className = "vpu-joint-follower-value";
|
|
@@ -6687,7 +6688,7 @@ class Xa {
|
|
|
6687
6688
|
const oe = O.mimic ? t.get(O.mimic.joint) : void 0;
|
|
6688
6689
|
ce.textContent = O.mimic ? `跟随 ${(oe == null ? void 0 : oe.name) ?? O.mimic.joint} · × ${_(O.mimic.multiplier)}${O.mimic.offset ? ` ${O.mimic.offset < 0 ? "−" : "+"} ${_(Math.abs(O.mimic.offset))} ${O.unit}` : ""}` : `由 ${i.name} 联动控制`;
|
|
6689
6690
|
const ve = document.createElement("small");
|
|
6690
|
-
ve.className = "vpu-joint-relation", ve.textContent = `${
|
|
6691
|
+
ve.className = "vpu-joint-relation", ve.textContent = `${Ge(O.parent)} → ${Ge(O.child)}`, ve.title = `${O.parent ?? "世界"} → ${O.child ?? "未绑定"}`, T.append(fe, ve, ce), this.followerRows.set(O.id, { element: T, value: de }), j.append(T);
|
|
6691
6692
|
}
|
|
6692
6693
|
n.append(j);
|
|
6693
6694
|
}
|
|
@@ -6728,7 +6729,7 @@ class Xa {
|
|
|
6728
6729
|
const s = document.createElement("button");
|
|
6729
6730
|
s.type = "button", s.className = "vpu-joint-map-node", s.dataset.mapJoint = i.id;
|
|
6730
6731
|
const a = document.createElement("span");
|
|
6731
|
-
a.className = "vpu-joint-map-label", a.textContent = e.labels.get(i.id) ??
|
|
6732
|
+
a.className = "vpu-joint-map-label", a.textContent = e.labels.get(i.id) ?? We(i);
|
|
6732
6733
|
const o = document.createElement("span");
|
|
6733
6734
|
o.className = "vpu-joint-map-value";
|
|
6734
6735
|
const l = document.createElement("span");
|
|
@@ -6759,10 +6760,10 @@ class Xa {
|
|
|
6759
6760
|
}
|
|
6760
6761
|
}
|
|
6761
6762
|
}
|
|
6762
|
-
function
|
|
6763
|
+
function We(r) {
|
|
6763
6764
|
return r.label ?? r.name;
|
|
6764
6765
|
}
|
|
6765
|
-
function
|
|
6766
|
+
function Za(r) {
|
|
6766
6767
|
var t;
|
|
6767
6768
|
const e = [["type", r.type]];
|
|
6768
6769
|
if (r.movingMass != null && Number.isFinite(r.movingMass) && e.push(["moving mass", `${_(r.movingMass)} kg`]), (t = r.drive) != null && t.type) {
|
|
@@ -6779,22 +6780,22 @@ function Ka(r) {
|
|
|
6779
6780
|
return a.className = "vpu-joint-metadata-value", a.textContent = n, a.title = n, [s, a];
|
|
6780
6781
|
});
|
|
6781
6782
|
}
|
|
6782
|
-
function
|
|
6783
|
+
function ze(r, e) {
|
|
6783
6784
|
const t = r * Math.PI / 180;
|
|
6784
6785
|
return [52 + Math.sin(t) * e, 52 - Math.cos(t) * e];
|
|
6785
6786
|
}
|
|
6786
|
-
function
|
|
6787
|
+
function Ri(r, e, t) {
|
|
6787
6788
|
if (Math.abs(t - e) >= 359.5)
|
|
6788
6789
|
return `M 52 ${52 - r} A ${r} ${r} 0 1 1 52 ${52 + r} A ${r} ${r} 0 1 1 52 ${52 - r}`;
|
|
6789
|
-
const [i, n] =
|
|
6790
|
+
const [i, n] = ze(e, r), [s, a] = ze(t, r);
|
|
6790
6791
|
return `M ${i} ${n} A ${r} ${r} 0 ${Math.abs(t - e) > 180 ? 1 : 0} ${t >= e ? 1 : 0} ${s} ${a}`;
|
|
6791
6792
|
}
|
|
6792
|
-
function
|
|
6793
|
-
const n = i.upper - i.lower, s = (y) => e.unit === "rad" ? y * 180 / Math.PI : -135 + (n > 0 && Number.isFinite(n) ? Math.max(0, Math.min(1, (y - i.lower) / n)) : 0.5) * 270, a = s(t), o = s(e.defaultValue), [l, d] =
|
|
6794
|
-
r.dialRange.setAttribute("d",
|
|
6795
|
-
const m =
|
|
6793
|
+
function Qa(r, e, t, i) {
|
|
6794
|
+
const n = i.upper - i.lower, s = (y) => e.unit === "rad" ? y * 180 / Math.PI : -135 + (n > 0 && Number.isFinite(n) ? Math.max(0, Math.min(1, (y - i.lower) / n)) : 0.5) * 270, a = s(t), o = s(e.defaultValue), [l, d] = ze(o, 35), [c, p] = ze(o, 49), h = Math.abs(a - o);
|
|
6795
|
+
r.dialRange.setAttribute("d", Ri(43, s(i.lower), s(i.upper)));
|
|
6796
|
+
const m = Ri(39, o, a);
|
|
6796
6797
|
r.dialWedge.setAttribute("d", h < 0.5 ? "" : h >= 359.5 ? `${m} Z` : `M 52 52 L ${m.slice(2)} Z`), r.dialNeedle.setAttribute("x1", "52"), r.dialNeedle.setAttribute("y1", "52");
|
|
6797
|
-
const [f, b] =
|
|
6798
|
+
const [f, b] = ze(a, 40);
|
|
6798
6799
|
r.dialNeedle.setAttribute("x2", String(f)), r.dialNeedle.setAttribute("y2", String(b)), r.dialKnobHit.setAttribute("cx", String(f)), r.dialKnobHit.setAttribute("cy", String(b)), r.dialKnob.setAttribute("cx", String(f)), r.dialKnob.setAttribute("cy", String(b)), r.dialHome.setAttribute("x1", String(l)), r.dialHome.setAttribute("y1", String(d)), r.dialHome.setAttribute("x2", String(c)), r.dialHome.setAttribute("y2", String(p));
|
|
6799
6800
|
}
|
|
6800
6801
|
function Ai(r, e) {
|
|
@@ -6803,26 +6804,26 @@ function Ai(r, e) {
|
|
|
6803
6804
|
const i = (e.clientX - t.left) / t.width * 104, n = (e.clientY - t.top) / t.height * 104, s = i - 52, a = 52 - n;
|
|
6804
6805
|
return s * s + a * a < 1 ? null : Math.atan2(s, a) * 180 / Math.PI;
|
|
6805
6806
|
}
|
|
6806
|
-
function
|
|
6807
|
+
function eo(r) {
|
|
6807
6808
|
return (r + 540) % 360 - 180;
|
|
6808
6809
|
}
|
|
6809
|
-
function
|
|
6810
|
+
function Ge(r) {
|
|
6810
6811
|
return (r == null ? void 0 : r.split("/").filter(Boolean).pop()) ?? (r === null ? "世界" : "未绑定");
|
|
6811
6812
|
}
|
|
6812
6813
|
function _(r) {
|
|
6813
6814
|
return Number(r.toFixed(4)).toString();
|
|
6814
6815
|
}
|
|
6815
|
-
function
|
|
6816
|
+
function Ii(r, e) {
|
|
6816
6817
|
const t = r.controlLimits ?? r.limits;
|
|
6817
6818
|
if (t && Number.isFinite(t.lower) && Number.isFinite(t.upper) && t.lower <= t.upper) return t;
|
|
6818
6819
|
const i = r.unit === "rad" ? Math.PI : 1, n = t && Number.isFinite(t.lower) ? t.lower : Math.min(-i, r.defaultValue, e), s = t && Number.isFinite(t.upper) ? t.upper : Math.max(i, r.defaultValue, e);
|
|
6819
6820
|
return { lower: n, upper: Math.max(n, s) };
|
|
6820
6821
|
}
|
|
6821
|
-
const
|
|
6822
|
+
const Li = "http://www.w3.org/2000/svg", ie = "var(--vpu-joint-highlight)", Di = { dark: "#21c7be", light: "#21c7be" }, to = 140, De = (r) => Number.isFinite(r.x) && Number.isFinite(r.y) && Number.isFinite(r.z), Ti = (r, e) => Number(r.toFixed(e)).toString(), bt = (r, e) => r.unit === "rad" ? `${Ti(e * 180 / Math.PI, 1)}°` : `${Ti(e, 4)} m`;
|
|
6822
6823
|
function Te(r) {
|
|
6823
6824
|
return !r.playing || r.controlMode === "kinematic" && r.previewing === !0;
|
|
6824
6825
|
}
|
|
6825
|
-
function
|
|
6826
|
+
function At(r) {
|
|
6826
6827
|
const e = /* @__PURE__ */ new Set(), t = new Set(r);
|
|
6827
6828
|
for (const i of t) {
|
|
6828
6829
|
let n = !0;
|
|
@@ -6837,16 +6838,16 @@ function Rt(r) {
|
|
|
6837
6838
|
}
|
|
6838
6839
|
return e;
|
|
6839
6840
|
}
|
|
6840
|
-
function
|
|
6841
|
-
return
|
|
6841
|
+
function Ni(r) {
|
|
6842
|
+
return Mn(At(r));
|
|
6842
6843
|
}
|
|
6843
|
-
function
|
|
6844
|
+
function Mn(r) {
|
|
6844
6845
|
const e = new Z();
|
|
6845
6846
|
for (const t of r)
|
|
6846
6847
|
(Array.isArray(t.material) ? t.material : [t.material]).some((n) => n.visible) && (t.updateWorldMatrix(!0, !1), t.geometry.boundingBox || t.geometry.computeBoundingBox(), t.geometry.boundingBox && e.union(t.geometry.boundingBox.clone().applyMatrix4(t.matrixWorld)));
|
|
6847
6848
|
return e;
|
|
6848
6849
|
}
|
|
6849
|
-
function
|
|
6850
|
+
function io(r) {
|
|
6850
6851
|
let e;
|
|
6851
6852
|
if (r.isShaderMaterial) {
|
|
6852
6853
|
const t = r, i = Object.create(t);
|
|
@@ -6857,7 +6858,7 @@ function eo(r) {
|
|
|
6857
6858
|
for (const [d, c] of Object.entries(o)) c != null && c.isTexture && (l[d] = null);
|
|
6858
6859
|
s[a] = l;
|
|
6859
6860
|
}
|
|
6860
|
-
n.uniforms =
|
|
6861
|
+
n.uniforms = qn.clone(s);
|
|
6861
6862
|
for (const [a, o] of Object.entries(t.uniforms))
|
|
6862
6863
|
for (const [l, d] of Object.entries(o))
|
|
6863
6864
|
d != null && d.isTexture && (n.uniforms[a][l] = d);
|
|
@@ -6865,12 +6866,12 @@ function eo(r) {
|
|
|
6865
6866
|
} else e = r.clone();
|
|
6866
6867
|
return e.onBeforeCompile = r.onBeforeCompile, e.customProgramCacheKey = r.customProgramCacheKey, e;
|
|
6867
6868
|
}
|
|
6868
|
-
function
|
|
6869
|
+
function no(r, e, t, i) {
|
|
6869
6870
|
var a, o, l, d;
|
|
6870
6871
|
const n = e, s = r;
|
|
6871
6872
|
(a = n.emissive) != null && a.isColor && ((o = s.emissive) != null && o.isColor) ? (s.emissive.copy(n.emissive).lerp(i, t), s.emissiveIntensity = Math.max(n.emissiveIntensity ?? 1, 1)) : (l = n.color) != null && l.isColor && ((d = s.color) != null && d.isColor) && s.color.copy(n.color).lerp(i, t);
|
|
6872
6873
|
}
|
|
6873
|
-
class
|
|
6874
|
+
class ro {
|
|
6874
6875
|
constructor(e, t) {
|
|
6875
6876
|
u(this, "element");
|
|
6876
6877
|
u(this, "svg");
|
|
@@ -6891,7 +6892,7 @@ class io {
|
|
|
6891
6892
|
u(this, "highlights", /* @__PURE__ */ new Map());
|
|
6892
6893
|
u(this, "bases", /* @__PURE__ */ new Map());
|
|
6893
6894
|
u(this, "joints", []);
|
|
6894
|
-
u(this, "plan",
|
|
6895
|
+
u(this, "plan", Fe([]));
|
|
6895
6896
|
u(this, "occluded", /* @__PURE__ */ new Set());
|
|
6896
6897
|
u(this, "occlusionRay", new lt());
|
|
6897
6898
|
u(this, "rayScreen", new J());
|
|
@@ -6910,15 +6911,15 @@ class io {
|
|
|
6910
6911
|
u(this, "offsetX", 0);
|
|
6911
6912
|
u(this, "offsetY", 0);
|
|
6912
6913
|
var o;
|
|
6913
|
-
this.inspection = e, this.options = t, this.highlightColor = new tt(((o = t.getHighlightColor) == null ? void 0 : o.call(t)) ||
|
|
6914
|
+
this.inspection = e, this.options = t, this.highlightColor = new tt(((o = t.getHighlightColor) == null ? void 0 : o.call(t)) || Di[t.theme ?? "dark"]);
|
|
6914
6915
|
const i = t.canvas.ownerDocument;
|
|
6915
6916
|
this.element = i.createElement("div"), this.element.className = "vpu-joint-scene-overlay", Object.assign(this.element.style, { position: "absolute", inset: "0", overflow: "hidden", pointerEvents: "none", zIndex: "4" }), this.element.style.setProperty("--vpu-joint-highlight", this.highlightColor.getStyle()), this.element.setAttribute("aria-label", "三维关节控制,拖动关节点或连接部件调整姿态");
|
|
6916
6917
|
const n = (l, d, c) => {
|
|
6917
|
-
const p = i.createElementNS(
|
|
6918
|
+
const p = i.createElementNS(Li, l);
|
|
6918
6919
|
for (const [h, m] of Object.entries(d)) p.setAttribute(h, m);
|
|
6919
6920
|
return c.append(p), p;
|
|
6920
6921
|
};
|
|
6921
|
-
this.svg = i.createElementNS(
|
|
6922
|
+
this.svg = i.createElementNS(Li, "svg"), this.svg.setAttribute("width", "100%"), this.svg.setAttribute("height", "100%"), this.svg.setAttribute("aria-hidden", "true"), Object.assign(this.svg.style, { position: "absolute", inset: "0", overflow: "visible", pointerEvents: "none" }), this.element.append(this.svg), this.dial = n("g", { class: "vpu-joint-dial", display: "none" }, this.svg);
|
|
6922
6923
|
const s = { fill: "none", "stroke-linecap": "round", "stroke-linejoin": "round" };
|
|
6923
6924
|
this.wedge = n("path", { class: "vpu-joint-dial-wedge", fill: ie, "fill-opacity": ".22" }, this.dial), this.range = n("path", { ...s, class: "vpu-joint-dial-range", stroke: "#fff", "stroke-opacity": ".6", "stroke-width": "1.5" }, this.dial), this.progress = n("path", { ...s, class: "vpu-joint-dial-progress", stroke: ie, "stroke-width": "2.5" }, this.dial), this.lower = n("line", { ...s, stroke: "#fff", "stroke-width": "1.5" }, this.dial), this.upper = n("line", { ...s, stroke: "#fff", "stroke-width": "1.5" }, this.dial), this.home = n("line", { ...s, class: "vpu-joint-dial-home", stroke: "#fff", "stroke-dasharray": "3 3", "stroke-width": "2" }, this.dial), this.needle = n("line", { ...s, class: "vpu-joint-dial-needle", stroke: ie, "stroke-width": "2" }, this.dial), this.knob = n("circle", { class: "vpu-joint-dial-knob", r: "5", fill: ie, stroke: "#171717", "stroke-width": "1.5" }, this.dial), this.value = n("text", { class: "vpu-joint-dial-value", fill: ie, "font-size": "11", "font-weight": "700", "font-family": "ui-monospace, monospace", "text-anchor": "middle", "dominant-baseline": "central", stroke: "#171717", "stroke-width": "3", "paint-order": "stroke" }, this.dial), this.dialLineHit = n("line", { class: "vpu-joint-dial-line-hit", stroke: "transparent", "stroke-width": "16", "stroke-linecap": "round" }, this.dial), this.dialHit = n("circle", { class: "vpu-joint-dial-hit", r: "14", fill: "transparent" }, this.dial);
|
|
6924
6925
|
const a = (l) => {
|
|
@@ -6939,7 +6940,7 @@ class io {
|
|
|
6939
6940
|
themeChanged(e) {
|
|
6940
6941
|
var t, i;
|
|
6941
6942
|
if (!this.disposed) {
|
|
6942
|
-
this.highlightColor.set(((i = (t = this.options).getHighlightColor) == null ? void 0 : i.call(t)) ||
|
|
6943
|
+
this.highlightColor.set(((i = (t = this.options).getHighlightColor) == null ? void 0 : i.call(t)) || Di[e]), this.element.style.setProperty("--vpu-joint-highlight", this.highlightColor.getStyle());
|
|
6943
6944
|
for (const n of this.highlights.values()) n.strength = -1;
|
|
6944
6945
|
this.update(), this.options.requestRender();
|
|
6945
6946
|
}
|
|
@@ -6958,7 +6959,7 @@ class io {
|
|
|
6958
6959
|
var f, b, y;
|
|
6959
6960
|
if (this.disposed) return;
|
|
6960
6961
|
const e = this.inspection.getSnapshot(), t = Te(e);
|
|
6961
|
-
this.joints !== e.joints && (this.joints = e.joints, this.plan =
|
|
6962
|
+
this.joints !== e.joints && (this.joints = e.joints, this.plan = Fe(e.joints));
|
|
6962
6963
|
const i = new Map(e.joints.map((v) => [v.id, v])), n = this.plan.drivers, s = new Set(n.map((v) => v.id));
|
|
6963
6964
|
for (const [v, g] of this.pins)
|
|
6964
6965
|
s.has(v) || (g.button.remove(), this.pins.delete(v), this.bases.delete(v));
|
|
@@ -7085,7 +7086,7 @@ class io {
|
|
|
7085
7086
|
this.clearOcclusionTimer(), this.occluded.clear(), this.lastOcclusion = -1 / 0;
|
|
7086
7087
|
return;
|
|
7087
7088
|
}
|
|
7088
|
-
const i = performance.now(), n =
|
|
7089
|
+
const i = performance.now(), n = to - (i - this.lastOcclusion);
|
|
7089
7090
|
if (n > 0) {
|
|
7090
7091
|
this.occlusionTimer === null && (this.occlusionTimer = setTimeout(() => {
|
|
7091
7092
|
this.occlusionTimer = null, !this.disposed && (this.update(), this.options.requestRender());
|
|
@@ -7095,9 +7096,9 @@ class io {
|
|
|
7095
7096
|
this.clearOcclusionTimer(), this.lastOcclusion = i, this.occluded.clear();
|
|
7096
7097
|
const s = this.inspection.pickRoots();
|
|
7097
7098
|
for (const p of s) p.updateWorldMatrix(!0, !0);
|
|
7098
|
-
const a = [...
|
|
7099
|
+
const a = [...At(s)];
|
|
7099
7100
|
if (!a.length) return;
|
|
7100
|
-
const o =
|
|
7101
|
+
const o = Mn(a), l = o.isEmpty() ? 0 : o.getBoundingSphere(new Ht()).radius, d = Number.isFinite(l) ? Math.max(l * 0.09, 1e-8) : 1e-8, c = this.occlusionRay;
|
|
7101
7102
|
c.layers.mask = t.layers.mask;
|
|
7102
7103
|
for (const [p, { world: h }] of e) {
|
|
7103
7104
|
this.rayPoint.copy(h).project(t), this.rayScreen.set(this.rayPoint.x, this.rayPoint.y), c.setFromCamera(this.rayScreen, t);
|
|
@@ -7125,7 +7126,7 @@ class io {
|
|
|
7125
7126
|
}
|
|
7126
7127
|
}
|
|
7127
7128
|
for (const { strength: o, roots: l } of a.values())
|
|
7128
|
-
for (const d of
|
|
7129
|
+
for (const d of At([...l]))
|
|
7129
7130
|
(Array.isArray(d.material) ? d.material : [d.material]).some((p) => p.visible) && s.set(d, Math.max(s.get(d) ?? 0, o));
|
|
7130
7131
|
}
|
|
7131
7132
|
for (const [a, o] of this.highlights)
|
|
@@ -7133,12 +7134,12 @@ class io {
|
|
|
7133
7134
|
for (const [a, o] of s) {
|
|
7134
7135
|
let l = this.highlights.get(a);
|
|
7135
7136
|
if (!l) {
|
|
7136
|
-
const d = a.material, p = (Array.isArray(d) ? d : [d]).map(
|
|
7137
|
+
const d = a.material, p = (Array.isArray(d) ? d : [d]).map(io), h = Array.isArray(d) ? p : p[0];
|
|
7137
7138
|
l = { original: d, clones: p, replacement: h, strength: -1 }, this.highlights.set(a, l), a.material = h;
|
|
7138
7139
|
}
|
|
7139
7140
|
if (l.strength !== o) {
|
|
7140
7141
|
const d = Array.isArray(l.original) ? l.original : [l.original];
|
|
7141
|
-
l.clones.forEach((c, p) =>
|
|
7142
|
+
l.clones.forEach((c, p) => no(c, d[p], o, this.highlightColor)), l.strength = o;
|
|
7142
7143
|
}
|
|
7143
7144
|
}
|
|
7144
7145
|
}
|
|
@@ -7150,7 +7151,7 @@ class io {
|
|
|
7150
7151
|
var y, v, g, w, x, C;
|
|
7151
7152
|
const s = this.bases.get(e.id);
|
|
7152
7153
|
if (s) return s;
|
|
7153
|
-
const a = e.child ? (v = (y = this.inspection).objectForBody) == null ? void 0 : v.call(y, e.child) : null, o =
|
|
7154
|
+
const a = e.child ? (v = (y = this.inspection).objectForBody) == null ? void 0 : v.call(y, e.child) : null, o = Ni(a ? [a] : []), l = Ni(((w = (g = this.inspection).pickRoots) == null ? void 0 : w.call(g)) ?? []);
|
|
7154
7155
|
let d = l.isEmpty() ? 0 : l.getBoundingSphere(new Ht()).radius;
|
|
7155
7156
|
(!(d > 0) || !Number.isFinite(d)) && (d = 0.1);
|
|
7156
7157
|
const p = (o.isEmpty() ? t.clone() : o.getCenter(new M())).sub(t);
|
|
@@ -7204,7 +7205,7 @@ function yt(r, e, t) {
|
|
|
7204
7205
|
const i = r.clone().project(e);
|
|
7205
7206
|
return new J(t.left + (i.x + 1) * t.width / 2, t.top + (1 - i.y) * t.height / 2);
|
|
7206
7207
|
}
|
|
7207
|
-
function
|
|
7208
|
+
function so(r, e, t, i, n, s, a) {
|
|
7208
7209
|
if (e.width <= 0 || e.height <= 0 || t.axis.lengthSq() < 1e-12) return 0;
|
|
7209
7210
|
r.updateMatrixWorld(!0);
|
|
7210
7211
|
const o = t.axis.clone().normalize(), l = a ? o : o.clone().cross(i.clone().sub(t.position)), d = yt(i, r, e), c = yt(i.clone().addScaledVector(l, 0.05), r, e).sub(d).multiplyScalar(20), p = s.clone().sub(n), h = c.lengthSq();
|
|
@@ -7217,7 +7218,7 @@ function no(r, e, t, i, n, s, a) {
|
|
|
7217
7218
|
}
|
|
7218
7219
|
return Number.isFinite(m) ? a ? m : Math.max(-0.5, Math.min(0.5, m)) : 0;
|
|
7219
7220
|
}
|
|
7220
|
-
class
|
|
7221
|
+
class ao {
|
|
7221
7222
|
constructor(e, t) {
|
|
7222
7223
|
u(this, "element");
|
|
7223
7224
|
u(this, "overlay");
|
|
@@ -7258,7 +7259,7 @@ class ro {
|
|
|
7258
7259
|
this.stop();
|
|
7259
7260
|
return;
|
|
7260
7261
|
}
|
|
7261
|
-
const s = t.body ? t.body.localToWorld(t.localPoint.clone()) : t.localPoint, a =
|
|
7262
|
+
const s = t.body ? t.body.localToWorld(t.localPoint.clone()) : t.localPoint, a = so(this.options.getCamera(), this.options.canvas.getBoundingClientRect(), n, s, t.previous, i, t.via.type === "prismatic") / t.gain;
|
|
7262
7263
|
if (t.previous.copy(i), !a) return;
|
|
7263
7264
|
const l = this.inspection.getSnapshot().jointValues[t.driver.id] ?? t.driver.defaultValue;
|
|
7264
7265
|
this.inspection.setJointValue(t.driver.id, l + a);
|
|
@@ -7287,7 +7288,7 @@ class ro {
|
|
|
7287
7288
|
}) || (this.stop(), this.inspection.select(null)));
|
|
7288
7289
|
});
|
|
7289
7290
|
var s;
|
|
7290
|
-
this.inspection = e, this.options = t, this.overlay = new
|
|
7291
|
+
this.inspection = e, this.options = t, this.overlay = new ro(e, {
|
|
7291
7292
|
canvas: t.canvas,
|
|
7292
7293
|
getCamera: t.getCamera,
|
|
7293
7294
|
requestRender: t.requestRender,
|
|
@@ -7399,7 +7400,7 @@ class ro {
|
|
|
7399
7400
|
}
|
|
7400
7401
|
}
|
|
7401
7402
|
const ye = "scene";
|
|
7402
|
-
function
|
|
7403
|
+
function oo(r, e) {
|
|
7403
7404
|
let t = null, i = null, n = null, s = null, a = null, o = null, l = null, d = null, c = null, p = null, h = null, m = null, f = null, b = null, y = null;
|
|
7404
7405
|
const v = [], g = (w) => {
|
|
7405
7406
|
const x = (w == null ? void 0 : w.getSnapshot().controlMode) === "kinematic" && w.pickRoots && w.jointWorldFrame && r.interactionCanvas && r.interactionCamera && r.setNavigationEnabled ? w : null;
|
|
@@ -7407,7 +7408,7 @@ function so(r, e) {
|
|
|
7407
7408
|
o == null || o.update();
|
|
7408
7409
|
return;
|
|
7409
7410
|
}
|
|
7410
|
-
o == null || o.dispose(), d == null || d.dispose(), o = null, d = null, l = x, x && (o = new
|
|
7411
|
+
o == null || o.dispose(), d == null || d.dispose(), o = null, d = null, l = x, x && (o = new ao(x, {
|
|
7411
7412
|
canvas: r.interactionCanvas(),
|
|
7412
7413
|
getCamera: () => r.interactionCamera(),
|
|
7413
7414
|
requestRender: () => {
|
|
@@ -7422,10 +7423,10 @@ function so(r, e) {
|
|
|
7422
7423
|
id: "nebula.ui.scene",
|
|
7423
7424
|
activate(w) {
|
|
7424
7425
|
var C, k, E, P, I, D;
|
|
7425
|
-
y = document.createElement("style"), y.dataset.viewerSceneUi = "", y.textContent =
|
|
7426
|
+
y = document.createElement("style"), y.dataset.viewerSceneUi = "", y.textContent = Ya, (C = r.shadowRoot()) == null || C.append(y), i = r.environment ? new Fa(r.theme(), r.environment, {
|
|
7426
7427
|
showBackgroundToggle: ((E = (k = e.scene) == null ? void 0 : k.parts) == null ? void 0 : E.background) !== !1,
|
|
7427
7428
|
onOpenChange: (S) => t == null ? void 0 : t.pickerChanged(S)
|
|
7428
|
-
}) : null, t =
|
|
7429
|
+
}) : null, t = Na(w, {
|
|
7429
7430
|
label: e.label("simulation"),
|
|
7430
7431
|
parts: (P = e.scene) == null ? void 0 : P.parts,
|
|
7431
7432
|
theme: r.theme(),
|
|
@@ -7436,10 +7437,10 @@ function so(r, e) {
|
|
|
7436
7437
|
openPicker: (S) => i.toggle(S)
|
|
7437
7438
|
}
|
|
7438
7439
|
} : {}
|
|
7439
|
-
}), n = new
|
|
7440
|
+
}), n = new _a(r.theme(), ((D = (I = e.scene) == null ? void 0 : I.parts) == null ? void 0 : D.scaleRuler) !== !1), s = new Ha(r.theme(), () => {
|
|
7440
7441
|
var S;
|
|
7441
7442
|
return ((S = r.getVisualDiagnostics) == null ? void 0 : S.call(r)) ?? null;
|
|
7442
|
-
}), a = new
|
|
7443
|
+
}), a = new Ja(r.theme()), c = r.mountBuiltin(t.element, { zone: "overlay", group: ye }), i && (p = r.mountBuiltin(i.element, { zone: "overlay", group: ye })), h = r.mountBuiltin(n.element, { zone: "overlay", group: ye }), m = r.mountBuiltin(s.element, { zone: "overlay", group: ye }), f = r.mountBuiltin(a.element, { zone: "overlay", group: ye }), b = r.onThemeChange((S) => {
|
|
7443
7444
|
t == null || t.themeChanged(S), i == null || i.themeChanged(S), i == null || i.reposition((t == null ? void 0 : t.environmentAnchor()) ?? null), n == null || n.themeChanged(S), s == null || s.themeChanged(S), a == null || a.themeChanged(S), o == null || o.themeChanged(S);
|
|
7444
7445
|
});
|
|
7445
7446
|
const x = () => {
|
|
@@ -7474,10 +7475,10 @@ function so(r, e) {
|
|
|
7474
7475
|
}
|
|
7475
7476
|
};
|
|
7476
7477
|
}
|
|
7477
|
-
class
|
|
7478
|
+
class lo {
|
|
7478
7479
|
constructor(e, t, i, n) {
|
|
7479
|
-
u(this, "renderer", new
|
|
7480
|
-
u(this, "scene", new
|
|
7480
|
+
u(this, "renderer", new rr());
|
|
7481
|
+
u(this, "scene", new $e());
|
|
7481
7482
|
u(this, "labels", []);
|
|
7482
7483
|
u(this, "frame", null);
|
|
7483
7484
|
u(this, "enabled", !1);
|
|
@@ -7487,7 +7488,7 @@ class ao {
|
|
|
7487
7488
|
if (s.kind !== "link" || s.visualCount === 0) continue;
|
|
7488
7489
|
const a = e.ownerDocument.createElement("div");
|
|
7489
7490
|
a.className = "vurdf-name-label", a.textContent = s.name;
|
|
7490
|
-
const o = new
|
|
7491
|
+
const o = new nr(a);
|
|
7491
7492
|
this.scene.add(o), this.labels.push({ id: s.id.slice(5), object: o });
|
|
7492
7493
|
}
|
|
7493
7494
|
}
|
|
@@ -7522,14 +7523,14 @@ class ao {
|
|
|
7522
7523
|
this.setVisible(!1), this.disposed = !0, this.scene.clear(), this.labels.length = 0;
|
|
7523
7524
|
}
|
|
7524
7525
|
}
|
|
7525
|
-
function
|
|
7526
|
+
function co(r) {
|
|
7526
7527
|
const e = r.clone().invert(), t = [new M(1, 0, 0), new M(0, 1, 0), new M(0, 0, 1)], i = ["#f3656a", "#36c978", "#4789f5"];
|
|
7527
7528
|
return `<svg viewBox="0 0 100 100" role="img" aria-label="世界坐标轴">${t.flatMap((s, a) => [-1, 1].map((o) => ({ p: s.clone().multiplyScalar(o).applyQuaternion(e), i: a, sign: o }))).sort((s, a) => s.p.z - a.p.z).map(({ p: s, i: a, sign: o }) => {
|
|
7528
7529
|
const l = 50 + s.x * 32, d = 50 - s.y * 32, c = i[a];
|
|
7529
7530
|
return `${o > 0 ? `<path d="M50 50L${l} ${d}" stroke="${c}" stroke-width="2"/>` : ""}<circle cx="${l}" cy="${d}" r="${o > 0 ? 7.5 : 4}" fill="${c}" opacity="${o > 0 ? 1 : 0.6}" stroke="none"/>${o > 0 ? `<text x="${l}" y="${d + 3}" fill="#101b24" stroke="none" text-anchor="middle" font-size="9">${"XYZ"[a]}</text>` : ""}`;
|
|
7530
7531
|
}).join("")}</svg>`;
|
|
7531
7532
|
}
|
|
7532
|
-
const
|
|
7533
|
+
const uo = {
|
|
7533
7534
|
structure: '<rect x="9" y="3" width="6" height="5" rx="1"/><rect x="2" y="16" width="6" height="5" rx="1"/><rect x="16" y="16" width="6" height="5" rx="1"/><path d="M12 8v4M5 16v-4h14v4"/>',
|
|
7534
7535
|
zoomIn: '<circle cx="10" cy="10" r="6"/><path d="m15 15 5 5M7 10h6m-3-3v6"/>',
|
|
7535
7536
|
zoomOut: '<circle cx="10" cy="10" r="6"/><path d="m15 15 5 5M7 10h6"/>',
|
|
@@ -7558,20 +7559,20 @@ const lo = {
|
|
|
7558
7559
|
moon: '<path d="M20 15.2A8 8 0 0 1 8.8 4 8.5 8.5 0 1 0 20 15.2Z"/>'
|
|
7559
7560
|
};
|
|
7560
7561
|
function W(r) {
|
|
7561
|
-
return `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${
|
|
7562
|
+
return `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${uo[r]}</svg>`;
|
|
7562
7563
|
}
|
|
7563
7564
|
function $(r) {
|
|
7564
7565
|
return r.mode === "kinematic" || r.mode === "dynamics-paused" || r.mode === "dynamics-unavailable";
|
|
7565
7566
|
}
|
|
7566
|
-
function
|
|
7567
|
+
function A(r) {
|
|
7567
7568
|
return String(r ?? "").replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """);
|
|
7568
7569
|
}
|
|
7569
|
-
function
|
|
7570
|
+
function Be(r, e = 1 / 0) {
|
|
7570
7571
|
var i, n;
|
|
7571
7572
|
const t = r.controlLimits;
|
|
7572
7573
|
return t && (Number.isFinite(t.lower) || Number.isFinite(t.upper)) ? { lower: Number.isFinite(t.lower) ? t.lower : -e, upper: Number.isFinite(t.upper) ? t.upper : e } : r.jointType === "continuous" ? { lower: -Math.PI, upper: Math.PI } : { lower: ((i = r.limits) == null ? void 0 : i.lower) ?? -e, upper: ((n = r.limits) == null ? void 0 : n.upper) ?? e };
|
|
7573
7574
|
}
|
|
7574
|
-
function
|
|
7575
|
+
function ho(r, e, t, i) {
|
|
7575
7576
|
const n = r.ownerDocument, s = n.defaultView;
|
|
7576
7577
|
let a = !1, o = 0, l = null, d = null, c = "";
|
|
7577
7578
|
const p = (E) => E.composedPath().some((P) => P instanceof s.HTMLElement && (P.matches("input,textarea,select") || P.isContentEditable)), h = () => {
|
|
@@ -7586,8 +7587,8 @@ function co(r, e, t, i) {
|
|
|
7586
7587
|
const P = e.getSnapshot(), I = P.nodes.find((V) => V.id === P.selectedEntityId && V.kind === "joint");
|
|
7587
7588
|
if (!(I != null && I.movable) || I.mimic) return;
|
|
7588
7589
|
t();
|
|
7589
|
-
const D = (L = e.jointWorldFrame) == null ? void 0 : L.call(e, I.name), S = i == null ? void 0 : i(), U = D && S && l !== null ?
|
|
7590
|
-
d = { id: I.id, name: I.name, value: P.jointValues[I.name] ?? 0, sensitivity: I.jointType === "prismatic" ? 1e-3 : 5e-3, ...
|
|
7590
|
+
const D = (L = e.jointWorldFrame) == null ? void 0 : L.call(e, I.name), S = i == null ? void 0 : i(), U = D && S && l !== null ? po(S, D, r.getBoundingClientRect(), l, o, I.jointType === "prismatic") : 1;
|
|
7591
|
+
d = { id: I.id, name: I.name, value: P.jointValues[I.name] ?? 0, sensitivity: I.jointType === "prismatic" ? 1e-3 : 5e-3, ...Be(I), direction: U }, c = r.style.cursor, r.style.cursor = "ew-resize", r.setAttribute("data-joint-adjusting", "true"), E.preventDefault();
|
|
7591
7592
|
}, b = (E) => {
|
|
7592
7593
|
E.code === "KeyR" && h();
|
|
7593
7594
|
}, y = (E) => {
|
|
@@ -7616,7 +7617,7 @@ function co(r, e, t, i) {
|
|
|
7616
7617
|
h(), k(), r.removeEventListener("pointerenter", v), r.removeEventListener("pointerleave", g), r.removeEventListener("pointermove", y, !0), r.removeEventListener("pointerdown", w, !0), n.removeEventListener("keydown", f), n.removeEventListener("keyup", b), n.removeEventListener("focusin", x), n.removeEventListener("visibilitychange", C), s.removeEventListener("blur", g);
|
|
7617
7618
|
};
|
|
7618
7619
|
}
|
|
7619
|
-
function
|
|
7620
|
+
function po(r, e, t, i, n, s) {
|
|
7620
7621
|
if (t.width <= 0 || t.height <= 0 || e.axis.lengthSq() < 1e-12) return 1;
|
|
7621
7622
|
r.updateMatrixWorld(!0);
|
|
7622
7623
|
const a = e.axis.clone().normalize(), o = r.getWorldDirection(new M()), l = new M(1, 0, 0).transformDirection(r.matrixWorld), d = new M(0, 1, 0).transformDirection(r.matrixWorld);
|
|
@@ -7624,7 +7625,7 @@ function uo(r, e, t, i, n, s) {
|
|
|
7624
7625
|
if (!s) {
|
|
7625
7626
|
const m = new lt();
|
|
7626
7627
|
m.setFromCamera(new J((i - t.left) / t.width * 2 - 1, 1 - (n - t.top) / t.height * 2), r);
|
|
7627
|
-
const f = m.ray.intersectPlane(new
|
|
7628
|
+
const f = m.ray.intersectPlane(new cn().setFromNormalAndCoplanarPoint(o, e.position), new M()), b = f ? f.sub(e.position) : new M();
|
|
7628
7629
|
c = a.clone().cross(b), Math.abs(c.dot(l)) <= Math.max(b.length(), 1e-6) * 0.05 && (c = a.clone().cross(o.clone().negate()), Math.abs(c.dot(l)) < 0.05 && (c = a.clone().cross(d.clone().negate())));
|
|
7629
7630
|
}
|
|
7630
7631
|
const p = c.dot(l);
|
|
@@ -7632,10 +7633,10 @@ function uo(r, e, t, i, n, s) {
|
|
|
7632
7633
|
const h = c.dot(d);
|
|
7633
7634
|
return Math.abs(h) > 1e-6 ? h >= 0 ? 1 : -1 : 1;
|
|
7634
7635
|
}
|
|
7635
|
-
function
|
|
7636
|
+
function Ae(r, e, t) {
|
|
7636
7637
|
return r.jointType === "prismatic" ? `${e.toFixed(3)} m` : t === "rad" ? `${e.toFixed(3)} rad` : `${(e * 180 / Math.PI).toFixed(1)}°`;
|
|
7637
7638
|
}
|
|
7638
|
-
function
|
|
7639
|
+
function mo(r, e) {
|
|
7639
7640
|
return r.jointType !== "prismatic" && e === "deg" ? 180 / Math.PI : 1;
|
|
7640
7641
|
}
|
|
7641
7642
|
function at(r, e) {
|
|
@@ -7649,21 +7650,21 @@ function at(r, e) {
|
|
|
7649
7650
|
return r;
|
|
7650
7651
|
}
|
|
7651
7652
|
function It(r, e, t, i = !1) {
|
|
7652
|
-
const { lower: n, upper: s } =
|
|
7653
|
-
return `<div class="vurdf-slider-card ${e.selectedEntityId === r.id ? "is-selected" : ""}" data-joint-card="${
|
|
7654
|
-
<div class="vurdf-slider-heading"><button class="vurdf-text-btn" data-entity="${
|
|
7655
|
-
<small>${i ? "联动控制 · " : ""}${
|
|
7656
|
-
<input type="range" aria-label="${
|
|
7657
|
-
${r.mimic ? `<small>跟随 ${
|
|
7653
|
+
const { lower: n, upper: s } = Be(r, Math.PI), a = e.jointValues[r.name] ?? 0, o = mo(r, t);
|
|
7654
|
+
return `<div class="vurdf-slider-card ${e.selectedEntityId === r.id ? "is-selected" : ""}" data-joint-card="${A(r.id)}" tabindex="0" role="group" aria-label="${A(r.name)},点击选中关节">
|
|
7655
|
+
<div class="vurdf-slider-heading"><button class="vurdf-text-btn" data-entity="${A(r.id)}">${A(r.name)}</button><output data-joint-readout="${A(r.name)}">${Ae(r, a, t)}</output></div>
|
|
7656
|
+
<small>${i ? "联动控制 · " : ""}${A(r.parentLink)} → ${A(r.childLink)}</small>
|
|
7657
|
+
<input type="range" aria-label="${A(r.name)}${i ? " 联动控制" : " 位置"}" data-control-joint="${A(r.name)}" data-display-factor="${o}" min="${n * o}" max="${s * o}" step="any" value="${a * o}" ${!$(e) || r.mimic ? "disabled" : ""}>
|
|
7658
|
+
${r.mimic ? `<small>跟随 ${A(r.mimic.joint)} × ${r.mimic.multiplier} + ${Ae(r, r.mimic.offset, t)}</small>` : ""}
|
|
7658
7659
|
</div>`;
|
|
7659
7660
|
}
|
|
7660
|
-
function
|
|
7661
|
+
function Oi(r, e, t) {
|
|
7661
7662
|
const i = e.nodes.filter((o) => o.kind === "joint"), n = r.kind === "joint" ? r : i.find((o) => o.childLink === r.name);
|
|
7662
7663
|
if (!n) return "";
|
|
7663
7664
|
const s = at(n, i), a = i.filter((o) => o.mimic && at(o, i).name === s.name);
|
|
7664
|
-
return a.length ? `<section class="vurdf-section"><div class="vurdf-section-head"><strong>联动约束 · ${a.length + 1} 个关节</strong></div>${It(s, e, t, !0)}<p class="vurdf-control-hint">${a.map((o) =>
|
|
7665
|
+
return a.length ? `<section class="vurdf-section"><div class="vurdf-section-head"><strong>联动约束 · ${a.length + 1} 个关节</strong></div>${It(s, e, t, !0)}<p class="vurdf-control-hint">${a.map((o) => A(o.name)).join(" · ")}</p></section>` : "";
|
|
7665
7666
|
}
|
|
7666
|
-
function
|
|
7667
|
+
function fo(r, e, t) {
|
|
7667
7668
|
const i = r.nodes.filter((c) => c.kind === "joint"), n = /* @__PURE__ */ new Map();
|
|
7668
7669
|
for (const c of i) n.set(c.parentLink, [...n.get(c.parentLink) ?? [], c]);
|
|
7669
7670
|
const s = new Set(i.map((c) => c.childLink)), a = /* @__PURE__ */ new Set(), o = [], l = (c) => {
|
|
@@ -7686,13 +7687,13 @@ function po(r, e, t) {
|
|
|
7686
7687
|
const d = e.trim().toLowerCase();
|
|
7687
7688
|
return o.filter((c) => c.some((p) => `${p.name} ${p.parentLink} ${p.childLink}`.toLowerCase().includes(d))).map((c) => {
|
|
7688
7689
|
const p = [...new Set(c.map((h) => at(h, i)))].filter((h) => i.some((m) => m.mimic && at(m, i).name === h.name));
|
|
7689
|
-
return `<section class="vurdf-joint-group"><h3>${
|
|
7690
|
+
return `<section class="vurdf-joint-group"><h3>${A(c[0].parentLink)} → ${A(c[c.length - 1].childLink)}</h3>${p.filter((h) => !c.includes(h)).map((h) => It(h, r, t, !0)).join("")}${c.map((h) => It(h, r, t, p.includes(h))).join("")}</section>`;
|
|
7690
7691
|
}).join("") || '<div class="vurdf-empty">没有符合筛选条件的可动关节。</div>';
|
|
7691
7692
|
}
|
|
7692
|
-
function
|
|
7693
|
+
function vo(r) {
|
|
7693
7694
|
return `<button class="vurdf-tool" data-angle-unit aria-label="切换弧度和角度" title="切换所有关节的显示单位" aria-pressed="${r === "deg"}">${W("angleUnit")}<span>${r === "rad" ? "rad" : "°"}</span></button>`;
|
|
7694
7695
|
}
|
|
7695
|
-
class
|
|
7696
|
+
class go {
|
|
7696
7697
|
constructor(e, t, i) {
|
|
7697
7698
|
u(this, "element", document.createElement("aside"));
|
|
7698
7699
|
u(this, "root", document.createElement("div"));
|
|
@@ -7721,9 +7722,9 @@ class fo {
|
|
|
7721
7722
|
const t = new Set(e.issues.map((d) => d.entityId)), i = this.root.querySelector(".vurdf-tree"), n = { top: (i == null ? void 0 : i.scrollTop) ?? 0, left: (i == null ? void 0 : i.scrollLeft) ?? 0 }, s = this.root.getRootNode().activeElement, a = s && (i != null && i.contains(s)) ? s.dataset.entity : void 0;
|
|
7722
7723
|
this.root.innerHTML = `
|
|
7723
7724
|
<div class="vurdf-head"><div><strong>URDF模型结构</strong><span>${e.nodes.filter((d) => d.kind === "link").length} Links · ${e.nodes.filter((d) => d.kind === "joint").length} Joints</span></div><button class="vurdf-diagram-open" data-open-diagram title="打开结构图" aria-label="打开结构图">${W("structure")}</button></div>
|
|
7724
|
-
<label class="vurdf-search">${W("search")}<input aria-label="搜索模型结构" placeholder="搜索 Link 或 Joint" value="${
|
|
7725
|
+
<label class="vurdf-search">${W("search")}<input aria-label="搜索模型结构" placeholder="搜索 Link 或 Joint" value="${A(this.query)}"></label>
|
|
7725
7726
|
<div class="vurdf-filters">${xt("all", "全部", this.filter)}${xt("movable", "可动关节", this.filter)}${xt("errors", `错误 ${e.issues.length}`, this.filter)}</div>
|
|
7726
|
-
<div class="vurdf-tree" role="${this.filter === "movable" ? "region" : "tree"}">${this.filter === "movable" ?
|
|
7727
|
+
<div class="vurdf-tree" role="${this.filter === "movable" ? "region" : "tree"}">${this.filter === "movable" ? fo(e, this.query, this.angleUnit) : bo(e, t, this.filter, this.query, this.collapsed, this.angleUnit)}</div>
|
|
7727
7728
|
`, this.bind(e), this.setDiagramOpen(this.diagramOpen);
|
|
7728
7729
|
const o = this.root.querySelector(".vurdf-tree");
|
|
7729
7730
|
o && (o.scrollTop = n.top, o.scrollLeft = n.left, a && ((l = Array.from(o.querySelectorAll("[data-entity]")).find((d) => d.dataset.entity === a)) == null || l.focus({ preventScroll: !0 })));
|
|
@@ -7791,7 +7792,7 @@ class fo {
|
|
|
7791
7792
|
t.value = String(i * Number(t.dataset.displayFactor ?? 1));
|
|
7792
7793
|
}), this.root.querySelectorAll("[data-joint-readout]").forEach((t) => {
|
|
7793
7794
|
const i = e.nodes.find((n) => n.kind === "joint" && n.name === t.dataset.jointReadout);
|
|
7794
|
-
i && (t.textContent =
|
|
7795
|
+
i && (t.textContent = Ae(i, e.jointValues[i.name] ?? 0, this.angleUnit));
|
|
7795
7796
|
});
|
|
7796
7797
|
}
|
|
7797
7798
|
bindListSliders(e) {
|
|
@@ -7809,7 +7810,7 @@ class fo {
|
|
|
7809
7810
|
});
|
|
7810
7811
|
}
|
|
7811
7812
|
}
|
|
7812
|
-
function
|
|
7813
|
+
function bo(r, e, t, i, n, s) {
|
|
7813
7814
|
const a = new Map(r.nodes.map((p) => [p.id, p])), o = i.trim().toLowerCase(), l = o.length > 0 || t !== "all", d = (p) => {
|
|
7814
7815
|
const h = !o || p.name.toLowerCase().includes(o), m = t === "all" || t === "movable" && p.kind === "joint" && p.movable || t === "errors" && e.has(p.id);
|
|
7815
7816
|
return h && m;
|
|
@@ -7819,12 +7820,12 @@ function vo(r, e, t, i, n, s) {
|
|
|
7819
7820
|
if (!f) return { html: "", matched: !1 };
|
|
7820
7821
|
const b = new Set(m).add(p), y = f.childIds.map((E) => c(E, h + 1, b));
|
|
7821
7822
|
if (!(d(f) || y.some((E) => E.matched))) return { html: "", matched: !1 };
|
|
7822
|
-
const g = y.some((E) => E.matched), w = !l && n.has(f.id), x = f.kind === "joint" ? f.jointType : f.kind, C = f.kind === "joint" && f.movable ? `${
|
|
7823
|
-
<button class="vurdf-tree-toggle ${g ? "" : "is-placeholder"} ${w ? "" : "is-open"}" data-tree-toggle="${
|
|
7824
|
-
<button class="vurdf-row ${r.selectedEntityId === f.id ? "is-selected" : ""} ${e.has(f.id) ? "has-error" : ""}" data-entity="${
|
|
7823
|
+
const g = y.some((E) => E.matched), w = !l && n.has(f.id), x = f.kind === "joint" ? f.jointType : f.kind, C = f.kind === "joint" && f.movable ? `${Ae(f, r.jointValues[f.name] ?? 0, s)}` : "", k = `<div class="vurdf-tree-item" style="--depth:${h}" role="treeitem" aria-expanded="${g ? String(!w) : "false"}">
|
|
7824
|
+
<button class="vurdf-tree-toggle ${g ? "" : "is-placeholder"} ${w ? "" : "is-open"}" data-tree-toggle="${A(f.id)}" ${g ? "" : "disabled"} aria-label="${w ? "展开" : "折叠"} ${A(f.name)}">${W("chevron")}</button>
|
|
7825
|
+
<button class="vurdf-row ${r.selectedEntityId === f.id ? "is-selected" : ""} ${e.has(f.id) ? "has-error" : ""}" data-entity="${A(f.id)}">
|
|
7825
7826
|
${W(f.kind === "robot" ? "robot" : f.kind === "joint" ? "joint" : "link")}
|
|
7826
|
-
<span class="vurdf-node-copy"><b title="${
|
|
7827
|
-
${e.has(f.id) ? '<span class="vurdf-node-error">!</span>' : `<span class="vurdf-node-value" ${f.kind === "joint" ? `data-joint-readout="${
|
|
7827
|
+
<span class="vurdf-node-copy"><b title="${A(f.name)}">${A(f.name)}</b><small>${A(x)}</small></span>
|
|
7828
|
+
${e.has(f.id) ? '<span class="vurdf-node-error">!</span>' : `<span class="vurdf-node-value" ${f.kind === "joint" ? `data-joint-readout="${A(f.name)}"` : ""}>${C}</span>`}
|
|
7828
7829
|
</button>
|
|
7829
7830
|
</div>`;
|
|
7830
7831
|
return { html: `<div class="vurdf-branch ${w ? "is-collapsed" : ""}">${k}<div class="vurdf-children" ${w ? "inert" : ""}><div>${y.map((E) => E.html).join("")}</div></div></div>`, matched: !0 };
|
|
@@ -7834,8 +7835,8 @@ function vo(r, e, t, i, n, s) {
|
|
|
7834
7835
|
function xt(r, e, t) {
|
|
7835
7836
|
return `<button class="vurdf-chip ${r === t ? "is-active" : ""}" data-filter="${r}">${e}</button>`;
|
|
7836
7837
|
}
|
|
7837
|
-
const
|
|
7838
|
-
class
|
|
7838
|
+
const yo = 1800;
|
|
7839
|
+
class xo {
|
|
7839
7840
|
constructor(e) {
|
|
7840
7841
|
u(this, "element", document.createElement("aside"));
|
|
7841
7842
|
u(this, "root", document.createElement("div"));
|
|
@@ -7873,9 +7874,9 @@ class bo {
|
|
|
7873
7874
|
a.open ? this.expandedInertia.add(o) : this.expandedInertia.delete(o);
|
|
7874
7875
|
}), this.root.innerHTML = `
|
|
7875
7876
|
<nav class="vurdf-tabs">${wt("properties", "属性", this.tab)}${wt("source", "XML", this.tab)}${wt("issues", `错误${e.issues.length ? ` <em>${e.issues.length}</em>` : ""}`, this.tab)}</nav>
|
|
7876
|
-
<section class="vurdf-pane ${this.tab === "properties" ? "is-active" : ""}" data-pane="properties">${t ?
|
|
7877
|
-
<section class="vurdf-pane ${this.tab === "source" ? "is-active" : ""}" data-pane="source">${this.tab === "source" ?
|
|
7878
|
-
<section class="vurdf-pane ${this.tab === "issues" ? "is-active" : ""}" data-pane="issues">${
|
|
7877
|
+
<section class="vurdf-pane ${this.tab === "properties" ? "is-active" : ""}" data-pane="properties">${t ? wo(t, e, ((i = this.sweep) == null ? void 0 : i.jointName) === t.name, this.angleUnit, this.expandedInertia) : ko()}</section>
|
|
7878
|
+
<section class="vurdf-pane ${this.tab === "source" ? "is-active" : ""}" data-pane="source">${this.tab === "source" ? Co(e, t) : ""}</section>
|
|
7879
|
+
<section class="vurdf-pane ${this.tab === "issues" ? "is-active" : ""}" data-pane="issues">${Eo(e)}</section>
|
|
7879
7880
|
`, this.bind(e), this.tab === "source" && ((s = (n = this.root.querySelector(".vurdf-source .line.is-selected")) == null ? void 0 : n.scrollIntoView) == null || s.call(n, { block: "center" }));
|
|
7880
7881
|
}
|
|
7881
7882
|
dispose() {
|
|
@@ -7937,7 +7938,7 @@ class bo {
|
|
|
7937
7938
|
this.syncJointInputs(this.inspection.getSnapshot().jointValues[t.name] ?? 0);
|
|
7938
7939
|
return;
|
|
7939
7940
|
}
|
|
7940
|
-
const { lower: b, upper: y } =
|
|
7941
|
+
const { lower: b, upper: y } = Be(t);
|
|
7941
7942
|
n(Math.max(b, Math.min(y, f)));
|
|
7942
7943
|
}), this.root.querySelectorAll("[data-joint-value]").forEach((h) => h.addEventListener("click", () => n(Number(h.dataset.jointValue)))), (c = this.root.querySelector("[data-reset-joint]")) == null || c.addEventListener("click", () => {
|
|
7943
7944
|
$(this.inspection.getSnapshot()) && (this.stopSweep(!1), this.inspection.resetJoint(t.name));
|
|
@@ -7952,7 +7953,7 @@ class bo {
|
|
|
7952
7953
|
t.value = String(i * Number(t.dataset.displayFactor ?? 1));
|
|
7953
7954
|
}), this.root.querySelectorAll("[data-joint-readout]").forEach((t) => {
|
|
7954
7955
|
const i = e.nodes.find((n) => n.kind === "joint" && n.name === t.dataset.jointReadout);
|
|
7955
|
-
i && (t.textContent =
|
|
7956
|
+
i && (t.textContent = Ae(i, e.jointValues[i.name] ?? 0, this.angleUnit));
|
|
7956
7957
|
});
|
|
7957
7958
|
}
|
|
7958
7959
|
bindListSliders(e) {
|
|
@@ -7982,10 +7983,10 @@ class bo {
|
|
|
7982
7983
|
}
|
|
7983
7984
|
startSweep(e, t) {
|
|
7984
7985
|
this.stopSweep(!1), this.sweep = { jointName: e.name, initial: t, startedAt: Date.now(), timer: null };
|
|
7985
|
-
const { lower: i, upper: n } =
|
|
7986
|
+
const { lower: i, upper: n } = Be(e, Math.PI), s = () => {
|
|
7986
7987
|
const a = this.sweep;
|
|
7987
7988
|
if (!a || a.jointName !== e.name || this.disposed || !$(this.inspection.getSnapshot())) return;
|
|
7988
|
-
const o = Math.min(1, (Date.now() - a.startedAt) /
|
|
7989
|
+
const o = Math.min(1, (Date.now() - a.startedAt) / yo), l = o < 0.5 ? o * 2 : (1 - o) * 2;
|
|
7989
7990
|
if (this.inspection.setJointValue(e.name, i + (n - i) * l), o >= 1) {
|
|
7990
7991
|
const d = a.initial;
|
|
7991
7992
|
this.sweep = null, this.inspection.setJointValue(e.name, d);
|
|
@@ -8000,35 +8001,35 @@ class bo {
|
|
|
8000
8001
|
t && (t.timer !== null && clearTimeout(t.timer), this.sweep = null, e && !this.disposed && this.inspection.setJointValue(t.jointName, t.initial));
|
|
8001
8002
|
}
|
|
8002
8003
|
}
|
|
8003
|
-
function
|
|
8004
|
+
function wo(r, e, t, i, n) {
|
|
8004
8005
|
var s, a;
|
|
8005
8006
|
if (r.kind === "joint") {
|
|
8006
|
-
const o = e.nodes.find((b) => b.kind === "link" && b.id === `link:${r.childLink}`), l = e.jointValues[r.name] ?? 0, { lower: d, upper: c } =
|
|
8007
|
+
const o = e.nodes.find((b) => b.kind === "link" && b.id === `link:${r.childLink}`), l = e.jointValues[r.name] ?? 0, { lower: d, upper: c } = Be(r, Math.PI), p = Dt(r, i), h = r.jointType === "prismatic" ? "m" : i === "deg" ? "°" : "rad", m = `<span class="vurdf-unit-label">${h}</span>`, f = r.mimic ? `<section class="vurdf-section vurdf-follower"><div class="vurdf-section-head"><strong>从属关节</strong>${m}<span class="vurdf-readonly-badge">只读 · 自动跟随</span></div><output class="vurdf-follower-value" data-joint-readout="${A(r.name)}">${Ae(r, l, i)}</output><div class="vurdf-follower-source"><span>主控关节</span><button class="vurdf-text-btn" data-entity="joint:${A(r.mimic.joint)}">${A(r.mimic.joint)}</button></div></section>` : r.movable ? `<fieldset class="vurdf-section vurdf-joint-controls" ${$(e) ? "" : "disabled"}>
|
|
8007
8008
|
<div class="vurdf-section-head"><strong>关节</strong>${m}<span class="vurdf-section-actions"><button class="vurdf-text-btn ${t ? "is-active" : ""}" data-sweep-joint>${t ? "停止扫描" : "扫描范围"}</button><button class="vurdf-text-btn" data-reset-joint>重置</button></span></div>
|
|
8008
8009
|
<div class="vurdf-value"><input data-joint-range aria-label="关节位置" type="range" min="${d * p}" max="${c * p}" step="${p === 1 ? 1e-3 : 0.1}" value="${l * p}"><input data-joint-number aria-label="关节位置精确值" type="number" step="0.001" value="${(l * p).toFixed(3)}"></div>
|
|
8009
8010
|
<div class="vurdf-quick"><span>${(d * p).toFixed(2)} ${h}</span><button data-joint-value="${d}">下限</button><button data-joint-value="0">零位</button><button data-joint-value="${c}">上限</button><span>${(c * p).toFixed(2)} ${h}</span></div>
|
|
8010
8011
|
${$(e) ? "" : '<p class="vurdf-control-hint">仿真运行期间只读,暂停后可选中部件并调整关节。</p>'}
|
|
8011
8012
|
</fieldset>` : '<div class="vurdf-section"><div class="vurdf-empty">固定关节不可调节。</div></div>';
|
|
8012
|
-
return `<div class="vurdf-entity"><label>${
|
|
8013
|
+
return `<div class="vurdf-entity"><label>${A(r.jointType.toUpperCase())} JOINT</label><h2>${A(r.name)}</h2><p>${A(r.parentLink)} → ${A(r.childLink)}</p></div>${f}${Oi(r, e, i)}<div class="vurdf-section"><div class="vurdf-section-head"><strong>变换与轴</strong><span>m / rad</span></div><dl class="vurdf-data"><dt>关节原点 XYZ</dt><dd>${r.originPosition.map(Ct).join(" ")}</dd><dt>关节原点 RPY</dt><dd>${r.originRotationRpy.map(Ct).join(" ")}</dd><dt>Axis xyz</dt><dd>${r.axis.map(Ct).join(" ")}</dd><dt>Lower</dt><dd>${((s = r.limits) == null ? void 0 : s.lower) ?? "—"}</dd><dt>Upper</dt><dd>${((a = r.limits) == null ? void 0 : a.upper) ?? "—"}</dd><dt>Effort</dt><dd>${r.effort ?? "—"}</dd><dt>Velocity</dt><dd>${r.velocity ?? "—"}</dd></dl></div>${o ? Fi(o, !0, n.has(o.id)) : ""}`;
|
|
8013
8014
|
}
|
|
8014
|
-
return r.kind === "link" ? `<div class="vurdf-entity"><label>LINK</label><h2>${
|
|
8015
|
+
return r.kind === "link" ? `<div class="vurdf-entity"><label>LINK</label><h2>${A(r.name)}</h2><p>${r.visualCount} Visual · ${r.collisionCount} Collision</p></div>${Oi(r, e, i)}${Fi(r, !1, n.has(r.id))}` : `<div class="vurdf-entity"><label>ROBOT</label><h2>${A(r.name)}</h2><p>${r.rootLinkIds.length} root link</p></div>`;
|
|
8015
8016
|
}
|
|
8016
8017
|
function Lt(r) {
|
|
8017
8018
|
if (r === void 0) return "<span>—</span>";
|
|
8018
8019
|
const e = String(r), t = Number.isFinite(r) ? String(Number(r.toPrecision(6))) : e;
|
|
8019
8020
|
return `<button type="button" class="vurdf-source-number" data-copy-number="${e}" title="${e} · 点击复制完整数值" aria-label="复制完整数值 ${e}">${t}</button>`;
|
|
8020
8021
|
}
|
|
8021
|
-
function
|
|
8022
|
+
function ji(r, e, t, i) {
|
|
8022
8023
|
return `<div class="vurdf-vector"><div class="vurdf-vector-title">${r}<span>${i}</span></div><dl>${e.map((n, s) => `<div><dt>${n}</dt><dd>${Lt(t == null ? void 0 : t[s])}</dd></div>`).join("")}</dl></div>`;
|
|
8023
8024
|
}
|
|
8024
|
-
function
|
|
8025
|
+
function Fi(r, e, t) {
|
|
8025
8026
|
return `<section class="vurdf-section" data-link-inertial>
|
|
8026
|
-
<div class="vurdf-section-head vurdf-component-title"><strong>${e ? "子部件" : "部件属性"} · ${
|
|
8027
|
+
<div class="vurdf-section-head vurdf-component-title"><strong>${e ? "子部件" : "部件属性"} · ${A(r.name)}</strong></div>
|
|
8027
8028
|
<dl class="vurdf-data"><dt>质量 (kg)</dt><dd>${Lt(r.mass)}</dd></dl>
|
|
8028
8029
|
<div class="vurdf-inertial-frame">惯性原点 · 相对于 Link</div>
|
|
8029
|
-
${
|
|
8030
|
-
${
|
|
8031
|
-
<details class="vurdf-inertia-details" data-inertia-details="${
|
|
8030
|
+
${ji("质心位置", ["X", "Y", "Z"], r.centerOfMass, "m")}
|
|
8031
|
+
${ji("惯性坐标系旋转", ["R", "P", "Y"], r.inertialRotationRpy, "rad")}
|
|
8032
|
+
<details class="vurdf-inertia-details" data-inertia-details="${A(r.id)}" ${t ? "open" : ""}>
|
|
8032
8033
|
<summary>${W("chevron")}<strong>惯性张量</strong><span>kg·m²</span></summary>
|
|
8033
8034
|
<div class="vurdf-inertial-frame">关于质心 · 惯性坐标系</div>
|
|
8034
8035
|
<dl class="vurdf-data">${["Ixx", "Iyy", "Izz", "Ixy", "Ixz", "Iyz"].map((i, n) => {
|
|
@@ -8038,30 +8039,30 @@ function ji(r, e, t) {
|
|
|
8038
8039
|
</details>
|
|
8039
8040
|
</section>`;
|
|
8040
8041
|
}
|
|
8041
|
-
function
|
|
8042
|
+
function Co(r, e) {
|
|
8042
8043
|
var s, a;
|
|
8043
8044
|
const t = r.sourceText.split(/\r?\n/), i = ((s = e == null ? void 0 : e.source) == null ? void 0 : s.startLine) ?? 0, n = ((a = e == null ? void 0 : e.source) == null ? void 0 : a.endLine) ?? 0;
|
|
8044
|
-
return `<pre class="vurdf-source"><code>${t.map((o, l) => `<span class="line ${e && l + 1 >= i && l + 1 <= n ? "is-selected" : ""}"><span class="ln">${l + 1}</span>${
|
|
8045
|
+
return `<pre class="vurdf-source"><code>${t.map((o, l) => `<span class="line ${e && l + 1 >= i && l + 1 <= n ? "is-selected" : ""}"><span class="ln">${l + 1}</span>${So(o)}</span>`).join("")}</code></pre>`;
|
|
8045
8046
|
}
|
|
8046
|
-
function
|
|
8047
|
-
return r.issues.length ? r.issues.map((e) => `<button class="vurdf-issue" data-issue-entity="${
|
|
8047
|
+
function Eo(r) {
|
|
8048
|
+
return r.issues.length ? r.issues.map((e) => `<button class="vurdf-issue" data-issue-entity="${A(e.entityId)}">${W("error")}<span><b>${A(e.title)}</b><small>${A(e.message)}</small></span></button>`).join("") : '<div class="vurdf-empty">所有严格结构与数学检查通过。</div>';
|
|
8048
8049
|
}
|
|
8049
8050
|
function wt(r, e, t) {
|
|
8050
8051
|
return `<button class="vurdf-tab ${r === t ? "is-active" : ""}" data-tab="${r}">${e}</button>`;
|
|
8051
8052
|
}
|
|
8052
|
-
function
|
|
8053
|
+
function ko() {
|
|
8053
8054
|
return '<div class="vurdf-empty vurdf-no-selection">点击模型或结构树选择部件;点击场景空白处可取消选择。</div>';
|
|
8054
8055
|
}
|
|
8055
8056
|
function Ct(r) {
|
|
8056
8057
|
return r.toFixed(3);
|
|
8057
8058
|
}
|
|
8058
|
-
function
|
|
8059
|
-
return
|
|
8059
|
+
function So(r) {
|
|
8060
|
+
return A(r).replace(/(<\/?[\w:-]+)/g, '<span class="tag">$1</span>').replace(/([\w:-]+)=(".*?")/g, '<span class="attr">$1</span>=<span class="str">$2</span>');
|
|
8060
8061
|
}
|
|
8061
8062
|
function Dt(r, e) {
|
|
8062
8063
|
return r.jointType !== "prismatic" && e === "deg" ? 180 / Math.PI : 1;
|
|
8063
8064
|
}
|
|
8064
|
-
function
|
|
8065
|
+
function Po(r) {
|
|
8065
8066
|
const e = new Map(r.nodes.map((o) => [o.id, o])), t = /* @__PURE__ */ new Set(), i = [], n = [];
|
|
8066
8067
|
let s = 0;
|
|
8067
8068
|
const a = (o, l) => {
|
|
@@ -8080,7 +8081,7 @@ function ko(r) {
|
|
|
8080
8081
|
for (const o of r.nodes) t.has(o.id) || a(o.id, 0);
|
|
8081
8082
|
return { nodes: i, edges: n, width: Math.max(200, s * 210), height: Math.max(90, ...i.map((o) => o.y + 45)) };
|
|
8082
8083
|
}
|
|
8083
|
-
class
|
|
8084
|
+
class Mo {
|
|
8084
8085
|
constructor(e, t, i = () => {
|
|
8085
8086
|
}) {
|
|
8086
8087
|
u(this, "element", document.createElement("section"));
|
|
@@ -8183,7 +8184,7 @@ class So {
|
|
|
8183
8184
|
if (this.snapshot = e, !this.opened) return;
|
|
8184
8185
|
if (this.modelNodes !== e.nodes) {
|
|
8185
8186
|
this.modelNodes = e.nodes;
|
|
8186
|
-
const i =
|
|
8187
|
+
const i = Po(e);
|
|
8187
8188
|
this.bounds = i;
|
|
8188
8189
|
const n = new Map(i.nodes.map((s) => [s.node.id, s]));
|
|
8189
8190
|
this.graph.innerHTML = i.edges.map((s) => {
|
|
@@ -8230,7 +8231,7 @@ class So {
|
|
|
8230
8231
|
this.graph.setAttribute("transform", `translate(${this.x} ${this.y}) scale(${this.scale})`);
|
|
8231
8232
|
}
|
|
8232
8233
|
}
|
|
8233
|
-
class
|
|
8234
|
+
class Ro {
|
|
8234
8235
|
constructor(e, t, i, n, s) {
|
|
8235
8236
|
u(this, "namesVisible", !1);
|
|
8236
8237
|
u(this, "element", document.createElement("div"));
|
|
@@ -8241,19 +8242,19 @@ class Po {
|
|
|
8241
8242
|
this.theme = t;
|
|
8242
8243
|
const n = !e.dynamicsAvailable || e.mode === "dynamics-initializing", s = e.dynamicsMessage ?? (e.dynamicsAvailable ? "点击后初始化并启动 MuJoCo 动力学仿真" : "该 URDF 未声明动力学仿真所需的惯性数据。");
|
|
8243
8244
|
this.root.innerHTML = `
|
|
8244
|
-
${
|
|
8245
|
-
${
|
|
8246
|
-
${
|
|
8247
|
-
${
|
|
8245
|
+
${Xe("collision", "碰撞", e.overlays.collision, "collision")}
|
|
8246
|
+
${Xe("jointAxis", "关节轴", e.overlays.jointAxis, "axis")}
|
|
8247
|
+
${Xe("centerOfMass", "质心", e.overlays.centerOfMass, "centerOfMass")}
|
|
8248
|
+
${Xe("inertia", "惯量", e.overlays.inertia === !0, "inertia")}
|
|
8248
8249
|
<button class="vurdf-tool ${this.namesVisible ? "is-active" : ""}" data-name-labels aria-pressed="${this.namesVisible}" title="显示/隐藏部件名称">${W("names")}名称</button>
|
|
8249
|
-
${e.nodes.some((a) => a.kind === "joint" && a.movable && a.jointType !== "prismatic") ?
|
|
8250
|
+
${e.nodes.some((a) => a.kind === "joint" && a.movable && a.jointType !== "prismatic") ? vo(i) : ""}
|
|
8250
8251
|
<span class="vurdf-tool-divider" aria-hidden="true"></span>
|
|
8251
|
-
${
|
|
8252
|
-
${
|
|
8253
|
-
${
|
|
8252
|
+
${Ke("ground", zi(this.ctx) ? "隐藏地面" : "显示地面", zi(this.ctx), "ground")}
|
|
8253
|
+
${Ke("fit", "适应视图", !1, "fit")}
|
|
8254
|
+
${Ke("theme", this.theme === "dark" ? "浅色主题" : "深色主题", !1, this.theme === "dark" ? "sun" : "moon")}
|
|
8254
8255
|
<span class="vurdf-tool-divider" aria-hidden="true"></span>
|
|
8255
|
-
${
|
|
8256
|
-
${
|
|
8256
|
+
${Ao(e, n, s)}
|
|
8257
|
+
${Ke("reset", "重置", !1, "reset")}
|
|
8257
8258
|
`, this.bind(e);
|
|
8258
8259
|
}
|
|
8259
8260
|
dispose() {
|
|
@@ -8279,57 +8280,57 @@ class Po {
|
|
|
8279
8280
|
});
|
|
8280
8281
|
}
|
|
8281
8282
|
}
|
|
8282
|
-
function
|
|
8283
|
+
function Xe(r, e, t, i) {
|
|
8283
8284
|
return `<button class="vurdf-tool ${t ? "is-active" : ""}" data-overlay="${r}" data-active="${t}" aria-pressed="${t}">${W(i)}${e}</button>`;
|
|
8284
8285
|
}
|
|
8285
|
-
function
|
|
8286
|
+
function Ke(r, e, t, i) {
|
|
8286
8287
|
const n = r === "ground" ? ` aria-pressed="${t}"` : "";
|
|
8287
8288
|
return `<button class="vurdf-tool ${t ? "is-active" : ""}" data-scene-tool="${r}"${n} title="${e}" aria-label="${e}">${W(i)}${r === "reset" ? e : ""}</button>`;
|
|
8288
8289
|
}
|
|
8289
|
-
function
|
|
8290
|
+
function Ao(r, e, t) {
|
|
8290
8291
|
const i = r.mode === "dynamics-running", n = i ? "暂停仿真" : r.mode === "dynamics-initializing" ? "启动中" : "启动仿真";
|
|
8291
|
-
return `<button class="vurdf-tool vurdf-dynamics ${i ? "is-active" : ""}" data-mode="dynamics" ${e ? "disabled" : ""} title="${
|
|
8292
|
+
return `<button class="vurdf-tool vurdf-dynamics ${i ? "is-active" : ""}" data-mode="dynamics" ${e ? "disabled" : ""} title="${A(t)}">${W(i ? "pause" : "play")}${n}</button>`;
|
|
8292
8293
|
}
|
|
8293
|
-
function
|
|
8294
|
+
function zi(r) {
|
|
8294
8295
|
return r.asset.$readControl().groundVisible;
|
|
8295
8296
|
}
|
|
8296
|
-
class
|
|
8297
|
+
class Io {
|
|
8297
8298
|
constructor() {
|
|
8298
8299
|
u(this, "element", document.createElement("footer"));
|
|
8299
8300
|
this.element.className = "vurdf-status";
|
|
8300
8301
|
}
|
|
8301
8302
|
update(e) {
|
|
8302
8303
|
const t = e.nodes.find((i) => i.id === e.selectedEntityId) ?? null;
|
|
8303
|
-
this.element.innerHTML = `<span>模型已就绪</span><span title="${
|
|
8304
|
+
this.element.innerHTML = `<span>模型已就绪</span><span title="${A(e.sourcePath)}">${A(e.sourcePath)}</span><span>选择:${t ? A(t.name) : "无"}</span>${(t == null ? void 0 : t.kind) === "joint" && t.movable && $(e) ? '<span class="vurdf-gesture-hint" title="选中可动关节,将鼠标移入场景,按住 R 左右移动调节,松开 R 结束。运行仿真时不可用。">按住 R + 鼠标左右移动</span>' : ""}<span class="spacer"></span><span>Z-Up</span><span>m / kg / s</span><span>${Lo(e.mode)}</span><span class="${e.issues.length ? "vurdf-status-error" : "vurdf-status-ok"}">${e.issues.length ? `${e.issues.length} 个错误` : "严格检查通过"}</span>`;
|
|
8304
8305
|
}
|
|
8305
8306
|
dispose() {
|
|
8306
8307
|
this.element.remove();
|
|
8307
8308
|
}
|
|
8308
8309
|
}
|
|
8309
|
-
function
|
|
8310
|
+
function Lo(r) {
|
|
8310
8311
|
return r === "kinematic" ? "运动学预览模式" : r === "dynamics-running" ? "动力学仿真运行中" : r === "dynamics-paused" ? "动力学仿真已暂停" : r === "dynamics-initializing" ? "正在初始化动力学" : "动力学仿真未启动";
|
|
8311
8312
|
}
|
|
8312
|
-
class
|
|
8313
|
+
class Do {
|
|
8313
8314
|
constructor(e, t, i, n, s, a, o) {
|
|
8314
8315
|
u(this, "diagram");
|
|
8315
8316
|
u(this, "structure");
|
|
8316
8317
|
u(this, "inspector");
|
|
8317
8318
|
u(this, "toolbar");
|
|
8318
|
-
u(this, "statusbar", new
|
|
8319
|
+
u(this, "statusbar", new Io());
|
|
8319
8320
|
u(this, "gizmo", document.createElement("div"));
|
|
8320
8321
|
u(this, "disposed", !1);
|
|
8321
8322
|
u(this, "angleUnit", "rad");
|
|
8322
8323
|
u(this, "nameLabels", null);
|
|
8323
8324
|
u(this, "pointerCleanup", null);
|
|
8324
8325
|
u(this, "resizeCleanup", null);
|
|
8325
|
-
this.root = e, this.inspection = t, this.theme = n, this.cameraQuaternion = s, this.structure = new
|
|
8326
|
+
this.root = e, this.inspection = t, this.theme = n, this.cameraQuaternion = s, this.structure = new go(t, () => this.diagram.open(), (l) => this.inspector.stopSweep(l)), this.inspector = new xo(t), this.toolbar = new Ro(t, i, n, (l) => {
|
|
8326
8327
|
var d;
|
|
8327
8328
|
return (d = this.nameLabels) == null ? void 0 : d.setVisible(l);
|
|
8328
8329
|
}, () => {
|
|
8329
8330
|
this.angleUnit = this.angleUnit === "rad" ? "deg" : "rad", this.render(this.inspection.getSnapshot());
|
|
8330
|
-
}), this.diagram = new
|
|
8331
|
+
}), this.diagram = new Mo((l) => this.selectFromScene(l), () => {
|
|
8331
8332
|
this.structure.setDiagramOpen(!1), this.structure.focusDiagramButton();
|
|
8332
|
-
}, () => this.structure.setDiagramOpen(!0)), this.gizmo.className = "vurdf-gizmo", this.gizmo.setAttribute("aria-label", "坐标轴方向"), this.root.append(this.structure.element, this.gizmo, this.toolbar.element, this.inspector.element, this.statusbar.element, this.diagram.element), this.bindSidebar("left"), this.bindSidebar("right"), a && o && (this.nameLabels = new
|
|
8333
|
+
}, () => this.structure.setDiagramOpen(!0)), this.gizmo.className = "vurdf-gizmo", this.gizmo.setAttribute("aria-label", "坐标轴方向"), this.root.append(this.structure.element, this.gizmo, this.toolbar.element, this.inspector.element, this.statusbar.element, this.diagram.element), this.bindSidebar("left"), this.bindSidebar("right"), a && o && (this.nameLabels = new lo(e, a, o, t)), a && (this.pointerCleanup = ho(a, t, () => this.inspector.stopSweep(!1), o));
|
|
8333
8334
|
}
|
|
8334
8335
|
render(e) {
|
|
8335
8336
|
this.disposed || !e || (this.root.dataset.theme = this.theme, this.structure.update(e, this.angleUnit), this.inspector.update(e, this.angleUnit), this.toolbar.update(e, this.theme, this.angleUnit), this.statusbar.update(e), this.diagram.update(e), this.updateGizmo());
|
|
@@ -8339,7 +8340,7 @@ class Io {
|
|
|
8339
8340
|
}
|
|
8340
8341
|
updateGizmo() {
|
|
8341
8342
|
var e;
|
|
8342
|
-
this.gizmo.innerHTML =
|
|
8343
|
+
this.gizmo.innerHTML = co(((e = this.cameraQuaternion) == null ? void 0 : e.call(this)) ?? new it());
|
|
8343
8344
|
}
|
|
8344
8345
|
setTheme(e) {
|
|
8345
8346
|
this.theme !== e && (this.theme = e, this.render(this.inspection.getSnapshot()));
|
|
@@ -8377,7 +8378,7 @@ class Io {
|
|
|
8377
8378
|
});
|
|
8378
8379
|
}
|
|
8379
8380
|
}
|
|
8380
|
-
const
|
|
8381
|
+
const To = `
|
|
8381
8382
|
.vurdf-shell{--vurdf-accent:#55d6b3;--vurdf-accent-strong:#72e5c6;--vurdf-accent-soft:rgba(85,214,179,.12);--vurdf-bg:#080d0f;--vurdf-panel:#0e1416;--vurdf-panel-raised:#141b1d;--vurdf-border:#283235;--vurdf-text:#e7ecea;--vurdf-muted:#75817f;--vurdf-hover:#1b2426;position:absolute;inset:0;pointer-events:none;color:var(--vurdf-text);font:12px/1.4 'Segoe UI','Microsoft YaHei UI',system-ui,sans-serif}.vurdf-shell[data-theme=light]{--vurdf-accent:#168c70;--vurdf-accent-strong:#08755d;--vurdf-accent-soft:rgba(22,140,112,.13);--vurdf-bg:#eef3f1;--vurdf-panel:#f8faf9;--vurdf-panel-raised:#eef3f1;--vurdf-border:#cfd9d6;--vurdf-text:#1f2927;--vurdf-muted:#687572;--vurdf-hover:#e5ece9}.vurdf-shell *{box-sizing:border-box}.vurdf-shell svg{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round}
|
|
8382
8383
|
.vurdf-side{position:absolute;top:0;bottom:27px;width:270px;background:var(--vurdf-panel);pointer-events:auto;z-index:7;display:flex;flex-direction:column;min-height:0}.vurdf-left{left:0;border-right:1px solid var(--vurdf-border)}.vurdf-right{right:0;width:320px;border-left:1px solid var(--vurdf-border)}.vurdf-head{height:52px;flex:0 0 52px;display:flex;align-items:center;justify-content:space-between;padding:0 12px;border-bottom:1px solid var(--vurdf-border)}.vurdf-head strong{font-size:12px}.vurdf-head span{display:block;color:var(--vurdf-muted);font-size:9px}
|
|
8383
8384
|
.vurdf-search{height:31px;margin:9px;border:1px solid var(--vurdf-border);border-radius:5px;background:var(--vurdf-panel-raised);display:flex;align-items:center;gap:7px;padding:0 8px}.vurdf-search:focus-within{border-color:var(--vurdf-accent)}.vurdf-search svg{width:14px;color:var(--vurdf-muted)}.vurdf-search input{appearance:none;box-shadow:none!important;min-width:0;flex:1;border:0!important;outline:0!important;background:transparent;color:var(--vurdf-text);font:11px inherit}.vurdf-filters{display:flex;gap:5px;padding:0 9px 8px;border-bottom:1px solid var(--vurdf-border)}.vurdf-chip{height:23px;border:1px solid var(--vurdf-border);border-radius:5px;background:transparent;color:var(--vurdf-muted);font-size:9px;padding:0 7px;cursor:pointer}.vurdf-chip.is-active{color:var(--vurdf-text);background:var(--vurdf-panel-raised)}
|
|
@@ -8502,17 +8503,17 @@ const Lo = `
|
|
|
8502
8503
|
|
|
8503
8504
|
.vurdf-diagram button:focus-visible{outline:2px solid var(--vurdf-accent)}
|
|
8504
8505
|
@media(max-width:600px){.vurdf-diagram{width:calc(100% - 16px);height:calc(100% - 60px)}}
|
|
8505
|
-
`,
|
|
8506
|
-
function
|
|
8506
|
+
`, No = "urdf";
|
|
8507
|
+
function Oo(r) {
|
|
8507
8508
|
let e = null, t = null, i = null, n = null, s = null, a = null;
|
|
8508
8509
|
const o = [];
|
|
8509
8510
|
return {
|
|
8510
8511
|
id: "nebula.ui.urdf",
|
|
8511
8512
|
activate(l) {
|
|
8512
8513
|
var p;
|
|
8513
|
-
t = document.createElement("style"), t.dataset.viewerUrdfUi = "", t.textContent =
|
|
8514
|
+
t = document.createElement("style"), t.dataset.viewerUrdfUi = "", t.textContent = To, (p = r.shadowRoot()) == null || p.append(t);
|
|
8514
8515
|
const d = document.createElement("div");
|
|
8515
|
-
d.className = "vurdf-shell", d.hidden = !0, e = r.mountBuiltin(d, { zone: "overlay", group:
|
|
8516
|
+
d.className = "vurdf-shell", d.hidden = !0, e = r.mountBuiltin(d, { zone: "overlay", group: No });
|
|
8516
8517
|
const c = () => {
|
|
8517
8518
|
var m;
|
|
8518
8519
|
const h = l.asset.$inspection();
|
|
@@ -8524,7 +8525,7 @@ function To(r) {
|
|
|
8524
8525
|
d.hidden = !0;
|
|
8525
8526
|
return;
|
|
8526
8527
|
}
|
|
8527
|
-
d.hidden = !1, i = new
|
|
8528
|
+
d.hidden = !1, i = new Do(d, h, l, r.theme(), r.cameraQuaternion, (m = r.interactionCanvas) == null ? void 0 : m.call(r), r.interactionCamera), n = h.subscribe((f) => i == null ? void 0 : i.render(f)), i.render(h.getSnapshot());
|
|
8528
8529
|
};
|
|
8529
8530
|
s = r.onThemeChange((h) => i == null ? void 0 : i.setTheme(h)), o.push(
|
|
8530
8531
|
l.events.on("asset-change", c),
|
|
@@ -8536,11 +8537,11 @@ function To(r) {
|
|
|
8536
8537
|
l.events.on("pick", (h) => {
|
|
8537
8538
|
var f;
|
|
8538
8539
|
const m = l.asset.$inspection();
|
|
8539
|
-
(m == null ? void 0 : m.kind) === "urdf" && $(m.getSnapshot()) && (i == null || i.selectFromScene(
|
|
8540
|
+
(m == null ? void 0 : m.kind) === "urdf" && $(m.getSnapshot()) && (i == null || i.selectFromScene($i(m, ((f = h.result) == null ? void 0 : f.object) ?? null)));
|
|
8540
8541
|
}),
|
|
8541
8542
|
l.events.on("selection-change", (h) => {
|
|
8542
8543
|
const m = l.asset.$inspection();
|
|
8543
|
-
(m == null ? void 0 : m.kind) === "urdf" && $(m.getSnapshot()) && (i == null || i.selectFromScene(
|
|
8544
|
+
(m == null ? void 0 : m.kind) === "urdf" && $(m.getSnapshot()) && (i == null || i.selectFromScene($i(m, h.object)));
|
|
8544
8545
|
})
|
|
8545
8546
|
), c();
|
|
8546
8547
|
},
|
|
@@ -8550,7 +8551,7 @@ function To(r) {
|
|
|
8550
8551
|
}
|
|
8551
8552
|
};
|
|
8552
8553
|
}
|
|
8553
|
-
function
|
|
8554
|
+
function jo(r) {
|
|
8554
8555
|
let e = r;
|
|
8555
8556
|
for (; e; ) {
|
|
8556
8557
|
if (typeof e.userData.urdfEntityId == "string") return e.userData.urdfEntityId;
|
|
@@ -8558,12 +8559,12 @@ function No(r) {
|
|
|
8558
8559
|
}
|
|
8559
8560
|
return null;
|
|
8560
8561
|
}
|
|
8561
|
-
function
|
|
8562
|
+
function $i(r, e) {
|
|
8562
8563
|
var s;
|
|
8563
|
-
const t =
|
|
8564
|
+
const t = jo(e), i = r.getSnapshot(), n = i.nodes.find((a) => a.id === t && a.kind === "link");
|
|
8564
8565
|
return n ? ((s = i.nodes.find((a) => a.kind === "joint" && a.childLink === n.name)) == null ? void 0 : s.id) ?? t : t;
|
|
8565
8566
|
}
|
|
8566
|
-
class
|
|
8567
|
+
class Fo {
|
|
8567
8568
|
constructor(e, t, i, n, s, a, o, l = null, d = () => null) {
|
|
8568
8569
|
u(this, "pluginsById", /* @__PURE__ */ new Map());
|
|
8569
8570
|
u(this, "contributions", []);
|
|
@@ -8771,7 +8772,7 @@ class Oo {
|
|
|
8771
8772
|
s.dataset.viewerContribution = "toolbar", s.dataset.viewerContributionId = t.id;
|
|
8772
8773
|
for (const a of t.items) {
|
|
8773
8774
|
const o = document.createElement("button");
|
|
8774
|
-
o.type = "button", a.icon ? (o.insertAdjacentHTML("afterbegin",
|
|
8775
|
+
o.type = "button", a.icon ? (o.insertAdjacentHTML("afterbegin", zo(a.icon)), o.title = a.title ?? a.label, o.setAttribute("aria-label", a.title ?? a.label)) : (o.textContent = a.label, a.title && (o.title = a.title)), o.disabled = a.disabled === !0, a.pressed !== void 0 && (o.setAttribute("aria-pressed", String(a.pressed)), o.classList.toggle("is-active", a.pressed)), o.addEventListener("click", a.onClick), s.append(o);
|
|
8775
8776
|
}
|
|
8776
8777
|
this.hostElement.append(s), e.cleanup = () => s.remove();
|
|
8777
8778
|
return;
|
|
@@ -8830,12 +8831,12 @@ class Oo {
|
|
|
8830
8831
|
if (this.disposed) throw new Error("Viewer plugin manager has been disposed.");
|
|
8831
8832
|
}
|
|
8832
8833
|
}
|
|
8833
|
-
function
|
|
8834
|
+
function zo(r) {
|
|
8834
8835
|
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${r}</svg>`;
|
|
8835
8836
|
}
|
|
8836
|
-
function
|
|
8837
|
+
function $o(r, e, t) {
|
|
8837
8838
|
var p;
|
|
8838
|
-
const i =
|
|
8839
|
+
const i = Bo(r), n = Vi([t, e.signal, i]), s = ((p = e.filename) == null ? void 0 : p.trim()) || _o(r), a = Tt(r) ? qo(r.files, r.entry, s) : s, o = Rn(r), l = e.baseUrl ?? Ho(o), d = /* @__PURE__ */ new Set(), c = Tt(r) ? new Map(r.files.map((h) => [se(h.path), h])) : null;
|
|
8839
8840
|
return Object.freeze({
|
|
8840
8841
|
original: r,
|
|
8841
8842
|
entryPath: a,
|
|
@@ -8845,20 +8846,20 @@ function Fo(r, e, t) {
|
|
|
8845
8846
|
baseUrl: l,
|
|
8846
8847
|
hasResourceResolver: !!e.resourceResolver,
|
|
8847
8848
|
async resolve(h, m) {
|
|
8848
|
-
const f = m ?
|
|
8849
|
-
|
|
8850
|
-
const b = se(h), y =
|
|
8849
|
+
const f = m ? Vi([n, m]) : n;
|
|
8850
|
+
Bi(f);
|
|
8851
|
+
const b = se(h), y = Uo(r);
|
|
8851
8852
|
if (y && (!b || b === se(a ?? ""))) {
|
|
8852
8853
|
const w = URL.createObjectURL(y);
|
|
8853
8854
|
return d.add(w), w;
|
|
8854
8855
|
}
|
|
8855
|
-
const v = (c == null ? void 0 : c.get(b)) ??
|
|
8856
|
+
const v = (c == null ? void 0 : c.get(b)) ?? Yo(c, a, b);
|
|
8856
8857
|
if (v) {
|
|
8857
8858
|
const w = URL.createObjectURL(v.file);
|
|
8858
8859
|
return d.add(w), w;
|
|
8859
8860
|
}
|
|
8860
|
-
const g = await
|
|
8861
|
-
if (
|
|
8861
|
+
const g = await Wo(e.resourceResolver, h, f);
|
|
8862
|
+
if (Bi(f), g instanceof Blob) {
|
|
8862
8863
|
const w = URL.createObjectURL(g);
|
|
8863
8864
|
return d.add(w), w;
|
|
8864
8865
|
}
|
|
@@ -8870,7 +8871,7 @@ function Fo(r, e, t) {
|
|
|
8870
8871
|
}
|
|
8871
8872
|
});
|
|
8872
8873
|
}
|
|
8873
|
-
function
|
|
8874
|
+
function Vo(r) {
|
|
8874
8875
|
var n;
|
|
8875
8876
|
const e = r.entryPath ?? r.url;
|
|
8876
8877
|
if (!e) return null;
|
|
@@ -8887,7 +8888,7 @@ function zo(r) {
|
|
|
8887
8888
|
const i = /\.([a-z0-9]+)$/i.exec(t);
|
|
8888
8889
|
return ((n = i == null ? void 0 : i[1]) == null ? void 0 : n.toLowerCase()) ?? null;
|
|
8889
8890
|
}
|
|
8890
|
-
function
|
|
8891
|
+
function Vi(r) {
|
|
8891
8892
|
const e = r.filter((n) => !!n);
|
|
8892
8893
|
if (e.length === 0) return new AbortController().signal;
|
|
8893
8894
|
if (e.length === 1) return e[0];
|
|
@@ -8902,22 +8903,22 @@ function $i(r) {
|
|
|
8902
8903
|
}
|
|
8903
8904
|
return t.signal;
|
|
8904
8905
|
}
|
|
8905
|
-
function
|
|
8906
|
+
function Bi(r) {
|
|
8906
8907
|
if (r.aborted)
|
|
8907
8908
|
throw typeof r.throwIfAborted == "function" && r.throwIfAborted(), new DOMException("The operation was aborted.", "AbortError");
|
|
8908
8909
|
}
|
|
8909
|
-
function
|
|
8910
|
+
function Bo(r) {
|
|
8910
8911
|
return typeof r == "object" && r !== null && "signal" in r ? r.signal : void 0;
|
|
8911
8912
|
}
|
|
8912
|
-
function
|
|
8913
|
+
function Rn(r) {
|
|
8913
8914
|
return typeof r == "string" ? r : typeof URL < "u" && r instanceof URL ? r.href : typeof r == "object" && r !== null && "kind" in r && r.kind === "url" ? r.url : null;
|
|
8914
8915
|
}
|
|
8915
|
-
function
|
|
8916
|
+
function Uo(r) {
|
|
8916
8917
|
return typeof Blob < "u" && r instanceof Blob ? r : r instanceof ArrayBuffer ? new Blob([r]) : typeof r == "object" && r !== null && "kind" in r && r.kind === "buffer" ? new Blob([r.buffer]) : null;
|
|
8917
8918
|
}
|
|
8918
|
-
function
|
|
8919
|
+
function _o(r) {
|
|
8919
8920
|
var t;
|
|
8920
|
-
const e =
|
|
8921
|
+
const e = Rn(r);
|
|
8921
8922
|
if (e)
|
|
8922
8923
|
try {
|
|
8923
8924
|
return decodeURIComponent(new URL(e, "https://viewer.invalid/").pathname.split("/").pop() || "") || null;
|
|
@@ -8926,7 +8927,7 @@ function Bo(r) {
|
|
|
8926
8927
|
}
|
|
8927
8928
|
return Tt(r) ? r.entry ?? null : typeof File < "u" && r instanceof File && r.name || null;
|
|
8928
8929
|
}
|
|
8929
|
-
function
|
|
8930
|
+
function Ho(r) {
|
|
8930
8931
|
var e;
|
|
8931
8932
|
if (!r) return null;
|
|
8932
8933
|
try {
|
|
@@ -8938,11 +8939,11 @@ function Uo(r) {
|
|
|
8938
8939
|
function Tt(r) {
|
|
8939
8940
|
return typeof r == "object" && r !== null && "kind" in r && r.kind === "files";
|
|
8940
8941
|
}
|
|
8941
|
-
function
|
|
8942
|
+
function qo(r, e, t) {
|
|
8942
8943
|
if (e) {
|
|
8943
8944
|
const i = se(e);
|
|
8944
8945
|
if (!r.some((n) => se(n.path) === i))
|
|
8945
|
-
throw
|
|
8946
|
+
throw Ui(`Asset package entry not found: ${e}`, "E_ASSET_ENTRY_NOT_FOUND");
|
|
8946
8947
|
return i;
|
|
8947
8948
|
}
|
|
8948
8949
|
if (t) {
|
|
@@ -8950,9 +8951,9 @@ function _o(r, e, t) {
|
|
|
8950
8951
|
if (r.filter((s) => se(s.path) === i).length === 1) return i;
|
|
8951
8952
|
}
|
|
8952
8953
|
if (r.length === 1) return se(r[0].path);
|
|
8953
|
-
throw
|
|
8954
|
+
throw Ui("Asset package has multiple files; specify an entry.", "E_ASSET_AMBIGUOUS_ENTRY");
|
|
8954
8955
|
}
|
|
8955
|
-
function
|
|
8956
|
+
function Yo(r, e, t) {
|
|
8956
8957
|
if (!r || !e) return;
|
|
8957
8958
|
const i = e.lastIndexOf("/"), n = i < 0 ? "" : e.slice(0, i + 1);
|
|
8958
8959
|
return r.get(se(`${n}${t}`));
|
|
@@ -8963,13 +8964,13 @@ function se(r) {
|
|
|
8963
8964
|
!t || t === "." || (t === ".." ? e.pop() : e.push(t));
|
|
8964
8965
|
return e.join("/");
|
|
8965
8966
|
}
|
|
8966
|
-
async function
|
|
8967
|
+
async function Wo(r, e, t) {
|
|
8967
8968
|
return r ? r.resolve(e, { signal: t }) : null;
|
|
8968
8969
|
}
|
|
8969
|
-
function
|
|
8970
|
+
function Ui(r, e) {
|
|
8970
8971
|
return Object.assign(new Error(r), { code: e });
|
|
8971
8972
|
}
|
|
8972
|
-
const
|
|
8973
|
+
const _i = Object.freeze({
|
|
8973
8974
|
canPlay: !1,
|
|
8974
8975
|
canPause: !1,
|
|
8975
8976
|
canReset: !1,
|
|
@@ -8979,8 +8980,8 @@ const Ui = Object.freeze({
|
|
|
8979
8980
|
}), Ee = Object.freeze({
|
|
8980
8981
|
light: 15265002,
|
|
8981
8982
|
dark: 593167
|
|
8982
|
-
}),
|
|
8983
|
-
class
|
|
8983
|
+
}), Go = 0.05;
|
|
8984
|
+
class Xo {
|
|
8984
8985
|
constructor(e) {
|
|
8985
8986
|
u(this, "epoch", 0);
|
|
8986
8987
|
u(this, "active", null);
|
|
@@ -9024,7 +9025,7 @@ class Wo {
|
|
|
9024
9025
|
disposing: !1,
|
|
9025
9026
|
cleanupErrors: [],
|
|
9026
9027
|
groundVisible: !0,
|
|
9027
|
-
groundGridScale:
|
|
9028
|
+
groundGridScale: je,
|
|
9028
9029
|
collisionVisible: !1,
|
|
9029
9030
|
upAxis: null,
|
|
9030
9031
|
grabbing: !1
|
|
@@ -9113,7 +9114,7 @@ class Wo {
|
|
|
9113
9114
|
if (!t || !this.current(t) || t.snapshot.phase !== "ready" || !t.dynamic || !t.session) return !1;
|
|
9114
9115
|
const i = t.session, n = t.playing ? i.update : i.updatePaused;
|
|
9115
9116
|
if (!n) return !1;
|
|
9116
|
-
const s = t.resetFrameClock ? 0 : Math.max(0, Math.min(Number.isNaN(e) ? 0 : e,
|
|
9117
|
+
const s = t.resetFrameClock ? 0 : Math.max(0, Math.min(Number.isNaN(e) ? 0 : e, Go));
|
|
9117
9118
|
t.resetFrameClock = !1;
|
|
9118
9119
|
try {
|
|
9119
9120
|
return !!(n.call(i, s) && this.current(t) && t.snapshot.phase === "ready");
|
|
@@ -9128,7 +9129,7 @@ class Wo {
|
|
|
9128
9129
|
var i, n;
|
|
9129
9130
|
try {
|
|
9130
9131
|
if (!this.current(e)) return;
|
|
9131
|
-
e.source =
|
|
9132
|
+
e.source = $o(t, e.options, e.abort.signal);
|
|
9132
9133
|
const s = e.source.signal, a = () => {
|
|
9133
9134
|
this.stop(e, "E_ABORTED");
|
|
9134
9135
|
};
|
|
@@ -9136,7 +9137,7 @@ class Wo {
|
|
|
9136
9137
|
a();
|
|
9137
9138
|
return;
|
|
9138
9139
|
}
|
|
9139
|
-
const o = this.detect(e), l =
|
|
9140
|
+
const o = this.detect(e), l = Hi(o) ? await o : o;
|
|
9140
9141
|
if (!this.current(e) || (e.loader = l.loader, !this.current(e))) return;
|
|
9141
9142
|
if (!this.host.loaders().includes(l.loader))
|
|
9142
9143
|
throw X("Asset loader was removed.", "E_ABORTED");
|
|
@@ -9174,7 +9175,7 @@ class Wo {
|
|
|
9174
9175
|
if (!this.current(e) || e.snapshot.phase !== "ready" || !e.session) return;
|
|
9175
9176
|
const f = e.session;
|
|
9176
9177
|
f.isPlaying && (e.playing = f.isPlaying()), ((b = f.physics) == null ? void 0 : b.status) === "unavailable" && (e.playing = !1, e.resetFrameClock = !1, this.endGrabOf(e)), this.transition(e, {
|
|
9177
|
-
capabilities: f.capabilities ??
|
|
9178
|
+
capabilities: f.capabilities ?? _i,
|
|
9178
9179
|
physics: f.physics ?? null,
|
|
9179
9180
|
warning: f.warning ?? null
|
|
9180
9181
|
}), this.publishControl(e), this.host.requestRender();
|
|
@@ -9182,7 +9183,7 @@ class Wo {
|
|
|
9182
9183
|
reportProgress: (f, b) => {
|
|
9183
9184
|
this.current(e) && e.snapshot.phase === "loading" && this.transition(e, { stage: f, message: b });
|
|
9184
9185
|
}
|
|
9185
|
-
}, h = l.loader.createSession(e.source, p), m =
|
|
9186
|
+
}, h = l.loader.createSession(e.source, p), m = Hi(h) ? await h : h;
|
|
9186
9187
|
if (e.session && e.session !== m) {
|
|
9187
9188
|
m.beginDispose(), await m.dispose();
|
|
9188
9189
|
return;
|
|
@@ -9204,7 +9205,7 @@ class Wo {
|
|
|
9204
9205
|
if (!this.current(e)) return;
|
|
9205
9206
|
e.dynamic = typeof m.update == "function", e.playing = e.dynamic && m.autoPlay !== !1, e.resetFrameClock = e.playing, this.transition(e, {
|
|
9206
9207
|
phase: "ready",
|
|
9207
|
-
capabilities: m.capabilities ??
|
|
9208
|
+
capabilities: m.capabilities ?? _i,
|
|
9208
9209
|
warning: m.warning ?? null,
|
|
9209
9210
|
physics: m.physics ?? null
|
|
9210
9211
|
}), this.current(e) && e.snapshot.phase === "ready" && e.ready.resolve();
|
|
@@ -9215,7 +9216,7 @@ class Wo {
|
|
|
9215
9216
|
}
|
|
9216
9217
|
}
|
|
9217
9218
|
detect(e) {
|
|
9218
|
-
const t = e.source, i = this.host.loaders(), n = e.options.format, s =
|
|
9219
|
+
const t = e.source, i = this.host.loaders(), n = e.options.format, s = Vo(t), a = n && n !== "auto" ? n : s && ["dxb", "dxb3"].includes(s) ? "cad" : s;
|
|
9219
9220
|
if (a) {
|
|
9220
9221
|
const o = i.find((l) => l.formats.includes(a));
|
|
9221
9222
|
if (o) return { loader: o, format: a };
|
|
@@ -9360,7 +9361,7 @@ class Wo {
|
|
|
9360
9361
|
return !e || !this.current(e) ? Object.freeze({
|
|
9361
9362
|
playing: !1,
|
|
9362
9363
|
groundVisible: !0,
|
|
9363
|
-
groundGridScale:
|
|
9364
|
+
groundGridScale: je,
|
|
9364
9365
|
collisionVisible: !1,
|
|
9365
9366
|
upAxis: null
|
|
9366
9367
|
}) : this.controlStateOf(e);
|
|
@@ -9493,7 +9494,7 @@ class Wo {
|
|
|
9493
9494
|
transition(e, t) {
|
|
9494
9495
|
var n, s, a, o, l, d;
|
|
9495
9496
|
const i = e.snapshot.phase;
|
|
9496
|
-
e.snapshot = Object.freeze({ ...e.snapshot, ...t, revision: e.snapshot.revision + 1 }), this.publish(e), i !== "ready" && e.snapshot.phase === "ready" && (e.groundVisible = ((s = (n = e.session) == null ? void 0 : n.getGroundVisible) == null ? void 0 : s.call(n)) ?? !0, e.groundGridScale = ((o = (a = e.session) == null ? void 0 : a.getGroundGridScale) == null ? void 0 : o.call(a)) ??
|
|
9497
|
+
e.snapshot = Object.freeze({ ...e.snapshot, ...t, revision: e.snapshot.revision + 1 }), this.publish(e), i !== "ready" && e.snapshot.phase === "ready" && (e.groundVisible = ((s = (n = e.session) == null ? void 0 : n.getGroundVisible) == null ? void 0 : s.call(n)) ?? !0, e.groundGridScale = ((o = (a = e.session) == null ? void 0 : a.getGroundGridScale) == null ? void 0 : o.call(a)) ?? je, e.upAxis = ((d = (l = e.session) == null ? void 0 : l.getUpAxis) == null ? void 0 : d.call(l)) ?? null, this.publishControl(e));
|
|
9497
9498
|
}
|
|
9498
9499
|
publish(e) {
|
|
9499
9500
|
const t = e.snapshot, i = [...e.listeners];
|
|
@@ -9522,10 +9523,10 @@ function Et() {
|
|
|
9522
9523
|
function X(r, e) {
|
|
9523
9524
|
return Object.assign(new Error(r), { code: e, ...e === "E_ABORTED" || e === "E_SUPERSEDED" ? { name: "AbortError" } : {} });
|
|
9524
9525
|
}
|
|
9525
|
-
function
|
|
9526
|
+
function Hi(r) {
|
|
9526
9527
|
return !!(r && typeof r.then == "function");
|
|
9527
9528
|
}
|
|
9528
|
-
const
|
|
9529
|
+
const Ko = {
|
|
9529
9530
|
id: "nebula-asset-model",
|
|
9530
9531
|
activate(r) {
|
|
9531
9532
|
r.contribute({
|
|
@@ -9543,13 +9544,13 @@ const Go = {
|
|
|
9543
9544
|
clearColor: Ee.dark
|
|
9544
9545
|
},
|
|
9545
9546
|
async createSession(e, t) {
|
|
9546
|
-
const { createModelSession: i } = await import("./session-
|
|
9547
|
+
const { createModelSession: i } = await import("./session-BUarD9PA.js");
|
|
9547
9548
|
return i(e, t);
|
|
9548
9549
|
}
|
|
9549
9550
|
});
|
|
9550
9551
|
}
|
|
9551
9552
|
};
|
|
9552
|
-
function
|
|
9553
|
+
function Jo(r, e, t) {
|
|
9553
9554
|
let i = !1, n = !1;
|
|
9554
9555
|
const s = {
|
|
9555
9556
|
...t.options.cad,
|
|
@@ -9578,7 +9579,7 @@ function Xo(r, e, t) {
|
|
|
9578
9579
|
}
|
|
9579
9580
|
};
|
|
9580
9581
|
}
|
|
9581
|
-
function
|
|
9582
|
+
function Zo(r) {
|
|
9582
9583
|
return {
|
|
9583
9584
|
id: "nebula-asset-cad",
|
|
9584
9585
|
activate(e) {
|
|
@@ -9593,24 +9594,24 @@ function Ko(r) {
|
|
|
9593
9594
|
uiProfile: "cad",
|
|
9594
9595
|
fitPolicy: "restore-then-fit"
|
|
9595
9596
|
},
|
|
9596
|
-
createSession: (t, i) =>
|
|
9597
|
+
createSession: (t, i) => Jo(r, t, i)
|
|
9597
9598
|
});
|
|
9598
9599
|
}
|
|
9599
9600
|
};
|
|
9600
9601
|
}
|
|
9601
|
-
function
|
|
9602
|
+
function Qo(r) {
|
|
9602
9603
|
const e = r.replace(/^\uFEFF/, "").replace(/^\s*(?:<\?[\s\S]*?\?>\s*)?/, "").replace(/^(?:<!--[\s\S]*?-->\s*)*/, "");
|
|
9603
9604
|
return /^<\s*mujoco(?:\s|>)/i.test(e) ? "mjcf" : /^<\s*robot(?:\s|>)/i.test(e) ? "urdf" : null;
|
|
9604
9605
|
}
|
|
9605
|
-
async function
|
|
9606
|
+
async function el(r) {
|
|
9606
9607
|
const e = r.entryPath ?? r.filename ?? r.url ?? "";
|
|
9607
9608
|
if (!e.toLowerCase().split(/[?#]/, 1)[0].endsWith(".xml")) return null;
|
|
9608
9609
|
const t = await r.resolve(e), i = await fetch(t, { signal: r.signal });
|
|
9609
9610
|
if (!i.ok) return null;
|
|
9610
|
-
const n =
|
|
9611
|
+
const n = Qo(await i.text());
|
|
9611
9612
|
return n ? { format: n } : null;
|
|
9612
9613
|
}
|
|
9613
|
-
const
|
|
9614
|
+
const tl = {
|
|
9614
9615
|
id: "nebula-asset-simulation",
|
|
9615
9616
|
activate(r) {
|
|
9616
9617
|
r.contribute({
|
|
@@ -9618,7 +9619,7 @@ const Qo = {
|
|
|
9618
9619
|
id: "nebula.simulation-loader",
|
|
9619
9620
|
assetKind: "simulation",
|
|
9620
9621
|
formats: ["urdf", "xacro", "mjcf", "usd", "usda", "usdc", "usdz"],
|
|
9621
|
-
match:
|
|
9622
|
+
match: el,
|
|
9622
9623
|
presentation: {
|
|
9623
9624
|
preferredViewMode: "3d",
|
|
9624
9625
|
interactionMode: "simulation",
|
|
@@ -9627,12 +9628,12 @@ const Qo = {
|
|
|
9627
9628
|
clearColor: Ee.dark
|
|
9628
9629
|
},
|
|
9629
9630
|
async createSession(e, t) {
|
|
9630
|
-
const { createSimulationSession: i } = await import("./session-
|
|
9631
|
+
const { createSimulationSession: i } = await import("./session-Ciaw522_.js").then((n) => n.a);
|
|
9631
9632
|
return i(e, t);
|
|
9632
9633
|
}
|
|
9633
9634
|
});
|
|
9634
9635
|
}
|
|
9635
|
-
},
|
|
9636
|
+
}, Je = "viewer:highlight", xe = "viewer:cad-selection", we = "viewer:cad-hover", qi = {
|
|
9636
9637
|
dark: {
|
|
9637
9638
|
hover: { color: 3528703, fillOpacity: 0, edgeOpacity: 0.85 },
|
|
9638
9639
|
selected: { color: 5999871, fillOpacity: 0.24, edgeOpacity: 1 }
|
|
@@ -9641,8 +9642,8 @@ const Qo = {
|
|
|
9641
9642
|
hover: { color: 24524, fillOpacity: 0, edgeOpacity: 0.95 },
|
|
9642
9643
|
selected: { color: 24524, fillOpacity: 0.2, edgeOpacity: 1 }
|
|
9643
9644
|
}
|
|
9644
|
-
},
|
|
9645
|
-
class
|
|
9645
|
+
}, il = 6, nl = 12, rl = 160, sl = 160, al = 50, Yi = 592655;
|
|
9646
|
+
class ol {
|
|
9646
9647
|
constructor(e, t) {
|
|
9647
9648
|
u(this, "cad");
|
|
9648
9649
|
u(this, "mountedObjects", /* @__PURE__ */ new Set());
|
|
@@ -9658,9 +9659,9 @@ class sl {
|
|
|
9658
9659
|
u(this, "interactionRenderLastTs", null);
|
|
9659
9660
|
u(this, "cadHoveredInsert", null);
|
|
9660
9661
|
u(this, "cadPointerPosition", null);
|
|
9661
|
-
u(this, "pointerDragTracker", new
|
|
9662
|
-
distancePx:
|
|
9663
|
-
pathPx:
|
|
9662
|
+
u(this, "pointerDragTracker", new Ws({
|
|
9663
|
+
distancePx: il,
|
|
9664
|
+
pathPx: nl
|
|
9664
9665
|
}));
|
|
9665
9666
|
u(this, "cadCapability");
|
|
9666
9667
|
u(this, "cadHost");
|
|
@@ -9796,7 +9797,7 @@ class sl {
|
|
|
9796
9797
|
this.pointerStart = null, this.cadPointerPosition = null, this.pointerDragTracker.reset(), this.setCadHoveredInsert(null), this.interactionMode !== "disabled" && this.pluginManager.dispatchInteraction("onHover", null), this.scheduleInteractionIdle(), !this.disposed && this.emit("pointer-leave", this.toPointerEvent(e));
|
|
9797
9798
|
});
|
|
9798
9799
|
var i, n, s, a, o, l, d, c, p, h, m, f, b, y, v, g, w;
|
|
9799
|
-
this.options = e, this.runtime = t, this.cameraStateStore = e.cameraStateStore === !1 ? void 0 : e.cameraStateStore ??
|
|
9800
|
+
this.options = e, this.runtime = t, this.cameraStateStore = e.cameraStateStore === !1 ? void 0 : e.cameraStateStore ?? ks(), this.interactionMode = e.cadInteraction ?? "managed", this.defaultEnvironment = (i = e.environmentPresets) != null && i.length ? e.environmentPresets[0] : e.environment ?? "room", this.environmentPresets = (n = e.environmentPresets) != null && n.length ? e.environmentPresets.map((x) => Wi(x)).filter((x) => x !== null) : [Wi(this.defaultEnvironment)].filter((x) => x !== null), this.activePresetIndex = this.environmentPresets.length > 0 ? 0 : null, this.environmentRotation = Gi(e.environmentRotation ?? 0), this.environmentSupported = typeof t.setEnvironment == "function" && typeof t.setEnvironmentBackgroundVisible == "function" && typeof t.getEnvironmentBackgroundVisible == "function", this.environmentRotationSupported = typeof t.setEnvironmentRotation == "function", this.environmentRotationSupported && t.setEnvironmentRotation(this.environmentRotation), e.previewDragPreset && this.runtime.setPreviewDragPreset(e.previewDragPreset), this.uiTheme = ((s = e.ui) == null ? void 0 : s.theme) ?? "dark", this.cadHost = this.createCadHost(), this.cadCapability = new Bs(this.cadHost), this.cad = this.cadCapability, this.cadCapability.open = async (x, C = {}) => {
|
|
9800
9801
|
this.assertActive();
|
|
9801
9802
|
const { filename: k, signal: E, ...P } = C;
|
|
9802
9803
|
await this.assetController.open(x, { format: "cad", filename: k, signal: E, cad: P }, !0).ready;
|
|
@@ -9805,7 +9806,7 @@ class sl {
|
|
|
9805
9806
|
return D;
|
|
9806
9807
|
}, this.cadCapability.close = () => {
|
|
9807
9808
|
this.assertActive(), this.assetController.closeKind("cad");
|
|
9808
|
-
}, this.initialCameraSnapshot = t.captureCameraSnapshot(), this.lastCameraFingerprint = kt(this.initialCameraSnapshot), this.layoutEngine = this.createLayoutEngine(), this.pluginManager = new
|
|
9809
|
+
}, this.initialCameraSnapshot = t.captureCameraSnapshot(), this.lastCameraFingerprint = kt(this.initialCameraSnapshot), this.layoutEngine = this.createLayoutEngine(), this.pluginManager = new Fo(
|
|
9809
9810
|
() => this.cadCapability.getSnapshot(),
|
|
9810
9811
|
() => ({
|
|
9811
9812
|
viewMode: this.runtime.viewMode,
|
|
@@ -9839,7 +9840,7 @@ class sl {
|
|
|
9839
9840
|
e.viewport,
|
|
9840
9841
|
this.layoutEngine,
|
|
9841
9842
|
() => this.assetController.getActiveInspection()
|
|
9842
|
-
), this.assetController = new
|
|
9843
|
+
), this.assetController = new Xo({
|
|
9843
9844
|
loaders: () => this.pluginManager.getAssetLoaders(),
|
|
9844
9845
|
...this.runtime.getRenderer ? { getRenderer: () => this.runtime.getRenderer() } : {},
|
|
9845
9846
|
mount: (x) => this.mountAssetObject(x),
|
|
@@ -9857,14 +9858,14 @@ class sl {
|
|
|
9857
9858
|
cleanupError: (x) => {
|
|
9858
9859
|
this.options.onCleanupError ? this.options.onCleanupError(x) : console.error("[viewer] asset cleanup failed", x);
|
|
9859
9860
|
}
|
|
9860
|
-
}), this.pluginManager.registerBuiltin(
|
|
9861
|
+
}), this.pluginManager.registerBuiltin(Zo(this.cadCapability)), this.pluginManager.registerBuiltin(Ko), this.pluginManager.registerBuiltin(tl), this.pluginManager.onAssetLoaderRemoved((x) => this.assetController.removeLoader(x)), this.cadInspectorUnsubscribe = this.cad.on("inspector-change", () => {
|
|
9861
9862
|
this.interactionMode === "managed" && (this.syncCadSelectionOverlay(), this.syncCadHoverOverlay()), this.dispatchCadSelectionChange();
|
|
9862
9863
|
}), this.cadDocumentUnsubscribe = this.cad.on("document-change", () => {
|
|
9863
9864
|
this.setCadHoveredInsert(null), this.interactionMode === "managed" && this.syncCadSelectionOverlay();
|
|
9864
9865
|
}), this.assetChangeUnsubscribe = this.on("asset-change", (x) => {
|
|
9865
9866
|
const C = x.snapshot.phase;
|
|
9866
9867
|
(C === "closing" || C === "failed" || C === "closed") && this.endAssetGrab();
|
|
9867
|
-
}), e.ui && e.ui.preset !== "none" && (e.ui.preset !== "cad-readonly" && this.interactionMode === "managed" && this.pluginManager.registerBuiltin(
|
|
9868
|
+
}), e.ui && e.ui.preset !== "none" && (e.ui.preset !== "cad-readonly" && this.interactionMode === "managed" && this.pluginManager.registerBuiltin(oo(
|
|
9868
9869
|
{
|
|
9869
9870
|
mountBuiltin: (x, C) => this.layoutEngine.mountBuiltin(x, C),
|
|
9870
9871
|
shadowRoot: () => this.builtinUiShadow(),
|
|
@@ -9881,7 +9882,7 @@ class sl {
|
|
|
9881
9882
|
label: (x) => x === "simulation" ? "仿真控制" : "模型控制",
|
|
9882
9883
|
scene: e.ui.scene
|
|
9883
9884
|
}
|
|
9884
|
-
)), e.ui.urdf !== !1 && this.interactionMode === "managed" && this.pluginManager.registerBuiltin(
|
|
9885
|
+
)), e.ui.urdf !== !1 && this.interactionMode === "managed" && this.pluginManager.registerBuiltin(Oo({
|
|
9885
9886
|
interactionCanvas: () => this.options.canvas,
|
|
9886
9887
|
interactionCamera: () => this.runtime.getActiveCamera(),
|
|
9887
9888
|
cameraQuaternion: () => this.runtime.getActiveCamera().quaternion.clone(),
|
|
@@ -9892,13 +9893,13 @@ class sl {
|
|
|
9892
9893
|
})), this.interactionMode === "managed" && this.pluginManager.register({
|
|
9893
9894
|
id: "nebula.ui.cad",
|
|
9894
9895
|
activate: () => {
|
|
9895
|
-
this.ui = new
|
|
9896
|
+
this.ui = new ka(this.createUiHost(), e.ui), this.ui.mount();
|
|
9896
9897
|
},
|
|
9897
9898
|
deactivate: () => {
|
|
9898
9899
|
var x;
|
|
9899
9900
|
(x = this.ui) == null || x.dispose(), this.ui = null;
|
|
9900
9901
|
}
|
|
9901
|
-
})), (o = (a = this.options.canvas).addEventListener) == null || o.call(a, "pointerdown", this.handlePointerDown), (d = (l = this.options.canvas).addEventListener) == null || d.call(l, "pointermove", this.handlePointerMove), (p = (c = this.options.canvas).addEventListener) == null || p.call(c, "pointerup", this.handlePointerUp), (m = (h = this.options.canvas).addEventListener) == null || m.call(h, "pointercancel", this.handlePointerCancel), (b = (f = this.options.canvas).addEventListener) == null || b.call(f, "pointerleave", this.handlePointerLeave), (v = (y = this.options.canvas).addEventListener) == null || v.call(y, "lostpointercapture", this.handleLostPointerCapture), (w = (g = this.options.canvas).addEventListener) == null || w.call(g, "wheel", this.handleWheel, { passive: !0 }), typeof globalThis.window < "u" && globalThis.window.addEventListener("blur", this.handleWindowBlur), typeof ResizeObserver == "function" &&
|
|
9902
|
+
})), (o = (a = this.options.canvas).addEventListener) == null || o.call(a, "pointerdown", this.handlePointerDown), (d = (l = this.options.canvas).addEventListener) == null || d.call(l, "pointermove", this.handlePointerMove), (p = (c = this.options.canvas).addEventListener) == null || p.call(c, "pointerup", this.handlePointerUp), (m = (h = this.options.canvas).addEventListener) == null || m.call(h, "pointercancel", this.handlePointerCancel), (b = (f = this.options.canvas).addEventListener) == null || b.call(f, "pointerleave", this.handlePointerLeave), (v = (y = this.options.canvas).addEventListener) == null || v.call(y, "lostpointercapture", this.handleLostPointerCapture), (w = (g = this.options.canvas).addEventListener) == null || w.call(g, "wheel", this.handleWheel, { passive: !0 }), typeof globalThis.window < "u" && globalThis.window.addEventListener("blur", this.handleWindowBlur), typeof ResizeObserver == "function" && pl(this.options.viewport) ? (this.viewportResizeObserver = new ResizeObserver(() => this.handleViewportResize()), this.viewportResizeObserver.observe(this.options.viewport)) : (this.viewportResizeObserver = null, typeof globalThis.window < "u" && (this.usingWindowResizeFallback = !0, globalThis.window.addEventListener("resize", this.handleViewportResize))), this.runtime.startAnimation({
|
|
9902
9903
|
renderExtension: { beforeRender: (x, C, k) => this.assetController.beforeRender(x, C, k) },
|
|
9903
9904
|
onFrame: (x, C) => {
|
|
9904
9905
|
this.assetController.update(C) && this.runtime.requestRender();
|
|
@@ -10005,7 +10006,7 @@ class sl {
|
|
|
10005
10006
|
this.assertActive();
|
|
10006
10007
|
const t = this.runtime.setEnvironmentRotation;
|
|
10007
10008
|
if (!t) return !1;
|
|
10008
|
-
const i =
|
|
10009
|
+
const i = Gi(e);
|
|
10009
10010
|
return i === this.environmentRotation ? !0 : t.call(this.runtime, i) ? (this.environmentRotation = i, this.emit("environment-change", this.getEnvironmentState()), !0) : !1;
|
|
10010
10011
|
}
|
|
10011
10012
|
async useDefaultEnvironment() {
|
|
@@ -10022,7 +10023,7 @@ class sl {
|
|
|
10022
10023
|
async loadEnvironmentFile(e) {
|
|
10023
10024
|
var o;
|
|
10024
10025
|
this.assertActive();
|
|
10025
|
-
const t =
|
|
10026
|
+
const t = dl(e);
|
|
10026
10027
|
if (!t) return !1;
|
|
10027
10028
|
const i = URL.createObjectURL(e), n = { type: t, url: i, name: e.name }, s = (o = this.customEnvironment) == null ? void 0 : o.url, a = await this.applyEnvironment(n, "custom", () => {
|
|
10028
10029
|
this.customEnvironment = n, s && s !== i && URL.revokeObjectURL(s);
|
|
@@ -10115,9 +10116,9 @@ class sl {
|
|
|
10115
10116
|
}
|
|
10116
10117
|
setHighlight(e, t = {}) {
|
|
10117
10118
|
if (this.assertActive(), e && this.assertMounted(e), !(this.highlightedObjectValue === null && e === null)) {
|
|
10118
|
-
if (this.runtime.removeOverlay(
|
|
10119
|
-
const i = new
|
|
10120
|
-
i.name =
|
|
10119
|
+
if (this.runtime.removeOverlay(Je), this.highlightedObjectValue = e, e) {
|
|
10120
|
+
const i = new Yn(e, t.color ?? 6000111);
|
|
10121
|
+
i.name = Je, this.runtime.mountOverlay(Je, i, { owned: !0 });
|
|
10121
10122
|
}
|
|
10122
10123
|
this.emit("highlight-change", { object: e });
|
|
10123
10124
|
}
|
|
@@ -10145,7 +10146,7 @@ class sl {
|
|
|
10145
10146
|
dispose() {
|
|
10146
10147
|
var e, t, i, n, s, a, o, l, d, c, p, h, m, f, b;
|
|
10147
10148
|
if (!this.disposed) {
|
|
10148
|
-
this.environmentGeneration += 1, this.customEnvironment && (URL.revokeObjectURL(this.customEnvironment.url), this.customEnvironment = null), this.grabbing && this.endAssetGrab(), this.assetController.dispose(), this.disposed = !0, this.pluginManager.dispose(), this.clearInteractionIdleTimer(), this.pointerDragTracker.reset(), (t = (e = this.options.canvas).removeEventListener) == null || t.call(e, "pointerdown", this.handlePointerDown), (n = (i = this.options.canvas).removeEventListener) == null || n.call(i, "pointermove", this.handlePointerMove), (a = (s = this.options.canvas).removeEventListener) == null || a.call(s, "pointerup", this.handlePointerUp), (l = (o = this.options.canvas).removeEventListener) == null || l.call(o, "pointercancel", this.handlePointerCancel), (c = (d = this.options.canvas).removeEventListener) == null || c.call(d, "pointerleave", this.handlePointerLeave), (h = (p = this.options.canvas).removeEventListener) == null || h.call(p, "lostpointercapture", this.handleLostPointerCapture), (f = (m = this.options.canvas).removeEventListener) == null || f.call(m, "wheel", this.handleWheel), typeof globalThis.window < "u" && (globalThis.window.removeEventListener("blur", this.handleWindowBlur), this.usingWindowResizeFallback && globalThis.window.removeEventListener("resize", this.handleViewportResize)), (b = this.viewportResizeObserver) == null || b.disconnect(), this.pointerStart = null, this.cadPointerPosition = null, this.setCadHoveredInsert(null), this.setCanvasCursor(""), this.highlightedObjectValue && this.runtime.removeOverlay(
|
|
10149
|
+
this.environmentGeneration += 1, this.customEnvironment && (URL.revokeObjectURL(this.customEnvironment.url), this.customEnvironment = null), this.grabbing && this.endAssetGrab(), this.assetController.dispose(), this.disposed = !0, this.pluginManager.dispose(), this.clearInteractionIdleTimer(), this.pointerDragTracker.reset(), (t = (e = this.options.canvas).removeEventListener) == null || t.call(e, "pointerdown", this.handlePointerDown), (n = (i = this.options.canvas).removeEventListener) == null || n.call(i, "pointermove", this.handlePointerMove), (a = (s = this.options.canvas).removeEventListener) == null || a.call(s, "pointerup", this.handlePointerUp), (l = (o = this.options.canvas).removeEventListener) == null || l.call(o, "pointercancel", this.handlePointerCancel), (c = (d = this.options.canvas).removeEventListener) == null || c.call(d, "pointerleave", this.handlePointerLeave), (h = (p = this.options.canvas).removeEventListener) == null || h.call(p, "lostpointercapture", this.handleLostPointerCapture), (f = (m = this.options.canvas).removeEventListener) == null || f.call(m, "wheel", this.handleWheel), typeof globalThis.window < "u" && (globalThis.window.removeEventListener("blur", this.handleWindowBlur), this.usingWindowResizeFallback && globalThis.window.removeEventListener("resize", this.handleViewportResize)), (b = this.viewportResizeObserver) == null || b.disconnect(), this.pointerStart = null, this.cadPointerPosition = null, this.setCadHoveredInsert(null), this.setCanvasCursor(""), this.highlightedObjectValue && this.runtime.removeOverlay(Je), this.runtime.removeOverlay(xe), this.runtime.removeOverlay(we), this.cadInspectorUnsubscribe(), this.cadDocumentUnsubscribe(), this.assetChangeUnsubscribe(), this.highlightedObjectValue = null, this.selectedObjectValue = null;
|
|
10149
10150
|
for (const y of this.mountedObjects)
|
|
10150
10151
|
this.runtime.removeObject(y, { dispose: !1 });
|
|
10151
10152
|
this.mountedObjects.clear();
|
|
@@ -10170,7 +10171,7 @@ class sl {
|
|
|
10170
10171
|
createLayoutEngine() {
|
|
10171
10172
|
var n;
|
|
10172
10173
|
const e = this, t = this.options, i = (n = t.ui) == null ? void 0 : n.insetTarget;
|
|
10173
|
-
return new
|
|
10174
|
+
return new Ra({
|
|
10174
10175
|
reference: () => {
|
|
10175
10176
|
var s;
|
|
10176
10177
|
return ((s = t.ui) == null ? void 0 : s.root) ?? t.viewport;
|
|
@@ -10214,7 +10215,7 @@ class sl {
|
|
|
10214
10215
|
*/
|
|
10215
10216
|
resetAssetPresentation() {
|
|
10216
10217
|
var e;
|
|
10217
|
-
this.runtime.setClearColor(this.options.clearColor ??
|
|
10218
|
+
this.runtime.setClearColor(this.options.clearColor ?? Yi), this.runtime.setNavigationPolicy("viewer"), this.interactionMode = this.options.cadInteraction ?? "managed", (e = this.ui) == null || e.setActive(!1), this.interactionMode !== "managed" ? (this.setCadHoveredInsert(null), this.runtime.removeOverlay(xe), this.runtime.removeOverlay(we), this.cadCapability.clearSelection()) : this.syncCadSelectionOverlay(), this.runtime.requestRender();
|
|
10218
10219
|
}
|
|
10219
10220
|
createCadHost() {
|
|
10220
10221
|
const e = this;
|
|
@@ -10235,7 +10236,7 @@ class sl {
|
|
|
10235
10236
|
return e.cadCapability.getVisibilityRevision();
|
|
10236
10237
|
},
|
|
10237
10238
|
get viewportDemandCoalesceMs() {
|
|
10238
|
-
return e.options.viewportDemandCoalesceMs ??
|
|
10239
|
+
return e.options.viewportDemandCoalesceMs ?? sl;
|
|
10239
10240
|
},
|
|
10240
10241
|
mountCadObject(t) {
|
|
10241
10242
|
e.unmountCadObject(), e.runtime.addObject(t, { owned: !0 }), e.cadRenderRoot = t;
|
|
@@ -10274,10 +10275,10 @@ class sl {
|
|
|
10274
10275
|
return ((s = e.runtime.screenToWorldOnPlane(t, i, n)) == null ? void 0 : s.clone()) ?? null;
|
|
10275
10276
|
},
|
|
10276
10277
|
readCameraSnapshot(t) {
|
|
10277
|
-
return
|
|
10278
|
+
return Ps(e.cameraStateStore, t);
|
|
10278
10279
|
},
|
|
10279
10280
|
persistCameraSnapshot(t, i) {
|
|
10280
|
-
|
|
10281
|
+
Ms(e.cameraStateStore, t, i);
|
|
10281
10282
|
},
|
|
10282
10283
|
getViewportSize() {
|
|
10283
10284
|
return {
|
|
@@ -10312,7 +10313,7 @@ class sl {
|
|
|
10312
10313
|
if (!i || i.isEmpty()) return;
|
|
10313
10314
|
const n = !!((o = e.details) != null && o.bbox);
|
|
10314
10315
|
if (((d = (l = this.options.cadInteractionStyle) == null ? void 0 : l.selected) == null ? void 0 : d.enabled) === !1) return;
|
|
10315
|
-
const s = n ? this.createCadInteractionOverlay(i, "selected") : new
|
|
10316
|
+
const s = n ? this.createCadInteractionOverlay(i, "selected") : new Wn(i, ((p = (c = this.options.cadInteractionStyle) == null ? void 0 : c.selected) == null ? void 0 : p.color) ?? qi.dark.selected.color);
|
|
10316
10317
|
s.name = xe, this.runtime.mountOverlay(xe, s, { owned: !0 });
|
|
10317
10318
|
}
|
|
10318
10319
|
dispatchCadSelectionChange() {
|
|
@@ -10331,13 +10332,13 @@ class sl {
|
|
|
10331
10332
|
}
|
|
10332
10333
|
createCadInteractionOverlay(e, t) {
|
|
10333
10334
|
var h, m;
|
|
10334
|
-
const i = ((h = this.options.ui) == null ? void 0 : h.theme) === "light" ? "light" : "dark", n =
|
|
10335
|
+
const i = ((h = this.options.ui) == null ? void 0 : h.theme) === "light" ? "light" : "dark", n = qi[i][t], s = (m = this.options.cadInteractionStyle) == null ? void 0 : m[t], a = {
|
|
10335
10336
|
color: (s == null ? void 0 : s.color) ?? n.color,
|
|
10336
10337
|
fillOpacity: (s == null ? void 0 : s.fillOpacity) ?? n.fillOpacity,
|
|
10337
10338
|
edgeOpacity: (s == null ? void 0 : s.edgeOpacity) ?? n.edgeOpacity
|
|
10338
|
-
}, o = new
|
|
10339
|
+
}, o = new on();
|
|
10339
10340
|
o.name = t === "hover" ? "cad-insert-hover" : "cad-insert-selected", o.renderOrder = t === "hover" ? 1300 : 1310;
|
|
10340
|
-
const l = e.getSize(new M()), d = e.getCenter(new M()), c = new
|
|
10341
|
+
const l = e.getSize(new M()), d = e.getCenter(new M()), c = new Gn(Math.max(l.x, 1e-6), Math.max(l.y, 1e-6), Math.max(l.z, 1e-3));
|
|
10341
10342
|
if (a.fillOpacity > 0) {
|
|
10342
10343
|
const f = new ae(
|
|
10343
10344
|
c.clone(),
|
|
@@ -10351,9 +10352,9 @@ class sl {
|
|
|
10351
10352
|
);
|
|
10352
10353
|
f.name = `${o.name}:fill`, f.position.copy(d), f.renderOrder = 1305, o.add(f);
|
|
10353
10354
|
}
|
|
10354
|
-
const p = new
|
|
10355
|
-
new
|
|
10356
|
-
new
|
|
10355
|
+
const p = new Xn(
|
|
10356
|
+
new Kn(c),
|
|
10357
|
+
new Jn({
|
|
10357
10358
|
color: a.color,
|
|
10358
10359
|
transparent: !0,
|
|
10359
10360
|
opacity: a.edgeOpacity,
|
|
@@ -10455,9 +10456,9 @@ class sl {
|
|
|
10455
10456
|
this.resetAssetPresentation();
|
|
10456
10457
|
return;
|
|
10457
10458
|
}
|
|
10458
|
-
this.runtime.setClearColor(e.clearColor ?? this.options.clearColor ??
|
|
10459
|
+
this.runtime.setClearColor(e.clearColor ?? this.options.clearColor ?? Yi), this.runtime.setNavigationPolicy(
|
|
10459
10460
|
e.interactionMode === "object" || e.interactionMode === "simulation" ? "preview" : "viewer"
|
|
10460
|
-
), e.preferredViewMode && e.preferredViewMode !== this.runtime.viewMode && this.setViewMode(e.preferredViewMode, { preserveOrbit: !0 }), this.interactionMode = e.interactionMode === "cad-managed" ? this.options.cadInteraction ?? "managed" : e.interactionMode === "object" || e.interactionMode === "simulation" ? "disabled" : this.options.cadInteraction ?? "managed", this.layoutEngine.setActiveGroups(
|
|
10461
|
+
), e.preferredViewMode && e.preferredViewMode !== this.runtime.viewMode && this.setViewMode(e.preferredViewMode, { preserveOrbit: !0 }), this.interactionMode = e.interactionMode === "cad-managed" ? this.options.cadInteraction ?? "managed" : e.interactionMode === "object" || e.interactionMode === "simulation" ? "disabled" : this.options.cadInteraction ?? "managed", this.layoutEngine.setActiveGroups(cl(e.uiProfile)), (t = this.ui) == null || t.setActive(e.uiProfile === "cad"), this.interactionMode !== "managed" ? (this.setCadHoveredInsert(null), this.runtime.removeOverlay(xe), this.runtime.removeOverlay(we), this.cadCapability.clearSelection()) : this.syncCadSelectionOverlay();
|
|
10461
10462
|
}
|
|
10462
10463
|
resolveMixedBounds() {
|
|
10463
10464
|
const e = this.assetController.getActiveFitBounds();
|
|
@@ -10495,7 +10496,7 @@ class sl {
|
|
|
10495
10496
|
shouldRenderCurrentFrame(e) {
|
|
10496
10497
|
if (this.assetController.isActivePreview || this.assetController.isActiveDynamicPlaying || this.interaction !== "active" || this.interactionRenderLastTs === null) return !0;
|
|
10497
10498
|
const t = e - this.interactionRenderLastTs;
|
|
10498
|
-
return t < 0 || t >=
|
|
10499
|
+
return t < 0 || t >= al;
|
|
10499
10500
|
}
|
|
10500
10501
|
markInteractionActive() {
|
|
10501
10502
|
this.clearInteractionIdleTimer(), this.setInteraction("active");
|
|
@@ -10503,7 +10504,7 @@ class sl {
|
|
|
10503
10504
|
scheduleInteractionIdle() {
|
|
10504
10505
|
this.clearInteractionIdleTimer(), this.interactionIdleTimer = globalThis.setTimeout(() => {
|
|
10505
10506
|
this.interactionIdleTimer = null, this.setInteraction("idle"), this.refreshCadPointerHover();
|
|
10506
|
-
},
|
|
10507
|
+
}, rl);
|
|
10507
10508
|
}
|
|
10508
10509
|
clearInteractionIdleTimer() {
|
|
10509
10510
|
this.interactionIdleTimer !== null && (globalThis.clearTimeout(this.interactionIdleTimer), this.interactionIdleTimer = null);
|
|
@@ -10578,9 +10579,9 @@ class sl {
|
|
|
10578
10579
|
for (const i of this.listeners.get(e) ?? []) i(t);
|
|
10579
10580
|
}
|
|
10580
10581
|
}
|
|
10581
|
-
function
|
|
10582
|
+
function ed(r) {
|
|
10582
10583
|
var i;
|
|
10583
|
-
const e = (i = r.environmentPresets) != null && i.length ? r.environmentPresets[0] : r.environment ?? "room", t = new
|
|
10584
|
+
const e = (i = r.environmentPresets) != null && i.length ? r.environmentPresets[0] : r.environment ?? "room", t = new bs({
|
|
10584
10585
|
canvasArea: r.viewport,
|
|
10585
10586
|
canvas: r.canvas,
|
|
10586
10587
|
clearColor: r.clearColor,
|
|
@@ -10595,12 +10596,12 @@ function Jl(r) {
|
|
|
10595
10596
|
transmissionMode: r.transmissionMode,
|
|
10596
10597
|
navigationPolicy: "viewer"
|
|
10597
10598
|
});
|
|
10598
|
-
return
|
|
10599
|
+
return ll(r, t);
|
|
10599
10600
|
}
|
|
10600
|
-
function
|
|
10601
|
-
return e.initialize(), new
|
|
10601
|
+
function ll(r, e) {
|
|
10602
|
+
return e.initialize(), new ol(r, e);
|
|
10602
10603
|
}
|
|
10603
|
-
function
|
|
10604
|
+
function Wi(r) {
|
|
10604
10605
|
if (r === "room") return null;
|
|
10605
10606
|
let t = (r.url.split(/[?#]/, 1)[0] ?? r.url).split("/").pop() || r.url;
|
|
10606
10607
|
try {
|
|
@@ -10609,26 +10610,26 @@ function Yi(r) {
|
|
|
10609
10610
|
}
|
|
10610
10611
|
return { type: r.type, url: r.url, name: t };
|
|
10611
10612
|
}
|
|
10612
|
-
function
|
|
10613
|
+
function dl(r) {
|
|
10613
10614
|
const e = r.name.trim().toLowerCase().split(".").pop();
|
|
10614
10615
|
return e === "hdr" ? "hdr" : ["jpg", "jpeg", "png", "webp", "avif"].includes(e ?? "") ? "image" : null;
|
|
10615
10616
|
}
|
|
10616
|
-
function
|
|
10617
|
+
function Gi(r) {
|
|
10617
10618
|
if (!Number.isFinite(r)) return 0;
|
|
10618
10619
|
const e = r % 360;
|
|
10619
10620
|
return e < 0 ? e + 360 : e;
|
|
10620
10621
|
}
|
|
10621
|
-
function
|
|
10622
|
-
return r === "cad" ?
|
|
10622
|
+
function cl(r) {
|
|
10623
|
+
return r === "cad" ? ul : r === "model" ? Xi : r === "simulation" ? /* @__PURE__ */ new Set([...Xi, "urdf"]) : hl;
|
|
10623
10624
|
}
|
|
10624
|
-
const
|
|
10625
|
+
const ul = /* @__PURE__ */ new Set(["cad"]), Xi = /* @__PURE__ */ new Set(["scene"]), hl = /* @__PURE__ */ new Set();
|
|
10625
10626
|
function kt(r) {
|
|
10626
10627
|
return r ? JSON.stringify(r) : null;
|
|
10627
10628
|
}
|
|
10628
|
-
function
|
|
10629
|
+
function pl(r) {
|
|
10629
10630
|
return !!(r && typeof r == "object" && r.nodeType === 1);
|
|
10630
10631
|
}
|
|
10631
|
-
function
|
|
10632
|
+
function ml(r, e) {
|
|
10632
10633
|
const t = async (s, a) => {
|
|
10633
10634
|
var l;
|
|
10634
10635
|
const o = r.GetPrimAtPath(s);
|
|
@@ -10800,26 +10801,26 @@ function hl(r, e) {
|
|
|
10800
10801
|
}
|
|
10801
10802
|
};
|
|
10802
10803
|
}
|
|
10803
|
-
function
|
|
10804
|
+
function td(r) {
|
|
10804
10805
|
const e = r;
|
|
10805
|
-
return e.usdQuery ? e.usdQuery : !r.stage || !r.pxr ? null : e.usdQuery =
|
|
10806
|
+
return e.usdQuery ? e.usdQuery : !r.stage || !r.pxr ? null : e.usdQuery = ml(r.stage, r.pxr);
|
|
10806
10807
|
}
|
|
10807
|
-
const
|
|
10808
|
+
const fl = 1, vl = 3, gl = "6ad6617c3ba6d2037c62", bl = {
|
|
10808
10809
|
file: "openusd_probe.js",
|
|
10809
10810
|
sha256: "83a14d264f2348a0899de8f1bc0c021fdcd8cae554ef545fb9e5b88da6f30b4e",
|
|
10810
10811
|
bytes: 95918
|
|
10811
|
-
},
|
|
10812
|
+
}, yl = {
|
|
10812
10813
|
file: "openusd_probe.wasm",
|
|
10813
10814
|
sha256: "a68fdbc8902ccb59e5cc84d24ad79572860806c01eaec5ad130218d0bbc835a9",
|
|
10814
10815
|
bytes: 10672319
|
|
10815
|
-
},
|
|
10816
|
-
schemaVersion:
|
|
10817
|
-
apiVersion:
|
|
10818
|
-
runtimeId:
|
|
10819
|
-
js:
|
|
10820
|
-
wasm:
|
|
10821
|
-
},
|
|
10822
|
-
function
|
|
10816
|
+
}, xl = {
|
|
10817
|
+
schemaVersion: fl,
|
|
10818
|
+
apiVersion: vl,
|
|
10819
|
+
runtimeId: gl,
|
|
10820
|
+
js: bl,
|
|
10821
|
+
wasm: yl
|
|
10822
|
+
}, Ne = wl(xl);
|
|
10823
|
+
function wl(r) {
|
|
10823
10824
|
if (!r || typeof r != "object") throw new Error("OpenUSD runtime manifest is missing.");
|
|
10824
10825
|
const e = r;
|
|
10825
10826
|
if (e.schemaVersion !== 1 || !Number.isInteger(e.apiVersion) || Number(e.apiVersion) < 1 || typeof e.runtimeId != "string" || !/^[0-9a-f]{20}$/.test(e.runtimeId))
|
|
@@ -10828,11 +10829,11 @@ function yl(r) {
|
|
|
10828
10829
|
schemaVersion: e.schemaVersion,
|
|
10829
10830
|
apiVersion: Number(e.apiVersion),
|
|
10830
10831
|
runtimeId: e.runtimeId,
|
|
10831
|
-
js:
|
|
10832
|
-
wasm:
|
|
10832
|
+
js: Ki(e.js, "openusd_probe.js"),
|
|
10833
|
+
wasm: Ki(e.wasm, "openusd_probe.wasm")
|
|
10833
10834
|
});
|
|
10834
10835
|
}
|
|
10835
|
-
function
|
|
10836
|
+
function Ki(r, e) {
|
|
10836
10837
|
if (!r || typeof r != "object") throw new Error(`OpenUSD runtime manifest omits ${e}.`);
|
|
10837
10838
|
const t = r;
|
|
10838
10839
|
if (t.file !== e || typeof t.sha256 != "string" || !/^[0-9a-f]{64}$/.test(t.sha256) || !Number.isInteger(t.bytes) || Number(t.bytes) < 1)
|
|
@@ -10843,22 +10844,32 @@ function Xi(r, e) {
|
|
|
10843
10844
|
bytes: Number(t.bytes)
|
|
10844
10845
|
});
|
|
10845
10846
|
}
|
|
10846
|
-
|
|
10847
|
-
|
|
10847
|
+
function Ji(r, e) {
|
|
10848
|
+
const t = typeof document > "u" ? "file:///" : document.baseURI, i = new URL(r, t);
|
|
10849
|
+
return i.searchParams.set("v", e), i.href;
|
|
10850
|
+
}
|
|
10851
|
+
function An(r, e = Ne.runtimeId) {
|
|
10848
10852
|
if (!/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/.test(e))
|
|
10849
10853
|
throw new Error(`Invalid OpenUSD runtime id: ${e}`);
|
|
10850
|
-
|
|
10854
|
+
if (!r)
|
|
10855
|
+
return {
|
|
10856
|
+
moduleUrl: Ji(Yt.openUsdModuleUrl, e),
|
|
10857
|
+
wasmUrl: Ji(Yt.openUsdWasmUrl, e),
|
|
10858
|
+
runtimeId: e,
|
|
10859
|
+
apiVersion: Ne.apiVersion
|
|
10860
|
+
};
|
|
10861
|
+
const t = r.replace(/\/*$/, "/"), i = typeof document > "u" ? new URL(t, "file:///").href : new URL(t, document.baseURI).href, n = (s) => {
|
|
10851
10862
|
const a = new URL(s, i);
|
|
10852
10863
|
return a.searchParams.set("v", e), a.href;
|
|
10853
10864
|
};
|
|
10854
10865
|
return {
|
|
10855
|
-
moduleUrl: n(
|
|
10856
|
-
wasmUrl: n(
|
|
10866
|
+
moduleUrl: n(Ne.js.file),
|
|
10867
|
+
wasmUrl: n(Ne.wasm.file),
|
|
10857
10868
|
runtimeId: e,
|
|
10858
|
-
apiVersion:
|
|
10869
|
+
apiVersion: Ne.apiVersion
|
|
10859
10870
|
};
|
|
10860
10871
|
}
|
|
10861
|
-
async function
|
|
10872
|
+
async function In(r, e) {
|
|
10862
10873
|
const t = await fetch(r, { signal: e });
|
|
10863
10874
|
if (!t.ok)
|
|
10864
10875
|
throw Object.assign(new Error(`WASM request failed (${t.status}): ${r}`), {
|
|
@@ -10866,7 +10877,7 @@ async function An(r, e) {
|
|
|
10866
10877
|
});
|
|
10867
10878
|
return WebAssembly.compile(await t.arrayBuffer());
|
|
10868
10879
|
}
|
|
10869
|
-
function
|
|
10880
|
+
function id(r, e, t) {
|
|
10870
10881
|
return WebAssembly.instantiate(r, e).then(
|
|
10871
10882
|
(i) => t(i, r),
|
|
10872
10883
|
(i) => {
|
|
@@ -10876,25 +10887,25 @@ function Ql(r, e, t) {
|
|
|
10876
10887
|
}
|
|
10877
10888
|
), {};
|
|
10878
10889
|
}
|
|
10879
|
-
function
|
|
10880
|
-
const e =
|
|
10890
|
+
function nd(r = {}) {
|
|
10891
|
+
const e = An(
|
|
10881
10892
|
r.openUsdBaseUrl,
|
|
10882
10893
|
r.openUsdRuntimeId
|
|
10883
10894
|
);
|
|
10884
|
-
return
|
|
10895
|
+
return In(e.wasmUrl, r.signal);
|
|
10885
10896
|
}
|
|
10886
|
-
function
|
|
10887
|
-
return r ? new URL("mujoco.wasm", r).href :
|
|
10897
|
+
function Cl(r) {
|
|
10898
|
+
return r ? new URL("mujoco.wasm", r).href : sr;
|
|
10888
10899
|
}
|
|
10889
|
-
function
|
|
10890
|
-
return
|
|
10900
|
+
function rd(r = {}) {
|
|
10901
|
+
return In(Cl(r.mujocoBaseUrl), r.signal);
|
|
10891
10902
|
}
|
|
10892
|
-
let
|
|
10893
|
-
function
|
|
10894
|
-
return
|
|
10895
|
-
})),
|
|
10903
|
+
let Zi = null;
|
|
10904
|
+
function sd() {
|
|
10905
|
+
return Zi ?? (Zi = import("./usd-session-DSFtJk4b.js").then(() => {
|
|
10906
|
+
})), Zi;
|
|
10896
10907
|
}
|
|
10897
|
-
function
|
|
10908
|
+
function El(r) {
|
|
10898
10909
|
return r instanceof Error ? {
|
|
10899
10910
|
name: r.name,
|
|
10900
10911
|
message: r.message,
|
|
@@ -10902,14 +10913,14 @@ function Cl(r) {
|
|
|
10902
10913
|
...r.stack ? { stack: r.stack } : {}
|
|
10903
10914
|
} : { name: "Error", message: String(r) };
|
|
10904
10915
|
}
|
|
10905
|
-
function
|
|
10916
|
+
function Oe(r) {
|
|
10906
10917
|
const e = Object.assign(new Error(r.message), {
|
|
10907
10918
|
name: r.name,
|
|
10908
10919
|
...r.code ? { code: r.code } : {}
|
|
10909
10920
|
});
|
|
10910
10921
|
return r.stack && (e.stack = r.stack), e;
|
|
10911
10922
|
}
|
|
10912
|
-
const
|
|
10923
|
+
const kl = [
|
|
10913
10924
|
1,
|
|
10914
10925
|
0,
|
|
10915
10926
|
0,
|
|
@@ -10927,33 +10938,33 @@ const El = [
|
|
|
10927
10938
|
0,
|
|
10928
10939
|
1
|
|
10929
10940
|
];
|
|
10930
|
-
function
|
|
10941
|
+
function Sl(r) {
|
|
10931
10942
|
const e = new Map(r.map((s) => [s.path, s])), t = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set(), n = (s) => {
|
|
10932
10943
|
const a = t.get(s.path);
|
|
10933
10944
|
if (a) return a;
|
|
10934
|
-
if (i.has(s.path)) return
|
|
10945
|
+
if (i.has(s.path)) return Qi(s.localMatrix);
|
|
10935
10946
|
i.add(s.path);
|
|
10936
|
-
const o =
|
|
10947
|
+
const o = Qi(s.localMatrix), l = s.parentPath ? e.get(s.parentPath) : void 0, d = !l || s.resetsXformStack ? o : en(o, n(l));
|
|
10937
10948
|
return i.delete(s.path), t.set(s.path, d), d;
|
|
10938
10949
|
};
|
|
10939
10950
|
return r.map((s) => {
|
|
10940
10951
|
if (!s.resetsXformStack || !s.parentPath) return s;
|
|
10941
10952
|
const a = e.get(s.parentPath);
|
|
10942
10953
|
if (!a) return s;
|
|
10943
|
-
const o = n(a), l =
|
|
10954
|
+
const o = n(a), l = Ml(o);
|
|
10944
10955
|
return l ? {
|
|
10945
10956
|
...s,
|
|
10946
|
-
localMatrix:
|
|
10957
|
+
localMatrix: en(n(s), l)
|
|
10947
10958
|
} : s;
|
|
10948
10959
|
});
|
|
10949
10960
|
}
|
|
10950
|
-
function
|
|
10951
|
-
return
|
|
10961
|
+
function Qi(r) {
|
|
10962
|
+
return Pl(r) ? r : kl;
|
|
10952
10963
|
}
|
|
10953
|
-
function
|
|
10964
|
+
function Pl(r) {
|
|
10954
10965
|
return (r == null ? void 0 : r.length) === 16 && r.every(Number.isFinite);
|
|
10955
10966
|
}
|
|
10956
|
-
function
|
|
10967
|
+
function en(r, e) {
|
|
10957
10968
|
const t = new Array(16);
|
|
10958
10969
|
for (let i = 0; i < 4; i++)
|
|
10959
10970
|
for (let n = 0; n < 4; n++) {
|
|
@@ -10964,7 +10975,7 @@ function Zi(r, e) {
|
|
|
10964
10975
|
}
|
|
10965
10976
|
return t;
|
|
10966
10977
|
}
|
|
10967
|
-
function
|
|
10978
|
+
function Ml(r) {
|
|
10968
10979
|
const [
|
|
10969
10980
|
e,
|
|
10970
10981
|
t,
|
|
@@ -11012,12 +11023,12 @@ function Pl(r) {
|
|
|
11012
11023
|
1
|
|
11013
11024
|
];
|
|
11014
11025
|
}
|
|
11015
|
-
function
|
|
11026
|
+
function ad(r, e = []) {
|
|
11016
11027
|
return {
|
|
11017
11028
|
stage: r.stage,
|
|
11018
11029
|
view: {
|
|
11019
11030
|
...r.view,
|
|
11020
|
-
prims:
|
|
11031
|
+
prims: Sl(r.view.prims)
|
|
11021
11032
|
},
|
|
11022
11033
|
elements: r.elements,
|
|
11023
11034
|
materials: r.materials,
|
|
@@ -11031,10 +11042,10 @@ function nd(r, e = []) {
|
|
|
11031
11042
|
variants: e
|
|
11032
11043
|
};
|
|
11033
11044
|
}
|
|
11034
|
-
function
|
|
11045
|
+
function Rl(r, e) {
|
|
11035
11046
|
r.physics = e.physics, r.joints = e.joints;
|
|
11036
11047
|
}
|
|
11037
|
-
function
|
|
11048
|
+
function od(r) {
|
|
11038
11049
|
const e = r.materialSubsets;
|
|
11039
11050
|
if (!Array.isArray(e))
|
|
11040
11051
|
throw new Error(`USD probe omitted material subset hints for ${r.path}.`);
|
|
@@ -11045,7 +11056,7 @@ function rd(r) {
|
|
|
11045
11056
|
}
|
|
11046
11057
|
return e;
|
|
11047
11058
|
}
|
|
11048
|
-
function
|
|
11059
|
+
function ld(r) {
|
|
11049
11060
|
const e = r;
|
|
11050
11061
|
if (!Object.hasOwn(e, "surface"))
|
|
11051
11062
|
throw new Error(`USD probe omitted surface metadata for ${r.path}.`);
|
|
@@ -11054,7 +11065,7 @@ function sd(r) {
|
|
|
11054
11065
|
throw new Error(`USD probe returned invalid surface metadata for ${r.path}.`);
|
|
11055
11066
|
return e.surface;
|
|
11056
11067
|
}
|
|
11057
|
-
function
|
|
11068
|
+
function dd(r) {
|
|
11058
11069
|
const e = r;
|
|
11059
11070
|
if (!Object.hasOwn(e, "surfaceTerminals")) return null;
|
|
11060
11071
|
if (!Array.isArray(e.surfaceTerminals))
|
|
@@ -11075,13 +11086,13 @@ function ad(r) {
|
|
|
11075
11086
|
}
|
|
11076
11087
|
return Object.freeze(t);
|
|
11077
11088
|
}
|
|
11078
|
-
function
|
|
11089
|
+
function cd(r) {
|
|
11079
11090
|
const e = r;
|
|
11080
11091
|
if (typeof e.doubleSidedAuthored != "boolean")
|
|
11081
11092
|
throw new Error(`USD probe omitted authored double-sided metadata for ${r.path}.`);
|
|
11082
11093
|
return e.doubleSidedAuthored;
|
|
11083
11094
|
}
|
|
11084
|
-
function
|
|
11095
|
+
function ud(r) {
|
|
11085
11096
|
const e = r;
|
|
11086
11097
|
if (e.uvTopology === null) return null;
|
|
11087
11098
|
if (!e.uvTopology || typeof e.uvTopology != "object")
|
|
@@ -11095,7 +11106,7 @@ function ld(r) {
|
|
|
11095
11106
|
indexed: t.indexed
|
|
11096
11107
|
};
|
|
11097
11108
|
}
|
|
11098
|
-
function
|
|
11109
|
+
function hd(r) {
|
|
11099
11110
|
const e = r;
|
|
11100
11111
|
if (typeof e.purpose != "string" || !e.purpose)
|
|
11101
11112
|
throw new Error(`USD probe omitted visual purpose metadata for ${e.path}.`);
|
|
@@ -11111,10 +11122,10 @@ function Al() {
|
|
|
11111
11122
|
};
|
|
11112
11123
|
}
|
|
11113
11124
|
let te = null;
|
|
11114
|
-
function
|
|
11125
|
+
function Ln(r, e) {
|
|
11115
11126
|
return r.moduleUrl === e.moduleUrl && r.wasmUrl === e.wasmUrl && r.runtimeId === e.runtimeId && r.apiVersion === e.apiVersion && r.wasmModule === e.wasmModule;
|
|
11116
11127
|
}
|
|
11117
|
-
function
|
|
11128
|
+
function Dn() {
|
|
11118
11129
|
return new Worker(new URL(
|
|
11119
11130
|
/* @vite-ignore */
|
|
11120
11131
|
"" + new URL("assets/usd-worker-CPCXyXkl.js", import.meta.url).href,
|
|
@@ -11124,43 +11135,43 @@ function In() {
|
|
|
11124
11135
|
name: "openusd-usd-stage"
|
|
11125
11136
|
});
|
|
11126
11137
|
}
|
|
11127
|
-
function
|
|
11138
|
+
function Tn(r, e, t) {
|
|
11128
11139
|
return new Promise((i, n) => {
|
|
11129
11140
|
const s = () => {
|
|
11130
11141
|
r.onmessage = null, r.onerror = null;
|
|
11131
11142
|
};
|
|
11132
11143
|
r.onmessage = (a) => {
|
|
11133
11144
|
const o = a.data;
|
|
11134
|
-
o.type === "worker-ready" ? (s(), i()) : o.type === "error" && (s(), r.terminate(), n(
|
|
11145
|
+
o.type === "worker-ready" ? (s(), i()) : o.type === "error" && (s(), r.terminate(), n(Oe(o.error)));
|
|
11135
11146
|
}, r.onerror = (a) => {
|
|
11136
11147
|
s(), r.terminate(), n(new Error(a.message || "USD worker failed during preparation"));
|
|
11137
11148
|
}, r.postMessage({ type: "prepare", runtime: e, warmup: t });
|
|
11138
11149
|
});
|
|
11139
11150
|
}
|
|
11140
|
-
async function
|
|
11151
|
+
async function Il(r, e) {
|
|
11141
11152
|
if (typeof Worker > "u") return;
|
|
11142
|
-
const t =
|
|
11143
|
-
if (te &&
|
|
11153
|
+
const t = An(r, e);
|
|
11154
|
+
if (te && Ln(te.runtime, t)) {
|
|
11144
11155
|
await te.ready;
|
|
11145
11156
|
return;
|
|
11146
11157
|
}
|
|
11147
11158
|
te && (te.worker.terminate(), te = null);
|
|
11148
|
-
const i =
|
|
11159
|
+
const i = Dn(), n = Tn(i, t, !0), s = { worker: i, runtime: t, ready: n };
|
|
11149
11160
|
te = s, n.catch(() => {
|
|
11150
11161
|
te === s && (te = null);
|
|
11151
11162
|
}), await n;
|
|
11152
11163
|
}
|
|
11153
|
-
function
|
|
11164
|
+
function Ll(r) {
|
|
11154
11165
|
const e = te;
|
|
11155
|
-
return e ? (te = null,
|
|
11166
|
+
return e ? (te = null, Ln(e.runtime, r) ? e : (e.worker.terminate(), null)) : null;
|
|
11156
11167
|
}
|
|
11157
|
-
async function
|
|
11168
|
+
async function pd(r, e, t) {
|
|
11158
11169
|
var L, V, j, Q, O;
|
|
11159
11170
|
if (typeof Worker > "u") throw new Error("Web Worker is unavailable");
|
|
11160
|
-
const i =
|
|
11171
|
+
const i = Ll(r), n = (i == null ? void 0 : i.worker) ?? Dn(), s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), l = [];
|
|
11161
11172
|
let d = 0, c = 1, p = !1, h = !1, m = !1, f = !1, b = null, y = /* @__PURE__ */ new Map(), v = () => {
|
|
11162
11173
|
};
|
|
11163
|
-
const g = (i == null ? void 0 : i.ready) ??
|
|
11174
|
+
const g = (i == null ? void 0 : i.ready) ?? Tn(n, r, !1), w = new Promise((T, B) => {
|
|
11164
11175
|
v = B, g.then(T, B);
|
|
11165
11176
|
});
|
|
11166
11177
|
w.catch(() => {
|
|
@@ -11221,87 +11232,87 @@ async function ud(r, e, t) {
|
|
|
11221
11232
|
if ((j = t.signal) != null && j.aborted) throw Ze();
|
|
11222
11233
|
const ve = new Promise((N, z) => {
|
|
11223
11234
|
U = z, n.onerror = (ee) => {
|
|
11224
|
-
const
|
|
11225
|
-
z(
|
|
11226
|
-
for (const G of s.values()) G.reject(
|
|
11235
|
+
const R = new Error(ee.message || "USD worker failed");
|
|
11236
|
+
z(R);
|
|
11237
|
+
for (const G of s.values()) G.reject(R);
|
|
11227
11238
|
s.clear(), D();
|
|
11228
11239
|
}, n.onmessage = async (ee) => {
|
|
11229
11240
|
var G, ue;
|
|
11230
|
-
const
|
|
11231
|
-
switch (
|
|
11241
|
+
const R = ee.data;
|
|
11242
|
+
switch (R.type) {
|
|
11232
11243
|
case "visual-ready":
|
|
11233
11244
|
if (h) return;
|
|
11234
|
-
h = !0, b =
|
|
11245
|
+
h = !0, b = R.data, y = new Map(R.textureURLs ?? []), N(b);
|
|
11235
11246
|
return;
|
|
11236
11247
|
case "physics-ready": {
|
|
11237
11248
|
if (!b || m) return;
|
|
11238
|
-
m = !0,
|
|
11249
|
+
m = !0, Rl(b, R.phase), x(R.phase);
|
|
11239
11250
|
return;
|
|
11240
11251
|
}
|
|
11241
11252
|
case "physics-failed":
|
|
11242
11253
|
if (m) return;
|
|
11243
|
-
m = !0, C(
|
|
11254
|
+
m = !0, C(Oe(R.error));
|
|
11244
11255
|
return;
|
|
11245
11256
|
case "resource-request": {
|
|
11246
11257
|
try {
|
|
11247
|
-
const F = await t.resolveBytes(new URL(
|
|
11258
|
+
const F = await t.resolveBytes(new URL(R.url), R.identifier), he = { type: "resource-result", id: R.id, bytes: F };
|
|
11248
11259
|
n.postMessage(he, [F.buffer]);
|
|
11249
11260
|
} catch (F) {
|
|
11250
11261
|
const he = {
|
|
11251
11262
|
type: "resource-result",
|
|
11252
|
-
id:
|
|
11253
|
-
error:
|
|
11263
|
+
id: R.id,
|
|
11264
|
+
error: El(F)
|
|
11254
11265
|
};
|
|
11255
11266
|
n.postMessage(he);
|
|
11256
11267
|
}
|
|
11257
11268
|
return;
|
|
11258
11269
|
}
|
|
11259
11270
|
case "event":
|
|
11260
|
-
|
|
11271
|
+
R.event === "reference-skipped" ? (G = t.onReferenceSkipped) == null || G.call(t, R.identifier) : (ue = t.onResourceFailed) == null || ue.call(t, R.identifier, Oe(R.error));
|
|
11261
11272
|
return;
|
|
11262
11273
|
case "query-result": {
|
|
11263
|
-
const F = s.get(
|
|
11264
|
-
s.delete(
|
|
11274
|
+
const F = s.get(R.id);
|
|
11275
|
+
s.delete(R.id), F == null || F.resolve(R.value);
|
|
11265
11276
|
return;
|
|
11266
11277
|
}
|
|
11267
11278
|
case "texture-decoded": {
|
|
11268
|
-
const F = s.get(
|
|
11269
|
-
s.delete(
|
|
11279
|
+
const F = s.get(R.id);
|
|
11280
|
+
s.delete(R.id), F == null || F.resolve(R.bitmap);
|
|
11270
11281
|
return;
|
|
11271
11282
|
}
|
|
11272
11283
|
case "error":
|
|
11273
|
-
if (
|
|
11274
|
-
const F = s.get(
|
|
11275
|
-
s.delete(
|
|
11284
|
+
if (R.id !== void 0) {
|
|
11285
|
+
const F = s.get(R.id);
|
|
11286
|
+
s.delete(R.id), F == null || F.reject(Oe(R.error));
|
|
11276
11287
|
} else {
|
|
11277
|
-
const F =
|
|
11288
|
+
const F = Oe(R.error);
|
|
11278
11289
|
z(F), D();
|
|
11279
11290
|
}
|
|
11280
11291
|
}
|
|
11281
11292
|
};
|
|
11282
11293
|
});
|
|
11283
11294
|
E({ type: "load", input: oe, options: ce }, [oe.buffer]);
|
|
11284
|
-
const
|
|
11295
|
+
const Ue = await ve;
|
|
11285
11296
|
if ((Q = t.signal) != null && Q.aborted) throw Ze();
|
|
11286
11297
|
const K = async (N, z) => {
|
|
11287
11298
|
if (p) return Promise.reject(new Error("USD worker disposed"));
|
|
11288
11299
|
const ee = c++;
|
|
11289
11300
|
try {
|
|
11290
|
-
return await new Promise((
|
|
11291
|
-
s.set(ee, { resolve: (ue) =>
|
|
11301
|
+
return await new Promise((R, G) => {
|
|
11302
|
+
s.set(ee, { resolve: (ue) => R(ue), reject: G }), E({ type: "query", id: ee, method: N, args: z });
|
|
11292
11303
|
});
|
|
11293
|
-
} catch (
|
|
11294
|
-
const G =
|
|
11304
|
+
} catch (R) {
|
|
11305
|
+
const G = R instanceof Error ? R.message : String(R);
|
|
11295
11306
|
throw Object.assign(
|
|
11296
11307
|
new Error(`USD stage query ${N}(${z.map(String).join(", ")}) failed: ${G}`),
|
|
11297
11308
|
{
|
|
11298
|
-
code:
|
|
11309
|
+
code: R && typeof R == "object" && "code" in R ? String(R.code) : "E_USD_QUERY"
|
|
11299
11310
|
}
|
|
11300
11311
|
);
|
|
11301
11312
|
}
|
|
11302
11313
|
};
|
|
11303
11314
|
return {
|
|
11304
|
-
data:
|
|
11315
|
+
data: Ue,
|
|
11305
11316
|
query: {
|
|
11306
11317
|
stageMetadata: (N) => K("stageMetadata", [N]),
|
|
11307
11318
|
primInfo: (N) => K("primInfo", [N]),
|
|
@@ -11319,10 +11330,10 @@ async function ud(r, e, t) {
|
|
|
11319
11330
|
textureURLs: y,
|
|
11320
11331
|
decodeTexture(N, z, ee) {
|
|
11321
11332
|
if (p) return Promise.reject(new Error("USD worker disposed"));
|
|
11322
|
-
const
|
|
11333
|
+
const R = ee ? Dl(ee) : N, G = `${z}:${R}`, ue = a.get(G);
|
|
11323
11334
|
if (ue) return ue;
|
|
11324
|
-
const F = new Promise((he,
|
|
11325
|
-
l.push({ url: N, maxDimension: z, resolve: he, reject:
|
|
11335
|
+
const F = new Promise((he, On) => {
|
|
11336
|
+
l.push({ url: N, maxDimension: z, resolve: he, reject: On }), I();
|
|
11326
11337
|
});
|
|
11327
11338
|
return a.set(G, F), F.then((he) => {
|
|
11328
11339
|
o.add(he);
|
|
@@ -11341,7 +11352,7 @@ async function ud(r, e, t) {
|
|
|
11341
11352
|
(O = t.signal) == null || O.removeEventListener("abort", S);
|
|
11342
11353
|
}
|
|
11343
11354
|
}
|
|
11344
|
-
function
|
|
11355
|
+
function Dl(r) {
|
|
11345
11356
|
if (/^https?:/i.test(r)) return r;
|
|
11346
11357
|
const e = [];
|
|
11347
11358
|
for (const t of r.replaceAll("\\", "/").split("/"))
|
|
@@ -11351,7 +11362,10 @@ function Il(r) {
|
|
|
11351
11362
|
function Ze() {
|
|
11352
11363
|
return Object.assign(new Error("USD load aborted."), { name: "AbortError", code: "E_ABORTED" });
|
|
11353
11364
|
}
|
|
11354
|
-
|
|
11365
|
+
function md(r, e) {
|
|
11366
|
+
return Il(r, e);
|
|
11367
|
+
}
|
|
11368
|
+
const Tl = "E_ASSET_RESOURCE_NOT_FOUND", Nl = "E_ASSET_RESOURCE_INVALID", Ol = "E_ASSET_FETCH", jl = "E_ASSET_EXTERNAL_DENIED", Fl = "E_ASSET_AUTH", zl = /* @__PURE__ */ new Set([
|
|
11355
11369
|
"png",
|
|
11356
11370
|
"jpg",
|
|
11357
11371
|
"jpeg",
|
|
@@ -11364,78 +11378,78 @@ const Ll = "E_ASSET_RESOURCE_NOT_FOUND", Dl = "E_ASSET_RESOURCE_INVALID", Tl = "
|
|
|
11364
11378
|
"hdr",
|
|
11365
11379
|
"exr",
|
|
11366
11380
|
"ktx2"
|
|
11367
|
-
]),
|
|
11368
|
-
function
|
|
11381
|
+
]), $l = /* @__PURE__ */ new Set(["usd", "usda", "usdc", "usdz"]);
|
|
11382
|
+
function Vl(r) {
|
|
11369
11383
|
var t;
|
|
11370
11384
|
return ((t = (r.split(/[?#]/, 1)[0] ?? r).split(".").pop()) == null ? void 0 : t.toLowerCase()) ?? "";
|
|
11371
11385
|
}
|
|
11372
|
-
function
|
|
11373
|
-
const e =
|
|
11374
|
-
return
|
|
11386
|
+
function fd(r) {
|
|
11387
|
+
const e = Vl(r);
|
|
11388
|
+
return zl.has(e) && !$l.has(e);
|
|
11375
11389
|
}
|
|
11376
|
-
function
|
|
11390
|
+
function vd(r, e) {
|
|
11377
11391
|
return Object.assign(new Error(r), { code: e });
|
|
11378
11392
|
}
|
|
11379
|
-
function
|
|
11393
|
+
function Bl(r) {
|
|
11380
11394
|
var i;
|
|
11381
11395
|
if (r instanceof Error && r.name === "AbortError") return "aborted";
|
|
11382
11396
|
const e = r == null ? void 0 : r.code;
|
|
11383
|
-
if (e ===
|
|
11384
|
-
if (e ===
|
|
11385
|
-
if (e ===
|
|
11386
|
-
if (e ===
|
|
11397
|
+
if (e === Tl) return "missing";
|
|
11398
|
+
if (e === Nl) return "invalid";
|
|
11399
|
+
if (e === Ol) return "unavailable";
|
|
11400
|
+
if (e === Fl || e === jl) return "denied";
|
|
11387
11401
|
const t = (i = /\((\d{3})\)/.exec(r instanceof Error ? r.message : "")) == null ? void 0 : i[1];
|
|
11388
11402
|
return t === "404" || t === "410" ? "missing" : t === "401" || t === "403" ? "denied" : t != null && t.startsWith("5") ? "unavailable" : "unknown";
|
|
11389
11403
|
}
|
|
11390
|
-
function
|
|
11391
|
-
const e =
|
|
11404
|
+
function gd(r) {
|
|
11405
|
+
const e = Bl(r);
|
|
11392
11406
|
return e === "missing" || e === "invalid" || e === "unavailable";
|
|
11393
11407
|
}
|
|
11394
|
-
function
|
|
11408
|
+
function Nn(r, e) {
|
|
11395
11409
|
return r && /\bhtml\b/i.test(r) ? `返回 HTML 页面(${r})` : r && !/^text\//i.test(r) ? null : /^\uFEFF?\s*(?:<!doctype\s+html|<html|<\?xml[^>]*\bhtml)/i.test(e) ? "返回 HTML 兜底页" : null;
|
|
11396
11410
|
}
|
|
11397
|
-
function
|
|
11398
|
-
return e.byteLength ?
|
|
11411
|
+
function bd(r, e) {
|
|
11412
|
+
return e.byteLength ? Nn(r, new TextDecoder().decode(e.subarray(0, 512))) : "响应内容为空";
|
|
11399
11413
|
}
|
|
11400
|
-
async function
|
|
11401
|
-
return r.size ?
|
|
11414
|
+
async function yd(r) {
|
|
11415
|
+
return r.size ? Nn(r.type, await r.slice(0, 512).text()) : "响应内容为空";
|
|
11402
11416
|
}
|
|
11403
11417
|
export {
|
|
11404
|
-
|
|
11405
|
-
|
|
11406
|
-
|
|
11407
|
-
|
|
11408
|
-
|
|
11409
|
-
|
|
11410
|
-
|
|
11411
|
-
|
|
11412
|
-
|
|
11413
|
-
|
|
11418
|
+
jl as A,
|
|
11419
|
+
rd as B,
|
|
11420
|
+
nd as C,
|
|
11421
|
+
je as D,
|
|
11422
|
+
ed as E,
|
|
11423
|
+
Ba as F,
|
|
11424
|
+
sd as G,
|
|
11425
|
+
md as H,
|
|
11426
|
+
ar as I,
|
|
11427
|
+
Nl as U,
|
|
11414
11428
|
Ee as V,
|
|
11415
|
-
|
|
11416
|
-
|
|
11417
|
-
|
|
11418
|
-
|
|
11419
|
-
|
|
11420
|
-
|
|
11421
|
-
|
|
11422
|
-
|
|
11423
|
-
|
|
11424
|
-
|
|
11425
|
-
|
|
11426
|
-
|
|
11427
|
-
|
|
11428
|
-
|
|
11429
|
-
|
|
11430
|
-
|
|
11431
|
-
|
|
11432
|
-
|
|
11433
|
-
|
|
11434
|
-
|
|
11435
|
-
|
|
11436
|
-
|
|
11437
|
-
|
|
11438
|
-
|
|
11439
|
-
|
|
11440
|
-
|
|
11429
|
+
Rl as a,
|
|
11430
|
+
id as b,
|
|
11431
|
+
vd as c,
|
|
11432
|
+
ad as d,
|
|
11433
|
+
ml as e,
|
|
11434
|
+
fd as f,
|
|
11435
|
+
gd as g,
|
|
11436
|
+
cd as h,
|
|
11437
|
+
bd as i,
|
|
11438
|
+
dd as j,
|
|
11439
|
+
td as k,
|
|
11440
|
+
od as l,
|
|
11441
|
+
ud as m,
|
|
11442
|
+
ld as n,
|
|
11443
|
+
Ne as o,
|
|
11444
|
+
Bl as p,
|
|
11445
|
+
An as q,
|
|
11446
|
+
hd as r,
|
|
11447
|
+
pd as s,
|
|
11448
|
+
Bi as t,
|
|
11449
|
+
Tl as u,
|
|
11450
|
+
Fl as v,
|
|
11451
|
+
Ol as w,
|
|
11452
|
+
yd as x,
|
|
11453
|
+
Ql as y,
|
|
11454
|
+
Cl as z
|
|
11441
11455
|
};
|