@nebula-spatial/viewer 0.5.11 → 0.5.13
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 +38 -0
- package/MATERIALX-LIBRARY-AUDIT.md +250 -0
- package/USD-VISUAL-MATERIAL-SUPPORT.md +57 -10
- package/dist/{collision-debug-COTEHr4t.js → collision-debug-Aey5D_9r.js} +1 -1
- package/dist/{index-BStaY4GZ.js → index-DbJbq4N_.js} +375 -372
- package/dist/index.js +1 -1
- package/dist/{mjcf-visual-CD52zbv0.js → mjcf-visual-B3UBh_gG.js} +1 -1
- package/dist/{mujoco-runtime-sHgzRbpf.js → mujoco-runtime-BPCq2bmg.js} +1 -1
- package/dist/{session-CU4-Zy1h.js → session-52jx0mHi.js} +7 -7
- package/dist/{session-HOTFzdIP.js → session-C0KFNp50.js} +2 -2
- package/dist/{stage-BwDT2iC9.js → stage-PhbBBoMY.js} +1 -1
- package/dist/{urdf-session-D-o78xoS.js → urdf-session-DPOKRNNw.js} +5 -5
- package/dist/usd-session-Co9oFkxC.js +9636 -0
- package/dist/version.d.ts +1 -1
- package/dist/{xacro-Bpz-UyEX.js → xacro-B50iFe4M.js} +1 -1
- package/package.json +3 -1
- package/dist/usd-session-CxFNEMic.js +0 -8374
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
var Nn = Object.defineProperty;
|
|
2
2
|
var On = (r, e, t) => e in r ? Nn(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
3
|
var u = (r, e, t) => On(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { Texture as
|
|
4
|
+
import { Texture as ot, Scene as ze, OrthographicCamera as St, PlaneGeometry as Qi, ShaderMaterial as en, KeepStencilOp as ke, EqualStencilFunc as Qe, Matrix3 as tn, 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 nn, MeshPhysicalMaterial as jt, FrontSide as jn, Vector3 as M, ShaderChunk as Ut, MOUSE as re, Object3D as rn, Group as sn, Raycaster as lt, Vector2 as J, Quaternion as it, WebGLRenderer as an, PerspectiveCamera as on, TOUCH as _t, Vector4 as Fn, Plane as ln, WebGLRenderTarget as zn, Box3 as Z, PMREMGenerator as $n, TextureLoader as dn, SRGBColorSpace as Ft, ACESFilmicToneMapping as Vn, MeshStandardMaterial as Bn, SphereGeometry as Un, Sphere as Ht, UniformsUtils as _n, BoxHelper as Hn, Box3Helper as qn, BoxGeometry as Yn, LineSegments as Wn, EdgesGeometry as Gn, LineBasicMaterial as Xn } from "three";
|
|
5
5
|
import { RoomEnvironment as Kn } from "three/addons/environments/RoomEnvironment.js";
|
|
6
6
|
import { MapControls as Jn } from "three/addons/controls/MapControls.js";
|
|
7
7
|
import { OrbitControls as Zn } from "three/addons/controls/OrbitControls.js";
|
|
8
8
|
import { HDRLoader as cn } from "three/addons/loaders/HDRLoader.js";
|
|
9
|
-
import { createCadDocumentSession as Qn, getCadDocumentRenderResource as er, formatCadInsertId as
|
|
9
|
+
import { createCadDocumentSession as Qn, getCadDocumentRenderResource as er, formatCadInsertId as qt } from "@nebula-spatial/cad-loader";
|
|
10
10
|
import { CSS2DObject as tr, CSS2DRenderer as ir } from "three/addons/renderers/CSS2DRenderer.js";
|
|
11
11
|
import nr from "@mujoco/mujoco/mujoco.wasm?url";
|
|
12
|
-
const rr = "0.5.
|
|
13
|
-
function
|
|
12
|
+
const rr = "0.5.13", sr = "@nebula-spatial/viewer", Yt = "__NEBULA_SPATIAL_VIEWER_BANNER_PRINTED__";
|
|
13
|
+
function Wt() {
|
|
14
14
|
const r = `%c ${sr} %c v${rr} `;
|
|
15
15
|
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
16
|
}
|
|
17
17
|
try {
|
|
18
18
|
const r = globalThis;
|
|
19
|
-
r[
|
|
19
|
+
r[Yt] || (r[Yt] = !0, Wt());
|
|
20
20
|
} catch {
|
|
21
|
-
|
|
21
|
+
Wt();
|
|
22
22
|
}
|
|
23
23
|
const ar = [
|
|
24
24
|
"alphaMap",
|
|
@@ -46,7 +46,7 @@ const ar = [
|
|
|
46
46
|
"thicknessMap",
|
|
47
47
|
"transmissionMap"
|
|
48
48
|
];
|
|
49
|
-
function
|
|
49
|
+
function nt(r, e) {
|
|
50
50
|
e.has(r) || (e.add(r), r.dispose());
|
|
51
51
|
}
|
|
52
52
|
function or(r, e, t) {
|
|
@@ -54,20 +54,20 @@ function or(r, e, t) {
|
|
|
54
54
|
const i = r;
|
|
55
55
|
for (const n of ar) {
|
|
56
56
|
const s = i[n];
|
|
57
|
-
s instanceof
|
|
57
|
+
s instanceof ot && nt(s, t);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
nt(r, t);
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function Gt(r, e = {}) {
|
|
63
63
|
const t = e.disposedResources ?? /* @__PURE__ */ new WeakSet(), i = e.disposeTextures !== !1;
|
|
64
64
|
r.traverse((n) => {
|
|
65
65
|
const s = n;
|
|
66
|
-
s.geometry &&
|
|
66
|
+
s.geometry && nt(s.geometry, t);
|
|
67
67
|
const a = Array.isArray(s.material) ? s.material : [s.material];
|
|
68
68
|
for (const o of a)
|
|
69
69
|
o && or(o, i, t);
|
|
70
|
-
s.renderTarget &&
|
|
70
|
+
s.renderTarget && nt(s.renderTarget, t);
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
function pe(r) {
|
|
@@ -78,7 +78,7 @@ function pe(r) {
|
|
|
78
78
|
}
|
|
79
79
|
return !0;
|
|
80
80
|
}
|
|
81
|
-
const
|
|
81
|
+
const Xt = 31, Kt = "HDR_BACKDROP_BLUR", lr = (
|
|
82
82
|
/* glsl */
|
|
83
83
|
`
|
|
84
84
|
varying vec2 vUv;
|
|
@@ -136,13 +136,13 @@ class cr {
|
|
|
136
136
|
u(this, "candidates", []);
|
|
137
137
|
u(this, "activeCandidates", []);
|
|
138
138
|
u(this, "backdropScene", new ze());
|
|
139
|
-
u(this, "backdropCamera", new
|
|
140
|
-
u(this, "backdropGeometry", new
|
|
141
|
-
u(this, "backdropMaterial", new
|
|
139
|
+
u(this, "backdropCamera", new St(-1, 1, 1, -1, 0, 1));
|
|
140
|
+
u(this, "backdropGeometry", new Qi(2, 2));
|
|
141
|
+
u(this, "backdropMaterial", new en({
|
|
142
142
|
name: "HdrTransparentBackdropMaterial",
|
|
143
143
|
uniforms: {
|
|
144
144
|
tEquirect: { value: null },
|
|
145
|
-
uvTransform: { value: new
|
|
145
|
+
uvTransform: { value: new tn() },
|
|
146
146
|
backgroundIntensity: { value: 1 },
|
|
147
147
|
blurriness: { value: 0 },
|
|
148
148
|
yawOffset: { value: 0 }
|
|
@@ -153,28 +153,28 @@ class cr {
|
|
|
153
153
|
depthWrite: !1,
|
|
154
154
|
stencilWrite: !0,
|
|
155
155
|
stencilRef: 1,
|
|
156
|
-
stencilFunc:
|
|
156
|
+
stencilFunc: Qe,
|
|
157
157
|
stencilFail: ke,
|
|
158
158
|
stencilZFail: ke,
|
|
159
159
|
stencilZPass: ke,
|
|
160
160
|
toneMapped: !0
|
|
161
161
|
}));
|
|
162
162
|
u(this, "backdropMesh", new ae(this.backdropGeometry, this.backdropMaterial));
|
|
163
|
-
u(this, "maskMaterial", new
|
|
163
|
+
u(this, "maskMaterial", new Nt({
|
|
164
164
|
name: "HdrTransparentMaskMaterial",
|
|
165
165
|
colorWrite: !1,
|
|
166
166
|
depthTest: !1,
|
|
167
167
|
depthWrite: !1,
|
|
168
168
|
fog: !1,
|
|
169
|
-
side:
|
|
169
|
+
side: Ot,
|
|
170
170
|
stencilWrite: !0,
|
|
171
171
|
stencilRef: 1,
|
|
172
|
-
stencilFunc:
|
|
172
|
+
stencilFunc: Pt,
|
|
173
173
|
stencilFail: Se,
|
|
174
174
|
stencilZFail: Se,
|
|
175
175
|
stencilZPass: Se
|
|
176
176
|
}));
|
|
177
|
-
u(this, "previousClearColor", new
|
|
177
|
+
u(this, "previousClearColor", new tt());
|
|
178
178
|
u(this, "previousLayerMasks", []);
|
|
179
179
|
u(this, "blurriness", 0);
|
|
180
180
|
u(this, "yawOffset", 0);
|
|
@@ -200,7 +200,7 @@ class cr {
|
|
|
200
200
|
}
|
|
201
201
|
render(e, t, i, n) {
|
|
202
202
|
const s = t.environment;
|
|
203
|
-
if (this.disposed || !(s instanceof
|
|
203
|
+
if (this.disposed || !(s instanceof ot) || s.mapping !== Me || (this.dirty && this.refreshCandidates(n), this.candidates.length === 0)) return !1;
|
|
204
204
|
this.activeCandidates.length = 0;
|
|
205
205
|
for (const m of this.candidates)
|
|
206
206
|
pe(m) && i.layers.test(m.layers) && this.activeCandidates.push(m);
|
|
@@ -208,15 +208,15 @@ class cr {
|
|
|
208
208
|
const a = e.autoClear, o = e.getClearAlpha(), l = e.getClearColor(this.previousClearColor), d = t.background, c = t.overrideMaterial, p = i.layers.mask;
|
|
209
209
|
this.previousLayerMasks.length = 0;
|
|
210
210
|
for (const m of this.activeCandidates)
|
|
211
|
-
this.previousLayerMasks.push(m.layers.mask), m.layers.set(
|
|
211
|
+
this.previousLayerMasks.push(m.layers.mask), m.layers.set(Xt);
|
|
212
212
|
s.updateMatrix();
|
|
213
213
|
const h = this.backdropMaterial.uniforms;
|
|
214
214
|
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;
|
|
215
215
|
try {
|
|
216
216
|
return e.autoClear = !1, e.setClearColor(
|
|
217
|
-
t.background instanceof
|
|
217
|
+
t.background instanceof tt ? t.background : l,
|
|
218
218
|
1
|
|
219
|
-
), e.clear(!0, !0, !0), t.background = null, t.overrideMaterial = this.maskMaterial, i.layers.set(
|
|
219
|
+
), e.clear(!0, !0, !0), t.background = null, t.overrideMaterial = this.maskMaterial, i.layers.set(Xt), 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
220
|
} finally {
|
|
221
221
|
this.restoreCandidateLayers(), i.layers.mask = p, t.overrideMaterial = c, t.background = d, e.autoClear = a, e.setClearColor(l, o);
|
|
222
222
|
}
|
|
@@ -241,9 +241,9 @@ function ur(r) {
|
|
|
241
241
|
return (Array.isArray(r) ? r : [r]).some((t) => t.visible && t.transparent === !0);
|
|
242
242
|
}
|
|
243
243
|
function hr(r, e) {
|
|
244
|
-
e ? r.defines = { ...r.defines, [
|
|
244
|
+
e ? r.defines = { ...r.defines, [Kt]: "" } : r.defines && delete r.defines[Kt], r.needsUpdate = !0;
|
|
245
245
|
}
|
|
246
|
-
const
|
|
246
|
+
const Jt = "TRANSMISSION_BACKDROP_BLUR", pr = -9999, mr = -1e4, fr = (
|
|
247
247
|
/* glsl */
|
|
248
248
|
`
|
|
249
249
|
varying vec2 vUv;
|
|
@@ -309,28 +309,28 @@ class gr {
|
|
|
309
309
|
constructor() {
|
|
310
310
|
u(this, "candidates", /* @__PURE__ */ new Set());
|
|
311
311
|
u(this, "proxies", /* @__PURE__ */ new Map());
|
|
312
|
-
u(this, "backdropGeometry", new
|
|
313
|
-
u(this, "maskMaterial", new
|
|
312
|
+
u(this, "backdropGeometry", new Qi(2, 2));
|
|
313
|
+
u(this, "maskMaterial", new Nt({
|
|
314
314
|
name: "TransmissionHdrMaskMaterial",
|
|
315
315
|
colorWrite: !1,
|
|
316
316
|
depthTest: !1,
|
|
317
317
|
depthWrite: !1,
|
|
318
318
|
fog: !1,
|
|
319
|
-
side:
|
|
319
|
+
side: Ot,
|
|
320
320
|
stencilWrite: !0,
|
|
321
321
|
stencilRef: 1,
|
|
322
|
-
stencilFunc:
|
|
322
|
+
stencilFunc: Pt,
|
|
323
323
|
stencilFail: Se,
|
|
324
324
|
stencilZFail: Se,
|
|
325
325
|
stencilZPass: Se
|
|
326
326
|
}));
|
|
327
|
-
u(this, "backdropMaterial", new
|
|
327
|
+
u(this, "backdropMaterial", new en({
|
|
328
328
|
name: "TransmissionHdrBackdropMaterial",
|
|
329
329
|
uniforms: {
|
|
330
330
|
tEquirect: { value: null },
|
|
331
|
-
environmentRotation: { value: new
|
|
332
|
-
cameraProjectionMatrixInverse: { value: new
|
|
333
|
-
cameraWorldMatrix: { value: new
|
|
331
|
+
environmentRotation: { value: new tn() },
|
|
332
|
+
cameraProjectionMatrixInverse: { value: new ct() },
|
|
333
|
+
cameraWorldMatrix: { value: new ct() },
|
|
334
334
|
environmentIntensity: { value: 1 },
|
|
335
335
|
blurriness: { value: 0 }
|
|
336
336
|
},
|
|
@@ -341,7 +341,7 @@ class gr {
|
|
|
341
341
|
fog: !1,
|
|
342
342
|
stencilWrite: !0,
|
|
343
343
|
stencilRef: 1,
|
|
344
|
-
stencilFunc:
|
|
344
|
+
stencilFunc: Qe,
|
|
345
345
|
stencilFail: ke,
|
|
346
346
|
stencilZFail: ke,
|
|
347
347
|
stencilZPass: ke,
|
|
@@ -349,12 +349,15 @@ class gr {
|
|
|
349
349
|
}));
|
|
350
350
|
u(this, "backdropMesh", new ae(this.backdropGeometry, this.backdropMaterial));
|
|
351
351
|
u(this, "rotation", new nn());
|
|
352
|
-
u(this, "rotationMatrix", new
|
|
352
|
+
u(this, "rotationMatrix", new ct());
|
|
353
353
|
u(this, "blurriness", 0);
|
|
354
354
|
u(this, "dirty", !0);
|
|
355
355
|
u(this, "attachedScene", null);
|
|
356
356
|
u(this, "disposed", !1);
|
|
357
357
|
this.backdropMesh.name = "scene-runtime:transmission-hdr-backdrop", this.backdropMesh.frustumCulled = !1, this.backdropMesh.renderOrder = pr, this.backdropMesh.raycast = () => {
|
|
358
|
+
}, this.backdropMesh.onBeforeRender = (e) => {
|
|
359
|
+
const t = e.getRenderTarget() !== null;
|
|
360
|
+
this.backdropMaterial.stencilWrite = !t, this.backdropMaterial.stencilFunc = t ? Pt : Qe;
|
|
358
361
|
};
|
|
359
362
|
}
|
|
360
363
|
markDirty() {
|
|
@@ -371,7 +374,7 @@ class gr {
|
|
|
371
374
|
prepare(e, t) {
|
|
372
375
|
if (this.disposed) return !1;
|
|
373
376
|
const i = e.environment;
|
|
374
|
-
if (!(i instanceof
|
|
377
|
+
if (!(i instanceof ot) || i.mapping !== Me)
|
|
375
378
|
return this.finish(), !1;
|
|
376
379
|
if (this.dirty && this.refreshCandidates(t), this.candidates.size === 0)
|
|
377
380
|
return this.finish(), !1;
|
|
@@ -399,7 +402,7 @@ class gr {
|
|
|
399
402
|
var e;
|
|
400
403
|
for (const [t, i] of this.proxies)
|
|
401
404
|
t.remove(i);
|
|
402
|
-
(e = this.attachedScene) == null || e.remove(this.backdropMesh), this.attachedScene = null;
|
|
405
|
+
this.backdropMaterial.stencilWrite = !0, this.backdropMaterial.stencilFunc = Qe, (e = this.attachedScene) == null || e.remove(this.backdropMesh), this.attachedScene = null;
|
|
403
406
|
}
|
|
404
407
|
dispose() {
|
|
405
408
|
this.disposed || (this.finish(), this.disposed = !0, this.candidates.clear(), this.proxies.clear(), this.backdropGeometry.dispose(), this.backdropMaterial.dispose(), this.maskMaterial.dispose());
|
|
@@ -425,11 +428,11 @@ class gr {
|
|
|
425
428
|
}
|
|
426
429
|
function br(r) {
|
|
427
430
|
return (Array.isArray(r) ? r : [r]).some(
|
|
428
|
-
(t) => t.visible && t instanceof
|
|
431
|
+
(t) => t.visible && t instanceof jt && t.transmission > 0
|
|
429
432
|
);
|
|
430
433
|
}
|
|
431
434
|
function yr(r, e) {
|
|
432
|
-
e ? r.defines = { ...r.defines, [
|
|
435
|
+
e ? r.defines = { ...r.defines, [Jt]: "" } : r.defines && delete r.defines[Jt], r.needsUpdate = !0;
|
|
433
436
|
}
|
|
434
437
|
class xr {
|
|
435
438
|
constructor() {
|
|
@@ -443,7 +446,7 @@ class xr {
|
|
|
443
446
|
prepare(e) {
|
|
444
447
|
if (this.dirty && this.refreshCandidates(e), this.candidates.size === 0) return !1;
|
|
445
448
|
for (const t of this.candidates)
|
|
446
|
-
t.visible && t.transmission > 0 && t.thickness > 0 && t.side === jn && (this.temporarySides.set(t, t.side), t.side =
|
|
449
|
+
t.visible && t.transmission > 0 && t.thickness > 0 && t.side === jn && (this.temporarySides.set(t, t.side), t.side = Ot);
|
|
447
450
|
return !0;
|
|
448
451
|
}
|
|
449
452
|
finish() {
|
|
@@ -460,12 +463,12 @@ class xr {
|
|
|
460
463
|
if (!(i instanceof ae) || !pe(i)) return;
|
|
461
464
|
const n = Array.isArray(i.material) ? i.material : [i.material];
|
|
462
465
|
for (const s of n)
|
|
463
|
-
s instanceof
|
|
466
|
+
s instanceof jt && s.transmission > 0 && this.candidates.add(s);
|
|
464
467
|
});
|
|
465
468
|
this.dirty = !1;
|
|
466
469
|
}
|
|
467
470
|
}
|
|
468
|
-
const
|
|
471
|
+
const Zt = "#include <transmission_pars_fragment>", Qt = "#include <transmission_fragment>", wr = (
|
|
469
472
|
/* glsl */
|
|
470
473
|
`
|
|
471
474
|
vec4 getEeveeSphereProbeRefraction(
|
|
@@ -537,7 +540,7 @@ class Cr {
|
|
|
537
540
|
const s = n.material, a = Array.isArray(s) ? s : [s];
|
|
538
541
|
let o = !1;
|
|
539
542
|
const l = a.map((d) => {
|
|
540
|
-
if (!(d instanceof
|
|
543
|
+
if (!(d instanceof jt) || d.transmission <= 0 || !Er(d))
|
|
541
544
|
return d;
|
|
542
545
|
const c = Sr(n);
|
|
543
546
|
return c === null ? d : (o = !0, this.getReplacement(d, c));
|
|
@@ -574,13 +577,13 @@ function Er(r) {
|
|
|
574
577
|
function kr(r) {
|
|
575
578
|
const e = r.onBeforeCompile, t = r.customProgramCacheKey;
|
|
576
579
|
r.onBeforeCompile = (i, n) => {
|
|
577
|
-
e.call(r, i, n), !(!i.fragmentShader.includes(
|
|
578
|
-
|
|
579
|
-
`${
|
|
580
|
+
e.call(r, i, n), !(!i.fragmentShader.includes(Zt) || !i.fragmentShader.includes(Qt)) && (i.fragmentShader = i.fragmentShader.replace(
|
|
581
|
+
Zt,
|
|
582
|
+
`${Ut.transmission_pars_fragment}
|
|
580
583
|
${wr}`
|
|
581
584
|
).replace(
|
|
582
|
-
|
|
583
|
-
|
|
585
|
+
Qt,
|
|
586
|
+
Ut.transmission_fragment.replace(
|
|
584
587
|
"getIBLVolumeRefraction(",
|
|
585
588
|
"getEeveeSphereProbeRefraction("
|
|
586
589
|
)
|
|
@@ -728,7 +731,7 @@ function Vr(r, e, t) {
|
|
|
728
731
|
const s = 1 / t.maxScalePerFrame;
|
|
729
732
|
return Math.max(s, Math.min(t.maxScalePerFrame, n));
|
|
730
733
|
}
|
|
731
|
-
const
|
|
734
|
+
const ut = 500, ei = 2e5, ht = 0.95, ti = -Math.PI / 2, ii = Y.degToRad(55), Br = 1e3, Ur = 2e6;
|
|
732
735
|
function ge(r, e, t = 1e-4) {
|
|
733
736
|
return Math.abs(r - e) <= t;
|
|
734
737
|
}
|
|
@@ -736,11 +739,11 @@ class _r {
|
|
|
736
739
|
constructor() {
|
|
737
740
|
u(this, "orbitTarget", new M(0, 0, 0));
|
|
738
741
|
u(this, "orbitDistance", 14e3);
|
|
739
|
-
u(this, "orbitYaw",
|
|
740
|
-
u(this, "orbitPitch",
|
|
742
|
+
u(this, "orbitYaw", ti);
|
|
743
|
+
u(this, "orbitPitch", ii);
|
|
741
744
|
u(this, "enabled", !0);
|
|
742
|
-
u(this, "orbitDistanceMin",
|
|
743
|
-
u(this, "orbitDistanceMax",
|
|
745
|
+
u(this, "orbitDistanceMin", ut);
|
|
746
|
+
u(this, "orbitDistanceMax", ei);
|
|
744
747
|
u(this, "viewportSnapshotBefore3D", null);
|
|
745
748
|
u(this, "orbitSnapshotOn3DEntry", null);
|
|
746
749
|
u(this, "dragMode", null);
|
|
@@ -790,9 +793,9 @@ class _r {
|
|
|
790
793
|
ymax: e.max.y,
|
|
791
794
|
fovDeg: i.camera3d.fov,
|
|
792
795
|
orbitPitchRad: this.orbitPitch,
|
|
793
|
-
ndcBand:
|
|
796
|
+
ndcBand: ht
|
|
794
797
|
}), 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);
|
|
795
|
-
this.orbitDistanceMin = h <
|
|
798
|
+
this.orbitDistanceMin = h < ut ? Math.max(h * 0.02, 1e-6) : ut, this.orbitDistanceMax = Math.max(ei, h * 20), this.orbitDistance = this.clampDistance(h), this.syncPerspectiveCamera();
|
|
796
799
|
}
|
|
797
800
|
getVisibleDocumentRect() {
|
|
798
801
|
const e = this.runtime;
|
|
@@ -946,9 +949,9 @@ class _r {
|
|
|
946
949
|
orbitDistanceMin: this.orbitDistanceMin,
|
|
947
950
|
orbitDistanceMax: this.orbitDistanceMax,
|
|
948
951
|
useFixedOrientation: e,
|
|
949
|
-
fixedOrbitYaw:
|
|
950
|
-
fixedOrbitPitch:
|
|
951
|
-
ndcBand:
|
|
952
|
+
fixedOrbitYaw: ti,
|
|
953
|
+
fixedOrbitPitch: ii,
|
|
954
|
+
ndcBand: ht
|
|
952
955
|
});
|
|
953
956
|
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;
|
|
954
957
|
}
|
|
@@ -965,7 +968,7 @@ class _r {
|
|
|
965
968
|
viewportHeightPx: n,
|
|
966
969
|
orthoFrustumMin: c,
|
|
967
970
|
orthoFrustumMax: p,
|
|
968
|
-
ndcBand:
|
|
971
|
+
ndcBand: ht
|
|
969
972
|
}), m = h.orthoFrustumSize > 0 ? h.orthoFrustumSize : o, f = o / 2;
|
|
970
973
|
e.setOrthographicViewport({
|
|
971
974
|
left: -f * s,
|
|
@@ -1058,7 +1061,7 @@ class _r {
|
|
|
1058
1061
|
}
|
|
1059
1062
|
}
|
|
1060
1063
|
}
|
|
1061
|
-
const Hr = new M(2.4, -2.7, 1.7), qr = new M(0, 0, 0.65), Yr = Math.PI,
|
|
1064
|
+
const Hr = new M(2.4, -2.7, 1.7), qr = new M(0, 0, 0.65), Yr = Math.PI, Wr = !0, Gr = new M(1.25, -1.5, 0.85).normalize(), Xr = 1.25, Kr = 0.4, Jr = 12, Zr = 1e3, Qr = 20, es = 0.1, ts = 0.2, mn = "left-rotate", is = {
|
|
1062
1065
|
"left-rotate": { LEFT: re.ROTATE, MIDDLE: re.DOLLY, RIGHT: re.PAN },
|
|
1063
1066
|
"left-pan": { LEFT: re.PAN, MIDDLE: re.DOLLY, RIGHT: re.ROTATE }
|
|
1064
1067
|
};
|
|
@@ -1079,15 +1082,15 @@ function ns({ radius: r, fovDeg: e }) {
|
|
|
1079
1082
|
function rs(r, e, t) {
|
|
1080
1083
|
e.minDistance = t.minDistance, e.maxDistance = t.maxDistance, r.near = t.near, r.far = t.far, r.updateProjectionMatrix();
|
|
1081
1084
|
}
|
|
1082
|
-
function
|
|
1083
|
-
r.enableDamping =
|
|
1085
|
+
function ni(r, e, t = mn) {
|
|
1086
|
+
r.enableDamping = Wr, r.maxPolarAngle = Yr, r.dampingFactor = 0.1, r.enablePan = !0, r.screenSpacePanning = !0, r.mouseButtons = { ...is[t] }, rn.DEFAULT_UP.set(0, 0, 1), e.up.set(0, 0, 1);
|
|
1084
1087
|
}
|
|
1085
1088
|
function ss(r, e, t, i) {
|
|
1086
1089
|
if (t.isEmpty()) return null;
|
|
1087
1090
|
const n = t.getSize(new M()), s = t.getCenter(new M()), a = Math.max(n.length() * 0.5, 0.02), o = ns({ radius: a, fovDeg: i });
|
|
1088
|
-
return e.target.copy(s), r.position.copy(s).addScaledVector(
|
|
1091
|
+
return e.target.copy(s), r.position.copy(s).addScaledVector(Gr, o.distance), rs(r, e, o), r.updateMatrixWorld(), e.update(), o;
|
|
1089
1092
|
}
|
|
1090
|
-
const as = 1e3, os = 2, ls = -1e4, ds = 1e4,
|
|
1093
|
+
const as = 1e3, os = 2, ls = -1e4, ds = 1e4, ri = 1e3, cs = 2e6, us = 1.15, hs = 1, ps = new nn(Math.PI / 2, 0, 0), ms = new it().setFromEuler(ps), fs = new M(0, 1, 0);
|
|
1091
1094
|
class vs {
|
|
1092
1095
|
constructor(e) {
|
|
1093
1096
|
u(this, "canvasArea");
|
|
@@ -1105,7 +1108,7 @@ class vs {
|
|
|
1105
1108
|
u(this, "ownedObjects", /* @__PURE__ */ new Set());
|
|
1106
1109
|
u(this, "overlays", /* @__PURE__ */ new Map());
|
|
1107
1110
|
u(this, "eventCleanups", []);
|
|
1108
|
-
u(this, "raycaster", new
|
|
1111
|
+
u(this, "raycaster", new lt());
|
|
1109
1112
|
u(this, "pointerNdc", new J());
|
|
1110
1113
|
u(this, "reuseVector", new M());
|
|
1111
1114
|
u(this, "reuseVector2", new M());
|
|
@@ -1133,8 +1136,8 @@ class vs {
|
|
|
1133
1136
|
u(this, "environmentBackgroundVisible", !1);
|
|
1134
1137
|
u(this, "environmentBackgroundCapable");
|
|
1135
1138
|
u(this, "environmentRotationDegrees");
|
|
1136
|
-
u(this, "upRotationQuaternion", new
|
|
1137
|
-
u(this, "composedRotationQuaternion", new
|
|
1139
|
+
u(this, "upRotationQuaternion", new it());
|
|
1140
|
+
u(this, "composedRotationQuaternion", new it());
|
|
1138
1141
|
u(this, "hdrTransparentBackdrop", null);
|
|
1139
1142
|
u(this, "transparentHdrBackdropBlurriness");
|
|
1140
1143
|
u(this, "hdrTransparentBackdropFailed", !1);
|
|
@@ -1144,7 +1147,7 @@ class vs {
|
|
|
1144
1147
|
u(this, "volumeTransmissionFailed", !1);
|
|
1145
1148
|
u(this, "eeveeSphereProbeTransmission", new Cr());
|
|
1146
1149
|
u(this, "eeveeSphereProbeTransmissionFailed", !1);
|
|
1147
|
-
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 ?? mn, this.environmentBackgroundCapable = e.environment !== void 0 && e.environment !== "room", this.environmentRotationDegrees =
|
|
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 ?? mn, this.environmentBackgroundCapable = e.environment !== void 0 && e.environment !== "room", this.environmentRotationDegrees = ai(e.environmentRotation ?? 0), this.overlayRoot.name = "scene-runtime:overlays", this.scene.add(this.overlayRoot);
|
|
1148
1151
|
}
|
|
1149
1152
|
initialize() {
|
|
1150
1153
|
if (this.disposed) throw new Error("SceneRuntime has been disposed.");
|
|
@@ -1158,10 +1161,10 @@ class vs {
|
|
|
1158
1161
|
// allocate stencil even when the initial environment is an image.
|
|
1159
1162
|
stencil: this.options.transparentHdrBackdrop === !0,
|
|
1160
1163
|
powerPreference: this.options.powerPreference ?? "high-performance"
|
|
1161
|
-
}), this.options.clearColor !== void 0 && this.renderer.setClearColor(new
|
|
1164
|
+
}), this.options.clearColor !== void 0 && this.renderer.setClearColor(new tt(this.options.clearColor));
|
|
1162
1165
|
const s = Math.max(1, this.canvasArea.clientWidth || 1), a = Math.max(1, this.canvasArea.clientHeight || 1), o = s / a;
|
|
1163
1166
|
if (this.renderer.setPixelRatio(this.readDevicePixelRatio()), this.renderer.setSize(s, a, !1), this.options.environment) {
|
|
1164
|
-
const l = (e == null ? void 0 : e.createEnvironment) ??
|
|
1167
|
+
const l = (e == null ? void 0 : e.createEnvironment) ?? si;
|
|
1165
1168
|
this.scene.environmentIntensity = hs, this.applyEnvironmentRotations();
|
|
1166
1169
|
const d = ++this.environmentLoadGeneration, c = l(this.renderer, this.options.environment);
|
|
1167
1170
|
gs(c) ? c.then(
|
|
@@ -1171,13 +1174,13 @@ class vs {
|
|
|
1171
1174
|
}
|
|
1172
1175
|
) : this.applyEnvironmentResource(c, d);
|
|
1173
1176
|
}
|
|
1174
|
-
this.camera2d = new
|
|
1177
|
+
this.camera2d = new St(-o, o, 1, -1, ls, ds), this.camera2d.position.set(0, 0, 1), this.camera2d.lookAt(0, 0, 0), this.camera3d = new on(40, o, ri, cs), 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 = {
|
|
1175
1178
|
LEFT: re.PAN,
|
|
1176
1179
|
MIDDLE: re.DOLLY,
|
|
1177
1180
|
RIGHT: re.PAN
|
|
1178
1181
|
}, this.controls2d.touches = {
|
|
1179
|
-
ONE:
|
|
1180
|
-
TWO:
|
|
1182
|
+
ONE: _t.PAN,
|
|
1183
|
+
TWO: _t.DOLLY_PAN
|
|
1181
1184
|
}, this.controls3d = n(this.camera3d, this.renderer.domElement), this.controls3d.enablePan = !1, this.listen(this.controls2d, "change", () => this.requestRender()), this.listen(this.controls3d, "change", () => this.requestRender()), this.applyNavigationPolicy(this.navigationPolicyValue), this.initialized = !0, this.setViewMode(this.viewModeValue);
|
|
1182
1185
|
}
|
|
1183
1186
|
get isInitialized() {
|
|
@@ -1224,7 +1227,7 @@ class vs {
|
|
|
1224
1227
|
this.viewerOrbit ?? (this.viewerOrbit = new _r()), this.viewerOrbit.attach(this);
|
|
1225
1228
|
return;
|
|
1226
1229
|
}
|
|
1227
|
-
(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" && (
|
|
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" && (ni(this.controls3d, this.camera3d, this.previewDragPreset), this.camera3d.position.copy(Hr), this.controls3d.target.copy(qr), this.controls3d.update());
|
|
1228
1231
|
}
|
|
1229
1232
|
}
|
|
1230
1233
|
/**
|
|
@@ -1233,7 +1236,7 @@ class vs {
|
|
|
1233
1236
|
* handed to OrbitControls.
|
|
1234
1237
|
*/
|
|
1235
1238
|
setPreviewDragPreset(e) {
|
|
1236
|
-
this.previewDragPreset !== e && (this.previewDragPreset = e, !(!this.initialized || this.navigationPolicyValue !== "preview") && (
|
|
1239
|
+
this.previewDragPreset !== e && (this.previewDragPreset = e, !(!this.initialized || this.navigationPolicyValue !== "preview") && (ni(this.controls3d, this.camera3d, e), this.requestRender()));
|
|
1237
1240
|
}
|
|
1238
1241
|
/**
|
|
1239
1242
|
* Drives OrbitControls once per frame. Damping mutates the camera inside
|
|
@@ -1255,7 +1258,7 @@ class vs {
|
|
|
1255
1258
|
async setEnvironment(e) {
|
|
1256
1259
|
var n;
|
|
1257
1260
|
if (this.disposed || !this.renderer) return !1;
|
|
1258
|
-
const t = ++this.environmentLoadGeneration, i = ((n = this.options.factories) == null ? void 0 : n.createEnvironment) ??
|
|
1261
|
+
const t = ++this.environmentLoadGeneration, i = ((n = this.options.factories) == null ? void 0 : n.createEnvironment) ?? si;
|
|
1259
1262
|
try {
|
|
1260
1263
|
const s = await i(this.renderer, e), a = this.applyEnvironmentResource(s, t);
|
|
1261
1264
|
return a && (this.environmentBackgroundCapable = e !== "room"), a;
|
|
@@ -1272,7 +1275,7 @@ class vs {
|
|
|
1272
1275
|
setEnvironmentRotation(e) {
|
|
1273
1276
|
var i;
|
|
1274
1277
|
if (this.disposed || !Number.isFinite(e)) return !1;
|
|
1275
|
-
const t =
|
|
1278
|
+
const t = ai(e);
|
|
1276
1279
|
return t === this.environmentRotationDegrees || (this.environmentRotationDegrees = t, this.applyEnvironmentRotations(), (i = this.hdrTransparentBackdrop) == null || i.setRotationDegrees(this.environmentRotationDegrees), this.requestRender()), !0;
|
|
1277
1280
|
}
|
|
1278
1281
|
getEnvironmentRotation() {
|
|
@@ -1318,7 +1321,7 @@ class vs {
|
|
|
1318
1321
|
if (!this.mountedObjects.has(e) && e.parent !== this.scene) return !1;
|
|
1319
1322
|
e.removeFromParent(), this.mountedObjects.delete(e), this.markTransmissionCachesDirty();
|
|
1320
1323
|
const i = this.ownedObjects.delete(e);
|
|
1321
|
-
return (t.dispose === !0 || t.dispose === void 0 && i) &&
|
|
1324
|
+
return (t.dispose === !0 || t.dispose === void 0 && i) && Gt(e), this.requestRender(), !0;
|
|
1322
1325
|
}
|
|
1323
1326
|
setObjectVisible(e, t) {
|
|
1324
1327
|
e.visible !== t && (e.visible = t, this.markTransmissionCachesDirty(), this.requestRender());
|
|
@@ -1328,7 +1331,7 @@ class vs {
|
|
|
1328
1331
|
}
|
|
1329
1332
|
removeOverlay(e, t = {}) {
|
|
1330
1333
|
const i = this.overlays.get(e);
|
|
1331
|
-
return i ? (this.overlays.delete(e), i.object.removeFromParent(), (t.dispose === !0 || t.dispose === void 0 && i.owned) &&
|
|
1334
|
+
return i ? (this.overlays.delete(e), i.object.removeFromParent(), (t.dispose === !0 || t.dispose === void 0 && i.owned) && Gt(i.object), this.requestRender(), i.object) : null;
|
|
1332
1335
|
}
|
|
1333
1336
|
setHighlight(e, t = {}) {
|
|
1334
1337
|
if (!e) {
|
|
@@ -1365,7 +1368,7 @@ class vs {
|
|
|
1365
1368
|
else {
|
|
1366
1369
|
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);
|
|
1367
1370
|
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(
|
|
1368
|
-
|
|
1371
|
+
ri,
|
|
1369
1372
|
Math.max(m * 0.01, 1e-6)
|
|
1370
1373
|
), this.camera3d.updateProjectionMatrix(), this.controls3d.update();
|
|
1371
1374
|
}
|
|
@@ -1589,7 +1592,7 @@ class vs {
|
|
|
1589
1592
|
o
|
|
1590
1593
|
);
|
|
1591
1594
|
}
|
|
1592
|
-
const t = this.environmentBackgroundVisible && this.scene.environment instanceof
|
|
1595
|
+
const t = this.environmentBackgroundVisible && this.scene.environment instanceof ot && this.scene.environment.mapping === Me, i = this.options.transparentHdrBackdrop === !0 && !t, n = this.scene.background;
|
|
1593
1596
|
t && (this.scene.background = this.scene.environment);
|
|
1594
1597
|
try {
|
|
1595
1598
|
if (i && !e && !this.transmissionHdrBackdropFailed)
|
|
@@ -1664,7 +1667,7 @@ class vs {
|
|
|
1664
1667
|
return this.previewScene || (this.previewScene = new ze()), this.previewScene;
|
|
1665
1668
|
}
|
|
1666
1669
|
getOrCreatePreviewCamera() {
|
|
1667
|
-
return this.previewCamera || (this.previewCamera = new
|
|
1670
|
+
return this.previewCamera || (this.previewCamera = new St(-1, 1, 1, -1, -1e6, 1e6)), this.previewCamera;
|
|
1668
1671
|
}
|
|
1669
1672
|
getOrCreatePreviewRenderTarget(e, t) {
|
|
1670
1673
|
var i;
|
|
@@ -1721,7 +1724,7 @@ class vs {
|
|
|
1721
1724
|
});
|
|
1722
1725
|
}
|
|
1723
1726
|
}
|
|
1724
|
-
function
|
|
1727
|
+
function si(r, e) {
|
|
1725
1728
|
if (e === "room") {
|
|
1726
1729
|
const t = new $n(r), i = new Kn(), n = t.fromScene(i);
|
|
1727
1730
|
return i.dispose(), t.dispose(), {
|
|
@@ -1731,7 +1734,7 @@ function ni(r, e) {
|
|
|
1731
1734
|
}
|
|
1732
1735
|
if (e.url.trim().length === 0)
|
|
1733
1736
|
throw new Error("Scene environment requires a non-empty URL.");
|
|
1734
|
-
return e.type === "image" ? new dn().loadAsync(e.url).then((t) => (t.mapping = Me, t.colorSpace =
|
|
1737
|
+
return e.type === "image" ? new dn().loadAsync(e.url).then((t) => (t.mapping = Me, t.colorSpace = Ft, {
|
|
1735
1738
|
texture: t,
|
|
1736
1739
|
dispose: () => t.dispose()
|
|
1737
1740
|
})) : new cn().loadAsync(e.url).then((t) => (t.mapping = Me, {
|
|
@@ -1742,7 +1745,7 @@ function ni(r, e) {
|
|
|
1742
1745
|
function gs(r) {
|
|
1743
1746
|
return typeof (r == null ? void 0 : r.then) == "function";
|
|
1744
1747
|
}
|
|
1745
|
-
function
|
|
1748
|
+
function ai(r) {
|
|
1746
1749
|
if (!Number.isFinite(r)) return 0;
|
|
1747
1750
|
const e = r % 360;
|
|
1748
1751
|
return e < 0 ? e + 360 : e;
|
|
@@ -1750,12 +1753,12 @@ function ri(r) {
|
|
|
1750
1753
|
function bs(r) {
|
|
1751
1754
|
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;
|
|
1752
1755
|
}
|
|
1753
|
-
const
|
|
1756
|
+
const zt = 1, ys = 1024, xs = 16, ws = 1e9;
|
|
1754
1757
|
function Cs() {
|
|
1755
1758
|
return typeof globalThis.localStorage > "u" ? Es() : {
|
|
1756
1759
|
read(r) {
|
|
1757
1760
|
try {
|
|
1758
|
-
const e = globalThis.localStorage.getItem(
|
|
1761
|
+
const e = globalThis.localStorage.getItem(oi(r));
|
|
1759
1762
|
return e ? JSON.parse(e) : null;
|
|
1760
1763
|
} catch {
|
|
1761
1764
|
return null;
|
|
@@ -1763,7 +1766,7 @@ function Cs() {
|
|
|
1763
1766
|
},
|
|
1764
1767
|
write(r, e) {
|
|
1765
1768
|
try {
|
|
1766
|
-
globalThis.localStorage.setItem(
|
|
1769
|
+
globalThis.localStorage.setItem(oi(r), JSON.stringify(e));
|
|
1767
1770
|
} catch {
|
|
1768
1771
|
}
|
|
1769
1772
|
}
|
|
@@ -1783,12 +1786,12 @@ function Es() {
|
|
|
1783
1786
|
function ks(r, e) {
|
|
1784
1787
|
if (!r || !e) return null;
|
|
1785
1788
|
const t = r.read(e);
|
|
1786
|
-
return
|
|
1789
|
+
return $t(t) ? t : null;
|
|
1787
1790
|
}
|
|
1788
|
-
function
|
|
1791
|
+
function $t(r) {
|
|
1789
1792
|
if (!r || typeof r != "object") return !1;
|
|
1790
1793
|
const e = r;
|
|
1791
|
-
if (e.schemaVersion !==
|
|
1794
|
+
if (e.schemaVersion !== zt) return !1;
|
|
1792
1795
|
if (e.viewMode === "2d") {
|
|
1793
1796
|
const t = e.orthographic;
|
|
1794
1797
|
return !t || ![
|
|
@@ -1821,14 +1824,14 @@ function Ss(r, e, t) {
|
|
|
1821
1824
|
}
|
|
1822
1825
|
function Ps(r) {
|
|
1823
1826
|
return {
|
|
1824
|
-
schemaVersion:
|
|
1827
|
+
schemaVersion: zt,
|
|
1825
1828
|
viewMode: r.viewMode,
|
|
1826
1829
|
...r.orthographic ? { orthographic: r.orthographic } : {},
|
|
1827
1830
|
...r.orbit ? { orbit: r.orbit } : {}
|
|
1828
1831
|
};
|
|
1829
1832
|
}
|
|
1830
1833
|
function Ms(r, e) {
|
|
1831
|
-
if (
|
|
1834
|
+
if (!$t(r)) return null;
|
|
1832
1835
|
const t = As(e);
|
|
1833
1836
|
if (r.viewMode === "2d") {
|
|
1834
1837
|
const n = r.orthographic;
|
|
@@ -1856,8 +1859,8 @@ function Is(r, e, t) {
|
|
|
1856
1859
|
const n = i * xs;
|
|
1857
1860
|
return r >= t.minX - n && r <= t.maxX + n && e >= t.minY - n && e <= t.maxY + n;
|
|
1858
1861
|
}
|
|
1859
|
-
function
|
|
1860
|
-
return `nebula-viewer:camera:v${
|
|
1862
|
+
function oi(r) {
|
|
1863
|
+
return `nebula-viewer:camera:v${zt}:${r}`;
|
|
1861
1864
|
}
|
|
1862
1865
|
function Ie(r) {
|
|
1863
1866
|
return new Z(
|
|
@@ -2092,7 +2095,7 @@ function Fs(r, e) {
|
|
|
2092
2095
|
}
|
|
2093
2096
|
return `${r.toFixed(2)}${e ? ` ${e}` : ""}`;
|
|
2094
2097
|
}
|
|
2095
|
-
function
|
|
2098
|
+
function li(r) {
|
|
2096
2099
|
return {
|
|
2097
2100
|
documentKey: r.documentKey,
|
|
2098
2101
|
filename: r.filename,
|
|
@@ -2104,7 +2107,7 @@ function ai(r) {
|
|
|
2104
2107
|
units: r.units ?? { source: "mm" }
|
|
2105
2108
|
};
|
|
2106
2109
|
}
|
|
2107
|
-
const zs = 160,
|
|
2110
|
+
const zs = 160, di = 5e3;
|
|
2108
2111
|
class $s {
|
|
2109
2112
|
constructor(e) {
|
|
2110
2113
|
u(this, "layers", new Ls());
|
|
@@ -2236,7 +2239,7 @@ class $s {
|
|
|
2236
2239
|
name: "AbortError",
|
|
2237
2240
|
code: "E_SUPERSEDED"
|
|
2238
2241
|
});
|
|
2239
|
-
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 =
|
|
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 = li({
|
|
2240
2243
|
documentKey: n,
|
|
2241
2244
|
filename: t.filename ?? o.filename ?? null,
|
|
2242
2245
|
phase: s.phase === "interactive" && !this.initialDemandSettled ? "initial-loading" : s.phase,
|
|
@@ -2372,7 +2375,7 @@ class $s {
|
|
|
2372
2375
|
}
|
|
2373
2376
|
select(e) {
|
|
2374
2377
|
var t, i, n;
|
|
2375
|
-
this.assertActive(), e ? !this.document || !this.session || e.selection.documentKey !== this.document.documentKey ? this.clearSelection() : e.kind === "insert" ? this.setInsertSelection(e.selection, ((t = this.session) == null ? void 0 : t.getBlockDetails(
|
|
2378
|
+
this.assertActive(), e ? !this.document || !this.session || e.selection.documentKey !== this.document.documentKey ? this.clearSelection() : e.kind === "insert" ? this.setInsertSelection(e.selection, ((t = this.session) == null ? void 0 : t.getBlockDetails(qt(e.selection.id))) ?? null) : this.setTextSelectionInternal(e.selection, ((n = (i = this.session) == null ? void 0 : i.getTextDetails) == null ? void 0 : n.call(i, e.selection.id)) ?? null) : this.clearSelection();
|
|
2376
2379
|
}
|
|
2377
2380
|
clearSelection() {
|
|
2378
2381
|
this.assertActive(), !(!this.inspector.selection && !this.inspector.textSelection) && (this.inspector.clear(), this.emit("inspector-change", { inspector: this.inspector }));
|
|
@@ -2407,8 +2410,8 @@ class $s {
|
|
|
2407
2410
|
if (!e) return !1;
|
|
2408
2411
|
let { minX: t, minY: i, maxX: n, maxY: s } = e;
|
|
2409
2412
|
const a = n - t, o = s - i, l = Math.max(a, o);
|
|
2410
|
-
if (a > 0 && o > 0 && l <
|
|
2411
|
-
const c = (t + n) / 2, p = (i + s) / 2, h =
|
|
2413
|
+
if (a > 0 && o > 0 && l < di) {
|
|
2414
|
+
const c = (t + n) / 2, p = (i + s) / 2, h = di / 2;
|
|
2412
2415
|
t = c - h, i = p - h, n = c + h, s = p + h;
|
|
2413
2416
|
}
|
|
2414
2417
|
return this.host.fitBox3(Ie({
|
|
@@ -2423,7 +2426,7 @@ class $s {
|
|
|
2423
2426
|
refreshInspectorDetails(e) {
|
|
2424
2427
|
const t = this.inspector.selection;
|
|
2425
2428
|
if (!t) return;
|
|
2426
|
-
const i = e.getBlockDetails(
|
|
2429
|
+
const i = e.getBlockDetails(qt(t.id));
|
|
2427
2430
|
if (!i) return;
|
|
2428
2431
|
const n = this.inspector.details, s = n == null ? void 0 : n.bbox;
|
|
2429
2432
|
(s == null ? void 0 : s.minX) === i.bbox.minX && (s == null ? void 0 : s.minY) === i.bbox.minY && (s == null ? void 0 : s.maxX) === i.bbox.maxX && (s == null ? void 0 : s.maxY) === i.bbox.maxY || (this.inspector.setSelection(t, i), this.emit("inspector-change", { inspector: this.inspector }));
|
|
@@ -2505,7 +2508,7 @@ class $s {
|
|
|
2505
2508
|
});
|
|
2506
2509
|
}
|
|
2507
2510
|
publishDocumentPhase(e) {
|
|
2508
|
-
this.document && (this.document =
|
|
2511
|
+
this.document && (this.document = li({
|
|
2509
2512
|
documentKey: this.document.documentKey,
|
|
2510
2513
|
filename: this.document.filename,
|
|
2511
2514
|
phase: e,
|
|
@@ -2554,7 +2557,7 @@ function Le(r, e, t) {
|
|
|
2554
2557
|
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";
|
|
2555
2558
|
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 };
|
|
2556
2559
|
}
|
|
2557
|
-
const
|
|
2560
|
+
const ci = 1;
|
|
2558
2561
|
class qs {
|
|
2559
2562
|
constructor(e) {
|
|
2560
2563
|
u(this, "startX", 0);
|
|
@@ -2600,10 +2603,10 @@ class qs {
|
|
|
2600
2603
|
this.release(), this.resetMotion(), this.startX = 0, this.startY = 0, this.lastX = 0, this.lastY = 0;
|
|
2601
2604
|
}
|
|
2602
2605
|
isTrackingPrimaryPointer(e) {
|
|
2603
|
-
return this.primaryPointerDown || (e &
|
|
2606
|
+
return this.primaryPointerDown || (e & ci) === ci;
|
|
2604
2607
|
}
|
|
2605
2608
|
}
|
|
2606
|
-
function
|
|
2609
|
+
function Mt(r, e) {
|
|
2607
2610
|
return `${r}:${e}`;
|
|
2608
2611
|
}
|
|
2609
2612
|
class Ys {
|
|
@@ -2626,7 +2629,7 @@ class Ys {
|
|
|
2626
2629
|
this.expandedLayers.has(e) ? this.expandedLayers.delete(e) : this.expandedLayers.add(e), this.suppressedSelectionKey = null;
|
|
2627
2630
|
}
|
|
2628
2631
|
toggleBlockExpanded(e, t) {
|
|
2629
|
-
const i =
|
|
2632
|
+
const i = Mt(e, t);
|
|
2630
2633
|
this.expandedBlocks.has(i) ? this.expandedBlocks.delete(i) : this.expandedBlocks.add(i), this.suppressedSelectionKey = null;
|
|
2631
2634
|
}
|
|
2632
2635
|
prune(e, t) {
|
|
@@ -2638,7 +2641,7 @@ class Ys {
|
|
|
2638
2641
|
t.has(i) || this.blockVisibilitySnapshots.delete(i);
|
|
2639
2642
|
}
|
|
2640
2643
|
ensureSelectionVisible(e, t, i) {
|
|
2641
|
-
this.suppressedSelectionKey !== e && (this.suppressedSelectionKey !== null && (this.suppressedSelectionKey = null), this.expandedLayers.add(t), this.expandedBlocks.add(
|
|
2644
|
+
this.suppressedSelectionKey !== e && (this.suppressedSelectionKey !== null && (this.suppressedSelectionKey = null), this.expandedLayers.add(t), this.expandedBlocks.add(Mt(t, i)));
|
|
2642
2645
|
}
|
|
2643
2646
|
needsSelectionReveal(e) {
|
|
2644
2647
|
return this.revealedSelectionKey !== e;
|
|
@@ -2659,7 +2662,7 @@ function H(r) {
|
|
|
2659
2662
|
"'": "'"
|
|
2660
2663
|
})[e] ?? e);
|
|
2661
2664
|
}
|
|
2662
|
-
const
|
|
2665
|
+
const Ws = {
|
|
2663
2666
|
"panel.layers": "图层",
|
|
2664
2667
|
"panel.properties": "属性",
|
|
2665
2668
|
"panel.layers.aria": "图层面板",
|
|
@@ -2738,7 +2741,7 @@ const Gs = {
|
|
|
2738
2741
|
"status.parsing": "解析中…",
|
|
2739
2742
|
"status.incrementalLoading": "增量渲染中…",
|
|
2740
2743
|
"unit.mm": "mm"
|
|
2741
|
-
},
|
|
2744
|
+
}, Gs = {
|
|
2742
2745
|
"panel.layers": "Layers",
|
|
2743
2746
|
"panel.properties": "Properties",
|
|
2744
2747
|
"panel.layers.aria": "Layers panel",
|
|
@@ -2840,7 +2843,7 @@ function Js(r) {
|
|
|
2840
2843
|
}
|
|
2841
2844
|
function gn(r) {
|
|
2842
2845
|
var a;
|
|
2843
|
-
const e = ((a = r.locale) == null ? void 0 : a.trim()) || "zh-CN", t = e.toLowerCase().startsWith("en") ?
|
|
2846
|
+
const e = ((a = r.locale) == null ? void 0 : a.trim()) || "zh-CN", t = e.toLowerCase().startsWith("en") ? Gs : Ws, i = Ks(e), n = Js(e), s = {
|
|
2844
2847
|
locale: e,
|
|
2845
2848
|
t(o, l) {
|
|
2846
2849
|
var p;
|
|
@@ -2890,11 +2893,11 @@ function Qs(r, e) {
|
|
|
2890
2893
|
const t = r.trim(), i = Zs[t];
|
|
2891
2894
|
return i ? e.t(i) : t;
|
|
2892
2895
|
}
|
|
2893
|
-
const
|
|
2896
|
+
const Vt = gn({});
|
|
2894
2897
|
function ea(r) {
|
|
2895
2898
|
const e = /* @__PURE__ */ new Map();
|
|
2896
2899
|
for (const i of r.usages) {
|
|
2897
|
-
const n = e.get(i.layerIndex) ?? /* @__PURE__ */ new Map(), s =
|
|
2900
|
+
const n = e.get(i.layerIndex) ?? /* @__PURE__ */ new Map(), s = Mt(i.layerIndex, i.variantId);
|
|
2898
2901
|
let a = n.get(s);
|
|
2899
2902
|
a || (a = {
|
|
2900
2903
|
key: s,
|
|
@@ -2919,10 +2922,10 @@ function ea(r) {
|
|
|
2919
2922
|
function ta(r, e) {
|
|
2920
2923
|
return r ? e.toLowerCase().includes(r) : !0;
|
|
2921
2924
|
}
|
|
2922
|
-
function
|
|
2925
|
+
function rt(r, e, t) {
|
|
2923
2926
|
r.dataset.visible = e ? "1" : "0", r.classList.toggle("off", !e), r.textContent = e ? "●" : "○", r.title = e ? t.t("layer.hideInsert") : t.t("layer.showInsert");
|
|
2924
2927
|
}
|
|
2925
|
-
function
|
|
2928
|
+
function et(r, e, t) {
|
|
2926
2929
|
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");
|
|
2927
2930
|
}
|
|
2928
2931
|
function ia(r) {
|
|
@@ -2935,7 +2938,7 @@ function bn(r, e, t, i) {
|
|
|
2935
2938
|
const n = r.id;
|
|
2936
2939
|
return n.layerIndex !== e || n.variantId !== t ? !1 : i === void 0 ? !0 : n.instanceId === i;
|
|
2937
2940
|
}
|
|
2938
|
-
function
|
|
2941
|
+
function ui(r) {
|
|
2939
2942
|
const e = r.querySelector(".vui-lrow-insert.active") ?? r.querySelector(".vui-lrow-block.active");
|
|
2940
2943
|
if (!e) return !1;
|
|
2941
2944
|
const t = r.getBoundingClientRect(), i = e.getBoundingClientRect();
|
|
@@ -2985,14 +2988,14 @@ function ra(r, e) {
|
|
|
2985
2988
|
);
|
|
2986
2989
|
a && a.classList.add("active");
|
|
2987
2990
|
}
|
|
2988
|
-
function sa(r, e, t, i =
|
|
2991
|
+
function sa(r, e, t, i = Vt) {
|
|
2989
2992
|
var l;
|
|
2990
2993
|
const n = new Map(e.map((d) => [d.index, d]));
|
|
2991
2994
|
r.querySelectorAll(".vui-lrow[data-layer-index]:not(.vui-lrow-all)").forEach((d) => {
|
|
2992
2995
|
const c = n.get(Number(d.dataset.layerIndex));
|
|
2993
2996
|
if (!c) return;
|
|
2994
2997
|
const p = d.querySelector(".vui-lrow-eye");
|
|
2995
|
-
p && (p.textContent = c.visible ? "●" : "○", p.title = c.visible ? i.t("layer.hide") : i.t("layer.show")), d.classList.toggle("off", !c.visible), xn(d,
|
|
2998
|
+
p && (p.textContent = c.visible ? "●" : "○", p.title = c.visible ? i.t("layer.hide") : i.t("layer.show")), d.classList.toggle("off", !c.visible), xn(d, Bt(c));
|
|
2996
2999
|
});
|
|
2997
3000
|
const s = r.querySelector(".vui-lrow-all"), a = t === null ? "#c8c8c8" : Ae(t);
|
|
2998
3001
|
(l = s == null ? void 0 : s.querySelector(".vui-lrow-clr")) == null || l.style.setProperty("background", a);
|
|
@@ -3001,7 +3004,7 @@ function sa(r, e, t, i = zt) {
|
|
|
3001
3004
|
}
|
|
3002
3005
|
function aa(r, e, t) {
|
|
3003
3006
|
var f;
|
|
3004
|
-
const i = t.text ??
|
|
3007
|
+
const i = t.text ?? Vt;
|
|
3005
3008
|
e.resetForScope(t.scopeKey);
|
|
3006
3009
|
const n = e.filterText.trim().toLowerCase(), s = t.layers.rows, a = ea(t.blocks);
|
|
3007
3010
|
if (r.list.replaceChildren(), r.count.textContent = String(s.length), s.length === 0) {
|
|
@@ -3034,7 +3037,7 @@ function aa(r, e, t) {
|
|
|
3034
3037
|
if (t.setAllLayerColor) t.setAllLayerColor(y);
|
|
3035
3038
|
else for (const C of s) t.setLayerColor(C.index, y);
|
|
3036
3039
|
const x = y === null ? "#c8c8c8" : Ae(y);
|
|
3037
|
-
(g = h.closest(".vui-lrow-clr")) == null || g.style.setProperty("background", x),
|
|
3040
|
+
(g = h.closest(".vui-lrow-clr")) == null || g.style.setProperty("background", x), hi(r.list, s, y);
|
|
3038
3041
|
} finally {
|
|
3039
3042
|
(w = t.endLayerColorPreview) == null || w.call(t, h);
|
|
3040
3043
|
}
|
|
@@ -3044,18 +3047,18 @@ function aa(r, e, t) {
|
|
|
3044
3047
|
var y;
|
|
3045
3048
|
if (b.preventDefault(), b.stopPropagation(), t.setAllLayerColor) t.setAllLayerColor(null);
|
|
3046
3049
|
else for (const v of s) t.setLayerColor(v.index, null);
|
|
3047
|
-
(y = h == null ? void 0 : h.closest(".vui-lrow-clr")) == null || y.style.setProperty("background", "#c8c8c8"), h && (h.value = "#c8c8c8"),
|
|
3050
|
+
(y = h == null ? void 0 : h.closest(".vui-lrow-clr")) == null || y.style.setProperty("background", "#c8c8c8"), h && (h.value = "#c8c8c8"), hi(r.list, s, null);
|
|
3048
3051
|
}), r.list.appendChild(p);
|
|
3049
3052
|
for (const b of s)
|
|
3050
3053
|
ta(n, b.name) && r.list.appendChild(oa(b, e, t, a.get(b.index) ?? [], i));
|
|
3051
|
-
c && e.needsSelectionReveal(c) && (
|
|
3052
|
-
e.needsSelectionReveal(c) &&
|
|
3054
|
+
c && e.needsSelectionReveal(c) && (ui(r.list) && e.markSelectionRevealed(c), typeof requestAnimationFrame == "function" && requestAnimationFrame(() => {
|
|
3055
|
+
e.needsSelectionReveal(c) && ui(r.list) && e.markSelectionRevealed(c);
|
|
3053
3056
|
}));
|
|
3054
3057
|
}
|
|
3055
3058
|
function Ae(r) {
|
|
3056
3059
|
return `#${r.toString(16).padStart(6, "0")}`;
|
|
3057
3060
|
}
|
|
3058
|
-
function
|
|
3061
|
+
function Bt(r) {
|
|
3059
3062
|
return r.color !== null ? Ae(r.color) : Ae(fn(r.sourceColor));
|
|
3060
3063
|
}
|
|
3061
3064
|
function xn(r, e) {
|
|
@@ -3066,15 +3069,15 @@ function xn(r, e) {
|
|
|
3066
3069
|
const i = r.querySelector('input[type="color"]');
|
|
3067
3070
|
i && i.value !== e && (i.value = e);
|
|
3068
3071
|
}
|
|
3069
|
-
function
|
|
3072
|
+
function hi(r, e, t) {
|
|
3070
3073
|
const i = new Map(e.map((n) => [n.index, n]));
|
|
3071
3074
|
r.querySelectorAll(".vui-lrow[data-layer-index]").forEach((n) => {
|
|
3072
3075
|
const s = i.get(Number(n.dataset.layerIndex));
|
|
3073
|
-
s && xn(n, t === null ?
|
|
3076
|
+
s && xn(n, t === null ? Bt(s) : Ae(t));
|
|
3074
3077
|
});
|
|
3075
3078
|
}
|
|
3076
3079
|
function oa(r, e, t, i, n) {
|
|
3077
|
-
const s = i.length > 0, a = e.expandedLayers.has(r.index), o =
|
|
3080
|
+
const s = i.length > 0, a = e.expandedLayers.has(r.index), o = Bt(r), l = document.createElement("div");
|
|
3078
3081
|
l.className = "vui-lrow-wrap";
|
|
3079
3082
|
const d = document.createElement("div");
|
|
3080
3083
|
d.className = `vui-lrow${r.visible ? "" : " off"}`, d.dataset.layerIndex = String(r.index);
|
|
@@ -3100,7 +3103,7 @@ function oa(r, e, t, i, n) {
|
|
|
3100
3103
|
else {
|
|
3101
3104
|
w = document.createElement("div"), w.className = "vui-lrow-blocks open";
|
|
3102
3105
|
for (const x of i)
|
|
3103
|
-
w.appendChild(
|
|
3106
|
+
w.appendChild(pi(x, e, t, n));
|
|
3104
3107
|
l.appendChild(w);
|
|
3105
3108
|
}
|
|
3106
3109
|
else {
|
|
@@ -3137,26 +3140,26 @@ function oa(r, e, t, i, n) {
|
|
|
3137
3140
|
const v = document.createElement("div");
|
|
3138
3141
|
v.className = "vui-lrow-blocks open";
|
|
3139
3142
|
for (const g of i)
|
|
3140
|
-
v.appendChild(
|
|
3143
|
+
v.appendChild(pi(g, e, t, n));
|
|
3141
3144
|
l.appendChild(v);
|
|
3142
3145
|
}
|
|
3143
3146
|
return l;
|
|
3144
3147
|
}
|
|
3145
|
-
function
|
|
3148
|
+
function pi(r, e, t, i) {
|
|
3146
3149
|
const n = document.createElement("div");
|
|
3147
3150
|
n.className = "vui-lrow-block-wrap";
|
|
3148
3151
|
const s = e.expandedBlocks.has(r.key), a = ia(r.inserts), o = bn(t.selection, r.layerIndex, r.variantId), l = document.createElement("div");
|
|
3149
3152
|
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"));
|
|
3150
3153
|
const d = document.createElement("button");
|
|
3151
|
-
d.type = "button", d.className = "vui-lrow-block-visibility",
|
|
3154
|
+
d.type = "button", d.className = "vui-lrow-block-visibility", et(d, a, i), d.addEventListener("click", (f) => {
|
|
3152
3155
|
if (f.stopPropagation(), a === "none") {
|
|
3153
3156
|
const y = e.blockVisibilitySnapshots.get(r.key), v = [];
|
|
3154
3157
|
for (const g of r.inserts) {
|
|
3155
3158
|
const w = (y == null ? void 0 : y.get(g.instanceId)) ?? !0;
|
|
3156
3159
|
g.visible !== w && v.push({ insertId: g.insertId, visible: w });
|
|
3157
3160
|
}
|
|
3158
|
-
if (
|
|
3159
|
-
|
|
3161
|
+
if (et(d, "all", i), n.querySelectorAll(".vui-lrow-insert-visibility").forEach((g) => {
|
|
3162
|
+
rt(g, !0, i);
|
|
3160
3163
|
}), t.batchToggleInserts && v.length > 0)
|
|
3161
3164
|
t.batchToggleInserts(v);
|
|
3162
3165
|
else
|
|
@@ -3168,8 +3171,8 @@ function ui(r, e, t, i) {
|
|
|
3168
3171
|
new Map(r.inserts.map((y) => [y.instanceId, y.visible]))
|
|
3169
3172
|
);
|
|
3170
3173
|
const b = r.inserts.filter((y) => y.visible).map((y) => ({ insertId: y.insertId, visible: !1 }));
|
|
3171
|
-
if (
|
|
3172
|
-
|
|
3174
|
+
if (et(d, "none", i), n.querySelectorAll(".vui-lrow-insert-visibility").forEach((y) => {
|
|
3175
|
+
rt(y, !1, i);
|
|
3173
3176
|
}), t.batchToggleInserts && b.length > 0)
|
|
3174
3177
|
t.batchToggleInserts(b);
|
|
3175
3178
|
else
|
|
@@ -3183,7 +3186,7 @@ function ui(r, e, t, i) {
|
|
|
3183
3186
|
c.textContent = b ? "▼" : "▶";
|
|
3184
3187
|
let y = n.querySelector(":scope > .vui-lrow-inserts");
|
|
3185
3188
|
if (b)
|
|
3186
|
-
y ? y.classList.add("open") : (y =
|
|
3189
|
+
y ? y.classList.add("open") : (y = mi(r, e, t, d, i), n.appendChild(y));
|
|
3187
3190
|
else {
|
|
3188
3191
|
y == null || y.classList.remove("open");
|
|
3189
3192
|
const v = n.closest(".vui-section-list") ?? n.parentElement;
|
|
@@ -3198,26 +3201,26 @@ function ui(r, e, t, i) {
|
|
|
3198
3201
|
if (!r.canHighlight) return;
|
|
3199
3202
|
const f = r.inserts[0], b = `${r.layerIndex}:${r.variantId}:${f.instanceId}`;
|
|
3200
3203
|
e.markSelectionRevealed(b), t.selectInsert(f.insertId);
|
|
3201
|
-
}), n.appendChild(l), s && n.appendChild(
|
|
3204
|
+
}), n.appendChild(l), s && n.appendChild(mi(r, e, t, d, i)), n;
|
|
3202
3205
|
}
|
|
3203
|
-
function
|
|
3206
|
+
function mi(r, e, t, i, n) {
|
|
3204
3207
|
const s = document.createElement("div");
|
|
3205
3208
|
s.className = "vui-lrow-inserts open";
|
|
3206
3209
|
for (const a of r.inserts) {
|
|
3207
3210
|
const o = document.createElement("div");
|
|
3208
3211
|
o.className = `vui-lrow-insert${bn(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"));
|
|
3209
3212
|
const l = document.createElement("button");
|
|
3210
|
-
l.type = "button", l.className = "vui-lrow-insert-visibility",
|
|
3213
|
+
l.type = "button", l.className = "vui-lrow-insert-visibility", rt(l, a.visible, n), l.addEventListener("click", (c) => {
|
|
3211
3214
|
c.stopPropagation();
|
|
3212
3215
|
const p = !a.visible;
|
|
3213
|
-
|
|
3216
|
+
rt(l, p, n);
|
|
3214
3217
|
const h = s.querySelectorAll(".vui-lrow-insert-visibility");
|
|
3215
3218
|
let m = 0;
|
|
3216
3219
|
h.forEach((b) => {
|
|
3217
3220
|
b.dataset.visible === "1" && m++;
|
|
3218
3221
|
});
|
|
3219
3222
|
const f = m === 0 ? "none" : m === h.length ? "all" : "mixed";
|
|
3220
|
-
|
|
3223
|
+
et(i, f, n), t.toggleInsert(a.insertId, p);
|
|
3221
3224
|
});
|
|
3222
3225
|
const d = document.createElement("span");
|
|
3223
3226
|
d.className = "vui-lrow-insert-label", d.textContent = a.label, d.title = a.label, o.append(l, d), o.addEventListener("click", () => {
|
|
@@ -3238,16 +3241,16 @@ function da(r, e) {
|
|
|
3238
3241
|
};
|
|
3239
3242
|
return r.addEventListener("input", t), () => r.removeEventListener("input", t);
|
|
3240
3243
|
}
|
|
3241
|
-
function
|
|
3244
|
+
function fi(r, e, t = Vt, i = "mm") {
|
|
3242
3245
|
if (r.body.replaceChildren(), e.textSelection && e.textDetails) {
|
|
3243
|
-
Ce(r, !1), ua(r.body, e.textDetails, t, i),
|
|
3246
|
+
Ce(r, !1), ua(r.body, e.textDetails, t, i), vi(r.body);
|
|
3244
3247
|
return;
|
|
3245
3248
|
}
|
|
3246
3249
|
if (!e.selection || !e.details) {
|
|
3247
3250
|
Ce(r, !1), r.body.appendChild(ha(t.t("property.empty")));
|
|
3248
3251
|
return;
|
|
3249
3252
|
}
|
|
3250
|
-
ca(r.body, e.details, t, i),
|
|
3253
|
+
ca(r.body, e.details, t, i), vi(r.body);
|
|
3251
3254
|
}
|
|
3252
3255
|
function Ce(r, e) {
|
|
3253
3256
|
if (!r.previewWrap || !r.previewCanvas || (r.previewWrap.hidden = !e, e)) return;
|
|
@@ -3255,14 +3258,14 @@ function Ce(r, e) {
|
|
|
3255
3258
|
t == null || t.clearRect(0, 0, r.previewCanvas.width, r.previewCanvas.height);
|
|
3256
3259
|
}
|
|
3257
3260
|
function ca(r, e, t, i) {
|
|
3258
|
-
wn(r, t.t("property.insert"), e.blockName),
|
|
3261
|
+
wn(r, t.t("property.insert"), e.blockName), At(r, t.t("property.basic"), (n) => {
|
|
3259
3262
|
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"));
|
|
3260
|
-
}),
|
|
3263
|
+
}), At(r, t.t("property.transform"), (n) => {
|
|
3261
3264
|
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));
|
|
3262
3265
|
});
|
|
3263
3266
|
}
|
|
3264
3267
|
function ua(r, e, t, i) {
|
|
3265
|
-
wn(r, t.t("property.text"), e.content),
|
|
3268
|
+
wn(r, t.t("property.text"), e.content), At(r, t.t("property.basic"), (n) => {
|
|
3266
3269
|
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, "°"));
|
|
3267
3270
|
});
|
|
3268
3271
|
}
|
|
@@ -3270,7 +3273,7 @@ function wn(r, e, t) {
|
|
|
3270
3273
|
const i = document.createElement("div");
|
|
3271
3274
|
i.className = "vui-pp-section vui-pp-title-row", i.innerHTML = `<strong>${H(e)}</strong><span>·</span><span>${H(t)}</span>`, r.appendChild(i);
|
|
3272
3275
|
}
|
|
3273
|
-
function
|
|
3276
|
+
function At(r, e, t) {
|
|
3274
3277
|
const i = document.createElement("section");
|
|
3275
3278
|
i.className = "vui-pp-section";
|
|
3276
3279
|
const n = document.createElement("div");
|
|
@@ -3284,7 +3287,7 @@ function ha(r) {
|
|
|
3284
3287
|
const e = document.createElement("div");
|
|
3285
3288
|
return e.className = "vui-empty-note", e.textContent = r, e;
|
|
3286
3289
|
}
|
|
3287
|
-
function
|
|
3290
|
+
function vi(r) {
|
|
3288
3291
|
if (r.querySelector('input:not([type="color"])'))
|
|
3289
3292
|
throw new Error("Property panel must not contain editable inputs");
|
|
3290
3293
|
if (r.querySelector('[contenteditable=""], [contenteditable="true"]'))
|
|
@@ -4306,7 +4309,7 @@ button, input { font: inherit; }
|
|
|
4306
4309
|
}
|
|
4307
4310
|
`
|
|
4308
4311
|
};
|
|
4309
|
-
function
|
|
4312
|
+
function pt(r = "dark", e = {}) {
|
|
4310
4313
|
const t = {
|
|
4311
4314
|
accent: "--vui-accent",
|
|
4312
4315
|
panelBackground: "--vui-bg2",
|
|
@@ -4333,7 +4336,7 @@ const ba = {
|
|
|
4333
4336
|
infobarLineMode: !0,
|
|
4334
4337
|
infobarPhase: !0,
|
|
4335
4338
|
infobarDebug: !0
|
|
4336
|
-
},
|
|
4339
|
+
}, gi = "property-panel:open", bi = "layer-panel:open", yi = 300, xi = 180, ya = 2;
|
|
4337
4340
|
let xa = 0;
|
|
4338
4341
|
function be(r, ...e) {
|
|
4339
4342
|
const t = document.createElement("div");
|
|
@@ -4343,7 +4346,7 @@ function be(r, ...e) {
|
|
|
4343
4346
|
const n = document.createElement("div");
|
|
4344
4347
|
return n.className = "vui-debug-value", n.append(...e), t.append(i, n), t;
|
|
4345
4348
|
}
|
|
4346
|
-
function
|
|
4349
|
+
function wi(r, e, t) {
|
|
4347
4350
|
const i = document.createElement("div");
|
|
4348
4351
|
i.className = "vui-debug-spread";
|
|
4349
4352
|
const n = document.createElement("b");
|
|
@@ -4355,7 +4358,7 @@ function yi(r, e, t) {
|
|
|
4355
4358
|
}
|
|
4356
4359
|
return i;
|
|
4357
4360
|
}
|
|
4358
|
-
function
|
|
4361
|
+
function Ci(r) {
|
|
4359
4362
|
const e = document.createElement("div");
|
|
4360
4363
|
return e.className = "vui-debug-spread-list", e.append(...r), e;
|
|
4361
4364
|
}
|
|
@@ -4377,7 +4380,7 @@ function wa(r, e) {
|
|
|
4377
4380
|
return "";
|
|
4378
4381
|
}
|
|
4379
4382
|
}
|
|
4380
|
-
function
|
|
4383
|
+
function Ei(r) {
|
|
4381
4384
|
return (typeof r.composedPath == "function" ? r.composedPath() : [r.target]).some((t) => {
|
|
4382
4385
|
var a, o;
|
|
4383
4386
|
if (!t || typeof t != "object") return !1;
|
|
@@ -4423,13 +4426,13 @@ class Ca {
|
|
|
4423
4426
|
u(this, "activeLayerColorPreview", null);
|
|
4424
4427
|
u(this, "renderedLayerRows", null);
|
|
4425
4428
|
u(this, "handleKeyDown", (e) => {
|
|
4426
|
-
if (this.disposed || e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey ||
|
|
4429
|
+
if (this.disposed || e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey || Ei(e)) return;
|
|
4427
4430
|
const t = this.getFitShortcut();
|
|
4428
4431
|
t && e.key.toLowerCase() === t.toLowerCase() && this.host.fitSelectionOrDocument();
|
|
4429
4432
|
});
|
|
4430
4433
|
u(this, "handleKeyboardTargetPointerDown", (e) => {
|
|
4431
4434
|
var t, i;
|
|
4432
|
-
this.disposed ||
|
|
4435
|
+
this.disposed || Ei(e) || (i = (t = this.keyboardTarget) == null ? void 0 : t.focus) == null || i.call(t, { preventScroll: !0 });
|
|
4433
4436
|
});
|
|
4434
4437
|
u(this, "unsubscribers", []);
|
|
4435
4438
|
u(this, "filterCleanup", null);
|
|
@@ -4441,7 +4444,7 @@ class Ca {
|
|
|
4441
4444
|
}
|
|
4442
4445
|
}));
|
|
4443
4446
|
u(this, "refresh", () => {
|
|
4444
|
-
this.disposed || !this.active || (this.syncToolbarState(), this.renderLayerPanel(), this.propertyPanelRefs && this.parts.propertyPanel && (
|
|
4447
|
+
this.disposed || !this.active || (this.syncToolbarState(), this.renderLayerPanel(), this.propertyPanelRefs && this.parts.propertyPanel && (fi(this.propertyPanelRefs, this.host.cad.inspector, this.text, this.getCadUnit()), this.syncPropertyPanelSelectionState(), this.syncPropertyPanelPreview()), this.syncHud());
|
|
4445
4448
|
});
|
|
4446
4449
|
u(this, "syncHud", () => {
|
|
4447
4450
|
var e;
|
|
@@ -4459,7 +4462,7 @@ class Ca {
|
|
|
4459
4462
|
blocks: this.text.formatInteger(t.blockVariantCount),
|
|
4460
4463
|
split: this.text.formatInteger(t.splitBlockLayerGroupCount)
|
|
4461
4464
|
});
|
|
4462
|
-
const s = t.renderDebugBreakdown.map((d) =>
|
|
4465
|
+
const s = t.renderDebugBreakdown.map((d) => wi(
|
|
4463
4466
|
d.label,
|
|
4464
4467
|
this.text.t("toolbar.debug.breakdown", {
|
|
4465
4468
|
renderables: this.text.formatInteger(d.renderables),
|
|
@@ -4471,8 +4474,8 @@ class Ca {
|
|
|
4471
4474
|
calls: this.text.formatInteger(t.drawCalls)
|
|
4472
4475
|
})
|
|
4473
4476
|
];
|
|
4474
|
-
s.length > 0 && a.push(
|
|
4475
|
-
const o = t.splitBlockLayerDetails.map((d) =>
|
|
4477
|
+
s.length > 0 && a.push(Ci(s));
|
|
4478
|
+
const o = t.splitBlockLayerDetails.map((d) => wi(
|
|
4476
4479
|
`${d.blockName} #${d.variantId}`,
|
|
4477
4480
|
this.text.t("toolbar.debug.spreadMeta", {
|
|
4478
4481
|
layers: this.text.formatInteger(d.layerCount),
|
|
@@ -4489,7 +4492,7 @@ class Ca {
|
|
|
4489
4492
|
const l = [this.text.t("toolbar.debug.splitLayerCount", {
|
|
4490
4493
|
count: this.text.formatInteger(t.splitBlockLayerGroupCount)
|
|
4491
4494
|
})];
|
|
4492
|
-
o.length > 0 && l.push(
|
|
4495
|
+
o.length > 0 && l.push(Ci(o)), this.infobarRefs.debugBody.replaceChildren(
|
|
4493
4496
|
be("" + this.text.t("toolbar.debug.submitted"), this.text.formatInteger(t.submittedVertexRefs)),
|
|
4494
4497
|
...t.lineRenderMode ? [be(this.text.t("toolbar.debug.lineMode"), t.lineRenderMode.toUpperCase())] : [],
|
|
4495
4498
|
be(this.text.t("toolbar.debug.layers"), this.text.t("toolbar.debug.layerCount", {
|
|
@@ -4527,7 +4530,7 @@ class Ca {
|
|
|
4527
4530
|
if (this.disposed) return;
|
|
4528
4531
|
this.shadow = ((o = this.host.layout) == null ? void 0 : o.shadowRoot()) ?? this.options.root.shadowRoot ?? this.options.root.attachShadow({ mode: "open" });
|
|
4529
4532
|
const e = this.theme, t = document.createElement("style");
|
|
4530
|
-
t.dataset.viewerUiTheme = "", t.textContent =
|
|
4533
|
+
t.dataset.viewerUiTheme = "", t.textContent = pt(e, this.options.tokens), this.themeStyle = t;
|
|
4531
4534
|
const i = document.createElement("div");
|
|
4532
4535
|
i.className = "vui-root", i.dataset.theme = e, i.dataset.preset = this.options.preset ?? "auto";
|
|
4533
4536
|
const n = document.createElement("div");
|
|
@@ -4554,11 +4557,11 @@ class Ca {
|
|
|
4554
4557
|
this.themeValue = e;
|
|
4555
4558
|
const t = this.shadow.querySelector(".vui-root");
|
|
4556
4559
|
if (t && (t.dataset.theme = e), this.themeStyle) {
|
|
4557
|
-
this.themeStyle.textContent =
|
|
4560
|
+
this.themeStyle.textContent = pt(e, this.options.tokens);
|
|
4558
4561
|
return;
|
|
4559
4562
|
}
|
|
4560
4563
|
const i = document.createElement("style");
|
|
4561
|
-
i.dataset.viewerUiTheme = "", i.textContent =
|
|
4564
|
+
i.dataset.viewerUiTheme = "", i.textContent = pt(e, this.options.tokens), (n = this.shadow.querySelector("style[data-viewer-ui-theme]")) == null || n.replaceWith(i), this.themeStyle = i;
|
|
4562
4565
|
}
|
|
4563
4566
|
get theme() {
|
|
4564
4567
|
return this.themeValue;
|
|
@@ -4725,7 +4728,7 @@ class Ca {
|
|
|
4725
4728
|
const e = this.host.cad.inspector.selection, t = e == null ? void 0 : e.id, i = t ? `${t.layerIndex}:${t.variantId}:${t.instanceId}` : null;
|
|
4726
4729
|
i && this.layerPanelState.needsSelectionReveal(i) ? this.renderLayerPanel() : ra(this.layerPanelRefs.list, e);
|
|
4727
4730
|
}
|
|
4728
|
-
this.propertyPanelRefs && this.parts.propertyPanel && (
|
|
4731
|
+
this.propertyPanelRefs && this.parts.propertyPanel && (fi(this.propertyPanelRefs, this.host.cad.inspector, this.text, this.getCadUnit()), this.syncPropertyPanelSelectionState(), this.syncPropertyPanelPreview());
|
|
4729
4732
|
}),
|
|
4730
4733
|
this.host.cad.on("hud-change", () => this.syncHud()),
|
|
4731
4734
|
this.host.on("view-mode-change", () => {
|
|
@@ -4814,7 +4817,7 @@ class Ca {
|
|
|
4814
4817
|
var e;
|
|
4815
4818
|
if (((e = this.options.cad) == null ? void 0 : e.persistence) === !1) return !1;
|
|
4816
4819
|
try {
|
|
4817
|
-
return this.readState(
|
|
4820
|
+
return this.readState(gi) === "1";
|
|
4818
4821
|
} catch {
|
|
4819
4822
|
return !1;
|
|
4820
4823
|
}
|
|
@@ -4823,7 +4826,7 @@ class Ca {
|
|
|
4823
4826
|
var e;
|
|
4824
4827
|
if (((e = this.options.cad) == null ? void 0 : e.persistence) === !1) return !0;
|
|
4825
4828
|
try {
|
|
4826
|
-
return this.readState(
|
|
4829
|
+
return this.readState(bi) !== "0";
|
|
4827
4830
|
} catch {
|
|
4828
4831
|
return !0;
|
|
4829
4832
|
}
|
|
@@ -4836,7 +4839,7 @@ class Ca {
|
|
|
4836
4839
|
panel: this.text.t("panel.layers")
|
|
4837
4840
|
})), !!t && (this.emitUiLayoutChange(), ((s = this.options.cad) == null ? void 0 : s.persistence) !== !1)))
|
|
4838
4841
|
try {
|
|
4839
|
-
this.writeState(
|
|
4842
|
+
this.writeState(bi, e ? "1" : "0");
|
|
4840
4843
|
} catch {
|
|
4841
4844
|
}
|
|
4842
4845
|
}
|
|
@@ -4852,7 +4855,7 @@ class Ca {
|
|
|
4852
4855
|
panel: this.text.t("panel.properties")
|
|
4853
4856
|
})), (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)))
|
|
4854
4857
|
try {
|
|
4855
|
-
this.writeState(
|
|
4858
|
+
this.writeState(gi, e ? "1" : "0");
|
|
4856
4859
|
} catch {
|
|
4857
4860
|
}
|
|
4858
4861
|
}
|
|
@@ -4950,7 +4953,7 @@ class Ca {
|
|
|
4950
4953
|
return (t = this.propertyPanelShell) != null && t.classList.contains("closed") ? !0 : !this.isPropertyPreviewLayoutReady(e);
|
|
4951
4954
|
}
|
|
4952
4955
|
isPropertyPreviewLayoutReady(e) {
|
|
4953
|
-
return e.clientWidth >=
|
|
4956
|
+
return e.clientWidth >= xi && e.clientHeight >= xi;
|
|
4954
4957
|
}
|
|
4955
4958
|
waitForPropertyPreviewLayout(e) {
|
|
4956
4959
|
if (this.isPropertyPreviewLayoutReady(e)) return Promise.resolve();
|
|
@@ -4984,12 +4987,12 @@ class Ca {
|
|
|
4984
4987
|
}, x = () => {
|
|
4985
4988
|
g || (g = !0, v.removeEventListener("transitionend", w), requestAnimationFrame(m));
|
|
4986
4989
|
};
|
|
4987
|
-
v.addEventListener("transitionend", w), l.push(window.setTimeout(x,
|
|
4990
|
+
v.addEventListener("transitionend", w), l.push(window.setTimeout(x, yi)), d.push(() => {
|
|
4988
4991
|
g || (g = !0, v.removeEventListener("transitionend", w));
|
|
4989
4992
|
});
|
|
4990
4993
|
}, b = () => {
|
|
4991
4994
|
m(), s || (c = requestAnimationFrame(b));
|
|
4992
|
-
}, y = window.setTimeout(h,
|
|
4995
|
+
}, y = window.setTimeout(h, yi);
|
|
4993
4996
|
f(i), f(t), c = requestAnimationFrame(b), this.propertyPreviewLayoutWaitAbort = () => {
|
|
4994
4997
|
s = !0, p();
|
|
4995
4998
|
};
|
|
@@ -5088,7 +5091,7 @@ class Pa {
|
|
|
5088
5091
|
}
|
|
5089
5092
|
mountNode(e, t, i, n) {
|
|
5090
5093
|
var l;
|
|
5091
|
-
const s =
|
|
5094
|
+
const s = mt(t, i, n), a = this.ensureZoneContainer(t, i, n);
|
|
5092
5095
|
a.append(e);
|
|
5093
5096
|
const o = { node: e, zone: t, builtin: i, group: n, container: a, key: s };
|
|
5094
5097
|
return this.mounts.add(o), ne(e) && ((l = this.resizeObserver) == null || l.observe(e)), this.schedule(), {
|
|
@@ -5104,7 +5107,7 @@ class Pa {
|
|
|
5104
5107
|
}
|
|
5105
5108
|
ensureZoneContainer(e, t, i) {
|
|
5106
5109
|
var l;
|
|
5107
|
-
const n =
|
|
5110
|
+
const n = mt(e, t, i), s = this.zoneContainers.get(n);
|
|
5108
5111
|
if (s) return s;
|
|
5109
5112
|
const a = document.createElement("div");
|
|
5110
5113
|
a.dataset.viewerZone = e, a.dataset.viewerZoneOwner = t ? "builtin" : "plugin", i && (a.dataset.viewerZoneGroup = i), a.dataset.viewerZoneActive = String(!i || this.activeGroups.has(i));
|
|
@@ -5113,7 +5116,7 @@ class Pa {
|
|
|
5113
5116
|
}
|
|
5114
5117
|
/** Test/debug seam. Prefer querying the relevant host by data attributes. */
|
|
5115
5118
|
getOwnerZoneElement(e, t = !1, i) {
|
|
5116
|
-
return this.zoneContainers.get(
|
|
5119
|
+
return this.zoneContainers.get(mt(e, t, i)) ?? null;
|
|
5117
5120
|
}
|
|
5118
5121
|
installZoneStyles(e, t) {
|
|
5119
5122
|
if (!e || typeof e.querySelector != "function" || typeof e.prepend != "function" || e.querySelector(`style[data-viewer-layout="${t}"]`)) return;
|
|
@@ -5189,7 +5192,7 @@ class Pa {
|
|
|
5189
5192
|
return !t || t === e || !ne(e) || !ne(t) || !e.contains(t) ? !0 : (this.warnedUnstableReference || (this.warnedUnstableReference = !0, console.warn("[viewer] ui.root must not contain the inset target; content insets will be broadcast but not applied. Use a shell-level ui.root so insets stay stable.")), !1);
|
|
5190
5193
|
}
|
|
5191
5194
|
}
|
|
5192
|
-
function
|
|
5195
|
+
function mt(r, e, t) {
|
|
5193
5196
|
return `${e ? "builtin" : "plugin"}:${t ?? ""}:${r}`;
|
|
5194
5197
|
}
|
|
5195
5198
|
function ne(r) {
|
|
@@ -5235,7 +5238,7 @@ const Ra = `
|
|
|
5235
5238
|
sun: '<circle cx="12" cy="12" r="4"/><path d="M12 2v2m0 16v2M2 12h2m16 0h2M5 5l1.5 1.5m11 11L19 19M5 19l1.5-1.5m11-11L19 5"/>',
|
|
5236
5239
|
moon: '<path d="M20.5 13A9 9 0 0 1 11 3.5 9 9 0 1 0 20.5 13Z"/>'
|
|
5237
5240
|
};
|
|
5238
|
-
function
|
|
5241
|
+
function dt(r) {
|
|
5239
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">${Ia[r]}</svg>`;
|
|
5240
5243
|
}
|
|
5241
5244
|
const La = {
|
|
@@ -5262,7 +5265,7 @@ function Da(r, e) {
|
|
|
5262
5265
|
let o = null, l = null, d = { play: "运行仿真", pause: "暂停仿真", reset: "重置仿真" }, c = e.theme ?? "dark", p = null;
|
|
5263
5266
|
const h = (v, g, w, x, C) => {
|
|
5264
5267
|
const k = document.createElement("button");
|
|
5265
|
-
return k.type = "button", k.className = "vpu-btn", k.dataset.viewerControl = g, k.dataset.viewerControlId = v, k.innerHTML =
|
|
5268
|
+
return k.type = "button", k.className = "vpu-btn", k.dataset.viewerControl = g, k.dataset.viewerControlId = v, k.innerHTML = dt(x), k.title = w, k.setAttribute("aria-label", w), k.addEventListener("click", C), a.set(v, { button: k, icon: x }), s.append(k), k;
|
|
5266
5269
|
}, m = (v, g) => v ? g === "filename" ? t.filename : g === "playback" ? t.playback && v.canPlay : g === "reset" ? t.reset && v.canReset : g === "fit" ? t.fit : g === "upAxis" ? t.upAxis && v.canReorientUpAxis === !0 : g === "environment" ? t.environment : g === "ground" ? t.ground && v.canToggleGround === !0 : g === "collision" ? t.collision && v.canToggleCollision === !0 : t.theme : !1, f = (v) => {
|
|
5267
5270
|
var k, E, P, I, D, S, U;
|
|
5268
5271
|
p = v, s.replaceChildren(), a.clear(), o = null, l = null;
|
|
@@ -5294,12 +5297,12 @@ function Da(r, e) {
|
|
|
5294
5297
|
var V;
|
|
5295
5298
|
(V = e.environment) == null || V.openPicker(L);
|
|
5296
5299
|
});
|
|
5297
|
-
L.setAttribute("aria-haspopup", "dialog"), L.setAttribute("aria-controls", "vpu-environment-picker"),
|
|
5300
|
+
L.setAttribute("aria-haspopup", "dialog"), L.setAttribute("aria-controls", "vpu-environment-picker"), ki(L, ((U = e.environment) == null ? void 0 : U.isPickerOpen()) ?? !1);
|
|
5298
5301
|
}
|
|
5299
5302
|
if (v && m(g, "ground") && h("ground", "ground", "显示地面", "ground", () => {
|
|
5300
5303
|
const L = r.asset.$readControl().groundVisible;
|
|
5301
5304
|
r.commands.setGroundVisible(!L);
|
|
5302
|
-
}), v && m(g, "collision") && h("collision", "collision",
|
|
5305
|
+
}), v && m(g, "collision") && h("collision", "collision", Si(!1), "collision", () => {
|
|
5303
5306
|
const L = r.asset.$readControl().collisionVisible;
|
|
5304
5307
|
r.commands.setCollisionVisible(!L);
|
|
5305
5308
|
}), v && m(g, "theme")) {
|
|
@@ -5319,7 +5322,7 @@ function Da(r, e) {
|
|
|
5319
5322
|
const w = a.get("ground");
|
|
5320
5323
|
w && He(w.button, v.groundVisible ? "隐藏地面" : "显示地面", "ground", v.groundVisible);
|
|
5321
5324
|
const x = a.get("collision");
|
|
5322
|
-
x && He(x.button,
|
|
5325
|
+
x && He(x.button, Si(v.collisionVisible), "collision", v.collisionVisible);
|
|
5323
5326
|
const C = a.get("upAxis");
|
|
5324
5327
|
C && He(C.button, Na(v.upAxis), Ta(v.upAxis), v.upAxis === "y");
|
|
5325
5328
|
};
|
|
@@ -5329,7 +5332,7 @@ function Da(r, e) {
|
|
|
5329
5332
|
pressedChanged: () => b(r.asset.$readControl()),
|
|
5330
5333
|
pickerChanged: (v) => {
|
|
5331
5334
|
const g = a.get("environment");
|
|
5332
|
-
g &&
|
|
5335
|
+
g && ki(g.button, v);
|
|
5333
5336
|
},
|
|
5334
5337
|
environmentAnchor: () => {
|
|
5335
5338
|
var v;
|
|
@@ -5343,11 +5346,11 @@ function Da(r, e) {
|
|
|
5343
5346
|
}
|
|
5344
5347
|
};
|
|
5345
5348
|
}
|
|
5346
|
-
function
|
|
5349
|
+
function ki(r, e) {
|
|
5347
5350
|
r.setAttribute("aria-expanded", String(e)), r.classList.toggle("is-active", e);
|
|
5348
5351
|
}
|
|
5349
5352
|
function He(r, e, t, i) {
|
|
5350
|
-
r.innerHTML =
|
|
5353
|
+
r.innerHTML = dt(t), r.title = e, r.setAttribute("aria-label", e), r.setAttribute("aria-pressed", String(i)), r.classList.toggle("is-active", i);
|
|
5351
5354
|
}
|
|
5352
5355
|
function Ta(r) {
|
|
5353
5356
|
return r === "y" ? "upAxisY" : "upAxisZ";
|
|
@@ -5355,7 +5358,7 @@ function Ta(r) {
|
|
|
5355
5358
|
function Na(r) {
|
|
5356
5359
|
return r === "y" ? "当前 Y-UP,点击切换为 Z-UP" : "当前 Z-UP,点击切换为 Y-UP";
|
|
5357
5360
|
}
|
|
5358
|
-
function
|
|
5361
|
+
function Si(r) {
|
|
5359
5362
|
return `${r ? "隐藏碰撞代理" : "显示碰撞代理"}(青绿=精确代理,橙黄=碰撞源网格近似)`;
|
|
5360
5363
|
}
|
|
5361
5364
|
class Oa {
|
|
@@ -5372,8 +5375,8 @@ class Oa {
|
|
|
5372
5375
|
u(this, "rotation");
|
|
5373
5376
|
u(this, "status");
|
|
5374
5377
|
u(this, "input");
|
|
5375
|
-
u(this, "defaultPreview", new
|
|
5376
|
-
u(this, "customPreview", new
|
|
5378
|
+
u(this, "defaultPreview", new ft());
|
|
5379
|
+
u(this, "customPreview", new ft());
|
|
5377
5380
|
u(this, "showBackgroundToggle");
|
|
5378
5381
|
u(this, "onOpenChange");
|
|
5379
5382
|
u(this, "state");
|
|
@@ -5390,7 +5393,7 @@ class Oa {
|
|
|
5390
5393
|
const s = document.createElement("header");
|
|
5391
5394
|
s.className = "vpu-environment-header";
|
|
5392
5395
|
const a = document.createElement("div");
|
|
5393
|
-
a.className = "vpu-environment-title", a.textContent = "环境纹理", this.closeButton =
|
|
5396
|
+
a.className = "vpu-environment-title", a.textContent = "环境纹理", this.closeButton = Pi("关闭环境选择", "close"), s.append(a, this.closeButton);
|
|
5394
5397
|
const o = document.createElement("label");
|
|
5395
5398
|
o.className = "vpu-environment-background", o.hidden = !this.showBackgroundToggle;
|
|
5396
5399
|
const l = document.createElement("span");
|
|
@@ -5461,12 +5464,12 @@ class Oa {
|
|
|
5461
5464
|
const t = Fa(e);
|
|
5462
5465
|
this.syncPresetCards(t);
|
|
5463
5466
|
const i = e.active === "default" ? e.activePresetIndex ?? 0 : null;
|
|
5464
|
-
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] ?
|
|
5467
|
+
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";
|
|
5465
5468
|
for (let a = 0; a < this.presetCards.length; a += 1) {
|
|
5466
5469
|
const o = this.presetCards[a], l = t[a + 1];
|
|
5467
|
-
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 ?
|
|
5470
|
+
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";
|
|
5468
5471
|
}
|
|
5469
|
-
if (this.customCard.name.textContent = ((s = e.customEnvironment) == null ? void 0 : s.name) ?? "上传自定义环境", this.customCard.format.textContent = e.customEnvironment ?
|
|
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 = En(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) {
|
|
5470
5473
|
t[0] ? this.defaultPreview.load(this.defaultCard, t[0]) : this.defaultPreview.clear(this.defaultCard);
|
|
5471
5474
|
for (let a = 0; a < this.presetCards.length; a += 1) {
|
|
5472
5475
|
const o = t[a + 1], l = this.presetCards[a], d = this.presetPreviews[a];
|
|
@@ -5491,7 +5494,7 @@ class Oa {
|
|
|
5491
5494
|
for (; this.presetCards.length > t; )
|
|
5492
5495
|
(i = this.presetPreviews.pop()) == null || i.dispose(), (n = this.presetCards.pop()) == null || n.root.remove();
|
|
5493
5496
|
for (; this.presetCards.length < t; ) {
|
|
5494
|
-
const s = this.presetCards.length + 1, a = this.createCard(`预设环境 ${s + 1}`, !1), o = new
|
|
5497
|
+
const s = this.presetCards.length + 1, a = this.createCard(`预设环境 ${s + 1}`, !1), o = new ft();
|
|
5495
5498
|
a.select.addEventListener("click", () => {
|
|
5496
5499
|
this.run(() => this.api.usePreset(s));
|
|
5497
5500
|
}), this.presetCards.push(a), this.presetPreviews.push(o), this.list.insertBefore(a.root, this.customCard.root);
|
|
@@ -5507,14 +5510,14 @@ class Oa {
|
|
|
5507
5510
|
const a = document.createElement("canvas");
|
|
5508
5511
|
a.width = 128, a.height = 128, a.setAttribute("aria-hidden", "true");
|
|
5509
5512
|
const o = document.createElement("span");
|
|
5510
|
-
o.className = "vpu-environment-fallback", o.innerHTML =
|
|
5513
|
+
o.className = "vpu-environment-fallback", o.innerHTML = dt(t ? "image" : "environment"), s.append(a, o);
|
|
5511
5514
|
const l = document.createElement("span");
|
|
5512
5515
|
l.className = "vpu-environment-format";
|
|
5513
5516
|
const d = document.createElement("span");
|
|
5514
5517
|
d.className = "vpu-environment-meta";
|
|
5515
5518
|
const c = document.createElement("span");
|
|
5516
5519
|
c.className = "vpu-environment-name", d.append(c), n.append(s, d);
|
|
5517
|
-
const p = t ?
|
|
5520
|
+
const p = t ? Pi("更换自定义环境", "upload") : void 0;
|
|
5518
5521
|
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 };
|
|
5519
5522
|
}
|
|
5520
5523
|
async run(e, t = "") {
|
|
@@ -5544,7 +5547,7 @@ class Oa {
|
|
|
5544
5547
|
this.pendingRotationValue = null, e !== null && this.setRotation(e);
|
|
5545
5548
|
}
|
|
5546
5549
|
}
|
|
5547
|
-
class
|
|
5550
|
+
class ft {
|
|
5548
5551
|
constructor() {
|
|
5549
5552
|
u(this, "key", "");
|
|
5550
5553
|
u(this, "generation", 0);
|
|
@@ -5587,7 +5590,7 @@ class mt {
|
|
|
5587
5590
|
if (this.renderer && this.canvas === e) return this.renderer;
|
|
5588
5591
|
(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();
|
|
5589
5592
|
const t = new an({ canvas: e, alpha: !0, antialias: !0, powerPreference: "low-power" });
|
|
5590
|
-
t.setPixelRatio(1), t.setSize(128, 128, !1), t.outputColorSpace =
|
|
5593
|
+
t.setPixelRatio(1), t.setSize(128, 128, !1), t.outputColorSpace = Ft, t.toneMapping = Vn, t.toneMappingExposure = 1.05;
|
|
5591
5594
|
const i = new ze(), n = new Bn({
|
|
5592
5595
|
color: 16777215,
|
|
5593
5596
|
metalness: 1,
|
|
@@ -5603,11 +5606,11 @@ class mt {
|
|
|
5603
5606
|
}
|
|
5604
5607
|
const Cn = new on(32, 1, 0.1, 10);
|
|
5605
5608
|
Cn.position.set(0, 0, 3.4);
|
|
5606
|
-
function
|
|
5609
|
+
function Pi(r, e) {
|
|
5607
5610
|
const t = document.createElement("button");
|
|
5608
|
-
return t.type = "button", t.className = "vpu-environment-icon", t.innerHTML =
|
|
5611
|
+
return t.type = "button", t.className = "vpu-environment-icon", t.innerHTML = dt(e), t.title = r, t.setAttribute("aria-label", r), t;
|
|
5609
5612
|
}
|
|
5610
|
-
function
|
|
5613
|
+
function vt(r) {
|
|
5611
5614
|
var e;
|
|
5612
5615
|
return r.type === "hdr" ? "HDR" : ((e = r.name.split(".").pop()) == null ? void 0 : e.toUpperCase()) ?? "IMAGE";
|
|
5613
5616
|
}
|
|
@@ -5632,7 +5635,7 @@ function Fa(r) {
|
|
|
5632
5635
|
}
|
|
5633
5636
|
async function za(r) {
|
|
5634
5637
|
let e;
|
|
5635
|
-
return r.type === "hdr" ? e = await new cn().loadAsync(r.url) : (e = await new dn().loadAsync(r.url), e.colorSpace =
|
|
5638
|
+
return r.type === "hdr" ? e = await new cn().loadAsync(r.url) : (e = await new dn().loadAsync(r.url), e.colorSpace = Ft), e.mapping = Me, e;
|
|
5636
5639
|
}
|
|
5637
5640
|
const Oe = 1;
|
|
5638
5641
|
function Kl(r) {
|
|
@@ -6254,9 +6257,9 @@ const Ha = `
|
|
|
6254
6257
|
.vpu-status-spinner { animation: none; }
|
|
6255
6258
|
.vpu-joint-scene-dot,.vpu-joint-scene-pin,.vpu-joint-map-node { transition: none; }
|
|
6256
6259
|
}
|
|
6257
|
-
`,
|
|
6260
|
+
`, st = /* @__PURE__ */ new Set(["revolute", "continuous", "prismatic"]);
|
|
6258
6261
|
function kn(r) {
|
|
6259
|
-
if (!
|
|
6262
|
+
if (!st.has(r.type)) return !1;
|
|
6260
6263
|
const e = r.controlLimits ?? r.limits;
|
|
6261
6264
|
return !e || e.upper > e.lower;
|
|
6262
6265
|
}
|
|
@@ -6265,7 +6268,7 @@ function je(r) {
|
|
|
6265
6268
|
const p = t.get(c);
|
|
6266
6269
|
if (p !== void 0) return p;
|
|
6267
6270
|
const h = e.get(c);
|
|
6268
|
-
if (!h || !
|
|
6271
|
+
if (!h || !st.has(h.type))
|
|
6269
6272
|
return t.set(c, null), null;
|
|
6270
6273
|
if (!h.mimic)
|
|
6271
6274
|
return t.set(c, c), c;
|
|
@@ -6284,7 +6287,7 @@ function je(r) {
|
|
|
6284
6287
|
} else o.push(c);
|
|
6285
6288
|
}
|
|
6286
6289
|
const l = /* @__PURE__ */ new Map();
|
|
6287
|
-
for (const c of r) l.set(c.id,
|
|
6290
|
+
for (const c of r) l.set(c.id, Wa(c));
|
|
6288
6291
|
const d = qa(r, o);
|
|
6289
6292
|
return {
|
|
6290
6293
|
drivers: o,
|
|
@@ -6334,27 +6337,27 @@ function Ya(r, e) {
|
|
|
6334
6337
|
const i = e.split("/").filter(Boolean).pop();
|
|
6335
6338
|
return i ? i.replace(/[-_]+/g, " ") : "Chain";
|
|
6336
6339
|
}
|
|
6337
|
-
function
|
|
6340
|
+
function Wa(r) {
|
|
6338
6341
|
var e;
|
|
6339
6342
|
return (e = r.label) != null && e.trim() ? r.label.trim() : r.name.split("/").filter(Boolean).pop() ?? r.name;
|
|
6340
6343
|
}
|
|
6341
|
-
function
|
|
6344
|
+
function gt(r, e) {
|
|
6342
6345
|
const t = new Map(r.map((o) => [o.id, o])), i = t.get(e);
|
|
6343
|
-
if (!i || !
|
|
6346
|
+
if (!i || !st.has(i.type)) return null;
|
|
6344
6347
|
let n = i, s = 1;
|
|
6345
6348
|
const a = /* @__PURE__ */ new Set();
|
|
6346
6349
|
for (; n.mimic; ) {
|
|
6347
6350
|
if (a.has(n.id)) return null;
|
|
6348
6351
|
a.add(n.id), s *= n.mimic.multiplier;
|
|
6349
6352
|
const o = t.get(n.mimic.joint);
|
|
6350
|
-
if (!o || !
|
|
6353
|
+
if (!o || !st.has(o.type) || !Number.isFinite(n.mimic.offset) || !Number.isFinite(n.mimic.multiplier))
|
|
6351
6354
|
return null;
|
|
6352
6355
|
n = o;
|
|
6353
6356
|
}
|
|
6354
6357
|
return kn(n) && Number.isFinite(s) && Math.abs(s) >= 1e-8 ? { driver: n, via: i, gain: s } : null;
|
|
6355
6358
|
}
|
|
6356
6359
|
const le = (r, e, t) => Math.max(e, Math.min(t, r));
|
|
6357
|
-
class
|
|
6360
|
+
class Ga {
|
|
6358
6361
|
constructor(e, t) {
|
|
6359
6362
|
u(this, "view");
|
|
6360
6363
|
u(this, "handles", []);
|
|
@@ -6501,12 +6504,12 @@ class Xa {
|
|
|
6501
6504
|
var l;
|
|
6502
6505
|
const t = this.dialGesture;
|
|
6503
6506
|
if (!t || t.pointerId !== e.pointerId) return;
|
|
6504
|
-
const i =
|
|
6507
|
+
const i = Ai(t.dial, e);
|
|
6505
6508
|
if (i === null) return;
|
|
6506
6509
|
e.preventDefault(), e.stopPropagation();
|
|
6507
6510
|
const n = Za(i - t.previousAngle);
|
|
6508
6511
|
t.previousAngle = i;
|
|
6509
|
-
const s =
|
|
6512
|
+
const s = Ri(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));
|
|
6510
6513
|
!Number.isFinite(o) || o === t.value || (t.value = o, (l = this.inspection) == null || l.setJointValue(t.joint.id, o));
|
|
6511
6514
|
});
|
|
6512
6515
|
u(this, "endDialGesture", (e) => {
|
|
@@ -6526,7 +6529,7 @@ class Xa {
|
|
|
6526
6529
|
}), this.reset.textContent = "恢复默认姿态", this.reset.addEventListener("click", () => {
|
|
6527
6530
|
var s;
|
|
6528
6531
|
return (s = this.inspection) == null ? void 0 : s.resetPose();
|
|
6529
|
-
}), 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
|
|
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 Ga(this.element, t), this.syncExpanded();
|
|
6530
6533
|
}
|
|
6531
6534
|
bind(e) {
|
|
6532
6535
|
var t;
|
|
@@ -6563,7 +6566,7 @@ class Xa {
|
|
|
6563
6566
|
const a = e.playing && e.controlMode === "kinematic" && e.previewing === !0, o = e.playing && !a;
|
|
6564
6567
|
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;
|
|
6565
6568
|
for (const p of this.plan.drivers) {
|
|
6566
|
-
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 =
|
|
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 = Ri(p, v), w = o;
|
|
6567
6570
|
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);
|
|
6568
6571
|
const x = h.value.getRootNode();
|
|
6569
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, Ja(h, p, b, g), h.feedback.hidden = !y, y) {
|
|
@@ -6636,7 +6639,7 @@ class Xa {
|
|
|
6636
6639
|
const x = document.createElement("div");
|
|
6637
6640
|
x.className = "vpu-joint-inspector-summary", x.append(s, v, g), w.append(l, x);
|
|
6638
6641
|
const C = document.createElement("small");
|
|
6639
|
-
C.className = "vpu-joint-relation", C.textContent = `${
|
|
6642
|
+
C.className = "vpu-joint-relation", C.textContent = `${We(i.parent)} → ${We(i.child)}`, C.title = `${i.parent ?? "世界"} → ${i.child ?? "未绑定"}`;
|
|
6640
6643
|
const k = document.createElement("div");
|
|
6641
6644
|
k.className = "vpu-joint-inputs";
|
|
6642
6645
|
const E = document.createElement("input");
|
|
@@ -6684,7 +6687,7 @@ class Xa {
|
|
|
6684
6687
|
const oe = O.mimic ? t.get(O.mimic.joint) : void 0;
|
|
6685
6688
|
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} 联动控制`;
|
|
6686
6689
|
const ve = document.createElement("small");
|
|
6687
|
-
ve.className = "vpu-joint-relation", ve.textContent = `${
|
|
6690
|
+
ve.className = "vpu-joint-relation", ve.textContent = `${We(O.parent)} → ${We(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);
|
|
6688
6691
|
}
|
|
6689
6692
|
n.append(j);
|
|
6690
6693
|
}
|
|
@@ -6698,7 +6701,7 @@ class Xa {
|
|
|
6698
6701
|
if (!s) return;
|
|
6699
6702
|
const a = s.getSnapshot(), o = a.playing && a.controlMode === "kinematic" && a.previewing === !0;
|
|
6700
6703
|
if (a.playing && !o) return;
|
|
6701
|
-
const l =
|
|
6704
|
+
const l = Ai(t, n);
|
|
6702
6705
|
if (l === null) return;
|
|
6703
6706
|
const d = a.jointValues[e.id] ?? e.defaultValue;
|
|
6704
6707
|
this.dialGesture = { pointerId: n.pointerId, joint: e, dial: t, hit: i, previousAngle: l, value: d }, i.classList.add("is-dragging"), i.style.cursor = "grabbing";
|
|
@@ -6780,7 +6783,7 @@ function Fe(r, e) {
|
|
|
6780
6783
|
const t = r * Math.PI / 180;
|
|
6781
6784
|
return [52 + Math.sin(t) * e, 52 - Math.cos(t) * e];
|
|
6782
6785
|
}
|
|
6783
|
-
function
|
|
6786
|
+
function Mi(r, e, t) {
|
|
6784
6787
|
if (Math.abs(t - e) >= 359.5)
|
|
6785
6788
|
return `M 52 ${52 - r} A ${r} ${r} 0 1 1 52 ${52 + r} A ${r} ${r} 0 1 1 52 ${52 - r}`;
|
|
6786
6789
|
const [i, n] = Fe(e, r), [s, a] = Fe(t, r);
|
|
@@ -6788,13 +6791,13 @@ function Si(r, e, t) {
|
|
|
6788
6791
|
}
|
|
6789
6792
|
function Ja(r, e, t, i) {
|
|
6790
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] = Fe(o, 35), [c, p] = Fe(o, 49), h = Math.abs(a - o);
|
|
6791
|
-
r.dialRange.setAttribute("d",
|
|
6792
|
-
const m =
|
|
6794
|
+
r.dialRange.setAttribute("d", Mi(43, s(i.lower), s(i.upper)));
|
|
6795
|
+
const m = Mi(39, o, a);
|
|
6793
6796
|
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");
|
|
6794
6797
|
const [f, b] = Fe(a, 40);
|
|
6795
6798
|
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));
|
|
6796
6799
|
}
|
|
6797
|
-
function
|
|
6800
|
+
function Ai(r, e) {
|
|
6798
6801
|
const t = r.getBoundingClientRect();
|
|
6799
6802
|
if (!(t.width > 0) || !(t.height > 0)) return null;
|
|
6800
6803
|
const i = (e.clientX - t.left) / t.width * 104, n = (e.clientY - t.top) / t.height * 104, s = i - 52, a = 52 - n;
|
|
@@ -6803,23 +6806,23 @@ function Pi(r, e) {
|
|
|
6803
6806
|
function Za(r) {
|
|
6804
6807
|
return (r + 540) % 360 - 180;
|
|
6805
6808
|
}
|
|
6806
|
-
function
|
|
6809
|
+
function We(r) {
|
|
6807
6810
|
return (r == null ? void 0 : r.split("/").filter(Boolean).pop()) ?? (r === null ? "世界" : "未绑定");
|
|
6808
6811
|
}
|
|
6809
6812
|
function _(r) {
|
|
6810
6813
|
return Number(r.toFixed(4)).toString();
|
|
6811
6814
|
}
|
|
6812
|
-
function
|
|
6815
|
+
function Ri(r, e) {
|
|
6813
6816
|
const t = r.controlLimits ?? r.limits;
|
|
6814
6817
|
if (t && Number.isFinite(t.lower) && Number.isFinite(t.upper) && t.lower <= t.upper) return t;
|
|
6815
6818
|
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);
|
|
6816
6819
|
return { lower: n, upper: Math.max(n, s) };
|
|
6817
6820
|
}
|
|
6818
|
-
const
|
|
6821
|
+
const Ii = "http://www.w3.org/2000/svg", ie = "var(--vpu-joint-highlight)", Li = { dark: "#21c7be", light: "#21c7be" }, Qa = 140, De = (r) => Number.isFinite(r.x) && Number.isFinite(r.y) && Number.isFinite(r.z), Di = (r, e) => Number(r.toFixed(e)).toString(), bt = (r, e) => r.unit === "rad" ? `${Di(e * 180 / Math.PI, 1)}°` : `${Di(e, 4)} m`;
|
|
6819
6822
|
function Te(r) {
|
|
6820
6823
|
return !r.playing || r.controlMode === "kinematic" && r.previewing === !0;
|
|
6821
6824
|
}
|
|
6822
|
-
function
|
|
6825
|
+
function Rt(r) {
|
|
6823
6826
|
const e = /* @__PURE__ */ new Set(), t = new Set(r);
|
|
6824
6827
|
for (const i of t) {
|
|
6825
6828
|
let n = !0;
|
|
@@ -6834,8 +6837,8 @@ function Mt(r) {
|
|
|
6834
6837
|
}
|
|
6835
6838
|
return e;
|
|
6836
6839
|
}
|
|
6837
|
-
function
|
|
6838
|
-
return Sn(
|
|
6840
|
+
function Ti(r) {
|
|
6841
|
+
return Sn(Rt(r));
|
|
6839
6842
|
}
|
|
6840
6843
|
function Sn(r) {
|
|
6841
6844
|
const e = new Z();
|
|
@@ -6890,7 +6893,7 @@ class io {
|
|
|
6890
6893
|
u(this, "joints", []);
|
|
6891
6894
|
u(this, "plan", je([]));
|
|
6892
6895
|
u(this, "occluded", /* @__PURE__ */ new Set());
|
|
6893
|
-
u(this, "occlusionRay", new
|
|
6896
|
+
u(this, "occlusionRay", new lt());
|
|
6894
6897
|
u(this, "rayScreen", new J());
|
|
6895
6898
|
u(this, "rayPoint", new M());
|
|
6896
6899
|
u(this, "lastOcclusion", -1 / 0);
|
|
@@ -6907,15 +6910,15 @@ class io {
|
|
|
6907
6910
|
u(this, "offsetX", 0);
|
|
6908
6911
|
u(this, "offsetY", 0);
|
|
6909
6912
|
var o;
|
|
6910
|
-
this.inspection = e, this.options = t, this.highlightColor = new
|
|
6913
|
+
this.inspection = e, this.options = t, this.highlightColor = new tt(((o = t.getHighlightColor) == null ? void 0 : o.call(t)) || Li[t.theme ?? "dark"]);
|
|
6911
6914
|
const i = t.canvas.ownerDocument;
|
|
6912
6915
|
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", "三维关节控制,拖动关节点或连接部件调整姿态");
|
|
6913
6916
|
const n = (l, d, c) => {
|
|
6914
|
-
const p = i.createElementNS(
|
|
6917
|
+
const p = i.createElementNS(Ii, l);
|
|
6915
6918
|
for (const [h, m] of Object.entries(d)) p.setAttribute(h, m);
|
|
6916
6919
|
return c.append(p), p;
|
|
6917
6920
|
};
|
|
6918
|
-
this.svg = i.createElementNS(
|
|
6921
|
+
this.svg = i.createElementNS(Ii, "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);
|
|
6919
6922
|
const s = { fill: "none", "stroke-linecap": "round", "stroke-linejoin": "round" };
|
|
6920
6923
|
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);
|
|
6921
6924
|
const a = (l) => {
|
|
@@ -6936,7 +6939,7 @@ class io {
|
|
|
6936
6939
|
themeChanged(e) {
|
|
6937
6940
|
var t, i;
|
|
6938
6941
|
if (!this.disposed) {
|
|
6939
|
-
this.highlightColor.set(((i = (t = this.options).getHighlightColor) == null ? void 0 : i.call(t)) ||
|
|
6942
|
+
this.highlightColor.set(((i = (t = this.options).getHighlightColor) == null ? void 0 : i.call(t)) || Li[e]), this.element.style.setProperty("--vpu-joint-highlight", this.highlightColor.getStyle());
|
|
6940
6943
|
for (const n of this.highlights.values()) n.strength = -1;
|
|
6941
6944
|
this.update(), this.options.requestRender();
|
|
6942
6945
|
}
|
|
@@ -6974,9 +6977,9 @@ class io {
|
|
|
6974
6977
|
const g = this.pins.get(v.id) ?? this.makePin(v), w = (y = h.get(v.id)) == null ? void 0 : y.point, x = !!w;
|
|
6975
6978
|
g.button.hidden = !x, g.button.style.display = x ? "grid" : "none", g.button.disabled = !t;
|
|
6976
6979
|
const C = this.jointValue(e, v);
|
|
6977
|
-
g.button.setAttribute("aria-label", `${v.name} · ${
|
|
6980
|
+
g.button.setAttribute("aria-label", `${v.name} · ${bt(v, C)},拖动调整关节`), g.button.setAttribute("aria-pressed", String(d === v.id)), g.button.dataset.selected = String(d === v.id);
|
|
6978
6981
|
const k = v.id === d || v.id === c || v.id === p, E = this.occluded.has(v.id), P = E && !k;
|
|
6979
|
-
if (g.button.dataset.occluded = String(E), g.label.textContent = `${v.name} · ${
|
|
6982
|
+
if (g.button.dataset.occluded = String(E), g.label.textContent = `${v.name} · ${bt(v, C)}`, g.label.hidden = !k, g.button.style.opacity = P ? "0.4" : "1", g.button.style.zIndex = k ? "3" : P ? "1" : "2", g.button.style.cursor = p === v.id ? "grabbing" : "grab", g.dot.style.background = k ? ie : "rgba(12,12,12,.82)", g.dot.style.transform = k ? "scale(1.25)" : "none", g.dot.style.boxShadow = d === v.id ? `0 0 0 4px color-mix(in srgb, ${ie} 25%, transparent),0 0 0 1px #333` : "0 0 0 1px #333", w) {
|
|
6980
6983
|
g.button.style.transform = `translate(${w.x.toFixed(1)}px, ${w.y.toFixed(1)}px)`;
|
|
6981
6984
|
const I = w.x - this.offsetX > this.width - 180;
|
|
6982
6985
|
g.label.style.left = I ? "auto" : "24px", g.label.style.right = I ? "24px" : "auto";
|
|
@@ -7092,9 +7095,9 @@ class io {
|
|
|
7092
7095
|
this.clearOcclusionTimer(), this.lastOcclusion = i, this.occluded.clear();
|
|
7093
7096
|
const s = this.inspection.pickRoots();
|
|
7094
7097
|
for (const p of s) p.updateWorldMatrix(!0, !0);
|
|
7095
|
-
const a = [...
|
|
7098
|
+
const a = [...Rt(s)];
|
|
7096
7099
|
if (!a.length) return;
|
|
7097
|
-
const o = Sn(a), l = o.isEmpty() ? 0 : o.getBoundingSphere(new
|
|
7100
|
+
const o = Sn(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;
|
|
7098
7101
|
c.layers.mask = t.layers.mask;
|
|
7099
7102
|
for (const [p, { world: h }] of e) {
|
|
7100
7103
|
this.rayPoint.copy(h).project(t), this.rayScreen.set(this.rayPoint.x, this.rayPoint.y), c.setFromCamera(this.rayScreen, t);
|
|
@@ -7122,7 +7125,7 @@ class io {
|
|
|
7122
7125
|
}
|
|
7123
7126
|
}
|
|
7124
7127
|
for (const { strength: o, roots: l } of a.values())
|
|
7125
|
-
for (const d of
|
|
7128
|
+
for (const d of Rt([...l]))
|
|
7126
7129
|
(Array.isArray(d.material) ? d.material : [d.material]).some((p) => p.visible) && s.set(d, Math.max(s.get(d) ?? 0, o));
|
|
7127
7130
|
}
|
|
7128
7131
|
for (const [a, o] of this.highlights)
|
|
@@ -7147,8 +7150,8 @@ class io {
|
|
|
7147
7150
|
var y, v, g, w, x, C;
|
|
7148
7151
|
const s = this.bases.get(e.id);
|
|
7149
7152
|
if (s) return s;
|
|
7150
|
-
const a = e.child ? (v = (y = this.inspection).objectForBody) == null ? void 0 : v.call(y, e.child) : null, o =
|
|
7151
|
-
let d = l.isEmpty() ? 0 : l.getBoundingSphere(new
|
|
7153
|
+
const a = e.child ? (v = (y = this.inspection).objectForBody) == null ? void 0 : v.call(y, e.child) : null, o = Ti(a ? [a] : []), l = Ti(((w = (g = this.inspection).pickRoots) == null ? void 0 : w.call(g)) ?? []);
|
|
7154
|
+
let d = l.isEmpty() ? 0 : l.getBoundingSphere(new Ht()).radius;
|
|
7152
7155
|
(!(d > 0) || !Number.isFinite(d)) && (d = 0.1);
|
|
7153
7156
|
const p = (o.isEmpty() ? t.clone() : o.getCenter(new M())).sub(t);
|
|
7154
7157
|
p.addScaledVector(i, -p.dot(i));
|
|
@@ -7179,7 +7182,7 @@ class io {
|
|
|
7179
7182
|
if (!b || !y || !v) return;
|
|
7180
7183
|
this.dial.setAttribute("display", "inline"), this.dial.dataset.jointId = t.id, this.range.setAttribute("d", y), this.progress.setAttribute("d", v);
|
|
7181
7184
|
const g = t.unit === "rad" && m - h >= 2 * Math.PI - 0.01;
|
|
7182
|
-
if (this.range.setAttribute("stroke-dasharray", g ? "3 4" : "none"), this.knob.setAttribute("cx", b.x.toFixed(1)), this.knob.setAttribute("cy", b.y.toFixed(1)), this.dialHit.setAttribute("cx", b.x.toFixed(1)), this.dialHit.setAttribute("cy", b.y.toFixed(1)), this.value.textContent =
|
|
7185
|
+
if (this.range.setAttribute("stroke-dasharray", g ? "3 4" : "none"), this.knob.setAttribute("cx", b.x.toFixed(1)), this.knob.setAttribute("cy", b.y.toFixed(1)), this.dialHit.setAttribute("cx", b.x.toFixed(1)), this.dialHit.setAttribute("cy", b.y.toFixed(1)), this.value.textContent = bt(t, a), t.unit === "rad") {
|
|
7183
7186
|
this.wedge.setAttribute("d", `M ${s.x.toFixed(1)} ${s.y.toFixed(1)} ${v.replace(/^M/, "L")} Z`), this.needle.setAttribute("display", "inline"), this.line(this.needle, s, b), this.dialLineHit.setAttribute("display", "inline"), this.line(this.dialLineHit, s, b), this.line(this.home, c(t.defaultValue, 0.25), c(t.defaultValue, 1.22)), this.line(this.lower, c(h, 0.82), c(h, 1.18)), this.line(this.upper, c(m, 0.82), c(m, 1.18)), this.lower.setAttribute("display", g ? "none" : "inline"), this.upper.setAttribute("display", g ? "none" : "inline");
|
|
7184
7187
|
const C = c(a, 1.55) ?? b;
|
|
7185
7188
|
this.value.setAttribute("x", C.x.toFixed(1)), this.value.setAttribute("y", C.y.toFixed(1));
|
|
@@ -7197,18 +7200,18 @@ class io {
|
|
|
7197
7200
|
e.removeAttribute("visibility"), e.setAttribute("x1", t.x.toFixed(1)), e.setAttribute("y1", t.y.toFixed(1)), e.setAttribute("x2", i.x.toFixed(1)), e.setAttribute("y2", i.y.toFixed(1));
|
|
7198
7201
|
}
|
|
7199
7202
|
}
|
|
7200
|
-
function
|
|
7203
|
+
function yt(r, e, t) {
|
|
7201
7204
|
const i = r.clone().project(e);
|
|
7202
7205
|
return new J(t.left + (i.x + 1) * t.width / 2, t.top + (1 - i.y) * t.height / 2);
|
|
7203
7206
|
}
|
|
7204
7207
|
function no(r, e, t, i, n, s, a) {
|
|
7205
7208
|
if (e.width <= 0 || e.height <= 0 || t.axis.lengthSq() < 1e-12) return 0;
|
|
7206
7209
|
r.updateMatrixWorld(!0);
|
|
7207
|
-
const o = t.axis.clone().normalize(), l = a ? o : o.clone().cross(i.clone().sub(t.position)), d =
|
|
7210
|
+
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();
|
|
7208
7211
|
let m = 0;
|
|
7209
7212
|
if (h > (a ? 1 : 900)) m = p.dot(c) / h;
|
|
7210
7213
|
else if (!a) {
|
|
7211
|
-
const f =
|
|
7214
|
+
const f = yt(t.position, r, e), b = n.clone().sub(f), y = s.clone().sub(f);
|
|
7212
7215
|
if (b.lengthSq() < 16 || y.lengthSq() < 16) return 0;
|
|
7213
7216
|
m = Math.atan2(y.y, y.x) - Math.atan2(b.y, b.x), m = Math.atan2(Math.sin(m), Math.cos(m)), o.dot(r.getWorldPosition(new M()).sub(t.position)) > 0 && (m = -m);
|
|
7214
7217
|
}
|
|
@@ -7218,7 +7221,7 @@ class ro {
|
|
|
7218
7221
|
constructor(e, t) {
|
|
7219
7222
|
u(this, "element");
|
|
7220
7223
|
u(this, "overlay");
|
|
7221
|
-
u(this, "raycaster", new
|
|
7224
|
+
u(this, "raycaster", new lt());
|
|
7222
7225
|
u(this, "gesture", null);
|
|
7223
7226
|
u(this, "background", null);
|
|
7224
7227
|
u(this, "unsubscribe");
|
|
@@ -7336,7 +7339,7 @@ class ro {
|
|
|
7336
7339
|
let o = a.object;
|
|
7337
7340
|
for (; o && typeof o.userData.bodyId != "number"; ) o = o.parent;
|
|
7338
7341
|
if (!o) return null;
|
|
7339
|
-
const l = this.inspection.getSnapshot().joints, d = l.find((v) => v.id === this.inspection.getSnapshot().selectedJointId && v.child === o.name), c = (d == null ? void 0 : d.id) ?? ((b = (f = this.inspection).jointForBody) == null ? void 0 : b.call(f, o.name)) ?? ((y = l.find((v) => v.child === o.name)) == null ? void 0 : y.id), p = c ?
|
|
7342
|
+
const l = this.inspection.getSnapshot().joints, d = l.find((v) => v.id === this.inspection.getSnapshot().selectedJointId && v.child === o.name), c = (d == null ? void 0 : d.id) ?? ((b = (f = this.inspection).jointForBody) == null ? void 0 : b.call(f, o.name)) ?? ((y = l.find((v) => v.child === o.name)) == null ? void 0 : y.id), p = c ? gt(l, c) : null;
|
|
7340
7343
|
return p ? { motion: p, point: a.point, body: o } : null;
|
|
7341
7344
|
}
|
|
7342
7345
|
start(e, t, i, n) {
|
|
@@ -7363,7 +7366,7 @@ class ro {
|
|
|
7363
7366
|
}
|
|
7364
7367
|
startPin(e, t) {
|
|
7365
7368
|
var l, d, c, p;
|
|
7366
|
-
const i =
|
|
7369
|
+
const i = gt(this.inspection.getSnapshot().joints, e);
|
|
7367
7370
|
if (!i || !this.editable()) return;
|
|
7368
7371
|
const n = i.via.child ? ((d = (l = this.inspection).objectForBody) == null ? void 0 : d.call(l, i.via.child)) ?? null : null, s = (p = (c = this.inspection).jointWorldFrame) == null ? void 0 : p.call(c, i.via.id);
|
|
7369
7372
|
if (!s) return;
|
|
@@ -7372,7 +7375,7 @@ class ro {
|
|
|
7372
7375
|
}
|
|
7373
7376
|
startDial(e, t) {
|
|
7374
7377
|
var s, a;
|
|
7375
|
-
const i =
|
|
7378
|
+
const i = gt(this.inspection.getSnapshot().joints, e);
|
|
7376
7379
|
if (!i || !this.editable()) return;
|
|
7377
7380
|
const n = (a = (s = this.inspection).jointWorldFrame) == null ? void 0 : a.call(s, i.via.id);
|
|
7378
7381
|
n && this.start(i, n.position.clone(), null, t);
|
|
@@ -7554,7 +7557,7 @@ const lo = {
|
|
|
7554
7557
|
sun: '<circle cx="12" cy="12" r="3.5"/><path d="M12 2v2m0 16v2M4.9 4.9l1.4 1.4m11.4 11.4 1.4 1.4M2 12h2m16 0h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/>',
|
|
7555
7558
|
moon: '<path d="M20 15.2A8 8 0 0 1 8.8 4 8.5 8.5 0 1 0 20 15.2Z"/>'
|
|
7556
7559
|
};
|
|
7557
|
-
function
|
|
7560
|
+
function W(r) {
|
|
7558
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">${lo[r]}</svg>`;
|
|
7559
7562
|
}
|
|
7560
7563
|
function $(r) {
|
|
@@ -7619,7 +7622,7 @@ function uo(r, e, t, i, n, s) {
|
|
|
7619
7622
|
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);
|
|
7620
7623
|
let c = a.clone();
|
|
7621
7624
|
if (!s) {
|
|
7622
|
-
const m = new
|
|
7625
|
+
const m = new lt();
|
|
7623
7626
|
m.setFromCamera(new J((i - t.left) / t.width * 2 - 1, 1 - (n - t.top) / t.height * 2), r);
|
|
7624
7627
|
const f = m.ray.intersectPlane(new ln().setFromNormalAndCoplanarPoint(o, e.position), new M()), b = f ? f.sub(e.position) : new M();
|
|
7625
7628
|
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())));
|
|
@@ -7635,7 +7638,7 @@ function Re(r, e, t) {
|
|
|
7635
7638
|
function ho(r, e) {
|
|
7636
7639
|
return r.jointType !== "prismatic" && e === "deg" ? 180 / Math.PI : 1;
|
|
7637
7640
|
}
|
|
7638
|
-
function
|
|
7641
|
+
function at(r, e) {
|
|
7639
7642
|
const t = /* @__PURE__ */ new Set();
|
|
7640
7643
|
for (; r.mimic && !t.has(r.name); ) {
|
|
7641
7644
|
t.add(r.name);
|
|
@@ -7645,7 +7648,7 @@ function st(r, e) {
|
|
|
7645
7648
|
}
|
|
7646
7649
|
return r;
|
|
7647
7650
|
}
|
|
7648
|
-
function
|
|
7651
|
+
function It(r, e, t, i = !1) {
|
|
7649
7652
|
const { lower: n, upper: s } = Ve(r, Math.PI), a = e.jointValues[r.name] ?? 0, o = ho(r, t);
|
|
7650
7653
|
return `<div class="vurdf-slider-card ${e.selectedEntityId === r.id ? "is-selected" : ""}" data-joint-card="${R(r.id)}" tabindex="0" role="group" aria-label="${R(r.name)},点击选中关节">
|
|
7651
7654
|
<div class="vurdf-slider-heading"><button class="vurdf-text-btn" data-entity="${R(r.id)}">${R(r.name)}</button><output data-joint-readout="${R(r.name)}">${Re(r, a, t)}</output></div>
|
|
@@ -7654,11 +7657,11 @@ function At(r, e, t, i = !1) {
|
|
|
7654
7657
|
${r.mimic ? `<small>跟随 ${R(r.mimic.joint)} × ${r.mimic.multiplier} + ${Re(r, r.mimic.offset, t)}</small>` : ""}
|
|
7655
7658
|
</div>`;
|
|
7656
7659
|
}
|
|
7657
|
-
function
|
|
7660
|
+
function Ni(r, e, t) {
|
|
7658
7661
|
const i = e.nodes.filter((o) => o.kind === "joint"), n = r.kind === "joint" ? r : i.find((o) => o.childLink === r.name);
|
|
7659
7662
|
if (!n) return "";
|
|
7660
|
-
const s =
|
|
7661
|
-
return a.length ? `<section class="vurdf-section"><div class="vurdf-section-head"><strong>联动约束 · ${a.length + 1} 个关节</strong></div>${
|
|
7663
|
+
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) => R(o.name)).join(" · ")}</p></section>` : "";
|
|
7662
7665
|
}
|
|
7663
7666
|
function po(r, e, t) {
|
|
7664
7667
|
const i = r.nodes.filter((c) => c.kind === "joint"), n = /* @__PURE__ */ new Map();
|
|
@@ -7682,12 +7685,12 @@ function po(r, e, t) {
|
|
|
7682
7685
|
for (const c of i) a.has(c.name) || l(c);
|
|
7683
7686
|
const d = e.trim().toLowerCase();
|
|
7684
7687
|
return o.filter((c) => c.some((p) => `${p.name} ${p.parentLink} ${p.childLink}`.toLowerCase().includes(d))).map((c) => {
|
|
7685
|
-
const p = [...new Set(c.map((h) =>
|
|
7686
|
-
return `<section class="vurdf-joint-group"><h3>${R(c[0].parentLink)} → ${R(c[c.length - 1].childLink)}</h3>${p.filter((h) => !c.includes(h)).map((h) =>
|
|
7688
|
+
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>${R(c[0].parentLink)} → ${R(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>`;
|
|
7687
7690
|
}).join("") || '<div class="vurdf-empty">没有符合筛选条件的可动关节。</div>';
|
|
7688
7691
|
}
|
|
7689
7692
|
function mo(r) {
|
|
7690
|
-
return `<button class="vurdf-tool" data-angle-unit aria-label="切换弧度和角度" title="切换所有关节的显示单位" aria-pressed="${r === "deg"}">${
|
|
7693
|
+
return `<button class="vurdf-tool" data-angle-unit aria-label="切换弧度和角度" title="切换所有关节的显示单位" aria-pressed="${r === "deg"}">${W("angleUnit")}<span>${r === "rad" ? "rad" : "°"}</span></button>`;
|
|
7691
7694
|
}
|
|
7692
7695
|
class fo {
|
|
7693
7696
|
constructor(e, t, i) {
|
|
@@ -7717,9 +7720,9 @@ class fo {
|
|
|
7717
7720
|
this.pendingSnapshot = null;
|
|
7718
7721
|
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;
|
|
7719
7722
|
this.root.innerHTML = `
|
|
7720
|
-
<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="打开结构图">${
|
|
7721
|
-
<label class="vurdf-search">${
|
|
7722
|
-
<div class="vurdf-filters">${
|
|
7723
|
+
<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="${R(this.query)}"></label>
|
|
7725
|
+
<div class="vurdf-filters">${xt("all", "全部", this.filter)}${xt("movable", "可动关节", this.filter)}${xt("errors", `错误 ${e.issues.length}`, this.filter)}</div>
|
|
7723
7726
|
<div class="vurdf-tree" role="${this.filter === "movable" ? "region" : "tree"}">${this.filter === "movable" ? po(e, this.query, this.angleUnit) : vo(e, t, this.filter, this.query, this.collapsed, this.angleUnit)}</div>
|
|
7724
7727
|
`, this.bind(e), this.setDiagramOpen(this.diagramOpen);
|
|
7725
7728
|
const o = this.root.querySelector(".vurdf-tree");
|
|
@@ -7817,9 +7820,9 @@ function vo(r, e, t, i, n, s) {
|
|
|
7817
7820
|
const b = new Set(m).add(p), y = f.childIds.map((E) => c(E, h + 1, b));
|
|
7818
7821
|
if (!(d(f) || y.some((E) => E.matched))) return { html: "", matched: !1 };
|
|
7819
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 ? `${Re(f, r.jointValues[f.name] ?? 0, s)}` : "", k = `<div class="vurdf-tree-item" style="--depth:${h}" role="treeitem" aria-expanded="${g ? String(!w) : "false"}">
|
|
7820
|
-
<button class="vurdf-tree-toggle ${g ? "" : "is-placeholder"} ${w ? "" : "is-open"}" data-tree-toggle="${R(f.id)}" ${g ? "" : "disabled"} aria-label="${w ? "展开" : "折叠"} ${R(f.name)}">${
|
|
7823
|
+
<button class="vurdf-tree-toggle ${g ? "" : "is-placeholder"} ${w ? "" : "is-open"}" data-tree-toggle="${R(f.id)}" ${g ? "" : "disabled"} aria-label="${w ? "展开" : "折叠"} ${R(f.name)}">${W("chevron")}</button>
|
|
7821
7824
|
<button class="vurdf-row ${r.selectedEntityId === f.id ? "is-selected" : ""} ${e.has(f.id) ? "has-error" : ""}" data-entity="${R(f.id)}">
|
|
7822
|
-
${
|
|
7825
|
+
${W(f.kind === "robot" ? "robot" : f.kind === "joint" ? "joint" : "link")}
|
|
7823
7826
|
<span class="vurdf-node-copy"><b title="${R(f.name)}">${R(f.name)}</b><small>${R(x)}</small></span>
|
|
7824
7827
|
${e.has(f.id) ? '<span class="vurdf-node-error">!</span>' : `<span class="vurdf-node-value" ${f.kind === "joint" ? `data-joint-readout="${R(f.name)}"` : ""}>${C}</span>`}
|
|
7825
7828
|
</button>
|
|
@@ -7828,7 +7831,7 @@ function vo(r, e, t, i, n, s) {
|
|
|
7828
7831
|
};
|
|
7829
7832
|
return c(r.rootEntityId, 0).html || '<div class="vurdf-empty">没有符合筛选条件的节点。</div>';
|
|
7830
7833
|
}
|
|
7831
|
-
function
|
|
7834
|
+
function xt(r, e, t) {
|
|
7832
7835
|
return `<button class="vurdf-chip ${r === t ? "is-active" : ""}" data-filter="${r}">${e}</button>`;
|
|
7833
7836
|
}
|
|
7834
7837
|
const go = 1800;
|
|
@@ -7869,7 +7872,7 @@ class bo {
|
|
|
7869
7872
|
const o = a.dataset.inertiaDetails;
|
|
7870
7873
|
a.open ? this.expandedInertia.add(o) : this.expandedInertia.delete(o);
|
|
7871
7874
|
}), this.root.innerHTML = `
|
|
7872
|
-
<nav class="vurdf-tabs">${
|
|
7875
|
+
<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>
|
|
7873
7876
|
<section class="vurdf-pane ${this.tab === "properties" ? "is-active" : ""}" data-pane="properties">${t ? yo(t, e, ((i = this.sweep) == null ? void 0 : i.jointName) === t.name, this.angleUnit, this.expandedInertia) : Co()}</section>
|
|
7874
7877
|
<section class="vurdf-pane ${this.tab === "source" ? "is-active" : ""}" data-pane="source">${this.tab === "source" ? xo(e, t) : ""}</section>
|
|
7875
7878
|
<section class="vurdf-pane ${this.tab === "issues" ? "is-active" : ""}" data-pane="issues">${wo(e)}</section>
|
|
@@ -7913,7 +7916,7 @@ class bo {
|
|
|
7913
7916
|
if ((l = this.root.querySelector("[data-angle-unit]")) == null || l.addEventListener("click", () => {
|
|
7914
7917
|
this.angleUnit = this.angleUnit === "rad" ? "deg" : "rad", this.render(this.inspection.getSnapshot());
|
|
7915
7918
|
}), !(t != null && t.movable) || t.mimic || !$(e)) return;
|
|
7916
|
-
const i =
|
|
7919
|
+
const i = Dt(t, this.angleUnit), n = (h) => {
|
|
7917
7920
|
!$(this.inspection.getSnapshot()) || !Number.isFinite(h) || (this.stopSweep(!1), this.inspection.setJointValue(t.name, h));
|
|
7918
7921
|
}, s = this.root.querySelector("[data-joint-range]"), a = () => {
|
|
7919
7922
|
if (this.draggingJoint !== t.name) return;
|
|
@@ -7975,7 +7978,7 @@ class bo {
|
|
|
7975
7978
|
}
|
|
7976
7979
|
syncJointInputs(e) {
|
|
7977
7980
|
const t = this.root.querySelector("[data-joint-range]"), i = this.root.querySelector("[data-joint-number]"), n = this.inspection.getSnapshot(), s = n.nodes.find((a) => a.id === n.selectedEntityId);
|
|
7978
|
-
(s == null ? void 0 : s.kind) === "joint" && (e *=
|
|
7981
|
+
(s == null ? void 0 : s.kind) === "joint" && (e *= Dt(s, this.angleUnit)), t && Number(t.value) !== e && (t.value = String(e)), i && (i.value = e.toFixed(3));
|
|
7979
7982
|
}
|
|
7980
7983
|
startSweep(e, t) {
|
|
7981
7984
|
this.stopSweep(!1), this.sweep = { jointName: e.name, initial: t, startedAt: Date.now(), timer: null };
|
|
@@ -8000,37 +8003,37 @@ class bo {
|
|
|
8000
8003
|
function yo(r, e, t, i, n) {
|
|
8001
8004
|
var s, a;
|
|
8002
8005
|
if (r.kind === "joint") {
|
|
8003
|
-
const o = e.nodes.find((b) => b.kind === "link" && b.id === `link:${r.childLink}`), l = e.jointValues[r.name] ?? 0, { lower: d, upper: c } = Ve(r, Math.PI), p =
|
|
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 } = Ve(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="${R(r.name)}">${Re(r, l, i)}</output><div class="vurdf-follower-source"><span>主控关节</span><button class="vurdf-text-btn" data-entity="joint:${R(r.mimic.joint)}">${R(r.mimic.joint)}</button></div></section>` : r.movable ? `<fieldset class="vurdf-section vurdf-joint-controls" ${$(e) ? "" : "disabled"}>
|
|
8004
8007
|
<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>
|
|
8005
8008
|
<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>
|
|
8006
8009
|
<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>
|
|
8007
8010
|
${$(e) ? "" : '<p class="vurdf-control-hint">仿真运行期间只读,暂停后可选中部件并调整关节。</p>'}
|
|
8008
8011
|
</fieldset>` : '<div class="vurdf-section"><div class="vurdf-empty">固定关节不可调节。</div></div>';
|
|
8009
|
-
return `<div class="vurdf-entity"><label>${R(r.jointType.toUpperCase())} JOINT</label><h2>${R(r.name)}</h2><p>${R(r.parentLink)} → ${R(r.childLink)}</p></div>${f}${
|
|
8012
|
+
return `<div class="vurdf-entity"><label>${R(r.jointType.toUpperCase())} JOINT</label><h2>${R(r.name)}</h2><p>${R(r.parentLink)} → ${R(r.childLink)}</p></div>${f}${Ni(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 ? ji(o, !0, n.has(o.id)) : ""}`;
|
|
8010
8013
|
}
|
|
8011
|
-
return r.kind === "link" ? `<div class="vurdf-entity"><label>LINK</label><h2>${R(r.name)}</h2><p>${r.visualCount} Visual · ${r.collisionCount} Collision</p></div>${
|
|
8014
|
+
return r.kind === "link" ? `<div class="vurdf-entity"><label>LINK</label><h2>${R(r.name)}</h2><p>${r.visualCount} Visual · ${r.collisionCount} Collision</p></div>${Ni(r, e, i)}${ji(r, !1, n.has(r.id))}` : `<div class="vurdf-entity"><label>ROBOT</label><h2>${R(r.name)}</h2><p>${r.rootLinkIds.length} root link</p></div>`;
|
|
8012
8015
|
}
|
|
8013
|
-
function
|
|
8016
|
+
function Lt(r) {
|
|
8014
8017
|
if (r === void 0) return "<span>—</span>";
|
|
8015
8018
|
const e = String(r), t = Number.isFinite(r) ? String(Number(r.toPrecision(6))) : e;
|
|
8016
8019
|
return `<button type="button" class="vurdf-source-number" data-copy-number="${e}" title="${e} · 点击复制完整数值" aria-label="复制完整数值 ${e}">${t}</button>`;
|
|
8017
8020
|
}
|
|
8018
|
-
function
|
|
8019
|
-
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>${
|
|
8021
|
+
function Oi(r, e, t, i) {
|
|
8022
|
+
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>`;
|
|
8020
8023
|
}
|
|
8021
|
-
function
|
|
8024
|
+
function ji(r, e, t) {
|
|
8022
8025
|
return `<section class="vurdf-section" data-link-inertial>
|
|
8023
8026
|
<div class="vurdf-section-head vurdf-component-title"><strong>${e ? "子部件" : "部件属性"} · ${R(r.name)}</strong></div>
|
|
8024
|
-
<dl class="vurdf-data"><dt>质量 (kg)</dt><dd>${
|
|
8027
|
+
<dl class="vurdf-data"><dt>质量 (kg)</dt><dd>${Lt(r.mass)}</dd></dl>
|
|
8025
8028
|
<div class="vurdf-inertial-frame">惯性原点 · 相对于 Link</div>
|
|
8026
|
-
${
|
|
8027
|
-
${
|
|
8029
|
+
${Oi("质心位置", ["X", "Y", "Z"], r.centerOfMass, "m")}
|
|
8030
|
+
${Oi("惯性坐标系旋转", ["R", "P", "Y"], r.inertialRotationRpy, "rad")}
|
|
8028
8031
|
<details class="vurdf-inertia-details" data-inertia-details="${R(r.id)}" ${t ? "open" : ""}>
|
|
8029
|
-
<summary>${
|
|
8032
|
+
<summary>${W("chevron")}<strong>惯性张量</strong><span>kg·m²</span></summary>
|
|
8030
8033
|
<div class="vurdf-inertial-frame">关于质心 · 惯性坐标系</div>
|
|
8031
8034
|
<dl class="vurdf-data">${["Ixx", "Iyy", "Izz", "Ixy", "Ixz", "Iyz"].map((i, n) => {
|
|
8032
8035
|
var s;
|
|
8033
|
-
return `<dt>${i}</dt><dd>${
|
|
8036
|
+
return `<dt>${i}</dt><dd>${Lt((s = r.inertiaTensor) == null ? void 0 : s[n])}</dd>`;
|
|
8034
8037
|
}).join("")}</dl>
|
|
8035
8038
|
</details>
|
|
8036
8039
|
</section>`;
|
|
@@ -8041,21 +8044,21 @@ function xo(r, e) {
|
|
|
8041
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>${Eo(o)}</span>`).join("")}</code></pre>`;
|
|
8042
8045
|
}
|
|
8043
8046
|
function wo(r) {
|
|
8044
|
-
return r.issues.length ? r.issues.map((e) => `<button class="vurdf-issue" data-issue-entity="${R(e.entityId)}">${
|
|
8047
|
+
return r.issues.length ? r.issues.map((e) => `<button class="vurdf-issue" data-issue-entity="${R(e.entityId)}">${W("error")}<span><b>${R(e.title)}</b><small>${R(e.message)}</small></span></button>`).join("") : '<div class="vurdf-empty">所有严格结构与数学检查通过。</div>';
|
|
8045
8048
|
}
|
|
8046
|
-
function
|
|
8049
|
+
function wt(r, e, t) {
|
|
8047
8050
|
return `<button class="vurdf-tab ${r === t ? "is-active" : ""}" data-tab="${r}">${e}</button>`;
|
|
8048
8051
|
}
|
|
8049
8052
|
function Co() {
|
|
8050
8053
|
return '<div class="vurdf-empty vurdf-no-selection">点击模型或结构树选择部件;点击场景空白处可取消选择。</div>';
|
|
8051
8054
|
}
|
|
8052
|
-
function
|
|
8055
|
+
function Ct(r) {
|
|
8053
8056
|
return r.toFixed(3);
|
|
8054
8057
|
}
|
|
8055
8058
|
function Eo(r) {
|
|
8056
8059
|
return R(r).replace(/(<\/?[\w:-]+)/g, '<span class="tag">$1</span>').replace(/([\w:-]+)=(".*?")/g, '<span class="attr">$1</span>=<span class="str">$2</span>');
|
|
8057
8060
|
}
|
|
8058
|
-
function
|
|
8061
|
+
function Dt(r, e) {
|
|
8059
8062
|
return r.jointType !== "prismatic" && e === "deg" ? 180 / Math.PI : 1;
|
|
8060
8063
|
}
|
|
8061
8064
|
function ko(r) {
|
|
@@ -8095,13 +8098,13 @@ class So {
|
|
|
8095
8098
|
u(this, "suppressClick", !1);
|
|
8096
8099
|
u(this, "windowDrag", null);
|
|
8097
8100
|
u(this, "windowResize", null);
|
|
8098
|
-
this.select = e, this.onClose = t, this.onOpen = i, this.element.className = "vurdf-diagram", this.element.hidden = !0, this.element.setAttribute("role", "dialog"), this.element.setAttribute("aria-label", "URDF 结构图"), this.element.innerHTML = `<header class="vurdf-diagram-head"><strong>${
|
|
8101
|
+
this.select = e, this.onClose = t, this.onOpen = i, this.element.className = "vurdf-diagram", this.element.hidden = !0, this.element.setAttribute("role", "dialog"), this.element.setAttribute("aria-label", "URDF 结构图"), this.element.innerHTML = `<header class="vurdf-diagram-head"><strong>${W("structure")}结构图</strong><div>${this.tool("zoomOut", "缩小")}${this.tool("zoomIn", "放大")}${this.tool("reset", "重置视图")}${this.tool("maximize", "最大化")}${this.tool("close", "关闭结构图")}</div></header><svg class="vurdf-diagram-canvas" aria-label="机器人结构图" tabindex="0"><g></g></svg><span class="vurdf-diagram-resize vurdf-diagram-resize-tl" data-diagram-resize="tl" aria-hidden="true"></span><span class="vurdf-diagram-resize vurdf-diagram-resize-tr" data-diagram-resize="tr" aria-hidden="true"></span><span class="vurdf-diagram-resize vurdf-diagram-resize-br" data-diagram-resize="br" aria-hidden="true"></span><span class="vurdf-diagram-resize vurdf-diagram-resize-bl" data-diagram-resize="bl" aria-hidden="true"></span>`, this.svg = this.element.querySelector("svg.vurdf-diagram-canvas"), this.graph = this.svg.querySelector("g"), this.element.querySelectorAll("[data-diagram-action]").forEach((o) => o.addEventListener("click", () => {
|
|
8099
8102
|
const l = o.dataset.diagramAction;
|
|
8100
8103
|
if (l === "close") this.close();
|
|
8101
8104
|
else if (l === "reset") this.fit();
|
|
8102
8105
|
else if (l === "maximize") {
|
|
8103
8106
|
const d = this.element.classList.toggle("is-maximized");
|
|
8104
|
-
o.setAttribute("aria-pressed", String(d)), o.innerHTML =
|
|
8107
|
+
o.setAttribute("aria-pressed", String(d)), o.innerHTML = W(d ? "minimize" : "maximize"), o.title = d ? "最小化" : "最大化", o.setAttribute("aria-label", o.title), this.syncTopLayer(), this.fit();
|
|
8105
8108
|
} else this.zoom(l === "zoomIn" ? 1.25 : 0.8);
|
|
8106
8109
|
}));
|
|
8107
8110
|
const n = this.element.querySelector(".vurdf-diagram-head");
|
|
@@ -8210,7 +8213,7 @@ class So {
|
|
|
8210
8213
|
(e = this.observer) == null || e.disconnect(), this.element.remove();
|
|
8211
8214
|
}
|
|
8212
8215
|
tool(e, t) {
|
|
8213
|
-
return `<button type="button" data-diagram-action="${e}" title="${t}" aria-label="${t}">${
|
|
8216
|
+
return `<button type="button" data-diagram-action="${e}" title="${t}" aria-label="${t}">${W(e)}</button>`;
|
|
8214
8217
|
}
|
|
8215
8218
|
size() {
|
|
8216
8219
|
return { width: this.svg.clientWidth || 900, height: this.svg.clientHeight || 560 };
|
|
@@ -8238,14 +8241,14 @@ class Po {
|
|
|
8238
8241
|
this.theme = t;
|
|
8239
8242
|
const n = !e.dynamicsAvailable || e.mode === "dynamics-initializing", s = e.dynamicsMessage ?? (e.dynamicsAvailable ? "点击后初始化并启动 MuJoCo 动力学仿真" : "该 URDF 未声明动力学仿真所需的惯性数据。");
|
|
8240
8243
|
this.root.innerHTML = `
|
|
8241
|
-
${
|
|
8242
|
-
${
|
|
8243
|
-
${
|
|
8244
|
-
${
|
|
8245
|
-
<button class="vurdf-tool ${this.namesVisible ? "is-active" : ""}" data-name-labels aria-pressed="${this.namesVisible}" title="显示/隐藏部件名称">${
|
|
8244
|
+
${Ge("collision", "碰撞", e.overlays.collision, "collision")}
|
|
8245
|
+
${Ge("jointAxis", "关节轴", e.overlays.jointAxis, "axis")}
|
|
8246
|
+
${Ge("centerOfMass", "质心", e.overlays.centerOfMass, "centerOfMass")}
|
|
8247
|
+
${Ge("inertia", "惯量", e.overlays.inertia === !0, "inertia")}
|
|
8248
|
+
<button class="vurdf-tool ${this.namesVisible ? "is-active" : ""}" data-name-labels aria-pressed="${this.namesVisible}" title="显示/隐藏部件名称">${W("names")}名称</button>
|
|
8246
8249
|
${e.nodes.some((a) => a.kind === "joint" && a.movable && a.jointType !== "prismatic") ? mo(i) : ""}
|
|
8247
8250
|
<span class="vurdf-tool-divider" aria-hidden="true"></span>
|
|
8248
|
-
${Xe("ground",
|
|
8251
|
+
${Xe("ground", Fi(this.ctx) ? "隐藏地面" : "显示地面", Fi(this.ctx), "ground")}
|
|
8249
8252
|
${Xe("fit", "适应视图", !1, "fit")}
|
|
8250
8253
|
${Xe("theme", this.theme === "dark" ? "浅色主题" : "深色主题", !1, this.theme === "dark" ? "sun" : "moon")}
|
|
8251
8254
|
<span class="vurdf-tool-divider" aria-hidden="true"></span>
|
|
@@ -8276,18 +8279,18 @@ class Po {
|
|
|
8276
8279
|
});
|
|
8277
8280
|
}
|
|
8278
8281
|
}
|
|
8279
|
-
function
|
|
8280
|
-
return `<button class="vurdf-tool ${t ? "is-active" : ""}" data-overlay="${r}" data-active="${t}" aria-pressed="${t}">${
|
|
8282
|
+
function Ge(r, e, t, i) {
|
|
8283
|
+
return `<button class="vurdf-tool ${t ? "is-active" : ""}" data-overlay="${r}" data-active="${t}" aria-pressed="${t}">${W(i)}${e}</button>`;
|
|
8281
8284
|
}
|
|
8282
8285
|
function Xe(r, e, t, i) {
|
|
8283
8286
|
const n = r === "ground" ? ` aria-pressed="${t}"` : "";
|
|
8284
|
-
return `<button class="vurdf-tool ${t ? "is-active" : ""}" data-scene-tool="${r}"${n} title="${e}" aria-label="${e}">${
|
|
8287
|
+
return `<button class="vurdf-tool ${t ? "is-active" : ""}" data-scene-tool="${r}"${n} title="${e}" aria-label="${e}">${W(i)}${r === "reset" ? e : ""}</button>`;
|
|
8285
8288
|
}
|
|
8286
8289
|
function Mo(r, e, t) {
|
|
8287
8290
|
const i = r.mode === "dynamics-running", n = i ? "暂停仿真" : r.mode === "dynamics-initializing" ? "启动中" : "启动仿真";
|
|
8288
|
-
return `<button class="vurdf-tool vurdf-dynamics ${i ? "is-active" : ""}" data-mode="dynamics" ${e ? "disabled" : ""} title="${R(t)}">${
|
|
8291
|
+
return `<button class="vurdf-tool vurdf-dynamics ${i ? "is-active" : ""}" data-mode="dynamics" ${e ? "disabled" : ""} title="${R(t)}">${W(i ? "pause" : "play")}${n}</button>`;
|
|
8289
8292
|
}
|
|
8290
|
-
function
|
|
8293
|
+
function Fi(r) {
|
|
8291
8294
|
return r.asset.$readControl().groundVisible;
|
|
8292
8295
|
}
|
|
8293
8296
|
class Ao {
|
|
@@ -8336,7 +8339,7 @@ class Io {
|
|
|
8336
8339
|
}
|
|
8337
8340
|
updateGizmo() {
|
|
8338
8341
|
var e;
|
|
8339
|
-
this.gizmo.innerHTML = oo(((e = this.cameraQuaternion) == null ? void 0 : e.call(this)) ?? new
|
|
8342
|
+
this.gizmo.innerHTML = oo(((e = this.cameraQuaternion) == null ? void 0 : e.call(this)) ?? new it());
|
|
8340
8343
|
}
|
|
8341
8344
|
setTheme(e) {
|
|
8342
8345
|
this.theme !== e && (this.theme = e, this.render(this.inspection.getSnapshot()));
|
|
@@ -8347,7 +8350,7 @@ class Io {
|
|
|
8347
8350
|
}
|
|
8348
8351
|
bindSidebar(e) {
|
|
8349
8352
|
const t = this.root.querySelector(`[data-sidebar="${e}"]`), i = t.querySelector("[data-sidebar-toggle]");
|
|
8350
|
-
i.innerHTML =
|
|
8353
|
+
i.innerHTML = W("chevron");
|
|
8351
8354
|
const n = i.querySelector("svg"), s = `${e}Width`, a = () => {
|
|
8352
8355
|
const d = this.root.dataset[`${e}Collapsed`] === "true";
|
|
8353
8356
|
t.classList.toggle("is-collapsed", d), this.root.style.setProperty(`--${e}-width`, d ? "0px" : this.root.dataset[s] ? `${this.root.dataset[s]}px` : e === "left" ? "clamp(220px, 23vw, 270px)" : "clamp(260px, 27vw, 320px)"), i.setAttribute("aria-expanded", String(!d)), i.setAttribute("aria-label", `${d ? "展开" : "收起"}${e === "left" ? "左" : "右"}侧面板`), n.style.transform = `rotate(${e === "left" !== d ? 180 : 0}deg)`;
|
|
@@ -8533,11 +8536,11 @@ function To(r) {
|
|
|
8533
8536
|
l.events.on("pick", (h) => {
|
|
8534
8537
|
var f;
|
|
8535
8538
|
const m = l.asset.$inspection();
|
|
8536
|
-
(m == null ? void 0 : m.kind) === "urdf" && $(m.getSnapshot()) && (i == null || i.selectFromScene(
|
|
8539
|
+
(m == null ? void 0 : m.kind) === "urdf" && $(m.getSnapshot()) && (i == null || i.selectFromScene(zi(m, ((f = h.result) == null ? void 0 : f.object) ?? null)));
|
|
8537
8540
|
}),
|
|
8538
8541
|
l.events.on("selection-change", (h) => {
|
|
8539
8542
|
const m = l.asset.$inspection();
|
|
8540
|
-
(m == null ? void 0 : m.kind) === "urdf" && $(m.getSnapshot()) && (i == null || i.selectFromScene(
|
|
8543
|
+
(m == null ? void 0 : m.kind) === "urdf" && $(m.getSnapshot()) && (i == null || i.selectFromScene(zi(m, h.object)));
|
|
8541
8544
|
})
|
|
8542
8545
|
), c();
|
|
8543
8546
|
},
|
|
@@ -8555,7 +8558,7 @@ function No(r) {
|
|
|
8555
8558
|
}
|
|
8556
8559
|
return null;
|
|
8557
8560
|
}
|
|
8558
|
-
function
|
|
8561
|
+
function zi(r, e) {
|
|
8559
8562
|
var s;
|
|
8560
8563
|
const t = No(e), i = r.getSnapshot(), n = i.nodes.find((a) => a.id === t && a.kind === "link");
|
|
8561
8564
|
return n ? ((s = i.nodes.find((a) => a.kind === "joint" && a.childLink === n.name)) == null ? void 0 : s.id) ?? t : t;
|
|
@@ -8832,7 +8835,7 @@ function jo(r) {
|
|
|
8832
8835
|
}
|
|
8833
8836
|
function Fo(r, e, t) {
|
|
8834
8837
|
var p;
|
|
8835
|
-
const i = $o(r), n =
|
|
8838
|
+
const i = $o(r), n = $i([t, e.signal, i]), s = ((p = e.filename) == null ? void 0 : p.trim()) || Bo(r), a = Tt(r) ? _o(r.files, r.entry, s) : s, o = Pn(r), l = e.baseUrl ?? Uo(o), d = /* @__PURE__ */ new Set(), c = Tt(r) ? new Map(r.files.map((h) => [se(h.path), h])) : null;
|
|
8836
8839
|
return Object.freeze({
|
|
8837
8840
|
original: r,
|
|
8838
8841
|
entryPath: a,
|
|
@@ -8842,8 +8845,8 @@ function Fo(r, e, t) {
|
|
|
8842
8845
|
baseUrl: l,
|
|
8843
8846
|
hasResourceResolver: !!e.resourceResolver,
|
|
8844
8847
|
async resolve(h, m) {
|
|
8845
|
-
const f = m ?
|
|
8846
|
-
|
|
8848
|
+
const f = m ? $i([n, m]) : n;
|
|
8849
|
+
Vi(f);
|
|
8847
8850
|
const b = se(h), y = Vo(r);
|
|
8848
8851
|
if (y && (!b || b === se(a ?? ""))) {
|
|
8849
8852
|
const w = URL.createObjectURL(y);
|
|
@@ -8855,7 +8858,7 @@ function Fo(r, e, t) {
|
|
|
8855
8858
|
return d.add(w), w;
|
|
8856
8859
|
}
|
|
8857
8860
|
const g = await qo(e.resourceResolver, h, f);
|
|
8858
|
-
if (
|
|
8861
|
+
if (Vi(f), g instanceof Blob) {
|
|
8859
8862
|
const w = URL.createObjectURL(g);
|
|
8860
8863
|
return d.add(w), w;
|
|
8861
8864
|
}
|
|
@@ -8884,7 +8887,7 @@ function zo(r) {
|
|
|
8884
8887
|
const i = /\.([a-z0-9]+)$/i.exec(t);
|
|
8885
8888
|
return ((n = i == null ? void 0 : i[1]) == null ? void 0 : n.toLowerCase()) ?? null;
|
|
8886
8889
|
}
|
|
8887
|
-
function
|
|
8890
|
+
function $i(r) {
|
|
8888
8891
|
const e = r.filter((n) => !!n);
|
|
8889
8892
|
if (e.length === 0) return new AbortController().signal;
|
|
8890
8893
|
if (e.length === 1) return e[0];
|
|
@@ -8899,7 +8902,7 @@ function Fi(r) {
|
|
|
8899
8902
|
}
|
|
8900
8903
|
return t.signal;
|
|
8901
8904
|
}
|
|
8902
|
-
function
|
|
8905
|
+
function Vi(r) {
|
|
8903
8906
|
if (r.aborted)
|
|
8904
8907
|
throw typeof r.throwIfAborted == "function" && r.throwIfAborted(), new DOMException("The operation was aborted.", "AbortError");
|
|
8905
8908
|
}
|
|
@@ -8921,7 +8924,7 @@ function Bo(r) {
|
|
|
8921
8924
|
} catch {
|
|
8922
8925
|
return ((t = e.split(/[?#]/, 1)[0]) == null ? void 0 : t.split("/").pop()) || null;
|
|
8923
8926
|
}
|
|
8924
|
-
return
|
|
8927
|
+
return Tt(r) ? r.entry ?? null : typeof File < "u" && r instanceof File && r.name || null;
|
|
8925
8928
|
}
|
|
8926
8929
|
function Uo(r) {
|
|
8927
8930
|
var e;
|
|
@@ -8932,14 +8935,14 @@ function Uo(r) {
|
|
|
8932
8935
|
return null;
|
|
8933
8936
|
}
|
|
8934
8937
|
}
|
|
8935
|
-
function
|
|
8938
|
+
function Tt(r) {
|
|
8936
8939
|
return typeof r == "object" && r !== null && "kind" in r && r.kind === "files";
|
|
8937
8940
|
}
|
|
8938
8941
|
function _o(r, e, t) {
|
|
8939
8942
|
if (e) {
|
|
8940
8943
|
const i = se(e);
|
|
8941
8944
|
if (!r.some((n) => se(n.path) === i))
|
|
8942
|
-
throw
|
|
8945
|
+
throw Bi(`Asset package entry not found: ${e}`, "E_ASSET_ENTRY_NOT_FOUND");
|
|
8943
8946
|
return i;
|
|
8944
8947
|
}
|
|
8945
8948
|
if (t) {
|
|
@@ -8947,7 +8950,7 @@ function _o(r, e, t) {
|
|
|
8947
8950
|
if (r.filter((s) => se(s.path) === i).length === 1) return i;
|
|
8948
8951
|
}
|
|
8949
8952
|
if (r.length === 1) return se(r[0].path);
|
|
8950
|
-
throw
|
|
8953
|
+
throw Bi("Asset package has multiple files; specify an entry.", "E_ASSET_AMBIGUOUS_ENTRY");
|
|
8951
8954
|
}
|
|
8952
8955
|
function Ho(r, e, t) {
|
|
8953
8956
|
if (!r || !e) return;
|
|
@@ -8963,10 +8966,10 @@ function se(r) {
|
|
|
8963
8966
|
async function qo(r, e, t) {
|
|
8964
8967
|
return r ? r.resolve(e, { signal: t }) : null;
|
|
8965
8968
|
}
|
|
8966
|
-
function
|
|
8969
|
+
function Bi(r, e) {
|
|
8967
8970
|
return Object.assign(new Error(r), { code: e });
|
|
8968
8971
|
}
|
|
8969
|
-
const
|
|
8972
|
+
const Ui = Object.freeze({
|
|
8970
8973
|
canPlay: !1,
|
|
8971
8974
|
canPause: !1,
|
|
8972
8975
|
canReset: !1,
|
|
@@ -8977,7 +8980,7 @@ const Vi = Object.freeze({
|
|
|
8977
8980
|
light: 15265002,
|
|
8978
8981
|
dark: 593167
|
|
8979
8982
|
}), Yo = 0.05;
|
|
8980
|
-
class
|
|
8983
|
+
class Wo {
|
|
8981
8984
|
constructor(e) {
|
|
8982
8985
|
u(this, "epoch", 0);
|
|
8983
8986
|
u(this, "active", null);
|
|
@@ -9009,9 +9012,9 @@ class Go {
|
|
|
9009
9012
|
epoch: s,
|
|
9010
9013
|
abort: new AbortController(),
|
|
9011
9014
|
listeners: /* @__PURE__ */ new Set(),
|
|
9012
|
-
ready:
|
|
9013
|
-
finished:
|
|
9014
|
-
closeResult:
|
|
9015
|
+
ready: Et(),
|
|
9016
|
+
finished: Et(),
|
|
9017
|
+
closeResult: Et(),
|
|
9015
9018
|
options: t,
|
|
9016
9019
|
snapshot: Object.freeze({ revision: 0, phase: "detecting", format: null, kind: null, capabilities: null, error: null, filename: null }),
|
|
9017
9020
|
dynamic: !1,
|
|
@@ -9133,7 +9136,7 @@ class Go {
|
|
|
9133
9136
|
a();
|
|
9134
9137
|
return;
|
|
9135
9138
|
}
|
|
9136
|
-
const o = this.detect(e), l =
|
|
9139
|
+
const o = this.detect(e), l = _i(o) ? await o : o;
|
|
9137
9140
|
if (!this.current(e) || (e.loader = l.loader, !this.current(e))) return;
|
|
9138
9141
|
if (!this.host.loaders().includes(l.loader))
|
|
9139
9142
|
throw X("Asset loader was removed.", "E_ABORTED");
|
|
@@ -9171,7 +9174,7 @@ class Go {
|
|
|
9171
9174
|
if (!this.current(e) || e.snapshot.phase !== "ready" || !e.session) return;
|
|
9172
9175
|
const f = e.session;
|
|
9173
9176
|
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, {
|
|
9174
|
-
capabilities: f.capabilities ??
|
|
9177
|
+
capabilities: f.capabilities ?? Ui,
|
|
9175
9178
|
physics: f.physics ?? null,
|
|
9176
9179
|
warning: f.warning ?? null
|
|
9177
9180
|
}), this.publishControl(e), this.host.requestRender();
|
|
@@ -9179,7 +9182,7 @@ class Go {
|
|
|
9179
9182
|
reportProgress: (f, b) => {
|
|
9180
9183
|
this.current(e) && e.snapshot.phase === "loading" && this.transition(e, { stage: f, message: b });
|
|
9181
9184
|
}
|
|
9182
|
-
}, h = l.loader.createSession(e.source, p), m =
|
|
9185
|
+
}, h = l.loader.createSession(e.source, p), m = _i(h) ? await h : h;
|
|
9183
9186
|
if (e.session && e.session !== m) {
|
|
9184
9187
|
m.beginDispose(), await m.dispose();
|
|
9185
9188
|
return;
|
|
@@ -9201,7 +9204,7 @@ class Go {
|
|
|
9201
9204
|
if (!this.current(e)) return;
|
|
9202
9205
|
e.dynamic = typeof m.update == "function", e.playing = e.dynamic && m.autoPlay !== !1, e.resetFrameClock = e.playing, this.transition(e, {
|
|
9203
9206
|
phase: "ready",
|
|
9204
|
-
capabilities: m.capabilities ??
|
|
9207
|
+
capabilities: m.capabilities ?? Ui,
|
|
9205
9208
|
warning: m.warning ?? null,
|
|
9206
9209
|
physics: m.physics ?? null
|
|
9207
9210
|
}), this.current(e) && e.snapshot.phase === "ready" && e.ready.resolve();
|
|
@@ -9508,7 +9511,7 @@ class Go {
|
|
|
9508
9511
|
}
|
|
9509
9512
|
}
|
|
9510
9513
|
}
|
|
9511
|
-
function
|
|
9514
|
+
function Et() {
|
|
9512
9515
|
let r, e;
|
|
9513
9516
|
const t = new Promise((i, n) => {
|
|
9514
9517
|
r = i, e = n;
|
|
@@ -9519,10 +9522,10 @@ function Ct() {
|
|
|
9519
9522
|
function X(r, e) {
|
|
9520
9523
|
return Object.assign(new Error(r), { code: e, ...e === "E_ABORTED" || e === "E_SUPERSEDED" ? { name: "AbortError" } : {} });
|
|
9521
9524
|
}
|
|
9522
|
-
function
|
|
9525
|
+
function _i(r) {
|
|
9523
9526
|
return !!(r && typeof r.then == "function");
|
|
9524
9527
|
}
|
|
9525
|
-
const
|
|
9528
|
+
const Go = {
|
|
9526
9529
|
id: "nebula-asset-model",
|
|
9527
9530
|
activate(r) {
|
|
9528
9531
|
r.contribute({
|
|
@@ -9540,7 +9543,7 @@ const Wo = {
|
|
|
9540
9543
|
clearColor: Ee.dark
|
|
9541
9544
|
},
|
|
9542
9545
|
async createSession(e, t) {
|
|
9543
|
-
const { createModelSession: i } = await import("./session-
|
|
9546
|
+
const { createModelSession: i } = await import("./session-C0KFNp50.js");
|
|
9544
9547
|
return i(e, t);
|
|
9545
9548
|
}
|
|
9546
9549
|
});
|
|
@@ -9624,12 +9627,12 @@ const Qo = {
|
|
|
9624
9627
|
clearColor: Ee.dark
|
|
9625
9628
|
},
|
|
9626
9629
|
async createSession(e, t) {
|
|
9627
|
-
const { createSimulationSession: i } = await import("./session-
|
|
9630
|
+
const { createSimulationSession: i } = await import("./session-52jx0mHi.js").then((n) => n.a);
|
|
9628
9631
|
return i(e, t);
|
|
9629
9632
|
}
|
|
9630
9633
|
});
|
|
9631
9634
|
}
|
|
9632
|
-
}, Ke = "viewer:highlight", xe = "viewer:cad-selection", we = "viewer:cad-hover",
|
|
9635
|
+
}, Ke = "viewer:highlight", xe = "viewer:cad-selection", we = "viewer:cad-hover", Hi = {
|
|
9633
9636
|
dark: {
|
|
9634
9637
|
hover: { color: 3528703, fillOpacity: 0, edgeOpacity: 0.85 },
|
|
9635
9638
|
selected: { color: 5999871, fillOpacity: 0.24, edgeOpacity: 1 }
|
|
@@ -9638,7 +9641,7 @@ const Qo = {
|
|
|
9638
9641
|
hover: { color: 24524, fillOpacity: 0, edgeOpacity: 0.95 },
|
|
9639
9642
|
selected: { color: 24524, fillOpacity: 0.2, edgeOpacity: 1 }
|
|
9640
9643
|
}
|
|
9641
|
-
}, el = 6, tl = 12, il = 160, nl = 160, rl = 50,
|
|
9644
|
+
}, el = 6, tl = 12, il = 160, nl = 160, rl = 50, qi = 592655;
|
|
9642
9645
|
class sl {
|
|
9643
9646
|
constructor(e, t) {
|
|
9644
9647
|
u(this, "cad");
|
|
@@ -9793,7 +9796,7 @@ class sl {
|
|
|
9793
9796
|
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));
|
|
9794
9797
|
});
|
|
9795
9798
|
var i, n, s, a, o, l, d, c, p, h, m, f, b, y, v, g, w;
|
|
9796
|
-
this.options = e, this.runtime = t, this.cameraStateStore = e.cameraStateStore === !1 ? void 0 : e.cameraStateStore ?? Cs(), 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) =>
|
|
9799
|
+
this.options = e, this.runtime = t, this.cameraStateStore = e.cameraStateStore === !1 ? void 0 : e.cameraStateStore ?? Cs(), 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) => Yi(x)).filter((x) => x !== null) : [Yi(this.defaultEnvironment)].filter((x) => x !== null), this.activePresetIndex = this.environmentPresets.length > 0 ? 0 : null, this.environmentRotation = Wi(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 $s(this.cadHost), this.cad = this.cadCapability, this.cadCapability.open = async (x, C = {}) => {
|
|
9797
9800
|
this.assertActive();
|
|
9798
9801
|
const { filename: k, signal: E, ...P } = C;
|
|
9799
9802
|
await this.assetController.open(x, { format: "cad", filename: k, signal: E, cad: P }, !0).ready;
|
|
@@ -9802,7 +9805,7 @@ class sl {
|
|
|
9802
9805
|
return D;
|
|
9803
9806
|
}, this.cadCapability.close = () => {
|
|
9804
9807
|
this.assertActive(), this.assetController.closeKind("cad");
|
|
9805
|
-
}, this.initialCameraSnapshot = t.captureCameraSnapshot(), this.lastCameraFingerprint =
|
|
9808
|
+
}, this.initialCameraSnapshot = t.captureCameraSnapshot(), this.lastCameraFingerprint = kt(this.initialCameraSnapshot), this.layoutEngine = this.createLayoutEngine(), this.pluginManager = new Oo(
|
|
9806
9809
|
() => this.cadCapability.getSnapshot(),
|
|
9807
9810
|
() => ({
|
|
9808
9811
|
viewMode: this.runtime.viewMode,
|
|
@@ -9836,7 +9839,7 @@ class sl {
|
|
|
9836
9839
|
e.viewport,
|
|
9837
9840
|
this.layoutEngine,
|
|
9838
9841
|
() => this.assetController.getActiveInspection()
|
|
9839
|
-
), this.assetController = new
|
|
9842
|
+
), this.assetController = new Wo({
|
|
9840
9843
|
loaders: () => this.pluginManager.getAssetLoaders(),
|
|
9841
9844
|
...this.runtime.getRenderer ? { getRenderer: () => this.runtime.getRenderer() } : {},
|
|
9842
9845
|
mount: (x) => this.mountAssetObject(x),
|
|
@@ -9854,7 +9857,7 @@ class sl {
|
|
|
9854
9857
|
cleanupError: (x) => {
|
|
9855
9858
|
this.options.onCleanupError ? this.options.onCleanupError(x) : console.error("[viewer] asset cleanup failed", x);
|
|
9856
9859
|
}
|
|
9857
|
-
}), this.pluginManager.registerBuiltin(Ko(this.cadCapability)), this.pluginManager.registerBuiltin(
|
|
9860
|
+
}), this.pluginManager.registerBuiltin(Ko(this.cadCapability)), this.pluginManager.registerBuiltin(Go), this.pluginManager.registerBuiltin(Qo), this.pluginManager.onAssetLoaderRemoved((x) => this.assetController.removeLoader(x)), this.cadInspectorUnsubscribe = this.cad.on("inspector-change", () => {
|
|
9858
9861
|
this.interactionMode === "managed" && (this.syncCadSelectionOverlay(), this.syncCadHoverOverlay()), this.dispatchCadSelectionChange();
|
|
9859
9862
|
}), this.cadDocumentUnsubscribe = this.cad.on("document-change", () => {
|
|
9860
9863
|
this.setCadHoveredInsert(null), this.interactionMode === "managed" && this.syncCadSelectionOverlay();
|
|
@@ -10002,7 +10005,7 @@ class sl {
|
|
|
10002
10005
|
this.assertActive();
|
|
10003
10006
|
const t = this.runtime.setEnvironmentRotation;
|
|
10004
10007
|
if (!t) return !1;
|
|
10005
|
-
const i =
|
|
10008
|
+
const i = Wi(e);
|
|
10006
10009
|
return i === this.environmentRotation ? !0 : t.call(this.runtime, i) ? (this.environmentRotation = i, this.emit("environment-change", this.getEnvironmentState()), !0) : !1;
|
|
10007
10010
|
}
|
|
10008
10011
|
async useDefaultEnvironment() {
|
|
@@ -10211,7 +10214,7 @@ class sl {
|
|
|
10211
10214
|
*/
|
|
10212
10215
|
resetAssetPresentation() {
|
|
10213
10216
|
var e;
|
|
10214
|
-
this.runtime.setClearColor(this.options.clearColor ??
|
|
10217
|
+
this.runtime.setClearColor(this.options.clearColor ?? qi), 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();
|
|
10215
10218
|
}
|
|
10216
10219
|
createCadHost() {
|
|
10217
10220
|
const e = this;
|
|
@@ -10247,7 +10250,7 @@ class sl {
|
|
|
10247
10250
|
e.emit("content-change", { source: "cad" });
|
|
10248
10251
|
},
|
|
10249
10252
|
emitCameraChange(t = e.pendingCameraReason) {
|
|
10250
|
-
e.lastCameraFingerprint =
|
|
10253
|
+
e.lastCameraFingerprint = kt(e.runtime.captureCameraSnapshot()), e.emit("camera-change", {
|
|
10251
10254
|
viewMode: e.runtime.viewMode,
|
|
10252
10255
|
reason: t,
|
|
10253
10256
|
interaction: e.interaction
|
|
@@ -10309,7 +10312,7 @@ class sl {
|
|
|
10309
10312
|
if (!i || i.isEmpty()) return;
|
|
10310
10313
|
const n = !!((o = e.details) != null && o.bbox);
|
|
10311
10314
|
if (((d = (l = this.options.cadInteractionStyle) == null ? void 0 : l.selected) == null ? void 0 : d.enabled) === !1) return;
|
|
10312
|
-
const s = n ? this.createCadInteractionOverlay(i, "selected") : new qn(i, ((p = (c = this.options.cadInteractionStyle) == null ? void 0 : c.selected) == null ? void 0 : p.color) ??
|
|
10315
|
+
const s = n ? this.createCadInteractionOverlay(i, "selected") : new qn(i, ((p = (c = this.options.cadInteractionStyle) == null ? void 0 : c.selected) == null ? void 0 : p.color) ?? Hi.dark.selected.color);
|
|
10313
10316
|
s.name = xe, this.runtime.mountOverlay(xe, s, { owned: !0 });
|
|
10314
10317
|
}
|
|
10315
10318
|
dispatchCadSelectionChange() {
|
|
@@ -10328,7 +10331,7 @@ class sl {
|
|
|
10328
10331
|
}
|
|
10329
10332
|
createCadInteractionOverlay(e, t) {
|
|
10330
10333
|
var h, m;
|
|
10331
|
-
const i = ((h = this.options.ui) == null ? void 0 : h.theme) === "light" ? "light" : "dark", n =
|
|
10334
|
+
const i = ((h = this.options.ui) == null ? void 0 : h.theme) === "light" ? "light" : "dark", n = Hi[i][t], s = (m = this.options.cadInteractionStyle) == null ? void 0 : m[t], a = {
|
|
10332
10335
|
color: (s == null ? void 0 : s.color) ?? n.color,
|
|
10333
10336
|
fillOpacity: (s == null ? void 0 : s.fillOpacity) ?? n.fillOpacity,
|
|
10334
10337
|
edgeOpacity: (s == null ? void 0 : s.edgeOpacity) ?? n.edgeOpacity
|
|
@@ -10338,7 +10341,7 @@ class sl {
|
|
|
10338
10341
|
if (a.fillOpacity > 0) {
|
|
10339
10342
|
const f = new ae(
|
|
10340
10343
|
c.clone(),
|
|
10341
|
-
new
|
|
10344
|
+
new Nt({
|
|
10342
10345
|
color: a.color,
|
|
10343
10346
|
transparent: !0,
|
|
10344
10347
|
opacity: a.fillOpacity,
|
|
@@ -10348,8 +10351,8 @@ class sl {
|
|
|
10348
10351
|
);
|
|
10349
10352
|
f.name = `${o.name}:fill`, f.position.copy(d), f.renderOrder = 1305, o.add(f);
|
|
10350
10353
|
}
|
|
10351
|
-
const p = new
|
|
10352
|
-
new
|
|
10354
|
+
const p = new Wn(
|
|
10355
|
+
new Gn(c),
|
|
10353
10356
|
new Xn({
|
|
10354
10357
|
color: a.color,
|
|
10355
10358
|
transparent: !0,
|
|
@@ -10452,7 +10455,7 @@ class sl {
|
|
|
10452
10455
|
this.resetAssetPresentation();
|
|
10453
10456
|
return;
|
|
10454
10457
|
}
|
|
10455
|
-
this.runtime.setClearColor(e.clearColor ?? this.options.clearColor ??
|
|
10458
|
+
this.runtime.setClearColor(e.clearColor ?? this.options.clearColor ?? qi), this.runtime.setNavigationPolicy(
|
|
10456
10459
|
e.interactionMode === "object" || e.interactionMode === "simulation" ? "preview" : "viewer"
|
|
10457
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(ll(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();
|
|
10458
10461
|
}
|
|
@@ -10470,12 +10473,12 @@ class sl {
|
|
|
10470
10473
|
this.interaction !== e && (this.interaction = e, this.interactionRenderLastTs = null, this.emit("interaction-change", { interaction: e }), this.emitViewportChange(), this.cadCapability.onInteractionChanged(), e === "idle" && (this.pendingCameraReason = "api"), e === "idle" && this.runtime.requestRender());
|
|
10471
10474
|
}
|
|
10472
10475
|
applyCameraSnapshot(e, t) {
|
|
10473
|
-
if (
|
|
10476
|
+
if (!$t(e)) return !1;
|
|
10474
10477
|
const i = this.runtime.viewMode;
|
|
10475
10478
|
return this.runtime.applyCameraSnapshot(e) ? (this.runtime.resize(), this.runtime.viewMode !== i && this.emit("view-mode-change", { viewMode: this.runtime.viewMode }), this.pendingCameraReason = t, this.cadCapability.onCameraChanged(t), this.refreshCadPointerHover(), !0) : !1;
|
|
10476
10479
|
}
|
|
10477
10480
|
detectCameraChange(e = !1) {
|
|
10478
|
-
const t =
|
|
10481
|
+
const t = kt(this.runtime.captureCameraSnapshot());
|
|
10479
10482
|
return !e && t === this.lastCameraFingerprint ? !1 : (this.lastCameraFingerprint = t, this.cadCapability.onCameraChanged(this.pendingCameraReason), !0);
|
|
10480
10483
|
}
|
|
10481
10484
|
emitViewportChange() {
|
|
@@ -10597,7 +10600,7 @@ function Jl(r) {
|
|
|
10597
10600
|
function al(r, e) {
|
|
10598
10601
|
return e.initialize(), new sl(r, e);
|
|
10599
10602
|
}
|
|
10600
|
-
function
|
|
10603
|
+
function Yi(r) {
|
|
10601
10604
|
if (r === "room") return null;
|
|
10602
10605
|
let t = (r.url.split(/[?#]/, 1)[0] ?? r.url).split("/").pop() || r.url;
|
|
10603
10606
|
try {
|
|
@@ -10610,16 +10613,16 @@ function ol(r) {
|
|
|
10610
10613
|
const e = r.name.trim().toLowerCase().split(".").pop();
|
|
10611
10614
|
return e === "hdr" ? "hdr" : ["jpg", "jpeg", "png", "webp", "avif"].includes(e ?? "") ? "image" : null;
|
|
10612
10615
|
}
|
|
10613
|
-
function
|
|
10616
|
+
function Wi(r) {
|
|
10614
10617
|
if (!Number.isFinite(r)) return 0;
|
|
10615
10618
|
const e = r % 360;
|
|
10616
10619
|
return e < 0 ? e + 360 : e;
|
|
10617
10620
|
}
|
|
10618
10621
|
function ll(r) {
|
|
10619
|
-
return r === "cad" ? dl : r === "model" ?
|
|
10622
|
+
return r === "cad" ? dl : r === "model" ? Gi : r === "simulation" ? /* @__PURE__ */ new Set([...Gi, "urdf"]) : cl;
|
|
10620
10623
|
}
|
|
10621
|
-
const dl = /* @__PURE__ */ new Set(["cad"]),
|
|
10622
|
-
function
|
|
10624
|
+
const dl = /* @__PURE__ */ new Set(["cad"]), Gi = /* @__PURE__ */ new Set(["scene"]), cl = /* @__PURE__ */ new Set();
|
|
10625
|
+
function kt(r) {
|
|
10623
10626
|
return r ? JSON.stringify(r) : null;
|
|
10624
10627
|
}
|
|
10625
10628
|
function ul(r) {
|
|
@@ -10825,11 +10828,11 @@ function yl(r) {
|
|
|
10825
10828
|
schemaVersion: e.schemaVersion,
|
|
10826
10829
|
apiVersion: Number(e.apiVersion),
|
|
10827
10830
|
runtimeId: e.runtimeId,
|
|
10828
|
-
js:
|
|
10829
|
-
wasm:
|
|
10831
|
+
js: Xi(e.js, "openusd_probe.js"),
|
|
10832
|
+
wasm: Xi(e.wasm, "openusd_probe.wasm")
|
|
10830
10833
|
});
|
|
10831
10834
|
}
|
|
10832
|
-
function
|
|
10835
|
+
function Xi(r, e) {
|
|
10833
10836
|
if (!r || typeof r != "object") throw new Error(`OpenUSD runtime manifest omits ${e}.`);
|
|
10834
10837
|
const t = r;
|
|
10835
10838
|
if (t.file !== e || typeof t.sha256 != "string" || !/^[0-9a-f]{64}$/.test(t.sha256) || !Number.isInteger(t.bytes) || Number(t.bytes) < 1)
|
|
@@ -10886,10 +10889,10 @@ function wl(r) {
|
|
|
10886
10889
|
function td(r = {}) {
|
|
10887
10890
|
return An(wl(r.mujocoBaseUrl), r.signal);
|
|
10888
10891
|
}
|
|
10889
|
-
let
|
|
10892
|
+
let Ki = null;
|
|
10890
10893
|
function id() {
|
|
10891
|
-
return
|
|
10892
|
-
})),
|
|
10894
|
+
return Ki ?? (Ki = import("./usd-session-Co9oFkxC.js").then(() => {
|
|
10895
|
+
})), Ki;
|
|
10893
10896
|
}
|
|
10894
10897
|
function Cl(r) {
|
|
10895
10898
|
return r instanceof Error ? {
|
|
@@ -10928,9 +10931,9 @@ function kl(r) {
|
|
|
10928
10931
|
const e = new Map(r.map((s) => [s.path, s])), t = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set(), n = (s) => {
|
|
10929
10932
|
const a = t.get(s.path);
|
|
10930
10933
|
if (a) return a;
|
|
10931
|
-
if (i.has(s.path)) return
|
|
10934
|
+
if (i.has(s.path)) return Ji(s.localMatrix);
|
|
10932
10935
|
i.add(s.path);
|
|
10933
|
-
const o =
|
|
10936
|
+
const o = Ji(s.localMatrix), l = s.parentPath ? e.get(s.parentPath) : void 0, d = !l || s.resetsXformStack ? o : Zi(o, n(l));
|
|
10934
10937
|
return i.delete(s.path), t.set(s.path, d), d;
|
|
10935
10938
|
};
|
|
10936
10939
|
return r.map((s) => {
|
|
@@ -10940,17 +10943,17 @@ function kl(r) {
|
|
|
10940
10943
|
const o = n(a), l = Pl(o);
|
|
10941
10944
|
return l ? {
|
|
10942
10945
|
...s,
|
|
10943
|
-
localMatrix:
|
|
10946
|
+
localMatrix: Zi(n(s), l)
|
|
10944
10947
|
} : s;
|
|
10945
10948
|
});
|
|
10946
10949
|
}
|
|
10947
|
-
function
|
|
10950
|
+
function Ji(r) {
|
|
10948
10951
|
return Sl(r) ? r : El;
|
|
10949
10952
|
}
|
|
10950
10953
|
function Sl(r) {
|
|
10951
10954
|
return (r == null ? void 0 : r.length) === 16 && r.every(Number.isFinite);
|
|
10952
10955
|
}
|
|
10953
|
-
function
|
|
10956
|
+
function Zi(r, e) {
|
|
10954
10957
|
const t = new Array(16);
|
|
10955
10958
|
for (let i = 0; i < 4; i++)
|
|
10956
10959
|
for (let n = 0; n < 4; n++) {
|
|
@@ -11220,10 +11223,10 @@ async function ud(r, e, t) {
|
|
|
11220
11223
|
U = z, n.onerror = (ee) => {
|
|
11221
11224
|
const A = new Error(ee.message || "USD worker failed");
|
|
11222
11225
|
z(A);
|
|
11223
|
-
for (const
|
|
11226
|
+
for (const G of s.values()) G.reject(A);
|
|
11224
11227
|
s.clear(), D();
|
|
11225
11228
|
}, n.onmessage = async (ee) => {
|
|
11226
|
-
var
|
|
11229
|
+
var G, ue;
|
|
11227
11230
|
const A = ee.data;
|
|
11228
11231
|
switch (A.type) {
|
|
11229
11232
|
case "visual-ready":
|
|
@@ -11254,7 +11257,7 @@ async function ud(r, e, t) {
|
|
|
11254
11257
|
return;
|
|
11255
11258
|
}
|
|
11256
11259
|
case "event":
|
|
11257
|
-
A.event === "reference-skipped" ? (
|
|
11260
|
+
A.event === "reference-skipped" ? (G = t.onReferenceSkipped) == null || G.call(t, A.identifier) : (ue = t.onResourceFailed) == null || ue.call(t, A.identifier, Ne(A.error));
|
|
11258
11261
|
return;
|
|
11259
11262
|
case "query-result": {
|
|
11260
11263
|
const F = s.get(A.id);
|
|
@@ -11284,13 +11287,13 @@ async function ud(r, e, t) {
|
|
|
11284
11287
|
if (p) return Promise.reject(new Error("USD worker disposed"));
|
|
11285
11288
|
const ee = c++;
|
|
11286
11289
|
try {
|
|
11287
|
-
return await new Promise((A,
|
|
11288
|
-
s.set(ee, { resolve: (ue) => A(ue), reject:
|
|
11290
|
+
return await new Promise((A, G) => {
|
|
11291
|
+
s.set(ee, { resolve: (ue) => A(ue), reject: G }), E({ type: "query", id: ee, method: N, args: z });
|
|
11289
11292
|
});
|
|
11290
11293
|
} catch (A) {
|
|
11291
|
-
const
|
|
11294
|
+
const G = A instanceof Error ? A.message : String(A);
|
|
11292
11295
|
throw Object.assign(
|
|
11293
|
-
new Error(`USD stage query ${N}(${z.map(String).join(", ")}) failed: ${
|
|
11296
|
+
new Error(`USD stage query ${N}(${z.map(String).join(", ")}) failed: ${G}`),
|
|
11294
11297
|
{
|
|
11295
11298
|
code: A && typeof A == "object" && "code" in A ? String(A.code) : "E_USD_QUERY"
|
|
11296
11299
|
}
|
|
@@ -11316,15 +11319,15 @@ async function ud(r, e, t) {
|
|
|
11316
11319
|
textureURLs: y,
|
|
11317
11320
|
decodeTexture(N, z, ee) {
|
|
11318
11321
|
if (p) return Promise.reject(new Error("USD worker disposed"));
|
|
11319
|
-
const A = ee ? Il(ee) : N,
|
|
11322
|
+
const A = ee ? Il(ee) : N, G = `${z}:${A}`, ue = a.get(G);
|
|
11320
11323
|
if (ue) return ue;
|
|
11321
11324
|
const F = new Promise((he, Tn) => {
|
|
11322
11325
|
l.push({ url: N, maxDimension: z, resolve: he, reject: Tn }), I();
|
|
11323
11326
|
});
|
|
11324
|
-
return a.set(
|
|
11327
|
+
return a.set(G, F), F.then((he) => {
|
|
11325
11328
|
o.add(he);
|
|
11326
11329
|
}, () => {
|
|
11327
|
-
a.get(
|
|
11330
|
+
a.get(G) === F && a.delete(G);
|
|
11328
11331
|
}), F;
|
|
11329
11332
|
},
|
|
11330
11333
|
startPhysics() {
|
|
@@ -11428,7 +11431,7 @@ export {
|
|
|
11428
11431
|
Mn as q,
|
|
11429
11432
|
dd as r,
|
|
11430
11433
|
ud as s,
|
|
11431
|
-
|
|
11434
|
+
Vi as t,
|
|
11432
11435
|
Ll as u,
|
|
11433
11436
|
Ol as v,
|
|
11434
11437
|
Tl as w,
|