exodeui 6.3.41 → 6.3.43
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 +1136 -1101
- package/dist/src/engine.d.ts +5 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -40,17 +40,17 @@ function ps(g) {
|
|
|
40
40
|
lineHeight: n = 1.2,
|
|
41
41
|
width: a = 200,
|
|
42
42
|
letterSpacing: r = 0,
|
|
43
|
-
paragraphSpacing:
|
|
43
|
+
paragraphSpacing: l = 0,
|
|
44
44
|
paragraphIndent: f = 0,
|
|
45
|
-
textCase:
|
|
46
|
-
segments:
|
|
45
|
+
textCase: h = "none",
|
|
46
|
+
segments: u = [],
|
|
47
47
|
enableSegments: c = !1
|
|
48
48
|
} = g;
|
|
49
49
|
let d = String(t || "");
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
let b = Ge.get(
|
|
53
|
-
const m = typeof CanvasRenderingContext2D < "u" ? CanvasRenderingContext2D.prototype.measureText : null,
|
|
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}|${l}|${f}|${c}|${JSON.stringify(u)}|hyp:${!!g.hyphenation}|comp:${g.composer}|bal:${!!g.balanceRaggedLines}`;
|
|
52
|
+
let b = Ge.get(y);
|
|
53
|
+
const m = typeof CanvasRenderingContext2D < "u" ? CanvasRenderingContext2D.prototype.measureText : null, v = function(k) {
|
|
54
54
|
if (!m) return { width: 0, fontBoundingBoxAscent: 0, fontBoundingBoxDescent: 0 };
|
|
55
55
|
const T = m.call(this, k);
|
|
56
56
|
return r !== 0 && k && k.length > 0 ? {
|
|
@@ -60,18 +60,18 @@ function ps(g) {
|
|
|
60
60
|
};
|
|
61
61
|
if (!b) {
|
|
62
62
|
try {
|
|
63
|
-
if (r !== 0 && typeof CanvasRenderingContext2D < "u" && (CanvasRenderingContext2D.prototype.measureText =
|
|
64
|
-
const k =
|
|
63
|
+
if (r !== 0 && typeof CanvasRenderingContext2D < "u" && (CanvasRenderingContext2D.prototype.measureText = v), c && u && u.length > 0) {
|
|
64
|
+
const k = u.map((T) => {
|
|
65
65
|
let R = T.text || "";
|
|
66
|
-
const P = T.textCase ||
|
|
66
|
+
const P = T.textCase || h || "none";
|
|
67
67
|
return P === "uppercase" ? R.toUpperCase() : P === "lowercase" ? R.toLowerCase() : P === "capitalize" ? R.replace(/\b\w/g, (_) => _.toUpperCase()) : R;
|
|
68
68
|
}).join("");
|
|
69
|
-
if (b = ts(k,
|
|
69
|
+
if (b = ts(k, p), b) {
|
|
70
70
|
let T = 0, R = o;
|
|
71
|
-
for (const P of
|
|
71
|
+
for (const P of u) {
|
|
72
72
|
let _ = P.text || "";
|
|
73
73
|
if (!_) continue;
|
|
74
|
-
const E = P.textCase ||
|
|
74
|
+
const E = P.textCase || h || "none";
|
|
75
75
|
E === "uppercase" ? _ = _.toUpperCase() : E === "lowercase" ? _ = _.toLowerCase() : E === "capitalize" && (_ = _.replace(/\b\w/g, (Y) => Y.toUpperCase()));
|
|
76
76
|
const A = P.fontSize || o;
|
|
77
77
|
A > R && (R = A);
|
|
@@ -95,8 +95,8 @@ function ps(g) {
|
|
|
95
95
|
b.fullText = k, b.maxFontSize = R;
|
|
96
96
|
}
|
|
97
97
|
} else
|
|
98
|
-
b = ts(d,
|
|
99
|
-
b && Ge.set(
|
|
98
|
+
b = ts(d, p);
|
|
99
|
+
b && Ge.set(y, b);
|
|
100
100
|
} catch (k) {
|
|
101
101
|
return console.error("[ExodeUI] Pretext prepare failed:", k), { width: a, height: 0, lineCount: 0, lines: [] };
|
|
102
102
|
} finally {
|
|
@@ -118,7 +118,7 @@ function ps(g) {
|
|
|
118
118
|
}
|
|
119
119
|
if (!b) return { width: a, height: 0, lineCount: 0, lines: [] };
|
|
120
120
|
let S = n;
|
|
121
|
-
typeof S == "string" && (S = parseFloat(S)), S > 5 && o > 0 && (S = S / o), r !== 0 && (CanvasRenderingContext2D.prototype.measureText =
|
|
121
|
+
typeof S == "string" && (S = parseFloat(S)), S > 5 && o > 0 && (S = S / o), r !== 0 && (CanvasRenderingContext2D.prototype.measureText = v);
|
|
122
122
|
let C;
|
|
123
123
|
try {
|
|
124
124
|
const k = b.maxFontSize || o;
|
|
@@ -136,12 +136,12 @@ function ps(g) {
|
|
|
136
136
|
r !== 0 && m && (CanvasRenderingContext2D.prototype.measureText = m);
|
|
137
137
|
}
|
|
138
138
|
let w = (C == null ? void 0 : C.height) !== void 0 && C.height > 0 ? C.height : (((I = C == null ? void 0 : C.lines) == null ? void 0 : I.length) || 0) * S * o;
|
|
139
|
-
if (
|
|
139
|
+
if (l > 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 += l, k++, T[k - 1] === "\r" && T[k] === `
|
|
145
145
|
` && k++);
|
|
146
146
|
}
|
|
147
147
|
let M = (C == null ? void 0 : C.lines) || [];
|
|
@@ -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, l) => {
|
|
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[l] = f, n -= f;
|
|
167
|
+
} else r.endsWith("fr") ? a += parseFloat(r) : r === "auto" && (s[l] = 100, n -= 100);
|
|
168
168
|
}), a > 0 && n > 0) {
|
|
169
169
|
const r = n / a;
|
|
170
|
-
e.forEach((
|
|
171
|
-
|
|
170
|
+
e.forEach((l, f) => {
|
|
171
|
+
l.endsWith("fr") && (s[f] = r * parseFloat(l));
|
|
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, l = 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") {
|
|
@@ -209,48 +209,48 @@ function Es(g, t, i) {
|
|
|
209
209
|
}
|
|
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
|
-
let
|
|
213
|
-
const c = ((_ = g.layoutProps) == null ? void 0 : _.width) === "hug", d = ((E = g.layoutProps) == null ? void 0 : E.height) === "hug",
|
|
214
|
-
let
|
|
215
|
-
const
|
|
212
|
+
let h = g.width, u = g.height;
|
|
213
|
+
const c = ((_ = g.layoutProps) == null ? void 0 : _.width) === "hug", d = ((E = g.layoutProps) == null ? void 0 : E.height) === "hug", p = [];
|
|
214
|
+
let y = [], b = 0, m = 0;
|
|
215
|
+
const v = h - n.left - n.right, S = u - n.top - n.bottom;
|
|
216
216
|
f.forEach((A) => {
|
|
217
|
-
r &&
|
|
218
|
-
}),
|
|
217
|
+
r && y.length > 0 && (l ? 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), l ? (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 }), c && !l && (h = Math.max(...p.map((A) => A.width), 0) + n.left + n.right), d && l && (u = Math.max(...p.map((A) => A.height), 0) + n.top + n.bottom);
|
|
219
219
|
const C = [];
|
|
220
220
|
let w = n.left, M = n.top;
|
|
221
221
|
const I = a.toLowerCase(), k = I === "center" || I.endsWith("-center"), T = I.endsWith("-right"), R = I === "center" || I.startsWith("center-"), P = I.startsWith("bottom-");
|
|
222
|
-
return
|
|
222
|
+
return p.forEach((A) => {
|
|
223
223
|
let W = w, z = M;
|
|
224
|
-
|
|
224
|
+
l ? 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
|
+
l ? 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
|
-
x: G + Y.w / 2 -
|
|
232
|
-
y: N + Y.h / 2 -
|
|
233
|
-
width: J &&
|
|
234
|
-
height: x ?
|
|
235
|
-
}),
|
|
236
|
-
}),
|
|
237
|
-
}), { frameWidth: c ?
|
|
231
|
+
x: G + Y.w / 2 - h / 2,
|
|
232
|
+
y: N + Y.h / 2 - u / 2,
|
|
233
|
+
width: J && l ? A.width : void 0,
|
|
234
|
+
height: x ? l ? void 0 : A.height : void 0
|
|
235
|
+
}), l ? z += Y.h + s : W += Y.w + s;
|
|
236
|
+
}), l ? w += A.width + s : M += A.height + s;
|
|
237
|
+
}), { frameWidth: c ? 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:
|
|
243
|
-
let f = g.width,
|
|
244
|
-
const
|
|
242
|
+
const { gridColumns: e, gridRows: s, columnGap: n = 0, rowGap: a = 0, padding: r, align: l } = o;
|
|
243
|
+
let f = g.width, h = g.height;
|
|
244
|
+
const u = f - r.left - r.right, c = h - r.top - r.bottom, d = is(e || "1fr", u, n), p = is(s || "auto", c, 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 = l.toLowerCase(), v = m === "center" || m.endsWith("-center"), S = m.endsWith("-right"), C = m === "center" || m.startsWith("center-"), w = m.startsWith("bottom-");
|
|
245
245
|
let M = 0, I = 0;
|
|
246
|
-
|
|
246
|
+
v ? M = (u - y) / 2 : S && (M = u - y), C ? I = (c - b) / 2 : w && (I = c - 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
|
-
_ >=
|
|
252
|
-
const E = d[P], A =
|
|
253
|
-
let W = r.left + M + d.slice(0, P).reduce((tt, L) => tt + L + n, 0), z = r.top + I +
|
|
251
|
+
_ >= p.length && p.push(100);
|
|
252
|
+
const E = d[P], A = p[_];
|
|
253
|
+
let W = r.left + M + d.slice(0, P).reduce((tt, L) => tt + L + n, 0), z = r.top + I + 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") {
|
|
@@ -259,10 +259,10 @@ function As(g, t, i) {
|
|
|
259
259
|
}
|
|
260
260
|
N *= T.transform.scale_x || 1, J *= T.transform.scale_y || 1;
|
|
261
261
|
let x = W, F = z;
|
|
262
|
-
|
|
262
|
+
v ? x += (E - N) / 2 : S && (x += E - N), C ? F += (A - J) / 2 : w && (F += A - J), k.push({
|
|
263
263
|
id: T.id,
|
|
264
264
|
x: x + N / 2 - f / 2,
|
|
265
|
-
y: F + J / 2 -
|
|
265
|
+
y: F + J / 2 - h / 2,
|
|
266
266
|
width: ((j = T.layoutProps) == null ? void 0 : j.width) === "fill" ? E : void 0,
|
|
267
267
|
height: ((X = T.layoutProps) == null ? void 0 : X.height) === "fill" ? A : void 0
|
|
268
268
|
});
|
|
@@ -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, l = t.damping ?? 10;
|
|
408
|
+
n = qt.JointData.spring(a, r, l, e, s);
|
|
409
409
|
} else
|
|
410
410
|
n = qt.JointData.revolute(e, s);
|
|
411
411
|
try {
|
|
@@ -431,17 +431,17 @@ const gs = (g) => g, Rs = (g) => g > 0 ? 1 : 0, Ls = (g) => g < 1 ? 0 : 1, os =
|
|
|
431
431
|
const e = `${g},${t},${i},${o}`;
|
|
432
432
|
if (es.has(e)) return es.get(e);
|
|
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
|
-
let
|
|
435
|
-
for (let
|
|
436
|
-
const c = s(
|
|
437
|
-
if (Math.abs(c) < 1e-6) return
|
|
438
|
-
const d = a(
|
|
434
|
+
let h = f;
|
|
435
|
+
for (let u = 0; u < 8; u++) {
|
|
436
|
+
const c = s(h) - f;
|
|
437
|
+
if (Math.abs(c) < 1e-6) return h;
|
|
438
|
+
const d = a(h);
|
|
439
439
|
if (Math.abs(d) < 1e-6) break;
|
|
440
|
-
|
|
440
|
+
h = h - c / d;
|
|
441
441
|
}
|
|
442
|
-
return
|
|
443
|
-
},
|
|
444
|
-
return es.set(e,
|
|
442
|
+
return h;
|
|
443
|
+
}, l = (f) => f === 0 ? 0 : f === 1 ? 1 : n(r(f));
|
|
444
|
+
return es.set(e, l), l;
|
|
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,9 +572,9 @@ 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,
|
|
576
|
-
let
|
|
577
|
-
const c = o.rotation * Math.PI / 180, d = Math.cos(c),
|
|
575
|
+
const s = o.scale_x ?? 1, n = o.scale_y ?? 1, a = (r, l, f) => {
|
|
576
|
+
let h = 0, u = 0;
|
|
577
|
+
const c = o.rotation * Math.PI / 180, d = Math.cos(c), p = Math.sin(c), y = r * s * d - l * n * p + o.x, b = r * s * p + l * n * d + o.y;
|
|
578
578
|
f.forEach((I) => {
|
|
579
579
|
const k = e(I.boneId);
|
|
580
580
|
if (!k) return;
|
|
@@ -584,8 +584,8 @@ 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[I.boneId] || [1, 0, 0, 1, 0, 0], P =
|
|
588
|
-
|
|
587
|
+
}, R = i[I.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 * I.amount, u += Y * I.amount;
|
|
589
589
|
});
|
|
590
590
|
const m = [...f].sort((I, k) => k.amount - I.amount);
|
|
591
591
|
if (m.length >= 2 && m[0].amount > 0 && m[1].amount > 0) {
|
|
@@ -605,34 +605,34 @@ const gs = (g) => g, Rs = (g) => g > 0 ? 1 : 0, Ls = (g) => g < 1 ? 0 : 1, os =
|
|
|
605
605
|
const ot = -x[2] / F, yt = x[0] / F, bt = Math.hypot(ot, yt), gt = I.length * bt;
|
|
606
606
|
j = tt - gt * Math.sin(O), X = L + gt * Math.cos(O);
|
|
607
607
|
}
|
|
608
|
-
const D = Math.hypot(
|
|
608
|
+
const D = Math.hypot(y - j, b - X), q = Math.hypot(h - Y, u - G);
|
|
609
609
|
if (q > 0 && D > 0) {
|
|
610
|
-
const ot = Math.max(q, 0.01), yt = Math.min(D / ot, 3), bt = Y + (
|
|
611
|
-
|
|
610
|
+
const ot = Math.max(q, 0.01), yt = Math.min(D / ot, 3), bt = Y + (h - Y) * yt, gt = G + (u - G) * yt, Et = m[0].amount, It = m[1].amount, vt = Math.min(Et, It) * 2, Yt = 1 - Math.pow(1 - vt, 4);
|
|
611
|
+
h = h * (1 - Yt) + bt * Yt, u = u * (1 - Yt) + gt * Yt;
|
|
612
612
|
}
|
|
613
613
|
}
|
|
614
614
|
}
|
|
615
615
|
}
|
|
616
616
|
}
|
|
617
|
-
const
|
|
617
|
+
const v = o.rotation * Math.PI / 180, S = Math.cos(v), C = Math.sin(v), w = h - o.x, M = u - o.y;
|
|
618
618
|
return {
|
|
619
619
|
x: (w * S + M * C) / s,
|
|
620
620
|
y: (-w * C + M * S) / n
|
|
621
621
|
};
|
|
622
622
|
};
|
|
623
|
-
return g.map((r,
|
|
624
|
-
const f = t[
|
|
623
|
+
return g.map((r, l) => {
|
|
624
|
+
const f = t[l];
|
|
625
625
|
if (!f || f.length === 0) return { ...r };
|
|
626
|
-
const
|
|
626
|
+
const h = { ...r, ...a(r.x, r.y, f) };
|
|
627
627
|
if (r.in_x !== void 0 && r.in_y !== void 0) {
|
|
628
|
-
const
|
|
629
|
-
|
|
628
|
+
const u = a(r.in_x, r.in_y, f);
|
|
629
|
+
h.in_x = u.x, h.in_y = u.y;
|
|
630
630
|
}
|
|
631
631
|
if (r.out_x !== void 0 && r.out_y !== void 0) {
|
|
632
|
-
const
|
|
633
|
-
|
|
632
|
+
const u = a(r.out_x, r.out_y, f);
|
|
633
|
+
h.out_x = u.x, h.out_y = u.y;
|
|
634
634
|
}
|
|
635
|
-
return
|
|
635
|
+
return h;
|
|
636
636
|
});
|
|
637
637
|
}, ds = {
|
|
638
638
|
default: {
|
|
@@ -909,26 +909,26 @@ 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,
|
|
913
|
-
for (; (
|
|
914
|
-
const c =
|
|
912
|
+
let s = !1, n = 0, a = 0, r = 0, l = 0, f = 0, h = 0, u;
|
|
913
|
+
for (; (u = i.exec(t)) !== null; ) {
|
|
914
|
+
const c = u[1], d = (u[2].match(o) || []).map(parseFloat), p = c === c.toLowerCase(), y = c.toUpperCase();
|
|
915
915
|
let b = 0;
|
|
916
916
|
const m = (S) => {
|
|
917
917
|
let C = d[b++];
|
|
918
|
-
return
|
|
919
|
-
},
|
|
920
|
-
switch (
|
|
918
|
+
return p && (C += S ? n : a), C;
|
|
919
|
+
}, v = () => ({ x: m(!0), y: m(!1) });
|
|
920
|
+
switch (y) {
|
|
921
921
|
case "M": {
|
|
922
|
-
const S =
|
|
923
|
-
for (f = n = S.x,
|
|
924
|
-
const C =
|
|
922
|
+
const S = v();
|
|
923
|
+
for (f = n = S.x, h = a = S.y, e.push({ x: n, y: a, in_x: n, in_y: a, out_x: n, out_y: a, moveTo: !0 }); b < d.length; ) {
|
|
924
|
+
const C = v();
|
|
925
925
|
n = C.x, a = C.y, e.push({ x: n, y: a, in_x: n, in_y: a, out_x: n, out_y: a });
|
|
926
926
|
}
|
|
927
927
|
break;
|
|
928
928
|
}
|
|
929
929
|
case "L":
|
|
930
930
|
for (; b < d.length; ) {
|
|
931
|
-
const S =
|
|
931
|
+
const S = v();
|
|
932
932
|
n = S.x, a = S.y, e.push({ x: n, y: a, in_x: n, in_y: a, out_x: n, out_y: a });
|
|
933
933
|
}
|
|
934
934
|
break;
|
|
@@ -942,42 +942,42 @@ class ci {
|
|
|
942
942
|
break;
|
|
943
943
|
case "C":
|
|
944
944
|
for (; b < d.length; ) {
|
|
945
|
-
const S =
|
|
945
|
+
const S = v(), C = v(), w = v();
|
|
946
946
|
if (e.length > 0) {
|
|
947
947
|
const M = e[e.length - 1];
|
|
948
948
|
M.out_x = S.x, M.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, l = 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 - l }, C = v(), w = v();
|
|
956
956
|
if (e.length > 0) {
|
|
957
957
|
const M = e[e.length - 1];
|
|
958
958
|
M.out_x = S.x, M.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, l = C.y;
|
|
961
961
|
}
|
|
962
962
|
break;
|
|
963
963
|
case "Q":
|
|
964
964
|
for (; b < d.length; ) {
|
|
965
|
-
const S =
|
|
965
|
+
const S = v(), C = v();
|
|
966
966
|
if (e.length > 0) {
|
|
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, l = 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 - l }, 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, l = S.y;
|
|
981
981
|
}
|
|
982
982
|
break;
|
|
983
983
|
case "Z":
|
|
@@ -987,11 +987,11 @@ class ci {
|
|
|
987
987
|
const C = [...e].reverse().find((w) => w.moveTo) || e[0];
|
|
988
988
|
C && Math.hypot(C.x - S.x, C.y - S.y) < 0.1 && (C.in_x = S.in_x, C.in_y = S.in_y, e.pop(), e.length > 0 && (e[e.length - 1].closePath = !0));
|
|
989
989
|
}
|
|
990
|
-
n = f, a =
|
|
990
|
+
n = f, a = h;
|
|
991
991
|
break;
|
|
992
992
|
default:
|
|
993
993
|
if (d.length >= 2) {
|
|
994
|
-
const S =
|
|
994
|
+
const S = v();
|
|
995
995
|
n = S.x, a = S.y, e.push({ x: n, y: a, in_x: n, in_y: a, out_x: n, out_y: a });
|
|
996
996
|
}
|
|
997
997
|
break;
|
|
@@ -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 = { ...
|
|
1070
|
-
e.add(f.id), o.push(f), s(
|
|
1067
|
+
r && r.forEach((l) => {
|
|
1068
|
+
if (e.has(l.id)) return;
|
|
1069
|
+
const f = { ...l }, h = f.childrenObjects || [];
|
|
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((l) => {
|
|
1076
|
+
r.set(l.id, l), l.children || (l.children = []);
|
|
1077
|
+
}), this.artboard.objects.forEach((l) => {
|
|
1078
|
+
if (l.parentId) {
|
|
1079
|
+
const f = r.get(l.parentId);
|
|
1080
|
+
f && (f.children || (f.children = []), f.children.includes(l.id) || f.children.push(l.id));
|
|
1081
1081
|
}
|
|
1082
1082
|
});
|
|
1083
1083
|
}
|
|
@@ -1127,12 +1127,12 @@ 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, l, 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) ?? ((l = i.geometry) == null ? void 0 : l.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,
|
|
1135
|
-
y: ((
|
|
1135
|
+
y: ((h = i.transform) == null ? void 0 : h.y) ?? i.y ?? 0,
|
|
1136
1136
|
width: o,
|
|
1137
1137
|
height: e,
|
|
1138
1138
|
cornerRadius: s,
|
|
@@ -1141,7 +1141,7 @@ class ci {
|
|
|
1141
1141
|
clipContent: i.clipContent ?? !1,
|
|
1142
1142
|
autoLayout: i.autoLayout ? JSON.parse(JSON.stringify(i.autoLayout)) : void 0,
|
|
1143
1143
|
layoutProps: i.layoutProps ? JSON.parse(JSON.stringify(i.layoutProps)) : void 0,
|
|
1144
|
-
opacity: ((
|
|
1144
|
+
opacity: ((u = i.transform) == null ? void 0 : u.opacity) !== void 0 ? i.transform.opacity : i.opacity !== void 0 ? i.opacity : 100,
|
|
1145
1145
|
visible: i.visible !== void 0 ? i.visible : i.isVisible !== void 0 ? i.isVisible : !0,
|
|
1146
1146
|
blendMode: i.blendMode || "Normal",
|
|
1147
1147
|
// We need to store style state to animate it
|
|
@@ -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, l = 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: l,
|
|
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 l = Math.abs(r.x - a.x), f = Math.abs(r.y - a.y);
|
|
1216
|
+
!t && (l > 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((
|
|
1228
|
-
if (!
|
|
1229
|
-
const f = ns(
|
|
1230
|
-
f.frameWidth !== void 0 && (
|
|
1227
|
+
const r = n.children.map((h) => i.get(h)).filter((h) => !!h), l = this.objectStates.get(n.id);
|
|
1228
|
+
if (!l) return;
|
|
1229
|
+
const f = ns(l, r, (h) => this.objectStates.get(h));
|
|
1230
|
+
f.frameWidth !== void 0 && (l.width = f.frameWidth), f.frameHeight !== void 0 && (l.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:
|
|
1285
|
-
const
|
|
1286
|
-
|
|
1281
|
+
const l = a.states.find((f) => f.id === r);
|
|
1282
|
+
if (l)
|
|
1283
|
+
if (l.isBlendState && l.blendAnimations && l.blendAnimations.length > 0)
|
|
1284
|
+
e.push({ animation: null, state: l }), l.blendAnimations.forEach((f) => {
|
|
1285
|
+
const h = this.artboard.animations.find((u) => u.id === f.animationId);
|
|
1286
|
+
h && (s = Math.max(s, h.duration));
|
|
1287
1287
|
});
|
|
1288
1288
|
else {
|
|
1289
1289
|
let f = null;
|
|
1290
|
-
|
|
1291
|
-
(
|
|
1292
|
-
var
|
|
1293
|
-
return
|
|
1290
|
+
l.animationId && (f = this.artboard.animations.find((h) => h.id === l.animationId) || null), f || (f = this.artboard.animations.find(
|
|
1291
|
+
(h) => {
|
|
1292
|
+
var u, c;
|
|
1293
|
+
return h.name === l.name || h.id === l.name || (l.name === "Entry" || l.id === "entry") && (((u = h.name) == null ? void 0 : u.toLowerCase()) === "onload" || ((c = h.name) == null ? void 0 : c.toLowerCase()) === "intro");
|
|
1294
1294
|
}
|
|
1295
|
-
) || null), f && ((n = this.artboard.animationFlow) != null && n.some((
|
|
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: l }), 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 l = (n = this.activeStateMachine) == null ? void 0 : n.inputs.find((f) => f.id === t);
|
|
1342
|
+
l && typeof l.value == "object" && (o = l.value.type);
|
|
1343
1343
|
} else {
|
|
1344
|
-
const
|
|
1345
|
-
if (
|
|
1346
|
-
const f = (a = this.activeStateMachine) == null ? void 0 : a.inputs.find((
|
|
1344
|
+
const l = this.inputNameMap.get(t);
|
|
1345
|
+
if (l && l.length > 0) {
|
|
1346
|
+
const f = (a = this.activeStateMachine) == null ? void 0 : a.inputs.find((h) => h.id === l[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((l) => this.setInternalInput(l, e)), o === "Trigger" && e === !0 && (this.justFiredTriggers.add(t), s && s.forEach((l) => this.justFiredTriggers.add(l))), Array.isArray(e) && ((r = this.artboard) == null || r.objects.forEach((l) => {
|
|
1354
|
+
if (l.inputId === t || l.name === t) {
|
|
1355
|
+
const f = this.objectStates.get(l.id);
|
|
1356
|
+
f && f.options && (l.type === "ListView" || l.variant === "listview" ? f.options.items = e : (l.type === "Dropdown" || l.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 l = !1;
|
|
1367
1367
|
switch (a) {
|
|
1368
1368
|
case "Equal":
|
|
1369
1369
|
case "==":
|
|
1370
|
-
|
|
1370
|
+
l = i == r;
|
|
1371
1371
|
break;
|
|
1372
1372
|
case "NotEqual":
|
|
1373
1373
|
case "!=":
|
|
1374
|
-
|
|
1374
|
+
l = i != r;
|
|
1375
1375
|
break;
|
|
1376
1376
|
case "GreaterThan":
|
|
1377
1377
|
case ">":
|
|
1378
|
-
|
|
1378
|
+
l = i > r;
|
|
1379
1379
|
break;
|
|
1380
1380
|
case "LessThan":
|
|
1381
1381
|
case "<":
|
|
1382
|
-
|
|
1382
|
+
l = i < r;
|
|
1383
1383
|
break;
|
|
1384
1384
|
case "GreaterEqual":
|
|
1385
1385
|
case ">=":
|
|
1386
|
-
|
|
1386
|
+
l = i >= r;
|
|
1387
1387
|
break;
|
|
1388
1388
|
case "LessEqual":
|
|
1389
1389
|
case "<=":
|
|
1390
|
-
|
|
1390
|
+
l = i <= r;
|
|
1391
1391
|
break;
|
|
1392
1392
|
case "IsTrue":
|
|
1393
|
-
|
|
1393
|
+
l = !!i;
|
|
1394
1394
|
break;
|
|
1395
1395
|
case "IsFalse":
|
|
1396
|
-
|
|
1396
|
+
l = !i;
|
|
1397
1397
|
break;
|
|
1398
1398
|
}
|
|
1399
|
-
if (
|
|
1399
|
+
if (l) {
|
|
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((l) => l.id === n.inputId);
|
|
1425
1425
|
a && typeof a.value == "object" && a.value.type === "Trigger" && this.setInternalInput(n.inputId, !1);
|
|
1426
1426
|
}));
|
|
1427
1427
|
}
|
|
@@ -1498,15 +1498,15 @@ class ci {
|
|
|
1498
1498
|
});
|
|
1499
1499
|
}
|
|
1500
1500
|
evaluateLogicTree(t, i = null, o = /* @__PURE__ */ new Set()) {
|
|
1501
|
-
var a, r,
|
|
1501
|
+
var a, r, l, 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
1505
|
const e = (r = (a = this.activeStateMachine) == null ? void 0 : a.logicNodes) == null ? void 0 : r.find((c) => c.id === t);
|
|
1506
1506
|
if (e) {
|
|
1507
|
-
const c = (
|
|
1508
|
-
const b = e.inputs.find((m) => m.id ===
|
|
1509
|
-
return b ? b.sourceId ? this.evaluateLogicTree(b.sourceId, b.sourceHandleId, o) : b.value !== void 0 ? b.value :
|
|
1507
|
+
const c = (p, y) => {
|
|
1508
|
+
const b = e.inputs.find((m) => m.id === p);
|
|
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) {
|
|
@@ -1528,27 +1528,27 @@ class ci {
|
|
|
1528
1528
|
break;
|
|
1529
1529
|
case wt.PROPERTY:
|
|
1530
1530
|
case wt.GET_PROPERTY: {
|
|
1531
|
-
const
|
|
1532
|
-
if (!
|
|
1531
|
+
const p = c("id", "");
|
|
1532
|
+
if (!p) {
|
|
1533
1533
|
d = 0;
|
|
1534
1534
|
break;
|
|
1535
1535
|
}
|
|
1536
|
-
const
|
|
1537
|
-
if (!
|
|
1536
|
+
const y = e.name;
|
|
1537
|
+
if (!y || y === "GET_PROPERTY" || y === "PROPERTY") {
|
|
1538
1538
|
d = 0;
|
|
1539
1539
|
break;
|
|
1540
1540
|
}
|
|
1541
|
-
const b = this.objectStates.get(
|
|
1541
|
+
const b = this.objectStates.get(p);
|
|
1542
1542
|
if (!b) {
|
|
1543
1543
|
d = 0;
|
|
1544
1544
|
break;
|
|
1545
1545
|
}
|
|
1546
|
-
|
|
1546
|
+
y in b ? d = b[y] : d = this.resolvePath(b, y);
|
|
1547
1547
|
break;
|
|
1548
1548
|
}
|
|
1549
1549
|
case wt.SET_PROPERTY: {
|
|
1550
|
-
const
|
|
1551
|
-
if (!
|
|
1550
|
+
const p = c("id", ""), y = c("value", void 0);
|
|
1551
|
+
if (!p || y === void 0) {
|
|
1552
1552
|
d = 0;
|
|
1553
1553
|
break;
|
|
1554
1554
|
}
|
|
@@ -1557,13 +1557,13 @@ class ci {
|
|
|
1557
1557
|
d = 0;
|
|
1558
1558
|
break;
|
|
1559
1559
|
}
|
|
1560
|
-
const m = this.objectStates.get(
|
|
1560
|
+
const m = this.objectStates.get(p);
|
|
1561
1561
|
if (!m) {
|
|
1562
1562
|
d = 0;
|
|
1563
1563
|
break;
|
|
1564
1564
|
}
|
|
1565
1565
|
if (["x", "y", "rotation", "scale_x", "scale_y", "opacity", "width", "height", "cornerRadius", "visible", "zIndex"].includes(b))
|
|
1566
|
-
m[b] =
|
|
1566
|
+
m[b] = y, d = y;
|
|
1567
1567
|
else {
|
|
1568
1568
|
const S = b.split(".");
|
|
1569
1569
|
let C = m;
|
|
@@ -1572,7 +1572,7 @@ class ci {
|
|
|
1572
1572
|
C[I] === void 0 && (C[I] = {}), C = C[I];
|
|
1573
1573
|
}
|
|
1574
1574
|
const w = S[S.length - 1];
|
|
1575
|
-
C[w] =
|
|
1575
|
+
C[w] = y, d = y;
|
|
1576
1576
|
}
|
|
1577
1577
|
break;
|
|
1578
1578
|
}
|
|
@@ -1587,8 +1587,8 @@ class ci {
|
|
|
1587
1587
|
d = c("a", 0) * c("b", 0);
|
|
1588
1588
|
break;
|
|
1589
1589
|
case wt.DIV: {
|
|
1590
|
-
const
|
|
1591
|
-
d =
|
|
1590
|
+
const p = c("b", 1);
|
|
1591
|
+
d = p === 0 ? 0 : c("a", 0) / p;
|
|
1592
1592
|
break;
|
|
1593
1593
|
}
|
|
1594
1594
|
case wt.MOD:
|
|
@@ -1619,13 +1619,13 @@ class ci {
|
|
|
1619
1619
|
d = Math.tan(c("in", 0));
|
|
1620
1620
|
break;
|
|
1621
1621
|
case wt.CLAMP: {
|
|
1622
|
-
const
|
|
1623
|
-
d = Math.max(
|
|
1622
|
+
const p = c("in", 0), y = c("min", 0), b = c("max", 1);
|
|
1623
|
+
d = Math.max(y, Math.min(b, p));
|
|
1624
1624
|
break;
|
|
1625
1625
|
}
|
|
1626
1626
|
case wt.REMAP: {
|
|
1627
|
-
const
|
|
1628
|
-
d = b ===
|
|
1627
|
+
const p = c("in", 0), y = c("inMin", 0), b = c("inMax", 100), m = c("outMin", 0), v = c("outMax", 1);
|
|
1628
|
+
d = b === y ? m : m + (p - y) * (v - m) / (b - y);
|
|
1629
1629
|
break;
|
|
1630
1630
|
}
|
|
1631
1631
|
// Comparison
|
|
@@ -1658,8 +1658,8 @@ class ci {
|
|
|
1658
1658
|
d = this.inputs.get(e.name) ?? 0;
|
|
1659
1659
|
break;
|
|
1660
1660
|
case wt.LOG: {
|
|
1661
|
-
const
|
|
1662
|
-
this.debugLog(`[User Logic] ${
|
|
1661
|
+
const p = c("in", "");
|
|
1662
|
+
this.debugLog(`[User Logic] ${p}`), d = p;
|
|
1663
1663
|
break;
|
|
1664
1664
|
}
|
|
1665
1665
|
case wt.SCROLL_X:
|
|
@@ -1678,8 +1678,8 @@ class ci {
|
|
|
1678
1678
|
d = this.inputs.get("isMouseDown") ?? !1;
|
|
1679
1679
|
break;
|
|
1680
1680
|
case wt.EFFECTOR: {
|
|
1681
|
-
const
|
|
1682
|
-
if (!
|
|
1681
|
+
const p = c("id", ""), y = c("intensity", 1), b = c("trigger", !0);
|
|
1682
|
+
if (!p || !b) {
|
|
1683
1683
|
d = 0;
|
|
1684
1684
|
break;
|
|
1685
1685
|
}
|
|
@@ -1688,17 +1688,17 @@ class ci {
|
|
|
1688
1688
|
d = 0;
|
|
1689
1689
|
break;
|
|
1690
1690
|
}
|
|
1691
|
-
const
|
|
1692
|
-
if (!
|
|
1691
|
+
const v = this.objectStates.get(p);
|
|
1692
|
+
if (!v) {
|
|
1693
1693
|
d = 0;
|
|
1694
1694
|
break;
|
|
1695
1695
|
}
|
|
1696
1696
|
if (["glitch", "halftone", "pixelate", "noise", "acid_gradient", "acid_rave", "shimmer"].includes(m))
|
|
1697
|
-
|
|
1697
|
+
v.style || (v.style = {}), v.style.artEffect = { enabled: !0, type: m, intensity: y }, d = 1;
|
|
1698
1698
|
else {
|
|
1699
|
-
|
|
1700
|
-
let C =
|
|
1701
|
-
C ? (C.enabled = !0, C.settings || (C.settings = {}), C.settings.intensity =
|
|
1699
|
+
v.behaviors || (v.behaviors = []);
|
|
1700
|
+
let C = v.behaviors.find((w) => w.type === m);
|
|
1701
|
+
C ? (C.enabled = !0, C.settings || (C.settings = {}), C.settings.intensity = y) : (C = { id: `eff_${Date.now()}_${m}`, type: m, enabled: !0, sensors: [], settings: { intensity: y } }, v.behaviors.push(C)), d = 1;
|
|
1702
1702
|
}
|
|
1703
1703
|
break;
|
|
1704
1704
|
}
|
|
@@ -1707,47 +1707,47 @@ class ci {
|
|
|
1707
1707
|
break;
|
|
1708
1708
|
}
|
|
1709
1709
|
case wt.SPRING_PULL: {
|
|
1710
|
-
const
|
|
1711
|
-
|
|
1712
|
-
m.behaviors && m.behaviors.forEach((
|
|
1710
|
+
const p = c("objectId", ""), y = c("forceX", 0), b = c("forceY", 0);
|
|
1711
|
+
p && ((l = this.artboard) == null || l.objects.forEach((m) => {
|
|
1712
|
+
m.behaviors && m.behaviors.forEach((v) => {
|
|
1713
1713
|
var S;
|
|
1714
|
-
if (
|
|
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
|
-
if (!w.has(
|
|
1718
|
-
const I = this.objectStates.get(
|
|
1719
|
-
w.set(
|
|
1717
|
+
if (!w.has(p)) {
|
|
1718
|
+
const I = this.objectStates.get(p);
|
|
1719
|
+
w.set(p, {
|
|
1720
1720
|
x: (I == null ? void 0 : I.x) ?? 0,
|
|
1721
1721
|
y: (I == null ? void 0 : I.y) ?? 0,
|
|
1722
1722
|
vx: 0,
|
|
1723
1723
|
vy: 0
|
|
1724
1724
|
});
|
|
1725
1725
|
}
|
|
1726
|
-
const M = w.get(
|
|
1727
|
-
M && (M.vx +=
|
|
1726
|
+
const M = w.get(p);
|
|
1727
|
+
M && (M.vx += y, M.vy += b);
|
|
1728
1728
|
}
|
|
1729
1729
|
});
|
|
1730
1730
|
})), d = 1;
|
|
1731
1731
|
break;
|
|
1732
1732
|
}
|
|
1733
1733
|
case wt.SPRING_SETTLE: {
|
|
1734
|
-
const
|
|
1735
|
-
let
|
|
1736
|
-
if (
|
|
1734
|
+
const p = c("objectId", "");
|
|
1735
|
+
let y = !0;
|
|
1736
|
+
if (p) {
|
|
1737
1737
|
const b = c("threshold", 1);
|
|
1738
1738
|
this._springChainState.forEach((m) => {
|
|
1739
|
-
const
|
|
1740
|
-
|
|
1739
|
+
const v = m.get(p);
|
|
1740
|
+
v && (Math.abs(v.vx) > b || Math.abs(v.vy) > b) && (y = !1);
|
|
1741
1741
|
});
|
|
1742
1742
|
}
|
|
1743
|
-
d =
|
|
1743
|
+
d = y;
|
|
1744
1744
|
break;
|
|
1745
1745
|
}
|
|
1746
1746
|
case wt.EMIT: {
|
|
1747
|
-
const
|
|
1748
|
-
|
|
1747
|
+
const p = c("objectId", ""), y = c("count", 20);
|
|
1748
|
+
p && ((f = this.artboard) == null || f.objects.forEach((b) => {
|
|
1749
1749
|
b.behaviors && b.behaviors.forEach((m) => {
|
|
1750
|
-
m.type === U.ParticleEmitter && b.id ===
|
|
1750
|
+
m.type === U.ParticleEmitter && b.id === p && (m._pendingBurst = (m._pendingBurst || 0) + y);
|
|
1751
1751
|
});
|
|
1752
1752
|
})), d = 1;
|
|
1753
1753
|
break;
|
|
@@ -1757,22 +1757,22 @@ class ci {
|
|
|
1757
1757
|
break;
|
|
1758
1758
|
}
|
|
1759
1759
|
if (this.logicNodeValues.set(t, d), e.op === wt.DELAY) {
|
|
1760
|
-
const
|
|
1760
|
+
const p = c("delay", 0), y = c("in", 0);
|
|
1761
1761
|
let b = this.logicNodeState.get(t);
|
|
1762
|
-
for (b || (b = { queue: [] }, this.logicNodeState.set(t, b)), b.queue.push({ time: this.currentTime +
|
|
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;
|
|
1764
1764
|
d = b.lastValue ?? 0;
|
|
1765
1765
|
}
|
|
1766
1766
|
return d;
|
|
1767
1767
|
}
|
|
1768
|
-
const s = (
|
|
1768
|
+
const s = (h = this.activeStateMachine) == null ? void 0 : h.inputs.find((c) => c.id === t || c.name === t);
|
|
1769
1769
|
if (s && s.sourceId && !o.has(s.sourceId)) {
|
|
1770
1770
|
const c = this.evaluateLogicTree(s.sourceId, s.sourceHandleId, o);
|
|
1771
1771
|
return this.inputs.set(s.id, c), c;
|
|
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 c = (
|
|
1775
|
+
const c = (u = this.activeStateMachine) == null ? void 0 : u.inputs.find((d) => d.id === t);
|
|
1776
1776
|
if (c && c.value.type === "Number" && typeof n == "number") {
|
|
1777
1777
|
const d = c.value.defaultValue ?? c.value.value;
|
|
1778
1778
|
if (i === "source-greater") return n > d;
|
|
@@ -1841,17 +1841,17 @@ 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, l, f, h;
|
|
1845
1845
|
if (o.phase === "entry")
|
|
1846
|
-
o.time += t, o.time >= o.animation.duration && ((a = (n = (s = this.artboard) == null ? void 0 : s.objects.find((
|
|
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
|
|
1848
|
+
const u = (f = (l = (r = this.artboard) == null ? void 0 : r.objects.find((p) => p.id === e)) == null ? void 0 : l.triggers) == null ? void 0 : f.find((p) => p.id === o.triggerId), c = (u == null ? void 0 : u.duration) || 0;
|
|
1849
1849
|
o.elapsedHold += t * 1e3;
|
|
1850
1850
|
let d = o.elapsedHold >= c;
|
|
1851
|
-
if ((
|
|
1852
|
-
if (
|
|
1853
|
-
const
|
|
1854
|
-
|
|
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
|
+
if (u != null && u.exitAnimationId) {
|
|
1853
|
+
const p = (h = this.artboard) == null ? void 0 : h.animations.find((y) => y.id === u.exitAnimationId);
|
|
1854
|
+
p ? (o.phase = "exit", o.animation = p, o.time = 0) : this.activeTriggers.delete(e);
|
|
1855
1855
|
} else
|
|
1856
1856
|
this.activeTriggers.delete(e);
|
|
1857
1857
|
} else o.phase === "exit" && (o.time += t, o.time >= o.animation.duration ? this.activeTriggers.delete(e) : this.applyAnimation(o.animation, o.time, o.filterObjectIds || o.filterObjectId || void 0));
|
|
@@ -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
|
-
|
|
1867
|
+
const r = this.getGlobalTransform(i.id), l = (((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 + l / 2 >= -this.canvasWidth / 2 - h && r.x - l / 2 <= this.canvasWidth / 2 + h && r.y + f / 2 >= -this.canvasHeight / 2 - h && r.y - f / 2 <= this.canvasHeight / 2 + h, c = `analytics_${i.id}`, d = this.wasInView.has(c);
|
|
1868
|
+
u && !d && this.fireAnalyticsEvent(i.id, "visible"), u ? this.wasInView.add(c) : this.wasInView.delete(c);
|
|
1869
1869
|
}
|
|
1870
1870
|
}
|
|
1871
1871
|
}), this.artboard.objects.forEach((i) => {
|
|
@@ -1873,26 +1873,26 @@ 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, l, f;
|
|
1877
1877
|
const a = n.toLowerCase();
|
|
1878
1878
|
if (a === "on interval" || a === "oninterval") {
|
|
1879
|
-
const
|
|
1880
|
-
this.currentTime * 1e3 -
|
|
1879
|
+
const h = e.intervalValue || 2e3, u = this.periodicTriggerTimes.get(e.id) || 0;
|
|
1880
|
+
this.currentTime * 1e3 - u >= h && (!e.conditions || this.checkConditions(e.conditions)) && (this.fireEventForObject(i.id, "On Interval"), this.periodicTriggerTimes.set(e.id, this.currentTime * 1e3));
|
|
1881
1881
|
}
|
|
1882
1882
|
if (a === "on delay" || a === "ondelay") {
|
|
1883
|
-
const
|
|
1884
|
-
!this.periodicTriggerTimes.has(e.id) && this.currentTime * 1e3 >=
|
|
1883
|
+
const h = e.delayValue || 1e3;
|
|
1884
|
+
!this.periodicTriggerTimes.has(e.id) && this.currentTime * 1e3 >= h && (!e.conditions || this.checkConditions(e.conditions)) && (this.fireEventForObject(i.id, "On Delay"), this.periodicTriggerTimes.set(e.id, this.currentTime * 1e3));
|
|
1885
1885
|
}
|
|
1886
1886
|
if (a === "scroll into view" || a === "scrollintoview") {
|
|
1887
|
-
const
|
|
1888
|
-
if (
|
|
1889
|
-
const
|
|
1890
|
-
|
|
1887
|
+
const h = this.objectStates.get(i.id);
|
|
1888
|
+
if (h && h.visible !== !1) {
|
|
1889
|
+
const u = this.getGlobalTransform(i.id), c = (((r = i.geometry) == null ? void 0 : r.width) || 100) * (u.scale_x || 1), d = (((l = i.geometry) == null ? void 0 : l.height) || 100) * (u.scale_y || 1), p = 50, y = u.x + c / 2 >= -this.canvasWidth / 2 - p && u.x - c / 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
|
+
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
|
}
|
|
1893
1893
|
if (a === "scroll progress" || a === "scrollprogress") {
|
|
1894
|
-
const
|
|
1895
|
-
Math.abs(
|
|
1894
|
+
const h = Math.abs(this.scrollOffset.y) / (((f = this.artboard) == null ? void 0 : f.height) || 1e3), u = this.scrollProgressLastValue.get(e.id) || 0;
|
|
1895
|
+
Math.abs(h - u) > 1e-3 && (this.scrollProgressLastValue.set(e.id, h), (e.action === "Set Input" || e.action === "setInput") && this.updateInput(e.targetInputId, h));
|
|
1896
1896
|
}
|
|
1897
1897
|
});
|
|
1898
1898
|
});
|
|
@@ -1905,65 +1905,65 @@ 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,
|
|
1909
|
-
const a = ((f = o.constraints) == null ? void 0 : f[n]) || {}, r = { ...s, ...a },
|
|
1908
|
+
var f, h, u, c, d, p, y, b, m;
|
|
1909
|
+
const a = ((f = o.constraints) == null ? void 0 : f[n]) || {}, r = { ...s, ...a }, l = r.strength ?? 1;
|
|
1910
1910
|
if (r.type === "Translation") {
|
|
1911
|
-
const
|
|
1912
|
-
if (
|
|
1913
|
-
const S = r.offsetX || 0, C = r.offsetY || 0, w =
|
|
1911
|
+
const v = this.getGlobalTransform(r.targetId);
|
|
1912
|
+
if (v) {
|
|
1913
|
+
const S = r.offsetX || 0, C = r.offsetY || 0, w = v.x + S, M = v.y + C, I = r.useSpring;
|
|
1914
1914
|
if (I) {
|
|
1915
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, M, r, t);
|
|
1916
|
-
r.copyX && (e.x = e.x + (R - e.x) *
|
|
1916
|
+
r.copyX && (e.x = e.x + (R - e.x) * l), r.copyY && (e.y = e.y + (P - e.y) * l), 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) * l), r.copyY && (e.y = e.y + (M - e.y) * l);
|
|
1919
1919
|
let k = !1;
|
|
1920
|
-
if ((
|
|
1920
|
+
if ((h = r.limitX) != null && h.enabled) {
|
|
1921
1921
|
const T = e.x;
|
|
1922
1922
|
e.x = Math.max(r.limitX.min, Math.min(r.limitX.max, e.x)), e.x !== T && (k = !0);
|
|
1923
1923
|
}
|
|
1924
|
-
if ((
|
|
1924
|
+
if ((u = r.limitY) != null && u.enabled) {
|
|
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
1928
|
k && I && this.objectVelocities.set(i.id, { vx: 0, vy: 0 });
|
|
1929
1929
|
}
|
|
1930
1930
|
} else if (r.type === "Rotation") {
|
|
1931
|
-
const
|
|
1932
|
-
if (
|
|
1933
|
-
let C = (
|
|
1934
|
-
C > 180 && (C -= 360), C < -180 && (C += 360), e.rotation = e.rotation + C *
|
|
1931
|
+
const v = this.getGlobalTransform(r.targetId);
|
|
1932
|
+
if (v) {
|
|
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 * l;
|
|
1935
1935
|
}
|
|
1936
1936
|
} else if (r.type === "Scale") {
|
|
1937
|
-
const
|
|
1938
|
-
|
|
1937
|
+
const v = this.getGlobalTransform(r.targetId);
|
|
1938
|
+
v && (r.copyX && (e.scale_x = e.scale_x + (v.scale_x - e.scale_x) * l), r.copyY && (e.scale_y = e.scale_y + (v.scale_y - e.scale_y) * l));
|
|
1939
1939
|
} else if (r.type === "Transform") {
|
|
1940
|
-
const
|
|
1941
|
-
if (
|
|
1942
|
-
e.x = e.x + (
|
|
1943
|
-
let S = (
|
|
1944
|
-
S > 180 && (S -= 360), S < -180 && (S += 360), e.rotation = e.rotation + S *
|
|
1940
|
+
const v = this.getGlobalTransform(r.targetId);
|
|
1941
|
+
if (v) {
|
|
1942
|
+
e.x = e.x + (v.x - e.x) * l, e.y = e.y + (v.y - e.y) * l;
|
|
1943
|
+
let S = (v.rotation - e.rotation) % 360;
|
|
1944
|
+
S > 180 && (S -= 360), S < -180 && (S += 360), e.rotation = e.rotation + S * l, e.scale_x = e.scale_x + (v.scale_x - e.scale_x) * l, e.scale_y = e.scale_y + (v.scale_y - e.scale_y) * l;
|
|
1945
1945
|
}
|
|
1946
1946
|
} else if (r.type === "FollowPointer") {
|
|
1947
|
-
const
|
|
1947
|
+
const v = ((c = this._lastPointerPos) == null ? void 0 : c.x) ?? e.x, S = ((d = this._lastPointerPos) == null ? void 0 : d.y) ?? e.y, C = r.useSpring;
|
|
1948
1948
|
if (C) {
|
|
1949
|
-
const M = this.objectVelocities.get(i.id) || { vx: 0, vy: 0 }, { x: I, y: k, vx: T, vy: R } = this.computeSpring(e.x, e.y, M.vx, M.vy,
|
|
1949
|
+
const M = this.objectVelocities.get(i.id) || { vx: 0, vy: 0 }, { x: I, y: k, vx: T, vy: R } = this.computeSpring(e.x, e.y, M.vx, M.vy, v, S, r, t);
|
|
1950
1950
|
e.x = I, e.y = k, this.objectVelocities.set(i.id, { vx: T, vy: R });
|
|
1951
1951
|
} else
|
|
1952
|
-
e.x = e.x + (
|
|
1952
|
+
e.x = e.x + (v - e.x) * l, e.y = e.y + (S - e.y) * l;
|
|
1953
1953
|
let w = !1;
|
|
1954
|
-
if ((
|
|
1954
|
+
if ((p = r.limitX) != null && p.enabled) {
|
|
1955
1955
|
const M = e.x;
|
|
1956
1956
|
e.x = Math.max(r.limitX.min, Math.min(r.limitX.max, e.x)), e.x !== M && (w = !0);
|
|
1957
1957
|
}
|
|
1958
|
-
if ((
|
|
1958
|
+
if ((y = r.limitY) != null && y.enabled) {
|
|
1959
1959
|
const M = e.y;
|
|
1960
1960
|
e.y = Math.max(r.limitY.min, Math.min(r.limitY.max, e.y)), e.y !== M && (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
|
-
const
|
|
1965
|
-
if (
|
|
1966
|
-
const S = e.x -
|
|
1964
|
+
const v = this.getGlobalTransform(r.targetId);
|
|
1965
|
+
if (v) {
|
|
1966
|
+
const S = e.x - v.x, C = e.y - v.y, w = Math.sqrt(S * S + C * C), M = r.distance || 0;
|
|
1967
1967
|
let I = w;
|
|
1968
1968
|
switch (r.mode) {
|
|
1969
1969
|
case "exact":
|
|
@@ -1980,19 +1980,19 @@ class ci {
|
|
|
1980
1980
|
break;
|
|
1981
1981
|
}
|
|
1982
1982
|
if (w > 0) {
|
|
1983
|
-
const k = e.x ===
|
|
1984
|
-
e.x = e.x + (
|
|
1983
|
+
const k = e.x === v.x && e.y === v.y ? 1 : I / w;
|
|
1984
|
+
e.x = e.x + (v.x + S * k - e.x) * l, e.y = e.y + (v.y + C * k - e.y) * l;
|
|
1985
1985
|
}
|
|
1986
1986
|
}
|
|
1987
1987
|
} else if (r.type === "FollowPath") {
|
|
1988
|
-
const
|
|
1989
|
-
if (
|
|
1990
|
-
const S = this.getGlobalTransform(
|
|
1988
|
+
const v = (b = this.artboard) == null ? void 0 : b.objects.find((S) => S.id === r.targetId);
|
|
1989
|
+
if (v) {
|
|
1990
|
+
const S = this.getGlobalTransform(v.id);
|
|
1991
1991
|
if (S) {
|
|
1992
|
-
let C =
|
|
1993
|
-
if (
|
|
1992
|
+
let C = v.geometry;
|
|
1993
|
+
if (v.type === "Frame" || v.type === "Group" || !C || C.type !== "Path" && C.type !== "Ellipse" && C.type !== "Rectangle") {
|
|
1994
1994
|
const F = (m = this.artboard) == null ? void 0 : m.objects.find(
|
|
1995
|
-
(j) => j.parentId ===
|
|
1995
|
+
(j) => j.parentId === v.id && j.type === "Shape" && j.geometry && (j.geometry.type === "Path" || j.geometry.type === "Ellipse" || j.geometry.type === "Rectangle")
|
|
1996
1996
|
);
|
|
1997
1997
|
F && (C = F.geometry);
|
|
1998
1998
|
}
|
|
@@ -2004,15 +2004,15 @@ class ci {
|
|
|
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) * l, e.y = e.y + (x - e.y) * l, 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 * l;
|
|
2010
2010
|
}
|
|
2011
2011
|
}
|
|
2012
2012
|
}
|
|
2013
2013
|
} else if (r.type === "IK") {
|
|
2014
|
-
const
|
|
2015
|
-
|
|
2014
|
+
const v = this.getGlobalTransform(r.targetId);
|
|
2015
|
+
v && this.solveIK(i, v, r.boneCount || 2, l);
|
|
2016
2016
|
}
|
|
2017
2017
|
}), i.constraints.some((s) => s.type !== "IK")) {
|
|
2018
2018
|
const s = this.globalToLocal(i.parentId, e);
|
|
@@ -2021,10 +2021,10 @@ class ci {
|
|
|
2021
2021
|
});
|
|
2022
2022
|
}
|
|
2023
2023
|
getGlobalTransform(t) {
|
|
2024
|
-
var
|
|
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 = (
|
|
2027
|
+
const o = (h = this.artboard) == null ? void 0 : h.objects.find((c) => c.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), l = 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: l,
|
|
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,36 +2046,36 @@ 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), l = i.x - o.x, f = i.y - o.y, h = (l * a - f * r) * e, u = (l * r + f * a) * s;
|
|
2050
2050
|
return {
|
|
2051
|
-
x:
|
|
2052
|
-
y:
|
|
2051
|
+
x: h,
|
|
2052
|
+
y: u,
|
|
2053
2053
|
rotation: i.rotation - o.rotation,
|
|
2054
2054
|
scale_x: i.scale_x / (o.scale_x || 1),
|
|
2055
2055
|
scale_y: i.scale_y / (o.scale_y || 1)
|
|
2056
2056
|
};
|
|
2057
2057
|
}
|
|
2058
2058
|
solveIK(t, i, o, e) {
|
|
2059
|
-
var
|
|
2059
|
+
var l;
|
|
2060
2060
|
const s = [];
|
|
2061
2061
|
let n = t.id;
|
|
2062
2062
|
for (let f = 0; f < o && n; f++) {
|
|
2063
|
-
const
|
|
2064
|
-
if (!
|
|
2063
|
+
const h = (l = this.artboard) == null ? void 0 : l.objects.find((u) => u.id === n);
|
|
2064
|
+
if (!h) break;
|
|
2065
2065
|
s.push({
|
|
2066
2066
|
id: n,
|
|
2067
2067
|
local: this.objectStates.get(n),
|
|
2068
2068
|
global: this.getGlobalTransform(n)
|
|
2069
|
-
}), n =
|
|
2069
|
+
}), n = h.parentId;
|
|
2070
2070
|
}
|
|
2071
2071
|
if (s.length < 2) return;
|
|
2072
2072
|
const a = s.reverse(), r = 5;
|
|
2073
2073
|
for (let f = 0; f < r; f++) {
|
|
2074
|
-
const
|
|
2075
|
-
for (let
|
|
2076
|
-
const c = a[
|
|
2077
|
-
if (
|
|
2078
|
-
const C = Math.atan2(
|
|
2074
|
+
const h = this.getGlobalTransform(t.id);
|
|
2075
|
+
for (let u = a.length - 2; u >= 0; u--) {
|
|
2076
|
+
const c = a[u], d = this.getGlobalTransform(c.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
|
+
if (v > 1e-3 && S > 1e-3) {
|
|
2078
|
+
const C = Math.atan2(y, p);
|
|
2079
2079
|
let M = (Math.atan2(m, b) - C) * 180 / Math.PI;
|
|
2080
2080
|
M *= e;
|
|
2081
2081
|
const I = this.objectStates.get(c.id);
|
|
@@ -2085,8 +2085,8 @@ class ci {
|
|
|
2085
2085
|
}
|
|
2086
2086
|
}
|
|
2087
2087
|
computeSpring(t, i, o, e, s, n, a, r) {
|
|
2088
|
-
const
|
|
2089
|
-
return { x: S, y: C, vx: m, vy:
|
|
2088
|
+
const l = a.stiffness ?? 100, f = a.damping ?? 10, h = a.mass ?? 1, u = -l * (t - s), c = -l * (i - n), d = -f * o, p = -f * e, y = (u + d) / h, b = (c + p) / h, m = o + y * r, v = e + b * r, S = t + m * r, C = i + v * r;
|
|
2089
|
+
return { x: S, y: C, vx: m, vy: v };
|
|
2090
2090
|
}
|
|
2091
2091
|
handlePointerInput(t, i, o, e, s) {
|
|
2092
2092
|
if (!this.artboard) return;
|
|
@@ -2109,23 +2109,23 @@ 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, l, 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
2116
|
const s = (c, d) => {
|
|
2117
2117
|
var S;
|
|
2118
|
-
let
|
|
2119
|
-
d === "click" ?
|
|
2120
|
-
const
|
|
2121
|
-
d === "move" &&
|
|
2118
|
+
let p = d;
|
|
2119
|
+
d === "click" ? p = "onClick" : d === "down" ? p = "onPointerDown" : d === "up" ? p = "onPointerUp" : d === "blur" && (p = "onPointerLeave");
|
|
2120
|
+
const y = /* @__PURE__ */ new Set([p]);
|
|
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 !!(c.type === "Component" && b.includes(c.variant) || c.type === "Joystick" || b.includes((S = c.type) == null ? void 0 : S.toLowerCase()) || (c.interactions || []).some((C) =>
|
|
2123
|
+
return !!(c.type === "Component" && b.includes(c.variant) || c.type === "Joystick" || b.includes((S = c.type) == null ? void 0 : S.toLowerCase()) || (c.interactions || []).some((C) => y.has(C.event)) || (c.triggers || []).some((C) => y.has(C.eventType)));
|
|
2124
2124
|
};
|
|
2125
2125
|
let n = null;
|
|
2126
2126
|
for (let c = this.artboard.objects.length - 1; c >= 0; c--) {
|
|
2127
|
-
const d = this.artboard.objects[c],
|
|
2128
|
-
if (
|
|
2127
|
+
const d = this.artboard.objects[c], p = this.objectStates.get(d.id);
|
|
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;
|
|
2131
2131
|
}
|
|
@@ -2156,12 +2156,12 @@ class ci {
|
|
|
2156
2156
|
})) : t === "blur" && this.activeHoverIds.clear(), this.activeDropdownId && t === "down") {
|
|
2157
2157
|
const c = this.artboard.objects.find((d) => d.id === this.activeDropdownId);
|
|
2158
2158
|
if (c && (c.type === "Dropdown" || c.variant === "dropdown")) {
|
|
2159
|
-
const d = this.objectStates.get(c.id),
|
|
2159
|
+
const d = this.objectStates.get(c.id), p = (d == null ? void 0 : d.options) || c.options || {}, y = c.geometry || {}, b = y.width ?? c.width ?? 200, m = y.height ?? c.height ?? 40, v = p.optionsList || [], S = p.itemHeight || 32, C = p.listPadding ?? 4, w = v.length * S + C * 2, M = this.getWorldTransform(c.id), I = b * Math.abs(M.scaleX), k = m * Math.abs(M.scaleY), T = M.y + k / 2 + 4, R = Math.abs(i - M.x) <= I / 2, P = o >= T && o <= T + w * Math.abs(M.scaleY);
|
|
2160
2160
|
if (R && P) {
|
|
2161
2161
|
const _ = Math.abs(M.scaleY), E = o - (T + C * _), A = Math.floor(E / (S * _));
|
|
2162
|
-
if (A >= 0 && A <
|
|
2163
|
-
const W =
|
|
2164
|
-
|
|
2162
|
+
if (A >= 0 && A < v.length) {
|
|
2163
|
+
const W = v[A];
|
|
2164
|
+
p.selectedOption = W, p.isOpen = !1, this.activeDropdownId = null, c.inputId && this.setInternalInput(c.inputId, W), this.onComponentChange && this.onComponentChange({
|
|
2165
2165
|
objectId: c.id,
|
|
2166
2166
|
componentName: c.name,
|
|
2167
2167
|
variant: "dropdown",
|
|
@@ -2170,22 +2170,22 @@ class ci {
|
|
|
2170
2170
|
});
|
|
2171
2171
|
}
|
|
2172
2172
|
return;
|
|
2173
|
-
} else a !== this.activeDropdownId && (
|
|
2173
|
+
} else a !== this.activeDropdownId && (p.isOpen = !1, this.activeDropdownId = null);
|
|
2174
2174
|
}
|
|
2175
2175
|
}
|
|
2176
2176
|
if (e) {
|
|
2177
2177
|
let c = e, d = e;
|
|
2178
2178
|
for (; d && d.parentId; ) {
|
|
2179
|
-
const
|
|
2180
|
-
if (
|
|
2181
|
-
c =
|
|
2179
|
+
const y = this.artboard.objects.find((b) => b.id === d.parentId);
|
|
2180
|
+
if (y && y.type === "Component") {
|
|
2181
|
+
c = y;
|
|
2182
2182
|
break;
|
|
2183
2183
|
}
|
|
2184
|
-
d =
|
|
2184
|
+
d = y;
|
|
2185
2185
|
}
|
|
2186
|
-
let
|
|
2187
|
-
if (t === "click" ?
|
|
2188
|
-
const
|
|
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), c !== e && this.fireEventForObject(c.id, p), c.type === "Component" && c.variant === "toggle_button" && t === "down") {
|
|
2188
|
+
const y = this.objectStates.get(c.id), b = (y == null ? void 0 : y.options) || c.options || {};
|
|
2189
2189
|
b.checked = !b.checked, c.inputId && this.setInternalInput(c.inputId, b.checked), this.onComponentChange && this.onComponentChange({
|
|
2190
2190
|
objectId: c.id,
|
|
2191
2191
|
componentName: c.name,
|
|
@@ -2195,7 +2195,7 @@ class ci {
|
|
|
2195
2195
|
}), this.fireEventForObject(c.id, "Toggle"), this.fireEventForObject(c.id, b.checked ? "Toggle True" : "Toggle False");
|
|
2196
2196
|
}
|
|
2197
2197
|
if (c.type === "Component" && c.variant === "toggle" && t === "down") {
|
|
2198
|
-
const
|
|
2198
|
+
const y = this.objectStates.get(c.id), b = (y == null ? void 0 : y.options) || c.options || {};
|
|
2199
2199
|
b.checked = !b.checked, c.inputId && this.setInternalInput(c.inputId, b.checked), this.onComponentChange && this.onComponentChange({
|
|
2200
2200
|
objectId: c.id,
|
|
2201
2201
|
componentName: c.name,
|
|
@@ -2205,10 +2205,10 @@ class ci {
|
|
|
2205
2205
|
}), this.onToggle && this.onToggle(c.name, b.checked), this.fireEventForObject(c.id, "Toggle"), this.fireEventForObject(c.id, b.checked ? "Toggle True" : "Toggle False");
|
|
2206
2206
|
}
|
|
2207
2207
|
if (c.type === "Component" && c.variant === "dropdown" && t === "down") {
|
|
2208
|
-
const
|
|
2208
|
+
const y = this.objectStates.get(c.id), b = (y == null ? void 0 : y.options) || c.options || {}, m = !b.isOpen;
|
|
2209
2209
|
if (m && this.activeDropdownId && this.activeDropdownId !== c.id) {
|
|
2210
|
-
const
|
|
2211
|
-
|
|
2210
|
+
const v = this.artboard.objects.find((S) => S.id === this.activeDropdownId);
|
|
2211
|
+
v && v.options && (v.options.isOpen = !1);
|
|
2212
2212
|
}
|
|
2213
2213
|
b.isOpen = m, this.activeDropdownId = m ? c.id : null;
|
|
2214
2214
|
}
|
|
@@ -2220,19 +2220,19 @@ class ci {
|
|
|
2220
2220
|
value: !0
|
|
2221
2221
|
})), (c.type === "ListView" || c.type === "Component" && c.variant === "listview") && t === "down") {
|
|
2222
2222
|
this.draggingListViewId = c.id;
|
|
2223
|
-
const
|
|
2224
|
-
if (
|
|
2223
|
+
const y = this.getListViewItemIndexAtPointer(c, i, o);
|
|
2224
|
+
if (y !== null) {
|
|
2225
2225
|
const b = c.options || {};
|
|
2226
|
-
b.activeItemIndex =
|
|
2226
|
+
b.activeItemIndex = y;
|
|
2227
2227
|
const m = this.objectStates.get(c.id);
|
|
2228
|
-
m && m.options && (m.options.activeItemIndex =
|
|
2229
|
-
const
|
|
2228
|
+
m && m.options && (m.options.activeItemIndex = y);
|
|
2229
|
+
const v = (b.items || [])[y], S = typeof v == "string" ? v : v.label || v.value || y;
|
|
2230
2230
|
m && m.options && (m.options.selectedValue = S), c.inputId && this.setInternalInput(c.inputId, S), this.onComponentChange && (this.onComponentChange({
|
|
2231
2231
|
objectId: c.id,
|
|
2232
2232
|
componentName: c.name,
|
|
2233
2233
|
variant: "listview",
|
|
2234
2234
|
property: "activeItemIndex",
|
|
2235
|
-
value:
|
|
2235
|
+
value: y
|
|
2236
2236
|
}), this.onComponentChange({
|
|
2237
2237
|
objectId: c.id,
|
|
2238
2238
|
componentName: c.name,
|
|
@@ -2246,12 +2246,12 @@ class ci {
|
|
|
2246
2246
|
if (t === "down")
|
|
2247
2247
|
this.draggingJoystickId = c.id, this.updateJoystickValueFromPointer(c, i, o);
|
|
2248
2248
|
else if (t === "up" || t === "blur") {
|
|
2249
|
-
const
|
|
2250
|
-
|
|
2249
|
+
const y = this.objectStates.get(c.id);
|
|
2250
|
+
y && c.isSpringReturn !== !1 && (y.handleX = 0, y.handleY = 0), c.isSpringReturn !== !1 && (c.handleX = 0, c.handleY = 0);
|
|
2251
2251
|
}
|
|
2252
2252
|
}
|
|
2253
2253
|
if (c.type === "Component" && c.variant === "checkbox" && t === "down") {
|
|
2254
|
-
const
|
|
2254
|
+
const y = this.objectStates.get(c.id), b = (y == null ? void 0 : y.options) || c.options || {};
|
|
2255
2255
|
b.checked = !b.checked, c.inputId && this.setInternalInput(c.inputId, b.checked), this.onComponentChange && this.onComponentChange({
|
|
2256
2256
|
objectId: c.id,
|
|
2257
2257
|
componentName: c.name,
|
|
@@ -2261,9 +2261,9 @@ class ci {
|
|
|
2261
2261
|
}), this.fireEventForObject(c.id, "Click"), this.fireEventForObject(c.id, b.checked ? "Checked" : "Unchecked");
|
|
2262
2262
|
}
|
|
2263
2263
|
if (c.type === "Component" && c.variant === "radiogroup" && t === "down") {
|
|
2264
|
-
const
|
|
2265
|
-
if (
|
|
2266
|
-
const S = m[
|
|
2264
|
+
const y = this.objectStates.get(c.id), b = (y == null ? void 0 : y.options) || c.options || {}, m = b.optionsList || [], v = this.getRadioGroupItemIndexAtPointer(c, i, o);
|
|
2265
|
+
if (v !== null && v >= 0 && v < m.length) {
|
|
2266
|
+
const S = m[v];
|
|
2267
2267
|
b.selectedValue = S, c.inputId && this.setInternalInput(c.inputId, S), this.onComponentChange && this.onComponentChange({
|
|
2268
2268
|
objectId: c.id,
|
|
2269
2269
|
componentName: c.name,
|
|
@@ -2274,7 +2274,7 @@ class ci {
|
|
|
2274
2274
|
}
|
|
2275
2275
|
}
|
|
2276
2276
|
if (c.type === "LineGraph" && (t === "down" || t === "click")) {
|
|
2277
|
-
const
|
|
2277
|
+
const y = c.geometry, b = (y == null ? void 0 : y.datasets) || [], m = this.objectStates.get(c.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(c.id), w = 30, M = 20, I = v - w, k = S - M;
|
|
2278
2278
|
let T = 1;
|
|
2279
2279
|
b.forEach((_) => {
|
|
2280
2280
|
const E = Math.max(..._.data || [0]);
|
|
@@ -2284,30 +2284,30 @@ class ci {
|
|
|
2284
2284
|
b.forEach((_, E) => {
|
|
2285
2285
|
const A = _.data || [], W = I / Math.max(A.length - 1, 1);
|
|
2286
2286
|
A.forEach((z, Y) => {
|
|
2287
|
-
const G = C.x -
|
|
2287
|
+
const G = C.x - v / 2 + w + Y * W, N = C.y + S / 2 - M - 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
2290
|
}), P && R < 20 && this.onGraphPointClick && this.onGraphPointClick({ objectId: c.id, componentName: c.name, datasetIndex: P.dIdx, pointIndex: P.pIdx, value: P.val, label: P.label }), this.onComponentChange && this.onComponentChange({ objectId: c.id, componentName: c.name, variant: "linegraph", property: "click", value: (P == null ? void 0 : P.val) ?? null });
|
|
2291
2291
|
}
|
|
2292
2292
|
if (t === "click") {
|
|
2293
|
-
const
|
|
2294
|
-
if (
|
|
2293
|
+
const y = (l = this.artboard) == null ? void 0 : l.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
|
+
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) {
|
|
2297
|
-
const
|
|
2298
|
-
|
|
2297
|
+
const v = (f = this.artboard) == null ? void 0 : f.objects.find((S) => S.id === b);
|
|
2298
|
+
v && this.onInputBlur && this.onInputBlur(v.name);
|
|
2299
2299
|
}
|
|
2300
|
-
this.onInputFocus && this.onInputFocus(
|
|
2300
|
+
this.onInputFocus && this.onInputFocus(y.name);
|
|
2301
2301
|
}
|
|
2302
2302
|
} else if (this.focusedId = null, b) {
|
|
2303
|
-
const
|
|
2304
|
-
|
|
2303
|
+
const v = (h = this.artboard) == null ? void 0 : h.objects.find((S) => S.id === b);
|
|
2304
|
+
v && this.onInputBlur && this.onInputBlur(v.name);
|
|
2305
2305
|
}
|
|
2306
2306
|
}
|
|
2307
2307
|
} else if (t === "click") {
|
|
2308
2308
|
const c = this.focusedId;
|
|
2309
2309
|
if (this.focusedId = null, c) {
|
|
2310
|
-
const d = (
|
|
2310
|
+
const d = (u = this.artboard) == null ? void 0 : u.objects.find((p) => p.id === c);
|
|
2311
2311
|
d && this.onInputBlur && this.onInputBlur(d.name);
|
|
2312
2312
|
}
|
|
2313
2313
|
}
|
|
@@ -2346,85 +2346,85 @@ 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,
|
|
2350
|
-
const o = (f = this.artboard) == null ? void 0 : f.objects.find((
|
|
2349
|
+
var f, h, u, c, d;
|
|
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();
|
|
2353
2353
|
s === "onclick" || s === "click" || s === "onpointerdown" || s === "pointerdown" ? this.fireAnalyticsEvent(t, "click") : (s === "onpointerenter" || s === "hover" || s === "move") && this.fireAnalyticsEvent(t, "hover"), s === "onclick" || s === "click" ? (e.add("click"), e.add("onclick")) : s === "onpointerdown" || s === "pointerdown" ? (e.add("pointerdown"), e.add("onpointerdown")) : s === "onpointerup" || s === "pointerup" ? (e.add("pointerup"), e.add("onpointerup")) : s === "onpointerenter" || s === "hover" || s === "move" ? (e.add("hover"), e.add("onpointerenter")) : s === "onpointerleave" || s === "blur" ? (e.add("onpointerleave"), e.add("blur")) : s === "drag" || s === "ondrag" ? (e.add("drag"), e.add("ondrag")) : s === "toggle" || s === "ontoggle" ? (e.add("toggle"), e.add("ontoggle")) : s === "toggle true" || s === "toggle_true" || s === "toggletrue" ? (e.add("toggle true"), e.add("toggle_true"), e.add("toggletrue")) : (s === "toggle false" || s === "toggle_false" || s === "togglefalse") && (e.add("toggle false"), e.add("toggle_false"), e.add("togglefalse"));
|
|
2354
|
-
const a = (o.interactions || []).find((
|
|
2355
|
-
const
|
|
2356
|
-
return ((
|
|
2354
|
+
const a = (o.interactions || []).find((p) => {
|
|
2355
|
+
const y = p.triggers || [p.event || p.trigger || "click"];
|
|
2356
|
+
return ((p.triggerLogic || "OR") === "AND" ? y.every((v) => e.has(v.toLowerCase())) : y.some((v) => e.has(v.toLowerCase()))) ? p.conditions && p.conditions.length > 0 ? this.checkConditions(p.conditions) : !0 : !1;
|
|
2357
2357
|
});
|
|
2358
2358
|
if (a) {
|
|
2359
2359
|
if (this.log(`[Engine] Interaction matched: ${i} -> Action: ${a.action}`), a.action === "setInput" || a.action === "Set Input") {
|
|
2360
|
-
let
|
|
2361
|
-
|
|
2360
|
+
let p = a.value || a.inputValue;
|
|
2361
|
+
p === "toggle" && (p = !this.inputs.get(a.targetInputId)), this.updateInput(a.targetInputId, p);
|
|
2362
2362
|
} else if (a.action === "Toggle Boolean") {
|
|
2363
|
-
const
|
|
2364
|
-
this.updateInput(a.targetInputId, !
|
|
2363
|
+
const p = this.inputs.get(a.targetInputId);
|
|
2364
|
+
this.updateInput(a.targetInputId, !p);
|
|
2365
2365
|
} else if (a.action === "fireTrigger")
|
|
2366
2366
|
this.updateInput(a.targetInputId, !0);
|
|
2367
2367
|
else if (a.action === "setProperty") {
|
|
2368
|
-
const
|
|
2369
|
-
|
|
2368
|
+
const p = a.targetObjectId || o.id, y = a.targetProperty;
|
|
2369
|
+
y && this.updateObjectProperty(p, y, a.value);
|
|
2370
2370
|
} else if (a.action === "Navigate Artboard" || a.action === "navigate")
|
|
2371
2371
|
this.onNavigation && this.onNavigation({ type: "artboard", value: a.targetArtboard || a.value });
|
|
2372
2372
|
else if (a.action === "Navigate URL")
|
|
2373
2373
|
this.onNavigation && this.onNavigation({ type: "url", value: a.navigateUrl });
|
|
2374
2374
|
else if (a.action === "Play Animation") {
|
|
2375
|
-
const
|
|
2376
|
-
|
|
2377
|
-
this.triggerGlobalAnimation(b.id,
|
|
2378
|
-
}) :
|
|
2375
|
+
const p = a.targetAnimationId, y = !a.playMode || a.playMode === "all" ? void 0 : a.subAnimationIds;
|
|
2376
|
+
p === "__all__" ? (u = (h = this.artboard) == null ? void 0 : h.animations) == null || u.forEach((b) => {
|
|
2377
|
+
this.triggerGlobalAnimation(b.id, y);
|
|
2378
|
+
}) : p && this.triggerGlobalAnimation(p, y);
|
|
2379
2379
|
} else if (a.action === "setState" || a.action === "Set State") {
|
|
2380
|
-
const
|
|
2381
|
-
this.objectStates.set(
|
|
2380
|
+
const p = a.targetObjectId || o.id, b = { ...this.objectStates.get(p) || {}, ...a.value || {} };
|
|
2381
|
+
this.objectStates.set(p, b), this.log(`[Engine] State updated for ${p}:`, b);
|
|
2382
2382
|
} else if (a.action === "Stop Animation" || a.action === "Pause Animation") {
|
|
2383
|
-
const
|
|
2384
|
-
|
|
2383
|
+
const p = a.targetAnimationId;
|
|
2384
|
+
p === "__all__" ? this.layerStates.forEach((y, b) => {
|
|
2385
2385
|
b.startsWith("global_") && this.layerStates.delete(b);
|
|
2386
|
-
}) :
|
|
2387
|
-
b.startsWith(`global_${
|
|
2386
|
+
}) : p && this.layerStates.forEach((y, b) => {
|
|
2387
|
+
b.startsWith(`global_${p}_`) && this.layerStates.delete(b);
|
|
2388
2388
|
});
|
|
2389
2389
|
} else if (a.action === "Switch to State" && this.activeStateMachine) {
|
|
2390
|
-
const
|
|
2391
|
-
(b) => b.states.some((m) => m.id ===
|
|
2390
|
+
const p = a.targetState, y = this.activeStateMachine.layers.find(
|
|
2391
|
+
(b) => b.states.some((m) => m.id === p || m.name === p)
|
|
2392
2392
|
);
|
|
2393
|
-
|
|
2393
|
+
y && (this.log(`[Engine] Switching Layer ${y.name} to State ${p}`), this.enterStates(y.name, [p]));
|
|
2394
2394
|
}
|
|
2395
2395
|
this.onTrigger && this.onTrigger(i, a.action);
|
|
2396
2396
|
}
|
|
2397
|
-
const
|
|
2398
|
-
const
|
|
2397
|
+
const l = (o.triggers || []).find((p) => {
|
|
2398
|
+
const y = p.eventType.toLowerCase();
|
|
2399
2399
|
let b = !1;
|
|
2400
|
-
return (e.has(
|
|
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
|
|
2405
|
-
|
|
2406
|
-
triggerId:
|
|
2407
|
-
animation:
|
|
2402
|
+
if (l && l.entryAnimationId) {
|
|
2403
|
+
this.log(`[Engine] Trigger matched: ${i} (as ${l.eventType}) -> Animation ${l.entryAnimationId}`);
|
|
2404
|
+
const p = (d = (c = this.artboard) == null ? void 0 : c.animations) == null ? void 0 : d.find((y) => y.id === l.entryAnimationId);
|
|
2405
|
+
p && (this.activeTriggers.set(o.id, {
|
|
2406
|
+
triggerId: l.id,
|
|
2407
|
+
animation: p,
|
|
2408
2408
|
time: 0,
|
|
2409
2409
|
phase: "entry",
|
|
2410
2410
|
elapsedHold: 0,
|
|
2411
|
-
filterObjectId:
|
|
2412
|
-
}), this.onTrigger && this.onTrigger(
|
|
2411
|
+
filterObjectId: l.targetObjectId
|
|
2412
|
+
}), this.onTrigger && this.onTrigger(l.name, p.name));
|
|
2413
2413
|
}
|
|
2414
2414
|
}
|
|
2415
2415
|
fireAnalyticsEvent(t, i) {
|
|
2416
|
-
var r,
|
|
2416
|
+
var r, l;
|
|
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 = (l = o.style) == null ? void 0 : l.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) => {
|
|
2423
2423
|
if (f.type === "literal")
|
|
2424
2424
|
n[f.key] = f.value;
|
|
2425
2425
|
else if (f.type === "variable") {
|
|
2426
|
-
const
|
|
2427
|
-
n[f.key] =
|
|
2426
|
+
const h = this.inputs.get(f.value);
|
|
2427
|
+
n[f.key] = h !== void 0 ? h : "";
|
|
2428
2428
|
}
|
|
2429
2429
|
}), this.log(`[ExodeUI Analytics] Dispatching event "${s}" via ${i} trigger:`, n);
|
|
2430
2430
|
const a = e.platforms || { ga4: !0, meta: !0, mixpanel: !1 };
|
|
@@ -2476,10 +2476,10 @@ class ci {
|
|
|
2476
2476
|
});
|
|
2477
2477
|
}
|
|
2478
2478
|
getWorldTransform(t) {
|
|
2479
|
-
var
|
|
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 = (
|
|
2482
|
+
const o = (u = this.artboard) == null ? void 0 : u.objects.find((c) => c.id === t);
|
|
2483
2483
|
if (!o || !o.parentId)
|
|
2484
2484
|
return {
|
|
2485
2485
|
x: i.x,
|
|
@@ -2488,31 +2488,31 @@ 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, l = i.y * e.scaleY, f = e.x + (r * n - l * a), h = e.y + (r * a + l * n);
|
|
2492
2492
|
return {
|
|
2493
2493
|
x: f,
|
|
2494
|
-
y:
|
|
2494
|
+
y: h,
|
|
2495
2495
|
scaleX: (i.scale_x ?? 1) * e.scaleX,
|
|
2496
2496
|
scaleY: (i.scale_y ?? 1) * e.scaleY,
|
|
2497
2497
|
rotation: e.rotation + (i.rotation ?? 0)
|
|
2498
2498
|
};
|
|
2499
2499
|
}
|
|
2500
2500
|
hitTest(t, i, o) {
|
|
2501
|
-
var
|
|
2501
|
+
var v, S;
|
|
2502
2502
|
if (!this.objectStates.get(t.id)) return !1;
|
|
2503
|
-
const s = ((
|
|
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, l = o - a.y, f = -a.rotation * (Math.PI / 180), h = Math.cos(f), u = Math.sin(f), c = r * h - l * u, d = r * u + l * h, p = a.scaleX, y = a.scaleY, b = s * Math.abs(p), m = n * Math.abs(y);
|
|
2504
2504
|
return Math.abs(c) <= b / 2 && Math.abs(d) <= m / 2;
|
|
2505
2505
|
}
|
|
2506
2506
|
updateSliderValueFromPointer(t, i, o) {
|
|
2507
2507
|
var M;
|
|
2508
2508
|
const e = this.objectStates.get(t.id);
|
|
2509
2509
|
if (!e) return;
|
|
2510
|
-
const s = t.options || {}, n = ((M = t.geometry) == null ? void 0 : M.width) ?? t.width ?? 200, a = this.getWorldTransform(t.id), r = i - a.x,
|
|
2511
|
-
let b = (c +
|
|
2510
|
+
const s = t.options || {}, n = ((M = t.geometry) == null ? void 0 : M.width) ?? t.width ?? 200, a = this.getWorldTransform(t.id), r = i - a.x, l = o - a.y, f = -a.rotation * (Math.PI / 180), h = Math.cos(f), u = Math.sin(f), c = r * h - l * u, d = s.thumbWidth ?? 16, p = n - d;
|
|
2511
|
+
let b = (c + p / 2) / p;
|
|
2512
2512
|
b = Math.max(0, Math.min(1, b));
|
|
2513
|
-
const m = s.min ?? 0,
|
|
2514
|
-
let C = m + b * (
|
|
2515
|
-
S > 0 && (C = Math.round(C / S) * S), C = Math.max(m, Math.min(
|
|
2513
|
+
const m = s.min ?? 0, v = s.max ?? 100, S = s.step || 1;
|
|
2514
|
+
let C = m + b * (v - m);
|
|
2515
|
+
S > 0 && (C = Math.round(C / S) * S), C = Math.max(m, Math.min(v, C));
|
|
2516
2516
|
const w = e.options || {};
|
|
2517
2517
|
w.value !== C && (e.options = { ...w, value: C }, t.inputId && this.setInternalInput(t.inputId, C), this.onComponentChange && this.onComponentChange({
|
|
2518
2518
|
objectId: t.id,
|
|
@@ -2526,15 +2526,15 @@ class ci {
|
|
|
2526
2526
|
var M, I;
|
|
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 : ((M = t.geometry) == null ? void 0 : M.width) ?? t.width ?? 100, n = (e == null ? void 0 : e.height) !== void 0 ? e.height : ((I = t.geometry) == null ? void 0 : I.height) ?? t.height ?? 100, a = this.getWorldTransform(t.id), r = i - a.x,
|
|
2530
|
-
let c = (r *
|
|
2529
|
+
const s = (e == null ? void 0 : e.width) !== void 0 ? e.width : ((M = t.geometry) == null ? void 0 : M.width) ?? t.width ?? 100, n = (e == null ? void 0 : e.height) !== void 0 ? e.height : ((I = t.geometry) == null ? void 0 : I.height) ?? t.height ?? 100, a = this.getWorldTransform(t.id), r = i - a.x, l = o - a.y, f = -a.rotation * (Math.PI / 180), h = Math.cos(f), u = Math.sin(f);
|
|
2530
|
+
let c = (r * h - l * u) / Math.max(1e-3, Math.abs(a.scaleX || 1)), d = (r * u + l * h) / Math.max(1e-3, Math.abs(a.scaleY || 1));
|
|
2531
2531
|
t.handleOrigin === "top-left" ? (c -= s / 2, d -= n / 2) : t.handleOrigin === "bottom-right" && (c += s / 2, d += n / 2);
|
|
2532
|
-
const
|
|
2533
|
-
let m = c / b,
|
|
2534
|
-
const S = Math.sqrt(m * m +
|
|
2535
|
-
t.boundsShape === "square" ? (m = Math.max(-1, Math.min(1, m)),
|
|
2532
|
+
const p = Math.min(s, n) * 0.45, y = Math.min(s, n) * 0.15, b = p - y;
|
|
2533
|
+
let m = c / b, v = d / b;
|
|
2534
|
+
const S = Math.sqrt(m * m + v * v);
|
|
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;
|
|
2537
|
-
(C !== m || w !==
|
|
2537
|
+
(C !== m || w !== v) && (e.handleX = m, e.handleY = v, t.handleX = m, t.handleY = v);
|
|
2538
2538
|
}
|
|
2539
2539
|
processJoysticks(t) {
|
|
2540
2540
|
this.artboard && (this.artboard.objects.forEach((i) => {
|
|
@@ -2544,68 +2544,68 @@ 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
|
|
2548
|
-
let f = s,
|
|
2549
|
-
const c = (
|
|
2547
|
+
const l = o.inputBinding.keyboardConfig;
|
|
2548
|
+
let f = s, h = n;
|
|
2549
|
+
const c = (l.speed || 5) * t;
|
|
2550
2550
|
let d = !1;
|
|
2551
|
-
this.activeKeys.has(
|
|
2552
|
-
const
|
|
2553
|
-
|
|
2551
|
+
this.activeKeys.has(l.upKey.toLowerCase()) && (h -= c, d = !0), this.activeKeys.has(l.downKey.toLowerCase()) && (h += c, d = !0), this.activeKeys.has(l.leftKey.toLowerCase()) && (f -= c, d = !0), this.activeKeys.has(l.rightKey.toLowerCase()) && (f += c, d = !0), o.joystickType === "1D_X" && (h = 0), o.joystickType === "1D_Y" && (f = 0);
|
|
2552
|
+
const p = Math.sqrt(f * f + h * h);
|
|
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
|
|
2556
|
-
let f = s,
|
|
2557
|
-
const
|
|
2558
|
-
|
|
2559
|
-
const d = Math.sqrt(f * f +
|
|
2560
|
-
d > 1 && (f /= d,
|
|
2555
|
+
const l = o.inputBinding.mouseConfig;
|
|
2556
|
+
let f = s, h = n;
|
|
2557
|
+
const u = l.sensitivity || 0.01, c = Math.abs(this._mouseDelta.dx) > 0 || Math.abs(this._mouseDelta.dy) > 0;
|
|
2558
|
+
l.axisX && (f += this._mouseDelta.dx * u), l.axisY && (h += this._mouseDelta.dy * u), o.joystickType === "1D_X" && (h = 0), o.joystickType === "1D_Y" && (f = 0);
|
|
2559
|
+
const d = Math.sqrt(f * f + h * h);
|
|
2560
|
+
d > 1 && (f /= d, h /= d), !c && 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 l = Math.sqrt(s * s + n * n);
|
|
2564
2564
|
let f = Math.atan2(n, s) * (180 / Math.PI);
|
|
2565
|
-
f < 0 && (f += 360), o.bindings.forEach((
|
|
2566
|
-
var d,
|
|
2567
|
-
let
|
|
2568
|
-
|
|
2569
|
-
const c = (d = this.artboard) == null ? void 0 : d.objects.find((w) => w.id ===
|
|
2565
|
+
f < 0 && (f += 360), o.bindings.forEach((h) => {
|
|
2566
|
+
var d, p, y, b, m, v, S, C;
|
|
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 = l : h.sourceAxis === "angle" && (u = f);
|
|
2569
|
+
const c = (d = this.artboard) == null ? void 0 : d.objects.find((w) => w.id === h.targetObjectId);
|
|
2570
2570
|
if (c) {
|
|
2571
|
-
if (
|
|
2572
|
-
const w =
|
|
2573
|
-
let T = !!
|
|
2571
|
+
if (h.actionType === "bind" && h.targetProperty && h.isContinuous !== !1) {
|
|
2572
|
+
const w = h.sourceMin ?? -1, M = h.sourceMax ?? 1, I = h.targetMin ?? 0, k = h.targetMax ?? 100;
|
|
2573
|
+
let T = !!h.isContinuous, R = 0, P = 0;
|
|
2574
2574
|
if (T) {
|
|
2575
|
-
if ((
|
|
2575
|
+
if ((h.sourceAxis === "x" || h.sourceAxis === "y") && I >= 0) {
|
|
2576
2576
|
const E = Math.max(Math.abs(w), Math.abs(M)) || 1;
|
|
2577
|
-
P =
|
|
2577
|
+
P = u / E * k;
|
|
2578
2578
|
} else {
|
|
2579
|
-
let E = (
|
|
2579
|
+
let E = (u - w) / (M - w);
|
|
2580
2580
|
E = Math.max(0, Math.min(1, E)), P = I + E * (k - I);
|
|
2581
2581
|
}
|
|
2582
|
-
Math.abs(
|
|
2582
|
+
Math.abs(u) < 0.05 && (P = 0);
|
|
2583
2583
|
} else {
|
|
2584
|
-
const E = (
|
|
2585
|
-
R = I + A * (k - I),
|
|
2584
|
+
const E = (u - w) / (M - w), A = Math.max(0, Math.min(1, E));
|
|
2585
|
+
R = I + A * (k - I), h.step && h.step > 0 && (R = Math.round(R / h.step) * h.step);
|
|
2586
2586
|
}
|
|
2587
2587
|
const _ = this.objectStates.get(c.id);
|
|
2588
2588
|
if (_) {
|
|
2589
|
-
const E =
|
|
2589
|
+
const E = h.isRelative !== !1, A = E ? ((p = c.transform) == null ? void 0 : p.x) ?? 0 : 0, W = E ? ((y = c.transform) == null ? void 0 : y.y) ?? 0 : 0, z = E ? ((b = c.transform) == null ? void 0 : b.rotation) ?? 0 : 0, Y = E ? ((m = c.transform) == null ? void 0 : m.scale_x) ?? 1 : 0, G = E ? ((v = c.transform) == null ? void 0 : v.scale_y) ?? 1 : 0, N = E ? ((S = c.style) == null ? void 0 : S.opacity) ?? 100 : 0, J = t * 60, x = (F, j) => {
|
|
2590
2590
|
let X = R;
|
|
2591
2591
|
if (T) {
|
|
2592
|
-
const tt = `_internal_${F}_${
|
|
2592
|
+
const tt = `_internal_${F}_${h.id}`;
|
|
2593
2593
|
let L = _[tt];
|
|
2594
|
-
L === void 0 && (L = _[F] ?? j), X = L + P * J, _[tt] = X,
|
|
2594
|
+
L === void 0 && (L = _[F] ?? j), X = L + P * J, _[tt] = X, h.step && h.step > 0 && (X = Math.round(X / h.step) * h.step);
|
|
2595
2595
|
} else
|
|
2596
2596
|
X = j + R;
|
|
2597
2597
|
_[F] = X;
|
|
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 = c.physics) != null && C.enabled && this.physicsEngine && (
|
|
2602
|
-
} else if (
|
|
2601
|
+
(C = c.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(c.id, (R - ((_ == null ? void 0 : _.x) || 0)) * 10, 0) : (h.targetProperty === "y" || h.targetProperty === "transform.y") && this.physicsEngine.applyForce(c.id, 0, (R - ((_ == null ? void 0 : _.y) || 0)) * 10));
|
|
2602
|
+
} else if (h.actionType === "playAnimation" || h.actionType === "stopAnimation" || h.actionType === "pauseAnimation") {
|
|
2603
2603
|
let w = !1;
|
|
2604
|
-
const M =
|
|
2605
|
-
|
|
2606
|
-
const I = e[`_prev_src_${
|
|
2604
|
+
const M = h.threshold ?? 0;
|
|
2605
|
+
h.condition === "always" ? w = !0 : h.condition === ">" ? w = u > M : h.condition === "<" ? w = u < M : h.condition === "==" && (w = Math.abs(u - M) < 0.01);
|
|
2606
|
+
const I = e[`_prev_src_${h.id}`] ?? u;
|
|
2607
2607
|
let k = !1;
|
|
2608
|
-
|
|
2608
|
+
h.condition === "always" ? k = !0 : h.condition === ">" ? k = I > M : h.condition === "<" ? k = I < M : h.condition === "==" && (k = Math.abs(I - M) < 0.01), e[`_prev_src_${h.id}`] = u, w && !k && h.targetAnimationId && (h.actionType === "playAnimation" || h.actionType);
|
|
2609
2609
|
}
|
|
2610
2610
|
}
|
|
2611
2611
|
});
|
|
@@ -2613,27 +2613,27 @@ class ci {
|
|
|
2613
2613
|
}), this._mouseDelta.dx = 0, this._mouseDelta.dy = 0);
|
|
2614
2614
|
}
|
|
2615
2615
|
applyBlendState(t, i) {
|
|
2616
|
-
var
|
|
2616
|
+
var l, f, h, u, c, 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);
|
|
2620
2620
|
const s = [];
|
|
2621
2621
|
let n = 0;
|
|
2622
2622
|
if (t.blendType === "1D") {
|
|
2623
|
-
const b = [...t.blendAnimations].sort((m,
|
|
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 = (l = this.artboard) == null ? void 0 : l.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;
|
|
2629
2629
|
for (; m < b.length - 1 && b[m + 1].position[0] < o; )
|
|
2630
2630
|
m++;
|
|
2631
2631
|
if (m === b.length - 1 && o > b[m].position[0]) {
|
|
2632
|
-
const
|
|
2633
|
-
|
|
2632
|
+
const v = (u = (h = this.artboard) == null ? void 0 : h.animations) == null ? void 0 : u.find((S) => S.id === b[m].animationId);
|
|
2633
|
+
v && (s.push({ anim: v, weight: 1 }), n = 1);
|
|
2634
2634
|
} else {
|
|
2635
|
-
const
|
|
2636
|
-
let I = (o -
|
|
2635
|
+
const v = b[m].position[0], S = b[m + 1].position[0], C = (d = (c = this.artboard) == null ? void 0 : c.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), M = Math.max(1e-3, S - v);
|
|
2636
|
+
let I = (o - v) / M;
|
|
2637
2637
|
I = Math.max(0, Math.min(1, I));
|
|
2638
2638
|
const k = 1 - I;
|
|
2639
2639
|
C && (s.push({ anim: C, weight: k }), n += k), w && (s.push({ anim: w, weight: I }), n += I);
|
|
@@ -2644,7 +2644,7 @@ class ci {
|
|
|
2644
2644
|
var w, M;
|
|
2645
2645
|
const m = (M = (w = this.artboard) == null ? void 0 : w.animations) == null ? void 0 : M.find((I) => I.id === b.animationId);
|
|
2646
2646
|
if (!m) return;
|
|
2647
|
-
const
|
|
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 {
|
|
@@ -2659,11 +2659,11 @@ class ci {
|
|
|
2659
2659
|
return m.length === 3 && (m = [m[0], m[0], m[1], m[1], m[2], m[2]].join("")), m = "0x" + m, { r: m >> 16 & 255, g: m >> 8 & 255, b: m & 255, a: 1 };
|
|
2660
2660
|
};
|
|
2661
2661
|
s.forEach(({ anim: b, weight: m }) => {
|
|
2662
|
-
b.tracks && b.tracks.forEach((
|
|
2662
|
+
b.tracks && b.tracks.forEach((v) => {
|
|
2663
2663
|
var R, P;
|
|
2664
|
-
const S =
|
|
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 I = this.interpolate(
|
|
2666
|
+
const I = this.interpolate(v.keyframes, i);
|
|
2667
2667
|
if (I === void 0) return;
|
|
2668
2668
|
let k = a.get(S);
|
|
2669
2669
|
k || (k = /* @__PURE__ */ new Map(), a.set(S, k));
|
|
@@ -2686,8 +2686,8 @@ class ci {
|
|
|
2686
2686
|
});
|
|
2687
2687
|
}), a.forEach((b, m) => {
|
|
2688
2688
|
var C;
|
|
2689
|
-
const
|
|
2690
|
-
!
|
|
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, M) => {
|
|
2691
2691
|
let I = 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");
|
|
@@ -2695,7 +2695,7 @@ class ci {
|
|
|
2695
2695
|
}
|
|
2696
2696
|
if (M.includes(".")) {
|
|
2697
2697
|
const k = (M || "").split(".");
|
|
2698
|
-
let T =
|
|
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) {
|
|
2701
2701
|
let P = S;
|
|
@@ -2711,13 +2711,13 @@ class ci {
|
|
|
2711
2711
|
}
|
|
2712
2712
|
T[k[k.length - 1]] = I, k[k.length - 1] === "color" && (k[k.length - 2] === "fill" || k[k.length - 2] === "stroke") && (T.type = "Solid");
|
|
2713
2713
|
} else
|
|
2714
|
-
M === "fill" ? (
|
|
2714
|
+
M === "fill" ? (v.style || (v.style = {}), v.style.fill = I) : M === "stroke" ? (v.style || (v.style = {}), v.style.stroke = I) : v[M] = I;
|
|
2715
2715
|
});
|
|
2716
2716
|
});
|
|
2717
2717
|
}
|
|
2718
2718
|
applyAnimation(t, i, o) {
|
|
2719
2719
|
!t || !t.tracks || t.tracks.forEach((e) => {
|
|
2720
|
-
var
|
|
2720
|
+
var h, u, c;
|
|
2721
2721
|
const s = e.object_id || e.objectId;
|
|
2722
2722
|
if (o) {
|
|
2723
2723
|
if (Array.isArray(o)) {
|
|
@@ -2725,40 +2725,40 @@ class ci {
|
|
|
2725
2725
|
} else if (s !== o)
|
|
2726
2726
|
return;
|
|
2727
2727
|
}
|
|
2728
|
-
const n = (
|
|
2728
|
+
const n = (h = this.artboard) == null ? void 0 : h.objects.find((d) => d.id === s), a = ((u = n == null ? void 0 : n.physics) == null ? void 0 : u.enabled) && n.physics.bodyType !== "Static";
|
|
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 l = this.objectStates.get(s);
|
|
2733
|
+
if (!l) {
|
|
2734
2734
|
this.frameCount % 600 === 0 && this.debugLog(`Skipping track: Object ${s} not found in state`);
|
|
2735
2735
|
return;
|
|
2736
2736
|
}
|
|
2737
2737
|
const f = this.interpolate(e.keyframes, i);
|
|
2738
2738
|
if (f !== void 0) {
|
|
2739
2739
|
if (this.frameCount % 240 === 0) {
|
|
2740
|
-
const d = (n == null ? void 0 : n.name) || s,
|
|
2741
|
-
this.debugLog(`[Anim] Applying ${r} = ${
|
|
2740
|
+
const d = (n == null ? void 0 : n.name) || s, p = typeof f == "object" ? JSON.stringify(f).slice(0, 50) : f;
|
|
2741
|
+
this.debugLog(`[Anim] Applying ${r} = ${p} to ${d}`);
|
|
2742
2742
|
}
|
|
2743
2743
|
if (r.includes(".")) {
|
|
2744
2744
|
const d = (r || "").split(".");
|
|
2745
|
-
let
|
|
2746
|
-
for (let
|
|
2747
|
-
if (typeof
|
|
2745
|
+
let p = l;
|
|
2746
|
+
for (let y = 0; y < d.length - 1; y++) {
|
|
2747
|
+
if (typeof p[d[y]] != "object" || p[d[y]] === null) {
|
|
2748
2748
|
let b = n;
|
|
2749
|
-
for (let m = 0; m <=
|
|
2749
|
+
for (let m = 0; m <= y; m++)
|
|
2750
2750
|
b = b ? b[d[m]] : null;
|
|
2751
|
-
if (d[
|
|
2752
|
-
const m = typeof
|
|
2753
|
-
|
|
2751
|
+
if (d[y] === "corner_radius" || d[y] === "cornerRadius") {
|
|
2752
|
+
const m = typeof p[d[y]] == "number" ? p[d[y]] : typeof b == "number" ? b : 0;
|
|
2753
|
+
p[d[y]] = { tl: m, tr: m, bl: m, br: m };
|
|
2754
2754
|
} else
|
|
2755
|
-
|
|
2755
|
+
p[d[y]] = b ? JSON.parse(JSON.stringify(b)) : {};
|
|
2756
2756
|
}
|
|
2757
|
-
|
|
2757
|
+
p = p[d[y]];
|
|
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" ? (
|
|
2761
|
+
r === "fill" ? (l.style || (l.style = {}), l.style.fill = f) : r === "stroke" ? (l.style || (l.style = {}), l.style.stroke = f) : l[r] = f;
|
|
2762
2762
|
if (this.physicsEngine && ((c = n == null ? void 0 : n.physics) != null && c.enabled) && n.physics.bodyType === "Static")
|
|
2763
2763
|
if (r === "x") {
|
|
2764
2764
|
const d = this.physicsEngine.getPosition(s);
|
|
@@ -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 l = e.value[r];
|
|
2794
|
+
return typeof a == "number" && typeof l == "number" ? a + (l - a) * n : n < 0.5 ? a : l;
|
|
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,18 +2799,18 @@ 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
|
|
2802
|
+
return (/* @__PURE__ */ new Set([...Object.keys(o.value), ...Object.keys(e.value)])).forEach((l) => {
|
|
2803
|
+
const f = o.value[l], h = e.value[l];
|
|
2804
|
+
typeof f == "number" && typeof h == "number" ? a[l] = f + (h - f) * n : f === void 0 ? a[l] = h : h === void 0 ? a[l] = f : a[l] = 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;
|
|
2808
2808
|
}
|
|
2809
2809
|
interpolateColor(t, i, o) {
|
|
2810
|
-
var d,
|
|
2811
|
-
const e = ((
|
|
2812
|
-
if (!
|
|
2813
|
-
const b =
|
|
2810
|
+
var d, p;
|
|
2811
|
+
const e = ((p = (d = this.artboard) == null ? void 0 : d.tokens) == null ? void 0 : p.colors) || {}, s = e[t] || t, n = e[i] || i, a = (y) => {
|
|
2812
|
+
if (!y) return { r: 0, g: 0, b: 0 };
|
|
2813
|
+
const b = y.startsWith("#") ? y.replace("#", "") : "000000";
|
|
2814
2814
|
return b.length === 3 ? {
|
|
2815
2815
|
r: parseInt(b[0] + b[0], 16),
|
|
2816
2816
|
g: parseInt(b[1] + b[1], 16),
|
|
@@ -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),
|
|
2824
|
-
const b = Math.max(0, Math.min(255,
|
|
2823
|
+
}, r = a(s), l = a(n), f = Math.round(r.r + (l.r - r.r) * o), h = Math.round(r.g + (l.g - r.g) * o), u = Math.round(r.b + (l.b - r.b) * o), c = (y) => {
|
|
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 `#${c(f)}${c(
|
|
2827
|
+
return `#${c(f)}${c(h)}${c(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) => {
|
|
@@ -2856,8 +2856,8 @@ class ci {
|
|
|
2856
2856
|
return e.width = (t.width ?? 0) + ((i.width ?? 0) - (t.width ?? 0)) * o, e.opacity = (t.opacity ?? 1) + ((i.opacity ?? 1) - (t.opacity ?? 1)) * o, t.fill && i.fill ? e.fill = this.interpolateFill(t.fill, i.fill, o) : t.color && i.color && t.color.startsWith("#") && i.color.startsWith("#") && (e.color = this.interpolateColor(t.color, i.color, o)), e.trimStart = (t.trimStart ?? 0) + ((i.trimStart ?? 0) - (t.trimStart ?? 0)) * o, e.trimEnd = (t.trimEnd ?? 1) + ((i.trimEnd ?? 1) - (t.trimEnd ?? 1)) * o, e.trimOffset = (t.trimOffset ?? 0) + ((i.trimOffset ?? 0) - (t.trimOffset ?? 0)) * o, e.dashOffset = (t.dashOffset ?? 0) + ((i.dashOffset ?? 0) - (t.dashOffset ?? 0)) * o, e;
|
|
2857
2857
|
}
|
|
2858
2858
|
render(t, i, o) {
|
|
2859
|
-
var
|
|
2860
|
-
this.debug_objectsTotal = ((
|
|
2859
|
+
var h;
|
|
2860
|
+
this.debug_objectsTotal = ((h = this.artboard) == null ? void 0 : h.objects.length) || 0, this.debug_objectsRendered = 0;
|
|
2861
2861
|
const e = performance.now();
|
|
2862
2862
|
if (this.canvasWidth = i, this.canvasHeight = o, !this.artboard)
|
|
2863
2863
|
return;
|
|
@@ -2871,64 +2871,64 @@ class ci {
|
|
|
2871
2871
|
this.layout.alignment
|
|
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
|
-
const
|
|
2875
|
-
let c = this.imageCache.get(
|
|
2876
|
-
if (c || (c = new Image(), c.src =
|
|
2874
|
+
const u = this.artboard.backgroundImage;
|
|
2875
|
+
let c = this.imageCache.get(u);
|
|
2876
|
+
if (c || (c = new Image(), c.src = u, this.imageCache.set(u, c)), c.complete && c.naturalWidth > 0) {
|
|
2877
2877
|
t.save(), t.globalAlpha = this.normalizeOpacity(this.artboard.backgroundOpacity ?? 100);
|
|
2878
|
-
const d = c.naturalWidth / c.naturalHeight,
|
|
2879
|
-
let
|
|
2880
|
-
|
|
2878
|
+
const d = c.naturalWidth / c.naturalHeight, p = s / n;
|
|
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(c, 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((
|
|
2886
|
-
const d = this.objectStates.get(
|
|
2887
|
-
return { obj:
|
|
2888
|
-
}).sort((
|
|
2889
|
-
this.renderObject(t,
|
|
2890
|
-
}), this._emitterPools.forEach((
|
|
2891
|
-
if (!(
|
|
2892
|
-
for (const
|
|
2893
|
-
t.save(), t.globalAlpha =
|
|
2884
|
+
const l = /* @__PURE__ */ new Map();
|
|
2885
|
+
this.artboard.objects.forEach((u) => l.set(u.id, u)), this.artboard.objects.filter((u) => !u.parentId).map((u, c) => {
|
|
2886
|
+
const d = this.objectStates.get(u.id), p = (d == null ? void 0 : d.zIndex) ?? c;
|
|
2887
|
+
return { obj: u, zIndex: p };
|
|
2888
|
+
}).sort((u, c) => u.zIndex - c.zIndex).forEach(({ obj: u }) => {
|
|
2889
|
+
this.renderObject(t, u, l);
|
|
2890
|
+
}), this._emitterPools.forEach((u, c) => {
|
|
2891
|
+
if (!(u.length === 0 || !l.get(c)))
|
|
2892
|
+
for (const p of u)
|
|
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 +
|
|
2897
|
+
const a = t.getTransform(), r = i * a.a + o * a.c + a.e, l = 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, c = (s / 2 + n) * h;
|
|
2898
|
+
return r + u >= 0 && r - u <= this.canvasWidth && l + c >= 0 && l - c <= this.canvasHeight;
|
|
2899
2899
|
}
|
|
2900
2900
|
calculateTransform(t, i, o, e, s, n) {
|
|
2901
|
-
let a = 1, r = 1,
|
|
2902
|
-
const f = o / e,
|
|
2901
|
+
let a = 1, r = 1, l = 1;
|
|
2902
|
+
const f = o / e, h = t / i;
|
|
2903
2903
|
switch (s) {
|
|
2904
2904
|
case "Contain":
|
|
2905
|
-
|
|
2905
|
+
h > f ? l = i / e : l = t / o, a = r = l;
|
|
2906
2906
|
break;
|
|
2907
2907
|
case "Cover":
|
|
2908
|
-
|
|
2908
|
+
h > f ? l = t / o : l = i / e, a = r = l;
|
|
2909
2909
|
break;
|
|
2910
2910
|
case "Fill":
|
|
2911
2911
|
a = t / o, r = i / e;
|
|
2912
2912
|
break;
|
|
2913
2913
|
case "FitWidth":
|
|
2914
|
-
|
|
2914
|
+
l = t / o, a = r = l;
|
|
2915
2915
|
break;
|
|
2916
2916
|
case "FitHeight":
|
|
2917
|
-
|
|
2917
|
+
l = i / e, a = r = l;
|
|
2918
2918
|
break;
|
|
2919
2919
|
case "None":
|
|
2920
2920
|
a = r = 1;
|
|
2921
2921
|
break;
|
|
2922
2922
|
case "ScaleDown":
|
|
2923
|
-
|
|
2923
|
+
l = Math.min(t / o, i / e), l > 1 && (l = 1), a = r = l;
|
|
2924
2924
|
break;
|
|
2925
2925
|
default:
|
|
2926
2926
|
a = r = 1;
|
|
2927
2927
|
break;
|
|
2928
2928
|
}
|
|
2929
|
-
const
|
|
2930
|
-
let d = 0,
|
|
2931
|
-
return n.includes("Left") ? d = 0 : n.includes("Right") ? d = t -
|
|
2929
|
+
const u = o * a, c = e * r;
|
|
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 - c : p = (i - c) / 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
|
|
2953
|
+
var p, y, b, m, v, S, C, w, M, I, 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);
|
|
@@ -2958,45 +2958,45 @@ class ci {
|
|
|
2958
2958
|
}
|
|
2959
2959
|
this.frameCount % 60, t.roundRect || (t.roundRect = (X, tt, L, O, D) => (this.drawRoundRect(t, X, tt, L, O, D), t));
|
|
2960
2960
|
const s = e.geometry ? this.deepMerge(i.geometry, e.geometry) : i.geometry;
|
|
2961
|
-
let n = e.style ? this.deepMerge(i.style, e.style) : i.style, a = (s == null ? void 0 : s.width) || ((
|
|
2961
|
+
let n = e.style ? this.deepMerge(i.style, e.style) : i.style, a = (s == null ? void 0 : s.width) || ((p = i.geometry) == null ? void 0 : p.width) || i.width || 0, r = (s == null ? void 0 : s.height) || ((y = i.geometry) == null ? void 0 : y.height) || i.height || 0;
|
|
2962
2962
|
if ((a === 0 || r === 0) && (s != null && s.points) && Array.isArray(s.points) && s.points.length > 0) {
|
|
2963
2963
|
let X = 1 / 0, tt = -1 / 0, L = 1 / 0, O = -1 / 0;
|
|
2964
2964
|
s.points.forEach((D) => {
|
|
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 l = (X) => {
|
|
2969
2969
|
if (X)
|
|
2970
2970
|
return X.corner_radius ?? X.cornerRadius;
|
|
2971
|
-
}, f =
|
|
2972
|
-
let
|
|
2973
|
-
if (delete
|
|
2971
|
+
}, f = l(e) ?? l(n) ?? l(s) ?? l(i.style) ?? l(i.geometry) ?? 0;
|
|
2972
|
+
let h = { ...s, width: a, height: r };
|
|
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);
|
|
2975
2975
|
if (X) {
|
|
2976
2976
|
const tt = li(
|
|
2977
|
-
|
|
2977
|
+
h.points,
|
|
2978
2978
|
i.weights,
|
|
2979
2979
|
i.bindMatrices,
|
|
2980
2980
|
X,
|
|
2981
2981
|
(L) => this.getGlobalTransform(L)
|
|
2982
2982
|
);
|
|
2983
|
-
|
|
2983
|
+
h = { ...h, points: tt };
|
|
2984
2984
|
}
|
|
2985
2985
|
}
|
|
2986
2986
|
if (e.visible === !1)
|
|
2987
2987
|
return;
|
|
2988
|
-
const
|
|
2988
|
+
const u = i.repeaterConfig, c = u && u.isEnabled && u.count > 1, d = c ? u.count : 1;
|
|
2989
2989
|
for (let X = 0; X < d; X++) {
|
|
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 : ((
|
|
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
2991
|
if (c && X > 0) {
|
|
2992
|
-
if (
|
|
2993
|
-
const ht =
|
|
2992
|
+
if (u.type === "Linear") {
|
|
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);
|
|
2995
|
-
} else if (
|
|
2996
|
-
const ht =
|
|
2995
|
+
} else if (u.type === "Grid") {
|
|
2996
|
+
const ht = u.cols || Math.ceil(Math.sqrt(u.count)), ut = u.gapX || 0, at = u.gapY || 0, B = Math.floor(X / ht), et = X % ht, Q = a + ut, Pt = r + at;
|
|
2997
2997
|
tt += et * Q, L += B * Pt;
|
|
2998
|
-
} else if (
|
|
2999
|
-
const ht =
|
|
2998
|
+
} else if (u.type === "Radial") {
|
|
2999
|
+
const ht = u.radius || 100, ut = u.startAngle || 0, B = (u.endAngle || 360) - ut, et = u.count > 1 ? B / (B === 360 ? u.count : u.count - 1) : 0, Q = ut + X * et, Pt = Q * Math.PI / 180;
|
|
3000
3000
|
tt = e.x + ht * Math.cos(Pt), L = e.y + ht * Math.sin(Pt), O += Q;
|
|
3001
3001
|
}
|
|
3002
3002
|
}
|
|
@@ -3172,7 +3172,7 @@ class ci {
|
|
|
3172
3172
|
t.rect(-a / 2, ut, a, r * ht), t.clip(), t.fillStyle = jt.color || "#3b82f6", t.globalAlpha = t.globalAlpha * (jt.opacity ?? 1);
|
|
3173
3173
|
}
|
|
3174
3174
|
if ((s == null ? void 0 : s.type) === "Text")
|
|
3175
|
-
this._renderText(t, i,
|
|
3175
|
+
this._renderText(t, i, h, n, e, a, r, !1, !1, D, q);
|
|
3176
3176
|
else if ((s == null ? void 0 : s.type) === "Image") {
|
|
3177
3177
|
const ht = s.originalSrc || s.src;
|
|
3178
3178
|
if (ht) {
|
|
@@ -3183,12 +3183,12 @@ class ci {
|
|
|
3183
3183
|
console.error("[ExodeUI] Image load failed:", et, `Src preview: ${ht.substring(0, 100)}...`);
|
|
3184
3184
|
}, ut.src = ht, this.imageCache.set(ht, ut));
|
|
3185
3185
|
const at = n.stroke && n.stroke.width > 0 && n.stroke.isEnabled !== !1, B = (((J = n.stroke) == null ? void 0 : J.alignment) || "center").toLowerCase();
|
|
3186
|
-
if (at && (B === "outside" || B === "center") && this.applyStrokeAlignment(t, n,
|
|
3186
|
+
if (at && (B === "outside" || B === "center") && this.applyStrokeAlignment(t, n, h, a, r, f, D, q), n.fill && n.fill.type !== "None") {
|
|
3187
3187
|
t.save();
|
|
3188
3188
|
const et = t.globalAlpha, Q = this.createCanvasFill(t, n.fill, a, r);
|
|
3189
3189
|
t.fillStyle = Q || n.fill.color || "transparent", t.globalAlpha = et * this.normalizeOpacity(n.fill.opacity ?? 100), f !== 0 ? (this.drawRoundRect(t, -a / 2, -r / 2, a, r, f), t.fill()) : t.fillRect(-a / 2, -r / 2, a, r), t.globalAlpha = et, t.restore();
|
|
3190
3190
|
}
|
|
3191
|
-
ut.complete && ut.naturalWidth > 0 ? (f !== 0 ? (t.save(), this.drawRoundRect(t, -a / 2, -r / 2, a, r, f), t.clip(), t.drawImage(ut, -a / 2, -r / 2, a, r), t.restore()) : t.drawImage(ut, -a / 2, -r / 2, a, r), at && B === "inside" && this.applyStrokeAlignment(t, n,
|
|
3191
|
+
ut.complete && ut.naturalWidth > 0 ? (f !== 0 ? (t.save(), this.drawRoundRect(t, -a / 2, -r / 2, a, r, f), t.clip(), t.drawImage(ut, -a / 2, -r / 2, a, r), t.restore()) : t.drawImage(ut, -a / 2, -r / 2, a, r), at && B === "inside" && this.applyStrokeAlignment(t, n, h, a, r, f, D, q)) : at && B === "inside" && this.applyStrokeAlignment(t, n, h, a, r, f, D, q);
|
|
3192
3192
|
}
|
|
3193
3193
|
} else if (s.type === "SVG") {
|
|
3194
3194
|
const ht = s.svgContent;
|
|
@@ -3353,28 +3353,28 @@ class ci {
|
|
|
3353
3353
|
} else f !== 0 ? (t.save(), this.drawRoundRect(t, -$ / 2, -Wt / 2, $, Wt, f), t.clip(), t.drawImage(Mt, -$ / 2, -Wt / 2, $, Wt), t.restore()) : t.drawImage(Mt, -$ / 2, -Wt / 2, $, Wt);
|
|
3354
3354
|
}
|
|
3355
3355
|
}
|
|
3356
|
-
} else if (
|
|
3357
|
-
this.renderLineGraph(t,
|
|
3356
|
+
} else if (h.type === "LineGraph")
|
|
3357
|
+
this.renderLineGraph(t, h, a, r);
|
|
3358
3358
|
else if (i.type === "Shape") {
|
|
3359
|
-
if (this.applyPath(t,
|
|
3360
|
-
this.applyBackgroundBlurGlass(t,
|
|
3359
|
+
if (this.applyPath(t, h, a, r, f), t.save(), n.blur && n.blur.amount > 0 && (t.filter = `blur(${n.blur.amount}px)`), Yt && ie === "BackgroundBlur")
|
|
3360
|
+
this.applyBackgroundBlurGlass(t, h, a, r, f, vt);
|
|
3361
3361
|
else if (n.fill) {
|
|
3362
3362
|
const ut = t.globalAlpha;
|
|
3363
3363
|
if (((F = n.fill) == null ? void 0 : F.type) === "Image" && (n.fill.originalSrc || n.fill.src)) {
|
|
3364
3364
|
const at = n.fill.originalSrc || n.fill.src;
|
|
3365
3365
|
let B = this.imageCache.get(at);
|
|
3366
|
-
B || (B = new Image(), B.src = at, this.imageCache.set(at, B)), B.complete && B.naturalWidth > 0 && (t.save(), this.applyPath(t,
|
|
3366
|
+
B || (B = new Image(), B.src = at, this.imageCache.set(at, B)), B.complete && B.naturalWidth > 0 && (t.save(), this.applyPath(t, h, a, r, f), t.clip(), this.renderFittedImage(t, B, -a / 2, -r / 2, a, r, n.fill.fillMode), t.restore());
|
|
3367
3367
|
} else {
|
|
3368
3368
|
const at = this.createCanvasFill(t, n.fill, a, r);
|
|
3369
|
-
t.fillStyle = at || (typeof n.fill == "string" ? n.fill : n.fill.color || "transparent"), t.globalAlpha = ut * this.normalizeOpacity(n.fill.opacity ?? 100), this.applyPath(t,
|
|
3369
|
+
t.fillStyle = at || (typeof n.fill == "string" ? n.fill : n.fill.color || "transparent"), t.globalAlpha = ut * this.normalizeOpacity(n.fill.opacity ?? 100), this.applyPath(t, h, a, r, f), t.fill();
|
|
3370
3370
|
}
|
|
3371
3371
|
t.globalAlpha = ut;
|
|
3372
3372
|
}
|
|
3373
|
-
t.restore(), n.stroke && n.stroke.width > 0 && (this.applyPath(t,
|
|
3373
|
+
t.restore(), n.stroke && n.stroke.width > 0 && (this.applyPath(t, h, a, r, f), this.applyStrokeAlignment(t, n, h, a, r, f, D, q));
|
|
3374
3374
|
} else if (i.type === "Frame" || i.type === "Group" && !i.isStructuralGroup) {
|
|
3375
3375
|
const ht = e.width ?? s.width ?? i.width ?? a, ut = e.height ?? s.height ?? i.height ?? r, at = f;
|
|
3376
3376
|
if (t.save(), t.beginPath(), this.drawRoundRect(t, -ht / 2, -ut / 2, ht, ut, at), Yt && ie === "BackgroundBlur")
|
|
3377
|
-
this.applyBackgroundBlurGlass(t,
|
|
3377
|
+
this.applyBackgroundBlurGlass(t, h, ht, ut, at, vt);
|
|
3378
3378
|
else if (n.fill && n.fill.type !== "None") {
|
|
3379
3379
|
const et = t.globalAlpha, Q = this.createCanvasFill(t, n.fill, ht, ut);
|
|
3380
3380
|
t.fillStyle = Q || n.fill.color || "transparent", t.globalAlpha = et * this.normalizeOpacity(n.fill.opacity ?? 100), t.beginPath(), this.drawRoundRect(t, -ht / 2, -ut / 2, ht, ut, at), t.fill(), t.globalAlpha = et;
|
|
@@ -3384,7 +3384,7 @@ class ci {
|
|
|
3384
3384
|
t.beginPath(), this.drawRoundRect(t, -ht / 2, -ut / 2, ht, ut, at), this.applyStrokeAlignment(t, n, et, ht, ut, at, D, q);
|
|
3385
3385
|
}
|
|
3386
3386
|
} else i.type === "Group" && i.isStructuralGroup || (i.type === "Component" && i.variant === "inputbox" ? this.renderInputBox(t, i) : i.type === "Component" && i.variant === "button" ? this.renderButton(t, i) : i.type === "Component" && i.variant === "toggle_button" ? this.renderToggleButton(t, i) : i.type === "Toggle" || i.type === "Component" && i.variant === "toggle" ? this.renderToggle(t, i) : i.type === "Slider" || i.type === "Component" && i.variant === "slider" ? this.renderSlider(t, i) : i.type === "Dropdown" || i.type === "Component" && i.variant === "dropdown" ? this.renderDropdown(t, i) : i.type === "ListView" || i.type === "Component" && i.variant === "listview" ? this.renderListView(t, i) : i.type === "Checkbox" || i.type === "Component" && i.variant === "checkbox" ? this.renderCheckbox(t, i) : i.type === "RadioGroup" || i.type === "Component" && i.variant === "radiogroup" ? this.renderRadioGroup(t, i) : i.type === "BarChart" || i.type === "Component" && i.variant === "barchart" ? this.renderBarChart(t, i) : i.type === "PieChart" || i.type === "Component" && i.variant === "piechart" ? this.renderPieChart(t, i) : i.type === "Joystick" || i.type === "Component" && i.variant === "joystick" ? this.renderJoystick(t, i) : this.frameCount % 300 === 0 && this.warn("[Engine] Unhandled object type in renderObject:", i.type, "Geo:", (j = i.geometry) == null ? void 0 : j.type));
|
|
3387
|
-
if (this.applyArtEffectOverlay(t, i,
|
|
3387
|
+
if (this.applyArtEffectOverlay(t, i, h, a, r, f), jt && jt.enabled && t.restore(), i.children && i.children.length > 0) {
|
|
3388
3388
|
const ut = i.type === "Frame", at = i.clipsContent !== void 0 ? i.clipsContent : i.clipContent !== void 0 ? i.clipContent : ut;
|
|
3389
3389
|
if (t.save(), at) {
|
|
3390
3390
|
t.beginPath();
|
|
@@ -3491,12 +3491,12 @@ 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, l = !1, f = 1, h = 1) {
|
|
3495
3495
|
var yt, bt, gt, Et, It, vt, Yt, ie, fe;
|
|
3496
|
-
let
|
|
3496
|
+
let u = o.text || "";
|
|
3497
3497
|
if (o.textInputId && !r) {
|
|
3498
3498
|
const st = this.inputs.get(o.textInputId);
|
|
3499
|
-
st !== void 0 && (
|
|
3499
|
+
st !== void 0 && (u = String(st), s.geometry && s.geometry.type === "Text" && (s.geometry.text = u));
|
|
3500
3500
|
}
|
|
3501
3501
|
if (o.svgPath) {
|
|
3502
3502
|
const st = o.svgPath;
|
|
@@ -3507,20 +3507,20 @@ class ci {
|
|
|
3507
3507
|
t.fill(_t), t.restore();
|
|
3508
3508
|
return;
|
|
3509
3509
|
}
|
|
3510
|
-
let c =
|
|
3510
|
+
let c = u || "";
|
|
3511
3511
|
o.enableSegments === !0 && o.segments && Array.isArray(o.segments) && (c = o.segments.map((st) => st && st.text ? st.text : "").join(""));
|
|
3512
3512
|
const d = o.textCase || "none";
|
|
3513
3513
|
d === "uppercase" ? c = c.toUpperCase() : d === "lowercase" ? c = c.toLowerCase() : d === "capitalize" && (c = c.replace(/\b\w/g, (st) => st.toUpperCase()));
|
|
3514
|
-
let
|
|
3515
|
-
|
|
3516
|
-
const b = this.mapFontWeight(
|
|
3517
|
-
let
|
|
3514
|
+
let p = ((Et = o.fontWeight) == null ? void 0 : Et.toString()) || "400", y = o.fontStyle || "normal";
|
|
3515
|
+
p.toLowerCase().includes("italic") && (y = "italic", p = p.replace(/italic/gi, "").trim() || "400");
|
|
3516
|
+
const b = this.mapFontWeight(p), m = Math.max(1, o.fontSize || 32);
|
|
3517
|
+
let v = o.fontFamily || "Inter";
|
|
3518
3518
|
const S = ["Bold", "SemiBold", "Medium", "Regular", "Light", "Thin", "ExtraBold", "Black", "Italic"];
|
|
3519
3519
|
S.forEach((st) => {
|
|
3520
3520
|
const mt = new RegExp(`[\\s-]${st}$`, "i");
|
|
3521
|
-
mt.test(
|
|
3521
|
+
mt.test(v) && (v = v.replace(mt, "").trim());
|
|
3522
3522
|
});
|
|
3523
|
-
const M = `${o.smallCaps === !0 ? "small-caps " : ""}${
|
|
3523
|
+
const M = `${o.smallCaps === !0 ? "small-caps " : ""}${y} ${b} ${m}px "${v}", sans-serif`;
|
|
3524
3524
|
t.font = M;
|
|
3525
3525
|
const I = o.textVerticalAlign || "top";
|
|
3526
3526
|
t.textBaseline = "top";
|
|
@@ -3543,10 +3543,10 @@ class ci {
|
|
|
3543
3543
|
o.autoHeight;
|
|
3544
3544
|
const G = ps({
|
|
3545
3545
|
text: c,
|
|
3546
|
-
fontFamily:
|
|
3546
|
+
fontFamily: v,
|
|
3547
3547
|
fontSize: m,
|
|
3548
3548
|
fontWeight: b,
|
|
3549
|
-
fontStyle:
|
|
3549
|
+
fontStyle: y,
|
|
3550
3550
|
lineHeight: E,
|
|
3551
3551
|
width: Y,
|
|
3552
3552
|
letterSpacing: T,
|
|
@@ -3558,7 +3558,7 @@ class ci {
|
|
|
3558
3558
|
hyphenation: o.hyphenation,
|
|
3559
3559
|
composer: o.composer,
|
|
3560
3560
|
balanceRaggedLines: o.balanceRaggedLines
|
|
3561
|
-
}), N = G.lines || [], J = G.maxFontSize || m, x = this.fontLeadingFactors[
|
|
3561
|
+
}), N = G.lines || [], J = G.maxFontSize || m, x = this.fontLeadingFactors[v] ?? 0.5, F = (A - m) * x;
|
|
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;
|
|
@@ -3599,7 +3599,7 @@ class ci {
|
|
|
3599
3599
|
if (Vt) {
|
|
3600
3600
|
t.save();
|
|
3601
3601
|
let ne = Vt.fontFamily || o.fontFamily || "Inter";
|
|
3602
|
-
const me = this.mapFontWeight((Vt.fontWeight || o.fontWeight || "400").toString()), ye = Vt.fontStyle ||
|
|
3602
|
+
const me = this.mapFontWeight((Vt.fontWeight || o.fontWeight || "400").toString()), ye = Vt.fontStyle || y, Ut = Vt.fontSize || m;
|
|
3603
3603
|
t.font = `${ye} ${me} ${Ut}px "${ne}", sans-serif`, $t = t.measureText(st[Ft]).width, t.restore();
|
|
3604
3604
|
} else
|
|
3605
3605
|
$t = t.measureText(st[Ft]).width;
|
|
@@ -3611,7 +3611,7 @@ class ci {
|
|
|
3611
3611
|
}, ot = (st, mt, Lt, _t, dt) => {
|
|
3612
3612
|
var me, ye;
|
|
3613
3613
|
const Dt = (dt === 0 || c[dt - 1] === `
|
|
3614
|
-
` || c[dt - 1] === "\r") && o.paragraphIndent ? o.paragraphIndent : 0, $t = (!r ||
|
|
3614
|
+
` || c[dt - 1] === "\r") && o.paragraphIndent ? o.paragraphIndent : 0, $t = (!r || l) && (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)
|
|
@@ -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 && !l ? [] : ((me = i.behaviors) == null ? void 0 : me.filter(
|
|
3641
3641
|
(ut) => [
|
|
3642
3642
|
U.Typewriter,
|
|
3643
3643
|
U.Scramble,
|
|
@@ -3786,7 +3786,7 @@ class ci {
|
|
|
3786
3786
|
const nt = new RegExp(`[\\s-]${it}$`, "i");
|
|
3787
3787
|
nt.test(Ct) && (Ct = Ct.replace(nt, "").trim());
|
|
3788
3788
|
});
|
|
3789
|
-
const rt = this.mapFontWeight((ct.fontWeight || o.fontWeight || "400").toString()), V = ct.fontStyle ||
|
|
3789
|
+
const rt = this.mapFontWeight((ct.fontWeight || o.fontWeight || "400").toString()), V = ct.fontStyle || y;
|
|
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
|
|
@@ -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 && !l) {
|
|
3803
3803
|
const pt = this.createCanvasFill(t, $, X, tt);
|
|
3804
3804
|
t.fillStyle = pt || $.color || "#000000";
|
|
3805
|
-
} else if (!r && !
|
|
3805
|
+
} else if (!r && !l) {
|
|
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 || l) {
|
|
3811
|
+
const pt = l ? "#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;
|
|
@@ -3823,7 +3823,7 @@ class ci {
|
|
|
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 (l) {
|
|
3827
3827
|
let st = 0, mt = L;
|
|
3828
3828
|
(N || []).forEach((Lt) => {
|
|
3829
3829
|
const _t = Lt.text || "";
|
|
@@ -3882,7 +3882,7 @@ class ci {
|
|
|
3882
3882
|
const Dt = t.getTransform(), $t = Math.sqrt(Dt.a * Dt.a + Dt.b * Dt.b) || 1, Ot = this.rootTransform, Vt = Math.sqrt(Ot.a * Ot.a + Ot.b * Ot.b) || 1;
|
|
3883
3883
|
_t = $t / Vt;
|
|
3884
3884
|
} else
|
|
3885
|
-
_t = (Math.abs(f) + Math.abs(
|
|
3885
|
+
_t = (Math.abs(f) + Math.abs(h)) / 2 || 1;
|
|
3886
3886
|
t.lineWidth = (e.stroke.width || 1) / (_t || 1), t.globalAlpha = mt * this.normalizeOpacity(e.stroke.opacity ?? 100);
|
|
3887
3887
|
let dt = 0, Ft = L;
|
|
3888
3888
|
(N || []).forEach((Dt) => {
|
|
@@ -3896,26 +3896,26 @@ 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 l = i.stroke;
|
|
3900
3900
|
let f = 1;
|
|
3901
3901
|
if (this.rootTransform) {
|
|
3902
3902
|
const S = t.getTransform(), C = Math.sqrt(S.a * S.a + S.b * S.b) || 1, w = this.rootTransform, M = Math.sqrt(w.a * w.a + w.b * w.b) || 1;
|
|
3903
3903
|
f = C / M;
|
|
3904
3904
|
} else
|
|
3905
3905
|
f = (Math.abs(a) + Math.abs(r)) / 2 || 1;
|
|
3906
|
-
const
|
|
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 = (l.width || 1) / (f || 1), u = (l.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), l.fill) {
|
|
3908
|
+
const S = this.createCanvasFill(t, l.fill, e, s);
|
|
3909
|
+
S ? t.strokeStyle = S : t.strokeStyle = l.color || "#000000";
|
|
3910
3910
|
} else
|
|
3911
|
-
t.strokeStyle =
|
|
3911
|
+
t.strokeStyle = l.color || "#000000";
|
|
3912
3912
|
const d = t.globalAlpha;
|
|
3913
|
-
t.globalAlpha = d * this.normalizeOpacity(
|
|
3914
|
-
const
|
|
3915
|
-
if (
|
|
3913
|
+
t.globalAlpha = d * this.normalizeOpacity(l.opacity ?? 100), t.lineWidth = h, t.lineCap = l.lineCap || "round", t.lineJoin = l.lineJoin || "round", l.miterLimit !== void 0 && (t.miterLimit = l.miterLimit);
|
|
3914
|
+
const p = l.trimStart ?? 0, y = l.trimEnd ?? 1, b = l.trimOffset ?? 0, m = l.dashOffset ?? 0, v = l.dashArray || [];
|
|
3915
|
+
if (p !== 0 || y !== 1 || b !== 0) {
|
|
3916
3916
|
const S = this.getPerimeter(o, e, s);
|
|
3917
3917
|
if (S > 0) {
|
|
3918
|
-
const C = Math.max(0, Math.min(1,
|
|
3918
|
+
const C = Math.max(0, Math.min(1, p)), w = Math.max(0, Math.min(1, y));
|
|
3919
3919
|
if (C < w) {
|
|
3920
3920
|
const M = S * (w - C), I = S - M, k = -(S * (C + b % 1));
|
|
3921
3921
|
t.setLineDash([M, I]), t.lineDashOffset = k + m * S;
|
|
@@ -3926,8 +3926,18 @@ class ci {
|
|
|
3926
3926
|
t.setLineDash([M, I]), t.lineDashOffset = k + m * S;
|
|
3927
3927
|
}
|
|
3928
3928
|
}
|
|
3929
|
-
} else
|
|
3930
|
-
(o == null ? void 0 : o.type) === "Line" || e === 0 || s === 0
|
|
3929
|
+
} else v.length > 0 && (t.setLineDash(v), t.lineDashOffset = m);
|
|
3930
|
+
if ((o == null ? void 0 : o.type) === "Line" || e === 0 || s === 0)
|
|
3931
|
+
this.applyPath(t, o, e, s, n), t.stroke();
|
|
3932
|
+
else if (u === "inside")
|
|
3933
|
+
t.lineWidth = h * 2, t.save(), this.applyPath(t, o, e, s, n), t.clip(), t.stroke(), t.restore();
|
|
3934
|
+
else if (u === "outside") {
|
|
3935
|
+
t.save(), t.beginPath();
|
|
3936
|
+
const S = Math.max(e, s, 2e4);
|
|
3937
|
+
t.rect(-S, -S, S * 2, S * 2), this.applyPath(t, o, e, s, n), t.clip("evenodd"), t.lineWidth = h * 2, t.beginPath(), this.applyPath(t, o, e, s, n), t.stroke(), t.restore();
|
|
3938
|
+
} else
|
|
3939
|
+
t.lineWidth = h, this.applyPath(t, o, e, s, n), t.stroke();
|
|
3940
|
+
t.restore();
|
|
3931
3941
|
}
|
|
3932
3942
|
getPerimeter(t, i, o) {
|
|
3933
3943
|
switch (this.ensurePathPoints(t), t == null ? void 0 : t.type) {
|
|
@@ -3936,12 +3946,12 @@ class ci {
|
|
|
3936
3946
|
case "Ellipse": {
|
|
3937
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)));
|
|
3938
3948
|
if (n >= 360 && a <= 0) return r;
|
|
3939
|
-
let
|
|
3949
|
+
let l = n / 360 * r;
|
|
3940
3950
|
if (a > 0) {
|
|
3941
3951
|
const f = Math.PI * (3 * (e * a + s * a) - Math.sqrt((3 * e * a + s * a) * (e * a + 3 * s * a)));
|
|
3942
|
-
|
|
3943
|
-
} else n < 360 && (
|
|
3944
|
-
return isNaN(
|
|
3952
|
+
l += n / 360 * f, n < 360 && (l += 2 * Math.sqrt((e - e * a) ** 2 + (s - s * a) ** 2));
|
|
3953
|
+
} else n < 360 && (l += 2 * Math.max(e, s));
|
|
3954
|
+
return isNaN(l) ? 0 : l;
|
|
3945
3955
|
}
|
|
3946
3956
|
case "Line":
|
|
3947
3957
|
return t.length || Math.sqrt(i * i + o * o);
|
|
@@ -3960,33 +3970,33 @@ class ci {
|
|
|
3960
3970
|
if (e.length < 2) return t.length || 0;
|
|
3961
3971
|
let s = 0, n = e[0].x, a = e[0].y;
|
|
3962
3972
|
for (let r = 1; r < e.length; r++) {
|
|
3963
|
-
const
|
|
3964
|
-
if (
|
|
3965
|
-
n =
|
|
3973
|
+
const l = e[r];
|
|
3974
|
+
if (l.moveTo) {
|
|
3975
|
+
n = l.x, a = l.y;
|
|
3966
3976
|
continue;
|
|
3967
3977
|
}
|
|
3968
|
-
const f = n,
|
|
3969
|
-
if (
|
|
3978
|
+
const f = n, h = a, u = e[r - 1].out_x, c = e[r - 1].out_y;
|
|
3979
|
+
if (u !== void 0 || l.in_x !== void 0 ? s += this.getBezierLength(
|
|
3970
3980
|
f,
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
c ??
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
) : s += Math.sqrt((
|
|
3979
|
-
const d = n,
|
|
3980
|
-
|
|
3981
|
+
h,
|
|
3982
|
+
u ?? f,
|
|
3983
|
+
c ?? h,
|
|
3984
|
+
l.in_x ?? l.x,
|
|
3985
|
+
l.in_y ?? l.y,
|
|
3986
|
+
l.x,
|
|
3987
|
+
l.y
|
|
3988
|
+
) : s += Math.sqrt((l.x - f) ** 2 + (l.y - h) ** 2), n = l.x, a = l.y, l.closePath || r === e.length - 1 && (t.is_closed || t.isClosed)) {
|
|
3989
|
+
const d = n, p = a, y = [...e.slice(0, r + 1)].reverse().find((M) => M.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
|
+
v !== void 0 || C !== void 0 ? s += this.getBezierLength(
|
|
3981
3991
|
d,
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
S ??
|
|
3992
|
+
p,
|
|
3993
|
+
v ?? d,
|
|
3994
|
+
S ?? p,
|
|
3985
3995
|
C ?? b,
|
|
3986
3996
|
w ?? m,
|
|
3987
3997
|
b,
|
|
3988
3998
|
m
|
|
3989
|
-
) : s += Math.sqrt((b - d) ** 2 + (m -
|
|
3999
|
+
) : s += Math.sqrt((b - d) ** 2 + (m - p) ** 2);
|
|
3990
4000
|
}
|
|
3991
4001
|
}
|
|
3992
4002
|
return s;
|
|
@@ -3995,24 +4005,24 @@ class ci {
|
|
|
3995
4005
|
return (i + o) * 2;
|
|
3996
4006
|
}
|
|
3997
4007
|
}
|
|
3998
|
-
getBezierLength(t, i, o, e, s, n, a, r,
|
|
3999
|
-
let f = 0,
|
|
4000
|
-
for (let c = 1; c <=
|
|
4001
|
-
const d = c /
|
|
4002
|
-
f += Math.sqrt(w * w + M * M),
|
|
4008
|
+
getBezierLength(t, i, o, e, s, n, a, r, l = 10) {
|
|
4009
|
+
let f = 0, h = t, u = i;
|
|
4010
|
+
for (let c = 1; c <= l; c++) {
|
|
4011
|
+
const d = c / l, 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, M = C - u;
|
|
4012
|
+
f += Math.sqrt(w * w + M * M), h = S, u = C;
|
|
4003
4013
|
}
|
|
4004
4014
|
return f;
|
|
4005
4015
|
}
|
|
4006
|
-
getBezierTAtLength(t, i, o, e, s, n, a, r,
|
|
4016
|
+
getBezierTAtLength(t, i, o, e, s, n, a, r, l, f = 20) {
|
|
4007
4017
|
if (t <= 0) return 0;
|
|
4008
|
-
let
|
|
4018
|
+
let h = 0, u = i, c = o;
|
|
4009
4019
|
for (let d = 1; d <= f; d++) {
|
|
4010
|
-
const
|
|
4011
|
-
if (
|
|
4012
|
-
const T = t -
|
|
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 * l, M = C - u, I = w - c, k = Math.sqrt(M * M + I * I);
|
|
4021
|
+
if (h + k >= t) {
|
|
4022
|
+
const T = t - h, R = k === 0 ? 0 : T / k;
|
|
4013
4023
|
return (d - 1 + R) / f;
|
|
4014
4024
|
}
|
|
4015
|
-
|
|
4025
|
+
h += k, u = C, c = w;
|
|
4016
4026
|
}
|
|
4017
4027
|
return 1;
|
|
4018
4028
|
}
|
|
@@ -4020,51 +4030,51 @@ class ci {
|
|
|
4020
4030
|
if (this.ensurePathPoints(t), (t == null ? void 0 : t.type) === "Path") {
|
|
4021
4031
|
const s = t.points || [];
|
|
4022
4032
|
if (s.length < 2) return { x: 0, y: 0, angle: 0 };
|
|
4023
|
-
let n = 1 / 0, a = -1 / 0, r = 1 / 0,
|
|
4033
|
+
let n = 1 / 0, a = -1 / 0, r = 1 / 0, l = -1 / 0;
|
|
4024
4034
|
s.forEach((m) => {
|
|
4025
|
-
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), l = Math.max(l, 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), l = Math.max(l, 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), l = Math.max(l, m.in_y)));
|
|
4026
4036
|
});
|
|
4027
|
-
const f = (n + a) / 2,
|
|
4037
|
+
const f = (n + a) / 2, h = (r + l) / 2, c = this.getPerimeter(t, i, o) * e;
|
|
4028
4038
|
let d = 0;
|
|
4029
|
-
const
|
|
4030
|
-
let
|
|
4039
|
+
const p = [];
|
|
4040
|
+
let y = s[0], b = s[0];
|
|
4031
4041
|
for (let m = 1; m < s.length; m++) {
|
|
4032
|
-
const
|
|
4033
|
-
if (
|
|
4034
|
-
|
|
4042
|
+
const v = s[m];
|
|
4043
|
+
if (v.moveTo) {
|
|
4044
|
+
y = v, b = v;
|
|
4035
4045
|
continue;
|
|
4036
4046
|
}
|
|
4037
|
-
|
|
4047
|
+
p.push({ p0: y, p1: v }), (v.closePath || m === s.length - 1 && (t.is_closed || t.isClosed)) && p.push({ p0: v, p1: b }), y = v;
|
|
4038
4048
|
}
|
|
4039
|
-
for (const m of
|
|
4040
|
-
const
|
|
4049
|
+
for (const m of p) {
|
|
4050
|
+
const v = m.p0, S = m.p1;
|
|
4041
4051
|
let C = 0;
|
|
4042
|
-
const w =
|
|
4043
|
-
if (w ? C = this.getBezierLength(
|
|
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 >= c || m === p[p.length - 1]) {
|
|
4044
4054
|
let M = 0;
|
|
4045
4055
|
if (w)
|
|
4046
|
-
return M = this.getBezierTAtLength(c - d,
|
|
4056
|
+
return M = this.getBezierTAtLength(c - 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(M, v, S, f, h);
|
|
4047
4057
|
{
|
|
4048
4058
|
M = C === 0 ? 0 : (c - d) / C;
|
|
4049
|
-
const I =
|
|
4059
|
+
const I = v.x + (S.x - v.x) * M - f, k = v.y + (S.y - v.y) * M - h, T = Math.atan2(S.y - v.y, S.x - v.x);
|
|
4050
4060
|
return { x: I, y: k, angle: T };
|
|
4051
4061
|
}
|
|
4052
4062
|
}
|
|
4053
4063
|
d += C;
|
|
4054
4064
|
}
|
|
4055
4065
|
} else if (t.type === "Ellipse") {
|
|
4056
|
-
const s = Math.abs(i) / 2, n = Math.abs(o) / 2, a = t.sweepAngle ?? 360,
|
|
4057
|
-
return { x: f, y:
|
|
4066
|
+
const s = Math.abs(i) / 2, n = Math.abs(o) / 2, a = t.sweepAngle ?? 360, l = ((t.startAngle ?? 0) + a * e) * Math.PI / 180, f = s * Math.cos(l), h = n * Math.sin(l), u = -s * Math.sin(l), c = n * Math.cos(l), d = Math.atan2(c, u);
|
|
4067
|
+
return { x: f, y: h, angle: d };
|
|
4058
4068
|
} else if ((t == null ? void 0 : t.type) === "Rectangle") {
|
|
4059
4069
|
const s = Math.abs(i), n = Math.abs(o), r = (s + n) * 2 * e;
|
|
4060
|
-
let
|
|
4061
|
-
return r < s ? (
|
|
4070
|
+
let l = 0, f = 0, h = 0;
|
|
4071
|
+
return r < s ? (l = -s / 2 + r, f = -n / 2, h = 0) : r < s + n ? (l = s / 2, f = -n / 2 + (r - s), h = Math.PI / 2) : r < 2 * s + n ? (l = s / 2 - (r - (s + n)), f = n / 2, h = Math.PI) : (l = -s / 2, f = n / 2 - (r - (2 * s + n)), h = -Math.PI / 2), { x: l, y: f, angle: h };
|
|
4062
4072
|
}
|
|
4063
4073
|
return { x: 0, y: 0, angle: 0 };
|
|
4064
4074
|
}
|
|
4065
4075
|
getBezierPointAndAngle(t, i, o, e, s) {
|
|
4066
|
-
const n = i.x, a = i.y, r = i.out_x ?? i.x,
|
|
4067
|
-
return { x:
|
|
4076
|
+
const n = i.x, a = i.y, r = i.out_x ?? i.x, l = i.out_y ?? i.y, f = o.in_x ?? o.x, h = o.in_y ?? o.y, u = o.x, c = 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 * l + 3 * d * p * h + m * c - s, C = 3 * y * (r - n) + 6 * d * t * (f - r) + 3 * p * (u - f), w = 3 * y * (l - a) + 6 * d * t * (h - l) + 3 * p * (c - h), M = Math.atan2(w, C);
|
|
4077
|
+
return { x: v, y: S, angle: M };
|
|
4068
4078
|
}
|
|
4069
4079
|
applyAbsoluteTransform(t, i, o) {
|
|
4070
4080
|
if (!o.get(i)) return;
|
|
@@ -4080,7 +4090,7 @@ class ci {
|
|
|
4080
4090
|
});
|
|
4081
4091
|
}
|
|
4082
4092
|
applyObjectTransform(t, i) {
|
|
4083
|
-
var d,
|
|
4093
|
+
var d, p, y;
|
|
4084
4094
|
const o = this.objectStates.get(i);
|
|
4085
4095
|
if (!o) return;
|
|
4086
4096
|
t.translate(o.x, o.y), t.rotate((o.rotation ?? 0) * Math.PI / 180);
|
|
@@ -4089,58 +4099,58 @@ class ci {
|
|
|
4089
4099
|
const b = Math.tan(e * Math.PI / 180), m = Math.tan(s * Math.PI / 180);
|
|
4090
4100
|
t.transform(1 + b * m, m, b, 1, 0, 0);
|
|
4091
4101
|
}
|
|
4092
|
-
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 : ((
|
|
4093
|
-
t.scale(
|
|
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, l = 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) * l, h = (o.flip_y === !0 ? -1 : 1) * Math.cos(n * Math.PI / 180) * l, u = (o.scale_x ?? 1) * f, c = (o.scale_y ?? 1) * h;
|
|
4103
|
+
t.scale(u, c);
|
|
4094
4104
|
}
|
|
4095
4105
|
applyArtEffectOverlay(t, i, o, e, s, n) {
|
|
4096
|
-
var c, d,
|
|
4106
|
+
var c, d, p, y, b;
|
|
4097
4107
|
const a = this.objectStates.get(i.id), r = ((c = a == null ? void 0 : a.style) == null ? void 0 : c.artEffect) || i.artEffect || ((d = i.style) == null ? void 0 : d.artEffect);
|
|
4098
4108
|
if (!r || !r.enabled) return;
|
|
4099
|
-
const
|
|
4100
|
-
if (
|
|
4101
|
-
if (t.save(), this.applyPath(t, o, e, s, n), t.clip(),
|
|
4102
|
-
const
|
|
4103
|
-
S.addColorStop(Math.max(0,
|
|
4104
|
-
} else if (
|
|
4105
|
-
let S = ((this._lastPointerPos || { x: 0 }).x - (((
|
|
4109
|
+
const l = r.type, f = r.intensity ?? 0.5, h = r.speed ?? 1, u = r.scale ?? 10;
|
|
4110
|
+
if (l === "acid_gradient" || l === "acid_rave" || l === "shimmer" || l === "glint_overlay" || l === "halftone" || l === "noise" || l === "scanlines" || l === "chromatic_aberration" || l === "pixelate" || l === "glitch" || l === "fold_overlay" || l === "crumple_overlay") {
|
|
4111
|
+
if (t.save(), this.applyPath(t, o, e, s, n), t.clip(), l === "shimmer") {
|
|
4112
|
+
const v = this.currentTime * h % 2 / 2, S = t.createLinearGradient(-e, -s, e, s);
|
|
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 (l === "glint_overlay") {
|
|
4115
|
+
let S = ((this._lastPointerPos || { x: 0 }).x - (((p = i.transform) == null ? void 0 : p.x) ?? 0) + 300) / 600;
|
|
4106
4116
|
S = Math.max(-0.2, Math.min(1.2, S));
|
|
4107
4117
|
const C = t.createLinearGradient(-e, -s, e, s);
|
|
4108
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";
|
|
4109
|
-
} else if (
|
|
4110
|
-
const m = this._lastPointerPos || { x: 0, y: 0 },
|
|
4111
|
-
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(),
|
|
4112
|
-
} else if (
|
|
4113
|
-
const m = Math.floor(e /
|
|
4114
|
-
|
|
4115
|
-
const S =
|
|
4119
|
+
} else if (l === "fold_overlay") {
|
|
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
|
+
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 (l === "crumple_overlay") {
|
|
4123
|
+
const m = Math.floor(e / u), v = document.createElement("canvas");
|
|
4124
|
+
v.width = m, v.height = Math.floor(s / u);
|
|
4125
|
+
const S = v.getContext("2d"), C = S.createImageData(v.width, v.height);
|
|
4116
4126
|
for (let w = 0; w < C.data.length; w += 4) {
|
|
4117
4127
|
const M = Math.random() > 0.95 ? 150 : 255;
|
|
4118
4128
|
C.data[w] = M, C.data[w + 1] = M, C.data[w + 2] = M, C.data[w + 3] = 255 * f;
|
|
4119
4129
|
}
|
|
4120
|
-
S.putImageData(C, 0, 0), t.globalCompositeOperation = "multiply", t.imageSmoothingEnabled = !1, t.drawImage(
|
|
4121
|
-
} else if (
|
|
4122
|
-
const m = this.currentTime *
|
|
4123
|
-
if (
|
|
4130
|
+
S.putImageData(C, 0, 0), t.globalCompositeOperation = "multiply", t.imageSmoothingEnabled = !1, t.drawImage(v, -e / 2, -s / 2, e, s);
|
|
4131
|
+
} else if (l === "acid_gradient" || l === "acid_rave") {
|
|
4132
|
+
const m = this.currentTime * h, v = r.color1, S = r.color2, C = t.createLinearGradient(-e / 2, -s / 2, e / 2, s / 2);
|
|
4133
|
+
if (v && S) {
|
|
4124
4134
|
const w = m * 60 % 360;
|
|
4125
|
-
C.addColorStop(0, this._shiftHue(
|
|
4135
|
+
C.addColorStop(0, this._shiftHue(v, w, f * 0.7)), C.addColorStop(1, this._shiftHue(S, (w + 180) % 360, f * 0.7));
|
|
4126
4136
|
} else {
|
|
4127
4137
|
const w = m * 100 % 360, M = (w + 180) % 360;
|
|
4128
4138
|
C.addColorStop(0, `hsla(${w}, 80%, 50%, ${f * 0.5})`), C.addColorStop(1, `hsla(${M}, 80%, 50%, ${f * 0.5})`);
|
|
4129
4139
|
}
|
|
4130
4140
|
t.fillStyle = C, t.globalCompositeOperation = "screen", t.fillRect(-e / 2, -s / 2, e, s);
|
|
4131
|
-
} else if (
|
|
4132
|
-
const m = Math.max(2,
|
|
4133
|
-
|
|
4134
|
-
const S =
|
|
4141
|
+
} else if (l === "halftone") {
|
|
4142
|
+
const m = Math.max(2, u * (1 - f * 0.8)), v = document.createElement("canvas");
|
|
4143
|
+
v.width = m, v.height = m;
|
|
4144
|
+
const S = v.getContext("2d");
|
|
4135
4145
|
if (S) {
|
|
4136
4146
|
S.fillStyle = "black", S.beginPath(), S.arc(m / 2, m / 2, m / 2 * f, 0, Math.PI * 2), S.fill();
|
|
4137
|
-
const C = t.createPattern(
|
|
4147
|
+
const C = t.createPattern(v, "repeat");
|
|
4138
4148
|
C && (t.globalAlpha = 0.3 * f, t.fillStyle = C, t.fillRect(-e / 2, -s / 2, e, s));
|
|
4139
4149
|
}
|
|
4140
|
-
} else if (
|
|
4150
|
+
} else if (l === "noise") {
|
|
4141
4151
|
const m = Math.floor(e * s * f * 0.02);
|
|
4142
4152
|
t.globalAlpha = 0.4 * f;
|
|
4143
|
-
for (let
|
|
4153
|
+
for (let v = 0; v < m; v++) {
|
|
4144
4154
|
const S = Math.random() > 0.5 ? 255 : 0;
|
|
4145
4155
|
t.fillStyle = `rgba(${S}, ${S}, ${S}, ${0.5 + Math.random() * 0.5})`, t.fillRect(
|
|
4146
4156
|
-e / 2 + Math.random() * e,
|
|
@@ -4149,32 +4159,32 @@ class ci {
|
|
|
4149
4159
|
2
|
|
4150
4160
|
);
|
|
4151
4161
|
}
|
|
4152
|
-
} else if (
|
|
4162
|
+
} else if (l === "scanlines") {
|
|
4153
4163
|
t.globalAlpha = 0.2 * f, t.strokeStyle = "rgba(0,0,0,0.5)", t.lineWidth = 1;
|
|
4154
4164
|
for (let m = -s / 2; m < s / 2; m += 4)
|
|
4155
4165
|
t.beginPath(), t.moveTo(-e / 2, m), t.lineTo(e / 2, m), t.stroke();
|
|
4156
|
-
} else if (
|
|
4166
|
+
} else if (l === "chromatic_aberration") {
|
|
4157
4167
|
const m = 5 * f;
|
|
4158
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);
|
|
4159
|
-
} else if (
|
|
4160
|
-
const m = Math.max(2, Math.round(
|
|
4161
|
-
|
|
4162
|
-
const w =
|
|
4169
|
+
} else if (l === "pixelate") {
|
|
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
|
+
v.width = S, v.height = C;
|
|
4172
|
+
const w = v.getContext("2d");
|
|
4163
4173
|
if (w) {
|
|
4164
4174
|
w.imageSmoothingEnabled = !1;
|
|
4165
4175
|
const M = t.getTransform(), I = M.e - e / 2, k = M.f - s / 2;
|
|
4166
|
-
w.drawImage(t.canvas, I, k, e, s, 0, 0, S, C), t.imageSmoothingEnabled = !1, t.drawImage(
|
|
4176
|
+
w.drawImage(t.canvas, I, 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;
|
|
4167
4177
|
}
|
|
4168
|
-
} else if (
|
|
4169
|
-
const m = this.currentTime *
|
|
4178
|
+
} else if (l === "glitch") {
|
|
4179
|
+
const m = this.currentTime * h, v = r.chaosAmount ?? 0.2, S = Math.max(3, Math.floor(8 * f)), C = f * e * 0.15;
|
|
4170
4180
|
t.globalCompositeOperation = "screen", t.globalAlpha = f * 0.4;
|
|
4171
4181
|
const w = C * 0.3;
|
|
4172
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;
|
|
4173
4183
|
const M = s / S;
|
|
4174
4184
|
for (let I = 0; I < S; I++) {
|
|
4175
|
-
const k = Math.sin(I * 127.1 + m * 311.7 *
|
|
4176
|
-
if (T > 1 -
|
|
4177
|
-
const R = (T - (1 -
|
|
4185
|
+
const k = Math.sin(I * 127.1 + m * 311.7 * h) * 43758.5, T = k - Math.floor(k);
|
|
4186
|
+
if (T > 1 - v) {
|
|
4187
|
+
const R = (T - (1 - v)) / v * C * (Math.random() > 0.5 ? 1 : -1), P = -s / 2 + I * M, _ = t.getTransform(), E = _.e - e / 2 + R, A = _.f + P;
|
|
4178
4188
|
t.save(), t.beginPath(), t.rect(-e / 2, P, e, M), t.clip(), t.globalAlpha = 0.8, t.drawImage(t.canvas, E, A, e, M, -e / 2 + R, P, e, M), t.restore();
|
|
4179
4189
|
}
|
|
4180
4190
|
}
|
|
@@ -4190,22 +4200,47 @@ class ci {
|
|
|
4190
4200
|
e = parseInt(c.substring(0, 2), 16) / 255, s = parseInt(c.substring(2, 4), 16) / 255, n = parseInt(c.substring(4, 6), 16) / 255;
|
|
4191
4201
|
}
|
|
4192
4202
|
const a = Math.max(e, s, n), r = Math.min(e, s, n);
|
|
4193
|
-
let
|
|
4203
|
+
let l = 0, f = 0, h = (a + r) / 2;
|
|
4194
4204
|
if (a !== r) {
|
|
4195
4205
|
const c = a - r;
|
|
4196
|
-
switch (f =
|
|
4206
|
+
switch (f = h > 0.5 ? c / (2 - a - r) : c / (a + r), a) {
|
|
4197
4207
|
case e:
|
|
4198
|
-
|
|
4208
|
+
l = ((s - n) / c + (s < n ? 6 : 0)) / 6;
|
|
4199
4209
|
break;
|
|
4200
4210
|
case s:
|
|
4201
|
-
|
|
4211
|
+
l = ((n - e) / c + 2) / 6;
|
|
4202
4212
|
break;
|
|
4203
4213
|
case n:
|
|
4204
|
-
|
|
4214
|
+
l = ((e - s) / c + 4) / 6;
|
|
4205
4215
|
break;
|
|
4206
4216
|
}
|
|
4207
4217
|
}
|
|
4208
|
-
return `hsla(${(((
|
|
4218
|
+
return `hsla(${(((l * 360 + i) % 360 + 360) % 360).toFixed(0)}, ${(f * 100).toFixed(0)}%, ${(h * 100).toFixed(0)}%, ${o})`;
|
|
4219
|
+
}
|
|
4220
|
+
/**
|
|
4221
|
+
* Parse any CSS color string and return it with the alpha channel replaced by `opacity`.
|
|
4222
|
+
* This lets us bake an opacity value into the color without double-multiplying via globalAlpha.
|
|
4223
|
+
*/
|
|
4224
|
+
_applyAlphaToColor(t, i) {
|
|
4225
|
+
if (!t) return `rgba(255,255,255,${i})`;
|
|
4226
|
+
const o = t.match(/rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)(?:\s*,\s*([\d.%]+))?\s*\)/);
|
|
4227
|
+
if (o) {
|
|
4228
|
+
const s = o[1], n = o[2], a = o[3];
|
|
4229
|
+
return `rgba(${s},${n},${a},${i})`;
|
|
4230
|
+
}
|
|
4231
|
+
if (t.startsWith("#")) {
|
|
4232
|
+
const s = t.replace("#", ""), n = s.length;
|
|
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), l = parseInt(a.slice(2, 4), 16), f = parseInt(a.slice(4, 6), 16);
|
|
4235
|
+
return `rgba(${r},${l},${f},${i})`;
|
|
4236
|
+
}
|
|
4237
|
+
if (n === 8) {
|
|
4238
|
+
const a = parseInt(s.slice(0, 2), 16), r = parseInt(s.slice(2, 4), 16), l = parseInt(s.slice(4, 6), 16);
|
|
4239
|
+
return `rgba(${a},${r},${l},${i})`;
|
|
4240
|
+
}
|
|
4241
|
+
}
|
|
4242
|
+
const e = t.match(/hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.%]+))?\s*\)/);
|
|
4243
|
+
return e ? `hsla(${e[1]},${e[2]}%,${e[3]}%,${i})` : `rgba(255,255,255,${i})`;
|
|
4209
4244
|
}
|
|
4210
4245
|
/**
|
|
4211
4246
|
* Simulate CSS `backdrop-filter: blur()` + glass overlay on Canvas2D.
|
|
@@ -4216,46 +4251,46 @@ class ci {
|
|
|
4216
4251
|
* 4. Apply the overlay color tint, sheen highlight, noise grain, and glass border
|
|
4217
4252
|
*/
|
|
4218
4253
|
applyBackgroundBlurGlass(t, i, o, e, s, n) {
|
|
4219
|
-
const a = n.radius ?? 10, r = n.
|
|
4254
|
+
const a = n.radius ?? 10, r = n.opacity !== void 0 ? this.normalizeOpacity(n.opacity) : 0.5, l = n.noise ?? 0, f = n.color ?? "rgba(255,255,255,0.2)", h = this._applyAlphaToColor(f, r);
|
|
4220
4255
|
t.save(), this.applyPath(t, i, o, e, s), t.clip();
|
|
4221
|
-
const
|
|
4256
|
+
const u = t.getTransform(), c = t.canvas;
|
|
4222
4257
|
try {
|
|
4223
|
-
const
|
|
4224
|
-
|
|
4225
|
-
const
|
|
4226
|
-
if (
|
|
4227
|
-
|
|
4228
|
-
const
|
|
4229
|
-
if (
|
|
4230
|
-
const
|
|
4231
|
-
|
|
4258
|
+
const p = document.createElement("canvas");
|
|
4259
|
+
p.width = Math.max(1, Math.ceil(o)), p.height = Math.max(1, Math.ceil(e));
|
|
4260
|
+
const y = p.getContext("2d");
|
|
4261
|
+
if (y) {
|
|
4262
|
+
y.save(), y.translate(o / 2, e / 2);
|
|
4263
|
+
const b = n.magnification || 1;
|
|
4264
|
+
if (b !== 1 && y.scale(b, b), typeof u.inverse == "function") {
|
|
4265
|
+
const S = u.inverse();
|
|
4266
|
+
y.transform(S.a, S.b, S.c, S.d, S.e, S.f);
|
|
4232
4267
|
} else {
|
|
4233
|
-
const
|
|
4234
|
-
|
|
4268
|
+
const S = u.a * u.d - u.b * u.c;
|
|
4269
|
+
S !== 0 && y.transform(u.d / S, -u.b / S, -u.c / S, u.a / S, (u.c * u.f - u.d * u.e) / S, (u.b * u.e - u.a * u.f) / S);
|
|
4235
4270
|
}
|
|
4236
|
-
|
|
4237
|
-
const
|
|
4238
|
-
|
|
4239
|
-
const
|
|
4240
|
-
|
|
4271
|
+
y.drawImage(c, 0, 0), y.restore(), y.filter = `blur(${a}px)`;
|
|
4272
|
+
const m = document.createElement("canvas");
|
|
4273
|
+
m.width = p.width, m.height = p.height;
|
|
4274
|
+
const v = m.getContext("2d");
|
|
4275
|
+
v.filter = `blur(${a}px)`, v.drawImage(p, 0, 0), t.globalCompositeOperation = "source-over", t.globalAlpha = 1, t.drawImage(m, -o / 2, -e / 2, o, e);
|
|
4241
4276
|
}
|
|
4242
4277
|
} catch {
|
|
4243
4278
|
}
|
|
4244
|
-
t.globalCompositeOperation = "source-over", t.globalAlpha =
|
|
4245
|
-
const
|
|
4246
|
-
if (
|
|
4247
|
-
if (t.globalAlpha =
|
|
4248
|
-
const
|
|
4249
|
-
|
|
4250
|
-
const
|
|
4251
|
-
for (let
|
|
4252
|
-
const
|
|
4253
|
-
|
|
4279
|
+
t.globalCompositeOperation = "source-over", t.globalAlpha = 1, t.fillStyle = h, t.fillRect(-o / 2, -e / 2, o, e), t.globalAlpha = 1, t.globalCompositeOperation = "source-atop";
|
|
4280
|
+
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), l > 0) {
|
|
4282
|
+
if (t.globalAlpha = l / 100, !this._noiseTileCanvas) {
|
|
4283
|
+
const y = document.createElement("canvas");
|
|
4284
|
+
y.width = 64, y.height = 64;
|
|
4285
|
+
const b = y.getContext("2d"), m = b.createImageData(64, 64), v = m.data;
|
|
4286
|
+
for (let S = 0; S < v.length; S += 4) {
|
|
4287
|
+
const C = Math.floor(Math.random() * 255);
|
|
4288
|
+
v[S] = C, v[S + 1] = C, v[S + 2] = C, v[S + 3] = 18;
|
|
4254
4289
|
}
|
|
4255
|
-
|
|
4290
|
+
b.putImageData(m, 0, 0), this._noiseTileCanvas = y;
|
|
4256
4291
|
}
|
|
4257
|
-
const
|
|
4258
|
-
|
|
4292
|
+
const p = t.createPattern(this._noiseTileCanvas, "repeat");
|
|
4293
|
+
p && (t.fillStyle = p, t.fillRect(-o / 2, -e / 2, o, e));
|
|
4259
4294
|
}
|
|
4260
4295
|
t.restore(), t.save(), t.globalAlpha = 1, t.strokeStyle = "rgba(255, 255, 255, 0.25)", t.lineWidth = 1.5, this.applyPath(t, i, o, e, s), t.stroke(), t.restore();
|
|
4261
4296
|
}
|
|
@@ -4270,89 +4305,89 @@ class ci {
|
|
|
4270
4305
|
} else if (i.type === "Line")
|
|
4271
4306
|
t.moveTo(-o / 2, 0), t.lineTo(o / 2, 0);
|
|
4272
4307
|
else if (i.type === "Ellipse") {
|
|
4273
|
-
const { startAngle: n = 0, sweepAngle: a = 360, ratio: r = 0 } = i,
|
|
4274
|
-
a >= 360 && r <= 0 ? t.ellipse(0, 0,
|
|
4308
|
+
const { startAngle: n = 0, sweepAngle: a = 360, ratio: r = 0 } = i, l = o / 2, f = e / 2, h = n * Math.PI / 180, u = a * Math.PI / 180, c = h + u;
|
|
4309
|
+
a >= 360 && r <= 0 ? t.ellipse(0, 0, l, f, 0, 0, Math.PI * 2) : (t.ellipse(0, 0, l, f, 0, h, c, !1), r > 0 ? t.ellipse(0, 0, l * r, f * r, 0, c, h, !0) : t.lineTo(0, 0), t.closePath());
|
|
4275
4310
|
} else if (i.type === "Triangle")
|
|
4276
4311
|
t.moveTo(0, -e / 2), t.lineTo(o / 2, e / 2), t.lineTo(-o / 2, e / 2), t.closePath();
|
|
4277
4312
|
else if (i.type === "Polygon") {
|
|
4278
4313
|
const n = i.sides || 3, a = i.radius || Math.min(o, e) / 2;
|
|
4279
4314
|
for (let r = 0; r < n; r++) {
|
|
4280
|
-
const
|
|
4281
|
-
r === 0 ? t.moveTo(f,
|
|
4315
|
+
const l = r * 2 * Math.PI / n - Math.PI / 2, f = a * Math.cos(l), h = a * Math.sin(l);
|
|
4316
|
+
r === 0 ? t.moveTo(f, h) : t.lineTo(f, h);
|
|
4282
4317
|
}
|
|
4283
4318
|
t.closePath();
|
|
4284
4319
|
} else if (i.type === "Star") {
|
|
4285
4320
|
const n = i.points || 5, a = i.outer_radius || Math.min(o, e) / 2;
|
|
4286
4321
|
let r = i.inner_radius;
|
|
4287
4322
|
r == null ? r = a * 0.382 : r <= 1 && (r = a * r);
|
|
4288
|
-
for (let
|
|
4289
|
-
const f =
|
|
4290
|
-
|
|
4323
|
+
for (let l = 0; l < n * 2; l++) {
|
|
4324
|
+
const f = l * Math.PI / n - Math.PI / 2, h = l % 2 === 0 ? a : r, u = h * Math.cos(f), c = h * Math.sin(f);
|
|
4325
|
+
l === 0 ? t.moveTo(u, c) : t.lineTo(u, c);
|
|
4291
4326
|
}
|
|
4292
4327
|
t.closePath();
|
|
4293
4328
|
} 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) {
|
|
4294
4329
|
this.frameCount % 300 === 0 && this.log("[Engine] Tracing Path:", i.points.length, "points");
|
|
4295
|
-
let n = 1 / 0, a = -1 / 0, r = 1 / 0,
|
|
4296
|
-
if (i.points.forEach((
|
|
4297
|
-
typeof
|
|
4330
|
+
let n = 1 / 0, a = -1 / 0, r = 1 / 0, l = -1 / 0;
|
|
4331
|
+
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), l = Math.max(l, 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), l = Math.max(l, 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), l = Math.max(l, u.in_y)));
|
|
4298
4333
|
}), n === 1 / 0) return;
|
|
4299
|
-
const f = (n + a) / 2,
|
|
4300
|
-
if (isNaN(f) || isNaN(
|
|
4301
|
-
this.warn("[Engine] Invalid path center:", f,
|
|
4334
|
+
const f = (n + a) / 2, h = (r + l) / 2;
|
|
4335
|
+
if (isNaN(f) || isNaN(h)) {
|
|
4336
|
+
this.warn("[Engine] Invalid path center:", f, h);
|
|
4302
4337
|
return;
|
|
4303
4338
|
}
|
|
4304
|
-
i.points.forEach((
|
|
4305
|
-
if (c === 0 ||
|
|
4306
|
-
t.moveTo(
|
|
4339
|
+
i.points.forEach((u, c) => {
|
|
4340
|
+
if (c === 0 || u.moveTo)
|
|
4341
|
+
t.moveTo(u.x - f, u.y - h);
|
|
4307
4342
|
else {
|
|
4308
4343
|
const d = i.points[c - 1];
|
|
4309
4344
|
if (!d) return;
|
|
4310
|
-
const
|
|
4311
|
-
isNaN(
|
|
4345
|
+
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
|
+
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);
|
|
4312
4347
|
}
|
|
4313
|
-
if (
|
|
4314
|
-
const d = [...i.points.slice(0, c + 1)].reverse().find((
|
|
4315
|
-
d && (
|
|
4316
|
-
(
|
|
4317
|
-
(
|
|
4348
|
+
if (u.closePath || c === i.points.length - 1 && (i.is_closed || i.isClosed)) {
|
|
4349
|
+
const d = [...i.points.slice(0, c + 1)].reverse().find((p) => p.moveTo) || i.points[0];
|
|
4350
|
+
d && (u.out_x !== void 0 || d.in_x !== void 0) && t.bezierCurveTo(
|
|
4351
|
+
(u.out_x ?? u.x) - f,
|
|
4352
|
+
(u.out_y ?? u.y) - h,
|
|
4318
4353
|
(d.in_x ?? d.x) - f,
|
|
4319
|
-
(d.in_y ?? d.y) -
|
|
4354
|
+
(d.in_y ?? d.y) - h,
|
|
4320
4355
|
d.x - f,
|
|
4321
|
-
d.y -
|
|
4356
|
+
d.y - h
|
|
4322
4357
|
), t.closePath();
|
|
4323
4358
|
}
|
|
4324
4359
|
});
|
|
4325
4360
|
} else if (i.points && Array.isArray(i.points)) {
|
|
4326
|
-
let n = 1 / 0, a = -1 / 0, r = 1 / 0,
|
|
4327
|
-
i.points.forEach((
|
|
4328
|
-
n = Math.min(n,
|
|
4361
|
+
let n = 1 / 0, a = -1 / 0, r = 1 / 0, l = -1 / 0;
|
|
4362
|
+
i.points.forEach((u) => {
|
|
4363
|
+
n = Math.min(n, u.x), a = Math.max(a, u.x), r = Math.min(r, u.y), l = Math.max(l, u.y);
|
|
4329
4364
|
});
|
|
4330
|
-
const f = (n + a) / 2,
|
|
4331
|
-
i.points.forEach((
|
|
4332
|
-
if (c === 0) t.moveTo(
|
|
4365
|
+
const f = (n + a) / 2, h = (r + l) / 2;
|
|
4366
|
+
i.points.forEach((u, c) => {
|
|
4367
|
+
if (c === 0) t.moveTo(u.x - f, u.y - h);
|
|
4333
4368
|
else {
|
|
4334
4369
|
const d = i.points[c - 1];
|
|
4335
|
-
d.out_x !== void 0 ||
|
|
4370
|
+
d.out_x !== void 0 || u.in_x !== void 0 ? t.bezierCurveTo(
|
|
4336
4371
|
(d.out_x ?? d.x) - f,
|
|
4337
|
-
(d.out_y ?? d.y) -
|
|
4338
|
-
(
|
|
4339
|
-
(
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
) : t.lineTo(
|
|
4372
|
+
(d.out_y ?? d.y) - h,
|
|
4373
|
+
(u.in_x ?? u.x) - f,
|
|
4374
|
+
(u.in_y ?? u.y) - h,
|
|
4375
|
+
u.x - f,
|
|
4376
|
+
u.y - h
|
|
4377
|
+
) : t.lineTo(u.x - f, u.y - h);
|
|
4343
4378
|
}
|
|
4344
|
-
(
|
|
4379
|
+
(u.closePath || c === i.points.length - 1 && (i.is_closed || i.isClosed)) && t.closePath();
|
|
4345
4380
|
});
|
|
4346
4381
|
}
|
|
4347
4382
|
}
|
|
4348
4383
|
}
|
|
4349
4384
|
renderInputBox(t, i) {
|
|
4350
4385
|
var L, O;
|
|
4351
|
-
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,
|
|
4352
|
-
let
|
|
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, l = e.previewState || "default", f = l !== "default" ? l : a ? "focused" : r ? "hovered" : "default", h = e.label || { visible: !0, text: "Label" }, u = e.helperText || { visible: !1, text: "Helper text" }, c = 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];
|
|
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", M = e.placeholderColor || "rgba(156, 163, 175, 1)", I = e.fontSize || 14;
|
|
4353
4388
|
const k = `${f}Style`, T = e[k];
|
|
4354
|
-
T ? (T.backgroundColor !== void 0 && (
|
|
4355
|
-
const R = this.createCanvasFill(t,
|
|
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 && (M = T.placeholderColor), T.fontSize !== void 0 && (I = 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
|
+
const R = this.createCanvasFill(t, v, s, n);
|
|
4356
4391
|
if (R && (t.fillStyle = R, t.fill()), C > 0) {
|
|
4357
4392
|
const D = this.createCanvasFill(t, S, s, n);
|
|
4358
4393
|
if (D && (t.strokeStyle = D, t.lineWidth = C, t.stroke()), f === "focused" || f === "focus") {
|
|
@@ -4372,9 +4407,9 @@ class ci {
|
|
|
4372
4407
|
};
|
|
4373
4408
|
P(c, !0), P(d, !1);
|
|
4374
4409
|
const _ = e.text || "", E = e.placeholder || "Enter text...", A = !_, W = _ || E, z = A ? M : w, Y = I, G = e.fontFamily || "Inter", N = e.fontWeight || 400;
|
|
4375
|
-
t.font = `${N} ${Y}px "${G}", sans-serif`, t.fillStyle = z, t.textAlign = "left", t.textBaseline =
|
|
4410
|
+
t.font = `${N} ${Y}px "${G}", sans-serif`, t.fillStyle = z, t.textAlign = "left", t.textBaseline = p ? "top" : "middle";
|
|
4376
4411
|
const J = e.inputPadding ?? 16, x = c.visible ? (c.offset ?? 16) + (c.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;
|
|
4377
|
-
if (t.save(), t.beginPath(), t.rect(j - 2, -n / 2 + 4, X + 4, n - 8), t.clip(),
|
|
4412
|
+
if (t.save(), t.beginPath(), t.rect(j - 2, -n / 2 + 4, X + 4, n - 8), t.clip(), p) {
|
|
4378
4413
|
const D = tt.split(`
|
|
4379
4414
|
`);
|
|
4380
4415
|
let q = -n / 2 + J;
|
|
@@ -4397,21 +4432,21 @@ class ci {
|
|
|
4397
4432
|
t.fillRect(bt, -(Y / 2), 1.5, Y);
|
|
4398
4433
|
}
|
|
4399
4434
|
}
|
|
4400
|
-
if (t.restore(),
|
|
4401
|
-
const D =
|
|
4435
|
+
if (t.restore(), h.visible !== !1) {
|
|
4436
|
+
const D = h.text || "Label", q = h.fontSize || 12, ot = h.color || "rgba(156, 163, 175, 1)", yt = h.offset ?? 8;
|
|
4402
4437
|
t.font = `600 ${q}px "${G}", sans-serif`, t.fillStyle = ot, t.textAlign = "left", t.textBaseline = "bottom";
|
|
4403
4438
|
const bt = -(s / 2), gt = -(n / 2) - yt;
|
|
4404
4439
|
t.fillText(D, bt, gt);
|
|
4405
4440
|
}
|
|
4406
|
-
if (
|
|
4407
|
-
const D =
|
|
4441
|
+
if (u.visible === !0) {
|
|
4442
|
+
const D = u.text || "Helper text", q = u.fontSize || 11, ot = f === "error" ? "rgba(239, 68, 68, 1)" : u.color || "rgba(156, 163, 175, 1)", yt = u.offset ?? 6;
|
|
4408
4443
|
t.font = `400 ${q}px "${G}", sans-serif`, t.fillStyle = ot, t.textAlign = "left", t.textBaseline = "top";
|
|
4409
4444
|
const bt = -(s / 2), gt = n / 2 + yt;
|
|
4410
4445
|
t.fillText(D, bt, gt);
|
|
4411
4446
|
}
|
|
4412
4447
|
}
|
|
4413
4448
|
renderSlider(t, i) {
|
|
4414
|
-
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,
|
|
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, c = 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", M = s.thumbPath || "", I = 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) => {
|
|
4415
4450
|
if ((X === "Custom" || X === "Icon") && ot)
|
|
4416
4451
|
try {
|
|
4417
4452
|
const yt = new Path2D(ot);
|
|
@@ -4448,18 +4483,18 @@ class ci {
|
|
|
4448
4483
|
t.closePath();
|
|
4449
4484
|
} else X === "Line" && (t.moveTo(tt - O / 2, L), t.lineTo(tt + O / 2, L));
|
|
4450
4485
|
t.fill();
|
|
4451
|
-
}, A = this.createCanvasFill(t, b, n,
|
|
4452
|
-
A && (t.fillStyle = A, t.strokeStyle = A), d === "Line" ? (t.lineWidth =
|
|
4453
|
-
const W = n -
|
|
4486
|
+
}, 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, c, p);
|
|
4488
|
+
const W = n - v, z = -n / 2 + v / 2 + h * W, Y = z - -n / 2;
|
|
4454
4489
|
if (Y > 0) {
|
|
4455
|
-
const X = this.createCanvasFill(t,
|
|
4456
|
-
X && (t.fillStyle = X, t.strokeStyle = X), d === "Line" ? (t.lineWidth =
|
|
4490
|
+
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, c), t.fill());
|
|
4457
4492
|
}
|
|
4458
4493
|
t.save(), t.translate(z, 0);
|
|
4459
4494
|
const G = t.getTransform(), N = Math.sqrt(G.a * G.a + G.b * G.b) || 1;
|
|
4460
4495
|
t.shadowColor = "rgba(0,0,0,0.2)", t.shadowBlur = 4 * N, t.shadowOffsetY = 1 * N;
|
|
4461
|
-
const J = this.createCanvasFill(t, w,
|
|
4462
|
-
if (J && (t.fillStyle = J), E(m, 0, 0,
|
|
4496
|
+
const J = this.createCanvasFill(t, w, v, S);
|
|
4497
|
+
if (J && (t.fillStyle = J), E(m, 0, 0, v, S, C, m === "Icon" ? I : M), t.restore(), k) {
|
|
4463
4498
|
t.save(), t.translate(z + P, _);
|
|
4464
4499
|
const X = Math.round(a).toString();
|
|
4465
4500
|
t.font = "10px Inter, sans-serif";
|
|
@@ -4470,13 +4505,13 @@ class ci {
|
|
|
4470
4505
|
if (x.visible !== !1) {
|
|
4471
4506
|
const X = x.text || "Label", tt = x.fontSize || 12, L = x.color || "rgba(156, 163, 175, 1)", O = x.offset ?? 8;
|
|
4472
4507
|
t.font = `600 ${tt}px "${j}", sans-serif`, t.fillStyle = L, t.textAlign = "left", t.textBaseline = "bottom";
|
|
4473
|
-
const D = -(n / 2), q = -(
|
|
4508
|
+
const D = -(n / 2), q = -(u / 2) - O;
|
|
4474
4509
|
t.fillText(X, D, q);
|
|
4475
4510
|
}
|
|
4476
4511
|
if (F.visible === !0) {
|
|
4477
4512
|
const X = F.text || "Helper text", tt = F.fontSize || 11, L = F.color || "rgba(156, 163, 175, 1)", O = F.offset ?? 6;
|
|
4478
4513
|
t.font = `400 ${tt}px "${j}", sans-serif`, t.fillStyle = L, t.textAlign = "left", t.textBaseline = "top";
|
|
4479
|
-
const D = -(n / 2), q =
|
|
4514
|
+
const D = -(n / 2), q = u / 2 + O;
|
|
4480
4515
|
t.fillText(X, D, q);
|
|
4481
4516
|
}
|
|
4482
4517
|
}
|
|
@@ -4484,22 +4519,22 @@ class ci {
|
|
|
4484
4519
|
var _;
|
|
4485
4520
|
const o = this.objectStates.get(i.id);
|
|
4486
4521
|
if (!o) return;
|
|
4487
|
-
const e = o.options || i.options || {}, s = i.geometry.width || 160, n = i.geometry.height || 40, a = -s / 2, r = -n / 2,
|
|
4488
|
-
let c = e.backgroundColor, d = e.borderColor,
|
|
4489
|
-
f ? (c = e.disabledBackgroundColor || "#f3f4f6", d = e.disabledBorderColor || "#e5e7eb",
|
|
4490
|
-
const
|
|
4491
|
-
t.globalAlpha =
|
|
4522
|
+
const e = o.options || i.options || {}, s = i.geometry.width || 160, n = i.geometry.height || 40, a = -s / 2, r = -n / 2, l = 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;
|
|
4523
|
+
let c = e.backgroundColor, d = e.borderColor, p = e.color || "#333333";
|
|
4524
|
+
f ? (c = e.disabledBackgroundColor || "#f3f4f6", d = e.disabledBorderColor || "#e5e7eb", p = e.disabledColor || "#9ca3af") : u ? (c = e.activeBackgroundColor || c, d = e.activeBorderColor || d, p = e.activeColor || p) : h && (c = e.hoverBackgroundColor || c, d = e.hoverBorderColor || d, p = e.hoverColor || p), c || (c = "#ffffff"), d || (d = "#e5e7eb");
|
|
4525
|
+
const y = t.globalAlpha;
|
|
4526
|
+
t.globalAlpha = y * (e.opacity ?? 1), this.drawRoundRect(t, a, r, s, n, l), t.fillStyle = this.createCanvasFill(t, typeof c == "string" ? { type: "Solid", color: c } : c, s, n) || "#ffffff", t.fill();
|
|
4492
4527
|
const b = e.borderWidth ?? 1;
|
|
4493
4528
|
b > 0 && (t.strokeStyle = this.createCanvasFill(t, typeof d == "string" ? { type: "Solid", color: d } : d, s, n) || "#e5e7eb", t.lineWidth = b, t.stroke());
|
|
4494
|
-
const m = 12,
|
|
4495
|
-
if (
|
|
4529
|
+
const m = 12, v = e.chevronType || "chevron", S = e.chevronSize || 16, C = (u ? e.openIconColor : e.closedIconColor) || e.chevronColor || "#6b7280";
|
|
4530
|
+
if (v !== "none") {
|
|
4496
4531
|
const E = a + s - m - S / 2;
|
|
4497
4532
|
t.save(), t.translate(E, 0);
|
|
4498
|
-
const A =
|
|
4499
|
-
if (t.rotate(A * Math.PI / 180), t.strokeStyle = C, t.fillStyle = C, t.lineWidth = 1.5, t.lineCap = "round", t.lineJoin = "round",
|
|
4533
|
+
const A = u ? e.openIconAngle ?? 180 : e.closedIconAngle ?? 0;
|
|
4534
|
+
if (t.rotate(A * Math.PI / 180), t.strokeStyle = C, t.fillStyle = C, t.lineWidth = 1.5, t.lineCap = "round", t.lineJoin = "round", v === "chevron")
|
|
4500
4535
|
t.beginPath(), t.moveTo(-S / 2, -S * 0.2), t.lineTo(0, S * 0.2), t.lineTo(S / 2, -S * 0.2), t.stroke();
|
|
4501
|
-
else if (
|
|
4502
|
-
const W =
|
|
4536
|
+
else if (v === "custom" || v === "path") {
|
|
4537
|
+
const W = u && e.openIconPath || e.closedIconPath;
|
|
4503
4538
|
if (W) {
|
|
4504
4539
|
const z = new Path2D(W);
|
|
4505
4540
|
t.save();
|
|
@@ -4511,11 +4546,11 @@ class ci {
|
|
|
4511
4546
|
}
|
|
4512
4547
|
const w = e.selectedOption || e.placeholder || "Select...", M = e.fontSize || 14, I = e.fontWeight || 400, k = e.fontFamily || "Inter, sans-serif";
|
|
4513
4548
|
t.font = `${I} ${M}px ${k}`;
|
|
4514
|
-
const T = f ? e.disabledColor || "#9ca3af" : !e.selectedOption && e.placeholder ? "#9ca3af" :
|
|
4549
|
+
const T = f ? e.disabledColor || "#9ca3af" : !e.selectedOption && e.placeholder ? "#9ca3af" : p;
|
|
4515
4550
|
t.fillStyle = this.createCanvasFill(t, typeof T == "string" ? { type: "Solid", color: T } : T, s, n) || "#333333", t.textAlign = "left", t.textBaseline = "middle";
|
|
4516
|
-
const R =
|
|
4517
|
-
if (t.save(), t.beginPath(), t.rect(a + m, r, P, n), t.clip(), t.fillText(w, a + m, 0), t.restore(),
|
|
4518
|
-
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 ??
|
|
4551
|
+
const R = v === "none" ? 0 : S + 8, P = s - m * 2 - R;
|
|
4552
|
+
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 ?? l;
|
|
4519
4554
|
t.save();
|
|
4520
4555
|
const N = e.listShadow || {}, J = t.getTransform(), x = Math.sqrt(J.a * J.a + J.b * J.b) || 1;
|
|
4521
4556
|
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();
|
|
@@ -4525,64 +4560,64 @@ class ci {
|
|
|
4525
4560
|
t.font = `${I} ${j}px ${X}`, A.forEach((tt, L) => {
|
|
4526
4561
|
const O = E + z + L * W;
|
|
4527
4562
|
if (tt === e.selectedOption)
|
|
4528
|
-
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 ||
|
|
4529
|
-
else if (t.fillStyle = e.listTextColor ||
|
|
4563
|
+
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";
|
|
4564
|
+
else if (t.fillStyle = e.listTextColor || p || "#333333", this.activeDropdownId === i.id && this._lastPointerPos) {
|
|
4530
4565
|
const q = this._lastPointerPos.y - (E + z), ot = Math.floor(q / W);
|
|
4531
|
-
L === ot && (t.fillStyle = this.createCanvasFill(t, typeof e.itemHoverBackgroundColor == "string" ? { type: "Solid", color: e.itemHoverBackgroundColor } : e.itemHoverBackgroundColor || { type: "Solid", color: "#f9fafb" }, s, W) || "#f9fafb", t.fillRect(a + F, O, s - F * 2, W), t.fillStyle = e.itemHoverColor ||
|
|
4566
|
+
L === ot && (t.fillStyle = this.createCanvasFill(t, typeof e.itemHoverBackgroundColor == "string" ? { type: "Solid", color: e.itemHoverBackgroundColor } : e.itemHoverBackgroundColor || { type: "Solid", color: "#f9fafb" }, s, W) || "#f9fafb", t.fillRect(a + F, O, s - F * 2, W), t.fillStyle = e.itemHoverColor || p);
|
|
4532
4567
|
}
|
|
4533
4568
|
t.fillText(tt, a + m, O + W / 2);
|
|
4534
4569
|
});
|
|
4535
4570
|
}
|
|
4536
|
-
t.globalAlpha =
|
|
4571
|
+
t.globalAlpha = y;
|
|
4537
4572
|
}
|
|
4538
4573
|
renderButton(t, i) {
|
|
4539
4574
|
if (i.children && i.children.length > 0) return;
|
|
4540
|
-
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,
|
|
4541
|
-
let d = e.backgroundColor || "#3b82f6",
|
|
4542
|
-
|
|
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, l = this.activeObjectId === i.id, f = e.label || {}, h = e.hoverStyle || {}, u = e.activeStyle || {}, c = e.icon || { enabled: !1 };
|
|
4576
|
+
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
|
+
l && 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);
|
|
4543
4578
|
const C = -n / 2, w = -a / 2;
|
|
4544
4579
|
t.save(), t.scale(S, S), t.beginPath(), this.drawRoundRect(t, C, w, n, a, b);
|
|
4545
4580
|
const M = this.createCanvasFill(t, d, n, a);
|
|
4546
|
-
M && (t.fillStyle = M, t.fill()), (
|
|
4581
|
+
M && (t.fillStyle = M, t.fill()), (v > 0 || r && h.borderColor) && (t.strokeStyle = m, t.lineWidth = v || (r ? 1 : 0), t.stroke());
|
|
4547
4582
|
const I = f.fontSize || 14, k = f.fontFamily || "Inter", T = f.fontWeight || 600;
|
|
4548
|
-
t.font = `${T} ${I}px "${k}", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`, t.fillStyle =
|
|
4583
|
+
t.font = `${T} ${I}px "${k}", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`, t.fillStyle = p, t.textAlign = "center", t.textBaseline = "middle";
|
|
4549
4584
|
let R = 0;
|
|
4550
4585
|
if (c.enabled && c.svgPath) {
|
|
4551
|
-
const P = I * 1.1, _ = c.gap || 8, E = t.measureText(
|
|
4586
|
+
const P = I * 1.1, _ = c.gap || 8, E = t.measureText(y), W = -(E.width + P + _) / 2, z = c.position === "left" ? W + P / 2 : W + E.width + _ + P / 2;
|
|
4552
4587
|
R = c.position === "left" ? W + P + _ + E.width / 2 : W + E.width / 2, t.save(), t.translate(z, 0);
|
|
4553
4588
|
const Y = new Path2D(c.svgPath), G = P / 24;
|
|
4554
|
-
t.scale(G, G), t.translate(-12, -12), t.fillStyle =
|
|
4589
|
+
t.scale(G, G), t.translate(-12, -12), t.fillStyle = p, t.fill(Y), t.restore();
|
|
4555
4590
|
}
|
|
4556
|
-
t.fillText(
|
|
4591
|
+
t.fillText(y, R, 0), t.restore();
|
|
4557
4592
|
}
|
|
4558
4593
|
renderToggleButton(t, i) {
|
|
4559
|
-
var
|
|
4560
|
-
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = e.checked ?? !1, n = ((
|
|
4561
|
-
t.save(), t.beginPath(), this.drawRoundRect(t, r,
|
|
4562
|
-
const d =
|
|
4563
|
-
t.font = `${
|
|
4594
|
+
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, l = -a / 2, f = e.corner_radius ?? 8, h = e.label || {}, u = s ? e.accentColor || "#3b82f6" : e.inactiveColor || "#374151", c = s ? e.activeTextColor || "#ffffff" : e.inactiveTextColor || "#9ca3af";
|
|
4596
|
+
t.save(), t.beginPath(), this.drawRoundRect(t, r, l, n, a, f), t.fillStyle = u, t.fill();
|
|
4597
|
+
const d = h.fontSize || 14, p = h.fontFamily || "Inter";
|
|
4598
|
+
t.font = `${h.fontWeight || 600} ${d}px "${p}", sans-serif`, t.fillStyle = c, t.textAlign = "center", t.textBaseline = "middle", t.fillText(h.text || "Toggle", 0, 0), t.restore();
|
|
4564
4599
|
}
|
|
4565
4600
|
renderToggle(t, i) {
|
|
4566
4601
|
var G, N, J, x, F, j, X, tt, L, O, D, q;
|
|
4567
|
-
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,
|
|
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, l = e.checked ?? !1, f = e.cornerRadius ?? e.corner_radius ?? n / 2, h = e.toggleStyle || {}, u = h.backgroundColor || e.activeColor || "#10b981", c = h.borderColor || e.borderColor || "transparent", d = h.borderWidth ?? e.borderWidth ?? 0, p = h.knobColor || e.knobColor || "#ffffff", y = l ? u : e.inactiveColor || "#374151", b = l ? c : e.borderColor || "transparent", m = l ? d : e.borderWidth ?? 0, v = l ? p : e.knobColor || "#ffffff";
|
|
4568
4603
|
e.disabled && (t.globalAlpha *= 0.5), t.beginPath(), this.drawRoundRect(t, a, r, s, n, f);
|
|
4569
|
-
const S = this.createCanvasFill(t,
|
|
4604
|
+
const S = this.createCanvasFill(t, y, s, n);
|
|
4570
4605
|
if (S && (t.fillStyle = S, t.fill()), m > 0) {
|
|
4571
4606
|
t.lineWidth = m;
|
|
4572
4607
|
const ot = this.createCanvasFill(t, b, s, n);
|
|
4573
4608
|
ot && (t.strokeStyle = ot, t.stroke());
|
|
4574
4609
|
}
|
|
4575
|
-
const C = 2, w = n - C * 2, M = w / 2, I = a + C, k = a + s - C - w, T =
|
|
4610
|
+
const C = 2, w = n - C * 2, M = w / 2, I = a + C, k = a + s - C - w, T = l ? k : I, R = r + C;
|
|
4576
4611
|
t.beginPath(), t.arc(T + M, R + M, M, 0, Math.PI * 2);
|
|
4577
|
-
const P = this.createCanvasFill(t,
|
|
4612
|
+
const P = this.createCanvasFill(t, v, w, w);
|
|
4578
4613
|
P && (t.fillStyle = P, t.fill()), e.disabled && (t.globalAlpha *= 2);
|
|
4579
4614
|
let _ = !1, E = !1;
|
|
4580
|
-
const A = (
|
|
4615
|
+
const A = (l ? (J = h.leftLabel) == null ? void 0 : J.text : null) || ((x = e.leftLabel) == null ? void 0 : x.text) || "", W = (l ? (F = h.leftLabel) == null ? void 0 : F.color : null) || ((j = e.leftLabel) == null ? void 0 : j.color) || "#f3f4f6";
|
|
4581
4616
|
if ((X = e.leftLabel) != null && X.enabled && A) {
|
|
4582
4617
|
const ot = e.leftLabel;
|
|
4583
4618
|
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;
|
|
4584
4619
|
}
|
|
4585
|
-
const z = (
|
|
4620
|
+
const z = (l ? (tt = h.rightLabel) == null ? void 0 : tt.text : null) || ((L = e.rightLabel) == null ? void 0 : L.text) || "", Y = (l ? (O = h.rightLabel) == null ? void 0 : O.color : null) || ((D = e.rightLabel) == null ? void 0 : D.color) || "#f3f4f6";
|
|
4586
4621
|
if ((q = e.rightLabel) != null && q.enabled && z) {
|
|
4587
4622
|
const ot = e.rightLabel;
|
|
4588
4623
|
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;
|
|
@@ -4597,16 +4632,16 @@ class ci {
|
|
|
4597
4632
|
}
|
|
4598
4633
|
renderCheckbox(t, i) {
|
|
4599
4634
|
var S, C;
|
|
4600
|
-
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,
|
|
4601
|
-
e.disabled && (t.globalAlpha *= 0.5), t.beginPath(), this.drawRoundRect(t, a, r, s, n,
|
|
4602
|
-
const
|
|
4603
|
-
if (
|
|
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, l = e.cornerRadius ?? 4, f = e.checked ?? !1, h = e.activeColor || "#3b82f6", u = e.inactiveColor || "transparent", c = e.checkColor || "#ffffff", d = e.borderColor || "#4b5563", p = e.borderWidth ?? 2, y = f ? h : u, b = f ? "transparent" : d, m = f ? 0 : p;
|
|
4636
|
+
e.disabled && (t.globalAlpha *= 0.5), t.beginPath(), this.drawRoundRect(t, a, r, s, n, l);
|
|
4637
|
+
const v = this.createCanvasFill(t, y, s, n);
|
|
4638
|
+
if (v && (t.fillStyle = v, t.fill()), m > 0) {
|
|
4604
4639
|
t.lineWidth = m;
|
|
4605
4640
|
const w = this.createCanvasFill(t, b, s, n);
|
|
4606
4641
|
w && (t.strokeStyle = w, t.stroke());
|
|
4607
4642
|
} else if (f) {
|
|
4608
4643
|
t.lineWidth = 1;
|
|
4609
|
-
const w = this.createCanvasFill(t,
|
|
4644
|
+
const w = this.createCanvasFill(t, h, s, n);
|
|
4610
4645
|
w && (t.strokeStyle = w, t.stroke());
|
|
4611
4646
|
}
|
|
4612
4647
|
if (f) {
|
|
@@ -4626,24 +4661,24 @@ class ci {
|
|
|
4626
4661
|
}
|
|
4627
4662
|
renderRadioGroup(t, i) {
|
|
4628
4663
|
var C, w;
|
|
4629
|
-
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,
|
|
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, l = e.selectedValue, f = e.optionsList || ["Option 1", "Option 2", "Option 3"], h = e.orientation || "vertical", u = e.itemGap !== void 0 ? e.itemGap : 16, c = e.activeColor || "#3b82f6", d = e.inactiveColor || "#4b5563", p = e.textColor || "#ffffff", y = e.fontSize || 14, b = e.fontFamily || "Inter", m = e.fontWeight || 400;
|
|
4630
4665
|
e.disabled && (t.globalAlpha *= 0.5);
|
|
4631
|
-
const
|
|
4632
|
-
if (t.save(), t.font = `${m} ${
|
|
4633
|
-
const M = Math.max(S,
|
|
4666
|
+
const v = 8, S = v * 2;
|
|
4667
|
+
if (t.save(), t.font = `${m} ${y}px "${b}", sans-serif`, t.textBaseline = "middle", t.textAlign = "left", h === "vertical") {
|
|
4668
|
+
const M = Math.max(S, y) + u;
|
|
4634
4669
|
f.forEach((I, k) => {
|
|
4635
|
-
const T = r + k * M +
|
|
4636
|
-
t.beginPath(), t.arc(a +
|
|
4637
|
-
const R =
|
|
4638
|
-
R ? (t.strokeStyle = P || c, t.lineWidth = 2, t.stroke(), t.beginPath(), t.arc(a +
|
|
4670
|
+
const T = r + k * M + v;
|
|
4671
|
+
t.beginPath(), t.arc(a + v, T, v, 0, Math.PI * 2);
|
|
4672
|
+
const R = l === I, P = this.createCanvasFill(t, c, S, S), _ = this.createCanvasFill(t, d, S, S);
|
|
4673
|
+
R ? (t.strokeStyle = P || c, t.lineWidth = 2, t.stroke(), t.beginPath(), t.arc(a + v, T, v / 2, 0, Math.PI * 2), t.fillStyle = P || c, t.fill()) : (t.strokeStyle = _ || d, t.lineWidth = 1.5, t.stroke()), t.fillStyle = p, t.fillText(I, a + S + 8, T);
|
|
4639
4674
|
});
|
|
4640
4675
|
} else {
|
|
4641
4676
|
let M = a;
|
|
4642
4677
|
f.forEach((I) => {
|
|
4643
|
-
const k =
|
|
4644
|
-
t.beginPath(), t.arc(M +
|
|
4678
|
+
const k = l === I, T = t.measureText(I).width;
|
|
4679
|
+
t.beginPath(), t.arc(M + v, 0, v, 0, Math.PI * 2);
|
|
4645
4680
|
const R = this.createCanvasFill(t, c, S, S), P = this.createCanvasFill(t, d, S, S);
|
|
4646
|
-
k ? (t.strokeStyle = R || c, t.lineWidth = 2, t.stroke(), t.beginPath(), t.arc(M +
|
|
4681
|
+
k ? (t.strokeStyle = R || c, t.lineWidth = 2, t.stroke(), t.beginPath(), t.arc(M + v, 0, v / 2, 0, Math.PI * 2), t.fillStyle = R || c, t.fill()) : (t.strokeStyle = P || d, t.lineWidth = 1.5, t.stroke()), t.fillStyle = p, t.fillText(I, M + S + 6, 0), M += S + 6 + T + u;
|
|
4647
4682
|
});
|
|
4648
4683
|
}
|
|
4649
4684
|
if (t.restore(), e.disabled && (t.globalAlpha *= 2), e.label && e.label.text) {
|
|
@@ -4718,13 +4753,13 @@ class ci {
|
|
|
4718
4753
|
}
|
|
4719
4754
|
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();
|
|
4720
4755
|
}
|
|
4721
|
-
}, n = s.width, a = s.height, r = -n / 2,
|
|
4756
|
+
}, n = s.width, a = s.height, r = -n / 2, l = -a / 2;
|
|
4722
4757
|
if (!s.datasets || s.datasets.length === 0 || s.categories.length === 0) {
|
|
4723
4758
|
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();
|
|
4724
4759
|
return;
|
|
4725
4760
|
}
|
|
4726
4761
|
const f = s._getPreset();
|
|
4727
|
-
let
|
|
4762
|
+
let h = -1 / 0, u = 1 / 0;
|
|
4728
4763
|
const c = s.categories.length, d = s.datasets.length;
|
|
4729
4764
|
if (s.chartType === "stacked")
|
|
4730
4765
|
for (let P = 0; P < c; P++) {
|
|
@@ -4732,21 +4767,21 @@ class ci {
|
|
|
4732
4767
|
s.datasets.forEach((A) => {
|
|
4733
4768
|
const W = A.data[P] ?? 0;
|
|
4734
4769
|
W >= 0 ? _ += W : E += W;
|
|
4735
|
-
}), _ >
|
|
4770
|
+
}), _ > h && (h = _), E < u && (u = E);
|
|
4736
4771
|
}
|
|
4737
4772
|
else
|
|
4738
4773
|
s.datasets.forEach((P) => {
|
|
4739
4774
|
P.data && P.data.forEach((_) => {
|
|
4740
|
-
_ >
|
|
4775
|
+
_ > h && (h = _), _ < u && (u = _);
|
|
4741
4776
|
});
|
|
4742
4777
|
});
|
|
4743
|
-
isFinite(
|
|
4744
|
-
const
|
|
4778
|
+
isFinite(h) || (h = 10), isFinite(u) || (u = 0), h = Math.max(h, 0), u = Math.min(u, 0);
|
|
4779
|
+
const p = h - u || 10;
|
|
4745
4780
|
t.save(), s.enableShadows && (t.shadowColor = s.shadowColor, t.shadowBlur = s.shadowBlur, t.shadowOffsetY = s.shadowOffsetY), t.font = s.axisLabelFontSize + "px Inter, sans-serif";
|
|
4746
|
-
const
|
|
4747
|
-
if (s.enableShadows && (t.shadowColor = "transparent"), t.beginPath(), t.roundRect(r,
|
|
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 = l + v, M = n - y - S, I = a - v - b;
|
|
4782
|
+
if (s.enableShadows && (t.shadowColor = "transparent"), t.beginPath(), t.roundRect(r, l, 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, M, I), t.fillStyle = s.chartBackground, t.fill()), s.showLegend && d > 0) {
|
|
4748
4783
|
t.font = s.legendFontSize + "px Inter, sans-serif", t.textBaseline = "middle";
|
|
4749
|
-
const P =
|
|
4784
|
+
const P = l + 12;
|
|
4750
4785
|
let _ = C;
|
|
4751
4786
|
s.datasets.forEach((E, A) => {
|
|
4752
4787
|
const W = s._resolveColor(E.color, A), z = E.label || "Series " + (A + 1), Y = 7;
|
|
@@ -4770,10 +4805,10 @@ class ci {
|
|
|
4770
4805
|
t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "right", t.textBaseline = "middle", t.fillStyle = f.axisLabelColor;
|
|
4771
4806
|
for (let P = 0; P <= k; P++)
|
|
4772
4807
|
if (s.orientation === "horizontal") {
|
|
4773
|
-
const _ =
|
|
4808
|
+
const _ = u + P / k * p, E = C + P / k * M;
|
|
4774
4809
|
t.textAlign = "center", t.fillText(_.toFixed(0), E, w + I + s.axisLabelFontSize);
|
|
4775
4810
|
} else {
|
|
4776
|
-
const _ =
|
|
4811
|
+
const _ = h - P / k * p, E = w + P / k * I;
|
|
4777
4812
|
t.textAlign = "right", t.fillText(_.toFixed(0), C - 6, E);
|
|
4778
4813
|
}
|
|
4779
4814
|
}
|
|
@@ -4787,7 +4822,7 @@ class ci {
|
|
|
4787
4822
|
s.datasets.forEach((W, z) => {
|
|
4788
4823
|
const Y = W.data[_] ?? 0;
|
|
4789
4824
|
if (Y === 0) return;
|
|
4790
|
-
const G = Y /
|
|
4825
|
+
const G = Y / p * M, N = Math.min(s.barWidth * d + s.barGap, P - 8), J = E - N / 2, x = A;
|
|
4791
4826
|
A += G;
|
|
4792
4827
|
const F = s._resolveColor(W.color, z);
|
|
4793
4828
|
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();
|
|
@@ -4802,7 +4837,7 @@ class ci {
|
|
|
4802
4837
|
s.datasets.forEach((W, z) => {
|
|
4803
4838
|
const Y = W.data[_] ?? 0;
|
|
4804
4839
|
if (Y === 0) return;
|
|
4805
|
-
const G = Y /
|
|
4840
|
+
const G = Y / p * I, N = Math.min(s.barWidth * d + s.barGap, P - 8), J = E - N / 2, x = A - G;
|
|
4806
4841
|
A -= G;
|
|
4807
4842
|
const F = s._resolveColor(W.color, z);
|
|
4808
4843
|
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();
|
|
@@ -4810,26 +4845,26 @@ class ci {
|
|
|
4810
4845
|
}
|
|
4811
4846
|
}
|
|
4812
4847
|
else if (s.orientation === "horizontal") {
|
|
4813
|
-
const P = I / c, _ = d * s.barWidth + Math.max(0, (d - 1) * s.barGap), E = C + (0 -
|
|
4848
|
+
const P = I / c, _ = d * s.barWidth + Math.max(0, (d - 1) * s.barGap), E = C + (0 - u) / p * M;
|
|
4814
4849
|
for (let A = 0; A < c; A++) {
|
|
4815
4850
|
const W = w + A * P + P / 2;
|
|
4816
4851
|
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));
|
|
4817
4852
|
const z = W - _ / 2;
|
|
4818
4853
|
s.datasets.forEach((Y, G) => {
|
|
4819
|
-
const N = Y.data[A] ?? 0, J = Math.abs(N /
|
|
4854
|
+
const N = Y.data[A] ?? 0, J = Math.abs(N / p * M);
|
|
4820
4855
|
if (J < 1) return;
|
|
4821
4856
|
const x = z + G * (s.barWidth + s.barGap), F = N >= 0 ? E : E - J, j = s._resolveColor(Y.color, G);
|
|
4822
4857
|
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));
|
|
4823
4858
|
});
|
|
4824
4859
|
}
|
|
4825
4860
|
} else {
|
|
4826
|
-
const P = M / c, _ = d * s.barWidth + Math.max(0, (d - 1) * s.barGap), E = w + I - (0 -
|
|
4861
|
+
const P = M / c, _ = d * s.barWidth + Math.max(0, (d - 1) * s.barGap), E = w + I - (0 - u) / p * I;
|
|
4827
4862
|
for (let A = 0; A < c; A++) {
|
|
4828
4863
|
const W = C + A * P + P / 2;
|
|
4829
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 + I + 5), s.enableShadows && (t.shadowColor = s.shadowColor));
|
|
4830
4865
|
const z = W - _ / 2;
|
|
4831
4866
|
s.datasets.forEach((Y, G) => {
|
|
4832
|
-
const N = Y.data[A] ?? 0, J = Math.abs(N /
|
|
4867
|
+
const N = Y.data[A] ?? 0, J = Math.abs(N / p * I);
|
|
4833
4868
|
if (J < 1) return;
|
|
4834
4869
|
const x = z + G * (s.barWidth + s.barGap), F = N >= 0 ? E - J : E, j = s._resolveColor(Y.color, G);
|
|
4835
4870
|
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));
|
|
@@ -4839,9 +4874,9 @@ class ci {
|
|
|
4839
4874
|
t.restore();
|
|
4840
4875
|
}
|
|
4841
4876
|
renderPieChart(t, i) {
|
|
4842
|
-
var
|
|
4877
|
+
var y, b;
|
|
4843
4878
|
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = {
|
|
4844
|
-
width: ((
|
|
4879
|
+
width: ((y = i.geometry) == null ? void 0 : y.width) || 180,
|
|
4845
4880
|
height: ((b = i.geometry) == null ? void 0 : b.height) || 180,
|
|
4846
4881
|
chartType: e.chartType || "donut",
|
|
4847
4882
|
stylePreset: e.stylePreset || "default",
|
|
@@ -4861,8 +4896,8 @@ class ci {
|
|
|
4861
4896
|
_getPreset: function() {
|
|
4862
4897
|
return us[this.stylePreset] || us.default;
|
|
4863
4898
|
},
|
|
4864
|
-
_resolveSliceColor: function(m,
|
|
4865
|
-
const S = m.color, C =
|
|
4899
|
+
_resolveSliceColor: function(m, v) {
|
|
4900
|
+
const S = m.color, C = v, w = this._getPreset();
|
|
4866
4901
|
return ["#6366f1", "#22d3ee", "#f59e0b", "#ec4899", "#34d399", "#a855f7", "#f87171"].includes(S) ? w.colors[C % w.colors.length] : typeof S == "string" ? S : w.colors[C % w.colors.length];
|
|
4867
4902
|
}
|
|
4868
4903
|
}, n = s.width, a = s.height;
|
|
@@ -4870,27 +4905,27 @@ class ci {
|
|
|
4870
4905
|
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("NO PIE DATA", 0, 0), t.restore();
|
|
4871
4906
|
return;
|
|
4872
4907
|
}
|
|
4873
|
-
const r = s.slices.reduce((m,
|
|
4908
|
+
const r = s.slices.reduce((m, v) => m + (v.value || 0), 0);
|
|
4874
4909
|
if (r <= 0) {
|
|
4875
4910
|
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();
|
|
4876
4911
|
return;
|
|
4877
4912
|
}
|
|
4878
|
-
const
|
|
4879
|
-
t.save(), t.beginPath(), t.roundRect(-n / 2, -a / 2, n, a, 10), t.fillStyle =
|
|
4880
|
-
const f = s.showLegend ? Math.ceil(s.slices.length / 2) : 0,
|
|
4913
|
+
const l = s._getPreset();
|
|
4914
|
+
t.save(), t.beginPath(), t.roundRect(-n / 2, -a / 2, n, a, 10), t.fillStyle = l.cardBackground, t.fill(), t.strokeStyle = l.cardBorderColor, t.lineWidth = 1, t.stroke();
|
|
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, c = Math.min(n - 24, u) / 2, d = 0, p = -h / 2;
|
|
4881
4916
|
if (s.chartType === "rose") {
|
|
4882
|
-
const m = Math.max(...s.slices.map((C) => C.value || 0)),
|
|
4917
|
+
const m = Math.max(...s.slices.map((C) => C.value || 0)), v = Math.PI * 2 / s.slices.length, S = c > 0 ? s.sliceGap / c : 0;
|
|
4883
4918
|
s.slices.forEach((C, w) => {
|
|
4884
4919
|
const M = C.value || 0;
|
|
4885
4920
|
if (M === 0) return;
|
|
4886
|
-
const I = M / m * c, k = -Math.PI / 2 + w *
|
|
4887
|
-
if (t.beginPath(), t.moveTo(d,
|
|
4888
|
-
const P = k + (T - k) / 2, _ = d + I * 0.65 * Math.cos(P), E =
|
|
4889
|
-
t.save(), t.font = `bold ${s.labelFontSize}px Inter, sans-serif`, t.fillStyle =
|
|
4921
|
+
const I = M / m * c, k = -Math.PI / 2 + w * v + S / 2, T = k + v - S, R = s._resolveSliceColor(C, w);
|
|
4922
|
+
if (t.beginPath(), t.moveTo(d, p), t.arc(d, p, I, k, T), t.closePath(), t.fillStyle = R + "cc", t.fill(), t.strokeStyle = R, t.lineWidth = 1.5, t.stroke(), s.showLabels) {
|
|
4923
|
+
const P = k + (T - k) / 2, _ = d + I * 0.65 * Math.cos(P), E = p + I * 0.65 * Math.sin(P), A = Math.round(M / r * 100);
|
|
4924
|
+
t.save(), t.font = `bold ${s.labelFontSize}px Inter, sans-serif`, t.fillStyle = l.labelColor, t.textAlign = "center", t.textBaseline = "middle", t.fillText(`${A}%`, _, E), t.restore();
|
|
4890
4925
|
}
|
|
4891
4926
|
});
|
|
4892
4927
|
} else {
|
|
4893
|
-
const m = s.chartType === "pie" ? 0 : s.innerRadius,
|
|
4928
|
+
const m = s.chartType === "pie" ? 0 : s.innerRadius, v = c * Math.max(0, m), S = c > 0 ? s.sliceGap / c : 0;
|
|
4894
4929
|
let C = -Math.PI / 2;
|
|
4895
4930
|
if (s.slices.forEach((w, M) => {
|
|
4896
4931
|
const I = w.value || 0;
|
|
@@ -4904,23 +4939,23 @@ class ci {
|
|
|
4904
4939
|
return;
|
|
4905
4940
|
}
|
|
4906
4941
|
const P = s._resolveSliceColor(w, M);
|
|
4907
|
-
if (t.beginPath(), t.fillStyle = P,
|
|
4908
|
-
const _ = T + (R - T) / 2, E =
|
|
4909
|
-
t.save(), t.font = `bold ${s.labelFontSize}px Inter, sans-serif`, t.fillStyle =
|
|
4942
|
+
if (t.beginPath(), t.fillStyle = P, v <= 0 ? (t.moveTo(d, p), t.arc(d, p, c, T, R), t.lineTo(d, p)) : (t.moveTo(d + c * Math.cos(T), p + c * Math.sin(T)), t.arc(d, p, c, T, R), t.arc(d, p, v, R, T, !0), t.closePath()), t.fill(), s.showLabels) {
|
|
4943
|
+
const _ = T + (R - T) / 2, E = v + (c - v) / 2, A = d + E * Math.cos(_), W = p + E * Math.sin(_), z = Math.round(I / r * 100);
|
|
4944
|
+
t.save(), t.font = `bold ${s.labelFontSize}px Inter, sans-serif`, t.fillStyle = l.labelColor, t.textAlign = "center", t.textBaseline = "middle", t.fillText(`${z}%`, A, W), t.restore();
|
|
4910
4945
|
}
|
|
4911
4946
|
C += k;
|
|
4912
|
-
}), s.chartType === "donut" && s.showCenterText &&
|
|
4913
|
-
const w = Math.round(r), M = Math.min(Math.floor(
|
|
4914
|
-
t.textAlign = "center", t.textBaseline = "middle", t.font = `bold ${M}px Inter, sans-serif`, t.fillStyle =
|
|
4947
|
+
}), s.chartType === "donut" && s.showCenterText && v > 14) {
|
|
4948
|
+
const w = Math.round(r), M = Math.min(Math.floor(v * 0.52), 20), I = Math.min(Math.floor(v * 0.26), 10);
|
|
4949
|
+
t.textAlign = "center", t.textBaseline = "middle", t.font = `bold ${M}px Inter, sans-serif`, t.fillStyle = l.centerTextColor, t.fillText(w.toString(), d, p - I * 0.5), s.centerLabel && (t.font = `${I}px Inter, sans-serif`, t.fillStyle = l.centerLabelColor, t.fillText(s.centerLabel, d, p + M * 0.6));
|
|
4915
4950
|
}
|
|
4916
4951
|
}
|
|
4917
4952
|
if (s.showLegend && s.slices.length > 0) {
|
|
4918
4953
|
t.font = `${s.legendFontSize}px Inter, sans-serif`;
|
|
4919
|
-
const m = 2,
|
|
4954
|
+
const m = 2, v = n / m, S = s.legendFontSize + 8, C = a / 2 - h + 10, w = -n / 2 + 10;
|
|
4920
4955
|
s.slices.forEach((M, I) => {
|
|
4921
|
-
const k = I % m, T = Math.floor(I / m), R = w + k *
|
|
4922
|
-
t.beginPath(), t.roundRect(R, P - E / 2, E, E, 2), t.fillStyle = _, t.fill(), t.textAlign = "left", t.textBaseline = "middle", t.fillStyle =
|
|
4923
|
-
const A = Math.round((M.value || 0) / r * 100), W = `${M.label || "Item"} ${A}%`, z =
|
|
4956
|
+
const k = I % m, T = Math.floor(I / m), R = w + k * v, P = C + T * S, _ = s._resolveSliceColor(M, I), E = 7;
|
|
4957
|
+
t.beginPath(), t.roundRect(R, P - E / 2, E, E, 2), t.fillStyle = _, t.fill(), t.textAlign = "left", t.textBaseline = "middle", t.fillStyle = l.legendColor;
|
|
4958
|
+
const A = Math.round((M.value || 0) / r * 100), W = `${M.label || "Item"} ${A}%`, z = v - E - 20;
|
|
4924
4959
|
let Y = W;
|
|
4925
4960
|
for (; t.measureText(Y).width > z && Y.length > 4; )
|
|
4926
4961
|
Y = Y.slice(0, -4) + "…";
|
|
@@ -4930,33 +4965,33 @@ class ci {
|
|
|
4930
4965
|
t.restore();
|
|
4931
4966
|
}
|
|
4932
4967
|
renderJoystick(t, i) {
|
|
4933
|
-
var
|
|
4934
|
-
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.width) !== void 0 ? o.width : ((
|
|
4935
|
-
let r = i.handleX || 0,
|
|
4936
|
-
o && o.handleX !== void 0 && (r = o.handleX), o && o.handleY !== void 0 && (
|
|
4937
|
-
let f = 0,
|
|
4938
|
-
i.handleOrigin === "top-left" ? (f = e / 2,
|
|
4939
|
-
const
|
|
4968
|
+
var p, y, b, m, v;
|
|
4969
|
+
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, l = i.handleY || 0;
|
|
4971
|
+
o && o.handleX !== void 0 && (r = o.handleX), o && o.handleY !== void 0 && (l = o.handleY), t.save();
|
|
4972
|
+
let f = 0, h = 0;
|
|
4973
|
+
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
|
+
const u = n - a;
|
|
4940
4975
|
let c = 0, d = 0;
|
|
4941
|
-
i.joystickType === "2D" ? (c = r *
|
|
4976
|
+
i.joystickType === "2D" ? (c = r * u, d = l * u) : i.joystickType === "1D_X" ? (c = r * u, d = 0) : i.joystickType === "1D_Y" && (c = 0, d = l * u), t.beginPath(), t.arc(c, 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();
|
|
4942
4977
|
}
|
|
4943
4978
|
getRadioGroupItemIndexAtPointer(t, i, o) {
|
|
4944
4979
|
var I, k;
|
|
4945
4980
|
const e = t.options || {}, s = this.objectStates.get(t.id) || {}, n = e.optionsList || [];
|
|
4946
4981
|
if (n.length === 0) return null;
|
|
4947
|
-
const a = s.width !== void 0 ? s.width : ((I = t.geometry) == null ? void 0 : I.width) || 180, r = s.height !== void 0 ? s.height : ((k = t.geometry) == null ? void 0 : k.height) || 100,
|
|
4948
|
-
if (
|
|
4949
|
-
const T = Math.max(C,
|
|
4982
|
+
const a = s.width !== void 0 ? s.width : ((I = t.geometry) == null ? void 0 : I.width) || 180, r = s.height !== void 0 ? s.height : ((k = t.geometry) == null ? void 0 : k.height) || 100, l = e.orientation || "vertical", f = e.itemGap !== void 0 ? e.itemGap : 16, h = e.fontSize || 14, u = this.getWorldTransform(t.id), c = i - u.x, d = o - u.y, p = -u.rotation * (Math.PI / 180), y = Math.cos(p), b = Math.sin(p), m = c * y - d * b, v = c * b + d * y, C = 8 * 2, w = -a / 2, M = -r / 2;
|
|
4983
|
+
if (l === "vertical") {
|
|
4984
|
+
const T = Math.max(C, h) + f;
|
|
4950
4985
|
for (let R = 0; R < n.length; R++) {
|
|
4951
4986
|
const P = M + R * T;
|
|
4952
|
-
if (m >= w && m <= w + a &&
|
|
4987
|
+
if (m >= w && m <= w + a && v >= P && v <= P + T)
|
|
4953
4988
|
return R;
|
|
4954
4989
|
}
|
|
4955
4990
|
} else {
|
|
4956
4991
|
let T = w;
|
|
4957
4992
|
for (let R = 0; R < n.length; R++) {
|
|
4958
4993
|
const _ = n[R].length * 8, E = C + 6 + _ + f;
|
|
4959
|
-
if (m >= T && m <= T + E &&
|
|
4994
|
+
if (m >= T && m <= T + E && v >= M && v <= M + r)
|
|
4960
4995
|
return R;
|
|
4961
4996
|
T += E;
|
|
4962
4997
|
}
|
|
@@ -4979,92 +5014,92 @@ class ci {
|
|
|
4979
5014
|
pointFill: i.pointFill || "#ffffff",
|
|
4980
5015
|
pointStrokeColor: i.pointStrokeColor || i.lineColor || "#3b82f6",
|
|
4981
5016
|
pointStrokeWidth: i.pointStrokeWidth || 2
|
|
4982
|
-
}]), !s || s.length === 0 || !s.some((
|
|
5017
|
+
}]), !s || s.length === 0 || !s.some((p) => p.data && p.data.length >= 2)) {
|
|
4983
5018
|
t.save(), t.fillStyle = "#6366f1", t.font = "12px Inter, system-ui, sans-serif", t.textAlign = "center", t.textBaseline = "middle", t.fillText("NO DATA", 0, 0), t.restore();
|
|
4984
5019
|
return;
|
|
4985
5020
|
}
|
|
4986
5021
|
let n = 1 / 0, a = -1 / 0, r = 0;
|
|
4987
|
-
if (s.forEach((
|
|
4988
|
-
let
|
|
4989
|
-
if (
|
|
4990
|
-
let b = this.inputs.get(
|
|
5022
|
+
if (s.forEach((p) => {
|
|
5023
|
+
let y = p.data;
|
|
5024
|
+
if (p.isVarEnabled && p.inputId) {
|
|
5025
|
+
let b = this.inputs.get(p.inputId);
|
|
4991
5026
|
if (b === void 0) {
|
|
4992
|
-
const m = this.inputNameMap.get(
|
|
5027
|
+
const m = this.inputNameMap.get(p.inputId);
|
|
4993
5028
|
m && m.length > 0 && (b = this.inputs.get(m[0]));
|
|
4994
5029
|
}
|
|
4995
|
-
b && Array.isArray(b) && (
|
|
5030
|
+
b && Array.isArray(b) && (y = b);
|
|
4996
5031
|
}
|
|
4997
|
-
if (
|
|
4998
|
-
const b =
|
|
4999
|
-
b.length > 0 && (n = Math.min(n, ...b), a = Math.max(a, ...b), r = Math.max(r,
|
|
5032
|
+
if (y && y.length > 0) {
|
|
5033
|
+
const b = y.filter((m) => typeof m == "number" && !isNaN(m));
|
|
5034
|
+
b.length > 0 && (n = Math.min(n, ...b), a = Math.max(a, ...b), r = Math.max(r, y.length));
|
|
5000
5035
|
}
|
|
5001
|
-
|
|
5036
|
+
p._resolvedData = y;
|
|
5002
5037
|
}), r < 2) return;
|
|
5003
|
-
const
|
|
5004
|
-
const
|
|
5005
|
-
return e / 2 -
|
|
5006
|
-
},
|
|
5038
|
+
const l = a - n, f = o / (r - 1), h = (p) => {
|
|
5039
|
+
const y = l === 0 ? 0.5 : (p - n) / l;
|
|
5040
|
+
return e / 2 - y * e;
|
|
5041
|
+
}, u = (p) => p * f - o / 2, c = i.axisColor || "#333333";
|
|
5007
5042
|
if (i.showXAxis && (t.beginPath(), t.strokeStyle = i.xAxisColor || c, 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 || c, 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) {
|
|
5008
5043
|
t.textAlign = "center", t.textBaseline = "top";
|
|
5009
|
-
for (let
|
|
5010
|
-
const
|
|
5011
|
-
t.fillText(`${
|
|
5044
|
+
for (let p = 0; p < r; p++) {
|
|
5045
|
+
const y = u(p);
|
|
5046
|
+
t.fillText(`${p + 1}`, y, e / 2 + 5);
|
|
5012
5047
|
}
|
|
5013
5048
|
}
|
|
5014
5049
|
if (i.showYLabels) {
|
|
5015
5050
|
t.textAlign = "right", t.textBaseline = "middle";
|
|
5016
|
-
const
|
|
5017
|
-
t.fillText(a.toFixed(1),
|
|
5051
|
+
const p = -o / 2 - 5, y = (a + n) / 2;
|
|
5052
|
+
t.fillText(a.toFixed(1), p, h(a)), t.fillText(y.toFixed(1), p, h(y)), t.fillText(n.toFixed(1), p, h(n));
|
|
5018
5053
|
}
|
|
5019
5054
|
const d = 10;
|
|
5020
|
-
if (s.forEach((
|
|
5021
|
-
const
|
|
5022
|
-
if (!(!
|
|
5023
|
-
if (
|
|
5024
|
-
if (t.beginPath(), t.moveTo(
|
|
5025
|
-
for (let m = 0; m <
|
|
5026
|
-
const
|
|
5055
|
+
if (s.forEach((p) => {
|
|
5056
|
+
const y = p._resolvedData;
|
|
5057
|
+
if (!(!y || y.length < 2)) {
|
|
5058
|
+
if (p.showArea) {
|
|
5059
|
+
if (t.beginPath(), t.moveTo(u(0), e / 2), t.lineTo(u(0), h(y[0])), p.smoothing && y.length > 2)
|
|
5060
|
+
for (let m = 0; m < y.length - 1; m++) {
|
|
5061
|
+
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];
|
|
5027
5062
|
for (let M = 1; M <= d; M++) {
|
|
5028
|
-
const I = M / d, k = this._catmullRom(
|
|
5029
|
-
t.lineTo(
|
|
5063
|
+
const I = M / d, k = this._catmullRom(v, S, C, w, I);
|
|
5064
|
+
t.lineTo(u(m + I), h(k));
|
|
5030
5065
|
}
|
|
5031
5066
|
}
|
|
5032
5067
|
else
|
|
5033
|
-
for (let m = 1; m <
|
|
5034
|
-
t.lineTo(
|
|
5035
|
-
t.lineTo(
|
|
5068
|
+
for (let m = 1; m < y.length; m++)
|
|
5069
|
+
t.lineTo(u(m), h(y[m]));
|
|
5070
|
+
t.lineTo(u(y.length - 1), e / 2), t.closePath();
|
|
5036
5071
|
const b = t.globalAlpha;
|
|
5037
|
-
t.globalAlpha = b * (i.areaOpacity ?? 0.3), t.fillStyle =
|
|
5072
|
+
t.globalAlpha = b * (i.areaOpacity ?? 0.3), t.fillStyle = p.areaColor || "rgba(139, 92, 246, 0.2)", t.fill(), t.globalAlpha = b;
|
|
5038
5073
|
}
|
|
5039
|
-
if (t.beginPath(), t.strokeStyle =
|
|
5040
|
-
for (let b = 0; b <
|
|
5041
|
-
const m =
|
|
5074
|
+
if (t.beginPath(), t.strokeStyle = p.lineColor || "#3b82f6", t.lineWidth = p.lineWidth || 2, t.lineJoin = "round", t.lineCap = "round", t.moveTo(u(0), h(y[0])), p.smoothing && y.length > 2)
|
|
5075
|
+
for (let b = 0; b < y.length - 1; b++) {
|
|
5076
|
+
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];
|
|
5042
5077
|
for (let w = 1; w <= d; w++) {
|
|
5043
|
-
const M = w / d, I = this._catmullRom(m,
|
|
5044
|
-
t.lineTo(
|
|
5078
|
+
const M = w / d, I = this._catmullRom(m, v, S, C, M);
|
|
5079
|
+
t.lineTo(u(b + M), h(I));
|
|
5045
5080
|
}
|
|
5046
5081
|
}
|
|
5047
5082
|
else
|
|
5048
|
-
for (let b = 1; b <
|
|
5049
|
-
t.lineTo(
|
|
5050
|
-
t.stroke(),
|
|
5051
|
-
const
|
|
5052
|
-
t.beginPath(), t.arc(
|
|
5083
|
+
for (let b = 1; b < y.length; b++)
|
|
5084
|
+
t.lineTo(u(b), h(y[b]));
|
|
5085
|
+
t.stroke(), p.showPoints && y.forEach((b, m) => {
|
|
5086
|
+
const v = u(m), S = h(b);
|
|
5087
|
+
t.beginPath(), t.arc(v, S, (p.pointSize || 6) / 2, 0, Math.PI * 2), t.fillStyle = p.pointFill || "#ffffff", t.fill(), t.strokeStyle = p.pointStrokeColor || p.lineColor || "#3b82f6", t.lineWidth = p.pointStrokeWidth || 1, t.stroke();
|
|
5053
5088
|
});
|
|
5054
5089
|
}
|
|
5055
5090
|
}), i.showLegend && s.length > 0) {
|
|
5056
|
-
const
|
|
5057
|
-
let
|
|
5091
|
+
const p = o / 2 - 10;
|
|
5092
|
+
let y = -e / 2 + 15;
|
|
5058
5093
|
const b = i.legendFontSize || 10, m = b + 5;
|
|
5059
|
-
t.font = `${b}px Inter, sans-serif`, t.textAlign = "right", t.textBaseline = "alphabetic", s.forEach((
|
|
5060
|
-
const C =
|
|
5061
|
-
t.beginPath(), t.rect(
|
|
5094
|
+
t.font = `${b}px Inter, sans-serif`, t.textAlign = "right", t.textBaseline = "alphabetic", s.forEach((v) => {
|
|
5095
|
+
const C = v.label || "Series", w = t.measureText(C).width;
|
|
5096
|
+
t.beginPath(), t.rect(p - w - 8 - 5, y - (8 / 2 + 2), 8, 8), t.fillStyle = v.lineColor || "#3b82f6", t.fill(), t.fillStyle = i.legendColor || "#333333", t.fillText(C, p, y), y += m;
|
|
5062
5097
|
});
|
|
5063
5098
|
}
|
|
5064
5099
|
}
|
|
5065
5100
|
_catmullRom(t, i, o, e, s) {
|
|
5066
|
-
const n = (o - t) * 0.5, a = (e - i) * 0.5, r = s * s,
|
|
5067
|
-
return (2 * i - 2 * o + n + a) *
|
|
5101
|
+
const n = (o - t) * 0.5, a = (e - i) * 0.5, r = s * s, l = s * r;
|
|
5102
|
+
return (2 * i - 2 * o + n + a) * l + (-3 * i + 3 * o - 2 * n - a) * r + n * s + i;
|
|
5068
5103
|
}
|
|
5069
5104
|
normalizeOpacity(t) {
|
|
5070
5105
|
const i = typeof t == "number" ? t : parseFloat(String(t));
|
|
@@ -5079,55 +5114,55 @@ class ci {
|
|
|
5079
5114
|
return t.fillStyle = f, f;
|
|
5080
5115
|
}
|
|
5081
5116
|
if ((i.type === "LinearGradient" || i.type === "RadialGradient" || i.type === "AngularGradient" || i.type === "DiamondGradient") && i.stops) {
|
|
5082
|
-
const r = (
|
|
5117
|
+
const r = (l, f = 100) => {
|
|
5083
5118
|
var S, C;
|
|
5084
|
-
const
|
|
5085
|
-
if (
|
|
5086
|
-
const
|
|
5087
|
-
return `rgba(${b}, ${m}, ${
|
|
5119
|
+
const u = (((C = (S = this.artboard) == null ? void 0 : S.tokens) == null ? void 0 : C.colors) || {})[l] || l, c = this.normalizeOpacity(i.opacity ?? 100), p = this.normalizeOpacity(f) * c;
|
|
5120
|
+
if (p >= 1 && u.startsWith("#")) return u;
|
|
5121
|
+
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
|
+
return `rgba(${b}, ${m}, ${v}, ${p})`;
|
|
5088
5123
|
};
|
|
5089
5124
|
if (i.type === "LinearGradient") {
|
|
5090
|
-
const
|
|
5091
|
-
if (i.stops.forEach((
|
|
5092
|
-
const
|
|
5093
|
-
d.addColorStop(Math.max(0, Math.min(1,
|
|
5125
|
+
const l = (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 = l(i.start, 0, "x") * o - o / 2, h = l(i.start, 1, "y") * e - e / 2, u = l(i.end, 0, "x") * o - o / 2, c = l(i.end, 1, "y") * e - e / 2, d = t.createLinearGradient(f, h, u, c);
|
|
5126
|
+
if (i.stops.forEach((p) => {
|
|
5127
|
+
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
|
+
d.addColorStop(Math.max(0, Math.min(1, y)), b);
|
|
5094
5129
|
}), i.gradientTransform && d.setTransform) {
|
|
5095
|
-
const [
|
|
5096
|
-
d.setTransform({ a:
|
|
5130
|
+
const [p, y, b, m, v, S] = i.gradientTransform;
|
|
5131
|
+
d.setTransform({ a: p, b: y, c: b, d: m, e: v, f: S });
|
|
5097
5132
|
}
|
|
5098
5133
|
return d;
|
|
5099
5134
|
} else if (i.type === "RadialGradient") {
|
|
5100
|
-
const
|
|
5135
|
+
const l = (d, p, y) => Array.isArray(d) ? d[p] ?? 0.5 : d && typeof d == "object" ? d[y] ?? 0.5 : 0.5, f = l(i.center, 0, "x") * o - o / 2, h = l(i.center, 1, "y") * e - e / 2, u = (i.radius ?? 0.5) * Math.max(o, e), c = t.createRadialGradient(f, h, 0, f, h, u);
|
|
5101
5136
|
if (i.stops.forEach((d) => {
|
|
5102
|
-
const
|
|
5103
|
-
c.addColorStop(Math.max(0, Math.min(1,
|
|
5137
|
+
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
|
+
c.addColorStop(Math.max(0, Math.min(1, p)), y);
|
|
5104
5139
|
}), i.gradientTransform && c.setTransform) {
|
|
5105
|
-
const [d,
|
|
5106
|
-
c.setTransform({ a: d, b:
|
|
5140
|
+
const [d, p, y, b, m, v] = i.gradientTransform;
|
|
5141
|
+
c.setTransform({ a: d, b: p, c: y, d: b, e: m, f: v });
|
|
5107
5142
|
}
|
|
5108
5143
|
return c;
|
|
5109
5144
|
} else if (i.type === "AngularGradient") {
|
|
5110
|
-
const
|
|
5145
|
+
const l = (d, p, y) => Array.isArray(d) ? d[p] ?? 0.5 : d && typeof d == "object" ? d[y] ?? 0.5 : 0.5, f = l(i.center || [0.5, 0.5], 0, "x") * o - o / 2, h = l(i.center || [0.5, 0.5], 1, "y") * e - e / 2, u = (i.degree || i.angle || 0) * (Math.PI / 180), c = (a = t.createConicGradient) == null ? void 0 : a.call(t, u, f, h);
|
|
5111
5146
|
if (c) {
|
|
5112
5147
|
if (i.stops.forEach((d) => {
|
|
5113
|
-
const
|
|
5114
|
-
c.addColorStop(Math.max(0, Math.min(1,
|
|
5148
|
+
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
|
+
c.addColorStop(Math.max(0, Math.min(1, p)), y);
|
|
5115
5150
|
}), i.gradientTransform && c.setTransform) {
|
|
5116
|
-
const [d,
|
|
5117
|
-
c.setTransform({ a: d, b:
|
|
5151
|
+
const [d, p, y, b, m, v] = i.gradientTransform;
|
|
5152
|
+
c.setTransform({ a: d, b: p, c: y, d: b, e: m, f: v });
|
|
5118
5153
|
}
|
|
5119
5154
|
return c;
|
|
5120
5155
|
}
|
|
5121
5156
|
} else if (i.type === "DiamondGradient") {
|
|
5122
|
-
const
|
|
5123
|
-
t.save(), t.translate(f,
|
|
5124
|
-
const c = t.createRadialGradient(0, 0, 0, 0, 0,
|
|
5157
|
+
const l = (d, p, y) => Array.isArray(d) ? d[p] ?? 0.5 : d && typeof d == "object" ? d[y] ?? 0.5 : 0.5, f = l(i.center || [0.5, 0.5], 0, "x") * o - o / 2, h = l(i.center || [0.5, 0.5], 1, "y") * e - e / 2, u = (i.radius ?? 0.5) * Math.max(o, e);
|
|
5158
|
+
t.save(), t.translate(f, h), t.rotate(Math.PI / 4);
|
|
5159
|
+
const c = t.createRadialGradient(0, 0, 0, 0, 0, u);
|
|
5125
5160
|
if (i.stops.forEach((d) => {
|
|
5126
|
-
const
|
|
5127
|
-
c.addColorStop(Math.max(0, Math.min(1,
|
|
5161
|
+
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
|
+
c.addColorStop(Math.max(0, Math.min(1, p)), y);
|
|
5128
5163
|
}), i.gradientTransform && c.setTransform) {
|
|
5129
|
-
const [d,
|
|
5130
|
-
c.setTransform({ a: d, b:
|
|
5164
|
+
const [d, p, y, b, m, v] = i.gradientTransform;
|
|
5165
|
+
c.setTransform({ a: d, b: p, c: y, d: b, e: m, f: v });
|
|
5131
5166
|
}
|
|
5132
5167
|
return t.scale(1 / Math.SQRT2, 1 / Math.SQRT2), t.fillStyle = c, t.restore(), c;
|
|
5133
5168
|
}
|
|
@@ -5135,12 +5170,12 @@ class ci {
|
|
|
5135
5170
|
if (i.type === "Pattern" && i.url) {
|
|
5136
5171
|
let r = this.imageCache.get(i.url);
|
|
5137
5172
|
if (r || (r = new Image(), r.src = i.url, this.imageCache.set(i.url, r)), r.complete && r.naturalWidth > 0) {
|
|
5138
|
-
const
|
|
5139
|
-
if (
|
|
5140
|
-
const f = new DOMMatrix(),
|
|
5141
|
-
f.translateSelf(c, d), f.rotateSelf(
|
|
5173
|
+
const l = t.createPattern(r, "repeat");
|
|
5174
|
+
if (l && (i.scaleX !== void 0 || i.offsetX !== void 0)) {
|
|
5175
|
+
const f = new DOMMatrix(), h = i.scaleX ?? 1, u = i.scaleY ?? 1, c = i.offsetX ?? 0, d = i.offsetY ?? 0, p = i.rotation ?? 0;
|
|
5176
|
+
f.translateSelf(c, d), f.rotateSelf(p), f.scaleSelf(h, u), l.setTransform(f);
|
|
5142
5177
|
}
|
|
5143
|
-
return
|
|
5178
|
+
return l;
|
|
5144
5179
|
}
|
|
5145
5180
|
}
|
|
5146
5181
|
return i.color || null;
|
|
@@ -5157,43 +5192,43 @@ class ci {
|
|
|
5157
5192
|
} catch {
|
|
5158
5193
|
a = parseFloat(a) || 0;
|
|
5159
5194
|
}
|
|
5160
|
-
let r = 0,
|
|
5161
|
-
typeof a == "number" ? r =
|
|
5162
|
-
const
|
|
5163
|
-
if (r = Math.min(Math.max(0, r),
|
|
5164
|
-
t.roundRect(i, o, e, s, [r,
|
|
5195
|
+
let r = 0, l = 0, f = 0, h = 0;
|
|
5196
|
+
typeof a == "number" ? r = l = f = h = a : Array.isArray(a) ? a.length === 1 ? r = l = f = h = a[0] : a.length === 2 ? (r = f = a[0], l = h = a[1]) : a.length === 3 ? (r = a[0], l = h = a[1], f = a[2]) : a.length >= 4 && (r = a[0], l = a[1], f = a[2], h = a[3]) : a && typeof a == "object" && (r = a.tl ?? a.corner_radius ?? a.cornerRadius ?? 0, l = 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
|
+
const u = Math.min(Math.abs(e) / 2, Math.abs(s) / 2);
|
|
5198
|
+
if (r = Math.min(Math.max(0, r), u), l = Math.min(Math.max(0, l), u), f = Math.min(Math.max(0, f), u), h = Math.min(Math.max(0, h), u), t.roundRect) {
|
|
5199
|
+
t.roundRect(i, o, e, s, [r, l, f, h]);
|
|
5165
5200
|
return;
|
|
5166
5201
|
}
|
|
5167
|
-
t.moveTo(i + r, o), t.lineTo(i + e -
|
|
5202
|
+
t.moveTo(i + r, o), t.lineTo(i + e - l, o), t.arcTo(i + e, o, i + e, o + l, l), 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();
|
|
5168
5203
|
}
|
|
5169
5204
|
renderListView(t, i) {
|
|
5170
5205
|
var A, W, z, Y;
|
|
5171
|
-
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,
|
|
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, l = o.corner_radius !== void 0 ? o.corner_radius : e.corner_radius ?? 0, f = e.orientation || "vertical", h = e.items || [], u = e.itemGap ?? 10, c = 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, M = e.glowIntensity ?? 0, I = e.glowColor || "#3b82f6", k = typeof I == "string" ? I : I.color || ((Y = (z = I.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;
|
|
5172
5207
|
if (t.save(), t.globalAlpha *= T, M > 0) {
|
|
5173
5208
|
const G = t.getTransform(), N = Math.sqrt(G.a * G.a + G.b * G.b) || 1;
|
|
5174
5209
|
t.shadowColor = k, t.shadowBlur = M * 2 * N, t.shadowOffsetX = 0, t.shadowOffsetY = 0;
|
|
5175
5210
|
}
|
|
5176
5211
|
if (b) {
|
|
5177
5212
|
const G = e.listBackgroundColor || "rgba(31, 41, 55, 0.4)", N = this.createCanvasFill(t, G, s, n);
|
|
5178
|
-
t.fillStyle = N || "rgba(31, 41, 55, 0.4)", t.beginPath(), this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, 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, l) || t.fill();
|
|
5179
5214
|
const x = t.createLinearGradient(a, r, a + s, r + n);
|
|
5180
|
-
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,
|
|
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, l) || 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, l) || t.stroke();
|
|
5181
5216
|
} else {
|
|
5182
5217
|
const G = e.backgroundColor || e.listBackgroundColor || "transparent", N = this.createCanvasFill(t, G, s, n);
|
|
5183
5218
|
if (N) {
|
|
5184
5219
|
t.fillStyle = N, t.beginPath();
|
|
5185
|
-
const x = this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n,
|
|
5220
|
+
const x = this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n, l);
|
|
5186
5221
|
t.fill();
|
|
5187
5222
|
}
|
|
5188
5223
|
const J = e.borderWidth ?? 0;
|
|
5189
5224
|
if (J > 0) {
|
|
5190
5225
|
t.strokeStyle = e.borderColor || "#cccccc", t.lineWidth = J, t.beginPath();
|
|
5191
|
-
const x = this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n,
|
|
5226
|
+
const x = this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n, l);
|
|
5192
5227
|
t.stroke();
|
|
5193
5228
|
}
|
|
5194
5229
|
}
|
|
5195
5230
|
t.shadowBlur = 0, t.save(), t.beginPath();
|
|
5196
|
-
const R = this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n,
|
|
5231
|
+
const R = this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n, l);
|
|
5197
5232
|
if (e.listLayout !== "circular")
|
|
5198
5233
|
if (R && e.containerShape === "custom")
|
|
5199
5234
|
try {
|
|
@@ -5203,13 +5238,13 @@ class ci {
|
|
|
5203
5238
|
}
|
|
5204
5239
|
else
|
|
5205
5240
|
t.clip();
|
|
5206
|
-
const P = typeof
|
|
5207
|
-
let _ = (f === "vertical" ? r : a) +
|
|
5208
|
-
if (t.textBaseline = "middle",
|
|
5241
|
+
const P = typeof y == "number" ? y : f === "vertical" ? y[0] : y[3];
|
|
5242
|
+
let _ = (f === "vertical" ? r : a) + p + P;
|
|
5243
|
+
if (t.textBaseline = "middle", h.forEach((G, N) => {
|
|
5209
5244
|
const J = e.listLayout || "linear", x = J === "circular" ? d : f === "vertical" ? s : d, F = J === "circular" || f === "vertical" ? c : n;
|
|
5210
5245
|
let j = 0, X = 0, tt = 0;
|
|
5211
5246
|
if (J === "circular") {
|
|
5212
|
-
const vt =
|
|
5247
|
+
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;
|
|
5213
5248
|
j = Lt + Math.cos(mt) * fe - x / 2, X = _t + Math.sin(mt) * fe - F / 2, tt = mt + (e.itemRotation || 0) * Math.PI / 180;
|
|
5214
5249
|
} else
|
|
5215
5250
|
j = f === "vertical" ? a : _, X = f === "vertical" ? _ : r, tt = (e.itemRotation || 0) * Math.PI / 180;
|
|
@@ -5229,28 +5264,28 @@ class ci {
|
|
|
5229
5264
|
const vt = this.createCanvasFill(t, m, f === "vertical" ? 3 : x, f === "vertical" ? F : 3);
|
|
5230
5265
|
t.fillStyle = vt || m, f === "vertical" ? t.fillRect(j, X, 3, F) : t.fillRect(j, X + F - 3, x, 3);
|
|
5231
5266
|
}
|
|
5232
|
-
const yt = O ? "#ffffff" : b ? "rgba(255, 255, 255, 0.9)" :
|
|
5267
|
+
const yt = O ? "#ffffff" : b ? "rgba(255, 255, 255, 0.9)" : v;
|
|
5233
5268
|
t.fillStyle = yt, t.font = O || L ? "600 14px Inter, sans-serif" : "400 14px Inter, sans-serif";
|
|
5234
5269
|
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;
|
|
5235
5270
|
f === "horizontal" || J === "circular" ? t.textAlign = "center" : t.textAlign = "left";
|
|
5236
5271
|
const It = J === "circular" ? j + x / 2 : gt;
|
|
5237
|
-
t.fillText(bt, It, Et), t.restore(), _ += (f === "vertical" ? c : d) +
|
|
5272
|
+
t.fillText(bt, It, Et), t.restore(), _ += (f === "vertical" ? c : d) + u;
|
|
5238
5273
|
}), t.restore(), e.showScrollbar !== !1) {
|
|
5239
|
-
const G = (
|
|
5240
|
-
if (G > N || J === "circular" &&
|
|
5274
|
+
const G = (h.length || 0) * (f === "vertical" ? c : d) + ((h.length || 0) - 1) * u, N = f === "vertical" ? n : s, J = e.listLayout || "linear", x = e.containerShape === "circle" || J === "circular";
|
|
5275
|
+
if (G > N || J === "circular" && h.length > 0) {
|
|
5241
5276
|
const F = e.scrollbarColor || "rgba(255,255,255,0.3)", j = e.scrollbarWidth || 4;
|
|
5242
5277
|
if (x) {
|
|
5243
5278
|
const X = Math.min(s, n) / 2 - j / 2 - 2, tt = a + s / 2, L = r + n / 2;
|
|
5244
5279
|
if (t.strokeStyle = F, t.lineWidth = j, t.lineCap = "round", t.beginPath(), J === "circular") {
|
|
5245
|
-
const O = Math.PI / 4, D = -(
|
|
5280
|
+
const O = Math.PI / 4, D = -(p * 0.01) - Math.PI / 2;
|
|
5246
5281
|
t.arc(tt, L, X, D, D + O);
|
|
5247
5282
|
} else {
|
|
5248
|
-
const O = Math.PI / 2, D = N / G, q = O * D, ot = -
|
|
5283
|
+
const O = Math.PI / 2, D = N / G, q = O * D, ot = -p / G * O, bt = -Math.PI / 4 + ot;
|
|
5249
5284
|
t.arc(tt, L, X, bt, bt + q);
|
|
5250
5285
|
}
|
|
5251
5286
|
t.stroke();
|
|
5252
5287
|
} else {
|
|
5253
|
-
const X = N / G, tt = N * X, L = -
|
|
5288
|
+
const X = N / G, tt = N * X, L = -p / G * N;
|
|
5254
5289
|
t.fillStyle = F, f === "vertical" ? t.fillRect(a + s - j - 2, r + L, j, tt) : t.fillRect(a + L, r + n - j - 2, tt, j);
|
|
5255
5290
|
}
|
|
5256
5291
|
}
|
|
@@ -5259,15 +5294,15 @@ class ci {
|
|
|
5259
5294
|
}
|
|
5260
5295
|
drawCustomShape(t, i, o, e, s, n, a, r) {
|
|
5261
5296
|
if (i === "circle") {
|
|
5262
|
-
const
|
|
5263
|
-
return t.arc(e + n / 2, s + a / 2,
|
|
5297
|
+
const l = Math.min(n, a) / 2;
|
|
5298
|
+
return t.arc(e + n / 2, s + a / 2, l, 0, Math.PI * 2), !1;
|
|
5264
5299
|
} else if (i === "pill") {
|
|
5265
|
-
const
|
|
5266
|
-
return this.drawListViewRect(t, e, s, n, a,
|
|
5300
|
+
const l = Math.min(n, a) / 2;
|
|
5301
|
+
return this.drawListViewRect(t, e, s, n, a, l), !1;
|
|
5267
5302
|
} else if (i === "custom" && o)
|
|
5268
5303
|
try {
|
|
5269
|
-
const
|
|
5270
|
-
return t.save(), t.translate(e, s), t.scale(n / 100, a / 100), t.fill(
|
|
5304
|
+
const l = new Path2D(o);
|
|
5305
|
+
return t.save(), t.translate(e, s), t.scale(n / 100, a / 100), t.fill(l), t.restore(), !0;
|
|
5271
5306
|
} catch {
|
|
5272
5307
|
return this.drawListViewRect(t, e, s, n, a, r), !1;
|
|
5273
5308
|
}
|
|
@@ -5278,11 +5313,11 @@ class ci {
|
|
|
5278
5313
|
if (!this._lastPointerPos || !this._prevPointerPos) return;
|
|
5279
5314
|
const i = t.options || {}, o = i.orientation || "vertical", e = this._lastPointerPos.x - this._prevPointerPos.x, s = this._lastPointerPos.y - this._prevPointerPos.y;
|
|
5280
5315
|
o === "vertical" ? i.scrollOffset = (i.scrollOffset || 0) + s : i.scrollOffset = (i.scrollOffset || 0) + e;
|
|
5281
|
-
const n = i.listLayout || "linear", a = this.objectStates.get(t.id) || {}, r = i.items || [],
|
|
5316
|
+
const n = i.listLayout || "linear", a = this.objectStates.get(t.id) || {}, r = i.items || [], l = 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, c = a.height !== void 0 ? a.height : ((m = t.geometry) == null ? void 0 : m.height) || 300;
|
|
5282
5317
|
if (n === "circular")
|
|
5283
5318
|
return;
|
|
5284
|
-
const d = (r.length || 0) * (o === "vertical" ? f :
|
|
5285
|
-
i.scrollOffset > 0 && (i.scrollOffset = 0), i.scrollOffset < -
|
|
5319
|
+
const d = (r.length || 0) * (o === "vertical" ? f : h) + ((r.length || 0) - 1) * l, y = Math.max(0, d - (o === "vertical" ? c : u) + (i.padding * 2 || 0));
|
|
5320
|
+
i.scrollOffset > 0 && (i.scrollOffset = 0), i.scrollOffset < -y && (i.scrollOffset = -y);
|
|
5286
5321
|
}
|
|
5287
5322
|
updateListViewHoverFromPointer(t, i, o) {
|
|
5288
5323
|
const e = this.getListViewItemIndexAtPointer(t, i, o), s = t.options || {};
|
|
@@ -5292,24 +5327,24 @@ class ci {
|
|
|
5292
5327
|
var z, Y;
|
|
5293
5328
|
const e = t.options || {}, s = this.objectStates.get(t.id) || {}, n = e.items || [];
|
|
5294
5329
|
if (n.length === 0) return null;
|
|
5295
|
-
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,
|
|
5296
|
-
let T = (
|
|
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, l = e.orientation || "vertical", f = e.itemGap ?? 10, h = e.itemHeight ?? 50, u = e.itemWidth ?? 200, c = 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, M = -a / 2, I = -r / 2, k = typeof d == "number" ? d : l === "vertical" ? d[0] : d[3];
|
|
5331
|
+
let T = (l === "vertical" ? I : M) + c + k;
|
|
5297
5332
|
const R = e.listLayout || "linear", P = n.length || 1, _ = Math.PI * 2 / P, E = e.circularStartAngle || 0, A = e.circularRadius || 100, W = c * 0.01 + E * Math.PI / 180;
|
|
5298
5333
|
for (let G = 0; G < n.length; G++) {
|
|
5299
|
-
const N = R === "circular" ?
|
|
5334
|
+
const N = R === "circular" ? u : l === "vertical" ? a : u, J = R === "circular" || l === "vertical" ? h : r;
|
|
5300
5335
|
let x = 0, F = 0, j = 0;
|
|
5301
5336
|
if (R === "circular") {
|
|
5302
5337
|
const X = G * _ + W, tt = M + a / 2, L = I + r / 2;
|
|
5303
5338
|
x = tt + Math.cos(X) * A - N / 2, F = L + Math.sin(X) * A - J / 2, j = X + (e.itemRotation || 0) * Math.PI / 180;
|
|
5304
5339
|
} else
|
|
5305
|
-
x =
|
|
5340
|
+
x = l === "vertical" ? M : T, F = l === "vertical" ? T : I, j = (e.itemRotation || 0) * Math.PI / 180;
|
|
5306
5341
|
if (j !== 0) {
|
|
5307
5342
|
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;
|
|
5308
5343
|
if (q >= x && q <= x + N && ot >= F && ot <= F + J)
|
|
5309
5344
|
return G;
|
|
5310
5345
|
} else if (C >= x && C <= x + N && w >= F && w <= F + J)
|
|
5311
5346
|
return G;
|
|
5312
|
-
T += (
|
|
5347
|
+
T += (l === "vertical" ? h : u) + f;
|
|
5313
5348
|
}
|
|
5314
5349
|
return null;
|
|
5315
5350
|
}
|
|
@@ -5327,84 +5362,84 @@ class ci {
|
|
|
5327
5362
|
if (!e.behaviors || e.behaviors.length === 0) return;
|
|
5328
5363
|
const s = this.objectStates.get(e.id);
|
|
5329
5364
|
s && e.behaviors.forEach((n) => {
|
|
5330
|
-
var
|
|
5365
|
+
var u, c, d, p, y, b, m, v, S, C, w, M, I, 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;
|
|
5331
5366
|
if (!n.enabled) return;
|
|
5332
5367
|
const a = n.startTime || 0, r = n.endTime || 1 / 0;
|
|
5333
5368
|
if (this.currentTime < a || this.currentTime > r) return;
|
|
5334
|
-
const
|
|
5369
|
+
const l = s.x - i, f = s.y - o, h = Math.sqrt(l * l + f * f);
|
|
5335
5370
|
if (this.frameCount % 240 === 0 && Math.random() < 0.1 && this.log(`[ExodeUI] Executing ${n.type} on ${e.name}`), n.type === U.Proximity) {
|
|
5336
|
-
const H = ((
|
|
5371
|
+
const H = ((u = n.settings) == null ? void 0 : u.radius) || 300, Z = ((c = n.settings) == null ? void 0 : c.falloff) || "smooth";
|
|
5337
5372
|
let K = 0;
|
|
5338
|
-
|
|
5339
|
-
this.applyBehaviorSensor(s, ft, K, t, n.settings, e,
|
|
5373
|
+
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, l, f, h);
|
|
5340
5375
|
});
|
|
5341
5376
|
} else if (n.type === U.Magnetic) {
|
|
5342
|
-
const H = ((d = n.settings) == null ? void 0 : d.radius) || 400, Z = ((
|
|
5343
|
-
if (
|
|
5344
|
-
const K = 1 -
|
|
5377
|
+
const H = ((d = n.settings) == null ? void 0 : d.radius) || 400, Z = ((p = n.settings) == null ? void 0 : p.strength) || 0.5;
|
|
5378
|
+
if (h < H && h > 5) {
|
|
5379
|
+
const K = 1 - h / H, ft = l * K * Z, Tt = f * K * Z;
|
|
5345
5380
|
s.x -= ft * t * 10, s.y -= Tt * t * 10;
|
|
5346
5381
|
}
|
|
5347
5382
|
} else if (n.type === U.Repel) {
|
|
5348
|
-
const H = ((
|
|
5349
|
-
if (
|
|
5350
|
-
const K = Math.pow(1 -
|
|
5351
|
-
s.x +=
|
|
5383
|
+
const H = ((y = n.settings) == null ? void 0 : y.radius) || 300, Z = ((b = n.settings) == null ? void 0 : b.strength) || 1;
|
|
5384
|
+
if (h < H) {
|
|
5385
|
+
const K = Math.pow(1 - h / H, 2);
|
|
5386
|
+
s.x += l / (h || 1) * K * 60 * Z * t * 5, s.y += f / (h || 1) * K * 60 * Z * t * 5;
|
|
5352
5387
|
}
|
|
5353
5388
|
} else if (n.type === U.Orbit) {
|
|
5354
|
-
const H = ((m = n.settings) == null ? void 0 : m.speed) || 1, Z = ((
|
|
5389
|
+
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;
|
|
5355
5390
|
s.x += Math.cos(K) * Z * t * 5, s.y += Math.sin(K) * Z * t * 5, s.rotation += 2 * t * 5;
|
|
5356
5391
|
} else if (n.type === U.Vortex) {
|
|
5357
5392
|
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;
|
|
5358
|
-
if (
|
|
5359
|
-
const ft = Math.pow(1 -
|
|
5393
|
+
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 - l * 0.4, Bt = Math.sin(Tt) * 30 - f * 0.4;
|
|
5360
5395
|
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;
|
|
5361
5396
|
}
|
|
5362
5397
|
} else if (n.type === U.Fluid) {
|
|
5363
5398
|
const H = ((M = n.settings) == null ? void 0 : M.radius) || 300, Z = ((I = n.settings) == null ? void 0 : I.strength) || 1;
|
|
5364
|
-
if (
|
|
5365
|
-
const K = Math.pow(1 -
|
|
5399
|
+
if (h < H) {
|
|
5400
|
+
const K = Math.pow(1 - h / H, 1.2), ft = l / (h || 1) * K * 1.2 * Z, Tt = f / (h || 1) * K * 1.2 * Z;
|
|
5366
5401
|
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;
|
|
5367
5402
|
}
|
|
5368
5403
|
} else if (n.type === U.Elastic) {
|
|
5369
5404
|
const H = ((k = n.settings) == null ? void 0 : k.radius) || 300, Z = ((T = n.settings) == null ? void 0 : T.strength) || 1;
|
|
5370
|
-
if (
|
|
5371
|
-
const K = 1 -
|
|
5405
|
+
if (h < H) {
|
|
5406
|
+
const K = 1 - h / H;
|
|
5372
5407
|
s.scale_x *= 1 + K * 0.4 * Z * t, s.scale_y *= 1 + K * 0.4 * Z * t;
|
|
5373
5408
|
}
|
|
5374
5409
|
} else if (n.type === U.Holographic) {
|
|
5375
5410
|
const H = s.x - this.canvasWidth / 2, Z = s.y - this.canvasHeight / 2, K = ((R = n.settings) == null ? void 0 : R.factor) || 25;
|
|
5376
5411
|
if (s.x -= H / 1e3 * K * t * 5, s.y -= Z / 1e3 * K * t * 5, s.style) {
|
|
5377
|
-
const ft = 1 - Math.min(1,
|
|
5412
|
+
const ft = 1 - Math.min(1, h / 400);
|
|
5378
5413
|
s.style.exposure = (s.style.exposure || 1) + ft * 0.5 * t;
|
|
5379
5414
|
}
|
|
5380
5415
|
} else if (n.type === U.Sticky) {
|
|
5381
5416
|
const H = ((P = n.settings) == null ? void 0 : P.radius) || 80, Z = ((_ = n.settings) == null ? void 0 : _.strength) || 1;
|
|
5382
|
-
if (
|
|
5383
|
-
const K = Math.pow(1 -
|
|
5384
|
-
s.x -=
|
|
5417
|
+
if (h < H) {
|
|
5418
|
+
const K = Math.pow(1 - h / H, 2);
|
|
5419
|
+
s.x -= l * 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;
|
|
5385
5420
|
}
|
|
5386
5421
|
} else if (n.type === U.Dilation) {
|
|
5387
5422
|
const H = ((E = n.settings) == null ? void 0 : E.size) || 120, Z = ((A = n.settings) == null ? void 0 : A.strength) || 1;
|
|
5388
|
-
if (
|
|
5389
|
-
const K = 1 -
|
|
5423
|
+
if (h < H) {
|
|
5424
|
+
const K = 1 - h / H;
|
|
5390
5425
|
s.scale_x *= 1 + K * 0.5 * Z * t, s.scale_y *= 1 + K * 0.5 * Z * t;
|
|
5391
5426
|
}
|
|
5392
5427
|
} else if (n.type === U.Parallax) {
|
|
5393
5428
|
const H = ((W = n.settings) == null ? void 0 : W.factor) || 15, Z = ((z = n.settings) == null ? void 0 : z.strength) || 1, K = this.canvasWidth / 2, ft = this.canvasHeight / 2, Tt = this._lastPointerPos || { x: K, y: ft }, Rt = (Tt.x - K) / K, Bt = (Tt.y - ft) / ft, ee = (((Y = e.transform) == null ? void 0 : Y.x) ?? 0) + Rt * H * Z, ue = (((G = e.transform) == null ? void 0 : G.y) ?? 0) + Bt * H * Z, Te = (((N = e.transform) == null ? void 0 : N.rotate_x) ?? 0) - Bt * H * 1.5 * Z, re = (((J = e.transform) == null ? void 0 : J.rotate_y) ?? 0) + Rt * H * 1.5 * Z, be = Math.min(1, 10 * t);
|
|
5394
5429
|
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);
|
|
5395
5430
|
} else if (n.type === U.Fold) {
|
|
5396
|
-
if (
|
|
5397
|
-
const H = 1 -
|
|
5431
|
+
if (h < 300) {
|
|
5432
|
+
const H = 1 - h / 300, Z = (l > 0 ? -1 : 1) * H * 10, K = 1 - H * 0.1, ft = f / 300 * H * 20, Tt = -(l / 300) * H * 20, Rt = Math.min(1, 10 * t);
|
|
5398
5433
|
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 };
|
|
5399
5434
|
}
|
|
5400
5435
|
} else if (n.type === U.Crumple) {
|
|
5401
|
-
if (
|
|
5402
|
-
const H = 1 -
|
|
5436
|
+
if (h < 300) {
|
|
5437
|
+
const H = 1 - h / 300, Z = H * (Math.random() - 0.5) * 5, K = H * (Math.random() - 0.5) * 0.05, ft = Math.min(1, 15 * t);
|
|
5403
5438
|
s.skew_x = this.lerp(s.skew_x ?? ((yt = e.transform) == null ? void 0 : yt.skew_x) ?? 0, Z, ft), s.scale_x = this.lerp(s.scale_x ?? ((bt = e.transform) == null ? void 0 : bt.scale_x) ?? 1, (((gt = e.transform) == null ? void 0 : gt.scale_x) ?? 1) * (1 + K), ft), s.scale_y = this.lerp(s.scale_y ?? ((Et = e.transform) == null ? void 0 : Et.scale_y) ?? 1, (((It = e.transform) == null ? void 0 : It.scale_y) ?? 1) * (1 + K), ft), s.style = s.style || { ...e.style }, s.style.artEffect = { enabled: !0, type: "crumple_overlay", intensity: ((vt = n.settings) == null ? void 0 : vt.intensity) ?? 1, scale: ((Yt = n.settings) == null ? void 0 : Yt.scale) ?? 2 };
|
|
5404
5439
|
}
|
|
5405
5440
|
} else if (n.type === U.Squash) {
|
|
5406
5441
|
const H = ((ie = n.settings) == null ? void 0 : ie.strength) || 0.8;
|
|
5407
|
-
|
|
5442
|
+
h < (e.width || 100) && this.isMouseDown ? (s.scale_y = this.lerp(s.scale_y ?? 1, (((fe = e.transform) == null ? void 0 : fe.scale_y) ?? 1) * H, 0.3), s.scale_x = this.lerp(s.scale_x ?? 1, (((st = e.transform) == null ? void 0 : st.scale_x) ?? 1) * (1 + (1 - H) * 0.4), 0.3)) : (s.scale_y = this.lerp(s.scale_y ?? 1, ((mt = e.transform) == null ? void 0 : mt.scale_y) ?? 1, 0.2), s.scale_x = this.lerp(s.scale_x ?? 1, ((Lt = e.transform) == null ? void 0 : Lt.scale_x) ?? 1, 0.2));
|
|
5408
5443
|
} else if (n.type === U.TextCounter) {
|
|
5409
5444
|
const H = ((_t = n.settings) == null ? void 0 : _t.duration) || 2, Z = ((dt = n.settings) == null ? void 0 : dt.from) || 0, K = ((Ft = n.settings) == null ? void 0 : Ft.to) || 100;
|
|
5410
5445
|
n._runtimeStart === void 0 && (n._runtimeStart = this.currentTime);
|
|
@@ -5415,8 +5450,8 @@ class ci {
|
|
|
5415
5450
|
}
|
|
5416
5451
|
} else if (n.type === U.Spotlight) {
|
|
5417
5452
|
const H = ((Vt = n.settings) == null ? void 0 : Vt.radius) || 250, Z = ((ne = n.settings) == null ? void 0 : ne.strength) || 1.5;
|
|
5418
|
-
if (
|
|
5419
|
-
const K = Math.pow(1 -
|
|
5453
|
+
if (h < H) {
|
|
5454
|
+
const K = Math.pow(1 - h / H, 2);
|
|
5420
5455
|
s.style || (s.style = { ...e.style }), s.style.adjustments || (s.style.adjustments = { ...(me = e.style) == null ? void 0 : me.adjustments }), s.style.adjustments.exposure = (((Ut = (ye = e.style) == null ? void 0 : ye.adjustments) == null ? void 0 : Ut.exposure) || 0) + K * Z * 50;
|
|
5421
5456
|
} else
|
|
5422
5457
|
(Se = s.style) != null && Se.adjustments && (s.style.adjustments.exposure = this.lerp(s.style.adjustments.exposure || 0, ((Ee = (Pe = e.style) == null ? void 0 : Pe.adjustments) == null ? void 0 : Ee.exposure) || 0, 0.1));
|
|
@@ -5428,15 +5463,15 @@ class ci {
|
|
|
5428
5463
|
s.scale_x *= 1 + K * Z * ft * t, s.scale_y *= 1 + K * Z * ft * t, s.style && (s.style.exposure = (s.style.exposure || 1) + Math.max(0, K) * 0.1 * ft * t);
|
|
5429
5464
|
} else if (n.type === U.Draggable) {
|
|
5430
5465
|
const H = ((B = n.settings) == null ? void 0 : B.radius) || 150, Z = this.draggingBehaviors.has(e.id);
|
|
5431
|
-
if (
|
|
5432
|
-
const K = ((et = n.settings) == null ? void 0 : et.strength) || 1, ft = Z ? 1 : Math.max(0, 1 -
|
|
5466
|
+
if (h < H || Z) {
|
|
5467
|
+
const K = ((et = n.settings) == null ? void 0 : et.strength) || 1, ft = Z ? 1 : Math.max(0, 1 - h / H);
|
|
5433
5468
|
this.applyBehaviorSensor(s, Zt.PositionX, ft * K, t, n.settings), this.applyBehaviorSensor(s, Zt.PositionY, ft * K, t, n.settings);
|
|
5434
5469
|
}
|
|
5435
5470
|
} else if (n.type === U.Scroll) {
|
|
5436
5471
|
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;
|
|
5437
5472
|
(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);
|
|
5438
5473
|
} else if (n.type === U.LookAt) {
|
|
5439
|
-
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, -
|
|
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, -l) * (180 / Math.PI), ft = s.rotation, Tt = (K - ft + 180) % 360 - 180;
|
|
5440
5475
|
s.rotation += Tt * H * Z * t * 10;
|
|
5441
5476
|
} else if (n.type === U.Scan) {
|
|
5442
5477
|
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;
|
|
@@ -5450,7 +5485,7 @@ class ci {
|
|
|
5450
5485
|
else if (n.type === U.Ratchet) {
|
|
5451
5486
|
const H = ((te = n.settings) == null ? void 0 : te.steps) || 12, Z = (((Jt = n.settings) == null ? void 0 : Jt.speed) || 1) * 30, K = Math.floor(s.rotation / (360 / H)) * (360 / H);
|
|
5452
5487
|
s.rotation = this.lerp(s.rotation, K + Z * t, 0.1);
|
|
5453
|
-
} else if (n.type === U.Jitter &&
|
|
5488
|
+
} else if (n.type === U.Jitter && h < 300) {
|
|
5454
5489
|
const H = ((pt = n.settings) == null ? void 0 : pt.strength) || 1, Z = (((ct = n.settings) == null ? void 0 : ct.intensity) || 5) * H;
|
|
5455
5490
|
s.x += (Math.random() - 0.5) * Z * t * 60, s.y += (Math.random() - 0.5) * Z * t * 60, s.rotation += (Math.random() - 0.5) * Z * t * 120;
|
|
5456
5491
|
} else if (n.type === U.Follower) {
|
|
@@ -5472,15 +5507,15 @@ class ci {
|
|
|
5472
5507
|
s.x += H * t * 10, s.y += Z * t * 10;
|
|
5473
5508
|
} else if (n.type === U.Shear) {
|
|
5474
5509
|
const H = ((St = n.settings) == null ? void 0 : St.strength) || 1, Z = ((Xt = n.settings) == null ? void 0 : Xt.radius) || 300;
|
|
5475
|
-
if (
|
|
5476
|
-
const K = 1 -
|
|
5510
|
+
if (h < Z) {
|
|
5511
|
+
const K = 1 - h / Z;
|
|
5477
5512
|
s.skew_x = this.lerp(s.skew_x || 0, (((Qt = e.transform) == null ? void 0 : Qt.skew_x) || 0) + K * H * 30, 0.1);
|
|
5478
5513
|
} else
|
|
5479
5514
|
s.skew_x = this.lerp(s.skew_x || 0, ((oe = e.transform) == null ? void 0 : oe.skew_x) || 0, 0.05);
|
|
5480
5515
|
} else if (n.type === U.Lens) {
|
|
5481
5516
|
const H = ((Gt = n.settings) == null ? void 0 : Gt.radius) || 200, Z = ((Ht = n.settings) == null ? void 0 : Ht.strength) || 0.5;
|
|
5482
|
-
if (
|
|
5483
|
-
const K = Math.pow(1 -
|
|
5517
|
+
if (h < H) {
|
|
5518
|
+
const K = Math.pow(1 - h / H, 2);
|
|
5484
5519
|
s.scale_x = this.lerp(s.scale_x ?? 1, (((Nt = e.transform) == null ? void 0 : Nt.scale_x) ?? 1) * (1 + K * Z), 0.2), s.scale_y = this.lerp(s.scale_y ?? 1, (((Ie = e.transform) == null ? void 0 : Ie.scale_y) ?? 1) * (1 + K * Z), 0.2);
|
|
5485
5520
|
} else
|
|
5486
5521
|
s.scale_x = this.lerp(s.scale_x ?? 1, ((Re = e.transform) == null ? void 0 : Re.scale_x) ?? 1, 0.1), s.scale_y = this.lerp(s.scale_y ?? 1, ((Le = e.transform) == null ? void 0 : Le.scale_y) ?? 1, 0.1);
|
|
@@ -5615,89 +5650,89 @@ class ci {
|
|
|
5615
5650
|
});
|
|
5616
5651
|
});
|
|
5617
5652
|
}
|
|
5618
|
-
applyBehaviorSensor(t, i, o, e, s, n, a = 0, r = 0,
|
|
5619
|
-
var d,
|
|
5620
|
-
const f = (s == null ? void 0 : s.intensity) || (s == null ? void 0 : s.strength) || 1,
|
|
5653
|
+
applyBehaviorSensor(t, i, o, e, s, n, a = 0, r = 0, l = 1) {
|
|
5654
|
+
var d, p, y, b, m, v, S, C, w, M, I, k, T, R, P, _, E, A, W, z, Y, G, N, J;
|
|
5655
|
+
const f = (s == null ? void 0 : s.intensity) || (s == null ? void 0 : s.strength) || 1, h = Math.min(1, 15 * e), u = l > 0 ? a / l : 0, c = l > 0 ? r / l : 0;
|
|
5621
5656
|
switch (i) {
|
|
5622
5657
|
case Zt.Scale: {
|
|
5623
|
-
const x = ((d = n == null ? void 0 : n.transform) == null ? void 0 : d.scale_x) ?? 1, F = ((
|
|
5624
|
-
t.scale_x = (t.scale_x ?? x) * (1 -
|
|
5658
|
+
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);
|
|
5659
|
+
t.scale_x = (t.scale_x ?? x) * (1 - h) + j * h, t.scale_y = (t.scale_y ?? F) * (1 - h) + X * h;
|
|
5625
5660
|
break;
|
|
5626
5661
|
}
|
|
5627
5662
|
case Zt.Opacity: {
|
|
5628
|
-
const x = ((
|
|
5629
|
-
t.opacity = (t.opacity ?? x) * (1 -
|
|
5663
|
+
const x = ((y = n == null ? void 0 : n.transform) == null ? void 0 : y.opacity) ?? 100, F = Math.max(0, Math.min(100, x - o * f * 100));
|
|
5664
|
+
t.opacity = (t.opacity ?? x) * (1 - h) + F * h;
|
|
5630
5665
|
break;
|
|
5631
5666
|
}
|
|
5632
5667
|
case Zt.RotateZ: {
|
|
5633
5668
|
const x = ((b = n == null ? void 0 : n.transform) == null ? void 0 : b.rotation) ?? 0, F = x + o * f * 45;
|
|
5634
|
-
t.rotation = (t.rotation ?? x) * (1 -
|
|
5669
|
+
t.rotation = (t.rotation ?? x) * (1 - h) + F * h;
|
|
5635
5670
|
break;
|
|
5636
5671
|
}
|
|
5637
5672
|
case Zt.RotateX: {
|
|
5638
5673
|
const x = ((m = n == null ? void 0 : n.transform) == null ? void 0 : m.rotate_x) ?? 0, F = x - c * o * f * 60;
|
|
5639
|
-
t.rotate_x = (t.rotate_x ?? x) * (1 -
|
|
5674
|
+
t.rotate_x = (t.rotate_x ?? x) * (1 - h) + F * h;
|
|
5640
5675
|
break;
|
|
5641
5676
|
}
|
|
5642
5677
|
case Zt.RotateY: {
|
|
5643
|
-
const x = ((
|
|
5644
|
-
t.rotate_y = (t.rotate_y ?? x) * (1 -
|
|
5678
|
+
const x = ((v = n == null ? void 0 : n.transform) == null ? void 0 : v.rotate_y) ?? 0, F = x + u * o * f * 60;
|
|
5679
|
+
t.rotate_y = (t.rotate_y ?? x) * (1 - h) + F * h;
|
|
5645
5680
|
break;
|
|
5646
5681
|
}
|
|
5647
5682
|
case Zt.PositionX: {
|
|
5648
|
-
const x = ((S = n == null ? void 0 : n.transform) == null ? void 0 : S.x) ?? 0, F = x -
|
|
5649
|
-
t.x = (t.x ?? x) * (1 -
|
|
5683
|
+
const x = ((S = n == null ? void 0 : n.transform) == null ? void 0 : S.x) ?? 0, F = x - u * o * f * 40;
|
|
5684
|
+
t.x = (t.x ?? x) * (1 - h) + F * h;
|
|
5650
5685
|
break;
|
|
5651
5686
|
}
|
|
5652
5687
|
case Zt.PositionY: {
|
|
5653
5688
|
const x = ((C = n == null ? void 0 : n.transform) == null ? void 0 : C.y) ?? 0, F = x - c * o * f * 40;
|
|
5654
|
-
t.y = (t.y ?? x) * (1 -
|
|
5689
|
+
t.y = (t.y ?? x) * (1 - h) + F * h;
|
|
5655
5690
|
break;
|
|
5656
5691
|
}
|
|
5657
5692
|
case Zt.SkewX: {
|
|
5658
|
-
const x = ((w = n == null ? void 0 : n.transform) == null ? void 0 : w.skew_x) ?? 0, F = x +
|
|
5659
|
-
t.skew_x = (t.skew_x ?? x) * (1 -
|
|
5693
|
+
const x = ((w = n == null ? void 0 : n.transform) == null ? void 0 : w.skew_x) ?? 0, F = x + u * o * f * 45;
|
|
5694
|
+
t.skew_x = (t.skew_x ?? x) * (1 - h) + F * h, t.skew_x > 85 && (t.skew_x = 85), t.skew_x < -85 && (t.skew_x = -85);
|
|
5660
5695
|
break;
|
|
5661
5696
|
}
|
|
5662
5697
|
case Zt.Blur: {
|
|
5663
5698
|
t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.blur || (t.style.blur = { ...(M = n == null ? void 0 : n.style) == null ? void 0 : M.blur });
|
|
5664
5699
|
const x = ((k = (I = n == null ? void 0 : n.style) == null ? void 0 : I.blur) == null ? void 0 : k.amount) || 0, F = x + o * ((s == null ? void 0 : s.blur) || 20) * f;
|
|
5665
|
-
t.style.blur.amount = (t.style.blur.amount ?? x) * (1 -
|
|
5700
|
+
t.style.blur.amount = (t.style.blur.amount ?? x) * (1 - h) + F * h;
|
|
5666
5701
|
break;
|
|
5667
5702
|
}
|
|
5668
5703
|
case Zt.Exposure: {
|
|
5669
5704
|
t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.adjustments || (t.style.adjustments = { ...(T = n == null ? void 0 : n.style) == null ? void 0 : T.adjustments });
|
|
5670
5705
|
const x = ((P = (R = n == null ? void 0 : n.style) == null ? void 0 : R.adjustments) == null ? void 0 : P.exposure) || 0, F = x + o * ((s == null ? void 0 : s.exposure) || 50) * f;
|
|
5671
|
-
t.style.adjustments.exposure = (t.style.adjustments.exposure ?? x) * (1 -
|
|
5706
|
+
t.style.adjustments.exposure = (t.style.adjustments.exposure ?? x) * (1 - h) + F * h;
|
|
5672
5707
|
break;
|
|
5673
5708
|
}
|
|
5674
5709
|
case Zt.HueShift: {
|
|
5675
5710
|
t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.adjustments || (t.style.adjustments = { ...(_ = n == null ? void 0 : n.style) == null ? void 0 : _.adjustments });
|
|
5676
5711
|
const x = ((A = (E = n == null ? void 0 : n.style) == null ? void 0 : E.adjustments) == null ? void 0 : A.hue) || 0, F = x + o * ((s == null ? void 0 : s.hue) || 180) * f;
|
|
5677
|
-
t.style.adjustments.hue = (t.style.adjustments.hue ?? x) * (1 -
|
|
5712
|
+
t.style.adjustments.hue = (t.style.adjustments.hue ?? x) * (1 - h) + F * h;
|
|
5678
5713
|
break;
|
|
5679
5714
|
}
|
|
5680
5715
|
case Zt.Negative: {
|
|
5681
5716
|
t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.adjustments || (t.style.adjustments = { ...(W = n == null ? void 0 : n.style) == null ? void 0 : W.adjustments });
|
|
5682
5717
|
const x = ((Y = (z = n == null ? void 0 : n.style) == null ? void 0 : z.adjustments) == null ? void 0 : Y.negative) || 0, F = x + o * ((s == null ? void 0 : s.negative) || 100) * f;
|
|
5683
|
-
t.style.adjustments.negative = (t.style.adjustments.negative ?? x) * (1 -
|
|
5718
|
+
t.style.adjustments.negative = (t.style.adjustments.negative ?? x) * (1 - h) + F * h;
|
|
5684
5719
|
break;
|
|
5685
5720
|
}
|
|
5686
5721
|
case Zt.CornerRadius: {
|
|
5687
5722
|
const x = ((G = n == null ? void 0 : n.transform) == null ? void 0 : G.corner_radius) || 0, F = x + o * f * 50;
|
|
5688
|
-
t.corner_radius = (t.corner_radius ?? x) * (1 -
|
|
5723
|
+
t.corner_radius = (t.corner_radius ?? x) * (1 - h) + F * h;
|
|
5689
5724
|
break;
|
|
5690
5725
|
}
|
|
5691
5726
|
case Zt.StrokeWidth: {
|
|
5692
5727
|
t.style || (t.style = { ...n == null ? void 0 : n.style });
|
|
5693
5728
|
const x = ((N = n == null ? void 0 : n.style) == null ? void 0 : N.borderWidth) || 0, F = x + o * f * 10;
|
|
5694
|
-
t.style.borderWidth = (t.style.borderWidth ?? x) * (1 -
|
|
5729
|
+
t.style.borderWidth = (t.style.borderWidth ?? x) * (1 - h) + F * h;
|
|
5695
5730
|
break;
|
|
5696
5731
|
}
|
|
5697
5732
|
case Zt.LetterSpacing: {
|
|
5698
5733
|
t.geometry || (t.geometry = {});
|
|
5699
5734
|
const x = ((J = n == null ? void 0 : n.geometry) == null ? void 0 : J.letterSpacing) || 0, F = x + o * f * 10;
|
|
5700
|
-
t.geometry.letterSpacing = (t.geometry.letterSpacing ?? x) * (1 -
|
|
5735
|
+
t.geometry.letterSpacing = (t.geometry.letterSpacing ?? x) * (1 - h) + F * h;
|
|
5701
5736
|
break;
|
|
5702
5737
|
}
|
|
5703
5738
|
}
|
|
@@ -5719,12 +5754,12 @@ class ci {
|
|
|
5719
5754
|
const s = o.split(".");
|
|
5720
5755
|
let n = t;
|
|
5721
5756
|
for (let r = 0; r < s.length - 1; r++) {
|
|
5722
|
-
const
|
|
5723
|
-
if (n[
|
|
5724
|
-
const f = i,
|
|
5725
|
-
n[
|
|
5757
|
+
const l = s[r];
|
|
5758
|
+
if (n[l] === void 0 || n[l] === null) {
|
|
5759
|
+
const f = i, h = s.slice(0, r + 1).reduce((u, c) => u == null ? void 0 : u[c], f);
|
|
5760
|
+
n[l] = h !== void 0 ? { ...h } : {};
|
|
5726
5761
|
}
|
|
5727
|
-
n = n[
|
|
5762
|
+
n = n[l];
|
|
5728
5763
|
}
|
|
5729
5764
|
const a = s[s.length - 1];
|
|
5730
5765
|
n != null && (n[a] = e);
|
|
@@ -5772,9 +5807,9 @@ class ci {
|
|
|
5772
5807
|
return o;
|
|
5773
5808
|
}
|
|
5774
5809
|
renderFittedImage(t, i, o, e, s, n, a = "cover") {
|
|
5775
|
-
const r = i.naturalWidth,
|
|
5776
|
-
let
|
|
5777
|
-
a === "cover" ? f >
|
|
5810
|
+
const r = i.naturalWidth, l = i.naturalHeight, f = r / l, h = s / n;
|
|
5811
|
+
let u = s, c = n, d = o, p = e;
|
|
5812
|
+
a === "cover" ? f > h ? (u = n * f, d = o - (u - s) / 2) : (c = s / f, p = e - (c - n) / 2) : a === "contain" && (f > h ? (c = s / f, p = e + (n - c) / 2) : (u = n * f, d = o + (s - u) / 2)), t.drawImage(i, d, p, u, c);
|
|
5778
5813
|
}
|
|
5779
5814
|
}
|
|
5780
5815
|
const yi = Ss(({
|
|
@@ -5787,17 +5822,17 @@ const yi = Ss(({
|
|
|
5787
5822
|
onReady: n,
|
|
5788
5823
|
onTrigger: a,
|
|
5789
5824
|
onInputUpdate: r,
|
|
5790
|
-
onComponentChange:
|
|
5825
|
+
onComponentChange: l,
|
|
5791
5826
|
onToggle: f,
|
|
5792
|
-
onInputChange:
|
|
5793
|
-
onInputFocus:
|
|
5827
|
+
onInputChange: h,
|
|
5828
|
+
onInputFocus: u,
|
|
5794
5829
|
onInputBlur: c,
|
|
5795
5830
|
onLog: d,
|
|
5796
|
-
onLogicUpdate:
|
|
5797
|
-
onButtonClick:
|
|
5831
|
+
onLogicUpdate: p,
|
|
5832
|
+
onButtonClick: y,
|
|
5798
5833
|
onGraphPointClick: b,
|
|
5799
5834
|
currentTime: m,
|
|
5800
|
-
revision:
|
|
5835
|
+
revision: v = 0,
|
|
5801
5836
|
scrollY: S,
|
|
5802
5837
|
scrollX: C,
|
|
5803
5838
|
mouseX: w,
|
|
@@ -5809,15 +5844,15 @@ const yi = Ss(({
|
|
|
5809
5844
|
}, P) => {
|
|
5810
5845
|
const _ = _e(null), E = _e(null);
|
|
5811
5846
|
E.current || (E.current = new ci());
|
|
5812
|
-
const A = _e(void 0), W = _e(0), z = _e(null), Y = _e(
|
|
5847
|
+
const A = _e(void 0), W = _e(0), z = _e(null), Y = _e(v), G = _e(null), [, N] = Qe(g || null), J = _e(!0);
|
|
5813
5848
|
Cs(P, () => _.current), ve(() => (J.current = !0, () => {
|
|
5814
5849
|
J.current = !1, A.current && cancelAnimationFrame(A.current);
|
|
5815
5850
|
}), []), ve(() => {
|
|
5816
5851
|
E.current.setLayout(e, s);
|
|
5817
5852
|
}, [e, s]), ve(() => {
|
|
5818
5853
|
const L = E.current;
|
|
5819
|
-
a && L.setTriggerCallback(a), r && L.setInputUpdateCallback((O, D) => r({ [O]: D })),
|
|
5820
|
-
}, [a, r,
|
|
5854
|
+
a && L.setTriggerCallback(a), r && L.setInputUpdateCallback((O, D) => r({ [O]: D })), l && L.setComponentChangeCallback((O) => l(O)), f && L.setToggleCallback(f), h && L.setInputChangeCallback(h), u && L.setInputFocusCallback(u), c && L.setInputBlurCallback(c), 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);
|
|
5855
|
+
}, [a, r, l, f, h, u, c, d, p, y, b, R]), ve(() => {
|
|
5821
5856
|
(async () => {
|
|
5822
5857
|
let O = g;
|
|
5823
5858
|
if (t && !g)
|
|
@@ -5828,10 +5863,10 @@ const yi = Ss(({
|
|
|
5828
5863
|
}
|
|
5829
5864
|
if (O) {
|
|
5830
5865
|
const D = E.current, q = O.id || O.name || "default";
|
|
5831
|
-
(z.current !== q || Y.current !==
|
|
5866
|
+
(z.current !== q || Y.current !== v || G.current !== O) && (D.load(O), z.current = q, Y.current = v, G.current = O, N(O), W.current = 0, D.advance(0)), n && n(D);
|
|
5832
5867
|
}
|
|
5833
5868
|
})();
|
|
5834
|
-
}, [g, t,
|
|
5869
|
+
}, [g, t, v]), ve(() => {
|
|
5835
5870
|
const L = (O) => {
|
|
5836
5871
|
if (!E.current || !J.current) return;
|
|
5837
5872
|
const D = E.current, q = _.current;
|
|
@@ -6039,24 +6074,24 @@ const yi = Ss(({
|
|
|
6039
6074
|
] });
|
|
6040
6075
|
});
|
|
6041
6076
|
function bi() {
|
|
6042
|
-
const [g, t] = Qe(null), i = Me((
|
|
6043
|
-
g == null || g.setInputBool(
|
|
6044
|
-
}, [g]), o = Me((
|
|
6045
|
-
g == null || g.setInputNumber(
|
|
6046
|
-
}, [g]), e = Me((
|
|
6047
|
-
g == null || g.fireTrigger(
|
|
6048
|
-
}, [g]), s = Me((
|
|
6049
|
-
g == null || g.setInputText(
|
|
6050
|
-
}, [g]), n = Me((
|
|
6051
|
-
g == null || g.setInputNumberArray(
|
|
6052
|
-
}, [g]), a = Me((
|
|
6053
|
-
g == null || g.setInputStringArray(
|
|
6054
|
-
}, [g]), r = Me((
|
|
6055
|
-
g == null || g.updateObjectOptions(
|
|
6056
|
-
}, [g]),
|
|
6057
|
-
g == null || g.updateConstraint(
|
|
6058
|
-
}, [g]), f = Me((
|
|
6059
|
-
g == null || g.updateGraphData(
|
|
6077
|
+
const [g, t] = Qe(null), i = Me((h, u) => {
|
|
6078
|
+
g == null || g.setInputBool(h, u);
|
|
6079
|
+
}, [g]), o = Me((h, u) => {
|
|
6080
|
+
g == null || g.setInputNumber(h, u);
|
|
6081
|
+
}, [g]), e = Me((h) => {
|
|
6082
|
+
g == null || g.fireTrigger(h);
|
|
6083
|
+
}, [g]), s = Me((h, u) => {
|
|
6084
|
+
g == null || g.setInputText(h, u);
|
|
6085
|
+
}, [g]), n = Me((h, u) => {
|
|
6086
|
+
g == null || g.setInputNumberArray(h, u);
|
|
6087
|
+
}, [g]), a = Me((h, u) => {
|
|
6088
|
+
g == null || g.setInputStringArray(h, u);
|
|
6089
|
+
}, [g]), r = Me((h, u) => {
|
|
6090
|
+
g == null || g.updateObjectOptions(h, u);
|
|
6091
|
+
}, [g]), l = Me((h, u, c) => {
|
|
6092
|
+
g == null || g.updateConstraint(h, u, c);
|
|
6093
|
+
}, [g]), f = Me((h, u) => {
|
|
6094
|
+
g == null || g.updateGraphData(h, u);
|
|
6060
6095
|
}, [g]);
|
|
6061
6096
|
return {
|
|
6062
6097
|
setEngine: t,
|
|
@@ -6068,7 +6103,7 @@ function bi() {
|
|
|
6068
6103
|
setInputText: s,
|
|
6069
6104
|
setInputNumberArray: n,
|
|
6070
6105
|
setInputStringArray: a,
|
|
6071
|
-
updateConstraint:
|
|
6106
|
+
updateConstraint: l,
|
|
6072
6107
|
updateGraphData: f,
|
|
6073
6108
|
updateObjectOptions: r
|
|
6074
6109
|
};
|
|
@@ -6080,36 +6115,36 @@ const vi = ({ artboard: g, config: t }) => {
|
|
|
6080
6115
|
a && (document.title = a);
|
|
6081
6116
|
let r = i.description;
|
|
6082
6117
|
if (!r && o) {
|
|
6083
|
-
const
|
|
6118
|
+
const h = g.objects.filter((u) => {
|
|
6084
6119
|
var c;
|
|
6085
|
-
return ((c =
|
|
6120
|
+
return ((c = u.geometry) == null ? void 0 : c.type) === "Text";
|
|
6086
6121
|
}).sort(
|
|
6087
|
-
(
|
|
6088
|
-
var d,
|
|
6089
|
-
return (((d = c.geometry.text) == null ? void 0 : d.length) || 0) - (((
|
|
6122
|
+
(u, c) => {
|
|
6123
|
+
var d, p;
|
|
6124
|
+
return (((d = c.geometry.text) == null ? void 0 : d.length) || 0) - (((p = u.geometry.text) == null ? void 0 : p.length) || 0);
|
|
6090
6125
|
}
|
|
6091
6126
|
);
|
|
6092
|
-
|
|
6127
|
+
h.length > 0 && (r = h[0].geometry.text);
|
|
6093
6128
|
}
|
|
6094
6129
|
r && (e("name", "description", r), e("property", "og:description", r)), i.keywords && i.keywords.length > 0 && e("name", "keywords", i.keywords.join(", "));
|
|
6095
|
-
const
|
|
6096
|
-
|
|
6130
|
+
const l = i.ogImage || g.backgroundImage;
|
|
6131
|
+
l && e("property", "og:image", l), a && e("property", "og:title", a), e("property", "og:type", "website");
|
|
6097
6132
|
}, [i, g, o]);
|
|
6098
|
-
const e = (a, r,
|
|
6133
|
+
const e = (a, r, l) => {
|
|
6099
6134
|
let f = document.querySelector(`meta[${a}="${r}"]`);
|
|
6100
|
-
f || (f = document.createElement("meta"), f.setAttribute(a, r), document.head.appendChild(f)), f.setAttribute("content",
|
|
6135
|
+
f || (f = document.createElement("meta"), f.setAttribute(a, r), document.head.appendChild(f)), f.setAttribute("content", l);
|
|
6101
6136
|
}, s = () => {
|
|
6102
6137
|
const a = [];
|
|
6103
|
-
return a.push(/* @__PURE__ */ ge("h1", { children: i.title || g.name }, "artboard-title")), g.objects.forEach((
|
|
6104
|
-
var
|
|
6105
|
-
if (!(
|
|
6106
|
-
if (((
|
|
6107
|
-
const c =
|
|
6108
|
-
c && (
|
|
6109
|
-
} else if (((
|
|
6110
|
-
const c =
|
|
6111
|
-
a.push(/* @__PURE__ */ ge("img", { src: c, alt: d },
|
|
6112
|
-
} else
|
|
6138
|
+
return a.push(/* @__PURE__ */ ge("h1", { children: i.title || g.name }, "artboard-title")), g.objects.forEach((l, f) => {
|
|
6139
|
+
var h, u;
|
|
6140
|
+
if (!(l.visible === !1 || l.isVisible === !1))
|
|
6141
|
+
if (((h = l.geometry) == null ? void 0 : h.type) === "Text") {
|
|
6142
|
+
const c = l.geometry.text;
|
|
6143
|
+
c && (l.geometry.fontSize > 24 ? a.push(/* @__PURE__ */ ge("h2", { children: c }, l.id || f)) : a.push(/* @__PURE__ */ ge("p", { children: c }, l.id || f)));
|
|
6144
|
+
} else if (((u = l.geometry) == null ? void 0 : u.type) === "Image") {
|
|
6145
|
+
const c = l.geometry.src, d = l.altText || l.name || "Illustration";
|
|
6146
|
+
a.push(/* @__PURE__ */ ge("img", { src: c, alt: d }, l.id || f));
|
|
6147
|
+
} else l.type === "Button" && a.push(/* @__PURE__ */ ge("button", { children: l.name || "Button" }, l.id || f));
|
|
6113
6148
|
}), a;
|
|
6114
6149
|
}, n = i.jsonLd || {
|
|
6115
6150
|
"@context": "https://schema.org",
|
|
@@ -6142,7 +6177,7 @@ const vi = ({ artboard: g, config: t }) => {
|
|
|
6142
6177
|
]
|
|
6143
6178
|
}
|
|
6144
6179
|
);
|
|
6145
|
-
}, hi = "6.3.
|
|
6180
|
+
}, hi = "6.3.42", fi = {
|
|
6146
6181
|
version: hi
|
|
6147
6182
|
}, Si = fi.version;
|
|
6148
6183
|
export {
|