@snowcone-app/canvas 0.30.0 → 0.32.0
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/ERROR_CONTRACT.md +11 -0
- package/STYLING_CONTRACT.md +3 -3
- package/dist/{CanvasRenderer-BEf0hXeF.js → CanvasRenderer-1j-twIbs.js} +443 -431
- package/dist/{CanvasRenderer-BEf0hXeF.js.map → CanvasRenderer-1j-twIbs.js.map} +1 -1
- package/dist/{CanvasStateV1-BDSyYo4A.js → CanvasStateV1-BmC1JfPv.js} +813 -798
- package/dist/{CanvasStateV1-BDSyYo4A.js.map → CanvasStateV1-BmC1JfPv.js.map} +1 -1
- package/dist/ContextualToolbars-BKU8IoAM.js +6474 -0
- package/dist/ContextualToolbars-BKU8IoAM.js.map +1 -0
- package/dist/{EditorCanvasImpl-DXeBz2CX.js → EditorCanvasImpl-4voOsj2k.js} +19 -20
- package/dist/{EditorCanvasImpl-DXeBz2CX.js.map → EditorCanvasImpl-4voOsj2k.js.map} +1 -1
- package/dist/{ExportManager-DUdis6se.js → ExportManager-Ci81K6xA.js} +783 -500
- package/dist/ExportManager-Ci81K6xA.js.map +1 -0
- package/dist/{FontAnalyzer-DKG5JK0x.js → FontAnalyzer-BrKY6XYn.js} +1604 -1444
- package/dist/FontAnalyzer-BrKY6XYn.js.map +1 -0
- package/dist/{ImagePanel-CBgGqmVV.js → ImagePanel-ntJBepby.js} +49 -49
- package/dist/{ImagePanel-CBgGqmVV.js.map → ImagePanel-ntJBepby.js.map} +1 -1
- package/dist/{SnowconeCanvas-BWPBngvI.js → SnowconeCanvas-CgQdiBXv.js} +27 -27
- package/dist/{SnowconeCanvas-BWPBngvI.js.map → SnowconeCanvas-CgQdiBXv.js.map} +1 -1
- package/dist/advanced.mjs +14 -14
- package/dist/components/ImageToolbar.d.ts +12 -0
- package/dist/components/ShapeToolbar.d.ts +8 -0
- package/dist/components/TextToolbar.d.ts +5 -1
- package/dist/components/toolbars/EmbeddedToolbarLayout.d.ts +6 -0
- package/dist/components/toolbars/GroupElementToolbar.d.ts +8 -0
- package/dist/components/toolbars/SecondaryPanels.d.ts +40 -1
- package/dist/components/toolbars/index.d.ts +2 -2
- package/dist/components/ui/SliderRow.d.ts +6 -0
- package/dist/components/ui/toolbar-button.d.ts +2 -2
- package/dist/core/BaseElement.d.ts +2 -1
- package/dist/core/image-adjustments.d.ts +32 -0
- package/dist/core/shape-fill.d.ts +31 -0
- package/dist/{custom-icons-BIaRovwG.js → custom-icons-DTWtkJ9N.js} +7 -7
- package/dist/{custom-icons-BIaRovwG.js.map → custom-icons-DTWtkJ9N.js.map} +1 -1
- package/dist/design-builder-BpbYUYtK.js +1672 -0
- package/dist/design-builder-BpbYUYtK.js.map +1 -0
- package/dist/{embed-Csez1hui.js → embed-C69x0jHc.js} +110 -111
- package/dist/{embed-Csez1hui.js.map → embed-C69x0jHc.js.map} +1 -1
- package/dist/embed.mjs +53 -54
- package/dist/embed.mjs.map +1 -1
- package/dist/errors/editorError.d.ts +7 -0
- package/dist/{guards-BSoX73yg.js → guards-BhaQgJrE.js} +2 -2
- package/dist/{guards-BSoX73yg.js.map → guards-BhaQgJrE.js.map} +1 -1
- package/dist/hooks/elementPatch.d.ts +14 -4
- package/dist/index.mjs +41 -41
- package/dist/internals.mjs +202 -133
- package/dist/internals.mjs.map +1 -1
- package/dist/rendering/LayerEffectsRenderer.d.ts +24 -0
- package/dist/rendering/element-painters.d.ts +0 -13
- package/dist/rendering/element-serializer.d.ts +3 -1
- package/dist/rendering/image-adjustments.d.ts +24 -0
- package/dist/rendering/renderer-types.d.ts +10 -1
- package/dist/state/CanvasStateV1.d.ts +22 -0
- package/dist/style.css +1 -1
- package/dist/template-fields-D-2oLhCi.js +505 -0
- package/dist/template-fields-D-2oLhCi.js.map +1 -0
- package/dist/testing.mjs +40 -41
- package/dist/testing.mjs.map +1 -1
- package/dist/types/index.d.ts +105 -1
- package/dist/types/public.d.ts +3 -2
- package/dist/{UnifiedFontService-Co9tQ59z.js → useCommands-DwnZHUg8.js} +2361 -2103
- package/dist/useCommands-DwnZHUg8.js.map +1 -0
- package/dist/{usePieceGuideBundle-CRLY2iQa.js → usePieceGuideBundle-CnSmYrmM.js} +2 -2
- package/dist/{usePieceGuideBundle-CRLY2iQa.js.map → usePieceGuideBundle-CnSmYrmM.js.map} +1 -1
- package/dist/utils/featureApplied.d.ts +6 -0
- package/dist/{validation-BGEl9rrE.js → validation-DyUOjRGa.js} +465 -465
- package/dist/{validation-BGEl9rrE.js.map → validation-DyUOjRGa.js.map} +1 -1
- package/dist/workers/export-worker.bundle.string.d.ts +1 -1
- package/example/package.json +1 -1
- package/package.json +1 -1
- package/dist/ContextualToolbars-C3D_6sep.js +0 -5960
- package/dist/ContextualToolbars-C3D_6sep.js.map +0 -1
- package/dist/ExportManager-DUdis6se.js.map +0 -1
- package/dist/FontAnalyzer-DKG5JK0x.js.map +0 -1
- package/dist/UnifiedFontService-Co9tQ59z.js.map +0 -1
- package/dist/design-builder-JYLO_Hyi.js +0 -470
- package/dist/design-builder-JYLO_Hyi.js.map +0 -1
- package/dist/editorErrors-WzaNxU1Y.js +0 -1206
- package/dist/editorErrors-WzaNxU1Y.js.map +0 -1
- package/dist/template-fields-DYPW7bVU.js +0 -716
- package/dist/template-fields-DYPW7bVU.js.map +0 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { jsx as r, jsxs as y, Fragment as Pn } from "react/jsx-runtime";
|
|
2
2
|
import * as $n from "react";
|
|
3
3
|
import je, { useState as ce, useEffect as Pe, useCallback as ft, useMemo as xs, useContext as Pr, createContext as Ar, useRef as we, useImperativeHandle as nr, forwardRef as Nr } from "react";
|
|
4
|
-
import { u as rs,
|
|
5
|
-
import {
|
|
6
|
-
import { I as
|
|
4
|
+
import { u as rs, k as sr, t as _s, v as $s, a as Ts, b as Dr, g as Br, h as Or } from "./design-builder-BpbYUYtK.js";
|
|
5
|
+
import { h as rr, I as ze, k as zr, o as or, N as Fn, m as Qt, O as _e, z as Xr, x as Lr, y as Yr, w as Hr, P as _r, T as dn, i as un, j as hn, B as Ct, Q as $r, R as Fr, V as Wr, W as ir, g as Vr, u as ar } from "./useCommands-DwnZHUg8.js";
|
|
6
|
+
import { I as Lt, G as Re, aC as Is, ad as ys, ai as cr, aD as Fs, aE as Kr, aF as Cn, aG as Ur, aH as us, P as wn, c as zn, aI as en, aJ as ms, aK as Gr, T as Qe, aB as qr, aL as Jn, aM as jr, aN as Zr, aO as Jr, aP as lr, aQ as Qr, aR as Es, aS as eo, Z as to, S as Qn, R as no, C as Bn } from "./FontAnalyzer-BrKY6XYn.js";
|
|
7
7
|
import { createPortal as dr } from "react-dom";
|
|
8
|
-
import { g as _n, b as so, r as ro, c as oo, C as Ws, d as
|
|
8
|
+
import { g as _n, b as so, r as ro, c as oo, C as Ws, d as Vs, e as gs, T as io, a as ao, A as co, S as lo, I as uo } from "./CanvasRenderer-1j-twIbs.js";
|
|
9
9
|
import { u as ho } from "./ThemeContext-Rjz25x9X.js";
|
|
10
10
|
import { renderToStaticMarkup as fo } from "react-dom/server";
|
|
11
|
-
import { D as Ps, n as As, o as ur, p as Ns, C as po, q as Mt } from "./ContextualToolbars-
|
|
12
|
-
import { L as Tt, S as hr, T as Ot, I as mo } from "./custom-icons-
|
|
11
|
+
import { D as Ps, n as As, o as ur, p as Ns, C as po, q as Mt } from "./ContextualToolbars-BKU8IoAM.js";
|
|
12
|
+
import { L as Tt, S as hr, T as Ot, I as mo } from "./custom-icons-DTWtkJ9N.js";
|
|
13
13
|
import * as ts from "@radix-ui/react-radio-group";
|
|
14
|
-
import { L as go, M as
|
|
14
|
+
import { L as go, M as Ks, N as Us } from "./ExportManager-Ci81K6xA.js";
|
|
15
15
|
import { cva as fr } from "class-variance-authority";
|
|
16
16
|
import { debounce as Gs } from "lodash-es";
|
|
17
17
|
const xo = {
|
|
@@ -176,11 +176,11 @@ function Fa() {
|
|
|
176
176
|
return e.capabilities;
|
|
177
177
|
}
|
|
178
178
|
function So(e, t) {
|
|
179
|
-
if (t instanceof
|
|
179
|
+
if (t instanceof Lt && t.isCropping || e instanceof Lt && e.isCropping)
|
|
180
180
|
return !0;
|
|
181
181
|
if (e instanceof Re) {
|
|
182
182
|
for (const n of e.children)
|
|
183
|
-
if (n instanceof
|
|
183
|
+
if (n instanceof Lt && n.isCropping)
|
|
184
184
|
return !0;
|
|
185
185
|
}
|
|
186
186
|
return !1;
|
|
@@ -286,8 +286,8 @@ function Eo(e) {
|
|
|
286
286
|
const D = g.shiftKey ? 10 : 1;
|
|
287
287
|
let w = 0, ne = 0;
|
|
288
288
|
g.key === "ArrowLeft" && (w = -D), g.key === "ArrowRight" && (w = D), g.key === "ArrowUp" && (ne = -D), g.key === "ArrowDown" && (ne = D);
|
|
289
|
-
const
|
|
290
|
-
|
|
289
|
+
const V = n.clone();
|
|
290
|
+
V.x += w, V.y += ne, a(V);
|
|
291
291
|
return;
|
|
292
292
|
}
|
|
293
293
|
}
|
|
@@ -425,7 +425,7 @@ function To(e, t) {
|
|
|
425
425
|
const D = Math.min(R, C.length);
|
|
426
426
|
for (let w = 0; w < D; w++) {
|
|
427
427
|
if (!T && w < A) continue;
|
|
428
|
-
const ne = C[w],
|
|
428
|
+
const ne = C[w], V = x + w, O = c.getStyleAt(V), u = O.fontSize || n, q = O.fontFamily || s, U = O.bold !== void 0 ? O.bold : o, te = O.italic !== void 0 ? O.italic : i, le = O.letterSpacing !== void 0 ? O.letterSpacing : l;
|
|
429
429
|
N += ys(ne, u, q, U, te, le);
|
|
430
430
|
}
|
|
431
431
|
return {
|
|
@@ -494,13 +494,13 @@ function Sn(e, t) {
|
|
|
494
494
|
return E + I;
|
|
495
495
|
if (ne >= D)
|
|
496
496
|
return E + A.length - g;
|
|
497
|
-
let
|
|
497
|
+
let V = 0;
|
|
498
498
|
for (let O = 0; O < A.length; O++) {
|
|
499
499
|
if (!P && O < I || !N && O >= A.length - g) continue;
|
|
500
|
-
const u = A[O], q = E + O, U = c.getStyleAt(q), te = U.fontSize || n, le = U.fontFamily || s,
|
|
501
|
-
if (ne <
|
|
500
|
+
const u = A[O], q = E + O, U = c.getStyleAt(q), te = U.fontSize || n, le = U.fontFamily || s, H = U.bold !== void 0 ? U.bold : o, xe = U.italic !== void 0 ? U.italic : i, ie = U.letterSpacing !== void 0 ? U.letterSpacing : l, be = ys(u, te, le, H, xe, ie);
|
|
501
|
+
if (ne < V + be / 2)
|
|
502
502
|
return q;
|
|
503
|
-
|
|
503
|
+
V += be;
|
|
504
504
|
}
|
|
505
505
|
return E + A.length;
|
|
506
506
|
}
|
|
@@ -720,7 +720,7 @@ class Ao {
|
|
|
720
720
|
var a, l, c, f, d, m, p, b;
|
|
721
721
|
if (!this.state.active || this.state.points.length === 0) return;
|
|
722
722
|
const { points: s, previewPoint: o, currentPoint: i } = this.state;
|
|
723
|
-
if (t.save(), t.translate(n.x, n.y), t.strokeStyle =
|
|
723
|
+
if (t.save(), t.translate(n.x, n.y), t.strokeStyle = Kr(), t.lineWidth = 2, t.setLineDash([]), t.beginPath(), s.length > 0) {
|
|
724
724
|
const x = s[0];
|
|
725
725
|
t.moveTo(x.x, x.y);
|
|
726
726
|
for (let C = 1; C < s.length; C++) {
|
|
@@ -949,13 +949,13 @@ class zo {
|
|
|
949
949
|
const P = o.startX - p, N = o.startY - b;
|
|
950
950
|
let D = P * v - N * C, w = P * C + N * v;
|
|
951
951
|
D *= R, w *= E;
|
|
952
|
-
const ne = I - D,
|
|
952
|
+
const ne = I - D, V = g - w, O = l.cropX, u = l.cropY, q = l.cropWidth, U = l.cropHeight, te = l.width, le = l.height, H = ne / te, xe = V / le, ie = this._calculateNewCropValues(
|
|
953
953
|
n,
|
|
954
954
|
O,
|
|
955
955
|
u,
|
|
956
956
|
q,
|
|
957
957
|
U,
|
|
958
|
-
|
|
958
|
+
H,
|
|
959
959
|
xe
|
|
960
960
|
), be = this._calculateCropCenterOffset(
|
|
961
961
|
O,
|
|
@@ -1044,7 +1044,7 @@ function Xo() {
|
|
|
1044
1044
|
cropController: e
|
|
1045
1045
|
};
|
|
1046
1046
|
}
|
|
1047
|
-
function
|
|
1047
|
+
function Lo(e) {
|
|
1048
1048
|
const t = we(null), n = we(null);
|
|
1049
1049
|
return Pe(() => {
|
|
1050
1050
|
n.current = null;
|
|
@@ -1061,13 +1061,13 @@ function Yo({ selectedElement: e, ref: t }) {
|
|
|
1061
1061
|
(w) => {
|
|
1062
1062
|
if (!n || !E)
|
|
1063
1063
|
return;
|
|
1064
|
-
const ne = Math.min(d, p),
|
|
1065
|
-
if (ne ===
|
|
1064
|
+
const ne = Math.min(d, p), V = Math.max(d, p);
|
|
1065
|
+
if (ne === V) {
|
|
1066
1066
|
const O = E.clone(), u = O.getText().length;
|
|
1067
1067
|
O.applyStyle(0, u, w), g.current = O, A(O), i(O.getText()), I((q) => ({ ...q, ...w }));
|
|
1068
1068
|
} else {
|
|
1069
1069
|
const O = E.clone();
|
|
1070
|
-
O.applyStyle(ne,
|
|
1070
|
+
O.applyStyle(ne, V, w), g.current = O, A(O), i(O.getText()), I((u) => ({ ...u, ...w }));
|
|
1071
1071
|
}
|
|
1072
1072
|
},
|
|
1073
1073
|
[n, E, d, p]
|
|
@@ -1128,7 +1128,7 @@ function Yo({ selectedElement: e, ref: t }) {
|
|
|
1128
1128
|
toggleFormattingProperty: D
|
|
1129
1129
|
};
|
|
1130
1130
|
}
|
|
1131
|
-
function
|
|
1131
|
+
function Ho({
|
|
1132
1132
|
width: e,
|
|
1133
1133
|
height: t,
|
|
1134
1134
|
zoom: n,
|
|
@@ -1143,18 +1143,18 @@ function Lo({
|
|
|
1143
1143
|
}) {
|
|
1144
1144
|
const [m, p] = ce(!1);
|
|
1145
1145
|
Pe(() => {
|
|
1146
|
-
const
|
|
1147
|
-
p(
|
|
1146
|
+
const V = "ontouchstart" in window || navigator.maxTouchPoints > 0;
|
|
1147
|
+
p(V);
|
|
1148
1148
|
}, []);
|
|
1149
1149
|
const b = we(null);
|
|
1150
1150
|
Pe(() => {
|
|
1151
|
-
const
|
|
1151
|
+
const V = (O) => {
|
|
1152
1152
|
b.current = O.target, setTimeout(() => {
|
|
1153
1153
|
b.current = null;
|
|
1154
1154
|
}, 500);
|
|
1155
1155
|
};
|
|
1156
|
-
return document.addEventListener("touchstart",
|
|
1157
|
-
document.removeEventListener("touchstart",
|
|
1156
|
+
return document.addEventListener("touchstart", V, { capture: !0, passive: !0 }), document.addEventListener("pointerdown", V, { capture: !0, passive: !0 }), () => {
|
|
1157
|
+
document.removeEventListener("touchstart", V, { capture: !0 }), document.removeEventListener("pointerdown", V, { capture: !0 });
|
|
1158
1158
|
};
|
|
1159
1159
|
}, []);
|
|
1160
1160
|
const [x, v] = ce({
|
|
@@ -1170,10 +1170,10 @@ function Lo({
|
|
|
1170
1170
|
v({ width: e, height: t });
|
|
1171
1171
|
return;
|
|
1172
1172
|
}
|
|
1173
|
-
const
|
|
1174
|
-
|
|
1173
|
+
const V = f.getActiveArtboard();
|
|
1174
|
+
V && v({ width: V.width, height: V.height });
|
|
1175
1175
|
}, [e, t, c, f, d]), Pe(() => {
|
|
1176
|
-
const
|
|
1176
|
+
const V = () => {
|
|
1177
1177
|
if (d) {
|
|
1178
1178
|
v({ width: d.width, height: d.height });
|
|
1179
1179
|
return;
|
|
@@ -1183,7 +1183,7 @@ function Lo({
|
|
|
1183
1183
|
v(O ? { width: O.width, height: O.height } : { width: window.innerWidth, height: window.innerHeight });
|
|
1184
1184
|
}
|
|
1185
1185
|
};
|
|
1186
|
-
return window.addEventListener("resize",
|
|
1186
|
+
return window.addEventListener("resize", V), () => window.removeEventListener("resize", V);
|
|
1187
1187
|
}, [e, t, f, d]);
|
|
1188
1188
|
const C = Math.max(0.1, Math.min(1, s)), R = a ?? i, E = l ?? i, A = R !== void 0 && n > 0 ? R / n : 0, T = E !== void 0 && n > 0 ? E / n : 0, I = R !== void 0 ? x.width + A * 2 : x.width / C, g = E !== void 0 ? x.height + T * 2 : x.height / C, P = R !== void 0 ? A : (I - x.width) / 2, N = E !== void 0 ? T : (g - x.height) / 2, D = d ? P - d.x : P, w = d ? N - d.y : N, ne = n > 0 ? o / n : o;
|
|
1189
1189
|
return {
|
|
@@ -1334,7 +1334,7 @@ function es(e, t) {
|
|
|
1334
1334
|
}
|
|
1335
1335
|
e.beginPath(), os(e, t), e.stroke();
|
|
1336
1336
|
}
|
|
1337
|
-
function
|
|
1337
|
+
function Vo(e, t) {
|
|
1338
1338
|
t.kind !== "path" && os(e, t);
|
|
1339
1339
|
}
|
|
1340
1340
|
function bs(e, t) {
|
|
@@ -1355,7 +1355,7 @@ function bs(e, t) {
|
|
|
1355
1355
|
}
|
|
1356
1356
|
e.addPath(new Path2D(t.d));
|
|
1357
1357
|
}
|
|
1358
|
-
function
|
|
1358
|
+
function Ko(e, t, n) {
|
|
1359
1359
|
return (e == null ? void 0 : e.boundary) ?? {
|
|
1360
1360
|
kind: "rect",
|
|
1361
1361
|
x: 0,
|
|
@@ -1409,16 +1409,16 @@ function Go(e) {
|
|
|
1409
1409
|
continue;
|
|
1410
1410
|
const D = s == null ? void 0 : s[N.id], w = (D == null ? void 0 : D.zones) ?? [], ne = (D == null ? void 0 : D.labels) ?? [];
|
|
1411
1411
|
t.save(), t.translate(N.x, N.y);
|
|
1412
|
-
const
|
|
1413
|
-
|
|
1414
|
-
const O =
|
|
1412
|
+
const V = N.rotation ?? 0;
|
|
1413
|
+
V === 90 ? (t.translate(N.width, 0), t.rotate(Math.PI / 2)) : V === 180 ? (t.translate(N.width, N.height), t.rotate(Math.PI)) : V === 270 && (t.translate(0, N.height), t.rotate(3 * Math.PI / 2));
|
|
1414
|
+
const O = V === 90 || V === 270, u = O ? N.height : N.width, q = O ? N.width : N.height, U = Ko(D, u, q), te = Uo(D, N, u, q), le = !0, H = Math.max(0, (D == null ? void 0 : D.outerRadius) ?? 0), xe = H > 0 ? {
|
|
1415
1415
|
kind: "roundedRect",
|
|
1416
1416
|
x: 0,
|
|
1417
1417
|
y: 0,
|
|
1418
1418
|
width: u,
|
|
1419
1419
|
height: q,
|
|
1420
|
-
rx:
|
|
1421
|
-
ry:
|
|
1420
|
+
rx: H,
|
|
1421
|
+
ry: H
|
|
1422
1422
|
} : {
|
|
1423
1423
|
kind: "rect",
|
|
1424
1424
|
x: 0,
|
|
@@ -1426,7 +1426,7 @@ function Go(e) {
|
|
|
1426
1426
|
width: u,
|
|
1427
1427
|
height: q
|
|
1428
1428
|
};
|
|
1429
|
-
if (
|
|
1429
|
+
if (H > 0 && (t.save(), t.beginPath(), Vo(t, xe), t.clip()), a.bleed && m.bleedOpacity > 0) {
|
|
1430
1430
|
const ie = m.bleedInnerEdge === "safeArea" && te ? te : U;
|
|
1431
1431
|
if (ie) {
|
|
1432
1432
|
const be = f ? "screen" : "multiply", Se = m.bleedOpacity;
|
|
@@ -1479,7 +1479,7 @@ function Go(e) {
|
|
|
1479
1479
|
m.dieCutStroke,
|
|
1480
1480
|
m.dieCutStrokeWidthPx
|
|
1481
1481
|
));
|
|
1482
|
-
a.boundary && x && m.boundaryStrokeWidthPx > 0 && (t.save(), t.strokeStyle = x, Jn(t, m.boundaryStrokeWidthPx), es(t, U), t.restore()), a.safeArea && te && m.safeAreaStroke && (t.save(), t.strokeStyle = m.safeAreaStroke, Jn(t, m.safeAreaStrokeWidthPx, m.safeAreaDashPx), es(t, te), t.setLineDash([]), t.restore()), a.labels && ne.length > 0 && ti(t, ne, m, i),
|
|
1482
|
+
a.boundary && x && m.boundaryStrokeWidthPx > 0 && (t.save(), t.strokeStyle = x, Jn(t, m.boundaryStrokeWidthPx), es(t, U), t.restore()), a.safeArea && te && m.safeAreaStroke && (t.save(), t.strokeStyle = m.safeAreaStroke, Jn(t, m.safeAreaStrokeWidthPx, m.safeAreaDashPx), es(t, te), t.setLineDash([]), t.restore()), a.labels && ne.length > 0 && ti(t, ne, m, i), H > 0 && t.restore(), t.restore();
|
|
1483
1483
|
}
|
|
1484
1484
|
t.restore();
|
|
1485
1485
|
}
|
|
@@ -1616,11 +1616,11 @@ function ri(e) {
|
|
|
1616
1616
|
} else
|
|
1617
1617
|
P = { ...P, centerX: I, centerY: g };
|
|
1618
1618
|
}
|
|
1619
|
-
const w = l && i.getMode() === "rotate" ? P.rotation + c : P.rotation, ne = P.width,
|
|
1620
|
-
let
|
|
1619
|
+
const w = l && i.getMode() === "rotate" ? P.rotation + c : P.rotation, ne = P.width, V = P.height, O = P.centerX, u = P.centerY, q = O - ne / 2, U = u - V / 2, te = O + ne / 2, le = u + V / 2;
|
|
1620
|
+
let H = O, xe = le + jr;
|
|
1621
1621
|
if (w !== 0) {
|
|
1622
|
-
const be = -w * Math.PI / 180, Se = Math.cos(be), Te = Math.sin(be), Oe =
|
|
1623
|
-
|
|
1622
|
+
const be = -w * Math.PI / 180, Se = Math.cos(be), Te = Math.sin(be), Oe = H - O, De = xe - u;
|
|
1623
|
+
H = O + (Oe * Se - De * Te), xe = u + (Oe * Te + De * Se);
|
|
1624
1624
|
}
|
|
1625
1625
|
const ie = {
|
|
1626
1626
|
minX: q,
|
|
@@ -1629,11 +1629,11 @@ function ri(e) {
|
|
|
1629
1629
|
maxY: le,
|
|
1630
1630
|
centerX: O,
|
|
1631
1631
|
centerY: u,
|
|
1632
|
-
rotationHandleX:
|
|
1632
|
+
rotationHandleX: H,
|
|
1633
1633
|
rotationHandleY: xe,
|
|
1634
1634
|
rotation: w
|
|
1635
1635
|
};
|
|
1636
|
-
return t.save(), t.translate(O, u), t.rotate(-w * Math.PI / 180), t.translate(-O, -u), t.strokeStyle = Cn(), t.lineWidth = _n(d), t.setLineDash(so(d)), t.strokeRect(q, U, ne,
|
|
1636
|
+
return t.save(), t.translate(O, u), t.rotate(-w * Math.PI / 180), t.translate(-O, -u), t.strokeStyle = Cn(), t.lineWidth = _n(d), t.setLineDash(so(d)), t.strokeRect(q, U, ne, V), t.restore(), f || oi(t, {
|
|
1637
1637
|
renderMinX: q,
|
|
1638
1638
|
renderMinY: U,
|
|
1639
1639
|
renderMaxX: te,
|
|
@@ -1641,9 +1641,9 @@ function ri(e) {
|
|
|
1641
1641
|
renderCenterX: O,
|
|
1642
1642
|
renderCenterY: u,
|
|
1643
1643
|
renderWidth: ne,
|
|
1644
|
-
renderHeight:
|
|
1644
|
+
renderHeight: V,
|
|
1645
1645
|
groupRotation: w,
|
|
1646
|
-
rotationHandleX:
|
|
1646
|
+
rotationHandleX: H,
|
|
1647
1647
|
rotationHandleY: xe,
|
|
1648
1648
|
stateMachine: i,
|
|
1649
1649
|
zoom: d
|
|
@@ -1697,7 +1697,7 @@ function ci(e) {
|
|
|
1697
1697
|
t.save(), t.translate(o.x + o.width / 2, o.y + o.height / 2), t.rotate(-n.rotation * Math.PI / 180), t.translate(-(o.x + o.width / 2), -(o.y + o.height / 2)), t.strokeStyle = Jr(), t.lineWidth = _n(s), t.setLineDash([]), t.strokeRect(o.x, o.y, o.width, o.height), t.restore();
|
|
1698
1698
|
}
|
|
1699
1699
|
const li = 60;
|
|
1700
|
-
class
|
|
1700
|
+
class Hn {
|
|
1701
1701
|
constructor() {
|
|
1702
1702
|
this.frameTimes = [], this.metrics = {
|
|
1703
1703
|
frameTime: 0,
|
|
@@ -1708,7 +1708,7 @@ class Ln {
|
|
|
1708
1708
|
};
|
|
1709
1709
|
}
|
|
1710
1710
|
static getInstance() {
|
|
1711
|
-
return
|
|
1711
|
+
return Hn.instance || (Hn.instance = new Hn()), Hn.instance;
|
|
1712
1712
|
}
|
|
1713
1713
|
/**
|
|
1714
1714
|
* Record a single frame's render duration. Maintains a rolling window
|
|
@@ -1827,7 +1827,7 @@ function ui(e) {
|
|
|
1827
1827
|
if (c.startTime !== null && c.type !== null && performance.now() - c.startTime < 150 && (n.current = !0), n.current) {
|
|
1828
1828
|
n.current = !1;
|
|
1829
1829
|
const f = performance.now();
|
|
1830
|
-
hi(t.current, o, s),
|
|
1830
|
+
hi(t.current, o, s), Hn.getInstance().recordFrameTime(performance.now() - f);
|
|
1831
1831
|
}
|
|
1832
1832
|
i = requestAnimationFrame(l);
|
|
1833
1833
|
};
|
|
@@ -1862,14 +1862,14 @@ function hi(e, t, n) {
|
|
|
1862
1862
|
hoverState: D,
|
|
1863
1863
|
isEditing: w,
|
|
1864
1864
|
editText: ne,
|
|
1865
|
-
editRichText:
|
|
1865
|
+
editRichText: V,
|
|
1866
1866
|
cursorPosition: O,
|
|
1867
1867
|
selectionStart: u,
|
|
1868
1868
|
selectionEnd: q,
|
|
1869
1869
|
cursorOpacityRef: U,
|
|
1870
1870
|
cursorStartTimeRef: te,
|
|
1871
1871
|
isTouchDevice: le,
|
|
1872
|
-
selectionHandlePositionsRef:
|
|
1872
|
+
selectionHandlePositionsRef: H,
|
|
1873
1873
|
multiClickSelectionRef: xe,
|
|
1874
1874
|
lastMultiClickTimeRef: ie,
|
|
1875
1875
|
MULTI_CLICK_DEBOUNCE: be,
|
|
@@ -1891,31 +1891,31 @@ function hi(e, t, n) {
|
|
|
1891
1891
|
const se = lt.getContext("2d");
|
|
1892
1892
|
if (!se) return;
|
|
1893
1893
|
if (w) {
|
|
1894
|
-
const Ue = (me) => me < 0.5 ? 4 * me * me * me : 1 - Math.pow(-2 * me + 2, 3) / 2,
|
|
1894
|
+
const Ue = (me) => me < 0.5 ? 4 * me * me * me : 1 - Math.pow(-2 * me + 2, 3) / 2, K = (performance.now() - te.current) % 1060 / 1060, ue = K < 0.5 ? 1 - Ue(K * 2) : Ue((K - 0.5) * 2);
|
|
1895
1895
|
U.current = ue;
|
|
1896
1896
|
} else
|
|
1897
1897
|
U.current = 1;
|
|
1898
1898
|
const h = window.devicePixelRatio || 1, G = v * A, re = C * A;
|
|
1899
1899
|
if (G <= 0 || re <= 0) return;
|
|
1900
|
-
const he = 4096, _ = G * h, Ce = re * h, Ie = Math.max(_, Ce),
|
|
1900
|
+
const he = 4096, _ = G * h, Ce = re * h, Ie = Math.max(_, Ce), Ve = Ie > he ? he / Ie : 1, Xe = h * Ve;
|
|
1901
1901
|
lt.width = G * Xe, lt.height = re * Xe, se.setTransform(1, 0, 0, 1, 0, 0), se.clearRect(0, 0, lt.width, lt.height);
|
|
1902
1902
|
const Y = t.current;
|
|
1903
1903
|
se.scale(Xe, Xe), A !== 1 && se.scale(A, A), (R !== 0 || E !== 0) && se.translate(R, E);
|
|
1904
|
-
const $ = a.find((
|
|
1904
|
+
const $ = a.find((Ke) => Ke.id === l.getActiveArtboardId()), ot = ($ == null ? void 0 : $.id) ?? null, rt = Ee && $ ? di(
|
|
1905
1905
|
Ee.pieces,
|
|
1906
1906
|
Ee.guides,
|
|
1907
1907
|
e.focusedPieceId ?? null
|
|
1908
1908
|
) : void 0;
|
|
1909
1909
|
let Ze = Ee ? 0 : T;
|
|
1910
1910
|
if (Ee && Ee.pieces.length === 1 && $) {
|
|
1911
|
-
const
|
|
1911
|
+
const Ke = Ee.pieces[0].id, Ae = (rn = Ee.guides) == null ? void 0 : rn[Ke], K = Ae == null ? void 0 : Ae.outerRadius, ue = Ae == null ? void 0 : Ae.boundary, me = ue && typeof ue == "object" && ue.kind === "roundedRect" ? ue.rx ?? ue.ry : void 0, Be = typeof K == "number" && K > 0 ? K : typeof me == "number" && me > 0 ? me : 0;
|
|
1912
1912
|
Be > 0 && (Ze = Be);
|
|
1913
1913
|
}
|
|
1914
1914
|
if ($ && !Ee)
|
|
1915
1915
|
if (se.fillStyle = Y, rt && typeof rt == "object" && rt.type === "path")
|
|
1916
1916
|
try {
|
|
1917
|
-
const
|
|
1918
|
-
se.save(), se.translate($.x, $.y), se.fill(
|
|
1917
|
+
const Ke = new Path2D(rt.d);
|
|
1918
|
+
se.save(), se.translate($.x, $.y), se.fill(Ke), se.restore();
|
|
1919
1919
|
} catch {
|
|
1920
1920
|
se.fillRect(
|
|
1921
1921
|
$.x,
|
|
@@ -1945,33 +1945,33 @@ function hi(e, t, n) {
|
|
|
1945
1945
|
), m || (gt = Ue[d.id]));
|
|
1946
1946
|
}
|
|
1947
1947
|
if (w && d) {
|
|
1948
|
-
const
|
|
1949
|
-
if (!(Ue !== null && Ue.elementId === d.id && Ue.childId ===
|
|
1950
|
-
let
|
|
1951
|
-
if (
|
|
1948
|
+
const Ke = p.current ?? null, Ue = n.current;
|
|
1949
|
+
if (!(Ue !== null && Ue.elementId === d.id && Ue.childId === Ke && Ue.editRichText === V)) {
|
|
1950
|
+
let K = null;
|
|
1951
|
+
if (Ke && d instanceof Re) {
|
|
1952
1952
|
const ue = Nt.find(
|
|
1953
1953
|
(me) => me.id === d.id && me instanceof Re
|
|
1954
1954
|
);
|
|
1955
1955
|
if (ue) {
|
|
1956
1956
|
const me = ue.clone();
|
|
1957
1957
|
me.children = me.children.map((Be) => {
|
|
1958
|
-
if (Be.id ===
|
|
1958
|
+
if (Be.id === Ke && V && Be instanceof Qe) {
|
|
1959
1959
|
const Je = Be.clone();
|
|
1960
|
-
return Je.setRichText(
|
|
1960
|
+
return Je.setRichText(V), Je;
|
|
1961
1961
|
}
|
|
1962
1962
|
return Be;
|
|
1963
|
-
}),
|
|
1963
|
+
}), K = me;
|
|
1964
1964
|
}
|
|
1965
|
-
} else if (
|
|
1965
|
+
} else if (V && d instanceof Qe) {
|
|
1966
1966
|
const ue = d.clone();
|
|
1967
|
-
ue.setRichText(
|
|
1967
|
+
ue.setRichText(V), K = ue;
|
|
1968
1968
|
}
|
|
1969
|
-
|
|
1969
|
+
K ? n.current = { elementId: d.id, childId: Ke, editRichText: V, clonedElement: K } : n.current = null;
|
|
1970
1970
|
}
|
|
1971
1971
|
if (n.current) {
|
|
1972
|
-
const { clonedElement:
|
|
1972
|
+
const { clonedElement: K } = n.current;
|
|
1973
1973
|
Nt = Nt.map(
|
|
1974
|
-
(ue) => ue.id === d.id ?
|
|
1974
|
+
(ue) => ue.id === d.id ? K : ue
|
|
1975
1975
|
);
|
|
1976
1976
|
}
|
|
1977
1977
|
} else
|
|
@@ -2016,20 +2016,20 @@ function hi(e, t, n) {
|
|
|
2016
2016
|
suppressOverflowDim: !1,
|
|
2017
2017
|
showRotationHandle: g,
|
|
2018
2018
|
editModeData: w ? (() => {
|
|
2019
|
-
const
|
|
2019
|
+
const Ke = xe.current, Ue = Date.now() - ie.current < be, Ae = Ke && Ue;
|
|
2020
2020
|
return {
|
|
2021
|
-
cursorPosition: Ae ?
|
|
2022
|
-
selectionStart: Ae ?
|
|
2023
|
-
selectionEnd: Ae ?
|
|
2021
|
+
cursorPosition: Ae ? Ke.cursor : O,
|
|
2022
|
+
selectionStart: Ae ? Ke.start : u,
|
|
2023
|
+
selectionEnd: Ae ? Ke.end : q,
|
|
2024
2024
|
editText: ne,
|
|
2025
|
-
editRichText:
|
|
2025
|
+
editRichText: V,
|
|
2026
2026
|
cursorOpacity: U.current,
|
|
2027
2027
|
isTouchDevice: le,
|
|
2028
|
-
selectionHandlePositionsRef:
|
|
2028
|
+
selectionHandlePositionsRef: H
|
|
2029
2029
|
};
|
|
2030
2030
|
})() : void 0
|
|
2031
2031
|
}), Ee && Ee.pieces.length > 0 && $) {
|
|
2032
|
-
let
|
|
2032
|
+
let Ke = !1;
|
|
2033
2033
|
const Ue = gt ?? null;
|
|
2034
2034
|
if (Ue && Ee) {
|
|
2035
2035
|
const ue = Ue.getVisualBoundingBox();
|
|
@@ -2039,19 +2039,19 @@ function hi(e, t, n) {
|
|
|
2039
2039
|
if (Je.kind !== "dieCut") continue;
|
|
2040
2040
|
const Ge = Je.path;
|
|
2041
2041
|
if (Ge.kind !== "rect" && Ge.kind !== "roundedRect") {
|
|
2042
|
-
|
|
2042
|
+
Ke = !0;
|
|
2043
2043
|
break e;
|
|
2044
2044
|
}
|
|
2045
2045
|
const Fe = me.x + (Ge.x ?? 0), nt = me.y + (Ge.y ?? 0), st = Ge.width ?? 0, xt = Ge.height ?? 0;
|
|
2046
2046
|
if (ue.x < Fe + st && ue.x + ue.width > Fe && ue.y < nt + xt && ue.y + ue.height > nt) {
|
|
2047
|
-
|
|
2047
|
+
Ke = !0;
|
|
2048
2048
|
break e;
|
|
2049
2049
|
}
|
|
2050
2050
|
}
|
|
2051
2051
|
}
|
|
2052
2052
|
}
|
|
2053
|
-
const Ae =
|
|
2054
|
-
if (
|
|
2053
|
+
const Ae = Ke, K = Ze > 0 && $ !== void 0;
|
|
2054
|
+
if (K && (se.save(), se.beginPath(), se.roundRect(
|
|
2055
2055
|
$.x,
|
|
2056
2056
|
$.y,
|
|
2057
2057
|
$.width,
|
|
@@ -2069,7 +2069,7 @@ function hi(e, t, n) {
|
|
|
2069
2069
|
zoom: A,
|
|
2070
2070
|
interacting: Ae,
|
|
2071
2071
|
focusedPieceId: e.focusedPieceId ?? null
|
|
2072
|
-
}),
|
|
2072
|
+
}), K && se.restore(), e.focusedPieceId && Ee.pieces.length > 1) {
|
|
2073
2073
|
const ue = e.focusedPieceRect ?? Ee.pieces.find((me) => me.id === e.focusedPieceId) ?? null;
|
|
2074
2074
|
if (ue) {
|
|
2075
2075
|
se.save(), se.translate($.x, $.y), se.globalCompositeOperation = "destination-out";
|
|
@@ -2115,7 +2115,7 @@ function hi(e, t, n) {
|
|
|
2115
2115
|
zoom: A,
|
|
2116
2116
|
paddingOffset: { x: R, y: E }
|
|
2117
2117
|
});
|
|
2118
|
-
const tn = pt ? zt : De, Yt = new Set(Nt.map((
|
|
2118
|
+
const tn = pt ? zt : De, Yt = new Set(Nt.map((Ke) => Ke.id)), { updatedOBB: wt, groupBounds: Xt } = ri({
|
|
2119
2119
|
ctx: se,
|
|
2120
2120
|
displaySelection: tn,
|
|
2121
2121
|
elements: o,
|
|
@@ -2270,17 +2270,17 @@ function xi(e) {
|
|
|
2270
2270
|
function yi(e) {
|
|
2271
2271
|
const { selectedElement: t, activeChildElement: n } = e;
|
|
2272
2272
|
let s = null, o = -1;
|
|
2273
|
-
if (n instanceof
|
|
2273
|
+
if (n instanceof Lt && n.isCropping)
|
|
2274
2274
|
s = n, t instanceof Re && (o = t.children.findIndex((a) => a.id === n.id));
|
|
2275
2275
|
else if (t instanceof Re)
|
|
2276
2276
|
for (let a = 0; a < t.children.length; a++) {
|
|
2277
2277
|
const l = t.children[a];
|
|
2278
|
-
if (l.visible !== !1 && l instanceof
|
|
2278
|
+
if (l.visible !== !1 && l instanceof Lt && l.isCropping) {
|
|
2279
2279
|
s = l, o = a;
|
|
2280
2280
|
break;
|
|
2281
2281
|
}
|
|
2282
2282
|
}
|
|
2283
|
-
const i = s || (t instanceof
|
|
2283
|
+
const i = s || (t instanceof Lt && t.isCropping ? t : null);
|
|
2284
2284
|
return i ? {
|
|
2285
2285
|
croppingImage: i,
|
|
2286
2286
|
croppingChild: s,
|
|
@@ -2471,14 +2471,14 @@ function Mi(e) {
|
|
|
2471
2471
|
selectionStart: D,
|
|
2472
2472
|
selectionEnd: w,
|
|
2473
2473
|
isRotating: ne,
|
|
2474
|
-
isMarqueeSelecting:
|
|
2474
|
+
isMarqueeSelecting: V,
|
|
2475
2475
|
isAltKeyPressed: O,
|
|
2476
2476
|
selectedElement: u,
|
|
2477
2477
|
activeChildElement: q,
|
|
2478
2478
|
elements: U,
|
|
2479
2479
|
multiSelection: te,
|
|
2480
2480
|
multiSelectionOBBRef: le,
|
|
2481
|
-
zoom:
|
|
2481
|
+
zoom: H,
|
|
2482
2482
|
paddingOffsetX: xe,
|
|
2483
2483
|
paddingOffsetY: ie,
|
|
2484
2484
|
spacingIndicators: be,
|
|
@@ -2504,7 +2504,7 @@ function Mi(e) {
|
|
|
2504
2504
|
penTool: _,
|
|
2505
2505
|
cropController: Ce,
|
|
2506
2506
|
onElementUpdate: Ie,
|
|
2507
|
-
executeElementUpdate:
|
|
2507
|
+
executeElementUpdate: Ve,
|
|
2508
2508
|
onSelectionChange: Xe,
|
|
2509
2509
|
onMultiSelectionChange: Y,
|
|
2510
2510
|
onRotationStateChange: $,
|
|
@@ -2521,9 +2521,9 @@ function Mi(e) {
|
|
|
2521
2521
|
setEditRichText: rn,
|
|
2522
2522
|
setIsEditing: on,
|
|
2523
2523
|
setCurrentFormattingStyle: Ut,
|
|
2524
|
-
getWrappedTextForEditing:
|
|
2525
|
-
} = e, Ue = we(null), Ae = we(/* @__PURE__ */ new Map()),
|
|
2526
|
-
|
|
2524
|
+
getWrappedTextForEditing: Ke
|
|
2525
|
+
} = e, Ue = we(null), Ae = we(/* @__PURE__ */ new Map()), K = we(null), ue = we(null), me = we(null), Be = we(null), Je = we(null), Ge = we(null), Fe = we(null), { userZoom: nt, setUserZoom: st, panOffset: xt, setPanOffset: yt } = Ts(), Ht = we(nt);
|
|
2526
|
+
Ht.current = nt;
|
|
2527
2527
|
const ve = we(xt);
|
|
2528
2528
|
ve.current = xt, Pe(() => {
|
|
2529
2529
|
const z = t.current;
|
|
@@ -2537,7 +2537,7 @@ function Mi(e) {
|
|
|
2537
2537
|
}, [t]), Pe(() => {
|
|
2538
2538
|
const z = t.current;
|
|
2539
2539
|
z && (Ue.current = z.getBoundingClientRect());
|
|
2540
|
-
}, [
|
|
2540
|
+
}, [H, t]);
|
|
2541
2541
|
const as = ft(
|
|
2542
2542
|
(z) => {
|
|
2543
2543
|
var j, pe, ke, ee, J;
|
|
@@ -2546,14 +2546,14 @@ function Mi(e) {
|
|
|
2546
2546
|
if (!fe) return;
|
|
2547
2547
|
const dt = fe.getBoundingClientRect();
|
|
2548
2548
|
Ue.current = dt;
|
|
2549
|
-
const W = (z.clientX - dt.left) /
|
|
2549
|
+
const W = (z.clientX - dt.left) / H - xe, Z = (z.clientY - dt.top) / H - ie;
|
|
2550
2550
|
Ae.current.size === 0 && (me.current = (u == null ? void 0 : u.id) ?? null), Ae.current.set(z.pointerId, {
|
|
2551
2551
|
x: W,
|
|
2552
2552
|
y: Z,
|
|
2553
2553
|
clientX: z.clientX,
|
|
2554
2554
|
clientY: z.clientY
|
|
2555
2555
|
});
|
|
2556
|
-
const et = g || u instanceof
|
|
2556
|
+
const et = g || u instanceof Lt && u.isCropping || _.isActive();
|
|
2557
2557
|
if (Ae.current.size === 2 && !et) {
|
|
2558
2558
|
const k = Array.from(Ae.current.keys()), X = Ae.current.get(k[0]), M = Ae.current.get(k[1]), F = me.current !== null;
|
|
2559
2559
|
if (!(F && u && !u.locked && (u.hitTest(X.x, X.y) || u.hitTest(M.x, M.y)))) {
|
|
@@ -2567,17 +2567,17 @@ function Mi(e) {
|
|
|
2567
2567
|
), b.current = null;
|
|
2568
2568
|
}
|
|
2569
2569
|
!F && u && Xe(null), h.isInteracting() && h.end(), Fe.current = null, Be.current = null, Je.current = null, delete h._pendingTextEditMode, delete h._pendingChildSelection;
|
|
2570
|
-
const oe = M.clientX - X.clientX, Me = M.clientY - X.clientY,
|
|
2570
|
+
const oe = M.clientX - X.clientX, Me = M.clientY - X.clientY, Le = Math.hypot(oe, Me), bt = (((j = fe.parentElement) == null ? void 0 : j.parentElement) ?? fe).getBoundingClientRect();
|
|
2571
2571
|
Ge.current = {
|
|
2572
2572
|
pointerA: k[0],
|
|
2573
2573
|
pointerB: k[1],
|
|
2574
|
-
startUserZoom:
|
|
2574
|
+
startUserZoom: Ht.current,
|
|
2575
2575
|
startPanOffset: { ...ve.current },
|
|
2576
2576
|
startCentroidClient: {
|
|
2577
2577
|
x: (X.clientX + M.clientX) / 2,
|
|
2578
2578
|
y: (X.clientY + M.clientY) / 2
|
|
2579
2579
|
},
|
|
2580
|
-
startDistance: Math.max(
|
|
2580
|
+
startDistance: Math.max(Le, 1),
|
|
2581
2581
|
containerRect: { left: bt.left, top: bt.top }
|
|
2582
2582
|
};
|
|
2583
2583
|
try {
|
|
@@ -2595,12 +2595,12 @@ function Mi(e) {
|
|
|
2595
2595
|
const ae = gt().find(
|
|
2596
2596
|
(oe) => oe.id === F.element.id
|
|
2597
2597
|
);
|
|
2598
|
-
|
|
2598
|
+
Ve(ae, F.element);
|
|
2599
2599
|
}
|
|
2600
2600
|
h.end();
|
|
2601
2601
|
}
|
|
2602
2602
|
const k = Array.from(Ae.current.keys());
|
|
2603
|
-
|
|
2603
|
+
K.current = { a: k[0], b: k[1] };
|
|
2604
2604
|
const X = Ae.current.get(k[0]), M = Ae.current.get(k[1]);
|
|
2605
2605
|
Be.current = null, Je.current = null, Fe.current = null, ue.current = u.clone(), h.startPinch(u, X, M);
|
|
2606
2606
|
try {
|
|
@@ -2614,7 +2614,7 @@ function Mi(e) {
|
|
|
2614
2614
|
if (N && D !== w) {
|
|
2615
2615
|
const k = m.current;
|
|
2616
2616
|
if (k.start || k.end) {
|
|
2617
|
-
const X = en.toRadiansInverse(u.rotation), M = u.getRotationAnchor(), F = W - M.x, ae = Z - M.y, oe = Math.cos(X), Me = Math.sin(X),
|
|
2617
|
+
const X = en.toRadiansInverse(u.rotation), M = u.getRotationAnchor(), F = W - M.x, ae = Z - M.y, oe = Math.cos(X), Me = Math.sin(X), Le = F * oe - ae * Me, it = F * Me + ae * oe, bt = Le, Bt = it, St = 44 / H;
|
|
2618
2618
|
if (k.start && Math.sqrt(
|
|
2619
2619
|
Math.pow(bt - k.start.center.x, 2) + Math.pow(Bt - k.start.center.y, 2)
|
|
2620
2620
|
) <= St) {
|
|
@@ -2631,7 +2631,7 @@ function Mi(e) {
|
|
|
2631
2631
|
}
|
|
2632
2632
|
if (u.hitTest(W, Z)) {
|
|
2633
2633
|
z.preventDefault(), s.current = !0;
|
|
2634
|
-
const k = u.getVisualBoundingBox(), X = en.toRadiansInverse(u.rotation), M = u.getRotationAnchor(), F = W - M.x, ae = Z - M.y, oe = Math.cos(X), Me = Math.sin(X),
|
|
2634
|
+
const k = u.getVisualBoundingBox(), X = en.toRadiansInverse(u.rotation), M = u.getRotationAnchor(), F = W - M.x, ae = Z - M.y, oe = Math.cos(X), Me = Math.sin(X), Le = F * oe - ae * Me, it = F * Me + ae * oe, bt = Le + k.width / 2, Bt = it + k.height / 2, St = Sn(u, { x: bt, y: Bt }), Et = Date.now();
|
|
2635
2635
|
if (Et - a.current < I) {
|
|
2636
2636
|
(ee = n.current) == null || ee.focus();
|
|
2637
2637
|
return;
|
|
@@ -2662,7 +2662,7 @@ function Mi(e) {
|
|
|
2662
2662
|
return;
|
|
2663
2663
|
}
|
|
2664
2664
|
if (te.length > 0 && E.current) {
|
|
2665
|
-
const k = E.current, X = pi({ x: W, y: Z, bounds: k, zoom:
|
|
2665
|
+
const k = E.current, X = pi({ x: W, y: Z, bounds: k, zoom: H });
|
|
2666
2666
|
if (X.type === "corner-handle") {
|
|
2667
2667
|
if (mi({
|
|
2668
2668
|
multiSelection: te,
|
|
@@ -2709,7 +2709,7 @@ function Mi(e) {
|
|
|
2709
2709
|
if (B && B.visible !== !1 && !B.locked && (te.length === 0 || q)) {
|
|
2710
2710
|
const k = yi({ selectedElement: u || null, activeChildElement: q });
|
|
2711
2711
|
if (k) {
|
|
2712
|
-
const M = bi({ x: W, y: Z, cropContext: k, transformHandles: G, zoom:
|
|
2712
|
+
const M = bi({ x: W, y: Z, cropContext: k, transformHandles: G, zoom: H });
|
|
2713
2713
|
if (M.type === "crop-handle") {
|
|
2714
2714
|
vi({
|
|
2715
2715
|
cropContext: k,
|
|
@@ -2751,12 +2751,12 @@ function Mi(e) {
|
|
|
2751
2751
|
onElementUpdate: Ie,
|
|
2752
2752
|
transformHandles: G,
|
|
2753
2753
|
updateActiveChild: Ze,
|
|
2754
|
-
zoom:
|
|
2754
|
+
zoom: H
|
|
2755
2755
|
}), We((F) => F + 1);
|
|
2756
2756
|
return;
|
|
2757
2757
|
}
|
|
2758
2758
|
}
|
|
2759
|
-
if (G.hitTestRotation(W, Z,
|
|
2759
|
+
if (G.hitTestRotation(W, Z, H)) {
|
|
2760
2760
|
if (B.locked) return;
|
|
2761
2761
|
const M = B.getBoundingBox(), F = Es(M), ae = lr(F.x, F.y, W, Z);
|
|
2762
2762
|
$e(!0), at(ae), pt(B.rotation), h.startRotate(B, W, Z, ae, B.rotation), q && u instanceof Re && (h._activeChildContext = {
|
|
@@ -2765,7 +2765,7 @@ function Mi(e) {
|
|
|
2765
2765
|
}), Be.current = B.id, Je.current = { x: W, y: Z }, se({});
|
|
2766
2766
|
return;
|
|
2767
2767
|
}
|
|
2768
|
-
const X = G.hitTestResize(W, Z,
|
|
2768
|
+
const X = G.hitTestResize(W, Z, H);
|
|
2769
2769
|
if (X) {
|
|
2770
2770
|
if (B.locked) return;
|
|
2771
2771
|
const M = B.getBoundingBox(), F = B.getVisualBoundingBox();
|
|
@@ -2807,13 +2807,13 @@ function Mi(e) {
|
|
|
2807
2807
|
dragOriginalElementsRef: b,
|
|
2808
2808
|
setHoverState: Ee,
|
|
2809
2809
|
forceUpdate: se,
|
|
2810
|
-
zoom:
|
|
2810
|
+
zoom: H
|
|
2811
2811
|
})) return;
|
|
2812
|
-
Zs({ updateActiveChild: Ze, selectedElement: u || null, transformHandles: G, setHandlesVersion: We, zoom:
|
|
2812
|
+
Zs({ updateActiveChild: Ze, selectedElement: u || null, transformHandles: G, setHandlesVersion: We, zoom: H });
|
|
2813
2813
|
return;
|
|
2814
2814
|
}
|
|
2815
2815
|
if (q) {
|
|
2816
|
-
Zs({ updateActiveChild: Ze, selectedElement: u || null, transformHandles: G, setHandlesVersion: We, zoom:
|
|
2816
|
+
Zs({ updateActiveChild: Ze, selectedElement: u || null, transformHandles: G, setHandlesVersion: We, zoom: H });
|
|
2817
2817
|
return;
|
|
2818
2818
|
}
|
|
2819
2819
|
if (!z.shiftKey) {
|
|
@@ -2871,9 +2871,9 @@ function Mi(e) {
|
|
|
2871
2871
|
setHoverState: Ee,
|
|
2872
2872
|
forceUpdate: se
|
|
2873
2873
|
})) return;
|
|
2874
|
-
const
|
|
2875
|
-
if (!
|
|
2876
|
-
if (
|
|
2874
|
+
const L = zr.shouldProtectClick(), Q = Dr(z.target);
|
|
2875
|
+
if (!L && !Q)
|
|
2876
|
+
if (Ht.current > 1.001) {
|
|
2877
2877
|
Fe.current = {
|
|
2878
2878
|
pointerId: z.pointerId,
|
|
2879
2879
|
startClientX: z.clientX,
|
|
@@ -2901,9 +2901,9 @@ function Mi(e) {
|
|
|
2901
2901
|
te,
|
|
2902
2902
|
h,
|
|
2903
2903
|
_,
|
|
2904
|
-
|
|
2904
|
+
Ve,
|
|
2905
2905
|
We,
|
|
2906
|
-
|
|
2906
|
+
H,
|
|
2907
2907
|
Te,
|
|
2908
2908
|
Oe,
|
|
2909
2909
|
De,
|
|
@@ -2918,7 +2918,7 @@ function Mi(e) {
|
|
|
2918
2918
|
if (z.buttons === 2) return;
|
|
2919
2919
|
const fe = t.current;
|
|
2920
2920
|
if (!fe) return;
|
|
2921
|
-
const dt = Ue.current ?? fe.getBoundingClientRect(), W = (z.clientX - dt.left) /
|
|
2921
|
+
const dt = Ue.current ?? fe.getBoundingClientRect(), W = (z.clientX - dt.left) / H - xe, Z = (z.clientY - dt.top) / H - ie;
|
|
2922
2922
|
if (p.current = { x: W, y: Z }, Ae.current.has(z.pointerId) && Ae.current.set(z.pointerId, {
|
|
2923
2923
|
x: W,
|
|
2924
2924
|
y: Z,
|
|
@@ -2927,12 +2927,12 @@ function Mi(e) {
|
|
|
2927
2927
|
}), Ge.current) {
|
|
2928
2928
|
const B = Ge.current, ge = Ae.current.get(B.pointerA), S = Ae.current.get(B.pointerB);
|
|
2929
2929
|
if (ge && S) {
|
|
2930
|
-
const
|
|
2930
|
+
const L = S.clientX - ge.clientX, Q = S.clientY - ge.clientY, pe = Math.hypot(L, Q) / B.startDistance, ke = Math.min(
|
|
2931
2931
|
Math.max(B.startUserZoom * pe, 0.25),
|
|
2932
2932
|
8
|
|
2933
2933
|
), ee = B.startCentroidClient.x - B.containerRect.left, J = B.startCentroidClient.y - B.containerRect.top, k = (ge.clientX + S.clientX) / 2 - B.containerRect.left, X = (ge.clientY + S.clientY) / 2 - B.containerRect.top, M = ke / B.startUserZoom, F = k - (ee - B.startPanOffset.x) * M, ae = X - (J - B.startPanOffset.y) * M, oe = t.current;
|
|
2934
2934
|
if (oe) {
|
|
2935
|
-
const Me = oe.getBoundingClientRect(),
|
|
2935
|
+
const Me = oe.getBoundingClientRect(), Le = (et = oe.parentElement) == null ? void 0 : et.parentElement, it = (Le == null ? void 0 : Le.clientWidth) ?? Me.width, bt = (Le == null ? void 0 : Le.clientHeight) ?? Me.height, Bt = 80, St = ke / Math.max(Ht.current, 1e-4), Et = Me.width * St, Gt = Me.height * St, ut = ve.current.x, kt = ve.current.y, kn = Me.left - B.containerRect.left, Ft = Me.top - B.containerRect.top, qt = kn + (F - ut), jt = Ft + (ae - kt), _t = Math.min(
|
|
2936
2936
|
Math.max(qt, -Et + Bt),
|
|
2937
2937
|
it - Bt
|
|
2938
2938
|
), $t = Math.min(
|
|
@@ -2955,17 +2955,17 @@ function Mi(e) {
|
|
|
2955
2955
|
B.movedPastThreshold = !0, B.pendingTap = null;
|
|
2956
2956
|
else
|
|
2957
2957
|
return;
|
|
2958
|
-
if (
|
|
2958
|
+
if (Ht.current <= 1.001) return;
|
|
2959
2959
|
yt({
|
|
2960
2960
|
x: B.startPanOffset.x + ge,
|
|
2961
2961
|
y: B.startPanOffset.y + S
|
|
2962
2962
|
});
|
|
2963
2963
|
return;
|
|
2964
2964
|
}
|
|
2965
|
-
if (h.getMode() === "pinch" &&
|
|
2966
|
-
const { a: B, b: ge } =
|
|
2967
|
-
if (S &&
|
|
2968
|
-
const Q = h.updatePinch(S,
|
|
2965
|
+
if (h.getMode() === "pinch" && K.current) {
|
|
2966
|
+
const { a: B, b: ge } = K.current, S = Ae.current.get(B), L = Ae.current.get(ge);
|
|
2967
|
+
if (S && L) {
|
|
2968
|
+
const Q = h.updatePinch(S, L), { element: j, startData: pe } = h.getPinchContext();
|
|
2969
2969
|
fi.calculatePinch({
|
|
2970
2970
|
element: j,
|
|
2971
2971
|
startData: pe,
|
|
@@ -2984,7 +2984,7 @@ function Mi(e) {
|
|
|
2984
2984
|
return;
|
|
2985
2985
|
}
|
|
2986
2986
|
if (d.current && u instanceof Qe) {
|
|
2987
|
-
const B = u.getVisualBoundingBox(), ge = u.getRotationAnchor(), S = en.toRadiansInverse(u.rotation),
|
|
2987
|
+
const B = u.getVisualBoundingBox(), ge = u.getRotationAnchor(), S = en.toRadiansInverse(u.rotation), L = W - ge.x, Q = Z - ge.y, j = Math.cos(S), pe = Math.sin(S), ke = L * j - Q * pe, ee = L * pe + Q * j, J = m.current;
|
|
2988
2988
|
let k = 0;
|
|
2989
2989
|
d.current === "start" && (J != null && J.start) ? k = J.start.textEdge.y - J.start.center.y : d.current === "end" && (J != null && J.end) && (k = J.end.textEdge.y - J.end.center.y);
|
|
2990
2990
|
const X = ke + B.width / 2, M = ee + k + B.height / 2, F = Sn(u, { x: X, y: M });
|
|
@@ -2998,59 +2998,59 @@ function Mi(e) {
|
|
|
2998
2998
|
_.isDraggingHandle() ? (_.updateHandle(W - u.x, Z - u.y), We((B) => B + 1)) : (_.setPreviewPoint(W - u.x, Z - u.y), We((B) => B + 1));
|
|
2999
2999
|
return;
|
|
3000
3000
|
}
|
|
3001
|
-
if (z.altKey !== O && Pt(z.altKey),
|
|
3001
|
+
if (z.altKey !== O && Pt(z.altKey), V) {
|
|
3002
3002
|
Dt(W, Z, U);
|
|
3003
3003
|
return;
|
|
3004
3004
|
}
|
|
3005
3005
|
if (h.getMode() === "drag") {
|
|
3006
3006
|
const B = h._multiSelectionDragContext;
|
|
3007
3007
|
if (B && te.length > 0) {
|
|
3008
|
-
const { dx: ge, dy: S } =
|
|
3008
|
+
const { dx: ge, dy: S } = Vs(
|
|
3009
3009
|
W - B.startX,
|
|
3010
3010
|
Z - B.startY,
|
|
3011
3011
|
{ shift: z.shiftKey }
|
|
3012
3012
|
);
|
|
3013
3013
|
B.currentElements || (B.currentElements = /* @__PURE__ */ new Map());
|
|
3014
|
-
const
|
|
3014
|
+
const L = [];
|
|
3015
3015
|
B.elementsStartData.forEach((Q) => {
|
|
3016
3016
|
const j = Q.element, pe = Q.startData, ke = j.clone();
|
|
3017
|
-
ke.x = pe.x + ge, ke.y = pe.y + S, B.currentElements.set(ke.id, ke),
|
|
3018
|
-
}), lt((Q) => Q.map((j) =>
|
|
3017
|
+
ke.x = pe.x + ge, ke.y = pe.y + S, B.currentElements.set(ke.id, ke), L.push(ke);
|
|
3018
|
+
}), lt((Q) => Q.map((j) => L.find((pe) => pe.id === j.id) || j)), B.currentDelta = { dx: ge, dy: S }, !B.startOBB && le.current && (B.startOBB = { ...le.current }), We((Q) => Q + 1), se({});
|
|
3019
3019
|
return;
|
|
3020
3020
|
}
|
|
3021
3021
|
}
|
|
3022
3022
|
if (h.getMode() === "drag" && u) {
|
|
3023
3023
|
if (h.getDragMode() === "crop-image-drag") {
|
|
3024
3024
|
const ee = h.getContext(), J = ee.element;
|
|
3025
|
-
if (J instanceof
|
|
3025
|
+
if (J instanceof Lt && J.isCropping) {
|
|
3026
3026
|
const k = Ce.handleCropImageDrag(J, ee, W, Z), X = h._cropGroupContext, M = h._activeChildContext, F = X || M;
|
|
3027
3027
|
if (F && u instanceof Re) {
|
|
3028
3028
|
const ae = J.clone();
|
|
3029
3029
|
ae.x = k.x, ae.y = k.y, ae.updateCrop(k.cropX, k.cropY, k.cropWidth, k.cropHeight, !1);
|
|
3030
3030
|
const oe = u.clone(), Me = X ? X.childIndex : oe.children.findIndex((it) => it.id === F.childId);
|
|
3031
3031
|
Me >= 0 && (oe.children[Me] = ae, oe.updateBoundsFromChildren(!0)), lt((it) => it.map((bt) => bt.id === oe.id ? oe : bt));
|
|
3032
|
-
const
|
|
3033
|
-
|
|
3032
|
+
const Le = h.getContext();
|
|
3033
|
+
Le._cachedElement || (Le._cachedElement = {}), Le._cachedElement[oe.id] = oe, M && Me >= 0 && (Ze(oe.children[Me]), G.update(ae, H)), We((it) => it + 1);
|
|
3034
3034
|
} else {
|
|
3035
3035
|
const ae = J.clone();
|
|
3036
3036
|
ae.x = k.x, ae.y = k.y, ae.updateCrop(k.cropX, k.cropY, k.cropWidth, k.cropHeight, !1), lt(
|
|
3037
|
-
(Me) => Me.map((
|
|
3037
|
+
(Me) => Me.map((Le) => Le.id === ae.id ? ae : Le)
|
|
3038
3038
|
);
|
|
3039
3039
|
const oe = h.getContext();
|
|
3040
|
-
oe._cachedElement || (oe._cachedElement = {}), oe._cachedElement[ae.id] = ae, G.update(ae,
|
|
3040
|
+
oe._cachedElement || (oe._cachedElement = {}), oe._cachedElement[ae.id] = ae, G.update(ae, H), We((Me) => Me + 1);
|
|
3041
3041
|
}
|
|
3042
3042
|
return;
|
|
3043
3043
|
}
|
|
3044
3044
|
}
|
|
3045
|
-
const ge = h._activeChildContext, S = gt(),
|
|
3045
|
+
const ge = h._activeChildContext, S = gt(), L = [];
|
|
3046
3046
|
S.forEach((ee) => {
|
|
3047
|
-
ee instanceof Re ?
|
|
3047
|
+
ee instanceof Re ? L.push(...ee.children) : L.push(ee);
|
|
3048
3048
|
});
|
|
3049
3049
|
const Q = { shift: z.shiftKey };
|
|
3050
|
-
let j = h.updateDrag(W, Z,
|
|
3050
|
+
let j = h.updateDrag(W, Z, L, Q);
|
|
3051
3051
|
const pe = ge && u instanceof Re ? u.children.find((ee) => ee.id === ge.childId) : u;
|
|
3052
|
-
if (pe && (j = he.snapToSpacing(j, pe,
|
|
3053
|
-
const ee = h.getContext(), J = ee.startData, { lockedAxis: k } =
|
|
3052
|
+
if (pe && (j = he.snapToSpacing(j, pe, L), Q.shift)) {
|
|
3053
|
+
const ee = h.getContext(), J = ee.startData, { lockedAxis: k } = Vs(W - ee.startX, Z - ee.startY, Q);
|
|
3054
3054
|
k === "x" ? j.x = J.x : k === "y" && (j.y = J.y);
|
|
3055
3055
|
}
|
|
3056
3056
|
if (ge && u instanceof Re) {
|
|
@@ -3063,7 +3063,7 @@ function Mi(e) {
|
|
|
3063
3063
|
const k = h.getContext();
|
|
3064
3064
|
if (k._cachedElement || (k._cachedElement = {}), k._cachedElement[ee.id] = ee, J >= 0) {
|
|
3065
3065
|
const X = ee.children[J];
|
|
3066
|
-
Ze(X), G.update(X,
|
|
3066
|
+
Ze(X), G.update(X, H);
|
|
3067
3067
|
}
|
|
3068
3068
|
We((X) => X + 1), se({});
|
|
3069
3069
|
} else {
|
|
@@ -3073,7 +3073,7 @@ function Mi(e) {
|
|
|
3073
3073
|
J.move(F, ae);
|
|
3074
3074
|
} else
|
|
3075
3075
|
J.x = j.x, J.y = j.y;
|
|
3076
|
-
lt((X) => X.map((M) => M.id === J.id ? J : M)), G.update(J,
|
|
3076
|
+
lt((X) => X.map((M) => M.id === J.id ? J : M)), G.update(J, H);
|
|
3077
3077
|
const k = h.getContext();
|
|
3078
3078
|
k._cachedElement || (k._cachedElement = {}), k._cachedElement[J.id] = J;
|
|
3079
3079
|
}
|
|
@@ -3086,13 +3086,13 @@ function Mi(e) {
|
|
|
3086
3086
|
ee._cachedElement && u ? ke = ee._cachedElement[u.id] : ke = u || void 0;
|
|
3087
3087
|
}
|
|
3088
3088
|
if (ke) {
|
|
3089
|
-
const ee = he.detectSpacing(ke,
|
|
3089
|
+
const ee = he.detectSpacing(ke, L, O);
|
|
3090
3090
|
At(ee);
|
|
3091
3091
|
}
|
|
3092
3092
|
} else if (h.getMode() === "resize") {
|
|
3093
|
-
const { dx: B, dy: ge } = h.updateResize(W, Z), S = h.getResizeContext(),
|
|
3094
|
-
if (
|
|
3095
|
-
const k =
|
|
3093
|
+
const { dx: B, dy: ge } = h.updateResize(W, Z), S = h.getResizeContext(), L = h._multiSelectionResizeContext;
|
|
3094
|
+
if (L && te.length > 0) {
|
|
3095
|
+
const k = L.startBounds, X = L.anchor;
|
|
3096
3096
|
let M, F, ae, oe;
|
|
3097
3097
|
switch (X) {
|
|
3098
3098
|
case "top-left":
|
|
@@ -3110,7 +3110,7 @@ function Mi(e) {
|
|
|
3110
3110
|
default:
|
|
3111
3111
|
M = k.minX, F = k.minY, ae = k.maxX, oe = k.maxY;
|
|
3112
3112
|
}
|
|
3113
|
-
const Me = ae + B,
|
|
3113
|
+
const Me = ae + B, Le = oe + ge, it = Math.abs(ae - M), bt = Math.abs(oe - F), Bt = Math.abs(Me - M), St = Math.abs(Le - F), Et = it > 0 ? Bt / it : 1, Gt = bt > 0 ? St / bt : 1, ut = (Et + Gt) / 2, kt = k.maxX - k.minX, kn = k.maxY - k.minY, Ft = kt * ut, qt = kn * ut;
|
|
3114
3114
|
let jt = M, _t = F, $t = M, an = F;
|
|
3115
3115
|
switch (X) {
|
|
3116
3116
|
case "top-left":
|
|
@@ -3126,26 +3126,26 @@ function Mi(e) {
|
|
|
3126
3126
|
jt = M, _t = F, $t = M + Ft, an = F + qt;
|
|
3127
3127
|
break;
|
|
3128
3128
|
}
|
|
3129
|
-
if (
|
|
3130
|
-
const
|
|
3131
|
-
if (Wt instanceof
|
|
3132
|
-
Wt.x =
|
|
3129
|
+
if (L.elementsStartData.forEach((Ln) => {
|
|
3130
|
+
const Vn = Ln.element, nn = Ln.startData, ls = nn.x - M, ds = nn.y - F, Kn = M + ls * ut, Un = F + ds * ut, Wt = Vn.clone();
|
|
3131
|
+
if (Wt instanceof Lt) {
|
|
3132
|
+
Wt.x = Kn, Wt.y = Un;
|
|
3133
3133
|
const Rn = Wt.transformData, yn = nn.transformData;
|
|
3134
3134
|
Rn.width = yn.width * ut, Rn.height = yn.height * ut;
|
|
3135
3135
|
} else if (Wt instanceof Re) {
|
|
3136
|
-
Wt.x =
|
|
3136
|
+
Wt.x = Kn, Wt.y = Un;
|
|
3137
3137
|
const Rn = nn.width * ut, yn = nn.height * ut;
|
|
3138
3138
|
Wt.resize(X, Rn, yn, nn);
|
|
3139
3139
|
} else {
|
|
3140
3140
|
const Rn = nn.width * ut, yn = nn.height * ut;
|
|
3141
|
-
Wt.resize(X, Rn, yn, nn), Wt.x =
|
|
3141
|
+
Wt.resize(X, Rn, yn, nn), Wt.x = Kn, Wt.y = Un;
|
|
3142
3142
|
}
|
|
3143
3143
|
Ie(Wt);
|
|
3144
3144
|
}), le.current) {
|
|
3145
|
-
const
|
|
3145
|
+
const Ln = (jt + $t) / 2, Vn = (_t + an) / 2;
|
|
3146
3146
|
le.current = {
|
|
3147
|
-
centerX:
|
|
3148
|
-
centerY:
|
|
3147
|
+
centerX: Ln,
|
|
3148
|
+
centerY: Vn,
|
|
3149
3149
|
width: $t - jt,
|
|
3150
3150
|
height: an - _t,
|
|
3151
3151
|
rotation: le.current.rotation
|
|
@@ -3154,15 +3154,15 @@ function Mi(e) {
|
|
|
3154
3154
|
return;
|
|
3155
3155
|
}
|
|
3156
3156
|
const Q = S.element;
|
|
3157
|
-
if (Q instanceof
|
|
3157
|
+
if (Q instanceof Lt && Q.isCropping && S.handle.anchor && S.handle.anchor.startsWith("crop-")) {
|
|
3158
3158
|
const k = S.handle.anchor.replace("crop-", ""), X = h.getContext(), M = Ce.handleCropBoxResize(Q, k, S, X, W, Z);
|
|
3159
3159
|
fe.style.cursor = M.cursor;
|
|
3160
3160
|
const F = h._cropGroupContext, ae = h._activeChildContext, oe = F || ae;
|
|
3161
3161
|
if (oe && u instanceof Re) {
|
|
3162
3162
|
const Me = Q.clone();
|
|
3163
3163
|
Me.x = M.x, Me.y = M.y, Me.rotation = M.rotation, Me.transformData.width = M.width, Me.transformData.height = M.height, Me.updateCrop(M.cropX, M.cropY, M.cropWidth, M.cropHeight, !1);
|
|
3164
|
-
const
|
|
3165
|
-
it >= 0 && (
|
|
3164
|
+
const Le = u.clone(), it = F ? F.childIndex : Le.children.findIndex((bt) => bt.id === oe.childId);
|
|
3165
|
+
it >= 0 && (Le.children[it] = Me, Le.updateBoundsFromChildren(!0)), Ie(Le), ae && it >= 0 && Ze(Le.children[it]);
|
|
3166
3166
|
} else {
|
|
3167
3167
|
const Me = Q.clone();
|
|
3168
3168
|
Me.x = M.x, Me.y = M.y, Me.rotation = M.rotation, Me.transformData.width = M.width, Me.transformData.height = M.height, Me.updateCrop(M.cropX, M.cropY, M.cropWidth, M.cropHeight, !1), Ie(Me);
|
|
@@ -3187,9 +3187,9 @@ function Mi(e) {
|
|
|
3187
3187
|
}).element;
|
|
3188
3188
|
if (h.updateResizeElement(J), pe) {
|
|
3189
3189
|
const k = u.clone(), X = k.children.findIndex((M) => M.id === j.childId);
|
|
3190
|
-
X >= 0 && (k.children[X] = J, k.updateBoundsFromChildren(!0)), Ie(k), X >= 0 && (Ze(k.children[X]), G.update(k.children[X],
|
|
3190
|
+
X >= 0 && (k.children[X] = J, k.updateBoundsFromChildren(!0)), Ie(k), X >= 0 && (Ze(k.children[X]), G.update(k.children[X], H));
|
|
3191
3191
|
} else
|
|
3192
|
-
Ie(J), G.update(J,
|
|
3192
|
+
Ie(J), G.update(J, H);
|
|
3193
3193
|
We((k) => k + 1), zt(re.getGuides());
|
|
3194
3194
|
} else if (h.getMode() === "rotate") {
|
|
3195
3195
|
fe.style.cursor = "grabbing", ne || ($e(!0), $ == null || $(!0));
|
|
@@ -3210,20 +3210,20 @@ function Mi(e) {
|
|
|
3210
3210
|
}
|
|
3211
3211
|
const ge = h._activeChildContext, S = ge ? q : u;
|
|
3212
3212
|
if (!S) return;
|
|
3213
|
-
const
|
|
3213
|
+
const L = S.getBoundingBox(), Q = Es(L), j = Q.x, pe = Q.y, ke = h.updateRotate(W, Z, Q.x, Q.y, { shift: z.shiftKey }), ee = S.clone();
|
|
3214
3214
|
if (ee.setRotation(ke), !(ee instanceof Re)) {
|
|
3215
3215
|
const J = ee.getBoundingBox(), k = Es(J), X = j - k.x, M = pe - k.y;
|
|
3216
3216
|
ee.x += X, ee.y += M;
|
|
3217
3217
|
}
|
|
3218
3218
|
if (x.current = ee, pt(ee.rotation), ct((J) => J + 1), ge && u instanceof Re) {
|
|
3219
3219
|
const J = u.clone(), k = J.children.findIndex((X) => X.id === ge.childId);
|
|
3220
|
-
k >= 0 && (J.children[k] = ee, J.updateBoundsFromChildren(!0)), Ie(J), k >= 0 && (Ze(J.children[k]), G.update(J.children[k],
|
|
3220
|
+
k >= 0 && (J.children[k] = ee, J.updateBoundsFromChildren(!0)), Ie(J), k >= 0 && (Ze(J.children[k]), G.update(J.children[k], H));
|
|
3221
3221
|
} else
|
|
3222
|
-
Ie(ee), G.update(ee,
|
|
3222
|
+
Ie(ee), G.update(ee, H);
|
|
3223
3223
|
We((J) => J + 1);
|
|
3224
3224
|
} else {
|
|
3225
3225
|
if (te.length > 0 && E.current) {
|
|
3226
|
-
const S = E.current,
|
|
3226
|
+
const S = E.current, L = 16 / H, Q = [
|
|
3227
3227
|
{ x: S.minX, y: S.minY, anchor: "top-left", cursor: "nwse-resize" },
|
|
3228
3228
|
{ x: S.maxX, y: S.minY, anchor: "top-right", cursor: "nesw-resize" },
|
|
3229
3229
|
{ x: S.minX, y: S.maxY, anchor: "bottom-left", cursor: "nesw-resize" },
|
|
@@ -3242,12 +3242,12 @@ function Mi(e) {
|
|
|
3242
3242
|
});
|
|
3243
3243
|
for (const X of pe) {
|
|
3244
3244
|
const M = W - X.x, F = Z - X.y;
|
|
3245
|
-
if (Math.sqrt(M * M + F * F) <=
|
|
3245
|
+
if (Math.sqrt(M * M + F * F) <= L) {
|
|
3246
3246
|
fe.style.cursor = X.cursor, Ee({ type: "multi-selection-handle", data: X });
|
|
3247
3247
|
return;
|
|
3248
3248
|
}
|
|
3249
3249
|
}
|
|
3250
|
-
const ke = 18 /
|
|
3250
|
+
const ke = 18 / H;
|
|
3251
3251
|
if (Math.sqrt(
|
|
3252
3252
|
Math.pow(W - S.rotationHandleX, 2) + Math.pow(Z - S.rotationHandleY, 2)
|
|
3253
3253
|
) <= ke) {
|
|
@@ -3266,9 +3266,9 @@ function Mi(e) {
|
|
|
3266
3266
|
}
|
|
3267
3267
|
if (z.altKey) {
|
|
3268
3268
|
let S = null;
|
|
3269
|
-
const
|
|
3270
|
-
for (let Q =
|
|
3271
|
-
const j =
|
|
3269
|
+
const L = gt();
|
|
3270
|
+
for (let Q = L.length - 1; Q >= 0; Q--) {
|
|
3271
|
+
const j = L[Q];
|
|
3272
3272
|
if (j.visible !== !1) {
|
|
3273
3273
|
if (j instanceof Re)
|
|
3274
3274
|
for (let pe = j.children.length - 1; pe >= 0; pe--) {
|
|
@@ -3292,7 +3292,7 @@ function Mi(e) {
|
|
|
3292
3292
|
}
|
|
3293
3293
|
if (S) {
|
|
3294
3294
|
const Q = [];
|
|
3295
|
-
|
|
3295
|
+
L.forEach((pe) => {
|
|
3296
3296
|
pe instanceof Re ? Q.push(...pe.children) : Q.push(pe);
|
|
3297
3297
|
});
|
|
3298
3298
|
const j = he.detectSpacing(S, Q, !0);
|
|
@@ -3303,8 +3303,8 @@ function Mi(e) {
|
|
|
3303
3303
|
be.length > 0 && At([]);
|
|
3304
3304
|
const B = q || u;
|
|
3305
3305
|
if (B && B.visible !== !1)
|
|
3306
|
-
if (B instanceof
|
|
3307
|
-
const S = B.hitTestCropHandle(W, Z,
|
|
3306
|
+
if (B instanceof Lt && B.isCropping) {
|
|
3307
|
+
const S = B.hitTestCropHandle(W, Z, H);
|
|
3308
3308
|
if (S) {
|
|
3309
3309
|
const Q = eo(
|
|
3310
3310
|
S.worldX,
|
|
@@ -3318,9 +3318,9 @@ function Mi(e) {
|
|
|
3318
3318
|
fe.style.cursor = Q, Ee({ type: "crop-handle", data: S });
|
|
3319
3319
|
return;
|
|
3320
3320
|
}
|
|
3321
|
-
const
|
|
3322
|
-
if (
|
|
3323
|
-
fe.style.cursor =
|
|
3321
|
+
const L = G.hitTestResize(W, Z, H);
|
|
3322
|
+
if (L) {
|
|
3323
|
+
fe.style.cursor = L.cursor, Ee({ type: "resize-handle", data: L });
|
|
3324
3324
|
return;
|
|
3325
3325
|
}
|
|
3326
3326
|
if (B.hitTest(W, Z)) {
|
|
@@ -3328,11 +3328,11 @@ function Mi(e) {
|
|
|
3328
3328
|
return;
|
|
3329
3329
|
}
|
|
3330
3330
|
} else {
|
|
3331
|
-
if (G.hitTestRotation(W, Z,
|
|
3331
|
+
if (G.hitTestRotation(W, Z, H)) {
|
|
3332
3332
|
fe.style.cursor = "grab", Ee({ type: "rotation-handle", data: null });
|
|
3333
3333
|
return;
|
|
3334
3334
|
}
|
|
3335
|
-
const S = G.hitTestResize(W, Z,
|
|
3335
|
+
const S = G.hitTestResize(W, Z, H);
|
|
3336
3336
|
if (S) {
|
|
3337
3337
|
fe.style.cursor = S.cursor, Ee({ type: "resize-handle", data: S });
|
|
3338
3338
|
return;
|
|
@@ -3344,9 +3344,9 @@ function Mi(e) {
|
|
|
3344
3344
|
}
|
|
3345
3345
|
if (q && u instanceof Re)
|
|
3346
3346
|
for (let S = u.children.length - 1; S >= 0; S--) {
|
|
3347
|
-
const
|
|
3348
|
-
if (!(
|
|
3349
|
-
fe.style.cursor = "pointer", Ee({ type: "group-sibling", data:
|
|
3347
|
+
const L = u.children[S];
|
|
3348
|
+
if (!(L.visible === !1 || L.id === q.id) && L.hitTest(W, Z)) {
|
|
3349
|
+
fe.style.cursor = "pointer", Ee({ type: "group-sibling", data: L });
|
|
3350
3350
|
return;
|
|
3351
3351
|
}
|
|
3352
3352
|
}
|
|
@@ -3367,14 +3367,14 @@ function Mi(e) {
|
|
|
3367
3367
|
gt,
|
|
3368
3368
|
Ie,
|
|
3369
3369
|
G,
|
|
3370
|
-
|
|
3370
|
+
V,
|
|
3371
3371
|
re,
|
|
3372
3372
|
te,
|
|
3373
3373
|
le,
|
|
3374
3374
|
q,
|
|
3375
3375
|
_,
|
|
3376
3376
|
We,
|
|
3377
|
-
|
|
3377
|
+
H,
|
|
3378
3378
|
xe,
|
|
3379
3379
|
ie,
|
|
3380
3380
|
Ee,
|
|
@@ -3398,54 +3398,54 @@ function Mi(e) {
|
|
|
3398
3398
|
Fe.current = null, S.movedPastThreshold || (((W = S.pendingTap) == null ? void 0 : W.kind) === "select-element" ? (Xe(S.pendingTap.elementId), Y([])) : ((Z = S.pendingTap) == null ? void 0 : Z.kind) === "deselect" && (Xe(null), Y([])));
|
|
3399
3399
|
return;
|
|
3400
3400
|
}
|
|
3401
|
-
if (h.getMode() === "pinch" &&
|
|
3402
|
-
const { a: S, b:
|
|
3403
|
-
if (z.pointerId === S || z.pointerId ===
|
|
3401
|
+
if (h.getMode() === "pinch" && K.current) {
|
|
3402
|
+
const { a: S, b: L } = K.current;
|
|
3403
|
+
if (z.pointerId === S || z.pointerId === L) {
|
|
3404
3404
|
const j = h.getContext().element, pe = ue.current ?? void 0;
|
|
3405
|
-
j &&
|
|
3405
|
+
j && Ve(
|
|
3406
3406
|
pe,
|
|
3407
3407
|
j
|
|
3408
|
-
), h.end(),
|
|
3408
|
+
), h.end(), K.current = null, ue.current = null, Ae.current.clear();
|
|
3409
3409
|
return;
|
|
3410
3410
|
}
|
|
3411
3411
|
}
|
|
3412
3412
|
if (d.current && (d.current = null), _.isActive() && _.isDraggingHandle()) {
|
|
3413
3413
|
const S = _.isClosingPath();
|
|
3414
3414
|
if (_.finishDraggingHandle(), S && u instanceof wn) {
|
|
3415
|
-
const
|
|
3416
|
-
|
|
3415
|
+
const L = u.clone();
|
|
3416
|
+
Ve(u, L);
|
|
3417
3417
|
}
|
|
3418
|
-
We((
|
|
3418
|
+
We((L) => L + 1);
|
|
3419
3419
|
return;
|
|
3420
3420
|
}
|
|
3421
|
-
if (
|
|
3421
|
+
if (V) {
|
|
3422
3422
|
tn(Y);
|
|
3423
3423
|
return;
|
|
3424
3424
|
}
|
|
3425
|
-
b.current && h.getMode() === "drag" && (b.current.forEach((
|
|
3425
|
+
b.current && h.getMode() === "drag" && (b.current.forEach((L, Q) => {
|
|
3426
3426
|
const j = U.find((pe) => pe.id === Q);
|
|
3427
|
-
j && (
|
|
3427
|
+
j && (L.x !== j.x || L.y !== j.y || L instanceof Re && j instanceof Re && JSON.stringify(L.children.map((ke) => ({ x: ke.x, y: ke.y }))) !== JSON.stringify(j.children.map((ke) => ({ x: ke.x, y: ke.y })))) && Ve(L, j);
|
|
3428
3428
|
}), b.current = null);
|
|
3429
3429
|
const fe = t.current;
|
|
3430
3430
|
if (fe && (fe.style.cursor = "default"), re.clearGuides(), re.clearSnapState(), zt([]), he.clearIndicators(), At([]), h._cropGroupContext && delete h._cropGroupContext, h._activeChildContext) {
|
|
3431
3431
|
if (q && u instanceof Re) {
|
|
3432
3432
|
const S = h.getContext(), j = (S._cachedElement && S._cachedElement[u.id] || u).children.find((pe) => pe.id === q.id);
|
|
3433
|
-
j && (Ze(j), G.update(j,
|
|
3433
|
+
j && (Ze(j), G.update(j, H));
|
|
3434
3434
|
}
|
|
3435
3435
|
delete h._activeChildContext;
|
|
3436
3436
|
}
|
|
3437
3437
|
if (h._multiSelectionResizeContext && delete h._multiSelectionResizeContext, U.forEach((S) => {
|
|
3438
3438
|
if (S instanceof to && S._lockedLineCount !== void 0) {
|
|
3439
|
-
const
|
|
3440
|
-
|
|
3439
|
+
const L = S.clone();
|
|
3440
|
+
L._lockedLineCount = void 0, Ie(L);
|
|
3441
3441
|
}
|
|
3442
3442
|
}), h._multiSelectionDragContext) {
|
|
3443
3443
|
const S = h._multiSelectionDragContext;
|
|
3444
3444
|
if (S.startOBB && S.currentDelta) {
|
|
3445
|
-
const { dx:
|
|
3445
|
+
const { dx: L, dy: Q } = S.currentDelta, j = S.startOBB;
|
|
3446
3446
|
le.current = {
|
|
3447
3447
|
...j,
|
|
3448
|
-
centerX: j.centerX +
|
|
3448
|
+
centerX: j.centerX + L,
|
|
3449
3449
|
centerY: j.centerY + Q
|
|
3450
3450
|
};
|
|
3451
3451
|
}
|
|
@@ -3464,27 +3464,27 @@ function Mi(e) {
|
|
|
3464
3464
|
const dt = h.getContext();
|
|
3465
3465
|
if (dt._cachedElement && delete dt._cachedElement, h._pendingChildSelection) {
|
|
3466
3466
|
const S = h._pendingChildSelection;
|
|
3467
|
-
let
|
|
3467
|
+
let L = !0;
|
|
3468
3468
|
if (u instanceof Re) {
|
|
3469
3469
|
const Q = h._groupDragOriginalElement;
|
|
3470
|
-
Q && (
|
|
3470
|
+
Q && (L = !(Math.abs(u.x - Q.x) > 0.1 || Math.abs(u.y - Q.y) > 0.1));
|
|
3471
3471
|
}
|
|
3472
|
-
|
|
3472
|
+
L && (Ze(S), G.update(S, H), We((Q) => Q + 1)), delete h._pendingChildSelection;
|
|
3473
3473
|
}
|
|
3474
3474
|
if (h._pendingTextEditMode) {
|
|
3475
|
-
const S = h._pendingTextEditMode,
|
|
3476
|
-
!(
|
|
3475
|
+
const S = h._pendingTextEditMode, L = U.find((j) => j.id === S.elementId);
|
|
3476
|
+
!(L && (Math.abs(L.x - S.originalX) > 0.1 || Math.abs(L.y - S.originalY) > 0.1)) && L instanceof Qe && !(L instanceof Lt) && !(L instanceof Qn) && Yt(L, S.clickX, S.clickY), delete h._pendingTextEditMode;
|
|
3477
3477
|
}
|
|
3478
3478
|
if (Be.current) {
|
|
3479
|
-
const S = Be.current,
|
|
3480
|
-
(z.clientX - (((B = Ue.current) == null ? void 0 : B.left) ?? 0)) /
|
|
3481
|
-
(z.clientY - (((ge = Ue.current) == null ? void 0 : ge.top) ?? 0)) /
|
|
3482
|
-
) > 4 / Math.max(
|
|
3483
|
-
if (!pe && !ke && S === (u == null ? void 0 : u.id) &&
|
|
3479
|
+
const S = Be.current, L = Je.current, Q = U.find((ee) => ee.id === S), j = (et = b.current) == null ? void 0 : et.get(S), pe = !!(Q && j && (Math.abs(Q.x - j.x) > 0.1 || Math.abs(Q.y - j.y) > 0.1)), ke = L ? Math.hypot(
|
|
3480
|
+
(z.clientX - (((B = Ue.current) == null ? void 0 : B.left) ?? 0)) / H - xe - L.x,
|
|
3481
|
+
(z.clientY - (((ge = Ue.current) == null ? void 0 : ge.top) ?? 0)) / H - ie - L.y
|
|
3482
|
+
) > 4 / Math.max(H, 1e-4) : !1;
|
|
3483
|
+
if (!pe && !ke && S === (u == null ? void 0 : u.id) && L) {
|
|
3484
3484
|
const ee = gt(), J = [];
|
|
3485
3485
|
for (let X = ee.length - 1; X >= 0; X--) {
|
|
3486
3486
|
const M = ee[X];
|
|
3487
|
-
M.visible !== !1 && M.hitTest(
|
|
3487
|
+
M.visible !== !1 && M.hitTest(L.x, L.y) && hs(M, L.x, L.y, Se) && J.push(M);
|
|
3488
3488
|
}
|
|
3489
3489
|
const k = J.findIndex((X) => X.id === S);
|
|
3490
3490
|
k !== -1 && k + 1 < J.length ? Xe(J[k + 1].id) : Xe(null);
|
|
@@ -3495,7 +3495,7 @@ function Mi(e) {
|
|
|
3495
3495
|
}, [
|
|
3496
3496
|
h,
|
|
3497
3497
|
re,
|
|
3498
|
-
|
|
3498
|
+
V,
|
|
3499
3499
|
Y,
|
|
3500
3500
|
te,
|
|
3501
3501
|
le,
|
|
@@ -3506,34 +3506,34 @@ function Mi(e) {
|
|
|
3506
3506
|
t,
|
|
3507
3507
|
_,
|
|
3508
3508
|
We,
|
|
3509
|
-
|
|
3509
|
+
H,
|
|
3510
3510
|
xe,
|
|
3511
3511
|
ie,
|
|
3512
3512
|
$,
|
|
3513
3513
|
Yt,
|
|
3514
3514
|
U,
|
|
3515
3515
|
Xe,
|
|
3516
|
-
|
|
3516
|
+
Ve,
|
|
3517
3517
|
Se
|
|
3518
3518
|
]), cs = ft(
|
|
3519
3519
|
(z) => {
|
|
3520
3520
|
if (!u) return;
|
|
3521
3521
|
const fe = t.current;
|
|
3522
3522
|
if (!fe) return;
|
|
3523
|
-
const dt = Ue.current ?? fe.getBoundingClientRect(), W = (z.clientX - dt.left) /
|
|
3523
|
+
const dt = Ue.current ?? fe.getBoundingClientRect(), W = (z.clientX - dt.left) / H - xe, Z = (z.clientY - dt.top) / H - ie;
|
|
3524
3524
|
if (u.hitTest(W, Z)) {
|
|
3525
3525
|
if (u instanceof Re) {
|
|
3526
3526
|
const oe = u.hitTestChild(W, Z);
|
|
3527
3527
|
if (oe) {
|
|
3528
3528
|
if (!(q && q.id === oe.id)) return;
|
|
3529
3529
|
if (oe instanceof Qe && !(oe instanceof Re) && !(oe instanceof Qn)) {
|
|
3530
|
-
const
|
|
3530
|
+
const Le = oe.getVisualBoundingBox(), it = en.toRadiansInverse(oe.rotation), bt = oe.getRotationAnchor(), Bt = W - bt.x, St = Z - bt.y, Et = Math.cos(it), Gt = Math.sin(it), ut = Bt * Et - St * Gt, kt = Bt * Gt + St * Et, kn = ut + Le.width / 2, Ft = kt + Le.height / 2, qt = Sn(oe, { x: kn, y: Ft }), jt = Le.height + 16, _t = 6;
|
|
3531
3531
|
wt({
|
|
3532
|
-
x: dt.left + (
|
|
3533
|
-
y: dt.top + (
|
|
3534
|
-
width: Math.max(20,
|
|
3535
|
-
height: Math.max(jt *
|
|
3536
|
-
}), Xt(
|
|
3532
|
+
x: dt.left + (Le.x + xe) * H - _t,
|
|
3533
|
+
y: dt.top + (Le.y + ie) * H - _t,
|
|
3534
|
+
width: Math.max(20, Le.width * H),
|
|
3535
|
+
height: Math.max(jt * H, 50)
|
|
3536
|
+
}), Xt(Ke(oe));
|
|
3537
3537
|
const $t = oe.getRichText().clone();
|
|
3538
3538
|
C.current = $t, rn($t);
|
|
3539
3539
|
const an = oe.getRichText().getStyleAt(Math.max(0, oe.text.length - 1));
|
|
@@ -3549,13 +3549,13 @@ function Mi(e) {
|
|
|
3549
3549
|
}
|
|
3550
3550
|
if (u instanceof Qn || !(u instanceof Qe))
|
|
3551
3551
|
return;
|
|
3552
|
-
const et = u.getVisualBoundingBox(), B = en.toRadiansInverse(u.rotation), ge = u.getRotationAnchor(), S = W - ge.x,
|
|
3552
|
+
const et = u.getVisualBoundingBox(), B = en.toRadiansInverse(u.rotation), ge = u.getRotationAnchor(), S = W - ge.x, L = Z - ge.y, Q = Math.cos(B), j = Math.sin(B), pe = S * Q - L * j, ke = S * j + L * Q, ee = pe + et.width / 2, J = ke + et.height / 2, k = Sn(u, { x: ee, y: J }), X = et.height + 16, M = 6;
|
|
3553
3553
|
wt({
|
|
3554
|
-
x: dt.left + (et.x + xe) *
|
|
3555
|
-
y: dt.top + (et.y + ie) *
|
|
3556
|
-
width: Math.max(20, et.width *
|
|
3557
|
-
height: Math.max(X *
|
|
3558
|
-
}), Xt(
|
|
3554
|
+
x: dt.left + (et.x + xe) * H - M,
|
|
3555
|
+
y: dt.top + (et.y + ie) * H - M,
|
|
3556
|
+
width: Math.max(20, et.width * H),
|
|
3557
|
+
height: Math.max(X * H, 50)
|
|
3558
|
+
}), Xt(Ke(u));
|
|
3559
3559
|
const F = u.getRichText().clone();
|
|
3560
3560
|
C.current = F, rn(F);
|
|
3561
3561
|
const ae = u.getRichText().getStyleAt(Math.max(0, u.text.length - 1));
|
|
@@ -3569,7 +3569,7 @@ function Mi(e) {
|
|
|
3569
3569
|
G,
|
|
3570
3570
|
_,
|
|
3571
3571
|
We,
|
|
3572
|
-
|
|
3572
|
+
H,
|
|
3573
3573
|
xe,
|
|
3574
3574
|
ie,
|
|
3575
3575
|
wt,
|
|
@@ -3582,7 +3582,7 @@ function Mi(e) {
|
|
|
3582
3582
|
on,
|
|
3583
3583
|
Ze,
|
|
3584
3584
|
ot,
|
|
3585
|
-
|
|
3585
|
+
Ke
|
|
3586
3586
|
]
|
|
3587
3587
|
), Xn = ft(
|
|
3588
3588
|
(z) => {
|
|
@@ -3617,7 +3617,7 @@ function Mi(e) {
|
|
|
3617
3617
|
(z) => {
|
|
3618
3618
|
const fe = t.current;
|
|
3619
3619
|
if (!fe) return;
|
|
3620
|
-
const dt = z.target, W = dt ? fe.contains(dt) : !1, Z = Ae.current.has(z.pointerId) || Ge.current !== null || Fe.current !== null ||
|
|
3620
|
+
const dt = z.target, W = dt ? fe.contains(dt) : !1, Z = Ae.current.has(z.pointerId) || Ge.current !== null || Fe.current !== null || K.current !== null || h.isInteracting();
|
|
3621
3621
|
if (!W && !Z) return;
|
|
3622
3622
|
const et = {
|
|
3623
3623
|
clientX: z.clientX,
|
|
@@ -3642,19 +3642,19 @@ function Mi(e) {
|
|
|
3642
3642
|
if (!rt) return;
|
|
3643
3643
|
z.preventDefault();
|
|
3644
3644
|
const fe = t.current;
|
|
3645
|
-
if (!fe || g || u instanceof
|
|
3646
|
-
const W = fe.getBoundingClientRect(), Z = (z.clientX - W.left) /
|
|
3645
|
+
if (!fe || g || u instanceof Lt && u.isCropping || _.isActive()) return;
|
|
3646
|
+
const W = fe.getBoundingClientRect(), Z = (z.clientX - W.left) / H - xe, et = (z.clientY - W.top) / H - ie, B = gt();
|
|
3647
3647
|
let ge = null;
|
|
3648
3648
|
for (let S = B.length - 1; S >= 0; S--) {
|
|
3649
|
-
const
|
|
3650
|
-
if (
|
|
3651
|
-
ge =
|
|
3649
|
+
const L = B[S];
|
|
3650
|
+
if (L.visible !== !1 && L.hitTest(Z, et) && hs(L, Z, et, Se)) {
|
|
3651
|
+
ge = L;
|
|
3652
3652
|
break;
|
|
3653
3653
|
}
|
|
3654
3654
|
}
|
|
3655
3655
|
if (ge) {
|
|
3656
|
-
const S = te.includes(ge.id),
|
|
3657
|
-
!S && !
|
|
3656
|
+
const S = te.includes(ge.id), L = (u == null ? void 0 : u.id) === ge.id;
|
|
3657
|
+
!S && !L && (Xe(ge.id), Y([]));
|
|
3658
3658
|
}
|
|
3659
3659
|
rt({
|
|
3660
3660
|
clientX: z.clientX,
|
|
@@ -3670,7 +3670,7 @@ function Mi(e) {
|
|
|
3670
3670
|
g,
|
|
3671
3671
|
u,
|
|
3672
3672
|
_,
|
|
3673
|
-
|
|
3673
|
+
H,
|
|
3674
3674
|
xe,
|
|
3675
3675
|
ie,
|
|
3676
3676
|
gt,
|
|
@@ -3734,14 +3734,14 @@ function Ti(e) {
|
|
|
3734
3734
|
elements: D,
|
|
3735
3735
|
zoom: w,
|
|
3736
3736
|
paddingOffsetX: ne,
|
|
3737
|
-
paddingOffsetY:
|
|
3737
|
+
paddingOffsetY: V,
|
|
3738
3738
|
setIsEditing: O,
|
|
3739
3739
|
setEditText: u,
|
|
3740
3740
|
setEditRichText: q,
|
|
3741
3741
|
setCursorPosition: U,
|
|
3742
3742
|
setSelectionStart: te,
|
|
3743
3743
|
setSelectionEnd: le,
|
|
3744
|
-
setEditPosition:
|
|
3744
|
+
setEditPosition: H,
|
|
3745
3745
|
setCurrentFormattingStyle: xe,
|
|
3746
3746
|
setCursorAnimationFrame: ie,
|
|
3747
3747
|
setHandlesVersion: be,
|
|
@@ -3754,10 +3754,10 @@ function Ti(e) {
|
|
|
3754
3754
|
(h, G, re) => {
|
|
3755
3755
|
const he = t.current;
|
|
3756
3756
|
if (!he) return;
|
|
3757
|
-
const _ = he.getBoundingClientRect(), Ce = h.getVisualBoundingBox(), Ie = en.toRadiansInverse(h.rotation),
|
|
3758
|
-
|
|
3757
|
+
const _ = he.getBoundingClientRect(), Ce = h.getVisualBoundingBox(), Ie = en.toRadiansInverse(h.rotation), Ve = h.getRotationAnchor(), Xe = G - Ve.x, Y = re - Ve.y, $ = Math.cos(Ie), ot = Math.sin(Ie), rt = Xe * $ - Y * ot, Ze = Xe * ot + Y * $, gt = rt + Ce.width / 2, Nt = Ze + Ce.height / 2, Dt = Sn(h, { x: gt, y: Nt }), tn = Ce.height + 16, Yt = 6;
|
|
3758
|
+
H({
|
|
3759
3759
|
x: _.left + (Ce.x + ne) * w - Yt,
|
|
3760
|
-
y: _.top + (Ce.y +
|
|
3760
|
+
y: _.top + (Ce.y + V) * w - Yt,
|
|
3761
3761
|
width: Math.max(20, Ce.width * w),
|
|
3762
3762
|
height: Math.max(tn * w, 50)
|
|
3763
3763
|
}), u(fs(h));
|
|
@@ -3766,7 +3766,7 @@ function Ti(e) {
|
|
|
3766
3766
|
const Xt = h.getRichText().getStyleAt(Math.max(0, h.text.length - 1));
|
|
3767
3767
|
xe({ ...h.getDefaultStyle(), ...Xt }), U(Dt), te(Dt), le(Dt), O(!0), p.current = Date.now();
|
|
3768
3768
|
},
|
|
3769
|
-
[w,
|
|
3769
|
+
[w, H, u, q, xe, U, te, le, O]
|
|
3770
3770
|
), pt = ft(
|
|
3771
3771
|
(h) => {
|
|
3772
3772
|
if (!C || !E)
|
|
@@ -3822,13 +3822,13 @@ function Ti(e) {
|
|
|
3822
3822
|
return;
|
|
3823
3823
|
}
|
|
3824
3824
|
setTimeout(() => {
|
|
3825
|
-
var Ie,
|
|
3825
|
+
var Ie, Ve, Xe;
|
|
3826
3826
|
if (Date.now() - p.current < v) {
|
|
3827
3827
|
(Ie = n.current) == null || Ie.focus();
|
|
3828
3828
|
return;
|
|
3829
3829
|
}
|
|
3830
3830
|
if (m.current) {
|
|
3831
|
-
m.current = !1, (
|
|
3831
|
+
m.current = !1, (Ve = n.current) == null || Ve.focus(), n.current && n.current.setSelectionRange(T, I);
|
|
3832
3832
|
return;
|
|
3833
3833
|
}
|
|
3834
3834
|
let _ = document.activeElement, Ce = !1;
|
|
@@ -3946,24 +3946,24 @@ function Ti(e) {
|
|
|
3946
3946
|
return f.current && clearTimeout(f.current), f.current = setTimeout(() => {
|
|
3947
3947
|
let G = h;
|
|
3948
3948
|
if (s.current && h instanceof Re) {
|
|
3949
|
-
const
|
|
3950
|
-
|
|
3949
|
+
const Ve = h.children.find((Xe) => Xe.id === s.current);
|
|
3950
|
+
Ve && (G = Ve);
|
|
3951
3951
|
}
|
|
3952
3952
|
if (!(G instanceof Qe)) return;
|
|
3953
3953
|
const re = G.clone();
|
|
3954
3954
|
E && re.setRichText(E);
|
|
3955
3955
|
const he = re.getVisualBoundingBox(), _ = t.current.getBoundingClientRect(), Ce = he.height + 16, Ie = 6;
|
|
3956
|
-
if (
|
|
3956
|
+
if (H({
|
|
3957
3957
|
x: _.left + (he.x + ne) * w - Ie,
|
|
3958
|
-
y: _.top + (he.y +
|
|
3958
|
+
y: _.top + (he.y + V) * w - Ie,
|
|
3959
3959
|
width: Math.max(20, he.width * w),
|
|
3960
3960
|
height: Math.max(Ce * w, 50)
|
|
3961
3961
|
}), s.current && h instanceof Re) {
|
|
3962
|
-
const
|
|
3963
|
-
Xe >= 0 && (
|
|
3962
|
+
const Ve = h.clone(), Xe = Ve.children.findIndex((Y) => Y.id === s.current);
|
|
3963
|
+
Xe >= 0 && (Ve.children[Xe] = re, Ve.updateBoundsFromChildren(!0)), Se((Y) => Y.map(($) => $.id === Ve.id ? Ve : $)), De.update(re, w);
|
|
3964
3964
|
} else
|
|
3965
|
-
Se((
|
|
3966
|
-
be((
|
|
3965
|
+
Se((Ve) => Ve.map((Xe) => Xe.id === re.id ? re : Xe)), De.update(re, w);
|
|
3966
|
+
be((Ve) => Ve + 1);
|
|
3967
3967
|
}, 50), () => {
|
|
3968
3968
|
f.current && clearTimeout(f.current);
|
|
3969
3969
|
};
|
|
@@ -3987,23 +3987,23 @@ function Ti(e) {
|
|
|
3987
3987
|
const re = G.target;
|
|
3988
3988
|
if (re.tagName === "INPUT" || re.tagName === "TEXTAREA" || G.key !== "Enter" || C || !t.current) return;
|
|
3989
3989
|
const he = t.current.getBoundingClientRect();
|
|
3990
|
-
if (N && N instanceof Qe && !(N instanceof Re) && !(N instanceof
|
|
3990
|
+
if (N && N instanceof Qe && !(N instanceof Re) && !(N instanceof Lt) && !(N instanceof Qn)) {
|
|
3991
3991
|
G.preventDefault();
|
|
3992
3992
|
const _ = N.getVisualBoundingBox(), Ce = _.height + 16, Ie = 6;
|
|
3993
|
-
|
|
3993
|
+
H({
|
|
3994
3994
|
x: he.left + (_.x + ne) * w - Ie,
|
|
3995
|
-
y: he.top + (_.y +
|
|
3995
|
+
y: he.top + (_.y + V) * w - Ie,
|
|
3996
3996
|
width: Math.max(200, _.width * w),
|
|
3997
3997
|
height: Math.max(Ce * w, 50)
|
|
3998
3998
|
}), u(fs(N)), O(!0), p.current = Date.now(), s.current = N.id;
|
|
3999
3999
|
return;
|
|
4000
4000
|
}
|
|
4001
|
-
if (P && P instanceof Qe && !(P instanceof Re) && !(P instanceof
|
|
4001
|
+
if (P && P instanceof Qe && !(P instanceof Re) && !(P instanceof Lt) && !(P instanceof Qn)) {
|
|
4002
4002
|
G.preventDefault();
|
|
4003
4003
|
const _ = P.getVisualBoundingBox(), Ce = _.height + 16, Ie = 6;
|
|
4004
|
-
|
|
4004
|
+
H({
|
|
4005
4005
|
x: he.left + (_.x + ne) * w - Ie,
|
|
4006
|
-
y: he.top + (_.y +
|
|
4006
|
+
y: he.top + (_.y + V) * w - Ie,
|
|
4007
4007
|
width: Math.max(200, _.width * w),
|
|
4008
4008
|
height: Math.max(Ce * w, 50)
|
|
4009
4009
|
}), u(fs(P)), O(!0), p.current = Date.now();
|
|
@@ -4051,13 +4051,13 @@ const yr = Nr(
|
|
|
4051
4051
|
fixedMargin: D,
|
|
4052
4052
|
fixedMarginX: w,
|
|
4053
4053
|
fixedMarginY: ne,
|
|
4054
|
-
showRotationHandle:
|
|
4054
|
+
showRotationHandle: V = !0,
|
|
4055
4055
|
canvasCutouts: O,
|
|
4056
4056
|
pieceGuides: u,
|
|
4057
4057
|
pieceFocus: q,
|
|
4058
4058
|
focusedPieceRect: U
|
|
4059
4059
|
}, te) => {
|
|
4060
|
-
const { resolvedTheme: le } = ho(),
|
|
4060
|
+
const { resolvedTheme: le } = ho(), H = we(null), xe = R || H, ie = we(null), be = we(!1), Se = we(0), Te = we(0), Oe = we(0), De = we(!1), $e = we(0), at = we(null), pt = we(0), ct = we(null), Pt = we({ start: null, end: null }), zt = we(null), At = we(null), We = we(null), Ee = we(null), lt = 400, se = 300, h = 50, G = 200, re = je.useMemo(() => {
|
|
4061
4061
|
if (!q || q === "spread") return null;
|
|
4062
4062
|
const ye = (u == null ? void 0 : u.pieces) ?? [];
|
|
4063
4063
|
if (ye.length <= 1) return null;
|
|
@@ -4074,14 +4074,14 @@ const yr = Nr(
|
|
|
4074
4074
|
}, [he, u]), {
|
|
4075
4075
|
isTouchDevice: Ce,
|
|
4076
4076
|
canvasSize: Ie,
|
|
4077
|
-
lastTouchTargetRef:
|
|
4077
|
+
lastTouchTargetRef: Ve,
|
|
4078
4078
|
effectiveViewPadding: Xe,
|
|
4079
4079
|
paddedCanvasWidth: Y,
|
|
4080
4080
|
paddedCanvasHeight: $,
|
|
4081
4081
|
paddingOffsetX: ot,
|
|
4082
4082
|
paddingOffsetY: rt,
|
|
4083
4083
|
zoomInvariantBorderRadius: Ze
|
|
4084
|
-
} =
|
|
4084
|
+
} = Ho({
|
|
4085
4085
|
width: E,
|
|
4086
4086
|
height: A,
|
|
4087
4087
|
zoom: T,
|
|
@@ -4104,11 +4104,11 @@ const yr = Nr(
|
|
|
4104
4104
|
setIsRotating: rn,
|
|
4105
4105
|
setRotationStartAngle: on,
|
|
4106
4106
|
currentRotation: Ut,
|
|
4107
|
-
setCurrentRotation:
|
|
4107
|
+
setCurrentRotation: Ke,
|
|
4108
4108
|
setRotatingElementVersion: Ue
|
|
4109
4109
|
} = _o(), {
|
|
4110
4110
|
renderVersion: Ae,
|
|
4111
|
-
forceRender:
|
|
4111
|
+
forceRender: K,
|
|
4112
4112
|
handlesVersion: ue,
|
|
4113
4113
|
setHandlesVersion: me,
|
|
4114
4114
|
forceUpdate: Be,
|
|
@@ -4126,8 +4126,8 @@ const yr = Nr(
|
|
|
4126
4126
|
ye ? [{ id: "focused-piece", ...ye }] : []
|
|
4127
4127
|
);
|
|
4128
4128
|
}, [st, U, re]);
|
|
4129
|
-
const
|
|
4130
|
-
|
|
4129
|
+
const Ht = we(e);
|
|
4130
|
+
Ht.current = e;
|
|
4131
4131
|
const ve = e.find((ye) => ye.id === s), as = we(ve);
|
|
4132
4132
|
as.current = ve;
|
|
4133
4133
|
const [An, En] = ce("");
|
|
@@ -4139,14 +4139,14 @@ const yr = Nr(
|
|
|
4139
4139
|
if (ye instanceof Qe) {
|
|
4140
4140
|
const Ye = ((de = ye.text) == null ? void 0 : de.slice(0, 40)) || "empty";
|
|
4141
4141
|
En(`Selected text element: ${Ye}`);
|
|
4142
|
-
} else ye instanceof
|
|
4142
|
+
} else ye instanceof Lt ? En("Selected image element") : ye instanceof Re ? En("Selected group") : En("Selected element");
|
|
4143
4143
|
}, [s, e]);
|
|
4144
4144
|
const cs = we(n);
|
|
4145
4145
|
cs.current = n;
|
|
4146
4146
|
const Xn = we(/* @__PURE__ */ new Map());
|
|
4147
4147
|
Pe(() => {
|
|
4148
4148
|
const ye = (de) => {
|
|
4149
|
-
const Ye = de,
|
|
4149
|
+
const Ye = de, He = cs.current.getActiveArtboardId(), tt = Xn.current.get(He) || [], vt = [];
|
|
4150
4150
|
return tt.forEach((Rt) => {
|
|
4151
4151
|
Rt instanceof Re ? vt.push(...Rt.children) : vt.push(Rt);
|
|
4152
4152
|
}), st.snapDimensions(Ye, vt, Ye.startData);
|
|
@@ -4164,7 +4164,7 @@ const yr = Nr(
|
|
|
4164
4164
|
setEditPosition: B,
|
|
4165
4165
|
cursorPosition: ge,
|
|
4166
4166
|
setCursorPosition: S,
|
|
4167
|
-
selectionStart:
|
|
4167
|
+
selectionStart: L,
|
|
4168
4168
|
setSelectionStart: Q,
|
|
4169
4169
|
selectionEnd: j,
|
|
4170
4170
|
setSelectionEnd: pe,
|
|
@@ -4180,17 +4180,17 @@ const yr = Nr(
|
|
|
4180
4180
|
} = Yo({ selectedElement: ve, ref: te });
|
|
4181
4181
|
Pe(() => {
|
|
4182
4182
|
const ye = Date.now() - $e.current, de = at.current;
|
|
4183
|
-
de && ye < se ? (
|
|
4184
|
-
}, [
|
|
4183
|
+
de && ye < se ? (L !== de.start || j !== de.end) && (S(de.cursor), Q(de.start), pe(de.end), ie.current && ie.current.setSelectionRange(de.start, de.end)) : de && ye >= se && (at.current = null);
|
|
4184
|
+
}, [L, j, ge]), Pe(() => {
|
|
4185
4185
|
if (!fe) return;
|
|
4186
4186
|
const ye = xe.current;
|
|
4187
4187
|
if (!ye) return;
|
|
4188
4188
|
let de = ye.getBoundingClientRect();
|
|
4189
4189
|
const Ye = () => {
|
|
4190
|
-
const
|
|
4191
|
-
if (!
|
|
4190
|
+
const He = ie.current, tt = xe.current;
|
|
4191
|
+
if (!He || !tt) return;
|
|
4192
4192
|
const vt = tt.getBoundingClientRect(), Rt = vt.left - de.left, ht = vt.top - de.top;
|
|
4193
|
-
Rt === 0 && ht === 0 || (de = vt,
|
|
4193
|
+
Rt === 0 && ht === 0 || (de = vt, He.style.left = `${parseFloat(He.style.left || "0") + Rt}px`, He.style.top = `${parseFloat(He.style.top || "0") + ht}px`);
|
|
4194
4194
|
};
|
|
4195
4195
|
return window.addEventListener("scroll", Ye, { passive: !0, capture: !0 }), window.addEventListener("resize", Ye), () => {
|
|
4196
4196
|
window.removeEventListener("scroll", Ye, { capture: !0 }), window.removeEventListener("resize", Ye);
|
|
@@ -4198,7 +4198,7 @@ const yr = Nr(
|
|
|
4198
4198
|
}, [fe]);
|
|
4199
4199
|
const {
|
|
4200
4200
|
isMarqueeSelecting: Me,
|
|
4201
|
-
marqueeStart:
|
|
4201
|
+
marqueeStart: Le,
|
|
4202
4202
|
marqueeEnd: it,
|
|
4203
4203
|
marqueePreviewSelection: bt,
|
|
4204
4204
|
startMarqueeSelection: Bt,
|
|
@@ -4207,7 +4207,7 @@ const yr = Nr(
|
|
|
4207
4207
|
} = Po(), {
|
|
4208
4208
|
multiSelectionGroupBoundsRef: Gt,
|
|
4209
4209
|
multiSelectionOBBRef: ut
|
|
4210
|
-
} =
|
|
4210
|
+
} = Lo(o), {
|
|
4211
4211
|
activeChildElement: kt,
|
|
4212
4212
|
updateActiveChild: kn,
|
|
4213
4213
|
editingChildIdRef: Ft
|
|
@@ -4224,25 +4224,25 @@ const yr = Nr(
|
|
|
4224
4224
|
return _t.get(ye) || [];
|
|
4225
4225
|
}, [_t, n]);
|
|
4226
4226
|
Pe(() => {
|
|
4227
|
-
const ye = (
|
|
4227
|
+
const ye = (He) => {
|
|
4228
4228
|
if (!fe) {
|
|
4229
4229
|
if (xn.isActive() && ve instanceof wn) {
|
|
4230
|
-
if (
|
|
4231
|
-
|
|
4230
|
+
if (He.key === "Escape") {
|
|
4231
|
+
He.preventDefault(), xn.finishPath();
|
|
4232
4232
|
const tt = ve.clone();
|
|
4233
4233
|
l(ve, tt), me((vt) => vt + 1);
|
|
4234
4234
|
return;
|
|
4235
|
-
} else if (
|
|
4236
|
-
|
|
4235
|
+
} else if (He.key === "Backspace" || He.key === "Delete") {
|
|
4236
|
+
He.preventDefault(), xn.deleteLastPoint(), me((tt) => tt + 1);
|
|
4237
4237
|
return;
|
|
4238
4238
|
}
|
|
4239
4239
|
}
|
|
4240
|
-
|
|
4240
|
+
He.altKey && wt(!0);
|
|
4241
4241
|
}
|
|
4242
|
-
}, de = (
|
|
4243
|
-
|
|
4244
|
-
}, Ye = (
|
|
4245
|
-
(!
|
|
4242
|
+
}, de = (He) => {
|
|
4243
|
+
He.altKey || wt(!1);
|
|
4244
|
+
}, Ye = (He) => {
|
|
4245
|
+
(!He.relatedTarget || !He.relatedTarget.ownerDocument) && wt(!1);
|
|
4246
4246
|
};
|
|
4247
4247
|
return window.addEventListener("keydown", ye), window.addEventListener("keyup", de), window.addEventListener("blur", Ye), () => {
|
|
4248
4248
|
window.removeEventListener("keydown", ye), window.removeEventListener("keyup", de), window.removeEventListener("blur", Ye);
|
|
@@ -4252,7 +4252,7 @@ const yr = Nr(
|
|
|
4252
4252
|
return;
|
|
4253
4253
|
const { x: de, y: Ye } = zt.current;
|
|
4254
4254
|
if (Yt) {
|
|
4255
|
-
let
|
|
4255
|
+
let He = null;
|
|
4256
4256
|
const tt = $t();
|
|
4257
4257
|
for (let vt = tt.length - 1; vt >= 0; vt--) {
|
|
4258
4258
|
const Rt = tt[vt];
|
|
@@ -4263,26 +4263,26 @@ const yr = Nr(
|
|
|
4263
4263
|
if (qe.visible === !1) continue;
|
|
4264
4264
|
const Ne = qe.getVisualBoundingBox();
|
|
4265
4265
|
if (de >= Ne.x && de <= Ne.x + Ne.width && Ye >= Ne.y && Ye <= Ne.y + Ne.height) {
|
|
4266
|
-
|
|
4266
|
+
He = qe;
|
|
4267
4267
|
break;
|
|
4268
4268
|
}
|
|
4269
4269
|
}
|
|
4270
4270
|
else {
|
|
4271
4271
|
const ht = Rt.getVisualBoundingBox();
|
|
4272
4272
|
if (de >= ht.x && de <= ht.x + ht.width && Ye >= ht.y && Ye <= ht.y + ht.height) {
|
|
4273
|
-
|
|
4273
|
+
He = Rt;
|
|
4274
4274
|
break;
|
|
4275
4275
|
}
|
|
4276
4276
|
}
|
|
4277
|
-
if (
|
|
4277
|
+
if (He) break;
|
|
4278
4278
|
}
|
|
4279
4279
|
}
|
|
4280
|
-
if (
|
|
4280
|
+
if (He) {
|
|
4281
4281
|
const vt = [];
|
|
4282
4282
|
tt.forEach((ht) => {
|
|
4283
4283
|
ht instanceof Re ? vt.push(...ht.children) : vt.push(ht);
|
|
4284
4284
|
});
|
|
4285
|
-
const Rt = xt.detectSpacing(
|
|
4285
|
+
const Rt = xt.detectSpacing(He, vt, !0);
|
|
4286
4286
|
tn(Rt);
|
|
4287
4287
|
}
|
|
4288
4288
|
} else
|
|
@@ -4292,17 +4292,17 @@ const yr = Nr(
|
|
|
4292
4292
|
Pe(() => {
|
|
4293
4293
|
const ye = e.find((Ye) => Ye.id === s), de = kt || ye;
|
|
4294
4294
|
if (de) {
|
|
4295
|
-
const Ye = de.getBoundingBox(),
|
|
4296
|
-
an.current !==
|
|
4295
|
+
const Ye = de.getBoundingBox(), He = `${de.id}-${Ye.x}-${Ye.y}-${Ye.width}-${Ye.height}-${de.rotation}`;
|
|
4296
|
+
an.current !== He && (an.current = He, Fe.update(de, T), me((tt) => tt + 1));
|
|
4297
4297
|
}
|
|
4298
4298
|
}, [s, kt, Fe, T, e]);
|
|
4299
4299
|
const {
|
|
4300
|
-
handleTextEditBlur:
|
|
4301
|
-
handleTextKeyDown:
|
|
4300
|
+
handleTextEditBlur: Ln,
|
|
4301
|
+
handleTextKeyDown: Vn,
|
|
4302
4302
|
applyFormattingToSelection: nn,
|
|
4303
4303
|
getSelectionStyle: ls,
|
|
4304
4304
|
toggleFormattingProperty: ds,
|
|
4305
|
-
enterTextEditMode:
|
|
4305
|
+
enterTextEditMode: Kn,
|
|
4306
4306
|
getWrappedTextForEditing: Un
|
|
4307
4307
|
} = Ti({
|
|
4308
4308
|
canvasRef: xe,
|
|
@@ -4317,14 +4317,14 @@ const yr = Nr(
|
|
|
4317
4317
|
draggingSelectionHandleRef: ct,
|
|
4318
4318
|
repositioningCursorRef: be,
|
|
4319
4319
|
editModeEnteredAtRef: Oe,
|
|
4320
|
-
lastTouchTargetRef:
|
|
4320
|
+
lastTouchTargetRef: Ve,
|
|
4321
4321
|
MULTI_CLICK_DEBOUNCE: se,
|
|
4322
4322
|
EDIT_MODE_BLUR_DEBOUNCE: G,
|
|
4323
4323
|
isEditing: fe,
|
|
4324
4324
|
editText: W,
|
|
4325
4325
|
editRichText: X,
|
|
4326
4326
|
cursorPosition: ge,
|
|
4327
|
-
selectionStart:
|
|
4327
|
+
selectionStart: L,
|
|
4328
4328
|
selectionEnd: j,
|
|
4329
4329
|
selectedId: s,
|
|
4330
4330
|
selectedElement: ve,
|
|
@@ -4379,7 +4379,7 @@ const yr = Nr(
|
|
|
4379
4379
|
isEditing: fe,
|
|
4380
4380
|
editText: W,
|
|
4381
4381
|
isTouchDevice: Ce,
|
|
4382
|
-
selectionStart:
|
|
4382
|
+
selectionStart: L,
|
|
4383
4383
|
selectionEnd: j,
|
|
4384
4384
|
isRotating: Xt,
|
|
4385
4385
|
isMarqueeSelecting: Me,
|
|
@@ -4399,7 +4399,7 @@ const yr = Nr(
|
|
|
4399
4399
|
setSelectionEnd: pe,
|
|
4400
4400
|
setIsRotating: rn,
|
|
4401
4401
|
setRotationStartAngle: on,
|
|
4402
|
-
setCurrentRotation:
|
|
4402
|
+
setCurrentRotation: Ke,
|
|
4403
4403
|
setRotatingElementVersion: Ue,
|
|
4404
4404
|
setIsAltKeyPressed: wt,
|
|
4405
4405
|
setSnapGuides: Nt,
|
|
@@ -4426,7 +4426,7 @@ const yr = Nr(
|
|
|
4426
4426
|
startMarqueeSelection: Bt,
|
|
4427
4427
|
updateMarqueeSelection: St,
|
|
4428
4428
|
finishMarqueeSelection: Et,
|
|
4429
|
-
enterTextEditMode:
|
|
4429
|
+
enterTextEditMode: Kn,
|
|
4430
4430
|
setEditPosition: B,
|
|
4431
4431
|
setEditText: Z,
|
|
4432
4432
|
setEditRichText: M,
|
|
@@ -4455,7 +4455,7 @@ const yr = Nr(
|
|
|
4455
4455
|
zoom: T,
|
|
4456
4456
|
zoomInvariantBorderRadius: Ze,
|
|
4457
4457
|
effectiveViewPadding: Xe,
|
|
4458
|
-
showRotationHandle:
|
|
4458
|
+
showRotationHandle: V,
|
|
4459
4459
|
isRotating: Xt,
|
|
4460
4460
|
currentRotation: Ut,
|
|
4461
4461
|
hoverState: qt,
|
|
@@ -4463,7 +4463,7 @@ const yr = Nr(
|
|
|
4463
4463
|
editText: W,
|
|
4464
4464
|
editRichText: X,
|
|
4465
4465
|
cursorPosition: ge,
|
|
4466
|
-
selectionStart:
|
|
4466
|
+
selectionStart: L,
|
|
4467
4467
|
selectionEnd: j,
|
|
4468
4468
|
cursorOpacityRef: ke,
|
|
4469
4469
|
cursorStartTimeRef: ee,
|
|
@@ -4479,7 +4479,7 @@ const yr = Nr(
|
|
|
4479
4479
|
multiSelectionOBBRef: ut,
|
|
4480
4480
|
multiSelectionGroupBoundsRef: Gt,
|
|
4481
4481
|
isMarqueeSelecting: Me,
|
|
4482
|
-
marqueeStart:
|
|
4482
|
+
marqueeStart: Le,
|
|
4483
4483
|
marqueeEnd: it,
|
|
4484
4484
|
marqueePreviewSelection: bt,
|
|
4485
4485
|
penTool: xn,
|
|
@@ -4504,25 +4504,25 @@ const yr = Nr(
|
|
|
4504
4504
|
isRotating: () => Xt,
|
|
4505
4505
|
getSelectionStyle: () => ls(),
|
|
4506
4506
|
getZoom: () => T,
|
|
4507
|
-
forceRender:
|
|
4507
|
+
forceRender: K,
|
|
4508
4508
|
getEditingState: () => ({
|
|
4509
4509
|
isEditing: fe,
|
|
4510
4510
|
editText: W,
|
|
4511
4511
|
cursorPosition: ge,
|
|
4512
|
-
selectionStart:
|
|
4512
|
+
selectionStart: L,
|
|
4513
4513
|
selectionEnd: j
|
|
4514
4514
|
}),
|
|
4515
4515
|
getCropState: () => ({
|
|
4516
|
-
isCropping: ve instanceof
|
|
4516
|
+
isCropping: ve instanceof Lt && ve.isCropping,
|
|
4517
4517
|
elementId: (ve == null ? void 0 : ve.id) || null
|
|
4518
4518
|
}),
|
|
4519
4519
|
getPaddingOffset: () => ({ x: ot, y: rt })
|
|
4520
4520
|
}),
|
|
4521
|
-
[nn, ds, fe, Xt, ls, T,
|
|
4521
|
+
[nn, ds, fe, Xt, ls, T, K, W, ge, L, j, ve, ot, rt]
|
|
4522
4522
|
);
|
|
4523
4523
|
const Sr = xs(() => {
|
|
4524
4524
|
if (!O || O.length === 0) return;
|
|
4525
|
-
const ye = Y * T, de = $ * T, Ye = `M 0 0 h ${ye} v ${de} h ${-ye} Z`,
|
|
4525
|
+
const ye = Y * T, de = $ * T, Ye = `M 0 0 h ${ye} v ${de} h ${-ye} Z`, He = O.map((tt) => {
|
|
4526
4526
|
if (tt.kind === "rect" || tt.kind === "roundedRect") {
|
|
4527
4527
|
const vt = (ot + tt.x) * T, Rt = (rt + tt.y) * T, ht = tt.width * T, qe = tt.height * T;
|
|
4528
4528
|
if (tt.kind === "roundedRect") {
|
|
@@ -4545,8 +4545,8 @@ const yr = Nr(
|
|
|
4545
4545
|
}
|
|
4546
4546
|
return "";
|
|
4547
4547
|
}).filter(Boolean);
|
|
4548
|
-
if (
|
|
4549
|
-
return `path(evenodd, "${Ye} ${
|
|
4548
|
+
if (He.length !== 0)
|
|
4549
|
+
return `path(evenodd, "${Ye} ${He.join(" ")}")`;
|
|
4550
4550
|
}, [O, Y, $, ot, rt, T]);
|
|
4551
4551
|
return /* @__PURE__ */ y(Pn, { children: [
|
|
4552
4552
|
/* @__PURE__ */ r(
|
|
@@ -4602,7 +4602,7 @@ const yr = Nr(
|
|
|
4602
4602
|
const qe = ve.children.find((Ne) => Ne.id === Ft.current);
|
|
4603
4603
|
qe && (ye = qe);
|
|
4604
4604
|
}
|
|
4605
|
-
const de = ye instanceof Qe ? ye : null, Ye = (de == null ? void 0 : de.fontSize) || 24,
|
|
4605
|
+
const de = ye instanceof Qe ? ye : null, Ye = (de == null ? void 0 : de.fontSize) || 24, He = (de == null ? void 0 : de.fontFamily) || "Arial", tt = (de == null ? void 0 : de.bold) || !1, vt = (de == null ? void 0 : de.italic) || !1, Rt = (de == null ? void 0 : de.textAlign) || "center", ht = /* @__PURE__ */ r(
|
|
4606
4606
|
"textarea",
|
|
4607
4607
|
{
|
|
4608
4608
|
ref: ie,
|
|
@@ -4618,13 +4618,13 @@ const yr = Nr(
|
|
|
4618
4618
|
return;
|
|
4619
4619
|
}
|
|
4620
4620
|
const mt = W, bn = X.clone();
|
|
4621
|
-
let
|
|
4622
|
-
for (;
|
|
4623
|
-
|
|
4621
|
+
let Vt = 0;
|
|
4622
|
+
for (; Vt < mt.length && Vt < Ne.length && mt[Vt] === Ne[Vt]; )
|
|
4623
|
+
Vt++;
|
|
4624
4624
|
let Zt = 0;
|
|
4625
|
-
for (; Zt < mt.length -
|
|
4625
|
+
for (; Zt < mt.length - Vt && Zt < Ne.length - Vt && mt[mt.length - 1 - Zt] === Ne[Ne.length - 1 - Zt]; )
|
|
4626
4626
|
Zt++;
|
|
4627
|
-
const cn =
|
|
4627
|
+
const cn = Vt, Mn = mt.length - Zt, Tn = Ne.substring(Vt, Ne.length - Zt);
|
|
4628
4628
|
if (Mn > cn && bn.delete(cn, Mn), Tn.length > 0) {
|
|
4629
4629
|
let Jt;
|
|
4630
4630
|
ae ? Jt = ae : cn > 0 ? Jt = bn.getStyleAt(cn - 1) : ve instanceof Qe ? Jt = ve.getDefaultStyle() : Jt = {}, bn.insert(cn, Tn, Jt);
|
|
@@ -4637,14 +4637,14 @@ const yr = Nr(
|
|
|
4637
4637
|
vn && document.activeElement === vn && vn.setSelectionRange(fn, fn);
|
|
4638
4638
|
}, 0);
|
|
4639
4639
|
},
|
|
4640
|
-
onBlur:
|
|
4641
|
-
onKeyDown:
|
|
4640
|
+
onBlur: Ln,
|
|
4641
|
+
onKeyDown: Vn,
|
|
4642
4642
|
onPointerDown: (qe) => {
|
|
4643
4643
|
if (qe.preventDefault(), !ve || !(ve instanceof Qe) || !xe.current) return;
|
|
4644
4644
|
const Ne = Date.now();
|
|
4645
4645
|
if (Ne - pt.current < h) return;
|
|
4646
4646
|
pt.current = Ne, Ne - $e.current >= se && (at.current = null);
|
|
4647
|
-
const mt = xe.current.getBoundingClientRect(), bn = (qe.clientX - mt.left) / T - ot,
|
|
4647
|
+
const mt = xe.current.getBoundingClientRect(), bn = (qe.clientX - mt.left) / T - ot, Vt = (qe.clientY - mt.top) / T - rt, Zt = ve.getVisualBoundingBox(), cn = ve.getRotationAnchor(), Mn = en.toRadiansInverse(ve.rotation), Tn = bn - cn.x, fn = Vt - cn.y, vn = Math.cos(Mn), Jt = Math.sin(Mn), Gn = Tn * vn - fn * Jt, Cs = Tn * Jt + fn * vn, ws = Gn + Zt.width / 2, Nn = Cs + Zt.height / 2, sn = Sn(ve, { x: ws, y: Nn });
|
|
4648
4648
|
Ne - Se.current < lt ? Te.current += 1 : Te.current = 1, Se.current = Ne;
|
|
4649
4649
|
const pn = W;
|
|
4650
4650
|
if (k.current = !1, Te.current >= 3)
|
|
@@ -4659,18 +4659,18 @@ const yr = Nr(
|
|
|
4659
4659
|
onPointerMove: (qe) => {
|
|
4660
4660
|
if (qe.buttons !== 1) return;
|
|
4661
4661
|
if (ct.current && ve instanceof Qe && xe.current) {
|
|
4662
|
-
const qn = xe.current.getBoundingClientRect(), pn = (qe.clientX - qn.left) / T - ot, ln = (qe.clientY - qn.top) / T - rt, Bs = ve.getVisualBoundingBox(), Os = ve.getRotationAnchor(), zs = en.toRadiansInverse(ve.rotation), Xs = pn - Os.x,
|
|
4662
|
+
const qn = xe.current.getBoundingClientRect(), pn = (qe.clientX - qn.left) / T - ot, ln = (qe.clientY - qn.top) / T - rt, Bs = ve.getVisualBoundingBox(), Os = ve.getRotationAnchor(), zs = en.toRadiansInverse(ve.rotation), Xs = pn - Os.x, Ls = ln - Os.y, Ys = Math.cos(zs), Hs = Math.sin(zs), Er = Xs * Ys - Ls * Hs, kr = Xs * Hs + Ls * Ys, mn = Pt.current;
|
|
4663
4663
|
let Ss = 0;
|
|
4664
4664
|
ct.current === "start" && (mn != null && mn.start) ? Ss = mn.start.textEdge.y - mn.start.center.y : ct.current === "end" && (mn != null && mn.end) && (Ss = mn.end.textEdge.y - mn.end.center.y);
|
|
4665
4665
|
const Rr = Er + Bs.width / 2, Mr = kr + Ss + Bs.height / 2, gn = Sn(ve, { x: Rr, y: Mr });
|
|
4666
|
-
if (ct.current === "start" ? gn <= j ? (Q(gn), S(gn)) : (Q(j), pe(gn), S(gn), ct.current = "end") : gn >=
|
|
4667
|
-
const Tr = Math.min(
|
|
4666
|
+
if (ct.current === "start" ? gn <= j ? (Q(gn), S(gn)) : (Q(j), pe(gn), S(gn), ct.current = "end") : gn >= L ? (pe(gn), S(gn)) : (pe(L), Q(gn), S(gn), ct.current = "start"), ie.current) {
|
|
4667
|
+
const Tr = Math.min(L, j), Ir = Math.max(L, j);
|
|
4668
4668
|
ie.current.setSelectionRange(Tr, Ir);
|
|
4669
4669
|
}
|
|
4670
4670
|
return;
|
|
4671
4671
|
}
|
|
4672
4672
|
if (De.current || !ve || !(ve instanceof Qe) || !xe.current) return;
|
|
4673
|
-
const Ne = xe.current.getBoundingClientRect(), mt = (qe.clientX - Ne.left) / T - ot, bn = (qe.clientY - Ne.top) / T - rt,
|
|
4673
|
+
const Ne = xe.current.getBoundingClientRect(), mt = (qe.clientX - Ne.left) / T - ot, bn = (qe.clientY - Ne.top) / T - rt, Vt = ve.getVisualBoundingBox(), Zt = ve.getRotationAnchor(), cn = en.toRadiansInverse(ve.rotation), Mn = mt - Zt.x, Tn = bn - Zt.y, fn = Math.cos(cn), vn = Math.sin(cn), Jt = Mn * fn - Tn * vn, Gn = Mn * vn + Tn * fn, Cs = Jt + Vt.width / 2, ws = Gn + Vt.height / 2, Nn = Sn(ve, { x: Cs, y: ws }), sn = J.current;
|
|
4674
4674
|
if (sn !== Nn && (k.current = !0), pe(Nn), S(Nn), Q(sn), ie.current) {
|
|
4675
4675
|
const qn = Math.min(sn, Nn), pn = Math.max(sn, Nn);
|
|
4676
4676
|
ie.current.setSelectionRange(qn, pn);
|
|
@@ -4693,7 +4693,7 @@ const yr = Nr(
|
|
|
4693
4693
|
width: `${et.width}px`,
|
|
4694
4694
|
height: `${et.height || 50}px`,
|
|
4695
4695
|
fontSize: `${Ye * T}px`,
|
|
4696
|
-
fontFamily: `"${
|
|
4696
|
+
fontFamily: `"${He}", Arial, sans-serif`,
|
|
4697
4697
|
fontWeight: tt ? 700 : 400,
|
|
4698
4698
|
fontStyle: vt ? "italic" : "normal",
|
|
4699
4699
|
textAlign: Rt,
|
|
@@ -4868,7 +4868,7 @@ const Ms = $n.forwardRef(({ className: e, variant: t, ...n }, s) => {
|
|
|
4868
4868
|
);
|
|
4869
4869
|
});
|
|
4870
4870
|
Ms.displayName = ts.Item.displayName;
|
|
4871
|
-
const
|
|
4871
|
+
const Kt = $n.forwardRef(
|
|
4872
4872
|
({ children: e, className: t, variant: n, ...s }, o) => e ? /* @__PURE__ */ y("div", { className: "sc:flex sc:items-center sc:space-x-2", children: [
|
|
4873
4873
|
/* @__PURE__ */ r(Ms, { ref: o, variant: n, ...s }),
|
|
4874
4874
|
/* @__PURE__ */ r(
|
|
@@ -4881,7 +4881,7 @@ const Vt = $n.forwardRef(
|
|
|
4881
4881
|
)
|
|
4882
4882
|
] }) : /* @__PURE__ */ r(Ms, { ref: o, className: t, variant: n, ...s })
|
|
4883
4883
|
);
|
|
4884
|
-
|
|
4884
|
+
Kt.displayName = "Radio";
|
|
4885
4885
|
const Ai = fr("sc:pointer-events-none sc:relative sc:origin-center sc:animate-spin sc:size-6 sc:text-primary", {
|
|
4886
4886
|
variants: {
|
|
4887
4887
|
size: {
|
|
@@ -4977,7 +4977,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
4977
4977
|
const g = e.targetId ? A(e.targetId) : null, P = xs(() => e.targetId ? n.length > 1 && n.includes(e.targetId) ? n : [e.targetId] : [], [e.targetId, n]), N = !!(g != null && g.locked), D = P.some((u) => {
|
|
4978
4978
|
var q;
|
|
4979
4979
|
return !!((q = A(u)) != null && q.locked);
|
|
4980
|
-
}), w = g instanceof Re, ne = P.length > 1,
|
|
4980
|
+
}), w = g instanceof Re, ne = P.length > 1, V = (u) => () => {
|
|
4981
4981
|
u(), t();
|
|
4982
4982
|
}, O = /* @__PURE__ */ r(
|
|
4983
4983
|
"div",
|
|
@@ -5005,7 +5005,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5005
5005
|
icon: /* @__PURE__ */ r(ze, { icon: _e.copy, className: "sc:size-3.5" }),
|
|
5006
5006
|
label: "Copy",
|
|
5007
5007
|
shortcut: `${Zn}C`,
|
|
5008
|
-
onClick:
|
|
5008
|
+
onClick: V(() => s())
|
|
5009
5009
|
}
|
|
5010
5010
|
),
|
|
5011
5011
|
/* @__PURE__ */ r(
|
|
@@ -5016,7 +5016,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5016
5016
|
label: "Paste",
|
|
5017
5017
|
shortcut: `${Zn}V`,
|
|
5018
5018
|
disabled: !i,
|
|
5019
|
-
onClick:
|
|
5019
|
+
onClick: V(() => o())
|
|
5020
5020
|
}
|
|
5021
5021
|
),
|
|
5022
5022
|
/* @__PURE__ */ r(
|
|
@@ -5026,7 +5026,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5026
5026
|
icon: /* @__PURE__ */ r(ze, { icon: _e.copy, className: "sc:size-3.5" }),
|
|
5027
5027
|
label: "Duplicate",
|
|
5028
5028
|
shortcut: `${Zn}D`,
|
|
5029
|
-
onClick:
|
|
5029
|
+
onClick: V(() => P.forEach((u) => d(u)))
|
|
5030
5030
|
}
|
|
5031
5031
|
),
|
|
5032
5032
|
/* @__PURE__ */ r(ps, {}),
|
|
@@ -5036,7 +5036,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5036
5036
|
"data-testid": "context-menu-lock",
|
|
5037
5037
|
icon: /* @__PURE__ */ r(ze, { icon: N ? _e.lockOpen : _e.lock, className: "sc:size-3.5" }),
|
|
5038
5038
|
label: N ? "Unlock" : "Lock",
|
|
5039
|
-
onClick:
|
|
5039
|
+
onClick: V(() => P.forEach((u) => p(u)))
|
|
5040
5040
|
}
|
|
5041
5041
|
),
|
|
5042
5042
|
/* @__PURE__ */ r(ps, {}),
|
|
@@ -5047,7 +5047,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5047
5047
|
icon: /* @__PURE__ */ r(ze, { icon: _e.layerForward, className: "sc:size-3.5" }),
|
|
5048
5048
|
label: "Bring to Front",
|
|
5049
5049
|
disabled: N,
|
|
5050
|
-
onClick:
|
|
5050
|
+
onClick: V(() => v(e.targetId))
|
|
5051
5051
|
}
|
|
5052
5052
|
),
|
|
5053
5053
|
/* @__PURE__ */ r(
|
|
@@ -5057,7 +5057,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5057
5057
|
icon: /* @__PURE__ */ r(ze, { icon: _e.arrowUp, className: "sc:size-3.5" }),
|
|
5058
5058
|
label: "Bring Forward",
|
|
5059
5059
|
disabled: N,
|
|
5060
|
-
onClick:
|
|
5060
|
+
onClick: V(() => b(e.targetId))
|
|
5061
5061
|
}
|
|
5062
5062
|
),
|
|
5063
5063
|
/* @__PURE__ */ r(
|
|
@@ -5067,7 +5067,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5067
5067
|
icon: /* @__PURE__ */ r(ze, { icon: _e.arrowDown, className: "sc:size-3.5" }),
|
|
5068
5068
|
label: "Send Backward",
|
|
5069
5069
|
disabled: N,
|
|
5070
|
-
onClick:
|
|
5070
|
+
onClick: V(() => x(e.targetId))
|
|
5071
5071
|
}
|
|
5072
5072
|
),
|
|
5073
5073
|
/* @__PURE__ */ r(
|
|
@@ -5077,7 +5077,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5077
5077
|
icon: /* @__PURE__ */ r(ze, { icon: _e.layerBackward, className: "sc:size-3.5" }),
|
|
5078
5078
|
label: "Send to Back",
|
|
5079
5079
|
disabled: N,
|
|
5080
|
-
onClick:
|
|
5080
|
+
onClick: V(() => C(e.targetId))
|
|
5081
5081
|
}
|
|
5082
5082
|
),
|
|
5083
5083
|
(ne || w) && /* @__PURE__ */ r(ps, {}),
|
|
@@ -5088,7 +5088,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5088
5088
|
icon: /* @__PURE__ */ r(ze, { icon: _e.group, className: "sc:size-3.5" }),
|
|
5089
5089
|
label: "Group",
|
|
5090
5090
|
disabled: D,
|
|
5091
|
-
onClick:
|
|
5091
|
+
onClick: V(() => R(P))
|
|
5092
5092
|
}
|
|
5093
5093
|
),
|
|
5094
5094
|
w && /* @__PURE__ */ r(
|
|
@@ -5098,7 +5098,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5098
5098
|
icon: /* @__PURE__ */ r(ze, { icon: _e.ungroup, className: "sc:size-3.5" }),
|
|
5099
5099
|
label: "Ungroup",
|
|
5100
5100
|
disabled: N,
|
|
5101
|
-
onClick:
|
|
5101
|
+
onClick: V(() => E(e.targetId))
|
|
5102
5102
|
}
|
|
5103
5103
|
),
|
|
5104
5104
|
/* @__PURE__ */ r(ps, {}),
|
|
@@ -5110,7 +5110,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5110
5110
|
label: "Delete",
|
|
5111
5111
|
shortcut: "Del",
|
|
5112
5112
|
className: "sc:text-[#d32f2f] sc:hover:bg-[rgba(211,47,47,0.1)] sc:hover:text-[#c62828]",
|
|
5113
|
-
onClick:
|
|
5113
|
+
onClick: V(() => {
|
|
5114
5114
|
P.filter((u) => {
|
|
5115
5115
|
var q;
|
|
5116
5116
|
return !T((q = A(u)) == null ? void 0 : q.name);
|
|
@@ -5127,7 +5127,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5127
5127
|
label: "Paste",
|
|
5128
5128
|
shortcut: `${Zn}V`,
|
|
5129
5129
|
disabled: !i,
|
|
5130
|
-
onClick:
|
|
5130
|
+
onClick: V(() => o())
|
|
5131
5131
|
}
|
|
5132
5132
|
),
|
|
5133
5133
|
/* @__PURE__ */ r(
|
|
@@ -5137,7 +5137,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5137
5137
|
icon: /* @__PURE__ */ r(ze, { icon: _e.selectAll, className: "sc:size-3.5" }),
|
|
5138
5138
|
label: "Select All",
|
|
5139
5139
|
shortcut: `${Zn}A`,
|
|
5140
|
-
onClick:
|
|
5140
|
+
onClick: V(
|
|
5141
5141
|
() => gr({
|
|
5142
5142
|
elements: a,
|
|
5143
5143
|
artboardManager: l,
|
|
@@ -5154,7 +5154,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5154
5154
|
/* @__PURE__ */ r("div", { className: "sc-root", style: { display: "contents" }, children: O }),
|
|
5155
5155
|
document.body
|
|
5156
5156
|
);
|
|
5157
|
-
}, Oi = 0.25, zi = 8, Xi = 0.1,
|
|
5157
|
+
}, Oi = 0.25, zi = 8, Xi = 0.1, Li = 4, Yi = 1e-3, Wa = ({
|
|
5158
5158
|
className: e,
|
|
5159
5159
|
style: t,
|
|
5160
5160
|
width: n,
|
|
@@ -5187,7 +5187,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5187
5187
|
panOffset: D,
|
|
5188
5188
|
setPanOffset: w,
|
|
5189
5189
|
isPanning: ne,
|
|
5190
|
-
setIsPanning:
|
|
5190
|
+
setIsPanning: V,
|
|
5191
5191
|
userZoom: O,
|
|
5192
5192
|
setUserZoom: u,
|
|
5193
5193
|
resetUserView: q
|
|
@@ -5195,7 +5195,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5195
5195
|
selectedId: U,
|
|
5196
5196
|
multiSelection: te,
|
|
5197
5197
|
handleSelectionChange: le,
|
|
5198
|
-
setMultiSelection:
|
|
5198
|
+
setMultiSelection: H,
|
|
5199
5199
|
handleActiveChildChange: xe,
|
|
5200
5200
|
setHoveredElementId: ie,
|
|
5201
5201
|
hideHandles: be
|
|
@@ -5207,89 +5207,89 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5207
5207
|
}, [Te]), De = je.useRef(null), [$e, at] = je.useState(0), [pt, ct] = je.useState(0), [Pt, zt] = je.useState(!1), At = je.useRef(P), We = je.useRef(!1), [Ee, lt] = je.useState(!1), se = je.useRef(null);
|
|
5208
5208
|
Eo({ enabled: m });
|
|
5209
5209
|
const [h, G] = je.useState(null), re = je.useCallback(
|
|
5210
|
-
(
|
|
5210
|
+
(K) => {
|
|
5211
5211
|
G({
|
|
5212
|
-
x:
|
|
5213
|
-
y:
|
|
5214
|
-
targetId:
|
|
5212
|
+
x: K.clientX,
|
|
5213
|
+
y: K.clientY,
|
|
5214
|
+
targetId: K.elementId
|
|
5215
5215
|
});
|
|
5216
5216
|
},
|
|
5217
5217
|
[]
|
|
5218
5218
|
), he = je.useCallback(() => G(null), []), _ = A.getActiveArtboard(), Ce = je.useCallback(
|
|
5219
|
-
(
|
|
5220
|
-
if (!(a ||
|
|
5221
|
-
|
|
5219
|
+
(K) => {
|
|
5220
|
+
if (!(a || K.ctrlKey || K.metaKey)) return;
|
|
5221
|
+
K.preventDefault();
|
|
5222
5222
|
const me = De.current;
|
|
5223
5223
|
if (!me) return;
|
|
5224
|
-
const Be = me.getBoundingClientRect(), Je =
|
|
5224
|
+
const Be = me.getBoundingClientRect(), Je = K.clientX - Be.left, Ge = K.clientY - Be.top, Fe = -K.deltaY * Yi;
|
|
5225
5225
|
if (a) {
|
|
5226
|
-
const nt = $e, st = Math.min(Math.max(nt * (1 + Fe), Xi),
|
|
5226
|
+
const nt = $e, st = Math.min(Math.max(nt * (1 + Fe), Xi), Li);
|
|
5227
5227
|
if (st === nt) return;
|
|
5228
|
-
const xt = st / nt, yt = Je - (Je - D.x) * xt,
|
|
5229
|
-
at(st), w({ x: yt, y:
|
|
5228
|
+
const xt = st / nt, yt = Je - (Je - D.x) * xt, Ht = Ge - (Ge - D.y) * xt;
|
|
5229
|
+
at(st), w({ x: yt, y: Ht });
|
|
5230
5230
|
} else {
|
|
5231
5231
|
const nt = O, st = Math.min(
|
|
5232
5232
|
Math.max(nt * (1 + Fe), Oi),
|
|
5233
5233
|
zi
|
|
5234
5234
|
);
|
|
5235
5235
|
if (st === nt) return;
|
|
5236
|
-
const xt = st / nt, yt = Je - (Je - D.x) * xt,
|
|
5237
|
-
u(st), w({ x: yt, y:
|
|
5236
|
+
const xt = st / nt, yt = Je - (Je - D.x) * xt, Ht = Ge - (Ge - D.y) * xt;
|
|
5237
|
+
u(st), w({ x: yt, y: Ht });
|
|
5238
5238
|
}
|
|
5239
5239
|
},
|
|
5240
5240
|
[a, $e, D, w, O, u]
|
|
5241
5241
|
);
|
|
5242
5242
|
je.useEffect(() => {
|
|
5243
|
-
const
|
|
5244
|
-
if (
|
|
5245
|
-
return
|
|
5243
|
+
const K = De.current;
|
|
5244
|
+
if (K)
|
|
5245
|
+
return K.addEventListener("wheel", Ce, { passive: !1 }), () => K.removeEventListener("wheel", Ce);
|
|
5246
5246
|
}, [Ce]), je.useEffect(() => {
|
|
5247
5247
|
if (!a) return;
|
|
5248
|
-
const
|
|
5248
|
+
const K = (me) => {
|
|
5249
5249
|
me.code === "Space" && !me.repeat && lt(!0);
|
|
5250
5250
|
}, ue = (me) => {
|
|
5251
5251
|
me.code === "Space" && (lt(!1), se.current = null);
|
|
5252
5252
|
};
|
|
5253
|
-
return window.addEventListener("keydown",
|
|
5254
|
-
window.removeEventListener("keydown",
|
|
5253
|
+
return window.addEventListener("keydown", K), window.addEventListener("keyup", ue), () => {
|
|
5254
|
+
window.removeEventListener("keydown", K), window.removeEventListener("keyup", ue);
|
|
5255
5255
|
};
|
|
5256
5256
|
}, [a]);
|
|
5257
5257
|
const Ie = je.useCallback(
|
|
5258
|
-
(
|
|
5258
|
+
(K) => {
|
|
5259
5259
|
if (!a) return;
|
|
5260
|
-
const ue =
|
|
5261
|
-
(ue || me) && (
|
|
5262
|
-
x:
|
|
5263
|
-
y:
|
|
5260
|
+
const ue = K.button === 1, me = Ee && K.button === 0;
|
|
5261
|
+
(ue || me) && (K.preventDefault(), K.target.setPointerCapture(K.pointerId), V(!0), se.current = {
|
|
5262
|
+
x: K.clientX,
|
|
5263
|
+
y: K.clientY,
|
|
5264
5264
|
panX: D.x,
|
|
5265
5265
|
panY: D.y
|
|
5266
5266
|
});
|
|
5267
5267
|
},
|
|
5268
|
-
[a, Ee, D,
|
|
5269
|
-
),
|
|
5270
|
-
(
|
|
5268
|
+
[a, Ee, D, V]
|
|
5269
|
+
), Ve = je.useCallback(
|
|
5270
|
+
(K) => {
|
|
5271
5271
|
if (!ne || !se.current) return;
|
|
5272
|
-
const ue =
|
|
5272
|
+
const ue = K.clientX - se.current.x, me = K.clientY - se.current.y;
|
|
5273
5273
|
w({
|
|
5274
5274
|
x: se.current.panX + ue,
|
|
5275
5275
|
y: se.current.panY + me
|
|
5276
5276
|
});
|
|
5277
5277
|
},
|
|
5278
5278
|
[ne, w]
|
|
5279
|
-
), Xe = je.useCallback((
|
|
5280
|
-
ne && (
|
|
5281
|
-
}, [ne,
|
|
5279
|
+
), Xe = je.useCallback((K) => {
|
|
5280
|
+
ne && (K && K.target.releasePointerCapture(K.pointerId), V(!1), se.current = null);
|
|
5281
|
+
}, [ne, V]);
|
|
5282
5282
|
je.useEffect(() => {
|
|
5283
5283
|
if (!a || !ne) return;
|
|
5284
|
-
const
|
|
5285
|
-
|
|
5284
|
+
const K = () => {
|
|
5285
|
+
V(!1), se.current = null;
|
|
5286
5286
|
};
|
|
5287
|
-
return window.addEventListener("pointerup",
|
|
5288
|
-
}, [a, ne,
|
|
5287
|
+
return window.addEventListener("pointerup", K), () => window.removeEventListener("pointerup", K);
|
|
5288
|
+
}, [a, ne, V]);
|
|
5289
5289
|
const Y = je.useMemo(() => {
|
|
5290
5290
|
if (!x || !b) return null;
|
|
5291
|
-
const
|
|
5292
|
-
if (
|
|
5291
|
+
const K = b.pieces ?? [];
|
|
5292
|
+
if (K.length <= 1) return null;
|
|
5293
5293
|
if (x === "spread")
|
|
5294
5294
|
return _ ? {
|
|
5295
5295
|
x: 0,
|
|
@@ -5297,7 +5297,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5297
5297
|
width: _.width,
|
|
5298
5298
|
height: _.height
|
|
5299
5299
|
} : null;
|
|
5300
|
-
const ue =
|
|
5300
|
+
const ue = K.find((me) => me.id === x.pieceId);
|
|
5301
5301
|
return ue ? { x: ue.x, y: ue.y, width: ue.width, height: ue.height } : null;
|
|
5302
5302
|
}, [x, b, _]), $ = Mo(Y);
|
|
5303
5303
|
je.useEffect(() => {
|
|
@@ -5307,7 +5307,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5307
5307
|
}
|
|
5308
5308
|
if (!De.current || !_)
|
|
5309
5309
|
return;
|
|
5310
|
-
let
|
|
5310
|
+
let K = 0;
|
|
5311
5311
|
const ue = () => {
|
|
5312
5312
|
if (!De.current || !_) return;
|
|
5313
5313
|
const Je = De.current.clientWidth;
|
|
@@ -5317,7 +5317,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5317
5317
|
if (x && x !== "spread" && b) {
|
|
5318
5318
|
const xt = b.pieces ?? [];
|
|
5319
5319
|
if (xt.length > 1) {
|
|
5320
|
-
const yt = xt.find((
|
|
5320
|
+
const yt = xt.find((Ht) => Ht.id === x.pieceId);
|
|
5321
5321
|
yt && (Ge = yt.width, Fe = yt.height);
|
|
5322
5322
|
}
|
|
5323
5323
|
}
|
|
@@ -5325,7 +5325,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5325
5325
|
if (c !== void 0) {
|
|
5326
5326
|
const xt = Je - c * 2, yt = Math.min(xt / Ge, 1);
|
|
5327
5327
|
if ($ && f !== void 0) {
|
|
5328
|
-
const
|
|
5328
|
+
const Ht = f - c * 2, ve = Math.min(Ht / Fe, 1);
|
|
5329
5329
|
nt = Math.min(yt, ve), st = ve <= yt;
|
|
5330
5330
|
} else if (nt = yt, f !== void 0 && Fe * nt + c * 2 > f) {
|
|
5331
5331
|
const An = (f - c * 2) / Fe;
|
|
@@ -5336,8 +5336,8 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5336
5336
|
at(nt), ct(Je), zt(st);
|
|
5337
5337
|
};
|
|
5338
5338
|
let me = !1;
|
|
5339
|
-
We.current ? ue() :
|
|
5340
|
-
|
|
5339
|
+
We.current ? ue() : K = requestAnimationFrame(() => {
|
|
5340
|
+
K = requestAnimationFrame(() => {
|
|
5341
5341
|
me || (ue(), We.current = !0);
|
|
5342
5342
|
});
|
|
5343
5343
|
});
|
|
@@ -5345,7 +5345,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5345
5345
|
ue();
|
|
5346
5346
|
});
|
|
5347
5347
|
return Be.observe(De.current), () => {
|
|
5348
|
-
me = !0, cancelAnimationFrame(
|
|
5348
|
+
me = !0, cancelAnimationFrame(K), Be.disconnect();
|
|
5349
5349
|
};
|
|
5350
5350
|
}, [o, _, i, c, f, x, b, $]);
|
|
5351
5351
|
const ot = $e > 0 && O > 0 ? $e * O : $e;
|
|
@@ -5364,8 +5364,8 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5364
5364
|
}, [ot, N]);
|
|
5365
5365
|
const rt = je.useRef(null);
|
|
5366
5366
|
je.useEffect(() => {
|
|
5367
|
-
const
|
|
5368
|
-
|
|
5367
|
+
const K = $ && "id" in $ ? $.id ?? null : null;
|
|
5368
|
+
K !== rt.current && (rt.current !== null && q(), rt.current = K);
|
|
5369
5369
|
}, [$, q]);
|
|
5370
5370
|
const Ze = $ ? $.width : (_ == null ? void 0 : _.width) ?? 0, gt = $ ? $.height : (_ == null ? void 0 : _.height) ?? 0, Nt = Ze * ot, Dt = gt * ot, tn = Ze * $e;
|
|
5371
5371
|
let Yt = _ ? c !== void 0 ? Dt + c * 2 : Dt / i : 0;
|
|
@@ -5375,11 +5375,11 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5375
5375
|
c !== void 0 && Pt && rn > 0 && tn > 0 && (wt = (rn - tn) / 2);
|
|
5376
5376
|
const on = Yt, Ut = je.useRef({ w: 0, h: 0 });
|
|
5377
5377
|
je.useEffect(() => {
|
|
5378
|
-
const
|
|
5379
|
-
if (!
|
|
5378
|
+
const K = De.current;
|
|
5379
|
+
if (!K) return;
|
|
5380
5380
|
Ut.current = {
|
|
5381
|
-
w:
|
|
5382
|
-
h:
|
|
5381
|
+
w: K.clientWidth,
|
|
5382
|
+
h: K.clientHeight
|
|
5383
5383
|
};
|
|
5384
5384
|
const ue = new ResizeObserver((me) => {
|
|
5385
5385
|
const Be = me[0];
|
|
@@ -5388,16 +5388,16 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5388
5388
|
h: Be.contentRect.height
|
|
5389
5389
|
});
|
|
5390
5390
|
});
|
|
5391
|
-
return ue.observe(
|
|
5391
|
+
return ue.observe(K), () => ue.disconnect();
|
|
5392
5392
|
}, []), je.useEffect(() => {
|
|
5393
5393
|
if (a) return;
|
|
5394
5394
|
if (O <= 1.001) {
|
|
5395
5395
|
(D.x !== 0 || D.y !== 0) && w({ x: 0, y: 0 });
|
|
5396
5396
|
return;
|
|
5397
5397
|
}
|
|
5398
|
-
const
|
|
5399
|
-
if (
|
|
5400
|
-
const me = 0.25 * Math.min(Nt,
|
|
5398
|
+
const K = Ut.current.w, ue = Ut.current.h;
|
|
5399
|
+
if (K === 0 || ue === 0 || Nt === 0 || Dt === 0) return;
|
|
5400
|
+
const me = 0.25 * Math.min(Nt, K), Be = 0.25 * Math.min(Dt, ue), Je = me - (wt ?? 0) - Nt, Ge = K - me - (wt ?? 0), Fe = Be - (Xt ?? 0) - Dt, nt = ue - Be - (Xt ?? 0), st = Math.max(Je, Math.min(Ge, D.x)), xt = Math.max(Fe, Math.min(nt, D.y));
|
|
5401
5401
|
(st !== D.x || xt !== D.y) && w({ x: st, y: xt });
|
|
5402
5402
|
}, [
|
|
5403
5403
|
a,
|
|
@@ -5409,7 +5409,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5409
5409
|
Xt,
|
|
5410
5410
|
w
|
|
5411
5411
|
]);
|
|
5412
|
-
const
|
|
5412
|
+
const Ke = a ? {
|
|
5413
5413
|
// Interactive mode: full viewport with overflow hidden for infinite canvas feel
|
|
5414
5414
|
position: "relative",
|
|
5415
5415
|
width: n ? `${n}px` : "100%",
|
|
@@ -5455,9 +5455,9 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5455
5455
|
{
|
|
5456
5456
|
ref: De,
|
|
5457
5457
|
className: e,
|
|
5458
|
-
style:
|
|
5458
|
+
style: Ke,
|
|
5459
5459
|
onPointerDown: a ? Ie : void 0,
|
|
5460
|
-
onPointerMove: a ?
|
|
5460
|
+
onPointerMove: a ? Ve : void 0,
|
|
5461
5461
|
onPointerUp: a ? Xe : void 0,
|
|
5462
5462
|
onPointerLeave: a ? Xe : void 0,
|
|
5463
5463
|
onPointerCancel: a ? Xe : void 0,
|
|
@@ -5475,9 +5475,9 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5475
5475
|
setElements: I,
|
|
5476
5476
|
executeElementUpdate: g,
|
|
5477
5477
|
onSelectionChange: le,
|
|
5478
|
-
onMultiSelectionChange:
|
|
5478
|
+
onMultiSelectionChange: H,
|
|
5479
5479
|
onActiveChildChange: xe,
|
|
5480
|
-
onTextSelectionChange: () => Se((
|
|
5480
|
+
onTextSelectionChange: () => Se((K) => K + 1),
|
|
5481
5481
|
onHoverChange: ie,
|
|
5482
5482
|
onCropModeEnter: Oe,
|
|
5483
5483
|
onContextMenuRequest: re,
|
|
@@ -5503,18 +5503,18 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5503
5503
|
_i,
|
|
5504
5504
|
{
|
|
5505
5505
|
userZoom: O,
|
|
5506
|
-
onSetZoom: (
|
|
5507
|
-
if (
|
|
5506
|
+
onSetZoom: (K) => {
|
|
5507
|
+
if (K <= 1.001) {
|
|
5508
5508
|
q();
|
|
5509
5509
|
return;
|
|
5510
5510
|
}
|
|
5511
5511
|
const ue = De.current;
|
|
5512
5512
|
if (!ue) {
|
|
5513
|
-
u(
|
|
5513
|
+
u(K);
|
|
5514
5514
|
return;
|
|
5515
5515
|
}
|
|
5516
|
-
const me = ue.getBoundingClientRect(), Be = me.width / 2, Je = me.height / 2, Ge =
|
|
5517
|
-
u(
|
|
5516
|
+
const me = ue.getBoundingClientRect(), Be = me.width / 2, Je = me.height / 2, Ge = K / Math.max(O, 1e-4);
|
|
5517
|
+
u(K), w({
|
|
5518
5518
|
x: Be - (Be - D.x) * Ge,
|
|
5519
5519
|
y: Je - (Je - D.y) * Ge
|
|
5520
5520
|
});
|
|
@@ -5524,7 +5524,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5524
5524
|
]
|
|
5525
5525
|
}
|
|
5526
5526
|
);
|
|
5527
|
-
},
|
|
5527
|
+
}, Hi = [1, 2, 4, 8];
|
|
5528
5528
|
function _i({
|
|
5529
5529
|
userZoom: e,
|
|
5530
5530
|
onSetZoom: t
|
|
@@ -5567,7 +5567,7 @@ function _i({
|
|
|
5567
5567
|
backdropFilter: "blur(6px)"
|
|
5568
5568
|
},
|
|
5569
5569
|
className: "sc:flex sc:flex-col sc:rounded-2xl sc:border sc:border-border/40 sc:bg-popover/95 sc:p-1 sc:shadow-lg",
|
|
5570
|
-
children:
|
|
5570
|
+
children: Hi.map((i) => {
|
|
5571
5571
|
const a = i * 100, l = Math.abs(e - i) < 0.05;
|
|
5572
5572
|
return /* @__PURE__ */ y(
|
|
5573
5573
|
"button",
|
|
@@ -5620,10 +5620,10 @@ const is = /* @__PURE__ */ new Map();
|
|
|
5620
5620
|
function It(e, t) {
|
|
5621
5621
|
is.set(e, t);
|
|
5622
5622
|
}
|
|
5623
|
-
function
|
|
5623
|
+
function Va(e) {
|
|
5624
5624
|
return is.get(e);
|
|
5625
5625
|
}
|
|
5626
|
-
function
|
|
5626
|
+
function Ka() {
|
|
5627
5627
|
return Array.from(is.keys());
|
|
5628
5628
|
}
|
|
5629
5629
|
function Ua() {
|
|
@@ -5648,12 +5648,12 @@ async function qa() {
|
|
|
5648
5648
|
] = await Promise.all([
|
|
5649
5649
|
Promise.resolve().then(() => xa),
|
|
5650
5650
|
Promise.resolve().then(() => ba),
|
|
5651
|
-
import("./ImagePanel-
|
|
5651
|
+
import("./ImagePanel-ntJBepby.js"),
|
|
5652
5652
|
Promise.resolve().then(() => Sa),
|
|
5653
5653
|
Promise.resolve().then(() => ka),
|
|
5654
|
-
import("./ContextualToolbars-
|
|
5654
|
+
import("./ContextualToolbars-BKU8IoAM.js").then((c) => c.s),
|
|
5655
5655
|
Promise.resolve().then(() => Ra),
|
|
5656
|
-
import("./ContextualToolbars-
|
|
5656
|
+
import("./ContextualToolbars-BKU8IoAM.js").then((c) => c.r)
|
|
5657
5657
|
]);
|
|
5658
5658
|
It("effects-panel", {
|
|
5659
5659
|
component: e,
|
|
@@ -5703,7 +5703,7 @@ function br() {
|
|
|
5703
5703
|
icon: "gravity-ui:layers",
|
|
5704
5704
|
position: "left"
|
|
5705
5705
|
}), It("menu-button", {
|
|
5706
|
-
component:
|
|
5706
|
+
component: Lr,
|
|
5707
5707
|
label: "Menu",
|
|
5708
5708
|
icon: "gravity-ui:bars",
|
|
5709
5709
|
position: "topbar"
|
|
@@ -5713,7 +5713,7 @@ function br() {
|
|
|
5713
5713
|
icon: "lucide:undo-2",
|
|
5714
5714
|
position: "topbar"
|
|
5715
5715
|
}), It("add-element-menu", {
|
|
5716
|
-
component:
|
|
5716
|
+
component: Hr,
|
|
5717
5717
|
label: "Add Element",
|
|
5718
5718
|
icon: "gravity-ui:plus",
|
|
5719
5719
|
position: "topbar"
|
|
@@ -5846,15 +5846,15 @@ const $i = ({ stroke: e, onChange: t }) => {
|
|
|
5846
5846
|
/* @__PURE__ */ r(Tt, { children: "Line Cap" }),
|
|
5847
5847
|
/* @__PURE__ */ y(ss, { value: l, onValueChange: x, orientation: "horizontal", children: [
|
|
5848
5848
|
/* @__PURE__ */ y(dn, { children: [
|
|
5849
|
-
/* @__PURE__ */ r(un, { asChild: !0, children: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(
|
|
5849
|
+
/* @__PURE__ */ r(un, { asChild: !0, children: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(Kt, { value: "butt", id: "cap-butt", children: "Butt" }) }) }),
|
|
5850
5850
|
/* @__PURE__ */ r(hn, { children: "Butt - Flat edges" })
|
|
5851
5851
|
] }),
|
|
5852
5852
|
/* @__PURE__ */ y(dn, { children: [
|
|
5853
|
-
/* @__PURE__ */ r(un, { asChild: !0, children: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(
|
|
5853
|
+
/* @__PURE__ */ r(un, { asChild: !0, children: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(Kt, { value: "round", id: "cap-round", children: "Round" }) }) }),
|
|
5854
5854
|
/* @__PURE__ */ r(hn, { children: "Round - Rounded edges" })
|
|
5855
5855
|
] }),
|
|
5856
5856
|
/* @__PURE__ */ y(dn, { children: [
|
|
5857
|
-
/* @__PURE__ */ r(un, { asChild: !0, children: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(
|
|
5857
|
+
/* @__PURE__ */ r(un, { asChild: !0, children: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(Kt, { value: "square", id: "cap-square", children: "Square" }) }) }),
|
|
5858
5858
|
/* @__PURE__ */ r(hn, { children: "Square - Extended square edges" })
|
|
5859
5859
|
] })
|
|
5860
5860
|
] })
|
|
@@ -5863,15 +5863,15 @@ const $i = ({ stroke: e, onChange: t }) => {
|
|
|
5863
5863
|
/* @__PURE__ */ r(Tt, { children: "Line Join" }),
|
|
5864
5864
|
/* @__PURE__ */ y(ss, { value: c, onValueChange: v, orientation: "horizontal", children: [
|
|
5865
5865
|
/* @__PURE__ */ y(dn, { children: [
|
|
5866
|
-
/* @__PURE__ */ r(un, { asChild: !0, children: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(
|
|
5866
|
+
/* @__PURE__ */ r(un, { asChild: !0, children: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(Kt, { value: "miter", id: "join-miter", children: "Miter" }) }) }),
|
|
5867
5867
|
/* @__PURE__ */ r(hn, { children: "Miter - Sharp corners" })
|
|
5868
5868
|
] }),
|
|
5869
5869
|
/* @__PURE__ */ y(dn, { children: [
|
|
5870
|
-
/* @__PURE__ */ r(un, { asChild: !0, children: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(
|
|
5870
|
+
/* @__PURE__ */ r(un, { asChild: !0, children: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(Kt, { value: "round", id: "join-round", children: "Round" }) }) }),
|
|
5871
5871
|
/* @__PURE__ */ r(hn, { children: "Round - Rounded corners" })
|
|
5872
5872
|
] }),
|
|
5873
5873
|
/* @__PURE__ */ y(dn, { children: [
|
|
5874
|
-
/* @__PURE__ */ r(un, { asChild: !0, children: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(
|
|
5874
|
+
/* @__PURE__ */ r(un, { asChild: !0, children: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(Kt, { value: "bevel", id: "join-bevel", children: "Bevel" }) }) }),
|
|
5875
5875
|
/* @__PURE__ */ r(hn, { children: "Bevel - Beveled corners" })
|
|
5876
5876
|
] })
|
|
5877
5877
|
] })
|
|
@@ -6270,7 +6270,7 @@ const $i = ({ stroke: e, onChange: t }) => {
|
|
|
6270
6270
|
const m = {
|
|
6271
6271
|
id: `mask-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
|
|
6272
6272
|
type: d,
|
|
6273
|
-
maskElement:
|
|
6273
|
+
maskElement: Vi(d),
|
|
6274
6274
|
inverted: !1,
|
|
6275
6275
|
feather: 0,
|
|
6276
6276
|
opacity: 1
|
|
@@ -6391,7 +6391,7 @@ const $i = ({ stroke: e, onChange: t }) => {
|
|
|
6391
6391
|
] })
|
|
6392
6392
|
] });
|
|
6393
6393
|
};
|
|
6394
|
-
function
|
|
6394
|
+
function Vi(e) {
|
|
6395
6395
|
switch (e) {
|
|
6396
6396
|
case "clip":
|
|
6397
6397
|
return {
|
|
@@ -6449,7 +6449,7 @@ function Ki(e) {
|
|
|
6449
6449
|
};
|
|
6450
6450
|
}
|
|
6451
6451
|
}
|
|
6452
|
-
const
|
|
6452
|
+
const Ki = {
|
|
6453
6453
|
enabled: !0,
|
|
6454
6454
|
style: "worn",
|
|
6455
6455
|
intensity: 30,
|
|
@@ -6539,7 +6539,7 @@ const Vi = {
|
|
|
6539
6539
|
seed: void 0
|
|
6540
6540
|
}, ra = {
|
|
6541
6541
|
worn: {
|
|
6542
|
-
light:
|
|
6542
|
+
light: Ki,
|
|
6543
6543
|
medium: Ui,
|
|
6544
6544
|
heavy: Gi
|
|
6545
6545
|
},
|
|
@@ -6582,7 +6582,7 @@ const ia = ({ distressEffect: e, onChange: t }) => {
|
|
|
6582
6582
|
}, b = (g) => {
|
|
6583
6583
|
if (e)
|
|
6584
6584
|
if (g === "custom") {
|
|
6585
|
-
const P = e.textureUrl ||
|
|
6585
|
+
const P = e.textureUrl || Ks[0].textureUrl;
|
|
6586
6586
|
Us(P), t({
|
|
6587
6587
|
...e,
|
|
6588
6588
|
style: "custom",
|
|
@@ -6794,15 +6794,15 @@ const ia = ({ distressEffect: e, onChange: t }) => {
|
|
|
6794
6794
|
/* @__PURE__ */ y(On, { className: "sc:flex sc:flex-col sc:gap-sm", children: [
|
|
6795
6795
|
/* @__PURE__ */ r(Tt, { children: "Style" }),
|
|
6796
6796
|
/* @__PURE__ */ y(ss, { value: i, onValueChange: b, orientation: "horizontal", children: [
|
|
6797
|
-
/* @__PURE__ */ r(
|
|
6798
|
-
/* @__PURE__ */ r(
|
|
6799
|
-
/* @__PURE__ */ r(
|
|
6800
|
-
/* @__PURE__ */ r(
|
|
6801
|
-
/* @__PURE__ */ r(
|
|
6797
|
+
/* @__PURE__ */ r(Kt, { value: "worn", id: "style-worn", children: "Worn" }),
|
|
6798
|
+
/* @__PURE__ */ r(Kt, { value: "cracked", id: "style-cracked", children: "Cracked" }),
|
|
6799
|
+
/* @__PURE__ */ r(Kt, { value: "grunge", id: "style-grunge", children: "Grunge" }),
|
|
6800
|
+
/* @__PURE__ */ r(Kt, { value: "retro", id: "style-retro", children: "Retro" }),
|
|
6801
|
+
/* @__PURE__ */ r(Kt, { value: "custom", id: "style-custom", children: "Custom" })
|
|
6802
6802
|
] })
|
|
6803
6803
|
] }),
|
|
6804
6804
|
i === "custom" && /* @__PURE__ */ y(Pn, { children: [
|
|
6805
|
-
/* @__PURE__ */ r("div", { className: "sc:grid sc:grid-cols-4 sc:gap-1.5", children:
|
|
6805
|
+
/* @__PURE__ */ r("div", { className: "sc:grid sc:grid-cols-4 sc:gap-1.5", children: Ks.map((g) => /* @__PURE__ */ r(
|
|
6806
6806
|
"button",
|
|
6807
6807
|
{
|
|
6808
6808
|
onClick: () => x(g.textureUrl),
|
|
@@ -6979,8 +6979,8 @@ const da = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
|
|
|
6979
6979
|
/* @__PURE__ */ y(On, { className: "sc:flex sc:flex-col sc:gap-sm", children: [
|
|
6980
6980
|
/* @__PURE__ */ r(Tt, { children: "Blend Mode" }),
|
|
6981
6981
|
/* @__PURE__ */ y(ss, { value: e, onValueChange: d, orientation: "horizontal", children: [
|
|
6982
|
-
/* @__PURE__ */ r(
|
|
6983
|
-
/* @__PURE__ */ r(
|
|
6982
|
+
/* @__PURE__ */ r(Kt, { value: "normal", id: "blend-normal", children: "Normal" }),
|
|
6983
|
+
/* @__PURE__ */ r(Kt, { value: "knockout", id: "blend-knockout", children: "Knockout" })
|
|
6984
6984
|
] })
|
|
6985
6985
|
] }),
|
|
6986
6986
|
a && /* @__PURE__ */ y(Pn, { children: [
|
|
@@ -7246,12 +7246,12 @@ const da = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
|
|
|
7246
7246
|
}
|
|
7247
7247
|
N(!0), (async () => {
|
|
7248
7248
|
const le = /* @__PURE__ */ new Map();
|
|
7249
|
-
for (const
|
|
7249
|
+
for (const H of U)
|
|
7250
7250
|
try {
|
|
7251
|
-
const xe = await Bn.getGlyphAlternates(e,
|
|
7252
|
-
le.set(
|
|
7251
|
+
const xe = await Bn.getGlyphAlternates(e, H, t), ie = xe.length > 0 ? xe.length - 1 : 0;
|
|
7252
|
+
le.set(H, ie);
|
|
7253
7253
|
} catch (xe) {
|
|
7254
|
-
Rs.error(`Error loading alternates for '${
|
|
7254
|
+
Rs.error(`Error loading alternates for '${H}':`, xe), le.set(H, 0);
|
|
7255
7255
|
}
|
|
7256
7256
|
g(le), N(!1);
|
|
7257
7257
|
})();
|
|
@@ -7261,20 +7261,20 @@ const da = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
|
|
|
7261
7261
|
...s,
|
|
7262
7262
|
[U]: !te
|
|
7263
7263
|
};
|
|
7264
|
-
Object.keys(le).forEach((
|
|
7265
|
-
le[
|
|
7266
|
-
}), e && Object.keys(le).length > 0 && Bn.loadFont(e, t).catch((
|
|
7267
|
-
Rs.error("Error pre-loading font for OpenType features:",
|
|
7264
|
+
Object.keys(le).forEach((H) => {
|
|
7265
|
+
le[H] || delete le[H];
|
|
7266
|
+
}), e && Object.keys(le).length > 0 && Bn.loadFont(e, t).catch((H) => {
|
|
7267
|
+
Rs.error("Error pre-loading font for OpenType features:", H);
|
|
7268
7268
|
}), i(Object.keys(le).length > 0 ? le : void 0);
|
|
7269
7269
|
}, w = (U, te) => {
|
|
7270
7270
|
C(U), E(te), T(!1), x(!0);
|
|
7271
7271
|
}, ne = () => {
|
|
7272
7272
|
T(!0), x(!0);
|
|
7273
|
-
},
|
|
7273
|
+
}, V = (U) => {
|
|
7274
7274
|
if (!a) return;
|
|
7275
7275
|
let te = [...o];
|
|
7276
7276
|
if (U) {
|
|
7277
|
-
const le = te.findIndex((
|
|
7277
|
+
const le = te.findIndex((H) => H.charIndex === U.charIndex);
|
|
7278
7278
|
le >= 0 ? te[le] = U : te.push(U);
|
|
7279
7279
|
} else
|
|
7280
7280
|
te = te.filter((le) => le.charIndex !== v);
|
|
@@ -7351,10 +7351,10 @@ const da = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
|
|
|
7351
7351
|
}) })
|
|
7352
7352
|
] }),
|
|
7353
7353
|
!m && e && f.length > 0 && /* @__PURE__ */ r(Pn, { children: Object.entries(q).map(([U, te]) => {
|
|
7354
|
-
const le = te.filter((
|
|
7354
|
+
const le = te.filter((H) => f.includes(H.tag));
|
|
7355
7355
|
return le.length === 0 ? null : /* @__PURE__ */ y("div", { className: "sc:mb-lg", children: [
|
|
7356
7356
|
/* @__PURE__ */ r("div", { className: "sc:mb-sm sc:text-2xs sc:font-semibold sc:uppercase sc:tracking-wide sc:text-text-secondary", children: U }),
|
|
7357
|
-
/* @__PURE__ */ r("div", { className: "sc:flex sc:flex-col sc:gap-sm", children: le.map((
|
|
7357
|
+
/* @__PURE__ */ r("div", { className: "sc:flex sc:flex-col sc:gap-sm", children: le.map((H) => /* @__PURE__ */ y(
|
|
7358
7358
|
"label",
|
|
7359
7359
|
{
|
|
7360
7360
|
className: "sc:flex sc:cursor-pointer sc:items-start sc:gap-sm sc:rounded sc:p-xs sc:transition-colors sc:duration-fast sc:hover:bg-surface",
|
|
@@ -7363,18 +7363,18 @@ const da = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
|
|
|
7363
7363
|
"input",
|
|
7364
7364
|
{
|
|
7365
7365
|
type: "checkbox",
|
|
7366
|
-
checked: (s == null ? void 0 : s[
|
|
7367
|
-
onChange: () => D(
|
|
7366
|
+
checked: (s == null ? void 0 : s[H.tag]) || !1,
|
|
7367
|
+
onChange: () => D(H.tag),
|
|
7368
7368
|
className: "sc:mt-[2px] sc:h-4 sc:w-4 sc:cursor-pointer sc:rounded sc:border-border-primary sc:bg-bg-input sc:accent-accent-primary"
|
|
7369
7369
|
}
|
|
7370
7370
|
),
|
|
7371
7371
|
/* @__PURE__ */ y("div", { className: "sc:flex-1", children: [
|
|
7372
|
-
/* @__PURE__ */ r("div", { className: "sc:text-sm sc:font-medium", children:
|
|
7373
|
-
/* @__PURE__ */ r("div", { className: "sc:mt-[2px] sc:text-2xs sc:text-text-secondary", children:
|
|
7372
|
+
/* @__PURE__ */ r("div", { className: "sc:text-sm sc:font-medium", children: H.label }),
|
|
7373
|
+
/* @__PURE__ */ r("div", { className: "sc:mt-[2px] sc:text-2xs sc:text-text-secondary", children: H.description })
|
|
7374
7374
|
] })
|
|
7375
7375
|
]
|
|
7376
7376
|
},
|
|
7377
|
-
|
|
7377
|
+
H.tag
|
|
7378
7378
|
)) })
|
|
7379
7379
|
] }, U);
|
|
7380
7380
|
}) })
|
|
@@ -7389,7 +7389,7 @@ const da = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
|
|
|
7389
7389
|
fontFamily: e,
|
|
7390
7390
|
fontWeight: t,
|
|
7391
7391
|
currentGlyphOverride: o.find((U) => U.charIndex === v),
|
|
7392
|
-
onSelectGlyph:
|
|
7392
|
+
onSelectGlyph: V,
|
|
7393
7393
|
browseAll: A
|
|
7394
7394
|
}
|
|
7395
7395
|
)
|
|
@@ -7586,10 +7586,10 @@ const da = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
|
|
|
7586
7586
|
progress: p,
|
|
7587
7587
|
supportsWorkerExport: b,
|
|
7588
7588
|
workerStats: x
|
|
7589
|
-
} =
|
|
7589
|
+
} = Vr(), { artboardsInfo: v, activeArtboardId: C } = ar(), [R, E] = ce(t), [A, T] = ce(n), [I, g] = ce(500), P = async () => {
|
|
7590
7590
|
if (C)
|
|
7591
7591
|
try {
|
|
7592
|
-
const w = await a(C, { scale: R, format: A }), ne = document.createElement("a"),
|
|
7592
|
+
const w = await a(C, { scale: R, format: A }), ne = document.createElement("a"), V = v.find((q) => q.id === C), O = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19), u = (V == null ? void 0 : V.name) || "artboard";
|
|
7593
7593
|
ne.download = `${u}-${O}.${A}`, ne.href = w, ne.click(), s && s({ [C]: w });
|
|
7594
7594
|
} catch (w) {
|
|
7595
7595
|
Js.error("Export failed:", w), alert("Export failed. Please try again.");
|
|
@@ -7597,8 +7597,8 @@ const da = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
|
|
|
7597
7597
|
}, N = async () => {
|
|
7598
7598
|
try {
|
|
7599
7599
|
const w = await l({ scale: R, format: A }), ne = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19);
|
|
7600
|
-
Object.entries(w).forEach(([
|
|
7601
|
-
const u = v.find((te) => te.id ===
|
|
7600
|
+
Object.entries(w).forEach(([V, O]) => {
|
|
7601
|
+
const u = v.find((te) => te.id === V), q = (u == null ? void 0 : u.name) || V, U = document.createElement("a");
|
|
7602
7602
|
U.download = `${q}-${ne}.${A}`, U.href = O, U.click();
|
|
7603
7603
|
}), s && s(w);
|
|
7604
7604
|
} catch (w) {
|
|
@@ -8671,8 +8671,8 @@ export {
|
|
|
8671
8671
|
ya as f,
|
|
8672
8672
|
$a as g,
|
|
8673
8673
|
Ua as h,
|
|
8674
|
-
|
|
8675
|
-
|
|
8674
|
+
Va as i,
|
|
8675
|
+
Ka as j,
|
|
8676
8676
|
qa as k,
|
|
8677
8677
|
ja as l,
|
|
8678
8678
|
It as m,
|
|
@@ -8683,4 +8683,4 @@ export {
|
|
|
8683
8683
|
Ga as u,
|
|
8684
8684
|
nc as v
|
|
8685
8685
|
};
|
|
8686
|
-
//# sourceMappingURL=validation-
|
|
8686
|
+
//# sourceMappingURL=validation-DyUOjRGa.js.map
|