@nebula-spatial/viewer 0.5.14 → 0.5.16
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 +116 -72
- package/README.md +15 -0
- package/dist/assets/types.d.ts +22 -0
- package/dist/assets/usd-worker-drur-7bI.js +1673 -0
- package/dist/{collision-debug-B2bN8P2g.js → collision-debug-fwawwhH3.js} +87 -75
- package/dist/{index-BSDalKkd.js → index-D9-UMnkK.js} +1062 -1018
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{mjcf-visual-D6T3a1uQ.js → mjcf-visual-8DniLezh.js} +1 -1
- package/dist/{mujoco-runtime-CFQQsRmc.js → mujoco-runtime-D3JnsOCZ.js} +1 -1
- package/dist/session-CEipzQYJ.js +801 -0
- package/dist/{session-BUarD9PA.js → session-Dn5fAl3z.js} +2 -2
- package/dist/{stage-CvP0yaff.js → stage-CrDYgXLe.js} +1 -1
- package/dist/{urdf-session-DcGOHFg2.js → urdf-session-BABUz6Qt.js} +5 -5
- package/dist/{usd-session-DSFtJk4b.js → usd-session-CNYn-3LD.js} +3680 -3494
- package/dist/version.d.ts +1 -1
- package/dist/{xacro-bURYAikr.js → xacro-Q-egO2RI.js} +1 -1
- package/openusd/openusd-runtime-manifest.json +6 -6
- package/openusd/openusd_probe.js +1 -1
- package/openusd/openusd_probe.wasm +0 -0
- package/package.json +1 -1
- package/dist/assets/usd-worker-CPCXyXkl.js +0 -1508
- package/dist/session-Ciaw522_.js +0 -786
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
var jn = Object.defineProperty;
|
|
2
2
|
var Fn = (r, e, t) => e in r ? jn(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
3
|
var u = (r, e, t) => Fn(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { Texture as
|
|
4
|
+
import { Texture as lt, Scene as $e, OrthographicCamera as Pt, PlaneGeometry as tn, ShaderMaterial as nn, KeepStencilOp as ke, EqualStencilFunc as Qe, Matrix3 as rn, Mesh as ae, MeshBasicMaterial as Ot, ReplaceStencilOp as Se, AlwaysStencilFunc as Mt, DoubleSide as jt, Color as tt, MathUtils as Y, EquirectangularReflectionMapping as Me, Matrix4 as ut, Euler as sn, MeshPhysicalMaterial as Ft, FrontSide as zn, Vector3 as R, ShaderChunk as _t, MOUSE as se, Object3D as an, Group as on, Raycaster as dt, Vector2 as Z, Quaternion as it, WebGLRenderer as ln, PerspectiveCamera as dn, TOUCH as Ht, Vector4 as $n, Plane as cn, WebGLRenderTarget as Vn, Box3 as Q, PMREMGenerator as Bn, TextureLoader as un, SRGBColorSpace as zt, ACESFilmicToneMapping as Un, MeshStandardMaterial as _n, SphereGeometry as Hn, Sphere as qt, UniformsUtils as qn, BoxHelper as Yn, Box3Helper as Wn, BoxGeometry as Gn, LineSegments as Xn, EdgesGeometry as Kn, LineBasicMaterial as Jn } from "three";
|
|
5
5
|
import { RoomEnvironment as Zn } from "three/addons/environments/RoomEnvironment.js";
|
|
6
6
|
import { MapControls as Qn } from "three/addons/controls/MapControls.js";
|
|
7
7
|
import { OrbitControls as er } from "three/addons/controls/OrbitControls.js";
|
|
8
8
|
import { HDRLoader as hn } from "three/addons/loaders/HDRLoader.js";
|
|
9
|
-
import { createCadDocumentSession as tr, getCadDocumentRenderResource as ir, formatCadInsertId as
|
|
9
|
+
import { createCadDocumentSession as tr, getCadDocumentRenderResource as ir, formatCadInsertId as Yt } from "@nebula-spatial/cad-loader";
|
|
10
10
|
import { CSS2DObject as nr, CSS2DRenderer as rr } from "three/addons/renderers/CSS2DRenderer.js";
|
|
11
|
-
import { viewerRuntimeAssetUrls as
|
|
11
|
+
import { viewerRuntimeAssetUrls as Wt } from "@nebula-spatial/viewer/runtime-assets";
|
|
12
12
|
import sr from "@mujoco/mujoco/mujoco.wasm?url";
|
|
13
|
-
const ar = "0.5.
|
|
14
|
-
function
|
|
13
|
+
const ar = "0.5.16", or = "@nebula-spatial/viewer", Gt = "__NEBULA_SPATIAL_VIEWER_BANNER_PRINTED__";
|
|
14
|
+
function Xt() {
|
|
15
15
|
const r = `%c ${or} %c v${ar} `;
|
|
16
16
|
console.log(r, "background:#111827;color:#ffffff;padding:4px 10px;border-radius:4px 0 0 4px;font-weight:700;", "background:#10B981;color:#ffffff;padding:4px 10px;border-radius:0 4px 4px 0;font-weight:700;");
|
|
17
17
|
}
|
|
18
18
|
try {
|
|
19
19
|
const r = globalThis;
|
|
20
|
-
r[
|
|
20
|
+
r[Gt] || (r[Gt] = !0, Xt());
|
|
21
21
|
} catch {
|
|
22
|
-
|
|
22
|
+
Xt();
|
|
23
23
|
}
|
|
24
24
|
const lr = [
|
|
25
25
|
"alphaMap",
|
|
@@ -55,12 +55,12 @@ function dr(r, e, t) {
|
|
|
55
55
|
const i = r;
|
|
56
56
|
for (const n of lr) {
|
|
57
57
|
const s = i[n];
|
|
58
|
-
s instanceof
|
|
58
|
+
s instanceof lt && nt(s, t);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
nt(r, t);
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function Kt(r, e = {}) {
|
|
64
64
|
const t = e.disposedResources ?? /* @__PURE__ */ new WeakSet(), i = e.disposeTextures !== !1;
|
|
65
65
|
r.traverse((n) => {
|
|
66
66
|
const s = n;
|
|
@@ -79,7 +79,7 @@ function pe(r) {
|
|
|
79
79
|
}
|
|
80
80
|
return !0;
|
|
81
81
|
}
|
|
82
|
-
const
|
|
82
|
+
const Jt = 31, Zt = "HDR_BACKDROP_BLUR", cr = (
|
|
83
83
|
/* glsl */
|
|
84
84
|
`
|
|
85
85
|
varying vec2 vUv;
|
|
@@ -137,7 +137,7 @@ class hr {
|
|
|
137
137
|
u(this, "candidates", []);
|
|
138
138
|
u(this, "activeCandidates", []);
|
|
139
139
|
u(this, "backdropScene", new $e());
|
|
140
|
-
u(this, "backdropCamera", new
|
|
140
|
+
u(this, "backdropCamera", new Pt(-1, 1, 1, -1, 0, 1));
|
|
141
141
|
u(this, "backdropGeometry", new tn(2, 2));
|
|
142
142
|
u(this, "backdropMaterial", new nn({
|
|
143
143
|
name: "HdrTransparentBackdropMaterial",
|
|
@@ -161,16 +161,16 @@ class hr {
|
|
|
161
161
|
toneMapped: !0
|
|
162
162
|
}));
|
|
163
163
|
u(this, "backdropMesh", new ae(this.backdropGeometry, this.backdropMaterial));
|
|
164
|
-
u(this, "maskMaterial", new
|
|
164
|
+
u(this, "maskMaterial", new Ot({
|
|
165
165
|
name: "HdrTransparentMaskMaterial",
|
|
166
166
|
colorWrite: !1,
|
|
167
167
|
depthTest: !1,
|
|
168
168
|
depthWrite: !1,
|
|
169
169
|
fog: !1,
|
|
170
|
-
side:
|
|
170
|
+
side: jt,
|
|
171
171
|
stencilWrite: !0,
|
|
172
172
|
stencilRef: 1,
|
|
173
|
-
stencilFunc:
|
|
173
|
+
stencilFunc: Mt,
|
|
174
174
|
stencilFail: Se,
|
|
175
175
|
stencilZFail: Se,
|
|
176
176
|
stencilZPass: Se
|
|
@@ -201,7 +201,7 @@ class hr {
|
|
|
201
201
|
}
|
|
202
202
|
render(e, t, i, n) {
|
|
203
203
|
const s = t.environment;
|
|
204
|
-
if (this.disposed || !(s instanceof
|
|
204
|
+
if (this.disposed || !(s instanceof lt) || s.mapping !== Me || (this.dirty && this.refreshCandidates(n), this.candidates.length === 0)) return !1;
|
|
205
205
|
this.activeCandidates.length = 0;
|
|
206
206
|
for (const m of this.candidates)
|
|
207
207
|
pe(m) && i.layers.test(m.layers) && this.activeCandidates.push(m);
|
|
@@ -209,7 +209,7 @@ class hr {
|
|
|
209
209
|
const a = e.autoClear, o = e.getClearAlpha(), l = e.getClearColor(this.previousClearColor), d = t.background, c = t.overrideMaterial, p = i.layers.mask;
|
|
210
210
|
this.previousLayerMasks.length = 0;
|
|
211
211
|
for (const m of this.activeCandidates)
|
|
212
|
-
this.previousLayerMasks.push(m.layers.mask), m.layers.set(
|
|
212
|
+
this.previousLayerMasks.push(m.layers.mask), m.layers.set(Jt);
|
|
213
213
|
s.updateMatrix();
|
|
214
214
|
const h = this.backdropMaterial.uniforms;
|
|
215
215
|
h.tEquirect.value = s, h.uvTransform.value.copy(s.matrix), h.backgroundIntensity.value = t.backgroundIntensity, h.blurriness.value = this.blurriness, h.yawOffset.value = this.yawOffset;
|
|
@@ -217,7 +217,7 @@ class hr {
|
|
|
217
217
|
return e.autoClear = !1, e.setClearColor(
|
|
218
218
|
t.background instanceof tt ? t.background : l,
|
|
219
219
|
1
|
|
220
|
-
), e.clear(!0, !0, !0), t.background = null, t.overrideMaterial = this.maskMaterial, i.layers.set(
|
|
220
|
+
), e.clear(!0, !0, !0), t.background = null, t.overrideMaterial = this.maskMaterial, i.layers.set(Jt), 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;
|
|
221
221
|
} finally {
|
|
222
222
|
this.restoreCandidateLayers(), i.layers.mask = p, t.overrideMaterial = c, t.background = d, e.autoClear = a, e.setClearColor(l, o);
|
|
223
223
|
}
|
|
@@ -242,9 +242,9 @@ function pr(r) {
|
|
|
242
242
|
return (Array.isArray(r) ? r : [r]).some((t) => t.visible && t.transparent === !0);
|
|
243
243
|
}
|
|
244
244
|
function mr(r, e) {
|
|
245
|
-
e ? r.defines = { ...r.defines, [
|
|
245
|
+
e ? r.defines = { ...r.defines, [Zt]: "" } : r.defines && delete r.defines[Zt], r.needsUpdate = !0;
|
|
246
246
|
}
|
|
247
|
-
const
|
|
247
|
+
const Qt = "TRANSMISSION_BACKDROP_BLUR", fr = -9999, vr = -1e4, gr = (
|
|
248
248
|
/* glsl */
|
|
249
249
|
`
|
|
250
250
|
varying vec2 vUv;
|
|
@@ -311,16 +311,16 @@ class yr {
|
|
|
311
311
|
u(this, "candidates", /* @__PURE__ */ new Set());
|
|
312
312
|
u(this, "proxies", /* @__PURE__ */ new Map());
|
|
313
313
|
u(this, "backdropGeometry", new tn(2, 2));
|
|
314
|
-
u(this, "maskMaterial", new
|
|
314
|
+
u(this, "maskMaterial", new Ot({
|
|
315
315
|
name: "TransmissionHdrMaskMaterial",
|
|
316
316
|
colorWrite: !1,
|
|
317
317
|
depthTest: !1,
|
|
318
318
|
depthWrite: !1,
|
|
319
319
|
fog: !1,
|
|
320
|
-
side:
|
|
320
|
+
side: jt,
|
|
321
321
|
stencilWrite: !0,
|
|
322
322
|
stencilRef: 1,
|
|
323
|
-
stencilFunc:
|
|
323
|
+
stencilFunc: Mt,
|
|
324
324
|
stencilFail: Se,
|
|
325
325
|
stencilZFail: Se,
|
|
326
326
|
stencilZPass: Se
|
|
@@ -330,8 +330,8 @@ class yr {
|
|
|
330
330
|
uniforms: {
|
|
331
331
|
tEquirect: { value: null },
|
|
332
332
|
environmentRotation: { value: new rn() },
|
|
333
|
-
cameraProjectionMatrixInverse: { value: new
|
|
334
|
-
cameraWorldMatrix: { value: new
|
|
333
|
+
cameraProjectionMatrixInverse: { value: new ut() },
|
|
334
|
+
cameraWorldMatrix: { value: new ut() },
|
|
335
335
|
environmentIntensity: { value: 1 },
|
|
336
336
|
blurriness: { value: 0 }
|
|
337
337
|
},
|
|
@@ -350,7 +350,7 @@ class yr {
|
|
|
350
350
|
}));
|
|
351
351
|
u(this, "backdropMesh", new ae(this.backdropGeometry, this.backdropMaterial));
|
|
352
352
|
u(this, "rotation", new sn());
|
|
353
|
-
u(this, "rotationMatrix", new
|
|
353
|
+
u(this, "rotationMatrix", new ut());
|
|
354
354
|
u(this, "blurriness", 0);
|
|
355
355
|
u(this, "dirty", !0);
|
|
356
356
|
u(this, "attachedScene", null);
|
|
@@ -358,7 +358,7 @@ class yr {
|
|
|
358
358
|
this.backdropMesh.name = "scene-runtime:transmission-hdr-backdrop", this.backdropMesh.frustumCulled = !1, this.backdropMesh.renderOrder = fr, this.backdropMesh.raycast = () => {
|
|
359
359
|
}, this.backdropMesh.onBeforeRender = (e) => {
|
|
360
360
|
const t = e.getRenderTarget() !== null;
|
|
361
|
-
this.backdropMaterial.stencilWrite = !t, this.backdropMaterial.stencilFunc = t ?
|
|
361
|
+
this.backdropMaterial.stencilWrite = !t, this.backdropMaterial.stencilFunc = t ? Mt : Qe;
|
|
362
362
|
};
|
|
363
363
|
}
|
|
364
364
|
markDirty() {
|
|
@@ -375,7 +375,7 @@ class yr {
|
|
|
375
375
|
prepare(e, t) {
|
|
376
376
|
if (this.disposed) return !1;
|
|
377
377
|
const i = e.environment;
|
|
378
|
-
if (!(i instanceof
|
|
378
|
+
if (!(i instanceof lt) || i.mapping !== Me)
|
|
379
379
|
return this.finish(), !1;
|
|
380
380
|
if (this.dirty && this.refreshCandidates(t), this.candidates.size === 0)
|
|
381
381
|
return this.finish(), !1;
|
|
@@ -429,11 +429,11 @@ class yr {
|
|
|
429
429
|
}
|
|
430
430
|
function xr(r) {
|
|
431
431
|
return (Array.isArray(r) ? r : [r]).some(
|
|
432
|
-
(t) => t.visible && t instanceof
|
|
432
|
+
(t) => t.visible && t instanceof Ft && t.transmission > 0
|
|
433
433
|
);
|
|
434
434
|
}
|
|
435
435
|
function wr(r, e) {
|
|
436
|
-
e ? r.defines = { ...r.defines, [
|
|
436
|
+
e ? r.defines = { ...r.defines, [Qt]: "" } : r.defines && delete r.defines[Qt], r.needsUpdate = !0;
|
|
437
437
|
}
|
|
438
438
|
class Cr {
|
|
439
439
|
constructor() {
|
|
@@ -447,7 +447,7 @@ class Cr {
|
|
|
447
447
|
prepare(e) {
|
|
448
448
|
if (this.dirty && this.refreshCandidates(e), this.candidates.size === 0) return !1;
|
|
449
449
|
for (const t of this.candidates)
|
|
450
|
-
t.visible && t.transmission > 0 && t.thickness > 0 && t.side === zn && (this.temporarySides.set(t, t.side), t.side =
|
|
450
|
+
t.visible && t.transmission > 0 && t.thickness > 0 && t.side === zn && (this.temporarySides.set(t, t.side), t.side = jt);
|
|
451
451
|
return !0;
|
|
452
452
|
}
|
|
453
453
|
finish() {
|
|
@@ -464,12 +464,12 @@ class Cr {
|
|
|
464
464
|
if (!(i instanceof ae) || !pe(i)) return;
|
|
465
465
|
const n = Array.isArray(i.material) ? i.material : [i.material];
|
|
466
466
|
for (const s of n)
|
|
467
|
-
s instanceof
|
|
467
|
+
s instanceof Ft && s.transmission > 0 && this.candidates.add(s);
|
|
468
468
|
});
|
|
469
469
|
this.dirty = !1;
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
|
-
const
|
|
472
|
+
const ei = "#include <transmission_pars_fragment>", ti = "#include <transmission_fragment>", Er = (
|
|
473
473
|
/* glsl */
|
|
474
474
|
`
|
|
475
475
|
vec4 getEeveeSphereProbeRefraction(
|
|
@@ -541,7 +541,7 @@ class kr {
|
|
|
541
541
|
const s = n.material, a = Array.isArray(s) ? s : [s];
|
|
542
542
|
let o = !1;
|
|
543
543
|
const l = a.map((d) => {
|
|
544
|
-
if (!(d instanceof
|
|
544
|
+
if (!(d instanceof Ft) || d.transmission <= 0 || !Sr(d))
|
|
545
545
|
return d;
|
|
546
546
|
const c = Mr(n);
|
|
547
547
|
return c === null ? d : (o = !0, this.getReplacement(d, c));
|
|
@@ -578,13 +578,13 @@ function Sr(r) {
|
|
|
578
578
|
function Pr(r) {
|
|
579
579
|
const e = r.onBeforeCompile, t = r.customProgramCacheKey;
|
|
580
580
|
r.onBeforeCompile = (i, n) => {
|
|
581
|
-
e.call(r, i, n), !(!i.fragmentShader.includes(
|
|
582
|
-
|
|
583
|
-
`${
|
|
581
|
+
e.call(r, i, n), !(!i.fragmentShader.includes(ei) || !i.fragmentShader.includes(ti)) && (i.fragmentShader = i.fragmentShader.replace(
|
|
582
|
+
ei,
|
|
583
|
+
`${_t.transmission_pars_fragment}
|
|
584
584
|
${Er}`
|
|
585
585
|
).replace(
|
|
586
|
-
|
|
587
|
-
|
|
586
|
+
ti,
|
|
587
|
+
_t.transmission_fragment.replace(
|
|
588
588
|
"getIBLVolumeRefraction(",
|
|
589
589
|
"getEeveeSphereProbeRefraction("
|
|
590
590
|
)
|
|
@@ -596,7 +596,7 @@ function Mr(r) {
|
|
|
596
596
|
e.boundingBox || e.computeBoundingBox();
|
|
597
597
|
const t = e.boundingBox;
|
|
598
598
|
if (!t) return null;
|
|
599
|
-
const i = t.getSize(new
|
|
599
|
+
const i = t.getSize(new R()), n = Math.min(i.x, i.y, i.z);
|
|
600
600
|
return Number.isFinite(n) && n > 1e-6 ? n : null;
|
|
601
601
|
}
|
|
602
602
|
function Rr(r) {
|
|
@@ -613,10 +613,10 @@ function Rr(r) {
|
|
|
613
613
|
} = r;
|
|
614
614
|
if (!Number.isFinite(e) || !Number.isFinite(t) || !Number.isFinite(i) || !Number.isFinite(n) || !Number.isFinite(s) || !Number.isFinite(a) || !Number.isFinite(o) || !Number.isFinite(l) || !Number.isFinite(d) || i <= 0 || n <= 0 || s <= 0 || a <= 0 || a >= 180 || o <= 0)
|
|
615
615
|
return { x: 0, y: 0, z: 0 };
|
|
616
|
-
const c = 2 * s * Math.tan(a * Math.PI / 360), p = c / n, m = c * o / i, f = Math.sin(l),
|
|
616
|
+
const c = 2 * s * Math.tan(a * Math.PI / 360), p = c / n, m = c * o / i, f = Math.sin(l), g = Math.cos(l), b = -f, x = g, v = -g, w = -f, y = -e * m * d, C = t * p * d;
|
|
617
617
|
return {
|
|
618
|
-
x:
|
|
619
|
-
y:
|
|
618
|
+
x: b * y + v * C,
|
|
619
|
+
y: x * y + w * C,
|
|
620
620
|
z: 0
|
|
621
621
|
};
|
|
622
622
|
}
|
|
@@ -732,19 +732,19 @@ function Ur(r, e, t) {
|
|
|
732
732
|
const s = 1 / t.maxScalePerFrame;
|
|
733
733
|
return Math.max(s, Math.min(t.maxScalePerFrame, n));
|
|
734
734
|
}
|
|
735
|
-
const
|
|
735
|
+
const ht = 500, ii = 2e5, pt = 0.95, ni = -Math.PI / 2, ri = Y.degToRad(55), _r = 1e3, Hr = 2e6;
|
|
736
736
|
function ge(r, e, t = 1e-4) {
|
|
737
737
|
return Math.abs(r - e) <= t;
|
|
738
738
|
}
|
|
739
739
|
class qr {
|
|
740
740
|
constructor() {
|
|
741
|
-
u(this, "orbitTarget", new
|
|
741
|
+
u(this, "orbitTarget", new R(0, 0, 0));
|
|
742
742
|
u(this, "orbitDistance", 14e3);
|
|
743
|
-
u(this, "orbitYaw",
|
|
744
|
-
u(this, "orbitPitch",
|
|
743
|
+
u(this, "orbitYaw", ni);
|
|
744
|
+
u(this, "orbitPitch", ri);
|
|
745
745
|
u(this, "enabled", !0);
|
|
746
|
-
u(this, "orbitDistanceMin",
|
|
747
|
-
u(this, "orbitDistanceMax",
|
|
746
|
+
u(this, "orbitDistanceMin", ht);
|
|
747
|
+
u(this, "orbitDistanceMax", ii);
|
|
748
748
|
u(this, "viewportSnapshotBefore3D", null);
|
|
749
749
|
u(this, "orbitSnapshotOn3DEntry", null);
|
|
750
750
|
u(this, "dragMode", null);
|
|
@@ -785,7 +785,7 @@ class qr {
|
|
|
785
785
|
fit3D(e, t) {
|
|
786
786
|
const i = this.runtime;
|
|
787
787
|
if (!i) return;
|
|
788
|
-
const n = Math.max(1, (t == null ? void 0 : t.padding) ?? 1.15), s = e.getSize(new
|
|
788
|
+
const n = Math.max(1, (t == null ? void 0 : t.padding) ?? 1.15), s = e.getSize(new R()), a = e.getCenter(new R());
|
|
789
789
|
this.orbitTarget.set(a.x, a.y, a.z);
|
|
790
790
|
const o = $r({
|
|
791
791
|
xmin: e.min.x,
|
|
@@ -794,9 +794,9 @@ class qr {
|
|
|
794
794
|
ymax: e.max.y,
|
|
795
795
|
fovDeg: i.camera3d.fov,
|
|
796
796
|
orbitPitchRad: this.orbitPitch,
|
|
797
|
-
ndcBand:
|
|
797
|
+
ndcBand: pt
|
|
798
798
|
}), l = i.camera3d.fov * Math.PI / 180, d = 2 * Math.atan(Math.tan(l / 2) * Math.max(i.camera3d.aspect, 1e-6)), c = Math.max(Math.min(l, d) / 2, 1e-6), p = Math.max(s.length() / 2, 1e-6) / Math.sin(c) * n, h = Math.max(o, p);
|
|
799
|
-
this.orbitDistanceMin = h <
|
|
799
|
+
this.orbitDistanceMin = h < ht ? Math.max(h * 0.02, 1e-6) : ht, this.orbitDistanceMax = Math.max(ii, h * 20), this.orbitDistance = this.clampDistance(h), this.syncPerspectiveCamera();
|
|
800
800
|
}
|
|
801
801
|
getVisibleDocumentRect() {
|
|
802
802
|
const e = this.runtime;
|
|
@@ -950,9 +950,9 @@ class qr {
|
|
|
950
950
|
orbitDistanceMin: this.orbitDistanceMin,
|
|
951
951
|
orbitDistanceMax: this.orbitDistanceMax,
|
|
952
952
|
useFixedOrientation: e,
|
|
953
|
-
fixedOrbitYaw:
|
|
954
|
-
fixedOrbitPitch:
|
|
955
|
-
ndcBand:
|
|
953
|
+
fixedOrbitYaw: ni,
|
|
954
|
+
fixedOrbitPitch: ri,
|
|
955
|
+
ndcBand: pt
|
|
956
956
|
});
|
|
957
957
|
this.orbitTarget.set(a.orbitTarget.x, a.orbitTarget.y, a.orbitTarget.z), this.orbitDistance = this.clampDistance(a.orbitDistance), this.orbitYaw = a.orbitYaw, this.orbitPitch = a.orbitPitch;
|
|
958
958
|
}
|
|
@@ -969,7 +969,7 @@ class qr {
|
|
|
969
969
|
viewportHeightPx: n,
|
|
970
970
|
orthoFrustumMin: c,
|
|
971
971
|
orthoFrustumMax: p,
|
|
972
|
-
ndcBand:
|
|
972
|
+
ndcBand: pt
|
|
973
973
|
}), m = h.orthoFrustumSize > 0 ? h.orthoFrustumSize : o, f = o / 2;
|
|
974
974
|
e.setOrthographicViewport({
|
|
975
975
|
left: -f * s,
|
|
@@ -986,7 +986,7 @@ class qr {
|
|
|
986
986
|
syncPerspectiveCamera(e = {}) {
|
|
987
987
|
const t = this.runtime;
|
|
988
988
|
if (!t) return;
|
|
989
|
-
const i = Math.cos(this.orbitPitch), n = new
|
|
989
|
+
const i = Math.cos(this.orbitPitch), n = new R(
|
|
990
990
|
this.orbitTarget.x + this.orbitDistance * Math.cos(this.orbitYaw) * i,
|
|
991
991
|
this.orbitTarget.y + this.orbitDistance * Math.sin(this.orbitYaw) * i,
|
|
992
992
|
this.orbitTarget.z + this.orbitDistance * Math.sin(this.orbitPitch)
|
|
@@ -1019,7 +1019,7 @@ class qr {
|
|
|
1019
1019
|
const t = [];
|
|
1020
1020
|
for (const i of [-1, 1])
|
|
1021
1021
|
for (const n of [-1, 1]) {
|
|
1022
|
-
const s = new
|
|
1022
|
+
const s = new R(i, n, -1).unproject(e.camera3d), o = new R(i, n, 1).unproject(e.camera3d).sub(s).normalize();
|
|
1023
1023
|
if (Math.abs(o.z) < 1e-8) continue;
|
|
1024
1024
|
const l = (0 - s.z) / o.z;
|
|
1025
1025
|
!Number.isFinite(l) || l < 0 || t.push({
|
|
@@ -1062,9 +1062,9 @@ class qr {
|
|
|
1062
1062
|
}
|
|
1063
1063
|
}
|
|
1064
1064
|
}
|
|
1065
|
-
const Yr = new
|
|
1066
|
-
"left-rotate": { LEFT:
|
|
1067
|
-
"left-pan": { LEFT:
|
|
1065
|
+
const Yr = new R(2.4, -2.7, 1.7), Wr = new R(0, 0, 0.65), Gr = Math.PI, Xr = !0, Kr = new R(1.25, -1.5, 0.85).normalize(), Jr = 1.25, Zr = 0.4, Qr = 12, es = 1e3, ts = 20, is = 0.1, ns = 0.2, vn = "left-rotate", rs = {
|
|
1066
|
+
"left-rotate": { LEFT: se.ROTATE, MIDDLE: se.DOLLY, RIGHT: se.PAN },
|
|
1067
|
+
"left-pan": { LEFT: se.PAN, MIDDLE: se.DOLLY, RIGHT: se.ROTATE }
|
|
1068
1068
|
};
|
|
1069
1069
|
function ss({ radius: r, fovDeg: e }) {
|
|
1070
1070
|
const t = Math.max(r, 0.02), i = Y.degToRad(e), n = t / Math.sin(i * 0.5) * Jr;
|
|
@@ -1083,15 +1083,15 @@ function ss({ radius: r, fovDeg: e }) {
|
|
|
1083
1083
|
function as(r, e, t) {
|
|
1084
1084
|
e.minDistance = t.minDistance, e.maxDistance = t.maxDistance, r.near = t.near, r.far = t.far, r.updateProjectionMatrix();
|
|
1085
1085
|
}
|
|
1086
|
-
function
|
|
1086
|
+
function si(r, e, t = vn) {
|
|
1087
1087
|
r.enableDamping = Xr, r.maxPolarAngle = Gr, r.dampingFactor = 0.1, r.enablePan = !0, r.screenSpacePanning = !0, r.mouseButtons = { ...rs[t] }, an.DEFAULT_UP.set(0, 0, 1), e.up.set(0, 0, 1);
|
|
1088
1088
|
}
|
|
1089
1089
|
function os(r, e, t, i) {
|
|
1090
1090
|
if (t.isEmpty()) return null;
|
|
1091
|
-
const n = t.getSize(new
|
|
1091
|
+
const n = t.getSize(new R()), s = t.getCenter(new R()), a = Math.max(n.length() * 0.5, 0.02), o = ss({ radius: a, fovDeg: i });
|
|
1092
1092
|
return e.target.copy(s), r.position.copy(s).addScaledVector(Kr, o.distance), as(r, e, o), r.updateMatrixWorld(), e.update(), o;
|
|
1093
1093
|
}
|
|
1094
|
-
const ls = 1e3, ds = 2, cs = -1e4, us = 1e4,
|
|
1094
|
+
const ls = 1e3, ds = 2, cs = -1e4, us = 1e4, ai = 1e3, hs = 2e6, ps = 1.15, ms = 1, fs = new sn(Math.PI / 2, 0, 0), vs = new it().setFromEuler(fs), gs = new R(0, 1, 0);
|
|
1095
1095
|
class bs {
|
|
1096
1096
|
constructor(e) {
|
|
1097
1097
|
u(this, "canvasArea");
|
|
@@ -1109,10 +1109,10 @@ class bs {
|
|
|
1109
1109
|
u(this, "ownedObjects", /* @__PURE__ */ new Set());
|
|
1110
1110
|
u(this, "overlays", /* @__PURE__ */ new Map());
|
|
1111
1111
|
u(this, "eventCleanups", []);
|
|
1112
|
-
u(this, "raycaster", new
|
|
1113
|
-
u(this, "pointerNdc", new
|
|
1114
|
-
u(this, "reuseVector", new
|
|
1115
|
-
u(this, "reuseVector2", new
|
|
1112
|
+
u(this, "raycaster", new dt());
|
|
1113
|
+
u(this, "pointerNdc", new Z());
|
|
1114
|
+
u(this, "reuseVector", new R());
|
|
1115
|
+
u(this, "reuseVector2", new R());
|
|
1116
1116
|
u(this, "viewModeValue");
|
|
1117
1117
|
u(this, "initialized", !1);
|
|
1118
1118
|
u(this, "disposed", !1);
|
|
@@ -1148,7 +1148,7 @@ class bs {
|
|
|
1148
1148
|
u(this, "volumeTransmissionFailed", !1);
|
|
1149
1149
|
u(this, "eeveeSphereProbeTransmission", new kr());
|
|
1150
1150
|
u(this, "eeveeSphereProbeTransmissionFailed", !1);
|
|
1151
|
-
this.options = e, this.transparentHdrBackdropBlurriness = e.transparentHdrBackdropBlurriness ?? 0, this.canvasArea = e.canvasArea, this.canvas = e.canvas, this.viewModeValue = e.initialViewMode ?? "2d", this.navigationPolicyValue = e.navigationPolicy ?? "legacy", this.previewDragPreset = e.previewDragPreset ?? vn, this.environmentBackgroundCapable = e.environment !== void 0 && e.environment !== "room", this.environmentRotationDegrees =
|
|
1151
|
+
this.options = e, this.transparentHdrBackdropBlurriness = e.transparentHdrBackdropBlurriness ?? 0, this.canvasArea = e.canvasArea, this.canvas = e.canvas, this.viewModeValue = e.initialViewMode ?? "2d", this.navigationPolicyValue = e.navigationPolicy ?? "legacy", this.previewDragPreset = e.previewDragPreset ?? vn, this.environmentBackgroundCapable = e.environment !== void 0 && e.environment !== "room", this.environmentRotationDegrees = li(e.environmentRotation ?? 0), this.overlayRoot.name = "scene-runtime:overlays", this.scene.add(this.overlayRoot);
|
|
1152
1152
|
}
|
|
1153
1153
|
initialize() {
|
|
1154
1154
|
if (this.disposed) throw new Error("SceneRuntime has been disposed.");
|
|
@@ -1165,7 +1165,7 @@ class bs {
|
|
|
1165
1165
|
}), this.options.clearColor !== void 0 && this.renderer.setClearColor(new tt(this.options.clearColor));
|
|
1166
1166
|
const s = Math.max(1, this.canvasArea.clientWidth || 1), a = Math.max(1, this.canvasArea.clientHeight || 1), o = s / a;
|
|
1167
1167
|
if (this.renderer.setPixelRatio(this.readDevicePixelRatio()), this.renderer.setSize(s, a, !1), this.options.environment) {
|
|
1168
|
-
const l = (e == null ? void 0 : e.createEnvironment) ??
|
|
1168
|
+
const l = (e == null ? void 0 : e.createEnvironment) ?? oi;
|
|
1169
1169
|
this.scene.environmentIntensity = ms, this.applyEnvironmentRotations();
|
|
1170
1170
|
const d = ++this.environmentLoadGeneration, c = l(this.renderer, this.options.environment);
|
|
1171
1171
|
ys(c) ? c.then(
|
|
@@ -1175,13 +1175,13 @@ class bs {
|
|
|
1175
1175
|
}
|
|
1176
1176
|
) : this.applyEnvironmentResource(c, d);
|
|
1177
1177
|
}
|
|
1178
|
-
this.camera2d = new
|
|
1179
|
-
LEFT:
|
|
1180
|
-
MIDDLE:
|
|
1181
|
-
RIGHT:
|
|
1178
|
+
this.camera2d = new Pt(-o, o, 1, -1, cs, us), this.camera2d.position.set(0, 0, 1), this.camera2d.lookAt(0, 0, 0), this.camera3d = new dn(40, o, ai, hs), this.camera3d.up.set(0, 0, 1), this.camera3d.position.set(1e4, 0, 1e4), this.camera3d.lookAt(0, 0, 0), this.controls2d = i(this.camera2d, this.renderer.domElement), this.controls2d.enableRotate = !1, this.controls2d.screenSpacePanning = !0, this.controls2d.zoomToCursor = !0, this.controls2d.minZoom = 2e-3, this.controls2d.maxZoom = 5e4, this.controls2d.mouseButtons = {
|
|
1179
|
+
LEFT: se.PAN,
|
|
1180
|
+
MIDDLE: se.DOLLY,
|
|
1181
|
+
RIGHT: se.PAN
|
|
1182
1182
|
}, this.controls2d.touches = {
|
|
1183
|
-
ONE:
|
|
1184
|
-
TWO:
|
|
1183
|
+
ONE: Ht.PAN,
|
|
1184
|
+
TWO: Ht.DOLLY_PAN
|
|
1185
1185
|
}, 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);
|
|
1186
1186
|
}
|
|
1187
1187
|
get isInitialized() {
|
|
@@ -1228,7 +1228,7 @@ class bs {
|
|
|
1228
1228
|
this.viewerOrbit ?? (this.viewerOrbit = new qr()), this.viewerOrbit.attach(this);
|
|
1229
1229
|
return;
|
|
1230
1230
|
}
|
|
1231
|
-
(t = this.viewerOrbit) == null || t.setEnabled(!1), (i = this.viewerOrbit) == null || i.dispose(), this.viewerOrbit = null, this.controls3d.enabled = e === "preview" && this.viewModeValue === "3d", e === "preview" && (
|
|
1231
|
+
(t = this.viewerOrbit) == null || t.setEnabled(!1), (i = this.viewerOrbit) == null || i.dispose(), this.viewerOrbit = null, this.controls3d.enabled = e === "preview" && this.viewModeValue === "3d", e === "preview" && (si(this.controls3d, this.camera3d, this.previewDragPreset), this.camera3d.position.copy(Yr), this.controls3d.target.copy(Wr), this.controls3d.update());
|
|
1232
1232
|
}
|
|
1233
1233
|
}
|
|
1234
1234
|
/**
|
|
@@ -1237,7 +1237,7 @@ class bs {
|
|
|
1237
1237
|
* handed to OrbitControls.
|
|
1238
1238
|
*/
|
|
1239
1239
|
setPreviewDragPreset(e) {
|
|
1240
|
-
this.previewDragPreset !== e && (this.previewDragPreset = e, !(!this.initialized || this.navigationPolicyValue !== "preview") && (
|
|
1240
|
+
this.previewDragPreset !== e && (this.previewDragPreset = e, !(!this.initialized || this.navigationPolicyValue !== "preview") && (si(this.controls3d, this.camera3d, e), this.requestRender()));
|
|
1241
1241
|
}
|
|
1242
1242
|
/**
|
|
1243
1243
|
* Drives OrbitControls once per frame. Damping mutates the camera inside
|
|
@@ -1259,7 +1259,7 @@ class bs {
|
|
|
1259
1259
|
async setEnvironment(e) {
|
|
1260
1260
|
var n;
|
|
1261
1261
|
if (this.disposed || !this.renderer) return !1;
|
|
1262
|
-
const t = ++this.environmentLoadGeneration, i = ((n = this.options.factories) == null ? void 0 : n.createEnvironment) ??
|
|
1262
|
+
const t = ++this.environmentLoadGeneration, i = ((n = this.options.factories) == null ? void 0 : n.createEnvironment) ?? oi;
|
|
1263
1263
|
try {
|
|
1264
1264
|
const s = await i(this.renderer, e), a = this.applyEnvironmentResource(s, t);
|
|
1265
1265
|
return a && (this.environmentBackgroundCapable = e !== "room"), a;
|
|
@@ -1276,7 +1276,7 @@ class bs {
|
|
|
1276
1276
|
setEnvironmentRotation(e) {
|
|
1277
1277
|
var i;
|
|
1278
1278
|
if (this.disposed || !Number.isFinite(e)) return !1;
|
|
1279
|
-
const t =
|
|
1279
|
+
const t = li(e);
|
|
1280
1280
|
return t === this.environmentRotationDegrees || (this.environmentRotationDegrees = t, this.applyEnvironmentRotations(), (i = this.hdrTransparentBackdrop) == null || i.setRotationDegrees(this.environmentRotationDegrees), this.requestRender()), !0;
|
|
1281
1281
|
}
|
|
1282
1282
|
getEnvironmentRotation() {
|
|
@@ -1322,7 +1322,7 @@ class bs {
|
|
|
1322
1322
|
if (!this.mountedObjects.has(e) && e.parent !== this.scene) return !1;
|
|
1323
1323
|
e.removeFromParent(), this.mountedObjects.delete(e), this.markTransmissionCachesDirty();
|
|
1324
1324
|
const i = this.ownedObjects.delete(e);
|
|
1325
|
-
return (t.dispose === !0 || t.dispose === void 0 && i) &&
|
|
1325
|
+
return (t.dispose === !0 || t.dispose === void 0 && i) && Kt(e), this.requestRender(), !0;
|
|
1326
1326
|
}
|
|
1327
1327
|
setObjectVisible(e, t) {
|
|
1328
1328
|
e.visible !== t && (e.visible = t, this.markTransmissionCachesDirty(), this.requestRender());
|
|
@@ -1332,7 +1332,7 @@ class bs {
|
|
|
1332
1332
|
}
|
|
1333
1333
|
removeOverlay(e, t = {}) {
|
|
1334
1334
|
const i = this.overlays.get(e);
|
|
1335
|
-
return i ? (this.overlays.delete(e), i.object.removeFromParent(), (t.dispose === !0 || t.dispose === void 0 && i.owned) &&
|
|
1335
|
+
return i ? (this.overlays.delete(e), i.object.removeFromParent(), (t.dispose === !0 || t.dispose === void 0 && i.owned) && Kt(i.object), this.requestRender(), i.object) : null;
|
|
1336
1336
|
}
|
|
1337
1337
|
setHighlight(e, t = {}) {
|
|
1338
1338
|
if (!e) {
|
|
@@ -1355,7 +1355,7 @@ class bs {
|
|
|
1355
1355
|
if (!this.camera2d || !this.camera3d) return !1;
|
|
1356
1356
|
const i = this.resolveBox3(e);
|
|
1357
1357
|
if (!i || i.isEmpty()) return !1;
|
|
1358
|
-
const n = i.getSize(new
|
|
1358
|
+
const n = i.getSize(new R()), s = i.getCenter(new R());
|
|
1359
1359
|
if (![n.x, n.y, n.z, s.x, s.y, s.z].every(Number.isFinite)) return !1;
|
|
1360
1360
|
const a = Math.max(1, t.padding ?? 1.05);
|
|
1361
1361
|
if ((t.viewMode ?? this.viewModeValue) === "2d") {
|
|
@@ -1369,7 +1369,7 @@ class bs {
|
|
|
1369
1369
|
else {
|
|
1370
1370
|
const l = s.clone(), d = this.camera3d.fov * Math.PI / 180, c = 2 * Math.atan(Math.tan(d / 2) * Math.max(this.camera3d.aspect, 1e-6)), p = Math.max(n.length() / 2, 1e-6), h = Math.max(Math.min(d, c) / 2, 1e-6), m = p / Math.sin(h) * a, f = this.camera3d.position.clone().sub(this.controls3d.target);
|
|
1371
1371
|
f.lengthSq() <= 1e-12 && f.set(1, -1, 1), f.normalize(), this.controls3d.target.copy(l), this.camera3d.position.copy(l).addScaledVector(f, m), this.camera3d.lookAt(l), this.camera3d.near = Math.min(
|
|
1372
|
-
|
|
1372
|
+
ai,
|
|
1373
1373
|
Math.max(m * 0.01, 1e-6)
|
|
1374
1374
|
), this.camera3d.updateProjectionMatrix(), this.controls3d.update();
|
|
1375
1375
|
}
|
|
@@ -1434,11 +1434,11 @@ class bs {
|
|
|
1434
1434
|
}
|
|
1435
1435
|
applyPreviewOrbitSnapshot(e) {
|
|
1436
1436
|
if (!this.camera3d || !this.controls3d) return !1;
|
|
1437
|
-
const t = Math.cos(e.pitch), i = new
|
|
1437
|
+
const t = Math.cos(e.pitch), i = new R(e.targetX, e.targetY, e.targetZ), n = Y.clamp(
|
|
1438
1438
|
e.distance,
|
|
1439
1439
|
this.controls3d.minDistance,
|
|
1440
1440
|
this.controls3d.maxDistance
|
|
1441
|
-
), s = new
|
|
1441
|
+
), s = new R(
|
|
1442
1442
|
i.x + n * Math.cos(e.yaw) * t,
|
|
1443
1443
|
i.y + n * Math.sin(e.yaw) * t,
|
|
1444
1444
|
i.z + n * Math.sin(e.pitch)
|
|
@@ -1471,36 +1471,36 @@ class bs {
|
|
|
1471
1471
|
};
|
|
1472
1472
|
}
|
|
1473
1473
|
renderOrthographicPreview(e, t, i) {
|
|
1474
|
-
var
|
|
1474
|
+
var T;
|
|
1475
1475
|
if (!this.renderer || this.disposed || t.parent || !xs(i)) return !1;
|
|
1476
|
-
const n = Math.max(1, Math.floor(e.clientWidth || e.width || 0)), s = Math.max(1, Math.floor(e.clientHeight || e.height || 0)), a = this.resolveRendererPixelRatio(), o = Math.min(2, a), l = Math.max(1, Math.floor(n * o)), d = Math.max(1, Math.floor(s * o)), c = l / a, p = d / a, h = Math.min(c, p), m = (i.minX + i.maxX) / 2, f = (i.minY + i.maxY) / 2,
|
|
1477
|
-
|
|
1478
|
-
const w = this.getOrCreatePreviewScene(),
|
|
1479
|
-
|
|
1480
|
-
const
|
|
1476
|
+
const n = Math.max(1, Math.floor(e.clientWidth || e.width || 0)), s = Math.max(1, Math.floor(e.clientHeight || e.height || 0)), a = this.resolveRendererPixelRatio(), o = Math.min(2, a), l = Math.max(1, Math.floor(n * o)), d = Math.max(1, Math.floor(s * o)), c = l / a, p = d / a, h = Math.min(c, p), m = (i.minX + i.maxX) / 2, f = (i.minY + i.maxY) / 2, b = Math.max(i.maxX - i.minX, i.maxY - i.minY, 1) * ps / 2, x = this.getOrCreatePreviewRenderTarget(l, d), v = this.getOrCreatePreviewCamera();
|
|
1477
|
+
v.left = -b, v.right = b, v.top = b, v.bottom = -b, v.position.set(m, f, 1), v.up.copy(((T = this.camera2d) == null ? void 0 : T.up) ?? new R(0, 1, 0)), v.lookAt(m, f, 0), v.updateProjectionMatrix(), v.updateMatrixWorld(!0);
|
|
1478
|
+
const w = this.getOrCreatePreviewScene(), y = this.renderer, C = y.getRenderTarget(), k = y.getClearAlpha(), E = y.autoClear, P = new $n();
|
|
1479
|
+
y.getViewport(P);
|
|
1480
|
+
const D = y.getScissorTest();
|
|
1481
1481
|
w.add(t);
|
|
1482
1482
|
try {
|
|
1483
|
-
|
|
1483
|
+
y.setRenderTarget(x), y.setViewport(0, 0, c, p), y.setScissorTest(!1), y.setClearAlpha(0), y.autoClear = !1, y.clear(), y.setViewport(
|
|
1484
1484
|
Math.floor((c - h) / 2),
|
|
1485
1485
|
Math.floor((p - h) / 2),
|
|
1486
1486
|
h,
|
|
1487
1487
|
h
|
|
1488
|
-
),
|
|
1489
|
-
const
|
|
1490
|
-
return
|
|
1488
|
+
), y.render(w, v);
|
|
1489
|
+
const M = this.getOrCreatePreviewPixelBuffer(l, d);
|
|
1490
|
+
return y.readRenderTargetPixels(x, 0, 0, l, d, M), this.blitPreviewPixelsToCanvas(e, M, l, d);
|
|
1491
1491
|
} finally {
|
|
1492
|
-
t.removeFromParent(),
|
|
1492
|
+
t.removeFromParent(), y.setRenderTarget(C), y.setClearAlpha(k), y.autoClear = E, y.setViewport(
|
|
1493
1493
|
P.x,
|
|
1494
1494
|
P.y,
|
|
1495
1495
|
P.z,
|
|
1496
1496
|
P.w
|
|
1497
|
-
),
|
|
1497
|
+
), y.setScissorTest(D), this.requestRender();
|
|
1498
1498
|
}
|
|
1499
1499
|
}
|
|
1500
1500
|
bindRuntimeEvent(e, t, i, n) {
|
|
1501
1501
|
this.listen(e, t, i, n);
|
|
1502
1502
|
}
|
|
1503
|
-
clientToNdc(e, t, i = new
|
|
1503
|
+
clientToNdc(e, t, i = new Z()) {
|
|
1504
1504
|
var a;
|
|
1505
1505
|
const n = (a = this.renderer) == null ? void 0 : a.domElement;
|
|
1506
1506
|
if (!n) return null;
|
|
@@ -1512,9 +1512,9 @@ class bs {
|
|
|
1512
1512
|
}
|
|
1513
1513
|
screenToWorldOnPlane(e, t, i = 0) {
|
|
1514
1514
|
const n = this.clientToNdc(e, t, this.pointerNdc);
|
|
1515
|
-
return !n || !this.activeCamera ? null : (this.raycaster.setFromCamera(n, this.activeCamera), this.raycaster.ray.intersectPlane(new cn(new
|
|
1515
|
+
return !n || !this.activeCamera ? null : (this.raycaster.setFromCamera(n, this.activeCamera), this.raycaster.ray.intersectPlane(new cn(new R(0, 0, 1), -i), new R()));
|
|
1516
1516
|
}
|
|
1517
|
-
worldToClient(e, t = new
|
|
1517
|
+
worldToClient(e, t = new Z()) {
|
|
1518
1518
|
var a;
|
|
1519
1519
|
const i = (a = this.renderer) == null ? void 0 : a.domElement;
|
|
1520
1520
|
if (!i || !this.activeCamera) return null;
|
|
@@ -1555,7 +1555,7 @@ class bs {
|
|
|
1555
1555
|
if (this.disposed || this.animationLoopActive) return;
|
|
1556
1556
|
this.animationLoopActive = !0, this.infoFrames = 0, this.infoLastTime = performance.now();
|
|
1557
1557
|
const t = e.infoUpdateIntervalMs ?? ls, i = (n = performance.now()) => {
|
|
1558
|
-
var o, l, d, c, p, h, m, f,
|
|
1558
|
+
var o, l, d, c, p, h, m, f, g;
|
|
1559
1559
|
if (!this.animationLoopActive || this.disposed) {
|
|
1560
1560
|
this.animationFrameId = null;
|
|
1561
1561
|
return;
|
|
@@ -1566,18 +1566,18 @@ class bs {
|
|
|
1566
1566
|
let a = !1;
|
|
1567
1567
|
if (this.renderRequested && (((c = e.shouldRender) == null ? void 0 : c.call(e, n)) ?? !0)) {
|
|
1568
1568
|
(p = e.beforeRender) == null || p.call(e, n);
|
|
1569
|
-
const
|
|
1569
|
+
const b = (h = e.renderExtension) == null ? void 0 : h.beforeRender(this.renderer, this.scene, this.activeCamera, n);
|
|
1570
1570
|
try {
|
|
1571
1571
|
this.renderScene();
|
|
1572
1572
|
} finally {
|
|
1573
|
-
|
|
1573
|
+
b == null || b();
|
|
1574
1574
|
}
|
|
1575
1575
|
this.renderRequested = !1, a = !0, (m = e.afterRender) == null || m.call(e, n);
|
|
1576
1576
|
}
|
|
1577
1577
|
if (this.infoFrames += 1, n - this.infoLastTime >= t) {
|
|
1578
|
-
const
|
|
1579
|
-
this.fpsCurrent = this.infoFrames * 1e3 /
|
|
1580
|
-
} else a && ((
|
|
1578
|
+
const b = Math.max(1, n - this.infoLastTime);
|
|
1579
|
+
this.fpsCurrent = this.infoFrames * 1e3 / b, this.infoFrames = 0, this.infoLastTime = n, (f = e.onInfoUpdate) == null || f.call(e);
|
|
1580
|
+
} else a && ((g = e.onInfoUpdate) == null || g.call(e));
|
|
1581
1581
|
};
|
|
1582
1582
|
i();
|
|
1583
1583
|
}
|
|
@@ -1593,7 +1593,7 @@ class bs {
|
|
|
1593
1593
|
o
|
|
1594
1594
|
);
|
|
1595
1595
|
}
|
|
1596
|
-
const t = this.environmentBackgroundVisible && this.scene.environment instanceof
|
|
1596
|
+
const t = this.environmentBackgroundVisible && this.scene.environment instanceof lt && this.scene.environment.mapping === Me, i = this.options.transparentHdrBackdrop === !0 && !t, n = this.scene.background;
|
|
1597
1597
|
t && (this.scene.background = this.scene.environment);
|
|
1598
1598
|
try {
|
|
1599
1599
|
if (i && !e && !this.transmissionHdrBackdropFailed)
|
|
@@ -1668,7 +1668,7 @@ class bs {
|
|
|
1668
1668
|
return this.previewScene || (this.previewScene = new $e()), this.previewScene;
|
|
1669
1669
|
}
|
|
1670
1670
|
getOrCreatePreviewCamera() {
|
|
1671
|
-
return this.previewCamera || (this.previewCamera = new
|
|
1671
|
+
return this.previewCamera || (this.previewCamera = new Pt(-1, 1, 1, -1, -1e6, 1e6)), this.previewCamera;
|
|
1672
1672
|
}
|
|
1673
1673
|
getOrCreatePreviewRenderTarget(e, t) {
|
|
1674
1674
|
var i;
|
|
@@ -1705,10 +1705,10 @@ class bs {
|
|
|
1705
1705
|
return typeof e != "number" || !Number.isFinite(e) || e <= 0 ? 1 : Math.min(e, ds);
|
|
1706
1706
|
}
|
|
1707
1707
|
resolveBox3(e) {
|
|
1708
|
-
if (e instanceof
|
|
1709
|
-
if (e instanceof an) return new
|
|
1708
|
+
if (e instanceof Q) return e.clone();
|
|
1709
|
+
if (e instanceof an) return new Q().setFromObject(e);
|
|
1710
1710
|
const { minX: t, minY: i, maxX: n, maxY: s } = e;
|
|
1711
|
-
return ![t, i, n, s].every(Number.isFinite) || n < t || s < i ? null : new
|
|
1711
|
+
return ![t, i, n, s].every(Number.isFinite) || n < t || s < i ? null : new Q(new R(t, i, 0), new R(n, s, 0));
|
|
1712
1712
|
}
|
|
1713
1713
|
isDescendantOf(e, t) {
|
|
1714
1714
|
let i = e.parent;
|
|
@@ -1725,7 +1725,7 @@ class bs {
|
|
|
1725
1725
|
});
|
|
1726
1726
|
}
|
|
1727
1727
|
}
|
|
1728
|
-
function
|
|
1728
|
+
function oi(r, e) {
|
|
1729
1729
|
if (e === "room") {
|
|
1730
1730
|
const t = new Bn(r), i = new Zn(), n = t.fromScene(i);
|
|
1731
1731
|
return i.dispose(), t.dispose(), {
|
|
@@ -1735,7 +1735,7 @@ function ai(r, e) {
|
|
|
1735
1735
|
}
|
|
1736
1736
|
if (e.url.trim().length === 0)
|
|
1737
1737
|
throw new Error("Scene environment requires a non-empty URL.");
|
|
1738
|
-
return e.type === "image" ? new un().loadAsync(e.url).then((t) => (t.mapping = Me, t.colorSpace =
|
|
1738
|
+
return e.type === "image" ? new un().loadAsync(e.url).then((t) => (t.mapping = Me, t.colorSpace = zt, {
|
|
1739
1739
|
texture: t,
|
|
1740
1740
|
dispose: () => t.dispose()
|
|
1741
1741
|
})) : new hn().loadAsync(e.url).then((t) => (t.mapping = Me, {
|
|
@@ -1746,7 +1746,7 @@ function ai(r, e) {
|
|
|
1746
1746
|
function ys(r) {
|
|
1747
1747
|
return typeof (r == null ? void 0 : r.then) == "function";
|
|
1748
1748
|
}
|
|
1749
|
-
function
|
|
1749
|
+
function li(r) {
|
|
1750
1750
|
if (!Number.isFinite(r)) return 0;
|
|
1751
1751
|
const e = r % 360;
|
|
1752
1752
|
return e < 0 ? e + 360 : e;
|
|
@@ -1754,12 +1754,12 @@ function oi(r) {
|
|
|
1754
1754
|
function xs(r) {
|
|
1755
1755
|
return Number.isFinite(r.minX) && Number.isFinite(r.minY) && Number.isFinite(r.maxX) && Number.isFinite(r.maxY) && r.maxX >= r.minX && r.maxY >= r.minY;
|
|
1756
1756
|
}
|
|
1757
|
-
const
|
|
1757
|
+
const $t = 1, ws = 1024, Cs = 16, Es = 1e9;
|
|
1758
1758
|
function ks() {
|
|
1759
1759
|
return typeof globalThis.localStorage > "u" ? Ss() : {
|
|
1760
1760
|
read(r) {
|
|
1761
1761
|
try {
|
|
1762
|
-
const e = globalThis.localStorage.getItem(
|
|
1762
|
+
const e = globalThis.localStorage.getItem(di(r));
|
|
1763
1763
|
return e ? JSON.parse(e) : null;
|
|
1764
1764
|
} catch {
|
|
1765
1765
|
return null;
|
|
@@ -1767,7 +1767,7 @@ function ks() {
|
|
|
1767
1767
|
},
|
|
1768
1768
|
write(r, e) {
|
|
1769
1769
|
try {
|
|
1770
|
-
globalThis.localStorage.setItem(
|
|
1770
|
+
globalThis.localStorage.setItem(di(r), JSON.stringify(e));
|
|
1771
1771
|
} catch {
|
|
1772
1772
|
}
|
|
1773
1773
|
}
|
|
@@ -1787,12 +1787,12 @@ function Ss() {
|
|
|
1787
1787
|
function Ps(r, e) {
|
|
1788
1788
|
if (!r || !e) return null;
|
|
1789
1789
|
const t = r.read(e);
|
|
1790
|
-
return
|
|
1790
|
+
return Vt(t) ? t : null;
|
|
1791
1791
|
}
|
|
1792
|
-
function
|
|
1792
|
+
function Vt(r) {
|
|
1793
1793
|
if (!r || typeof r != "object") return !1;
|
|
1794
1794
|
const e = r;
|
|
1795
|
-
if (e.schemaVersion !==
|
|
1795
|
+
if (e.schemaVersion !== $t) return !1;
|
|
1796
1796
|
if (e.viewMode === "2d") {
|
|
1797
1797
|
const t = e.orthographic;
|
|
1798
1798
|
return !t || ![
|
|
@@ -1825,14 +1825,14 @@ function Ms(r, e, t) {
|
|
|
1825
1825
|
}
|
|
1826
1826
|
function Rs(r) {
|
|
1827
1827
|
return {
|
|
1828
|
-
schemaVersion:
|
|
1828
|
+
schemaVersion: $t,
|
|
1829
1829
|
viewMode: r.viewMode,
|
|
1830
1830
|
...r.orthographic ? { orthographic: r.orthographic } : {},
|
|
1831
1831
|
...r.orbit ? { orbit: r.orbit } : {}
|
|
1832
1832
|
};
|
|
1833
1833
|
}
|
|
1834
1834
|
function As(r, e) {
|
|
1835
|
-
if (
|
|
1835
|
+
if (!Vt(r)) return null;
|
|
1836
1836
|
const t = Is(e);
|
|
1837
1837
|
if (r.viewMode === "2d") {
|
|
1838
1838
|
const n = r.orthographic;
|
|
@@ -1860,13 +1860,13 @@ function Ds(r, e, t) {
|
|
|
1860
1860
|
const n = i * Cs;
|
|
1861
1861
|
return r >= t.minX - n && r <= t.maxX + n && e >= t.minY - n && e <= t.maxY + n;
|
|
1862
1862
|
}
|
|
1863
|
-
function
|
|
1864
|
-
return `nebula-viewer:camera:v${
|
|
1863
|
+
function di(r) {
|
|
1864
|
+
return `nebula-viewer:camera:v${$t}:${r}`;
|
|
1865
1865
|
}
|
|
1866
1866
|
function Ie(r) {
|
|
1867
|
-
return new
|
|
1868
|
-
new
|
|
1869
|
-
new
|
|
1867
|
+
return new Q(
|
|
1868
|
+
new R(r.minX, r.minY, r.minZ),
|
|
1869
|
+
new R(r.maxX, r.maxY, r.maxZ)
|
|
1870
1870
|
);
|
|
1871
1871
|
}
|
|
1872
1872
|
function gn(r) {
|
|
@@ -2096,7 +2096,7 @@ function $s(r, e) {
|
|
|
2096
2096
|
}
|
|
2097
2097
|
return `${r.toFixed(2)}${e ? ` ${e}` : ""}`;
|
|
2098
2098
|
}
|
|
2099
|
-
function
|
|
2099
|
+
function ci(r) {
|
|
2100
2100
|
return {
|
|
2101
2101
|
documentKey: r.documentKey,
|
|
2102
2102
|
filename: r.filename,
|
|
@@ -2108,7 +2108,7 @@ function di(r) {
|
|
|
2108
2108
|
units: r.units ?? { source: "mm" }
|
|
2109
2109
|
};
|
|
2110
2110
|
}
|
|
2111
|
-
const Vs = 160,
|
|
2111
|
+
const Vs = 160, ui = 5e3;
|
|
2112
2112
|
class Bs {
|
|
2113
2113
|
constructor(e) {
|
|
2114
2114
|
u(this, "layers", new Ts());
|
|
@@ -2240,7 +2240,7 @@ class Bs {
|
|
|
2240
2240
|
name: "AbortError",
|
|
2241
2241
|
code: "E_SUPERSEDED"
|
|
2242
2242
|
});
|
|
2243
|
-
return this.layers.sync(s, !1), this.blocks.sync(s, !1), this.syncHud(t.filename ?? o.filename ?? null), this.initialCameraRestored = this.tryRestoreCamera(n, o.bounds), !this.initialCameraRestored && o.bounds && this.host.fitBox3(Ie(o.bounds)), this.cameraSettled = !0, this.syncDisplayContext(), this.document =
|
|
2243
|
+
return this.layers.sync(s, !1), this.blocks.sync(s, !1), this.syncHud(t.filename ?? o.filename ?? null), this.initialCameraRestored = this.tryRestoreCamera(n, o.bounds), !this.initialCameraRestored && o.bounds && this.host.fitBox3(Ie(o.bounds)), this.cameraSettled = !0, this.syncDisplayContext(), this.document = ci({
|
|
2244
2244
|
documentKey: n,
|
|
2245
2245
|
filename: t.filename ?? o.filename ?? null,
|
|
2246
2246
|
phase: s.phase === "interactive" && !this.initialDemandSettled ? "initial-loading" : s.phase,
|
|
@@ -2376,7 +2376,7 @@ class Bs {
|
|
|
2376
2376
|
}
|
|
2377
2377
|
select(e) {
|
|
2378
2378
|
var t, i, n;
|
|
2379
|
-
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(
|
|
2379
|
+
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(Yt(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();
|
|
2380
2380
|
}
|
|
2381
2381
|
clearSelection() {
|
|
2382
2382
|
this.assertActive(), !(!this.inspector.selection && !this.inspector.textSelection) && (this.inspector.clear(), this.emit("inspector-change", { inspector: this.inspector }));
|
|
@@ -2411,8 +2411,8 @@ class Bs {
|
|
|
2411
2411
|
if (!e) return !1;
|
|
2412
2412
|
let { minX: t, minY: i, maxX: n, maxY: s } = e;
|
|
2413
2413
|
const a = n - t, o = s - i, l = Math.max(a, o);
|
|
2414
|
-
if (a > 0 && o > 0 && l <
|
|
2415
|
-
const c = (t + n) / 2, p = (i + s) / 2, h =
|
|
2414
|
+
if (a > 0 && o > 0 && l < ui) {
|
|
2415
|
+
const c = (t + n) / 2, p = (i + s) / 2, h = ui / 2;
|
|
2416
2416
|
t = c - h, i = p - h, n = c + h, s = p + h;
|
|
2417
2417
|
}
|
|
2418
2418
|
return this.host.fitBox3(Ie({
|
|
@@ -2427,7 +2427,7 @@ class Bs {
|
|
|
2427
2427
|
refreshInspectorDetails(e) {
|
|
2428
2428
|
const t = this.inspector.selection;
|
|
2429
2429
|
if (!t) return;
|
|
2430
|
-
const i = e.getBlockDetails(
|
|
2430
|
+
const i = e.getBlockDetails(Yt(t.id));
|
|
2431
2431
|
if (!i) return;
|
|
2432
2432
|
const n = this.inspector.details, s = n == null ? void 0 : n.bbox;
|
|
2433
2433
|
(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 }));
|
|
@@ -2509,7 +2509,7 @@ class Bs {
|
|
|
2509
2509
|
});
|
|
2510
2510
|
}
|
|
2511
2511
|
publishDocumentPhase(e) {
|
|
2512
|
-
this.document && (this.document =
|
|
2512
|
+
this.document && (this.document = ci({
|
|
2513
2513
|
documentKey: this.document.documentKey,
|
|
2514
2514
|
filename: this.document.filename,
|
|
2515
2515
|
phase: e,
|
|
@@ -2558,7 +2558,7 @@ function Le(r, e, t) {
|
|
|
2558
2558
|
const i = r.code, n = r.name, s = r.message.toLowerCase(), a = /external block|sidecar|variant .*fetch/.test(s), o = /annotation/.test(s), l = /font|troika/.test(s), d = i === "E_SUPERSEDED" ? "E_SUPERSEDED" : n === "AbortError" || i === "E_DISPOSED" ? "E_ABORTED" : a ? "E_SIDECAR_FETCH" : o ? "E_ANNOTATION" : l ? "E_FONT" : i === "E_SOURCE" ? "E_SOURCE" : i === "E_PACK_HTTP" || i === "E_PACK_NETWORK" ? "E_FETCH" : i === "E_HEADER" || i === "E_HEADER_JSON" || i === "E_UNSUPPORTED_PACK_VERSION" ? "E_PARSE_HEADER" : i === "E_WORKER" || i === "E_MAIN_BUFFER_PROTOCOL" || i === "E_MAIN_BUFFER_MISSING" || /worker/.test(s) ? "E_WORKER" : "E_PARSE_GEOMETRY";
|
|
2559
2559
|
return { code: d, stage: d === "E_FETCH" ? "source" : d === "E_PARSE_HEADER" ? "header" : d === "E_WORKER" ? "worker" : d === "E_PARSE_GEOMETRY" ? "geometry" : d === "E_SIDECAR_FETCH" ? "sidecar" : d === "E_ANNOTATION" ? "annotation" : d === "E_FONT" ? "font" : d === "E_ABORTED" || d === "E_SUPERSEDED" ? "lifecycle" : "source", fatal: e, source: t };
|
|
2560
2560
|
}
|
|
2561
|
-
const
|
|
2561
|
+
const hi = 1;
|
|
2562
2562
|
class Ws {
|
|
2563
2563
|
constructor(e) {
|
|
2564
2564
|
u(this, "startX", 0);
|
|
@@ -2604,10 +2604,10 @@ class Ws {
|
|
|
2604
2604
|
this.release(), this.resetMotion(), this.startX = 0, this.startY = 0, this.lastX = 0, this.lastY = 0;
|
|
2605
2605
|
}
|
|
2606
2606
|
isTrackingPrimaryPointer(e) {
|
|
2607
|
-
return this.primaryPointerDown || (e &
|
|
2607
|
+
return this.primaryPointerDown || (e & hi) === hi;
|
|
2608
2608
|
}
|
|
2609
2609
|
}
|
|
2610
|
-
function
|
|
2610
|
+
function Rt(r, e) {
|
|
2611
2611
|
return `${r}:${e}`;
|
|
2612
2612
|
}
|
|
2613
2613
|
class Gs {
|
|
@@ -2630,7 +2630,7 @@ class Gs {
|
|
|
2630
2630
|
this.expandedLayers.has(e) ? this.expandedLayers.delete(e) : this.expandedLayers.add(e), this.suppressedSelectionKey = null;
|
|
2631
2631
|
}
|
|
2632
2632
|
toggleBlockExpanded(e, t) {
|
|
2633
|
-
const i =
|
|
2633
|
+
const i = Rt(e, t);
|
|
2634
2634
|
this.expandedBlocks.has(i) ? this.expandedBlocks.delete(i) : this.expandedBlocks.add(i), this.suppressedSelectionKey = null;
|
|
2635
2635
|
}
|
|
2636
2636
|
prune(e, t) {
|
|
@@ -2642,7 +2642,7 @@ class Gs {
|
|
|
2642
2642
|
t.has(i) || this.blockVisibilitySnapshots.delete(i);
|
|
2643
2643
|
}
|
|
2644
2644
|
ensureSelectionVisible(e, t, i) {
|
|
2645
|
-
this.suppressedSelectionKey !== e && (this.suppressedSelectionKey !== null && (this.suppressedSelectionKey = null), this.expandedLayers.add(t), this.expandedBlocks.add(
|
|
2645
|
+
this.suppressedSelectionKey !== e && (this.suppressedSelectionKey !== null && (this.suppressedSelectionKey = null), this.expandedLayers.add(t), this.expandedBlocks.add(Rt(t, i)));
|
|
2646
2646
|
}
|
|
2647
2647
|
needsSelectionReveal(e) {
|
|
2648
2648
|
return this.revealedSelectionKey !== e;
|
|
@@ -2654,7 +2654,7 @@ class Gs {
|
|
|
2654
2654
|
this.revealedSelectionKey = null, this.suppressedSelectionKey = null;
|
|
2655
2655
|
}
|
|
2656
2656
|
}
|
|
2657
|
-
function
|
|
2657
|
+
function U(r) {
|
|
2658
2658
|
return r.replace(/[&<>"']/g, (e) => ({
|
|
2659
2659
|
"&": "&",
|
|
2660
2660
|
"<": "<",
|
|
@@ -2894,11 +2894,11 @@ function ta(r, e) {
|
|
|
2894
2894
|
const t = r.trim(), i = ea[t];
|
|
2895
2895
|
return i ? e.t(i) : t;
|
|
2896
2896
|
}
|
|
2897
|
-
const
|
|
2897
|
+
const Bt = yn({});
|
|
2898
2898
|
function ia(r) {
|
|
2899
2899
|
const e = /* @__PURE__ */ new Map();
|
|
2900
2900
|
for (const i of r.usages) {
|
|
2901
|
-
const n = e.get(i.layerIndex) ?? /* @__PURE__ */ new Map(), s =
|
|
2901
|
+
const n = e.get(i.layerIndex) ?? /* @__PURE__ */ new Map(), s = Rt(i.layerIndex, i.variantId);
|
|
2902
2902
|
let a = n.get(s);
|
|
2903
2903
|
a || (a = {
|
|
2904
2904
|
key: s,
|
|
@@ -2939,7 +2939,7 @@ function xn(r, e, t, i) {
|
|
|
2939
2939
|
const n = r.id;
|
|
2940
2940
|
return n.layerIndex !== e || n.variantId !== t ? !1 : i === void 0 ? !0 : n.instanceId === i;
|
|
2941
2941
|
}
|
|
2942
|
-
function
|
|
2942
|
+
function pi(r) {
|
|
2943
2943
|
const e = r.querySelector(".vui-lrow-insert.active") ?? r.querySelector(".vui-lrow-block.active");
|
|
2944
2944
|
if (!e) return !1;
|
|
2945
2945
|
const t = r.getBoundingClientRect(), i = e.getBoundingClientRect();
|
|
@@ -2989,14 +2989,14 @@ function aa(r, e) {
|
|
|
2989
2989
|
);
|
|
2990
2990
|
a && a.classList.add("active");
|
|
2991
2991
|
}
|
|
2992
|
-
function oa(r, e, t, i =
|
|
2992
|
+
function oa(r, e, t, i = Bt) {
|
|
2993
2993
|
var l;
|
|
2994
2994
|
const n = new Map(e.map((d) => [d.index, d]));
|
|
2995
2995
|
r.querySelectorAll(".vui-lrow[data-layer-index]:not(.vui-lrow-all)").forEach((d) => {
|
|
2996
2996
|
const c = n.get(Number(d.dataset.layerIndex));
|
|
2997
2997
|
if (!c) return;
|
|
2998
2998
|
const p = d.querySelector(".vui-lrow-eye");
|
|
2999
|
-
p && (p.textContent = c.visible ? "●" : "○", p.title = c.visible ? i.t("layer.hide") : i.t("layer.show")), d.classList.toggle("off", !c.visible), Cn(d,
|
|
2999
|
+
p && (p.textContent = c.visible ? "●" : "○", p.title = c.visible ? i.t("layer.hide") : i.t("layer.show")), d.classList.toggle("off", !c.visible), Cn(d, Ut(c));
|
|
3000
3000
|
});
|
|
3001
3001
|
const s = r.querySelector(".vui-lrow-all"), a = t === null ? "#c8c8c8" : Re(t);
|
|
3002
3002
|
(l = s == null ? void 0 : s.querySelector(".vui-lrow-clr")) == null || l.style.setProperty("background", a);
|
|
@@ -3005,7 +3005,7 @@ function oa(r, e, t, i = Vt) {
|
|
|
3005
3005
|
}
|
|
3006
3006
|
function la(r, e, t) {
|
|
3007
3007
|
var f;
|
|
3008
|
-
const i = t.text ??
|
|
3008
|
+
const i = t.text ?? Bt;
|
|
3009
3009
|
e.resetForScope(t.scopeKey);
|
|
3010
3010
|
const n = e.filterText.trim().toLowerCase(), s = t.layers.rows, a = ia(t.blocks);
|
|
3011
3011
|
if (r.list.replaceChildren(), r.count.textContent = String(s.length), s.length === 0) {
|
|
@@ -3013,9 +3013,9 @@ function la(r, e, t) {
|
|
|
3013
3013
|
return;
|
|
3014
3014
|
}
|
|
3015
3015
|
const o = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set();
|
|
3016
|
-
for (const
|
|
3017
|
-
o.add(
|
|
3018
|
-
for (const
|
|
3016
|
+
for (const g of s) {
|
|
3017
|
+
o.add(g.index);
|
|
3018
|
+
for (const b of a.get(g.index) ?? []) l.add(b.key);
|
|
3019
3019
|
}
|
|
3020
3020
|
e.prune(o, l);
|
|
3021
3021
|
const d = (f = t.selection) == null ? void 0 : f.id, c = d ? `${d.layerIndex}:${d.variantId}:${d.instanceId}` : null;
|
|
@@ -3025,41 +3025,41 @@ function la(r, e, t) {
|
|
|
3025
3025
|
<span class="vui-lrow-eye">◎</span>
|
|
3026
3026
|
<span class="vui-lrow-dot"></span>
|
|
3027
3027
|
<span class="vui-lrow-toggle placeholder">▶</span>
|
|
3028
|
-
<span class="vui-lrow-name">${
|
|
3029
|
-
<span class="vui-lrow-clr" style="background: ${t.layers.allColor == null ? "#c8c8c8" : `#${t.layers.allColor.toString(16).padStart(6, "0")}`}" title="${
|
|
3028
|
+
<span class="vui-lrow-name">${U(i.t("layer.all"))}</span>
|
|
3029
|
+
<span class="vui-lrow-clr" style="background: ${t.layers.allColor == null ? "#c8c8c8" : `#${t.layers.allColor.toString(16).padStart(6, "0")}`}" title="${U(i.t("layer.colorOverrideAll"))}">
|
|
3030
3030
|
<input type="color" value="#${(t.layers.allColor ?? 13158600).toString(16).padStart(6, "0")}">
|
|
3031
3031
|
</span>`;
|
|
3032
3032
|
const h = p.querySelector('input[type="color"]');
|
|
3033
3033
|
h && h.addEventListener("input", () => {
|
|
3034
|
-
var
|
|
3035
|
-
const
|
|
3036
|
-
(
|
|
3034
|
+
var x, v, w;
|
|
3035
|
+
const g = Number.parseInt(h.value.slice(1), 16), b = Number.isFinite(g) ? g : null;
|
|
3036
|
+
(x = t.beginLayerColorPreview) == null || x.call(t, h);
|
|
3037
3037
|
try {
|
|
3038
|
-
if (t.setAllLayerColor) t.setAllLayerColor(
|
|
3039
|
-
else for (const C of s) t.setLayerColor(C.index,
|
|
3040
|
-
const
|
|
3041
|
-
(
|
|
3038
|
+
if (t.setAllLayerColor) t.setAllLayerColor(b);
|
|
3039
|
+
else for (const C of s) t.setLayerColor(C.index, b);
|
|
3040
|
+
const y = b === null ? "#c8c8c8" : Re(b);
|
|
3041
|
+
(v = h.closest(".vui-lrow-clr")) == null || v.style.setProperty("background", y), mi(r.list, s, b);
|
|
3042
3042
|
} finally {
|
|
3043
3043
|
(w = t.endLayerColorPreview) == null || w.call(t, h);
|
|
3044
3044
|
}
|
|
3045
|
-
}), h == null || h.addEventListener("click", (
|
|
3045
|
+
}), h == null || h.addEventListener("click", (g) => g.stopPropagation());
|
|
3046
3046
|
const m = p.querySelector(".vui-lrow-clr");
|
|
3047
|
-
m && m.addEventListener("contextmenu", (
|
|
3048
|
-
var
|
|
3049
|
-
if (
|
|
3050
|
-
else for (const
|
|
3051
|
-
(
|
|
3047
|
+
m && m.addEventListener("contextmenu", (g) => {
|
|
3048
|
+
var b;
|
|
3049
|
+
if (g.preventDefault(), g.stopPropagation(), t.setAllLayerColor) t.setAllLayerColor(null);
|
|
3050
|
+
else for (const x of s) t.setLayerColor(x.index, null);
|
|
3051
|
+
(b = h == null ? void 0 : h.closest(".vui-lrow-clr")) == null || b.style.setProperty("background", "#c8c8c8"), h && (h.value = "#c8c8c8"), mi(r.list, s, null);
|
|
3052
3052
|
}), r.list.appendChild(p);
|
|
3053
|
-
for (const
|
|
3054
|
-
na(n,
|
|
3055
|
-
c && e.needsSelectionReveal(c) && (
|
|
3056
|
-
e.needsSelectionReveal(c) &&
|
|
3053
|
+
for (const g of s)
|
|
3054
|
+
na(n, g.name) && r.list.appendChild(da(g, e, t, a.get(g.index) ?? [], i));
|
|
3055
|
+
c && e.needsSelectionReveal(c) && (pi(r.list) && e.markSelectionRevealed(c), typeof requestAnimationFrame == "function" && requestAnimationFrame(() => {
|
|
3056
|
+
e.needsSelectionReveal(c) && pi(r.list) && e.markSelectionRevealed(c);
|
|
3057
3057
|
}));
|
|
3058
3058
|
}
|
|
3059
3059
|
function Re(r) {
|
|
3060
3060
|
return `#${r.toString(16).padStart(6, "0")}`;
|
|
3061
3061
|
}
|
|
3062
|
-
function
|
|
3062
|
+
function Ut(r) {
|
|
3063
3063
|
return r.color !== null ? Re(r.color) : Re(gn(r.sourceColor));
|
|
3064
3064
|
}
|
|
3065
3065
|
function Cn(r, e) {
|
|
@@ -3070,83 +3070,83 @@ function Cn(r, e) {
|
|
|
3070
3070
|
const i = r.querySelector('input[type="color"]');
|
|
3071
3071
|
i && i.value !== e && (i.value = e);
|
|
3072
3072
|
}
|
|
3073
|
-
function
|
|
3073
|
+
function mi(r, e, t) {
|
|
3074
3074
|
const i = new Map(e.map((n) => [n.index, n]));
|
|
3075
3075
|
r.querySelectorAll(".vui-lrow[data-layer-index]").forEach((n) => {
|
|
3076
3076
|
const s = i.get(Number(n.dataset.layerIndex));
|
|
3077
|
-
s && Cn(n, t === null ?
|
|
3077
|
+
s && Cn(n, t === null ? Ut(s) : Re(t));
|
|
3078
3078
|
});
|
|
3079
3079
|
}
|
|
3080
3080
|
function da(r, e, t, i, n) {
|
|
3081
|
-
const s = i.length > 0, a = e.expandedLayers.has(r.index), o =
|
|
3081
|
+
const s = i.length > 0, a = e.expandedLayers.has(r.index), o = Ut(r), l = document.createElement("div");
|
|
3082
3082
|
l.className = "vui-lrow-wrap";
|
|
3083
3083
|
const d = document.createElement("div");
|
|
3084
3084
|
d.className = `vui-lrow${r.visible ? "" : " off"}`, d.dataset.layerIndex = String(r.index);
|
|
3085
3085
|
const c = document.createElement("button");
|
|
3086
|
-
c.type = "button", c.className = "vui-lrow-eye", c.textContent = r.visible ? "●" : "○", c.title = r.visible ? n.t("layer.hide") : n.t("layer.show"), c.addEventListener("click", (
|
|
3087
|
-
|
|
3088
|
-
const
|
|
3089
|
-
c.textContent =
|
|
3086
|
+
c.type = "button", c.className = "vui-lrow-eye", c.textContent = r.visible ? "●" : "○", c.title = r.visible ? n.t("layer.hide") : n.t("layer.show"), c.addEventListener("click", (x) => {
|
|
3087
|
+
x.stopPropagation();
|
|
3088
|
+
const v = !r.visible;
|
|
3089
|
+
c.textContent = v ? "●" : "○", c.title = v ? n.t("layer.hide") : n.t("layer.show"), d.classList.toggle("off", !v), t.toggleLayer(r.index);
|
|
3090
3090
|
});
|
|
3091
3091
|
const p = document.createElement("span");
|
|
3092
3092
|
p.className = "vui-lrow-dot", p.style.background = o;
|
|
3093
3093
|
const h = document.createElement("button");
|
|
3094
3094
|
h.type = "button", h.className = `vui-lrow-toggle${s ? "" : " placeholder"}`, h.textContent = a ? "▼" : "▶", h.disabled = !s;
|
|
3095
|
-
const m = (
|
|
3096
|
-
if (
|
|
3095
|
+
const m = (x) => {
|
|
3096
|
+
if (x.stopPropagation(), !s) return;
|
|
3097
3097
|
e.toggleLayerExpanded(r.index);
|
|
3098
|
-
const
|
|
3099
|
-
h.textContent =
|
|
3098
|
+
const v = e.expandedLayers.has(r.index);
|
|
3099
|
+
h.textContent = v ? "▼" : "▶";
|
|
3100
3100
|
let w = l.querySelector(":scope > .vui-lrow-blocks");
|
|
3101
|
-
if (
|
|
3101
|
+
if (v)
|
|
3102
3102
|
if (w)
|
|
3103
3103
|
w.classList.add("open");
|
|
3104
3104
|
else {
|
|
3105
3105
|
w = document.createElement("div"), w.className = "vui-lrow-blocks open";
|
|
3106
|
-
for (const
|
|
3107
|
-
w.appendChild(
|
|
3106
|
+
for (const y of i)
|
|
3107
|
+
w.appendChild(fi(y, e, t, n));
|
|
3108
3108
|
l.appendChild(w);
|
|
3109
3109
|
}
|
|
3110
3110
|
else {
|
|
3111
3111
|
w == null || w.classList.remove("open");
|
|
3112
|
-
const
|
|
3113
|
-
|
|
3112
|
+
const y = l.closest(".vui-section-list") ?? l.parentElement;
|
|
3113
|
+
y && wn(y, d, 0);
|
|
3114
3114
|
}
|
|
3115
3115
|
};
|
|
3116
3116
|
h.addEventListener("click", m);
|
|
3117
3117
|
const f = document.createElement("span");
|
|
3118
3118
|
f.className = "vui-lrow-name", f.textContent = r.name || n.t("layer.unnamed"), f.title = r.name;
|
|
3119
|
-
const
|
|
3120
|
-
|
|
3121
|
-
const
|
|
3122
|
-
if (
|
|
3123
|
-
var
|
|
3124
|
-
const
|
|
3125
|
-
(
|
|
3119
|
+
const g = document.createElement("span");
|
|
3120
|
+
g.className = "vui-lrow-clr", g.style.background = o, g.title = n.t("layer.colorOverride");
|
|
3121
|
+
const b = document.createElement("input");
|
|
3122
|
+
if (b.type = "color", b.value = o, b.addEventListener("input", () => {
|
|
3123
|
+
var v, w;
|
|
3124
|
+
const x = Number.parseInt(b.value.slice(1), 16);
|
|
3125
|
+
(v = t.beginLayerColorPreview) == null || v.call(t, b);
|
|
3126
3126
|
try {
|
|
3127
|
-
t.setLayerColor(r.index, Number.isFinite(
|
|
3127
|
+
t.setLayerColor(r.index, Number.isFinite(x) ? x : null), p.style.background = b.value, g.style.background = b.value;
|
|
3128
3128
|
} finally {
|
|
3129
|
-
(w = t.endLayerColorPreview) == null || w.call(t,
|
|
3130
|
-
}
|
|
3131
|
-
}),
|
|
3132
|
-
|
|
3133
|
-
const
|
|
3134
|
-
|
|
3135
|
-
}),
|
|
3136
|
-
const
|
|
3137
|
-
if (
|
|
3129
|
+
(w = t.endLayerColorPreview) == null || w.call(t, b);
|
|
3130
|
+
}
|
|
3131
|
+
}), b.addEventListener("click", (x) => x.stopPropagation()), g.addEventListener("contextmenu", (x) => {
|
|
3132
|
+
x.preventDefault(), x.stopPropagation(), t.setLayerColor(r.index, null);
|
|
3133
|
+
const v = Re(gn(r.sourceColor));
|
|
3134
|
+
b.value = v, p.style.background = v, g.style.background = v;
|
|
3135
|
+
}), g.appendChild(b), d.append(c, p, h, f, g), d.addEventListener("click", (x) => {
|
|
3136
|
+
const v = x.target;
|
|
3137
|
+
if (v instanceof HTMLInputElement && v.type === "color" || v.closest(".vui-lrow-clr") || v.closest(".vui-lrow-toggle") || v.closest(".vui-lrow-eye")) return;
|
|
3138
3138
|
const w = !r.visible;
|
|
3139
3139
|
c.textContent = w ? "●" : "○", c.title = w ? n.t("layer.hide") : n.t("layer.show"), d.classList.toggle("off", !w), t.toggleLayer(r.index);
|
|
3140
3140
|
}), l.appendChild(d), s && a) {
|
|
3141
|
-
const
|
|
3142
|
-
|
|
3143
|
-
for (const
|
|
3144
|
-
|
|
3145
|
-
l.appendChild(
|
|
3141
|
+
const x = document.createElement("div");
|
|
3142
|
+
x.className = "vui-lrow-blocks open";
|
|
3143
|
+
for (const v of i)
|
|
3144
|
+
x.appendChild(fi(v, e, t, n));
|
|
3145
|
+
l.appendChild(x);
|
|
3146
3146
|
}
|
|
3147
3147
|
return l;
|
|
3148
3148
|
}
|
|
3149
|
-
function
|
|
3149
|
+
function fi(r, e, t, i) {
|
|
3150
3150
|
const n = document.createElement("div");
|
|
3151
3151
|
n.className = "vui-lrow-block-wrap";
|
|
3152
3152
|
const s = e.expandedBlocks.has(r.key), a = ra(r.inserts), o = xn(t.selection, r.layerIndex, r.variantId), l = document.createElement("div");
|
|
@@ -3154,44 +3154,44 @@ function mi(r, e, t, i) {
|
|
|
3154
3154
|
const d = document.createElement("button");
|
|
3155
3155
|
d.type = "button", d.className = "vui-lrow-block-visibility", et(d, a, i), d.addEventListener("click", (f) => {
|
|
3156
3156
|
if (f.stopPropagation(), a === "none") {
|
|
3157
|
-
const
|
|
3158
|
-
for (const
|
|
3159
|
-
const w = (
|
|
3160
|
-
|
|
3157
|
+
const b = e.blockVisibilitySnapshots.get(r.key), x = [];
|
|
3158
|
+
for (const v of r.inserts) {
|
|
3159
|
+
const w = (b == null ? void 0 : b.get(v.instanceId)) ?? !0;
|
|
3160
|
+
v.visible !== w && x.push({ insertId: v.insertId, visible: w });
|
|
3161
3161
|
}
|
|
3162
|
-
if (et(d, "all", i), n.querySelectorAll(".vui-lrow-insert-visibility").forEach((
|
|
3163
|
-
rt(
|
|
3164
|
-
}), t.batchToggleInserts &&
|
|
3165
|
-
t.batchToggleInserts(
|
|
3162
|
+
if (et(d, "all", i), n.querySelectorAll(".vui-lrow-insert-visibility").forEach((v) => {
|
|
3163
|
+
rt(v, !0, i);
|
|
3164
|
+
}), t.batchToggleInserts && x.length > 0)
|
|
3165
|
+
t.batchToggleInserts(x);
|
|
3166
3166
|
else
|
|
3167
|
-
for (const
|
|
3167
|
+
for (const v of x) t.toggleInsert(v.insertId, v.visible);
|
|
3168
3168
|
return;
|
|
3169
3169
|
}
|
|
3170
3170
|
e.blockVisibilitySnapshots.set(
|
|
3171
3171
|
r.key,
|
|
3172
|
-
new Map(r.inserts.map((
|
|
3172
|
+
new Map(r.inserts.map((b) => [b.instanceId, b.visible]))
|
|
3173
3173
|
);
|
|
3174
|
-
const
|
|
3175
|
-
if (et(d, "none", i), n.querySelectorAll(".vui-lrow-insert-visibility").forEach((
|
|
3176
|
-
rt(
|
|
3177
|
-
}), t.batchToggleInserts &&
|
|
3178
|
-
t.batchToggleInserts(
|
|
3174
|
+
const g = r.inserts.filter((b) => b.visible).map((b) => ({ insertId: b.insertId, visible: !1 }));
|
|
3175
|
+
if (et(d, "none", i), n.querySelectorAll(".vui-lrow-insert-visibility").forEach((b) => {
|
|
3176
|
+
rt(b, !1, i);
|
|
3177
|
+
}), t.batchToggleInserts && g.length > 0)
|
|
3178
|
+
t.batchToggleInserts(g);
|
|
3179
3179
|
else
|
|
3180
|
-
for (const
|
|
3180
|
+
for (const b of g) t.toggleInsert(b.insertId, !1);
|
|
3181
3181
|
});
|
|
3182
3182
|
const c = document.createElement("button");
|
|
3183
3183
|
c.type = "button", c.className = "vui-lrow-block-toggle", c.textContent = s ? "▼" : "▶";
|
|
3184
3184
|
const p = (f) => {
|
|
3185
3185
|
f.stopPropagation(), e.toggleBlockExpanded(r.layerIndex, r.variantId);
|
|
3186
|
-
const
|
|
3187
|
-
c.textContent =
|
|
3188
|
-
let
|
|
3189
|
-
if (
|
|
3190
|
-
|
|
3186
|
+
const g = e.expandedBlocks.has(r.key);
|
|
3187
|
+
c.textContent = g ? "▼" : "▶";
|
|
3188
|
+
let b = n.querySelector(":scope > .vui-lrow-inserts");
|
|
3189
|
+
if (g)
|
|
3190
|
+
b ? b.classList.add("open") : (b = vi(r, e, t, d, i), n.appendChild(b));
|
|
3191
3191
|
else {
|
|
3192
|
-
|
|
3193
|
-
const
|
|
3194
|
-
|
|
3192
|
+
b == null || b.classList.remove("open");
|
|
3193
|
+
const x = n.closest(".vui-section-list") ?? n.parentElement;
|
|
3194
|
+
x && wn(x, l, 24);
|
|
3195
3195
|
}
|
|
3196
3196
|
};
|
|
3197
3197
|
c.addEventListener("click", p);
|
|
@@ -3200,11 +3200,11 @@ function mi(r, e, t, i) {
|
|
|
3200
3200
|
const m = document.createElement("span");
|
|
3201
3201
|
return m.className = "vui-lrow-block-count", m.textContent = `×${r.inserts.length}`, l.append(d, c, h, m), r.inserts.length === 1 && l.addEventListener("click", () => {
|
|
3202
3202
|
if (!r.canHighlight) return;
|
|
3203
|
-
const f = r.inserts[0],
|
|
3204
|
-
e.markSelectionRevealed(
|
|
3205
|
-
}), n.appendChild(l), s && n.appendChild(
|
|
3203
|
+
const f = r.inserts[0], g = `${r.layerIndex}:${r.variantId}:${f.instanceId}`;
|
|
3204
|
+
e.markSelectionRevealed(g), t.selectInsert(f.insertId);
|
|
3205
|
+
}), n.appendChild(l), s && n.appendChild(vi(r, e, t, d, i)), n;
|
|
3206
3206
|
}
|
|
3207
|
-
function
|
|
3207
|
+
function vi(r, e, t, i, n) {
|
|
3208
3208
|
const s = document.createElement("div");
|
|
3209
3209
|
s.className = "vui-lrow-inserts open";
|
|
3210
3210
|
for (const a of r.inserts) {
|
|
@@ -3217,8 +3217,8 @@ function fi(r, e, t, i, n) {
|
|
|
3217
3217
|
rt(l, p, n);
|
|
3218
3218
|
const h = s.querySelectorAll(".vui-lrow-insert-visibility");
|
|
3219
3219
|
let m = 0;
|
|
3220
|
-
h.forEach((
|
|
3221
|
-
|
|
3220
|
+
h.forEach((g) => {
|
|
3221
|
+
g.dataset.visible === "1" && m++;
|
|
3222
3222
|
});
|
|
3223
3223
|
const f = m === 0 ? "none" : m === h.length ? "all" : "mixed";
|
|
3224
3224
|
et(i, f, n), t.toggleInsert(a.insertId, p);
|
|
@@ -3242,16 +3242,16 @@ function ua(r, e) {
|
|
|
3242
3242
|
};
|
|
3243
3243
|
return r.addEventListener("input", t), () => r.removeEventListener("input", t);
|
|
3244
3244
|
}
|
|
3245
|
-
function
|
|
3245
|
+
function gi(r, e, t = Bt, i = "mm") {
|
|
3246
3246
|
if (r.body.replaceChildren(), e.textSelection && e.textDetails) {
|
|
3247
|
-
Ce(r, !1), pa(r.body, e.textDetails, t, i),
|
|
3247
|
+
Ce(r, !1), pa(r.body, e.textDetails, t, i), bi(r.body);
|
|
3248
3248
|
return;
|
|
3249
3249
|
}
|
|
3250
3250
|
if (!e.selection || !e.details) {
|
|
3251
3251
|
Ce(r, !1), r.body.appendChild(ma(t.t("property.empty")));
|
|
3252
3252
|
return;
|
|
3253
3253
|
}
|
|
3254
|
-
ha(r.body, e.details, t, i),
|
|
3254
|
+
ha(r.body, e.details, t, i), bi(r.body);
|
|
3255
3255
|
}
|
|
3256
3256
|
function Ce(r, e) {
|
|
3257
3257
|
if (!r.previewWrap || !r.previewCanvas || (r.previewWrap.hidden = !e, e)) return;
|
|
@@ -3259,22 +3259,22 @@ function Ce(r, e) {
|
|
|
3259
3259
|
t == null || t.clearRect(0, 0, r.previewCanvas.width, r.previewCanvas.height);
|
|
3260
3260
|
}
|
|
3261
3261
|
function ha(r, e, t, i) {
|
|
3262
|
-
En(r, t.t("property.insert"), e.blockName),
|
|
3262
|
+
En(r, t.t("property.insert"), e.blockName), At(r, t.t("property.basic"), (n) => {
|
|
3263
3263
|
q(n, t.t("property.block"), e.blockName), q(n, t.t("property.layer"), e.layerName), q(n, t.t("property.instance"), `#${e.id.instanceId}`), q(n, t.t("property.currentShape"), t.t("property.normalShape"));
|
|
3264
|
-
}),
|
|
3264
|
+
}), At(r, t.t("property.transform"), (n) => {
|
|
3265
3265
|
q(n, "X", t.formatUnit(e.tx, i)), q(n, "Y", t.formatUnit(e.ty, i)), q(n, t.t("property.rotation"), t.formatUnit(e.rotation, "°")), q(n, "Sx", t.formatNumber(e.scaleX)), q(n, "Sy", t.formatNumber(e.scaleY));
|
|
3266
3266
|
});
|
|
3267
3267
|
}
|
|
3268
3268
|
function pa(r, e, t, i) {
|
|
3269
|
-
En(r, t.t("property.text"), e.content),
|
|
3269
|
+
En(r, t.t("property.text"), e.content), At(r, t.t("property.basic"), (n) => {
|
|
3270
3270
|
q(n, t.t("property.layer"), e.layerName), q(n, t.t("property.content"), e.content), q(n, t.t("property.height"), t.formatUnit(e.height, i)), q(n, "X", t.formatUnit(e.x, i)), q(n, "Y", t.formatUnit(e.y, i)), q(n, t.t("property.rotation"), t.formatUnit(e.rotation, "°"));
|
|
3271
3271
|
});
|
|
3272
3272
|
}
|
|
3273
3273
|
function En(r, e, t) {
|
|
3274
3274
|
const i = document.createElement("div");
|
|
3275
|
-
i.className = "vui-pp-section vui-pp-title-row", i.innerHTML = `<strong>${
|
|
3275
|
+
i.className = "vui-pp-section vui-pp-title-row", i.innerHTML = `<strong>${U(e)}</strong><span>·</span><span>${U(t)}</span>`, r.appendChild(i);
|
|
3276
3276
|
}
|
|
3277
|
-
function
|
|
3277
|
+
function At(r, e, t) {
|
|
3278
3278
|
const i = document.createElement("section");
|
|
3279
3279
|
i.className = "vui-pp-section";
|
|
3280
3280
|
const n = document.createElement("div");
|
|
@@ -3282,13 +3282,13 @@ function Rt(r, e, t) {
|
|
|
3282
3282
|
}
|
|
3283
3283
|
function q(r, e, t) {
|
|
3284
3284
|
const i = document.createElement("div");
|
|
3285
|
-
i.className = "vui-pp-row", i.innerHTML = `<span class="label">${
|
|
3285
|
+
i.className = "vui-pp-row", i.innerHTML = `<span class="label">${U(e)}</span><span class="value" title="${U(t)}">${U(t)}</span>`, r.appendChild(i);
|
|
3286
3286
|
}
|
|
3287
3287
|
function ma(r) {
|
|
3288
3288
|
const e = document.createElement("div");
|
|
3289
3289
|
return e.className = "vui-empty-note", e.textContent = r, e;
|
|
3290
3290
|
}
|
|
3291
|
-
function
|
|
3291
|
+
function bi(r) {
|
|
3292
3292
|
if (r.querySelector('input:not([type="color"])'))
|
|
3293
3293
|
throw new Error("Property panel must not contain editable inputs");
|
|
3294
3294
|
if (r.querySelector('[contenteditable=""], [contenteditable="true"]'))
|
|
@@ -4310,7 +4310,7 @@ button, input { font: inherit; }
|
|
|
4310
4310
|
}
|
|
4311
4311
|
`
|
|
4312
4312
|
};
|
|
4313
|
-
function
|
|
4313
|
+
function mt(r = "dark", e = {}) {
|
|
4314
4314
|
const t = {
|
|
4315
4315
|
accent: "--vui-accent",
|
|
4316
4316
|
panelBackground: "--vui-bg2",
|
|
@@ -4337,7 +4337,7 @@ const xa = {
|
|
|
4337
4337
|
infobarLineMode: !0,
|
|
4338
4338
|
infobarPhase: !0,
|
|
4339
4339
|
infobarDebug: !0
|
|
4340
|
-
},
|
|
4340
|
+
}, yi = "property-panel:open", xi = "layer-panel:open", wi = 300, Ci = 180, wa = 2;
|
|
4341
4341
|
let Ca = 0;
|
|
4342
4342
|
function be(r, ...e) {
|
|
4343
4343
|
const t = document.createElement("div");
|
|
@@ -4347,7 +4347,7 @@ function be(r, ...e) {
|
|
|
4347
4347
|
const n = document.createElement("div");
|
|
4348
4348
|
return n.className = "vui-debug-value", n.append(...e), t.append(i, n), t;
|
|
4349
4349
|
}
|
|
4350
|
-
function
|
|
4350
|
+
function Ei(r, e, t) {
|
|
4351
4351
|
const i = document.createElement("div");
|
|
4352
4352
|
i.className = "vui-debug-spread";
|
|
4353
4353
|
const n = document.createElement("b");
|
|
@@ -4359,7 +4359,7 @@ function Ci(r, e, t) {
|
|
|
4359
4359
|
}
|
|
4360
4360
|
return i;
|
|
4361
4361
|
}
|
|
4362
|
-
function
|
|
4362
|
+
function ki(r) {
|
|
4363
4363
|
const e = document.createElement("div");
|
|
4364
4364
|
return e.className = "vui-debug-spread-list", e.append(...r), e;
|
|
4365
4365
|
}
|
|
@@ -4381,7 +4381,7 @@ function Ea(r, e) {
|
|
|
4381
4381
|
return "";
|
|
4382
4382
|
}
|
|
4383
4383
|
}
|
|
4384
|
-
function
|
|
4384
|
+
function Si(r) {
|
|
4385
4385
|
return (typeof r.composedPath == "function" ? r.composedPath() : [r.target]).some((t) => {
|
|
4386
4386
|
var a, o;
|
|
4387
4387
|
if (!t || typeof t != "object") return !1;
|
|
@@ -4427,13 +4427,13 @@ class ka {
|
|
|
4427
4427
|
u(this, "activeLayerColorPreview", null);
|
|
4428
4428
|
u(this, "renderedLayerRows", null);
|
|
4429
4429
|
u(this, "handleKeyDown", (e) => {
|
|
4430
|
-
if (this.disposed || e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey ||
|
|
4430
|
+
if (this.disposed || e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey || Si(e)) return;
|
|
4431
4431
|
const t = this.getFitShortcut();
|
|
4432
4432
|
t && e.key.toLowerCase() === t.toLowerCase() && this.host.fitSelectionOrDocument();
|
|
4433
4433
|
});
|
|
4434
4434
|
u(this, "handleKeyboardTargetPointerDown", (e) => {
|
|
4435
4435
|
var t, i;
|
|
4436
|
-
this.disposed ||
|
|
4436
|
+
this.disposed || Si(e) || (i = (t = this.keyboardTarget) == null ? void 0 : t.focus) == null || i.call(t, { preventScroll: !0 });
|
|
4437
4437
|
});
|
|
4438
4438
|
u(this, "unsubscribers", []);
|
|
4439
4439
|
u(this, "filterCleanup", null);
|
|
@@ -4445,7 +4445,7 @@ class ka {
|
|
|
4445
4445
|
}
|
|
4446
4446
|
}));
|
|
4447
4447
|
u(this, "refresh", () => {
|
|
4448
|
-
this.disposed || !this.active || (this.syncToolbarState(), this.renderLayerPanel(), this.propertyPanelRefs && this.parts.propertyPanel && (
|
|
4448
|
+
this.disposed || !this.active || (this.syncToolbarState(), this.renderLayerPanel(), this.propertyPanelRefs && this.parts.propertyPanel && (gi(this.propertyPanelRefs, this.host.cad.inspector, this.text, this.getCadUnit()), this.syncPropertyPanelSelectionState(), this.syncPropertyPanelPreview()), this.syncHud());
|
|
4449
4449
|
});
|
|
4450
4450
|
u(this, "syncHud", () => {
|
|
4451
4451
|
var e;
|
|
@@ -4463,7 +4463,7 @@ class ka {
|
|
|
4463
4463
|
blocks: this.text.formatInteger(t.blockVariantCount),
|
|
4464
4464
|
split: this.text.formatInteger(t.splitBlockLayerGroupCount)
|
|
4465
4465
|
});
|
|
4466
|
-
const s = t.renderDebugBreakdown.map((d) =>
|
|
4466
|
+
const s = t.renderDebugBreakdown.map((d) => Ei(
|
|
4467
4467
|
d.label,
|
|
4468
4468
|
this.text.t("toolbar.debug.breakdown", {
|
|
4469
4469
|
renderables: this.text.formatInteger(d.renderables),
|
|
@@ -4475,8 +4475,8 @@ class ka {
|
|
|
4475
4475
|
calls: this.text.formatInteger(t.drawCalls)
|
|
4476
4476
|
})
|
|
4477
4477
|
];
|
|
4478
|
-
s.length > 0 && a.push(
|
|
4479
|
-
const o = t.splitBlockLayerDetails.map((d) =>
|
|
4478
|
+
s.length > 0 && a.push(ki(s));
|
|
4479
|
+
const o = t.splitBlockLayerDetails.map((d) => Ei(
|
|
4480
4480
|
`${d.blockName} #${d.variantId}`,
|
|
4481
4481
|
this.text.t("toolbar.debug.spreadMeta", {
|
|
4482
4482
|
layers: this.text.formatInteger(d.layerCount),
|
|
@@ -4493,7 +4493,7 @@ class ka {
|
|
|
4493
4493
|
const l = [this.text.t("toolbar.debug.splitLayerCount", {
|
|
4494
4494
|
count: this.text.formatInteger(t.splitBlockLayerGroupCount)
|
|
4495
4495
|
})];
|
|
4496
|
-
o.length > 0 && l.push(
|
|
4496
|
+
o.length > 0 && l.push(ki(o)), this.infobarRefs.debugBody.replaceChildren(
|
|
4497
4497
|
be("" + this.text.t("toolbar.debug.submitted"), this.text.formatInteger(t.submittedVertexRefs)),
|
|
4498
4498
|
...t.lineRenderMode ? [be(this.text.t("toolbar.debug.lineMode"), t.lineRenderMode.toUpperCase())] : [],
|
|
4499
4499
|
be(this.text.t("toolbar.debug.layers"), this.text.t("toolbar.debug.layerCount", {
|
|
@@ -4531,7 +4531,7 @@ class ka {
|
|
|
4531
4531
|
if (this.disposed) return;
|
|
4532
4532
|
this.shadow = ((o = this.host.layout) == null ? void 0 : o.shadowRoot()) ?? this.options.root.shadowRoot ?? this.options.root.attachShadow({ mode: "open" });
|
|
4533
4533
|
const e = this.theme, t = document.createElement("style");
|
|
4534
|
-
t.dataset.viewerUiTheme = "", t.textContent =
|
|
4534
|
+
t.dataset.viewerUiTheme = "", t.textContent = mt(e, this.options.tokens), this.themeStyle = t;
|
|
4535
4535
|
const i = document.createElement("div");
|
|
4536
4536
|
i.className = "vui-root", i.dataset.theme = e, i.dataset.preset = this.options.preset ?? "auto";
|
|
4537
4537
|
const n = document.createElement("div");
|
|
@@ -4558,11 +4558,11 @@ class ka {
|
|
|
4558
4558
|
this.themeValue = e;
|
|
4559
4559
|
const t = this.shadow.querySelector(".vui-root");
|
|
4560
4560
|
if (t && (t.dataset.theme = e), this.themeStyle) {
|
|
4561
|
-
this.themeStyle.textContent =
|
|
4561
|
+
this.themeStyle.textContent = mt(e, this.options.tokens);
|
|
4562
4562
|
return;
|
|
4563
4563
|
}
|
|
4564
4564
|
const i = document.createElement("style");
|
|
4565
|
-
i.dataset.viewerUiTheme = "", i.textContent =
|
|
4565
|
+
i.dataset.viewerUiTheme = "", i.textContent = mt(e, this.options.tokens), (n = this.shadow.querySelector("style[data-viewer-ui-theme]")) == null || n.replaceWith(i), this.themeStyle = i;
|
|
4566
4566
|
}
|
|
4567
4567
|
get theme() {
|
|
4568
4568
|
return this.themeValue;
|
|
@@ -4610,7 +4610,7 @@ class ka {
|
|
|
4610
4610
|
const i = document.createElement("div");
|
|
4611
4611
|
i.className = "vui-section";
|
|
4612
4612
|
const n = document.createElement("div");
|
|
4613
|
-
n.className = "vui-section-head", n.innerHTML = `<span class="vui-section-title">${
|
|
4613
|
+
n.className = "vui-section-head", n.innerHTML = `<span class="vui-section-title">${U(this.text.t("panel.layers"))}</span><span class="vui-section-count">—</span>`;
|
|
4614
4614
|
const s = document.createElement("div");
|
|
4615
4615
|
s.className = "vui-section-filter-wrap";
|
|
4616
4616
|
const a = document.createElement("input");
|
|
@@ -4623,9 +4623,9 @@ class ka {
|
|
|
4623
4623
|
d.type = "button", d.className = "vui-btn", d.textContent = this.text.t("layer.hideAll"), d.addEventListener("click", () => this.host.cad.layers.hideAll());
|
|
4624
4624
|
const c = document.createElement("button");
|
|
4625
4625
|
c.type = "button", c.className = "vui-btn", c.textContent = this.text.t("layer.collapse"), c.title = this.text.t("layer.collapseTitle"), c.addEventListener("click", () => {
|
|
4626
|
-
var
|
|
4627
|
-
const f = (
|
|
4628
|
-
this.layerPanelState.collapseAll(
|
|
4626
|
+
var b;
|
|
4627
|
+
const f = (b = this.host.cad.inspector.selection) == null ? void 0 : b.id, g = f ? `${f.layerIndex}:${f.variantId}:${f.instanceId}` : null;
|
|
4628
|
+
this.layerPanelState.collapseAll(g), this.refresh();
|
|
4629
4629
|
}), o.append(l, d, c);
|
|
4630
4630
|
const p = document.createElement("div");
|
|
4631
4631
|
p.className = "vui-section-list", i.append(n, s, o, p), t.appendChild(i), this.layerPanelRefs = {
|
|
@@ -4660,12 +4660,12 @@ class ka {
|
|
|
4660
4660
|
const a = document.createElement("span");
|
|
4661
4661
|
if (a.className = "vui-info-text", this.toolbarInfoText = a, s.appendChild(a), this.parts.fit) {
|
|
4662
4662
|
this.btnFit = document.createElement("button"), this.btnFit.type = "button", this.btnFit.className = "vui-btn";
|
|
4663
|
-
const
|
|
4664
|
-
this.btnFit.innerHTML =
|
|
4663
|
+
const b = this.getFitShortcut();
|
|
4664
|
+
this.btnFit.innerHTML = b ? `${U(this.text.t("toolbar.fit"))} <span class="vui-kbd">${U(b.toUpperCase())}</span>` : U(this.text.t("toolbar.fit")), this.btnFit.addEventListener("click", () => this.host.fitSelectionOrDocument()), s.appendChild(this.btnFit);
|
|
4665
4665
|
}
|
|
4666
4666
|
if (this.parts.viewMode) {
|
|
4667
|
-
const
|
|
4668
|
-
|
|
4667
|
+
const b = document.createElement("div");
|
|
4668
|
+
b.className = "vui-view-toggle", b.setAttribute("role", "group"), b.setAttribute("aria-label", this.text.t("toolbar.viewMode")), this.btnView2d = document.createElement("button"), this.btnView2d.type = "button", this.btnView2d.className = "vui-btn", this.btnView2d.textContent = "2D", this.btnView2d.setAttribute("aria-pressed", "false"), this.btnView2d.addEventListener("click", () => this.host.setViewMode("2d")), this.btnView3d = document.createElement("button"), this.btnView3d.type = "button", this.btnView3d.className = "vui-btn", this.btnView3d.textContent = "3D", this.btnView3d.setAttribute("aria-pressed", "false"), this.btnView3d.addEventListener("click", () => this.host.setViewMode("3d")), b.append(this.btnView2d, this.btnView3d), s.appendChild(b);
|
|
4669
4669
|
}
|
|
4670
4670
|
const o = document.createElement("span");
|
|
4671
4671
|
o.className = "vui-seg";
|
|
@@ -4683,8 +4683,8 @@ class ka {
|
|
|
4683
4683
|
m.className = "vui-debug-card";
|
|
4684
4684
|
const f = document.createElement("summary");
|
|
4685
4685
|
f.className = "vui-debug-summary", f.textContent = this.text.t("toolbar.details");
|
|
4686
|
-
const
|
|
4687
|
-
return
|
|
4686
|
+
const g = document.createElement("div");
|
|
4687
|
+
return g.className = "vui-debug-body", m.append(f, g), i.append(n, s, o, l, d, c, p, h, m), e.append(t, i), this.infobarRefs = {
|
|
4688
4688
|
infobar: e,
|
|
4689
4689
|
file: n,
|
|
4690
4690
|
tools: s,
|
|
@@ -4696,7 +4696,7 @@ class ka {
|
|
|
4696
4696
|
fps: h,
|
|
4697
4697
|
debugCard: m,
|
|
4698
4698
|
debugSummary: f,
|
|
4699
|
-
debugBody:
|
|
4699
|
+
debugBody: g
|
|
4700
4700
|
}, this.infobar = e, this.infobarToggle = t, e;
|
|
4701
4701
|
}
|
|
4702
4702
|
buildPropertyPanel() {
|
|
@@ -4705,7 +4705,7 @@ class ka {
|
|
|
4705
4705
|
const t = document.createElement("div");
|
|
4706
4706
|
t.className = "vui-property-panel", t.dataset.part = "property-panel";
|
|
4707
4707
|
const i = document.createElement("div");
|
|
4708
|
-
i.className = "vui-pp-head", i.innerHTML = `<span class="vui-pp-title-text">${
|
|
4708
|
+
i.className = "vui-pp-head", i.innerHTML = `<span class="vui-pp-title-text">${U(this.text.t("panel.properties"))}</span>`;
|
|
4709
4709
|
const n = document.createElement("div");
|
|
4710
4710
|
n.className = "vui-pp-preview-wrap", n.hidden = !0;
|
|
4711
4711
|
const s = document.createElement("canvas");
|
|
@@ -4729,7 +4729,7 @@ class ka {
|
|
|
4729
4729
|
const e = this.host.cad.inspector.selection, t = e == null ? void 0 : e.id, i = t ? `${t.layerIndex}:${t.variantId}:${t.instanceId}` : null;
|
|
4730
4730
|
i && this.layerPanelState.needsSelectionReveal(i) ? this.renderLayerPanel() : aa(this.layerPanelRefs.list, e);
|
|
4731
4731
|
}
|
|
4732
|
-
this.propertyPanelRefs && this.parts.propertyPanel && (
|
|
4732
|
+
this.propertyPanelRefs && this.parts.propertyPanel && (gi(this.propertyPanelRefs, this.host.cad.inspector, this.text, this.getCadUnit()), this.syncPropertyPanelSelectionState(), this.syncPropertyPanelPreview());
|
|
4733
4733
|
}),
|
|
4734
4734
|
this.host.cad.on("hud-change", () => this.syncHud()),
|
|
4735
4735
|
this.host.on("view-mode-change", () => {
|
|
@@ -4818,7 +4818,7 @@ class ka {
|
|
|
4818
4818
|
var e;
|
|
4819
4819
|
if (((e = this.options.cad) == null ? void 0 : e.persistence) === !1) return !1;
|
|
4820
4820
|
try {
|
|
4821
|
-
return this.readState(
|
|
4821
|
+
return this.readState(yi) === "1";
|
|
4822
4822
|
} catch {
|
|
4823
4823
|
return !1;
|
|
4824
4824
|
}
|
|
@@ -4827,7 +4827,7 @@ class ka {
|
|
|
4827
4827
|
var e;
|
|
4828
4828
|
if (((e = this.options.cad) == null ? void 0 : e.persistence) === !1) return !0;
|
|
4829
4829
|
try {
|
|
4830
|
-
return this.readState(
|
|
4830
|
+
return this.readState(xi) !== "0";
|
|
4831
4831
|
} catch {
|
|
4832
4832
|
return !0;
|
|
4833
4833
|
}
|
|
@@ -4840,7 +4840,7 @@ class ka {
|
|
|
4840
4840
|
panel: this.text.t("panel.layers")
|
|
4841
4841
|
})), !!t && (this.emitUiLayoutChange(), ((s = this.options.cad) == null ? void 0 : s.persistence) !== !1)))
|
|
4842
4842
|
try {
|
|
4843
|
-
this.writeState(
|
|
4843
|
+
this.writeState(xi, e ? "1" : "0");
|
|
4844
4844
|
} catch {
|
|
4845
4845
|
}
|
|
4846
4846
|
}
|
|
@@ -4856,7 +4856,7 @@ class ka {
|
|
|
4856
4856
|
panel: this.text.t("panel.properties")
|
|
4857
4857
|
})), (s = i.querySelector(".vui-property-panel")) == null || s.setAttribute("aria-hidden", String(!e)), e ? this.syncPropertyPanelPreview(!0) : (this.cancelPropertyPreviewRender(), this.propertyPanelRefs && Ce(this.propertyPanelRefs, !1)), !!t && (this.emitUiLayoutChange(), ((a = this.options.cad) == null ? void 0 : a.persistence) !== !1)))
|
|
4858
4858
|
try {
|
|
4859
|
-
this.writeState(
|
|
4859
|
+
this.writeState(yi, e ? "1" : "0");
|
|
4860
4860
|
} catch {
|
|
4861
4861
|
}
|
|
4862
4862
|
}
|
|
@@ -4954,7 +4954,7 @@ class ka {
|
|
|
4954
4954
|
return (t = this.propertyPanelShell) != null && t.classList.contains("closed") ? !0 : !this.isPropertyPreviewLayoutReady(e);
|
|
4955
4955
|
}
|
|
4956
4956
|
isPropertyPreviewLayoutReady(e) {
|
|
4957
|
-
return e.clientWidth >=
|
|
4957
|
+
return e.clientWidth >= Ci && e.clientHeight >= Ci;
|
|
4958
4958
|
}
|
|
4959
4959
|
waitForPropertyPreviewLayout(e) {
|
|
4960
4960
|
if (this.isPropertyPreviewLayoutReady(e)) return Promise.resolve();
|
|
@@ -4964,37 +4964,37 @@ class ka {
|
|
|
4964
4964
|
const l = [], d = [];
|
|
4965
4965
|
let c = 0;
|
|
4966
4966
|
const p = () => {
|
|
4967
|
-
for (const
|
|
4968
|
-
for (const
|
|
4969
|
-
window.clearTimeout(
|
|
4967
|
+
for (const x of l) window.clearTimeout(x);
|
|
4968
|
+
for (const x of d) x();
|
|
4969
|
+
window.clearTimeout(b), c !== 0 && cancelAnimationFrame(c), this.propertyPreviewLayoutWaitAbort = null;
|
|
4970
4970
|
}, h = () => {
|
|
4971
4971
|
s || (s = !0, p(), n());
|
|
4972
4972
|
}, m = () => {
|
|
4973
|
-
const
|
|
4973
|
+
const x = e.clientWidth;
|
|
4974
4974
|
if (!this.isPropertyPreviewLayoutReady(e)) {
|
|
4975
4975
|
a = 0, o = -1;
|
|
4976
4976
|
return;
|
|
4977
4977
|
}
|
|
4978
|
-
if (
|
|
4978
|
+
if (x === o) {
|
|
4979
4979
|
a += 1, a >= wa && h();
|
|
4980
4980
|
return;
|
|
4981
4981
|
}
|
|
4982
|
-
o =
|
|
4983
|
-
}, f = (
|
|
4984
|
-
if (!Sa(
|
|
4985
|
-
let
|
|
4982
|
+
o = x, a = 0;
|
|
4983
|
+
}, f = (x) => {
|
|
4984
|
+
if (!Sa(x)) return;
|
|
4985
|
+
let v = !1;
|
|
4986
4986
|
const w = (C) => {
|
|
4987
|
-
C.target !==
|
|
4988
|
-
},
|
|
4989
|
-
|
|
4987
|
+
C.target !== x || C.propertyName !== "width" || y();
|
|
4988
|
+
}, y = () => {
|
|
4989
|
+
v || (v = !0, x.removeEventListener("transitionend", w), requestAnimationFrame(m));
|
|
4990
4990
|
};
|
|
4991
|
-
|
|
4992
|
-
|
|
4991
|
+
x.addEventListener("transitionend", w), l.push(window.setTimeout(y, wi)), d.push(() => {
|
|
4992
|
+
v || (v = !0, x.removeEventListener("transitionend", w));
|
|
4993
4993
|
});
|
|
4994
|
-
},
|
|
4995
|
-
m(), s || (c = requestAnimationFrame(
|
|
4996
|
-
},
|
|
4997
|
-
f(i), f(t), c = requestAnimationFrame(
|
|
4994
|
+
}, g = () => {
|
|
4995
|
+
m(), s || (c = requestAnimationFrame(g));
|
|
4996
|
+
}, b = window.setTimeout(h, wi);
|
|
4997
|
+
f(i), f(t), c = requestAnimationFrame(g), this.propertyPreviewLayoutWaitAbort = () => {
|
|
4998
4998
|
s = !0, p();
|
|
4999
4999
|
};
|
|
5000
5000
|
});
|
|
@@ -5041,7 +5041,7 @@ class Ra {
|
|
|
5041
5041
|
const t = this.canMeasure();
|
|
5042
5042
|
this.resizeObserver = t && typeof ResizeObserver == "function" ? new ResizeObserver(() => this.schedule()) : null, t && typeof globalThis.window < "u" && globalThis.window.addEventListener("resize", this.handleWindowResize);
|
|
5043
5043
|
const i = this.host.reference(), n = this.host.target();
|
|
5044
|
-
i &&
|
|
5044
|
+
i && re(i) && ((s = this.resizeObserver) == null || s.observe(i)), n && n !== i && re(n) && ((a = this.resizeObserver) == null || a.observe(n));
|
|
5045
5045
|
}
|
|
5046
5046
|
mountBuiltin(e, t) {
|
|
5047
5047
|
return this.mountNode(e, t.zone, !0, t.group);
|
|
@@ -5078,7 +5078,7 @@ class Ra {
|
|
|
5078
5078
|
}
|
|
5079
5079
|
canMeasure() {
|
|
5080
5080
|
const e = this.host.reference();
|
|
5081
|
-
return !!(e &&
|
|
5081
|
+
return !!(e && re(e) && typeof e.getBoundingClientRect == "function");
|
|
5082
5082
|
}
|
|
5083
5083
|
dispose() {
|
|
5084
5084
|
var e;
|
|
@@ -5092,13 +5092,13 @@ class Ra {
|
|
|
5092
5092
|
}
|
|
5093
5093
|
mountNode(e, t, i, n) {
|
|
5094
5094
|
var l;
|
|
5095
|
-
const s =
|
|
5095
|
+
const s = ft(t, i, n), a = this.ensureZoneContainer(t, i, n);
|
|
5096
5096
|
a.append(e);
|
|
5097
5097
|
const o = { node: e, zone: t, builtin: i, group: n, container: a, key: s };
|
|
5098
|
-
return this.mounts.add(o),
|
|
5098
|
+
return this.mounts.add(o), re(e) && ((l = this.resizeObserver) == null || l.observe(e)), this.schedule(), {
|
|
5099
5099
|
dispose: () => {
|
|
5100
5100
|
var d, c;
|
|
5101
|
-
this.mounts.delete(o) && (
|
|
5101
|
+
this.mounts.delete(o) && (re(e) ? ((d = this.resizeObserver) == null || d.unobserve(e), e.remove()) : e.parentNode === a && a.removeChild(e), this.containerHasMounts(s) || ((c = this.resizeObserver) == null || c.unobserve(a), a.remove(), this.zoneContainers.delete(s)), this.schedule());
|
|
5102
5102
|
}
|
|
5103
5103
|
};
|
|
5104
5104
|
}
|
|
@@ -5108,7 +5108,7 @@ class Ra {
|
|
|
5108
5108
|
}
|
|
5109
5109
|
ensureZoneContainer(e, t, i) {
|
|
5110
5110
|
var l;
|
|
5111
|
-
const n =
|
|
5111
|
+
const n = ft(e, t, i), s = this.zoneContainers.get(n);
|
|
5112
5112
|
if (s) return s;
|
|
5113
5113
|
const a = document.createElement("div");
|
|
5114
5114
|
a.dataset.viewerZone = e, a.dataset.viewerZoneOwner = t ? "builtin" : "plugin", i && (a.dataset.viewerZoneGroup = i), a.dataset.viewerZoneActive = String(!i || this.activeGroups.has(i));
|
|
@@ -5117,12 +5117,12 @@ class Ra {
|
|
|
5117
5117
|
}
|
|
5118
5118
|
/** Test/debug seam. Prefer querying the relevant host by data attributes. */
|
|
5119
5119
|
getOwnerZoneElement(e, t = !1, i) {
|
|
5120
|
-
return this.zoneContainers.get(
|
|
5120
|
+
return this.zoneContainers.get(ft(e, t, i)) ?? null;
|
|
5121
5121
|
}
|
|
5122
5122
|
installZoneStyles(e, t) {
|
|
5123
5123
|
if (!e || typeof e.querySelector != "function" || typeof e.prepend != "function" || e.querySelector(`style[data-viewer-layout="${t}"]`)) return;
|
|
5124
5124
|
const i = document.createElement("style");
|
|
5125
|
-
i.dataset.viewerLayout = t, i.textContent = La, e.append(i), this.installedStyles.push(i),
|
|
5125
|
+
i.dataset.viewerLayout = t, i.textContent = La, e.append(i), this.installedStyles.push(i), re(e) && (e.dataset.viewerLayoutHost = "", typeof getComputedStyle == "function" && getComputedStyle(e).position === "static" && (e.style.position = "relative"));
|
|
5126
5126
|
}
|
|
5127
5127
|
schedule() {
|
|
5128
5128
|
if (!(this.disposed || this.frameHandle !== null)) {
|
|
@@ -5190,17 +5190,17 @@ class Ra {
|
|
|
5190
5190
|
return !t || this.activeGroups.has(t);
|
|
5191
5191
|
}
|
|
5192
5192
|
assertStableReference(e, t) {
|
|
5193
|
-
return !t || t === e || !
|
|
5193
|
+
return !t || t === e || !re(e) || !re(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);
|
|
5194
5194
|
}
|
|
5195
5195
|
}
|
|
5196
|
-
function
|
|
5196
|
+
function ft(r, e, t) {
|
|
5197
5197
|
return `${e ? "builtin" : "plugin"}:${t ?? ""}:${r}`;
|
|
5198
5198
|
}
|
|
5199
|
-
function
|
|
5199
|
+
function re(r) {
|
|
5200
5200
|
return !!(r && typeof r == "object" && r.nodeType === 1);
|
|
5201
5201
|
}
|
|
5202
5202
|
function Aa(r) {
|
|
5203
|
-
if (!
|
|
5203
|
+
if (!re(r) || r.hidden) return !1;
|
|
5204
5204
|
const e = typeof getComputedStyle == "function" ? getComputedStyle(r) : null;
|
|
5205
5205
|
return !(e && (e.display === "none" || e.visibility === "hidden"));
|
|
5206
5206
|
}
|
|
@@ -5239,7 +5239,7 @@ const La = `
|
|
|
5239
5239
|
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"/>',
|
|
5240
5240
|
moon: '<path d="M20.5 13A9 9 0 0 1 11 3.5 9 9 0 1 0 20.5 13Z"/>'
|
|
5241
5241
|
};
|
|
5242
|
-
function
|
|
5242
|
+
function ct(r) {
|
|
5243
5243
|
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${Da[r]}</svg>`;
|
|
5244
5244
|
}
|
|
5245
5245
|
const Ta = {
|
|
@@ -5260,98 +5260,104 @@ function Na(r, e) {
|
|
|
5260
5260
|
i.className = "vpu-toolbar", i.dataset.theme = e.theme ?? "dark", i.setAttribute("aria-label", e.label);
|
|
5261
5261
|
const n = document.createElement("span");
|
|
5262
5262
|
n.className = "vpu-filename", n.hidden = !0;
|
|
5263
|
-
const s = document.createElement("
|
|
5264
|
-
s.className = "vpu-
|
|
5265
|
-
const a =
|
|
5266
|
-
|
|
5267
|
-
const
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5263
|
+
const s = document.createElement("span");
|
|
5264
|
+
s.className = "vpu-toolbar-spinner", s.hidden = !0, s.setAttribute("role", "status"), s.setAttribute("aria-live", "polite");
|
|
5265
|
+
const a = document.createElement("div");
|
|
5266
|
+
a.className = "vpu-actions", i.append(s, n, a);
|
|
5267
|
+
const o = /* @__PURE__ */ new Map();
|
|
5268
|
+
let l = null, d = null, c = { play: "运行仿真", pause: "暂停仿真", reset: "重置仿真" }, p = e.theme ?? "dark", h = null;
|
|
5269
|
+
const m = (v, w, y, C, k) => {
|
|
5270
|
+
const E = document.createElement("button");
|
|
5271
|
+
return E.type = "button", E.className = "vpu-btn", E.dataset.viewerControl = w, E.dataset.viewerControlId = v, E.innerHTML = ct(C), E.title = y, E.setAttribute("aria-label", y), E.addEventListener("click", k), o.set(v, { button: E, icon: C }), a.append(E), E;
|
|
5272
|
+
}, f = (v, w) => v ? w === "filename" ? t.filename : w === "playback" ? t.playback && v.canPlay : w === "reset" ? t.reset && v.canReset : w === "fit" ? t.fit : w === "upAxis" ? t.upAxis && v.canReorientUpAxis === !0 : w === "environment" ? t.environment : w === "ground" ? t.ground && v.canToggleGround === !0 : w === "collision" ? t.collision && v.canToggleCollision === !0 : t.theme : !1, g = (v) => {
|
|
5273
|
+
var D, T, M, V, _, H, O, G;
|
|
5274
|
+
h = v, a.replaceChildren(), o.clear(), l = null, d = null;
|
|
5275
|
+
const w = (v == null ? void 0 : v.capabilities) ?? null, y = (T = (D = r.asset).$inspection) == null ? void 0 : T.call(D), C = (y == null ? void 0 : y.kind) === "joints" && y.getSnapshot().controlMode === "kinematic";
|
|
5276
|
+
c = (w == null ? void 0 : w.hasAnimation) === !0 && (w.hasPhysics !== !0 || C) ? { play: "播放动画", pause: "暂停动画", reset: "重置动画" } : { play: "运行仿真", pause: "暂停仿真", reset: "重置仿真" }, n.hidden = !(t.filename && (v != null && v.filename)), n.textContent = (v == null ? void 0 : v.filename) ?? "", n.title = (v == null ? void 0 : v.filename) ?? "";
|
|
5277
|
+
const k = (v == null ? void 0 : v.phase) === "ready" ? v.backgroundLoading ?? null : null;
|
|
5278
|
+
s.hidden = !t.filename || !k;
|
|
5279
|
+
const E = ((M = k == null ? void 0 : k.message) == null ? void 0 : M.trim()) || "资源加载中...";
|
|
5280
|
+
if (k ? (s.title = E, s.setAttribute("aria-label", E)) : (s.removeAttribute("title"), s.removeAttribute("aria-label")), v && f(w, "playback")) {
|
|
5281
|
+
const S = "playback";
|
|
5282
|
+
d = S;
|
|
5283
|
+
const A = m(S, "playback", c.play, "play", () => {
|
|
5278
5284
|
r.asset.$readControl().playing ? r.commands.pause() : r.commands.play();
|
|
5279
5285
|
});
|
|
5280
|
-
|
|
5286
|
+
A.className = "vpu-btn vpu-btn-primary";
|
|
5281
5287
|
}
|
|
5282
|
-
if ((v == null ? void 0 : v.kind) === "simulation" && v.phase === "ready" && t.playback && !(
|
|
5283
|
-
const
|
|
5288
|
+
if ((v == null ? void 0 : v.kind) === "simulation" && v.phase === "ready" && t.playback && !(w != null && w.canPlay) && (((V = v.physics) == null ? void 0 : V.status) === "unavailable" || !v.physics && ((_ = v.warning) == null ? void 0 : _.stage) === "physics-fallback")) {
|
|
5289
|
+
const S = ((H = v.physics) == null ? void 0 : H.status) === "unavailable" ? v.physics.issue : v.warning, A = S.notice ? `${S.notice.title}:${S.notice.summary}` : S.message, j = m("playback", "playback", A, "play", () => {
|
|
5284
5290
|
});
|
|
5285
5291
|
j.setAttribute("aria-disabled", "true"), j.className = "vpu-btn vpu-btn-primary";
|
|
5286
5292
|
}
|
|
5287
|
-
v &&
|
|
5293
|
+
v && f(w, "reset") && m("reset", "reset", c.reset, "reset", () => {
|
|
5288
5294
|
r.commands.reset();
|
|
5289
|
-
}), v &&
|
|
5295
|
+
}), v && f(w, "fit") && m("fit", "fit", "视角适应", "fit", () => {
|
|
5290
5296
|
r.commands.fitView();
|
|
5291
|
-
}), v &&
|
|
5292
|
-
const
|
|
5293
|
-
r.commands.setUpAxis(
|
|
5297
|
+
}), v && f(w, "upAxis") && (l = "切换上轴", m("upAxis", "upAxis", l, "upAxisZ", () => {
|
|
5298
|
+
const S = r.asset.$readControl().upAxis ?? "z";
|
|
5299
|
+
r.commands.setUpAxis(S === "z" ? "y" : "z");
|
|
5294
5300
|
}));
|
|
5295
|
-
const
|
|
5296
|
-
if (v && (
|
|
5297
|
-
const
|
|
5298
|
-
var
|
|
5299
|
-
(
|
|
5301
|
+
const P = (O = e.environment) == null ? void 0 : O.getState();
|
|
5302
|
+
if (v && (P != null && P.available) && f(w, "environment")) {
|
|
5303
|
+
const S = m("environment", "environment", "选择环境纹理", "environment", () => {
|
|
5304
|
+
var A;
|
|
5305
|
+
(A = e.environment) == null || A.openPicker(S);
|
|
5300
5306
|
});
|
|
5301
|
-
|
|
5302
|
-
}
|
|
5303
|
-
if (v &&
|
|
5304
|
-
const
|
|
5305
|
-
r.commands.setGroundVisible(!
|
|
5306
|
-
}), v &&
|
|
5307
|
-
const
|
|
5308
|
-
r.commands.setCollisionVisible(!
|
|
5309
|
-
}), v &&
|
|
5310
|
-
const
|
|
5311
|
-
|
|
5307
|
+
S.setAttribute("aria-haspopup", "dialog"), S.setAttribute("aria-controls", "vpu-environment-picker"), Pi(S, ((G = e.environment) == null ? void 0 : G.isPickerOpen()) ?? !1);
|
|
5308
|
+
}
|
|
5309
|
+
if (v && f(w, "ground") && m("ground", "ground", "显示地面", "ground", () => {
|
|
5310
|
+
const S = r.asset.$readControl().groundVisible;
|
|
5311
|
+
r.commands.setGroundVisible(!S);
|
|
5312
|
+
}), v && f(w, "collision") && m("collision", "collision", Mi(!1), "collision", () => {
|
|
5313
|
+
const S = r.asset.$readControl().collisionVisible;
|
|
5314
|
+
r.commands.setCollisionVisible(!S);
|
|
5315
|
+
}), v && f(w, "theme")) {
|
|
5316
|
+
const S = p === "dark";
|
|
5317
|
+
m(
|
|
5312
5318
|
"theme",
|
|
5313
5319
|
"theme",
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
() => r.commands.setTheme(
|
|
5320
|
+
S ? "切换浅色主题" : "切换深色主题",
|
|
5321
|
+
S ? "sun" : "moon",
|
|
5322
|
+
() => r.commands.setTheme(p === "dark" ? "light" : "dark")
|
|
5317
5323
|
);
|
|
5318
5324
|
}
|
|
5319
|
-
i.hidden =
|
|
5325
|
+
i.hidden = a.childElementCount === 0 && n.hidden, b(r.asset.$readControl());
|
|
5320
5326
|
}, b = (v) => {
|
|
5321
|
-
const
|
|
5322
|
-
|
|
5323
|
-
const
|
|
5324
|
-
|
|
5325
|
-
const
|
|
5326
|
-
|
|
5327
|
-
const
|
|
5328
|
-
|
|
5327
|
+
const w = d ? o.get(d) : void 0;
|
|
5328
|
+
w && (qe(w.button, v.playing ? c.pause : c.play, v.playing ? "pause" : "play", v.playing), w.icon = v.playing ? "pause" : "play");
|
|
5329
|
+
const y = o.get("ground");
|
|
5330
|
+
y && qe(y.button, v.groundVisible ? "隐藏地面" : "显示地面", "ground", v.groundVisible);
|
|
5331
|
+
const C = o.get("collision");
|
|
5332
|
+
C && qe(C.button, Mi(v.collisionVisible), "collision", v.collisionVisible);
|
|
5333
|
+
const k = o.get("upAxis");
|
|
5334
|
+
k && qe(k.button, ja(v.upAxis), Oa(v.upAxis), v.upAxis === "y");
|
|
5329
5335
|
};
|
|
5330
5336
|
return {
|
|
5331
5337
|
element: i,
|
|
5332
|
-
update: (v) =>
|
|
5338
|
+
update: (v) => g(v),
|
|
5333
5339
|
pressedChanged: () => b(r.asset.$readControl()),
|
|
5334
5340
|
pickerChanged: (v) => {
|
|
5335
|
-
const
|
|
5336
|
-
|
|
5341
|
+
const w = o.get("environment");
|
|
5342
|
+
w && Pi(w.button, v);
|
|
5337
5343
|
},
|
|
5338
5344
|
environmentAnchor: () => {
|
|
5339
5345
|
var v;
|
|
5340
|
-
return ((v =
|
|
5346
|
+
return ((v = o.get("environment")) == null ? void 0 : v.button) ?? null;
|
|
5341
5347
|
},
|
|
5342
5348
|
themeChanged: (v) => {
|
|
5343
|
-
|
|
5349
|
+
p = v, i.dataset.theme = v, g(h);
|
|
5344
5350
|
},
|
|
5345
5351
|
dispose: () => {
|
|
5346
5352
|
i.remove();
|
|
5347
5353
|
}
|
|
5348
5354
|
};
|
|
5349
5355
|
}
|
|
5350
|
-
function
|
|
5356
|
+
function Pi(r, e) {
|
|
5351
5357
|
r.setAttribute("aria-expanded", String(e)), r.classList.toggle("is-active", e);
|
|
5352
5358
|
}
|
|
5353
5359
|
function qe(r, e, t, i) {
|
|
5354
|
-
r.innerHTML =
|
|
5360
|
+
r.innerHTML = ct(t), r.title = e, r.setAttribute("aria-label", e), r.setAttribute("aria-pressed", String(i)), r.classList.toggle("is-active", i);
|
|
5355
5361
|
}
|
|
5356
5362
|
function Oa(r) {
|
|
5357
5363
|
return r === "y" ? "upAxisY" : "upAxisZ";
|
|
@@ -5359,7 +5365,7 @@ function Oa(r) {
|
|
|
5359
5365
|
function ja(r) {
|
|
5360
5366
|
return r === "y" ? "当前 Y-UP,点击切换为 Z-UP" : "当前 Z-UP,点击切换为 Y-UP";
|
|
5361
5367
|
}
|
|
5362
|
-
function
|
|
5368
|
+
function Mi(r) {
|
|
5363
5369
|
return `${r ? "隐藏碰撞代理" : "显示碰撞代理"}(青绿=精确代理,橙黄=碰撞源网格近似)`;
|
|
5364
5370
|
}
|
|
5365
5371
|
class Fa {
|
|
@@ -5376,8 +5382,8 @@ class Fa {
|
|
|
5376
5382
|
u(this, "rotation");
|
|
5377
5383
|
u(this, "status");
|
|
5378
5384
|
u(this, "input");
|
|
5379
|
-
u(this, "defaultPreview", new
|
|
5380
|
-
u(this, "customPreview", new
|
|
5385
|
+
u(this, "defaultPreview", new vt());
|
|
5386
|
+
u(this, "customPreview", new vt());
|
|
5381
5387
|
u(this, "showBackgroundToggle");
|
|
5382
5388
|
u(this, "onOpenChange");
|
|
5383
5389
|
u(this, "state");
|
|
@@ -5394,7 +5400,7 @@ class Fa {
|
|
|
5394
5400
|
const s = document.createElement("header");
|
|
5395
5401
|
s.className = "vpu-environment-header";
|
|
5396
5402
|
const a = document.createElement("div");
|
|
5397
|
-
a.className = "vpu-environment-title", a.textContent = "环境纹理", this.closeButton =
|
|
5403
|
+
a.className = "vpu-environment-title", a.textContent = "环境纹理", this.closeButton = Ri("关闭环境选择", "close"), s.append(a, this.closeButton);
|
|
5398
5404
|
const o = document.createElement("label");
|
|
5399
5405
|
o.className = "vpu-environment-background", o.hidden = !this.showBackgroundToggle;
|
|
5400
5406
|
const l = document.createElement("span");
|
|
@@ -5418,8 +5424,8 @@ class Fa {
|
|
|
5418
5424
|
}), this.customCard.select.addEventListener("click", () => {
|
|
5419
5425
|
this.state.customEnvironment ? this.run(() => this.api.useCustom()) : this.input.click();
|
|
5420
5426
|
}), (m = this.customCard.replace) == null || m.addEventListener("click", () => this.input.click()), this.input.addEventListener("change", () => {
|
|
5421
|
-
var
|
|
5422
|
-
const f = (
|
|
5427
|
+
var g;
|
|
5428
|
+
const f = (g = this.input.files) == null ? void 0 : g[0];
|
|
5423
5429
|
this.input.value = "", f && this.run(() => this.api.load(f), "环境已应用");
|
|
5424
5430
|
}), this.update(this.state);
|
|
5425
5431
|
}
|
|
@@ -5465,12 +5471,12 @@ class Fa {
|
|
|
5465
5471
|
const t = $a(e);
|
|
5466
5472
|
this.syncPresetCards(t);
|
|
5467
5473
|
const i = e.active === "default" ? e.activePresetIndex ?? 0 : null;
|
|
5468
|
-
this.element.dataset.busy = String(e.loading), this.defaultCard.root.dataset.selected = String(i === 0), this.customCard.root.dataset.selected = String(e.active === "custom"), this.defaultCard.select.setAttribute("aria-pressed", String(i === 0)), this.customCard.select.setAttribute("aria-pressed", String(e.active === "custom")), this.defaultCard.name.textContent = ((n = t[0]) == null ? void 0 : n.name) ?? "默认环境", this.defaultCard.format.textContent = t[0] ?
|
|
5474
|
+
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] ? gt(t[0]) : "HDR";
|
|
5469
5475
|
for (let a = 0; a < this.presetCards.length; a += 1) {
|
|
5470
5476
|
const o = this.presetCards[a], l = t[a + 1];
|
|
5471
|
-
o.root.dataset.selected = String(i === a + 1), o.select.setAttribute("aria-pressed", String(i === a + 1)), o.select.disabled = e.loading, o.name.textContent = (l == null ? void 0 : l.name) ?? `预设环境 ${a + 2}`, o.format.textContent = l ?
|
|
5477
|
+
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 ? gt(l) : "HDR";
|
|
5472
5478
|
}
|
|
5473
|
-
if (this.customCard.name.textContent = ((s = e.customEnvironment) == null ? void 0 : s.name) ?? "上传自定义环境", this.customCard.format.textContent = e.customEnvironment ?
|
|
5479
|
+
if (this.customCard.name.textContent = ((s = e.customEnvironment) == null ? void 0 : s.name) ?? "上传自定义环境", this.customCard.format.textContent = e.customEnvironment ? gt(e.customEnvironment) : "HDR / JPG / PNG", this.customCard.root.dataset.empty = String(!e.customEnvironment), this.customCard.replace.hidden = !e.customEnvironment, this.customCard.select.disabled = e.loading, this.defaultCard.select.disabled = e.loading, this.customCard.replace.disabled = e.loading, this.closeButton.disabled = e.loading, this.backgroundToggle.checked = e.backgroundVisible, this.rotation.input.value = String(e.rotation), this.rotation.output.value = Sn(e.rotation), this.rotationPanel.hidden = !e.rotationAvailable, this.status.textContent = e.loading ? "正在应用环境..." : this.message, this.status.dataset.kind = this.message.startsWith("环境加载失败") ? "error" : "hint", !!this.opened) {
|
|
5474
5480
|
t[0] ? this.defaultPreview.load(this.defaultCard, t[0]) : this.defaultPreview.clear(this.defaultCard);
|
|
5475
5481
|
for (let a = 0; a < this.presetCards.length; a += 1) {
|
|
5476
5482
|
const o = t[a + 1], l = this.presetCards[a], d = this.presetPreviews[a];
|
|
@@ -5495,7 +5501,7 @@ class Fa {
|
|
|
5495
5501
|
for (; this.presetCards.length > t; )
|
|
5496
5502
|
(i = this.presetPreviews.pop()) == null || i.dispose(), (n = this.presetCards.pop()) == null || n.root.remove();
|
|
5497
5503
|
for (; this.presetCards.length < t; ) {
|
|
5498
|
-
const s = this.presetCards.length + 1, a = this.createCard(`预设环境 ${s + 1}`, !1), o = new
|
|
5504
|
+
const s = this.presetCards.length + 1, a = this.createCard(`预设环境 ${s + 1}`, !1), o = new vt();
|
|
5499
5505
|
a.select.addEventListener("click", () => {
|
|
5500
5506
|
this.run(() => this.api.usePreset(s));
|
|
5501
5507
|
}), this.presetCards.push(a), this.presetPreviews.push(o), this.list.insertBefore(a.root, this.customCard.root);
|
|
@@ -5511,14 +5517,14 @@ class Fa {
|
|
|
5511
5517
|
const a = document.createElement("canvas");
|
|
5512
5518
|
a.width = 128, a.height = 128, a.setAttribute("aria-hidden", "true");
|
|
5513
5519
|
const o = document.createElement("span");
|
|
5514
|
-
o.className = "vpu-environment-fallback", o.innerHTML =
|
|
5520
|
+
o.className = "vpu-environment-fallback", o.innerHTML = ct(t ? "image" : "environment"), s.append(a, o);
|
|
5515
5521
|
const l = document.createElement("span");
|
|
5516
5522
|
l.className = "vpu-environment-format";
|
|
5517
5523
|
const d = document.createElement("span");
|
|
5518
5524
|
d.className = "vpu-environment-meta";
|
|
5519
5525
|
const c = document.createElement("span");
|
|
5520
5526
|
c.className = "vpu-environment-name", d.append(c), n.append(s, d);
|
|
5521
|
-
const p = t ?
|
|
5527
|
+
const p = t ? Ri("更换自定义环境", "upload") : void 0;
|
|
5522
5528
|
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 };
|
|
5523
5529
|
}
|
|
5524
5530
|
async run(e, t = "") {
|
|
@@ -5548,7 +5554,7 @@ class Fa {
|
|
|
5548
5554
|
this.pendingRotationValue = null, e !== null && this.setRotation(e);
|
|
5549
5555
|
}
|
|
5550
5556
|
}
|
|
5551
|
-
class
|
|
5557
|
+
class vt {
|
|
5552
5558
|
constructor() {
|
|
5553
5559
|
u(this, "key", "");
|
|
5554
5560
|
u(this, "generation", 0);
|
|
@@ -5591,7 +5597,7 @@ class ft {
|
|
|
5591
5597
|
if (this.renderer && this.canvas === e) return this.renderer;
|
|
5592
5598
|
(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();
|
|
5593
5599
|
const t = new ln({ canvas: e, alpha: !0, antialias: !0, powerPreference: "low-power" });
|
|
5594
|
-
t.setPixelRatio(1), t.setSize(128, 128, !1), t.outputColorSpace =
|
|
5600
|
+
t.setPixelRatio(1), t.setSize(128, 128, !1), t.outputColorSpace = zt, t.toneMapping = Un, t.toneMappingExposure = 1.05;
|
|
5595
5601
|
const i = new $e(), n = new _n({
|
|
5596
5602
|
color: 16777215,
|
|
5597
5603
|
metalness: 1,
|
|
@@ -5607,11 +5613,11 @@ class ft {
|
|
|
5607
5613
|
}
|
|
5608
5614
|
const kn = new dn(32, 1, 0.1, 10);
|
|
5609
5615
|
kn.position.set(0, 0, 3.4);
|
|
5610
|
-
function
|
|
5616
|
+
function Ri(r, e) {
|
|
5611
5617
|
const t = document.createElement("button");
|
|
5612
|
-
return t.type = "button", t.className = "vpu-environment-icon", t.innerHTML =
|
|
5618
|
+
return t.type = "button", t.className = "vpu-environment-icon", t.innerHTML = ct(e), t.title = r, t.setAttribute("aria-label", r), t;
|
|
5613
5619
|
}
|
|
5614
|
-
function
|
|
5620
|
+
function gt(r) {
|
|
5615
5621
|
var e;
|
|
5616
5622
|
return r.type === "hdr" ? "HDR" : ((e = r.name.split(".").pop()) == null ? void 0 : e.toUpperCase()) ?? "IMAGE";
|
|
5617
5623
|
}
|
|
@@ -5636,10 +5642,10 @@ function $a(r) {
|
|
|
5636
5642
|
}
|
|
5637
5643
|
async function Va(r) {
|
|
5638
5644
|
let e;
|
|
5639
|
-
return r.type === "hdr" ? e = await new hn().loadAsync(r.url) : (e = await new un().loadAsync(r.url), e.colorSpace =
|
|
5645
|
+
return r.type === "hdr" ? e = await new hn().loadAsync(r.url) : (e = await new un().loadAsync(r.url), e.colorSpace = zt), e.mapping = Me, e;
|
|
5640
5646
|
}
|
|
5641
5647
|
const je = 1;
|
|
5642
|
-
function
|
|
5648
|
+
function ed(r) {
|
|
5643
5649
|
if (!Number.isFinite(r) || r <= 0) return je;
|
|
5644
5650
|
const e = r / 16, t = 10 ** Math.floor(Math.log10(e)), i = e / t;
|
|
5645
5651
|
return (i >= 5 ? 5 : i >= 2.5 ? 2.5 : i >= 2 ? 2 : 1) * t;
|
|
@@ -5833,6 +5839,16 @@ const Ya = `
|
|
|
5833
5839
|
}
|
|
5834
5840
|
.vpu-toolbar[data-theme="light"] .vpu-filename { text-shadow: 0 1px 2px rgba(255, 255, 255, 0.7); }
|
|
5835
5841
|
.vpu-filename[hidden] { display: none; }
|
|
5842
|
+
.vpu-toolbar-spinner {
|
|
5843
|
+
flex: 0 0 auto;
|
|
5844
|
+
width: 14px;
|
|
5845
|
+
height: 14px;
|
|
5846
|
+
border-radius: 50%;
|
|
5847
|
+
border: 2px solid color-mix(in srgb, var(--vpu-active) 28%, transparent);
|
|
5848
|
+
border-top-color: var(--vpu-active);
|
|
5849
|
+
animation: vpu-spin 0.9s linear infinite;
|
|
5850
|
+
}
|
|
5851
|
+
.vpu-toolbar-spinner[hidden] { display: none; }
|
|
5836
5852
|
.vpu-actions {
|
|
5837
5853
|
display: inline-flex;
|
|
5838
5854
|
align-items: center;
|
|
@@ -6256,6 +6272,7 @@ const Ya = `
|
|
|
6256
6272
|
}
|
|
6257
6273
|
@media (prefers-reduced-motion: reduce) {
|
|
6258
6274
|
.vpu-status-spinner { animation: none; }
|
|
6275
|
+
.vpu-toolbar-spinner { animation: none; }
|
|
6259
6276
|
.vpu-joint-scene-dot,.vpu-joint-scene-pin,.vpu-joint-map-node { transition: none; }
|
|
6260
6277
|
}
|
|
6261
6278
|
`, st = /* @__PURE__ */ new Set(["revolute", "continuous", "prismatic"]);
|
|
@@ -6342,7 +6359,7 @@ function Xa(r) {
|
|
|
6342
6359
|
var e;
|
|
6343
6360
|
return (e = r.label) != null && e.trim() ? r.label.trim() : r.name.split("/").filter(Boolean).pop() ?? r.name;
|
|
6344
6361
|
}
|
|
6345
|
-
function
|
|
6362
|
+
function bt(r, e) {
|
|
6346
6363
|
const t = new Map(r.map((o) => [o.id, o])), i = t.get(e);
|
|
6347
6364
|
if (!i || !st.has(i.type)) return null;
|
|
6348
6365
|
let n = i, s = 1;
|
|
@@ -6387,8 +6404,8 @@ class Ka {
|
|
|
6387
6404
|
const n = e.clientX - t.x, s = e.clientY - t.y;
|
|
6388
6405
|
let a, o;
|
|
6389
6406
|
if (t.corner) {
|
|
6390
|
-
const l = t.corner.endsWith("w"), d = t.corner.startsWith("n"), c = t.left + t.width, p = t.top + t.height, h = Math.min(i.maxWidth, l ? c - i.left : i.right - t.left), m = Math.min(i.maxHeight, d ? p - i.top : i.bottom - t.top), f = le(t.width + (l ? -n : n), i.minWidth, h),
|
|
6391
|
-
a = l ? c - f : t.left, o = d ? p -
|
|
6407
|
+
const l = t.corner.endsWith("w"), d = t.corner.startsWith("n"), c = t.left + t.width, p = t.top + t.height, h = Math.min(i.maxWidth, l ? c - i.left : i.right - t.left), m = Math.min(i.maxHeight, d ? p - i.top : i.bottom - t.top), f = le(t.width + (l ? -n : n), i.minWidth, h), g = le(t.height + (d ? -s : s), i.minHeight, m);
|
|
6408
|
+
a = l ? c - f : t.left, o = d ? p - g : t.top, this.resizedHeight = g, this.element.style.width = `${f}px`, this.element.style.height = `${g}px`;
|
|
6392
6409
|
} else
|
|
6393
6410
|
a = le(t.left + n, i.left, i.right - t.width), o = le(t.top + s, i.top, i.bottom - t.height);
|
|
6394
6411
|
this.element.style.left = `${a}px`, this.element.style.top = `${o}px`;
|
|
@@ -6436,10 +6453,10 @@ class Ka {
|
|
|
6436
6453
|
if (!e) return null;
|
|
6437
6454
|
const t = e.getBoundingClientRect(), i = e.clientWidth || t.width, n = e.clientHeight || t.height;
|
|
6438
6455
|
if (i <= 0 || n <= 0) return null;
|
|
6439
|
-
const s = t.left + e.clientLeft - e.scrollLeft, a = t.top + e.clientTop - e.scrollTop, o = this.view.visualViewport, l = (o == null ? void 0 : o.offsetLeft) ?? 0, d = (o == null ? void 0 : o.offsetTop) ?? 0, c = (o == null ? void 0 : o.width) ?? this.view.innerWidth, p = (o == null ? void 0 : o.height) ?? this.view.innerHeight, h = Math.max(0, l - s) + 8, m = Math.max(0, d - a) + 8, f = Math.min(i, l + c - s) - 8,
|
|
6440
|
-
if (f <= h ||
|
|
6441
|
-
const
|
|
6442
|
-
return { originX: s, originY: a, left: h, top: m, right: f, bottom:
|
|
6456
|
+
const s = t.left + e.clientLeft - e.scrollLeft, a = t.top + e.clientTop - e.scrollTop, o = this.view.visualViewport, l = (o == null ? void 0 : o.offsetLeft) ?? 0, d = (o == null ? void 0 : o.offsetTop) ?? 0, c = (o == null ? void 0 : o.width) ?? this.view.innerWidth, p = (o == null ? void 0 : o.height) ?? this.view.innerHeight, h = Math.max(0, l - s) + 8, m = Math.max(0, d - a) + 8, f = Math.min(i, l + c - s) - 8, g = Math.min(n, d + p - a) - 8;
|
|
6457
|
+
if (f <= h || g <= m) return null;
|
|
6458
|
+
const b = Math.min(560, f - h), x = Math.min(p * 0.8, g - m);
|
|
6459
|
+
return { originX: s, originY: a, left: h, top: m, right: f, bottom: g, minWidth: Math.min(280, b), minHeight: Math.min(280, x), maxWidth: b, maxHeight: x };
|
|
6443
6460
|
}
|
|
6444
6461
|
start(e, t, i) {
|
|
6445
6462
|
var a;
|
|
@@ -6505,12 +6522,12 @@ class Ja {
|
|
|
6505
6522
|
var l;
|
|
6506
6523
|
const t = this.dialGesture;
|
|
6507
6524
|
if (!t || t.pointerId !== e.pointerId) return;
|
|
6508
|
-
const i =
|
|
6525
|
+
const i = Ii(t.dial, e);
|
|
6509
6526
|
if (i === null) return;
|
|
6510
6527
|
e.preventDefault(), e.stopPropagation();
|
|
6511
6528
|
const n = eo(i - t.previousAngle);
|
|
6512
6529
|
t.previousAngle = i;
|
|
6513
|
-
const s =
|
|
6530
|
+
const s = Li(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));
|
|
6514
6531
|
!Number.isFinite(o) || o === t.value || (t.value = o, (l = this.inspection) == null || l.setJointValue(t.joint.id, o));
|
|
6515
6532
|
});
|
|
6516
6533
|
u(this, "endDialGesture", (e) => {
|
|
@@ -6567,18 +6584,18 @@ class Ja {
|
|
|
6567
6584
|
const a = e.playing && e.controlMode === "kinematic" && e.previewing === !0, o = e.playing && !a;
|
|
6568
6585
|
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;
|
|
6569
6586
|
for (const p of this.plan.drivers) {
|
|
6570
|
-
const h = this.rows.get(p.id), m = p.unit === "rad" && this.angleUnit === "deg" ? 180 / Math.PI : 1, f = p.unit === "m" ? "m" : this.angleUnit === "deg" ? "°" : "rad",
|
|
6571
|
-
w && this.numberDrafts.delete(p.id), h.element.hidden = n !== p.id, h.element.classList.toggle("is-selected", n === p.id), h.slider.disabled = h.value.disabled = h.reset.disabled = w, h.dialKnobHit.style.pointerEvents = w ? "none" : "all", h.slider.min = h.value.min = String(
|
|
6572
|
-
const
|
|
6573
|
-
if ((w ||
|
|
6574
|
-
const k = Math.abs(
|
|
6575
|
-
h.feedback.textContent = `实际 ${
|
|
6587
|
+
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", g = e.jointValues[p.id] ?? e.jointValues[p.name] ?? p.defaultValue, b = e.controlMode === "physics", x = b ? ((d = e.jointTargets) == null ? void 0 : d[p.id]) ?? ((c = e.jointTargets) == null ? void 0 : c[p.name]) ?? g : g, v = Li(p, x), w = o;
|
|
6588
|
+
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(v.lower * m), h.slider.max = h.value.max = String(v.upper * m), h.slider.value = String(x * m);
|
|
6589
|
+
const y = h.value.getRootNode();
|
|
6590
|
+
if ((w || y.activeElement !== h.value || !this.numberDrafts.has(p.id)) && (h.value.value = B(x * m)), h.slider.dataset.factor = h.value.dataset.factor = String(m), h.unit.textContent = f, h.limits.textContent = `${B(v.lower * m)} — ${B(v.upper * m)} ${f}`, h.current.textContent = `${B(g * m)} ${f}`, h.rangeSummary.textContent = `${B(v.lower * m)} to ${B(v.upper * m)} ${f} · home ${B(p.defaultValue * m)} ${f}`, h.rangeSummary.title = h.rangeSummary.textContent, Qa(h, p, g, v), h.feedback.hidden = !b, b) {
|
|
6591
|
+
const k = Math.abs(g - x) > (p.unit === "rad" ? Math.PI / 1800 : 1e-4);
|
|
6592
|
+
h.feedback.textContent = `实际 ${B(g * m)} ${f} · 目标 ${B(x * m)} ${f}${k ? "(尚未到达)" : ""}`, h.feedback.classList.toggle("is-pending", k), h.feedback.title = "实际位置由物理求解决定;尚未到达目标时,关节可能仍在运动或受到碰撞约束。";
|
|
6576
6593
|
}
|
|
6577
|
-
h.slider.setAttribute("aria-label", `${p.name} ${
|
|
6594
|
+
h.slider.setAttribute("aria-label", `${p.name} ${b ? "目标位置" : "位置"}`), h.value.setAttribute("aria-label", `${p.name} ${b ? "目标位置数值" : "位置数值"}`), h.name.setAttribute("aria-pressed", String(n === p.id));
|
|
6578
6595
|
const C = this.cards.get(p.id);
|
|
6579
6596
|
if (C) {
|
|
6580
|
-
C.value.textContent = `${
|
|
6581
|
-
const k =
|
|
6597
|
+
C.value.textContent = `${B(g * m)} ${f}`;
|
|
6598
|
+
const k = v.upper - v.lower, E = k > 0 ? Math.max(0, Math.min(1, (g - v.lower) / k)) : 0;
|
|
6582
6599
|
C.progress.style.width = `${E * 100}%`;
|
|
6583
6600
|
}
|
|
6584
6601
|
}
|
|
@@ -6586,8 +6603,8 @@ class Ja {
|
|
|
6586
6603
|
for (const h of p) {
|
|
6587
6604
|
const m = this.followerRows.get(h.id);
|
|
6588
6605
|
if (!m) continue;
|
|
6589
|
-
const f = h.unit === "rad" && this.angleUnit === "deg" ? 180 / Math.PI : 1,
|
|
6590
|
-
m.value.textContent = `${
|
|
6606
|
+
const f = h.unit === "rad" && this.angleUnit === "deg" ? 180 / Math.PI : 1, g = h.unit === "m" ? "m" : this.angleUnit === "deg" ? "°" : "rad", b = e.jointValues[h.id] ?? e.jointValues[h.name] ?? h.defaultValue;
|
|
6607
|
+
m.value.textContent = `${B(b * f)} ${g}`, m.element.classList.toggle("is-selected", e.selectedJointId === h.id);
|
|
6591
6608
|
}
|
|
6592
6609
|
for (const p of this.map.querySelectorAll("[data-map-joint]")) {
|
|
6593
6610
|
const h = p.dataset.mapJoint === n;
|
|
@@ -6605,13 +6622,13 @@ class Ja {
|
|
|
6605
6622
|
s.className = "vpu-joint-heading";
|
|
6606
6623
|
const a = document.createElement("button");
|
|
6607
6624
|
a.type = "button", a.className = "vpu-joint-name", a.textContent = e.labels.get(i.id) ?? We(i), a.title = `${i.name} · ${i.type}`, a.addEventListener("click", () => {
|
|
6608
|
-
var
|
|
6609
|
-
return (
|
|
6625
|
+
var O;
|
|
6626
|
+
return (O = this.inspection) == null ? void 0 : O.select(i.id);
|
|
6610
6627
|
});
|
|
6611
6628
|
const o = document.createElement("button");
|
|
6612
6629
|
o.type = "button", o.className = "vpu-joint-reset", o.textContent = "Home", o.title = `恢复 ${i.name} 默认位置`, o.setAttribute("aria-label", o.title), o.addEventListener("click", () => {
|
|
6613
|
-
var
|
|
6614
|
-
return (
|
|
6630
|
+
var O;
|
|
6631
|
+
return (O = this.inspection) == null ? void 0 : O.resetJoint(i.id);
|
|
6615
6632
|
}), s.append(a);
|
|
6616
6633
|
const l = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
6617
6634
|
l.classList.add("vpu-joint-dial"), l.setAttribute("viewBox", "0 0 104 104"), l.setAttribute("aria-hidden", "true");
|
|
@@ -6626,19 +6643,19 @@ class Ja {
|
|
|
6626
6643
|
const m = document.createElementNS("http://www.w3.org/2000/svg", "line");
|
|
6627
6644
|
m.classList.add("vpu-joint-dial-needle");
|
|
6628
6645
|
const f = document.createElementNS("http://www.w3.org/2000/svg", "circle");
|
|
6629
|
-
f.setAttribute("r", "10"), f.classList.add("vpu-joint-dial-hit"), f.style.pointerEvents = "all", f.style.touchAction = "none", f.addEventListener("pointerdown", (
|
|
6646
|
+
f.setAttribute("r", "10"), f.classList.add("vpu-joint-dial-hit"), f.style.pointerEvents = "all", f.style.touchAction = "none", f.addEventListener("pointerdown", (O) => this.startDialGesture(i, l, f, O)), f.addEventListener("pointermove", this.moveDialGesture), f.addEventListener("pointerup", this.endDialGesture), f.addEventListener("pointercancel", this.endDialGesture), f.addEventListener("lostpointercapture", this.endDialGesture);
|
|
6647
|
+
const g = document.createElementNS("http://www.w3.org/2000/svg", "circle");
|
|
6648
|
+
g.setAttribute("r", "4.5"), g.classList.add("vpu-joint-dial-knob");
|
|
6630
6649
|
const b = document.createElementNS("http://www.w3.org/2000/svg", "circle");
|
|
6631
|
-
b.setAttribute("r", "4
|
|
6632
|
-
const
|
|
6633
|
-
|
|
6634
|
-
const v = document.createElement("
|
|
6635
|
-
v.className = "vpu-joint-
|
|
6636
|
-
const g = document.createElement("small");
|
|
6637
|
-
g.className = "vpu-joint-range-summary";
|
|
6650
|
+
b.setAttribute("cx", "52"), b.setAttribute("cy", "52"), b.setAttribute("r", "3.4"), b.classList.add("vpu-joint-dial-center"), l.append(d, c, p, h, m, f, g, b);
|
|
6651
|
+
const x = document.createElement("strong");
|
|
6652
|
+
x.className = "vpu-joint-current";
|
|
6653
|
+
const v = document.createElement("small");
|
|
6654
|
+
v.className = "vpu-joint-range-summary";
|
|
6638
6655
|
const w = document.createElement("div");
|
|
6639
6656
|
w.className = "vpu-joint-inspector-main";
|
|
6640
|
-
const
|
|
6641
|
-
|
|
6657
|
+
const y = document.createElement("div");
|
|
6658
|
+
y.className = "vpu-joint-inspector-summary", y.append(s, x, v), w.append(l, y);
|
|
6642
6659
|
const C = document.createElement("small");
|
|
6643
6660
|
C.className = "vpu-joint-relation", C.textContent = `${Ge(i.parent)} → ${Ge(i.child)}`, C.title = `${i.parent ?? "世界"} → ${i.child ?? "未绑定"}`;
|
|
6644
6661
|
const k = document.createElement("div");
|
|
@@ -6647,52 +6664,52 @@ class Ja {
|
|
|
6647
6664
|
E.type = "range", E.step = "any", E.setAttribute("aria-label", `${i.name} 位置`);
|
|
6648
6665
|
const P = document.createElement("input");
|
|
6649
6666
|
P.type = "number", P.step = "any", P.setAttribute("aria-label", `${i.name} 位置数值`);
|
|
6650
|
-
const
|
|
6651
|
-
var
|
|
6652
|
-
const
|
|
6653
|
-
Number.isFinite(
|
|
6667
|
+
const D = (O) => {
|
|
6668
|
+
var S, A;
|
|
6669
|
+
const G = O.valueAsNumber;
|
|
6670
|
+
Number.isFinite(G) && ((S = this.inspection) == null || S.select(i.id), (A = this.inspection) == null || A.setJointValue(i.id, G / Number(O.dataset.factor ?? 1)));
|
|
6654
6671
|
};
|
|
6655
|
-
E.addEventListener("input", () =>
|
|
6656
|
-
this.numberDrafts.delete(i.id),
|
|
6672
|
+
E.addEventListener("input", () => D(E)), P.addEventListener("input", () => this.numberDrafts.add(i.id)), P.addEventListener("change", () => {
|
|
6673
|
+
this.numberDrafts.delete(i.id), D(P), P.blur(), this.inspection && this.render(this.inspection.getSnapshot());
|
|
6657
6674
|
}), P.addEventListener("blur", () => {
|
|
6658
6675
|
this.numberDrafts.delete(i.id), this.inspection && this.render(this.inspection.getSnapshot());
|
|
6659
6676
|
});
|
|
6660
|
-
const
|
|
6661
|
-
|
|
6662
|
-
const
|
|
6663
|
-
|
|
6664
|
-
const
|
|
6665
|
-
|
|
6666
|
-
const
|
|
6667
|
-
|
|
6668
|
-
const
|
|
6669
|
-
if (
|
|
6670
|
-
const
|
|
6671
|
-
|
|
6672
|
-
const
|
|
6673
|
-
|
|
6674
|
-
for (const
|
|
6675
|
-
const
|
|
6676
|
-
|
|
6677
|
-
const
|
|
6678
|
-
|
|
6677
|
+
const T = document.createElement("span");
|
|
6678
|
+
T.className = "vpu-joint-unit", k.append(E, P, T, o);
|
|
6679
|
+
const M = document.createElement("small");
|
|
6680
|
+
M.className = "vpu-joint-limits";
|
|
6681
|
+
const V = document.createElement("small");
|
|
6682
|
+
V.className = "vpu-joint-feedback", V.hidden = !0;
|
|
6683
|
+
const _ = document.createElement("div");
|
|
6684
|
+
_.className = "vpu-joint-metadata", _.append(...Za(i)), n.append(w, C, k, V, M, _);
|
|
6685
|
+
const H = e.followersByDriver.get(i.id) ?? [];
|
|
6686
|
+
if (H.length) {
|
|
6687
|
+
const O = document.createElement("details");
|
|
6688
|
+
O.className = "vpu-joint-followers", O.dataset.driverId = i.id;
|
|
6689
|
+
const G = document.createElement("summary");
|
|
6690
|
+
G.textContent = `联动关节 ${H.length}`, O.append(G);
|
|
6691
|
+
for (const S of H) {
|
|
6692
|
+
const A = document.createElement("div");
|
|
6693
|
+
A.className = "vpu-joint-follower", A.dataset.jointId = S.id;
|
|
6694
|
+
const j = document.createElement("button");
|
|
6695
|
+
j.type = "button", j.className = "vpu-joint-name", j.textContent = e.labels.get(S.id) ?? We(S), j.title = `${S.name} · 由 ${i.name} 控制`, j.addEventListener("click", () => {
|
|
6679
6696
|
var Ue;
|
|
6680
6697
|
return (Ue = this.inspection) == null ? void 0 : Ue.select(i.id);
|
|
6681
6698
|
});
|
|
6682
6699
|
const de = document.createElement("span");
|
|
6683
6700
|
de.className = "vpu-joint-follower-value";
|
|
6684
6701
|
const fe = document.createElement("div");
|
|
6685
|
-
fe.className = "vpu-joint-heading", fe.append(
|
|
6702
|
+
fe.className = "vpu-joint-heading", fe.append(j, de);
|
|
6686
6703
|
const ce = document.createElement("small");
|
|
6687
6704
|
ce.className = "vpu-joint-mimic";
|
|
6688
|
-
const oe =
|
|
6689
|
-
ce.textContent =
|
|
6705
|
+
const oe = S.mimic ? t.get(S.mimic.joint) : void 0;
|
|
6706
|
+
ce.textContent = S.mimic ? `跟随 ${(oe == null ? void 0 : oe.name) ?? S.mimic.joint} · × ${B(S.mimic.multiplier)}${S.mimic.offset ? ` ${S.mimic.offset < 0 ? "−" : "+"} ${B(Math.abs(S.mimic.offset))} ${S.unit}` : ""}` : `由 ${i.name} 联动控制`;
|
|
6690
6707
|
const ve = document.createElement("small");
|
|
6691
|
-
ve.className = "vpu-joint-relation", ve.textContent = `${Ge(
|
|
6708
|
+
ve.className = "vpu-joint-relation", ve.textContent = `${Ge(S.parent)} → ${Ge(S.child)}`, ve.title = `${S.parent ?? "世界"} → ${S.child ?? "未绑定"}`, A.append(fe, ve, ce), this.followerRows.set(S.id, { element: A, value: de }), O.append(A);
|
|
6692
6709
|
}
|
|
6693
|
-
n.append(
|
|
6710
|
+
n.append(O);
|
|
6694
6711
|
}
|
|
6695
|
-
this.rows.set(i.id, { element: n, name: a, slider: E, value: P, unit:
|
|
6712
|
+
this.rows.set(i.id, { element: n, name: a, slider: E, value: P, unit: T, limits: M, feedback: V, reset: o, current: x, rangeSummary: v, dial: l, dialRange: c, dialWedge: p, dialNeedle: m, dialHome: h, dialKnobHit: f, dialKnob: g }), this.list.append(n);
|
|
6696
6713
|
}
|
|
6697
6714
|
}
|
|
6698
6715
|
startDialGesture(e, t, i, n) {
|
|
@@ -6702,7 +6719,7 @@ class Ja {
|
|
|
6702
6719
|
if (!s) return;
|
|
6703
6720
|
const a = s.getSnapshot(), o = a.playing && a.controlMode === "kinematic" && a.previewing === !0;
|
|
6704
6721
|
if (a.playing && !o) return;
|
|
6705
|
-
const l =
|
|
6722
|
+
const l = Ii(t, n);
|
|
6706
6723
|
if (l === null) return;
|
|
6707
6724
|
const d = a.jointValues[e.id] ?? e.defaultValue;
|
|
6708
6725
|
this.dialGesture = { pointerId: n.pointerId, joint: e, dial: t, hit: i, previousAngle: l, value: d }, i.classList.add("is-dragging"), i.style.cursor = "grabbing";
|
|
@@ -6766,14 +6783,14 @@ function We(r) {
|
|
|
6766
6783
|
function Za(r) {
|
|
6767
6784
|
var t;
|
|
6768
6785
|
const e = [["type", r.type]];
|
|
6769
|
-
if (r.movingMass != null && Number.isFinite(r.movingMass) && e.push(["moving mass", `${
|
|
6786
|
+
if (r.movingMass != null && Number.isFinite(r.movingMass) && e.push(["moving mass", `${B(r.movingMass)} kg`]), (t = r.drive) != null && t.type) {
|
|
6770
6787
|
const i = [
|
|
6771
|
-
Number.isFinite(r.drive.stiffness) ? `k ${
|
|
6772
|
-
Number.isFinite(r.drive.damping) ? `d ${
|
|
6788
|
+
Number.isFinite(r.drive.stiffness) ? `k ${B(r.drive.stiffness)}` : "",
|
|
6789
|
+
Number.isFinite(r.drive.damping) ? `d ${B(r.drive.damping)}` : ""
|
|
6773
6790
|
].filter(Boolean).join(" · ");
|
|
6774
6791
|
e.push(["drive", `${r.drive.type}${i ? ` · ${i}` : ""}`]);
|
|
6775
6792
|
}
|
|
6776
|
-
return r.maxEffort != null && Number.isFinite(r.maxEffort) && Math.abs(r.maxEffort) < 1e9 && e.push(["max effort", `${
|
|
6793
|
+
return r.maxEffort != null && Number.isFinite(r.maxEffort) && Math.abs(r.maxEffort) < 1e9 && e.push(["max effort", `${B(r.maxEffort)} ${r.type === "revolute" ? "N·m" : "N"}`]), e.flatMap(([i, n]) => {
|
|
6777
6794
|
const s = document.createElement("span");
|
|
6778
6795
|
s.className = "vpu-joint-metadata-key", s.textContent = i;
|
|
6779
6796
|
const a = document.createElement("span");
|
|
@@ -6784,21 +6801,21 @@ function ze(r, e) {
|
|
|
6784
6801
|
const t = r * Math.PI / 180;
|
|
6785
6802
|
return [52 + Math.sin(t) * e, 52 - Math.cos(t) * e];
|
|
6786
6803
|
}
|
|
6787
|
-
function
|
|
6804
|
+
function Ai(r, e, t) {
|
|
6788
6805
|
if (Math.abs(t - e) >= 359.5)
|
|
6789
6806
|
return `M 52 ${52 - r} A ${r} ${r} 0 1 1 52 ${52 + r} A ${r} ${r} 0 1 1 52 ${52 - r}`;
|
|
6790
6807
|
const [i, n] = ze(e, r), [s, a] = ze(t, r);
|
|
6791
6808
|
return `M ${i} ${n} A ${r} ${r} 0 ${Math.abs(t - e) > 180 ? 1 : 0} ${t >= e ? 1 : 0} ${s} ${a}`;
|
|
6792
6809
|
}
|
|
6793
6810
|
function Qa(r, e, t, i) {
|
|
6794
|
-
const n = i.upper - i.lower, s = (
|
|
6795
|
-
r.dialRange.setAttribute("d",
|
|
6796
|
-
const m =
|
|
6811
|
+
const n = i.upper - i.lower, s = (b) => e.unit === "rad" ? b * 180 / Math.PI : -135 + (n > 0 && Number.isFinite(n) ? Math.max(0, Math.min(1, (b - i.lower) / n)) : 0.5) * 270, a = s(t), o = s(e.defaultValue), [l, d] = ze(o, 35), [c, p] = ze(o, 49), h = Math.abs(a - o);
|
|
6812
|
+
r.dialRange.setAttribute("d", Ai(43, s(i.lower), s(i.upper)));
|
|
6813
|
+
const m = Ai(39, o, a);
|
|
6797
6814
|
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");
|
|
6798
|
-
const [f,
|
|
6799
|
-
r.dialNeedle.setAttribute("x2", String(f)), r.dialNeedle.setAttribute("y2", String(
|
|
6815
|
+
const [f, g] = ze(a, 40);
|
|
6816
|
+
r.dialNeedle.setAttribute("x2", String(f)), r.dialNeedle.setAttribute("y2", String(g)), r.dialKnobHit.setAttribute("cx", String(f)), r.dialKnobHit.setAttribute("cy", String(g)), r.dialKnob.setAttribute("cx", String(f)), r.dialKnob.setAttribute("cy", String(g)), r.dialHome.setAttribute("x1", String(l)), r.dialHome.setAttribute("y1", String(d)), r.dialHome.setAttribute("x2", String(c)), r.dialHome.setAttribute("y2", String(p));
|
|
6800
6817
|
}
|
|
6801
|
-
function
|
|
6818
|
+
function Ii(r, e) {
|
|
6802
6819
|
const t = r.getBoundingClientRect();
|
|
6803
6820
|
if (!(t.width > 0) || !(t.height > 0)) return null;
|
|
6804
6821
|
const i = (e.clientX - t.left) / t.width * 104, n = (e.clientY - t.top) / t.height * 104, s = i - 52, a = 52 - n;
|
|
@@ -6810,20 +6827,20 @@ function eo(r) {
|
|
|
6810
6827
|
function Ge(r) {
|
|
6811
6828
|
return (r == null ? void 0 : r.split("/").filter(Boolean).pop()) ?? (r === null ? "世界" : "未绑定");
|
|
6812
6829
|
}
|
|
6813
|
-
function
|
|
6830
|
+
function B(r) {
|
|
6814
6831
|
return Number(r.toFixed(4)).toString();
|
|
6815
6832
|
}
|
|
6816
|
-
function
|
|
6833
|
+
function Li(r, e) {
|
|
6817
6834
|
const t = r.controlLimits ?? r.limits;
|
|
6818
6835
|
if (t && Number.isFinite(t.lower) && Number.isFinite(t.upper) && t.lower <= t.upper) return t;
|
|
6819
6836
|
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);
|
|
6820
6837
|
return { lower: n, upper: Math.max(n, s) };
|
|
6821
6838
|
}
|
|
6822
|
-
const
|
|
6839
|
+
const Di = "http://www.w3.org/2000/svg", ne = "var(--vpu-joint-highlight)", Ti = { dark: "#21c7be", light: "#21c7be" }, to = 140, De = (r) => Number.isFinite(r.x) && Number.isFinite(r.y) && Number.isFinite(r.z), Ni = (r, e) => Number(r.toFixed(e)).toString(), yt = (r, e) => r.unit === "rad" ? `${Ni(e * 180 / Math.PI, 1)}°` : `${Ni(e, 4)} m`;
|
|
6823
6840
|
function Te(r) {
|
|
6824
6841
|
return !r.playing || r.controlMode === "kinematic" && r.previewing === !0;
|
|
6825
6842
|
}
|
|
6826
|
-
function
|
|
6843
|
+
function It(r) {
|
|
6827
6844
|
const e = /* @__PURE__ */ new Set(), t = new Set(r);
|
|
6828
6845
|
for (const i of t) {
|
|
6829
6846
|
let n = !0;
|
|
@@ -6838,11 +6855,11 @@ function At(r) {
|
|
|
6838
6855
|
}
|
|
6839
6856
|
return e;
|
|
6840
6857
|
}
|
|
6841
|
-
function
|
|
6842
|
-
return Mn(
|
|
6858
|
+
function Oi(r) {
|
|
6859
|
+
return Mn(It(r));
|
|
6843
6860
|
}
|
|
6844
6861
|
function Mn(r) {
|
|
6845
|
-
const e = new
|
|
6862
|
+
const e = new Q();
|
|
6846
6863
|
for (const t of r)
|
|
6847
6864
|
(Array.isArray(t.material) ? t.material : [t.material]).some((n) => n.visible) && (t.updateWorldMatrix(!0, !1), t.geometry.boundingBox || t.geometry.computeBoundingBox(), t.geometry.boundingBox && e.union(t.geometry.boundingBox.clone().applyMatrix4(t.matrixWorld)));
|
|
6848
6865
|
return e;
|
|
@@ -6894,9 +6911,9 @@ class ro {
|
|
|
6894
6911
|
u(this, "joints", []);
|
|
6895
6912
|
u(this, "plan", Fe([]));
|
|
6896
6913
|
u(this, "occluded", /* @__PURE__ */ new Set());
|
|
6897
|
-
u(this, "occlusionRay", new
|
|
6898
|
-
u(this, "rayScreen", new
|
|
6899
|
-
u(this, "rayPoint", new
|
|
6914
|
+
u(this, "occlusionRay", new dt());
|
|
6915
|
+
u(this, "rayScreen", new Z());
|
|
6916
|
+
u(this, "rayPoint", new R());
|
|
6900
6917
|
u(this, "lastOcclusion", -1 / 0);
|
|
6901
6918
|
u(this, "occlusionTimer", null);
|
|
6902
6919
|
u(this, "highlightColor");
|
|
@@ -6911,17 +6928,17 @@ class ro {
|
|
|
6911
6928
|
u(this, "offsetX", 0);
|
|
6912
6929
|
u(this, "offsetY", 0);
|
|
6913
6930
|
var o;
|
|
6914
|
-
this.inspection = e, this.options = t, this.highlightColor = new tt(((o = t.getHighlightColor) == null ? void 0 : o.call(t)) ||
|
|
6931
|
+
this.inspection = e, this.options = t, this.highlightColor = new tt(((o = t.getHighlightColor) == null ? void 0 : o.call(t)) || Ti[t.theme ?? "dark"]);
|
|
6915
6932
|
const i = t.canvas.ownerDocument;
|
|
6916
6933
|
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", "三维关节控制,拖动关节点或连接部件调整姿态");
|
|
6917
6934
|
const n = (l, d, c) => {
|
|
6918
|
-
const p = i.createElementNS(
|
|
6935
|
+
const p = i.createElementNS(Di, l);
|
|
6919
6936
|
for (const [h, m] of Object.entries(d)) p.setAttribute(h, m);
|
|
6920
6937
|
return c.append(p), p;
|
|
6921
6938
|
};
|
|
6922
|
-
this.svg = i.createElementNS(
|
|
6939
|
+
this.svg = i.createElementNS(Di, "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);
|
|
6923
6940
|
const s = { fill: "none", "stroke-linecap": "round", "stroke-linejoin": "round" };
|
|
6924
|
-
this.wedge = n("path", { class: "vpu-joint-dial-wedge", fill:
|
|
6941
|
+
this.wedge = n("path", { class: "vpu-joint-dial-wedge", fill: ne, "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: ne, "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: ne, "stroke-width": "2" }, this.dial), this.knob = n("circle", { class: "vpu-joint-dial-knob", r: "5", fill: ne, stroke: "#171717", "stroke-width": "1.5" }, this.dial), this.value = n("text", { class: "vpu-joint-dial-value", fill: ne, "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);
|
|
6925
6942
|
const a = (l) => {
|
|
6926
6943
|
Object.assign(l.style, { pointerEvents: "none", touchAction: "none", cursor: "grab" }), l.addEventListener("pointerdown", (d) => {
|
|
6927
6944
|
const c = this.dial.dataset.jointId;
|
|
@@ -6940,7 +6957,7 @@ class ro {
|
|
|
6940
6957
|
themeChanged(e) {
|
|
6941
6958
|
var t, i;
|
|
6942
6959
|
if (!this.disposed) {
|
|
6943
|
-
this.highlightColor.set(((i = (t = this.options).getHighlightColor) == null ? void 0 : i.call(t)) ||
|
|
6960
|
+
this.highlightColor.set(((i = (t = this.options).getHighlightColor) == null ? void 0 : i.call(t)) || Ti[e]), this.element.style.setProperty("--vpu-joint-highlight", this.highlightColor.getStyle());
|
|
6944
6961
|
for (const n of this.highlights.values()) n.strength = -1;
|
|
6945
6962
|
this.update(), this.options.requestRender();
|
|
6946
6963
|
}
|
|
@@ -6956,42 +6973,42 @@ class ro {
|
|
|
6956
6973
|
this.disposed || (this.pulsePending = !0, this.update());
|
|
6957
6974
|
}
|
|
6958
6975
|
update() {
|
|
6959
|
-
var f,
|
|
6976
|
+
var f, g, b;
|
|
6960
6977
|
if (this.disposed) return;
|
|
6961
6978
|
const e = this.inspection.getSnapshot(), t = Te(e);
|
|
6962
6979
|
this.joints !== e.joints && (this.joints = e.joints, this.plan = Fe(e.joints));
|
|
6963
|
-
const i = new Map(e.joints.map((
|
|
6964
|
-
for (const [
|
|
6965
|
-
s.has(
|
|
6980
|
+
const i = new Map(e.joints.map((x) => [x.id, x])), n = this.plan.drivers, s = new Set(n.map((x) => x.id));
|
|
6981
|
+
for (const [x, v] of this.pins)
|
|
6982
|
+
s.has(x) || (v.button.remove(), this.pins.delete(x), this.bases.delete(x));
|
|
6966
6983
|
const a = this.options.canvas.getBoundingClientRect(), o = this.element.getBoundingClientRect();
|
|
6967
6984
|
this.width = a.width || this.options.canvas.clientWidth || 1, this.height = a.height || this.options.canvas.clientHeight || 1, this.offsetX = a.left - o.left, this.offsetY = a.top - o.top;
|
|
6968
6985
|
const l = this.options.getCamera();
|
|
6969
6986
|
l.updateWorldMatrix(!0, !1);
|
|
6970
6987
|
const d = this.plan.driverIds.get(e.selectedJointId ?? "") ?? null, c = this.plan.driverIds.get(this.hover ?? "") ?? null, p = this.plan.driverIds.get(this.dragging ?? "") ?? null, h = /* @__PURE__ */ new Map();
|
|
6971
6988
|
if (t)
|
|
6972
|
-
for (const
|
|
6973
|
-
const
|
|
6974
|
-
w && h.set(
|
|
6989
|
+
for (const x of n) {
|
|
6990
|
+
const v = (g = (f = this.inspection).jointWorldFrame) == null ? void 0 : g.call(f, x.id), w = v && De(v.position) ? this.project(v.position, l) : null;
|
|
6991
|
+
w && h.set(x.id, { world: v.position, point: w });
|
|
6975
6992
|
}
|
|
6976
6993
|
this.updateOcclusion(h, l);
|
|
6977
|
-
for (const
|
|
6978
|
-
const
|
|
6979
|
-
|
|
6980
|
-
const C = this.jointValue(e,
|
|
6981
|
-
|
|
6982
|
-
const k =
|
|
6983
|
-
if (
|
|
6984
|
-
|
|
6985
|
-
const
|
|
6986
|
-
|
|
6994
|
+
for (const x of n) {
|
|
6995
|
+
const v = this.pins.get(x.id) ?? this.makePin(x), w = (b = h.get(x.id)) == null ? void 0 : b.point, y = !!w;
|
|
6996
|
+
v.button.hidden = !y, v.button.style.display = y ? "grid" : "none", v.button.disabled = !t;
|
|
6997
|
+
const C = this.jointValue(e, x);
|
|
6998
|
+
v.button.setAttribute("aria-label", `${x.name} · ${yt(x, C)},拖动调整关节`), v.button.setAttribute("aria-pressed", String(d === x.id)), v.button.dataset.selected = String(d === x.id);
|
|
6999
|
+
const k = x.id === d || x.id === c || x.id === p, E = this.occluded.has(x.id), P = E && !k;
|
|
7000
|
+
if (v.button.dataset.occluded = String(E), v.label.textContent = `${x.name} · ${yt(x, C)}`, v.label.hidden = !k, v.button.style.opacity = P ? "0.4" : "1", v.button.style.zIndex = k ? "3" : P ? "1" : "2", v.button.style.cursor = p === x.id ? "grabbing" : "grab", v.dot.style.background = k ? ne : "rgba(12,12,12,.82)", v.dot.style.transform = k ? "scale(1.25)" : "none", v.dot.style.boxShadow = d === x.id ? `0 0 0 4px color-mix(in srgb, ${ne} 25%, transparent),0 0 0 1px #333` : "0 0 0 1px #333", w) {
|
|
7001
|
+
v.button.style.transform = `translate(${w.x.toFixed(1)}px, ${w.y.toFixed(1)}px)`;
|
|
7002
|
+
const D = w.x - this.offsetX > this.width - 180;
|
|
7003
|
+
v.label.style.left = D ? "auto" : "24px", v.label.style.right = D ? "24px" : "auto";
|
|
6987
7004
|
}
|
|
6988
7005
|
}
|
|
6989
7006
|
this.startPendingPulse(), this.updateHighlights(e, d, c, p);
|
|
6990
7007
|
const m = i.get(p ?? d ?? "");
|
|
6991
7008
|
if (this.dial.setAttribute("display", "none"), this.dialLineHit.style.pointerEvents = "none", this.dialHit.style.pointerEvents = "none", t && m) {
|
|
6992
7009
|
this.updateDial(e, m, l);
|
|
6993
|
-
const
|
|
6994
|
-
this.dialHit.style.pointerEvents =
|
|
7010
|
+
const x = this.dial.getAttribute("display") === "inline", v = p === m.id ? "grabbing" : "grab";
|
|
7011
|
+
this.dialHit.style.pointerEvents = x ? "all" : "none", this.dialLineHit.style.pointerEvents = x && m.unit === "rad" ? "all" : "none", this.dialHit.style.cursor = v, this.dialLineHit.style.cursor = v;
|
|
6995
7012
|
}
|
|
6996
7013
|
}
|
|
6997
7014
|
dispose() {
|
|
@@ -7017,7 +7034,7 @@ class ro {
|
|
|
7017
7034
|
height: "11px",
|
|
7018
7035
|
margin: "-5.5px 0 0 -5.5px",
|
|
7019
7036
|
boxSizing: "border-box",
|
|
7020
|
-
border: `2px solid ${
|
|
7037
|
+
border: `2px solid ${ne}`,
|
|
7021
7038
|
borderRadius: "50%",
|
|
7022
7039
|
pointerEvents: "none",
|
|
7023
7040
|
opacity: "0",
|
|
@@ -7057,7 +7074,7 @@ class ro {
|
|
|
7057
7074
|
const n = t.createElement("span");
|
|
7058
7075
|
n.className = "vpu-joint-scene-dot", Object.assign(n.style, { width: "11px", height: "11px", boxSizing: "border-box", border: "2px solid #fff", borderRadius: "50%", pointerEvents: "none" });
|
|
7059
7076
|
const s = t.createElement("span");
|
|
7060
|
-
s.className = "vpu-joint-scene-label", Object.assign(s.style, { position: "absolute", top: "50%", transform: "translateY(-50%)", padding: "2px 6px", whiteSpace: "nowrap", border: `1px solid color-mix(in srgb, ${
|
|
7077
|
+
s.className = "vpu-joint-scene-label", Object.assign(s.style, { position: "absolute", top: "50%", transform: "translateY(-50%)", padding: "2px 6px", whiteSpace: "nowrap", border: `1px solid color-mix(in srgb, ${ne} 65%, transparent)`, borderRadius: "3px", background: "rgba(20,20,20,.9)", color: "#fff", font: "700 10px/1.3 ui-monospace, monospace", pointerEvents: "none" }), i.append(n, s), i.addEventListener("pointerdown", (o) => {
|
|
7061
7078
|
!this.disposed && Te(this.inspection.getSnapshot()) && o.button === 0 && this.options.onPointerDown(e.id, o);
|
|
7062
7079
|
}), i.addEventListener("pointerenter", () => this.setHover(e.id)), i.addEventListener("pointerleave", () => {
|
|
7063
7080
|
this.hover === e.id && this.setHover(null);
|
|
@@ -7096,18 +7113,18 @@ class ro {
|
|
|
7096
7113
|
this.clearOcclusionTimer(), this.lastOcclusion = i, this.occluded.clear();
|
|
7097
7114
|
const s = this.inspection.pickRoots();
|
|
7098
7115
|
for (const p of s) p.updateWorldMatrix(!0, !0);
|
|
7099
|
-
const a = [...
|
|
7116
|
+
const a = [...It(s)];
|
|
7100
7117
|
if (!a.length) return;
|
|
7101
|
-
const o = Mn(a), l = o.isEmpty() ? 0 : o.getBoundingSphere(new
|
|
7118
|
+
const o = Mn(a), l = o.isEmpty() ? 0 : o.getBoundingSphere(new qt()).radius, d = Number.isFinite(l) ? Math.max(l * 0.09, 1e-8) : 1e-8, c = this.occlusionRay;
|
|
7102
7119
|
c.layers.mask = t.layers.mask;
|
|
7103
7120
|
for (const [p, { world: h }] of e) {
|
|
7104
7121
|
this.rayPoint.copy(h).project(t), this.rayScreen.set(this.rayPoint.x, this.rayPoint.y), c.setFromCamera(this.rayScreen, t);
|
|
7105
7122
|
const m = this.rayPoint.copy(h).sub(c.ray.origin).dot(c.ray.direction);
|
|
7106
7123
|
if (this.rayPoint.set(this.rayScreen.x, this.rayScreen.y, -1).unproject(t), c.near = Math.max(0, this.rayPoint.sub(c.ray.origin).dot(c.ray.direction)), c.far = m - d, c.far <= c.near) continue;
|
|
7107
|
-
c.intersectObjects(a, !1).some((
|
|
7108
|
-
var
|
|
7109
|
-
const
|
|
7110
|
-
return (
|
|
7124
|
+
c.intersectObjects(a, !1).some((g) => {
|
|
7125
|
+
var v;
|
|
7126
|
+
const b = g.object, x = Array.isArray(b.material) ? b.material[((v = g.face) == null ? void 0 : v.materialIndex) ?? 0] : b.material;
|
|
7127
|
+
return (x == null ? void 0 : x.visible) && x.colorWrite && (!x.transparent || x.opacity > 0);
|
|
7111
7128
|
}) && this.occluded.add(p);
|
|
7112
7129
|
}
|
|
7113
7130
|
}
|
|
@@ -7126,7 +7143,7 @@ class ro {
|
|
|
7126
7143
|
}
|
|
7127
7144
|
}
|
|
7128
7145
|
for (const { strength: o, roots: l } of a.values())
|
|
7129
|
-
for (const d of
|
|
7146
|
+
for (const d of It([...l]))
|
|
7130
7147
|
(Array.isArray(d.material) ? d.material : [d.material]).some((p) => p.visible) && s.set(d, Math.max(s.get(d) ?? 0, o));
|
|
7131
7148
|
}
|
|
7132
7149
|
for (const [a, o] of this.highlights)
|
|
@@ -7148,24 +7165,24 @@ class ro {
|
|
|
7148
7165
|
for (const i of t.clones) i.dispose();
|
|
7149
7166
|
}
|
|
7150
7167
|
basis(e, t, i, n) {
|
|
7151
|
-
var
|
|
7168
|
+
var b, x, v, w, y, C;
|
|
7152
7169
|
const s = this.bases.get(e.id);
|
|
7153
7170
|
if (s) return s;
|
|
7154
|
-
const a = e.child ? (
|
|
7155
|
-
let d = l.isEmpty() ? 0 : l.getBoundingSphere(new
|
|
7171
|
+
const a = e.child ? (x = (b = this.inspection).objectForBody) == null ? void 0 : x.call(b, e.child) : null, o = Oi(a ? [a] : []), l = Oi(((w = (v = this.inspection).pickRoots) == null ? void 0 : w.call(v)) ?? []);
|
|
7172
|
+
let d = l.isEmpty() ? 0 : l.getBoundingSphere(new qt()).radius;
|
|
7156
7173
|
(!(d > 0) || !Number.isFinite(d)) && (d = 0.1);
|
|
7157
|
-
const p = (o.isEmpty() ? t.clone() : o.getCenter(new
|
|
7174
|
+
const p = (o.isEmpty() ? t.clone() : o.getCenter(new R())).sub(t);
|
|
7158
7175
|
p.addScaledVector(i, -p.dot(i));
|
|
7159
7176
|
let h = p.length();
|
|
7160
7177
|
h < d * 1e-5 && (p.set(0, 1, 0), Math.abs(p.dot(i)) > 0.9 && p.set(1, 0, 0), p.addScaledVector(i, -p.dot(i)), h = 0.2 * d), p.normalize(), e.unit === "rad" && p.applyAxisAngle(i, e.defaultValue - n);
|
|
7161
|
-
const m = (e.parent ? (C = (
|
|
7178
|
+
const m = (e.parent ? (C = (y = this.inspection).objectForBody) == null ? void 0 : C.call(y, e.parent) : null) ?? null;
|
|
7162
7179
|
m && (m.updateWorldMatrix(!0, !1), p.transformDirection(m.matrixWorld.clone().invert()));
|
|
7163
|
-
const f = Math.min(0.17 * d, Math.max(0.07 * d, 0.62 * h)),
|
|
7164
|
-
return this.bases.set(e.id,
|
|
7180
|
+
const f = Math.min(0.17 * d, Math.max(0.07 * d, 0.62 * h)), g = { parent: m, direction: p, radius: e.unit === "rad" ? f * 1.35 : f };
|
|
7181
|
+
return this.bases.set(e.id, g), g;
|
|
7165
7182
|
}
|
|
7166
7183
|
updateDial(e, t, i) {
|
|
7167
|
-
var w,
|
|
7168
|
-
const n = (
|
|
7184
|
+
var w, y;
|
|
7185
|
+
const n = (y = (w = this.inspection).jointWorldFrame) == null ? void 0 : y.call(w, t.id);
|
|
7169
7186
|
if (!n || !De(n.position) || !De(n.axis) || n.axis.lengthSq() < 1e-12) return;
|
|
7170
7187
|
const s = this.project(n.position, i);
|
|
7171
7188
|
if (!s) return;
|
|
@@ -7173,24 +7190,24 @@ class ro {
|
|
|
7173
7190
|
if (l.parent && (l.parent.updateWorldMatrix(!0, !1), d.transformDirection(l.parent.matrixWorld)), d.addScaledVector(o, -d.dot(o)).normalize(), d.lengthSq() < 1e-12) return;
|
|
7174
7191
|
const c = (C, k = 1) => this.project(t.unit === "rad" ? n.position.clone().addScaledVector(d.clone().applyAxisAngle(o, C - t.defaultValue), l.radius * k) : n.position.clone().addScaledVector(o, C - a), i), p = t.controlLimits ?? t.limits, h = Number.isFinite(p == null ? void 0 : p.lower) ? p.lower : t.unit === "rad" ? t.defaultValue - Math.PI : t.defaultValue - l.radius, m = Number.isFinite(p == null ? void 0 : p.upper) ? p.upper : t.unit === "rad" ? t.defaultValue + Math.PI : t.defaultValue + l.radius, f = (C, k) => {
|
|
7175
7192
|
const E = t.unit === "rad" ? Math.max(2, Math.min(128, Math.ceil(Math.abs(k - C) / (Math.PI / 36)))) : 1, P = [];
|
|
7176
|
-
for (let
|
|
7177
|
-
const
|
|
7178
|
-
if (!
|
|
7179
|
-
P.push(
|
|
7193
|
+
for (let D = 0; D <= E; D += 1) {
|
|
7194
|
+
const T = c(C + (k - C) * D / E);
|
|
7195
|
+
if (!T) return "";
|
|
7196
|
+
P.push(T);
|
|
7180
7197
|
}
|
|
7181
|
-
return P.map((
|
|
7182
|
-
},
|
|
7183
|
-
if (!
|
|
7184
|
-
this.dial.setAttribute("display", "inline"), this.dial.dataset.jointId = t.id, this.range.setAttribute("d",
|
|
7185
|
-
const
|
|
7186
|
-
if (this.range.setAttribute("stroke-dasharray",
|
|
7187
|
-
this.wedge.setAttribute("d", `M ${s.x.toFixed(1)} ${s.y.toFixed(1)} ${
|
|
7188
|
-
const C = c(a, 1.55) ??
|
|
7198
|
+
return P.map((D, T) => `${T ? "L" : "M"} ${D.x.toFixed(1)} ${D.y.toFixed(1)}`).join(" ");
|
|
7199
|
+
}, g = c(a), b = f(h, m), x = f(t.defaultValue, a);
|
|
7200
|
+
if (!g || !b || !x) return;
|
|
7201
|
+
this.dial.setAttribute("display", "inline"), this.dial.dataset.jointId = t.id, this.range.setAttribute("d", b), this.progress.setAttribute("d", x);
|
|
7202
|
+
const v = t.unit === "rad" && m - h >= 2 * Math.PI - 0.01;
|
|
7203
|
+
if (this.range.setAttribute("stroke-dasharray", v ? "3 4" : "none"), this.knob.setAttribute("cx", g.x.toFixed(1)), this.knob.setAttribute("cy", g.y.toFixed(1)), this.dialHit.setAttribute("cx", g.x.toFixed(1)), this.dialHit.setAttribute("cy", g.y.toFixed(1)), this.value.textContent = yt(t, a), t.unit === "rad") {
|
|
7204
|
+
this.wedge.setAttribute("d", `M ${s.x.toFixed(1)} ${s.y.toFixed(1)} ${x.replace(/^M/, "L")} Z`), this.needle.setAttribute("display", "inline"), this.line(this.needle, s, g), this.dialLineHit.setAttribute("display", "inline"), this.line(this.dialLineHit, s, g), 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", v ? "none" : "inline"), this.upper.setAttribute("display", v ? "none" : "inline");
|
|
7205
|
+
const C = c(a, 1.55) ?? g;
|
|
7189
7206
|
this.value.setAttribute("x", C.x.toFixed(1)), this.value.setAttribute("y", C.y.toFixed(1));
|
|
7190
7207
|
} else {
|
|
7191
7208
|
this.wedge.setAttribute("d", ""), this.needle.setAttribute("display", "none"), this.dialLineHit.setAttribute("display", "none"), this.lower.setAttribute("display", "none"), this.upper.setAttribute("display", "none");
|
|
7192
7209
|
const C = c(t.defaultValue);
|
|
7193
|
-
this.line(this.home, { x: C.x - 5, y: C.y }, { x: C.x + 5, y: C.y }), this.value.setAttribute("x", (
|
|
7210
|
+
this.line(this.home, { x: C.x - 5, y: C.y }, { x: C.x + 5, y: C.y }), this.value.setAttribute("x", (g.x + 24).toFixed(1)), this.value.setAttribute("y", (g.y - 14).toFixed(1));
|
|
7194
7211
|
}
|
|
7195
7212
|
}
|
|
7196
7213
|
line(e, t, i) {
|
|
@@ -7201,20 +7218,20 @@ class ro {
|
|
|
7201
7218
|
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));
|
|
7202
7219
|
}
|
|
7203
7220
|
}
|
|
7204
|
-
function
|
|
7221
|
+
function xt(r, e, t) {
|
|
7205
7222
|
const i = r.clone().project(e);
|
|
7206
|
-
return new
|
|
7223
|
+
return new Z(t.left + (i.x + 1) * t.width / 2, t.top + (1 - i.y) * t.height / 2);
|
|
7207
7224
|
}
|
|
7208
7225
|
function so(r, e, t, i, n, s, a) {
|
|
7209
7226
|
if (e.width <= 0 || e.height <= 0 || t.axis.lengthSq() < 1e-12) return 0;
|
|
7210
7227
|
r.updateMatrixWorld(!0);
|
|
7211
|
-
const o = t.axis.clone().normalize(), l = a ? o : o.clone().cross(i.clone().sub(t.position)), d =
|
|
7228
|
+
const o = t.axis.clone().normalize(), l = a ? o : o.clone().cross(i.clone().sub(t.position)), d = xt(i, r, e), c = xt(i.clone().addScaledVector(l, 0.05), r, e).sub(d).multiplyScalar(20), p = s.clone().sub(n), h = c.lengthSq();
|
|
7212
7229
|
let m = 0;
|
|
7213
7230
|
if (h > (a ? 1 : 900)) m = p.dot(c) / h;
|
|
7214
7231
|
else if (!a) {
|
|
7215
|
-
const f =
|
|
7216
|
-
if (
|
|
7217
|
-
m = Math.atan2(
|
|
7232
|
+
const f = xt(t.position, r, e), g = n.clone().sub(f), b = s.clone().sub(f);
|
|
7233
|
+
if (g.lengthSq() < 16 || b.lengthSq() < 16) return 0;
|
|
7234
|
+
m = Math.atan2(b.y, b.x) - Math.atan2(g.y, g.x), m = Math.atan2(Math.sin(m), Math.cos(m)), o.dot(r.getWorldPosition(new R()).sub(t.position)) > 0 && (m = -m);
|
|
7218
7235
|
}
|
|
7219
7236
|
return Number.isFinite(m) ? a ? m : Math.max(-0.5, Math.min(0.5, m)) : 0;
|
|
7220
7237
|
}
|
|
@@ -7222,7 +7239,7 @@ class ao {
|
|
|
7222
7239
|
constructor(e, t) {
|
|
7223
7240
|
u(this, "element");
|
|
7224
7241
|
u(this, "overlay");
|
|
7225
|
-
u(this, "raycaster", new
|
|
7242
|
+
u(this, "raycaster", new dt());
|
|
7226
7243
|
u(this, "gesture", null);
|
|
7227
7244
|
u(this, "background", null);
|
|
7228
7245
|
u(this, "unsubscribe");
|
|
@@ -7234,13 +7251,13 @@ class ao {
|
|
|
7234
7251
|
u(this, "down", (e) => {
|
|
7235
7252
|
if (!this.fromCanvas(e) || this.gesture || !this.editable() || e.button !== 0 || e.isPrimary === !1 || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
7236
7253
|
const t = this.pick(e);
|
|
7237
|
-
t ? this.start(t.motion, t.point, t.body, e) : this.background = { pointerId: e.pointerId, point: new
|
|
7254
|
+
t ? this.start(t.motion, t.point, t.body, e) : this.background = { pointerId: e.pointerId, point: new Z(e.clientX, e.clientY), moved: !1 };
|
|
7238
7255
|
});
|
|
7239
7256
|
u(this, "move", (e) => {
|
|
7240
7257
|
var d, c, p;
|
|
7241
7258
|
const t = this.gesture;
|
|
7242
7259
|
if (!t) {
|
|
7243
|
-
if (!this.fromCanvas(e) || (((d = this.background) == null ? void 0 : d.pointerId) === e.pointerId && this.background.point.distanceTo(new
|
|
7260
|
+
if (!this.fromCanvas(e) || (((d = this.background) == null ? void 0 : d.pointerId) === e.pointerId && this.background.point.distanceTo(new Z(e.clientX, e.clientY)) >= 4 && (this.background.moved = !0), !this.editable() || e.buttons)) return;
|
|
7244
7261
|
const h = this.pick(e);
|
|
7245
7262
|
this.overlay.setHover((h == null ? void 0 : h.motion.driver.id) ?? null), h ? (this.hoverCursor === null && (this.hoverCursor = this.options.canvas.style.cursor), this.options.canvas.style.cursor = "grab") : this.restoreHoverCursor();
|
|
7246
7263
|
return;
|
|
@@ -7251,7 +7268,7 @@ class ao {
|
|
|
7251
7268
|
return;
|
|
7252
7269
|
}
|
|
7253
7270
|
e.preventDefault(), e.stopImmediatePropagation();
|
|
7254
|
-
const i = new
|
|
7271
|
+
const i = new Z(e.clientX, e.clientY);
|
|
7255
7272
|
if (!t.moved && i.distanceTo(t.start) < 4) return;
|
|
7256
7273
|
t.moved = !0;
|
|
7257
7274
|
const n = (p = (c = this.inspection).jointWorldFrame) == null ? void 0 : p.call(c, t.via.id);
|
|
@@ -7266,7 +7283,7 @@ class ao {
|
|
|
7266
7283
|
});
|
|
7267
7284
|
u(this, "up", (e) => {
|
|
7268
7285
|
var t, i;
|
|
7269
|
-
((t = this.gesture) == null ? void 0 : t.pointerId) === e.pointerId ? (e.preventDefault(), e.stopImmediatePropagation(), this.stop()) : ((i = this.background) == null ? void 0 : i.pointerId) === e.pointerId && (this.fromCanvas(e) && this.editable() && e.button === 0 && !this.background.moved && this.background.point.distanceTo(new
|
|
7286
|
+
((t = this.gesture) == null ? void 0 : t.pointerId) === e.pointerId ? (e.preventDefault(), e.stopImmediatePropagation(), this.stop()) : ((i = this.background) == null ? void 0 : i.pointerId) === e.pointerId && (this.fromCanvas(e) && this.editable() && e.button === 0 && !this.background.moved && this.background.point.distanceTo(new Z(e.clientX, e.clientY)) < 4 && this.inspection.select(null), this.background = null);
|
|
7270
7287
|
});
|
|
7271
7288
|
u(this, "cancel", (e) => {
|
|
7272
7289
|
var t;
|
|
@@ -7323,24 +7340,24 @@ class ao {
|
|
|
7323
7340
|
return !this.disposed && e.controlMode === "kinematic" && (!e.playing || e.previewing === !0);
|
|
7324
7341
|
}
|
|
7325
7342
|
pick(e) {
|
|
7326
|
-
var h, m, f,
|
|
7343
|
+
var h, m, f, g, b;
|
|
7327
7344
|
const i = this.options.canvas.getBoundingClientRect();
|
|
7328
7345
|
if (!i.width || !i.height) return null;
|
|
7329
7346
|
const n = this.options.getCamera();
|
|
7330
7347
|
n.updateMatrixWorld(!0);
|
|
7331
7348
|
const s = ((m = (h = this.inspection).pickRoots) == null ? void 0 : m.call(h)) ?? [];
|
|
7332
|
-
for (const
|
|
7333
|
-
this.raycaster.firstHitOnly = !0, this.raycaster.setFromCamera(new
|
|
7334
|
-
const a = this.raycaster.intersectObjects([...s], !0).find((
|
|
7335
|
-
if (!
|
|
7336
|
-
for (let
|
|
7349
|
+
for (const x of s) x.updateWorldMatrix(!0, !0);
|
|
7350
|
+
this.raycaster.firstHitOnly = !0, this.raycaster.setFromCamera(new Z((e.clientX - i.left) / i.width * 2 - 1, 1 - (e.clientY - i.top) / i.height * 2), n);
|
|
7351
|
+
const a = this.raycaster.intersectObjects([...s], !0).find((x) => {
|
|
7352
|
+
if (!x.object.isMesh) return !1;
|
|
7353
|
+
for (let v = x.object; v; v = v.parent) if (!v.visible) return !1;
|
|
7337
7354
|
return !0;
|
|
7338
7355
|
});
|
|
7339
7356
|
if (!a) return null;
|
|
7340
7357
|
let o = a.object;
|
|
7341
7358
|
for (; o && typeof o.userData.bodyId != "number"; ) o = o.parent;
|
|
7342
7359
|
if (!o) return null;
|
|
7343
|
-
const l = this.inspection.getSnapshot().joints, d = l.find((
|
|
7360
|
+
const l = this.inspection.getSnapshot().joints, d = l.find((x) => x.id === this.inspection.getSnapshot().selectedJointId && x.child === o.name), c = (d == null ? void 0 : d.id) ?? ((g = (f = this.inspection).jointForBody) == null ? void 0 : g.call(f, o.name)) ?? ((b = l.find((x) => x.child === o.name)) == null ? void 0 : b.id), p = c ? bt(l, c) : null;
|
|
7344
7361
|
return p ? { motion: p, point: a.point, body: o } : null;
|
|
7345
7362
|
}
|
|
7346
7363
|
start(e, t, i, n) {
|
|
@@ -7349,7 +7366,7 @@ class ao {
|
|
|
7349
7366
|
this.restoreHoverCursor(), this.inspection.select(e.driver.id);
|
|
7350
7367
|
const s = this.inspection.getSnapshot().jointValues[e.driver.id] ?? e.driver.defaultValue;
|
|
7351
7368
|
this.inspection.setJointValue(e.driver.id, s), this.background = null;
|
|
7352
|
-
const a = new
|
|
7369
|
+
const a = new Z(n.clientX, n.clientY);
|
|
7353
7370
|
this.gesture = {
|
|
7354
7371
|
pointerId: n.pointerId,
|
|
7355
7372
|
...e,
|
|
@@ -7367,16 +7384,16 @@ class ao {
|
|
|
7367
7384
|
}
|
|
7368
7385
|
startPin(e, t) {
|
|
7369
7386
|
var l, d, c, p;
|
|
7370
|
-
const i =
|
|
7387
|
+
const i = bt(this.inspection.getSnapshot().joints, e);
|
|
7371
7388
|
if (!i || !this.editable()) return;
|
|
7372
7389
|
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);
|
|
7373
7390
|
if (!s) return;
|
|
7374
|
-
const a = n ? new
|
|
7391
|
+
const a = n ? new Q().setFromObject(n) : new Q(), o = a.isEmpty() ? s.position.clone() : a.getCenter(new R());
|
|
7375
7392
|
this.start(i, o, n, t);
|
|
7376
7393
|
}
|
|
7377
7394
|
startDial(e, t) {
|
|
7378
7395
|
var s, a;
|
|
7379
|
-
const i =
|
|
7396
|
+
const i = bt(this.inspection.getSnapshot().joints, e);
|
|
7380
7397
|
if (!i || !this.editable()) return;
|
|
7381
7398
|
const n = (a = (s = this.inspection).jointWorldFrame) == null ? void 0 : a.call(s, i.via.id);
|
|
7382
7399
|
n && this.start(i, n.position.clone(), null, t);
|
|
@@ -7401,14 +7418,14 @@ class ao {
|
|
|
7401
7418
|
}
|
|
7402
7419
|
const ye = "scene";
|
|
7403
7420
|
function oo(r, e) {
|
|
7404
|
-
let t = null, i = null, n = null, s = null, a = null, o = null, l = null, d = null, c = null, p = null, h = null, m = null, f = null,
|
|
7405
|
-
const
|
|
7406
|
-
const
|
|
7407
|
-
if (l ===
|
|
7421
|
+
let t = null, i = null, n = null, s = null, a = null, o = null, l = null, d = null, c = null, p = null, h = null, m = null, f = null, g = null, b = null;
|
|
7422
|
+
const x = [], v = (w) => {
|
|
7423
|
+
const y = (w == null ? void 0 : w.getSnapshot().controlMode) === "kinematic" && w.pickRoots && w.jointWorldFrame && r.interactionCanvas && r.interactionCamera && r.setNavigationEnabled ? w : null;
|
|
7424
|
+
if (l === y) {
|
|
7408
7425
|
o == null || o.update();
|
|
7409
7426
|
return;
|
|
7410
7427
|
}
|
|
7411
|
-
o == null || o.dispose(), d == null || d.dispose(), o = null, d = null, l =
|
|
7428
|
+
o == null || o.dispose(), d == null || d.dispose(), o = null, d = null, l = y, y && (o = new ao(y, {
|
|
7412
7429
|
canvas: r.interactionCanvas(),
|
|
7413
7430
|
getCamera: () => r.interactionCamera(),
|
|
7414
7431
|
requestRender: () => {
|
|
@@ -7422,10 +7439,10 @@ function oo(r, e) {
|
|
|
7422
7439
|
return {
|
|
7423
7440
|
id: "nebula.ui.scene",
|
|
7424
7441
|
activate(w) {
|
|
7425
|
-
var C, k, E, P,
|
|
7426
|
-
|
|
7442
|
+
var C, k, E, P, D, T;
|
|
7443
|
+
b = document.createElement("style"), b.dataset.viewerSceneUi = "", b.textContent = Ya, (C = r.shadowRoot()) == null || C.append(b), i = r.environment ? new Fa(r.theme(), r.environment, {
|
|
7427
7444
|
showBackgroundToggle: ((E = (k = e.scene) == null ? void 0 : k.parts) == null ? void 0 : E.background) !== !1,
|
|
7428
|
-
onOpenChange: (
|
|
7445
|
+
onOpenChange: (M) => t == null ? void 0 : t.pickerChanged(M)
|
|
7429
7446
|
}) : null, t = Na(w, {
|
|
7430
7447
|
label: e.label("simulation"),
|
|
7431
7448
|
parts: (P = e.scene) == null ? void 0 : P.parts,
|
|
@@ -7434,44 +7451,44 @@ function oo(r, e) {
|
|
|
7434
7451
|
environment: {
|
|
7435
7452
|
getState: () => r.environment.getState(),
|
|
7436
7453
|
isPickerOpen: () => (i == null ? void 0 : i.isOpen) ?? !1,
|
|
7437
|
-
openPicker: (
|
|
7454
|
+
openPicker: (M) => i.toggle(M)
|
|
7438
7455
|
}
|
|
7439
7456
|
} : {}
|
|
7440
|
-
}), n = new _a(r.theme(), ((
|
|
7441
|
-
var
|
|
7442
|
-
return ((
|
|
7443
|
-
}), a = new Ja(r.theme()), c = r.mountBuiltin(t.element, { zone: "overlay", group: ye }), i && (p = r.mountBuiltin(i.element, { zone: "overlay", group: ye })), h = r.mountBuiltin(n.element, { zone: "overlay", group: ye }), m = r.mountBuiltin(s.element, { zone: "overlay", group: ye }), f = r.mountBuiltin(a.element, { zone: "overlay", group: ye }),
|
|
7444
|
-
t == null || t.themeChanged(
|
|
7457
|
+
}), n = new _a(r.theme(), ((T = (D = e.scene) == null ? void 0 : D.parts) == null ? void 0 : T.scaleRuler) !== !1), s = new Ha(r.theme(), () => {
|
|
7458
|
+
var M;
|
|
7459
|
+
return ((M = r.getVisualDiagnostics) == null ? void 0 : M.call(r)) ?? null;
|
|
7460
|
+
}), a = new Ja(r.theme()), c = r.mountBuiltin(t.element, { zone: "overlay", group: ye }), i && (p = r.mountBuiltin(i.element, { zone: "overlay", group: ye })), h = r.mountBuiltin(n.element, { zone: "overlay", group: ye }), m = r.mountBuiltin(s.element, { zone: "overlay", group: ye }), f = r.mountBuiltin(a.element, { zone: "overlay", group: ye }), g = r.onThemeChange((M) => {
|
|
7461
|
+
t == null || t.themeChanged(M), i == null || i.themeChanged(M), i == null || i.reposition((t == null ? void 0 : t.environmentAnchor()) ?? null), n == null || n.themeChanged(M), s == null || s.themeChanged(M), a == null || a.themeChanged(M), o == null || o.themeChanged(M);
|
|
7445
7462
|
});
|
|
7446
|
-
const
|
|
7447
|
-
var
|
|
7448
|
-
const
|
|
7449
|
-
if (a == null || a.bind(
|
|
7463
|
+
const y = () => {
|
|
7464
|
+
var O, G, S, A, j;
|
|
7465
|
+
const M = w.asset.$read(), V = (G = (O = w.asset).$inspection) == null ? void 0 : G.call(O), _ = (M == null ? void 0 : M.phase) === "ready" && (V == null ? void 0 : V.kind) === "joints" ? V : null;
|
|
7466
|
+
if (a == null || a.bind(_), v(_), ((j = (A = (S = w.asset).$inspection) == null ? void 0 : A.call(S)) == null ? void 0 : j.kind) === "urdf") {
|
|
7450
7467
|
t && (t.element.hidden = !0), i == null || i.close(), n == null || n.update(null, w.asset.$readControl()), s == null || s.update(null);
|
|
7451
7468
|
return;
|
|
7452
7469
|
}
|
|
7453
|
-
if (!
|
|
7470
|
+
if (!M) {
|
|
7454
7471
|
t && (t.element.hidden = !0), i == null || i.close(), n == null || n.update(null, w.asset.$readControl()), s == null || s.update(null);
|
|
7455
7472
|
return;
|
|
7456
7473
|
}
|
|
7457
|
-
t == null || t.update(
|
|
7458
|
-
const
|
|
7459
|
-
|
|
7474
|
+
t == null || t.update(M), i == null || i.update(), i == null || i.reposition((t == null ? void 0 : t.environmentAnchor()) ?? null);
|
|
7475
|
+
const H = M.kind === "model" || M.kind === "simulation" ? e.label(M.kind) : null;
|
|
7476
|
+
H && (t == null || t.element.setAttribute("aria-label", H)), n == null || n.update(M, w.asset.$readControl()), s == null || s.update(M);
|
|
7460
7477
|
};
|
|
7461
|
-
|
|
7478
|
+
x.push(w.events.on("asset-change", y)), x.push(w.events.on("asset-control-change", () => {
|
|
7462
7479
|
t == null || t.pressedChanged(), n == null || n.update(w.asset.$read(), w.asset.$readControl()), o == null || o.update();
|
|
7463
|
-
})),
|
|
7464
|
-
i == null || i.update(
|
|
7480
|
+
})), x.push(w.events.on("environment-change", (M) => {
|
|
7481
|
+
i == null || i.update(M);
|
|
7465
7482
|
}));
|
|
7466
|
-
for (const
|
|
7467
|
-
|
|
7483
|
+
for (const M of ["camera-change", "resize", "viewport-change", "ui-layout-change"])
|
|
7484
|
+
x.push(w.events.on(M, () => {
|
|
7468
7485
|
o == null || o.update(), i == null || i.reposition((t == null ? void 0 : t.environmentAnchor()) ?? null);
|
|
7469
7486
|
}));
|
|
7470
|
-
|
|
7487
|
+
y();
|
|
7471
7488
|
},
|
|
7472
7489
|
deactivate() {
|
|
7473
|
-
for (const w of
|
|
7474
|
-
|
|
7490
|
+
for (const w of x.splice(0)) w();
|
|
7491
|
+
g == null || g.dispose(), v(null), c == null || c.dispose(), p == null || p.dispose(), h == null || h.dispose(), m == null || m.dispose(), f == null || f.dispose(), i == null || i.dispose(), t == null || t.dispose(), n == null || n.dispose(), s == null || s.dispose(), a == null || a.dispose(), b == null || b.remove(), t = null, i = null, n = null, s = null, a = null, c = null, p = null, h = null, m = null, f = null, g = null, b = null;
|
|
7475
7492
|
}
|
|
7476
7493
|
};
|
|
7477
7494
|
}
|
|
@@ -7524,7 +7541,7 @@ class lo {
|
|
|
7524
7541
|
}
|
|
7525
7542
|
}
|
|
7526
7543
|
function co(r) {
|
|
7527
|
-
const e = r.clone().invert(), t = [new
|
|
7544
|
+
const e = r.clone().invert(), t = [new R(1, 0, 0), new R(0, 1, 0), new R(0, 0, 1)], i = ["#f3656a", "#36c978", "#4789f5"];
|
|
7528
7545
|
return `<svg viewBox="0 0 100 100" role="img" aria-label="世界坐标轴">${t.flatMap((s, a) => [-1, 1].map((o) => ({ p: s.clone().multiplyScalar(o).applyQuaternion(e), i: a, sign: o }))).sort((s, a) => s.p.z - a.p.z).map(({ p: s, i: a, sign: o }) => {
|
|
7529
7546
|
const l = 50 + s.x * 32, d = 50 - s.y * 32, c = i[a];
|
|
7530
7547
|
return `${o > 0 ? `<path d="M50 50L${l} ${d}" stroke="${c}" stroke-width="2"/>` : ""}<circle cx="${l}" cy="${d}" r="${o > 0 ? 7.5 : 4}" fill="${c}" opacity="${o > 0 ? 1 : 0.6}" stroke="none"/>${o > 0 ? `<text x="${l}" y="${d + 3}" fill="#101b24" stroke="none" text-anchor="middle" font-size="9">${"XYZ"[a]}</text>` : ""}`;
|
|
@@ -7564,7 +7581,7 @@ function W(r) {
|
|
|
7564
7581
|
function $(r) {
|
|
7565
7582
|
return r.mode === "kinematic" || r.mode === "dynamics-paused" || r.mode === "dynamics-unavailable";
|
|
7566
7583
|
}
|
|
7567
|
-
function
|
|
7584
|
+
function L(r) {
|
|
7568
7585
|
return String(r ?? "").replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """);
|
|
7569
7586
|
}
|
|
7570
7587
|
function Be(r, e = 1 / 0) {
|
|
@@ -7578,20 +7595,20 @@ function ho(r, e, t, i) {
|
|
|
7578
7595
|
const p = (E) => E.composedPath().some((P) => P instanceof s.HTMLElement && (P.matches("input,textarea,select") || P.isContentEditable)), h = () => {
|
|
7579
7596
|
d && (d = null, r.style.cursor = c, r.removeAttribute("data-joint-adjusting"));
|
|
7580
7597
|
}, m = () => ["kinematic", "dynamics-paused", "dynamics-unavailable"].includes(e.getSnapshot().mode), f = (E) => {
|
|
7581
|
-
var
|
|
7598
|
+
var _;
|
|
7582
7599
|
if (E.code === "Escape") {
|
|
7583
7600
|
h();
|
|
7584
7601
|
return;
|
|
7585
7602
|
}
|
|
7586
7603
|
if (E.code !== "KeyR" || E.repeat || E.ctrlKey || E.altKey || E.metaKey || p(E) || !a && n.activeElement !== r || !m()) return;
|
|
7587
|
-
const P = e.getSnapshot(),
|
|
7588
|
-
if (!(
|
|
7604
|
+
const P = e.getSnapshot(), D = P.nodes.find((H) => H.id === P.selectedEntityId && H.kind === "joint");
|
|
7605
|
+
if (!(D != null && D.movable) || D.mimic) return;
|
|
7589
7606
|
t();
|
|
7590
|
-
const
|
|
7591
|
-
d = { id:
|
|
7592
|
-
},
|
|
7607
|
+
const T = (_ = e.jointWorldFrame) == null ? void 0 : _.call(e, D.name), M = i == null ? void 0 : i(), V = T && M && l !== null ? po(M, T, r.getBoundingClientRect(), l, o, D.jointType === "prismatic") : 1;
|
|
7608
|
+
d = { id: D.id, name: D.name, value: P.jointValues[D.name] ?? 0, sensitivity: D.jointType === "prismatic" ? 1e-3 : 5e-3, ...Be(D), direction: V }, c = r.style.cursor, r.style.cursor = "ew-resize", r.setAttribute("data-joint-adjusting", "true"), E.preventDefault();
|
|
7609
|
+
}, g = (E) => {
|
|
7593
7610
|
E.code === "KeyR" && h();
|
|
7594
|
-
},
|
|
7611
|
+
}, b = (E) => {
|
|
7595
7612
|
const P = l === null ? 0 : E.clientX - l;
|
|
7596
7613
|
if (l = E.clientX, o = E.clientY, !(!d || E.pointerType === "touch")) {
|
|
7597
7614
|
if (!m() || e.getSnapshot().selectedEntityId !== d.id || E.buttons !== 0) {
|
|
@@ -7600,33 +7617,33 @@ function ho(r, e, t, i) {
|
|
|
7600
7617
|
}
|
|
7601
7618
|
P && (d.value = Math.max(d.lower, Math.min(d.upper, d.value + P * d.direction * d.sensitivity)), e.setJointValue(d.name, d.value), E.preventDefault(), E.stopImmediatePropagation());
|
|
7602
7619
|
}
|
|
7603
|
-
},
|
|
7620
|
+
}, x = (E) => {
|
|
7604
7621
|
a = !0, l = E.clientX, o = E.clientY;
|
|
7605
|
-
},
|
|
7622
|
+
}, v = () => {
|
|
7606
7623
|
a = !1, l = null, h();
|
|
7607
7624
|
}, w = (E) => {
|
|
7608
7625
|
d && (E.preventDefault(), E.stopImmediatePropagation());
|
|
7609
|
-
},
|
|
7626
|
+
}, y = (E) => {
|
|
7610
7627
|
E.composedPath()[0] !== r && h();
|
|
7611
7628
|
}, C = () => {
|
|
7612
7629
|
n.hidden && h();
|
|
7613
7630
|
}, k = e.subscribe((E) => {
|
|
7614
7631
|
d && (!m() || E.selectedEntityId !== d.id) && h();
|
|
7615
7632
|
});
|
|
7616
|
-
return r.addEventListener("pointerenter",
|
|
7617
|
-
h(), k(), r.removeEventListener("pointerenter",
|
|
7633
|
+
return r.addEventListener("pointerenter", x), r.addEventListener("pointerleave", v), r.addEventListener("pointermove", b, !0), r.addEventListener("pointerdown", w, !0), n.addEventListener("keydown", f), n.addEventListener("keyup", g), n.addEventListener("focusin", y), n.addEventListener("visibilitychange", C), s.addEventListener("blur", v), () => {
|
|
7634
|
+
h(), k(), r.removeEventListener("pointerenter", x), r.removeEventListener("pointerleave", v), r.removeEventListener("pointermove", b, !0), r.removeEventListener("pointerdown", w, !0), n.removeEventListener("keydown", f), n.removeEventListener("keyup", g), n.removeEventListener("focusin", y), n.removeEventListener("visibilitychange", C), s.removeEventListener("blur", v);
|
|
7618
7635
|
};
|
|
7619
7636
|
}
|
|
7620
7637
|
function po(r, e, t, i, n, s) {
|
|
7621
7638
|
if (t.width <= 0 || t.height <= 0 || e.axis.lengthSq() < 1e-12) return 1;
|
|
7622
7639
|
r.updateMatrixWorld(!0);
|
|
7623
|
-
const a = e.axis.clone().normalize(), o = r.getWorldDirection(new
|
|
7640
|
+
const a = e.axis.clone().normalize(), o = r.getWorldDirection(new R()), l = new R(1, 0, 0).transformDirection(r.matrixWorld), d = new R(0, 1, 0).transformDirection(r.matrixWorld);
|
|
7624
7641
|
let c = a.clone();
|
|
7625
7642
|
if (!s) {
|
|
7626
|
-
const m = new
|
|
7627
|
-
m.setFromCamera(new
|
|
7628
|
-
const f = m.ray.intersectPlane(new cn().setFromNormalAndCoplanarPoint(o, e.position), new
|
|
7629
|
-
c = a.clone().cross(
|
|
7643
|
+
const m = new dt();
|
|
7644
|
+
m.setFromCamera(new Z((i - t.left) / t.width * 2 - 1, 1 - (n - t.top) / t.height * 2), r);
|
|
7645
|
+
const f = m.ray.intersectPlane(new cn().setFromNormalAndCoplanarPoint(o, e.position), new R()), g = f ? f.sub(e.position) : new R();
|
|
7646
|
+
c = a.clone().cross(g), Math.abs(c.dot(l)) <= Math.max(g.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())));
|
|
7630
7647
|
}
|
|
7631
7648
|
const p = c.dot(l);
|
|
7632
7649
|
if (Math.abs(p) > 0.05 * Math.max(c.length(), 1e-9)) return p >= 0 ? 1 : -1;
|
|
@@ -7649,20 +7666,20 @@ function at(r, e) {
|
|
|
7649
7666
|
}
|
|
7650
7667
|
return r;
|
|
7651
7668
|
}
|
|
7652
|
-
function
|
|
7669
|
+
function Lt(r, e, t, i = !1) {
|
|
7653
7670
|
const { lower: n, upper: s } = Be(r, Math.PI), a = e.jointValues[r.name] ?? 0, o = mo(r, t);
|
|
7654
|
-
return `<div class="vurdf-slider-card ${e.selectedEntityId === r.id ? "is-selected" : ""}" data-joint-card="${
|
|
7655
|
-
<div class="vurdf-slider-heading"><button class="vurdf-text-btn" data-entity="${
|
|
7656
|
-
<small>${i ? "联动控制 · " : ""}${
|
|
7657
|
-
<input type="range" aria-label="${
|
|
7658
|
-
${r.mimic ? `<small>跟随 ${
|
|
7671
|
+
return `<div class="vurdf-slider-card ${e.selectedEntityId === r.id ? "is-selected" : ""}" data-joint-card="${L(r.id)}" tabindex="0" role="group" aria-label="${L(r.name)},点击选中关节">
|
|
7672
|
+
<div class="vurdf-slider-heading"><button class="vurdf-text-btn" data-entity="${L(r.id)}">${L(r.name)}</button><output data-joint-readout="${L(r.name)}">${Ae(r, a, t)}</output></div>
|
|
7673
|
+
<small>${i ? "联动控制 · " : ""}${L(r.parentLink)} → ${L(r.childLink)}</small>
|
|
7674
|
+
<input type="range" aria-label="${L(r.name)}${i ? " 联动控制" : " 位置"}" data-control-joint="${L(r.name)}" data-display-factor="${o}" min="${n * o}" max="${s * o}" step="any" value="${a * o}" ${!$(e) || r.mimic ? "disabled" : ""}>
|
|
7675
|
+
${r.mimic ? `<small>跟随 ${L(r.mimic.joint)} × ${r.mimic.multiplier} + ${Ae(r, r.mimic.offset, t)}</small>` : ""}
|
|
7659
7676
|
</div>`;
|
|
7660
7677
|
}
|
|
7661
|
-
function
|
|
7678
|
+
function ji(r, e, t) {
|
|
7662
7679
|
const i = e.nodes.filter((o) => o.kind === "joint"), n = r.kind === "joint" ? r : i.find((o) => o.childLink === r.name);
|
|
7663
7680
|
if (!n) return "";
|
|
7664
7681
|
const s = at(n, i), a = i.filter((o) => o.mimic && at(o, i).name === s.name);
|
|
7665
|
-
return a.length ? `<section class="vurdf-section"><div class="vurdf-section-head"><strong>联动约束 · ${a.length + 1} 个关节</strong></div>${
|
|
7682
|
+
return a.length ? `<section class="vurdf-section"><div class="vurdf-section-head"><strong>联动约束 · ${a.length + 1} 个关节</strong></div>${Lt(s, e, t, !0)}<p class="vurdf-control-hint">${a.map((o) => L(o.name)).join(" · ")}</p></section>` : "";
|
|
7666
7683
|
}
|
|
7667
7684
|
function fo(r, e, t) {
|
|
7668
7685
|
const i = r.nodes.filter((c) => c.kind === "joint"), n = /* @__PURE__ */ new Map();
|
|
@@ -7687,7 +7704,7 @@ function fo(r, e, t) {
|
|
|
7687
7704
|
const d = e.trim().toLowerCase();
|
|
7688
7705
|
return o.filter((c) => c.some((p) => `${p.name} ${p.parentLink} ${p.childLink}`.toLowerCase().includes(d))).map((c) => {
|
|
7689
7706
|
const p = [...new Set(c.map((h) => at(h, i)))].filter((h) => i.some((m) => m.mimic && at(m, i).name === h.name));
|
|
7690
|
-
return `<section class="vurdf-joint-group"><h3>${
|
|
7707
|
+
return `<section class="vurdf-joint-group"><h3>${L(c[0].parentLink)} → ${L(c[c.length - 1].childLink)}</h3>${p.filter((h) => !c.includes(h)).map((h) => Lt(h, r, t, !0)).join("")}${c.map((h) => Lt(h, r, t, p.includes(h))).join("")}</section>`;
|
|
7691
7708
|
}).join("") || '<div class="vurdf-empty">没有符合筛选条件的可动关节。</div>';
|
|
7692
7709
|
}
|
|
7693
7710
|
function vo(r) {
|
|
@@ -7722,8 +7739,8 @@ class go {
|
|
|
7722
7739
|
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;
|
|
7723
7740
|
this.root.innerHTML = `
|
|
7724
7741
|
<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>
|
|
7725
|
-
<label class="vurdf-search">${W("search")}<input aria-label="搜索模型结构" placeholder="搜索 Link 或 Joint" value="${
|
|
7726
|
-
<div class="vurdf-filters">${
|
|
7742
|
+
<label class="vurdf-search">${W("search")}<input aria-label="搜索模型结构" placeholder="搜索 Link 或 Joint" value="${L(this.query)}"></label>
|
|
7743
|
+
<div class="vurdf-filters">${wt("all", "全部", this.filter)}${wt("movable", "可动关节", this.filter)}${wt("errors", `错误 ${e.issues.length}`, this.filter)}</div>
|
|
7727
7744
|
<div class="vurdf-tree" role="${this.filter === "movable" ? "region" : "tree"}">${this.filter === "movable" ? fo(e, this.query, this.angleUnit) : bo(e, t, this.filter, this.query, this.collapsed, this.angleUnit)}</div>
|
|
7728
7745
|
`, this.bind(e), this.setDiagramOpen(this.diagramOpen);
|
|
7729
7746
|
const o = this.root.querySelector(".vurdf-tree");
|
|
@@ -7818,21 +7835,21 @@ function bo(r, e, t, i, n, s) {
|
|
|
7818
7835
|
if (m.has(p)) return { html: "", matched: !1 };
|
|
7819
7836
|
const f = a.get(p);
|
|
7820
7837
|
if (!f) return { html: "", matched: !1 };
|
|
7821
|
-
const
|
|
7822
|
-
if (!(d(f) ||
|
|
7823
|
-
const
|
|
7824
|
-
<button class="vurdf-tree-toggle ${
|
|
7825
|
-
<button class="vurdf-row ${r.selectedEntityId === f.id ? "is-selected" : ""} ${e.has(f.id) ? "has-error" : ""}" data-entity="${
|
|
7838
|
+
const g = new Set(m).add(p), b = f.childIds.map((E) => c(E, h + 1, g));
|
|
7839
|
+
if (!(d(f) || b.some((E) => E.matched))) return { html: "", matched: !1 };
|
|
7840
|
+
const v = b.some((E) => E.matched), w = !l && n.has(f.id), y = f.kind === "joint" ? f.jointType : f.kind, C = f.kind === "joint" && f.movable ? `${Ae(f, r.jointValues[f.name] ?? 0, s)}` : "", k = `<div class="vurdf-tree-item" style="--depth:${h}" role="treeitem" aria-expanded="${v ? String(!w) : "false"}">
|
|
7841
|
+
<button class="vurdf-tree-toggle ${v ? "" : "is-placeholder"} ${w ? "" : "is-open"}" data-tree-toggle="${L(f.id)}" ${v ? "" : "disabled"} aria-label="${w ? "展开" : "折叠"} ${L(f.name)}">${W("chevron")}</button>
|
|
7842
|
+
<button class="vurdf-row ${r.selectedEntityId === f.id ? "is-selected" : ""} ${e.has(f.id) ? "has-error" : ""}" data-entity="${L(f.id)}">
|
|
7826
7843
|
${W(f.kind === "robot" ? "robot" : f.kind === "joint" ? "joint" : "link")}
|
|
7827
|
-
<span class="vurdf-node-copy"><b title="${
|
|
7828
|
-
${e.has(f.id) ? '<span class="vurdf-node-error">!</span>' : `<span class="vurdf-node-value" ${f.kind === "joint" ? `data-joint-readout="${
|
|
7844
|
+
<span class="vurdf-node-copy"><b title="${L(f.name)}">${L(f.name)}</b><small>${L(y)}</small></span>
|
|
7845
|
+
${e.has(f.id) ? '<span class="vurdf-node-error">!</span>' : `<span class="vurdf-node-value" ${f.kind === "joint" ? `data-joint-readout="${L(f.name)}"` : ""}>${C}</span>`}
|
|
7829
7846
|
</button>
|
|
7830
7847
|
</div>`;
|
|
7831
|
-
return { html: `<div class="vurdf-branch ${w ? "is-collapsed" : ""}">${k}<div class="vurdf-children" ${w ? "inert" : ""}><div>${
|
|
7848
|
+
return { html: `<div class="vurdf-branch ${w ? "is-collapsed" : ""}">${k}<div class="vurdf-children" ${w ? "inert" : ""}><div>${b.map((E) => E.html).join("")}</div></div></div>`, matched: !0 };
|
|
7832
7849
|
};
|
|
7833
7850
|
return c(r.rootEntityId, 0).html || '<div class="vurdf-empty">没有符合筛选条件的节点。</div>';
|
|
7834
7851
|
}
|
|
7835
|
-
function
|
|
7852
|
+
function wt(r, e, t) {
|
|
7836
7853
|
return `<button class="vurdf-chip ${r === t ? "is-active" : ""}" data-filter="${r}">${e}</button>`;
|
|
7837
7854
|
}
|
|
7838
7855
|
const yo = 1800;
|
|
@@ -7873,7 +7890,7 @@ class xo {
|
|
|
7873
7890
|
const o = a.dataset.inertiaDetails;
|
|
7874
7891
|
a.open ? this.expandedInertia.add(o) : this.expandedInertia.delete(o);
|
|
7875
7892
|
}), this.root.innerHTML = `
|
|
7876
|
-
<nav class="vurdf-tabs">${
|
|
7893
|
+
<nav class="vurdf-tabs">${Ct("properties", "属性", this.tab)}${Ct("source", "XML", this.tab)}${Ct("issues", `错误${e.issues.length ? ` <em>${e.issues.length}</em>` : ""}`, this.tab)}</nav>
|
|
7877
7894
|
<section class="vurdf-pane ${this.tab === "properties" ? "is-active" : ""}" data-pane="properties">${t ? wo(t, e, ((i = this.sweep) == null ? void 0 : i.jointName) === t.name, this.angleUnit, this.expandedInertia) : ko()}</section>
|
|
7878
7895
|
<section class="vurdf-pane ${this.tab === "source" ? "is-active" : ""}" data-pane="source">${this.tab === "source" ? Co(e, t) : ""}</section>
|
|
7879
7896
|
<section class="vurdf-pane ${this.tab === "issues" ? "is-active" : ""}" data-pane="issues">${Eo(e)}</section>
|
|
@@ -7917,7 +7934,7 @@ class xo {
|
|
|
7917
7934
|
if ((l = this.root.querySelector("[data-angle-unit]")) == null || l.addEventListener("click", () => {
|
|
7918
7935
|
this.angleUnit = this.angleUnit === "rad" ? "deg" : "rad", this.render(this.inspection.getSnapshot());
|
|
7919
7936
|
}), !(t != null && t.movable) || t.mimic || !$(e)) return;
|
|
7920
|
-
const i =
|
|
7937
|
+
const i = Tt(t, this.angleUnit), n = (h) => {
|
|
7921
7938
|
!$(this.inspection.getSnapshot()) || !Number.isFinite(h) || (this.stopSweep(!1), this.inspection.setJointValue(t.name, h));
|
|
7922
7939
|
}, s = this.root.querySelector("[data-joint-range]"), a = () => {
|
|
7923
7940
|
if (this.draggingJoint !== t.name) return;
|
|
@@ -7938,8 +7955,8 @@ class xo {
|
|
|
7938
7955
|
this.syncJointInputs(this.inspection.getSnapshot().jointValues[t.name] ?? 0);
|
|
7939
7956
|
return;
|
|
7940
7957
|
}
|
|
7941
|
-
const { lower:
|
|
7942
|
-
n(Math.max(
|
|
7958
|
+
const { lower: g, upper: b } = Be(t);
|
|
7959
|
+
n(Math.max(g, Math.min(b, f)));
|
|
7943
7960
|
}), this.root.querySelectorAll("[data-joint-value]").forEach((h) => h.addEventListener("click", () => n(Number(h.dataset.jointValue)))), (c = this.root.querySelector("[data-reset-joint]")) == null || c.addEventListener("click", () => {
|
|
7944
7961
|
$(this.inspection.getSnapshot()) && (this.stopSweep(!1), this.inspection.resetJoint(t.name));
|
|
7945
7962
|
}), (p = this.root.querySelector("[data-sweep-joint]")) == null || p.addEventListener("click", () => {
|
|
@@ -7979,7 +7996,7 @@ class xo {
|
|
|
7979
7996
|
}
|
|
7980
7997
|
syncJointInputs(e) {
|
|
7981
7998
|
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);
|
|
7982
|
-
(s == null ? void 0 : s.kind) === "joint" && (e *=
|
|
7999
|
+
(s == null ? void 0 : s.kind) === "joint" && (e *= Tt(s, this.angleUnit)), t && Number(t.value) !== e && (t.value = String(e)), i && (i.value = e.toFixed(3));
|
|
7983
8000
|
}
|
|
7984
8001
|
startSweep(e, t) {
|
|
7985
8002
|
this.stopSweep(!1), this.sweep = { jointName: e.name, initial: t, startedAt: Date.now(), timer: null };
|
|
@@ -8004,37 +8021,37 @@ class xo {
|
|
|
8004
8021
|
function wo(r, e, t, i, n) {
|
|
8005
8022
|
var s, a;
|
|
8006
8023
|
if (r.kind === "joint") {
|
|
8007
|
-
const o = e.nodes.find((
|
|
8024
|
+
const o = e.nodes.find((g) => g.kind === "link" && g.id === `link:${r.childLink}`), l = e.jointValues[r.name] ?? 0, { lower: d, upper: c } = Be(r, Math.PI), p = Tt(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="${L(r.name)}">${Ae(r, l, i)}</output><div class="vurdf-follower-source"><span>主控关节</span><button class="vurdf-text-btn" data-entity="joint:${L(r.mimic.joint)}">${L(r.mimic.joint)}</button></div></section>` : r.movable ? `<fieldset class="vurdf-section vurdf-joint-controls" ${$(e) ? "" : "disabled"}>
|
|
8008
8025
|
<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>
|
|
8009
8026
|
<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>
|
|
8010
8027
|
<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>
|
|
8011
8028
|
${$(e) ? "" : '<p class="vurdf-control-hint">仿真运行期间只读,暂停后可选中部件并调整关节。</p>'}
|
|
8012
8029
|
</fieldset>` : '<div class="vurdf-section"><div class="vurdf-empty">固定关节不可调节。</div></div>';
|
|
8013
|
-
return `<div class="vurdf-entity"><label>${
|
|
8030
|
+
return `<div class="vurdf-entity"><label>${L(r.jointType.toUpperCase())} JOINT</label><h2>${L(r.name)}</h2><p>${L(r.parentLink)} → ${L(r.childLink)}</p></div>${f}${ji(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(Et).join(" ")}</dd><dt>关节原点 RPY</dt><dd>${r.originRotationRpy.map(Et).join(" ")}</dd><dt>Axis xyz</dt><dd>${r.axis.map(Et).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 ? zi(o, !0, n.has(o.id)) : ""}`;
|
|
8014
8031
|
}
|
|
8015
|
-
return r.kind === "link" ? `<div class="vurdf-entity"><label>LINK</label><h2>${
|
|
8032
|
+
return r.kind === "link" ? `<div class="vurdf-entity"><label>LINK</label><h2>${L(r.name)}</h2><p>${r.visualCount} Visual · ${r.collisionCount} Collision</p></div>${ji(r, e, i)}${zi(r, !1, n.has(r.id))}` : `<div class="vurdf-entity"><label>ROBOT</label><h2>${L(r.name)}</h2><p>${r.rootLinkIds.length} root link</p></div>`;
|
|
8016
8033
|
}
|
|
8017
|
-
function
|
|
8034
|
+
function Dt(r) {
|
|
8018
8035
|
if (r === void 0) return "<span>—</span>";
|
|
8019
8036
|
const e = String(r), t = Number.isFinite(r) ? String(Number(r.toPrecision(6))) : e;
|
|
8020
8037
|
return `<button type="button" class="vurdf-source-number" data-copy-number="${e}" title="${e} · 点击复制完整数值" aria-label="复制完整数值 ${e}">${t}</button>`;
|
|
8021
8038
|
}
|
|
8022
|
-
function
|
|
8023
|
-
return `<div class="vurdf-vector"><div class="vurdf-vector-title">${r}<span>${i}</span></div><dl>${e.map((n, s) => `<div><dt>${n}</dt><dd>${
|
|
8039
|
+
function Fi(r, e, t, i) {
|
|
8040
|
+
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>${Dt(t == null ? void 0 : t[s])}</dd></div>`).join("")}</dl></div>`;
|
|
8024
8041
|
}
|
|
8025
|
-
function
|
|
8042
|
+
function zi(r, e, t) {
|
|
8026
8043
|
return `<section class="vurdf-section" data-link-inertial>
|
|
8027
|
-
<div class="vurdf-section-head vurdf-component-title"><strong>${e ? "子部件" : "部件属性"} · ${
|
|
8028
|
-
<dl class="vurdf-data"><dt>质量 (kg)</dt><dd>${
|
|
8044
|
+
<div class="vurdf-section-head vurdf-component-title"><strong>${e ? "子部件" : "部件属性"} · ${L(r.name)}</strong></div>
|
|
8045
|
+
<dl class="vurdf-data"><dt>质量 (kg)</dt><dd>${Dt(r.mass)}</dd></dl>
|
|
8029
8046
|
<div class="vurdf-inertial-frame">惯性原点 · 相对于 Link</div>
|
|
8030
|
-
${
|
|
8031
|
-
${
|
|
8032
|
-
<details class="vurdf-inertia-details" data-inertia-details="${
|
|
8047
|
+
${Fi("质心位置", ["X", "Y", "Z"], r.centerOfMass, "m")}
|
|
8048
|
+
${Fi("惯性坐标系旋转", ["R", "P", "Y"], r.inertialRotationRpy, "rad")}
|
|
8049
|
+
<details class="vurdf-inertia-details" data-inertia-details="${L(r.id)}" ${t ? "open" : ""}>
|
|
8033
8050
|
<summary>${W("chevron")}<strong>惯性张量</strong><span>kg·m²</span></summary>
|
|
8034
8051
|
<div class="vurdf-inertial-frame">关于质心 · 惯性坐标系</div>
|
|
8035
8052
|
<dl class="vurdf-data">${["Ixx", "Iyy", "Izz", "Ixy", "Ixz", "Iyz"].map((i, n) => {
|
|
8036
8053
|
var s;
|
|
8037
|
-
return `<dt>${i}</dt><dd>${
|
|
8054
|
+
return `<dt>${i}</dt><dd>${Dt((s = r.inertiaTensor) == null ? void 0 : s[n])}</dd>`;
|
|
8038
8055
|
}).join("")}</dl>
|
|
8039
8056
|
</details>
|
|
8040
8057
|
</section>`;
|
|
@@ -8045,21 +8062,21 @@ function Co(r, e) {
|
|
|
8045
8062
|
return `<pre class="vurdf-source"><code>${t.map((o, l) => `<span class="line ${e && l + 1 >= i && l + 1 <= n ? "is-selected" : ""}"><span class="ln">${l + 1}</span>${So(o)}</span>`).join("")}</code></pre>`;
|
|
8046
8063
|
}
|
|
8047
8064
|
function Eo(r) {
|
|
8048
|
-
return r.issues.length ? r.issues.map((e) => `<button class="vurdf-issue" data-issue-entity="${
|
|
8065
|
+
return r.issues.length ? r.issues.map((e) => `<button class="vurdf-issue" data-issue-entity="${L(e.entityId)}">${W("error")}<span><b>${L(e.title)}</b><small>${L(e.message)}</small></span></button>`).join("") : '<div class="vurdf-empty">所有严格结构与数学检查通过。</div>';
|
|
8049
8066
|
}
|
|
8050
|
-
function
|
|
8067
|
+
function Ct(r, e, t) {
|
|
8051
8068
|
return `<button class="vurdf-tab ${r === t ? "is-active" : ""}" data-tab="${r}">${e}</button>`;
|
|
8052
8069
|
}
|
|
8053
8070
|
function ko() {
|
|
8054
8071
|
return '<div class="vurdf-empty vurdf-no-selection">点击模型或结构树选择部件;点击场景空白处可取消选择。</div>';
|
|
8055
8072
|
}
|
|
8056
|
-
function
|
|
8073
|
+
function Et(r) {
|
|
8057
8074
|
return r.toFixed(3);
|
|
8058
8075
|
}
|
|
8059
8076
|
function So(r) {
|
|
8060
|
-
return
|
|
8077
|
+
return L(r).replace(/(<\/?[\w:-]+)/g, '<span class="tag">$1</span>').replace(/([\w:-]+)=(".*?")/g, '<span class="attr">$1</span>=<span class="str">$2</span>');
|
|
8061
8078
|
}
|
|
8062
|
-
function
|
|
8079
|
+
function Tt(r, e) {
|
|
8063
8080
|
return r.jointType !== "prismatic" && e === "deg" ? 180 / Math.PI : 1;
|
|
8064
8081
|
}
|
|
8065
8082
|
function Po(r) {
|
|
@@ -8134,9 +8151,9 @@ class Mo {
|
|
|
8134
8151
|
}), o.addEventListener("pointermove", (d) => {
|
|
8135
8152
|
const c = this.windowResize;
|
|
8136
8153
|
if (!c || c.id !== d.pointerId) return;
|
|
8137
|
-
const p = this.element.parentElement, h = d.clientX - c.x, m = d.clientY - c.y, f = 420,
|
|
8138
|
-
let
|
|
8139
|
-
(c.corner === "tr" || c.corner === "br") && (
|
|
8154
|
+
const p = this.element.parentElement, h = d.clientX - c.x, m = d.clientY - c.y, f = 420, g = 320;
|
|
8155
|
+
let b = c.left, x = c.top, v = c.width, w = c.height;
|
|
8156
|
+
(c.corner === "tr" || c.corner === "br") && (v = Math.max(f, c.width + h)), (c.corner === "tl" || c.corner === "bl") && (v = Math.max(f, c.width - h), b = c.left + c.width - v), c.corner === "tr" && (w = Math.max(g, c.height - m), x = c.top + c.height - w), (c.corner === "br" || c.corner === "bl") && (w = Math.max(g, c.height + m)), c.corner === "tl" && (w = Math.max(g, c.height - m), x = c.top + c.height - w), b = Math.max(0, Math.min(b, Math.max(0, p.clientWidth - v))), x = Math.max(0, Math.min(x, Math.max(0, p.clientHeight - w))), v = Math.min(v, p.clientWidth - b), w = Math.min(w, p.clientHeight - x), this.element.style.left = `${b}px`, this.element.style.top = `${x}px`, this.element.style.width = `${Math.max(f, v)}px`, this.element.style.height = `${Math.max(g, w)}px`;
|
|
8140
8157
|
});
|
|
8141
8158
|
const l = () => {
|
|
8142
8159
|
this.windowResize = null;
|
|
@@ -8190,7 +8207,7 @@ class Mo {
|
|
|
8190
8207
|
this.graph.innerHTML = i.edges.map((s) => {
|
|
8191
8208
|
const a = n.get(s.from), o = n.get(s.to), l = a.y + 20, d = o.y - 20, c = (l + d) / 2;
|
|
8192
8209
|
return `<path class="vurdf-diagram-edge" d="M${a.x} ${l} C${a.x} ${c},${o.x} ${c},${o.x} ${d}"/>`;
|
|
8193
|
-
}).join("") + i.nodes.map(({ node: s, x: a, y: o }) => `<g class="vurdf-diagram-node" data-diagram-node="${
|
|
8210
|
+
}).join("") + i.nodes.map(({ node: s, x: a, y: o }) => `<g class="vurdf-diagram-node" data-diagram-node="${U(s.id)}" transform="translate(${a - 90} ${o - 20})" role="button" tabindex="0" aria-label="${U(s.name)}"><title>${U(s.name)}</title><rect width="180" height="40" rx="${s.kind === "joint" ? 20 : 5}"/><text x="90" y="16">${U(s.name.length > 26 ? s.name.slice(0, 24) + "…" : s.name)}</text><text class="vurdf-diagram-kind" x="90" y="31">${U(s.kind === "joint" ? s.jointType : s.kind)}</text></g>`).join(""), this.fit();
|
|
8194
8211
|
}
|
|
8195
8212
|
const t = e.mode === "dynamics-running" || e.mode === "dynamics-initializing";
|
|
8196
8213
|
for (const i of this.graph.querySelectorAll("[data-diagram-node]")) {
|
|
@@ -8249,7 +8266,7 @@ class Ro {
|
|
|
8249
8266
|
<button class="vurdf-tool ${this.namesVisible ? "is-active" : ""}" data-name-labels aria-pressed="${this.namesVisible}" title="显示/隐藏部件名称">${W("names")}名称</button>
|
|
8250
8267
|
${e.nodes.some((a) => a.kind === "joint" && a.movable && a.jointType !== "prismatic") ? vo(i) : ""}
|
|
8251
8268
|
<span class="vurdf-tool-divider" aria-hidden="true"></span>
|
|
8252
|
-
${Ke("ground",
|
|
8269
|
+
${Ke("ground", $i(this.ctx) ? "隐藏地面" : "显示地面", $i(this.ctx), "ground")}
|
|
8253
8270
|
${Ke("fit", "适应视图", !1, "fit")}
|
|
8254
8271
|
${Ke("theme", this.theme === "dark" ? "浅色主题" : "深色主题", !1, this.theme === "dark" ? "sun" : "moon")}
|
|
8255
8272
|
<span class="vurdf-tool-divider" aria-hidden="true"></span>
|
|
@@ -8289,9 +8306,9 @@ function Ke(r, e, t, i) {
|
|
|
8289
8306
|
}
|
|
8290
8307
|
function Ao(r, e, t) {
|
|
8291
8308
|
const i = r.mode === "dynamics-running", n = i ? "暂停仿真" : r.mode === "dynamics-initializing" ? "启动中" : "启动仿真";
|
|
8292
|
-
return `<button class="vurdf-tool vurdf-dynamics ${i ? "is-active" : ""}" data-mode="dynamics" ${e ? "disabled" : ""} title="${
|
|
8309
|
+
return `<button class="vurdf-tool vurdf-dynamics ${i ? "is-active" : ""}" data-mode="dynamics" ${e ? "disabled" : ""} title="${L(t)}">${W(i ? "pause" : "play")}${n}</button>`;
|
|
8293
8310
|
}
|
|
8294
|
-
function
|
|
8311
|
+
function $i(r) {
|
|
8295
8312
|
return r.asset.$readControl().groundVisible;
|
|
8296
8313
|
}
|
|
8297
8314
|
class Io {
|
|
@@ -8301,7 +8318,7 @@ class Io {
|
|
|
8301
8318
|
}
|
|
8302
8319
|
update(e) {
|
|
8303
8320
|
const t = e.nodes.find((i) => i.id === e.selectedEntityId) ?? null;
|
|
8304
|
-
this.element.innerHTML = `<span>模型已就绪</span><span title="${
|
|
8321
|
+
this.element.innerHTML = `<span>模型已就绪</span><span title="${L(e.sourcePath)}">${L(e.sourcePath)}</span><span>选择:${t ? L(t.name) : "无"}</span>${(t == null ? void 0 : t.kind) === "joint" && t.movable && $(e) ? '<span class="vurdf-gesture-hint" title="选中可动关节,将鼠标移入场景,按住 R 左右移动调节,松开 R 结束。运行仿真时不可用。">按住 R + 鼠标左右移动</span>' : ""}<span class="spacer"></span><span>Z-Up</span><span>m / kg / s</span><span>${Lo(e.mode)}</span><span class="${e.issues.length ? "vurdf-status-error" : "vurdf-status-ok"}">${e.issues.length ? `${e.issues.length} 个错误` : "严格检查通过"}</span>`;
|
|
8305
8322
|
}
|
|
8306
8323
|
dispose() {
|
|
8307
8324
|
this.element.remove();
|
|
@@ -8371,7 +8388,7 @@ class Do {
|
|
|
8371
8388
|
var f;
|
|
8372
8389
|
if (d.button !== 0) return;
|
|
8373
8390
|
d.preventDefault(), this.root.classList.add("is-resizing"), (f = o.setPointerCapture) == null || f.call(o, d.pointerId);
|
|
8374
|
-
const c = d.clientX, p = t.getBoundingClientRect().width, h = (
|
|
8391
|
+
const c = d.clientX, p = t.getBoundingClientRect().width, h = (g) => l(p + (e === "left" ? 1 : -1) * (g.clientX - c)), m = () => {
|
|
8375
8392
|
o.removeEventListener("pointermove", h), o.removeEventListener("pointerup", m), o.removeEventListener("pointercancel", m), o.removeEventListener("lostpointercapture", m), this.resizeCleanup = null, this.root.classList.remove("is-resizing");
|
|
8376
8393
|
};
|
|
8377
8394
|
this.resizeCleanup = m, o.addEventListener("pointermove", h), o.addEventListener("pointerup", m), o.addEventListener("pointercancel", m), o.addEventListener("lostpointercapture", m);
|
|
@@ -8537,11 +8554,11 @@ function Oo(r) {
|
|
|
8537
8554
|
l.events.on("pick", (h) => {
|
|
8538
8555
|
var f;
|
|
8539
8556
|
const m = l.asset.$inspection();
|
|
8540
|
-
(m == null ? void 0 : m.kind) === "urdf" && $(m.getSnapshot()) && (i == null || i.selectFromScene(
|
|
8557
|
+
(m == null ? void 0 : m.kind) === "urdf" && $(m.getSnapshot()) && (i == null || i.selectFromScene(Vi(m, ((f = h.result) == null ? void 0 : f.object) ?? null)));
|
|
8541
8558
|
}),
|
|
8542
8559
|
l.events.on("selection-change", (h) => {
|
|
8543
8560
|
const m = l.asset.$inspection();
|
|
8544
|
-
(m == null ? void 0 : m.kind) === "urdf" && $(m.getSnapshot()) && (i == null || i.selectFromScene(
|
|
8561
|
+
(m == null ? void 0 : m.kind) === "urdf" && $(m.getSnapshot()) && (i == null || i.selectFromScene(Vi(m, h.object)));
|
|
8545
8562
|
})
|
|
8546
8563
|
), c();
|
|
8547
8564
|
},
|
|
@@ -8559,7 +8576,7 @@ function jo(r) {
|
|
|
8559
8576
|
}
|
|
8560
8577
|
return null;
|
|
8561
8578
|
}
|
|
8562
|
-
function
|
|
8579
|
+
function Vi(r, e) {
|
|
8563
8580
|
var s;
|
|
8564
8581
|
const t = jo(e), i = r.getSnapshot(), n = i.nodes.find((a) => a.id === t && a.kind === "link");
|
|
8565
8582
|
return n ? ((s = i.nodes.find((a) => a.kind === "joint" && a.childLink === n.name)) == null ? void 0 : s.id) ?? t : t;
|
|
@@ -8835,8 +8852,10 @@ function zo(r) {
|
|
|
8835
8852
|
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${r}</svg>`;
|
|
8836
8853
|
}
|
|
8837
8854
|
function $o(r, e, t) {
|
|
8838
|
-
var
|
|
8839
|
-
const i = Bo(r), n =
|
|
8855
|
+
var h, m, f;
|
|
8856
|
+
const i = Bo(r), n = Bi([t, e.signal, i]), s = ((h = e.filename) == null ? void 0 : h.trim()) || _o(r), a = Nt(r) ? qo(r.files, r.entry, s) : s, o = Rn(r), l = e.baseUrl ?? Ho(o), d = /* @__PURE__ */ new Set(), c = Nt(r) ? new Map(r.files.map((g) => [ie(g.path), g])) : null, p = Wo(
|
|
8857
|
+
((f = (m = e.resourceResolver) == null ? void 0 : m.listResources) == null ? void 0 : f.call(m)) ?? []
|
|
8858
|
+
);
|
|
8840
8859
|
return Object.freeze({
|
|
8841
8860
|
original: r,
|
|
8842
8861
|
entryPath: a,
|
|
@@ -8845,28 +8864,29 @@ function $o(r, e, t) {
|
|
|
8845
8864
|
signal: n,
|
|
8846
8865
|
baseUrl: l,
|
|
8847
8866
|
hasResourceResolver: !!e.resourceResolver,
|
|
8848
|
-
|
|
8849
|
-
|
|
8850
|
-
Bi(
|
|
8851
|
-
|
|
8852
|
-
|
|
8853
|
-
|
|
8854
|
-
|
|
8867
|
+
resourcePaths: p,
|
|
8868
|
+
async resolve(g, b) {
|
|
8869
|
+
const x = b ? Bi([n, b]) : n;
|
|
8870
|
+
Ui(x);
|
|
8871
|
+
const v = ie(g), w = Uo(r);
|
|
8872
|
+
if (w && (!v || v === ie(a ?? ""))) {
|
|
8873
|
+
const k = URL.createObjectURL(w);
|
|
8874
|
+
return d.add(k), k;
|
|
8855
8875
|
}
|
|
8856
|
-
const
|
|
8857
|
-
if (
|
|
8858
|
-
const
|
|
8859
|
-
return d.add(
|
|
8876
|
+
const y = (c == null ? void 0 : c.get(v)) ?? Yo(c, a, v);
|
|
8877
|
+
if (y) {
|
|
8878
|
+
const k = URL.createObjectURL(y.file);
|
|
8879
|
+
return d.add(k), k;
|
|
8860
8880
|
}
|
|
8861
|
-
const
|
|
8862
|
-
if (
|
|
8863
|
-
const
|
|
8864
|
-
return d.add(
|
|
8881
|
+
const C = await Go(e.resourceResolver, g, x);
|
|
8882
|
+
if (Ui(x), C instanceof Blob) {
|
|
8883
|
+
const k = URL.createObjectURL(C);
|
|
8884
|
+
return d.add(k), k;
|
|
8865
8885
|
}
|
|
8866
|
-
return
|
|
8886
|
+
return C instanceof URL ? C.href : typeof C == "string" ? C : l ? new URL(g, l).href : g;
|
|
8867
8887
|
},
|
|
8868
8888
|
release() {
|
|
8869
|
-
for (const
|
|
8889
|
+
for (const g of d) URL.revokeObjectURL(g);
|
|
8870
8890
|
d.clear();
|
|
8871
8891
|
}
|
|
8872
8892
|
});
|
|
@@ -8888,7 +8908,7 @@ function Vo(r) {
|
|
|
8888
8908
|
const i = /\.([a-z0-9]+)$/i.exec(t);
|
|
8889
8909
|
return ((n = i == null ? void 0 : i[1]) == null ? void 0 : n.toLowerCase()) ?? null;
|
|
8890
8910
|
}
|
|
8891
|
-
function
|
|
8911
|
+
function Bi(r) {
|
|
8892
8912
|
const e = r.filter((n) => !!n);
|
|
8893
8913
|
if (e.length === 0) return new AbortController().signal;
|
|
8894
8914
|
if (e.length === 1) return e[0];
|
|
@@ -8903,7 +8923,7 @@ function Vi(r) {
|
|
|
8903
8923
|
}
|
|
8904
8924
|
return t.signal;
|
|
8905
8925
|
}
|
|
8906
|
-
function
|
|
8926
|
+
function Ui(r) {
|
|
8907
8927
|
if (r.aborted)
|
|
8908
8928
|
throw typeof r.throwIfAborted == "function" && r.throwIfAborted(), new DOMException("The operation was aborted.", "AbortError");
|
|
8909
8929
|
}
|
|
@@ -8925,7 +8945,7 @@ function _o(r) {
|
|
|
8925
8945
|
} catch {
|
|
8926
8946
|
return ((t = e.split(/[?#]/, 1)[0]) == null ? void 0 : t.split("/").pop()) || null;
|
|
8927
8947
|
}
|
|
8928
|
-
return
|
|
8948
|
+
return Nt(r) ? r.entry ?? null : typeof File < "u" && r instanceof File && r.name || null;
|
|
8929
8949
|
}
|
|
8930
8950
|
function Ho(r) {
|
|
8931
8951
|
var e;
|
|
@@ -8936,38 +8956,56 @@ function Ho(r) {
|
|
|
8936
8956
|
return null;
|
|
8937
8957
|
}
|
|
8938
8958
|
}
|
|
8939
|
-
function
|
|
8959
|
+
function Nt(r) {
|
|
8940
8960
|
return typeof r == "object" && r !== null && "kind" in r && r.kind === "files";
|
|
8941
8961
|
}
|
|
8942
8962
|
function qo(r, e, t) {
|
|
8943
8963
|
if (e) {
|
|
8944
|
-
const i =
|
|
8945
|
-
if (!r.some((n) =>
|
|
8946
|
-
throw
|
|
8964
|
+
const i = ie(e);
|
|
8965
|
+
if (!r.some((n) => ie(n.path) === i))
|
|
8966
|
+
throw ot(`Asset package entry not found: ${e}`, "E_ASSET_ENTRY_NOT_FOUND");
|
|
8947
8967
|
return i;
|
|
8948
8968
|
}
|
|
8949
8969
|
if (t) {
|
|
8950
|
-
const i =
|
|
8951
|
-
if (r.filter((s) =>
|
|
8970
|
+
const i = ie(t);
|
|
8971
|
+
if (r.filter((s) => ie(s.path) === i).length === 1) return i;
|
|
8952
8972
|
}
|
|
8953
|
-
if (r.length === 1) return
|
|
8954
|
-
throw
|
|
8973
|
+
if (r.length === 1) return ie(r[0].path);
|
|
8974
|
+
throw ot("Asset package has multiple files; specify an entry.", "E_ASSET_AMBIGUOUS_ENTRY");
|
|
8955
8975
|
}
|
|
8956
8976
|
function Yo(r, e, t) {
|
|
8957
8977
|
if (!r || !e) return;
|
|
8958
8978
|
const i = e.lastIndexOf("/"), n = i < 0 ? "" : e.slice(0, i + 1);
|
|
8959
|
-
return r.get(
|
|
8979
|
+
return r.get(ie(`${n}${t}`));
|
|
8960
8980
|
}
|
|
8961
|
-
function
|
|
8981
|
+
function ie(r) {
|
|
8962
8982
|
const e = [];
|
|
8963
8983
|
for (const t of r.replaceAll("\\", "/").split("/"))
|
|
8964
|
-
!t || t === "." || (t === ".." ? e.pop() : e.push(t));
|
|
8984
|
+
!t || t === "." || (t === ".." ? e.length && e.at(-1) !== ".." ? e.pop() : e.push("..") : e.push(t));
|
|
8965
8985
|
return e.join("/");
|
|
8966
8986
|
}
|
|
8967
|
-
|
|
8987
|
+
function Wo(r) {
|
|
8988
|
+
const e = /* @__PURE__ */ new Set();
|
|
8989
|
+
for (const t of r) {
|
|
8990
|
+
if (/^[a-z][a-z\d+.-]*:/i.test(t) || t.startsWith("/"))
|
|
8991
|
+
throw ot(
|
|
8992
|
+
`resourceResolver.listResources() must return entry-relative paths: ${t}`,
|
|
8993
|
+
"E_ASSET_RESOURCE_PATH_INVALID"
|
|
8994
|
+
);
|
|
8995
|
+
if (t.includes("?") || t.includes("#"))
|
|
8996
|
+
throw ot(
|
|
8997
|
+
`resourceResolver.listResources() must return logical paths without query or hash: ${t}`,
|
|
8998
|
+
"E_ASSET_RESOURCE_PATH_INVALID"
|
|
8999
|
+
);
|
|
9000
|
+
const i = ie(t);
|
|
9001
|
+
i && e.add(i);
|
|
9002
|
+
}
|
|
9003
|
+
return Object.freeze([...e]);
|
|
9004
|
+
}
|
|
9005
|
+
async function Go(r, e, t) {
|
|
8968
9006
|
return r ? r.resolve(e, { signal: t }) : null;
|
|
8969
9007
|
}
|
|
8970
|
-
function
|
|
9008
|
+
function ot(r, e) {
|
|
8971
9009
|
return Object.assign(new Error(r), { code: e });
|
|
8972
9010
|
}
|
|
8973
9011
|
const _i = Object.freeze({
|
|
@@ -8980,8 +9018,8 @@ const _i = Object.freeze({
|
|
|
8980
9018
|
}), Ee = Object.freeze({
|
|
8981
9019
|
light: 15265002,
|
|
8982
9020
|
dark: 593167
|
|
8983
|
-
}),
|
|
8984
|
-
class
|
|
9021
|
+
}), Xo = 0.05;
|
|
9022
|
+
class Ko {
|
|
8985
9023
|
constructor(e) {
|
|
8986
9024
|
u(this, "epoch", 0);
|
|
8987
9025
|
u(this, "active", null);
|
|
@@ -9013,9 +9051,9 @@ class Xo {
|
|
|
9013
9051
|
epoch: s,
|
|
9014
9052
|
abort: new AbortController(),
|
|
9015
9053
|
listeners: /* @__PURE__ */ new Set(),
|
|
9016
|
-
ready:
|
|
9017
|
-
finished:
|
|
9018
|
-
closeResult:
|
|
9054
|
+
ready: kt(),
|
|
9055
|
+
finished: kt(),
|
|
9056
|
+
closeResult: kt(),
|
|
9019
9057
|
options: t,
|
|
9020
9058
|
snapshot: Object.freeze({ revision: 0, phase: "detecting", format: null, kind: null, capabilities: null, error: null, filename: null }),
|
|
9021
9059
|
dynamic: !1,
|
|
@@ -9114,7 +9152,7 @@ class Xo {
|
|
|
9114
9152
|
if (!t || !this.current(t) || t.snapshot.phase !== "ready" || !t.dynamic || !t.session) return !1;
|
|
9115
9153
|
const i = t.session, n = t.playing ? i.update : i.updatePaused;
|
|
9116
9154
|
if (!n) return !1;
|
|
9117
|
-
const s = t.resetFrameClock ? 0 : Math.max(0, Math.min(Number.isNaN(e) ? 0 : e,
|
|
9155
|
+
const s = t.resetFrameClock ? 0 : Math.max(0, Math.min(Number.isNaN(e) ? 0 : e, Xo));
|
|
9118
9156
|
t.resetFrameClock = !1;
|
|
9119
9157
|
try {
|
|
9120
9158
|
return !!(n.call(i, s) && this.current(t) && t.snapshot.phase === "ready");
|
|
@@ -9140,7 +9178,7 @@ class Xo {
|
|
|
9140
9178
|
const o = this.detect(e), l = Hi(o) ? await o : o;
|
|
9141
9179
|
if (!this.current(e) || (e.loader = l.loader, !this.current(e))) return;
|
|
9142
9180
|
if (!this.host.loaders().includes(l.loader))
|
|
9143
|
-
throw
|
|
9181
|
+
throw K("Asset loader was removed.", "E_ABORTED");
|
|
9144
9182
|
if (this.transition(e, {
|
|
9145
9183
|
phase: "loading",
|
|
9146
9184
|
format: l.format,
|
|
@@ -9164,24 +9202,25 @@ class Xo {
|
|
|
9164
9202
|
},
|
|
9165
9203
|
...this.host.invalidateTransmissionCaches ? {
|
|
9166
9204
|
invalidateTransmissionCaches: () => {
|
|
9167
|
-
var f,
|
|
9168
|
-
this.current(e) && ((
|
|
9205
|
+
var f, g;
|
|
9206
|
+
this.current(e) && ((g = (f = this.host).invalidateTransmissionCaches) == null || g.call(f));
|
|
9169
9207
|
}
|
|
9170
9208
|
} : {},
|
|
9171
|
-
fit: (f,
|
|
9172
|
-
reportError: (f,
|
|
9209
|
+
fit: (f, g) => this.current(e) ? this.host.fit(f, g) : !1,
|
|
9210
|
+
reportError: (f, g) => this.report(e, f, g),
|
|
9173
9211
|
reportSessionState: () => {
|
|
9174
|
-
var
|
|
9212
|
+
var g;
|
|
9175
9213
|
if (!this.current(e) || e.snapshot.phase !== "ready" || !e.session) return;
|
|
9176
9214
|
const f = e.session;
|
|
9177
|
-
f.isPlaying && (e.playing = f.isPlaying()), ((
|
|
9215
|
+
f.isPlaying && (e.playing = f.isPlaying()), ((g = f.physics) == null ? void 0 : g.status) === "unavailable" && (e.playing = !1, e.resetFrameClock = !1, this.endGrabOf(e)), this.transition(e, {
|
|
9178
9216
|
capabilities: f.capabilities ?? _i,
|
|
9179
9217
|
physics: f.physics ?? null,
|
|
9218
|
+
backgroundLoading: f.backgroundLoading ?? null,
|
|
9180
9219
|
warning: f.warning ?? null
|
|
9181
9220
|
}), this.publishControl(e), this.host.requestRender();
|
|
9182
9221
|
},
|
|
9183
|
-
reportProgress: (f,
|
|
9184
|
-
this.current(e) && e.snapshot.phase === "loading" && this.transition(e, { stage: f, message:
|
|
9222
|
+
reportProgress: (f, g) => {
|
|
9223
|
+
this.current(e) && e.snapshot.phase === "loading" && this.transition(e, { stage: f, message: g });
|
|
9185
9224
|
}
|
|
9186
9225
|
}, h = l.loader.createSession(e.source, p), m = Hi(h) ? await h : h;
|
|
9187
9226
|
if (e.session && e.session !== m) {
|
|
@@ -9199,7 +9238,7 @@ class Xo {
|
|
|
9199
9238
|
if (e.mounted = m.root, this.host.mount(m.root), !this.current(e)) return;
|
|
9200
9239
|
if (((i = m.presentation ?? l.loader.presentation) == null ? void 0 : i.fitPolicy) === "fit-on-ready") {
|
|
9201
9240
|
const f = ((n = m.getFitBounds) == null ? void 0 : n.call(m)) ?? m.fitTarget ?? m.root;
|
|
9202
|
-
if (!this.host.fit(f, { padding: 1.15 })) throw
|
|
9241
|
+
if (!this.host.fit(f, { padding: 1.15 })) throw K("Asset has no displayable geometry.", "E_ASSET_EMPTY");
|
|
9203
9242
|
}
|
|
9204
9243
|
}
|
|
9205
9244
|
if (!this.current(e)) return;
|
|
@@ -9207,7 +9246,8 @@ class Xo {
|
|
|
9207
9246
|
phase: "ready",
|
|
9208
9247
|
capabilities: m.capabilities ?? _i,
|
|
9209
9248
|
warning: m.warning ?? null,
|
|
9210
|
-
physics: m.physics ?? null
|
|
9249
|
+
physics: m.physics ?? null,
|
|
9250
|
+
backgroundLoading: m.backgroundLoading ?? null
|
|
9211
9251
|
}), this.current(e) && e.snapshot.phase === "ready" && e.ready.resolve();
|
|
9212
9252
|
} catch (s) {
|
|
9213
9253
|
this.current(e) && this.report(e, s, { fatal: !0, stage: "load" });
|
|
@@ -9220,23 +9260,23 @@ class Xo {
|
|
|
9220
9260
|
if (a) {
|
|
9221
9261
|
const o = i.find((l) => l.formats.includes(a));
|
|
9222
9262
|
if (o) return { loader: o, format: a };
|
|
9223
|
-
if (n && n !== "auto") throw
|
|
9263
|
+
if (n && n !== "auto") throw K(`Unsupported asset format: ${n}`, "E_ASSET_UNKNOWN_FORMAT");
|
|
9224
9264
|
}
|
|
9225
9265
|
return this.matchLoaders(e, i, 0);
|
|
9226
9266
|
}
|
|
9227
9267
|
async matchLoaders(e, t, i) {
|
|
9228
9268
|
var n;
|
|
9229
9269
|
for (let s = i; s < t.length; s += 1) {
|
|
9230
|
-
if (!this.current(e)) throw
|
|
9270
|
+
if (!this.current(e)) throw K("Asset open superseded.", "E_SUPERSEDED");
|
|
9231
9271
|
const a = t[s], o = await ((n = a.match) == null ? void 0 : n.call(a, e.source));
|
|
9232
9272
|
if (o && o.format !== "auto" && a.formats.includes(o.format)) return { loader: a, format: o.format };
|
|
9233
9273
|
}
|
|
9234
|
-
throw
|
|
9274
|
+
throw K("Unable to determine asset format automatically; provide a supported filename or specify format explicitly.", "E_ASSET_UNKNOWN_FORMAT");
|
|
9235
9275
|
}
|
|
9236
9276
|
stop(e, t) {
|
|
9237
9277
|
var i;
|
|
9238
9278
|
if (e.stopped) return e.closeResult.promise;
|
|
9239
|
-
if (e.stopped = !0, e.playing = !1, e.resetFrameClock = !1, this.endGrabOf(e), this.active === e && (this.active = null, this.host.applyProfile(void 0)), e.ready.reject(
|
|
9279
|
+
if (e.stopped = !0, e.playing = !1, e.resetFrameClock = !1, this.endGrabOf(e), this.active === e && (this.active = null, this.host.applyProfile(void 0)), e.ready.reject(K(t === "E_SUPERSEDED" ? "Asset open superseded." : "Asset open aborted.", t)), (i = e.unsubscribeAbort) == null || i.call(e), e.abort.abort(), this.beginDispose(e), e.mounted) {
|
|
9240
9280
|
const n = e.mounted;
|
|
9241
9281
|
e.mounted = void 0;
|
|
9242
9282
|
try {
|
|
@@ -9281,11 +9321,11 @@ class Xo {
|
|
|
9281
9321
|
}
|
|
9282
9322
|
control(e, t) {
|
|
9283
9323
|
var n, s;
|
|
9284
|
-
if (!this.current(e)) throw
|
|
9285
|
-
if (e.snapshot.phase !== "ready") throw
|
|
9324
|
+
if (!this.current(e)) throw K("Asset is inactive.", "E_ASSET_INACTIVE");
|
|
9325
|
+
if (e.snapshot.phase !== "ready") throw K("Asset is not ready.", "E_ASSET_NOT_READY");
|
|
9286
9326
|
const i = t === "play" ? "canPlay" : t === "pause" ? "canPause" : "canReset";
|
|
9287
9327
|
if (!((n = e.snapshot.capabilities) != null && n[i]) || !((s = e.session) != null && s[t]))
|
|
9288
|
-
throw
|
|
9328
|
+
throw K(`Asset does not support ${t}.`, "E_ASSET_CAPABILITY_UNAVAILABLE");
|
|
9289
9329
|
this.applyControl(e, t);
|
|
9290
9330
|
}
|
|
9291
9331
|
applyControl(e, t) {
|
|
@@ -9298,19 +9338,19 @@ class Xo {
|
|
|
9298
9338
|
* surface returns booleans instead of throwing `E_ASSET_*`.
|
|
9299
9339
|
*/
|
|
9300
9340
|
requireReady(e) {
|
|
9301
|
-
if (!this.current(e)) throw
|
|
9302
|
-
if (e.snapshot.phase !== "ready") throw
|
|
9341
|
+
if (!this.current(e)) throw K("Asset is inactive.", "E_ASSET_INACTIVE");
|
|
9342
|
+
if (e.snapshot.phase !== "ready") throw K("Asset is not ready.", "E_ASSET_NOT_READY");
|
|
9303
9343
|
}
|
|
9304
9344
|
requireCapability(e, t, i) {
|
|
9305
9345
|
var n;
|
|
9306
9346
|
if (this.requireReady(e), !((n = e.snapshot.capabilities) != null && n[t]))
|
|
9307
|
-
throw
|
|
9347
|
+
throw K(i, "E_ASSET_CAPABILITY_UNAVAILABLE");
|
|
9308
9348
|
}
|
|
9309
9349
|
requireSession(e, t, i) {
|
|
9310
9350
|
var s;
|
|
9311
9351
|
this.requireReady(e);
|
|
9312
9352
|
const n = (s = e.session) == null ? void 0 : s[t];
|
|
9313
|
-
if (typeof n != "function") throw
|
|
9353
|
+
if (typeof n != "function") throw K(i, "E_ASSET_CAPABILITY_UNAVAILABLE");
|
|
9314
9354
|
return n.bind(e.session);
|
|
9315
9355
|
}
|
|
9316
9356
|
setCollisionVisible(e, t) {
|
|
@@ -9482,7 +9522,11 @@ class Xo {
|
|
|
9482
9522
|
stage: i.stage,
|
|
9483
9523
|
fatal: i.fatal
|
|
9484
9524
|
};
|
|
9485
|
-
if (this.current(e) && i.fatal && (e.playing = !1, e.resetFrameClock = !1, this.transition(e, {
|
|
9525
|
+
if (this.current(e) && i.fatal && (e.playing = !1, e.resetFrameClock = !1, this.transition(e, {
|
|
9526
|
+
phase: "failed",
|
|
9527
|
+
error: Object.freeze({ code: s.code, message: s.message, stage: s.stage, fatal: !0 }),
|
|
9528
|
+
backgroundLoading: null
|
|
9529
|
+
}), e.ready.reject(n)), this.disposed)
|
|
9486
9530
|
i.stage === "dispose" && this.host.cleanupError ? this.host.cleanupError(s) : console.error("[viewer] asset cleanup failed", s);
|
|
9487
9531
|
else if (this.current(e) || i.stage === "dispose")
|
|
9488
9532
|
try {
|
|
@@ -9512,7 +9556,7 @@ class Xo {
|
|
|
9512
9556
|
}
|
|
9513
9557
|
}
|
|
9514
9558
|
}
|
|
9515
|
-
function
|
|
9559
|
+
function kt() {
|
|
9516
9560
|
let r, e;
|
|
9517
9561
|
const t = new Promise((i, n) => {
|
|
9518
9562
|
r = i, e = n;
|
|
@@ -9520,13 +9564,13 @@ function Et() {
|
|
|
9520
9564
|
return t.catch(() => {
|
|
9521
9565
|
}), { promise: t, resolve: r, reject: e };
|
|
9522
9566
|
}
|
|
9523
|
-
function
|
|
9567
|
+
function K(r, e) {
|
|
9524
9568
|
return Object.assign(new Error(r), { code: e, ...e === "E_ABORTED" || e === "E_SUPERSEDED" ? { name: "AbortError" } : {} });
|
|
9525
9569
|
}
|
|
9526
9570
|
function Hi(r) {
|
|
9527
9571
|
return !!(r && typeof r.then == "function");
|
|
9528
9572
|
}
|
|
9529
|
-
const
|
|
9573
|
+
const Jo = {
|
|
9530
9574
|
id: "nebula-asset-model",
|
|
9531
9575
|
activate(r) {
|
|
9532
9576
|
r.contribute({
|
|
@@ -9544,13 +9588,13 @@ const Ko = {
|
|
|
9544
9588
|
clearColor: Ee.dark
|
|
9545
9589
|
},
|
|
9546
9590
|
async createSession(e, t) {
|
|
9547
|
-
const { createModelSession: i } = await import("./session-
|
|
9591
|
+
const { createModelSession: i } = await import("./session-Dn5fAl3z.js");
|
|
9548
9592
|
return i(e, t);
|
|
9549
9593
|
}
|
|
9550
9594
|
});
|
|
9551
9595
|
}
|
|
9552
9596
|
};
|
|
9553
|
-
function
|
|
9597
|
+
function Zo(r, e, t) {
|
|
9554
9598
|
let i = !1, n = !1;
|
|
9555
9599
|
const s = {
|
|
9556
9600
|
...t.options.cad,
|
|
@@ -9579,7 +9623,7 @@ function Jo(r, e, t) {
|
|
|
9579
9623
|
}
|
|
9580
9624
|
};
|
|
9581
9625
|
}
|
|
9582
|
-
function
|
|
9626
|
+
function Qo(r) {
|
|
9583
9627
|
return {
|
|
9584
9628
|
id: "nebula-asset-cad",
|
|
9585
9629
|
activate(e) {
|
|
@@ -9594,24 +9638,24 @@ function Zo(r) {
|
|
|
9594
9638
|
uiProfile: "cad",
|
|
9595
9639
|
fitPolicy: "restore-then-fit"
|
|
9596
9640
|
},
|
|
9597
|
-
createSession: (t, i) =>
|
|
9641
|
+
createSession: (t, i) => Zo(r, t, i)
|
|
9598
9642
|
});
|
|
9599
9643
|
}
|
|
9600
9644
|
};
|
|
9601
9645
|
}
|
|
9602
|
-
function
|
|
9646
|
+
function el(r) {
|
|
9603
9647
|
const e = r.replace(/^\uFEFF/, "").replace(/^\s*(?:<\?[\s\S]*?\?>\s*)?/, "").replace(/^(?:<!--[\s\S]*?-->\s*)*/, "");
|
|
9604
9648
|
return /^<\s*mujoco(?:\s|>)/i.test(e) ? "mjcf" : /^<\s*robot(?:\s|>)/i.test(e) ? "urdf" : null;
|
|
9605
9649
|
}
|
|
9606
|
-
async function
|
|
9650
|
+
async function tl(r) {
|
|
9607
9651
|
const e = r.entryPath ?? r.filename ?? r.url ?? "";
|
|
9608
9652
|
if (!e.toLowerCase().split(/[?#]/, 1)[0].endsWith(".xml")) return null;
|
|
9609
9653
|
const t = await r.resolve(e), i = await fetch(t, { signal: r.signal });
|
|
9610
9654
|
if (!i.ok) return null;
|
|
9611
|
-
const n =
|
|
9655
|
+
const n = el(await i.text());
|
|
9612
9656
|
return n ? { format: n } : null;
|
|
9613
9657
|
}
|
|
9614
|
-
const
|
|
9658
|
+
const il = {
|
|
9615
9659
|
id: "nebula-asset-simulation",
|
|
9616
9660
|
activate(r) {
|
|
9617
9661
|
r.contribute({
|
|
@@ -9619,7 +9663,7 @@ const tl = {
|
|
|
9619
9663
|
id: "nebula.simulation-loader",
|
|
9620
9664
|
assetKind: "simulation",
|
|
9621
9665
|
formats: ["urdf", "xacro", "mjcf", "usd", "usda", "usdc", "usdz"],
|
|
9622
|
-
match:
|
|
9666
|
+
match: tl,
|
|
9623
9667
|
presentation: {
|
|
9624
9668
|
preferredViewMode: "3d",
|
|
9625
9669
|
interactionMode: "simulation",
|
|
@@ -9628,7 +9672,7 @@ const tl = {
|
|
|
9628
9672
|
clearColor: Ee.dark
|
|
9629
9673
|
},
|
|
9630
9674
|
async createSession(e, t) {
|
|
9631
|
-
const { createSimulationSession: i } = await import("./session-
|
|
9675
|
+
const { createSimulationSession: i } = await import("./session-CEipzQYJ.js").then((n) => n.a);
|
|
9632
9676
|
return i(e, t);
|
|
9633
9677
|
}
|
|
9634
9678
|
});
|
|
@@ -9642,8 +9686,8 @@ const tl = {
|
|
|
9642
9686
|
hover: { color: 24524, fillOpacity: 0, edgeOpacity: 0.95 },
|
|
9643
9687
|
selected: { color: 24524, fillOpacity: 0.2, edgeOpacity: 1 }
|
|
9644
9688
|
}
|
|
9645
|
-
},
|
|
9646
|
-
class
|
|
9689
|
+
}, nl = 6, rl = 12, sl = 160, al = 160, ol = 50, Yi = 592655;
|
|
9690
|
+
class ll {
|
|
9647
9691
|
constructor(e, t) {
|
|
9648
9692
|
u(this, "cad");
|
|
9649
9693
|
u(this, "mountedObjects", /* @__PURE__ */ new Set());
|
|
@@ -9660,8 +9704,8 @@ class ol {
|
|
|
9660
9704
|
u(this, "cadHoveredInsert", null);
|
|
9661
9705
|
u(this, "cadPointerPosition", null);
|
|
9662
9706
|
u(this, "pointerDragTracker", new Ws({
|
|
9663
|
-
distancePx:
|
|
9664
|
-
pathPx:
|
|
9707
|
+
distancePx: nl,
|
|
9708
|
+
pathPx: rl
|
|
9665
9709
|
}));
|
|
9666
9710
|
u(this, "cadCapability");
|
|
9667
9711
|
u(this, "cadHost");
|
|
@@ -9796,17 +9840,17 @@ class ol {
|
|
|
9796
9840
|
u(this, "handlePointerLeave", (e) => {
|
|
9797
9841
|
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));
|
|
9798
9842
|
});
|
|
9799
|
-
var i, n, s, a, o, l, d, c, p, h, m, f, b,
|
|
9800
|
-
this.options = e, this.runtime = t, this.cameraStateStore = e.cameraStateStore === !1 ? void 0 : e.cameraStateStore ?? ks(), this.interactionMode = e.cadInteraction ?? "managed", this.defaultEnvironment = (i = e.environmentPresets) != null && i.length ? e.environmentPresets[0] : e.environment ?? "room", this.environmentPresets = (n = e.environmentPresets) != null && n.length ? e.environmentPresets.map((
|
|
9843
|
+
var i, n, s, a, o, l, d, c, p, h, m, f, g, b, x, v, w;
|
|
9844
|
+
this.options = e, this.runtime = t, this.cameraStateStore = e.cameraStateStore === !1 ? void 0 : e.cameraStateStore ?? ks(), this.interactionMode = e.cadInteraction ?? "managed", this.defaultEnvironment = (i = e.environmentPresets) != null && i.length ? e.environmentPresets[0] : e.environment ?? "room", this.environmentPresets = (n = e.environmentPresets) != null && n.length ? e.environmentPresets.map((y) => Wi(y)).filter((y) => y !== null) : [Wi(this.defaultEnvironment)].filter((y) => y !== null), this.activePresetIndex = this.environmentPresets.length > 0 ? 0 : null, this.environmentRotation = Gi(e.environmentRotation ?? 0), this.environmentSupported = typeof t.setEnvironment == "function" && typeof t.setEnvironmentBackgroundVisible == "function" && typeof t.getEnvironmentBackgroundVisible == "function", this.environmentRotationSupported = typeof t.setEnvironmentRotation == "function", this.environmentRotationSupported && t.setEnvironmentRotation(this.environmentRotation), e.previewDragPreset && this.runtime.setPreviewDragPreset(e.previewDragPreset), this.uiTheme = ((s = e.ui) == null ? void 0 : s.theme) ?? "dark", this.cadHost = this.createCadHost(), this.cadCapability = new Bs(this.cadHost), this.cad = this.cadCapability, this.cadCapability.open = async (y, C = {}) => {
|
|
9801
9845
|
this.assertActive();
|
|
9802
9846
|
const { filename: k, signal: E, ...P } = C;
|
|
9803
|
-
await this.assetController.open(
|
|
9804
|
-
const
|
|
9805
|
-
if (!
|
|
9806
|
-
return
|
|
9847
|
+
await this.assetController.open(y, { format: "cad", filename: k, signal: E, cad: P }, !0).ready;
|
|
9848
|
+
const T = this.cadCapability.document;
|
|
9849
|
+
if (!T) throw Object.assign(new Error("CAD open superseded"), { code: "E_SUPERSEDED", name: "AbortError" });
|
|
9850
|
+
return T;
|
|
9807
9851
|
}, this.cadCapability.close = () => {
|
|
9808
9852
|
this.assertActive(), this.assetController.closeKind("cad");
|
|
9809
|
-
}, this.initialCameraSnapshot = t.captureCameraSnapshot(), this.lastCameraFingerprint =
|
|
9853
|
+
}, this.initialCameraSnapshot = t.captureCameraSnapshot(), this.lastCameraFingerprint = St(this.initialCameraSnapshot), this.layoutEngine = this.createLayoutEngine(), this.pluginManager = new Fo(
|
|
9810
9854
|
() => this.cadCapability.getSnapshot(),
|
|
9811
9855
|
() => ({
|
|
9812
9856
|
viewMode: this.runtime.viewMode,
|
|
@@ -9816,12 +9860,12 @@ class ol {
|
|
|
9816
9860
|
}),
|
|
9817
9861
|
() => this.assetController.getActiveSnapshot(),
|
|
9818
9862
|
() => this.assetController.getActiveControlState(),
|
|
9819
|
-
(
|
|
9863
|
+
(y, C) => this.subscribePluginEvent(y, C),
|
|
9820
9864
|
{
|
|
9821
|
-
setLayerVisible: (
|
|
9822
|
-
setSelection: (
|
|
9865
|
+
setLayerVisible: (y, C) => this.cad.layers.setVisible(y, C),
|
|
9866
|
+
setSelection: (y) => this.cad.select(y),
|
|
9823
9867
|
fitDocument: () => this.cad.fitDocument(),
|
|
9824
|
-
setViewMode: (
|
|
9868
|
+
setViewMode: (y) => this.setViewMode(y),
|
|
9825
9869
|
play: () => this.assetController.tryPlay(),
|
|
9826
9870
|
pause: () => this.assetController.tryPause(),
|
|
9827
9871
|
reset: () => this.assetController.tryReset(),
|
|
@@ -9832,81 +9876,81 @@ class ol {
|
|
|
9832
9876
|
return !1;
|
|
9833
9877
|
}
|
|
9834
9878
|
},
|
|
9835
|
-
setUpAxis: (
|
|
9836
|
-
setGroundVisible: (
|
|
9837
|
-
setCollisionVisible: (
|
|
9838
|
-
setTheme: (
|
|
9879
|
+
setUpAxis: (y) => this.assetController.trySetUpAxis(y),
|
|
9880
|
+
setGroundVisible: (y) => this.assetController.trySetGroundVisible(y),
|
|
9881
|
+
setCollisionVisible: (y) => this.assetController.trySetCollisionVisible(y),
|
|
9882
|
+
setTheme: (y) => this.applyUiTheme(y)
|
|
9839
9883
|
},
|
|
9840
9884
|
e.viewport,
|
|
9841
9885
|
this.layoutEngine,
|
|
9842
9886
|
() => this.assetController.getActiveInspection()
|
|
9843
|
-
), this.assetController = new
|
|
9887
|
+
), this.assetController = new Ko({
|
|
9844
9888
|
loaders: () => this.pluginManager.getAssetLoaders(),
|
|
9845
9889
|
...this.runtime.getRenderer ? { getRenderer: () => this.runtime.getRenderer() } : {},
|
|
9846
|
-
mount: (
|
|
9847
|
-
detach: (
|
|
9848
|
-
applyProfile: (
|
|
9849
|
-
fit: (
|
|
9890
|
+
mount: (y) => this.mountAssetObject(y),
|
|
9891
|
+
detach: (y) => this.unmountAssetObject(y),
|
|
9892
|
+
applyProfile: (y) => this.applyAssetProfile(y),
|
|
9893
|
+
fit: (y, C) => this.runtime.fitView(y, C),
|
|
9850
9894
|
requestRender: () => this.runtime.requestRender(),
|
|
9851
9895
|
invalidateTransmissionCaches: () => {
|
|
9852
|
-
var
|
|
9853
|
-
return (C = (
|
|
9896
|
+
var y, C;
|
|
9897
|
+
return (C = (y = this.runtime).invalidateTransmissionCaches) == null ? void 0 : C.call(y);
|
|
9854
9898
|
},
|
|
9855
|
-
change: (
|
|
9856
|
-
error: (
|
|
9857
|
-
controlChange: (
|
|
9858
|
-
cleanupError: (
|
|
9859
|
-
this.options.onCleanupError ? this.options.onCleanupError(
|
|
9899
|
+
change: (y) => this.emit("asset-change", y),
|
|
9900
|
+
error: (y) => this.emit("asset-error", y),
|
|
9901
|
+
controlChange: (y) => this.emit("asset-control-change", y),
|
|
9902
|
+
cleanupError: (y) => {
|
|
9903
|
+
this.options.onCleanupError ? this.options.onCleanupError(y) : console.error("[viewer] asset cleanup failed", y);
|
|
9860
9904
|
}
|
|
9861
|
-
}), this.pluginManager.registerBuiltin(
|
|
9905
|
+
}), this.pluginManager.registerBuiltin(Qo(this.cadCapability)), this.pluginManager.registerBuiltin(Jo), this.pluginManager.registerBuiltin(il), this.pluginManager.onAssetLoaderRemoved((y) => this.assetController.removeLoader(y)), this.cadInspectorUnsubscribe = this.cad.on("inspector-change", () => {
|
|
9862
9906
|
this.interactionMode === "managed" && (this.syncCadSelectionOverlay(), this.syncCadHoverOverlay()), this.dispatchCadSelectionChange();
|
|
9863
9907
|
}), this.cadDocumentUnsubscribe = this.cad.on("document-change", () => {
|
|
9864
9908
|
this.setCadHoveredInsert(null), this.interactionMode === "managed" && this.syncCadSelectionOverlay();
|
|
9865
|
-
}), this.assetChangeUnsubscribe = this.on("asset-change", (
|
|
9866
|
-
const C =
|
|
9909
|
+
}), this.assetChangeUnsubscribe = this.on("asset-change", (y) => {
|
|
9910
|
+
const C = y.snapshot.phase;
|
|
9867
9911
|
(C === "closing" || C === "failed" || C === "closed") && this.endAssetGrab();
|
|
9868
9912
|
}), e.ui && e.ui.preset !== "none" && (e.ui.preset !== "cad-readonly" && this.interactionMode === "managed" && this.pluginManager.registerBuiltin(oo(
|
|
9869
9913
|
{
|
|
9870
|
-
mountBuiltin: (
|
|
9914
|
+
mountBuiltin: (y, C) => this.layoutEngine.mountBuiltin(y, C),
|
|
9871
9915
|
shadowRoot: () => this.builtinUiShadow(),
|
|
9872
9916
|
getVisualDiagnostics: () => this.assetController.getActiveVisualDiagnostics(),
|
|
9873
9917
|
interactionCanvas: () => this.options.canvas,
|
|
9874
9918
|
interactionCamera: () => this.runtime.getActiveCamera(),
|
|
9875
9919
|
requestRender: () => this.runtime.requestRender(),
|
|
9876
|
-
setNavigationEnabled: (
|
|
9920
|
+
setNavigationEnabled: (y) => this.runtime.setNavigationEnabled(y),
|
|
9877
9921
|
environment: this.environment,
|
|
9878
9922
|
theme: () => this.uiTheme,
|
|
9879
|
-
onThemeChange: (
|
|
9923
|
+
onThemeChange: (y) => (this.uiThemeListeners.add(y), { dispose: () => this.uiThemeListeners.delete(y) })
|
|
9880
9924
|
},
|
|
9881
9925
|
{
|
|
9882
|
-
label: (
|
|
9926
|
+
label: (y) => y === "simulation" ? "仿真控制" : "模型控制",
|
|
9883
9927
|
scene: e.ui.scene
|
|
9884
9928
|
}
|
|
9885
9929
|
)), e.ui.urdf !== !1 && this.interactionMode === "managed" && this.pluginManager.registerBuiltin(Oo({
|
|
9886
9930
|
interactionCanvas: () => this.options.canvas,
|
|
9887
9931
|
interactionCamera: () => this.runtime.getActiveCamera(),
|
|
9888
9932
|
cameraQuaternion: () => this.runtime.getActiveCamera().quaternion.clone(),
|
|
9889
|
-
mountBuiltin: (
|
|
9933
|
+
mountBuiltin: (y, C) => this.layoutEngine.mountBuiltin(y, C),
|
|
9890
9934
|
shadowRoot: () => this.builtinUiShadow(),
|
|
9891
9935
|
theme: () => this.uiTheme,
|
|
9892
|
-
onThemeChange: (
|
|
9936
|
+
onThemeChange: (y) => (this.uiThemeListeners.add(y), { dispose: () => this.uiThemeListeners.delete(y) })
|
|
9893
9937
|
})), this.interactionMode === "managed" && this.pluginManager.register({
|
|
9894
9938
|
id: "nebula.ui.cad",
|
|
9895
9939
|
activate: () => {
|
|
9896
9940
|
this.ui = new ka(this.createUiHost(), e.ui), this.ui.mount();
|
|
9897
9941
|
},
|
|
9898
9942
|
deactivate: () => {
|
|
9899
|
-
var
|
|
9900
|
-
(
|
|
9943
|
+
var y;
|
|
9944
|
+
(y = this.ui) == null || y.dispose(), this.ui = null;
|
|
9901
9945
|
}
|
|
9902
|
-
})), (o = (a = this.options.canvas).addEventListener) == null || o.call(a, "pointerdown", this.handlePointerDown), (d = (l = this.options.canvas).addEventListener) == null || d.call(l, "pointermove", this.handlePointerMove), (p = (c = this.options.canvas).addEventListener) == null || p.call(c, "pointerup", this.handlePointerUp), (m = (h = this.options.canvas).addEventListener) == null || m.call(h, "pointercancel", this.handlePointerCancel), (
|
|
9903
|
-
renderExtension: { beforeRender: (
|
|
9904
|
-
onFrame: (
|
|
9946
|
+
})), (o = (a = this.options.canvas).addEventListener) == null || o.call(a, "pointerdown", this.handlePointerDown), (d = (l = this.options.canvas).addEventListener) == null || d.call(l, "pointermove", this.handlePointerMove), (p = (c = this.options.canvas).addEventListener) == null || p.call(c, "pointerup", this.handlePointerUp), (m = (h = this.options.canvas).addEventListener) == null || m.call(h, "pointercancel", this.handlePointerCancel), (g = (f = this.options.canvas).addEventListener) == null || g.call(f, "pointerleave", this.handlePointerLeave), (x = (b = this.options.canvas).addEventListener) == null || x.call(b, "lostpointercapture", this.handleLostPointerCapture), (w = (v = this.options.canvas).addEventListener) == null || w.call(v, "wheel", this.handleWheel, { passive: !0 }), typeof globalThis.window < "u" && globalThis.window.addEventListener("blur", this.handleWindowBlur), typeof ResizeObserver == "function" && ml(this.options.viewport) ? (this.viewportResizeObserver = new ResizeObserver(() => this.handleViewportResize()), this.viewportResizeObserver.observe(this.options.viewport)) : (this.viewportResizeObserver = null, typeof globalThis.window < "u" && (this.usingWindowResizeFallback = !0, globalThis.window.addEventListener("resize", this.handleViewportResize))), this.runtime.startAnimation({
|
|
9947
|
+
renderExtension: { beforeRender: (y, C, k) => this.assetController.beforeRender(y, C, k) },
|
|
9948
|
+
onFrame: (y, C) => {
|
|
9905
9949
|
this.assetController.update(C) && this.runtime.requestRender();
|
|
9906
9950
|
},
|
|
9907
|
-
shouldRender: (
|
|
9908
|
-
beforeRender: (
|
|
9909
|
-
this.detectCameraChange() || this.cadCapability.onBeforeRender(), this.interaction === "active" && (this.interactionRenderLastTs =
|
|
9951
|
+
shouldRender: (y) => this.shouldRenderCurrentFrame(y),
|
|
9952
|
+
beforeRender: (y) => {
|
|
9953
|
+
this.detectCameraChange() || this.cadCapability.onBeforeRender(), this.interaction === "active" && (this.interactionRenderLastTs = y);
|
|
9910
9954
|
},
|
|
9911
9955
|
onInfoUpdate: () => {
|
|
9912
9956
|
this.detectCameraChange() || this.cadCapability.onRuntimeStatsChanged();
|
|
@@ -10023,7 +10067,7 @@ class ol {
|
|
|
10023
10067
|
async loadEnvironmentFile(e) {
|
|
10024
10068
|
var o;
|
|
10025
10069
|
this.assertActive();
|
|
10026
|
-
const t =
|
|
10070
|
+
const t = cl(e);
|
|
10027
10071
|
if (!t) return !1;
|
|
10028
10072
|
const i = URL.createObjectURL(e), n = { type: t, url: i, name: e.name }, s = (o = this.customEnvironment) == null ? void 0 : o.url, a = await this.applyEnvironment(n, "custom", () => {
|
|
10029
10073
|
this.customEnvironment = n, s && s !== i && URL.revokeObjectURL(s);
|
|
@@ -10083,7 +10127,7 @@ class ol {
|
|
|
10083
10127
|
this.assertActive(), e !== this.runtime.viewMode && (t ? this.runtime.setViewMode(e, t) : this.runtime.setViewMode(e), this.emit("view-mode-change", { viewMode: e }), this.pendingCameraReason = "view-mode", this.cadCapability.onCameraChanged("view-mode"), this.refreshCadPointerHover());
|
|
10084
10128
|
}
|
|
10085
10129
|
fitView(e, t) {
|
|
10086
|
-
this.assertActive(), e && !(e instanceof
|
|
10130
|
+
this.assertActive(), e && !(e instanceof Q) && this.assertMounted(e);
|
|
10087
10131
|
const i = e ?? this.assetController.getActiveFitBounds() ?? this.pluginManager.findFitPolicy() ?? this.resolveMixedBounds();
|
|
10088
10132
|
if (!i) return !1;
|
|
10089
10133
|
const n = this.runtime.fitView(i, t);
|
|
@@ -10144,14 +10188,14 @@ class ol {
|
|
|
10144
10188
|
this.assertActive(), this.pluginManager.use(e, t);
|
|
10145
10189
|
}
|
|
10146
10190
|
dispose() {
|
|
10147
|
-
var e, t, i, n, s, a, o, l, d, c, p, h, m, f,
|
|
10191
|
+
var e, t, i, n, s, a, o, l, d, c, p, h, m, f, g;
|
|
10148
10192
|
if (!this.disposed) {
|
|
10149
|
-
this.environmentGeneration += 1, this.customEnvironment && (URL.revokeObjectURL(this.customEnvironment.url), this.customEnvironment = null), this.grabbing && this.endAssetGrab(), this.assetController.dispose(), this.disposed = !0, this.pluginManager.dispose(), this.clearInteractionIdleTimer(), this.pointerDragTracker.reset(), (t = (e = this.options.canvas).removeEventListener) == null || t.call(e, "pointerdown", this.handlePointerDown), (n = (i = this.options.canvas).removeEventListener) == null || n.call(i, "pointermove", this.handlePointerMove), (a = (s = this.options.canvas).removeEventListener) == null || a.call(s, "pointerup", this.handlePointerUp), (l = (o = this.options.canvas).removeEventListener) == null || l.call(o, "pointercancel", this.handlePointerCancel), (c = (d = this.options.canvas).removeEventListener) == null || c.call(d, "pointerleave", this.handlePointerLeave), (h = (p = this.options.canvas).removeEventListener) == null || h.call(p, "lostpointercapture", this.handleLostPointerCapture), (f = (m = this.options.canvas).removeEventListener) == null || f.call(m, "wheel", this.handleWheel), typeof globalThis.window < "u" && (globalThis.window.removeEventListener("blur", this.handleWindowBlur), this.usingWindowResizeFallback && globalThis.window.removeEventListener("resize", this.handleViewportResize)), (
|
|
10150
|
-
for (const
|
|
10151
|
-
this.runtime.removeObject(
|
|
10193
|
+
this.environmentGeneration += 1, this.customEnvironment && (URL.revokeObjectURL(this.customEnvironment.url), this.customEnvironment = null), this.grabbing && this.endAssetGrab(), this.assetController.dispose(), this.disposed = !0, this.pluginManager.dispose(), this.clearInteractionIdleTimer(), this.pointerDragTracker.reset(), (t = (e = this.options.canvas).removeEventListener) == null || t.call(e, "pointerdown", this.handlePointerDown), (n = (i = this.options.canvas).removeEventListener) == null || n.call(i, "pointermove", this.handlePointerMove), (a = (s = this.options.canvas).removeEventListener) == null || a.call(s, "pointerup", this.handlePointerUp), (l = (o = this.options.canvas).removeEventListener) == null || l.call(o, "pointercancel", this.handlePointerCancel), (c = (d = this.options.canvas).removeEventListener) == null || c.call(d, "pointerleave", this.handlePointerLeave), (h = (p = this.options.canvas).removeEventListener) == null || h.call(p, "lostpointercapture", this.handleLostPointerCapture), (f = (m = this.options.canvas).removeEventListener) == null || f.call(m, "wheel", this.handleWheel), typeof globalThis.window < "u" && (globalThis.window.removeEventListener("blur", this.handleWindowBlur), this.usingWindowResizeFallback && globalThis.window.removeEventListener("resize", this.handleViewportResize)), (g = this.viewportResizeObserver) == null || g.disconnect(), this.pointerStart = null, this.cadPointerPosition = null, this.setCadHoveredInsert(null), this.setCanvasCursor(""), this.highlightedObjectValue && this.runtime.removeOverlay(Je), this.runtime.removeOverlay(xe), this.runtime.removeOverlay(we), this.cadInspectorUnsubscribe(), this.cadDocumentUnsubscribe(), this.assetChangeUnsubscribe(), this.highlightedObjectValue = null, this.selectedObjectValue = null;
|
|
10194
|
+
for (const b of this.mountedObjects)
|
|
10195
|
+
this.runtime.removeObject(b, { dispose: !1 });
|
|
10152
10196
|
this.mountedObjects.clear();
|
|
10153
|
-
for (const
|
|
10154
|
-
this.runtime.removeObject(
|
|
10197
|
+
for (const b of this.mountedAssetObjects)
|
|
10198
|
+
this.runtime.removeObject(b, { dispose: !1 });
|
|
10155
10199
|
this.mountedAssetObjects.clear(), this.cadCapability.dispose(), this.layoutEngine.dispose(), this.listeners.clear(), this.runtime.dispose();
|
|
10156
10200
|
}
|
|
10157
10201
|
}
|
|
@@ -10236,7 +10280,7 @@ class ol {
|
|
|
10236
10280
|
return e.cadCapability.getVisibilityRevision();
|
|
10237
10281
|
},
|
|
10238
10282
|
get viewportDemandCoalesceMs() {
|
|
10239
|
-
return e.options.viewportDemandCoalesceMs ??
|
|
10283
|
+
return e.options.viewportDemandCoalesceMs ?? al;
|
|
10240
10284
|
},
|
|
10241
10285
|
mountCadObject(t) {
|
|
10242
10286
|
e.unmountCadObject(), e.runtime.addObject(t, { owned: !0 }), e.cadRenderRoot = t;
|
|
@@ -10251,7 +10295,7 @@ class ol {
|
|
|
10251
10295
|
e.emit("content-change", { source: "cad" });
|
|
10252
10296
|
},
|
|
10253
10297
|
emitCameraChange(t = e.pendingCameraReason) {
|
|
10254
|
-
e.lastCameraFingerprint =
|
|
10298
|
+
e.lastCameraFingerprint = St(e.runtime.captureCameraSnapshot()), e.emit("camera-change", {
|
|
10255
10299
|
viewMode: e.runtime.viewMode,
|
|
10256
10300
|
reason: t,
|
|
10257
10301
|
interaction: e.interaction
|
|
@@ -10299,12 +10343,12 @@ class ol {
|
|
|
10299
10343
|
e.details.bbox.minY,
|
|
10300
10344
|
e.details.bbox.maxX,
|
|
10301
10345
|
e.details.bbox.maxY
|
|
10302
|
-
].every(Number.isFinite) ? e.details.bbox : null, i = t ? new
|
|
10303
|
-
new
|
|
10304
|
-
new
|
|
10305
|
-
) : e.textDetails ? new
|
|
10306
|
-
new
|
|
10307
|
-
new
|
|
10346
|
+
].every(Number.isFinite) ? e.details.bbox : null, i = t ? new Q(
|
|
10347
|
+
new R(t.minX, t.minY, -0.01),
|
|
10348
|
+
new R(t.maxX, t.maxY, 0.01)
|
|
10349
|
+
) : e.textDetails ? new Q(
|
|
10350
|
+
new R(e.textDetails.x, e.textDetails.y, -0.01),
|
|
10351
|
+
new R(
|
|
10308
10352
|
e.textDetails.x + e.textDetails.content.length * e.textDetails.height * 0.6,
|
|
10309
10353
|
e.textDetails.y + e.textDetails.height,
|
|
10310
10354
|
0.01
|
|
@@ -10338,11 +10382,11 @@ class ol {
|
|
|
10338
10382
|
edgeOpacity: (s == null ? void 0 : s.edgeOpacity) ?? n.edgeOpacity
|
|
10339
10383
|
}, o = new on();
|
|
10340
10384
|
o.name = t === "hover" ? "cad-insert-hover" : "cad-insert-selected", o.renderOrder = t === "hover" ? 1300 : 1310;
|
|
10341
|
-
const l = e.getSize(new
|
|
10385
|
+
const l = e.getSize(new R()), d = e.getCenter(new R()), c = new Gn(Math.max(l.x, 1e-6), Math.max(l.y, 1e-6), Math.max(l.z, 1e-3));
|
|
10342
10386
|
if (a.fillOpacity > 0) {
|
|
10343
10387
|
const f = new ae(
|
|
10344
10388
|
c.clone(),
|
|
10345
|
-
new
|
|
10389
|
+
new Ot({
|
|
10346
10390
|
color: a.color,
|
|
10347
10391
|
transparent: !0,
|
|
10348
10392
|
opacity: a.fillOpacity,
|
|
@@ -10366,9 +10410,9 @@ class ol {
|
|
|
10366
10410
|
}
|
|
10367
10411
|
cadInsertDetailsToBox(e) {
|
|
10368
10412
|
const t = e == null ? void 0 : e.bbox;
|
|
10369
|
-
return !t || ![t.minX, t.minY, t.maxX, t.maxY].every(Number.isFinite) ? null : new
|
|
10370
|
-
new
|
|
10371
|
-
new
|
|
10413
|
+
return !t || ![t.minX, t.minY, t.maxX, t.maxY].every(Number.isFinite) ? null : new Q(
|
|
10414
|
+
new R(t.minX, t.minY, -0.01),
|
|
10415
|
+
new R(t.maxX, t.maxY, 0.01)
|
|
10372
10416
|
);
|
|
10373
10417
|
}
|
|
10374
10418
|
isSameCadInsertSelection(e, t) {
|
|
@@ -10458,12 +10502,12 @@ class ol {
|
|
|
10458
10502
|
}
|
|
10459
10503
|
this.runtime.setClearColor(e.clearColor ?? this.options.clearColor ?? Yi), this.runtime.setNavigationPolicy(
|
|
10460
10504
|
e.interactionMode === "object" || e.interactionMode === "simulation" ? "preview" : "viewer"
|
|
10461
|
-
), e.preferredViewMode && e.preferredViewMode !== this.runtime.viewMode && this.setViewMode(e.preferredViewMode, { preserveOrbit: !0 }), this.interactionMode = e.interactionMode === "cad-managed" ? this.options.cadInteraction ?? "managed" : e.interactionMode === "object" || e.interactionMode === "simulation" ? "disabled" : this.options.cadInteraction ?? "managed", this.layoutEngine.setActiveGroups(
|
|
10505
|
+
), 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(ul(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();
|
|
10462
10506
|
}
|
|
10463
10507
|
resolveMixedBounds() {
|
|
10464
10508
|
const e = this.assetController.getActiveFitBounds();
|
|
10465
10509
|
if (e) return e;
|
|
10466
|
-
const t = new
|
|
10510
|
+
const t = new Q();
|
|
10467
10511
|
let i = !1;
|
|
10468
10512
|
for (const s of [...this.mountedObjects, ...this.mountedAssetObjects])
|
|
10469
10513
|
s.visible && (t.expandByObject(s), i = !0);
|
|
@@ -10474,12 +10518,12 @@ class ol {
|
|
|
10474
10518
|
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());
|
|
10475
10519
|
}
|
|
10476
10520
|
applyCameraSnapshot(e, t) {
|
|
10477
|
-
if (
|
|
10521
|
+
if (!Vt(e)) return !1;
|
|
10478
10522
|
const i = this.runtime.viewMode;
|
|
10479
10523
|
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;
|
|
10480
10524
|
}
|
|
10481
10525
|
detectCameraChange(e = !1) {
|
|
10482
|
-
const t =
|
|
10526
|
+
const t = St(this.runtime.captureCameraSnapshot());
|
|
10483
10527
|
return !e && t === this.lastCameraFingerprint ? !1 : (this.lastCameraFingerprint = t, this.cadCapability.onCameraChanged(this.pendingCameraReason), !0);
|
|
10484
10528
|
}
|
|
10485
10529
|
emitViewportChange() {
|
|
@@ -10496,7 +10540,7 @@ class ol {
|
|
|
10496
10540
|
shouldRenderCurrentFrame(e) {
|
|
10497
10541
|
if (this.assetController.isActivePreview || this.assetController.isActiveDynamicPlaying || this.interaction !== "active" || this.interactionRenderLastTs === null) return !0;
|
|
10498
10542
|
const t = e - this.interactionRenderLastTs;
|
|
10499
|
-
return t < 0 || t >=
|
|
10543
|
+
return t < 0 || t >= ol;
|
|
10500
10544
|
}
|
|
10501
10545
|
markInteractionActive() {
|
|
10502
10546
|
this.clearInteractionIdleTimer(), this.setInteraction("active");
|
|
@@ -10504,7 +10548,7 @@ class ol {
|
|
|
10504
10548
|
scheduleInteractionIdle() {
|
|
10505
10549
|
this.clearInteractionIdleTimer(), this.interactionIdleTimer = globalThis.setTimeout(() => {
|
|
10506
10550
|
this.interactionIdleTimer = null, this.setInteraction("idle"), this.refreshCadPointerHover();
|
|
10507
|
-
},
|
|
10551
|
+
}, sl);
|
|
10508
10552
|
}
|
|
10509
10553
|
clearInteractionIdleTimer() {
|
|
10510
10554
|
this.interactionIdleTimer !== null && (globalThis.clearTimeout(this.interactionIdleTimer), this.interactionIdleTimer = null);
|
|
@@ -10579,7 +10623,7 @@ class ol {
|
|
|
10579
10623
|
for (const i of this.listeners.get(e) ?? []) i(t);
|
|
10580
10624
|
}
|
|
10581
10625
|
}
|
|
10582
|
-
function
|
|
10626
|
+
function td(r) {
|
|
10583
10627
|
var i;
|
|
10584
10628
|
const e = (i = r.environmentPresets) != null && i.length ? r.environmentPresets[0] : r.environment ?? "room", t = new bs({
|
|
10585
10629
|
canvasArea: r.viewport,
|
|
@@ -10596,10 +10640,10 @@ function ed(r) {
|
|
|
10596
10640
|
transmissionMode: r.transmissionMode,
|
|
10597
10641
|
navigationPolicy: "viewer"
|
|
10598
10642
|
});
|
|
10599
|
-
return
|
|
10643
|
+
return dl(r, t);
|
|
10600
10644
|
}
|
|
10601
|
-
function
|
|
10602
|
-
return e.initialize(), new
|
|
10645
|
+
function dl(r, e) {
|
|
10646
|
+
return e.initialize(), new ll(r, e);
|
|
10603
10647
|
}
|
|
10604
10648
|
function Wi(r) {
|
|
10605
10649
|
if (r === "room") return null;
|
|
@@ -10610,7 +10654,7 @@ function Wi(r) {
|
|
|
10610
10654
|
}
|
|
10611
10655
|
return { type: r.type, url: r.url, name: t };
|
|
10612
10656
|
}
|
|
10613
|
-
function
|
|
10657
|
+
function cl(r) {
|
|
10614
10658
|
const e = r.name.trim().toLowerCase().split(".").pop();
|
|
10615
10659
|
return e === "hdr" ? "hdr" : ["jpg", "jpeg", "png", "webp", "avif"].includes(e ?? "") ? "image" : null;
|
|
10616
10660
|
}
|
|
@@ -10619,17 +10663,17 @@ function Gi(r) {
|
|
|
10619
10663
|
const e = r % 360;
|
|
10620
10664
|
return e < 0 ? e + 360 : e;
|
|
10621
10665
|
}
|
|
10622
|
-
function
|
|
10623
|
-
return r === "cad" ?
|
|
10666
|
+
function ul(r) {
|
|
10667
|
+
return r === "cad" ? hl : r === "model" ? Xi : r === "simulation" ? /* @__PURE__ */ new Set([...Xi, "urdf"]) : pl;
|
|
10624
10668
|
}
|
|
10625
|
-
const
|
|
10626
|
-
function
|
|
10669
|
+
const hl = /* @__PURE__ */ new Set(["cad"]), Xi = /* @__PURE__ */ new Set(["scene"]), pl = /* @__PURE__ */ new Set();
|
|
10670
|
+
function St(r) {
|
|
10627
10671
|
return r ? JSON.stringify(r) : null;
|
|
10628
10672
|
}
|
|
10629
|
-
function
|
|
10673
|
+
function ml(r) {
|
|
10630
10674
|
return !!(r && typeof r == "object" && r.nodeType === 1);
|
|
10631
10675
|
}
|
|
10632
|
-
function
|
|
10676
|
+
function fl(r, e) {
|
|
10633
10677
|
const t = async (s, a) => {
|
|
10634
10678
|
var l;
|
|
10635
10679
|
const o = r.GetPrimAtPath(s);
|
|
@@ -10644,10 +10688,10 @@ function ml(r, e) {
|
|
|
10644
10688
|
if (!o) return [];
|
|
10645
10689
|
try {
|
|
10646
10690
|
return ((d = o.IsValid) == null ? void 0 : d.call(o)) !== !0 ? [] : (((c = o.GetConnections) == null ? void 0 : c.call(o)) ?? []).map((h) => {
|
|
10647
|
-
var f,
|
|
10691
|
+
var f, g;
|
|
10648
10692
|
if (typeof h == "string") return h;
|
|
10649
10693
|
const m = String(((f = h.GetString) == null ? void 0 : f.call(h)) ?? h.path ?? "");
|
|
10650
|
-
return (
|
|
10694
|
+
return (g = h.delete) == null || g.call(h), m;
|
|
10651
10695
|
}).filter(Boolean);
|
|
10652
10696
|
} finally {
|
|
10653
10697
|
(p = o.delete) == null || p.call(o);
|
|
@@ -10762,11 +10806,11 @@ function ml(r, e) {
|
|
|
10762
10806
|
const c = (p = l == null ? void 0 : l.GetAttribute) == null ? void 0 : p.call(l, d);
|
|
10763
10807
|
if (!c) return [d, { valid: !1, authored: !1, value: null }];
|
|
10764
10808
|
try {
|
|
10765
|
-
const
|
|
10809
|
+
const g = ((h = c.IsValid) == null ? void 0 : h.call(c)) === !0;
|
|
10766
10810
|
return [d, {
|
|
10767
|
-
valid:
|
|
10768
|
-
authored:
|
|
10769
|
-
value:
|
|
10811
|
+
valid: g,
|
|
10812
|
+
authored: g && ((m = c.HasAuthoredValue) == null ? void 0 : m.call(c)) === !0,
|
|
10813
|
+
value: g ? c.Get() : null
|
|
10770
10814
|
}];
|
|
10771
10815
|
} finally {
|
|
10772
10816
|
(f = c.delete) == null || f.call(c);
|
|
@@ -10801,26 +10845,26 @@ function ml(r, e) {
|
|
|
10801
10845
|
}
|
|
10802
10846
|
};
|
|
10803
10847
|
}
|
|
10804
|
-
function
|
|
10848
|
+
function id(r) {
|
|
10805
10849
|
const e = r;
|
|
10806
|
-
return e.usdQuery ? e.usdQuery : !r.stage || !r.pxr ? null : e.usdQuery =
|
|
10850
|
+
return e.usdQuery ? e.usdQuery : !r.stage || !r.pxr ? null : e.usdQuery = fl(r.stage, r.pxr);
|
|
10807
10851
|
}
|
|
10808
|
-
const
|
|
10852
|
+
const vl = 1, gl = 5, bl = "6f5df5c5901df72d6c87", yl = {
|
|
10809
10853
|
file: "openusd_probe.js",
|
|
10810
|
-
sha256: "
|
|
10811
|
-
bytes:
|
|
10812
|
-
}, yl = {
|
|
10813
|
-
file: "openusd_probe.wasm",
|
|
10814
|
-
sha256: "a68fdbc8902ccb59e5cc84d24ad79572860806c01eaec5ad130218d0bbc835a9",
|
|
10815
|
-
bytes: 10672319
|
|
10854
|
+
sha256: "f89019f6a03661e6aa6403e8b6b694fa00c92ba1c0c7e09620e25ea8efbe6bc2",
|
|
10855
|
+
bytes: 97833
|
|
10816
10856
|
}, xl = {
|
|
10817
|
-
|
|
10818
|
-
|
|
10819
|
-
|
|
10820
|
-
|
|
10821
|
-
|
|
10822
|
-
|
|
10823
|
-
|
|
10857
|
+
file: "openusd_probe.wasm",
|
|
10858
|
+
sha256: "1170d1ae548f51e5e9d65931df001d8fcd627e8b69b85d9447494c24402893f7",
|
|
10859
|
+
bytes: 10744656
|
|
10860
|
+
}, wl = {
|
|
10861
|
+
schemaVersion: vl,
|
|
10862
|
+
apiVersion: gl,
|
|
10863
|
+
runtimeId: bl,
|
|
10864
|
+
js: yl,
|
|
10865
|
+
wasm: xl
|
|
10866
|
+
}, Ne = Cl(wl);
|
|
10867
|
+
function Cl(r) {
|
|
10824
10868
|
if (!r || typeof r != "object") throw new Error("OpenUSD runtime manifest is missing.");
|
|
10825
10869
|
const e = r;
|
|
10826
10870
|
if (e.schemaVersion !== 1 || !Number.isInteger(e.apiVersion) || Number(e.apiVersion) < 1 || typeof e.runtimeId != "string" || !/^[0-9a-f]{20}$/.test(e.runtimeId))
|
|
@@ -10853,8 +10897,8 @@ function An(r, e = Ne.runtimeId) {
|
|
|
10853
10897
|
throw new Error(`Invalid OpenUSD runtime id: ${e}`);
|
|
10854
10898
|
if (!r)
|
|
10855
10899
|
return {
|
|
10856
|
-
moduleUrl: Ji(
|
|
10857
|
-
wasmUrl: Ji(
|
|
10900
|
+
moduleUrl: Ji(Wt.openUsdModuleUrl, e),
|
|
10901
|
+
wasmUrl: Ji(Wt.openUsdWasmUrl, e),
|
|
10858
10902
|
runtimeId: e,
|
|
10859
10903
|
apiVersion: Ne.apiVersion
|
|
10860
10904
|
};
|
|
@@ -10877,7 +10921,7 @@ async function In(r, e) {
|
|
|
10877
10921
|
});
|
|
10878
10922
|
return WebAssembly.compile(await t.arrayBuffer());
|
|
10879
10923
|
}
|
|
10880
|
-
function
|
|
10924
|
+
function nd(r, e, t) {
|
|
10881
10925
|
return WebAssembly.instantiate(r, e).then(
|
|
10882
10926
|
(i) => t(i, r),
|
|
10883
10927
|
(i) => {
|
|
@@ -10887,25 +10931,25 @@ function id(r, e, t) {
|
|
|
10887
10931
|
}
|
|
10888
10932
|
), {};
|
|
10889
10933
|
}
|
|
10890
|
-
function
|
|
10934
|
+
function rd(r = {}) {
|
|
10891
10935
|
const e = An(
|
|
10892
10936
|
r.openUsdBaseUrl,
|
|
10893
10937
|
r.openUsdRuntimeId
|
|
10894
10938
|
);
|
|
10895
10939
|
return In(e.wasmUrl, r.signal);
|
|
10896
10940
|
}
|
|
10897
|
-
function
|
|
10941
|
+
function El(r) {
|
|
10898
10942
|
return r ? new URL("mujoco.wasm", r).href : sr;
|
|
10899
10943
|
}
|
|
10900
|
-
function
|
|
10901
|
-
return In(
|
|
10944
|
+
function sd(r = {}) {
|
|
10945
|
+
return In(El(r.mujocoBaseUrl), r.signal);
|
|
10902
10946
|
}
|
|
10903
10947
|
let Zi = null;
|
|
10904
|
-
function
|
|
10905
|
-
return Zi ?? (Zi = import("./usd-session-
|
|
10948
|
+
function ad() {
|
|
10949
|
+
return Zi ?? (Zi = import("./usd-session-CNYn-3LD.js").then(() => {
|
|
10906
10950
|
})), Zi;
|
|
10907
10951
|
}
|
|
10908
|
-
function
|
|
10952
|
+
function kl(r) {
|
|
10909
10953
|
return r instanceof Error ? {
|
|
10910
10954
|
name: r.name,
|
|
10911
10955
|
message: r.message,
|
|
@@ -10920,7 +10964,7 @@ function Oe(r) {
|
|
|
10920
10964
|
});
|
|
10921
10965
|
return r.stack && (e.stack = r.stack), e;
|
|
10922
10966
|
}
|
|
10923
|
-
const
|
|
10967
|
+
const Sl = [
|
|
10924
10968
|
1,
|
|
10925
10969
|
0,
|
|
10926
10970
|
0,
|
|
@@ -10938,7 +10982,7 @@ const kl = [
|
|
|
10938
10982
|
0,
|
|
10939
10983
|
1
|
|
10940
10984
|
];
|
|
10941
|
-
function
|
|
10985
|
+
function Pl(r) {
|
|
10942
10986
|
const e = new Map(r.map((s) => [s.path, s])), t = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set(), n = (s) => {
|
|
10943
10987
|
const a = t.get(s.path);
|
|
10944
10988
|
if (a) return a;
|
|
@@ -10951,7 +10995,7 @@ function Sl(r) {
|
|
|
10951
10995
|
if (!s.resetsXformStack || !s.parentPath) return s;
|
|
10952
10996
|
const a = e.get(s.parentPath);
|
|
10953
10997
|
if (!a) return s;
|
|
10954
|
-
const o = n(a), l =
|
|
10998
|
+
const o = n(a), l = Rl(o);
|
|
10955
10999
|
return l ? {
|
|
10956
11000
|
...s,
|
|
10957
11001
|
localMatrix: en(n(s), l)
|
|
@@ -10959,9 +11003,9 @@ function Sl(r) {
|
|
|
10959
11003
|
});
|
|
10960
11004
|
}
|
|
10961
11005
|
function Qi(r) {
|
|
10962
|
-
return
|
|
11006
|
+
return Ml(r) ? r : Sl;
|
|
10963
11007
|
}
|
|
10964
|
-
function
|
|
11008
|
+
function Ml(r) {
|
|
10965
11009
|
return (r == null ? void 0 : r.length) === 16 && r.every(Number.isFinite);
|
|
10966
11010
|
}
|
|
10967
11011
|
function en(r, e) {
|
|
@@ -10975,7 +11019,7 @@ function en(r, e) {
|
|
|
10975
11019
|
}
|
|
10976
11020
|
return t;
|
|
10977
11021
|
}
|
|
10978
|
-
function
|
|
11022
|
+
function Rl(r) {
|
|
10979
11023
|
const [
|
|
10980
11024
|
e,
|
|
10981
11025
|
t,
|
|
@@ -10992,7 +11036,7 @@ function Ml(r) {
|
|
|
10992
11036
|
c,
|
|
10993
11037
|
p,
|
|
10994
11038
|
h
|
|
10995
|
-
] = r, m = s * d - a * l, f = i * l - t * d,
|
|
11039
|
+
] = r, m = s * d - a * l, f = i * l - t * d, g = t * a - i * s, b = e * m + n * f + o * g, x = Math.max(
|
|
10996
11040
|
Math.abs(e * s * d),
|
|
10997
11041
|
Math.abs(e * a * l),
|
|
10998
11042
|
Math.abs(t * n * d),
|
|
@@ -11001,39 +11045,39 @@ function Ml(r) {
|
|
|
11001
11045
|
Math.abs(i * s * o),
|
|
11002
11046
|
1
|
|
11003
11047
|
);
|
|
11004
|
-
if (!Number.isFinite(
|
|
11048
|
+
if (!Number.isFinite(b) || Math.abs(b) <= Number.EPSILON * x * 16)
|
|
11005
11049
|
return null;
|
|
11006
|
-
const
|
|
11050
|
+
const v = 1 / b, w = m * v, y = f * v, C = g * v, k = (a * o - n * d) * v, E = (e * d - i * o) * v, P = (i * n - e * a) * v, D = (n * l - s * o) * v, T = (t * o - e * l) * v, M = (e * s - t * n) * v;
|
|
11007
11051
|
return [
|
|
11008
11052
|
w,
|
|
11009
|
-
|
|
11053
|
+
y,
|
|
11010
11054
|
C,
|
|
11011
11055
|
0,
|
|
11012
11056
|
k,
|
|
11013
11057
|
E,
|
|
11014
11058
|
P,
|
|
11015
11059
|
0,
|
|
11016
|
-
I,
|
|
11017
11060
|
D,
|
|
11018
|
-
|
|
11061
|
+
T,
|
|
11062
|
+
M,
|
|
11019
11063
|
0,
|
|
11020
|
-
-(c * w + p * k + h *
|
|
11021
|
-
-(c *
|
|
11022
|
-
-(c * C + p * P + h *
|
|
11064
|
+
-(c * w + p * k + h * D),
|
|
11065
|
+
-(c * y + p * E + h * T),
|
|
11066
|
+
-(c * C + p * P + h * M),
|
|
11023
11067
|
1
|
|
11024
11068
|
];
|
|
11025
11069
|
}
|
|
11026
|
-
function
|
|
11070
|
+
function od(r, e = []) {
|
|
11027
11071
|
return {
|
|
11028
11072
|
stage: r.stage,
|
|
11029
11073
|
view: {
|
|
11030
11074
|
...r.view,
|
|
11031
|
-
prims:
|
|
11075
|
+
prims: Pl(r.view.prims)
|
|
11032
11076
|
},
|
|
11033
11077
|
elements: r.elements,
|
|
11034
11078
|
materials: r.materials,
|
|
11035
11079
|
materialAliases: r.materialAliases,
|
|
11036
|
-
physics:
|
|
11080
|
+
physics: Il(),
|
|
11037
11081
|
joints: [],
|
|
11038
11082
|
cameras: [],
|
|
11039
11083
|
lights: [],
|
|
@@ -11042,10 +11086,10 @@ function ad(r, e = []) {
|
|
|
11042
11086
|
variants: e
|
|
11043
11087
|
};
|
|
11044
11088
|
}
|
|
11045
|
-
function
|
|
11089
|
+
function Al(r, e) {
|
|
11046
11090
|
r.physics = e.physics, r.joints = e.joints;
|
|
11047
11091
|
}
|
|
11048
|
-
function
|
|
11092
|
+
function ld(r) {
|
|
11049
11093
|
const e = r.materialSubsets;
|
|
11050
11094
|
if (!Array.isArray(e))
|
|
11051
11095
|
throw new Error(`USD probe omitted material subset hints for ${r.path}.`);
|
|
@@ -11056,7 +11100,7 @@ function od(r) {
|
|
|
11056
11100
|
}
|
|
11057
11101
|
return e;
|
|
11058
11102
|
}
|
|
11059
|
-
function
|
|
11103
|
+
function dd(r) {
|
|
11060
11104
|
const e = r;
|
|
11061
11105
|
if (!Object.hasOwn(e, "surface"))
|
|
11062
11106
|
throw new Error(`USD probe omitted surface metadata for ${r.path}.`);
|
|
@@ -11065,7 +11109,7 @@ function ld(r) {
|
|
|
11065
11109
|
throw new Error(`USD probe returned invalid surface metadata for ${r.path}.`);
|
|
11066
11110
|
return e.surface;
|
|
11067
11111
|
}
|
|
11068
|
-
function
|
|
11112
|
+
function cd(r) {
|
|
11069
11113
|
const e = r;
|
|
11070
11114
|
if (!Object.hasOwn(e, "surfaceTerminals")) return null;
|
|
11071
11115
|
if (!Array.isArray(e.surfaceTerminals))
|
|
@@ -11086,13 +11130,13 @@ function dd(r) {
|
|
|
11086
11130
|
}
|
|
11087
11131
|
return Object.freeze(t);
|
|
11088
11132
|
}
|
|
11089
|
-
function
|
|
11133
|
+
function ud(r) {
|
|
11090
11134
|
const e = r;
|
|
11091
11135
|
if (typeof e.doubleSidedAuthored != "boolean")
|
|
11092
11136
|
throw new Error(`USD probe omitted authored double-sided metadata for ${r.path}.`);
|
|
11093
11137
|
return e.doubleSidedAuthored;
|
|
11094
11138
|
}
|
|
11095
|
-
function
|
|
11139
|
+
function hd(r) {
|
|
11096
11140
|
const e = r;
|
|
11097
11141
|
if (e.uvTopology === null) return null;
|
|
11098
11142
|
if (!e.uvTopology || typeof e.uvTopology != "object")
|
|
@@ -11106,13 +11150,13 @@ function ud(r) {
|
|
|
11106
11150
|
indexed: t.indexed
|
|
11107
11151
|
};
|
|
11108
11152
|
}
|
|
11109
|
-
function
|
|
11153
|
+
function pd(r) {
|
|
11110
11154
|
const e = r;
|
|
11111
11155
|
if (typeof e.purpose != "string" || !e.purpose)
|
|
11112
11156
|
throw new Error(`USD probe omitted visual purpose metadata for ${e.path}.`);
|
|
11113
11157
|
return e.purpose;
|
|
11114
11158
|
}
|
|
11115
|
-
function
|
|
11159
|
+
function Il() {
|
|
11116
11160
|
return {
|
|
11117
11161
|
scenes: [],
|
|
11118
11162
|
rigidBodies: [],
|
|
@@ -11128,7 +11172,7 @@ function Ln(r, e) {
|
|
|
11128
11172
|
function Dn() {
|
|
11129
11173
|
return new Worker(new URL(
|
|
11130
11174
|
/* @vite-ignore */
|
|
11131
|
-
"" + new URL("assets/usd-worker-
|
|
11175
|
+
"" + new URL("assets/usd-worker-drur-7bI.js", import.meta.url).href,
|
|
11132
11176
|
import.meta.url
|
|
11133
11177
|
), {
|
|
11134
11178
|
type: "module",
|
|
@@ -11148,7 +11192,7 @@ function Tn(r, e, t) {
|
|
|
11148
11192
|
}, r.postMessage({ type: "prepare", runtime: e, warmup: t });
|
|
11149
11193
|
});
|
|
11150
11194
|
}
|
|
11151
|
-
async function
|
|
11195
|
+
async function Ll(r, e) {
|
|
11152
11196
|
if (typeof Worker > "u") return;
|
|
11153
11197
|
const t = An(r, e);
|
|
11154
11198
|
if (te && Ln(te.runtime, t)) {
|
|
@@ -11161,152 +11205,152 @@ async function Il(r, e) {
|
|
|
11161
11205
|
te === s && (te = null);
|
|
11162
11206
|
}), await n;
|
|
11163
11207
|
}
|
|
11164
|
-
function
|
|
11208
|
+
function Dl(r) {
|
|
11165
11209
|
const e = te;
|
|
11166
11210
|
return e ? (te = null, Ln(e.runtime, r) ? e : (e.worker.terminate(), null)) : null;
|
|
11167
11211
|
}
|
|
11168
|
-
async function
|
|
11169
|
-
var
|
|
11212
|
+
async function md(r, e, t) {
|
|
11213
|
+
var _, H, O, G, S;
|
|
11170
11214
|
if (typeof Worker > "u") throw new Error("Web Worker is unavailable");
|
|
11171
|
-
const i =
|
|
11172
|
-
let d = 0, c = 1, p = !1, h = !1, m = !1, f = !1,
|
|
11215
|
+
const i = Dl(r), n = (i == null ? void 0 : i.worker) ?? Dn(), s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), l = [];
|
|
11216
|
+
let d = 0, c = 1, p = !1, h = !1, m = !1, f = !1, g = null, b = /* @__PURE__ */ new Map(), x = () => {
|
|
11173
11217
|
};
|
|
11174
|
-
const
|
|
11175
|
-
|
|
11218
|
+
const v = (i == null ? void 0 : i.ready) ?? Tn(n, r, !1), w = new Promise((A, j) => {
|
|
11219
|
+
x = j, v.then(A, j);
|
|
11176
11220
|
});
|
|
11177
11221
|
w.catch(() => {
|
|
11178
11222
|
});
|
|
11179
|
-
let
|
|
11223
|
+
let y = () => {
|
|
11180
11224
|
}, C = () => {
|
|
11181
11225
|
};
|
|
11182
|
-
const k = new Promise((
|
|
11183
|
-
|
|
11226
|
+
const k = new Promise((A, j) => {
|
|
11227
|
+
y = A, C = j;
|
|
11184
11228
|
});
|
|
11185
11229
|
k.catch(() => {
|
|
11186
11230
|
});
|
|
11187
|
-
const E = (
|
|
11188
|
-
n.postMessage(
|
|
11189
|
-
}, P = (
|
|
11231
|
+
const E = (A, j = []) => {
|
|
11232
|
+
n.postMessage(A, j);
|
|
11233
|
+
}, P = (A, j) => {
|
|
11190
11234
|
if (p) return Promise.reject(new Error("USD worker disposed"));
|
|
11191
11235
|
const de = c++;
|
|
11192
11236
|
return new Promise((fe, ce) => {
|
|
11193
11237
|
s.set(de, {
|
|
11194
11238
|
resolve: (oe) => fe(oe),
|
|
11195
11239
|
reject: ce
|
|
11196
|
-
}), E({ type: "decode-texture", id: de, url:
|
|
11240
|
+
}), E({ type: "decode-texture", id: de, url: A, maxDimension: j });
|
|
11197
11241
|
});
|
|
11198
|
-
},
|
|
11242
|
+
}, D = () => {
|
|
11199
11243
|
for (; !p && d < 4 && l.length > 0; ) {
|
|
11200
|
-
const
|
|
11201
|
-
d += 1, P(
|
|
11202
|
-
d -= 1,
|
|
11244
|
+
const A = l.shift();
|
|
11245
|
+
d += 1, P(A.url, A.maxDimension).then(A.resolve, A.reject).finally(() => {
|
|
11246
|
+
d -= 1, D();
|
|
11203
11247
|
});
|
|
11204
11248
|
}
|
|
11205
|
-
},
|
|
11249
|
+
}, T = () => {
|
|
11206
11250
|
if (!p) {
|
|
11207
11251
|
p = !0;
|
|
11208
|
-
for (const
|
|
11209
|
-
|
|
11210
|
-
for (const
|
|
11252
|
+
for (const A of l.splice(0))
|
|
11253
|
+
A.reject(new Error("USD worker disposed"));
|
|
11254
|
+
for (const A of o) A.close();
|
|
11211
11255
|
o.clear(), a.clear();
|
|
11212
|
-
for (const
|
|
11213
|
-
s.clear(),
|
|
11256
|
+
for (const A of s.values()) A.reject(new Error("USD worker disposed"));
|
|
11257
|
+
s.clear(), x(new Error("USD worker disposed")), m || (m = !0, C(new Error("USD worker disposed"))), n.terminate();
|
|
11214
11258
|
}
|
|
11215
|
-
},
|
|
11216
|
-
|
|
11259
|
+
}, M = () => {
|
|
11260
|
+
T(), V(Ze());
|
|
11217
11261
|
};
|
|
11218
|
-
let
|
|
11262
|
+
let V = () => {
|
|
11219
11263
|
};
|
|
11220
|
-
if ((
|
|
11221
|
-
throw
|
|
11222
|
-
(
|
|
11264
|
+
if ((_ = t.signal) != null && _.aborted)
|
|
11265
|
+
throw T(), Ze();
|
|
11266
|
+
(H = t.signal) == null || H.addEventListener("abort", M, { once: !0 });
|
|
11223
11267
|
try {
|
|
11224
11268
|
const {
|
|
11225
|
-
signal:
|
|
11226
|
-
resolveBytes:
|
|
11269
|
+
signal: A,
|
|
11270
|
+
resolveBytes: j,
|
|
11227
11271
|
onReferenceSkipped: de,
|
|
11228
11272
|
onResourceFailed: fe,
|
|
11229
11273
|
...ce
|
|
11230
11274
|
} = t, oe = await e;
|
|
11231
11275
|
if (await w, p) throw new Error("USD worker disposed");
|
|
11232
|
-
if ((
|
|
11276
|
+
if ((O = t.signal) != null && O.aborted) throw Ze();
|
|
11233
11277
|
const ve = new Promise((N, z) => {
|
|
11234
|
-
|
|
11235
|
-
const
|
|
11236
|
-
z(
|
|
11237
|
-
for (const
|
|
11238
|
-
s.clear(),
|
|
11278
|
+
V = z, n.onerror = (ee) => {
|
|
11279
|
+
const I = new Error(ee.message || "USD worker failed");
|
|
11280
|
+
z(I);
|
|
11281
|
+
for (const X of s.values()) X.reject(I);
|
|
11282
|
+
s.clear(), T();
|
|
11239
11283
|
}, n.onmessage = async (ee) => {
|
|
11240
|
-
var
|
|
11241
|
-
const
|
|
11242
|
-
switch (
|
|
11284
|
+
var X, ue;
|
|
11285
|
+
const I = ee.data;
|
|
11286
|
+
switch (I.type) {
|
|
11243
11287
|
case "visual-ready":
|
|
11244
11288
|
if (h) return;
|
|
11245
|
-
h = !0,
|
|
11289
|
+
h = !0, g = I.data, b = new Map(I.textureURLs ?? []), N(g);
|
|
11246
11290
|
return;
|
|
11247
11291
|
case "physics-ready": {
|
|
11248
|
-
if (!
|
|
11249
|
-
m = !0,
|
|
11292
|
+
if (!g || m) return;
|
|
11293
|
+
m = !0, Al(g, I.phase), y(I.phase);
|
|
11250
11294
|
return;
|
|
11251
11295
|
}
|
|
11252
11296
|
case "physics-failed":
|
|
11253
11297
|
if (m) return;
|
|
11254
|
-
m = !0, C(Oe(
|
|
11298
|
+
m = !0, C(Oe(I.error));
|
|
11255
11299
|
return;
|
|
11256
11300
|
case "resource-request": {
|
|
11257
11301
|
try {
|
|
11258
|
-
const F = await t.resolveBytes(new URL(
|
|
11302
|
+
const F = await t.resolveBytes(new URL(I.url), I.identifier), he = { type: "resource-result", id: I.id, bytes: F };
|
|
11259
11303
|
n.postMessage(he, [F.buffer]);
|
|
11260
11304
|
} catch (F) {
|
|
11261
11305
|
const he = {
|
|
11262
11306
|
type: "resource-result",
|
|
11263
|
-
id:
|
|
11264
|
-
error:
|
|
11307
|
+
id: I.id,
|
|
11308
|
+
error: kl(F)
|
|
11265
11309
|
};
|
|
11266
11310
|
n.postMessage(he);
|
|
11267
11311
|
}
|
|
11268
11312
|
return;
|
|
11269
11313
|
}
|
|
11270
11314
|
case "event":
|
|
11271
|
-
|
|
11315
|
+
I.event === "reference-skipped" ? (X = t.onReferenceSkipped) == null || X.call(t, I.identifier) : (ue = t.onResourceFailed) == null || ue.call(t, I.identifier, Oe(I.error));
|
|
11272
11316
|
return;
|
|
11273
11317
|
case "query-result": {
|
|
11274
|
-
const F = s.get(
|
|
11275
|
-
s.delete(
|
|
11318
|
+
const F = s.get(I.id);
|
|
11319
|
+
s.delete(I.id), F == null || F.resolve(I.value);
|
|
11276
11320
|
return;
|
|
11277
11321
|
}
|
|
11278
11322
|
case "texture-decoded": {
|
|
11279
|
-
const F = s.get(
|
|
11280
|
-
s.delete(
|
|
11323
|
+
const F = s.get(I.id);
|
|
11324
|
+
s.delete(I.id), F == null || F.resolve(I.bitmap);
|
|
11281
11325
|
return;
|
|
11282
11326
|
}
|
|
11283
11327
|
case "error":
|
|
11284
|
-
if (
|
|
11285
|
-
const F = s.get(
|
|
11286
|
-
s.delete(
|
|
11328
|
+
if (I.id !== void 0) {
|
|
11329
|
+
const F = s.get(I.id);
|
|
11330
|
+
s.delete(I.id), F == null || F.reject(Oe(I.error));
|
|
11287
11331
|
} else {
|
|
11288
|
-
const F = Oe(
|
|
11289
|
-
z(F),
|
|
11332
|
+
const F = Oe(I.error);
|
|
11333
|
+
z(F), T();
|
|
11290
11334
|
}
|
|
11291
11335
|
}
|
|
11292
11336
|
};
|
|
11293
11337
|
});
|
|
11294
11338
|
E({ type: "load", input: oe, options: ce }, [oe.buffer]);
|
|
11295
11339
|
const Ue = await ve;
|
|
11296
|
-
if ((
|
|
11297
|
-
const
|
|
11340
|
+
if ((G = t.signal) != null && G.aborted) throw Ze();
|
|
11341
|
+
const J = async (N, z) => {
|
|
11298
11342
|
if (p) return Promise.reject(new Error("USD worker disposed"));
|
|
11299
11343
|
const ee = c++;
|
|
11300
11344
|
try {
|
|
11301
|
-
return await new Promise((
|
|
11302
|
-
s.set(ee, { resolve: (ue) =>
|
|
11345
|
+
return await new Promise((I, X) => {
|
|
11346
|
+
s.set(ee, { resolve: (ue) => I(ue), reject: X }), E({ type: "query", id: ee, method: N, args: z });
|
|
11303
11347
|
});
|
|
11304
|
-
} catch (
|
|
11305
|
-
const
|
|
11348
|
+
} catch (I) {
|
|
11349
|
+
const X = I instanceof Error ? I.message : String(I);
|
|
11306
11350
|
throw Object.assign(
|
|
11307
|
-
new Error(`USD stage query ${N}(${z.map(String).join(", ")}) failed: ${
|
|
11351
|
+
new Error(`USD stage query ${N}(${z.map(String).join(", ")}) failed: ${X}`),
|
|
11308
11352
|
{
|
|
11309
|
-
code:
|
|
11353
|
+
code: I && typeof I == "object" && "code" in I ? String(I.code) : "E_USD_QUERY"
|
|
11310
11354
|
}
|
|
11311
11355
|
);
|
|
11312
11356
|
}
|
|
@@ -11314,45 +11358,45 @@ async function pd(r, e, t) {
|
|
|
11314
11358
|
return {
|
|
11315
11359
|
data: Ue,
|
|
11316
11360
|
query: {
|
|
11317
|
-
stageMetadata: (N) =>
|
|
11318
|
-
primInfo: (N) =>
|
|
11319
|
-
primChildren: (N) =>
|
|
11320
|
-
primDescendants: (N, z) =>
|
|
11321
|
-
primAttributes: (N) =>
|
|
11322
|
-
primMetadata: (N, z) =>
|
|
11323
|
-
relationshipTargets: (N, z) =>
|
|
11324
|
-
attributeValue: (N, z) =>
|
|
11325
|
-
attributeValues: (N) =>
|
|
11326
|
-
attributeMetadata: (N, z, ee) =>
|
|
11327
|
-
attributeConnections: (N, z) =>
|
|
11328
|
-
boundMaterial: (N) =>
|
|
11361
|
+
stageMetadata: (N) => J("stageMetadata", [N]),
|
|
11362
|
+
primInfo: (N) => J("primInfo", [N]),
|
|
11363
|
+
primChildren: (N) => J("primChildren", [N]),
|
|
11364
|
+
primDescendants: (N, z) => J("primDescendants", [N, z ?? ""]),
|
|
11365
|
+
primAttributes: (N) => J("primAttributes", [N]),
|
|
11366
|
+
primMetadata: (N, z) => J("primMetadata", [N, z]),
|
|
11367
|
+
relationshipTargets: (N, z) => J("relationshipTargets", [N, z]),
|
|
11368
|
+
attributeValue: (N, z) => J("attributeValue", [N, z]),
|
|
11369
|
+
attributeValues: (N) => J("attributeValues", [N]),
|
|
11370
|
+
attributeMetadata: (N, z, ee) => J("attributeMetadata", [N, z, ee]),
|
|
11371
|
+
attributeConnections: (N, z) => J("attributeConnections", [N, z]),
|
|
11372
|
+
boundMaterial: (N) => J("boundMaterial", [N])
|
|
11329
11373
|
},
|
|
11330
|
-
textureURLs:
|
|
11374
|
+
textureURLs: b,
|
|
11331
11375
|
decodeTexture(N, z, ee) {
|
|
11332
11376
|
if (p) return Promise.reject(new Error("USD worker disposed"));
|
|
11333
|
-
const
|
|
11377
|
+
const I = ee ? Tl(ee) : N, X = `${z}:${I}`, ue = a.get(X);
|
|
11334
11378
|
if (ue) return ue;
|
|
11335
11379
|
const F = new Promise((he, On) => {
|
|
11336
|
-
l.push({ url: N, maxDimension: z, resolve: he, reject: On }),
|
|
11380
|
+
l.push({ url: N, maxDimension: z, resolve: he, reject: On }), D();
|
|
11337
11381
|
});
|
|
11338
|
-
return a.set(
|
|
11382
|
+
return a.set(X, F), F.then((he) => {
|
|
11339
11383
|
o.add(he);
|
|
11340
11384
|
}, () => {
|
|
11341
|
-
a.get(
|
|
11385
|
+
a.get(X) === F && a.delete(X);
|
|
11342
11386
|
}), F;
|
|
11343
11387
|
},
|
|
11344
11388
|
startPhysics() {
|
|
11345
11389
|
return f || (f = !0, p ? (m = !0, C(new Error("USD worker disposed"))) : E({ type: "extract-physics" })), k;
|
|
11346
11390
|
},
|
|
11347
|
-
dispose:
|
|
11391
|
+
dispose: T
|
|
11348
11392
|
};
|
|
11349
|
-
} catch (
|
|
11350
|
-
throw
|
|
11393
|
+
} catch (A) {
|
|
11394
|
+
throw T(), A;
|
|
11351
11395
|
} finally {
|
|
11352
|
-
(
|
|
11396
|
+
(S = t.signal) == null || S.removeEventListener("abort", M);
|
|
11353
11397
|
}
|
|
11354
11398
|
}
|
|
11355
|
-
function
|
|
11399
|
+
function Tl(r) {
|
|
11356
11400
|
if (/^https?:/i.test(r)) return r;
|
|
11357
11401
|
const e = [];
|
|
11358
11402
|
for (const t of r.replaceAll("\\", "/").split("/"))
|
|
@@ -11362,10 +11406,10 @@ function Dl(r) {
|
|
|
11362
11406
|
function Ze() {
|
|
11363
11407
|
return Object.assign(new Error("USD load aborted."), { name: "AbortError", code: "E_ABORTED" });
|
|
11364
11408
|
}
|
|
11365
|
-
function
|
|
11366
|
-
return
|
|
11409
|
+
function fd(r, e) {
|
|
11410
|
+
return Ll(r, e);
|
|
11367
11411
|
}
|
|
11368
|
-
const
|
|
11412
|
+
const Nl = "E_ASSET_RESOURCE_NOT_FOUND", Ol = "E_ASSET_RESOURCE_INVALID", jl = "E_ASSET_FETCH", Fl = "E_ASSET_EXTERNAL_DENIED", zl = "E_ASSET_AUTH", $l = /* @__PURE__ */ new Set([
|
|
11369
11413
|
"png",
|
|
11370
11414
|
"jpg",
|
|
11371
11415
|
"jpeg",
|
|
@@ -11378,78 +11422,78 @@ const Tl = "E_ASSET_RESOURCE_NOT_FOUND", Nl = "E_ASSET_RESOURCE_INVALID", Ol = "
|
|
|
11378
11422
|
"hdr",
|
|
11379
11423
|
"exr",
|
|
11380
11424
|
"ktx2"
|
|
11381
|
-
]),
|
|
11382
|
-
function
|
|
11425
|
+
]), Vl = /* @__PURE__ */ new Set(["usd", "usda", "usdc", "usdz"]);
|
|
11426
|
+
function Bl(r) {
|
|
11383
11427
|
var t;
|
|
11384
11428
|
return ((t = (r.split(/[?#]/, 1)[0] ?? r).split(".").pop()) == null ? void 0 : t.toLowerCase()) ?? "";
|
|
11385
11429
|
}
|
|
11386
|
-
function
|
|
11387
|
-
const e =
|
|
11388
|
-
return
|
|
11430
|
+
function vd(r) {
|
|
11431
|
+
const e = Bl(r);
|
|
11432
|
+
return $l.has(e) && !Vl.has(e);
|
|
11389
11433
|
}
|
|
11390
|
-
function
|
|
11434
|
+
function gd(r, e) {
|
|
11391
11435
|
return Object.assign(new Error(r), { code: e });
|
|
11392
11436
|
}
|
|
11393
|
-
function
|
|
11437
|
+
function Ul(r) {
|
|
11394
11438
|
var i;
|
|
11395
11439
|
if (r instanceof Error && r.name === "AbortError") return "aborted";
|
|
11396
11440
|
const e = r == null ? void 0 : r.code;
|
|
11397
|
-
if (e ===
|
|
11398
|
-
if (e ===
|
|
11399
|
-
if (e ===
|
|
11400
|
-
if (e ===
|
|
11441
|
+
if (e === Nl) return "missing";
|
|
11442
|
+
if (e === Ol) return "invalid";
|
|
11443
|
+
if (e === jl) return "unavailable";
|
|
11444
|
+
if (e === zl || e === Fl) return "denied";
|
|
11401
11445
|
const t = (i = /\((\d{3})\)/.exec(r instanceof Error ? r.message : "")) == null ? void 0 : i[1];
|
|
11402
11446
|
return t === "404" || t === "410" ? "missing" : t === "401" || t === "403" ? "denied" : t != null && t.startsWith("5") ? "unavailable" : "unknown";
|
|
11403
11447
|
}
|
|
11404
|
-
function
|
|
11405
|
-
const e =
|
|
11448
|
+
function bd(r) {
|
|
11449
|
+
const e = Ul(r);
|
|
11406
11450
|
return e === "missing" || e === "invalid" || e === "unavailable";
|
|
11407
11451
|
}
|
|
11408
11452
|
function Nn(r, e) {
|
|
11409
11453
|
return r && /\bhtml\b/i.test(r) ? `返回 HTML 页面(${r})` : r && !/^text\//i.test(r) ? null : /^\uFEFF?\s*(?:<!doctype\s+html|<html|<\?xml[^>]*\bhtml)/i.test(e) ? "返回 HTML 兜底页" : null;
|
|
11410
11454
|
}
|
|
11411
|
-
function
|
|
11455
|
+
function yd(r, e) {
|
|
11412
11456
|
return e.byteLength ? Nn(r, new TextDecoder().decode(e.subarray(0, 512))) : "响应内容为空";
|
|
11413
11457
|
}
|
|
11414
|
-
async function
|
|
11458
|
+
async function xd(r) {
|
|
11415
11459
|
return r.size ? Nn(r.type, await r.slice(0, 512).text()) : "响应内容为空";
|
|
11416
11460
|
}
|
|
11417
11461
|
export {
|
|
11418
|
-
|
|
11419
|
-
|
|
11420
|
-
|
|
11462
|
+
Fl as A,
|
|
11463
|
+
sd as B,
|
|
11464
|
+
rd as C,
|
|
11421
11465
|
je as D,
|
|
11422
|
-
|
|
11466
|
+
td as E,
|
|
11423
11467
|
Ba as F,
|
|
11424
|
-
|
|
11425
|
-
|
|
11468
|
+
ad as G,
|
|
11469
|
+
fd as H,
|
|
11426
11470
|
ar as I,
|
|
11427
|
-
|
|
11471
|
+
Ol as U,
|
|
11428
11472
|
Ee as V,
|
|
11429
|
-
|
|
11430
|
-
|
|
11431
|
-
|
|
11432
|
-
|
|
11433
|
-
|
|
11434
|
-
|
|
11435
|
-
|
|
11436
|
-
|
|
11437
|
-
|
|
11438
|
-
|
|
11439
|
-
|
|
11440
|
-
|
|
11441
|
-
|
|
11442
|
-
|
|
11473
|
+
Al as a,
|
|
11474
|
+
nd as b,
|
|
11475
|
+
gd as c,
|
|
11476
|
+
od as d,
|
|
11477
|
+
fl as e,
|
|
11478
|
+
vd as f,
|
|
11479
|
+
bd as g,
|
|
11480
|
+
ud as h,
|
|
11481
|
+
yd as i,
|
|
11482
|
+
cd as j,
|
|
11483
|
+
id as k,
|
|
11484
|
+
ld as l,
|
|
11485
|
+
hd as m,
|
|
11486
|
+
dd as n,
|
|
11443
11487
|
Ne as o,
|
|
11444
|
-
|
|
11488
|
+
Ul as p,
|
|
11445
11489
|
An as q,
|
|
11446
|
-
|
|
11447
|
-
|
|
11448
|
-
|
|
11449
|
-
|
|
11450
|
-
|
|
11451
|
-
|
|
11452
|
-
|
|
11453
|
-
|
|
11454
|
-
|
|
11490
|
+
pd as r,
|
|
11491
|
+
md as s,
|
|
11492
|
+
Ui as t,
|
|
11493
|
+
Nl as u,
|
|
11494
|
+
zl as v,
|
|
11495
|
+
jl as w,
|
|
11496
|
+
xd as x,
|
|
11497
|
+
ed as y,
|
|
11498
|
+
El as z
|
|
11455
11499
|
};
|