exodeui 6.3.43 → 6.3.44
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/dist/index.js +16 -16
- package/dist/index.mjs +827 -825
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -30,7 +30,7 @@ function Ps(g, t, i) {
|
|
|
30
30
|
}
|
|
31
31
|
const Ge = /* @__PURE__ */ new Map();
|
|
32
32
|
function ps(g) {
|
|
33
|
-
var
|
|
33
|
+
var M;
|
|
34
34
|
const {
|
|
35
35
|
text: t,
|
|
36
36
|
fontFamily: i = "Inter",
|
|
@@ -40,15 +40,15 @@ function ps(g) {
|
|
|
40
40
|
lineHeight: n = 1.2,
|
|
41
41
|
width: a = 200,
|
|
42
42
|
letterSpacing: r = 0,
|
|
43
|
-
paragraphSpacing:
|
|
43
|
+
paragraphSpacing: c = 0,
|
|
44
44
|
paragraphIndent: f = 0,
|
|
45
45
|
textCase: h = "none",
|
|
46
46
|
segments: u = [],
|
|
47
|
-
enableSegments:
|
|
47
|
+
enableSegments: l = !1
|
|
48
48
|
} = g;
|
|
49
49
|
let d = String(t || "");
|
|
50
50
|
h === "uppercase" ? d = d.toUpperCase() : h === "lowercase" ? d = d.toLowerCase() : h === "capitalize" && (d = d.replace(/\b\w/g, (k) => k.toUpperCase())), g.hyphenation === !0 && (d = Ts(d));
|
|
51
|
-
const p = `${s} ${e} ${o}px "${i}", sans-serif`, y = `${d}|${p}|${r}|${
|
|
51
|
+
const p = `${s} ${e} ${o}px "${i}", sans-serif`, y = `${d}|${p}|${r}|${c}|${f}|${l}|${JSON.stringify(u)}|hyp:${!!g.hyphenation}|comp:${g.composer}|bal:${!!g.balanceRaggedLines}`;
|
|
52
52
|
let b = Ge.get(y);
|
|
53
53
|
const m = typeof CanvasRenderingContext2D < "u" ? CanvasRenderingContext2D.prototype.measureText : null, v = function(k) {
|
|
54
54
|
if (!m) return { width: 0, fontBoundingBoxAscent: 0, fontBoundingBoxDescent: 0 };
|
|
@@ -60,7 +60,7 @@ function ps(g) {
|
|
|
60
60
|
};
|
|
61
61
|
if (!b) {
|
|
62
62
|
try {
|
|
63
|
-
if (r !== 0 && typeof CanvasRenderingContext2D < "u" && (CanvasRenderingContext2D.prototype.measureText = v),
|
|
63
|
+
if (r !== 0 && typeof CanvasRenderingContext2D < "u" && (CanvasRenderingContext2D.prototype.measureText = v), l && u && u.length > 0) {
|
|
64
64
|
const k = u.map((T) => {
|
|
65
65
|
let R = T.text || "";
|
|
66
66
|
const P = T.textCase || h || "none";
|
|
@@ -135,21 +135,21 @@ function ps(g) {
|
|
|
135
135
|
} finally {
|
|
136
136
|
r !== 0 && m && (CanvasRenderingContext2D.prototype.measureText = m);
|
|
137
137
|
}
|
|
138
|
-
let w = (C == null ? void 0 : C.height) !== void 0 && C.height > 0 ? C.height : (((
|
|
139
|
-
if (
|
|
138
|
+
let w = (C == null ? void 0 : C.height) !== void 0 && C.height > 0 ? C.height : (((M = C == null ? void 0 : C.lines) == null ? void 0 : M.length) || 0) * S * o;
|
|
139
|
+
if (c > 0 && C && C.lines && C.lines.length > 1) {
|
|
140
140
|
let k = 0;
|
|
141
141
|
const T = b.fullText || t;
|
|
142
142
|
for (let R = 0; R < C.lines.length - 1; R++)
|
|
143
143
|
k += C.lines[R].text.length, (T[k] === `
|
|
144
|
-
` || T[k] === "\r") && (w +=
|
|
144
|
+
` || T[k] === "\r") && (w += c, k++, T[k - 1] === "\r" && T[k] === `
|
|
145
145
|
` && k++);
|
|
146
146
|
}
|
|
147
|
-
let
|
|
148
|
-
return g.composer === "every-line" &&
|
|
147
|
+
let I = (C == null ? void 0 : C.lines) || [];
|
|
148
|
+
return g.composer === "every-line" && I.length > 1 && (I = _s(I)), g.balanceRaggedLines === !0 && I.length > 1 && (I = Ps(I)), {
|
|
149
149
|
width: a,
|
|
150
150
|
height: w,
|
|
151
|
-
lineCount:
|
|
152
|
-
lines:
|
|
151
|
+
lineCount: I.length,
|
|
152
|
+
lines: I
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
155
|
function is(g, t, i) {
|
|
@@ -160,15 +160,15 @@ function is(g, t, i) {
|
|
|
160
160
|
}
|
|
161
161
|
const e = o.split(/\s+/).filter(Boolean), s = new Array(e.length).fill(0);
|
|
162
162
|
let n = t - (e.length - 1) * i, a = 0;
|
|
163
|
-
if (e.forEach((r,
|
|
163
|
+
if (e.forEach((r, c) => {
|
|
164
164
|
if (r.endsWith("px")) {
|
|
165
165
|
const f = parseFloat(r);
|
|
166
|
-
s[
|
|
167
|
-
} else r.endsWith("fr") ? a += parseFloat(r) : r === "auto" && (s[
|
|
166
|
+
s[c] = f, n -= f;
|
|
167
|
+
} else r.endsWith("fr") ? a += parseFloat(r) : r === "auto" && (s[c] = 100, n -= 100);
|
|
168
168
|
}), a > 0 && n > 0) {
|
|
169
169
|
const r = n / a;
|
|
170
|
-
e.forEach((
|
|
171
|
-
|
|
170
|
+
e.forEach((c, f) => {
|
|
171
|
+
c.endsWith("fr") && (s[f] = r * parseFloat(c));
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
174
|
return s;
|
|
@@ -183,7 +183,7 @@ function ns(g, t, i) {
|
|
|
183
183
|
}
|
|
184
184
|
function Es(g, t, i) {
|
|
185
185
|
var _, E;
|
|
186
|
-
const o = g.autoLayout, { direction: e, spacing: s, padding: n, align: a, wrap: r } = o,
|
|
186
|
+
const o = g.autoLayout, { direction: e, spacing: s, padding: n, align: a, wrap: r } = o, c = e === "vertical", f = t.map((A) => {
|
|
187
187
|
const W = i(A.id), z = A.geometry;
|
|
188
188
|
let Y = (W == null ? void 0 : W.width) ?? z.width ?? 100, G = (W == null ? void 0 : W.height) ?? z.height ?? 100;
|
|
189
189
|
if (z.type === "Ellipse" || z.type === "Polygon" || z.type === "Star") {
|
|
@@ -210,47 +210,47 @@ function Es(g, t, i) {
|
|
|
210
210
|
return Y *= A.transform.scale_x || 1, G *= A.transform.scale_y || 1, { id: A.id, w: Y, h: G, original: A };
|
|
211
211
|
});
|
|
212
212
|
let h = g.width, u = g.height;
|
|
213
|
-
const
|
|
213
|
+
const l = ((_ = g.layoutProps) == null ? void 0 : _.width) === "hug", d = ((E = g.layoutProps) == null ? void 0 : E.height) === "hug", p = [];
|
|
214
214
|
let y = [], b = 0, m = 0;
|
|
215
215
|
const v = h - n.left - n.right, S = u - n.top - n.bottom;
|
|
216
216
|
f.forEach((A) => {
|
|
217
|
-
r && y.length > 0 && (
|
|
218
|
-
}), y.length > 0 && p.push({ children: y, width: b, height: m }),
|
|
217
|
+
r && y.length > 0 && (c ? m + s + A.h > S : b + s + A.w > v) ? (p.push({ children: y, width: b, height: m }), y = [A], b = A.w, m = A.h) : (y.push(A), c ? (b = Math.max(b, A.w), m += (y.length > 1 ? s : 0) + A.h) : (b += (y.length > 1 ? s : 0) + A.w, m = Math.max(m, A.h)));
|
|
218
|
+
}), y.length > 0 && p.push({ children: y, width: b, height: m }), l && !c && (h = Math.max(...p.map((A) => A.width), 0) + n.left + n.right), d && c && (u = Math.max(...p.map((A) => A.height), 0) + n.top + n.bottom);
|
|
219
219
|
const C = [];
|
|
220
|
-
let w = n.left,
|
|
221
|
-
const
|
|
220
|
+
let w = n.left, I = n.top;
|
|
221
|
+
const M = a.toLowerCase(), k = M === "center" || M.endsWith("-center"), T = M.endsWith("-right"), R = M === "center" || M.startsWith("center-"), P = M.startsWith("bottom-");
|
|
222
222
|
return p.forEach((A) => {
|
|
223
|
-
let W = w, z =
|
|
224
|
-
|
|
223
|
+
let W = w, z = I;
|
|
224
|
+
c ? R ? z = n.top + (u - n.top - n.bottom - A.height) / 2 : P && (z = u - n.bottom - A.height) : k ? W = n.left + (h - n.left - n.right - A.width) / 2 : T && (W = h - n.right - A.width), A.children.forEach((Y) => {
|
|
225
225
|
var F, j;
|
|
226
226
|
let G = W, N = z;
|
|
227
|
-
|
|
227
|
+
c ? k ? G += (A.width - Y.w) / 2 : T && (G += A.width - Y.w) : R ? N += (A.height - Y.h) / 2 : P && (N += A.height - Y.h);
|
|
228
228
|
const J = ((F = Y.original.layoutProps) == null ? void 0 : F.width) === "fill", x = ((j = Y.original.layoutProps) == null ? void 0 : j.height) === "fill";
|
|
229
229
|
C.push({
|
|
230
230
|
id: Y.id,
|
|
231
231
|
x: G + Y.w / 2 - h / 2,
|
|
232
232
|
y: N + Y.h / 2 - u / 2,
|
|
233
|
-
width: J &&
|
|
234
|
-
height: x ?
|
|
235
|
-
}),
|
|
236
|
-
}),
|
|
237
|
-
}), { frameWidth:
|
|
233
|
+
width: J && c ? A.width : void 0,
|
|
234
|
+
height: x ? c ? void 0 : A.height : void 0
|
|
235
|
+
}), c ? z += Y.h + s : W += Y.w + s;
|
|
236
|
+
}), c ? w += A.width + s : I += A.height + s;
|
|
237
|
+
}), { frameWidth: l ? h : void 0, frameHeight: d ? u : void 0, childUpdates: C };
|
|
238
238
|
}
|
|
239
239
|
function As(g, t, i) {
|
|
240
240
|
const o = g.autoLayout;
|
|
241
241
|
if (!o) return { childUpdates: [] };
|
|
242
|
-
const { gridColumns: e, gridRows: s, columnGap: n = 0, rowGap: a = 0, padding: r, align:
|
|
242
|
+
const { gridColumns: e, gridRows: s, columnGap: n = 0, rowGap: a = 0, padding: r, align: c } = o;
|
|
243
243
|
let f = g.width, h = g.height;
|
|
244
|
-
const u = f - r.left - r.right,
|
|
245
|
-
let
|
|
246
|
-
v ?
|
|
244
|
+
const u = f - r.left - r.right, l = h - r.top - r.bottom, d = is(e || "1fr", u, n), p = is(s || "auto", l, a), y = d.length > 0 ? d.reduce((T, R) => T + R, 0) + (d.length - 1) * n : 0, b = p.length > 0 ? p.reduce((T, R) => T + R, 0) + (p.length - 1) * a : 0, m = c.toLowerCase(), v = m === "center" || m.endsWith("-center"), S = m.endsWith("-right"), C = m === "center" || m.startsWith("center-"), w = m.startsWith("bottom-");
|
|
245
|
+
let I = 0, M = 0;
|
|
246
|
+
v ? I = (u - y) / 2 : S && (I = u - y), C ? M = (l - b) / 2 : w && (M = l - b);
|
|
247
247
|
const k = [];
|
|
248
248
|
return t.forEach((T, R) => {
|
|
249
249
|
var j, X;
|
|
250
250
|
const P = R % d.length || 0, _ = Math.floor(R / d.length) || 0;
|
|
251
251
|
_ >= p.length && p.push(100);
|
|
252
252
|
const E = d[P], A = p[_];
|
|
253
|
-
let W = r.left +
|
|
253
|
+
let W = r.left + I + d.slice(0, P).reduce((tt, L) => tt + L + n, 0), z = r.top + M + p.slice(0, _).reduce((tt, L) => tt + L + a, 0);
|
|
254
254
|
const Y = i(T.id), G = T.geometry;
|
|
255
255
|
let N = (Y == null ? void 0 : Y.width) ?? G.width ?? 100, J = (Y == null ? void 0 : Y.height) ?? G.height ?? 100;
|
|
256
256
|
if (G.type === "Ellipse" || G.type === "Polygon" || G.type === "Star") {
|
|
@@ -404,8 +404,8 @@ class xs {
|
|
|
404
404
|
const e = new qt.Vector2(t.anchorA.x, t.anchorA.y), s = new qt.Vector2(t.anchorB.x, t.anchorB.y);
|
|
405
405
|
let n;
|
|
406
406
|
if (t.type === "Distance") {
|
|
407
|
-
const a = t.length ?? 100, r = t.stiffness ?? 100,
|
|
408
|
-
n = qt.JointData.spring(a, r,
|
|
407
|
+
const a = t.length ?? 100, r = t.stiffness ?? 100, c = t.damping ?? 10;
|
|
408
|
+
n = qt.JointData.spring(a, r, c, e, s);
|
|
409
409
|
} else
|
|
410
410
|
n = qt.JointData.revolute(e, s);
|
|
411
411
|
try {
|
|
@@ -433,15 +433,15 @@ const gs = (g) => g, Rs = (g) => g > 0 ? 1 : 0, Ls = (g) => g < 1 ? 0 : 1, os =
|
|
|
433
433
|
const s = (f) => (1 - 3 * i + 3 * g) * f * f * f + (3 * i - 6 * g) * f * f + 3 * g * f, n = (f) => (1 - 3 * o + 3 * t) * f * f * f + (3 * o - 6 * t) * f * f + 3 * t * f, a = (f) => 3 * (1 - 3 * i + 3 * g) * f * f + 2 * (3 * i - 6 * g) * f + 3 * g, r = (f) => {
|
|
434
434
|
let h = f;
|
|
435
435
|
for (let u = 0; u < 8; u++) {
|
|
436
|
-
const
|
|
437
|
-
if (Math.abs(
|
|
436
|
+
const l = s(h) - f;
|
|
437
|
+
if (Math.abs(l) < 1e-6) return h;
|
|
438
438
|
const d = a(h);
|
|
439
439
|
if (Math.abs(d) < 1e-6) break;
|
|
440
|
-
h = h -
|
|
440
|
+
h = h - l / d;
|
|
441
441
|
}
|
|
442
442
|
return h;
|
|
443
|
-
},
|
|
444
|
-
return es.set(e,
|
|
443
|
+
}, c = (f) => f === 0 ? 0 : f === 1 ? 1 : n(r(f));
|
|
444
|
+
return es.set(e, c), c;
|
|
445
445
|
}, cs = (g) => {
|
|
446
446
|
const t = g.match(/cubic-bezier\s*\(\s*([-?\d.]+)\s*,\s*([-?\d.]+)\s*,\s*([-?\d.]+)\s*,\s*([-?\d.]+)\s*\)/);
|
|
447
447
|
if (!t) return null;
|
|
@@ -572,11 +572,11 @@ const gs = (g) => g, Rs = (g) => g > 0 ? 1 : 0, Ls = (g) => g < 1 ? 0 : 1, os =
|
|
|
572
572
|
}
|
|
573
573
|
}, li = (g, t, i, o, e) => {
|
|
574
574
|
if (!g || !t || !i) return g;
|
|
575
|
-
const s = o.scale_x ?? 1, n = o.scale_y ?? 1, a = (r,
|
|
575
|
+
const s = o.scale_x ?? 1, n = o.scale_y ?? 1, a = (r, c, f) => {
|
|
576
576
|
let h = 0, u = 0;
|
|
577
|
-
const
|
|
578
|
-
f.forEach((
|
|
579
|
-
const k = e(
|
|
577
|
+
const l = o.rotation * Math.PI / 180, d = Math.cos(l), p = Math.sin(l), y = r * s * d - c * n * p + o.x, b = r * s * p + c * n * d + o.y;
|
|
578
|
+
f.forEach((M) => {
|
|
579
|
+
const k = e(M.boneId);
|
|
580
580
|
if (!k) return;
|
|
581
581
|
const T = {
|
|
582
582
|
x: k.x,
|
|
@@ -584,17 +584,17 @@ const gs = (g) => g, Rs = (g) => g > 0 ? 1 : 0, Ls = (g) => g < 1 ? 0 : 1, os =
|
|
|
584
584
|
rotation: k.rotation,
|
|
585
585
|
scaleX: k.scale_x ?? 1,
|
|
586
586
|
scaleY: k.scale_y ?? 1
|
|
587
|
-
}, R = i[
|
|
588
|
-
h += z *
|
|
587
|
+
}, R = i[M.boneId] || [1, 0, 0, 1, 0, 0], P = y * R[0] + b * R[2] + R[4], _ = y * R[1] + b * R[3] + R[5], E = T.rotation * Math.PI / 180, A = Math.cos(E), W = Math.sin(E), z = P * T.scaleX * A - _ * T.scaleY * W + T.x, Y = P * T.scaleX * W + _ * T.scaleY * A + T.y;
|
|
588
|
+
h += z * M.amount, u += Y * M.amount;
|
|
589
589
|
});
|
|
590
|
-
const m = [...f].sort((
|
|
590
|
+
const m = [...f].sort((M, k) => k.amount - M.amount);
|
|
591
591
|
if (m.length >= 2 && m[0].amount > 0 && m[1].amount > 0) {
|
|
592
|
-
const
|
|
593
|
-
if (
|
|
594
|
-
const T =
|
|
592
|
+
const M = e(m[0].boneId), k = e(m[1].boneId);
|
|
593
|
+
if (M && k && M.length !== void 0 && k.length !== void 0) {
|
|
594
|
+
const T = M.length * (M.scale_y ?? 1), R = M.rotation * Math.PI / 180, P = M.x - T * Math.sin(R), _ = M.y + T * Math.cos(R), E = k.length * (k.scale_y ?? 1), A = k.rotation * Math.PI / 180, W = k.x - E * Math.sin(A), z = k.y + E * Math.cos(A);
|
|
595
595
|
let Y = null, G = null, N = !1;
|
|
596
596
|
const J = 1;
|
|
597
|
-
if (Math.hypot(
|
|
597
|
+
if (Math.hypot(M.x - k.x, M.y - k.y) < J || Math.hypot(M.x - W, M.y - z) < J ? (Y = M.x, G = M.y) : (Math.hypot(P - k.x, _ - k.y) < J || Math.hypot(P - W, _ - z) < J) && (Y = P, G = _, N = !0), Y !== null && G !== null) {
|
|
598
598
|
const x = i[m[0].boneId] || [1, 0, 0, 1, 0, 0], F = x[0] * x[3] - x[1] * x[2];
|
|
599
599
|
let j = 0, X = 0;
|
|
600
600
|
if (F !== 0) {
|
|
@@ -602,7 +602,7 @@ const gs = (g) => g, Rs = (g) => g > 0 ? 1 : 0, Ls = (g) => g < 1 ? 0 : 1, os =
|
|
|
602
602
|
if (!N)
|
|
603
603
|
j = tt, X = L;
|
|
604
604
|
else {
|
|
605
|
-
const ot = -x[2] / F, yt = x[0] / F, bt = Math.hypot(ot, yt), gt =
|
|
605
|
+
const ot = -x[2] / F, yt = x[0] / F, bt = Math.hypot(ot, yt), gt = M.length * bt;
|
|
606
606
|
j = tt - gt * Math.sin(O), X = L + gt * Math.cos(O);
|
|
607
607
|
}
|
|
608
608
|
const D = Math.hypot(y - j, b - X), q = Math.hypot(h - Y, u - G);
|
|
@@ -614,14 +614,14 @@ const gs = (g) => g, Rs = (g) => g > 0 ? 1 : 0, Ls = (g) => g < 1 ? 0 : 1, os =
|
|
|
614
614
|
}
|
|
615
615
|
}
|
|
616
616
|
}
|
|
617
|
-
const v = o.rotation * Math.PI / 180, S = Math.cos(v), C = Math.sin(v), w = h - o.x,
|
|
617
|
+
const v = o.rotation * Math.PI / 180, S = Math.cos(v), C = Math.sin(v), w = h - o.x, I = u - o.y;
|
|
618
618
|
return {
|
|
619
|
-
x: (w * S +
|
|
620
|
-
y: (-w * C +
|
|
619
|
+
x: (w * S + I * C) / s,
|
|
620
|
+
y: (-w * C + I * S) / n
|
|
621
621
|
};
|
|
622
622
|
};
|
|
623
|
-
return g.map((r,
|
|
624
|
-
const f = t[
|
|
623
|
+
return g.map((r, c) => {
|
|
624
|
+
const f = t[c];
|
|
625
625
|
if (!f || f.length === 0) return { ...r };
|
|
626
626
|
const h = { ...r, ...a(r.x, r.y, f) };
|
|
627
627
|
if (r.in_x !== void 0 && r.in_y !== void 0) {
|
|
@@ -909,9 +909,9 @@ class ci {
|
|
|
909
909
|
}
|
|
910
910
|
svgPathToPoints(t) {
|
|
911
911
|
const i = /([MLHVCSQTAZmlhvcsqtaz])([^MLHVCSQTAZmlhvcsqtaz]*)/g, o = /[-+]?(?:\d*\.\d+|\d+)(?:[eE][-+]?\d+)?/g, e = [];
|
|
912
|
-
let s = !1, n = 0, a = 0, r = 0,
|
|
912
|
+
let s = !1, n = 0, a = 0, r = 0, c = 0, f = 0, h = 0, u;
|
|
913
913
|
for (; (u = i.exec(t)) !== null; ) {
|
|
914
|
-
const
|
|
914
|
+
const l = u[1], d = (u[2].match(o) || []).map(parseFloat), p = l === l.toLowerCase(), y = l.toUpperCase();
|
|
915
915
|
let b = 0;
|
|
916
916
|
const m = (S) => {
|
|
917
917
|
let C = d[b++];
|
|
@@ -944,20 +944,20 @@ class ci {
|
|
|
944
944
|
for (; b < d.length; ) {
|
|
945
945
|
const S = v(), C = v(), w = v();
|
|
946
946
|
if (e.length > 0) {
|
|
947
|
-
const
|
|
948
|
-
|
|
947
|
+
const I = e[e.length - 1];
|
|
948
|
+
I.out_x = S.x, I.out_y = S.y;
|
|
949
949
|
}
|
|
950
|
-
n = w.x, a = w.y, e.push({ x: n, y: a, in_x: C.x, in_y: C.y, out_x: n, out_y: a }), r = C.x,
|
|
950
|
+
n = w.x, a = w.y, e.push({ x: n, y: a, in_x: C.x, in_y: C.y, out_x: n, out_y: a }), r = C.x, c = C.y;
|
|
951
951
|
}
|
|
952
952
|
break;
|
|
953
953
|
case "S":
|
|
954
954
|
for (; b < d.length; ) {
|
|
955
|
-
const S = { x: 2 * n - r, y: 2 * a -
|
|
955
|
+
const S = { x: 2 * n - r, y: 2 * a - c }, C = v(), w = v();
|
|
956
956
|
if (e.length > 0) {
|
|
957
|
-
const
|
|
958
|
-
|
|
957
|
+
const I = e[e.length - 1];
|
|
958
|
+
I.out_x = S.x, I.out_y = S.y;
|
|
959
959
|
}
|
|
960
|
-
n = w.x, a = w.y, e.push({ x: n, y: a, in_x: C.x, in_y: C.y, out_x: n, out_y: a }), r = C.x,
|
|
960
|
+
n = w.x, a = w.y, e.push({ x: n, y: a, in_x: C.x, in_y: C.y, out_x: n, out_y: a }), r = C.x, c = C.y;
|
|
961
961
|
}
|
|
962
962
|
break;
|
|
963
963
|
case "Q":
|
|
@@ -967,17 +967,17 @@ class ci {
|
|
|
967
967
|
const w = e[e.length - 1];
|
|
968
968
|
w.out_x = w.x + 2 / 3 * (S.x - w.x), w.out_y = w.y + 2 / 3 * (S.y - w.y);
|
|
969
969
|
}
|
|
970
|
-
n = C.x, a = C.y, e.push({ x: n, y: a, in_x: n + 2 / 3 * (S.x - n), in_y: a + 2 / 3 * (S.y - a), out_x: n, out_y: a }), r = S.x,
|
|
970
|
+
n = C.x, a = C.y, e.push({ x: n, y: a, in_x: n + 2 / 3 * (S.x - n), in_y: a + 2 / 3 * (S.y - a), out_x: n, out_y: a }), r = S.x, c = S.y;
|
|
971
971
|
}
|
|
972
972
|
break;
|
|
973
973
|
case "T":
|
|
974
974
|
for (; b < d.length; ) {
|
|
975
|
-
const S = { x: 2 * n - r, y: 2 * a -
|
|
975
|
+
const S = { x: 2 * n - r, y: 2 * a - c }, C = v();
|
|
976
976
|
if (e.length > 0) {
|
|
977
977
|
const w = e[e.length - 1];
|
|
978
978
|
w.out_x = w.x + 2 / 3 * (S.x - w.x), w.out_y = w.y + 2 / 3 * (S.y - w.y);
|
|
979
979
|
}
|
|
980
|
-
n = C.x, a = C.y, e.push({ x: n, y: a, in_x: n + 2 / 3 * (S.x - n), in_y: a + 2 / 3 * (S.y - a), out_x: n, out_y: a }), r = S.x,
|
|
980
|
+
n = C.x, a = C.y, e.push({ x: n, y: a, in_x: n + 2 / 3 * (S.x - n), in_y: a + 2 / 3 * (S.y - a), out_x: n, out_y: a }), r = S.x, c = S.y;
|
|
981
981
|
}
|
|
982
982
|
break;
|
|
983
983
|
case "Z":
|
|
@@ -1064,20 +1064,20 @@ class ci {
|
|
|
1064
1064
|
if (!t) return;
|
|
1065
1065
|
let i = this.decompressStrings(t);
|
|
1066
1066
|
const o = [], e = /* @__PURE__ */ new Set(), s = (r) => {
|
|
1067
|
-
r && r.forEach((
|
|
1068
|
-
if (e.has(
|
|
1069
|
-
const f = { ...
|
|
1067
|
+
r && r.forEach((c) => {
|
|
1068
|
+
if (e.has(c.id)) return;
|
|
1069
|
+
const f = { ...c }, h = f.childrenObjects || [];
|
|
1070
1070
|
e.add(f.id), o.push(f), s(h);
|
|
1071
1071
|
});
|
|
1072
1072
|
};
|
|
1073
1073
|
if (s(i.objects || []), o.length > (i.objects || []).length && this.log(`[Engine] Flattened artboard from ${(i.objects || []).length} to ${o.length} objects.`), i.objects = o, this.artboard = i, this.currentTime = 0, this.objectStates.clear(), this.log(`[ExodeUIEngine] Loading artboard: "${(n = this.artboard) == null ? void 0 : n.name}" with ${(a = this.artboard) == null ? void 0 : a.objects.length} objects`), this.artboard && this.artboard.objects) {
|
|
1074
1074
|
const r = /* @__PURE__ */ new Map();
|
|
1075
|
-
this.artboard.objects.forEach((
|
|
1076
|
-
r.set(
|
|
1077
|
-
}), this.artboard.objects.forEach((
|
|
1078
|
-
if (
|
|
1079
|
-
const f = r.get(
|
|
1080
|
-
f && (f.children || (f.children = []), f.children.includes(
|
|
1075
|
+
this.artboard.objects.forEach((c) => {
|
|
1076
|
+
r.set(c.id, c), c.children || (c.children = []);
|
|
1077
|
+
}), this.artboard.objects.forEach((c) => {
|
|
1078
|
+
if (c.parentId) {
|
|
1079
|
+
const f = r.get(c.parentId);
|
|
1080
|
+
f && (f.children || (f.children = []), f.children.includes(c.id) || f.children.push(c.id));
|
|
1081
1081
|
}
|
|
1082
1082
|
});
|
|
1083
1083
|
}
|
|
@@ -1127,8 +1127,8 @@ class ci {
|
|
|
1127
1127
|
reset() {
|
|
1128
1128
|
if (!this.artboard) return;
|
|
1129
1129
|
if (this.objectStates.clear(), this.objectVelocities.clear(), this.currentTime = 0, this.inputs.clear(), this.inputNameMap.clear(), this.layerStates.clear(), this.logicNodeValues.clear(), this.justFiredTriggers.clear(), this.inputs.set("mouseX", 0), this.inputs.set("mouseY", 0), this.inputs.set("scrollX", 0), this.inputs.set("scrollY", 0), this.inputs.set("isMouseDown", !1), this.physicsEngine && (this.physicsEngine.destroy(), this.physicsEngine = null), this._layoutAnimCache.clear(), this._springChainState.clear(), this._emitterPools.clear(), this.artboard.objects.forEach((i) => {
|
|
1130
|
-
var n, a, r,
|
|
1131
|
-
const o = i.width ?? ((n = i.geometry) == null ? void 0 : n.width) ?? 0, e = i.height ?? ((a = i.geometry) == null ? void 0 : a.height) ?? 0, s = i.cornerRadius ?? i.corner_radius ?? ((r = i.geometry) == null ? void 0 : r.corner_radius) ?? ((
|
|
1130
|
+
var n, a, r, c, f, h, u;
|
|
1131
|
+
const o = i.width ?? ((n = i.geometry) == null ? void 0 : n.width) ?? 0, e = i.height ?? ((a = i.geometry) == null ? void 0 : a.height) ?? 0, s = i.cornerRadius ?? i.corner_radius ?? ((r = i.geometry) == null ? void 0 : r.corner_radius) ?? ((c = i.geometry) == null ? void 0 : c.cornerRadius) ?? 0;
|
|
1132
1132
|
this.objectStates.set(i.id, {
|
|
1133
1133
|
...i.transform || {},
|
|
1134
1134
|
x: ((f = i.transform) == null ? void 0 : f.x) ?? i.x ?? 0,
|
|
@@ -1168,14 +1168,14 @@ class ci {
|
|
|
1168
1168
|
if ((s = e.physics) != null && s.enabled && e.type === "Shape") {
|
|
1169
1169
|
const a = this.objectStates.get(e.id);
|
|
1170
1170
|
if (!a) return;
|
|
1171
|
-
const r = e.geometry.width || 100,
|
|
1171
|
+
const r = e.geometry.width || 100, c = e.geometry.height || 100;
|
|
1172
1172
|
this.physicsEngine.createBody({
|
|
1173
1173
|
id: e.id,
|
|
1174
1174
|
type: ((n = e.geometry) == null ? void 0 : n.type) || "Rectangle",
|
|
1175
1175
|
x: a.x,
|
|
1176
1176
|
y: a.y,
|
|
1177
1177
|
width: r,
|
|
1178
|
-
height:
|
|
1178
|
+
height: c,
|
|
1179
1179
|
rotation: a.rotation * (Math.PI / 180),
|
|
1180
1180
|
// Convert deg to rad
|
|
1181
1181
|
isStatic: e.physics.bodyType === "Static",
|
|
@@ -1212,8 +1212,8 @@ class ci {
|
|
|
1212
1212
|
n.forEach((a) => {
|
|
1213
1213
|
const r = this.objectStates.get(a.id);
|
|
1214
1214
|
if (r) {
|
|
1215
|
-
const
|
|
1216
|
-
!t && (
|
|
1215
|
+
const c = Math.abs(r.x - a.x), f = Math.abs(r.y - a.y);
|
|
1216
|
+
!t && (c > 20 || f > 20) ? (r.x += (a.x - r.x) * o, r.y += (a.y - r.y) * o) : (r.x = a.x, r.y = a.y), a.width !== void 0 && (r.width = a.width), a.height !== void 0 && (r.height = a.height);
|
|
1217
1217
|
}
|
|
1218
1218
|
});
|
|
1219
1219
|
};
|
|
@@ -1224,10 +1224,10 @@ class ci {
|
|
|
1224
1224
|
this.artboard.objects.forEach((n) => {
|
|
1225
1225
|
var a;
|
|
1226
1226
|
if (n.type === "Frame" && ((a = n.autoLayout) != null && a.enabled) && n.children && n.children.length > 0) {
|
|
1227
|
-
const r = n.children.map((h) => i.get(h)).filter((h) => !!h),
|
|
1228
|
-
if (!
|
|
1229
|
-
const f = ns(
|
|
1230
|
-
f.frameWidth !== void 0 && (
|
|
1227
|
+
const r = n.children.map((h) => i.get(h)).filter((h) => !!h), c = this.objectStates.get(n.id);
|
|
1228
|
+
if (!c) return;
|
|
1229
|
+
const f = ns(c, r, (h) => this.objectStates.get(h));
|
|
1230
|
+
f.frameWidth !== void 0 && (c.width = f.frameWidth), f.frameHeight !== void 0 && (c.height = f.frameHeight), e(f.childUpdates);
|
|
1231
1231
|
}
|
|
1232
1232
|
});
|
|
1233
1233
|
}
|
|
@@ -1278,21 +1278,21 @@ class ci {
|
|
|
1278
1278
|
const a = this.activeStateMachine.layers.find((r) => r.name === t);
|
|
1279
1279
|
if (a)
|
|
1280
1280
|
for (const r of i) {
|
|
1281
|
-
const
|
|
1282
|
-
if (
|
|
1283
|
-
if (
|
|
1284
|
-
e.push({ animation: null, state:
|
|
1281
|
+
const c = a.states.find((f) => f.id === r);
|
|
1282
|
+
if (c)
|
|
1283
|
+
if (c.isBlendState && c.blendAnimations && c.blendAnimations.length > 0)
|
|
1284
|
+
e.push({ animation: null, state: c }), c.blendAnimations.forEach((f) => {
|
|
1285
1285
|
const h = this.artboard.animations.find((u) => u.id === f.animationId);
|
|
1286
1286
|
h && (s = Math.max(s, h.duration));
|
|
1287
1287
|
});
|
|
1288
1288
|
else {
|
|
1289
1289
|
let f = null;
|
|
1290
|
-
|
|
1290
|
+
c.animationId && (f = this.artboard.animations.find((h) => h.id === c.animationId) || null), f || (f = this.artboard.animations.find(
|
|
1291
1291
|
(h) => {
|
|
1292
|
-
var u,
|
|
1293
|
-
return h.name ===
|
|
1292
|
+
var u, l;
|
|
1293
|
+
return h.name === c.name || h.id === c.name || (c.name === "Entry" || c.id === "entry") && (((u = h.name) == null ? void 0 : u.toLowerCase()) === "onload" || ((l = h.name) == null ? void 0 : l.toLowerCase()) === "intro");
|
|
1294
1294
|
}
|
|
1295
|
-
) || null), f && ((n = this.artboard.animationFlow) != null && n.some((u) => (u.trigger === "on_load" || u.trigger === "after_delay") && u.targetAnimationId === (f == null ? void 0 : f.id)) || (e.push({ animation: f, state:
|
|
1295
|
+
) || null), f && ((n = this.artboard.animationFlow) != null && n.some((u) => (u.trigger === "on_load" || u.trigger === "after_delay") && u.targetAnimationId === (f == null ? void 0 : f.id)) || (e.push({ animation: f, state: c }), s = Math.max(s, f.duration)));
|
|
1296
1296
|
}
|
|
1297
1297
|
}
|
|
1298
1298
|
}
|
|
@@ -1338,22 +1338,22 @@ class ci {
|
|
|
1338
1338
|
var n, a, r;
|
|
1339
1339
|
let o;
|
|
1340
1340
|
if (this.inputs.has(t)) {
|
|
1341
|
-
const
|
|
1342
|
-
|
|
1341
|
+
const c = (n = this.activeStateMachine) == null ? void 0 : n.inputs.find((f) => f.id === t);
|
|
1342
|
+
c && typeof c.value == "object" && (o = c.value.type);
|
|
1343
1343
|
} else {
|
|
1344
|
-
const
|
|
1345
|
-
if (
|
|
1346
|
-
const f = (a = this.activeStateMachine) == null ? void 0 : a.inputs.find((h) => h.id ===
|
|
1344
|
+
const c = this.inputNameMap.get(t);
|
|
1345
|
+
if (c && c.length > 0) {
|
|
1346
|
+
const f = (a = this.activeStateMachine) == null ? void 0 : a.inputs.find((h) => h.id === c[0]);
|
|
1347
1347
|
f && typeof f.value == "object" && (o = f.value.type);
|
|
1348
1348
|
}
|
|
1349
1349
|
}
|
|
1350
1350
|
let e = i;
|
|
1351
1351
|
o === "Trigger" && (i === 1 ? e = !0 : i === 0 && (e = !1)), this.inputs.has(t) && this.setInternalInput(t, e);
|
|
1352
1352
|
const s = this.inputNameMap.get(t);
|
|
1353
|
-
s && s.forEach((
|
|
1354
|
-
if (
|
|
1355
|
-
const f = this.objectStates.get(
|
|
1356
|
-
f && f.options && (
|
|
1353
|
+
s && s.forEach((c) => this.setInternalInput(c, e)), o === "Trigger" && e === !0 && (this.justFiredTriggers.add(t), s && s.forEach((c) => this.justFiredTriggers.add(c))), Array.isArray(e) && ((r = this.artboard) == null || r.objects.forEach((c) => {
|
|
1354
|
+
if (c.inputId === t || c.name === t) {
|
|
1355
|
+
const f = this.objectStates.get(c.id);
|
|
1356
|
+
f && f.options && (c.type === "ListView" || c.variant === "listview" ? f.options.items = e : (c.type === "Dropdown" || c.variant === "dropdown") && (f.options.optionsList = e));
|
|
1357
1357
|
}
|
|
1358
1358
|
})), this.evaluateTransitions(), this.evaluateVariableTriggers(t, e);
|
|
1359
1359
|
}
|
|
@@ -1363,40 +1363,40 @@ class ci {
|
|
|
1363
1363
|
o.forEach((s) => {
|
|
1364
1364
|
if (s.trigger === "variable" && s.conditionVariableId && s.targetAnimationId && (s.conditionVariableId === t || e && e.includes(s.conditionVariableId))) {
|
|
1365
1365
|
const a = s.conditionOperator || "IsTrue", r = s.conditionValue;
|
|
1366
|
-
let
|
|
1366
|
+
let c = !1;
|
|
1367
1367
|
switch (a) {
|
|
1368
1368
|
case "Equal":
|
|
1369
1369
|
case "==":
|
|
1370
|
-
|
|
1370
|
+
c = i == r;
|
|
1371
1371
|
break;
|
|
1372
1372
|
case "NotEqual":
|
|
1373
1373
|
case "!=":
|
|
1374
|
-
|
|
1374
|
+
c = i != r;
|
|
1375
1375
|
break;
|
|
1376
1376
|
case "GreaterThan":
|
|
1377
1377
|
case ">":
|
|
1378
|
-
|
|
1378
|
+
c = i > r;
|
|
1379
1379
|
break;
|
|
1380
1380
|
case "LessThan":
|
|
1381
1381
|
case "<":
|
|
1382
|
-
|
|
1382
|
+
c = i < r;
|
|
1383
1383
|
break;
|
|
1384
1384
|
case "GreaterEqual":
|
|
1385
1385
|
case ">=":
|
|
1386
|
-
|
|
1386
|
+
c = i >= r;
|
|
1387
1387
|
break;
|
|
1388
1388
|
case "LessEqual":
|
|
1389
1389
|
case "<=":
|
|
1390
|
-
|
|
1390
|
+
c = i <= r;
|
|
1391
1391
|
break;
|
|
1392
1392
|
case "IsTrue":
|
|
1393
|
-
|
|
1393
|
+
c = !!i;
|
|
1394
1394
|
break;
|
|
1395
1395
|
case "IsFalse":
|
|
1396
|
-
|
|
1396
|
+
c = !i;
|
|
1397
1397
|
break;
|
|
1398
1398
|
}
|
|
1399
|
-
if (
|
|
1399
|
+
if (c) {
|
|
1400
1400
|
const f = s.delay || 0;
|
|
1401
1401
|
f <= 0 ? this.triggerGlobalAnimation(s.targetAnimationId, s.subAnimationIds, s.loop, s.id) : setTimeout(() => this.triggerGlobalAnimation(s.targetAnimationId, s.subAnimationIds, s.loop, s.id), f);
|
|
1402
1402
|
}
|
|
@@ -1421,7 +1421,7 @@ class ci {
|
|
|
1421
1421
|
const s = this.findGlobalTransition(t, i.currentStateIds);
|
|
1422
1422
|
s && (o.length = 0, o.push(s.targetStateId), e = !0, s.conditions && (s.conditions || []).forEach((n) => {
|
|
1423
1423
|
var r;
|
|
1424
|
-
const a = (r = this.activeStateMachine) == null ? void 0 : r.inputs.find((
|
|
1424
|
+
const a = (r = this.activeStateMachine) == null ? void 0 : r.inputs.find((c) => c.id === n.inputId);
|
|
1425
1425
|
a && typeof a.value == "object" && a.value.type === "Trigger" && this.setInternalInput(n.inputId, !1);
|
|
1426
1426
|
}));
|
|
1427
1427
|
}
|
|
@@ -1498,29 +1498,29 @@ class ci {
|
|
|
1498
1498
|
});
|
|
1499
1499
|
}
|
|
1500
1500
|
evaluateLogicTree(t, i = null, o = /* @__PURE__ */ new Set()) {
|
|
1501
|
-
var a, r,
|
|
1501
|
+
var a, r, c, f, h, u;
|
|
1502
1502
|
if (o.has(t))
|
|
1503
1503
|
return this.inputs.get(t) ?? this.logicNodeValues.get(t) ?? 0;
|
|
1504
1504
|
o.add(t);
|
|
1505
|
-
const e = (r = (a = this.activeStateMachine) == null ? void 0 : a.logicNodes) == null ? void 0 : r.find((
|
|
1505
|
+
const e = (r = (a = this.activeStateMachine) == null ? void 0 : a.logicNodes) == null ? void 0 : r.find((l) => l.id === t);
|
|
1506
1506
|
if (e) {
|
|
1507
|
-
const
|
|
1507
|
+
const l = (p, y) => {
|
|
1508
1508
|
const b = e.inputs.find((m) => m.id === p);
|
|
1509
1509
|
return b ? b.sourceId ? this.evaluateLogicTree(b.sourceId, b.sourceHandleId, o) : b.value !== void 0 ? b.value : y : y;
|
|
1510
1510
|
};
|
|
1511
1511
|
let d = 0;
|
|
1512
1512
|
switch (e.op) {
|
|
1513
1513
|
case wt.AND:
|
|
1514
|
-
d =
|
|
1514
|
+
d = l("a", !1) && l("b", !1);
|
|
1515
1515
|
break;
|
|
1516
1516
|
case wt.OR:
|
|
1517
|
-
d =
|
|
1517
|
+
d = l("a", !1) || l("b", !1);
|
|
1518
1518
|
break;
|
|
1519
1519
|
case wt.NOT:
|
|
1520
|
-
d = !
|
|
1520
|
+
d = !l("in", !1);
|
|
1521
1521
|
break;
|
|
1522
1522
|
case wt.XOR:
|
|
1523
|
-
d = !!
|
|
1523
|
+
d = !!l("a", !1) != !!l("b", !1);
|
|
1524
1524
|
break;
|
|
1525
1525
|
// Object & Property
|
|
1526
1526
|
case wt.OBJECT:
|
|
@@ -1528,7 +1528,7 @@ class ci {
|
|
|
1528
1528
|
break;
|
|
1529
1529
|
case wt.PROPERTY:
|
|
1530
1530
|
case wt.GET_PROPERTY: {
|
|
1531
|
-
const p =
|
|
1531
|
+
const p = l("id", "");
|
|
1532
1532
|
if (!p) {
|
|
1533
1533
|
d = 0;
|
|
1534
1534
|
break;
|
|
@@ -1547,7 +1547,7 @@ class ci {
|
|
|
1547
1547
|
break;
|
|
1548
1548
|
}
|
|
1549
1549
|
case wt.SET_PROPERTY: {
|
|
1550
|
-
const p =
|
|
1550
|
+
const p = l("id", ""), y = l("value", void 0);
|
|
1551
1551
|
if (!p || y === void 0) {
|
|
1552
1552
|
d = 0;
|
|
1553
1553
|
break;
|
|
@@ -1567,9 +1567,9 @@ class ci {
|
|
|
1567
1567
|
else {
|
|
1568
1568
|
const S = b.split(".");
|
|
1569
1569
|
let C = m;
|
|
1570
|
-
for (let
|
|
1571
|
-
const
|
|
1572
|
-
C[
|
|
1570
|
+
for (let I = 0; I < S.length - 1; I++) {
|
|
1571
|
+
const M = S[I];
|
|
1572
|
+
C[M] === void 0 && (C[M] = {}), C = C[M];
|
|
1573
1573
|
}
|
|
1574
1574
|
const w = S[S.length - 1];
|
|
1575
1575
|
C[w] = y, d = y;
|
|
@@ -1578,78 +1578,78 @@ class ci {
|
|
|
1578
1578
|
}
|
|
1579
1579
|
// Math
|
|
1580
1580
|
case wt.ADD:
|
|
1581
|
-
d =
|
|
1581
|
+
d = l("a", 0) + l("b", 0);
|
|
1582
1582
|
break;
|
|
1583
1583
|
case wt.SUB:
|
|
1584
|
-
d =
|
|
1584
|
+
d = l("a", 0) - l("b", 0);
|
|
1585
1585
|
break;
|
|
1586
1586
|
case wt.MUL:
|
|
1587
|
-
d =
|
|
1587
|
+
d = l("a", 0) * l("b", 0);
|
|
1588
1588
|
break;
|
|
1589
1589
|
case wt.DIV: {
|
|
1590
|
-
const p =
|
|
1591
|
-
d = p === 0 ? 0 :
|
|
1590
|
+
const p = l("b", 1);
|
|
1591
|
+
d = p === 0 ? 0 : l("a", 0) / p;
|
|
1592
1592
|
break;
|
|
1593
1593
|
}
|
|
1594
1594
|
case wt.MOD:
|
|
1595
|
-
d =
|
|
1595
|
+
d = l("a", 0) % l("b", 1);
|
|
1596
1596
|
break;
|
|
1597
1597
|
case wt.POW:
|
|
1598
|
-
d = Math.pow(
|
|
1598
|
+
d = Math.pow(l("a", 0), l("b", 1));
|
|
1599
1599
|
break;
|
|
1600
1600
|
case wt.ABS:
|
|
1601
|
-
d = Math.abs(
|
|
1601
|
+
d = Math.abs(l("in", 0));
|
|
1602
1602
|
break;
|
|
1603
1603
|
case wt.ROUND:
|
|
1604
|
-
d = Math.round(
|
|
1604
|
+
d = Math.round(l("in", 0));
|
|
1605
1605
|
break;
|
|
1606
1606
|
case wt.FLOOR:
|
|
1607
|
-
d = Math.floor(
|
|
1607
|
+
d = Math.floor(l("in", 0));
|
|
1608
1608
|
break;
|
|
1609
1609
|
case wt.CEIL:
|
|
1610
|
-
d = Math.ceil(
|
|
1610
|
+
d = Math.ceil(l("in", 0));
|
|
1611
1611
|
break;
|
|
1612
1612
|
case wt.SIN:
|
|
1613
|
-
d = Math.sin(
|
|
1613
|
+
d = Math.sin(l("in", 0));
|
|
1614
1614
|
break;
|
|
1615
1615
|
case wt.COS:
|
|
1616
|
-
d = Math.cos(
|
|
1616
|
+
d = Math.cos(l("in", 0));
|
|
1617
1617
|
break;
|
|
1618
1618
|
case wt.TAN:
|
|
1619
|
-
d = Math.tan(
|
|
1619
|
+
d = Math.tan(l("in", 0));
|
|
1620
1620
|
break;
|
|
1621
1621
|
case wt.CLAMP: {
|
|
1622
|
-
const p =
|
|
1622
|
+
const p = l("in", 0), y = l("min", 0), b = l("max", 1);
|
|
1623
1623
|
d = Math.max(y, Math.min(b, p));
|
|
1624
1624
|
break;
|
|
1625
1625
|
}
|
|
1626
1626
|
case wt.REMAP: {
|
|
1627
|
-
const p =
|
|
1627
|
+
const p = l("in", 0), y = l("inMin", 0), b = l("inMax", 100), m = l("outMin", 0), v = l("outMax", 1);
|
|
1628
1628
|
d = b === y ? m : m + (p - y) * (v - m) / (b - y);
|
|
1629
1629
|
break;
|
|
1630
1630
|
}
|
|
1631
1631
|
// Comparison
|
|
1632
1632
|
case wt.EQ:
|
|
1633
|
-
d =
|
|
1633
|
+
d = l("a", 0) == l("b", 0);
|
|
1634
1634
|
break;
|
|
1635
1635
|
case wt.NEQ:
|
|
1636
|
-
d =
|
|
1636
|
+
d = l("a", 0) != l("b", 0);
|
|
1637
1637
|
break;
|
|
1638
1638
|
case wt.GT:
|
|
1639
|
-
d =
|
|
1639
|
+
d = l("a", 0) > l("b", 0);
|
|
1640
1640
|
break;
|
|
1641
1641
|
case wt.LT:
|
|
1642
|
-
d =
|
|
1642
|
+
d = l("a", 0) < l("b", 0);
|
|
1643
1643
|
break;
|
|
1644
1644
|
case wt.GTE:
|
|
1645
|
-
d =
|
|
1645
|
+
d = l("a", 0) >= l("b", 0);
|
|
1646
1646
|
break;
|
|
1647
1647
|
case wt.LTE:
|
|
1648
|
-
d =
|
|
1648
|
+
d = l("a", 0) <= l("b", 0);
|
|
1649
1649
|
break;
|
|
1650
1650
|
// Control Flow & Utils
|
|
1651
1651
|
case wt.IF_ELSE:
|
|
1652
|
-
d =
|
|
1652
|
+
d = l("cond", !1) ? l("then", 0) : l("else", 0);
|
|
1653
1653
|
break;
|
|
1654
1654
|
case wt.VALUE:
|
|
1655
1655
|
d = e.value !== void 0 ? e.value : 0;
|
|
@@ -1658,7 +1658,7 @@ class ci {
|
|
|
1658
1658
|
d = this.inputs.get(e.name) ?? 0;
|
|
1659
1659
|
break;
|
|
1660
1660
|
case wt.LOG: {
|
|
1661
|
-
const p =
|
|
1661
|
+
const p = l("in", "");
|
|
1662
1662
|
this.debugLog(`[User Logic] ${p}`), d = p;
|
|
1663
1663
|
break;
|
|
1664
1664
|
}
|
|
@@ -1678,7 +1678,7 @@ class ci {
|
|
|
1678
1678
|
d = this.inputs.get("isMouseDown") ?? !1;
|
|
1679
1679
|
break;
|
|
1680
1680
|
case wt.EFFECTOR: {
|
|
1681
|
-
const p =
|
|
1681
|
+
const p = l("id", ""), y = l("intensity", 1), b = l("trigger", !0);
|
|
1682
1682
|
if (!p || !b) {
|
|
1683
1683
|
d = 0;
|
|
1684
1684
|
break;
|
|
@@ -1703,38 +1703,38 @@ class ci {
|
|
|
1703
1703
|
break;
|
|
1704
1704
|
}
|
|
1705
1705
|
case wt.MONITOR: {
|
|
1706
|
-
d =
|
|
1706
|
+
d = l("in", 0);
|
|
1707
1707
|
break;
|
|
1708
1708
|
}
|
|
1709
1709
|
case wt.SPRING_PULL: {
|
|
1710
|
-
const p =
|
|
1711
|
-
p && ((
|
|
1710
|
+
const p = l("objectId", ""), y = l("forceX", 0), b = l("forceY", 0);
|
|
1711
|
+
p && ((c = this.artboard) == null || c.objects.forEach((m) => {
|
|
1712
1712
|
m.behaviors && m.behaviors.forEach((v) => {
|
|
1713
1713
|
var S;
|
|
1714
1714
|
if (v.type === U.SpringChain && ((S = v.settings) != null && S.connections) && (v.settings.connections.some((w) => w.targetId === p) || m.id === p)) {
|
|
1715
1715
|
this._springChainState.has(m.id) || this._springChainState.set(m.id, /* @__PURE__ */ new Map());
|
|
1716
1716
|
const w = this._springChainState.get(m.id);
|
|
1717
1717
|
if (!w.has(p)) {
|
|
1718
|
-
const
|
|
1718
|
+
const M = this.objectStates.get(p);
|
|
1719
1719
|
w.set(p, {
|
|
1720
|
-
x: (
|
|
1721
|
-
y: (
|
|
1720
|
+
x: (M == null ? void 0 : M.x) ?? 0,
|
|
1721
|
+
y: (M == null ? void 0 : M.y) ?? 0,
|
|
1722
1722
|
vx: 0,
|
|
1723
1723
|
vy: 0
|
|
1724
1724
|
});
|
|
1725
1725
|
}
|
|
1726
|
-
const
|
|
1727
|
-
|
|
1726
|
+
const I = w.get(p);
|
|
1727
|
+
I && (I.vx += y, I.vy += b);
|
|
1728
1728
|
}
|
|
1729
1729
|
});
|
|
1730
1730
|
})), d = 1;
|
|
1731
1731
|
break;
|
|
1732
1732
|
}
|
|
1733
1733
|
case wt.SPRING_SETTLE: {
|
|
1734
|
-
const p =
|
|
1734
|
+
const p = l("objectId", "");
|
|
1735
1735
|
let y = !0;
|
|
1736
1736
|
if (p) {
|
|
1737
|
-
const b =
|
|
1737
|
+
const b = l("threshold", 1);
|
|
1738
1738
|
this._springChainState.forEach((m) => {
|
|
1739
1739
|
const v = m.get(p);
|
|
1740
1740
|
v && (Math.abs(v.vx) > b || Math.abs(v.vy) > b) && (y = !1);
|
|
@@ -1744,7 +1744,7 @@ class ci {
|
|
|
1744
1744
|
break;
|
|
1745
1745
|
}
|
|
1746
1746
|
case wt.EMIT: {
|
|
1747
|
-
const p =
|
|
1747
|
+
const p = l("objectId", ""), y = l("count", 20);
|
|
1748
1748
|
p && ((f = this.artboard) == null || f.objects.forEach((b) => {
|
|
1749
1749
|
b.behaviors && b.behaviors.forEach((m) => {
|
|
1750
1750
|
m.type === U.ParticleEmitter && b.id === p && (m._pendingBurst = (m._pendingBurst || 0) + y);
|
|
@@ -1757,7 +1757,7 @@ class ci {
|
|
|
1757
1757
|
break;
|
|
1758
1758
|
}
|
|
1759
1759
|
if (this.logicNodeValues.set(t, d), e.op === wt.DELAY) {
|
|
1760
|
-
const p =
|
|
1760
|
+
const p = l("delay", 0), y = l("in", 0);
|
|
1761
1761
|
let b = this.logicNodeState.get(t);
|
|
1762
1762
|
for (b || (b = { queue: [] }, this.logicNodeState.set(t, b)), b.queue.push({ time: this.currentTime + p, value: y }); b.queue.length > 0 && b.queue[0].time <= this.currentTime; )
|
|
1763
1763
|
b.lastValue = b.queue.shift().value;
|
|
@@ -1765,16 +1765,16 @@ class ci {
|
|
|
1765
1765
|
}
|
|
1766
1766
|
return d;
|
|
1767
1767
|
}
|
|
1768
|
-
const s = (h = this.activeStateMachine) == null ? void 0 : h.inputs.find((
|
|
1768
|
+
const s = (h = this.activeStateMachine) == null ? void 0 : h.inputs.find((l) => l.id === t || l.name === t);
|
|
1769
1769
|
if (s && s.sourceId && !o.has(s.sourceId)) {
|
|
1770
|
-
const
|
|
1771
|
-
return this.inputs.set(s.id,
|
|
1770
|
+
const l = this.evaluateLogicTree(s.sourceId, s.sourceHandleId, o);
|
|
1771
|
+
return this.inputs.set(s.id, l), l;
|
|
1772
1772
|
}
|
|
1773
1773
|
let n = this.inputs.get(t) ?? (s ? this.inputs.get(s.id) : void 0);
|
|
1774
1774
|
if ((this.justFiredTriggers.has(t) || s && this.justFiredTriggers.has(s.id)) && (n = !0), i && n !== void 0) {
|
|
1775
|
-
const
|
|
1776
|
-
if (
|
|
1777
|
-
const d =
|
|
1775
|
+
const l = (u = this.activeStateMachine) == null ? void 0 : u.inputs.find((d) => d.id === t);
|
|
1776
|
+
if (l && l.value.type === "Number" && typeof n == "number") {
|
|
1777
|
+
const d = l.value.defaultValue ?? l.value.value;
|
|
1778
1778
|
if (i === "source-greater") return n > d;
|
|
1779
1779
|
if (i === "source-less") return n < d;
|
|
1780
1780
|
if (i === "source-equal") return n === d;
|
|
@@ -1841,13 +1841,13 @@ class ci {
|
|
|
1841
1841
|
}), i.forEach((o) => {
|
|
1842
1842
|
this.layerStates.delete(o), this.debugLog(`[Engine] Cleaned up completed global layer: ${o}`);
|
|
1843
1843
|
}), this.solveConstraints(t), this.solveBehaviors(t), this.activeTriggers.forEach((o, e) => {
|
|
1844
|
-
var s, n, a, r,
|
|
1844
|
+
var s, n, a, r, c, f, h;
|
|
1845
1845
|
if (o.phase === "entry")
|
|
1846
1846
|
o.time += t, o.time >= o.animation.duration && ((a = (n = (s = this.artboard) == null ? void 0 : s.objects.find((u) => u.id === e)) == null ? void 0 : n.triggers) == null || a.find((u) => u.id === o.triggerId), o.phase = "hold", o.elapsedHold = 0, o.time = o.animation.duration), this.applyAnimation(o.animation, o.time, o.filterObjectIds || o.filterObjectId || void 0);
|
|
1847
1847
|
else if (o.phase === "hold") {
|
|
1848
|
-
const u = (f = (
|
|
1848
|
+
const u = (f = (c = (r = this.artboard) == null ? void 0 : r.objects.find((p) => p.id === e)) == null ? void 0 : c.triggers) == null ? void 0 : f.find((p) => p.id === o.triggerId), l = (u == null ? void 0 : u.duration) || 0;
|
|
1849
1849
|
o.elapsedHold += t * 1e3;
|
|
1850
|
-
let d = o.elapsedHold >=
|
|
1850
|
+
let d = o.elapsedHold >= l;
|
|
1851
1851
|
if ((u == null ? void 0 : u.eventType) === "hover" && !this.activeHoverIds.has(e) && (d = !0), ((u == null ? void 0 : u.eventType) === "onHold" || (u == null ? void 0 : u.eventType) === "pointerDown") && !this.isMouseDown && (d = !0), d)
|
|
1852
1852
|
if (u != null && u.exitAnimationId) {
|
|
1853
1853
|
const p = (h = this.artboard) == null ? void 0 : h.animations.find((y) => y.id === u.exitAnimationId);
|
|
@@ -1864,8 +1864,8 @@ class ci {
|
|
|
1864
1864
|
if (o && o.isEnabled && o.triggerType === "visible") {
|
|
1865
1865
|
const a = this.objectStates.get(i.id);
|
|
1866
1866
|
if (a && a.visible !== !1) {
|
|
1867
|
-
const r = this.getGlobalTransform(i.id),
|
|
1868
|
-
u && !d && this.fireAnalyticsEvent(i.id, "visible"), u ? this.wasInView.add(
|
|
1867
|
+
const r = this.getGlobalTransform(i.id), c = (((s = i.geometry) == null ? void 0 : s.width) || 100) * (r.scale_x || 1), f = (((n = i.geometry) == null ? void 0 : n.height) || 100) * (r.scale_y || 1), h = 50, u = r.x + c / 2 >= -this.canvasWidth / 2 - h && r.x - c / 2 <= this.canvasWidth / 2 + h && r.y + f / 2 >= -this.canvasHeight / 2 - h && r.y - f / 2 <= this.canvasHeight / 2 + h, l = `analytics_${i.id}`, d = this.wasInView.has(l);
|
|
1868
|
+
u && !d && this.fireAnalyticsEvent(i.id, "visible"), u ? this.wasInView.add(l) : this.wasInView.delete(l);
|
|
1869
1869
|
}
|
|
1870
1870
|
}
|
|
1871
1871
|
}), this.artboard.objects.forEach((i) => {
|
|
@@ -1873,7 +1873,7 @@ class ci {
|
|
|
1873
1873
|
o.length !== 0 && o.forEach((e) => {
|
|
1874
1874
|
const s = e.triggers || [e.event || e.trigger];
|
|
1875
1875
|
s && s.forEach((n) => {
|
|
1876
|
-
var r,
|
|
1876
|
+
var r, c, f;
|
|
1877
1877
|
const a = n.toLowerCase();
|
|
1878
1878
|
if (a === "on interval" || a === "oninterval") {
|
|
1879
1879
|
const h = e.intervalValue || 2e3, u = this.periodicTriggerTimes.get(e.id) || 0;
|
|
@@ -1886,7 +1886,7 @@ class ci {
|
|
|
1886
1886
|
if (a === "scroll into view" || a === "scrollintoview") {
|
|
1887
1887
|
const h = this.objectStates.get(i.id);
|
|
1888
1888
|
if (h && h.visible !== !1) {
|
|
1889
|
-
const u = this.getGlobalTransform(i.id),
|
|
1889
|
+
const u = this.getGlobalTransform(i.id), l = (((r = i.geometry) == null ? void 0 : r.width) || 100) * (u.scale_x || 1), d = (((c = i.geometry) == null ? void 0 : c.height) || 100) * (u.scale_y || 1), p = 50, y = u.x + l / 2 >= -this.canvasWidth / 2 - p && u.x - l / 2 <= this.canvasWidth / 2 + p && u.y + d / 2 >= -this.canvasHeight / 2 - p && u.y - d / 2 <= this.canvasHeight / 2 + p, b = this.wasInView.has(i.id);
|
|
1890
1890
|
y && !b && (!e.conditions || this.checkConditions(e.conditions)) && this.fireEventForObject(i.id, "Scroll Into View"), y ? this.wasInView.add(i.id) : this.wasInView.delete(i.id);
|
|
1891
1891
|
}
|
|
1892
1892
|
}
|
|
@@ -1905,17 +1905,17 @@ class ci {
|
|
|
1905
1905
|
if (!o) return;
|
|
1906
1906
|
const e = this.getGlobalTransform(i.id);
|
|
1907
1907
|
if (i.constraints.forEach((s, n) => {
|
|
1908
|
-
var f, h, u,
|
|
1909
|
-
const a = ((f = o.constraints) == null ? void 0 : f[n]) || {}, r = { ...s, ...a },
|
|
1908
|
+
var f, h, u, l, d, p, y, b, m;
|
|
1909
|
+
const a = ((f = o.constraints) == null ? void 0 : f[n]) || {}, r = { ...s, ...a }, c = r.strength ?? 1;
|
|
1910
1910
|
if (r.type === "Translation") {
|
|
1911
1911
|
const v = this.getGlobalTransform(r.targetId);
|
|
1912
1912
|
if (v) {
|
|
1913
|
-
const S = r.offsetX || 0, C = r.offsetY || 0, w = v.x + S,
|
|
1914
|
-
if (
|
|
1915
|
-
const T = this.objectVelocities.get(i.id) || { vx: 0, vy: 0 }, { x: R, y: P, vx: _, vy: E } = this.computeSpring(e.x, e.y, T.vx, T.vy, w,
|
|
1916
|
-
r.copyX && (e.x = e.x + (R - e.x) *
|
|
1913
|
+
const S = r.offsetX || 0, C = r.offsetY || 0, w = v.x + S, I = v.y + C, M = r.useSpring;
|
|
1914
|
+
if (M) {
|
|
1915
|
+
const T = this.objectVelocities.get(i.id) || { vx: 0, vy: 0 }, { x: R, y: P, vx: _, vy: E } = this.computeSpring(e.x, e.y, T.vx, T.vy, w, I, r, t);
|
|
1916
|
+
r.copyX && (e.x = e.x + (R - e.x) * c), r.copyY && (e.y = e.y + (P - e.y) * c), this.objectVelocities.set(i.id, { vx: _, vy: E });
|
|
1917
1917
|
} else
|
|
1918
|
-
r.copyX && (e.x = e.x + (w - e.x) *
|
|
1918
|
+
r.copyX && (e.x = e.x + (w - e.x) * c), r.copyY && (e.y = e.y + (I - e.y) * c);
|
|
1919
1919
|
let k = !1;
|
|
1920
1920
|
if ((h = r.limitX) != null && h.enabled) {
|
|
1921
1921
|
const T = e.x;
|
|
@@ -1925,63 +1925,63 @@ class ci {
|
|
|
1925
1925
|
const T = e.y;
|
|
1926
1926
|
e.y = Math.max(r.limitY.min, Math.min(r.limitY.max, e.y)), e.y !== T && (k = !0);
|
|
1927
1927
|
}
|
|
1928
|
-
k &&
|
|
1928
|
+
k && M && this.objectVelocities.set(i.id, { vx: 0, vy: 0 });
|
|
1929
1929
|
}
|
|
1930
1930
|
} else if (r.type === "Rotation") {
|
|
1931
1931
|
const v = this.getGlobalTransform(r.targetId);
|
|
1932
1932
|
if (v) {
|
|
1933
1933
|
let C = (v.rotation + (r.offset || 0) - e.rotation) % 360;
|
|
1934
|
-
C > 180 && (C -= 360), C < -180 && (C += 360), e.rotation = e.rotation + C *
|
|
1934
|
+
C > 180 && (C -= 360), C < -180 && (C += 360), e.rotation = e.rotation + C * c;
|
|
1935
1935
|
}
|
|
1936
1936
|
} else if (r.type === "Scale") {
|
|
1937
1937
|
const v = this.getGlobalTransform(r.targetId);
|
|
1938
|
-
v && (r.copyX && (e.scale_x = e.scale_x + (v.scale_x - e.scale_x) *
|
|
1938
|
+
v && (r.copyX && (e.scale_x = e.scale_x + (v.scale_x - e.scale_x) * c), r.copyY && (e.scale_y = e.scale_y + (v.scale_y - e.scale_y) * c));
|
|
1939
1939
|
} else if (r.type === "Transform") {
|
|
1940
1940
|
const v = this.getGlobalTransform(r.targetId);
|
|
1941
1941
|
if (v) {
|
|
1942
|
-
e.x = e.x + (v.x - e.x) *
|
|
1942
|
+
e.x = e.x + (v.x - e.x) * c, e.y = e.y + (v.y - e.y) * c;
|
|
1943
1943
|
let S = (v.rotation - e.rotation) % 360;
|
|
1944
|
-
S > 180 && (S -= 360), S < -180 && (S += 360), e.rotation = e.rotation + S *
|
|
1944
|
+
S > 180 && (S -= 360), S < -180 && (S += 360), e.rotation = e.rotation + S * c, e.scale_x = e.scale_x + (v.scale_x - e.scale_x) * c, e.scale_y = e.scale_y + (v.scale_y - e.scale_y) * c;
|
|
1945
1945
|
}
|
|
1946
1946
|
} else if (r.type === "FollowPointer") {
|
|
1947
|
-
const v = ((
|
|
1947
|
+
const v = ((l = this._lastPointerPos) == null ? void 0 : l.x) ?? e.x, S = ((d = this._lastPointerPos) == null ? void 0 : d.y) ?? e.y, C = r.useSpring;
|
|
1948
1948
|
if (C) {
|
|
1949
|
-
const
|
|
1950
|
-
e.x =
|
|
1949
|
+
const I = this.objectVelocities.get(i.id) || { vx: 0, vy: 0 }, { x: M, y: k, vx: T, vy: R } = this.computeSpring(e.x, e.y, I.vx, I.vy, v, S, r, t);
|
|
1950
|
+
e.x = M, e.y = k, this.objectVelocities.set(i.id, { vx: T, vy: R });
|
|
1951
1951
|
} else
|
|
1952
|
-
e.x = e.x + (v - e.x) *
|
|
1952
|
+
e.x = e.x + (v - e.x) * c, e.y = e.y + (S - e.y) * c;
|
|
1953
1953
|
let w = !1;
|
|
1954
1954
|
if ((p = r.limitX) != null && p.enabled) {
|
|
1955
|
-
const
|
|
1956
|
-
e.x = Math.max(r.limitX.min, Math.min(r.limitX.max, e.x)), e.x !==
|
|
1955
|
+
const I = e.x;
|
|
1956
|
+
e.x = Math.max(r.limitX.min, Math.min(r.limitX.max, e.x)), e.x !== I && (w = !0);
|
|
1957
1957
|
}
|
|
1958
1958
|
if ((y = r.limitY) != null && y.enabled) {
|
|
1959
|
-
const
|
|
1960
|
-
e.y = Math.max(r.limitY.min, Math.min(r.limitY.max, e.y)), e.y !==
|
|
1959
|
+
const I = e.y;
|
|
1960
|
+
e.y = Math.max(r.limitY.min, Math.min(r.limitY.max, e.y)), e.y !== I && (w = !0);
|
|
1961
1961
|
}
|
|
1962
1962
|
w && C && this.objectVelocities.set(i.id, { vx: 0, vy: 0 });
|
|
1963
1963
|
} else if (r.type === "Distance") {
|
|
1964
1964
|
const v = this.getGlobalTransform(r.targetId);
|
|
1965
1965
|
if (v) {
|
|
1966
|
-
const S = e.x - v.x, C = e.y - v.y, w = Math.sqrt(S * S + C * C),
|
|
1967
|
-
let
|
|
1966
|
+
const S = e.x - v.x, C = e.y - v.y, w = Math.sqrt(S * S + C * C), I = r.distance || 0;
|
|
1967
|
+
let M = w;
|
|
1968
1968
|
switch (r.mode) {
|
|
1969
1969
|
case "exact":
|
|
1970
|
-
|
|
1970
|
+
M = I;
|
|
1971
1971
|
break;
|
|
1972
1972
|
case "minimum":
|
|
1973
|
-
|
|
1973
|
+
M = Math.max(I, w);
|
|
1974
1974
|
break;
|
|
1975
1975
|
case "maximum":
|
|
1976
|
-
|
|
1976
|
+
M = Math.min(I, w);
|
|
1977
1977
|
break;
|
|
1978
1978
|
case "clamped":
|
|
1979
|
-
|
|
1979
|
+
M = Math.max(0, Math.min(I, w));
|
|
1980
1980
|
break;
|
|
1981
1981
|
}
|
|
1982
1982
|
if (w > 0) {
|
|
1983
|
-
const k = e.x === v.x && e.y === v.y ? 1 :
|
|
1984
|
-
e.x = e.x + (v.x + S * k - e.x) *
|
|
1983
|
+
const k = e.x === v.x && e.y === v.y ? 1 : M / w;
|
|
1984
|
+
e.x = e.x + (v.x + S * k - e.x) * c, e.y = e.y + (v.y + C * k - e.y) * c;
|
|
1985
1985
|
}
|
|
1986
1986
|
}
|
|
1987
1987
|
} else if (r.type === "FollowPath") {
|
|
@@ -1997,22 +1997,22 @@ class ci {
|
|
|
1997
1997
|
F && (C = F.geometry);
|
|
1998
1998
|
}
|
|
1999
1999
|
if (!C) return;
|
|
2000
|
-
const w = (r.distance || 0) / 100,
|
|
2000
|
+
const w = (r.distance || 0) / 100, I = S.width || C.width || 0, M = S.height || C.height || 0, k = this.getPointOnPath(C, I, M, w), T = S.rotation * Math.PI / 180, R = Math.cos(T), P = Math.sin(T), _ = k.x * S.scale_x * R - k.y * S.scale_y * P, E = k.x * S.scale_x * P + k.y * S.scale_y * R;
|
|
2001
2001
|
let A = S.rotation + (r.offsetRotation || 0);
|
|
2002
2002
|
if (r.orient) {
|
|
2003
2003
|
const F = Math.cos(k.angle), j = Math.sin(k.angle), X = F * S.scale_x * R - j * S.scale_y * P, tt = F * S.scale_x * P + j * S.scale_y * R;
|
|
2004
2004
|
A = Math.atan2(tt, X) * 180 / Math.PI + (r.offsetRotation || 0);
|
|
2005
2005
|
}
|
|
2006
2006
|
const W = A * Math.PI / 180, z = Math.cos(W), Y = Math.sin(W), G = (r.offsetX || 0) * z - (r.offsetY || 0) * Y, N = (r.offsetX || 0) * Y + (r.offsetY || 0) * z, J = S.x + _ + G, x = S.y + E + N;
|
|
2007
|
-
if (e.x = e.x + (J - e.x) *
|
|
2007
|
+
if (e.x = e.x + (J - e.x) * c, e.y = e.y + (x - e.y) * c, r.orient) {
|
|
2008
2008
|
let F = (A - e.rotation) % 360;
|
|
2009
|
-
F > 180 && (F -= 360), F < -180 && (F += 360), e.rotation = e.rotation + F *
|
|
2009
|
+
F > 180 && (F -= 360), F < -180 && (F += 360), e.rotation = e.rotation + F * c;
|
|
2010
2010
|
}
|
|
2011
2011
|
}
|
|
2012
2012
|
}
|
|
2013
2013
|
} else if (r.type === "IK") {
|
|
2014
2014
|
const v = this.getGlobalTransform(r.targetId);
|
|
2015
|
-
v && this.solveIK(i, v, r.boneCount || 2,
|
|
2015
|
+
v && this.solveIK(i, v, r.boneCount || 2, c);
|
|
2016
2016
|
}
|
|
2017
2017
|
}), i.constraints.some((s) => s.type !== "IK")) {
|
|
2018
2018
|
const s = this.globalToLocal(i.parentId, e);
|
|
@@ -2024,7 +2024,7 @@ class ci {
|
|
|
2024
2024
|
var h, u;
|
|
2025
2025
|
const i = this.objectStates.get(t);
|
|
2026
2026
|
if (!i) return { x: 0, y: 0, rotation: 0, scale_x: 1, scale_y: 1 };
|
|
2027
|
-
const o = (h = this.artboard) == null ? void 0 : h.objects.find((
|
|
2027
|
+
const o = (h = this.artboard) == null ? void 0 : h.objects.find((l) => l.id === t), e = (o == null ? void 0 : o.type) === "Bone" ? (u = o.geometry) == null ? void 0 : u.length : void 0;
|
|
2028
2028
|
if (!o || !o.parentId)
|
|
2029
2029
|
return {
|
|
2030
2030
|
x: i.x,
|
|
@@ -2034,9 +2034,9 @@ class ci {
|
|
|
2034
2034
|
scale_y: (i.scale_y ?? 1) * (i.flip_y ? -1 : 1),
|
|
2035
2035
|
length: e
|
|
2036
2036
|
};
|
|
2037
|
-
const s = this.getGlobalTransform(o.parentId), n = s.rotation * Math.PI / 180, a = Math.cos(n), r = Math.sin(n),
|
|
2037
|
+
const s = this.getGlobalTransform(o.parentId), n = s.rotation * Math.PI / 180, a = Math.cos(n), r = Math.sin(n), c = s.x + (i.x * s.scale_x * a - i.y * s.scale_y * r), f = s.y + (i.x * s.scale_x * r + i.y * s.scale_y * a);
|
|
2038
2038
|
return {
|
|
2039
|
-
x:
|
|
2039
|
+
x: c,
|
|
2040
2040
|
y: f,
|
|
2041
2041
|
rotation: s.rotation + i.rotation,
|
|
2042
2042
|
scale_x: s.scale_x * (i.scale_x ?? 1) * (i.flip_x ? -1 : 1),
|
|
@@ -2046,7 +2046,7 @@ class ci {
|
|
|
2046
2046
|
}
|
|
2047
2047
|
globalToLocal(t, i) {
|
|
2048
2048
|
if (!t) return i;
|
|
2049
|
-
const o = this.getGlobalTransform(t), e = o.scale_x === 0 ? 0 : 1 / o.scale_x, s = o.scale_y === 0 ? 0 : 1 / o.scale_y, n = -o.rotation * Math.PI / 180, a = Math.cos(n), r = Math.sin(n),
|
|
2049
|
+
const o = this.getGlobalTransform(t), e = o.scale_x === 0 ? 0 : 1 / o.scale_x, s = o.scale_y === 0 ? 0 : 1 / o.scale_y, n = -o.rotation * Math.PI / 180, a = Math.cos(n), r = Math.sin(n), c = i.x - o.x, f = i.y - o.y, h = (c * a - f * r) * e, u = (c * r + f * a) * s;
|
|
2050
2050
|
return {
|
|
2051
2051
|
x: h,
|
|
2052
2052
|
y: u,
|
|
@@ -2056,11 +2056,11 @@ class ci {
|
|
|
2056
2056
|
};
|
|
2057
2057
|
}
|
|
2058
2058
|
solveIK(t, i, o, e) {
|
|
2059
|
-
var
|
|
2059
|
+
var c;
|
|
2060
2060
|
const s = [];
|
|
2061
2061
|
let n = t.id;
|
|
2062
2062
|
for (let f = 0; f < o && n; f++) {
|
|
2063
|
-
const h = (
|
|
2063
|
+
const h = (c = this.artboard) == null ? void 0 : c.objects.find((u) => u.id === n);
|
|
2064
2064
|
if (!h) break;
|
|
2065
2065
|
s.push({
|
|
2066
2066
|
id: n,
|
|
@@ -2073,19 +2073,19 @@ class ci {
|
|
|
2073
2073
|
for (let f = 0; f < r; f++) {
|
|
2074
2074
|
const h = this.getGlobalTransform(t.id);
|
|
2075
2075
|
for (let u = a.length - 2; u >= 0; u--) {
|
|
2076
|
-
const
|
|
2076
|
+
const l = a[u], d = this.getGlobalTransform(l.id), p = h.x - d.x, y = h.y - d.y, b = i.x - d.x, m = i.y - d.y, v = Math.sqrt(p * p + y * y), S = Math.sqrt(b * b + m * m);
|
|
2077
2077
|
if (v > 1e-3 && S > 1e-3) {
|
|
2078
2078
|
const C = Math.atan2(y, p);
|
|
2079
|
-
let
|
|
2080
|
-
|
|
2081
|
-
const
|
|
2082
|
-
|
|
2079
|
+
let I = (Math.atan2(m, b) - C) * 180 / Math.PI;
|
|
2080
|
+
I *= e;
|
|
2081
|
+
const M = this.objectStates.get(l.id);
|
|
2082
|
+
M && (M.rotation += I);
|
|
2083
2083
|
}
|
|
2084
2084
|
}
|
|
2085
2085
|
}
|
|
2086
2086
|
}
|
|
2087
2087
|
computeSpring(t, i, o, e, s, n, a, r) {
|
|
2088
|
-
const
|
|
2088
|
+
const c = a.stiffness ?? 100, f = a.damping ?? 10, h = a.mass ?? 1, u = -c * (t - s), l = -c * (i - n), d = -f * o, p = -f * e, y = (u + d) / h, b = (l + p) / h, m = o + y * r, v = e + b * r, S = t + m * r, C = i + v * r;
|
|
2089
2089
|
return { x: S, y: C, vx: m, vy: v };
|
|
2090
2090
|
}
|
|
2091
2091
|
handlePointerInput(t, i, o, e, s) {
|
|
@@ -2109,22 +2109,22 @@ class ci {
|
|
|
2109
2109
|
this._totalScroll.x += t, this._totalScroll.y += i, this.scrollOffset = { x: this._totalScroll.x, y: this._totalScroll.y }, this.updateInput("scrollX", this._totalScroll.x), this.updateInput("scrollY", this._totalScroll.y);
|
|
2110
2110
|
}
|
|
2111
2111
|
handlePointerEvent(t, i, o) {
|
|
2112
|
-
var r,
|
|
2112
|
+
var r, c, f, h, u;
|
|
2113
2113
|
if (!this.artboard) return;
|
|
2114
2114
|
t === "down" ? (this.isMouseDown = !0, this.updateInput("isMouseDown", !0)) : (t === "up" || t === "blur") && (this.isMouseDown = !1, this.updateInput("isMouseDown", !1));
|
|
2115
2115
|
let e = null;
|
|
2116
|
-
const s = (
|
|
2116
|
+
const s = (l, d) => {
|
|
2117
2117
|
var S;
|
|
2118
2118
|
let p = d;
|
|
2119
2119
|
d === "click" ? p = "onClick" : d === "down" ? p = "onPointerDown" : d === "up" ? p = "onPointerUp" : d === "blur" && (p = "onPointerLeave");
|
|
2120
2120
|
const y = /* @__PURE__ */ new Set([p]);
|
|
2121
2121
|
d === "move" && y.add("onPointerEnter").add("hover").add("onPointerLeave").add("blur"), p === "onClick" && y.add("click"), p === "onPointerDown" && y.add("pointerDown"), p === "onPointerUp" && y.add("pointerUp");
|
|
2122
2122
|
const b = ["button", "toggle", "toggle_button", "dropdown", "listview", "inputbox", "slider", "checkbox", "radiogroup", "joystick"];
|
|
2123
|
-
return !!(
|
|
2123
|
+
return !!(l.type === "Component" && b.includes(l.variant) || l.type === "Joystick" || b.includes((S = l.type) == null ? void 0 : S.toLowerCase()) || (l.interactions || []).some((C) => y.has(C.event)) || (l.triggers || []).some((C) => y.has(C.eventType)));
|
|
2124
2124
|
};
|
|
2125
2125
|
let n = null;
|
|
2126
|
-
for (let
|
|
2127
|
-
const d = this.artboard.objects[
|
|
2126
|
+
for (let l = this.artboard.objects.length - 1; l >= 0; l--) {
|
|
2127
|
+
const d = this.artboard.objects[l], p = this.objectStates.get(d.id);
|
|
2128
2128
|
if (p && p.visible !== !1 && p.opacity > 0 && this.hitTest(d, i, o) && (n || (n = d), s(d, t))) {
|
|
2129
2129
|
e = d;
|
|
2130
2130
|
break;
|
|
@@ -2134,36 +2134,36 @@ class ci {
|
|
|
2134
2134
|
const a = (e == null ? void 0 : e.id) || null;
|
|
2135
2135
|
if (t === "move") {
|
|
2136
2136
|
if (this.draggingSliderId) {
|
|
2137
|
-
const
|
|
2138
|
-
|
|
2137
|
+
const l = this.artboard.objects.find((d) => d.id === this.draggingSliderId);
|
|
2138
|
+
l && this.updateSliderValueFromPointer(l, i, o);
|
|
2139
2139
|
return;
|
|
2140
2140
|
}
|
|
2141
2141
|
if (this.draggingJoystickId) {
|
|
2142
|
-
const
|
|
2143
|
-
|
|
2142
|
+
const l = this.artboard.objects.find((d) => d.id === this.draggingJoystickId);
|
|
2143
|
+
l && this.updateJoystickValueFromPointer(l, i, o);
|
|
2144
2144
|
return;
|
|
2145
2145
|
}
|
|
2146
2146
|
if (this.draggingListViewId) {
|
|
2147
|
-
const
|
|
2148
|
-
|
|
2147
|
+
const l = this.artboard.objects.find((d) => d.id === this.draggingListViewId);
|
|
2148
|
+
l && this.updateListViewScrollFromPointer(l);
|
|
2149
2149
|
return;
|
|
2150
2150
|
}
|
|
2151
2151
|
e && (e.type === "ListView" || e.type === "Component" && e.variant === "listview") && this.updateListViewHoverFromPointer(e, i, o), this.isMouseDown && a && this.fireEventForObject(a, "Drag"), a !== this.lastHoveredObjectId && (this.log(`[Engine] HOVER CHANGE: ${this.lastHoveredObjectId} -> ${a}`), this.lastHoveredObjectId && this.fireEventForObject(this.lastHoveredObjectId, "onPointerLeave"), a && this.fireEventForObject(a, "onPointerEnter"), this.lastHoveredObjectId = a);
|
|
2152
2152
|
return;
|
|
2153
2153
|
}
|
|
2154
|
-
if ((t === "up" || t === "blur") && (this.draggingSliderId = null, this.draggingJoystickId = null, this.draggingListViewId = null, this.draggingBehaviors.clear(), this.pointerDownTimes.delete(a), this.activeObjectId = null), t === "down" && (this.pointerDownTimes.set(a, this.currentTime), this.activeObjectId = a, e && ((r = e.behaviors) != null && r.some((
|
|
2155
|
-
|
|
2154
|
+
if ((t === "up" || t === "blur") && (this.draggingSliderId = null, this.draggingJoystickId = null, this.draggingListViewId = null, this.draggingBehaviors.clear(), this.pointerDownTimes.delete(a), this.activeObjectId = null), t === "down" && (this.pointerDownTimes.set(a, this.currentTime), this.activeObjectId = a, e && ((r = e.behaviors) != null && r.some((l) => l.type === U.Draggable)) && this.draggingBehaviors.add(a)), t === "move" ? (a && !this.activeHoverIds.has(a) && this.activeHoverIds.add(a), this.activeHoverIds.forEach((l) => {
|
|
2155
|
+
l !== a && this.activeHoverIds.delete(l);
|
|
2156
2156
|
})) : t === "blur" && this.activeHoverIds.clear(), this.activeDropdownId && t === "down") {
|
|
2157
|
-
const
|
|
2158
|
-
if (
|
|
2159
|
-
const d = this.objectStates.get(
|
|
2157
|
+
const l = this.artboard.objects.find((d) => d.id === this.activeDropdownId);
|
|
2158
|
+
if (l && (l.type === "Dropdown" || l.variant === "dropdown")) {
|
|
2159
|
+
const d = this.objectStates.get(l.id), p = (d == null ? void 0 : d.options) || l.options || {}, y = l.geometry || {}, b = y.width ?? l.width ?? 200, m = y.height ?? l.height ?? 40, v = p.optionsList || [], S = p.itemHeight || 32, C = p.listPadding ?? 4, w = v.length * S + C * 2, I = this.getWorldTransform(l.id), M = b * Math.abs(I.scaleX), k = m * Math.abs(I.scaleY), T = I.y + k / 2 + 4, R = Math.abs(i - I.x) <= M / 2, P = o >= T && o <= T + w * Math.abs(I.scaleY);
|
|
2160
2160
|
if (R && P) {
|
|
2161
|
-
const _ = Math.abs(
|
|
2161
|
+
const _ = Math.abs(I.scaleY), E = o - (T + C * _), A = Math.floor(E / (S * _));
|
|
2162
2162
|
if (A >= 0 && A < v.length) {
|
|
2163
2163
|
const W = v[A];
|
|
2164
|
-
p.selectedOption = W, p.isOpen = !1, this.activeDropdownId = null,
|
|
2165
|
-
objectId:
|
|
2166
|
-
componentName:
|
|
2164
|
+
p.selectedOption = W, p.isOpen = !1, this.activeDropdownId = null, l.inputId && this.setInternalInput(l.inputId, W), this.onComponentChange && this.onComponentChange({
|
|
2165
|
+
objectId: l.id,
|
|
2166
|
+
componentName: l.name,
|
|
2167
2167
|
variant: "dropdown",
|
|
2168
2168
|
property: "selectedOption",
|
|
2169
2169
|
value: W
|
|
@@ -2174,107 +2174,107 @@ class ci {
|
|
|
2174
2174
|
}
|
|
2175
2175
|
}
|
|
2176
2176
|
if (e) {
|
|
2177
|
-
let
|
|
2177
|
+
let l = e, d = e;
|
|
2178
2178
|
for (; d && d.parentId; ) {
|
|
2179
2179
|
const y = this.artboard.objects.find((b) => b.id === d.parentId);
|
|
2180
2180
|
if (y && y.type === "Component") {
|
|
2181
|
-
|
|
2181
|
+
l = y;
|
|
2182
2182
|
break;
|
|
2183
2183
|
}
|
|
2184
2184
|
d = y;
|
|
2185
2185
|
}
|
|
2186
2186
|
let p = t;
|
|
2187
|
-
if (t === "click" ? p = "onClick" : t === "down" ? p = "onPointerDown" : t === "up" ? p = "onPointerUp" : t === "blur" && (p = "onPointerLeave"), this.fireEventForObject(e.id, p),
|
|
2188
|
-
const y = this.objectStates.get(
|
|
2189
|
-
b.checked = !b.checked,
|
|
2190
|
-
objectId:
|
|
2191
|
-
componentName:
|
|
2187
|
+
if (t === "click" ? p = "onClick" : t === "down" ? p = "onPointerDown" : t === "up" ? p = "onPointerUp" : t === "blur" && (p = "onPointerLeave"), this.fireEventForObject(e.id, p), l !== e && this.fireEventForObject(l.id, p), l.type === "Component" && l.variant === "toggle_button" && t === "down") {
|
|
2188
|
+
const y = this.objectStates.get(l.id), b = (y == null ? void 0 : y.options) || l.options || {};
|
|
2189
|
+
b.checked = !b.checked, l.inputId && this.setInternalInput(l.inputId, b.checked), this.onComponentChange && this.onComponentChange({
|
|
2190
|
+
objectId: l.id,
|
|
2191
|
+
componentName: l.name,
|
|
2192
2192
|
variant: "toggle_button",
|
|
2193
2193
|
property: "checked",
|
|
2194
2194
|
value: b.checked
|
|
2195
|
-
}), this.fireEventForObject(
|
|
2195
|
+
}), this.fireEventForObject(l.id, "Toggle"), this.fireEventForObject(l.id, b.checked ? "Toggle True" : "Toggle False");
|
|
2196
2196
|
}
|
|
2197
|
-
if (
|
|
2198
|
-
const y = this.objectStates.get(
|
|
2199
|
-
b.checked = !b.checked,
|
|
2200
|
-
objectId:
|
|
2201
|
-
componentName:
|
|
2197
|
+
if (l.type === "Component" && l.variant === "toggle" && t === "down") {
|
|
2198
|
+
const y = this.objectStates.get(l.id), b = (y == null ? void 0 : y.options) || l.options || {};
|
|
2199
|
+
b.checked = !b.checked, l.inputId && this.setInternalInput(l.inputId, b.checked), this.onComponentChange && this.onComponentChange({
|
|
2200
|
+
objectId: l.id,
|
|
2201
|
+
componentName: l.name,
|
|
2202
2202
|
variant: "toggle",
|
|
2203
2203
|
property: "checked",
|
|
2204
2204
|
value: b.checked
|
|
2205
|
-
}), this.onToggle && this.onToggle(
|
|
2205
|
+
}), this.onToggle && this.onToggle(l.name, b.checked), this.fireEventForObject(l.id, "Toggle"), this.fireEventForObject(l.id, b.checked ? "Toggle True" : "Toggle False");
|
|
2206
2206
|
}
|
|
2207
|
-
if (
|
|
2208
|
-
const y = this.objectStates.get(
|
|
2209
|
-
if (m && this.activeDropdownId && this.activeDropdownId !==
|
|
2207
|
+
if (l.type === "Component" && l.variant === "dropdown" && t === "down") {
|
|
2208
|
+
const y = this.objectStates.get(l.id), b = (y == null ? void 0 : y.options) || l.options || {}, m = !b.isOpen;
|
|
2209
|
+
if (m && this.activeDropdownId && this.activeDropdownId !== l.id) {
|
|
2210
2210
|
const v = this.artboard.objects.find((S) => S.id === this.activeDropdownId);
|
|
2211
2211
|
v && v.options && (v.options.isOpen = !1);
|
|
2212
2212
|
}
|
|
2213
|
-
b.isOpen = m, this.activeDropdownId = m ?
|
|
2213
|
+
b.isOpen = m, this.activeDropdownId = m ? l.id : null;
|
|
2214
2214
|
}
|
|
2215
|
-
if (
|
|
2216
|
-
objectId:
|
|
2217
|
-
componentName:
|
|
2215
|
+
if (l.type === "Component" && l.variant === "button" && t === "down" && (this.onButtonClick && this.onButtonClick(l.name, l.id), this.onComponentChange && this.onComponentChange({
|
|
2216
|
+
objectId: l.id,
|
|
2217
|
+
componentName: l.name,
|
|
2218
2218
|
variant: "button",
|
|
2219
2219
|
property: "click",
|
|
2220
2220
|
value: !0
|
|
2221
|
-
})), (
|
|
2222
|
-
this.draggingListViewId =
|
|
2223
|
-
const y = this.getListViewItemIndexAtPointer(
|
|
2221
|
+
})), (l.type === "ListView" || l.type === "Component" && l.variant === "listview") && t === "down") {
|
|
2222
|
+
this.draggingListViewId = l.id;
|
|
2223
|
+
const y = this.getListViewItemIndexAtPointer(l, i, o);
|
|
2224
2224
|
if (y !== null) {
|
|
2225
|
-
const b =
|
|
2225
|
+
const b = l.options || {};
|
|
2226
2226
|
b.activeItemIndex = y;
|
|
2227
|
-
const m = this.objectStates.get(
|
|
2227
|
+
const m = this.objectStates.get(l.id);
|
|
2228
2228
|
m && m.options && (m.options.activeItemIndex = y);
|
|
2229
2229
|
const v = (b.items || [])[y], S = typeof v == "string" ? v : v.label || v.value || y;
|
|
2230
|
-
m && m.options && (m.options.selectedValue = S),
|
|
2231
|
-
objectId:
|
|
2232
|
-
componentName:
|
|
2230
|
+
m && m.options && (m.options.selectedValue = S), l.inputId && this.setInternalInput(l.inputId, S), this.onComponentChange && (this.onComponentChange({
|
|
2231
|
+
objectId: l.id,
|
|
2232
|
+
componentName: l.name,
|
|
2233
2233
|
variant: "listview",
|
|
2234
2234
|
property: "activeItemIndex",
|
|
2235
2235
|
value: y
|
|
2236
2236
|
}), this.onComponentChange({
|
|
2237
|
-
objectId:
|
|
2238
|
-
componentName:
|
|
2237
|
+
objectId: l.id,
|
|
2238
|
+
componentName: l.name,
|
|
2239
2239
|
variant: "listview",
|
|
2240
2240
|
property: "selected",
|
|
2241
2241
|
value: S
|
|
2242
2242
|
}));
|
|
2243
2243
|
}
|
|
2244
2244
|
}
|
|
2245
|
-
if (
|
|
2245
|
+
if (l.type === "Component" && l.variant === "slider" && t === "down" && (this.draggingSliderId = l.id, this.updateSliderValueFromPointer(l, i, o)), l.type === "Joystick" || l.type === "Component" && l.variant === "joystick") {
|
|
2246
2246
|
if (t === "down")
|
|
2247
|
-
this.draggingJoystickId =
|
|
2247
|
+
this.draggingJoystickId = l.id, this.updateJoystickValueFromPointer(l, i, o);
|
|
2248
2248
|
else if (t === "up" || t === "blur") {
|
|
2249
|
-
const y = this.objectStates.get(
|
|
2250
|
-
y &&
|
|
2249
|
+
const y = this.objectStates.get(l.id);
|
|
2250
|
+
y && l.isSpringReturn !== !1 && (y.handleX = 0, y.handleY = 0), l.isSpringReturn !== !1 && (l.handleX = 0, l.handleY = 0);
|
|
2251
2251
|
}
|
|
2252
2252
|
}
|
|
2253
|
-
if (
|
|
2254
|
-
const y = this.objectStates.get(
|
|
2255
|
-
b.checked = !b.checked,
|
|
2256
|
-
objectId:
|
|
2257
|
-
componentName:
|
|
2253
|
+
if (l.type === "Component" && l.variant === "checkbox" && t === "down") {
|
|
2254
|
+
const y = this.objectStates.get(l.id), b = (y == null ? void 0 : y.options) || l.options || {};
|
|
2255
|
+
b.checked = !b.checked, l.inputId && this.setInternalInput(l.inputId, b.checked), this.onComponentChange && this.onComponentChange({
|
|
2256
|
+
objectId: l.id,
|
|
2257
|
+
componentName: l.name,
|
|
2258
2258
|
variant: "checkbox",
|
|
2259
2259
|
property: "checked",
|
|
2260
2260
|
value: b.checked
|
|
2261
|
-
}), this.fireEventForObject(
|
|
2261
|
+
}), this.fireEventForObject(l.id, "Click"), this.fireEventForObject(l.id, b.checked ? "Checked" : "Unchecked");
|
|
2262
2262
|
}
|
|
2263
|
-
if (
|
|
2264
|
-
const y = this.objectStates.get(
|
|
2263
|
+
if (l.type === "Component" && l.variant === "radiogroup" && t === "down") {
|
|
2264
|
+
const y = this.objectStates.get(l.id), b = (y == null ? void 0 : y.options) || l.options || {}, m = b.optionsList || [], v = this.getRadioGroupItemIndexAtPointer(l, i, o);
|
|
2265
2265
|
if (v !== null && v >= 0 && v < m.length) {
|
|
2266
2266
|
const S = m[v];
|
|
2267
|
-
b.selectedValue = S,
|
|
2268
|
-
objectId:
|
|
2269
|
-
componentName:
|
|
2267
|
+
b.selectedValue = S, l.inputId && this.setInternalInput(l.inputId, S), this.onComponentChange && this.onComponentChange({
|
|
2268
|
+
objectId: l.id,
|
|
2269
|
+
componentName: l.name,
|
|
2270
2270
|
variant: "radiogroup",
|
|
2271
2271
|
property: "selectedValue",
|
|
2272
2272
|
value: S
|
|
2273
|
-
}), this.fireEventForObject(
|
|
2273
|
+
}), this.fireEventForObject(l.id, "Click"), this.fireEventForObject(l.id, `Selected: ${S}`);
|
|
2274
2274
|
}
|
|
2275
2275
|
}
|
|
2276
|
-
if (
|
|
2277
|
-
const y =
|
|
2276
|
+
if (l.type === "LineGraph" && (t === "down" || t === "click")) {
|
|
2277
|
+
const y = l.geometry, b = (y == null ? void 0 : y.datasets) || [], m = this.objectStates.get(l.id), v = (m == null ? void 0 : m.width) || (y == null ? void 0 : y.width) || 200, S = (m == null ? void 0 : m.height) || (y == null ? void 0 : y.height) || 150, C = this.getWorldTransform(l.id), w = 30, I = 20, M = v - w, k = S - I;
|
|
2278
2278
|
let T = 1;
|
|
2279
2279
|
b.forEach((_) => {
|
|
2280
2280
|
const E = Math.max(..._.data || [0]);
|
|
@@ -2282,15 +2282,15 @@ class ci {
|
|
|
2282
2282
|
});
|
|
2283
2283
|
let R = 1 / 0, P = null;
|
|
2284
2284
|
b.forEach((_, E) => {
|
|
2285
|
-
const A = _.data || [], W =
|
|
2285
|
+
const A = _.data || [], W = M / Math.max(A.length - 1, 1);
|
|
2286
2286
|
A.forEach((z, Y) => {
|
|
2287
|
-
const G = C.x - v / 2 + w + Y * W, N = C.y + S / 2 -
|
|
2287
|
+
const G = C.x - v / 2 + w + Y * W, N = C.y + S / 2 - I - z / T * k, J = Math.sqrt((i - G) ** 2 + (o - N) ** 2);
|
|
2288
2288
|
J < R && (R = J, P = { dIdx: E, pIdx: Y, val: z, label: _.label || `Dataset ${E + 1}` });
|
|
2289
2289
|
});
|
|
2290
|
-
}), P && R < 20 && this.onGraphPointClick && this.onGraphPointClick({ objectId:
|
|
2290
|
+
}), P && R < 20 && this.onGraphPointClick && this.onGraphPointClick({ objectId: l.id, componentName: l.name, datasetIndex: P.dIdx, pointIndex: P.pIdx, value: P.val, label: P.label }), this.onComponentChange && this.onComponentChange({ objectId: l.id, componentName: l.name, variant: "linegraph", property: "click", value: (P == null ? void 0 : P.val) ?? null });
|
|
2291
2291
|
}
|
|
2292
2292
|
if (t === "click") {
|
|
2293
|
-
const y = (
|
|
2293
|
+
const y = (c = this.artboard) == null ? void 0 : c.objects.find((v) => v.id === e.id), b = this.focusedId, m = (y == null ? void 0 : y.type) === "InputBox" || (y == null ? void 0 : y.type) === "Component" && y.variant === "inputbox";
|
|
2294
2294
|
if (y && m) {
|
|
2295
2295
|
if (this.focusedId = e.id, this.log(`[Engine] Focus set to: ${e.id}`), b !== this.focusedId) {
|
|
2296
2296
|
if (b) {
|
|
@@ -2305,9 +2305,9 @@ class ci {
|
|
|
2305
2305
|
}
|
|
2306
2306
|
}
|
|
2307
2307
|
} else if (t === "click") {
|
|
2308
|
-
const
|
|
2309
|
-
if (this.focusedId = null,
|
|
2310
|
-
const d = (u = this.artboard) == null ? void 0 : u.objects.find((p) => p.id ===
|
|
2308
|
+
const l = this.focusedId;
|
|
2309
|
+
if (this.focusedId = null, l) {
|
|
2310
|
+
const d = (u = this.artboard) == null ? void 0 : u.objects.find((p) => p.id === l);
|
|
2311
2311
|
d && this.onInputBlur && this.onInputBlur(d.name);
|
|
2312
2312
|
}
|
|
2313
2313
|
}
|
|
@@ -2346,7 +2346,7 @@ class ci {
|
|
|
2346
2346
|
this.artboard && (this.activeKeys.delete(t.key.toLowerCase()), this.activeKeys.delete(t.code));
|
|
2347
2347
|
}
|
|
2348
2348
|
fireEventForObject(t, i) {
|
|
2349
|
-
var f, h, u,
|
|
2349
|
+
var f, h, u, l, d;
|
|
2350
2350
|
const o = (f = this.artboard) == null ? void 0 : f.objects.find((p) => p.id === t);
|
|
2351
2351
|
if (!o) return;
|
|
2352
2352
|
const e = /* @__PURE__ */ new Set([i, i.toLowerCase()]), s = i.toLowerCase();
|
|
@@ -2394,29 +2394,29 @@ class ci {
|
|
|
2394
2394
|
}
|
|
2395
2395
|
this.onTrigger && this.onTrigger(i, a.action);
|
|
2396
2396
|
}
|
|
2397
|
-
const
|
|
2397
|
+
const c = (o.triggers || []).find((p) => {
|
|
2398
2398
|
const y = p.eventType.toLowerCase();
|
|
2399
2399
|
let b = !1;
|
|
2400
2400
|
return (e.has(y) || y === "click" && e.has("onclick") || y === "hover" && (e.has("onpointerenter") || e.has("hover")) || y === "pointerdown" && e.has("onpointerdown") || y === "pointerup" && e.has("onpointerup")) && (b = !0), b && p.conditions && p.conditions.length > 0 ? this.checkConditions(p.conditions) : b;
|
|
2401
2401
|
});
|
|
2402
|
-
if (
|
|
2403
|
-
this.log(`[Engine] Trigger matched: ${i} (as ${
|
|
2404
|
-
const p = (d = (
|
|
2402
|
+
if (c && c.entryAnimationId) {
|
|
2403
|
+
this.log(`[Engine] Trigger matched: ${i} (as ${c.eventType}) -> Animation ${c.entryAnimationId}`);
|
|
2404
|
+
const p = (d = (l = this.artboard) == null ? void 0 : l.animations) == null ? void 0 : d.find((y) => y.id === c.entryAnimationId);
|
|
2405
2405
|
p && (this.activeTriggers.set(o.id, {
|
|
2406
|
-
triggerId:
|
|
2406
|
+
triggerId: c.id,
|
|
2407
2407
|
animation: p,
|
|
2408
2408
|
time: 0,
|
|
2409
2409
|
phase: "entry",
|
|
2410
2410
|
elapsedHold: 0,
|
|
2411
|
-
filterObjectId:
|
|
2412
|
-
}), this.onTrigger && this.onTrigger(
|
|
2411
|
+
filterObjectId: c.targetObjectId
|
|
2412
|
+
}), this.onTrigger && this.onTrigger(c.name, p.name));
|
|
2413
2413
|
}
|
|
2414
2414
|
}
|
|
2415
2415
|
fireAnalyticsEvent(t, i) {
|
|
2416
|
-
var r,
|
|
2416
|
+
var r, c;
|
|
2417
2417
|
const o = (r = this.artboard) == null ? void 0 : r.objects.find((f) => f.id === t);
|
|
2418
2418
|
if (!o) return;
|
|
2419
|
-
const e = (
|
|
2419
|
+
const e = (c = o.style) == null ? void 0 : c.analytics;
|
|
2420
2420
|
if (!e || !e.isEnabled || e.triggerType !== i) return;
|
|
2421
2421
|
const s = e.eventName || `${o.name.toLowerCase().replace(/\s+/g, "_")}_interacted`, n = {};
|
|
2422
2422
|
e.parameters && Array.isArray(e.parameters) && e.parameters.forEach((f) => {
|
|
@@ -2479,7 +2479,7 @@ class ci {
|
|
|
2479
2479
|
var u;
|
|
2480
2480
|
const i = this.objectStates.get(t);
|
|
2481
2481
|
if (!i) return { x: 0, y: 0, scaleX: 1, scaleY: 1, rotation: 0 };
|
|
2482
|
-
const o = (u = this.artboard) == null ? void 0 : u.objects.find((
|
|
2482
|
+
const o = (u = this.artboard) == null ? void 0 : u.objects.find((l) => l.id === t);
|
|
2483
2483
|
if (!o || !o.parentId)
|
|
2484
2484
|
return {
|
|
2485
2485
|
x: i.x,
|
|
@@ -2488,7 +2488,7 @@ class ci {
|
|
|
2488
2488
|
scaleY: i.scale_y ?? 1,
|
|
2489
2489
|
rotation: i.rotation ?? 0
|
|
2490
2490
|
};
|
|
2491
|
-
const e = this.getWorldTransform(o.parentId), s = e.rotation * (Math.PI / 180), n = Math.cos(s), a = Math.sin(s), r = i.x * e.scaleX,
|
|
2491
|
+
const e = this.getWorldTransform(o.parentId), s = e.rotation * (Math.PI / 180), n = Math.cos(s), a = Math.sin(s), r = i.x * e.scaleX, c = i.y * e.scaleY, f = e.x + (r * n - c * a), h = e.y + (r * a + c * n);
|
|
2492
2492
|
return {
|
|
2493
2493
|
x: f,
|
|
2494
2494
|
y: h,
|
|
@@ -2500,15 +2500,15 @@ class ci {
|
|
|
2500
2500
|
hitTest(t, i, o) {
|
|
2501
2501
|
var v, S;
|
|
2502
2502
|
if (!this.objectStates.get(t.id)) return !1;
|
|
2503
|
-
const s = ((v = t.geometry) == null ? void 0 : v.width) ?? t.width ?? 100, n = ((S = t.geometry) == null ? void 0 : S.height) ?? t.height ?? 100, a = this.getWorldTransform(t.id), r = i - a.x,
|
|
2504
|
-
return Math.abs(
|
|
2503
|
+
const s = ((v = t.geometry) == null ? void 0 : v.width) ?? t.width ?? 100, n = ((S = t.geometry) == null ? void 0 : S.height) ?? t.height ?? 100, a = this.getWorldTransform(t.id), r = i - a.x, c = o - a.y, f = -a.rotation * (Math.PI / 180), h = Math.cos(f), u = Math.sin(f), l = r * h - c * u, d = r * u + c * h, p = a.scaleX, y = a.scaleY, b = s * Math.abs(p), m = n * Math.abs(y);
|
|
2504
|
+
return Math.abs(l) <= b / 2 && Math.abs(d) <= m / 2;
|
|
2505
2505
|
}
|
|
2506
2506
|
updateSliderValueFromPointer(t, i, o) {
|
|
2507
|
-
var
|
|
2507
|
+
var I;
|
|
2508
2508
|
const e = this.objectStates.get(t.id);
|
|
2509
2509
|
if (!e) return;
|
|
2510
|
-
const s = t.options || {}, n = ((
|
|
2511
|
-
let b = (
|
|
2510
|
+
const s = t.options || {}, n = ((I = t.geometry) == null ? void 0 : I.width) ?? t.width ?? 200, a = this.getWorldTransform(t.id), r = i - a.x, c = o - a.y, f = -a.rotation * (Math.PI / 180), h = Math.cos(f), u = Math.sin(f), l = r * h - c * u, d = s.thumbWidth ?? 16, p = n - d;
|
|
2511
|
+
let b = (l + p / 2) / p;
|
|
2512
2512
|
b = Math.max(0, Math.min(1, b));
|
|
2513
2513
|
const m = s.min ?? 0, v = s.max ?? 100, S = s.step || 1;
|
|
2514
2514
|
let C = m + b * (v - m);
|
|
@@ -2523,14 +2523,14 @@ class ci {
|
|
|
2523
2523
|
}));
|
|
2524
2524
|
}
|
|
2525
2525
|
updateJoystickValueFromPointer(t, i, o) {
|
|
2526
|
-
var
|
|
2526
|
+
var I, M;
|
|
2527
2527
|
const e = this.objectStates.get(t.id);
|
|
2528
2528
|
if (!e) return;
|
|
2529
|
-
const s = (e == null ? void 0 : e.width) !== void 0 ? e.width : ((
|
|
2530
|
-
let
|
|
2531
|
-
t.handleOrigin === "top-left" ? (
|
|
2529
|
+
const s = (e == null ? void 0 : e.width) !== void 0 ? e.width : ((I = t.geometry) == null ? void 0 : I.width) ?? t.width ?? 100, n = (e == null ? void 0 : e.height) !== void 0 ? e.height : ((M = t.geometry) == null ? void 0 : M.height) ?? t.height ?? 100, a = this.getWorldTransform(t.id), r = i - a.x, c = o - a.y, f = -a.rotation * (Math.PI / 180), h = Math.cos(f), u = Math.sin(f);
|
|
2530
|
+
let l = (r * h - c * u) / Math.max(1e-3, Math.abs(a.scaleX || 1)), d = (r * u + c * h) / Math.max(1e-3, Math.abs(a.scaleY || 1));
|
|
2531
|
+
t.handleOrigin === "top-left" ? (l -= s / 2, d -= n / 2) : t.handleOrigin === "bottom-right" && (l += s / 2, d += n / 2);
|
|
2532
2532
|
const p = Math.min(s, n) * 0.45, y = Math.min(s, n) * 0.15, b = p - y;
|
|
2533
|
-
let m =
|
|
2533
|
+
let m = l / b, v = d / b;
|
|
2534
2534
|
const S = Math.sqrt(m * m + v * v);
|
|
2535
2535
|
t.boundsShape === "square" ? (m = Math.max(-1, Math.min(1, m)), v = Math.max(-1, Math.min(1, v))) : S > 1 && (m /= S, v /= S), t.deadzone !== void 0 && S < t.deadzone ? (m = 0, v = 0) : (t.stepX !== void 0 && t.stepX > 0 && (m = Math.round(m / t.stepX) * t.stepX), t.stepY !== void 0 && t.stepY > 0 && (v = Math.round(v / t.stepY) * t.stepY)), t.joystickType === "1D_X" ? v = 0 : t.joystickType === "1D_Y" && (m = 0);
|
|
2536
2536
|
const C = e.handleX, w = e.handleY;
|
|
@@ -2544,49 +2544,49 @@ class ci {
|
|
|
2544
2544
|
if (!e) return;
|
|
2545
2545
|
let s = e.handleX ?? o.handleX ?? 0, n = e.handleY ?? o.handleY ?? 0;
|
|
2546
2546
|
if (((a = o.inputBinding) == null ? void 0 : a.type) === "keyboard" && o.inputBinding.keyboardConfig) {
|
|
2547
|
-
const
|
|
2547
|
+
const c = o.inputBinding.keyboardConfig;
|
|
2548
2548
|
let f = s, h = n;
|
|
2549
|
-
const
|
|
2549
|
+
const l = (c.speed || 5) * t;
|
|
2550
2550
|
let d = !1;
|
|
2551
|
-
this.activeKeys.has(
|
|
2551
|
+
this.activeKeys.has(c.upKey.toLowerCase()) && (h -= l, d = !0), this.activeKeys.has(c.downKey.toLowerCase()) && (h += l, d = !0), this.activeKeys.has(c.leftKey.toLowerCase()) && (f -= l, d = !0), this.activeKeys.has(c.rightKey.toLowerCase()) && (f += l, d = !0), o.joystickType === "1D_X" && (h = 0), o.joystickType === "1D_Y" && (f = 0);
|
|
2552
2552
|
const p = Math.sqrt(f * f + h * h);
|
|
2553
2553
|
p > 1 && (f /= p, h /= p), !d && o.isSpringReturn !== !1 && (f += (0 - f) * (10 * t), h += (0 - h) * (10 * t), Math.abs(f) < 0.01 && (f = 0), Math.abs(h) < 0.01 && (h = 0)), s = f, n = h;
|
|
2554
2554
|
} else if (((r = o.inputBinding) == null ? void 0 : r.type) === "mouse" && o.inputBinding.mouseConfig) {
|
|
2555
|
-
const
|
|
2555
|
+
const c = o.inputBinding.mouseConfig;
|
|
2556
2556
|
let f = s, h = n;
|
|
2557
|
-
const u =
|
|
2558
|
-
|
|
2557
|
+
const u = c.sensitivity || 0.01, l = Math.abs(this._mouseDelta.dx) > 0 || Math.abs(this._mouseDelta.dy) > 0;
|
|
2558
|
+
c.axisX && (f += this._mouseDelta.dx * u), c.axisY && (h += this._mouseDelta.dy * u), o.joystickType === "1D_X" && (h = 0), o.joystickType === "1D_Y" && (f = 0);
|
|
2559
2559
|
const d = Math.sqrt(f * f + h * h);
|
|
2560
|
-
d > 1 && (f /= d, h /= d), !
|
|
2560
|
+
d > 1 && (f /= d, h /= d), !l && o.isSpringReturn !== !1 && (f += (0 - f) * (10 * t), h += (0 - h) * (10 * t), Math.abs(f) < 0.01 && (f = 0), Math.abs(h) < 0.01 && (h = 0)), s = f, n = h;
|
|
2561
2561
|
}
|
|
2562
2562
|
if (e.handleX = s, e.handleY = n, o.handleX = s, o.handleY = n, o.bindings && o.bindings.length > 0) {
|
|
2563
|
-
const
|
|
2563
|
+
const c = Math.sqrt(s * s + n * n);
|
|
2564
2564
|
let f = Math.atan2(n, s) * (180 / Math.PI);
|
|
2565
2565
|
f < 0 && (f += 360), o.bindings.forEach((h) => {
|
|
2566
2566
|
var d, p, y, b, m, v, S, C;
|
|
2567
2567
|
let u = 0;
|
|
2568
|
-
h.sourceAxis === "x" ? u = o.invertX ? -s : s : h.sourceAxis === "y" ? u = o.invertY ? -n : n : h.sourceAxis === "distance" ? u =
|
|
2569
|
-
const
|
|
2570
|
-
if (
|
|
2568
|
+
h.sourceAxis === "x" ? u = o.invertX ? -s : s : h.sourceAxis === "y" ? u = o.invertY ? -n : n : h.sourceAxis === "distance" ? u = c : h.sourceAxis === "angle" && (u = f);
|
|
2569
|
+
const l = (d = this.artboard) == null ? void 0 : d.objects.find((w) => w.id === h.targetObjectId);
|
|
2570
|
+
if (l) {
|
|
2571
2571
|
if (h.actionType === "bind" && h.targetProperty && h.isContinuous !== !1) {
|
|
2572
|
-
const w = h.sourceMin ?? -1,
|
|
2572
|
+
const w = h.sourceMin ?? -1, I = h.sourceMax ?? 1, M = h.targetMin ?? 0, k = h.targetMax ?? 100;
|
|
2573
2573
|
let T = !!h.isContinuous, R = 0, P = 0;
|
|
2574
2574
|
if (T) {
|
|
2575
|
-
if ((h.sourceAxis === "x" || h.sourceAxis === "y") &&
|
|
2576
|
-
const E = Math.max(Math.abs(w), Math.abs(
|
|
2575
|
+
if ((h.sourceAxis === "x" || h.sourceAxis === "y") && M >= 0) {
|
|
2576
|
+
const E = Math.max(Math.abs(w), Math.abs(I)) || 1;
|
|
2577
2577
|
P = u / E * k;
|
|
2578
2578
|
} else {
|
|
2579
|
-
let E = (u - w) / (
|
|
2580
|
-
E = Math.max(0, Math.min(1, E)), P =
|
|
2579
|
+
let E = (u - w) / (I - w);
|
|
2580
|
+
E = Math.max(0, Math.min(1, E)), P = M + E * (k - M);
|
|
2581
2581
|
}
|
|
2582
2582
|
Math.abs(u) < 0.05 && (P = 0);
|
|
2583
2583
|
} else {
|
|
2584
|
-
const E = (u - w) / (
|
|
2585
|
-
R =
|
|
2584
|
+
const E = (u - w) / (I - w), A = Math.max(0, Math.min(1, E));
|
|
2585
|
+
R = M + A * (k - M), h.step && h.step > 0 && (R = Math.round(R / h.step) * h.step);
|
|
2586
2586
|
}
|
|
2587
|
-
const _ = this.objectStates.get(
|
|
2587
|
+
const _ = this.objectStates.get(l.id);
|
|
2588
2588
|
if (_) {
|
|
2589
|
-
const E = h.isRelative !== !1, A = E ? ((p =
|
|
2589
|
+
const E = h.isRelative !== !1, A = E ? ((p = l.transform) == null ? void 0 : p.x) ?? 0 : 0, W = E ? ((y = l.transform) == null ? void 0 : y.y) ?? 0 : 0, z = E ? ((b = l.transform) == null ? void 0 : b.rotation) ?? 0 : 0, Y = E ? ((m = l.transform) == null ? void 0 : m.scale_x) ?? 1 : 0, G = E ? ((v = l.transform) == null ? void 0 : v.scale_y) ?? 1 : 0, N = E ? ((S = l.style) == null ? void 0 : S.opacity) ?? 100 : 0, J = t * 60, x = (F, j) => {
|
|
2590
2590
|
let X = R;
|
|
2591
2591
|
if (T) {
|
|
2592
2592
|
const tt = `_internal_${F}_${h.id}`;
|
|
@@ -2598,14 +2598,14 @@ class ci {
|
|
|
2598
2598
|
};
|
|
2599
2599
|
h.targetProperty === "x" || h.targetProperty === "transform.x" ? x("x", A) : h.targetProperty === "y" || h.targetProperty === "transform.y" ? x("y", W) : h.targetProperty === "rotation" || h.targetProperty === "r" || h.targetProperty === "transform.rotation" ? x("rotation", z) : h.targetProperty === "scaleX" || h.targetProperty === "transform.scale_x" ? x("scale_x", Y) : h.targetProperty === "scaleY" || h.targetProperty === "transform.scale_y" ? x("scale_y", G) : (h.targetProperty === "opacity" || h.targetProperty === "transform.opacity") && x("opacity", N);
|
|
2600
2600
|
}
|
|
2601
|
-
(C =
|
|
2601
|
+
(C = l.physics) != null && C.enabled && this.physicsEngine && (h.targetProperty === "x" || h.targetProperty === "transform.x" || h.targetProperty === "y" || h.targetProperty === "transform.y") && (h.targetProperty === "x" || h.targetProperty === "transform.x" ? this.physicsEngine.applyForce(l.id, (R - ((_ == null ? void 0 : _.x) || 0)) * 10, 0) : (h.targetProperty === "y" || h.targetProperty === "transform.y") && this.physicsEngine.applyForce(l.id, 0, (R - ((_ == null ? void 0 : _.y) || 0)) * 10));
|
|
2602
2602
|
} else if (h.actionType === "playAnimation" || h.actionType === "stopAnimation" || h.actionType === "pauseAnimation") {
|
|
2603
2603
|
let w = !1;
|
|
2604
|
-
const
|
|
2605
|
-
h.condition === "always" ? w = !0 : h.condition === ">" ? w = u >
|
|
2606
|
-
const
|
|
2604
|
+
const I = h.threshold ?? 0;
|
|
2605
|
+
h.condition === "always" ? w = !0 : h.condition === ">" ? w = u > I : h.condition === "<" ? w = u < I : h.condition === "==" && (w = Math.abs(u - I) < 0.01);
|
|
2606
|
+
const M = e[`_prev_src_${h.id}`] ?? u;
|
|
2607
2607
|
let k = !1;
|
|
2608
|
-
h.condition === "always" ? k = !0 : h.condition === ">" ? k =
|
|
2608
|
+
h.condition === "always" ? k = !0 : h.condition === ">" ? k = M > I : h.condition === "<" ? k = M < I : h.condition === "==" && (k = Math.abs(M - I) < 0.01), e[`_prev_src_${h.id}`] = u, w && !k && h.targetAnimationId && (h.actionType === "playAnimation" || h.actionType);
|
|
2609
2609
|
}
|
|
2610
2610
|
}
|
|
2611
2611
|
});
|
|
@@ -2613,7 +2613,7 @@ class ci {
|
|
|
2613
2613
|
}), this._mouseDelta.dx = 0, this._mouseDelta.dy = 0);
|
|
2614
2614
|
}
|
|
2615
2615
|
applyBlendState(t, i) {
|
|
2616
|
-
var
|
|
2616
|
+
var c, f, h, u, l, d, p, y;
|
|
2617
2617
|
if (!t.blendAnimations || t.blendAnimations.length === 0) return;
|
|
2618
2618
|
let o = 0, e = 0;
|
|
2619
2619
|
t.blendInputX && (o = this.inputs.get(t.blendInputX) ?? 0), t.blendInputY && (e = this.inputs.get(t.blendInputY) ?? 0);
|
|
@@ -2622,7 +2622,7 @@ class ci {
|
|
|
2622
2622
|
if (t.blendType === "1D") {
|
|
2623
2623
|
const b = [...t.blendAnimations].sort((m, v) => m.position[0] - v.position[0]);
|
|
2624
2624
|
if (b.length === 1) {
|
|
2625
|
-
const m = (f = (
|
|
2625
|
+
const m = (f = (c = this.artboard) == null ? void 0 : c.animations) == null ? void 0 : f.find((v) => v.id === b[0].animationId);
|
|
2626
2626
|
m && (s.push({ anim: m, weight: 1 }), n = 1);
|
|
2627
2627
|
} else {
|
|
2628
2628
|
let m = 0;
|
|
@@ -2632,24 +2632,24 @@ class ci {
|
|
|
2632
2632
|
const v = (u = (h = this.artboard) == null ? void 0 : h.animations) == null ? void 0 : u.find((S) => S.id === b[m].animationId);
|
|
2633
2633
|
v && (s.push({ anim: v, weight: 1 }), n = 1);
|
|
2634
2634
|
} else {
|
|
2635
|
-
const v = b[m].position[0], S = b[m + 1].position[0], C = (d = (
|
|
2636
|
-
let
|
|
2637
|
-
|
|
2638
|
-
const k = 1 -
|
|
2639
|
-
C && (s.push({ anim: C, weight: k }), n += k), w && (s.push({ anim: w, weight:
|
|
2635
|
+
const v = b[m].position[0], S = b[m + 1].position[0], C = (d = (l = this.artboard) == null ? void 0 : l.animations) == null ? void 0 : d.find((T) => T.id === b[m].animationId), w = (y = (p = this.artboard) == null ? void 0 : p.animations) == null ? void 0 : y.find((T) => T.id === b[m + 1].animationId), I = Math.max(1e-3, S - v);
|
|
2636
|
+
let M = (o - v) / I;
|
|
2637
|
+
M = Math.max(0, Math.min(1, M));
|
|
2638
|
+
const k = 1 - M;
|
|
2639
|
+
C && (s.push({ anim: C, weight: k }), n += k), w && (s.push({ anim: w, weight: M }), n += M);
|
|
2640
2640
|
}
|
|
2641
2641
|
}
|
|
2642
2642
|
} else
|
|
2643
2643
|
t.blendAnimations.forEach((b) => {
|
|
2644
|
-
var w,
|
|
2645
|
-
const m = (
|
|
2644
|
+
var w, I;
|
|
2645
|
+
const m = (I = (w = this.artboard) == null ? void 0 : w.animations) == null ? void 0 : I.find((M) => M.id === b.animationId);
|
|
2646
2646
|
if (!m) return;
|
|
2647
2647
|
const v = b.position[0] - o, S = b.position[1] - e, C = v * v + S * S;
|
|
2648
2648
|
if (C < 1e-4)
|
|
2649
2649
|
s.push({ anim: m, weight: 1e4 }), n += 1e4;
|
|
2650
2650
|
else {
|
|
2651
|
-
const
|
|
2652
|
-
s.push({ anim: m, weight:
|
|
2651
|
+
const M = 1 / C;
|
|
2652
|
+
s.push({ anim: m, weight: M }), n += M;
|
|
2653
2653
|
}
|
|
2654
2654
|
});
|
|
2655
2655
|
if (n === 0) return;
|
|
@@ -2663,38 +2663,38 @@ class ci {
|
|
|
2663
2663
|
var R, P;
|
|
2664
2664
|
const S = v.object_id || v.objectId, C = v.property, w = (R = this.artboard) == null ? void 0 : R.objects.find((_) => _.id === S);
|
|
2665
2665
|
if (((P = w == null ? void 0 : w.physics) == null ? void 0 : P.enabled) && w.physics.bodyType !== "Static" && (C === "x" || C === "y" || C === "rotation")) return;
|
|
2666
|
-
const
|
|
2667
|
-
if (
|
|
2666
|
+
const M = this.interpolate(v.keyframes, i);
|
|
2667
|
+
if (M === void 0) return;
|
|
2668
2668
|
let k = a.get(S);
|
|
2669
2669
|
k || (k = /* @__PURE__ */ new Map(), a.set(S, k));
|
|
2670
2670
|
let T = k.get(C);
|
|
2671
2671
|
if (!T) {
|
|
2672
|
-
if (typeof
|
|
2672
|
+
if (typeof M == "number")
|
|
2673
2673
|
T = { type: "number", value: 0 };
|
|
2674
|
-
else if (typeof
|
|
2675
|
-
T = { type: "color", value:
|
|
2676
|
-
else if (T = { type: "number", value:
|
|
2674
|
+
else if (typeof M == "string" && M.startsWith("#"))
|
|
2675
|
+
T = { type: "color", value: M, colorAcc: { r: 0, g: 0, b: 0, a: 0 } };
|
|
2676
|
+
else if (T = { type: "number", value: M }, m < 0.5) return;
|
|
2677
2677
|
k.set(C, T);
|
|
2678
2678
|
}
|
|
2679
|
-
if (T.type === "number" && typeof
|
|
2680
|
-
T.value +=
|
|
2681
|
-
else if (T.type === "color" && typeof
|
|
2682
|
-
const _ = r(
|
|
2679
|
+
if (T.type === "number" && typeof M == "number")
|
|
2680
|
+
T.value += M * m;
|
|
2681
|
+
else if (T.type === "color" && typeof M == "string" && T.colorAcc) {
|
|
2682
|
+
const _ = r(M);
|
|
2683
2683
|
_ && (T.colorAcc.r += _.r * m, T.colorAcc.g += _.g * m, T.colorAcc.b += _.b * m, T.colorAcc.a += _.a * m);
|
|
2684
2684
|
} else
|
|
2685
|
-
m > 0.5 && (T.value =
|
|
2685
|
+
m > 0.5 && (T.value = M);
|
|
2686
2686
|
});
|
|
2687
2687
|
}), a.forEach((b, m) => {
|
|
2688
2688
|
var C;
|
|
2689
2689
|
const v = this.objectStates.get(m), S = (C = this.artboard) == null ? void 0 : C.objects.find((w) => w.id === m);
|
|
2690
|
-
!v || !S || b.forEach((w,
|
|
2691
|
-
let
|
|
2690
|
+
!v || !S || b.forEach((w, I) => {
|
|
2691
|
+
let M = w.value;
|
|
2692
2692
|
if (w.type === "color" && w.colorAcc) {
|
|
2693
2693
|
const k = Math.round(w.colorAcc.r).toString(16).padStart(2, "0"), T = Math.round(w.colorAcc.g).toString(16).padStart(2, "0"), R = Math.round(w.colorAcc.b).toString(16).padStart(2, "0");
|
|
2694
|
-
|
|
2694
|
+
M = `#${k}${T}${R}`;
|
|
2695
2695
|
}
|
|
2696
|
-
if (
|
|
2697
|
-
const k = (
|
|
2696
|
+
if (I.includes(".")) {
|
|
2697
|
+
const k = (I || "").split(".");
|
|
2698
2698
|
let T = v;
|
|
2699
2699
|
for (let R = 0; R < k.length - 1; R++) {
|
|
2700
2700
|
if (typeof T[k[R]] != "object" || T[k[R]] === null) {
|
|
@@ -2709,15 +2709,15 @@ class ci {
|
|
|
2709
2709
|
}
|
|
2710
2710
|
T = T[k[R]];
|
|
2711
2711
|
}
|
|
2712
|
-
T[k[k.length - 1]] =
|
|
2712
|
+
T[k[k.length - 1]] = M, k[k.length - 1] === "color" && (k[k.length - 2] === "fill" || k[k.length - 2] === "stroke") && (T.type = "Solid");
|
|
2713
2713
|
} else
|
|
2714
|
-
|
|
2714
|
+
I === "fill" ? (v.style || (v.style = {}), v.style.fill = M) : I === "stroke" ? (v.style || (v.style = {}), v.style.stroke = M) : v[I] = M;
|
|
2715
2715
|
});
|
|
2716
2716
|
});
|
|
2717
2717
|
}
|
|
2718
2718
|
applyAnimation(t, i, o) {
|
|
2719
2719
|
!t || !t.tracks || t.tracks.forEach((e) => {
|
|
2720
|
-
var h, u,
|
|
2720
|
+
var h, u, l;
|
|
2721
2721
|
const s = e.object_id || e.objectId;
|
|
2722
2722
|
if (o) {
|
|
2723
2723
|
if (Array.isArray(o)) {
|
|
@@ -2729,8 +2729,8 @@ class ci {
|
|
|
2729
2729
|
let r = e.property;
|
|
2730
2730
|
if (a && (r === "x" || r === "y" || r === "rotation"))
|
|
2731
2731
|
return;
|
|
2732
|
-
const
|
|
2733
|
-
if (!
|
|
2732
|
+
const c = this.objectStates.get(s);
|
|
2733
|
+
if (!c) {
|
|
2734
2734
|
this.frameCount % 600 === 0 && this.debugLog(`Skipping track: Object ${s} not found in state`);
|
|
2735
2735
|
return;
|
|
2736
2736
|
}
|
|
@@ -2742,7 +2742,7 @@ class ci {
|
|
|
2742
2742
|
}
|
|
2743
2743
|
if (r.includes(".")) {
|
|
2744
2744
|
const d = (r || "").split(".");
|
|
2745
|
-
let p =
|
|
2745
|
+
let p = c;
|
|
2746
2746
|
for (let y = 0; y < d.length - 1; y++) {
|
|
2747
2747
|
if (typeof p[d[y]] != "object" || p[d[y]] === null) {
|
|
2748
2748
|
let b = n;
|
|
@@ -2758,8 +2758,8 @@ class ci {
|
|
|
2758
2758
|
}
|
|
2759
2759
|
p[d[d.length - 1]] = f, d[d.length - 1] === "color" && (d[d.length - 2] === "fill" || d[d.length - 2] === "stroke") && (p.type = "Solid");
|
|
2760
2760
|
} else
|
|
2761
|
-
r === "fill" ? (
|
|
2762
|
-
if (this.physicsEngine && ((
|
|
2761
|
+
r === "fill" ? (c.style || (c.style = {}), c.style.fill = f) : r === "stroke" ? (c.style || (c.style = {}), c.style.stroke = f) : c[r] = f;
|
|
2762
|
+
if (this.physicsEngine && ((l = n == null ? void 0 : n.physics) != null && l.enabled) && n.physics.bodyType === "Static")
|
|
2763
2763
|
if (r === "x") {
|
|
2764
2764
|
const d = this.physicsEngine.getPosition(s);
|
|
2765
2765
|
d && this.physicsEngine.setPosition(s, f, d.y);
|
|
@@ -2790,8 +2790,8 @@ class ci {
|
|
|
2790
2790
|
}
|
|
2791
2791
|
if (Array.isArray(o.value) && Array.isArray(e.value))
|
|
2792
2792
|
return o.value.length === e.value.length ? o.value.map((a, r) => {
|
|
2793
|
-
const
|
|
2794
|
-
return typeof a == "number" && typeof
|
|
2793
|
+
const c = e.value[r];
|
|
2794
|
+
return typeof a == "number" && typeof c == "number" ? a + (c - a) * n : n < 0.5 ? a : c;
|
|
2795
2795
|
}) : n < 0.5 ? o.value : e.value;
|
|
2796
2796
|
if (typeof o.value == "object" && typeof e.value == "object" && o.value !== null && e.value !== null) {
|
|
2797
2797
|
if (o.value.width !== void 0 && o.value.color !== void 0)
|
|
@@ -2799,9 +2799,9 @@ class ci {
|
|
|
2799
2799
|
if (o.value.type && e.value.type)
|
|
2800
2800
|
return this.interpolateFill(o.value, e.value, n);
|
|
2801
2801
|
const a = {};
|
|
2802
|
-
return (/* @__PURE__ */ new Set([...Object.keys(o.value), ...Object.keys(e.value)])).forEach((
|
|
2803
|
-
const f = o.value[
|
|
2804
|
-
typeof f == "number" && typeof h == "number" ? a[
|
|
2802
|
+
return (/* @__PURE__ */ new Set([...Object.keys(o.value), ...Object.keys(e.value)])).forEach((c) => {
|
|
2803
|
+
const f = o.value[c], h = e.value[c];
|
|
2804
|
+
typeof f == "number" && typeof h == "number" ? a[c] = f + (h - f) * n : f === void 0 ? a[c] = h : h === void 0 ? a[c] = f : a[c] = n < 0.5 ? f : h;
|
|
2805
2805
|
}), a;
|
|
2806
2806
|
}
|
|
2807
2807
|
return typeof o.value == "number" && typeof e.value == "number" ? o.value + (e.value - o.value) * n : n < 0.5 ? o.value : e.value;
|
|
@@ -2820,11 +2820,11 @@ class ci {
|
|
|
2820
2820
|
g: parseInt(b.substring(2, 4), 16),
|
|
2821
2821
|
b: parseInt(b.substring(4, 6), 16)
|
|
2822
2822
|
};
|
|
2823
|
-
}, r = a(s),
|
|
2823
|
+
}, r = a(s), c = a(n), f = Math.round(r.r + (c.r - r.r) * o), h = Math.round(r.g + (c.g - r.g) * o), u = Math.round(r.b + (c.b - r.b) * o), l = (y) => {
|
|
2824
2824
|
const b = Math.max(0, Math.min(255, y)).toString(16);
|
|
2825
2825
|
return b.length === 1 ? "0" + b : b;
|
|
2826
2826
|
};
|
|
2827
|
-
return `#${
|
|
2827
|
+
return `#${l(f)}${l(h)}${l(u)}`;
|
|
2828
2828
|
}
|
|
2829
2829
|
interpolateStops(t, i, o) {
|
|
2830
2830
|
return !t || !i || t.length !== i.length ? o < 0.5 ? t : i : t.map((e, s) => {
|
|
@@ -2872,63 +2872,63 @@ class ci {
|
|
|
2872
2872
|
);
|
|
2873
2873
|
if (t.save(), t.translate(Math.round(a.tx), Math.round(a.ty)), t.scale(a.scaleX, a.scaleY), this.rootTransform = t.getTransform(), this.artboard.backgroundVisible !== !1 && (t.fillStyle = this.artboard.backgroundColor || "#000000", t.fillRect(0, 0, s, n)), this.artboard.backgroundImage) {
|
|
2874
2874
|
const u = this.artboard.backgroundImage;
|
|
2875
|
-
let
|
|
2876
|
-
if (
|
|
2875
|
+
let l = this.imageCache.get(u);
|
|
2876
|
+
if (l || (l = new Image(), l.src = u, this.imageCache.set(u, l)), l.complete && l.naturalWidth > 0) {
|
|
2877
2877
|
t.save(), t.globalAlpha = this.normalizeOpacity(this.artboard.backgroundOpacity ?? 100);
|
|
2878
|
-
const d =
|
|
2878
|
+
const d = l.naturalWidth / l.naturalHeight, p = s / n;
|
|
2879
2879
|
let y, b, m, v;
|
|
2880
|
-
p > d ? (y = s, b = s / d) : (b = n, y = n * d), m = (s - y) / 2, v = (n - b) / 2, t.drawImage(
|
|
2880
|
+
p > d ? (y = s, b = s / d) : (b = n, y = n * d), m = (s - y) / 2, v = (n - b) / 2, t.drawImage(l, m, v, y, b), t.restore();
|
|
2881
2881
|
}
|
|
2882
2882
|
}
|
|
2883
2883
|
(this.artboard.clipContent === !0 || this.artboard.clip_content === !0) && (t.beginPath(), t.rect(0, 0, s, n), t.clip());
|
|
2884
|
-
const
|
|
2885
|
-
this.artboard.objects.forEach((u) =>
|
|
2886
|
-
const d = this.objectStates.get(u.id), p = (d == null ? void 0 : d.zIndex) ??
|
|
2884
|
+
const c = /* @__PURE__ */ new Map();
|
|
2885
|
+
this.artboard.objects.forEach((u) => c.set(u.id, u)), this.artboard.objects.filter((u) => !u.parentId).map((u, l) => {
|
|
2886
|
+
const d = this.objectStates.get(u.id), p = (d == null ? void 0 : d.zIndex) ?? l;
|
|
2887
2887
|
return { obj: u, zIndex: p };
|
|
2888
|
-
}).sort((u,
|
|
2889
|
-
this.renderObject(t, u,
|
|
2890
|
-
}), this._emitterPools.forEach((u,
|
|
2891
|
-
if (!(u.length === 0 || !
|
|
2888
|
+
}).sort((u, l) => u.zIndex - l.zIndex).forEach(({ obj: u }) => {
|
|
2889
|
+
this.renderObject(t, u, c);
|
|
2890
|
+
}), this._emitterPools.forEach((u, l) => {
|
|
2891
|
+
if (!(u.length === 0 || !c.get(l)))
|
|
2892
2892
|
for (const p of u)
|
|
2893
2893
|
t.save(), t.globalAlpha = p.opacity, t.fillStyle = p.color, t.beginPath(), t.arc(p.x, p.y, Math.max(1, p.size * p.opacity), 0, Math.PI * 2), t.fill(), t.restore();
|
|
2894
2894
|
}), this.lastRenderTime = performance.now() - e, this.debugMode && this.frameCount % 60 === 0 && this.log(`[Engine Debug] Rendered ${this.debug_objectsRendered}/${this.debug_objectsTotal} objects in ${this.lastRenderTime.toFixed(2)}ms`), t.restore();
|
|
2895
2895
|
}
|
|
2896
2896
|
isObjectInView(t, i, o, e, s, n = 0) {
|
|
2897
|
-
const a = t.getTransform(), r = i * a.a + o * a.c + a.e,
|
|
2898
|
-
return r + u >= 0 && r - u <= this.canvasWidth &&
|
|
2897
|
+
const a = t.getTransform(), r = i * a.a + o * a.c + a.e, c = i * a.b + o * a.d + a.f, f = Math.sqrt(a.a * a.a + a.b * a.b), h = Math.sqrt(a.c * a.c + a.d * a.d), u = (e / 2 + n) * f, l = (s / 2 + n) * h;
|
|
2898
|
+
return r + u >= 0 && r - u <= this.canvasWidth && c + l >= 0 && c - l <= this.canvasHeight;
|
|
2899
2899
|
}
|
|
2900
2900
|
calculateTransform(t, i, o, e, s, n) {
|
|
2901
|
-
let a = 1, r = 1,
|
|
2901
|
+
let a = 1, r = 1, c = 1;
|
|
2902
2902
|
const f = o / e, h = t / i;
|
|
2903
2903
|
switch (s) {
|
|
2904
2904
|
case "Contain":
|
|
2905
|
-
h > f ?
|
|
2905
|
+
h > f ? c = i / e : c = t / o, a = r = c;
|
|
2906
2906
|
break;
|
|
2907
2907
|
case "Cover":
|
|
2908
|
-
h > f ?
|
|
2908
|
+
h > f ? c = t / o : c = i / e, a = r = c;
|
|
2909
2909
|
break;
|
|
2910
2910
|
case "Fill":
|
|
2911
2911
|
a = t / o, r = i / e;
|
|
2912
2912
|
break;
|
|
2913
2913
|
case "FitWidth":
|
|
2914
|
-
|
|
2914
|
+
c = t / o, a = r = c;
|
|
2915
2915
|
break;
|
|
2916
2916
|
case "FitHeight":
|
|
2917
|
-
|
|
2917
|
+
c = i / e, a = r = c;
|
|
2918
2918
|
break;
|
|
2919
2919
|
case "None":
|
|
2920
2920
|
a = r = 1;
|
|
2921
2921
|
break;
|
|
2922
2922
|
case "ScaleDown":
|
|
2923
|
-
|
|
2923
|
+
c = Math.min(t / o, i / e), c > 1 && (c = 1), a = r = c;
|
|
2924
2924
|
break;
|
|
2925
2925
|
default:
|
|
2926
2926
|
a = r = 1;
|
|
2927
2927
|
break;
|
|
2928
2928
|
}
|
|
2929
|
-
const u = o * a,
|
|
2929
|
+
const u = o * a, l = e * r;
|
|
2930
2930
|
let d = 0, p = 0;
|
|
2931
|
-
return n.includes("Left") ? d = 0 : n.includes("Right") ? d = t - u : d = (t - u) / 2, n.includes("Top") ? p = 0 : n.includes("Bottom") ? p = i -
|
|
2931
|
+
return n.includes("Left") ? d = 0 : n.includes("Right") ? d = t - u : d = (t - u) / 2, n.includes("Top") ? p = 0 : n.includes("Bottom") ? p = i - l : p = (i - l) / 2, { scaleX: a, scaleY: r, tx: d, ty: p };
|
|
2932
2932
|
}
|
|
2933
2933
|
mapFontWeight(t) {
|
|
2934
2934
|
const i = t.toLowerCase();
|
|
@@ -2950,7 +2950,7 @@ class ci {
|
|
|
2950
2950
|
}
|
|
2951
2951
|
*/
|
|
2952
2952
|
renderObject(t, i, o) {
|
|
2953
|
-
var p, y, b, m, v, S, C, w,
|
|
2953
|
+
var p, y, b, m, v, S, C, w, I, M, k, T, R, P, _, E, A, W, z, Y, G, N, J, x, F, j;
|
|
2954
2954
|
const e = this.objectStates.get(i.id);
|
|
2955
2955
|
if (!e) {
|
|
2956
2956
|
this.warn("No state for object:", i.id);
|
|
@@ -2965,10 +2965,10 @@ class ci {
|
|
|
2965
2965
|
X = Math.min(X, D.x), tt = Math.max(tt, D.x), L = Math.min(L, D.y), O = Math.max(O, D.y);
|
|
2966
2966
|
}), a === 0 && (a = tt - X), r === 0 && (r = O - L);
|
|
2967
2967
|
}
|
|
2968
|
-
const
|
|
2968
|
+
const c = (X) => {
|
|
2969
2969
|
if (X)
|
|
2970
2970
|
return X.corner_radius ?? X.cornerRadius;
|
|
2971
|
-
}, f =
|
|
2971
|
+
}, f = c(e) ?? c(n) ?? c(s) ?? c(i.style) ?? c(i.geometry) ?? 0;
|
|
2972
2972
|
let h = { ...s, width: a, height: r };
|
|
2973
2973
|
if (delete h.cornerRadius, h.corner_radius = f, h.type === "Path" && i.weights && i.bindMatrices && h.points) {
|
|
2974
2974
|
const X = this.getGlobalTransform(i.id);
|
|
@@ -2985,10 +2985,10 @@ class ci {
|
|
|
2985
2985
|
}
|
|
2986
2986
|
if (e.visible === !1)
|
|
2987
2987
|
return;
|
|
2988
|
-
const u = i.repeaterConfig,
|
|
2988
|
+
const u = i.repeaterConfig, l = u && u.isEnabled && u.count > 1, d = l ? u.count : 1;
|
|
2989
2989
|
for (let X = 0; X < d; X++) {
|
|
2990
2990
|
let tt = e.x !== void 0 ? e.x : ((b = e.transform) == null ? void 0 : b.x) ?? 0, L = e.y !== void 0 ? e.y : ((m = e.transform) == null ? void 0 : m.y) ?? 0, O = e.rotation !== void 0 ? e.rotation : ((v = e.transform) == null ? void 0 : v.rotation) ?? 0, D = e.scale_x !== void 0 ? e.scale_x : ((S = e.transform) == null ? void 0 : S.scale_x) ?? 1, q = e.scale_y !== void 0 ? e.scale_y : ((C = e.transform) == null ? void 0 : C.scale_y) ?? 1;
|
|
2991
|
-
if (
|
|
2991
|
+
if (l && X > 0) {
|
|
2992
2992
|
if (u.type === "Linear") {
|
|
2993
2993
|
const ht = u.offsetX || 0, ut = u.offsetY || 0, at = u.rotation || 0, B = u.scale !== void 0 ? u.scale : 1;
|
|
2994
2994
|
tt += X * ht, L += X * ut, O += X * at, D *= Math.pow(B, X), q *= Math.pow(B, X);
|
|
@@ -3002,7 +3002,7 @@ class ci {
|
|
|
3002
3002
|
}
|
|
3003
3003
|
const ot = i.type === "Group" || i.type === "Frame" || i.type === "Component", yt = a > 0 && r > 0;
|
|
3004
3004
|
if (!ot && yt) {
|
|
3005
|
-
const ht = (((w = n.shadow) == null ? void 0 : w.isEnabled) !== !1 ? (((
|
|
3005
|
+
const ht = (((w = n.shadow) == null ? void 0 : w.isEnabled) !== !1 ? (((I = n.shadow) == null ? void 0 : I.blur) || 0) + 10 : 0) + (((M = n.blur) == null ? void 0 : M.isEnabled) !== !1 && ((k = n.blur) == null ? void 0 : k.radius) || 0) + 20;
|
|
3006
3006
|
if (!this.isObjectInView(t, tt, L, a, r, ht))
|
|
3007
3007
|
continue;
|
|
3008
3008
|
}
|
|
@@ -3491,7 +3491,7 @@ class ci {
|
|
|
3491
3491
|
t.restore();
|
|
3492
3492
|
}
|
|
3493
3493
|
}
|
|
3494
|
-
_renderText(t, i, o, e, s, n, a, r = !1,
|
|
3494
|
+
_renderText(t, i, o, e, s, n, a, r = !1, c = !1, f = 1, h = 1) {
|
|
3495
3495
|
var yt, bt, gt, Et, It, vt, Yt, ie, fe;
|
|
3496
3496
|
let u = o.text || "";
|
|
3497
3497
|
if (o.textInputId && !r) {
|
|
@@ -3507,10 +3507,10 @@ class ci {
|
|
|
3507
3507
|
t.fill(_t), t.restore();
|
|
3508
3508
|
return;
|
|
3509
3509
|
}
|
|
3510
|
-
let
|
|
3511
|
-
o.enableSegments === !0 && o.segments && Array.isArray(o.segments) && (
|
|
3510
|
+
let l = u || "";
|
|
3511
|
+
o.enableSegments === !0 && o.segments && Array.isArray(o.segments) && (l = o.segments.map((st) => st && st.text ? st.text : "").join(""));
|
|
3512
3512
|
const d = o.textCase || "none";
|
|
3513
|
-
d === "uppercase" ?
|
|
3513
|
+
d === "uppercase" ? l = l.toUpperCase() : d === "lowercase" ? l = l.toLowerCase() : d === "capitalize" && (l = l.replace(/\b\w/g, (st) => st.toUpperCase()));
|
|
3514
3514
|
let p = ((Et = o.fontWeight) == null ? void 0 : Et.toString()) || "400", y = o.fontStyle || "normal";
|
|
3515
3515
|
p.toLowerCase().includes("italic") && (y = "italic", p = p.replace(/italic/gi, "").trim() || "400");
|
|
3516
3516
|
const b = this.mapFontWeight(p), m = Math.max(1, o.fontSize || 32);
|
|
@@ -3520,9 +3520,9 @@ class ci {
|
|
|
3520
3520
|
const mt = new RegExp(`[\\s-]${st}$`, "i");
|
|
3521
3521
|
mt.test(v) && (v = v.replace(mt, "").trim());
|
|
3522
3522
|
});
|
|
3523
|
-
const
|
|
3524
|
-
t.font =
|
|
3525
|
-
const
|
|
3523
|
+
const I = `${o.smallCaps === !0 ? "small-caps " : ""}${y} ${b} ${m}px "${v}", sans-serif`;
|
|
3524
|
+
t.font = I;
|
|
3525
|
+
const M = o.textVerticalAlign || "top";
|
|
3526
3526
|
t.textBaseline = "top";
|
|
3527
3527
|
const k = o.textAlign || "left";
|
|
3528
3528
|
t.textAlign = k;
|
|
@@ -3542,7 +3542,7 @@ class ci {
|
|
|
3542
3542
|
const A = (E || 1.2) * m, W = o.isPointText === !0 || !o.width || o.width <= 0, z = ((It = o.padding) == null ? void 0 : It.left) || ((vt = o.padding) == null ? void 0 : vt.right) || 0, Y = W ? 1e5 : o.width && o.width > 0 ? Math.ceil(o.width) - z * 2 : 1e5;
|
|
3543
3543
|
o.autoHeight;
|
|
3544
3544
|
const G = ps({
|
|
3545
|
-
text:
|
|
3545
|
+
text: l,
|
|
3546
3546
|
fontFamily: v,
|
|
3547
3547
|
fontSize: m,
|
|
3548
3548
|
fontWeight: b,
|
|
@@ -3562,7 +3562,7 @@ class ci {
|
|
|
3562
3562
|
let j = G.height, X = n, tt = a;
|
|
3563
3563
|
if (X === 0 || tt === 0 || X >= 1e5) {
|
|
3564
3564
|
let st = 0, mt = 0;
|
|
3565
|
-
const Lt = G.fullText ||
|
|
3565
|
+
const Lt = G.fullText || l;
|
|
3566
3566
|
(N || []).forEach((_t) => {
|
|
3567
3567
|
const dt = _t.text || "", Ft = t.measureText(dt).width + (dt.length > 0 ? (dt.length - 1) * T : 0);
|
|
3568
3568
|
Ft > st && (st = Ft), mt += dt.length, mt < Lt.length && (Lt[mt] === `
|
|
@@ -3571,7 +3571,7 @@ class ci {
|
|
|
3571
3571
|
}), (X === 0 || X >= 1e5) && (X = st), tt === 0 && (tt = j || 0);
|
|
3572
3572
|
}
|
|
3573
3573
|
let L = -j / 2;
|
|
3574
|
-
a > 0 && a > j && (
|
|
3574
|
+
a > 0 && a > j && (M === "top" ? L = -a / 2 : M === "middle" || M === "center" ? L = -j / 2 : M === "bottom" && (L = a / 2 - j)), L += F;
|
|
3575
3575
|
let O = null, D = 0;
|
|
3576
3576
|
if (o.pathId && this.artboard) {
|
|
3577
3577
|
const st = this.artboard.objects.find((mt) => mt.id === o.pathId);
|
|
@@ -3610,18 +3610,18 @@ class ci {
|
|
|
3610
3610
|
return Lt - (st.length > 0 ? T : 0);
|
|
3611
3611
|
}, ot = (st, mt, Lt, _t, dt) => {
|
|
3612
3612
|
var me, ye;
|
|
3613
|
-
const Dt = (dt === 0 ||
|
|
3614
|
-
` ||
|
|
3613
|
+
const Dt = (dt === 0 || l[dt - 1] === `
|
|
3614
|
+
` || l[dt - 1] === "\r") && o.paragraphIndent ? o.paragraphIndent : 0, $t = (!r || c) && (i.behaviors || []).some(
|
|
3615
3615
|
(Ut) => Ut.enabled && (Ut.type.toString().includes("Text") || ["Typewriter", "Scramble", "Wave", "Bounce", "GlitchText", "Reveal3D", "RevealSlide", "RevealBlur"].includes(Ut.type))
|
|
3616
3616
|
), Ot = !o.pathId && !$t && (o.enableSegments !== !0 || !o.segments || o.segments.length === 0), Vt = o.baselineShift || 0, ne = Lt + Vt;
|
|
3617
3617
|
if (Ot)
|
|
3618
|
-
t.font =
|
|
3618
|
+
t.font = I, _t ? t.strokeText(st, mt + Dt, ne) : t.fillText(st, mt + Dt, ne);
|
|
3619
3619
|
else {
|
|
3620
3620
|
const Ut = q(st, dt);
|
|
3621
3621
|
let Se = mt + Dt;
|
|
3622
3622
|
k === "center" ? Se -= Ut / 2 : k === "right" && (Se -= Ut);
|
|
3623
|
-
const Pe = dt + st.length >=
|
|
3624
|
-
` ||
|
|
3623
|
+
const Pe = dt + st.length >= l.length || l[dt + st.length] === `
|
|
3624
|
+
` || l[dt + st.length] === "\r";
|
|
3625
3625
|
let Ee = 0, Ce = 0;
|
|
3626
3626
|
const Ae = o.justifyMinWordSpacing, xe = o.justifyMaxWordSpacing;
|
|
3627
3627
|
if (k === "justify" && !Pe && Ut > 0 && !o.pathId) {
|
|
@@ -3637,7 +3637,7 @@ class ci {
|
|
|
3637
3637
|
let se = o.pathOffset || 0;
|
|
3638
3638
|
o.pathId && D > 0 && O && (k === "center" ? se += D / 2 - Ut / 2 : k === "right" && (se += D - Ut));
|
|
3639
3639
|
let jt = Se;
|
|
3640
|
-
const ht = r && !
|
|
3640
|
+
const ht = r && !c ? [] : ((me = i.behaviors) == null ? void 0 : me.filter(
|
|
3641
3641
|
(ut) => [
|
|
3642
3642
|
U.Typewriter,
|
|
3643
3643
|
U.Scramble,
|
|
@@ -3790,7 +3790,7 @@ class ci {
|
|
|
3790
3790
|
Kt = ct.fontSize || m, t.font = `${V} ${rt} ${Kt}px "${Ct}", sans-serif`, ct.fill && ($ = ct.fill), ct.textDecoration && (Wt = ct.textDecoration), Kt < J && (Q += (J - Kt) * 0.85);
|
|
3791
3791
|
}
|
|
3792
3792
|
} else
|
|
3793
|
-
t.font =
|
|
3793
|
+
t.font = I;
|
|
3794
3794
|
const te = t.globalAlpha;
|
|
3795
3795
|
t.globalAlpha *= At, t.save();
|
|
3796
3796
|
const Jt = t.measureText(Mt).width;
|
|
@@ -3799,16 +3799,16 @@ class ci {
|
|
|
3799
3799
|
t.translate(rt.x + St + et, rt.y + Xt), t.rotate(V + kt + (nt === -1 ? Math.PI : 0));
|
|
3800
3800
|
} else
|
|
3801
3801
|
t.translate(jt + et + Jt / 2, Lt + Q), kt !== 0 && t.rotate(kt);
|
|
3802
|
-
if (t.scale(Pt, xt), $ && !r && !
|
|
3802
|
+
if (t.scale(Pt, xt), $ && !r && !c) {
|
|
3803
3803
|
const pt = this.createCanvasFill(t, $, X, tt);
|
|
3804
3804
|
t.fillStyle = pt || $.color || "#000000";
|
|
3805
|
-
} else if (!r && !
|
|
3805
|
+
} else if (!r && !c) {
|
|
3806
3806
|
const pt = this.createCanvasFill(t, e.fill, X, tt);
|
|
3807
3807
|
t.fillStyle = pt || e.fill.color || "#000000";
|
|
3808
3808
|
}
|
|
3809
3809
|
if (At > 0)
|
|
3810
|
-
if (r ||
|
|
3811
|
-
const pt =
|
|
3810
|
+
if (r || c) {
|
|
3811
|
+
const pt = c ? "#000000" : this.createCanvasFill(t, e.fill, X, tt);
|
|
3812
3812
|
t.fillStyle = pt || e.fill.color || "#ffffff", t.fillText(Mt, -Jt / 2, 0);
|
|
3813
3813
|
} else _t ? t.strokeText(Mt, -Jt / 2, 0) : t.fillText(Mt, -Jt / 2, 0);
|
|
3814
3814
|
Wt !== "none" && !r && this.drawTextDecoration(t, Wt, 0, 0, Jt, Kt), t.restore(), t.globalAlpha = te, k === "justify" && Ee > 0 && Mt === " " && !Pe ? jt += Jt + T + Ee : jt += Jt + T;
|
|
@@ -3818,18 +3818,18 @@ class ci {
|
|
|
3818
3818
|
if (r) {
|
|
3819
3819
|
let st = 0, mt = L;
|
|
3820
3820
|
(N || []).forEach((Lt) => {
|
|
3821
|
-
const _t = Lt.text || "", dt =
|
|
3821
|
+
const _t = Lt.text || "", dt = l.indexOf(_t, st);
|
|
3822
3822
|
dt !== -1 && (st = dt);
|
|
3823
3823
|
let Ft = -X / 2;
|
|
3824
3824
|
k === "center" ? Ft = 0 : k === "right" && (Ft = X / 2), ot(_t, Ft, mt, !1, st), st += _t.length, mt += A;
|
|
3825
3825
|
});
|
|
3826
|
-
} else if (
|
|
3826
|
+
} else if (c) {
|
|
3827
3827
|
let st = 0, mt = L;
|
|
3828
3828
|
(N || []).forEach((Lt) => {
|
|
3829
3829
|
const _t = Lt.text || "";
|
|
3830
3830
|
let dt = -X / 2;
|
|
3831
|
-
k === "center" ? dt = 0 : k === "right" && (dt = X / 2), ot(_t, dt, mt, !1, st), st += _t.length, st <
|
|
3832
|
-
` ||
|
|
3831
|
+
k === "center" ? dt = 0 : k === "right" && (dt = X / 2), ot(_t, dt, mt, !1, st), st += _t.length, st < l.length && (l[st] === `
|
|
3832
|
+
` || l[st] === "\r") && (st++, l[st - 1] === "\r" && l[st] === `
|
|
3833
3833
|
` && st++), mt += A;
|
|
3834
3834
|
});
|
|
3835
3835
|
} else {
|
|
@@ -3840,7 +3840,7 @@ class ci {
|
|
|
3840
3840
|
let $t = Dt.text || "";
|
|
3841
3841
|
const Ot = Dt.textCase || o.textCase || "none";
|
|
3842
3842
|
return Ot === "uppercase" ? $t.toUpperCase() : Ot === "lowercase" ? $t.toLowerCase() : Ot === "capitalize" ? $t.replace(/\b\w/g, (Vt) => Vt.toUpperCase()) : $t;
|
|
3843
|
-
}).join("") :
|
|
3843
|
+
}).join("") : l);
|
|
3844
3844
|
let dt = 0, Ft = L;
|
|
3845
3845
|
(N || []).forEach((Dt) => {
|
|
3846
3846
|
const $t = Dt.text || "";
|
|
@@ -3855,8 +3855,8 @@ class ci {
|
|
|
3855
3855
|
let mt = 0;
|
|
3856
3856
|
(N || []).forEach((Lt, _t) => {
|
|
3857
3857
|
var Dt, $t;
|
|
3858
|
-
const Ft = mt === 0 || mt <
|
|
3859
|
-
` ||
|
|
3858
|
+
const Ft = mt === 0 || mt < l.length && (l[mt] === `
|
|
3859
|
+
` || l[mt] === "\r");
|
|
3860
3860
|
if (Ft && _t > 0 && mt++, Ft) {
|
|
3861
3861
|
if (((Dt = st.top) == null ? void 0 : Dt.width) > 0) {
|
|
3862
3862
|
const Ot = L + _t * A - st.top.offset;
|
|
@@ -3887,8 +3887,8 @@ class ci {
|
|
|
3887
3887
|
let dt = 0, Ft = L;
|
|
3888
3888
|
(N || []).forEach((Dt) => {
|
|
3889
3889
|
let $t = -X / 2;
|
|
3890
|
-
k === "center" ? $t = 0 : k === "right" && ($t = X / 2), ot(Dt.text, $t, Ft, !0, dt), dt += (Dt.text || "").length, Ft += A, dt <
|
|
3891
|
-
` ||
|
|
3890
|
+
k === "center" ? $t = 0 : k === "right" && ($t = X / 2), ot(Dt.text, $t, Ft, !0, dt), dt += (Dt.text || "").length, Ft += A, dt < l.length && (l[dt] === `
|
|
3891
|
+
` || l[dt] === "\r") && (_ > 0 && (Ft += _), dt++, l[dt - 1] === "\r" && l[dt] === `
|
|
3892
3892
|
` && dt++);
|
|
3893
3893
|
}), t.globalAlpha = mt;
|
|
3894
3894
|
}
|
|
@@ -3896,34 +3896,34 @@ class ci {
|
|
|
3896
3896
|
}
|
|
3897
3897
|
applyStrokeAlignment(t, i, o, e, s, n, a = 1, r = 1) {
|
|
3898
3898
|
if (!i.stroke || i.stroke.width <= 0 || i.stroke.isEnabled === !1) return;
|
|
3899
|
-
const
|
|
3899
|
+
const c = i.stroke;
|
|
3900
3900
|
let f = 1;
|
|
3901
3901
|
if (this.rootTransform) {
|
|
3902
|
-
const S = t.getTransform(), C = Math.sqrt(S.a * S.a + S.b * S.b) || 1, w = this.rootTransform,
|
|
3903
|
-
f = C /
|
|
3902
|
+
const S = t.getTransform(), C = Math.sqrt(S.a * S.a + S.b * S.b) || 1, w = this.rootTransform, I = Math.sqrt(w.a * w.a + w.b * w.b) || 1;
|
|
3903
|
+
f = C / I;
|
|
3904
3904
|
} else
|
|
3905
3905
|
f = (Math.abs(a) + Math.abs(r)) / 2 || 1;
|
|
3906
|
-
const h = (
|
|
3907
|
-
if (t.save(), i.fill && i.fill.type !== "None" && i.fill.isEnabled !== !1 && i.fill.opacity !== 0 && i.fill.color !== "transparent" && i.fill.color !== "rgba(0,0,0,0)" && (t.shadowColor = "transparent", t.shadowBlur = 0, t.shadowOffsetX = 0, t.shadowOffsetY = 0),
|
|
3908
|
-
const S = this.createCanvasFill(t,
|
|
3909
|
-
S ? t.strokeStyle = S : t.strokeStyle =
|
|
3906
|
+
const h = (c.width || 1) / (f || 1), u = (c.alignment || "center").toLowerCase();
|
|
3907
|
+
if (t.save(), i.fill && i.fill.type !== "None" && i.fill.isEnabled !== !1 && i.fill.opacity !== 0 && i.fill.color !== "transparent" && i.fill.color !== "rgba(0,0,0,0)" && (t.shadowColor = "transparent", t.shadowBlur = 0, t.shadowOffsetX = 0, t.shadowOffsetY = 0), c.fill) {
|
|
3908
|
+
const S = this.createCanvasFill(t, c.fill, e, s);
|
|
3909
|
+
S ? t.strokeStyle = S : t.strokeStyle = c.color || "#000000";
|
|
3910
3910
|
} else
|
|
3911
|
-
t.strokeStyle =
|
|
3911
|
+
t.strokeStyle = c.color || "#000000";
|
|
3912
3912
|
const d = t.globalAlpha;
|
|
3913
|
-
t.globalAlpha = d * this.normalizeOpacity(
|
|
3914
|
-
const p =
|
|
3913
|
+
t.globalAlpha = d * this.normalizeOpacity(c.opacity ?? 100), t.lineWidth = h, t.lineCap = c.lineCap || "round", t.lineJoin = c.lineJoin || "round", c.miterLimit !== void 0 && (t.miterLimit = c.miterLimit);
|
|
3914
|
+
const p = c.trimStart ?? 0, y = c.trimEnd ?? 1, b = c.trimOffset ?? 0, m = c.dashOffset ?? 0, v = c.dashArray || [];
|
|
3915
3915
|
if (p !== 0 || y !== 1 || b !== 0) {
|
|
3916
3916
|
const S = this.getPerimeter(o, e, s);
|
|
3917
3917
|
if (S > 0) {
|
|
3918
3918
|
const C = Math.max(0, Math.min(1, p)), w = Math.max(0, Math.min(1, y));
|
|
3919
3919
|
if (C < w) {
|
|
3920
|
-
const
|
|
3921
|
-
t.setLineDash([
|
|
3920
|
+
const I = S * (w - C), M = S - I, k = -(S * (C + b % 1));
|
|
3921
|
+
t.setLineDash([I, M]), t.lineDashOffset = k + m * S;
|
|
3922
3922
|
} else if (C === w)
|
|
3923
3923
|
t.setLineDash([0, S]);
|
|
3924
3924
|
else {
|
|
3925
|
-
const
|
|
3926
|
-
t.setLineDash([
|
|
3925
|
+
const I = S * (1 - C + w), M = S - I, k = -(S * C);
|
|
3926
|
+
t.setLineDash([I, M]), t.lineDashOffset = k + m * S;
|
|
3927
3927
|
}
|
|
3928
3928
|
}
|
|
3929
3929
|
} else v.length > 0 && (t.setLineDash(v), t.lineDashOffset = m);
|
|
@@ -3946,12 +3946,12 @@ class ci {
|
|
|
3946
3946
|
case "Ellipse": {
|
|
3947
3947
|
const e = Math.abs(i) / 2, s = Math.abs(o) / 2, n = Math.abs(t.sweepAngle ?? 360), a = t.ratio || 0, r = Math.PI * (3 * (e + s) - Math.sqrt((3 * e + s) * (e + 3 * s)));
|
|
3948
3948
|
if (n >= 360 && a <= 0) return r;
|
|
3949
|
-
let
|
|
3949
|
+
let c = n / 360 * r;
|
|
3950
3950
|
if (a > 0) {
|
|
3951
3951
|
const f = Math.PI * (3 * (e * a + s * a) - Math.sqrt((3 * e * a + s * a) * (e * a + 3 * s * a)));
|
|
3952
|
-
|
|
3953
|
-
} else n < 360 && (
|
|
3954
|
-
return isNaN(
|
|
3952
|
+
c += n / 360 * f, n < 360 && (c += 2 * Math.sqrt((e - e * a) ** 2 + (s - s * a) ** 2));
|
|
3953
|
+
} else n < 360 && (c += 2 * Math.max(e, s));
|
|
3954
|
+
return isNaN(c) ? 0 : c;
|
|
3955
3955
|
}
|
|
3956
3956
|
case "Line":
|
|
3957
3957
|
return t.length || Math.sqrt(i * i + o * o);
|
|
@@ -3970,23 +3970,23 @@ class ci {
|
|
|
3970
3970
|
if (e.length < 2) return t.length || 0;
|
|
3971
3971
|
let s = 0, n = e[0].x, a = e[0].y;
|
|
3972
3972
|
for (let r = 1; r < e.length; r++) {
|
|
3973
|
-
const
|
|
3974
|
-
if (
|
|
3975
|
-
n =
|
|
3973
|
+
const c = e[r];
|
|
3974
|
+
if (c.moveTo) {
|
|
3975
|
+
n = c.x, a = c.y;
|
|
3976
3976
|
continue;
|
|
3977
3977
|
}
|
|
3978
|
-
const f = n, h = a, u = e[r - 1].out_x,
|
|
3979
|
-
if (u !== void 0 ||
|
|
3978
|
+
const f = n, h = a, u = e[r - 1].out_x, l = e[r - 1].out_y;
|
|
3979
|
+
if (u !== void 0 || c.in_x !== void 0 ? s += this.getBezierLength(
|
|
3980
3980
|
f,
|
|
3981
3981
|
h,
|
|
3982
3982
|
u ?? f,
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
) : s += Math.sqrt((
|
|
3989
|
-
const d = n, p = a, y = [...e.slice(0, r + 1)].reverse().find((
|
|
3983
|
+
l ?? h,
|
|
3984
|
+
c.in_x ?? c.x,
|
|
3985
|
+
c.in_y ?? c.y,
|
|
3986
|
+
c.x,
|
|
3987
|
+
c.y
|
|
3988
|
+
) : s += Math.sqrt((c.x - f) ** 2 + (c.y - h) ** 2), n = c.x, a = c.y, c.closePath || r === e.length - 1 && (t.is_closed || t.isClosed)) {
|
|
3989
|
+
const d = n, p = a, y = [...e.slice(0, r + 1)].reverse().find((I) => I.moveTo) || e[0], b = y.x, m = y.y, v = e[r].out_x, S = e[r].out_y, C = y.in_x, w = y.in_y;
|
|
3990
3990
|
v !== void 0 || C !== void 0 ? s += this.getBezierLength(
|
|
3991
3991
|
d,
|
|
3992
3992
|
p,
|
|
@@ -4005,24 +4005,24 @@ class ci {
|
|
|
4005
4005
|
return (i + o) * 2;
|
|
4006
4006
|
}
|
|
4007
4007
|
}
|
|
4008
|
-
getBezierLength(t, i, o, e, s, n, a, r,
|
|
4008
|
+
getBezierLength(t, i, o, e, s, n, a, r, c = 10) {
|
|
4009
4009
|
let f = 0, h = t, u = i;
|
|
4010
|
-
for (let
|
|
4011
|
-
const d =
|
|
4012
|
-
f += Math.sqrt(w * w +
|
|
4010
|
+
for (let l = 1; l <= c; l++) {
|
|
4011
|
+
const d = l / c, p = 1 - d, y = d * d, b = p * p, m = b * p, v = y * d, S = m * t + 3 * b * d * o + 3 * p * y * s + v * a, C = m * i + 3 * b * d * e + 3 * p * y * n + v * r, w = S - h, I = C - u;
|
|
4012
|
+
f += Math.sqrt(w * w + I * I), h = S, u = C;
|
|
4013
4013
|
}
|
|
4014
4014
|
return f;
|
|
4015
4015
|
}
|
|
4016
|
-
getBezierTAtLength(t, i, o, e, s, n, a, r,
|
|
4016
|
+
getBezierTAtLength(t, i, o, e, s, n, a, r, c, f = 20) {
|
|
4017
4017
|
if (t <= 0) return 0;
|
|
4018
|
-
let h = 0, u = i,
|
|
4018
|
+
let h = 0, u = i, l = o;
|
|
4019
4019
|
for (let d = 1; d <= f; d++) {
|
|
4020
|
-
const p = d / f, y = 1 - p, b = p * p, m = y * y, v = m * y, S = b * p, C = v * i + 3 * m * p * e + 3 * y * b * n + S * r, w = v * o + 3 * m * p * s + 3 * y * b * a + S *
|
|
4020
|
+
const p = d / f, y = 1 - p, b = p * p, m = y * y, v = m * y, S = b * p, C = v * i + 3 * m * p * e + 3 * y * b * n + S * r, w = v * o + 3 * m * p * s + 3 * y * b * a + S * c, I = C - u, M = w - l, k = Math.sqrt(I * I + M * M);
|
|
4021
4021
|
if (h + k >= t) {
|
|
4022
4022
|
const T = t - h, R = k === 0 ? 0 : T / k;
|
|
4023
4023
|
return (d - 1 + R) / f;
|
|
4024
4024
|
}
|
|
4025
|
-
h += k, u = C,
|
|
4025
|
+
h += k, u = C, l = w;
|
|
4026
4026
|
}
|
|
4027
4027
|
return 1;
|
|
4028
4028
|
}
|
|
@@ -4030,11 +4030,11 @@ class ci {
|
|
|
4030
4030
|
if (this.ensurePathPoints(t), (t == null ? void 0 : t.type) === "Path") {
|
|
4031
4031
|
const s = t.points || [];
|
|
4032
4032
|
if (s.length < 2) return { x: 0, y: 0, angle: 0 };
|
|
4033
|
-
let n = 1 / 0, a = -1 / 0, r = 1 / 0,
|
|
4033
|
+
let n = 1 / 0, a = -1 / 0, r = 1 / 0, c = -1 / 0;
|
|
4034
4034
|
s.forEach((m) => {
|
|
4035
|
-
typeof m.x == "number" && typeof m.y == "number" && (n = Math.min(n, m.x), a = Math.max(a, m.x), r = Math.min(r, m.y),
|
|
4035
|
+
typeof m.x == "number" && typeof m.y == "number" && (n = Math.min(n, m.x), a = Math.max(a, m.x), r = Math.min(r, m.y), c = Math.max(c, m.y), m.out_x !== void 0 && (n = Math.min(n, m.out_x), a = Math.max(a, m.out_x)), m.out_y !== void 0 && (r = Math.min(r, m.out_y), c = Math.max(c, m.out_y)), m.in_x !== void 0 && (n = Math.min(n, m.in_x), a = Math.max(a, m.in_x)), m.in_y !== void 0 && (r = Math.min(r, m.in_y), c = Math.max(c, m.in_y)));
|
|
4036
4036
|
});
|
|
4037
|
-
const f = (n + a) / 2, h = (r +
|
|
4037
|
+
const f = (n + a) / 2, h = (r + c) / 2, l = this.getPerimeter(t, i, o) * e;
|
|
4038
4038
|
let d = 0;
|
|
4039
4039
|
const p = [];
|
|
4040
4040
|
let y = s[0], b = s[0];
|
|
@@ -4050,31 +4050,31 @@ class ci {
|
|
|
4050
4050
|
const v = m.p0, S = m.p1;
|
|
4051
4051
|
let C = 0;
|
|
4052
4052
|
const w = v.out_x !== void 0 || S.in_x !== void 0;
|
|
4053
|
-
if (w ? C = this.getBezierLength(v.x, v.y, v.out_x ?? v.x, v.out_y ?? v.y, S.in_x ?? S.x, S.in_y ?? S.y, S.x, S.y) : C = Math.sqrt((S.x - v.x) ** 2 + (S.y - v.y) ** 2), d + C >=
|
|
4054
|
-
let
|
|
4053
|
+
if (w ? C = this.getBezierLength(v.x, v.y, v.out_x ?? v.x, v.out_y ?? v.y, S.in_x ?? S.x, S.in_y ?? S.y, S.x, S.y) : C = Math.sqrt((S.x - v.x) ** 2 + (S.y - v.y) ** 2), d + C >= l || m === p[p.length - 1]) {
|
|
4054
|
+
let I = 0;
|
|
4055
4055
|
if (w)
|
|
4056
|
-
return
|
|
4056
|
+
return I = this.getBezierTAtLength(l - d, v.x, v.y, v.out_x ?? v.x, v.out_y ?? v.y, S.in_x ?? S.x, S.in_y ?? S.y, S.x, S.y, 20), this.getBezierPointAndAngle(I, v, S, f, h);
|
|
4057
4057
|
{
|
|
4058
|
-
|
|
4059
|
-
const
|
|
4060
|
-
return { x:
|
|
4058
|
+
I = C === 0 ? 0 : (l - d) / C;
|
|
4059
|
+
const M = v.x + (S.x - v.x) * I - f, k = v.y + (S.y - v.y) * I - h, T = Math.atan2(S.y - v.y, S.x - v.x);
|
|
4060
|
+
return { x: M, y: k, angle: T };
|
|
4061
4061
|
}
|
|
4062
4062
|
}
|
|
4063
4063
|
d += C;
|
|
4064
4064
|
}
|
|
4065
4065
|
} else if (t.type === "Ellipse") {
|
|
4066
|
-
const s = Math.abs(i) / 2, n = Math.abs(o) / 2, a = t.sweepAngle ?? 360,
|
|
4066
|
+
const s = Math.abs(i) / 2, n = Math.abs(o) / 2, a = t.sweepAngle ?? 360, c = ((t.startAngle ?? 0) + a * e) * Math.PI / 180, f = s * Math.cos(c), h = n * Math.sin(c), u = -s * Math.sin(c), l = n * Math.cos(c), d = Math.atan2(l, u);
|
|
4067
4067
|
return { x: f, y: h, angle: d };
|
|
4068
4068
|
} else if ((t == null ? void 0 : t.type) === "Rectangle") {
|
|
4069
4069
|
const s = Math.abs(i), n = Math.abs(o), r = (s + n) * 2 * e;
|
|
4070
|
-
let
|
|
4071
|
-
return r < s ? (
|
|
4070
|
+
let c = 0, f = 0, h = 0;
|
|
4071
|
+
return r < s ? (c = -s / 2 + r, f = -n / 2, h = 0) : r < s + n ? (c = s / 2, f = -n / 2 + (r - s), h = Math.PI / 2) : r < 2 * s + n ? (c = s / 2 - (r - (s + n)), f = n / 2, h = Math.PI) : (c = -s / 2, f = n / 2 - (r - (2 * s + n)), h = -Math.PI / 2), { x: c, y: f, angle: h };
|
|
4072
4072
|
}
|
|
4073
4073
|
return { x: 0, y: 0, angle: 0 };
|
|
4074
4074
|
}
|
|
4075
4075
|
getBezierPointAndAngle(t, i, o, e, s) {
|
|
4076
|
-
const n = i.x, a = i.y, r = i.out_x ?? i.x,
|
|
4077
|
-
return { x: v, y: S, angle:
|
|
4076
|
+
const n = i.x, a = i.y, r = i.out_x ?? i.x, c = i.out_y ?? i.y, f = o.in_x ?? o.x, h = o.in_y ?? o.y, u = o.x, l = o.y, d = 1 - t, p = t * t, y = d * d, b = y * d, m = p * t, v = b * n + 3 * y * t * r + 3 * d * p * f + m * u - e, S = b * a + 3 * y * t * c + 3 * d * p * h + m * l - s, C = 3 * y * (r - n) + 6 * d * t * (f - r) + 3 * p * (u - f), w = 3 * y * (c - a) + 6 * d * t * (h - c) + 3 * p * (l - h), I = Math.atan2(w, C);
|
|
4077
|
+
return { x: v, y: S, angle: I };
|
|
4078
4078
|
}
|
|
4079
4079
|
applyAbsoluteTransform(t, i, o) {
|
|
4080
4080
|
if (!o.get(i)) return;
|
|
@@ -4099,46 +4099,46 @@ class ci {
|
|
|
4099
4099
|
const b = Math.tan(e * Math.PI / 180), m = Math.tan(s * Math.PI / 180);
|
|
4100
4100
|
t.transform(1 + b * m, m, b, 1, 0, 0);
|
|
4101
4101
|
}
|
|
4102
|
-
const n = o.rotate_x !== void 0 ? o.rotate_x : ((d = o.transform) == null ? void 0 : d.rotate_x) ?? 0, a = o.rotate_y !== void 0 ? o.rotate_y : ((p = o.transform) == null ? void 0 : p.rotate_y) ?? 0,
|
|
4103
|
-
t.scale(u,
|
|
4102
|
+
const n = o.rotate_x !== void 0 ? o.rotate_x : ((d = o.transform) == null ? void 0 : d.rotate_x) ?? 0, a = o.rotate_y !== void 0 ? o.rotate_y : ((p = o.transform) == null ? void 0 : p.rotate_y) ?? 0, c = 1 + (o.translate_z !== void 0 ? o.translate_z : ((y = o.transform) == null ? void 0 : y.translate_z) ?? 0) / 1e3, f = (o.flip_x === !0 ? -1 : 1) * Math.cos(a * Math.PI / 180) * c, h = (o.flip_y === !0 ? -1 : 1) * Math.cos(n * Math.PI / 180) * c, u = (o.scale_x ?? 1) * f, l = (o.scale_y ?? 1) * h;
|
|
4103
|
+
t.scale(u, l);
|
|
4104
4104
|
}
|
|
4105
4105
|
applyArtEffectOverlay(t, i, o, e, s, n) {
|
|
4106
|
-
var
|
|
4107
|
-
const a = this.objectStates.get(i.id), r = ((
|
|
4106
|
+
var l, d, p, y, b;
|
|
4107
|
+
const a = this.objectStates.get(i.id), r = ((l = a == null ? void 0 : a.style) == null ? void 0 : l.artEffect) || i.artEffect || ((d = i.style) == null ? void 0 : d.artEffect);
|
|
4108
4108
|
if (!r || !r.enabled) return;
|
|
4109
|
-
const
|
|
4110
|
-
if (
|
|
4111
|
-
if (t.save(), this.applyPath(t, o, e, s, n), t.clip(),
|
|
4109
|
+
const c = r.type, f = r.intensity ?? 0.5, h = r.speed ?? 1, u = r.scale ?? 10;
|
|
4110
|
+
if (c === "acid_gradient" || c === "acid_rave" || c === "shimmer" || c === "glint_overlay" || c === "halftone" || c === "noise" || c === "scanlines" || c === "chromatic_aberration" || c === "pixelate" || c === "glitch" || c === "fold_overlay" || c === "crumple_overlay") {
|
|
4111
|
+
if (t.save(), this.applyPath(t, o, e, s, n), t.clip(), c === "shimmer") {
|
|
4112
4112
|
const v = this.currentTime * h % 2 / 2, S = t.createLinearGradient(-e, -s, e, s);
|
|
4113
4113
|
S.addColorStop(Math.max(0, v - 0.2), "rgba(255,255,255,0)"), S.addColorStop(v, `rgba(255,255,255,${f * 0.8})`), S.addColorStop(Math.min(1, v + 0.2), "rgba(255,255,255,0)"), t.fillStyle = S, t.globalCompositeOperation = "screen", t.fillRect(-e / 2, -s / 2, e, s), t.globalCompositeOperation = "source-over";
|
|
4114
|
-
} else if (
|
|
4114
|
+
} else if (c === "glint_overlay") {
|
|
4115
4115
|
let S = ((this._lastPointerPos || { x: 0 }).x - (((p = i.transform) == null ? void 0 : p.x) ?? 0) + 300) / 600;
|
|
4116
4116
|
S = Math.max(-0.2, Math.min(1.2, S));
|
|
4117
4117
|
const C = t.createLinearGradient(-e, -s, e, s);
|
|
4118
4118
|
C.addColorStop(Math.max(0, S - 0.15), "rgba(255,255,255,0)"), C.addColorStop(Math.max(0, Math.min(1, S)), `rgba(255,255,255,${f})`), C.addColorStop(Math.min(1, S + 0.15), "rgba(255,255,255,0)"), t.fillStyle = C, t.globalCompositeOperation = "screen", t.fillRect(-e / 2, -s / 2, e, s), t.globalCompositeOperation = "source-over";
|
|
4119
|
-
} else if (
|
|
4119
|
+
} else if (c === "fold_overlay") {
|
|
4120
4120
|
const m = this._lastPointerPos || { x: 0, y: 0 }, v = m.x - (((y = i.transform) == null ? void 0 : y.x) ?? 0), S = m.y - (((b = i.transform) == null ? void 0 : b.y) ?? 0), C = t.createLinearGradient(v > 0 ? -e / 2 : e / 2, S > 0 ? -s / 2 : s / 2, v > 0 ? e / 2 : -e / 2, S > 0 ? s / 2 : -s / 2);
|
|
4121
4121
|
C.addColorStop(0, `rgba(0,0,0,${f * 0.6})`), C.addColorStop(0.4, "rgba(0,0,0,0)"), C.addColorStop(0.5, `rgba(255,255,255,${f * 0.4})`), C.addColorStop(1, `rgba(0,0,0,${f * 0.2})`), t.fillStyle = C, t.globalCompositeOperation = "overlay", t.fillRect(-e / 2, -s / 2, e, s), t.globalCompositeOperation = "source-over", t.beginPath(), v > 0 && S > 0 ? (t.moveTo(e / 2 - 40, s / 2), t.lineTo(e / 2, s / 2 - 40), t.lineTo(e / 2 - 40, s / 2 - 40)) : v < 0 && S > 0 ? (t.moveTo(-e / 2 + 40, s / 2), t.lineTo(-e / 2, s / 2 - 40), t.lineTo(-e / 2 + 40, s / 2 - 40)) : v > 0 && S < 0 ? (t.moveTo(e / 2 - 40, -s / 2), t.lineTo(e / 2, -s / 2 + 40), t.lineTo(e / 2 - 40, -s / 2 + 40)) : (t.moveTo(-e / 2 + 40, -s / 2), t.lineTo(-e / 2, -s / 2 + 40), t.lineTo(-e / 2 + 40, -s / 2 + 40)), t.closePath(), t.fillStyle = "#ffffff", t.shadowColor = "rgba(0,0,0,0.5)", t.shadowBlur = 10, t.shadowOffsetX = v > 0 ? -2 : 2, t.shadowOffsetY = S > 0 ? -2 : 2, t.fill();
|
|
4122
|
-
} else if (
|
|
4122
|
+
} else if (c === "crumple_overlay") {
|
|
4123
4123
|
const m = Math.floor(e / u), v = document.createElement("canvas");
|
|
4124
4124
|
v.width = m, v.height = Math.floor(s / u);
|
|
4125
4125
|
const S = v.getContext("2d"), C = S.createImageData(v.width, v.height);
|
|
4126
4126
|
for (let w = 0; w < C.data.length; w += 4) {
|
|
4127
|
-
const
|
|
4128
|
-
C.data[w] =
|
|
4127
|
+
const I = Math.random() > 0.95 ? 150 : 255;
|
|
4128
|
+
C.data[w] = I, C.data[w + 1] = I, C.data[w + 2] = I, C.data[w + 3] = 255 * f;
|
|
4129
4129
|
}
|
|
4130
4130
|
S.putImageData(C, 0, 0), t.globalCompositeOperation = "multiply", t.imageSmoothingEnabled = !1, t.drawImage(v, -e / 2, -s / 2, e, s);
|
|
4131
|
-
} else if (
|
|
4131
|
+
} else if (c === "acid_gradient" || c === "acid_rave") {
|
|
4132
4132
|
const m = this.currentTime * h, v = r.color1, S = r.color2, C = t.createLinearGradient(-e / 2, -s / 2, e / 2, s / 2);
|
|
4133
4133
|
if (v && S) {
|
|
4134
4134
|
const w = m * 60 % 360;
|
|
4135
4135
|
C.addColorStop(0, this._shiftHue(v, w, f * 0.7)), C.addColorStop(1, this._shiftHue(S, (w + 180) % 360, f * 0.7));
|
|
4136
4136
|
} else {
|
|
4137
|
-
const w = m * 100 % 360,
|
|
4138
|
-
C.addColorStop(0, `hsla(${w}, 80%, 50%, ${f * 0.5})`), C.addColorStop(1, `hsla(${
|
|
4137
|
+
const w = m * 100 % 360, I = (w + 180) % 360;
|
|
4138
|
+
C.addColorStop(0, `hsla(${w}, 80%, 50%, ${f * 0.5})`), C.addColorStop(1, `hsla(${I}, 80%, 50%, ${f * 0.5})`);
|
|
4139
4139
|
}
|
|
4140
4140
|
t.fillStyle = C, t.globalCompositeOperation = "screen", t.fillRect(-e / 2, -s / 2, e, s);
|
|
4141
|
-
} else if (
|
|
4141
|
+
} else if (c === "halftone") {
|
|
4142
4142
|
const m = Math.max(2, u * (1 - f * 0.8)), v = document.createElement("canvas");
|
|
4143
4143
|
v.width = m, v.height = m;
|
|
4144
4144
|
const S = v.getContext("2d");
|
|
@@ -4147,7 +4147,7 @@ class ci {
|
|
|
4147
4147
|
const C = t.createPattern(v, "repeat");
|
|
4148
4148
|
C && (t.globalAlpha = 0.3 * f, t.fillStyle = C, t.fillRect(-e / 2, -s / 2, e, s));
|
|
4149
4149
|
}
|
|
4150
|
-
} else if (
|
|
4150
|
+
} else if (c === "noise") {
|
|
4151
4151
|
const m = Math.floor(e * s * f * 0.02);
|
|
4152
4152
|
t.globalAlpha = 0.4 * f;
|
|
4153
4153
|
for (let v = 0; v < m; v++) {
|
|
@@ -4159,33 +4159,33 @@ class ci {
|
|
|
4159
4159
|
2
|
|
4160
4160
|
);
|
|
4161
4161
|
}
|
|
4162
|
-
} else if (
|
|
4162
|
+
} else if (c === "scanlines") {
|
|
4163
4163
|
t.globalAlpha = 0.2 * f, t.strokeStyle = "rgba(0,0,0,0.5)", t.lineWidth = 1;
|
|
4164
4164
|
for (let m = -s / 2; m < s / 2; m += 4)
|
|
4165
4165
|
t.beginPath(), t.moveTo(-e / 2, m), t.lineTo(e / 2, m), t.stroke();
|
|
4166
|
-
} else if (
|
|
4166
|
+
} else if (c === "chromatic_aberration") {
|
|
4167
4167
|
const m = 5 * f;
|
|
4168
4168
|
t.globalCompositeOperation = "screen", t.globalAlpha = 0.5, t.fillStyle = "cyan", t.fillRect(-e / 2 - m, -s / 2, e, s), t.fillStyle = "magenta", t.fillRect(-e / 2 + m, -s / 2, e, s);
|
|
4169
|
-
} else if (
|
|
4169
|
+
} else if (c === "pixelate") {
|
|
4170
4170
|
const m = Math.max(2, Math.round(u * (1 - f * 0.5))), v = document.createElement("canvas"), S = Math.max(1, Math.ceil(e / m)), C = Math.max(1, Math.ceil(s / m));
|
|
4171
4171
|
v.width = S, v.height = C;
|
|
4172
4172
|
const w = v.getContext("2d");
|
|
4173
4173
|
if (w) {
|
|
4174
4174
|
w.imageSmoothingEnabled = !1;
|
|
4175
|
-
const
|
|
4176
|
-
w.drawImage(t.canvas,
|
|
4175
|
+
const I = t.getTransform(), M = I.e - e / 2, k = I.f - s / 2;
|
|
4176
|
+
w.drawImage(t.canvas, M, k, e, s, 0, 0, S, C), t.imageSmoothingEnabled = !1, t.drawImage(v, 0, 0, S, C, -e / 2, -s / 2, e, s), t.imageSmoothingEnabled = !0;
|
|
4177
4177
|
}
|
|
4178
|
-
} else if (
|
|
4178
|
+
} else if (c === "glitch") {
|
|
4179
4179
|
const m = this.currentTime * h, v = r.chaosAmount ?? 0.2, S = Math.max(3, Math.floor(8 * f)), C = f * e * 0.15;
|
|
4180
4180
|
t.globalCompositeOperation = "screen", t.globalAlpha = f * 0.4;
|
|
4181
4181
|
const w = C * 0.3;
|
|
4182
4182
|
t.fillStyle = "rgba(255, 0, 0, 0.4)", t.fillRect(-e / 2 + w, -s / 2, e, s), t.fillStyle = "rgba(0, 255, 255, 0.4)", t.fillRect(-e / 2 - w, -s / 2, e, s), t.globalCompositeOperation = "source-over", t.globalAlpha = 1;
|
|
4183
|
-
const
|
|
4184
|
-
for (let
|
|
4185
|
-
const k = Math.sin(
|
|
4183
|
+
const I = s / S;
|
|
4184
|
+
for (let M = 0; M < S; M++) {
|
|
4185
|
+
const k = Math.sin(M * 127.1 + m * 311.7 * h) * 43758.5, T = k - Math.floor(k);
|
|
4186
4186
|
if (T > 1 - v) {
|
|
4187
|
-
const R = (T - (1 - v)) / v * C * (Math.random() > 0.5 ? 1 : -1), P = -s / 2 +
|
|
4188
|
-
t.save(), t.beginPath(), t.rect(-e / 2, P, e,
|
|
4187
|
+
const R = (T - (1 - v)) / v * C * (Math.random() > 0.5 ? 1 : -1), P = -s / 2 + M * I, _ = t.getTransform(), E = _.e - e / 2 + R, A = _.f + P;
|
|
4188
|
+
t.save(), t.beginPath(), t.rect(-e / 2, P, e, I), t.clip(), t.globalAlpha = 0.8, t.drawImage(t.canvas, E, A, e, I, -e / 2 + R, P, e, I), t.restore();
|
|
4189
4189
|
}
|
|
4190
4190
|
}
|
|
4191
4191
|
}
|
|
@@ -4196,26 +4196,26 @@ class ci {
|
|
|
4196
4196
|
_shiftHue(t, i, o) {
|
|
4197
4197
|
let e = 0, s = 0, n = 0;
|
|
4198
4198
|
if (t.startsWith("#")) {
|
|
4199
|
-
const
|
|
4200
|
-
e = parseInt(
|
|
4199
|
+
const l = t.replace("#", "");
|
|
4200
|
+
e = parseInt(l.substring(0, 2), 16) / 255, s = parseInt(l.substring(2, 4), 16) / 255, n = parseInt(l.substring(4, 6), 16) / 255;
|
|
4201
4201
|
}
|
|
4202
4202
|
const a = Math.max(e, s, n), r = Math.min(e, s, n);
|
|
4203
|
-
let
|
|
4203
|
+
let c = 0, f = 0, h = (a + r) / 2;
|
|
4204
4204
|
if (a !== r) {
|
|
4205
|
-
const
|
|
4206
|
-
switch (f = h > 0.5 ?
|
|
4205
|
+
const l = a - r;
|
|
4206
|
+
switch (f = h > 0.5 ? l / (2 - a - r) : l / (a + r), a) {
|
|
4207
4207
|
case e:
|
|
4208
|
-
|
|
4208
|
+
c = ((s - n) / l + (s < n ? 6 : 0)) / 6;
|
|
4209
4209
|
break;
|
|
4210
4210
|
case s:
|
|
4211
|
-
|
|
4211
|
+
c = ((n - e) / l + 2) / 6;
|
|
4212
4212
|
break;
|
|
4213
4213
|
case n:
|
|
4214
|
-
|
|
4214
|
+
c = ((e - s) / l + 4) / 6;
|
|
4215
4215
|
break;
|
|
4216
4216
|
}
|
|
4217
4217
|
}
|
|
4218
|
-
return `hsla(${(((
|
|
4218
|
+
return `hsla(${(((c * 360 + i) % 360 + 360) % 360).toFixed(0)}, ${(f * 100).toFixed(0)}%, ${(h * 100).toFixed(0)}%, ${o})`;
|
|
4219
4219
|
}
|
|
4220
4220
|
/**
|
|
4221
4221
|
* Parse any CSS color string and return it with the alpha channel replaced by `opacity`.
|
|
@@ -4231,12 +4231,12 @@ class ci {
|
|
|
4231
4231
|
if (t.startsWith("#")) {
|
|
4232
4232
|
const s = t.replace("#", ""), n = s.length;
|
|
4233
4233
|
if (n === 3 || n === 6) {
|
|
4234
|
-
const a = n === 3 ? s.split("").map((h) => h + h).join("") : s, r = parseInt(a.slice(0, 2), 16),
|
|
4235
|
-
return `rgba(${r},${
|
|
4234
|
+
const a = n === 3 ? s.split("").map((h) => h + h).join("") : s, r = parseInt(a.slice(0, 2), 16), c = parseInt(a.slice(2, 4), 16), f = parseInt(a.slice(4, 6), 16);
|
|
4235
|
+
return `rgba(${r},${c},${f},${i})`;
|
|
4236
4236
|
}
|
|
4237
4237
|
if (n === 8) {
|
|
4238
|
-
const a = parseInt(s.slice(0, 2), 16), r = parseInt(s.slice(2, 4), 16),
|
|
4239
|
-
return `rgba(${a},${r},${
|
|
4238
|
+
const a = parseInt(s.slice(0, 2), 16), r = parseInt(s.slice(2, 4), 16), c = parseInt(s.slice(4, 6), 16);
|
|
4239
|
+
return `rgba(${a},${r},${c},${i})`;
|
|
4240
4240
|
}
|
|
4241
4241
|
}
|
|
4242
4242
|
const e = t.match(/hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.%]+))?\s*\)/);
|
|
@@ -4251,9 +4251,9 @@ class ci {
|
|
|
4251
4251
|
* 4. Apply the overlay color tint, sheen highlight, noise grain, and glass border
|
|
4252
4252
|
*/
|
|
4253
4253
|
applyBackgroundBlurGlass(t, i, o, e, s, n) {
|
|
4254
|
-
const a = n.radius ?? 10, r = n.opacity !== void 0 ? this.normalizeOpacity(n.opacity) : 0.5,
|
|
4254
|
+
const a = n.radius ?? 10, r = n.opacity !== void 0 ? this.normalizeOpacity(n.opacity) : 0.5, c = n.noise ?? 0, f = n.color ?? "rgba(255,255,255,0.2)";
|
|
4255
4255
|
t.save(), this.applyPath(t, i, o, e, s), t.clip();
|
|
4256
|
-
const
|
|
4256
|
+
const h = t.getTransform(), u = t.canvas, l = (typeof window < "u" ? window.devicePixelRatio : 1) || 1;
|
|
4257
4257
|
try {
|
|
4258
4258
|
const p = document.createElement("canvas");
|
|
4259
4259
|
p.width = Math.max(1, Math.ceil(o)), p.height = Math.max(1, Math.ceil(e));
|
|
@@ -4261,25 +4261,27 @@ class ci {
|
|
|
4261
4261
|
if (y) {
|
|
4262
4262
|
y.save(), y.translate(o / 2, e / 2);
|
|
4263
4263
|
const b = n.magnification || 1;
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4264
|
+
b !== 1 && y.scale(b, b);
|
|
4265
|
+
const m = h.a * l, v = h.b * l, S = h.c * l, C = h.d * l, w = h.e * l, I = h.f * l;
|
|
4266
|
+
if (typeof h.inverse == "function") {
|
|
4267
|
+
const T = h.inverse();
|
|
4268
|
+
y.transform(T.a / l, T.b / l, T.c / l, T.d / l, T.e / l, T.f / l);
|
|
4267
4269
|
} else {
|
|
4268
|
-
const
|
|
4269
|
-
|
|
4270
|
+
const T = m * C - v * S;
|
|
4271
|
+
T !== 0 && y.transform(C / T, -v / T, -S / T, m / T, (S * I - C * w) / T, (v * w - m * I) / T);
|
|
4270
4272
|
}
|
|
4271
|
-
y.drawImage(
|
|
4272
|
-
const
|
|
4273
|
-
|
|
4274
|
-
const
|
|
4275
|
-
|
|
4273
|
+
y.drawImage(u, 0, 0), y.restore();
|
|
4274
|
+
const M = document.createElement("canvas");
|
|
4275
|
+
M.width = p.width, M.height = p.height;
|
|
4276
|
+
const k = M.getContext("2d");
|
|
4277
|
+
k.filter = `blur(${a}px)`, k.drawImage(p, 0, 0), t.globalCompositeOperation = "source-over", t.globalAlpha = 1, t.drawImage(M, -o / 2, -e / 2, o, e);
|
|
4276
4278
|
}
|
|
4277
4279
|
} catch {
|
|
4278
4280
|
}
|
|
4279
|
-
t.globalCompositeOperation = "source-over", t.globalAlpha =
|
|
4281
|
+
t.globalCompositeOperation = "source-over", t.globalAlpha = r, t.fillStyle = f, t.fillRect(-o / 2, -e / 2, o, e), t.globalAlpha = 1, t.globalCompositeOperation = "source-atop";
|
|
4280
4282
|
const d = t.createLinearGradient(-o / 2, -e / 2, o / 2, e / 2);
|
|
4281
|
-
if (d.addColorStop(0, "rgba(255,255,255,0.12)"), d.addColorStop(0.3, "rgba(255,255,255,0.04)"), d.addColorStop(0.5, "rgba(255,255,255,0.0)"), d.addColorStop(1, "rgba(255,255,255,0.0)"), t.fillStyle = d, t.fillRect(-o / 2, -e / 2, o, e),
|
|
4282
|
-
if (t.globalAlpha =
|
|
4283
|
+
if (d.addColorStop(0, "rgba(255,255,255,0.12)"), d.addColorStop(0.3, "rgba(255,255,255,0.04)"), d.addColorStop(0.5, "rgba(255,255,255,0.0)"), d.addColorStop(1, "rgba(255,255,255,0.0)"), t.fillStyle = d, t.fillRect(-o / 2, -e / 2, o, e), c > 0) {
|
|
4284
|
+
if (t.globalAlpha = c / 100, !this._noiseTileCanvas) {
|
|
4283
4285
|
const y = document.createElement("canvas");
|
|
4284
4286
|
y.width = 64, y.height = 64;
|
|
4285
4287
|
const b = y.getContext("2d"), m = b.createImageData(64, 64), v = m.data;
|
|
@@ -4305,14 +4307,14 @@ class ci {
|
|
|
4305
4307
|
} else if (i.type === "Line")
|
|
4306
4308
|
t.moveTo(-o / 2, 0), t.lineTo(o / 2, 0);
|
|
4307
4309
|
else if (i.type === "Ellipse") {
|
|
4308
|
-
const { startAngle: n = 0, sweepAngle: a = 360, ratio: r = 0 } = i,
|
|
4309
|
-
a >= 360 && r <= 0 ? t.ellipse(0, 0,
|
|
4310
|
+
const { startAngle: n = 0, sweepAngle: a = 360, ratio: r = 0 } = i, c = o / 2, f = e / 2, h = n * Math.PI / 180, u = a * Math.PI / 180, l = h + u;
|
|
4311
|
+
a >= 360 && r <= 0 ? t.ellipse(0, 0, c, f, 0, 0, Math.PI * 2) : (t.ellipse(0, 0, c, f, 0, h, l, !1), r > 0 ? t.ellipse(0, 0, c * r, f * r, 0, l, h, !0) : t.lineTo(0, 0), t.closePath());
|
|
4310
4312
|
} else if (i.type === "Triangle")
|
|
4311
4313
|
t.moveTo(0, -e / 2), t.lineTo(o / 2, e / 2), t.lineTo(-o / 2, e / 2), t.closePath();
|
|
4312
4314
|
else if (i.type === "Polygon") {
|
|
4313
4315
|
const n = i.sides || 3, a = i.radius || Math.min(o, e) / 2;
|
|
4314
4316
|
for (let r = 0; r < n; r++) {
|
|
4315
|
-
const
|
|
4317
|
+
const c = r * 2 * Math.PI / n - Math.PI / 2, f = a * Math.cos(c), h = a * Math.sin(c);
|
|
4316
4318
|
r === 0 ? t.moveTo(f, h) : t.lineTo(f, h);
|
|
4317
4319
|
}
|
|
4318
4320
|
t.closePath();
|
|
@@ -4320,33 +4322,33 @@ class ci {
|
|
|
4320
4322
|
const n = i.points || 5, a = i.outer_radius || Math.min(o, e) / 2;
|
|
4321
4323
|
let r = i.inner_radius;
|
|
4322
4324
|
r == null ? r = a * 0.382 : r <= 1 && (r = a * r);
|
|
4323
|
-
for (let
|
|
4324
|
-
const f =
|
|
4325
|
-
|
|
4325
|
+
for (let c = 0; c < n * 2; c++) {
|
|
4326
|
+
const f = c * Math.PI / n - Math.PI / 2, h = c % 2 === 0 ? a : r, u = h * Math.cos(f), l = h * Math.sin(f);
|
|
4327
|
+
c === 0 ? t.moveTo(u, l) : t.lineTo(u, l);
|
|
4326
4328
|
}
|
|
4327
4329
|
t.closePath();
|
|
4328
4330
|
} else if (((i == null ? void 0 : i.type) === "Path" || i.type === "Subtract" || i.type === "Union" || i.type === "Intersect" || i.type === "Exclude" || i.type === "BooleanOperation") && i.points) {
|
|
4329
4331
|
this.frameCount % 300 === 0 && this.log("[Engine] Tracing Path:", i.points.length, "points");
|
|
4330
|
-
let n = 1 / 0, a = -1 / 0, r = 1 / 0,
|
|
4332
|
+
let n = 1 / 0, a = -1 / 0, r = 1 / 0, c = -1 / 0;
|
|
4331
4333
|
if (i.points.forEach((u) => {
|
|
4332
|
-
typeof u.x == "number" && typeof u.y == "number" && (n = Math.min(n, u.x), a = Math.max(a, u.x), r = Math.min(r, u.y),
|
|
4334
|
+
typeof u.x == "number" && typeof u.y == "number" && (n = Math.min(n, u.x), a = Math.max(a, u.x), r = Math.min(r, u.y), c = Math.max(c, u.y), u.out_x !== void 0 && (n = Math.min(n, u.out_x), a = Math.max(a, u.out_x)), u.out_y !== void 0 && (r = Math.min(r, u.out_y), c = Math.max(c, u.out_y)), u.in_x !== void 0 && (n = Math.min(n, u.in_x), a = Math.max(a, u.in_x)), u.in_y !== void 0 && (r = Math.min(r, u.in_y), c = Math.max(c, u.in_y)));
|
|
4333
4335
|
}), n === 1 / 0) return;
|
|
4334
|
-
const f = (n + a) / 2, h = (r +
|
|
4336
|
+
const f = (n + a) / 2, h = (r + c) / 2;
|
|
4335
4337
|
if (isNaN(f) || isNaN(h)) {
|
|
4336
4338
|
this.warn("[Engine] Invalid path center:", f, h);
|
|
4337
4339
|
return;
|
|
4338
4340
|
}
|
|
4339
|
-
i.points.forEach((u,
|
|
4340
|
-
if (
|
|
4341
|
+
i.points.forEach((u, l) => {
|
|
4342
|
+
if (l === 0 || u.moveTo)
|
|
4341
4343
|
t.moveTo(u.x - f, u.y - h);
|
|
4342
4344
|
else {
|
|
4343
|
-
const d = i.points[
|
|
4345
|
+
const d = i.points[l - 1];
|
|
4344
4346
|
if (!d) return;
|
|
4345
4347
|
const p = (d.out_x ?? d.x) - f, y = (d.out_y ?? d.y) - h, b = (u.in_x ?? u.x) - f, m = (u.in_y ?? u.y) - h;
|
|
4346
4348
|
isNaN(p) || isNaN(b) || isNaN(u.x) ? t.lineTo(u.x - f, u.y - h) : t.bezierCurveTo(p, y, b, m, u.x - f, u.y - h);
|
|
4347
4349
|
}
|
|
4348
|
-
if (u.closePath ||
|
|
4349
|
-
const d = [...i.points.slice(0,
|
|
4350
|
+
if (u.closePath || l === i.points.length - 1 && (i.is_closed || i.isClosed)) {
|
|
4351
|
+
const d = [...i.points.slice(0, l + 1)].reverse().find((p) => p.moveTo) || i.points[0];
|
|
4350
4352
|
d && (u.out_x !== void 0 || d.in_x !== void 0) && t.bezierCurveTo(
|
|
4351
4353
|
(u.out_x ?? u.x) - f,
|
|
4352
4354
|
(u.out_y ?? u.y) - h,
|
|
@@ -4358,15 +4360,15 @@ class ci {
|
|
|
4358
4360
|
}
|
|
4359
4361
|
});
|
|
4360
4362
|
} else if (i.points && Array.isArray(i.points)) {
|
|
4361
|
-
let n = 1 / 0, a = -1 / 0, r = 1 / 0,
|
|
4363
|
+
let n = 1 / 0, a = -1 / 0, r = 1 / 0, c = -1 / 0;
|
|
4362
4364
|
i.points.forEach((u) => {
|
|
4363
|
-
n = Math.min(n, u.x), a = Math.max(a, u.x), r = Math.min(r, u.y),
|
|
4365
|
+
n = Math.min(n, u.x), a = Math.max(a, u.x), r = Math.min(r, u.y), c = Math.max(c, u.y);
|
|
4364
4366
|
});
|
|
4365
|
-
const f = (n + a) / 2, h = (r +
|
|
4366
|
-
i.points.forEach((u,
|
|
4367
|
-
if (
|
|
4367
|
+
const f = (n + a) / 2, h = (r + c) / 2;
|
|
4368
|
+
i.points.forEach((u, l) => {
|
|
4369
|
+
if (l === 0) t.moveTo(u.x - f, u.y - h);
|
|
4368
4370
|
else {
|
|
4369
|
-
const d = i.points[
|
|
4371
|
+
const d = i.points[l - 1];
|
|
4370
4372
|
d.out_x !== void 0 || u.in_x !== void 0 ? t.bezierCurveTo(
|
|
4371
4373
|
(d.out_x ?? d.x) - f,
|
|
4372
4374
|
(d.out_y ?? d.y) - h,
|
|
@@ -4376,17 +4378,17 @@ class ci {
|
|
|
4376
4378
|
u.y - h
|
|
4377
4379
|
) : t.lineTo(u.x - f, u.y - h);
|
|
4378
4380
|
}
|
|
4379
|
-
(u.closePath ||
|
|
4381
|
+
(u.closePath || l === i.points.length - 1 && (i.is_closed || i.isClosed)) && t.closePath();
|
|
4380
4382
|
});
|
|
4381
4383
|
}
|
|
4382
4384
|
}
|
|
4383
4385
|
}
|
|
4384
4386
|
renderInputBox(t, i) {
|
|
4385
4387
|
var L, O;
|
|
4386
|
-
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = ((L = i.geometry) == null ? void 0 : L.width) || 250, n = ((O = i.geometry) == null ? void 0 : O.height) || 45, a = this.focusedId === i.id, r = this.lastHoveredObjectId === i.id,
|
|
4387
|
-
let v = e.backgroundColor || "rgba(31, 41, 55, 1)", S = e.borderColor || "rgba(55, 65, 81, 1)", C = e.borderWidth ?? 1.5, w = e.color || "#ffffff",
|
|
4388
|
+
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = ((L = i.geometry) == null ? void 0 : L.width) || 250, n = ((O = i.geometry) == null ? void 0 : O.height) || 45, a = this.focusedId === i.id, r = this.lastHoveredObjectId === i.id, c = e.previewState || "default", f = c !== "default" ? c : a ? "focused" : r ? "hovered" : "default", h = e.label || { visible: !0, text: "Label" }, u = e.helperText || { visible: !1, text: "Helper text" }, l = e.leftIcon || { visible: !1 }, d = e.rightIcon || { visible: !1 }, p = e.multiline === !0, y = e.corner_radius ?? 8, b = e.corners || { tl: y, tr: y, bl: y, br: y }, m = [b.tl, b.tr, b.br, b.bl];
|
|
4389
|
+
let v = e.backgroundColor || "rgba(31, 41, 55, 1)", S = e.borderColor || "rgba(55, 65, 81, 1)", C = e.borderWidth ?? 1.5, w = e.color || "#ffffff", I = e.placeholderColor || "rgba(156, 163, 175, 1)", M = e.fontSize || 14;
|
|
4388
4390
|
const k = `${f}Style`, T = e[k];
|
|
4389
|
-
T ? (T.backgroundColor !== void 0 && (v = T.backgroundColor), T.borderColor !== void 0 && (S = T.borderColor), T.borderWidth !== void 0 && (C = T.borderWidth), T.color !== void 0 && (w = T.color), T.placeholderColor !== void 0 && (
|
|
4391
|
+
T ? (T.backgroundColor !== void 0 && (v = T.backgroundColor), T.borderColor !== void 0 && (S = T.borderColor), T.borderWidth !== void 0 && (C = T.borderWidth), T.color !== void 0 && (w = T.color), T.placeholderColor !== void 0 && (I = T.placeholderColor), T.fontSize !== void 0 && (M = T.fontSize)) : f === "focused" ? (S = e.focusBorderColor || "rgba(59, 130, 246, 1)", C = Math.max(C, 2)) : f === "hovered" || f === "hover" ? (S = e.hoverBorderColor || S, v = e.hoverBackgroundColor || v) : f === "disabled" ? (v = e.disabledBackgroundColor || "rgba(31, 41, 55, 0.6)", S = e.disabledBorderColor || "rgba(55, 65, 81, 0.4)") : f === "error" && (S = "rgba(239, 68, 68, 1)", C = Math.max(C, 2)), t.beginPath(), this.drawRoundRect(t, -s / 2, -n / 2, s, n, m);
|
|
4390
4392
|
const R = this.createCanvasFill(t, v, s, n);
|
|
4391
4393
|
if (R && (t.fillStyle = R, t.fill()), C > 0) {
|
|
4392
4394
|
const D = this.createCanvasFill(t, S, s, n);
|
|
@@ -4405,10 +4407,10 @@ class ci {
|
|
|
4405
4407
|
}
|
|
4406
4408
|
t.restore();
|
|
4407
4409
|
};
|
|
4408
|
-
P(
|
|
4409
|
-
const _ = e.text || "", E = e.placeholder || "Enter text...", A = !_, W = _ || E, z = A ?
|
|
4410
|
+
P(l, !0), P(d, !1);
|
|
4411
|
+
const _ = e.text || "", E = e.placeholder || "Enter text...", A = !_, W = _ || E, z = A ? I : w, Y = M, G = e.fontFamily || "Inter", N = e.fontWeight || 400;
|
|
4410
4412
|
t.font = `${N} ${Y}px "${G}", sans-serif`, t.fillStyle = z, t.textAlign = "left", t.textBaseline = p ? "top" : "middle";
|
|
4411
|
-
const J = e.inputPadding ?? 16, x =
|
|
4413
|
+
const J = e.inputPadding ?? 16, x = l.visible ? (l.offset ?? 16) + (l.size || 14) / 2 + 8 : J, F = d.visible ? (d.offset ?? 16) + (d.size || 14) / 2 + 8 : J, j = -(s / 2) + x, X = s - x - F, tt = e.inputType === "password" ? "•".repeat(W.length) : W;
|
|
4412
4414
|
if (t.save(), t.beginPath(), t.rect(j - 2, -n / 2 + 4, X + 4, n - 8), t.clip(), p) {
|
|
4413
4415
|
const D = tt.split(`
|
|
4414
4416
|
`);
|
|
@@ -4446,7 +4448,7 @@ class ci {
|
|
|
4446
4448
|
}
|
|
4447
4449
|
}
|
|
4448
4450
|
renderSlider(t, i) {
|
|
4449
|
-
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.geometry) || i.geometry, s = (o == null ? void 0 : o.options) || i.options || {}, n = e.width || 200, a = s.value ?? 50, r = s.min ?? 0, f = (s.max ?? 100) - r, h = f === 0 ? 0 : (a - r) / f, u = s.trackHeight || 4,
|
|
4451
|
+
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.geometry) || i.geometry, s = (o == null ? void 0 : o.options) || i.options || {}, n = e.width || 200, a = s.value ?? 50, r = s.min ?? 0, f = (s.max ?? 100) - r, h = f === 0 ? 0 : (a - r) / f, u = s.trackHeight || 4, l = s.trackRoundedness ?? 2, d = s.trackShape ?? "Rectangle", p = s.trackPath || "", y = s.accentColor || "#3b82f6", b = s.inactiveColor || "#374151", m = s.thumbShape || "Ellipse", v = s.thumbWidth ?? 16, S = s.thumbHeight ?? 16, C = s.thumbRoundedness ?? 0, w = s.thumbColor || "#ffffff", I = s.thumbPath || "", M = s.thumbIcon || "", k = s.showValueTooltip ?? !1, T = s.tooltipBgColor || "#333333", R = s.tooltipColor || "#ffffff", P = s.tooltipOffsetX ?? 0, _ = s.tooltipOffsetY ?? -25, E = (X, tt, L, O, D, q, ot) => {
|
|
4450
4452
|
if ((X === "Custom" || X === "Icon") && ot)
|
|
4451
4453
|
try {
|
|
4452
4454
|
const yt = new Path2D(ot);
|
|
@@ -4484,17 +4486,17 @@ class ci {
|
|
|
4484
4486
|
} else X === "Line" && (t.moveTo(tt - O / 2, L), t.lineTo(tt + O / 2, L));
|
|
4485
4487
|
t.fill();
|
|
4486
4488
|
}, A = this.createCanvasFill(t, b, n, u);
|
|
4487
|
-
A && (t.fillStyle = A, t.strokeStyle = A), d === "Line" ? (t.lineWidth = u, t.beginPath(), t.moveTo(-n / 2, 0), t.lineTo(n / 2, 0), t.stroke()) : E(d, 0, 0, n, u,
|
|
4489
|
+
A && (t.fillStyle = A, t.strokeStyle = A), d === "Line" ? (t.lineWidth = u, t.beginPath(), t.moveTo(-n / 2, 0), t.lineTo(n / 2, 0), t.stroke()) : E(d, 0, 0, n, u, l, p);
|
|
4488
4490
|
const W = n - v, z = -n / 2 + v / 2 + h * W, Y = z - -n / 2;
|
|
4489
4491
|
if (Y > 0) {
|
|
4490
4492
|
const X = this.createCanvasFill(t, y, n, u);
|
|
4491
|
-
X && (t.fillStyle = X, t.strokeStyle = X), d === "Line" ? (t.lineWidth = u, t.beginPath(), t.moveTo(-n / 2, 0), t.lineTo(z, 0), t.stroke()) : d === "Rectangle" && (t.beginPath(), this.drawRoundRect(t, -n / 2, -u / 2, Y, u,
|
|
4493
|
+
X && (t.fillStyle = X, t.strokeStyle = X), d === "Line" ? (t.lineWidth = u, t.beginPath(), t.moveTo(-n / 2, 0), t.lineTo(z, 0), t.stroke()) : d === "Rectangle" && (t.beginPath(), this.drawRoundRect(t, -n / 2, -u / 2, Y, u, l), t.fill());
|
|
4492
4494
|
}
|
|
4493
4495
|
t.save(), t.translate(z, 0);
|
|
4494
4496
|
const G = t.getTransform(), N = Math.sqrt(G.a * G.a + G.b * G.b) || 1;
|
|
4495
4497
|
t.shadowColor = "rgba(0,0,0,0.2)", t.shadowBlur = 4 * N, t.shadowOffsetY = 1 * N;
|
|
4496
4498
|
const J = this.createCanvasFill(t, w, v, S);
|
|
4497
|
-
if (J && (t.fillStyle = J), E(m, 0, 0, v, S, C, m === "Icon" ?
|
|
4499
|
+
if (J && (t.fillStyle = J), E(m, 0, 0, v, S, C, m === "Icon" ? M : I), t.restore(), k) {
|
|
4498
4500
|
t.save(), t.translate(z + P, _);
|
|
4499
4501
|
const X = Math.round(a).toString();
|
|
4500
4502
|
t.font = "10px Inter, sans-serif";
|
|
@@ -4519,11 +4521,11 @@ class ci {
|
|
|
4519
4521
|
var _;
|
|
4520
4522
|
const o = this.objectStates.get(i.id);
|
|
4521
4523
|
if (!o) return;
|
|
4522
|
-
const e = o.options || i.options || {}, s = i.geometry.width || 160, n = i.geometry.height || 40, a = -s / 2, r = -n / 2,
|
|
4523
|
-
let
|
|
4524
|
-
f ? (
|
|
4524
|
+
const e = o.options || i.options || {}, s = i.geometry.width || 160, n = i.geometry.height || 40, a = -s / 2, r = -n / 2, c = e.corner_radius ?? 6, f = e.disabled || e.previewState === "disabled", h = this.lastHoveredObjectId === i.id || e.previewState === "hover", u = (e.isOpen || e.previewState === "active") && !f;
|
|
4525
|
+
let l = e.backgroundColor, d = e.borderColor, p = e.color || "#333333";
|
|
4526
|
+
f ? (l = e.disabledBackgroundColor || "#f3f4f6", d = e.disabledBorderColor || "#e5e7eb", p = e.disabledColor || "#9ca3af") : u ? (l = e.activeBackgroundColor || l, d = e.activeBorderColor || d, p = e.activeColor || p) : h && (l = e.hoverBackgroundColor || l, d = e.hoverBorderColor || d, p = e.hoverColor || p), l || (l = "#ffffff"), d || (d = "#e5e7eb");
|
|
4525
4527
|
const y = t.globalAlpha;
|
|
4526
|
-
t.globalAlpha = y * (e.opacity ?? 1), this.drawRoundRect(t, a, r, s, n,
|
|
4528
|
+
t.globalAlpha = y * (e.opacity ?? 1), this.drawRoundRect(t, a, r, s, n, c), t.fillStyle = this.createCanvasFill(t, typeof l == "string" ? { type: "Solid", color: l } : l, s, n) || "#ffffff", t.fill();
|
|
4527
4529
|
const b = e.borderWidth ?? 1;
|
|
4528
4530
|
b > 0 && (t.strokeStyle = this.createCanvasFill(t, typeof d == "string" ? { type: "Solid", color: d } : d, s, n) || "#e5e7eb", t.lineWidth = b, t.stroke());
|
|
4529
4531
|
const m = 12, v = e.chevronType || "chevron", S = e.chevronSize || 16, C = (u ? e.openIconColor : e.closedIconColor) || e.chevronColor || "#6b7280";
|
|
@@ -4544,20 +4546,20 @@ class ci {
|
|
|
4544
4546
|
}
|
|
4545
4547
|
t.restore();
|
|
4546
4548
|
}
|
|
4547
|
-
const w = e.selectedOption || e.placeholder || "Select...",
|
|
4548
|
-
t.font = `${
|
|
4549
|
+
const w = e.selectedOption || e.placeholder || "Select...", I = e.fontSize || 14, M = e.fontWeight || 400, k = e.fontFamily || "Inter, sans-serif";
|
|
4550
|
+
t.font = `${M} ${I}px ${k}`;
|
|
4549
4551
|
const T = f ? e.disabledColor || "#9ca3af" : !e.selectedOption && e.placeholder ? "#9ca3af" : p;
|
|
4550
4552
|
t.fillStyle = this.createCanvasFill(t, typeof T == "string" ? { type: "Solid", color: T } : T, s, n) || "#333333", t.textAlign = "left", t.textBaseline = "middle";
|
|
4551
4553
|
const R = v === "none" ? 0 : S + 8, P = s - m * 2 - R;
|
|
4552
4554
|
if (t.save(), t.beginPath(), t.rect(a + m, r, P, n), t.clip(), t.fillText(w, a + m, 0), t.restore(), u && !f) {
|
|
4553
|
-
const E = r + n + 4, A = e.optionsList || [], W = e.itemHeight || 32, z = e.listPadding ?? 4, Y = A.length * W + z * 2, G = e.listCornerRadius ??
|
|
4555
|
+
const E = r + n + 4, A = e.optionsList || [], W = e.itemHeight || 32, z = e.listPadding ?? 4, Y = A.length * W + z * 2, G = e.listCornerRadius ?? c;
|
|
4554
4556
|
t.save();
|
|
4555
4557
|
const N = e.listShadow || {}, J = t.getTransform(), x = Math.sqrt(J.a * J.a + J.b * J.b) || 1;
|
|
4556
4558
|
t.shadowColor = typeof N.color == "string" ? N.color : ((_ = N.color) == null ? void 0 : _.color) || "rgba(0,0,0,0.15)", t.shadowBlur = (N.blur ?? 12) * x, t.shadowOffsetY = (N.offsetY ?? 6) * x, t.shadowOffsetX = (N.offsetX ?? 0) * x, t.beginPath(), this.drawRoundRect(t, a, E, s, Y, G), t.fillStyle = this.createCanvasFill(t, typeof e.listBackgroundColor == "string" ? { type: "Solid", color: e.listBackgroundColor } : e.listBackgroundColor || { type: "Solid", color: "#ffffff" }, s, Y) || "#ffffff", t.fill();
|
|
4557
4559
|
const F = e.listBorderWidth ?? 1;
|
|
4558
4560
|
F > 0 && (t.shadowColor = "transparent", t.strokeStyle = this.createCanvasFill(t, typeof e.listBorderColor == "string" ? { type: "Solid", color: e.listBorderColor } : e.listBorderColor || { type: "Solid", color: d }, s, Y) || "#e5e7eb", t.lineWidth = F, t.stroke()), t.restore();
|
|
4559
|
-
const j = e.itemFontSize ||
|
|
4560
|
-
t.font = `${
|
|
4561
|
+
const j = e.itemFontSize || I, X = e.itemFontFamily || k;
|
|
4562
|
+
t.font = `${M} ${j}px ${X}`, A.forEach((tt, L) => {
|
|
4561
4563
|
const O = E + z + L * W;
|
|
4562
4564
|
if (tt === e.selectedOption)
|
|
4563
4565
|
t.fillStyle = this.createCanvasFill(t, typeof e.itemSelectedBackgroundColor == "string" ? { type: "Solid", color: e.itemSelectedBackgroundColor } : e.itemSelectedBackgroundColor || { type: "Solid", color: "#f3f4f6" }, s, W) || "#f3f4f6", t.fillRect(a + F, O, s - F * 2, W), t.fillStyle = e.itemSelectedColor || e.accentColor || p || "#374151";
|
|
@@ -4572,34 +4574,34 @@ class ci {
|
|
|
4572
4574
|
}
|
|
4573
4575
|
renderButton(t, i) {
|
|
4574
4576
|
if (i.children && i.children.length > 0) return;
|
|
4575
|
-
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = i.geometry || {}, n = s.width || 120, a = s.height || 40, r = this.lastHoveredObjectId === i.id,
|
|
4577
|
+
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = i.geometry || {}, n = s.width || 120, a = s.height || 40, r = this.lastHoveredObjectId === i.id, c = this.activeObjectId === i.id, f = e.label || {}, h = e.hoverStyle || {}, u = e.activeStyle || {}, l = e.icon || { enabled: !1 };
|
|
4576
4578
|
let d = e.backgroundColor || "#3b82f6", p = f.color || "#ffffff", y = f.text || "Button", b = s.cornerRadius ?? 8, m = e.borderColor || "transparent", v = e.borderWidth || 0, S = 1;
|
|
4577
|
-
|
|
4579
|
+
c && u ? (d = u.backgroundColor || d, p = u.color || p, y = u.text || y, S = u.scale ?? 0.95, b = u.cornerRadius ?? b) : r && h && (d = h.backgroundColor || d, p = h.color || p, y = h.text || y, S = h.scale ?? 1, b = h.cornerRadius ?? b, m = h.borderColor || m);
|
|
4578
4580
|
const C = -n / 2, w = -a / 2;
|
|
4579
4581
|
t.save(), t.scale(S, S), t.beginPath(), this.drawRoundRect(t, C, w, n, a, b);
|
|
4580
|
-
const
|
|
4581
|
-
|
|
4582
|
-
const
|
|
4583
|
-
t.font = `${T} ${
|
|
4582
|
+
const I = this.createCanvasFill(t, d, n, a);
|
|
4583
|
+
I && (t.fillStyle = I, t.fill()), (v > 0 || r && h.borderColor) && (t.strokeStyle = m, t.lineWidth = v || (r ? 1 : 0), t.stroke());
|
|
4584
|
+
const M = f.fontSize || 14, k = f.fontFamily || "Inter", T = f.fontWeight || 600;
|
|
4585
|
+
t.font = `${T} ${M}px "${k}", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`, t.fillStyle = p, t.textAlign = "center", t.textBaseline = "middle";
|
|
4584
4586
|
let R = 0;
|
|
4585
|
-
if (
|
|
4586
|
-
const P =
|
|
4587
|
-
R =
|
|
4588
|
-
const Y = new Path2D(
|
|
4587
|
+
if (l.enabled && l.svgPath) {
|
|
4588
|
+
const P = M * 1.1, _ = l.gap || 8, E = t.measureText(y), W = -(E.width + P + _) / 2, z = l.position === "left" ? W + P / 2 : W + E.width + _ + P / 2;
|
|
4589
|
+
R = l.position === "left" ? W + P + _ + E.width / 2 : W + E.width / 2, t.save(), t.translate(z, 0);
|
|
4590
|
+
const Y = new Path2D(l.svgPath), G = P / 24;
|
|
4589
4591
|
t.scale(G, G), t.translate(-12, -12), t.fillStyle = p, t.fill(Y), t.restore();
|
|
4590
4592
|
}
|
|
4591
4593
|
t.fillText(y, R, 0), t.restore();
|
|
4592
4594
|
}
|
|
4593
4595
|
renderToggleButton(t, i) {
|
|
4594
4596
|
var y, b;
|
|
4595
|
-
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = e.checked ?? !1, n = ((y = i.geometry) == null ? void 0 : y.width) || 120, a = ((b = i.geometry) == null ? void 0 : b.height) || 40, r = -n / 2,
|
|
4596
|
-
t.save(), t.beginPath(), this.drawRoundRect(t, r,
|
|
4597
|
+
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = e.checked ?? !1, n = ((y = i.geometry) == null ? void 0 : y.width) || 120, a = ((b = i.geometry) == null ? void 0 : b.height) || 40, r = -n / 2, c = -a / 2, f = e.corner_radius ?? 8, h = e.label || {}, u = s ? e.accentColor || "#3b82f6" : e.inactiveColor || "#374151", l = s ? e.activeTextColor || "#ffffff" : e.inactiveTextColor || "#9ca3af";
|
|
4598
|
+
t.save(), t.beginPath(), this.drawRoundRect(t, r, c, n, a, f), t.fillStyle = u, t.fill();
|
|
4597
4599
|
const d = h.fontSize || 14, p = h.fontFamily || "Inter";
|
|
4598
|
-
t.font = `${h.fontWeight || 600} ${d}px "${p}", sans-serif`, t.fillStyle =
|
|
4600
|
+
t.font = `${h.fontWeight || 600} ${d}px "${p}", sans-serif`, t.fillStyle = l, t.textAlign = "center", t.textBaseline = "middle", t.fillText(h.text || "Toggle", 0, 0), t.restore();
|
|
4599
4601
|
}
|
|
4600
4602
|
renderToggle(t, i) {
|
|
4601
4603
|
var G, N, J, x, F, j, X, tt, L, O, D, q;
|
|
4602
|
-
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = ((G = i.geometry) == null ? void 0 : G.width) || 52, n = ((N = i.geometry) == null ? void 0 : N.height) || 30, a = -s / 2, r = -n / 2,
|
|
4604
|
+
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = ((G = i.geometry) == null ? void 0 : G.width) || 52, n = ((N = i.geometry) == null ? void 0 : N.height) || 30, a = -s / 2, r = -n / 2, c = e.checked ?? !1, f = e.cornerRadius ?? e.corner_radius ?? n / 2, h = e.toggleStyle || {}, u = h.backgroundColor || e.activeColor || "#10b981", l = h.borderColor || e.borderColor || "transparent", d = h.borderWidth ?? e.borderWidth ?? 0, p = h.knobColor || e.knobColor || "#ffffff", y = c ? u : e.inactiveColor || "#374151", b = c ? l : e.borderColor || "transparent", m = c ? d : e.borderWidth ?? 0, v = c ? p : e.knobColor || "#ffffff";
|
|
4603
4605
|
e.disabled && (t.globalAlpha *= 0.5), t.beginPath(), this.drawRoundRect(t, a, r, s, n, f);
|
|
4604
4606
|
const S = this.createCanvasFill(t, y, s, n);
|
|
4605
4607
|
if (S && (t.fillStyle = S, t.fill()), m > 0) {
|
|
@@ -4607,17 +4609,17 @@ class ci {
|
|
|
4607
4609
|
const ot = this.createCanvasFill(t, b, s, n);
|
|
4608
4610
|
ot && (t.strokeStyle = ot, t.stroke());
|
|
4609
4611
|
}
|
|
4610
|
-
const C = 2, w = n - C * 2,
|
|
4611
|
-
t.beginPath(), t.arc(T +
|
|
4612
|
+
const C = 2, w = n - C * 2, I = w / 2, M = a + C, k = a + s - C - w, T = c ? k : M, R = r + C;
|
|
4613
|
+
t.beginPath(), t.arc(T + I, R + I, I, 0, Math.PI * 2);
|
|
4612
4614
|
const P = this.createCanvasFill(t, v, w, w);
|
|
4613
4615
|
P && (t.fillStyle = P, t.fill()), e.disabled && (t.globalAlpha *= 2);
|
|
4614
4616
|
let _ = !1, E = !1;
|
|
4615
|
-
const A = (
|
|
4617
|
+
const A = (c ? (J = h.leftLabel) == null ? void 0 : J.text : null) || ((x = e.leftLabel) == null ? void 0 : x.text) || "", W = (c ? (F = h.leftLabel) == null ? void 0 : F.color : null) || ((j = e.leftLabel) == null ? void 0 : j.color) || "#f3f4f6";
|
|
4616
4618
|
if ((X = e.leftLabel) != null && X.enabled && A) {
|
|
4617
4619
|
const ot = e.leftLabel;
|
|
4618
4620
|
t.font = `${ot.fontWeight || 400} ${ot.fontSize || 12}px "${ot.fontFamily || "Inter"}", sans-serif`, t.fillStyle = W, t.textBaseline = "middle", t.textAlign = "right", t.fillText(A, a - (ot.gap || 8), 0), _ = !0;
|
|
4619
4621
|
}
|
|
4620
|
-
const z = (
|
|
4622
|
+
const z = (c ? (tt = h.rightLabel) == null ? void 0 : tt.text : null) || ((L = e.rightLabel) == null ? void 0 : L.text) || "", Y = (c ? (O = h.rightLabel) == null ? void 0 : O.color : null) || ((D = e.rightLabel) == null ? void 0 : D.color) || "#f3f4f6";
|
|
4621
4623
|
if ((q = e.rightLabel) != null && q.enabled && z) {
|
|
4622
4624
|
const ot = e.rightLabel;
|
|
4623
4625
|
t.font = `${ot.fontWeight || 400} ${ot.fontSize || 12}px "${ot.fontFamily || "Inter"}", sans-serif`, t.fillStyle = Y, t.textBaseline = "middle", t.textAlign = "left", t.fillText(z, a + s + (ot.gap || 8), 0), E = !0;
|
|
@@ -4632,8 +4634,8 @@ class ci {
|
|
|
4632
4634
|
}
|
|
4633
4635
|
renderCheckbox(t, i) {
|
|
4634
4636
|
var S, C;
|
|
4635
|
-
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = ((S = i.geometry) == null ? void 0 : S.width) || 20, n = ((C = i.geometry) == null ? void 0 : C.height) || 20, a = -s / 2, r = -n / 2,
|
|
4636
|
-
e.disabled && (t.globalAlpha *= 0.5), t.beginPath(), this.drawRoundRect(t, a, r, s, n,
|
|
4637
|
+
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = ((S = i.geometry) == null ? void 0 : S.width) || 20, n = ((C = i.geometry) == null ? void 0 : C.height) || 20, a = -s / 2, r = -n / 2, c = e.cornerRadius ?? 4, f = e.checked ?? !1, h = e.activeColor || "#3b82f6", u = e.inactiveColor || "transparent", l = e.checkColor || "#ffffff", d = e.borderColor || "#4b5563", p = e.borderWidth ?? 2, y = f ? h : u, b = f ? "transparent" : d, m = f ? 0 : p;
|
|
4638
|
+
e.disabled && (t.globalAlpha *= 0.5), t.beginPath(), this.drawRoundRect(t, a, r, s, n, c);
|
|
4637
4639
|
const v = this.createCanvasFill(t, y, s, n);
|
|
4638
4640
|
if (v && (t.fillStyle = v, t.fill()), m > 0) {
|
|
4639
4641
|
t.lineWidth = m;
|
|
@@ -4646,47 +4648,47 @@ class ci {
|
|
|
4646
4648
|
}
|
|
4647
4649
|
if (f) {
|
|
4648
4650
|
t.save(), t.beginPath();
|
|
4649
|
-
const w = this.createCanvasFill(t,
|
|
4650
|
-
t.strokeStyle = w ||
|
|
4651
|
-
const
|
|
4652
|
-
t.moveTo(
|
|
4651
|
+
const w = this.createCanvasFill(t, l, s, n);
|
|
4652
|
+
t.strokeStyle = w || l, t.lineWidth = Math.max(2, s * 0.12), t.lineCap = "round", t.lineJoin = "round";
|
|
4653
|
+
const I = a + s * 0.25, M = r + n * 0.5, k = a + s * 0.45, T = r + n * 0.7, R = a + s * 0.75, P = r + n * 0.25;
|
|
4654
|
+
t.moveTo(I, M), t.lineTo(k, T), t.lineTo(R, P), t.stroke(), t.restore();
|
|
4653
4655
|
}
|
|
4654
4656
|
if (e.disabled && (t.globalAlpha *= 2), e.label && e.label.text) {
|
|
4655
4657
|
const w = e.label;
|
|
4656
4658
|
t.save(), t.font = `${w.fontWeight || 400} ${w.fontSize || 14}px "${w.fontFamily || "Inter"}", sans-serif`, t.fillStyle = w.color || "#f3f4f6", t.textBaseline = "middle";
|
|
4657
|
-
const
|
|
4658
|
-
let
|
|
4659
|
-
w.position === "left" ? (t.textAlign = "right",
|
|
4659
|
+
const I = w.gap || 8;
|
|
4660
|
+
let M = 0, k = 0;
|
|
4661
|
+
w.position === "left" ? (t.textAlign = "right", M = a - I, k = 0) : w.position === "right" ? (t.textAlign = "left", M = a + s + I, k = 0) : w.position === "top" ? (t.textAlign = "center", M = 0, k = r - I, t.textBaseline = "bottom") : w.position === "bottom" && (t.textAlign = "center", M = 0, k = r + n + I, t.textBaseline = "top"), t.fillText(w.text, M, k), t.restore();
|
|
4660
4662
|
}
|
|
4661
4663
|
}
|
|
4662
4664
|
renderRadioGroup(t, i) {
|
|
4663
4665
|
var C, w;
|
|
4664
|
-
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = ((C = i.geometry) == null ? void 0 : C.width) || 180, n = ((w = i.geometry) == null ? void 0 : w.height) || 100, a = -s / 2, r = -n / 2,
|
|
4666
|
+
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = ((C = i.geometry) == null ? void 0 : C.width) || 180, n = ((w = i.geometry) == null ? void 0 : w.height) || 100, a = -s / 2, r = -n / 2, c = e.selectedValue, f = e.optionsList || ["Option 1", "Option 2", "Option 3"], h = e.orientation || "vertical", u = e.itemGap !== void 0 ? e.itemGap : 16, l = e.activeColor || "#3b82f6", d = e.inactiveColor || "#4b5563", p = e.textColor || "#ffffff", y = e.fontSize || 14, b = e.fontFamily || "Inter", m = e.fontWeight || 400;
|
|
4665
4667
|
e.disabled && (t.globalAlpha *= 0.5);
|
|
4666
4668
|
const v = 8, S = v * 2;
|
|
4667
4669
|
if (t.save(), t.font = `${m} ${y}px "${b}", sans-serif`, t.textBaseline = "middle", t.textAlign = "left", h === "vertical") {
|
|
4668
|
-
const
|
|
4669
|
-
f.forEach((
|
|
4670
|
-
const T = r + k *
|
|
4670
|
+
const I = Math.max(S, y) + u;
|
|
4671
|
+
f.forEach((M, k) => {
|
|
4672
|
+
const T = r + k * I + v;
|
|
4671
4673
|
t.beginPath(), t.arc(a + v, T, v, 0, Math.PI * 2);
|
|
4672
|
-
const R =
|
|
4673
|
-
R ? (t.strokeStyle = P ||
|
|
4674
|
+
const R = c === M, P = this.createCanvasFill(t, l, S, S), _ = this.createCanvasFill(t, d, S, S);
|
|
4675
|
+
R ? (t.strokeStyle = P || l, t.lineWidth = 2, t.stroke(), t.beginPath(), t.arc(a + v, T, v / 2, 0, Math.PI * 2), t.fillStyle = P || l, t.fill()) : (t.strokeStyle = _ || d, t.lineWidth = 1.5, t.stroke()), t.fillStyle = p, t.fillText(M, a + S + 8, T);
|
|
4674
4676
|
});
|
|
4675
4677
|
} else {
|
|
4676
|
-
let
|
|
4677
|
-
f.forEach((
|
|
4678
|
-
const k =
|
|
4679
|
-
t.beginPath(), t.arc(
|
|
4680
|
-
const R = this.createCanvasFill(t,
|
|
4681
|
-
k ? (t.strokeStyle = R ||
|
|
4678
|
+
let I = a;
|
|
4679
|
+
f.forEach((M) => {
|
|
4680
|
+
const k = c === M, T = t.measureText(M).width;
|
|
4681
|
+
t.beginPath(), t.arc(I + v, 0, v, 0, Math.PI * 2);
|
|
4682
|
+
const R = this.createCanvasFill(t, l, S, S), P = this.createCanvasFill(t, d, S, S);
|
|
4683
|
+
k ? (t.strokeStyle = R || l, t.lineWidth = 2, t.stroke(), t.beginPath(), t.arc(I + v, 0, v / 2, 0, Math.PI * 2), t.fillStyle = R || l, t.fill()) : (t.strokeStyle = P || d, t.lineWidth = 1.5, t.stroke()), t.fillStyle = p, t.fillText(M, I + S + 6, 0), I += S + 6 + T + u;
|
|
4682
4684
|
});
|
|
4683
4685
|
}
|
|
4684
4686
|
if (t.restore(), e.disabled && (t.globalAlpha *= 2), e.label && e.label.text) {
|
|
4685
|
-
const
|
|
4686
|
-
t.save(), t.font = `${
|
|
4687
|
-
const
|
|
4687
|
+
const I = e.label;
|
|
4688
|
+
t.save(), t.font = `${I.fontWeight || 400} ${I.fontSize || 14}px "${I.fontFamily || "Inter"}", sans-serif`, t.fillStyle = I.color || "#9ca3af", t.textBaseline = "middle";
|
|
4689
|
+
const M = I.gap || 8;
|
|
4688
4690
|
let k = 0, T = 0;
|
|
4689
|
-
|
|
4691
|
+
I.position === "left" ? (t.textAlign = "right", k = a - M, T = 0) : I.position === "right" ? (t.textAlign = "left", k = a + s + M, T = 0) : I.position === "top" ? (t.textAlign = "center", k = 0, T = r - M, t.textBaseline = "bottom") : I.position === "bottom" && (t.textAlign = "center", k = 0, T = r + n + M, t.textBaseline = "top"), t.fillText(I.text, k, T), t.restore();
|
|
4690
4692
|
}
|
|
4691
4693
|
}
|
|
4692
4694
|
renderBarChart(t, i) {
|
|
@@ -4753,16 +4755,16 @@ class ci {
|
|
|
4753
4755
|
}
|
|
4754
4756
|
P.beginPath(), Y ? (P.moveTo(_, E + W), P.lineTo(_, E + z), P.quadraticCurveTo(_, E, _ + z, E), P.lineTo(_ + A - z, E), P.quadraticCurveTo(_ + A, E, _ + A, E + z), P.lineTo(_ + A, E + W), P.lineTo(_, E + W)) : (P.moveTo(_, E), P.lineTo(_ + A - z, E), P.quadraticCurveTo(_ + A, E, _ + A, E + z), P.lineTo(_ + A, E + W - z), P.quadraticCurveTo(_ + A, E + W, _ + A - z, E + W), P.lineTo(_, E + W), P.lineTo(_, E)), P.closePath();
|
|
4755
4757
|
}
|
|
4756
|
-
}, n = s.width, a = s.height, r = -n / 2,
|
|
4758
|
+
}, n = s.width, a = s.height, r = -n / 2, c = -a / 2;
|
|
4757
4759
|
if (!s.datasets || s.datasets.length === 0 || s.categories.length === 0) {
|
|
4758
4760
|
t.save(), t.fillStyle = "rgba(99,102,241,0.7)", t.font = "bold 11px Inter, sans-serif", t.textAlign = "center", t.textBaseline = "middle", t.fillText("NO CHART DATA", 0, 0), t.restore();
|
|
4759
4761
|
return;
|
|
4760
4762
|
}
|
|
4761
4763
|
const f = s._getPreset();
|
|
4762
4764
|
let h = -1 / 0, u = 1 / 0;
|
|
4763
|
-
const
|
|
4765
|
+
const l = s.categories.length, d = s.datasets.length;
|
|
4764
4766
|
if (s.chartType === "stacked")
|
|
4765
|
-
for (let P = 0; P <
|
|
4767
|
+
for (let P = 0; P < l; P++) {
|
|
4766
4768
|
let _ = 0, E = 0;
|
|
4767
4769
|
s.datasets.forEach((A) => {
|
|
4768
4770
|
const W = A.data[P] ?? 0;
|
|
@@ -4778,10 +4780,10 @@ class ci {
|
|
|
4778
4780
|
isFinite(h) || (h = 10), isFinite(u) || (u = 0), h = Math.max(h, 0), u = Math.min(u, 0);
|
|
4779
4781
|
const p = h - u || 10;
|
|
4780
4782
|
t.save(), s.enableShadows && (t.shadowColor = s.shadowColor, t.shadowBlur = s.shadowBlur, t.shadowOffsetY = s.shadowOffsetY), t.font = s.axisLabelFontSize + "px Inter, sans-serif";
|
|
4781
|
-
const y = s.showYLabels ? t.measureText(h.toFixed(0)).width + 14 : 10, b = s.showXLabels ? s.axisLabelFontSize + 12 : 8, v = (s.showLegend && d > 0 ? s.legendFontSize + 10 : 0) + 8, S = 10, C = r + y, w =
|
|
4782
|
-
if (s.enableShadows && (t.shadowColor = "transparent"), t.beginPath(), t.roundRect(r,
|
|
4783
|
+
const y = s.showYLabels ? t.measureText(h.toFixed(0)).width + 14 : 10, b = s.showXLabels ? s.axisLabelFontSize + 12 : 8, v = (s.showLegend && d > 0 ? s.legendFontSize + 10 : 0) + 8, S = 10, C = r + y, w = c + v, I = n - y - S, M = a - v - b;
|
|
4784
|
+
if (s.enableShadows && (t.shadowColor = "transparent"), t.beginPath(), t.roundRect(r, c, n, a, 10), t.fillStyle = f.cardBackground, t.fill(), t.strokeStyle = f.cardBorderColor, t.lineWidth = 1, t.stroke(), s.chartBackground && s.chartBackground !== "transparent" && (t.beginPath(), t.rect(C, w, I, M), t.fillStyle = s.chartBackground, t.fill()), s.showLegend && d > 0) {
|
|
4783
4785
|
t.font = s.legendFontSize + "px Inter, sans-serif", t.textBaseline = "middle";
|
|
4784
|
-
const P =
|
|
4786
|
+
const P = c + 12;
|
|
4785
4787
|
let _ = C;
|
|
4786
4788
|
s.datasets.forEach((E, A) => {
|
|
4787
4789
|
const W = s._resolveColor(E.color, A), z = E.label || "Series " + (A + 1), Y = 7;
|
|
@@ -4793,11 +4795,11 @@ class ci {
|
|
|
4793
4795
|
t.setLineDash(s.gridLineDash || []), t.lineWidth = s.gridLineWidth || 1, t.strokeStyle = f.gridColor;
|
|
4794
4796
|
for (let P = 0; P <= k; P++)
|
|
4795
4797
|
if (s.orientation === "horizontal") {
|
|
4796
|
-
const _ = C + P / k *
|
|
4797
|
-
t.beginPath(), t.moveTo(_, w), t.lineTo(_, w +
|
|
4798
|
+
const _ = C + P / k * I;
|
|
4799
|
+
t.beginPath(), t.moveTo(_, w), t.lineTo(_, w + M), t.stroke();
|
|
4798
4800
|
} else {
|
|
4799
|
-
const _ = w + P / k *
|
|
4800
|
-
t.beginPath(), t.moveTo(C, _), t.lineTo(C +
|
|
4801
|
+
const _ = w + P / k * M;
|
|
4802
|
+
t.beginPath(), t.moveTo(C, _), t.lineTo(C + I, _), t.stroke();
|
|
4801
4803
|
}
|
|
4802
4804
|
t.setLineDash([]);
|
|
4803
4805
|
}
|
|
@@ -4805,39 +4807,39 @@ class ci {
|
|
|
4805
4807
|
t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "right", t.textBaseline = "middle", t.fillStyle = f.axisLabelColor;
|
|
4806
4808
|
for (let P = 0; P <= k; P++)
|
|
4807
4809
|
if (s.orientation === "horizontal") {
|
|
4808
|
-
const _ = u + P / k * p, E = C + P / k *
|
|
4809
|
-
t.textAlign = "center", t.fillText(_.toFixed(0), E, w +
|
|
4810
|
+
const _ = u + P / k * p, E = C + P / k * I;
|
|
4811
|
+
t.textAlign = "center", t.fillText(_.toFixed(0), E, w + M + s.axisLabelFontSize);
|
|
4810
4812
|
} else {
|
|
4811
|
-
const _ = h - P / k * p, E = w + P / k *
|
|
4813
|
+
const _ = h - P / k * p, E = w + P / k * M;
|
|
4812
4814
|
t.textAlign = "right", t.fillText(_.toFixed(0), C - 6, E);
|
|
4813
4815
|
}
|
|
4814
4816
|
}
|
|
4815
|
-
if (t.setLineDash([]), s.showXAxis && (t.lineWidth = s.xAxisLineWidth || 1, t.strokeStyle = s.xAxisColor, t.beginPath(), t.moveTo(C, w +
|
|
4817
|
+
if (t.setLineDash([]), s.showXAxis && (t.lineWidth = s.xAxisLineWidth || 1, t.strokeStyle = s.xAxisColor, t.beginPath(), t.moveTo(C, w + M), t.lineTo(C + I, w + M), t.stroke()), s.showYAxis && (t.lineWidth = s.yAxisLineWidth || 1, t.strokeStyle = s.yAxisColor, t.beginPath(), t.moveTo(C, w), t.lineTo(C, w + M), t.stroke()), s.enableShadows && (t.shadowColor = s.shadowColor), s.chartType === "stacked")
|
|
4816
4818
|
if (s.orientation === "horizontal") {
|
|
4817
|
-
const P =
|
|
4818
|
-
for (let _ = 0; _ <
|
|
4819
|
+
const P = M / l;
|
|
4820
|
+
for (let _ = 0; _ < l; _++) {
|
|
4819
4821
|
const E = w + _ * P + P / 2;
|
|
4820
4822
|
s.showXLabels && (t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "right", t.textBaseline = "middle", t.fillStyle = f.axisLabelColor, t.shadowColor = "transparent", t.fillText(s.categories[_] || "", C - 5, E), s.enableShadows && (t.shadowColor = s.shadowColor));
|
|
4821
4823
|
let A = C;
|
|
4822
4824
|
s.datasets.forEach((W, z) => {
|
|
4823
4825
|
const Y = W.data[_] ?? 0;
|
|
4824
4826
|
if (Y === 0) return;
|
|
4825
|
-
const G = Y / p *
|
|
4827
|
+
const G = Y / p * I, N = Math.min(s.barWidth * d + s.barGap, P - 8), J = E - N / 2, x = A;
|
|
4826
4828
|
A += G;
|
|
4827
4829
|
const F = s._resolveColor(W.color, z);
|
|
4828
4830
|
t.beginPath(), t.fillStyle = s._makeGradient(t, F, x, J, x + G, J), s._drawRoundedBar(t, x, J, G, N, z === d - 1 ? s.barCornerRadius : 0, !1), s.barStyle === "outline" || s.barStyle === "dashed" ? (t.fillStyle = "transparent", t.strokeStyle = s.barBorderColor === "auto" ? F : s.barBorderColor, t.lineWidth = s.barBorderWidth, s.barStyle === "dashed" && t.setLineDash([4, 4]), t.stroke(), t.setLineDash([])) : t.fill();
|
|
4829
4831
|
});
|
|
4830
4832
|
}
|
|
4831
4833
|
} else {
|
|
4832
|
-
const P =
|
|
4833
|
-
for (let _ = 0; _ <
|
|
4834
|
+
const P = I / l;
|
|
4835
|
+
for (let _ = 0; _ < l; _++) {
|
|
4834
4836
|
const E = C + _ * P + P / 2;
|
|
4835
|
-
s.showXLabels && (t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "center", t.textBaseline = "top", t.fillStyle = f.axisLabelColor, t.shadowColor = "transparent", t.fillText(s.categories[_] || "", E, w +
|
|
4836
|
-
let A = w +
|
|
4837
|
+
s.showXLabels && (t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "center", t.textBaseline = "top", t.fillStyle = f.axisLabelColor, t.shadowColor = "transparent", t.fillText(s.categories[_] || "", E, w + M + 5), s.enableShadows && (t.shadowColor = s.shadowColor));
|
|
4838
|
+
let A = w + M;
|
|
4837
4839
|
s.datasets.forEach((W, z) => {
|
|
4838
4840
|
const Y = W.data[_] ?? 0;
|
|
4839
4841
|
if (Y === 0) return;
|
|
4840
|
-
const G = Y / p *
|
|
4842
|
+
const G = Y / p * M, N = Math.min(s.barWidth * d + s.barGap, P - 8), J = E - N / 2, x = A - G;
|
|
4841
4843
|
A -= G;
|
|
4842
4844
|
const F = s._resolveColor(W.color, z);
|
|
4843
4845
|
t.beginPath(), t.fillStyle = s._makeGradient(t, F, J, x, J, x + G), s._drawRoundedBar(t, J, x, N, G, z === d - 1 ? s.barCornerRadius : 0, !0), s.barStyle === "outline" || s.barStyle === "dashed" ? (t.fillStyle = "transparent", t.strokeStyle = s.barBorderColor === "auto" ? F : s.barBorderColor, t.lineWidth = s.barBorderWidth, s.barStyle === "dashed" && t.setLineDash([4, 4]), t.stroke(), t.setLineDash([])) : t.fill();
|
|
@@ -4845,26 +4847,26 @@ class ci {
|
|
|
4845
4847
|
}
|
|
4846
4848
|
}
|
|
4847
4849
|
else if (s.orientation === "horizontal") {
|
|
4848
|
-
const P =
|
|
4849
|
-
for (let A = 0; A <
|
|
4850
|
+
const P = M / l, _ = d * s.barWidth + Math.max(0, (d - 1) * s.barGap), E = C + (0 - u) / p * I;
|
|
4851
|
+
for (let A = 0; A < l; A++) {
|
|
4850
4852
|
const W = w + A * P + P / 2;
|
|
4851
4853
|
s.showXLabels && (t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "right", t.textBaseline = "middle", t.fillStyle = f.axisLabelColor, t.shadowColor = "transparent", t.fillText(s.categories[A] || "", C - 5, W), s.enableShadows && (t.shadowColor = s.shadowColor));
|
|
4852
4854
|
const z = W - _ / 2;
|
|
4853
4855
|
s.datasets.forEach((Y, G) => {
|
|
4854
|
-
const N = Y.data[A] ?? 0, J = Math.abs(N / p *
|
|
4856
|
+
const N = Y.data[A] ?? 0, J = Math.abs(N / p * I);
|
|
4855
4857
|
if (J < 1) return;
|
|
4856
4858
|
const x = z + G * (s.barWidth + s.barGap), F = N >= 0 ? E : E - J, j = s._resolveColor(Y.color, G);
|
|
4857
4859
|
t.beginPath(), t.fillStyle = s._makeGradient(t, j, F, x, F + J, x), s._drawRoundedBar(t, F, x, J, s.barWidth, s.barCornerRadius, !1), s.barStyle === "outline" || s.barStyle === "dashed" ? (t.fillStyle = "transparent", t.strokeStyle = s.barBorderColor === "auto" ? j : s.barBorderColor, t.lineWidth = s.barBorderWidth, s.barStyle === "dashed" && t.setLineDash([4, 4]), t.stroke(), t.setLineDash([])) : t.fill(), s.showValueOnTop && N !== 0 && (t.font = (s.valueFontWeight || "bold") + " " + (s.valueFontSize || 10) + "px Inter, sans-serif", t.textAlign = N >= 0 ? "left" : "right", t.textBaseline = "middle", t.fillStyle = s.valueColor === "auto" ? j : s.valueColor || "#fff", t.shadowColor = "transparent", t.fillText(N.toString(), N >= 0 ? F + J + 4 : F - 4, x + s.barWidth / 2), s.enableShadows && (t.shadowColor = s.shadowColor));
|
|
4858
4860
|
});
|
|
4859
4861
|
}
|
|
4860
4862
|
} else {
|
|
4861
|
-
const P =
|
|
4862
|
-
for (let A = 0; A <
|
|
4863
|
+
const P = I / l, _ = d * s.barWidth + Math.max(0, (d - 1) * s.barGap), E = w + M - (0 - u) / p * M;
|
|
4864
|
+
for (let A = 0; A < l; A++) {
|
|
4863
4865
|
const W = C + A * P + P / 2;
|
|
4864
|
-
s.showXLabels && (t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "center", t.textBaseline = "top", t.fillStyle = f.axisLabelColor, t.shadowColor = "transparent", t.fillText(s.categories[A] || "", W, w +
|
|
4866
|
+
s.showXLabels && (t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "center", t.textBaseline = "top", t.fillStyle = f.axisLabelColor, t.shadowColor = "transparent", t.fillText(s.categories[A] || "", W, w + M + 5), s.enableShadows && (t.shadowColor = s.shadowColor));
|
|
4865
4867
|
const z = W - _ / 2;
|
|
4866
4868
|
s.datasets.forEach((Y, G) => {
|
|
4867
|
-
const N = Y.data[A] ?? 0, J = Math.abs(N / p *
|
|
4869
|
+
const N = Y.data[A] ?? 0, J = Math.abs(N / p * M);
|
|
4868
4870
|
if (J < 1) return;
|
|
4869
4871
|
const x = z + G * (s.barWidth + s.barGap), F = N >= 0 ? E - J : E, j = s._resolveColor(Y.color, G);
|
|
4870
4872
|
t.beginPath(), t.fillStyle = s._makeGradient(t, j, x, F, x, F + J), s._drawRoundedBar(t, x, F, s.barWidth, J, s.barCornerRadius, !0), s.barStyle === "outline" || s.barStyle === "dashed" ? (t.fillStyle = "transparent", t.strokeStyle = s.barBorderColor === "auto" ? j : s.barBorderColor, t.lineWidth = s.barBorderWidth, s.barStyle === "dashed" && t.setLineDash([4, 4]), t.stroke(), t.setLineDash([])) : t.fill(), s.showValueOnTop && N !== 0 && (t.font = (s.valueFontWeight || "bold") + " " + (s.valueFontSize || 10) + "px Inter, sans-serif", t.textAlign = "center", t.textBaseline = N >= 0 ? "bottom" : "top", t.fillStyle = s.valueColor === "auto" ? j : s.valueColor || "#fff", t.shadowColor = "transparent", t.fillText(N.toString(), x + s.barWidth / 2, N >= 0 ? F - 4 : F + J + 4), s.enableShadows && (t.shadowColor = s.shadowColor));
|
|
@@ -4910,52 +4912,52 @@ class ci {
|
|
|
4910
4912
|
t.save(), t.fillStyle = "rgba(99,102,241,0.8)", t.font = "bold 11px Inter, sans-serif", t.textAlign = "center", t.textBaseline = "middle", t.fillText("EMPTY DATA", 0, 0), t.restore();
|
|
4911
4913
|
return;
|
|
4912
4914
|
}
|
|
4913
|
-
const
|
|
4914
|
-
t.save(), t.beginPath(), t.roundRect(-n / 2, -a / 2, n, a, 10), t.fillStyle =
|
|
4915
|
-
const f = s.showLegend ? Math.ceil(s.slices.length / 2) : 0, h = f > 0 ? f * (s.legendFontSize + 8) + 10 : 0, u = a - h - 16,
|
|
4915
|
+
const c = s._getPreset();
|
|
4916
|
+
t.save(), t.beginPath(), t.roundRect(-n / 2, -a / 2, n, a, 10), t.fillStyle = c.cardBackground, t.fill(), t.strokeStyle = c.cardBorderColor, t.lineWidth = 1, t.stroke();
|
|
4917
|
+
const f = s.showLegend ? Math.ceil(s.slices.length / 2) : 0, h = f > 0 ? f * (s.legendFontSize + 8) + 10 : 0, u = a - h - 16, l = Math.min(n - 24, u) / 2, d = 0, p = -h / 2;
|
|
4916
4918
|
if (s.chartType === "rose") {
|
|
4917
|
-
const m = Math.max(...s.slices.map((C) => C.value || 0)), v = Math.PI * 2 / s.slices.length, S =
|
|
4919
|
+
const m = Math.max(...s.slices.map((C) => C.value || 0)), v = Math.PI * 2 / s.slices.length, S = l > 0 ? s.sliceGap / l : 0;
|
|
4918
4920
|
s.slices.forEach((C, w) => {
|
|
4919
|
-
const
|
|
4920
|
-
if (
|
|
4921
|
-
const
|
|
4922
|
-
if (t.beginPath(), t.moveTo(d, p), t.arc(d, p,
|
|
4923
|
-
const P = k + (T - k) / 2, _ = d +
|
|
4924
|
-
t.save(), t.font = `bold ${s.labelFontSize}px Inter, sans-serif`, t.fillStyle =
|
|
4921
|
+
const I = C.value || 0;
|
|
4922
|
+
if (I === 0) return;
|
|
4923
|
+
const M = I / m * l, k = -Math.PI / 2 + w * v + S / 2, T = k + v - S, R = s._resolveSliceColor(C, w);
|
|
4924
|
+
if (t.beginPath(), t.moveTo(d, p), t.arc(d, p, M, k, T), t.closePath(), t.fillStyle = R + "cc", t.fill(), t.strokeStyle = R, t.lineWidth = 1.5, t.stroke(), s.showLabels) {
|
|
4925
|
+
const P = k + (T - k) / 2, _ = d + M * 0.65 * Math.cos(P), E = p + M * 0.65 * Math.sin(P), A = Math.round(I / r * 100);
|
|
4926
|
+
t.save(), t.font = `bold ${s.labelFontSize}px Inter, sans-serif`, t.fillStyle = c.labelColor, t.textAlign = "center", t.textBaseline = "middle", t.fillText(`${A}%`, _, E), t.restore();
|
|
4925
4927
|
}
|
|
4926
4928
|
});
|
|
4927
4929
|
} else {
|
|
4928
|
-
const m = s.chartType === "pie" ? 0 : s.innerRadius, v =
|
|
4930
|
+
const m = s.chartType === "pie" ? 0 : s.innerRadius, v = l * Math.max(0, m), S = l > 0 ? s.sliceGap / l : 0;
|
|
4929
4931
|
let C = -Math.PI / 2;
|
|
4930
|
-
if (s.slices.forEach((w,
|
|
4931
|
-
const
|
|
4932
|
-
if (
|
|
4933
|
-
C +=
|
|
4932
|
+
if (s.slices.forEach((w, I) => {
|
|
4933
|
+
const M = w.value || 0;
|
|
4934
|
+
if (M === 0) {
|
|
4935
|
+
C += M / r * Math.PI * 2;
|
|
4934
4936
|
return;
|
|
4935
4937
|
}
|
|
4936
|
-
const k =
|
|
4938
|
+
const k = M / r * Math.PI * 2, T = C + S / 2, R = C + k - S / 2;
|
|
4937
4939
|
if (R <= T) {
|
|
4938
4940
|
C += k;
|
|
4939
4941
|
return;
|
|
4940
4942
|
}
|
|
4941
|
-
const P = s._resolveSliceColor(w,
|
|
4942
|
-
if (t.beginPath(), t.fillStyle = P, v <= 0 ? (t.moveTo(d, p), t.arc(d, p,
|
|
4943
|
-
const _ = T + (R - T) / 2, E = v + (
|
|
4944
|
-
t.save(), t.font = `bold ${s.labelFontSize}px Inter, sans-serif`, t.fillStyle =
|
|
4943
|
+
const P = s._resolveSliceColor(w, I);
|
|
4944
|
+
if (t.beginPath(), t.fillStyle = P, v <= 0 ? (t.moveTo(d, p), t.arc(d, p, l, T, R), t.lineTo(d, p)) : (t.moveTo(d + l * Math.cos(T), p + l * Math.sin(T)), t.arc(d, p, l, T, R), t.arc(d, p, v, R, T, !0), t.closePath()), t.fill(), s.showLabels) {
|
|
4945
|
+
const _ = T + (R - T) / 2, E = v + (l - v) / 2, A = d + E * Math.cos(_), W = p + E * Math.sin(_), z = Math.round(M / r * 100);
|
|
4946
|
+
t.save(), t.font = `bold ${s.labelFontSize}px Inter, sans-serif`, t.fillStyle = c.labelColor, t.textAlign = "center", t.textBaseline = "middle", t.fillText(`${z}%`, A, W), t.restore();
|
|
4945
4947
|
}
|
|
4946
4948
|
C += k;
|
|
4947
4949
|
}), s.chartType === "donut" && s.showCenterText && v > 14) {
|
|
4948
|
-
const w = Math.round(r),
|
|
4949
|
-
t.textAlign = "center", t.textBaseline = "middle", t.font = `bold ${
|
|
4950
|
+
const w = Math.round(r), I = Math.min(Math.floor(v * 0.52), 20), M = Math.min(Math.floor(v * 0.26), 10);
|
|
4951
|
+
t.textAlign = "center", t.textBaseline = "middle", t.font = `bold ${I}px Inter, sans-serif`, t.fillStyle = c.centerTextColor, t.fillText(w.toString(), d, p - M * 0.5), s.centerLabel && (t.font = `${M}px Inter, sans-serif`, t.fillStyle = c.centerLabelColor, t.fillText(s.centerLabel, d, p + I * 0.6));
|
|
4950
4952
|
}
|
|
4951
4953
|
}
|
|
4952
4954
|
if (s.showLegend && s.slices.length > 0) {
|
|
4953
4955
|
t.font = `${s.legendFontSize}px Inter, sans-serif`;
|
|
4954
4956
|
const m = 2, v = n / m, S = s.legendFontSize + 8, C = a / 2 - h + 10, w = -n / 2 + 10;
|
|
4955
|
-
s.slices.forEach((
|
|
4956
|
-
const k =
|
|
4957
|
-
t.beginPath(), t.roundRect(R, P - E / 2, E, E, 2), t.fillStyle = _, t.fill(), t.textAlign = "left", t.textBaseline = "middle", t.fillStyle =
|
|
4958
|
-
const A = Math.round((
|
|
4957
|
+
s.slices.forEach((I, M) => {
|
|
4958
|
+
const k = M % m, T = Math.floor(M / m), R = w + k * v, P = C + T * S, _ = s._resolveSliceColor(I, M), E = 7;
|
|
4959
|
+
t.beginPath(), t.roundRect(R, P - E / 2, E, E, 2), t.fillStyle = _, t.fill(), t.textAlign = "left", t.textBaseline = "middle", t.fillStyle = c.legendColor;
|
|
4960
|
+
const A = Math.round((I.value || 0) / r * 100), W = `${I.label || "Item"} ${A}%`, z = v - E - 20;
|
|
4959
4961
|
let Y = W;
|
|
4960
4962
|
for (; t.measureText(Y).width > z && Y.length > 4; )
|
|
4961
4963
|
Y = Y.slice(0, -4) + "…";
|
|
@@ -4967,23 +4969,23 @@ class ci {
|
|
|
4967
4969
|
renderJoystick(t, i) {
|
|
4968
4970
|
var p, y, b, m, v;
|
|
4969
4971
|
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.width) !== void 0 ? o.width : ((p = i.geometry) == null ? void 0 : p.width) ?? i.width ?? 100, s = (o == null ? void 0 : o.height) !== void 0 ? o.height : ((y = i.geometry) == null ? void 0 : y.height) ?? i.height ?? 100, n = Math.min(e, s) * 0.45, a = Math.min(e, s) * 0.15;
|
|
4970
|
-
let r = i.handleX || 0,
|
|
4971
|
-
o && o.handleX !== void 0 && (r = o.handleX), o && o.handleY !== void 0 && (
|
|
4972
|
+
let r = i.handleX || 0, c = i.handleY || 0;
|
|
4973
|
+
o && o.handleX !== void 0 && (r = o.handleX), o && o.handleY !== void 0 && (c = o.handleY), t.save();
|
|
4972
4974
|
let f = 0, h = 0;
|
|
4973
4975
|
i.handleOrigin === "top-left" ? (f = e / 2, h = s / 2) : i.handleOrigin === "bottom-right" && (f = -e / 2, h = -s / 2), t.translate(f, h), t.beginPath(), i.boundsShape === "square" ? t.rect(-n, -n, n * 2, n * 2) : t.arc(0, 0, n, 0, Math.PI * 2), t.fillStyle = "rgba(0,0,0,0.2)", (b = i.style) != null && b.fill && typeof i.style.fill == "string" ? t.fillStyle = i.style.fill : (m = i.style) != null && m.fill && i.style.fill.type === "solid" && (t.fillStyle = i.style.fill.color), t.fill(), (v = i.style) != null && v.stroke && i.style.stroke.isEnabled !== !1 && (t.lineWidth = i.style.stroke.width || 1, t.strokeStyle = i.style.stroke.color || "#000", t.stroke());
|
|
4974
4976
|
const u = n - a;
|
|
4975
|
-
let
|
|
4976
|
-
i.joystickType === "2D" ? (
|
|
4977
|
+
let l = 0, d = 0;
|
|
4978
|
+
i.joystickType === "2D" ? (l = r * u, d = c * u) : i.joystickType === "1D_X" ? (l = r * u, d = 0) : i.joystickType === "1D_Y" && (l = 0, d = c * u), t.beginPath(), t.arc(l, d, a, 0, Math.PI * 2), t.fillStyle = "#fff", t.fill(), t.strokeStyle = "rgba(0,0,0,0.5)", t.lineWidth = 1, t.stroke(), t.restore();
|
|
4977
4979
|
}
|
|
4978
4980
|
getRadioGroupItemIndexAtPointer(t, i, o) {
|
|
4979
|
-
var
|
|
4981
|
+
var M, k;
|
|
4980
4982
|
const e = t.options || {}, s = this.objectStates.get(t.id) || {}, n = e.optionsList || [];
|
|
4981
4983
|
if (n.length === 0) return null;
|
|
4982
|
-
const a = s.width !== void 0 ? s.width : ((
|
|
4983
|
-
if (
|
|
4984
|
+
const a = s.width !== void 0 ? s.width : ((M = t.geometry) == null ? void 0 : M.width) || 180, r = s.height !== void 0 ? s.height : ((k = t.geometry) == null ? void 0 : k.height) || 100, c = e.orientation || "vertical", f = e.itemGap !== void 0 ? e.itemGap : 16, h = e.fontSize || 14, u = this.getWorldTransform(t.id), l = i - u.x, d = o - u.y, p = -u.rotation * (Math.PI / 180), y = Math.cos(p), b = Math.sin(p), m = l * y - d * b, v = l * b + d * y, C = 8 * 2, w = -a / 2, I = -r / 2;
|
|
4985
|
+
if (c === "vertical") {
|
|
4984
4986
|
const T = Math.max(C, h) + f;
|
|
4985
4987
|
for (let R = 0; R < n.length; R++) {
|
|
4986
|
-
const P =
|
|
4988
|
+
const P = I + R * T;
|
|
4987
4989
|
if (m >= w && m <= w + a && v >= P && v <= P + T)
|
|
4988
4990
|
return R;
|
|
4989
4991
|
}
|
|
@@ -4991,7 +4993,7 @@ class ci {
|
|
|
4991
4993
|
let T = w;
|
|
4992
4994
|
for (let R = 0; R < n.length; R++) {
|
|
4993
4995
|
const _ = n[R].length * 8, E = C + 6 + _ + f;
|
|
4994
|
-
if (m >= T && m <= T + E && v >=
|
|
4996
|
+
if (m >= T && m <= T + E && v >= I && v <= I + r)
|
|
4995
4997
|
return R;
|
|
4996
4998
|
T += E;
|
|
4997
4999
|
}
|
|
@@ -5035,11 +5037,11 @@ class ci {
|
|
|
5035
5037
|
}
|
|
5036
5038
|
p._resolvedData = y;
|
|
5037
5039
|
}), r < 2) return;
|
|
5038
|
-
const
|
|
5039
|
-
const y =
|
|
5040
|
+
const c = a - n, f = o / (r - 1), h = (p) => {
|
|
5041
|
+
const y = c === 0 ? 0.5 : (p - n) / c;
|
|
5040
5042
|
return e / 2 - y * e;
|
|
5041
|
-
}, u = (p) => p * f - o / 2,
|
|
5042
|
-
if (i.showXAxis && (t.beginPath(), t.strokeStyle = i.xAxisColor ||
|
|
5043
|
+
}, u = (p) => p * f - o / 2, l = i.axisColor || "#333333";
|
|
5044
|
+
if (i.showXAxis && (t.beginPath(), t.strokeStyle = i.xAxisColor || l, t.lineWidth = 1, t.moveTo(-o / 2, e / 2), t.lineTo(o / 2, e / 2), t.stroke()), i.showYAxis && (t.beginPath(), t.strokeStyle = i.yAxisColor || l, t.lineWidth = 1, t.moveTo(-o / 2, -e / 2), t.lineTo(-o / 2, e / 2), t.stroke()), t.fillStyle = i.axisLabelColor || "#333333", t.font = `${i.axisLabelFontSize || 10}px Inter, sans-serif`, i.showXLabels) {
|
|
5043
5045
|
t.textAlign = "center", t.textBaseline = "top";
|
|
5044
5046
|
for (let p = 0; p < r; p++) {
|
|
5045
5047
|
const y = u(p);
|
|
@@ -5059,9 +5061,9 @@ class ci {
|
|
|
5059
5061
|
if (t.beginPath(), t.moveTo(u(0), e / 2), t.lineTo(u(0), h(y[0])), p.smoothing && y.length > 2)
|
|
5060
5062
|
for (let m = 0; m < y.length - 1; m++) {
|
|
5061
5063
|
const v = y[m === 0 ? m : m - 1], S = y[m], C = y[m + 1], w = y[m + 1 === y.length - 1 ? m + 1 : m + 2];
|
|
5062
|
-
for (let
|
|
5063
|
-
const
|
|
5064
|
-
t.lineTo(u(m +
|
|
5064
|
+
for (let I = 1; I <= d; I++) {
|
|
5065
|
+
const M = I / d, k = this._catmullRom(v, S, C, w, M);
|
|
5066
|
+
t.lineTo(u(m + M), h(k));
|
|
5065
5067
|
}
|
|
5066
5068
|
}
|
|
5067
5069
|
else
|
|
@@ -5075,8 +5077,8 @@ class ci {
|
|
|
5075
5077
|
for (let b = 0; b < y.length - 1; b++) {
|
|
5076
5078
|
const m = y[b === 0 ? b : b - 1], v = y[b], S = y[b + 1], C = y[b + 1 === y.length - 1 ? b + 1 : b + 2];
|
|
5077
5079
|
for (let w = 1; w <= d; w++) {
|
|
5078
|
-
const
|
|
5079
|
-
t.lineTo(u(b +
|
|
5080
|
+
const I = w / d, M = this._catmullRom(m, v, S, C, I);
|
|
5081
|
+
t.lineTo(u(b + I), h(M));
|
|
5080
5082
|
}
|
|
5081
5083
|
}
|
|
5082
5084
|
else
|
|
@@ -5098,8 +5100,8 @@ class ci {
|
|
|
5098
5100
|
}
|
|
5099
5101
|
}
|
|
5100
5102
|
_catmullRom(t, i, o, e, s) {
|
|
5101
|
-
const n = (o - t) * 0.5, a = (e - i) * 0.5, r = s * s,
|
|
5102
|
-
return (2 * i - 2 * o + n + a) *
|
|
5103
|
+
const n = (o - t) * 0.5, a = (e - i) * 0.5, r = s * s, c = s * r;
|
|
5104
|
+
return (2 * i - 2 * o + n + a) * c + (-3 * i + 3 * o - 2 * n - a) * r + n * s + i;
|
|
5103
5105
|
}
|
|
5104
5106
|
normalizeOpacity(t) {
|
|
5105
5107
|
const i = typeof t == "number" ? t : parseFloat(String(t));
|
|
@@ -5114,15 +5116,15 @@ class ci {
|
|
|
5114
5116
|
return t.fillStyle = f, f;
|
|
5115
5117
|
}
|
|
5116
5118
|
if ((i.type === "LinearGradient" || i.type === "RadialGradient" || i.type === "AngularGradient" || i.type === "DiamondGradient") && i.stops) {
|
|
5117
|
-
const r = (
|
|
5119
|
+
const r = (c, f = 100) => {
|
|
5118
5120
|
var S, C;
|
|
5119
|
-
const u = (((C = (S = this.artboard) == null ? void 0 : S.tokens) == null ? void 0 : C.colors) || {})[
|
|
5121
|
+
const u = (((C = (S = this.artboard) == null ? void 0 : S.tokens) == null ? void 0 : C.colors) || {})[c] || c, l = this.normalizeOpacity(i.opacity ?? 100), p = this.normalizeOpacity(f) * l;
|
|
5120
5122
|
if (p >= 1 && u.startsWith("#")) return u;
|
|
5121
5123
|
const y = u.startsWith("#") ? u.replace("#", "") : "ffffff", b = parseInt(y.substring(0, 2), 16), m = parseInt(y.substring(2, 4), 16), v = parseInt(y.substring(4, 6), 16);
|
|
5122
5124
|
return `rgba(${b}, ${m}, ${v}, ${p})`;
|
|
5123
5125
|
};
|
|
5124
5126
|
if (i.type === "LinearGradient") {
|
|
5125
|
-
const
|
|
5127
|
+
const c = (p, y, b) => Array.isArray(p) ? p[y] ?? (y === 0 ? 0 : 1) : p && typeof p == "object" ? p[b] ?? (y === 0 ? 0 : 1) : y === 0 ? 0 : 1, f = c(i.start, 0, "x") * o - o / 2, h = c(i.start, 1, "y") * e - e / 2, u = c(i.end, 0, "x") * o - o / 2, l = c(i.end, 1, "y") * e - e / 2, d = t.createLinearGradient(f, h, u, l);
|
|
5126
5128
|
if (i.stops.forEach((p) => {
|
|
5127
5129
|
const y = p.offset !== void 0 ? p.offset : p.pos !== void 0 ? p.pos : p.position !== void 0 ? p.position : 0, b = r(p.color || "#000000", p.opacity ?? 100);
|
|
5128
5130
|
d.addColorStop(Math.max(0, Math.min(1, y)), b);
|
|
@@ -5132,50 +5134,50 @@ class ci {
|
|
|
5132
5134
|
}
|
|
5133
5135
|
return d;
|
|
5134
5136
|
} else if (i.type === "RadialGradient") {
|
|
5135
|
-
const
|
|
5137
|
+
const c = (d, p, y) => Array.isArray(d) ? d[p] ?? 0.5 : d && typeof d == "object" ? d[y] ?? 0.5 : 0.5, f = c(i.center, 0, "x") * o - o / 2, h = c(i.center, 1, "y") * e - e / 2, u = (i.radius ?? 0.5) * Math.max(o, e), l = t.createRadialGradient(f, h, 0, f, h, u);
|
|
5136
5138
|
if (i.stops.forEach((d) => {
|
|
5137
5139
|
const p = d.offset !== void 0 ? d.offset : d.pos !== void 0 ? d.pos : d.position !== void 0 ? d.position : 0, y = r(d.color || "#000000", d.opacity ?? 100);
|
|
5138
|
-
|
|
5139
|
-
}), i.gradientTransform &&
|
|
5140
|
+
l.addColorStop(Math.max(0, Math.min(1, p)), y);
|
|
5141
|
+
}), i.gradientTransform && l.setTransform) {
|
|
5140
5142
|
const [d, p, y, b, m, v] = i.gradientTransform;
|
|
5141
|
-
|
|
5143
|
+
l.setTransform({ a: d, b: p, c: y, d: b, e: m, f: v });
|
|
5142
5144
|
}
|
|
5143
|
-
return
|
|
5145
|
+
return l;
|
|
5144
5146
|
} else if (i.type === "AngularGradient") {
|
|
5145
|
-
const
|
|
5146
|
-
if (
|
|
5147
|
+
const c = (d, p, y) => Array.isArray(d) ? d[p] ?? 0.5 : d && typeof d == "object" ? d[y] ?? 0.5 : 0.5, f = c(i.center || [0.5, 0.5], 0, "x") * o - o / 2, h = c(i.center || [0.5, 0.5], 1, "y") * e - e / 2, u = (i.degree || i.angle || 0) * (Math.PI / 180), l = (a = t.createConicGradient) == null ? void 0 : a.call(t, u, f, h);
|
|
5148
|
+
if (l) {
|
|
5147
5149
|
if (i.stops.forEach((d) => {
|
|
5148
5150
|
const p = d.offset !== void 0 ? d.offset : d.pos !== void 0 ? d.pos : d.position !== void 0 ? d.position : 0, y = r(d.color || "#000000", d.opacity ?? 100);
|
|
5149
|
-
|
|
5150
|
-
}), i.gradientTransform &&
|
|
5151
|
+
l.addColorStop(Math.max(0, Math.min(1, p)), y);
|
|
5152
|
+
}), i.gradientTransform && l.setTransform) {
|
|
5151
5153
|
const [d, p, y, b, m, v] = i.gradientTransform;
|
|
5152
|
-
|
|
5154
|
+
l.setTransform({ a: d, b: p, c: y, d: b, e: m, f: v });
|
|
5153
5155
|
}
|
|
5154
|
-
return
|
|
5156
|
+
return l;
|
|
5155
5157
|
}
|
|
5156
5158
|
} else if (i.type === "DiamondGradient") {
|
|
5157
|
-
const
|
|
5159
|
+
const c = (d, p, y) => Array.isArray(d) ? d[p] ?? 0.5 : d && typeof d == "object" ? d[y] ?? 0.5 : 0.5, f = c(i.center || [0.5, 0.5], 0, "x") * o - o / 2, h = c(i.center || [0.5, 0.5], 1, "y") * e - e / 2, u = (i.radius ?? 0.5) * Math.max(o, e);
|
|
5158
5160
|
t.save(), t.translate(f, h), t.rotate(Math.PI / 4);
|
|
5159
|
-
const
|
|
5161
|
+
const l = t.createRadialGradient(0, 0, 0, 0, 0, u);
|
|
5160
5162
|
if (i.stops.forEach((d) => {
|
|
5161
5163
|
const p = d.offset !== void 0 ? d.offset : d.pos !== void 0 ? d.pos : d.position !== void 0 ? d.position : 0, y = r(d.color || "#000000", d.opacity ?? 100);
|
|
5162
|
-
|
|
5163
|
-
}), i.gradientTransform &&
|
|
5164
|
+
l.addColorStop(Math.max(0, Math.min(1, p)), y);
|
|
5165
|
+
}), i.gradientTransform && l.setTransform) {
|
|
5164
5166
|
const [d, p, y, b, m, v] = i.gradientTransform;
|
|
5165
|
-
|
|
5167
|
+
l.setTransform({ a: d, b: p, c: y, d: b, e: m, f: v });
|
|
5166
5168
|
}
|
|
5167
|
-
return t.scale(1 / Math.SQRT2, 1 / Math.SQRT2), t.fillStyle =
|
|
5169
|
+
return t.scale(1 / Math.SQRT2, 1 / Math.SQRT2), t.fillStyle = l, t.restore(), l;
|
|
5168
5170
|
}
|
|
5169
5171
|
}
|
|
5170
5172
|
if (i.type === "Pattern" && i.url) {
|
|
5171
5173
|
let r = this.imageCache.get(i.url);
|
|
5172
5174
|
if (r || (r = new Image(), r.src = i.url, this.imageCache.set(i.url, r)), r.complete && r.naturalWidth > 0) {
|
|
5173
|
-
const
|
|
5174
|
-
if (
|
|
5175
|
-
const f = new DOMMatrix(), h = i.scaleX ?? 1, u = i.scaleY ?? 1,
|
|
5176
|
-
f.translateSelf(
|
|
5175
|
+
const c = t.createPattern(r, "repeat");
|
|
5176
|
+
if (c && (i.scaleX !== void 0 || i.offsetX !== void 0)) {
|
|
5177
|
+
const f = new DOMMatrix(), h = i.scaleX ?? 1, u = i.scaleY ?? 1, l = i.offsetX ?? 0, d = i.offsetY ?? 0, p = i.rotation ?? 0;
|
|
5178
|
+
f.translateSelf(l, d), f.rotateSelf(p), f.scaleSelf(h, u), c.setTransform(f);
|
|
5177
5179
|
}
|
|
5178
|
-
return
|
|
5180
|
+
return c;
|
|
5179
5181
|
}
|
|
5180
5182
|
}
|
|
5181
5183
|
return i.color || null;
|
|
@@ -5192,43 +5194,43 @@ class ci {
|
|
|
5192
5194
|
} catch {
|
|
5193
5195
|
a = parseFloat(a) || 0;
|
|
5194
5196
|
}
|
|
5195
|
-
let r = 0,
|
|
5196
|
-
typeof a == "number" ? r =
|
|
5197
|
+
let r = 0, c = 0, f = 0, h = 0;
|
|
5198
|
+
typeof a == "number" ? r = c = f = h = a : Array.isArray(a) ? a.length === 1 ? r = c = f = h = a[0] : a.length === 2 ? (r = f = a[0], c = h = a[1]) : a.length === 3 ? (r = a[0], c = h = a[1], f = a[2]) : a.length >= 4 && (r = a[0], c = a[1], f = a[2], h = a[3]) : a && typeof a == "object" && (r = a.tl ?? a.corner_radius ?? a.cornerRadius ?? 0, c = a.tr ?? a.corner_radius ?? a.cornerRadius ?? 0, f = a.br ?? a.corner_radius ?? a.cornerRadius ?? 0, h = a.bl ?? a.corner_radius ?? a.cornerRadius ?? 0);
|
|
5197
5199
|
const u = Math.min(Math.abs(e) / 2, Math.abs(s) / 2);
|
|
5198
|
-
if (r = Math.min(Math.max(0, r), u),
|
|
5199
|
-
t.roundRect(i, o, e, s, [r,
|
|
5200
|
+
if (r = Math.min(Math.max(0, r), u), c = Math.min(Math.max(0, c), u), f = Math.min(Math.max(0, f), u), h = Math.min(Math.max(0, h), u), t.roundRect) {
|
|
5201
|
+
t.roundRect(i, o, e, s, [r, c, f, h]);
|
|
5200
5202
|
return;
|
|
5201
5203
|
}
|
|
5202
|
-
t.moveTo(i + r, o), t.lineTo(i + e -
|
|
5204
|
+
t.moveTo(i + r, o), t.lineTo(i + e - c, o), t.arcTo(i + e, o, i + e, o + c, c), t.lineTo(i + e, o + s - f), t.arcTo(i + e, o + s, i + e - f, o + s, f), t.lineTo(i + h, o + s), t.arcTo(i, o + s, i, o + s - h, h), t.lineTo(i, o + r), t.arcTo(i, o, i + r, o, r), t.closePath();
|
|
5203
5205
|
}
|
|
5204
5206
|
renderListView(t, i) {
|
|
5205
5207
|
var A, W, z, Y;
|
|
5206
|
-
const o = this.objectStates.get(i.id) || {}, e = o.options || i.options || {}, s = o.width !== void 0 ? o.width : ((A = i.geometry) == null ? void 0 : A.width) || 200, n = o.height !== void 0 ? o.height : ((W = i.geometry) == null ? void 0 : W.height) || 300, a = -s / 2, r = -n / 2,
|
|
5207
|
-
if (t.save(), t.globalAlpha *= T,
|
|
5208
|
+
const o = this.objectStates.get(i.id) || {}, e = o.options || i.options || {}, s = o.width !== void 0 ? o.width : ((A = i.geometry) == null ? void 0 : A.width) || 200, n = o.height !== void 0 ? o.height : ((W = i.geometry) == null ? void 0 : W.height) || 300, a = -s / 2, r = -n / 2, c = o.corner_radius !== void 0 ? o.corner_radius : e.corner_radius ?? 0, f = e.orientation || "vertical", h = e.items || [], u = e.itemGap ?? 10, l = e.itemHeight ?? 50, d = e.itemWidth ?? 200, p = e.scrollOffset ?? 0, y = e.padding ?? 0, b = e.glassEffect !== !1, m = e.accentColor || "#3b82f6", v = e.itemTextColor || "#333333", S = e.itemBackgroundColor || "#ffffff", C = e.hoveredIndex ?? null, w = e.activeItemIndex ?? null, I = e.glowIntensity ?? 0, M = e.glowColor || "#3b82f6", k = typeof M == "string" ? M : M.color || ((Y = (z = M.stops) == null ? void 0 : z[0]) == null ? void 0 : Y.color) || "#3b82f6", T = e.opacity !== void 0 ? e.opacity : i.opacity !== void 0 ? i.opacity : 1;
|
|
5209
|
+
if (t.save(), t.globalAlpha *= T, I > 0) {
|
|
5208
5210
|
const G = t.getTransform(), N = Math.sqrt(G.a * G.a + G.b * G.b) || 1;
|
|
5209
|
-
t.shadowColor = k, t.shadowBlur =
|
|
5211
|
+
t.shadowColor = k, t.shadowBlur = I * 2 * N, t.shadowOffsetX = 0, t.shadowOffsetY = 0;
|
|
5210
5212
|
}
|
|
5211
5213
|
if (b) {
|
|
5212
5214
|
const G = e.listBackgroundColor || "rgba(31, 41, 55, 0.4)", N = this.createCanvasFill(t, G, s, n);
|
|
5213
|
-
t.fillStyle = N || "rgba(31, 41, 55, 0.4)", t.beginPath(), this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n,
|
|
5215
|
+
t.fillStyle = N || "rgba(31, 41, 55, 0.4)", t.beginPath(), this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n, c) || t.fill();
|
|
5214
5216
|
const x = t.createLinearGradient(a, r, a + s, r + n);
|
|
5215
|
-
x.addColorStop(0, "rgba(255, 255, 255, 0.15)"), x.addColorStop(0.5, "rgba(255, 255, 255, 0.08)"), x.addColorStop(1, "rgba(255, 255, 255, 0.03)"), t.fillStyle = x, t.beginPath(), this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n,
|
|
5217
|
+
x.addColorStop(0, "rgba(255, 255, 255, 0.15)"), x.addColorStop(0.5, "rgba(255, 255, 255, 0.08)"), x.addColorStop(1, "rgba(255, 255, 255, 0.03)"), t.fillStyle = x, t.beginPath(), this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n, c) || t.fill(), t.strokeStyle = "rgba(255, 255, 255, 0.25)", t.lineWidth = 1, t.beginPath(), this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n, c) || t.stroke();
|
|
5216
5218
|
} else {
|
|
5217
5219
|
const G = e.backgroundColor || e.listBackgroundColor || "transparent", N = this.createCanvasFill(t, G, s, n);
|
|
5218
5220
|
if (N) {
|
|
5219
5221
|
t.fillStyle = N, t.beginPath();
|
|
5220
|
-
const x = this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n,
|
|
5222
|
+
const x = this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n, c);
|
|
5221
5223
|
t.fill();
|
|
5222
5224
|
}
|
|
5223
5225
|
const J = e.borderWidth ?? 0;
|
|
5224
5226
|
if (J > 0) {
|
|
5225
5227
|
t.strokeStyle = e.borderColor || "#cccccc", t.lineWidth = J, t.beginPath();
|
|
5226
|
-
const x = this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n,
|
|
5228
|
+
const x = this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n, c);
|
|
5227
5229
|
t.stroke();
|
|
5228
5230
|
}
|
|
5229
5231
|
}
|
|
5230
5232
|
t.shadowBlur = 0, t.save(), t.beginPath();
|
|
5231
|
-
const R = this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n,
|
|
5233
|
+
const R = this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n, c);
|
|
5232
5234
|
if (e.listLayout !== "circular")
|
|
5233
5235
|
if (R && e.containerShape === "custom")
|
|
5234
5236
|
try {
|
|
@@ -5241,7 +5243,7 @@ class ci {
|
|
|
5241
5243
|
const P = typeof y == "number" ? y : f === "vertical" ? y[0] : y[3];
|
|
5242
5244
|
let _ = (f === "vertical" ? r : a) + p + P;
|
|
5243
5245
|
if (t.textBaseline = "middle", h.forEach((G, N) => {
|
|
5244
|
-
const J = e.listLayout || "linear", x = J === "circular" ? d : f === "vertical" ? s : d, F = J === "circular" || f === "vertical" ?
|
|
5246
|
+
const J = e.listLayout || "linear", x = J === "circular" ? d : f === "vertical" ? s : d, F = J === "circular" || f === "vertical" ? l : n;
|
|
5245
5247
|
let j = 0, X = 0, tt = 0;
|
|
5246
5248
|
if (J === "circular") {
|
|
5247
5249
|
const vt = h.length || 1, Yt = Math.PI * 2 / vt, ie = e.circularStartAngle || 0, fe = e.circularRadius || 100, st = p * 0.01 + ie * Math.PI / 180, mt = N * Yt + st, Lt = a + s / 2, _t = r + n / 2;
|
|
@@ -5269,9 +5271,9 @@ class ci {
|
|
|
5269
5271
|
const bt = typeof G == "string" ? G : (G == null ? void 0 : G.label) || `Item ${N + 1}`, gt = j + (f === "vertical" ? 16 : x / 2), Et = X + F / 2;
|
|
5270
5272
|
f === "horizontal" || J === "circular" ? t.textAlign = "center" : t.textAlign = "left";
|
|
5271
5273
|
const It = J === "circular" ? j + x / 2 : gt;
|
|
5272
|
-
t.fillText(bt, It, Et), t.restore(), _ += (f === "vertical" ?
|
|
5274
|
+
t.fillText(bt, It, Et), t.restore(), _ += (f === "vertical" ? l : d) + u;
|
|
5273
5275
|
}), t.restore(), e.showScrollbar !== !1) {
|
|
5274
|
-
const G = (h.length || 0) * (f === "vertical" ?
|
|
5276
|
+
const G = (h.length || 0) * (f === "vertical" ? l : d) + ((h.length || 0) - 1) * u, N = f === "vertical" ? n : s, J = e.listLayout || "linear", x = e.containerShape === "circle" || J === "circular";
|
|
5275
5277
|
if (G > N || J === "circular" && h.length > 0) {
|
|
5276
5278
|
const F = e.scrollbarColor || "rgba(255,255,255,0.3)", j = e.scrollbarWidth || 4;
|
|
5277
5279
|
if (x) {
|
|
@@ -5294,15 +5296,15 @@ class ci {
|
|
|
5294
5296
|
}
|
|
5295
5297
|
drawCustomShape(t, i, o, e, s, n, a, r) {
|
|
5296
5298
|
if (i === "circle") {
|
|
5297
|
-
const
|
|
5298
|
-
return t.arc(e + n / 2, s + a / 2,
|
|
5299
|
+
const c = Math.min(n, a) / 2;
|
|
5300
|
+
return t.arc(e + n / 2, s + a / 2, c, 0, Math.PI * 2), !1;
|
|
5299
5301
|
} else if (i === "pill") {
|
|
5300
|
-
const
|
|
5301
|
-
return this.drawListViewRect(t, e, s, n, a,
|
|
5302
|
+
const c = Math.min(n, a) / 2;
|
|
5303
|
+
return this.drawListViewRect(t, e, s, n, a, c), !1;
|
|
5302
5304
|
} else if (i === "custom" && o)
|
|
5303
5305
|
try {
|
|
5304
|
-
const
|
|
5305
|
-
return t.save(), t.translate(e, s), t.scale(n / 100, a / 100), t.fill(
|
|
5306
|
+
const c = new Path2D(o);
|
|
5307
|
+
return t.save(), t.translate(e, s), t.scale(n / 100, a / 100), t.fill(c), t.restore(), !0;
|
|
5306
5308
|
} catch {
|
|
5307
5309
|
return this.drawListViewRect(t, e, s, n, a, r), !1;
|
|
5308
5310
|
}
|
|
@@ -5313,10 +5315,10 @@ class ci {
|
|
|
5313
5315
|
if (!this._lastPointerPos || !this._prevPointerPos) return;
|
|
5314
5316
|
const i = t.options || {}, o = i.orientation || "vertical", e = this._lastPointerPos.x - this._prevPointerPos.x, s = this._lastPointerPos.y - this._prevPointerPos.y;
|
|
5315
5317
|
o === "vertical" ? i.scrollOffset = (i.scrollOffset || 0) + s : i.scrollOffset = (i.scrollOffset || 0) + e;
|
|
5316
|
-
const n = i.listLayout || "linear", a = this.objectStates.get(t.id) || {}, r = i.items || [],
|
|
5318
|
+
const n = i.listLayout || "linear", a = this.objectStates.get(t.id) || {}, r = i.items || [], c = i.itemGap ?? 10, f = i.itemHeight ?? 50, h = i.itemWidth ?? 200, u = a.width !== void 0 ? a.width : ((b = t.geometry) == null ? void 0 : b.width) || 200, l = a.height !== void 0 ? a.height : ((m = t.geometry) == null ? void 0 : m.height) || 300;
|
|
5317
5319
|
if (n === "circular")
|
|
5318
5320
|
return;
|
|
5319
|
-
const d = (r.length || 0) * (o === "vertical" ? f : h) + ((r.length || 0) - 1) *
|
|
5321
|
+
const d = (r.length || 0) * (o === "vertical" ? f : h) + ((r.length || 0) - 1) * c, y = Math.max(0, d - (o === "vertical" ? l : u) + (i.padding * 2 || 0));
|
|
5320
5322
|
i.scrollOffset > 0 && (i.scrollOffset = 0), i.scrollOffset < -y && (i.scrollOffset = -y);
|
|
5321
5323
|
}
|
|
5322
5324
|
updateListViewHoverFromPointer(t, i, o) {
|
|
@@ -5327,24 +5329,24 @@ class ci {
|
|
|
5327
5329
|
var z, Y;
|
|
5328
5330
|
const e = t.options || {}, s = this.objectStates.get(t.id) || {}, n = e.items || [];
|
|
5329
5331
|
if (n.length === 0) return null;
|
|
5330
|
-
const a = s.width !== void 0 ? s.width : ((z = t.geometry) == null ? void 0 : z.width) || 200, r = s.height !== void 0 ? s.height : ((Y = t.geometry) == null ? void 0 : Y.height) || 300,
|
|
5331
|
-
let T = (
|
|
5332
|
-
const R = e.listLayout || "linear", P = n.length || 1, _ = Math.PI * 2 / P, E = e.circularStartAngle || 0, A = e.circularRadius || 100, W =
|
|
5332
|
+
const a = s.width !== void 0 ? s.width : ((z = t.geometry) == null ? void 0 : z.width) || 200, r = s.height !== void 0 ? s.height : ((Y = t.geometry) == null ? void 0 : Y.height) || 300, c = e.orientation || "vertical", f = e.itemGap ?? 10, h = e.itemHeight ?? 50, u = e.itemWidth ?? 200, l = e.scrollOffset ?? 0, d = e.padding ?? 0, p = this.getWorldTransform(t.id), y = i - p.x, b = o - p.y, m = -p.rotation * (Math.PI / 180), v = Math.cos(m), S = Math.sin(m), C = y * v - b * S, w = y * S + b * v, I = -a / 2, M = -r / 2, k = typeof d == "number" ? d : c === "vertical" ? d[0] : d[3];
|
|
5333
|
+
let T = (c === "vertical" ? M : I) + l + k;
|
|
5334
|
+
const R = e.listLayout || "linear", P = n.length || 1, _ = Math.PI * 2 / P, E = e.circularStartAngle || 0, A = e.circularRadius || 100, W = l * 0.01 + E * Math.PI / 180;
|
|
5333
5335
|
for (let G = 0; G < n.length; G++) {
|
|
5334
|
-
const N = R === "circular" ? u :
|
|
5336
|
+
const N = R === "circular" ? u : c === "vertical" ? a : u, J = R === "circular" || c === "vertical" ? h : r;
|
|
5335
5337
|
let x = 0, F = 0, j = 0;
|
|
5336
5338
|
if (R === "circular") {
|
|
5337
|
-
const X = G * _ + W, tt =
|
|
5339
|
+
const X = G * _ + W, tt = I + a / 2, L = M + r / 2;
|
|
5338
5340
|
x = tt + Math.cos(X) * A - N / 2, F = L + Math.sin(X) * A - J / 2, j = X + (e.itemRotation || 0) * Math.PI / 180;
|
|
5339
5341
|
} else
|
|
5340
|
-
x =
|
|
5342
|
+
x = c === "vertical" ? I : T, F = c === "vertical" ? T : M, j = (e.itemRotation || 0) * Math.PI / 180;
|
|
5341
5343
|
if (j !== 0) {
|
|
5342
5344
|
const X = x + N / 2, tt = F + J / 2, L = C - X, O = w - tt, D = -j, q = L * Math.cos(D) - O * Math.sin(D) + X, ot = L * Math.sin(D) + O * Math.cos(D) + tt;
|
|
5343
5345
|
if (q >= x && q <= x + N && ot >= F && ot <= F + J)
|
|
5344
5346
|
return G;
|
|
5345
5347
|
} else if (C >= x && C <= x + N && w >= F && w <= F + J)
|
|
5346
5348
|
return G;
|
|
5347
|
-
T += (
|
|
5349
|
+
T += (c === "vertical" ? h : u) + f;
|
|
5348
5350
|
}
|
|
5349
5351
|
return null;
|
|
5350
5352
|
}
|
|
@@ -5362,28 +5364,28 @@ class ci {
|
|
|
5362
5364
|
if (!e.behaviors || e.behaviors.length === 0) return;
|
|
5363
5365
|
const s = this.objectStates.get(e.id);
|
|
5364
5366
|
s && e.behaviors.forEach((n) => {
|
|
5365
|
-
var u,
|
|
5367
|
+
var u, l, d, p, y, b, m, v, S, C, w, I, M, k, T, R, P, _, E, A, W, z, Y, G, N, J, x, F, j, X, tt, L, O, D, q, ot, yt, bt, gt, Et, It, vt, Yt, ie, fe, st, mt, Lt, _t, dt, Ft, Dt, $t, Ot, Vt, ne, me, ye, Ut, Se, Pe, Ee, Ce, Ae, xe, se, jt, ht, ut, at, B, et, Q, Pt, xt, kt, At, Mt, $, Wt, Kt, te, Jt, pt, ct, Ct, rt, V, it, nt, St, Xt, Qt, oe, Gt, Ht, Nt, Ie, Re, Le, Oe, Fe, $e, Ye, zt, ae, we, Be, We, de, ce, he, ke, Xe, Ve, Ne, De, He;
|
|
5366
5368
|
if (!n.enabled) return;
|
|
5367
5369
|
const a = n.startTime || 0, r = n.endTime || 1 / 0;
|
|
5368
5370
|
if (this.currentTime < a || this.currentTime > r) return;
|
|
5369
|
-
const
|
|
5371
|
+
const c = s.x - i, f = s.y - o, h = Math.sqrt(c * c + f * f);
|
|
5370
5372
|
if (this.frameCount % 240 === 0 && Math.random() < 0.1 && this.log(`[ExodeUI] Executing ${n.type} on ${e.name}`), n.type === U.Proximity) {
|
|
5371
|
-
const H = ((u = n.settings) == null ? void 0 : u.radius) || 300, Z = ((
|
|
5373
|
+
const H = ((u = n.settings) == null ? void 0 : u.radius) || 300, Z = ((l = n.settings) == null ? void 0 : l.falloff) || "smooth";
|
|
5372
5374
|
let K = 0;
|
|
5373
5375
|
h < H && (Z === "linear" ? K = 1 - h / H : K = Math.pow(1 - h / H, 2)), n.sensors.forEach((ft) => {
|
|
5374
|
-
this.applyBehaviorSensor(s, ft, K, t, n.settings, e,
|
|
5376
|
+
this.applyBehaviorSensor(s, ft, K, t, n.settings, e, c, f, h);
|
|
5375
5377
|
});
|
|
5376
5378
|
} else if (n.type === U.Magnetic) {
|
|
5377
5379
|
const H = ((d = n.settings) == null ? void 0 : d.radius) || 400, Z = ((p = n.settings) == null ? void 0 : p.strength) || 0.5;
|
|
5378
5380
|
if (h < H && h > 5) {
|
|
5379
|
-
const K = 1 - h / H, ft =
|
|
5381
|
+
const K = 1 - h / H, ft = c * K * Z, Tt = f * K * Z;
|
|
5380
5382
|
s.x -= ft * t * 10, s.y -= Tt * t * 10;
|
|
5381
5383
|
}
|
|
5382
5384
|
} else if (n.type === U.Repel) {
|
|
5383
5385
|
const H = ((y = n.settings) == null ? void 0 : y.radius) || 300, Z = ((b = n.settings) == null ? void 0 : b.strength) || 1;
|
|
5384
5386
|
if (h < H) {
|
|
5385
5387
|
const K = Math.pow(1 - h / H, 2);
|
|
5386
|
-
s.x +=
|
|
5388
|
+
s.x += c / (h || 1) * K * 60 * Z * t * 5, s.y += f / (h || 1) * K * 60 * Z * t * 5;
|
|
5387
5389
|
}
|
|
5388
5390
|
} else if (n.type === U.Orbit) {
|
|
5389
5391
|
const H = ((m = n.settings) == null ? void 0 : m.speed) || 1, Z = ((v = n.settings) == null ? void 0 : v.radius) || 30, K = this.currentTime * H * Math.PI * 2;
|
|
@@ -5391,13 +5393,13 @@ class ci {
|
|
|
5391
5393
|
} else if (n.type === U.Vortex) {
|
|
5392
5394
|
const H = ((S = n.settings) == null ? void 0 : S.radius) || 400, Z = ((C = n.settings) == null ? void 0 : C.speed) || 2, K = ((w = n.settings) == null ? void 0 : w.strength) || 1;
|
|
5393
5395
|
if (h < H) {
|
|
5394
|
-
const ft = Math.pow(1 - h / H, 1.5), Tt = this.currentTime * Z * Math.PI * 2, Rt = Math.cos(Tt) * 30 -
|
|
5396
|
+
const ft = Math.pow(1 - h / H, 1.5), Tt = this.currentTime * Z * Math.PI * 2, Rt = Math.cos(Tt) * 30 - c * 0.4, Bt = Math.sin(Tt) * 30 - f * 0.4;
|
|
5395
5397
|
s.x += Rt * ft * K * t * 5, s.y += Bt * ft * K * t * 5, s.rotation += 5 * ft * K * t * 5, s.scale_x *= 1 - ft * 0.1 * K * t, s.scale_y *= 1 - ft * 0.1 * K * t;
|
|
5396
5398
|
}
|
|
5397
5399
|
} else if (n.type === U.Fluid) {
|
|
5398
|
-
const H = ((
|
|
5400
|
+
const H = ((I = n.settings) == null ? void 0 : I.radius) || 300, Z = ((M = n.settings) == null ? void 0 : M.strength) || 1;
|
|
5399
5401
|
if (h < H) {
|
|
5400
|
-
const K = Math.pow(1 - h / H, 1.2), ft =
|
|
5402
|
+
const K = Math.pow(1 - h / H, 1.2), ft = c / (h || 1) * K * 1.2 * Z, Tt = f / (h || 1) * K * 1.2 * Z;
|
|
5401
5403
|
s.x += ft * 10 * t * 5, s.y += Tt * 10 * t * 5, s.scale_x *= 1 + K * 0.3 * Z * t, s.scale_y *= 1 + K * 0.3 * Z * t;
|
|
5402
5404
|
}
|
|
5403
5405
|
} else if (n.type === U.Elastic) {
|
|
@@ -5416,7 +5418,7 @@ class ci {
|
|
|
5416
5418
|
const H = ((P = n.settings) == null ? void 0 : P.radius) || 80, Z = ((_ = n.settings) == null ? void 0 : _.strength) || 1;
|
|
5417
5419
|
if (h < H) {
|
|
5418
5420
|
const K = Math.pow(1 - h / H, 2);
|
|
5419
|
-
s.x -=
|
|
5421
|
+
s.x -= c * K * Z * t * 10, s.y -= f * K * Z * t * 10, s.scale_x *= 1 - K * 0.1 * Z * t, s.scale_y *= 1 - K * 0.1 * Z * t;
|
|
5420
5422
|
}
|
|
5421
5423
|
} else if (n.type === U.Dilation) {
|
|
5422
5424
|
const H = ((E = n.settings) == null ? void 0 : E.size) || 120, Z = ((A = n.settings) == null ? void 0 : A.strength) || 1;
|
|
@@ -5429,7 +5431,7 @@ class ci {
|
|
|
5429
5431
|
s.x = this.lerp(s.x ?? ((x = e.transform) == null ? void 0 : x.x) ?? 0, ee, be), s.y = this.lerp(s.y ?? ((F = e.transform) == null ? void 0 : F.y) ?? 0, ue, be), s.rotate_x = this.lerp(s.rotate_x ?? ((j = e.transform) == null ? void 0 : j.rotate_x) ?? 0, Te, be), s.rotate_y = this.lerp(s.rotate_y ?? ((X = e.transform) == null ? void 0 : X.rotate_y) ?? 0, re, be);
|
|
5430
5432
|
} else if (n.type === U.Fold) {
|
|
5431
5433
|
if (h < 300) {
|
|
5432
|
-
const H = 1 - h / 300, Z = (
|
|
5434
|
+
const H = 1 - h / 300, Z = (c > 0 ? -1 : 1) * H * 10, K = 1 - H * 0.1, ft = f / 300 * H * 20, Tt = -(c / 300) * H * 20, Rt = Math.min(1, 10 * t);
|
|
5433
5435
|
s.skew_x = this.lerp(s.skew_x ?? ((tt = e.transform) == null ? void 0 : tt.skew_x) ?? 0, Z, Rt), s.scale_y = this.lerp(s.scale_y ?? ((L = e.transform) == null ? void 0 : L.scale_y) ?? 1, (((O = e.transform) == null ? void 0 : O.scale_y) ?? 1) * K, Rt), s.rotate_x = this.lerp(s.rotate_x ?? ((D = e.transform) == null ? void 0 : D.rotate_x) ?? 0, ft, Rt), s.rotate_y = this.lerp(s.rotate_y ?? ((q = e.transform) == null ? void 0 : q.rotate_y) ?? 0, Tt, Rt), s.style = s.style || { ...e.style }, s.style.artEffect = { enabled: !0, type: "fold_overlay", intensity: ((ot = n.settings) == null ? void 0 : ot.opacity) ?? 0.5 };
|
|
5434
5436
|
}
|
|
5435
5437
|
} else if (n.type === U.Crumple) {
|
|
@@ -5471,7 +5473,7 @@ class ci {
|
|
|
5471
5473
|
const H = ((Q = n.settings) == null ? void 0 : Q.axis) || "vertical", Z = ((Pt = n.settings) == null ? void 0 : Pt.factor) || 0.5, K = ((xt = n.settings) == null ? void 0 : xt.strength) || 1, ft = ((kt = n.settings) == null ? void 0 : kt.scaleFactor) || 0;
|
|
5472
5474
|
(H === "vertical" || H === "both") && (s.y += this.scrollOffset.y * Z * K * t), (H === "horizontal" || H === "both") && (s.x += this.scrollOffset.x * Z * K * t), ft !== 0 && (s.scale_x *= 1 + this.scrollOffset.y * ft * t, s.scale_y *= 1 + this.scrollOffset.y * ft * t);
|
|
5473
5475
|
} else if (n.type === U.LookAt) {
|
|
5474
|
-
const H = ((At = n.settings) == null ? void 0 : At.factor) || 1, Z = ((Mt = n.settings) == null ? void 0 : Mt.strength) || 1, K = Math.atan2(-f, -
|
|
5476
|
+
const H = ((At = n.settings) == null ? void 0 : At.factor) || 1, Z = ((Mt = n.settings) == null ? void 0 : Mt.strength) || 1, K = Math.atan2(-f, -c) * (180 / Math.PI), ft = s.rotation, Tt = (K - ft + 180) % 360 - 180;
|
|
5475
5477
|
s.rotation += Tt * H * Z * t * 10;
|
|
5476
5478
|
} else if (n.type === U.Scan) {
|
|
5477
5479
|
const H = ((($ = n.settings) == null ? void 0 : $.speed) || 1) * 4e-3, Z = ((Wt = n.settings) == null ? void 0 : Wt.strength) || 1, K = (Math.sin(Date.now() * H) + 1) / 2;
|
|
@@ -5650,9 +5652,9 @@ class ci {
|
|
|
5650
5652
|
});
|
|
5651
5653
|
});
|
|
5652
5654
|
}
|
|
5653
|
-
applyBehaviorSensor(t, i, o, e, s, n, a = 0, r = 0,
|
|
5654
|
-
var d, p, y, b, m, v, S, C, w,
|
|
5655
|
-
const f = (s == null ? void 0 : s.intensity) || (s == null ? void 0 : s.strength) || 1, h = Math.min(1, 15 * e), u =
|
|
5655
|
+
applyBehaviorSensor(t, i, o, e, s, n, a = 0, r = 0, c = 1) {
|
|
5656
|
+
var d, p, y, b, m, v, S, C, w, I, M, k, T, R, P, _, E, A, W, z, Y, G, N, J;
|
|
5657
|
+
const f = (s == null ? void 0 : s.intensity) || (s == null ? void 0 : s.strength) || 1, h = Math.min(1, 15 * e), u = c > 0 ? a / c : 0, l = c > 0 ? r / c : 0;
|
|
5656
5658
|
switch (i) {
|
|
5657
5659
|
case Zt.Scale: {
|
|
5658
5660
|
const x = ((d = n == null ? void 0 : n.transform) == null ? void 0 : d.scale_x) ?? 1, F = ((p = n == null ? void 0 : n.transform) == null ? void 0 : p.scale_y) ?? 1, j = x * (1 + o * f * 0.4), X = F * (1 + o * f * 0.4);
|
|
@@ -5670,7 +5672,7 @@ class ci {
|
|
|
5670
5672
|
break;
|
|
5671
5673
|
}
|
|
5672
5674
|
case Zt.RotateX: {
|
|
5673
|
-
const x = ((m = n == null ? void 0 : n.transform) == null ? void 0 : m.rotate_x) ?? 0, F = x -
|
|
5675
|
+
const x = ((m = n == null ? void 0 : n.transform) == null ? void 0 : m.rotate_x) ?? 0, F = x - l * o * f * 60;
|
|
5674
5676
|
t.rotate_x = (t.rotate_x ?? x) * (1 - h) + F * h;
|
|
5675
5677
|
break;
|
|
5676
5678
|
}
|
|
@@ -5685,7 +5687,7 @@ class ci {
|
|
|
5685
5687
|
break;
|
|
5686
5688
|
}
|
|
5687
5689
|
case Zt.PositionY: {
|
|
5688
|
-
const x = ((C = n == null ? void 0 : n.transform) == null ? void 0 : C.y) ?? 0, F = x -
|
|
5690
|
+
const x = ((C = n == null ? void 0 : n.transform) == null ? void 0 : C.y) ?? 0, F = x - l * o * f * 40;
|
|
5689
5691
|
t.y = (t.y ?? x) * (1 - h) + F * h;
|
|
5690
5692
|
break;
|
|
5691
5693
|
}
|
|
@@ -5695,8 +5697,8 @@ class ci {
|
|
|
5695
5697
|
break;
|
|
5696
5698
|
}
|
|
5697
5699
|
case Zt.Blur: {
|
|
5698
|
-
t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.blur || (t.style.blur = { ...(
|
|
5699
|
-
const x = ((k = (
|
|
5700
|
+
t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.blur || (t.style.blur = { ...(I = n == null ? void 0 : n.style) == null ? void 0 : I.blur });
|
|
5701
|
+
const x = ((k = (M = n == null ? void 0 : n.style) == null ? void 0 : M.blur) == null ? void 0 : k.amount) || 0, F = x + o * ((s == null ? void 0 : s.blur) || 20) * f;
|
|
5700
5702
|
t.style.blur.amount = (t.style.blur.amount ?? x) * (1 - h) + F * h;
|
|
5701
5703
|
break;
|
|
5702
5704
|
}
|
|
@@ -5754,12 +5756,12 @@ class ci {
|
|
|
5754
5756
|
const s = o.split(".");
|
|
5755
5757
|
let n = t;
|
|
5756
5758
|
for (let r = 0; r < s.length - 1; r++) {
|
|
5757
|
-
const
|
|
5758
|
-
if (n[
|
|
5759
|
-
const f = i, h = s.slice(0, r + 1).reduce((u,
|
|
5760
|
-
n[
|
|
5759
|
+
const c = s[r];
|
|
5760
|
+
if (n[c] === void 0 || n[c] === null) {
|
|
5761
|
+
const f = i, h = s.slice(0, r + 1).reduce((u, l) => u == null ? void 0 : u[l], f);
|
|
5762
|
+
n[c] = h !== void 0 ? { ...h } : {};
|
|
5761
5763
|
}
|
|
5762
|
-
n = n[
|
|
5764
|
+
n = n[c];
|
|
5763
5765
|
}
|
|
5764
5766
|
const a = s[s.length - 1];
|
|
5765
5767
|
n != null && (n[a] = e);
|
|
@@ -5807,9 +5809,9 @@ class ci {
|
|
|
5807
5809
|
return o;
|
|
5808
5810
|
}
|
|
5809
5811
|
renderFittedImage(t, i, o, e, s, n, a = "cover") {
|
|
5810
|
-
const r = i.naturalWidth,
|
|
5811
|
-
let u = s,
|
|
5812
|
-
a === "cover" ? f > h ? (u = n * f, d = o - (u - s) / 2) : (
|
|
5812
|
+
const r = i.naturalWidth, c = i.naturalHeight, f = r / c, h = s / n;
|
|
5813
|
+
let u = s, l = n, d = o, p = e;
|
|
5814
|
+
a === "cover" ? f > h ? (u = n * f, d = o - (u - s) / 2) : (l = s / f, p = e - (l - n) / 2) : a === "contain" && (f > h ? (l = s / f, p = e + (n - l) / 2) : (u = n * f, d = o + (s - u) / 2)), t.drawImage(i, d, p, u, l);
|
|
5813
5815
|
}
|
|
5814
5816
|
}
|
|
5815
5817
|
const yi = Ss(({
|
|
@@ -5822,11 +5824,11 @@ const yi = Ss(({
|
|
|
5822
5824
|
onReady: n,
|
|
5823
5825
|
onTrigger: a,
|
|
5824
5826
|
onInputUpdate: r,
|
|
5825
|
-
onComponentChange:
|
|
5827
|
+
onComponentChange: c,
|
|
5826
5828
|
onToggle: f,
|
|
5827
5829
|
onInputChange: h,
|
|
5828
5830
|
onInputFocus: u,
|
|
5829
|
-
onInputBlur:
|
|
5831
|
+
onInputBlur: l,
|
|
5830
5832
|
onLog: d,
|
|
5831
5833
|
onLogicUpdate: p,
|
|
5832
5834
|
onButtonClick: y,
|
|
@@ -5836,8 +5838,8 @@ const yi = Ss(({
|
|
|
5836
5838
|
scrollY: S,
|
|
5837
5839
|
scrollX: C,
|
|
5838
5840
|
mouseX: w,
|
|
5839
|
-
mouseY:
|
|
5840
|
-
isMouseDown:
|
|
5841
|
+
mouseY: I,
|
|
5842
|
+
isMouseDown: M,
|
|
5841
5843
|
inputs: k,
|
|
5842
5844
|
interactive: T = !0,
|
|
5843
5845
|
onNavigation: R
|
|
@@ -5851,8 +5853,8 @@ const yi = Ss(({
|
|
|
5851
5853
|
E.current.setLayout(e, s);
|
|
5852
5854
|
}, [e, s]), ve(() => {
|
|
5853
5855
|
const L = E.current;
|
|
5854
|
-
a && L.setTriggerCallback(a), r && L.setInputUpdateCallback((O, D) => r({ [O]: D })),
|
|
5855
|
-
}, [a, r,
|
|
5856
|
+
a && L.setTriggerCallback(a), r && L.setInputUpdateCallback((O, D) => r({ [O]: D })), c && L.setComponentChangeCallback((O) => c(O)), f && L.setToggleCallback(f), h && L.setInputChangeCallback(h), u && L.setInputFocusCallback(u), l && L.setInputBlurCallback(l), d && L.setOnLogCallback((O) => d(O, "info")), p && L.setLogicUpdateCallback(p), y && L.setButtonClickCallback(y), b && L.setGraphPointClickCallback((O) => b(O.objectId, O)), R && L.setNavigationCallback(R);
|
|
5857
|
+
}, [a, r, c, f, h, u, l, d, p, y, b, R]), ve(() => {
|
|
5856
5858
|
(async () => {
|
|
5857
5859
|
let O = g;
|
|
5858
5860
|
if (t && !g)
|
|
@@ -5891,8 +5893,8 @@ const yi = Ss(({
|
|
|
5891
5893
|
};
|
|
5892
5894
|
}, [o, m]), ve(() => {
|
|
5893
5895
|
const L = E.current;
|
|
5894
|
-
S !== void 0 && L.updateInput("scrollY", S), C !== void 0 && L.updateInput("scrollX", C), w !== void 0 && L.updateInput("mouseX", w),
|
|
5895
|
-
}, [S, C, w,
|
|
5896
|
+
S !== void 0 && L.updateInput("scrollY", S), C !== void 0 && L.updateInput("scrollX", C), w !== void 0 && L.updateInput("mouseX", w), I !== void 0 && L.updateInput("mouseY", I), M !== void 0 && L.updateInput("isMouseDown", M), k && Object.entries(k).forEach(([O, D]) => L.updateInput(O, D));
|
|
5897
|
+
}, [S, C, w, I, M, k]);
|
|
5896
5898
|
const x = (L, O) => {
|
|
5897
5899
|
if (!T || !_.current) return;
|
|
5898
5900
|
L.stopPropagation(), "nativeEvent" in L && L.nativeEvent && typeof L.nativeEvent.stopImmediatePropagation == "function" ? L.nativeEvent.stopImmediatePropagation() : typeof L.stopImmediatePropagation == "function" && L.stopImmediatePropagation();
|
|
@@ -6088,8 +6090,8 @@ function bi() {
|
|
|
6088
6090
|
g == null || g.setInputStringArray(h, u);
|
|
6089
6091
|
}, [g]), r = Me((h, u) => {
|
|
6090
6092
|
g == null || g.updateObjectOptions(h, u);
|
|
6091
|
-
}, [g]),
|
|
6092
|
-
g == null || g.updateConstraint(h, u,
|
|
6093
|
+
}, [g]), c = Me((h, u, l) => {
|
|
6094
|
+
g == null || g.updateConstraint(h, u, l);
|
|
6093
6095
|
}, [g]), f = Me((h, u) => {
|
|
6094
6096
|
g == null || g.updateGraphData(h, u);
|
|
6095
6097
|
}, [g]);
|
|
@@ -6103,7 +6105,7 @@ function bi() {
|
|
|
6103
6105
|
setInputText: s,
|
|
6104
6106
|
setInputNumberArray: n,
|
|
6105
6107
|
setInputStringArray: a,
|
|
6106
|
-
updateConstraint:
|
|
6108
|
+
updateConstraint: c,
|
|
6107
6109
|
updateGraphData: f,
|
|
6108
6110
|
updateObjectOptions: r
|
|
6109
6111
|
};
|
|
@@ -6116,35 +6118,35 @@ const vi = ({ artboard: g, config: t }) => {
|
|
|
6116
6118
|
let r = i.description;
|
|
6117
6119
|
if (!r && o) {
|
|
6118
6120
|
const h = g.objects.filter((u) => {
|
|
6119
|
-
var
|
|
6120
|
-
return ((
|
|
6121
|
+
var l;
|
|
6122
|
+
return ((l = u.geometry) == null ? void 0 : l.type) === "Text";
|
|
6121
6123
|
}).sort(
|
|
6122
|
-
(u,
|
|
6124
|
+
(u, l) => {
|
|
6123
6125
|
var d, p;
|
|
6124
|
-
return (((d =
|
|
6126
|
+
return (((d = l.geometry.text) == null ? void 0 : d.length) || 0) - (((p = u.geometry.text) == null ? void 0 : p.length) || 0);
|
|
6125
6127
|
}
|
|
6126
6128
|
);
|
|
6127
6129
|
h.length > 0 && (r = h[0].geometry.text);
|
|
6128
6130
|
}
|
|
6129
6131
|
r && (e("name", "description", r), e("property", "og:description", r)), i.keywords && i.keywords.length > 0 && e("name", "keywords", i.keywords.join(", "));
|
|
6130
|
-
const
|
|
6131
|
-
|
|
6132
|
+
const c = i.ogImage || g.backgroundImage;
|
|
6133
|
+
c && e("property", "og:image", c), a && e("property", "og:title", a), e("property", "og:type", "website");
|
|
6132
6134
|
}, [i, g, o]);
|
|
6133
|
-
const e = (a, r,
|
|
6135
|
+
const e = (a, r, c) => {
|
|
6134
6136
|
let f = document.querySelector(`meta[${a}="${r}"]`);
|
|
6135
|
-
f || (f = document.createElement("meta"), f.setAttribute(a, r), document.head.appendChild(f)), f.setAttribute("content",
|
|
6137
|
+
f || (f = document.createElement("meta"), f.setAttribute(a, r), document.head.appendChild(f)), f.setAttribute("content", c);
|
|
6136
6138
|
}, s = () => {
|
|
6137
6139
|
const a = [];
|
|
6138
|
-
return a.push(/* @__PURE__ */ ge("h1", { children: i.title || g.name }, "artboard-title")), g.objects.forEach((
|
|
6140
|
+
return a.push(/* @__PURE__ */ ge("h1", { children: i.title || g.name }, "artboard-title")), g.objects.forEach((c, f) => {
|
|
6139
6141
|
var h, u;
|
|
6140
|
-
if (!(
|
|
6141
|
-
if (((h =
|
|
6142
|
-
const
|
|
6143
|
-
|
|
6144
|
-
} else if (((u =
|
|
6145
|
-
const
|
|
6146
|
-
a.push(/* @__PURE__ */ ge("img", { src:
|
|
6147
|
-
} else
|
|
6142
|
+
if (!(c.visible === !1 || c.isVisible === !1))
|
|
6143
|
+
if (((h = c.geometry) == null ? void 0 : h.type) === "Text") {
|
|
6144
|
+
const l = c.geometry.text;
|
|
6145
|
+
l && (c.geometry.fontSize > 24 ? a.push(/* @__PURE__ */ ge("h2", { children: l }, c.id || f)) : a.push(/* @__PURE__ */ ge("p", { children: l }, c.id || f)));
|
|
6146
|
+
} else if (((u = c.geometry) == null ? void 0 : u.type) === "Image") {
|
|
6147
|
+
const l = c.geometry.src, d = c.altText || c.name || "Illustration";
|
|
6148
|
+
a.push(/* @__PURE__ */ ge("img", { src: l, alt: d }, c.id || f));
|
|
6149
|
+
} else c.type === "Button" && a.push(/* @__PURE__ */ ge("button", { children: c.name || "Button" }, c.id || f));
|
|
6148
6150
|
}), a;
|
|
6149
6151
|
}, n = i.jsonLd || {
|
|
6150
6152
|
"@context": "https://schema.org",
|
|
@@ -6177,7 +6179,7 @@ const vi = ({ artboard: g, config: t }) => {
|
|
|
6177
6179
|
]
|
|
6178
6180
|
}
|
|
6179
6181
|
);
|
|
6180
|
-
}, hi = "6.3.
|
|
6182
|
+
}, hi = "6.3.43", fi = {
|
|
6181
6183
|
version: hi
|
|
6182
6184
|
}, Si = fi.version;
|
|
6183
6185
|
export {
|