@vincentt-xr/sdk 2.0.0-alpha.11 → 2.0.0-alpha.12
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/GROUNDING.md +12 -7
- package/dist/{TextLabel-Dgt-uNN9.js → TextLabel-C6F5xoaz.js} +243 -264
- package/dist/TextLabel-ChZCoB3P.cjs +2 -0
- package/dist/components/ScreenImage/ScreenImage.d.ts +1 -1
- package/dist/components/ScreenShape/index.d.ts +1 -1
- package/dist/debug-ui.cjs +1 -1
- package/dist/debug-ui.js +2 -2
- package/dist/{index-WkEZBuB4.js → index-BaNlidsb.js} +276 -270
- package/dist/index-BzGLgXJm.cjs +46 -0
- package/dist/index-Cm3v6Dlg.cjs +21 -0
- package/dist/{index-CXaj3tOT.js → index-bL819L-K.js} +345 -338
- package/dist/instructions.cjs +1 -1
- package/dist/instructions.js +1 -1
- package/dist/main.cjs +1 -1
- package/dist/main.js +4 -4
- package/dist/scene-object.cjs +1 -1
- package/dist/scene-object.js +1 -1
- package/dist/useEditOverrides-BTkPGVjN.js +38 -0
- package/dist/useEditOverrides-C3ZVXuIH.cjs +1 -0
- package/dist/utils/useEditOverrides.d.ts +9 -2
- package/package.json +1 -1
- package/settings.json +1 -1
- package/dist/TextLabel-Ctp-a7g9.cjs +0 -2
- package/dist/index-Bxb_UcfF.cjs +0 -46
- package/dist/index-CYwAL_d7.cjs +0 -21
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { D as Me } from "./index-DlP4xxaT.js";
|
|
2
|
-
import { useThree as
|
|
3
|
-
import { useRef as
|
|
2
|
+
import { useThree as be, useFrame as Ee } from "@react-three/fiber";
|
|
3
|
+
import { useRef as j, useState as ze, useCallback as N, useEffect as U, useMemo as W, createElement as Oe } from "react";
|
|
4
4
|
import * as ae from "three";
|
|
5
|
-
import { Vector2 as
|
|
5
|
+
import { Vector2 as V, Vector3 as z, Box3 as Pe, Matrix4 as B, Quaternion as X, Euler as H, MathUtils as L, Color as Re } from "three";
|
|
6
6
|
import { K as de, L as C, M as fe, N as De, O as Le, P as Z } from "./index-CTqQJj5p.js";
|
|
7
7
|
import { D as Fe } from "./index-CNt8esFO.js";
|
|
8
|
-
import { u as Ce, D as Ae, n as Ie, h as
|
|
8
|
+
import { u as Ce, D as Ae, n as Ie, h as _e, i as je, j as We } from "./renderPasses-DIPTIU_x.js";
|
|
9
9
|
import { jsxs as R, jsx as u } from "react/jsx-runtime";
|
|
10
10
|
import { Line as Ge } from "@react-three/drei";
|
|
11
11
|
import { u as Ne, S as Ue, a as ke } from "./context-DTxSQvp4.js";
|
|
12
|
+
import { u as Be } from "./useEditOverrides-BTkPGVjN.js";
|
|
12
13
|
const he = {
|
|
13
14
|
move: "grab",
|
|
14
15
|
pivot: "all-scroll",
|
|
@@ -24,7 +25,7 @@ const he = {
|
|
|
24
25
|
bottomRight: "nwse-resize",
|
|
25
26
|
topRight: "nesw-resize",
|
|
26
27
|
bottomLeft: "nesw-resize"
|
|
27
|
-
},
|
|
28
|
+
}, Xe = ({
|
|
28
29
|
color: e = "#22d3ee",
|
|
29
30
|
controlScale: t = [1, 1, 1],
|
|
30
31
|
handleColor: o = "#ffffff",
|
|
@@ -33,8 +34,8 @@ const he = {
|
|
|
33
34
|
pivot: s = [0.5, 0.5],
|
|
34
35
|
pivotScale: a = t,
|
|
35
36
|
renderOrder: i,
|
|
36
|
-
showSideHandles:
|
|
37
|
-
thickness:
|
|
37
|
+
showSideHandles: d = !0,
|
|
38
|
+
thickness: l = 4e-3
|
|
38
39
|
}) => {
|
|
39
40
|
const p = /* @__PURE__ */ u(
|
|
40
41
|
"meshBasicMaterial",
|
|
@@ -56,12 +57,12 @@ const he = {
|
|
|
56
57
|
depthWrite: !1,
|
|
57
58
|
toneMapped: !1
|
|
58
59
|
}
|
|
59
|
-
), w = Math.max(
|
|
60
|
+
), w = Math.max(l * 7, 0.028), b = Math.max(l * 7, 0.03), M = Math.max(l * 8, 0.032), h = 0.04, c = 0.06, T = 0.08, y = 0.1, f = i ?? 0, F = [
|
|
60
61
|
["topLeft", -0.5, 0.5],
|
|
61
62
|
["topRight", 0.5, 0.5],
|
|
62
63
|
["bottomLeft", -0.5, -0.5],
|
|
63
64
|
["bottomRight", 0.5, -0.5],
|
|
64
|
-
...
|
|
65
|
+
...d ? [
|
|
65
66
|
["top", 0, 0.5],
|
|
66
67
|
["bottom", 0, -0.5],
|
|
67
68
|
["left", -0.5, 0],
|
|
@@ -72,7 +73,7 @@ const he = {
|
|
|
72
73
|
["rotateTopRight", 0.56, 0.56, -Math.PI / 2],
|
|
73
74
|
["rotateBottomRight", 0.56, -0.56, Math.PI],
|
|
74
75
|
["rotateBottomLeft", -0.56, -0.56, Math.PI / 2]
|
|
75
|
-
],
|
|
76
|
+
], g = (m) => n ? (P) => {
|
|
76
77
|
P.stopPropagation(), document.body.style.cursor = m === "move" ? "grabbing" : he[m], n(m, P);
|
|
77
78
|
} : void 0, x = (m) => {
|
|
78
79
|
n && (document.body.style.cursor = he[m]);
|
|
@@ -80,19 +81,19 @@ const he = {
|
|
|
80
81
|
n && (document.body.style.cursor = "");
|
|
81
82
|
}, v = [s[0] - 0.5, s[1] - 0.5, y];
|
|
82
83
|
return /* @__PURE__ */ R("group", { renderOrder: f, children: [
|
|
83
|
-
/* @__PURE__ */ R("mesh", { position: [0, 0.5, h], scale: [1,
|
|
84
|
+
/* @__PURE__ */ R("mesh", { position: [0, 0.5, h], scale: [1, l, 1], renderOrder: f, children: [
|
|
84
85
|
/* @__PURE__ */ u("planeGeometry", { args: [1, 1] }),
|
|
85
86
|
p
|
|
86
87
|
] }),
|
|
87
|
-
/* @__PURE__ */ R("mesh", { position: [0, -0.5, h], scale: [1,
|
|
88
|
+
/* @__PURE__ */ R("mesh", { position: [0, -0.5, h], scale: [1, l, 1], renderOrder: f, children: [
|
|
88
89
|
/* @__PURE__ */ u("planeGeometry", { args: [1, 1] }),
|
|
89
90
|
p
|
|
90
91
|
] }),
|
|
91
|
-
/* @__PURE__ */ R("mesh", { position: [-0.5, 0, h], scale: [
|
|
92
|
+
/* @__PURE__ */ R("mesh", { position: [-0.5, 0, h], scale: [l, 1, 1], renderOrder: f, children: [
|
|
92
93
|
/* @__PURE__ */ u("planeGeometry", { args: [1, 1] }),
|
|
93
94
|
p
|
|
94
95
|
] }),
|
|
95
|
-
/* @__PURE__ */ R("mesh", { position: [0.5, 0, h], scale: [
|
|
96
|
+
/* @__PURE__ */ R("mesh", { position: [0.5, 0, h], scale: [l, 1, 1], renderOrder: f, children: [
|
|
96
97
|
/* @__PURE__ */ u("planeGeometry", { args: [1, 1] }),
|
|
97
98
|
p
|
|
98
99
|
] }),
|
|
@@ -101,7 +102,7 @@ const he = {
|
|
|
101
102
|
{
|
|
102
103
|
position: [0, 0, c],
|
|
103
104
|
renderOrder: f + 1,
|
|
104
|
-
onPointerDown:
|
|
105
|
+
onPointerDown: g("move"),
|
|
105
106
|
onPointerOver: () => x("move"),
|
|
106
107
|
onPointerOut: O,
|
|
107
108
|
children: [
|
|
@@ -116,7 +117,7 @@ const he = {
|
|
|
116
117
|
position: [P, A, T],
|
|
117
118
|
scale: [w * t[0], w * t[1], t[2]],
|
|
118
119
|
renderOrder: f + 2,
|
|
119
|
-
onPointerDown:
|
|
120
|
+
onPointerDown: g(m),
|
|
120
121
|
onPointerOver: () => x(m),
|
|
121
122
|
onPointerOut: O,
|
|
122
123
|
children: [
|
|
@@ -133,7 +134,7 @@ const he = {
|
|
|
133
134
|
rotation: [0, 0, $],
|
|
134
135
|
scale: [M * t[0], M * t[1], t[2]],
|
|
135
136
|
renderOrder: f + 3,
|
|
136
|
-
onPointerDown:
|
|
137
|
+
onPointerDown: g(m),
|
|
137
138
|
onPointerOver: () => x(m),
|
|
138
139
|
onPointerOut: O,
|
|
139
140
|
children: /* @__PURE__ */ R("mesh", { renderOrder: f + 3, children: [
|
|
@@ -147,9 +148,9 @@ const he = {
|
|
|
147
148
|
"group",
|
|
148
149
|
{
|
|
149
150
|
position: v,
|
|
150
|
-
scale: [
|
|
151
|
+
scale: [b * a[0], b * a[1], a[2]],
|
|
151
152
|
renderOrder: f + 5,
|
|
152
|
-
onPointerDown:
|
|
153
|
+
onPointerDown: g("pivot"),
|
|
153
154
|
onPointerOver: () => x("pivot"),
|
|
154
155
|
onPointerOut: O,
|
|
155
156
|
children: /* @__PURE__ */ R("group", { rotation: [0, 0, Math.PI / 4], children: [
|
|
@@ -194,7 +195,7 @@ const he = {
|
|
|
194
195
|
bottomRight: "nwse-resize",
|
|
195
196
|
topRight: "nesw-resize",
|
|
196
197
|
bottomLeft: "nesw-resize"
|
|
197
|
-
},
|
|
198
|
+
}, Ye = [
|
|
198
199
|
["topLeft", 0, 0],
|
|
199
200
|
["top", 0.5, 0],
|
|
200
201
|
["topRight", 1, 0],
|
|
@@ -203,29 +204,29 @@ const he = {
|
|
|
203
204
|
["bottom", 0.5, 1],
|
|
204
205
|
["bottomLeft", 0, 1],
|
|
205
206
|
["left", 0, 0.5]
|
|
206
|
-
],
|
|
207
|
+
], He = [
|
|
207
208
|
["rotateTopLeft", -0.03, -0.03],
|
|
208
209
|
["rotateTopRight", 1.03, -0.03],
|
|
209
210
|
["rotateBottomRight", 1.03, 1.03],
|
|
210
211
|
["rotateBottomLeft", -0.03, 1.03]
|
|
211
|
-
],
|
|
212
|
+
], $e = (e, t) => {
|
|
212
213
|
const o = de({
|
|
213
214
|
transform: t,
|
|
214
215
|
parentSize: { width: e.width, height: e.height }
|
|
215
216
|
}), n = Math.min(
|
|
216
217
|
e.width / C.width,
|
|
217
218
|
e.height / C.height
|
|
218
|
-
) * (fe / Math.max(t.referencePixelsPerUnit, 1e-6)) || 1, r = C.width * n, s = C.height * n, a = e.left + (e.width - r) / 2, i = e.top + (e.height - s) / 2,
|
|
219
|
+
) * (fe / Math.max(t.referencePixelsPerUnit, 1e-6)) || 1, r = C.width * n, s = C.height * n, a = e.left + (e.width - r) / 2, i = e.top + (e.height - s) / 2, d = a + r / 2, l = i + s / 2, p = o.size[0], S = o.size[1], w = d + o.center[0], b = l - o.center[1];
|
|
219
220
|
return {
|
|
220
221
|
centerX: w,
|
|
221
|
-
centerY:
|
|
222
|
+
centerY: b,
|
|
222
223
|
height: S,
|
|
223
224
|
left: w - p / 2,
|
|
224
225
|
scale: n,
|
|
225
|
-
top:
|
|
226
|
+
top: b - S / 2,
|
|
226
227
|
width: p
|
|
227
228
|
};
|
|
228
|
-
},
|
|
229
|
+
}, Ve = (e, t, o, n) => {
|
|
229
230
|
const r = C.width * n, s = C.height * n, a = o.left + (o.width - r) / 2, i = o.top + (o.height - s) / 2;
|
|
230
231
|
return {
|
|
231
232
|
x: (e - (a + r / 2)) / n,
|
|
@@ -237,19 +238,19 @@ const he = {
|
|
|
237
238
|
onChange: o,
|
|
238
239
|
transform: n
|
|
239
240
|
}) => {
|
|
240
|
-
const r =
|
|
241
|
+
const r = j(o);
|
|
241
242
|
r.current = o;
|
|
242
|
-
const { gl: s } =
|
|
243
|
+
const { gl: s } = be(), [a, i] = ze(null), d = j(null), l = j(null), p = N(() => {
|
|
243
244
|
i(s.domElement.getBoundingClientRect());
|
|
244
245
|
}, [s.domElement]);
|
|
245
246
|
U(() => (p(), window.addEventListener("resize", p), window.addEventListener("scroll", p, !0), () => {
|
|
246
247
|
window.removeEventListener("resize", p), window.removeEventListener("scroll", p, !0);
|
|
247
248
|
}), [p]);
|
|
248
249
|
const S = W(
|
|
249
|
-
() => a ?
|
|
250
|
+
() => a ? $e(a, n) : null,
|
|
250
251
|
[a, n]
|
|
251
252
|
), w = N((h) => {
|
|
252
|
-
const c =
|
|
253
|
+
const c = d.current, T = r.current;
|
|
253
254
|
if (!c || !T) return;
|
|
254
255
|
const y = (h.clientX - c.startX) / c.scale, f = -(h.clientY - c.startY) / c.scale, F = {
|
|
255
256
|
x: c.startPointerDesign.x + y,
|
|
@@ -266,23 +267,23 @@ const he = {
|
|
|
266
267
|
y: I(c.startTransform.position.y + f)
|
|
267
268
|
};
|
|
268
269
|
else if (c.handle === "pivot") {
|
|
269
|
-
const
|
|
270
|
+
const g = Math.max(
|
|
270
271
|
1,
|
|
271
272
|
c.startTransform.size.width * c.startTransform.scale2D.x
|
|
272
273
|
), x = Math.max(
|
|
273
274
|
1,
|
|
274
275
|
c.startTransform.size.height * c.startTransform.scale2D.y
|
|
275
|
-
), O = ue(c.startTransform.pivot[0] + y /
|
|
276
|
+
), O = ue(c.startTransform.pivot[0] + y / g), v = ue(c.startTransform.pivot[1] + f / x);
|
|
276
277
|
E.pivot = [I(O * 1e3) / 1e3, I(v * 1e3) / 1e3], E.position = {
|
|
277
278
|
x: I(
|
|
278
|
-
c.startTransform.position.x + (E.pivot[0] - c.startTransform.pivot[0]) *
|
|
279
|
+
c.startTransform.position.x + (E.pivot[0] - c.startTransform.pivot[0]) * g
|
|
279
280
|
),
|
|
280
281
|
y: I(
|
|
281
282
|
c.startTransform.position.y + (E.pivot[1] - c.startTransform.pivot[1]) * x
|
|
282
283
|
)
|
|
283
284
|
};
|
|
284
285
|
} else if (c.handle.startsWith("rotate")) {
|
|
285
|
-
const
|
|
286
|
+
const g = Math.atan2(
|
|
286
287
|
c.startPointerDesign.y - c.startTransform.position.y,
|
|
287
288
|
c.startPointerDesign.x - c.startTransform.position.x
|
|
288
289
|
), x = Math.atan2(
|
|
@@ -290,41 +291,41 @@ const he = {
|
|
|
290
291
|
F.x - c.startTransform.position.x
|
|
291
292
|
);
|
|
292
293
|
E.rotation = I(
|
|
293
|
-
c.startTransform.rotation + (x -
|
|
294
|
+
c.startTransform.rotation + (x - g) * 180 / Math.PI
|
|
294
295
|
);
|
|
295
296
|
} else {
|
|
296
|
-
const
|
|
297
|
+
const g = c.handle === "left" || c.handle.endsWith("Left"), x = c.handle === "right" || c.handle.endsWith("Right"), O = c.handle === "top" || c.handle.startsWith("top"), v = c.handle === "bottom" || c.handle.startsWith("bottom"), m = x ? y * 2 : g ? -y * 2 : 0, P = O ? f * 2 : v ? -f * 2 : 0;
|
|
297
298
|
E.size = {
|
|
298
299
|
width: Math.max(1, I(c.startTransform.size.width + m)),
|
|
299
300
|
height: Math.max(1, I(c.startTransform.size.height + P))
|
|
300
301
|
};
|
|
301
302
|
}
|
|
302
303
|
T(E);
|
|
303
|
-
}, []),
|
|
304
|
-
|
|
304
|
+
}, []), b = N(() => {
|
|
305
|
+
d.current = null, document.body.style.cursor = "", window.removeEventListener("pointermove", w), window.removeEventListener("pointerup", b);
|
|
305
306
|
}, [w]);
|
|
306
|
-
U(() =>
|
|
307
|
+
U(() => b, [b]);
|
|
307
308
|
const M = N(
|
|
308
309
|
(h, c) => {
|
|
309
|
-
!a || !S || !o || (c.preventDefault(), document.body.style.cursor = h === "move" ? "grabbing" : ee[h],
|
|
310
|
+
!a || !S || !o || (c.preventDefault(), document.body.style.cursor = h === "move" ? "grabbing" : ee[h], d.current = {
|
|
310
311
|
handle: h,
|
|
311
312
|
startX: c.clientX,
|
|
312
313
|
startY: c.clientY,
|
|
313
|
-
startPointerDesign:
|
|
314
|
+
startPointerDesign: Ve(c.clientX, c.clientY, a, S.scale),
|
|
314
315
|
startTransform: n,
|
|
315
316
|
scale: S.scale
|
|
316
|
-
}, window.addEventListener("pointermove", w), window.addEventListener("pointerup",
|
|
317
|
+
}, window.addEventListener("pointermove", w), window.addEventListener("pointerup", b));
|
|
317
318
|
},
|
|
318
|
-
[a, S, o,
|
|
319
|
+
[a, S, o, b, n, w]
|
|
319
320
|
);
|
|
320
321
|
return U(() => {
|
|
321
322
|
if (typeof document > "u") return;
|
|
322
323
|
const h = document.createElement("div");
|
|
323
|
-
return document.body.appendChild(h),
|
|
324
|
-
h.remove(),
|
|
324
|
+
return document.body.appendChild(h), l.current = h, () => {
|
|
325
|
+
h.remove(), l.current = null;
|
|
325
326
|
};
|
|
326
327
|
}, []), U(() => {
|
|
327
|
-
const h =
|
|
328
|
+
const h = l.current;
|
|
328
329
|
if (!h || (h.replaceChildren(), !S))
|
|
329
330
|
return;
|
|
330
331
|
const c = 12, T = 12, y = document.createElement("div");
|
|
@@ -347,8 +348,8 @@ const he = {
|
|
|
347
348
|
transformOrigin: `${n.pivot[0] * 100}% ${(1 - n.pivot[1]) * 100}%`,
|
|
348
349
|
pointerEvents: o ? "auto" : "none",
|
|
349
350
|
cursor: ee.move
|
|
350
|
-
}), f.addEventListener("pointerdown", (
|
|
351
|
-
const F = (
|
|
351
|
+
}), f.addEventListener("pointerdown", (g) => M("move", g));
|
|
352
|
+
const F = (g, x, O, v, m = "translate(-50%, -50%)") => {
|
|
352
353
|
const P = document.createElement("div");
|
|
353
354
|
return Object.assign(P.style, {
|
|
354
355
|
position: "absolute",
|
|
@@ -356,19 +357,19 @@ const he = {
|
|
|
356
357
|
top: `${O * 100}%`,
|
|
357
358
|
width: `${v}px`,
|
|
358
359
|
height: `${v}px`,
|
|
359
|
-
cursor: ee[
|
|
360
|
+
cursor: ee[g],
|
|
360
361
|
transform: m,
|
|
361
362
|
pointerEvents: "auto"
|
|
362
363
|
}), P.addEventListener("pointerdown", (A) => {
|
|
363
|
-
A.stopPropagation(), M(
|
|
364
|
+
A.stopPropagation(), M(g, A);
|
|
364
365
|
}), P;
|
|
365
366
|
};
|
|
366
|
-
for (const [
|
|
367
|
-
const v = F(
|
|
367
|
+
for (const [g, x, O] of Ye) {
|
|
368
|
+
const v = F(g, x, O, c);
|
|
368
369
|
v.style.background = t, f.appendChild(v);
|
|
369
370
|
}
|
|
370
|
-
for (const [
|
|
371
|
-
f.appendChild(F(
|
|
371
|
+
for (const [g, x, O] of He)
|
|
372
|
+
f.appendChild(F(g, x, O, 26));
|
|
372
373
|
const E = F(
|
|
373
374
|
"pivot",
|
|
374
375
|
n.pivot[0],
|
|
@@ -384,7 +385,7 @@ const he = {
|
|
|
384
385
|
h.replaceChildren();
|
|
385
386
|
};
|
|
386
387
|
}, [e, t, S, o, M, n]), null;
|
|
387
|
-
},
|
|
388
|
+
}, q = {
|
|
388
389
|
// Pinning is opt-in. A serialized scene must never move an object until
|
|
389
390
|
// the author explicitly enables the component and chooses a target.
|
|
390
391
|
enabled: !1,
|
|
@@ -395,49 +396,49 @@ const he = {
|
|
|
395
396
|
offsetSpace: "local",
|
|
396
397
|
offsetPosition: { x: 0, y: 0, z: 0 },
|
|
397
398
|
offsetRotation: { x: 0, y: 0, z: 0 }
|
|
398
|
-
},
|
|
399
|
+
}, Ke = (e, t, o, n) => {
|
|
399
400
|
const r = o.clone().sub(t), s = n.clone().sub(t), a = e.clone().sub(t), i = r.x * s.y - s.x * r.y;
|
|
400
401
|
if (Math.abs(i) < 1e-8) return null;
|
|
401
|
-
const
|
|
402
|
-
return p >= -1e-5 &&
|
|
403
|
-
},
|
|
404
|
-
const n = new
|
|
405
|
-
let
|
|
402
|
+
const d = (a.x * s.y - s.x * a.y) / i, l = (r.x * a.y - a.x * r.y) / i, p = 1 - d - l;
|
|
403
|
+
return p >= -1e-5 && d >= -1e-5 && l >= -1e-5 ? [p, d, l] : null;
|
|
404
|
+
}, Qe = (e, t, o = !1) => {
|
|
405
|
+
const n = new V(t.x, t.y), r = new V(), s = new V(), a = new V(), i = new z(), d = new z(), l = new z(), p = new z(), S = new z(), w = new z();
|
|
406
|
+
let b = null;
|
|
406
407
|
if (e.traverse((h) => {
|
|
407
408
|
var x, O;
|
|
408
|
-
if (
|
|
409
|
+
if (b || !h.isMesh) return;
|
|
409
410
|
const c = h, T = c.geometry, y = (x = T == null ? void 0 : T.attributes) == null ? void 0 : x.position, f = (O = T == null ? void 0 : T.attributes) == null ? void 0 : O.uv;
|
|
410
411
|
if (!y || !f) return;
|
|
411
|
-
const F = T.attributes.normal, E = T.index,
|
|
412
|
+
const F = T.attributes.normal, E = T.index, g = (v) => (E == null ? void 0 : E.getX(v)) ?? v;
|
|
412
413
|
for (let v = 0; v < (E ? E.count : y.count); v += 3) {
|
|
413
|
-
const m = [
|
|
414
|
+
const m = [g(v), g(v + 1), g(v + 2)];
|
|
414
415
|
r.set(f.getX(m[0]), f.getY(m[0])), s.set(f.getX(m[1]), f.getY(m[1])), a.set(f.getX(m[2]), f.getY(m[2]));
|
|
415
|
-
const P =
|
|
416
|
+
const P = Ke(n, r, s, a);
|
|
416
417
|
if (P) {
|
|
417
|
-
i.set(0, 0, 0),
|
|
418
|
-
|
|
419
|
-
}), o || (p.fromBufferAttribute(y, m[0]), S.fromBufferAttribute(y, m[1]), w.fromBufferAttribute(y, m[2]),
|
|
418
|
+
i.set(0, 0, 0), d.set(0, 0, 0), m.forEach((A, $) => {
|
|
419
|
+
l.fromBufferAttribute(y, A), i.addScaledVector(l, P[$]), F && o && d.addScaledVector(l.fromBufferAttribute(F, A), P[$]);
|
|
420
|
+
}), o || (p.fromBufferAttribute(y, m[0]), S.fromBufferAttribute(y, m[1]), w.fromBufferAttribute(y, m[2]), d.copy(S.sub(p).cross(w.sub(p)).normalize())), b = {
|
|
420
421
|
mesh: c,
|
|
421
422
|
localPosition: i.clone(),
|
|
422
|
-
localNormal:
|
|
423
|
+
localNormal: d.clone().normalize()
|
|
423
424
|
};
|
|
424
425
|
break;
|
|
425
426
|
}
|
|
426
427
|
}
|
|
427
|
-
}),
|
|
428
|
+
}), b) return b;
|
|
428
429
|
const M = new Pe().setFromObject(e);
|
|
429
430
|
return {
|
|
430
431
|
mesh: e,
|
|
431
432
|
localPosition: e.worldToLocal(M.getCenter(new z())),
|
|
432
433
|
localNormal: new z(0, 1, 0)
|
|
433
434
|
};
|
|
434
|
-
},
|
|
435
|
+
}, Ze = (e) => ({
|
|
435
436
|
position: e.mesh.localToWorld(e.localPosition.clone()),
|
|
436
437
|
normal: e.localNormal.clone().transformDirection(e.mesh.matrixWorld).normalize()
|
|
437
|
-
}), k = (e, t = 0) => Number.isFinite(e) ? e : t, te = new z(), oe = new z(), me = new B(), ne = new X(), re = new X(),
|
|
438
|
+
}), k = (e, t = 0) => Number.isFinite(e) ? e : t, te = new z(), oe = new z(), me = new B(), ne = new X(), re = new X(), Je = new z(0, 1, 0), et = (e) => {
|
|
438
439
|
e.position.set(0, 0, 0), e.quaternion.identity();
|
|
439
|
-
},
|
|
440
|
-
e.orientation === "positionAndDirection" ? (me.lookAt(o.position, o.position.clone().add(o.normal),
|
|
440
|
+
}, tt = ({ settings: e, source: t, surface: o }) => {
|
|
441
|
+
e.orientation === "positionAndDirection" ? (me.lookAt(o.position, o.position.clone().add(o.normal), Je), ne.setFromRotationMatrix(me)) : ne.identity(), t.quaternion.copy(ne), oe.set(
|
|
441
442
|
k(e.offsetPosition.x),
|
|
442
443
|
k(e.offsetPosition.y),
|
|
443
444
|
k(e.offsetPosition.z)
|
|
@@ -448,9 +449,9 @@ const he = {
|
|
|
448
449
|
k(e.offsetRotation.z) * Math.PI / 180
|
|
449
450
|
)
|
|
450
451
|
), e.offsetSpace === "local" ? t.quaternion.multiply(re) : t.quaternion.premultiply(re);
|
|
451
|
-
},
|
|
452
|
-
const n = De(), r =
|
|
453
|
-
r.current &&
|
|
452
|
+
}, no = ({ target: e, settings: t, children: o }) => {
|
|
453
|
+
const n = De(), r = j(null), s = j(null), a = () => {
|
|
454
|
+
r.current && et(r.current);
|
|
454
455
|
};
|
|
455
456
|
return U(() => {
|
|
456
457
|
s.current = null;
|
|
@@ -462,29 +463,29 @@ const he = {
|
|
|
462
463
|
(!t.enabled || !i) && a();
|
|
463
464
|
return;
|
|
464
465
|
}
|
|
465
|
-
const
|
|
466
|
-
(!s.current || s.current.target !== i || s.current.key !==
|
|
467
|
-
key:
|
|
466
|
+
const d = `${t.uv.x}:${t.uv.y}:${t.vertexNormal ? "vertex" : "face"}`;
|
|
467
|
+
(!s.current || s.current.target !== i || s.current.key !== d) && (s.current = {
|
|
468
|
+
key: d,
|
|
468
469
|
target: i,
|
|
469
|
-
surface:
|
|
470
|
+
surface: Qe(i, t.uv, t.vertexNormal)
|
|
470
471
|
}), i.updateWorldMatrix(!0, !0);
|
|
471
|
-
const
|
|
472
|
-
|
|
472
|
+
const l = Ze(s.current.surface);
|
|
473
|
+
tt({ source: r.current, surface: l, settings: t });
|
|
473
474
|
}), Oe("group", { ref: r }, o);
|
|
474
|
-
},
|
|
475
|
-
function
|
|
475
|
+
}, _ = (e) => Math.round(e * 2) / 2, ye = (e) => Math.min(1, Math.max(0, e));
|
|
476
|
+
function ot(e) {
|
|
476
477
|
return Math.min(
|
|
477
478
|
e.width / C.width,
|
|
478
479
|
e.height / C.height
|
|
479
480
|
) || 1;
|
|
480
481
|
}
|
|
481
|
-
function
|
|
482
|
+
function nt({
|
|
482
483
|
resolved: e,
|
|
483
484
|
transform: t
|
|
484
485
|
}) {
|
|
485
486
|
return e.size[0] / Math.max(Math.abs(t.size.width * t.scale2D.x), 1e-6) || 1;
|
|
486
487
|
}
|
|
487
|
-
function
|
|
488
|
+
function rt({
|
|
488
489
|
parent: e,
|
|
489
490
|
resolved: t,
|
|
490
491
|
transform: o
|
|
@@ -499,7 +500,7 @@ function nt({
|
|
|
499
500
|
1
|
|
500
501
|
];
|
|
501
502
|
}
|
|
502
|
-
function
|
|
503
|
+
function st({
|
|
503
504
|
drag: e,
|
|
504
505
|
clientX: t,
|
|
505
506
|
clientY: o,
|
|
@@ -516,8 +517,8 @@ function rt({
|
|
|
516
517
|
};
|
|
517
518
|
if (e.handle === "move")
|
|
518
519
|
return i.position = {
|
|
519
|
-
x:
|
|
520
|
-
y:
|
|
520
|
+
x: _(e.startTransform.position.x + r),
|
|
521
|
+
y: _(e.startTransform.position.y + s)
|
|
521
522
|
}, i;
|
|
522
523
|
if (e.handle === "pivot") {
|
|
523
524
|
const M = Math.max(
|
|
@@ -527,11 +528,11 @@ function rt({
|
|
|
527
528
|
1,
|
|
528
529
|
e.startTransform.size.height * e.startTransform.scale2D.y
|
|
529
530
|
), c = ye(e.startTransform.pivot[0] + r / M), T = ye(e.startTransform.pivot[1] + s / h);
|
|
530
|
-
return i.pivot = [
|
|
531
|
-
x:
|
|
531
|
+
return i.pivot = [_(c * 1e3) / 1e3, _(T * 1e3) / 1e3], i.position = {
|
|
532
|
+
x: _(
|
|
532
533
|
e.startTransform.position.x + (i.pivot[0] - e.startTransform.pivot[0]) * M
|
|
533
534
|
),
|
|
534
|
-
y:
|
|
535
|
+
y: _(
|
|
535
536
|
e.startTransform.position.y + (i.pivot[1] - e.startTransform.pivot[1]) * h
|
|
536
537
|
)
|
|
537
538
|
}, i;
|
|
@@ -544,34 +545,34 @@ function rt({
|
|
|
544
545
|
a.y - e.startTransform.position.y,
|
|
545
546
|
a.x - e.startTransform.position.x
|
|
546
547
|
);
|
|
547
|
-
return i.rotation =
|
|
548
|
+
return i.rotation = _(
|
|
548
549
|
e.startTransform.rotation + (h - M) * 180 / Math.PI
|
|
549
550
|
), i;
|
|
550
551
|
}
|
|
551
|
-
const
|
|
552
|
+
const d = e.handle === "left" || e.handle.endsWith("Left"), l = e.handle === "right" || e.handle.endsWith("Right"), p = e.handle === "top" || e.handle.startsWith("top"), S = e.handle === "bottom" || e.handle.startsWith("bottom"), w = l ? r * 2 : d ? -r * 2 : 0, b = p ? s * 2 : S ? -s * 2 : 0;
|
|
552
553
|
return i.size = {
|
|
553
|
-
width: Math.max(1,
|
|
554
|
-
height: Math.max(1,
|
|
554
|
+
width: Math.max(1, _(e.startTransform.size.width + w)),
|
|
555
|
+
height: Math.max(1, _(e.startTransform.size.height + b))
|
|
555
556
|
}, i;
|
|
556
557
|
}
|
|
557
|
-
function
|
|
558
|
+
function it({
|
|
558
559
|
transform: e,
|
|
559
560
|
guideLayer: t,
|
|
560
561
|
guideColor: o,
|
|
561
562
|
onChange: n,
|
|
562
563
|
children: r
|
|
563
564
|
}) {
|
|
564
|
-
const s = Ne(), { size: a } =
|
|
565
|
+
const s = Ne(), { size: a } = be(), i = j(n);
|
|
565
566
|
i.current = n;
|
|
566
|
-
const
|
|
567
|
+
const d = j(null), l = W(
|
|
567
568
|
() => de({ transform: e, parentSize: s }),
|
|
568
569
|
[s, e]
|
|
569
|
-
), p =
|
|
570
|
+
), p = ot(a), S = j(p);
|
|
570
571
|
S.current = p;
|
|
571
|
-
const w =
|
|
572
|
-
const y =
|
|
572
|
+
const w = nt({ resolved: l, transform: e }), b = N((T) => {
|
|
573
|
+
const y = d.current, f = i.current;
|
|
573
574
|
!y || !f || f(
|
|
574
|
-
|
|
575
|
+
st({
|
|
575
576
|
drag: y,
|
|
576
577
|
clientX: T.clientX,
|
|
577
578
|
clientY: T.clientY,
|
|
@@ -579,12 +580,12 @@ function st({
|
|
|
579
580
|
})
|
|
580
581
|
);
|
|
581
582
|
}, []), M = N(() => {
|
|
582
|
-
|
|
583
|
-
}, [
|
|
583
|
+
d.current = null, document.body.style.cursor = "", window.removeEventListener("pointermove", b), window.removeEventListener("pointerup", M);
|
|
584
|
+
}, [b]);
|
|
584
585
|
U(() => M, [M]);
|
|
585
586
|
const h = N(
|
|
586
587
|
(T, y) => {
|
|
587
|
-
n && (
|
|
588
|
+
n && (d.current = {
|
|
588
589
|
handle: T,
|
|
589
590
|
startX: y.nativeEvent.clientX,
|
|
590
591
|
startY: y.nativeEvent.clientY,
|
|
@@ -593,35 +594,35 @@ function st({
|
|
|
593
594
|
y: y.point.y / w
|
|
594
595
|
},
|
|
595
596
|
startTransform: e
|
|
596
|
-
}, window.addEventListener("pointermove",
|
|
597
|
+
}, window.addEventListener("pointermove", b), window.addEventListener("pointerup", M));
|
|
597
598
|
},
|
|
598
|
-
[n, M, e, w,
|
|
599
|
+
[n, M, e, w, b]
|
|
599
600
|
), c = W(
|
|
600
|
-
() =>
|
|
601
|
-
[s,
|
|
601
|
+
() => rt({ parent: s, resolved: l, transform: e }),
|
|
602
|
+
[s, l, e]
|
|
602
603
|
);
|
|
603
604
|
return /* @__PURE__ */ u(
|
|
604
605
|
"group",
|
|
605
606
|
{
|
|
606
607
|
position: [
|
|
607
|
-
|
|
608
|
-
|
|
608
|
+
l.center[0] + (e.pivot[0] - 0.5) * l.size[0],
|
|
609
|
+
l.center[1] + (e.pivot[1] - 0.5) * l.size[1],
|
|
609
610
|
0
|
|
610
611
|
],
|
|
611
|
-
rotation:
|
|
612
|
+
rotation: l.rotation,
|
|
612
613
|
children: /* @__PURE__ */ u(
|
|
613
614
|
"group",
|
|
614
615
|
{
|
|
615
616
|
position: [
|
|
616
|
-
(0.5 - e.pivot[0]) *
|
|
617
|
-
(0.5 - e.pivot[1]) *
|
|
617
|
+
(0.5 - e.pivot[0]) * l.size[0],
|
|
618
|
+
(0.5 - e.pivot[1]) * l.size[1],
|
|
618
619
|
0
|
|
619
620
|
],
|
|
620
|
-
scale:
|
|
621
|
-
children: /* @__PURE__ */ R(Ue.Provider, { value:
|
|
621
|
+
scale: l.size,
|
|
622
|
+
children: /* @__PURE__ */ R(Ue.Provider, { value: l.aspect, children: [
|
|
622
623
|
r,
|
|
623
624
|
e.showTransformGuides && t === "scene" ? /* @__PURE__ */ u(
|
|
624
|
-
|
|
625
|
+
Xe,
|
|
625
626
|
{
|
|
626
627
|
color: o,
|
|
627
628
|
controlScale: c,
|
|
@@ -656,13 +657,13 @@ const Y = {
|
|
|
656
657
|
opacity: L.clamp((e == null ? void 0 : e.opacity) ?? Y.opacity, 0, 1),
|
|
657
658
|
frost: L.clamp((e == null ? void 0 : e.frost) ?? Y.frost, 0, 1),
|
|
658
659
|
highlight: L.clamp((e == null ? void 0 : e.highlight) ?? Y.highlight, 0, 1)
|
|
659
|
-
}),
|
|
660
|
+
}), at = `
|
|
660
661
|
varying vec2 vPosition;
|
|
661
662
|
void main() {
|
|
662
663
|
vPosition = position.xy;
|
|
663
664
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
664
665
|
}
|
|
665
|
-
`,
|
|
666
|
+
`, ct = `
|
|
666
667
|
uniform vec3 tint;
|
|
667
668
|
uniform float opacity;
|
|
668
669
|
uniform float frost;
|
|
@@ -676,7 +677,7 @@ const Y = {
|
|
|
676
677
|
vec3 color = mix(frosted, vec3(1.0), sheen * highlight * 0.32);
|
|
677
678
|
gl_FragColor = vec4(color, opacity);
|
|
678
679
|
}
|
|
679
|
-
`,
|
|
680
|
+
`, lt = ({ opacity: e = 1, value: t }) => {
|
|
680
681
|
const o = W(() => {
|
|
681
682
|
const r = Te(t);
|
|
682
683
|
return {
|
|
@@ -690,8 +691,8 @@ const Y = {
|
|
|
690
691
|
"shaderMaterial",
|
|
691
692
|
{
|
|
692
693
|
uniforms: n,
|
|
693
|
-
vertexShader:
|
|
694
|
-
fragmentShader:
|
|
694
|
+
vertexShader: at,
|
|
695
|
+
fragmentShader: ct,
|
|
695
696
|
transparent: !0,
|
|
696
697
|
depthTest: !1,
|
|
697
698
|
depthWrite: !1,
|
|
@@ -701,7 +702,7 @@ const Y = {
|
|
|
701
702
|
}, se = (e, t = 1) => Array.from({ length: e }, (o, n) => {
|
|
702
703
|
const r = n % 2 ? t * 0.5 : 0.5, s = -Math.PI / 2 + n / e * Math.PI * 2;
|
|
703
704
|
return [Math.cos(s) * r, Math.sin(s) * r, 0];
|
|
704
|
-
}),
|
|
705
|
+
}), dt = (e) => {
|
|
705
706
|
switch (e.kind) {
|
|
706
707
|
case "line":
|
|
707
708
|
return [
|
|
@@ -731,8 +732,8 @@ const Y = {
|
|
|
731
732
|
[0.5 - t, -0.5 + t, Math.PI * 1.5]
|
|
732
733
|
].forEach(([r, s, a]) => {
|
|
733
734
|
for (let i = 0; i <= 6; i += 1) {
|
|
734
|
-
const
|
|
735
|
-
o.push([r + Math.cos(
|
|
735
|
+
const d = a + i / 6 * (Math.PI / 2);
|
|
736
|
+
o.push([r + Math.cos(d) * t, s + Math.sin(d) * t, 0]);
|
|
736
737
|
}
|
|
737
738
|
}), o;
|
|
738
739
|
}
|
|
@@ -741,7 +742,7 @@ const Y = {
|
|
|
741
742
|
default:
|
|
742
743
|
return se(64);
|
|
743
744
|
}
|
|
744
|
-
},
|
|
745
|
+
}, ft = (e) => {
|
|
745
746
|
const t = new ae.Shape();
|
|
746
747
|
return e.forEach(([o, n], r) => r ? t.lineTo(o, n) : t.moveTo(o, n)), t.closePath(), t;
|
|
747
748
|
}, K = {
|
|
@@ -760,7 +761,7 @@ const Y = {
|
|
|
760
761
|
dashed: !1,
|
|
761
762
|
lineStart: { x: 0.1, y: 0.5 },
|
|
762
763
|
lineEnd: { x: 0.9, y: 0.5 }
|
|
763
|
-
},
|
|
764
|
+
}, pt = (e) => {
|
|
764
765
|
const t = {
|
|
765
766
|
...K,
|
|
766
767
|
...e,
|
|
@@ -786,18 +787,18 @@ const Y = {
|
|
|
786
787
|
y: L.clamp(o(t.lineEnd.y, 0.5), 0, 1)
|
|
787
788
|
}
|
|
788
789
|
};
|
|
789
|
-
},
|
|
790
|
+
}, ht = ({
|
|
790
791
|
name: e,
|
|
791
792
|
renderOrder: t,
|
|
792
793
|
settings: o,
|
|
793
794
|
visible: n
|
|
794
795
|
}) => {
|
|
795
|
-
const r = ke(), s = W(() =>
|
|
796
|
-
return /* @__PURE__ */ R("group", { name: e, visible: n, scale:
|
|
796
|
+
const r = ke(), s = W(() => dt(o), [o]), a = W(() => ft(s), [s]), d = ["circle", "polygon", "star"].includes(o.kind) ? [Math.min(1, 1 / r), Math.min(1, r), 1] : [1, 1, 1], p = o.kind !== "line" ? [...s, s[0]] : s;
|
|
797
|
+
return /* @__PURE__ */ R("group", { name: e, visible: n, scale: d, children: [
|
|
797
798
|
o.kind !== "line" && o.fillOpacity > 0 ? /* @__PURE__ */ R("mesh", { renderOrder: t, children: [
|
|
798
799
|
/* @__PURE__ */ u("shapeGeometry", { args: [a] }),
|
|
799
|
-
o.fillMode === "glass" ? /* @__PURE__ */ u(
|
|
800
|
-
|
|
800
|
+
o.fillMode === "glass" ? /* @__PURE__ */ u(lt, { value: o.glass, opacity: o.fillOpacity }) : /* @__PURE__ */ u(
|
|
801
|
+
_e,
|
|
801
802
|
{
|
|
802
803
|
settings: {
|
|
803
804
|
source: o.fillMode,
|
|
@@ -825,39 +826,44 @@ const Y = {
|
|
|
825
826
|
}
|
|
826
827
|
) : null
|
|
827
828
|
] });
|
|
828
|
-
},
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
settings
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
829
|
+
}, ut = [
|
|
830
|
+
"transform.position",
|
|
831
|
+
"transform.size",
|
|
832
|
+
"transform.rotation",
|
|
833
|
+
"settings.fillColor"
|
|
834
|
+
], ro = (e) => {
|
|
835
|
+
const {
|
|
836
|
+
name: t,
|
|
837
|
+
onScreenTransformChange: o,
|
|
838
|
+
renderOrder: n,
|
|
839
|
+
settings: r,
|
|
840
|
+
transform: s,
|
|
841
|
+
transformGuideLayer: a = "scene",
|
|
842
|
+
visible: i = !0
|
|
843
|
+
} = Be(e, ut), d = W(() => pt(r), [r]), l = W(
|
|
844
|
+
() => Le(s ?? Z),
|
|
845
|
+
[s]
|
|
840
846
|
);
|
|
841
847
|
return l.enabled ? /* @__PURE__ */ u(
|
|
842
|
-
|
|
848
|
+
it,
|
|
843
849
|
{
|
|
844
850
|
transform: l,
|
|
845
|
-
guideLayer:
|
|
851
|
+
guideLayer: a,
|
|
846
852
|
guideColor: "#38bdf8",
|
|
847
|
-
onChange:
|
|
853
|
+
onChange: o,
|
|
848
854
|
children: /* @__PURE__ */ u(
|
|
849
|
-
|
|
855
|
+
ht,
|
|
850
856
|
{
|
|
851
|
-
name:
|
|
852
|
-
settings:
|
|
853
|
-
visible:
|
|
854
|
-
renderOrder:
|
|
857
|
+
name: t,
|
|
858
|
+
settings: d,
|
|
859
|
+
visible: i && l.visible,
|
|
860
|
+
renderOrder: n ?? l.renderOrder
|
|
855
861
|
}
|
|
856
862
|
)
|
|
857
863
|
}
|
|
858
864
|
) : null;
|
|
859
865
|
};
|
|
860
|
-
function
|
|
866
|
+
function so(e) {
|
|
861
867
|
const { screenSpaceUI: t, screenImage: o } = e, { image: n, transformation: r } = o, s = n.src.trim();
|
|
862
868
|
return {
|
|
863
869
|
shouldRender: t.enabled && o.enabled && r.enabled,
|
|
@@ -918,15 +924,15 @@ const pe = {
|
|
|
918
924
|
transparent: !0,
|
|
919
925
|
alphaTest: 0
|
|
920
926
|
}
|
|
921
|
-
},
|
|
927
|
+
}, io = {
|
|
922
928
|
screenImage: pe,
|
|
923
929
|
screenSpaceUI: {
|
|
924
930
|
enabled: !0
|
|
925
931
|
}
|
|
926
|
-
},
|
|
927
|
-
function
|
|
932
|
+
}, mt = (e) => e * Math.PI / 180;
|
|
933
|
+
function yt(e) {
|
|
928
934
|
if (!e) return;
|
|
929
|
-
const t = e.offset ?? 0, o =
|
|
935
|
+
const t = e.offset ?? 0, o = mt(e.angle ?? -45);
|
|
930
936
|
return {
|
|
931
937
|
color: e.color,
|
|
932
938
|
opacity: e.opacity,
|
|
@@ -935,7 +941,7 @@ function ut(e) {
|
|
|
935
941
|
offsetY: Math.sin(o) * t
|
|
936
942
|
};
|
|
937
943
|
}
|
|
938
|
-
function
|
|
944
|
+
function ao(e) {
|
|
939
945
|
const { screenSpaceUI: t, screenText: o } = e, { content: n, layout: r, style: s, transformation: a } = o, i = s.background;
|
|
940
946
|
return {
|
|
941
947
|
shouldRender: t.enabled && o.enabled && a.enabled,
|
|
@@ -966,7 +972,7 @@ function ro(e) {
|
|
|
966
972
|
strokeLayers: s.strokeLayers,
|
|
967
973
|
shadowEnabled: s.shadowEnabled,
|
|
968
974
|
shadowLayers: s.shadowLayers,
|
|
969
|
-
innerShadow: s.innerShadowEnabled ?
|
|
975
|
+
innerShadow: s.innerShadowEnabled ? yt(s.innerShadow) : void 0,
|
|
970
976
|
glow: s.glowEnabled ? s.glow : void 0,
|
|
971
977
|
bend: s.bendEnabled ? s.bend : void 0,
|
|
972
978
|
bgColor: i.enabled ? i.color : "transparent",
|
|
@@ -993,7 +999,7 @@ function ro(e) {
|
|
|
993
999
|
}
|
|
994
1000
|
};
|
|
995
1001
|
}
|
|
996
|
-
const
|
|
1002
|
+
const St = {
|
|
997
1003
|
color: "#000000",
|
|
998
1004
|
blur: 0,
|
|
999
1005
|
offsetX: 7.071,
|
|
@@ -1002,7 +1008,7 @@ const mt = {
|
|
|
1002
1008
|
offset: 10,
|
|
1003
1009
|
angle: -45,
|
|
1004
1010
|
feather: 0
|
|
1005
|
-
},
|
|
1011
|
+
}, gt = {
|
|
1006
1012
|
screenText: {
|
|
1007
1013
|
enabled: !0,
|
|
1008
1014
|
content: {
|
|
@@ -1077,7 +1083,7 @@ const mt = {
|
|
|
1077
1083
|
textureFlipY: !1
|
|
1078
1084
|
},
|
|
1079
1085
|
strokeLayers: [{ color: "#0f172a", width: 12, opacity: 1 }],
|
|
1080
|
-
shadowLayers: [
|
|
1086
|
+
shadowLayers: [St]
|
|
1081
1087
|
},
|
|
1082
1088
|
screenTransform: {
|
|
1083
1089
|
...Z,
|
|
@@ -1105,17 +1111,17 @@ const mt = {
|
|
|
1105
1111
|
}, xe = (e) => {
|
|
1106
1112
|
const t = typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
|
|
1107
1113
|
return `${e}_${t}`;
|
|
1108
|
-
},
|
|
1114
|
+
}, bt = () => xe("obj"), Tt = () => xe("cmp"), G = (e) => typeof structuredClone == "function" ? structuredClone(e) : JSON.parse(JSON.stringify(e)), xt = () => G(We), vt = () => G(Z), wt = () => G(pe), Mt = () => G(gt.screenText), Et = () => G(K), zt = () => G(Me), Ot = () => G(je), Pt = () => ({
|
|
1109
1115
|
type: "standard",
|
|
1110
1116
|
color: "#ffffff",
|
|
1111
1117
|
opacity: 1,
|
|
1112
1118
|
wireframe: !1,
|
|
1113
1119
|
roughness: 0.42,
|
|
1114
1120
|
metalness: 0.08
|
|
1115
|
-
}),
|
|
1121
|
+
}), Rt = () => ({
|
|
1116
1122
|
flipX: !1,
|
|
1117
1123
|
flipY: !1
|
|
1118
|
-
}),
|
|
1124
|
+
}), Dt = () => ({
|
|
1119
1125
|
enabled: !0,
|
|
1120
1126
|
type: "directional",
|
|
1121
1127
|
color: "#ffffff",
|
|
@@ -1126,35 +1132,35 @@ const mt = {
|
|
|
1126
1132
|
penumbra: 0.2,
|
|
1127
1133
|
decay: 2,
|
|
1128
1134
|
showHelper: !1
|
|
1129
|
-
}),
|
|
1135
|
+
}), Lt = () => ({
|
|
1130
1136
|
enabled: !1,
|
|
1131
1137
|
targetObjectId: null,
|
|
1132
1138
|
mode: "point",
|
|
1133
1139
|
inheritChildren: !1,
|
|
1134
1140
|
offsetRotation: { x: 0, y: 0, z: 0 }
|
|
1135
|
-
}),
|
|
1136
|
-
...
|
|
1137
|
-
uv: { ...
|
|
1138
|
-
offsetPosition: { ...
|
|
1139
|
-
offsetRotation: { ...
|
|
1140
|
-
}),
|
|
1141
|
-
Transform:
|
|
1142
|
-
ScreenTransform:
|
|
1143
|
-
ScreenImage:
|
|
1144
|
-
ScreenText:
|
|
1145
|
-
ScreenShape:
|
|
1146
|
-
MeshRenderer:
|
|
1147
|
-
FaceMeshRenderer:
|
|
1148
|
-
Material:
|
|
1149
|
-
Texture:
|
|
1150
|
-
Light:
|
|
1151
|
-
LookAt:
|
|
1152
|
-
PinToMesh:
|
|
1153
|
-
TrackingAnchor:
|
|
1154
|
-
},
|
|
1141
|
+
}), Ft = () => ({
|
|
1142
|
+
...q,
|
|
1143
|
+
uv: { ...q.uv },
|
|
1144
|
+
offsetPosition: { ...q.offsetPosition },
|
|
1145
|
+
offsetRotation: { ...q.offsetRotation }
|
|
1146
|
+
}), Ct = () => G(Fe), At = {
|
|
1147
|
+
Transform: xt,
|
|
1148
|
+
ScreenTransform: vt,
|
|
1149
|
+
ScreenImage: wt,
|
|
1150
|
+
ScreenText: Mt,
|
|
1151
|
+
ScreenShape: Et,
|
|
1152
|
+
MeshRenderer: zt,
|
|
1153
|
+
FaceMeshRenderer: Ot,
|
|
1154
|
+
Material: Pt,
|
|
1155
|
+
Texture: Rt,
|
|
1156
|
+
Light: Dt,
|
|
1157
|
+
LookAt: Lt,
|
|
1158
|
+
PinToMesh: Ft,
|
|
1159
|
+
TrackingAnchor: Ct
|
|
1160
|
+
}, co = ({
|
|
1155
1161
|
componentIds: e = [],
|
|
1156
1162
|
enabled: t = !0,
|
|
1157
|
-
id: o =
|
|
1163
|
+
id: o = bt(),
|
|
1158
1164
|
parentObjectId: n = null,
|
|
1159
1165
|
childObjectIds: r = [],
|
|
1160
1166
|
renderGroupId: s,
|
|
@@ -1169,25 +1175,25 @@ const mt = {
|
|
|
1169
1175
|
layerId: a,
|
|
1170
1176
|
renderGroupId: s ?? a,
|
|
1171
1177
|
componentIds: e
|
|
1172
|
-
}),
|
|
1173
|
-
id:
|
|
1178
|
+
}), lo = (e, t) => ({
|
|
1179
|
+
id: Tt(),
|
|
1174
1180
|
objectId: t,
|
|
1175
1181
|
type: e,
|
|
1176
1182
|
enabled: !0,
|
|
1177
|
-
settings:
|
|
1183
|
+
settings: At[e]()
|
|
1178
1184
|
}), J = (e, t) => {
|
|
1179
1185
|
const o = e.objects[t];
|
|
1180
1186
|
return o ? o.componentIds.map((n) => e.components[n]).filter((n) => !!n) : [];
|
|
1181
|
-
},
|
|
1187
|
+
}, fo = () => {
|
|
1182
1188
|
let e = null, t = null, o = null, n = [];
|
|
1183
1189
|
return (r, s) => {
|
|
1184
1190
|
const a = r.objects[s];
|
|
1185
1191
|
if (!a)
|
|
1186
1192
|
return e = r, t = s, o = null, n = [], n;
|
|
1187
1193
|
const i = a.componentIds;
|
|
1188
|
-
return e === r && t === s && o === i && n.length === i.length && n.every((
|
|
1194
|
+
return e === r && t === s && o === i && n.length === i.length && n.every((l) => r.components[l.id] === l) || (e = r, t = s, o = i, n = J(r, s)), n;
|
|
1189
1195
|
};
|
|
1190
|
-
},
|
|
1196
|
+
}, po = (e, t) => {
|
|
1191
1197
|
const o = e.objects[t.objectId];
|
|
1192
1198
|
return o ? {
|
|
1193
1199
|
...e,
|
|
@@ -1203,7 +1209,7 @@ const mt = {
|
|
|
1203
1209
|
[t.id]: t
|
|
1204
1210
|
}
|
|
1205
1211
|
} : e;
|
|
1206
|
-
},
|
|
1212
|
+
}, ho = (e, t, o, n) => {
|
|
1207
1213
|
const r = e.objects[t];
|
|
1208
1214
|
if (!r || r.componentIds.indexOf(o) < 0) return e;
|
|
1209
1215
|
const a = r.componentIds.filter((i) => i !== o);
|
|
@@ -1214,7 +1220,7 @@ const mt = {
|
|
|
1214
1220
|
[t]: { ...r, componentIds: a }
|
|
1215
1221
|
}
|
|
1216
1222
|
};
|
|
1217
|
-
},
|
|
1223
|
+
}, uo = (e, t, o) => {
|
|
1218
1224
|
const n = e.objects[t];
|
|
1219
1225
|
if (!n) return e;
|
|
1220
1226
|
const r = { ...e.components };
|
|
@@ -1235,16 +1241,16 @@ const mt = {
|
|
|
1235
1241
|
...e.components,
|
|
1236
1242
|
[t.id]: t
|
|
1237
1243
|
}
|
|
1238
|
-
} : e,
|
|
1244
|
+
} : e, It = (e, t) => e.objects[t.id] ? {
|
|
1239
1245
|
...e,
|
|
1240
1246
|
objects: {
|
|
1241
1247
|
...e.objects,
|
|
1242
1248
|
[t.id]: t
|
|
1243
1249
|
}
|
|
1244
|
-
} : e,
|
|
1250
|
+
} : e, _t = (e, t) => {
|
|
1245
1251
|
const o = e.objects[t], n = (o == null ? void 0 : o.childObjectIds) ?? [], r = Object.values(e.objects).filter((a) => a.parentObjectId === t).map((a) => a.id);
|
|
1246
1252
|
return [.../* @__PURE__ */ new Set([...n, ...r])].map((a) => e.objects[a]).filter((a) => !!a);
|
|
1247
|
-
},
|
|
1253
|
+
}, jt = (e, t, o) => {
|
|
1248
1254
|
var s;
|
|
1249
1255
|
let n = o;
|
|
1250
1256
|
const r = /* @__PURE__ */ new Set();
|
|
@@ -1253,17 +1259,17 @@ const mt = {
|
|
|
1253
1259
|
r.add(n), n = ((s = e.objects[n]) == null ? void 0 : s.parentObjectId) ?? null;
|
|
1254
1260
|
}
|
|
1255
1261
|
return !1;
|
|
1256
|
-
},
|
|
1262
|
+
}, ge = (e, t) => {
|
|
1257
1263
|
const o = new Set(J(e, t).map((n) => n.type));
|
|
1258
1264
|
return o.has("Transform") ? "3d" : o.has("ScreenTransform") ? "2d" : null;
|
|
1259
|
-
},
|
|
1265
|
+
}, Wt = (e, t, o, n) => {
|
|
1260
1266
|
const r = e.objects[t];
|
|
1261
1267
|
if (!r || o !== null && !e.objects[o]) return e;
|
|
1262
1268
|
if (o !== null) {
|
|
1263
|
-
const i =
|
|
1264
|
-
if (i &&
|
|
1269
|
+
const i = ge(e, t), d = ge(e, o);
|
|
1270
|
+
if (i && d && i !== d) return e;
|
|
1265
1271
|
}
|
|
1266
|
-
if (
|
|
1272
|
+
if (jt(e, t, o)) return e;
|
|
1267
1273
|
const s = r.parentObjectId ?? null;
|
|
1268
1274
|
if (s === o && o === null) return e;
|
|
1269
1275
|
const a = { ...e.objects };
|
|
@@ -1271,19 +1277,19 @@ const mt = {
|
|
|
1271
1277
|
const i = a[s];
|
|
1272
1278
|
a[s] = {
|
|
1273
1279
|
...i,
|
|
1274
|
-
childObjectIds: (i.childObjectIds ?? []).filter((
|
|
1280
|
+
childObjectIds: (i.childObjectIds ?? []).filter((d) => d !== t)
|
|
1275
1281
|
};
|
|
1276
1282
|
}
|
|
1277
1283
|
if (a[t] = { ...r, parentObjectId: o }, o) {
|
|
1278
|
-
const i = a[o],
|
|
1279
|
-
|
|
1280
|
-
Math.max(0, Math.min(n ??
|
|
1284
|
+
const i = a[o], d = (i.childObjectIds ?? []).filter((l) => l !== t);
|
|
1285
|
+
d.splice(
|
|
1286
|
+
Math.max(0, Math.min(n ?? d.length, d.length)),
|
|
1281
1287
|
0,
|
|
1282
1288
|
t
|
|
1283
|
-
), a[o] = { ...i, childObjectIds:
|
|
1289
|
+
), a[o] = { ...i, childObjectIds: d };
|
|
1284
1290
|
}
|
|
1285
1291
|
return { ...e, objects: a };
|
|
1286
|
-
}, ie = Math.PI / 180, Q = 180 / Math.PI, D = (e) => Number(e.toFixed(4)),
|
|
1292
|
+
}, ie = Math.PI / 180, Q = 180 / Math.PI, D = (e) => Number(e.toFixed(4)), Gt = (e) => (e == null ? void 0 : e.type) === "Transform", ve = (e, t) => J(e, t).find(Gt) ?? null, Nt = (e) => (e == null ? void 0 : e.type) === "ScreenTransform", we = (e, t) => J(e, t).find(Nt) ?? null, Ut = (e) => new B().compose(
|
|
1287
1293
|
new z(e.position.x, e.position.y, e.position.z),
|
|
1288
1294
|
new X().setFromEuler(
|
|
1289
1295
|
new H(
|
|
@@ -1293,13 +1299,13 @@ const mt = {
|
|
|
1293
1299
|
)
|
|
1294
1300
|
),
|
|
1295
1301
|
new z(e.scale.x, e.scale.y, e.scale.z)
|
|
1296
|
-
),
|
|
1302
|
+
), kt = (e, t) => {
|
|
1297
1303
|
const o = ve(e, t);
|
|
1298
|
-
return o ?
|
|
1304
|
+
return o ? Ut(o.settings) : new B();
|
|
1299
1305
|
}, ce = (e, t) => {
|
|
1300
|
-
const o = e.objects[t], n =
|
|
1306
|
+
const o = e.objects[t], n = kt(e, t);
|
|
1301
1307
|
return !(o != null && o.parentObjectId) || !e.objects[o.parentObjectId] ? n : ce(e, o.parentObjectId).multiply(n);
|
|
1302
|
-
},
|
|
1308
|
+
}, Bt = (e) => {
|
|
1303
1309
|
const t = de({
|
|
1304
1310
|
transform: e,
|
|
1305
1311
|
parentSize: C,
|
|
@@ -1312,9 +1318,9 @@ const mt = {
|
|
|
1312
1318
|
);
|
|
1313
1319
|
}, le = (e, t) => {
|
|
1314
1320
|
var s;
|
|
1315
|
-
const o = we(e, t), n = o ?
|
|
1321
|
+
const o = we(e, t), n = o ? Bt(o.settings) : new B(), r = (s = e.objects[t]) == null ? void 0 : s.parentObjectId;
|
|
1316
1322
|
return !r || !e.objects[r] ? n : le(e, r).multiply(n);
|
|
1317
|
-
},
|
|
1323
|
+
}, Xt = (e, t) => {
|
|
1318
1324
|
const o = new z(), n = new X(), r = new z();
|
|
1319
1325
|
e.decompose(o, n, r);
|
|
1320
1326
|
const s = new H().setFromQuaternion(n);
|
|
@@ -1336,48 +1342,48 @@ const mt = {
|
|
|
1336
1342
|
z: D(r.z)
|
|
1337
1343
|
}
|
|
1338
1344
|
};
|
|
1339
|
-
},
|
|
1345
|
+
}, Yt = (e, t) => {
|
|
1340
1346
|
const o = new z(), n = new X(), r = new z();
|
|
1341
1347
|
e.decompose(o, n, r);
|
|
1342
|
-
const s = new H().setFromQuaternion(n), a = fe / t.referencePixelsPerUnit, i = Math.abs(r.x),
|
|
1348
|
+
const s = new H().setFromQuaternion(n), a = fe / t.referencePixelsPerUnit, i = Math.abs(r.x), d = Math.abs(r.y), l = (t.pivot[0] - 0.5) * i, p = (t.pivot[1] - 0.5) * d;
|
|
1343
1349
|
return {
|
|
1344
1350
|
...t,
|
|
1345
1351
|
position: {
|
|
1346
|
-
x: D((o.x +
|
|
1352
|
+
x: D((o.x + l) / a),
|
|
1347
1353
|
y: D((o.y + p) / a)
|
|
1348
1354
|
},
|
|
1349
1355
|
rotation: D(s.z * Q),
|
|
1350
1356
|
scale2D: {
|
|
1351
1357
|
x: D(i / (t.size.width * a)),
|
|
1352
|
-
y: D(
|
|
1358
|
+
y: D(d / (t.size.height * a))
|
|
1353
1359
|
}
|
|
1354
1360
|
};
|
|
1355
|
-
},
|
|
1356
|
-
const r = ve(e, t), s = we(e, t), a = r ? ce(e, t) : s ? le(e, t) : null, i =
|
|
1361
|
+
}, mo = (e, t, o, n) => {
|
|
1362
|
+
const r = ve(e, t), s = we(e, t), a = r ? ce(e, t) : s ? le(e, t) : null, i = Wt(e, t, o, n);
|
|
1357
1363
|
if (i === e || !a) return i;
|
|
1358
|
-
const
|
|
1364
|
+
const l = (o ? r ? ce(i, o) : le(i, o) : new B()).clone().invert().multiply(a);
|
|
1359
1365
|
return s ? Se(i, {
|
|
1360
1366
|
...s,
|
|
1361
|
-
settings:
|
|
1367
|
+
settings: Yt(l, s.settings)
|
|
1362
1368
|
}) : r ? Se(i, {
|
|
1363
1369
|
...r,
|
|
1364
|
-
settings:
|
|
1370
|
+
settings: Xt(l, r.settings)
|
|
1365
1371
|
}) : i;
|
|
1366
|
-
},
|
|
1372
|
+
}, yo = (e, t, o) => {
|
|
1367
1373
|
const n = e.objects[t];
|
|
1368
|
-
return n ?
|
|
1369
|
-
},
|
|
1374
|
+
return n ? It(e, { ...n, enabled: o }) : e;
|
|
1375
|
+
}, So = (e, t) => {
|
|
1370
1376
|
const o = e.objects[t];
|
|
1371
1377
|
if (!o) return e;
|
|
1372
|
-
const n =
|
|
1378
|
+
const n = _t(e, t).map((i) => i.id), r = { ...e.objects };
|
|
1373
1379
|
delete r[t];
|
|
1374
1380
|
const s = Object.fromEntries(
|
|
1375
|
-
Object.entries(r).map(([i,
|
|
1381
|
+
Object.entries(r).map(([i, d]) => [
|
|
1376
1382
|
i,
|
|
1377
|
-
n.includes(i) ||
|
|
1378
|
-
...
|
|
1379
|
-
childObjectIds: (
|
|
1380
|
-
(
|
|
1383
|
+
n.includes(i) || d.parentObjectId === t ? { ...d, parentObjectId: null } : {
|
|
1384
|
+
...d,
|
|
1385
|
+
childObjectIds: (d.childObjectIds ?? []).filter(
|
|
1386
|
+
(l) => l !== t
|
|
1381
1387
|
)
|
|
1382
1388
|
}
|
|
1383
1389
|
])
|
|
@@ -1387,46 +1393,46 @@ const mt = {
|
|
|
1387
1393
|
return { ...e, objects: s, components: a };
|
|
1388
1394
|
};
|
|
1389
1395
|
export {
|
|
1390
|
-
|
|
1396
|
+
yo as A,
|
|
1391
1397
|
Te as B,
|
|
1392
|
-
|
|
1398
|
+
ro as C,
|
|
1393
1399
|
Y as D,
|
|
1394
1400
|
K as E,
|
|
1395
|
-
|
|
1401
|
+
pt as F,
|
|
1396
1402
|
pe as G,
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1403
|
+
io as H,
|
|
1404
|
+
so as I,
|
|
1405
|
+
gt as J,
|
|
1406
|
+
St as K,
|
|
1407
|
+
yt as L,
|
|
1408
|
+
ao as M,
|
|
1409
|
+
it as N,
|
|
1410
|
+
no as P,
|
|
1411
|
+
lt as S,
|
|
1412
|
+
po as a,
|
|
1413
|
+
lo as b,
|
|
1414
|
+
At as c,
|
|
1415
|
+
Ot as d,
|
|
1416
|
+
Pt as e,
|
|
1417
|
+
zt as f,
|
|
1418
|
+
wt as g,
|
|
1419
|
+
Mt as h,
|
|
1420
|
+
Et as i,
|
|
1421
|
+
vt as j,
|
|
1422
|
+
Rt as k,
|
|
1423
|
+
xt as l,
|
|
1424
|
+
Tt as m,
|
|
1419
1425
|
xe as n,
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1426
|
+
co as o,
|
|
1427
|
+
bt as p,
|
|
1428
|
+
fo as q,
|
|
1429
|
+
So as r,
|
|
1424
1430
|
J as s,
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1431
|
+
_t as t,
|
|
1432
|
+
ho as u,
|
|
1433
|
+
uo as v,
|
|
1428
1434
|
Se as w,
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1435
|
+
It as x,
|
|
1436
|
+
Wt as y,
|
|
1437
|
+
mo as z
|
|
1432
1438
|
};
|