@snowcone-app/canvas 0.1.8 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{CanvasStateV1-D5GzvmnY.cjs → CanvasStateV1-BmE5V6me.cjs} +2 -2
- package/dist/{CanvasStateV1-D5GzvmnY.cjs.map → CanvasStateV1-BmE5V6me.cjs.map} +1 -1
- package/dist/{CanvasStateV1-ejb4d_LM.js → CanvasStateV1-CD3Q94F4.js} +2 -2
- package/dist/{CanvasStateV1-ejb4d_LM.js.map → CanvasStateV1-CD3Q94F4.js.map} +1 -1
- package/dist/{ElementFactory-uJTXU-nP.js → ElementFactory-Ckv6sSev.js} +698 -696
- package/dist/ElementFactory-Ckv6sSev.js.map +1 -0
- package/dist/{ElementFactory-B7UOaJSD.cjs → ElementFactory-DEjwp-Wg.cjs} +5 -5
- package/dist/ElementFactory-DEjwp-Wg.cjs.map +1 -0
- package/dist/{ImportManager-CxiaRg1N.js → ImportManager-64OYjELO.js} +2 -2
- package/dist/{ImportManager-CxiaRg1N.js.map → ImportManager-64OYjELO.js.map} +1 -1
- package/dist/{ImportManager-BYwuK6n4.cjs → ImportManager-wSzrR-5a.cjs} +2 -2
- package/dist/{ImportManager-BYwuK6n4.cjs.map → ImportManager-wSzrR-5a.cjs.map} +1 -1
- package/dist/advanced.js +14 -14
- package/dist/advanced.js.map +1 -1
- package/dist/advanced.mjs +1847 -1854
- package/dist/advanced.mjs.map +1 -1
- package/dist/{compose-Bo108juW.cjs → compose-DHBRwi_A.cjs} +5 -5
- package/dist/compose-DHBRwi_A.cjs.map +1 -0
- package/dist/{compose-DQ1FZS3O.js → compose-DIPiisIw.js} +355 -355
- package/dist/compose-DIPiisIw.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +44 -45
- package/dist/index.mjs.map +1 -1
- package/dist/internals.js +1 -1
- package/dist/internals.mjs +3 -3
- package/dist/rendering/serialize-for-server.d.ts +2 -2
- package/package.json +2 -2
- package/dist/ElementFactory-B7UOaJSD.cjs.map +0 -1
- package/dist/ElementFactory-uJTXU-nP.js.map +0 -1
- package/dist/components/stories/utils/MockEditorProvider.d.ts +0 -32
- package/dist/components/stories/utils/QACanvasCard.d.ts +0 -41
- package/dist/components/stories/utils/VisualQACard.d.ts +0 -24
- package/dist/components/stories/utils/element-factories.d.ts +0 -188
- package/dist/components/stories/utils/spec-to-elements.d.ts +0 -74
- package/dist/components/stories/utils/themeDecorator.d.ts +0 -45
- package/dist/components/stories/utils/unified-test-cases.d.ts +0 -27
- package/dist/compose-Bo108juW.cjs.map +0 -1
- package/dist/compose-DQ1FZS3O.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as ue, jsxs as an, Fragment as ar } from "react/jsx-runtime";
|
|
2
2
|
import te, { forwardRef as Co, useState as Dt, useEffect as Vt, createElement as yo, createContext as zr, useCallback as xt, useMemo as ln, useContext as Vr, useRef as kt, useImperativeHandle as lr } from "react";
|
|
3
|
-
import { u as
|
|
4
|
-
import { c as Rn, G as pt, I as Ae, O as ko, Q as
|
|
3
|
+
import { u as Wn, c as cr, s as Wr, g as $r, d as jr, e as Nr } from "./ThemeContext-H0Z-MqqR.js";
|
|
4
|
+
import { c as Rn, G as pt, I as Ae, O as ko, Q as eo, U as dr, V as Oo, X as Kr, Y as cn, Z as Ur, _ as Un, P as dn, $ as _e, a0 as Zn, a1 as qr, T as oe, s as Gr, a2 as On, a3 as Zr, a4 as Qr, a5 as Jr, a6 as ur, a7 as ti, a8 as co, a9 as ei, aa as ni, S as Yn, R as oi } from "./HybridHistoryManager-BV6XV0nD.js";
|
|
5
5
|
import { createPortal as ri } from "react-dom";
|
|
6
|
-
import { h as En, j as ii, r as si, k as ai, C as Yo, l as
|
|
6
|
+
import { h as En, j as ii, r as si, k as ai, C as Yo, l as Qn, m as li, A as ci, n as di, S as ui, I as hi, b as uo } from "./ElementFactory-Ckv6sSev.js";
|
|
7
7
|
import { renderToStaticMarkup as fi } from "react-dom/server";
|
|
8
8
|
import { debounce as Fo } from "lodash-es";
|
|
9
9
|
function pi(t, e) {
|
|
@@ -24,13 +24,13 @@ const hr = Object.freeze({
|
|
|
24
24
|
top: 0,
|
|
25
25
|
width: 16,
|
|
26
26
|
height: 16
|
|
27
|
-
}),
|
|
27
|
+
}), no = Object.freeze({
|
|
28
28
|
rotate: 0,
|
|
29
29
|
vFlip: !1,
|
|
30
30
|
hFlip: !1
|
|
31
31
|
}), So = Object.freeze({
|
|
32
32
|
...hr,
|
|
33
|
-
...
|
|
33
|
+
...no
|
|
34
34
|
}), xo = Object.freeze({
|
|
35
35
|
...So,
|
|
36
36
|
body: "",
|
|
@@ -44,7 +44,7 @@ function gi(t, e) {
|
|
|
44
44
|
}
|
|
45
45
|
function _o(t, e) {
|
|
46
46
|
const n = gi(t, e);
|
|
47
|
-
for (const o in xo) o in
|
|
47
|
+
for (const o in xo) o in no ? o in t && !(o in n) && (n[o] = no[o]) : o in e ? n[o] = e[o] : o in t && (n[o] = t[o]);
|
|
48
48
|
return n;
|
|
49
49
|
}
|
|
50
50
|
function mi(t, e, n) {
|
|
@@ -74,23 +74,23 @@ const yi = {
|
|
|
74
74
|
not_found: {},
|
|
75
75
|
...hr
|
|
76
76
|
};
|
|
77
|
-
function
|
|
77
|
+
function ho(t, e) {
|
|
78
78
|
for (const n in e) if (n in t && typeof t[n] != typeof e[n]) return !1;
|
|
79
79
|
return !0;
|
|
80
80
|
}
|
|
81
81
|
function pr(t) {
|
|
82
82
|
if (typeof t != "object" || t === null) return null;
|
|
83
83
|
const e = t;
|
|
84
|
-
if (typeof e.prefix != "string" || !t.icons || typeof t.icons != "object" || !
|
|
84
|
+
if (typeof e.prefix != "string" || !t.icons || typeof t.icons != "object" || !ho(t, yi)) return null;
|
|
85
85
|
const n = e.icons;
|
|
86
86
|
for (const r in n) {
|
|
87
87
|
const i = n[r];
|
|
88
|
-
if (!r || typeof i.body != "string" || !
|
|
88
|
+
if (!r || typeof i.body != "string" || !ho(i, xo)) return null;
|
|
89
89
|
}
|
|
90
90
|
const o = e.aliases || /* @__PURE__ */ Object.create(null);
|
|
91
91
|
for (const r in o) {
|
|
92
92
|
const i = o[r], s = i.parent;
|
|
93
|
-
if (!r || typeof s != "string" || !n[s] && !o[s] || !
|
|
93
|
+
if (!r || typeof s != "string" || !n[s] && !o[s] || !ho(i, xo)) return null;
|
|
94
94
|
}
|
|
95
95
|
return e;
|
|
96
96
|
}
|
|
@@ -120,7 +120,7 @@ function bi(t, e, n) {
|
|
|
120
120
|
}
|
|
121
121
|
return !1;
|
|
122
122
|
}
|
|
123
|
-
const mr = /^[a-z0-9]+(-[a-z0-9]+)*$/,
|
|
123
|
+
const mr = /^[a-z0-9]+(-[a-z0-9]+)*$/, ro = (t, e, n, o = "") => {
|
|
124
124
|
const r = t.split(":");
|
|
125
125
|
if (t.slice(0, 1) === "@") {
|
|
126
126
|
if (r.length < 2 || r.length > 3) return null;
|
|
@@ -133,7 +133,7 @@ const mr = /^[a-z0-9]+(-[a-z0-9]+)*$/, oo = (t, e, n, o = "") => {
|
|
|
133
133
|
prefix: a,
|
|
134
134
|
name: l
|
|
135
135
|
};
|
|
136
|
-
return e && !
|
|
136
|
+
return e && !Jn(c) ? null : c;
|
|
137
137
|
}
|
|
138
138
|
const i = r[0], s = i.split("-");
|
|
139
139
|
if (s.length > 1) {
|
|
@@ -142,7 +142,7 @@ const mr = /^[a-z0-9]+(-[a-z0-9]+)*$/, oo = (t, e, n, o = "") => {
|
|
|
142
142
|
prefix: s.shift(),
|
|
143
143
|
name: s.join("-")
|
|
144
144
|
};
|
|
145
|
-
return e && !
|
|
145
|
+
return e && !Jn(l) ? null : l;
|
|
146
146
|
}
|
|
147
147
|
if (n && o === "") {
|
|
148
148
|
const l = {
|
|
@@ -150,37 +150,37 @@ const mr = /^[a-z0-9]+(-[a-z0-9]+)*$/, oo = (t, e, n, o = "") => {
|
|
|
150
150
|
prefix: "",
|
|
151
151
|
name: i
|
|
152
152
|
};
|
|
153
|
-
return e && !
|
|
153
|
+
return e && !Jn(l, n) ? null : l;
|
|
154
154
|
}
|
|
155
155
|
return null;
|
|
156
|
-
},
|
|
157
|
-
let
|
|
156
|
+
}, Jn = (t, e) => t ? !!((e && t.prefix === "" || t.prefix) && t.name) : !1;
|
|
157
|
+
let zn = !1;
|
|
158
158
|
function yr(t) {
|
|
159
|
-
return typeof t == "boolean" && (
|
|
159
|
+
return typeof t == "boolean" && (zn = t), zn;
|
|
160
160
|
}
|
|
161
161
|
function Vo(t) {
|
|
162
|
-
const e = typeof t == "string" ?
|
|
162
|
+
const e = typeof t == "string" ? ro(t, !0, zn) : t;
|
|
163
163
|
if (e) {
|
|
164
164
|
const n = Mn(e.provider, e.prefix), o = e.name;
|
|
165
165
|
return n.icons[o] || (n.missing.has(o) ? null : void 0);
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
function xr(t, e) {
|
|
169
|
-
const n =
|
|
169
|
+
const n = ro(t, !0, zn);
|
|
170
170
|
if (!n) return !1;
|
|
171
171
|
const o = Mn(n.provider, n.prefix);
|
|
172
172
|
return e ? bi(o, n.name, e) : (o.missing.add(n.name), !0);
|
|
173
173
|
}
|
|
174
174
|
function vi(t, e) {
|
|
175
175
|
if (typeof t != "object") return !1;
|
|
176
|
-
if (typeof e != "string" && (e = t.provider || ""),
|
|
176
|
+
if (typeof e != "string" && (e = t.provider || ""), zn && !e && !t.prefix) {
|
|
177
177
|
let r = !1;
|
|
178
178
|
return pr(t) && (t.prefix = "", fr(t, (i, s) => {
|
|
179
179
|
xr(i, s) && (r = !0);
|
|
180
180
|
})), r;
|
|
181
181
|
}
|
|
182
182
|
const n = t.prefix;
|
|
183
|
-
if (!
|
|
183
|
+
if (!Jn({
|
|
184
184
|
prefix: n,
|
|
185
185
|
name: "a"
|
|
186
186
|
})) return !1;
|
|
@@ -192,7 +192,7 @@ const br = Object.freeze({
|
|
|
192
192
|
height: null
|
|
193
193
|
}), vr = Object.freeze({
|
|
194
194
|
...br,
|
|
195
|
-
...
|
|
195
|
+
...no
|
|
196
196
|
}), wi = /(-?[0-9.]*[0-9]+[0-9.]*)/g, Ci = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
|
|
197
197
|
function Wo(t, e, n) {
|
|
198
198
|
if (e === 1) return t;
|
|
@@ -320,9 +320,9 @@ function Eo(t) {
|
|
|
320
320
|
dataAfterTimeout: t.dataAfterTimeout !== !1
|
|
321
321
|
};
|
|
322
322
|
}
|
|
323
|
-
const Mo = /* @__PURE__ */ Object.create(null), Bn = ["https://api.simplesvg.com", "https://api.unisvg.com"],
|
|
324
|
-
for (; Bn.length > 0; ) Bn.length === 1 || Math.random() > 0.5 ?
|
|
325
|
-
Mo[""] = Eo({ resources: ["https://api.iconify.design"].concat(
|
|
323
|
+
const Mo = /* @__PURE__ */ Object.create(null), Bn = ["https://api.simplesvg.com", "https://api.unisvg.com"], to = [];
|
|
324
|
+
for (; Bn.length > 0; ) Bn.length === 1 || Math.random() > 0.5 ? to.push(Bn.shift()) : to.push(Bn.pop());
|
|
325
|
+
Mo[""] = Eo({ resources: ["https://api.iconify.design"].concat(to) });
|
|
326
326
|
function Li(t, e) {
|
|
327
327
|
const n = Eo(e);
|
|
328
328
|
return n === null ? !1 : (Mo[t] = n, !0);
|
|
@@ -506,7 +506,7 @@ function $i(t) {
|
|
|
506
506
|
function ji(t, e = !0, n = !1) {
|
|
507
507
|
const o = [];
|
|
508
508
|
return t.forEach((r) => {
|
|
509
|
-
const i = typeof r == "string" ?
|
|
509
|
+
const i = typeof r == "string" ? ro(r, e, n) : r;
|
|
510
510
|
i && o.push(i);
|
|
511
511
|
}), o;
|
|
512
512
|
}
|
|
@@ -646,18 +646,18 @@ function Cr(t) {
|
|
|
646
646
|
}
|
|
647
647
|
function jo() {
|
|
648
648
|
}
|
|
649
|
-
const
|
|
649
|
+
const fo = /* @__PURE__ */ Object.create(null);
|
|
650
650
|
function Ui(t) {
|
|
651
|
-
if (!
|
|
651
|
+
if (!fo[t]) {
|
|
652
652
|
const e = Ro(t);
|
|
653
653
|
if (!e) return;
|
|
654
654
|
const n = Cr(e), o = {
|
|
655
655
|
config: e,
|
|
656
656
|
redundancy: n
|
|
657
657
|
};
|
|
658
|
-
|
|
658
|
+
fo[t] = o;
|
|
659
659
|
}
|
|
660
|
-
return
|
|
660
|
+
return fo[t];
|
|
661
661
|
}
|
|
662
662
|
function qi(t, e, n) {
|
|
663
663
|
let o, r;
|
|
@@ -843,16 +843,16 @@ function ss(t) {
|
|
|
843
843
|
function as(t) {
|
|
844
844
|
return 'url("' + ss(t) + '")';
|
|
845
845
|
}
|
|
846
|
-
let
|
|
846
|
+
let Fn;
|
|
847
847
|
function ls() {
|
|
848
848
|
try {
|
|
849
|
-
|
|
849
|
+
Fn = window.trustedTypes.createPolicy("iconify", { createHTML: (t) => t });
|
|
850
850
|
} catch {
|
|
851
|
-
|
|
851
|
+
Fn = null;
|
|
852
852
|
}
|
|
853
853
|
}
|
|
854
854
|
function cs(t) {
|
|
855
|
-
return
|
|
855
|
+
return Fn === void 0 && ls(), Fn ? Fn.createHTML(t) : t;
|
|
856
856
|
}
|
|
857
857
|
const kr = {
|
|
858
858
|
...vr,
|
|
@@ -894,7 +894,7 @@ const fs = (t, e, n) => {
|
|
|
894
894
|
...i === "svg" ? ds : {}
|
|
895
895
|
};
|
|
896
896
|
if (n) {
|
|
897
|
-
const f =
|
|
897
|
+
const f = ro(n, !1, !0);
|
|
898
898
|
if (f) {
|
|
899
899
|
const m = ["iconify"], b = [
|
|
900
900
|
"provider",
|
|
@@ -1791,7 +1791,7 @@ function Is(t = {}) {
|
|
|
1791
1791
|
executeAddElement: g,
|
|
1792
1792
|
executeRemoveElement: x,
|
|
1793
1793
|
executeReorderElement: y
|
|
1794
|
-
} =
|
|
1794
|
+
} = Wn(), S = kt(/* @__PURE__ */ new Map()), [f, m] = Dt(0), b = a.getActiveArtboardId(), w = e !== void 0 ? e : b, v = xt(async (L) => {
|
|
1795
1795
|
const X = i.find((et) => et.id === L);
|
|
1796
1796
|
if (!X) return;
|
|
1797
1797
|
const tt = await tr(X, o, r);
|
|
@@ -1909,7 +1909,7 @@ function Is(t = {}) {
|
|
|
1909
1909
|
const ct = F.clone();
|
|
1910
1910
|
return ct.x = F.x - $, ct.y = F.y - d, ct;
|
|
1911
1911
|
}), X.forEach((F) => x(F)), g(B, ot), c(B.id), h([]);
|
|
1912
|
-
}, [i, a, x, g, c, h]),
|
|
1912
|
+
}, [i, a, x, g, c, h]), Rt = xt((L) => {
|
|
1913
1913
|
const X = i.find((mt) => mt.id === L);
|
|
1914
1914
|
if (!X) {
|
|
1915
1915
|
me.warn(`Element ${L} not found for ungrouping`);
|
|
@@ -2043,7 +2043,7 @@ function Is(t = {}) {
|
|
|
2043
2043
|
moveLayerForward: Et,
|
|
2044
2044
|
moveLayerBackward: H,
|
|
2045
2045
|
groupLayers: yt,
|
|
2046
|
-
ungroupLayer:
|
|
2046
|
+
ungroupLayer: Rt,
|
|
2047
2047
|
addToGroup: ye,
|
|
2048
2048
|
removeFromGroup: Ut,
|
|
2049
2049
|
createEmptyGroup: ve,
|
|
@@ -2084,7 +2084,7 @@ function As(t) {
|
|
|
2084
2084
|
setHideHandles: y,
|
|
2085
2085
|
handleAddElement: S,
|
|
2086
2086
|
isToolbarMenuOpen: f
|
|
2087
|
-
} =
|
|
2087
|
+
} = Wn(), { duplicateLayer: m } = Is();
|
|
2088
2088
|
Vt(() => {
|
|
2089
2089
|
if (!e) return;
|
|
2090
2090
|
const b = (v) => {
|
|
@@ -2278,7 +2278,7 @@ function Bs(t, e) {
|
|
|
2278
2278
|
const E = m.match(/ +$/), R = E ? E[0].length : 0;
|
|
2279
2279
|
R > 0 && (m = m.substring(0, m.length - R));
|
|
2280
2280
|
}
|
|
2281
|
-
const N =
|
|
2281
|
+
const N = eo(m, n, o, r, i);
|
|
2282
2282
|
let W = h;
|
|
2283
2283
|
s === "center" ? W = (c - N) / 2 : s === "right" && (W = c - h - N);
|
|
2284
2284
|
let M = W;
|
|
@@ -2286,7 +2286,7 @@ function Bs(t, e) {
|
|
|
2286
2286
|
for (let E = 0; E < P; E++) {
|
|
2287
2287
|
if (!w && E < b) continue;
|
|
2288
2288
|
const R = S[E], rt = x + E, I = l.getStyleAt(rt), j = I.fontSize || n, p = I.fontFamily || o, Q = I.bold !== void 0 ? I.bold : r, St = I.italic !== void 0 ? I.italic : i;
|
|
2289
|
-
M +=
|
|
2289
|
+
M += eo(R, j, p, Q, St);
|
|
2290
2290
|
}
|
|
2291
2291
|
return {
|
|
2292
2292
|
lineIndex: y,
|
|
@@ -2345,7 +2345,7 @@ function un(t, e) {
|
|
|
2345
2345
|
const I = w.match(/ +$/);
|
|
2346
2346
|
N = I ? I[0].length : 0, N > 0 && (w = w.substring(0, w.length - N));
|
|
2347
2347
|
}
|
|
2348
|
-
const P =
|
|
2348
|
+
const P = eo(w, n, o, r, i);
|
|
2349
2349
|
let E = h;
|
|
2350
2350
|
s === "center" ? E = (c - P) / 2 : s === "right" && (E = c - h - P);
|
|
2351
2351
|
const R = e.x - E;
|
|
@@ -2356,7 +2356,7 @@ function un(t, e) {
|
|
|
2356
2356
|
let rt = 0;
|
|
2357
2357
|
for (let I = 0; I < b.length; I++) {
|
|
2358
2358
|
if (!W && I < v || !M && I >= b.length - N) continue;
|
|
2359
|
-
const j = b[I], p = m + I, Q = l.getStyleAt(p), St = Q.fontSize || n, vt = Q.fontFamily || o, Et = Q.bold !== void 0 ? Q.bold : r, H = Q.italic !== void 0 ? Q.italic : i, yt =
|
|
2359
|
+
const j = b[I], p = m + I, Q = l.getStyleAt(p), St = Q.fontSize || n, vt = Q.fontFamily || o, Et = Q.bold !== void 0 ? Q.bold : r, H = Q.italic !== void 0 ? Q.italic : i, yt = eo(j, St, vt, Et, H);
|
|
2360
2360
|
if (R < rt + yt / 2)
|
|
2361
2361
|
return p;
|
|
2362
2362
|
rt += yt;
|
|
@@ -2606,11 +2606,11 @@ class Os {
|
|
|
2606
2606
|
const S = o[y];
|
|
2607
2607
|
if (y === 0 && o.length > 1 && (e.strokeStyle = cn(), e.lineWidth = 2, e.beginPath(), e.arc(S.x, S.y, 8, 0, Math.PI * 2), e.stroke()), e.fillStyle = Ur(), e.strokeStyle = cn(), e.lineWidth = 2, e.beginPath(), e.arc(S.x, S.y, 4, 0, Math.PI * 2), e.fill(), e.stroke(), S.handleIn) {
|
|
2608
2608
|
const m = S.x + S.handleIn.x, b = S.y + S.handleIn.y;
|
|
2609
|
-
e.strokeStyle =
|
|
2609
|
+
e.strokeStyle = Un(), e.lineWidth = 1, e.beginPath(), e.moveTo(S.x, S.y), e.lineTo(m, b), e.stroke(), e.fillStyle = Un(), e.beginPath(), e.arc(m, b, 3, 0, Math.PI * 2), e.fill();
|
|
2610
2610
|
}
|
|
2611
2611
|
if (S.handleOut) {
|
|
2612
2612
|
const m = S.x + S.handleOut.x, b = S.y + S.handleOut.y;
|
|
2613
|
-
e.strokeStyle =
|
|
2613
|
+
e.strokeStyle = Un(), e.lineWidth = 1, e.beginPath(), e.moveTo(S.x, S.y), e.lineTo(m, b), e.stroke(), e.fillStyle = Un(), e.beginPath(), e.arc(m, b, 3, 0, Math.PI * 2), e.fill();
|
|
2614
2614
|
}
|
|
2615
2615
|
}
|
|
2616
2616
|
if (r && this.canClosePath(r.x, r.y)) {
|
|
@@ -2781,7 +2781,7 @@ class Vs {
|
|
|
2781
2781
|
* Handle dragging the image in crop mode
|
|
2782
2782
|
*/
|
|
2783
2783
|
handleCropImageDrag(e, n, o, r) {
|
|
2784
|
-
const i = o - n.startX, s = r - n.startY, l = n.startData.x, a = n.startData.y, c = n.startData.transformData, u = c.width, h = c.height, g = n.startData.cropX ?? 0, x = n.startData.cropY ?? 0, y = n.startData.cropWidth ?? 1, S = n.startData.cropHeight ?? 1, m =
|
|
2784
|
+
const i = o - n.startX, s = r - n.startY, l = n.startData.x, a = n.startData.y, c = n.startData.transformData, u = c.width, h = c.height, g = n.startData.cropX ?? 0, x = n.startData.cropY ?? 0, y = n.startData.cropWidth ?? 1, S = n.startData.cropHeight ?? 1, m = Zn.fromSnapshot(n.startData).worldDeltaToLocal(i, s);
|
|
2785
2785
|
let b = m.dx, w = m.dy;
|
|
2786
2786
|
const v = c.flipHorizontal ? -1 : 1, N = c.flipVertical ? -1 : 1;
|
|
2787
2787
|
b *= v, w *= N;
|
|
@@ -2802,13 +2802,13 @@ class Vs {
|
|
|
2802
2802
|
* Handle resizing the crop box
|
|
2803
2803
|
*/
|
|
2804
2804
|
handleCropBoxResize(e, n, o, r, i, s) {
|
|
2805
|
-
const l = o.startData.transformData, a = l.flipHorizontal, c = l.flipVertical, u = this._getCropResizeCursor(n, !!a, !!c), h = o.startData.rotation, g = o.startData.x, x = o.startData.y, y =
|
|
2805
|
+
const l = o.startData.transformData, a = l.flipHorizontal, c = l.flipVertical, u = this._getCropResizeCursor(n, !!a, !!c), h = o.startData.rotation, g = o.startData.x, x = o.startData.y, y = Zn.fromSnapshot(o.startData), { cos: S, sin: f } = y.getInverseCosSin(), m = a ? -1 : 1, b = c ? -1 : 1, w = i - g, v = s - x;
|
|
2806
2806
|
let N = w * S - v * f, W = w * f + v * S;
|
|
2807
2807
|
N *= m, W *= b;
|
|
2808
2808
|
const M = r.startX - g, P = r.startY - x;
|
|
2809
2809
|
let E = M * S - P * f, R = M * f + P * S;
|
|
2810
2810
|
E *= m, R *= b;
|
|
2811
|
-
const rt = N - E, I = W - R, j = l.cropX, p = l.cropY, Q = l.cropWidth, St = l.cropHeight, vt = l.width, Et = l.height, H = rt / vt, yt = I / Et,
|
|
2811
|
+
const rt = N - E, I = W - R, j = l.cropX, p = l.cropY, Q = l.cropWidth, St = l.cropHeight, vt = l.width, Et = l.height, H = rt / vt, yt = I / Et, Rt = this._calculateNewCropValues(
|
|
2812
2812
|
n,
|
|
2813
2813
|
j,
|
|
2814
2814
|
p,
|
|
@@ -2821,10 +2821,10 @@ class Vs {
|
|
|
2821
2821
|
p,
|
|
2822
2822
|
Q,
|
|
2823
2823
|
St,
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2824
|
+
Rt.cropX,
|
|
2825
|
+
Rt.cropY,
|
|
2826
|
+
Rt.cropWidth,
|
|
2827
|
+
Rt.cropHeight,
|
|
2828
2828
|
vt,
|
|
2829
2829
|
Et,
|
|
2830
2830
|
h,
|
|
@@ -2832,7 +2832,7 @@ class Vs {
|
|
|
2832
2832
|
b
|
|
2833
2833
|
);
|
|
2834
2834
|
return {
|
|
2835
|
-
...
|
|
2835
|
+
...Rt,
|
|
2836
2836
|
x: g + gt.worldOffsetX,
|
|
2837
2837
|
y: x + gt.worldOffsetY,
|
|
2838
2838
|
rotation: h,
|
|
@@ -2885,7 +2885,7 @@ class Vs {
|
|
|
2885
2885
|
const y = e * c + o * c / 2, S = n * u + r * u / 2, f = i * c + l * c / 2, m = s * u + a * u / 2;
|
|
2886
2886
|
let b = f - y, w = m - S;
|
|
2887
2887
|
b *= g, w *= x;
|
|
2888
|
-
const N = new
|
|
2888
|
+
const N = new Zn({ rotation: h, x: 0, y: 0 }).localDeltaToWorld(b, w), W = N.dx, M = N.dy;
|
|
2889
2889
|
return { worldOffsetX: W, worldOffsetY: M };
|
|
2890
2890
|
}
|
|
2891
2891
|
/**
|
|
@@ -2913,7 +2913,7 @@ function $s(t) {
|
|
|
2913
2913
|
};
|
|
2914
2914
|
}
|
|
2915
2915
|
function er(t) {
|
|
2916
|
-
return t != null && t instanceof
|
|
2916
|
+
return t != null && t instanceof oe;
|
|
2917
2917
|
}
|
|
2918
2918
|
function js({ selectedElement: t, ref: e }) {
|
|
2919
2919
|
const [n, o] = Dt(!1), [r, i] = Dt(""), [s, l] = Dt({ x: 0, y: 0, width: 200, height: 50 }), [a, c] = Dt(0), [u, h] = Dt(0), [g, x] = Dt(0), y = kt(1), S = kt(performance.now()), f = kt(0), m = kt(!1), [b, w] = Dt(null), [v, N] = Dt(null), W = kt(null), M = xt(
|
|
@@ -3090,7 +3090,7 @@ function Us({ elements: t }) {
|
|
|
3090
3090
|
setCursorAnimationFrame: l
|
|
3091
3091
|
};
|
|
3092
3092
|
}
|
|
3093
|
-
const
|
|
3093
|
+
const Xn = {
|
|
3094
3094
|
bleedMode: "gradient",
|
|
3095
3095
|
bleedInnerEdge: "boundary",
|
|
3096
3096
|
// Pure black at full opacity. With the `multiply` blend mode applied
|
|
@@ -3188,7 +3188,7 @@ function rr(t, e, n) {
|
|
|
3188
3188
|
};
|
|
3189
3189
|
return 0.2126 * o(t) + 0.7152 * o(e) + 0.0722 * o(n);
|
|
3190
3190
|
}
|
|
3191
|
-
function
|
|
3191
|
+
function $n(t, e) {
|
|
3192
3192
|
if (e.kind === "rect") {
|
|
3193
3193
|
t.rect(e.x, e.y, e.width, e.height);
|
|
3194
3194
|
return;
|
|
@@ -3207,26 +3207,26 @@ function Wn(t, e) {
|
|
|
3207
3207
|
const n = new Path2D(e.d);
|
|
3208
3208
|
t.__pieceGuidePath2D = n;
|
|
3209
3209
|
}
|
|
3210
|
-
function
|
|
3210
|
+
function Vn(t, e, n) {
|
|
3211
3211
|
if (e.kind === "path") {
|
|
3212
3212
|
const o = new Path2D(e.d);
|
|
3213
3213
|
t.fill(o);
|
|
3214
3214
|
return;
|
|
3215
3215
|
}
|
|
3216
|
-
t.beginPath(),
|
|
3216
|
+
t.beginPath(), $n(t, e), t.fill();
|
|
3217
3217
|
}
|
|
3218
|
-
function
|
|
3218
|
+
function _n(t, e) {
|
|
3219
3219
|
if (e.kind === "path") {
|
|
3220
3220
|
const n = new Path2D(e.d);
|
|
3221
3221
|
t.stroke(n);
|
|
3222
3222
|
return;
|
|
3223
3223
|
}
|
|
3224
|
-
t.beginPath(),
|
|
3224
|
+
t.beginPath(), $n(t, e), t.stroke();
|
|
3225
3225
|
}
|
|
3226
3226
|
function Zs(t, e) {
|
|
3227
|
-
e.kind !== "path" &&
|
|
3227
|
+
e.kind !== "path" && $n(t, e);
|
|
3228
3228
|
}
|
|
3229
|
-
function
|
|
3229
|
+
function oo(t, e) {
|
|
3230
3230
|
if (e.kind === "rect") {
|
|
3231
3231
|
t.rect(e.x, e.y, e.width, e.height);
|
|
3232
3232
|
return;
|
|
@@ -3278,10 +3278,10 @@ function ta(t) {
|
|
|
3278
3278
|
safeArea: ((v = t.show) == null ? void 0 : v.safeArea) ?? !0,
|
|
3279
3279
|
labels: ((N = t.show) == null ? void 0 : N.labels) ?? !0
|
|
3280
3280
|
}, l = e.canvas, a = l instanceof HTMLCanvasElement ? l : null, c = Gs(), h = { ...{
|
|
3281
|
-
...
|
|
3281
|
+
...Xn,
|
|
3282
3282
|
bleedFill: c ? "#ffffff" : "#000000"
|
|
3283
3283
|
}, ...t.style };
|
|
3284
|
-
h.zoneFill = { ...
|
|
3284
|
+
h.zoneFill = { ...Xn.zoneFill, ...((W = t.style) == null ? void 0 : W.zoneFill) ?? {} }, h.zoneStroke = { ...Xn.zoneStroke, ...((M = t.style) == null ? void 0 : M.zoneStroke) ?? {} };
|
|
3285
3285
|
let g = po(h.bleedFill, a);
|
|
3286
3286
|
const x = po(h.dieCutTint, a);
|
|
3287
3287
|
let y = po(h.boundaryStroke, a);
|
|
@@ -3316,13 +3316,13 @@ function ta(t) {
|
|
|
3316
3316
|
height: Q
|
|
3317
3317
|
};
|
|
3318
3318
|
if (H > 0 && (e.save(), e.beginPath(), Zs(e, yt), e.clip()), s.bleed && h.bleedOpacity > 0) {
|
|
3319
|
-
const
|
|
3320
|
-
if (
|
|
3319
|
+
const Rt = h.bleedInnerEdge === "safeArea" && vt ? vt : St;
|
|
3320
|
+
if (Rt) {
|
|
3321
3321
|
const gt = c ? "screen" : "multiply", bt = h.bleedOpacity;
|
|
3322
3322
|
h.bleedMode === "solid" ? na(
|
|
3323
3323
|
e,
|
|
3324
3324
|
yt,
|
|
3325
|
-
|
|
3325
|
+
Rt,
|
|
3326
3326
|
g,
|
|
3327
3327
|
bt,
|
|
3328
3328
|
gt
|
|
@@ -3331,7 +3331,7 @@ function ta(t) {
|
|
|
3331
3331
|
p,
|
|
3332
3332
|
Q,
|
|
3333
3333
|
yt,
|
|
3334
|
-
|
|
3334
|
+
Rt,
|
|
3335
3335
|
g,
|
|
3336
3336
|
bt,
|
|
3337
3337
|
h.bleedBlurScale,
|
|
@@ -3341,17 +3341,17 @@ function ta(t) {
|
|
|
3341
3341
|
}
|
|
3342
3342
|
}
|
|
3343
3343
|
if (s.zones)
|
|
3344
|
-
for (const
|
|
3345
|
-
|
|
3344
|
+
for (const Rt of R)
|
|
3345
|
+
Rt.kind !== "dieCut" && (e.save(), e.fillStyle = h.zoneFill[Rt.kind] ?? Xn.zoneFill[Rt.kind], Vn(e, Rt.path), e.strokeStyle = h.zoneStroke[Rt.kind] ?? Xn.zoneStroke[Rt.kind], On(
|
|
3346
3346
|
e,
|
|
3347
3347
|
1.5,
|
|
3348
|
-
|
|
3349
|
-
),
|
|
3348
|
+
Rt.kind === "wrap" ? [4, 3] : []
|
|
3349
|
+
), _n(e, Rt.path), e.setLineDash([]), e.restore());
|
|
3350
3350
|
if (s.zones)
|
|
3351
|
-
for (const
|
|
3352
|
-
|
|
3351
|
+
for (const Rt of R)
|
|
3352
|
+
Rt.kind === "dieCut" && (h.dieCutMode === "knockout" ? sa(
|
|
3353
3353
|
e,
|
|
3354
|
-
|
|
3354
|
+
Rt,
|
|
3355
3355
|
h.dieCutStroke,
|
|
3356
3356
|
h.dieCutStrokeWidthPx,
|
|
3357
3357
|
t.interacting === !0,
|
|
@@ -3360,7 +3360,7 @@ function ta(t) {
|
|
|
3360
3360
|
h.dieCutBlurPx
|
|
3361
3361
|
) : ra(
|
|
3362
3362
|
e,
|
|
3363
|
-
|
|
3363
|
+
Rt,
|
|
3364
3364
|
f,
|
|
3365
3365
|
x,
|
|
3366
3366
|
h.dieCutTintAlpha,
|
|
@@ -3368,7 +3368,7 @@ function ta(t) {
|
|
|
3368
3368
|
h.dieCutStroke,
|
|
3369
3369
|
h.dieCutStrokeWidthPx
|
|
3370
3370
|
));
|
|
3371
|
-
s.boundary && y && h.boundaryStrokeWidthPx > 0 && (e.save(), e.strokeStyle = y,
|
|
3371
|
+
s.boundary && y && h.boundaryStrokeWidthPx > 0 && (e.save(), e.strokeStyle = y, On(e, h.boundaryStrokeWidthPx), _n(e, St), e.restore()), s.safeArea && vt && h.safeAreaStroke && (e.save(), e.strokeStyle = h.safeAreaStroke, On(e, h.safeAreaStrokeWidthPx, h.safeAreaDashPx), _n(e, vt), e.setLineDash([]), e.restore()), s.labels && rt.length > 0 && aa(e, rt, h, i), H > 0 && e.restore(), e.restore();
|
|
3372
3372
|
}
|
|
3373
3373
|
e.restore();
|
|
3374
3374
|
}
|
|
@@ -3382,16 +3382,16 @@ function ea(t, e, n, o, r, i, s, l, a, c = "source-over") {
|
|
|
3382
3382
|
if (!w) return;
|
|
3383
3383
|
w.setTransform(1, 0, 0, 1, 0, 0), w.clearRect(0, 0, f, m), w.scale(a * g, a * g), w.translate(x, x), w.fillStyle = i, w.globalAlpha = s;
|
|
3384
3384
|
const v = new Path2D();
|
|
3385
|
-
|
|
3385
|
+
oo(v, o), w.fill(v), w.globalAlpha = 1, w.filter = `blur(${h * g}px)`, w.globalCompositeOperation = "destination-out", w.fillStyle = "#000";
|
|
3386
3386
|
const N = new Path2D();
|
|
3387
|
-
|
|
3387
|
+
oo(N, r), w.fill(N), w.filter = "none", w.globalCompositeOperation = "source-over";
|
|
3388
3388
|
const W = t.globalCompositeOperation;
|
|
3389
3389
|
t.globalCompositeOperation = c, t.drawImage(b, -x, -x, y, S), t.globalCompositeOperation = W;
|
|
3390
3390
|
}
|
|
3391
3391
|
function na(t, e, n, o, r, i = "source-over") {
|
|
3392
3392
|
t.save(), t.globalAlpha = t.globalAlpha * r, t.globalCompositeOperation = i, t.fillStyle = o;
|
|
3393
3393
|
const s = new Path2D();
|
|
3394
|
-
|
|
3394
|
+
oo(s, e), oo(s, n), t.fill(s, "evenodd"), t.restore();
|
|
3395
3395
|
}
|
|
3396
3396
|
let vn = null;
|
|
3397
3397
|
function oa(t, e) {
|
|
@@ -3399,27 +3399,27 @@ function oa(t, e) {
|
|
|
3399
3399
|
}
|
|
3400
3400
|
function ra(t, e, n, o, r, i, s, l) {
|
|
3401
3401
|
const a = e.path;
|
|
3402
|
-
if (t.save(), t.beginPath(),
|
|
3402
|
+
if (t.save(), t.beginPath(), $n(t, a), t.clip(), n && (t.save(), t.globalCompositeOperation = "destination-out", t.fillStyle = "#000", a.kind === "path" ? Vn(t, a) : t.fillRect(a.x, a.y, a.width, a.height), t.restore(), i > 0)) {
|
|
3403
3403
|
const c = t.globalAlpha, u = t.getTransform();
|
|
3404
3404
|
t.save(), t.setTransform(1, 0, 0, 1, 0, 0), t.filter = `blur(${i}px)`, t.globalAlpha = c * 0.4, t.drawImage(n, 0, 0), t.filter = "none", t.globalAlpha = c, t.setTransform(u), t.restore();
|
|
3405
3405
|
}
|
|
3406
3406
|
if (r > 0) {
|
|
3407
3407
|
const c = t.globalAlpha;
|
|
3408
|
-
t.fillStyle = o, t.globalAlpha = c * r, a.kind === "path" ?
|
|
3408
|
+
t.fillStyle = o, t.globalAlpha = c * r, a.kind === "path" ? Vn(t, a) : t.fillRect(a.x, a.y, a.width, a.height), t.globalAlpha = c;
|
|
3409
3409
|
}
|
|
3410
|
-
t.restore(), s && (t.save(), t.strokeStyle = s,
|
|
3410
|
+
t.restore(), s && (t.save(), t.strokeStyle = s, On(t, l), _n(t, a), t.restore());
|
|
3411
3411
|
}
|
|
3412
3412
|
const ia = 0.3;
|
|
3413
3413
|
function sa(t, e, n, o, r, i = !0, s, l = 0) {
|
|
3414
3414
|
const a = e.path;
|
|
3415
3415
|
if (i)
|
|
3416
3416
|
if (r && s && l > 0) {
|
|
3417
|
-
t.save(), t.beginPath(),
|
|
3417
|
+
t.save(), t.beginPath(), $n(t, a), t.clip(), t.save(), t.globalCompositeOperation = "destination-out", t.fillStyle = "#000", a.kind === "path" || a.kind === "roundedRect" ? Vn(t, a) : t.fillRect(a.x, a.y, a.width, a.height), t.restore();
|
|
3418
3418
|
const c = t.globalAlpha, u = t.getTransform();
|
|
3419
3419
|
t.save(), t.setTransform(1, 0, 0, 1, 0, 0), t.filter = `blur(${l}px)`, t.globalAlpha = c * 0.4, t.drawImage(s, 0, 0), t.filter = "none", t.globalAlpha = c, t.setTransform(u), t.restore(), t.restore();
|
|
3420
3420
|
} else
|
|
3421
|
-
t.save(), t.globalCompositeOperation = "destination-out", t.globalAlpha = r ? 1 - ia : 1, t.fillStyle = "#000", a.kind === "path" || a.kind === "roundedRect" ?
|
|
3422
|
-
n && (t.save(), t.strokeStyle = n,
|
|
3421
|
+
t.save(), t.globalCompositeOperation = "destination-out", t.globalAlpha = r ? 1 - ia : 1, t.fillStyle = "#000", a.kind === "path" || a.kind === "roundedRect" ? Vn(t, a) : t.fillRect(a.x, a.y, a.width, a.height), t.restore();
|
|
3422
|
+
n && (t.save(), t.strokeStyle = n, On(t, o), _n(t, a), t.restore());
|
|
3423
3423
|
}
|
|
3424
3424
|
function aa(t, e, n, o) {
|
|
3425
3425
|
const r = o > 0 ? n.labelFontSizePx / o : n.labelFontSizePx, i = Math.max(2, n.labelFontSizePx * 0.25), s = o > 0 ? i / o : i;
|
|
@@ -3511,7 +3511,7 @@ function da(t) {
|
|
|
3511
3511
|
const gt = -R * Math.PI / 180, bt = Math.cos(gt), Yt = Math.sin(gt), Lt = H - j, Ht = yt - p;
|
|
3512
3512
|
H = j + (Lt * bt - Ht * Yt), yt = p + (Lt * Yt + Ht * bt);
|
|
3513
3513
|
}
|
|
3514
|
-
const
|
|
3514
|
+
const Rt = {
|
|
3515
3515
|
minX: Q,
|
|
3516
3516
|
minY: St,
|
|
3517
3517
|
maxX: vt,
|
|
@@ -3536,7 +3536,7 @@ function da(t) {
|
|
|
3536
3536
|
rotationHandleY: yt,
|
|
3537
3537
|
stateMachine: i,
|
|
3538
3538
|
zoom: u
|
|
3539
|
-
}), { updatedOBB: M, groupBounds:
|
|
3539
|
+
}), { updatedOBB: M, groupBounds: Rt };
|
|
3540
3540
|
}
|
|
3541
3541
|
function ua(t, e) {
|
|
3542
3542
|
var w;
|
|
@@ -3760,7 +3760,7 @@ function xa(t, e, n) {
|
|
|
3760
3760
|
isTouchDevice: Et,
|
|
3761
3761
|
selectionHandlePositionsRef: H,
|
|
3762
3762
|
multiClickSelectionRef: yt,
|
|
3763
|
-
lastMultiClickTimeRef:
|
|
3763
|
+
lastMultiClickTimeRef: Rt,
|
|
3764
3764
|
MULTI_CLICK_DEBOUNCE: gt,
|
|
3765
3765
|
snapGuides: bt,
|
|
3766
3766
|
spacingIndicators: Yt,
|
|
@@ -3786,7 +3786,7 @@ function xa(t, e, n) {
|
|
|
3786
3786
|
St.current = 1;
|
|
3787
3787
|
const d = window.devicePixelRatio || 1, B = S * w, F = f * w;
|
|
3788
3788
|
if (B <= 0 || F <= 0) return;
|
|
3789
|
-
const ct = 4096, K = B * d,
|
|
3789
|
+
const ct = 4096, K = B * d, Tt = F * d, wt = Math.max(K, Tt), jt = wt > ct ? ct / wt : 1, $t = d * jt;
|
|
3790
3790
|
mt.width = B * $t, mt.height = F * $t, $.setTransform(1, 0, 0, 1, 0, 0), $.clearRect(0, 0, mt.width, mt.height);
|
|
3791
3791
|
const O = e.current;
|
|
3792
3792
|
$.scale($t, $t), w !== 1 && $.scale(w, w), (m !== 0 || b !== 0) && $.translate(m, b);
|
|
@@ -3795,10 +3795,10 @@ function xa(t, e, n) {
|
|
|
3795
3795
|
ot.guides,
|
|
3796
3796
|
t.focusedPieceId ?? null
|
|
3797
3797
|
) : void 0;
|
|
3798
|
-
let
|
|
3798
|
+
let re = ot ? 0 : v;
|
|
3799
3799
|
if (ot && ot.pieces.length === 1 && V) {
|
|
3800
3800
|
const ut = ot.pieces[0].id, Ot = (Qe = ot.guides) == null ? void 0 : Qe[ut], Wt = Ot == null ? void 0 : Ot.outerRadius, Ct = Ot == null ? void 0 : Ot.boundary, Xt = Ct && typeof Ct == "object" && Ct.kind === "roundedRect" ? Ct.rx ?? Ct.ry : void 0, _t = typeof Wt == "number" && Wt > 0 ? Wt : typeof Xt == "number" && Xt > 0 ? Xt : 0;
|
|
3801
|
-
_t > 0 && (
|
|
3801
|
+
_t > 0 && (re = _t);
|
|
3802
3802
|
}
|
|
3803
3803
|
if (V && !ot)
|
|
3804
3804
|
if ($.fillStyle = O, qt && typeof qt == "object" && qt.type === "path")
|
|
@@ -3813,12 +3813,12 @@ function xa(t, e, n) {
|
|
|
3813
3813
|
V.height
|
|
3814
3814
|
);
|
|
3815
3815
|
}
|
|
3816
|
-
else
|
|
3816
|
+
else re > 0 ? ($.beginPath(), $.roundRect(
|
|
3817
3817
|
V.x,
|
|
3818
3818
|
V.y,
|
|
3819
3819
|
V.width,
|
|
3820
3820
|
V.height,
|
|
3821
|
-
|
|
3821
|
+
re
|
|
3822
3822
|
), $.fill()) : $.fillRect(
|
|
3823
3823
|
V.x,
|
|
3824
3824
|
V.y,
|
|
@@ -3844,14 +3844,14 @@ function xa(t, e, n) {
|
|
|
3844
3844
|
if (Ct) {
|
|
3845
3845
|
const Xt = Ct.clone();
|
|
3846
3846
|
Xt.children = Xt.children.map((_t) => {
|
|
3847
|
-
if (_t.id === ut && I && _t instanceof
|
|
3847
|
+
if (_t.id === ut && I && _t instanceof oe) {
|
|
3848
3848
|
const Gt = _t.clone();
|
|
3849
3849
|
return Gt.setRichText(I), Gt;
|
|
3850
3850
|
}
|
|
3851
3851
|
return _t;
|
|
3852
3852
|
}), Wt = Xt;
|
|
3853
3853
|
}
|
|
3854
|
-
} else if (I && u instanceof
|
|
3854
|
+
} else if (I && u instanceof oe) {
|
|
3855
3855
|
const Ct = u.clone();
|
|
3856
3856
|
Ct.setRichText(I), Wt = Ct;
|
|
3857
3857
|
}
|
|
@@ -3889,7 +3889,7 @@ function xa(t, e, n) {
|
|
|
3889
3889
|
y: V.y,
|
|
3890
3890
|
width: V.width,
|
|
3891
3891
|
height: V.height,
|
|
3892
|
-
borderRadius:
|
|
3892
|
+
borderRadius: re,
|
|
3893
3893
|
clipShape: qt ?? V.clipShape
|
|
3894
3894
|
} : void 0,
|
|
3895
3895
|
zoom: w,
|
|
@@ -3905,7 +3905,7 @@ function xa(t, e, n) {
|
|
|
3905
3905
|
suppressOverflowDim: !1,
|
|
3906
3906
|
showRotationHandle: W,
|
|
3907
3907
|
editModeData: R ? (() => {
|
|
3908
|
-
const ut = yt.current, at = Date.now() -
|
|
3908
|
+
const ut = yt.current, at = Date.now() - Rt.current < gt, Ot = ut && at;
|
|
3909
3909
|
return {
|
|
3910
3910
|
cursorPosition: Ot ? ut.cursor : j,
|
|
3911
3911
|
selectionStart: Ot ? ut.start : p,
|
|
@@ -3939,13 +3939,13 @@ function xa(t, e, n) {
|
|
|
3939
3939
|
}
|
|
3940
3940
|
}
|
|
3941
3941
|
}
|
|
3942
|
-
const Ot = ut, Wt =
|
|
3942
|
+
const Ot = ut, Wt = re > 0 && V !== void 0;
|
|
3943
3943
|
if (Wt && ($.save(), $.beginPath(), $.roundRect(
|
|
3944
3944
|
V.x,
|
|
3945
3945
|
V.y,
|
|
3946
3946
|
V.width,
|
|
3947
3947
|
V.height,
|
|
3948
|
-
|
|
3948
|
+
re
|
|
3949
3949
|
), $.clip()), ta({
|
|
3950
3950
|
ctx: $,
|
|
3951
3951
|
artboardOrigin: { x: V.x, y: V.y },
|
|
@@ -3997,7 +3997,7 @@ function xa(t, e, n) {
|
|
|
3997
3997
|
y: V.y,
|
|
3998
3998
|
width: V.width,
|
|
3999
3999
|
height: V.height,
|
|
4000
|
-
borderRadius:
|
|
4000
|
+
borderRadius: re,
|
|
4001
4001
|
clipShape: V.clipShape
|
|
4002
4002
|
},
|
|
4003
4003
|
showRotationHandle: W,
|
|
@@ -4406,7 +4406,7 @@ function Ha(t) {
|
|
|
4406
4406
|
multiSelectionOBBRef: Et,
|
|
4407
4407
|
zoom: H,
|
|
4408
4408
|
paddingOffsetX: yt,
|
|
4409
|
-
paddingOffsetY:
|
|
4409
|
+
paddingOffsetY: Rt,
|
|
4410
4410
|
spacingIndicators: gt,
|
|
4411
4411
|
focusedPieceRect: bt,
|
|
4412
4412
|
setCursorPosition: Yt,
|
|
@@ -4428,7 +4428,7 @@ function Ha(t) {
|
|
|
4428
4428
|
snapSystem: F,
|
|
4429
4429
|
spacingSystem: ct,
|
|
4430
4430
|
penTool: K,
|
|
4431
|
-
cropController:
|
|
4431
|
+
cropController: Tt,
|
|
4432
4432
|
onElementUpdate: wt,
|
|
4433
4433
|
executeElementUpdate: jt,
|
|
4434
4434
|
onSelectionChange: $t,
|
|
@@ -4436,7 +4436,7 @@ function Ha(t) {
|
|
|
4436
4436
|
onRotationStateChange: V,
|
|
4437
4437
|
onCropModeEnter: le,
|
|
4438
4438
|
updateActiveChild: qt,
|
|
4439
|
-
getActiveArtboardElements:
|
|
4439
|
+
getActiveArtboardElements: re,
|
|
4440
4440
|
startMarqueeSelection: Pe,
|
|
4441
4441
|
updateMarqueeSelection: xe,
|
|
4442
4442
|
finishMarqueeSelection: Se,
|
|
@@ -4449,36 +4449,36 @@ function Ha(t) {
|
|
|
4449
4449
|
getWrappedTextForEditing: st
|
|
4450
4450
|
} = t, ut = kt(null), at = kt(/* @__PURE__ */ new Map()), Ot = kt(null), Wt = kt(null), Ct = kt(null), Xt = kt(null), _t = kt(null), Gt = kt(null), zt = kt(null), { userZoom: he, setUserZoom: ce, panOffset: ze, setPanOffset: He } = cr(), on = kt(he);
|
|
4451
4451
|
on.current = he;
|
|
4452
|
-
const
|
|
4453
|
-
|
|
4452
|
+
const At = kt(ze);
|
|
4453
|
+
At.current = ze, Vt(() => {
|
|
4454
4454
|
const Y = e.current;
|
|
4455
4455
|
if (!Y) return;
|
|
4456
|
-
const
|
|
4456
|
+
const It = () => {
|
|
4457
4457
|
ut.current = Y.getBoundingClientRect();
|
|
4458
4458
|
};
|
|
4459
|
-
return
|
|
4460
|
-
window.removeEventListener("scroll",
|
|
4459
|
+
return It(), window.addEventListener("scroll", It, { passive: !0, capture: !0 }), window.addEventListener("resize", It, { passive: !0 }), () => {
|
|
4460
|
+
window.removeEventListener("scroll", It, { capture: !0 }), window.removeEventListener("resize", It);
|
|
4461
4461
|
};
|
|
4462
4462
|
}, [e]), Vt(() => {
|
|
4463
4463
|
const Y = e.current;
|
|
4464
4464
|
Y && (ut.current = Y.getBoundingClientRect());
|
|
4465
4465
|
}, [H, e]);
|
|
4466
|
-
const
|
|
4466
|
+
const io = xt(
|
|
4467
4467
|
(Y) => {
|
|
4468
4468
|
var J, dt, U, ht, nt;
|
|
4469
|
-
const
|
|
4470
|
-
if (!
|
|
4471
|
-
const Jt =
|
|
4469
|
+
const It = e.current;
|
|
4470
|
+
if (!It) return;
|
|
4471
|
+
const Jt = It.getBoundingClientRect();
|
|
4472
4472
|
ut.current = Jt;
|
|
4473
|
-
const Z = (Y.clientX - Jt.left) / H - yt, q = (Y.clientY - Jt.top) / H -
|
|
4473
|
+
const Z = (Y.clientX - Jt.left) / H - yt, q = (Y.clientY - Jt.top) / H - Rt;
|
|
4474
4474
|
at.current.size === 0 && (Ct.current = (p == null ? void 0 : p.id) ?? null), at.current.set(Y.pointerId, {
|
|
4475
4475
|
x: Z,
|
|
4476
4476
|
y: q,
|
|
4477
4477
|
clientX: Y.clientX,
|
|
4478
4478
|
clientY: Y.clientY
|
|
4479
4479
|
});
|
|
4480
|
-
const
|
|
4481
|
-
if (at.current.size === 2 && !
|
|
4480
|
+
const ie = W || p instanceof Ae && p.isCropping || K.isActive();
|
|
4481
|
+
if (at.current.size === 2 && !ie) {
|
|
4482
4482
|
const C = Array.from(at.current.keys()), _ = at.current.get(C[0]), T = at.current.get(C[1]), D = Ct.current !== null;
|
|
4483
4483
|
if (!(D && p && !p.locked && (p.hitTest(_.x, _.y) || p.hitTest(T.x, T.y)))) {
|
|
4484
4484
|
if (x.current && x.current.size > 0) {
|
|
@@ -4491,12 +4491,12 @@ function Ha(t) {
|
|
|
4491
4491
|
), x.current = null;
|
|
4492
4492
|
}
|
|
4493
4493
|
!D && p && $t(null), d.isInteracting() && d.end(), zt.current = null, Xt.current = null, _t.current = null, delete d._pendingTextEditMode, delete d._pendingChildSelection;
|
|
4494
|
-
const it = T.clientX - _.clientX, Bt = T.clientY - _.clientY, Nt = Math.hypot(it, Bt), we = (((J =
|
|
4494
|
+
const it = T.clientX - _.clientX, Bt = T.clientY - _.clientY, Nt = Math.hypot(it, Bt), we = (((J = It.parentElement) == null ? void 0 : J.parentElement) ?? It).getBoundingClientRect();
|
|
4495
4495
|
Gt.current = {
|
|
4496
4496
|
pointerA: C[0],
|
|
4497
4497
|
pointerB: C[1],
|
|
4498
4498
|
startUserZoom: on.current,
|
|
4499
|
-
startPanOffset: { ...
|
|
4499
|
+
startPanOffset: { ...At.current },
|
|
4500
4500
|
startCentroidClient: {
|
|
4501
4501
|
x: (_.clientX + T.clientX) / 2,
|
|
4502
4502
|
y: (_.clientY + T.clientY) / 2
|
|
@@ -4505,18 +4505,18 @@ function Ha(t) {
|
|
|
4505
4505
|
containerRect: { left: we.left, top: we.top }
|
|
4506
4506
|
};
|
|
4507
4507
|
try {
|
|
4508
|
-
|
|
4508
|
+
It.setPointerCapture(Y.pointerId);
|
|
4509
4509
|
} catch {
|
|
4510
4510
|
}
|
|
4511
4511
|
Y.preventDefault();
|
|
4512
4512
|
return;
|
|
4513
4513
|
}
|
|
4514
4514
|
}
|
|
4515
|
-
if (at.current.size === 2 && p && !p.locked && !
|
|
4515
|
+
if (at.current.size === 2 && p && !p.locked && !ie) {
|
|
4516
4516
|
if (d.isInteracting()) {
|
|
4517
4517
|
const D = d.getContext();
|
|
4518
4518
|
if (D.element) {
|
|
4519
|
-
const lt =
|
|
4519
|
+
const lt = re().find(
|
|
4520
4520
|
(it) => it.id === D.element.id
|
|
4521
4521
|
);
|
|
4522
4522
|
jt(lt, D.element);
|
|
@@ -4528,13 +4528,13 @@ function Ha(t) {
|
|
|
4528
4528
|
const _ = at.current.get(C[0]), T = at.current.get(C[1]);
|
|
4529
4529
|
Xt.current = null, _t.current = null, zt.current = null, Wt.current = p.clone(), d.startPinch(p, _, T);
|
|
4530
4530
|
try {
|
|
4531
|
-
|
|
4531
|
+
It.setPointerCapture(Y.pointerId);
|
|
4532
4532
|
} catch {
|
|
4533
4533
|
}
|
|
4534
4534
|
Y.preventDefault();
|
|
4535
4535
|
return;
|
|
4536
4536
|
}
|
|
4537
|
-
if (W && p instanceof
|
|
4537
|
+
if (W && p instanceof oe) {
|
|
4538
4538
|
if (P && E !== R) {
|
|
4539
4539
|
const C = h.current;
|
|
4540
4540
|
if (C.start || C.end) {
|
|
@@ -4561,12 +4561,12 @@ function Ha(t) {
|
|
|
4561
4561
|
return;
|
|
4562
4562
|
}
|
|
4563
4563
|
s.current = pe, pe - l.current >= v && (a.current = null), pe - r.current < w ? i.current += 1 : i.current = 1, r.current = pe;
|
|
4564
|
-
const
|
|
4564
|
+
const se = M;
|
|
4565
4565
|
if (i.current >= 3)
|
|
4566
|
-
Y.preventDefault(), l.current = pe, a.current = { start: 0, end:
|
|
4566
|
+
Y.preventDefault(), l.current = pe, a.current = { start: 0, end: se.length, cursor: se.length }, c.current = !0, i.current = 0, Yt(se.length), Lt(0), Ht(se.length), n.current && (n.current.focus(), n.current.setSelectionRange(0, se.length));
|
|
4567
4567
|
else if (i.current === 2) {
|
|
4568
4568
|
Y.preventDefault(), l.current = pe, c.current = !0;
|
|
4569
|
-
const Ee = Ar(
|
|
4569
|
+
const Ee = Ar(se, fe);
|
|
4570
4570
|
a.current = { start: Ee.start, end: Ee.end, cursor: Ee.end }, Yt(Ee.end), Lt(Ee.start), Ht(Ee.end), n.current && (n.current.focus(), n.current.setSelectionRange(Ee.start, Ee.end));
|
|
4571
4571
|
} else
|
|
4572
4572
|
a.current = null, Yt(fe), Lt(fe), Ht(fe), n.current && (n.current.focus(), n.current.setSelectionRange(fe, fe)), c.current = !1;
|
|
@@ -4682,7 +4682,7 @@ function Ha(t) {
|
|
|
4682
4682
|
}
|
|
4683
4683
|
if (B.hitTestRotation(Z, q, H)) {
|
|
4684
4684
|
if (A.locked) return;
|
|
4685
|
-
const T = A.getBoundingBox(), D =
|
|
4685
|
+
const T = A.getBoundingBox(), D = co(T), lt = ur(D.x, D.y, Z, q);
|
|
4686
4686
|
Kt(!0), ye(lt), Ut(A.rotation), d.startRotate(A, Z, q, lt, A.rotation), Q && p instanceof pt && (d._activeChildContext = {
|
|
4687
4687
|
group: p,
|
|
4688
4688
|
childId: Q.id
|
|
@@ -4705,7 +4705,7 @@ function Ha(t) {
|
|
|
4705
4705
|
const T = p.hitTestChild(Z, q);
|
|
4706
4706
|
T && (d._pendingChildSelection = T);
|
|
4707
4707
|
}
|
|
4708
|
-
p && A.id === p.id && !(A instanceof
|
|
4708
|
+
p && A.id === p.id && !(A instanceof oe) && (Xt.current = A.id, _t.current = { x: Z, y: q }), A instanceof oe && !(A instanceof pt) && p && A.id === p.id && !W && (d._pendingTextEditMode = {
|
|
4709
4709
|
elementId: A.id,
|
|
4710
4710
|
originalX: A.x,
|
|
4711
4711
|
originalY: A.y,
|
|
@@ -4741,7 +4741,7 @@ function Ha(t) {
|
|
|
4741
4741
|
return;
|
|
4742
4742
|
}
|
|
4743
4743
|
if (!Y.shiftKey) {
|
|
4744
|
-
const C =
|
|
4744
|
+
const C = re(), _ = [];
|
|
4745
4745
|
for (let D = C.length - 1; D >= 0; D--) {
|
|
4746
4746
|
const lt = C[D];
|
|
4747
4747
|
lt.visible !== !1 && lt.hitTest(Z, q) && go(lt, Z, q, bt) && _.push(lt);
|
|
@@ -4769,23 +4769,23 @@ function Ha(t) {
|
|
|
4769
4769
|
pointerId: Y.pointerId,
|
|
4770
4770
|
startClientX: Y.clientX,
|
|
4771
4771
|
startClientY: Y.clientY,
|
|
4772
|
-
startPanOffset: { ...
|
|
4772
|
+
startPanOffset: { ...At.current },
|
|
4773
4773
|
movedPastThreshold: !1,
|
|
4774
4774
|
pendingTap: T
|
|
4775
4775
|
};
|
|
4776
4776
|
try {
|
|
4777
|
-
|
|
4777
|
+
It.setPointerCapture(Y.pointerId);
|
|
4778
4778
|
} catch {
|
|
4779
4779
|
}
|
|
4780
4780
|
Y.preventDefault();
|
|
4781
4781
|
return;
|
|
4782
4782
|
}
|
|
4783
|
-
const
|
|
4783
|
+
const Pt = re();
|
|
4784
4784
|
if (La({
|
|
4785
4785
|
x: Z,
|
|
4786
4786
|
y: q,
|
|
4787
4787
|
shiftKey: Y.shiftKey,
|
|
4788
|
-
activeArtboardElements:
|
|
4788
|
+
activeArtboardElements: Pt,
|
|
4789
4789
|
selectedElement: p || null,
|
|
4790
4790
|
multiSelection: vt,
|
|
4791
4791
|
onSelectionChange: $t,
|
|
@@ -4802,12 +4802,12 @@ function Ha(t) {
|
|
|
4802
4802
|
pointerId: Y.pointerId,
|
|
4803
4803
|
startClientX: Y.clientX,
|
|
4804
4804
|
startClientY: Y.clientY,
|
|
4805
|
-
startPanOffset: { ...
|
|
4805
|
+
startPanOffset: { ...At.current },
|
|
4806
4806
|
movedPastThreshold: !1,
|
|
4807
4807
|
pendingTap: null
|
|
4808
4808
|
};
|
|
4809
4809
|
try {
|
|
4810
|
-
|
|
4810
|
+
It.setPointerCapture(Y.pointerId);
|
|
4811
4811
|
} catch {
|
|
4812
4812
|
}
|
|
4813
4813
|
Y.preventDefault();
|
|
@@ -4817,7 +4817,7 @@ function Ha(t) {
|
|
|
4817
4817
|
[
|
|
4818
4818
|
W,
|
|
4819
4819
|
p,
|
|
4820
|
-
|
|
4820
|
+
re,
|
|
4821
4821
|
$t,
|
|
4822
4822
|
O,
|
|
4823
4823
|
B,
|
|
@@ -4838,24 +4838,24 @@ function Ha(t) {
|
|
|
4838
4838
|
]
|
|
4839
4839
|
), In = xt(
|
|
4840
4840
|
(Y) => {
|
|
4841
|
-
var
|
|
4842
|
-
const
|
|
4843
|
-
if (!
|
|
4844
|
-
const Jt = ut.current ??
|
|
4841
|
+
var ie;
|
|
4842
|
+
const It = e.current;
|
|
4843
|
+
if (!It) return;
|
|
4844
|
+
const Jt = ut.current ?? It.getBoundingClientRect(), Z = (Y.clientX - Jt.left) / H - yt, q = (Y.clientY - Jt.top) / H - Rt;
|
|
4845
4845
|
if (g.current = { x: Z, y: q }, at.current.has(Y.pointerId) && at.current.set(Y.pointerId, {
|
|
4846
4846
|
x: Z,
|
|
4847
4847
|
y: q,
|
|
4848
4848
|
clientX: Y.clientX,
|
|
4849
4849
|
clientY: Y.clientY
|
|
4850
4850
|
}), Gt.current) {
|
|
4851
|
-
const A = Gt.current,
|
|
4852
|
-
if (
|
|
4853
|
-
const z = k.clientX -
|
|
4851
|
+
const A = Gt.current, Pt = at.current.get(A.pointerA), k = at.current.get(A.pointerB);
|
|
4852
|
+
if (Pt && k) {
|
|
4853
|
+
const z = k.clientX - Pt.clientX, G = k.clientY - Pt.clientY, dt = Math.hypot(z, G) / A.startDistance, U = Math.min(
|
|
4854
4854
|
Math.max(A.startUserZoom * dt, 0.25),
|
|
4855
4855
|
8
|
|
4856
|
-
), ht = A.startCentroidClient.x - A.containerRect.left, nt = A.startCentroidClient.y - A.containerRect.top, C = (
|
|
4856
|
+
), ht = A.startCentroidClient.x - A.containerRect.left, nt = A.startCentroidClient.y - A.containerRect.top, C = (Pt.clientX + k.clientX) / 2 - A.containerRect.left, _ = (Pt.clientY + k.clientY) / 2 - A.containerRect.top, T = U / A.startUserZoom, D = C - (ht - A.startPanOffset.x) * T, lt = _ - (nt - A.startPanOffset.y) * T, it = e.current;
|
|
4857
4857
|
if (it) {
|
|
4858
|
-
const Bt = it.getBoundingClientRect(), Nt = (
|
|
4858
|
+
const Bt = it.getBoundingClientRect(), Nt = (ie = it.parentElement) == null ? void 0 : ie.parentElement, de = (Nt == null ? void 0 : Nt.clientWidth) ?? Bt.width, we = (Nt == null ? void 0 : Nt.clientHeight) ?? Bt.height, Ce = 80, fe = U / Math.max(on.current, 1e-4), pe = Bt.width * fe, Ve = Bt.height * fe, se = At.current.x, Ee = At.current.y, Ke = Bt.left - A.containerRect.left, Ue = Bt.top - A.containerRect.top, Me = Ke + (D - se), Xe = Ue + (lt - Ee), Oe = Math.min(
|
|
4859
4859
|
Math.max(Me, -pe + Ce),
|
|
4860
4860
|
de - Ce
|
|
4861
4861
|
), Te = Math.min(
|
|
@@ -4872,21 +4872,21 @@ function Ha(t) {
|
|
|
4872
4872
|
return;
|
|
4873
4873
|
}
|
|
4874
4874
|
if (zt.current && zt.current.pointerId === Y.pointerId) {
|
|
4875
|
-
const A = zt.current,
|
|
4875
|
+
const A = zt.current, Pt = Y.clientX - A.startClientX, k = Y.clientY - A.startClientY;
|
|
4876
4876
|
if (!A.movedPastThreshold)
|
|
4877
|
-
if (Math.hypot(
|
|
4877
|
+
if (Math.hypot(Pt, k) > 5)
|
|
4878
4878
|
A.movedPastThreshold = !0, A.pendingTap = null;
|
|
4879
4879
|
else
|
|
4880
4880
|
return;
|
|
4881
4881
|
if (on.current <= 1.001) return;
|
|
4882
4882
|
He({
|
|
4883
|
-
x: A.startPanOffset.x +
|
|
4883
|
+
x: A.startPanOffset.x + Pt,
|
|
4884
4884
|
y: A.startPanOffset.y + k
|
|
4885
4885
|
});
|
|
4886
4886
|
return;
|
|
4887
4887
|
}
|
|
4888
4888
|
if (d.getMode() === "pinch" && Ot.current) {
|
|
4889
|
-
const { a: A, b:
|
|
4889
|
+
const { a: A, b: Pt } = Ot.current, k = at.current.get(A), z = at.current.get(Pt);
|
|
4890
4890
|
if (k && z) {
|
|
4891
4891
|
const G = d.updatePinch(k, z), { element: J, startData: dt } = d.getPinchContext();
|
|
4892
4892
|
ba.calculatePinch({
|
|
@@ -4906,8 +4906,8 @@ function Ha(t) {
|
|
|
4906
4906
|
Y.preventDefault();
|
|
4907
4907
|
return;
|
|
4908
4908
|
}
|
|
4909
|
-
if (u.current && p instanceof
|
|
4910
|
-
const A = p.getVisualBoundingBox(),
|
|
4909
|
+
if (u.current && p instanceof oe) {
|
|
4910
|
+
const A = p.getVisualBoundingBox(), Pt = p.getRotationAnchor(), k = _e.toRadiansInverse(p.rotation), z = Z - Pt.x, G = q - Pt.y, J = Math.cos(k), dt = Math.sin(k), U = z * J - G * dt, ht = z * dt + G * J, nt = h.current;
|
|
4911
4911
|
let C = 0;
|
|
4912
4912
|
u.current === "start" && (nt != null && nt.start) ? C = nt.start.textEdge.y - nt.start.center.y : u.current === "end" && (nt != null && nt.end) && (C = nt.end.textEdge.y - nt.end.center.y);
|
|
4913
4913
|
const _ = U + A.width / 2, T = ht + C + A.height / 2, D = un(p, { x: _, y: T });
|
|
@@ -4928,13 +4928,13 @@ function Ha(t) {
|
|
|
4928
4928
|
if (d.getMode() === "drag") {
|
|
4929
4929
|
const A = d._multiSelectionDragContext;
|
|
4930
4930
|
if (A && vt.length > 0) {
|
|
4931
|
-
const
|
|
4931
|
+
const Pt = Z - A.startX, k = q - A.startY;
|
|
4932
4932
|
A.currentElements || (A.currentElements = /* @__PURE__ */ new Map());
|
|
4933
4933
|
const z = [];
|
|
4934
4934
|
A.elementsStartData.forEach((G) => {
|
|
4935
4935
|
const J = G.element, dt = G.startData, U = J.clone();
|
|
4936
|
-
U.x = dt.x +
|
|
4937
|
-
}), mt((G) => G.map((J) => z.find((dt) => dt.id === J.id) || J)), A.currentDelta = { dx:
|
|
4936
|
+
U.x = dt.x + Pt, U.y = dt.y + k, A.currentElements.set(U.id, U), z.push(U);
|
|
4937
|
+
}), mt((G) => G.map((J) => z.find((dt) => dt.id === J.id) || J)), A.currentDelta = { dx: Pt, dy: k }, !A.startOBB && Et.current && (A.startOBB = { ...Et.current }), et((G) => G + 1), $({});
|
|
4938
4938
|
return;
|
|
4939
4939
|
}
|
|
4940
4940
|
}
|
|
@@ -4942,7 +4942,7 @@ function Ha(t) {
|
|
|
4942
4942
|
if (d.getDragMode() === "crop-image-drag") {
|
|
4943
4943
|
const U = d.getContext(), ht = U.element;
|
|
4944
4944
|
if (ht instanceof Ae && ht.isCropping) {
|
|
4945
|
-
const nt =
|
|
4945
|
+
const nt = Tt.handleCropImageDrag(ht, U, Z, q), C = d._cropGroupContext, _ = d._activeChildContext, T = C || _;
|
|
4946
4946
|
if (T && p instanceof pt) {
|
|
4947
4947
|
const D = ht.clone();
|
|
4948
4948
|
D.x = nt.x, D.y = nt.y, D.updateCrop(nt.cropX, nt.cropY, nt.cropWidth, nt.cropHeight, !1);
|
|
@@ -4961,14 +4961,14 @@ function Ha(t) {
|
|
|
4961
4961
|
return;
|
|
4962
4962
|
}
|
|
4963
4963
|
}
|
|
4964
|
-
const
|
|
4964
|
+
const Pt = d._activeChildContext, k = re(), z = [];
|
|
4965
4965
|
k.forEach((U) => {
|
|
4966
4966
|
U instanceof pt ? z.push(...U.children) : z.push(U);
|
|
4967
4967
|
});
|
|
4968
4968
|
let G = d.updateDrag(Z, q, z);
|
|
4969
|
-
const J =
|
|
4970
|
-
if (J && (G = ct.snapToSpacing(G, J, z)),
|
|
4971
|
-
const U = p.clone(), ht = U.children.findIndex((C) => C.id ===
|
|
4969
|
+
const J = Pt && p instanceof pt ? p.children.find((U) => U.id === Pt.childId) : p;
|
|
4970
|
+
if (J && (G = ct.snapToSpacing(G, J, z)), Pt && p instanceof pt) {
|
|
4971
|
+
const U = p.clone(), ht = U.children.findIndex((C) => C.id === Pt.childId);
|
|
4972
4972
|
if (ht >= 0) {
|
|
4973
4973
|
const C = U.children[ht].clone();
|
|
4974
4974
|
C.x = G.x, C.y = G.y, U.children[ht] = C, U.updateBoundsFromChildren(!0);
|
|
@@ -4993,8 +4993,8 @@ function Ha(t) {
|
|
|
4993
4993
|
}
|
|
4994
4994
|
et((U) => U + 1), X(F.getGuides());
|
|
4995
4995
|
let dt;
|
|
4996
|
-
if (
|
|
4997
|
-
dt = p.children.find((U) => U.id ===
|
|
4996
|
+
if (Pt && p instanceof pt)
|
|
4997
|
+
dt = p.children.find((U) => U.id === Pt.childId);
|
|
4998
4998
|
else {
|
|
4999
4999
|
const U = d.getContext();
|
|
5000
5000
|
U._cachedElement && p ? dt = U._cachedElement[p.id] : dt = p || void 0;
|
|
@@ -5004,7 +5004,7 @@ function Ha(t) {
|
|
|
5004
5004
|
tt(U);
|
|
5005
5005
|
}
|
|
5006
5006
|
} else if (d.getMode() === "resize") {
|
|
5007
|
-
const { dx: A, dy:
|
|
5007
|
+
const { dx: A, dy: Pt } = d.updateResize(Z, q), k = d.getResizeContext(), z = d._multiSelectionResizeContext;
|
|
5008
5008
|
if (z && vt.length > 0) {
|
|
5009
5009
|
const C = z.startBounds, _ = z.anchor;
|
|
5010
5010
|
let T, D, lt, it;
|
|
@@ -5024,7 +5024,7 @@ function Ha(t) {
|
|
|
5024
5024
|
default:
|
|
5025
5025
|
T = C.minX, D = C.minY, lt = C.maxX, it = C.maxY;
|
|
5026
5026
|
}
|
|
5027
|
-
const Bt = lt + A, Nt = it +
|
|
5027
|
+
const Bt = lt + A, Nt = it + Pt, de = Math.abs(lt - T), we = Math.abs(it - D), Ce = Math.abs(Bt - T), fe = Math.abs(Nt - D), pe = de > 0 ? Ce / de : 1, Ve = we > 0 ? fe / we : 1, se = (pe + Ve) / 2, Ee = C.maxX - C.minX, Ke = C.maxY - C.minY, Ue = Ee * se, Me = Ke * se;
|
|
5028
5028
|
let Xe = T, Oe = D, Te = T, We = D;
|
|
5029
5029
|
switch (_) {
|
|
5030
5030
|
case "top-left":
|
|
@@ -5041,17 +5041,17 @@ function Ha(t) {
|
|
|
5041
5041
|
break;
|
|
5042
5042
|
}
|
|
5043
5043
|
if (z.elementsStartData.forEach((xn) => {
|
|
5044
|
-
const An = xn.element, qe = xn.startData,
|
|
5044
|
+
const An = xn.element, qe = xn.startData, Nn = qe.x - T, Kn = qe.y - D, Cn = T + Nn * se, Pn = D + Kn * se, Le = An.clone();
|
|
5045
5045
|
if (Le instanceof Ae) {
|
|
5046
5046
|
Le.x = Cn, Le.y = Pn;
|
|
5047
5047
|
const fn = Le.transformData, pn = qe.transformData;
|
|
5048
|
-
fn.width = pn.width *
|
|
5048
|
+
fn.width = pn.width * se, fn.height = pn.height * se;
|
|
5049
5049
|
} else if (Le instanceof pt) {
|
|
5050
5050
|
Le.x = Cn, Le.y = Pn;
|
|
5051
|
-
const fn = qe.width *
|
|
5051
|
+
const fn = qe.width * se, pn = qe.height * se;
|
|
5052
5052
|
Le.resize(_, fn, pn, qe);
|
|
5053
5053
|
} else {
|
|
5054
|
-
const fn = qe.width *
|
|
5054
|
+
const fn = qe.width * se, pn = qe.height * se;
|
|
5055
5055
|
Le.resize(_, fn, pn, qe), Le.x = Cn, Le.y = Pn;
|
|
5056
5056
|
}
|
|
5057
5057
|
wt(Le);
|
|
@@ -5069,8 +5069,8 @@ function Ha(t) {
|
|
|
5069
5069
|
}
|
|
5070
5070
|
const G = k.element;
|
|
5071
5071
|
if (G instanceof Ae && G.isCropping && k.handle.anchor && k.handle.anchor.startsWith("crop-")) {
|
|
5072
|
-
const C = k.handle.anchor.replace("crop-", ""), _ = d.getContext(), T =
|
|
5073
|
-
|
|
5072
|
+
const C = k.handle.anchor.replace("crop-", ""), _ = d.getContext(), T = Tt.handleCropBoxResize(G, C, k, _, Z, q);
|
|
5073
|
+
It.style.cursor = T.cursor;
|
|
5074
5074
|
const D = d._cropGroupContext, lt = d._activeChildContext, it = D || lt;
|
|
5075
5075
|
if (it && p instanceof pt) {
|
|
5076
5076
|
const Bt = G.clone();
|
|
@@ -5088,11 +5088,11 @@ function Ha(t) {
|
|
|
5088
5088
|
St.forEach((C) => {
|
|
5089
5089
|
C instanceof pt ? U.push(...C.children) : U.push(C);
|
|
5090
5090
|
});
|
|
5091
|
-
let nt =
|
|
5091
|
+
let nt = Qn.executeResize({
|
|
5092
5092
|
element: k.element,
|
|
5093
5093
|
handle: k.handle,
|
|
5094
5094
|
dx: A,
|
|
5095
|
-
dy:
|
|
5095
|
+
dy: Pt,
|
|
5096
5096
|
startData: k.startData,
|
|
5097
5097
|
allElements: U,
|
|
5098
5098
|
snapSystem: F
|
|
@@ -5104,12 +5104,12 @@ function Ha(t) {
|
|
|
5104
5104
|
wt(nt), B.update(nt, H);
|
|
5105
5105
|
et((C) => C + 1), X(F.getGuides());
|
|
5106
5106
|
} else if (d.getMode() === "rotate") {
|
|
5107
|
-
|
|
5107
|
+
It.style.cursor = "grabbing", rt || (Kt(!0), V == null || V(!0));
|
|
5108
5108
|
const A = d._multiSelectionRotationContext;
|
|
5109
5109
|
if (A && vt.length > 0) {
|
|
5110
5110
|
const nt = A.startBounds, C = d.updateRotate(Z, q, nt.centerX, nt.centerY);
|
|
5111
5111
|
Ut(C), A.elementsStartData.forEach((_) => {
|
|
5112
|
-
const T = _.element, D = _.startData, lt =
|
|
5112
|
+
const T = _.element, D = _.startData, lt = Zn.rotatePointAroundAnchor(
|
|
5113
5113
|
D.x,
|
|
5114
5114
|
D.y,
|
|
5115
5115
|
nt.centerX,
|
|
@@ -5120,15 +5120,15 @@ function Ha(t) {
|
|
|
5120
5120
|
});
|
|
5121
5121
|
return;
|
|
5122
5122
|
}
|
|
5123
|
-
const
|
|
5123
|
+
const Pt = d._activeChildContext, k = Pt ? Q : p;
|
|
5124
5124
|
if (!k) return;
|
|
5125
|
-
const z = k.getBoundingBox(), G =
|
|
5125
|
+
const z = k.getBoundingBox(), G = co(z), J = G.x, dt = G.y, U = d.updateRotate(Z, q, G.x, G.y), ht = k.clone();
|
|
5126
5126
|
if (ht.setRotation(U), !(ht instanceof pt)) {
|
|
5127
|
-
const nt = ht.getBoundingBox(), C =
|
|
5127
|
+
const nt = ht.getBoundingBox(), C = co(nt), _ = J - C.x, T = dt - C.y;
|
|
5128
5128
|
ht.x += _, ht.y += T;
|
|
5129
5129
|
}
|
|
5130
|
-
if (y.current = ht, Ut(ht.rotation), ve((nt) => nt + 1),
|
|
5131
|
-
const nt = p.clone(), C = nt.children.findIndex((_) => _.id ===
|
|
5130
|
+
if (y.current = ht, Ut(ht.rotation), ve((nt) => nt + 1), Pt && p instanceof pt) {
|
|
5131
|
+
const nt = p.clone(), C = nt.children.findIndex((_) => _.id === Pt.childId);
|
|
5132
5132
|
C >= 0 && (nt.children[C] = ht, nt.updateBoundsFromChildren(!0)), wt(nt), C >= 0 && (qt(nt.children[C]), B.update(nt.children[C], H));
|
|
5133
5133
|
} else
|
|
5134
5134
|
wt(ht), B.update(ht, H);
|
|
@@ -5155,7 +5155,7 @@ function Ha(t) {
|
|
|
5155
5155
|
for (const _ of dt) {
|
|
5156
5156
|
const T = Z - _.x, D = q - _.y;
|
|
5157
5157
|
if (Math.sqrt(T * T + D * D) <= z) {
|
|
5158
|
-
|
|
5158
|
+
It.style.cursor = _.cursor, ot({ type: "multi-selection-handle", data: _ });
|
|
5159
5159
|
return;
|
|
5160
5160
|
}
|
|
5161
5161
|
}
|
|
@@ -5163,7 +5163,7 @@ function Ha(t) {
|
|
|
5163
5163
|
if (Math.sqrt(
|
|
5164
5164
|
Math.pow(Z - k.rotationHandleX, 2) + Math.pow(q - k.rotationHandleY, 2)
|
|
5165
5165
|
) <= U) {
|
|
5166
|
-
|
|
5166
|
+
It.style.cursor = "grab", ot({ type: "multi-selection-rotation-handle", data: null });
|
|
5167
5167
|
return;
|
|
5168
5168
|
}
|
|
5169
5169
|
let nt = Z, C = q;
|
|
@@ -5172,13 +5172,13 @@ function Ha(t) {
|
|
|
5172
5172
|
nt = k.centerX + (lt * T - it * D), C = k.centerY + (lt * D + it * T);
|
|
5173
5173
|
}
|
|
5174
5174
|
if (nt >= k.minX && nt <= k.maxX && C >= k.minY && C <= k.maxY) {
|
|
5175
|
-
|
|
5175
|
+
It.style.cursor = "move", ot({ type: "multi-selection-bounds", data: k });
|
|
5176
5176
|
return;
|
|
5177
5177
|
}
|
|
5178
5178
|
}
|
|
5179
5179
|
if (Y.altKey) {
|
|
5180
5180
|
let k = null;
|
|
5181
|
-
const z =
|
|
5181
|
+
const z = re();
|
|
5182
5182
|
for (let G = z.length - 1; G >= 0; G--) {
|
|
5183
5183
|
const J = z[G];
|
|
5184
5184
|
if (J.visible !== !1) {
|
|
@@ -5227,30 +5227,30 @@ function Ha(t) {
|
|
|
5227
5227
|
A.rotation,
|
|
5228
5228
|
k.anchor
|
|
5229
5229
|
);
|
|
5230
|
-
|
|
5230
|
+
It.style.cursor = G, ot({ type: "crop-handle", data: k });
|
|
5231
5231
|
return;
|
|
5232
5232
|
}
|
|
5233
5233
|
const z = B.hitTestResize(Z, q, H);
|
|
5234
5234
|
if (z) {
|
|
5235
|
-
|
|
5235
|
+
It.style.cursor = z.cursor, ot({ type: "resize-handle", data: z });
|
|
5236
5236
|
return;
|
|
5237
5237
|
}
|
|
5238
5238
|
if (A.hitTest(Z, q)) {
|
|
5239
|
-
|
|
5239
|
+
It.style.cursor = "move", ot({ type: "element", data: A });
|
|
5240
5240
|
return;
|
|
5241
5241
|
}
|
|
5242
5242
|
} else {
|
|
5243
5243
|
if (B.hitTestRotation(Z, q, H)) {
|
|
5244
|
-
|
|
5244
|
+
It.style.cursor = "grab", ot({ type: "rotation-handle", data: null });
|
|
5245
5245
|
return;
|
|
5246
5246
|
}
|
|
5247
5247
|
const k = B.hitTestResize(Z, q, H);
|
|
5248
5248
|
if (k) {
|
|
5249
|
-
|
|
5249
|
+
It.style.cursor = k.cursor, ot({ type: "resize-handle", data: k });
|
|
5250
5250
|
return;
|
|
5251
5251
|
}
|
|
5252
5252
|
if (A.hitTest(Z, q)) {
|
|
5253
|
-
|
|
5253
|
+
It.style.cursor = "move", ot({ type: "element", data: A });
|
|
5254
5254
|
return;
|
|
5255
5255
|
}
|
|
5256
5256
|
}
|
|
@@ -5258,25 +5258,25 @@ function Ha(t) {
|
|
|
5258
5258
|
for (let k = p.children.length - 1; k >= 0; k--) {
|
|
5259
5259
|
const z = p.children[k];
|
|
5260
5260
|
if (!(z.visible === !1 || z.id === Q.id) && z.hitTest(Z, q)) {
|
|
5261
|
-
|
|
5261
|
+
It.style.cursor = "pointer", ot({ type: "group-sibling", data: z });
|
|
5262
5262
|
return;
|
|
5263
5263
|
}
|
|
5264
5264
|
}
|
|
5265
|
-
const
|
|
5266
|
-
for (let k =
|
|
5267
|
-
if (
|
|
5268
|
-
if (!go(
|
|
5265
|
+
const Pt = re();
|
|
5266
|
+
for (let k = Pt.length - 1; k >= 0; k--)
|
|
5267
|
+
if (Pt[k].visible !== !1 && !Pt[k].locked && Pt[k].hitTest(Z, q)) {
|
|
5268
|
+
if (!go(Pt[k], Z, q, bt))
|
|
5269
5269
|
continue;
|
|
5270
|
-
|
|
5270
|
+
It.style.cursor = "pointer", ot({ type: "element", data: Pt[k] });
|
|
5271
5271
|
return;
|
|
5272
5272
|
}
|
|
5273
|
-
|
|
5273
|
+
It.style.cursor = "default", ot({ type: null, data: null });
|
|
5274
5274
|
}
|
|
5275
5275
|
},
|
|
5276
5276
|
[
|
|
5277
5277
|
d,
|
|
5278
5278
|
p,
|
|
5279
|
-
|
|
5279
|
+
re,
|
|
5280
5280
|
wt,
|
|
5281
5281
|
B,
|
|
5282
5282
|
I,
|
|
@@ -5288,18 +5288,18 @@ function Ha(t) {
|
|
|
5288
5288
|
et,
|
|
5289
5289
|
H,
|
|
5290
5290
|
yt,
|
|
5291
|
-
|
|
5291
|
+
Rt,
|
|
5292
5292
|
ot,
|
|
5293
5293
|
ct,
|
|
5294
5294
|
tt,
|
|
5295
5295
|
gt,
|
|
5296
|
-
|
|
5296
|
+
Tt,
|
|
5297
5297
|
// Canvas-zoom pinch update uses these viewport setters.
|
|
5298
5298
|
ce,
|
|
5299
5299
|
He
|
|
5300
5300
|
]
|
|
5301
5301
|
), hn = xt((Y) => {
|
|
5302
|
-
var Z, q,
|
|
5302
|
+
var Z, q, ie, A, Pt;
|
|
5303
5303
|
if (Y.target.releasePointerCapture(Y.pointerId), at.current.delete(Y.pointerId), Gt.current && (Y.pointerId === Gt.current.pointerA || Y.pointerId === Gt.current.pointerB)) {
|
|
5304
5304
|
Gt.current = null, at.current.clear();
|
|
5305
5305
|
return;
|
|
@@ -5337,8 +5337,8 @@ function Ha(t) {
|
|
|
5337
5337
|
const J = St.find((dt) => dt.id === G);
|
|
5338
5338
|
J && (z.x !== J.x || z.y !== J.y || z instanceof pt && J instanceof pt && JSON.stringify(z.children.map((U) => ({ x: U.x, y: U.y }))) !== JSON.stringify(J.children.map((U) => ({ x: U.x, y: U.y })))) && jt(z, J);
|
|
5339
5339
|
}), x.current = null);
|
|
5340
|
-
const
|
|
5341
|
-
if (
|
|
5340
|
+
const It = e.current;
|
|
5341
|
+
if (It && (It.style.cursor = "default"), F.clearGuides(), F.clearSnapState(), X([]), ct.clearIndicators(), tt([]), d._cropGroupContext && delete d._cropGroupContext, d._activeChildContext) {
|
|
5342
5342
|
if (Q && p instanceof pt) {
|
|
5343
5343
|
const k = d.getContext(), J = (k._cachedElement && k._cachedElement[p.id] || p).children.find((dt) => dt.id === Q.id);
|
|
5344
5344
|
J && (qt(J), B.update(J, H));
|
|
@@ -5384,15 +5384,15 @@ function Ha(t) {
|
|
|
5384
5384
|
}
|
|
5385
5385
|
if (d._pendingTextEditMode) {
|
|
5386
5386
|
const k = d._pendingTextEditMode, z = St.find((J) => J.id === k.elementId);
|
|
5387
|
-
!(z && (Math.abs(z.x - k.originalX) > 0.1 || Math.abs(z.y - k.originalY) > 0.1)) && z instanceof
|
|
5387
|
+
!(z && (Math.abs(z.x - k.originalX) > 0.1 || Math.abs(z.y - k.originalY) > 0.1)) && z instanceof oe && !(z instanceof Ae) && !(z instanceof Yn) && De(z, k.clickX, k.clickY), delete d._pendingTextEditMode;
|
|
5388
5388
|
}
|
|
5389
5389
|
if (Xt.current) {
|
|
5390
|
-
const k = Xt.current, z = _t.current, G = St.find((ht) => ht.id === k), J = (
|
|
5390
|
+
const k = Xt.current, z = _t.current, G = St.find((ht) => ht.id === k), J = (ie = x.current) == null ? void 0 : ie.get(k), dt = !!(G && J && (Math.abs(G.x - J.x) > 0.1 || Math.abs(G.y - J.y) > 0.1)), U = z ? Math.hypot(
|
|
5391
5391
|
(Y.clientX - (((A = ut.current) == null ? void 0 : A.left) ?? 0)) / H - yt - z.x,
|
|
5392
|
-
(Y.clientY - (((
|
|
5392
|
+
(Y.clientY - (((Pt = ut.current) == null ? void 0 : Pt.top) ?? 0)) / H - Rt - z.y
|
|
5393
5393
|
) > 4 / Math.max(H, 1e-4) : !1;
|
|
5394
5394
|
if (!dt && !U && k === (p == null ? void 0 : p.id) && z) {
|
|
5395
|
-
const ht =
|
|
5395
|
+
const ht = re(), nt = [];
|
|
5396
5396
|
for (let _ = ht.length - 1; _ >= 0; _--) {
|
|
5397
5397
|
const T = ht[_];
|
|
5398
5398
|
T.visible !== !1 && T.hitTest(z.x, z.y) && go(T, z.x, z.y, bt) && nt.push(T);
|
|
@@ -5419,29 +5419,29 @@ function Ha(t) {
|
|
|
5419
5419
|
et,
|
|
5420
5420
|
H,
|
|
5421
5421
|
yt,
|
|
5422
|
-
|
|
5422
|
+
Rt,
|
|
5423
5423
|
V,
|
|
5424
5424
|
De,
|
|
5425
5425
|
St,
|
|
5426
5426
|
$t,
|
|
5427
5427
|
jt,
|
|
5428
5428
|
bt
|
|
5429
|
-
]),
|
|
5429
|
+
]), jn = xt(
|
|
5430
5430
|
(Y) => {
|
|
5431
5431
|
if (!p) return;
|
|
5432
|
-
const
|
|
5433
|
-
if (!
|
|
5434
|
-
const Jt = ut.current ??
|
|
5432
|
+
const It = e.current;
|
|
5433
|
+
if (!It) return;
|
|
5434
|
+
const Jt = ut.current ?? It.getBoundingClientRect(), Z = (Y.clientX - Jt.left) / H - yt, q = (Y.clientY - Jt.top) / H - Rt;
|
|
5435
5435
|
if (p.hitTest(Z, q)) {
|
|
5436
5436
|
if (p instanceof pt) {
|
|
5437
5437
|
const it = p.hitTestChild(Z, q);
|
|
5438
5438
|
if (it) {
|
|
5439
5439
|
if (!(Q && Q.id === it.id)) return;
|
|
5440
|
-
if (it instanceof
|
|
5441
|
-
const Nt = it.getVisualBoundingBox(), de = _e.toRadiansInverse(it.rotation), we = it.getRotationAnchor(), Ce = Z - we.x, fe = q - we.y, pe = Math.cos(de), Ve = Math.sin(de),
|
|
5440
|
+
if (it instanceof oe && !(it instanceof pt) && !(it instanceof Yn)) {
|
|
5441
|
+
const Nt = it.getVisualBoundingBox(), de = _e.toRadiansInverse(it.rotation), we = it.getRotationAnchor(), Ce = Z - we.x, fe = q - we.y, pe = Math.cos(de), Ve = Math.sin(de), se = Ce * pe - fe * Ve, Ee = Ce * Ve + fe * pe, Ke = se + Nt.width / 2, Ue = Ee + Nt.height / 2, Me = un(it, { x: Ke, y: Ue }), Xe = Nt.height + 16, Oe = 6;
|
|
5442
5442
|
Ie({
|
|
5443
5443
|
x: Jt.left + (Nt.x + yt) * H - Oe,
|
|
5444
|
-
y: Jt.top + (Nt.y +
|
|
5444
|
+
y: Jt.top + (Nt.y + Rt) * H - Oe,
|
|
5445
5445
|
width: Math.max(20, Nt.width * H),
|
|
5446
5446
|
height: Math.max(Xe * H, 50)
|
|
5447
5447
|
}), be(st(it));
|
|
@@ -5458,13 +5458,13 @@ function Ha(t) {
|
|
|
5458
5458
|
K.editPath(p), et((it) => it + 1);
|
|
5459
5459
|
return;
|
|
5460
5460
|
}
|
|
5461
|
-
if (p instanceof
|
|
5461
|
+
if (p instanceof Yn || !(p instanceof oe))
|
|
5462
5462
|
return;
|
|
5463
|
-
const
|
|
5463
|
+
const ie = p.getVisualBoundingBox(), A = _e.toRadiansInverse(p.rotation), Pt = p.getRotationAnchor(), k = Z - Pt.x, z = q - Pt.y, G = Math.cos(A), J = Math.sin(A), dt = k * G - z * J, U = k * J + z * G, ht = dt + ie.width / 2, nt = U + ie.height / 2, C = un(p, { x: ht, y: nt }), _ = ie.height + 16, T = 6;
|
|
5464
5464
|
Ie({
|
|
5465
|
-
x: Jt.left + (
|
|
5466
|
-
y: Jt.top + (
|
|
5467
|
-
width: Math.max(20,
|
|
5465
|
+
x: Jt.left + (ie.x + yt) * H - T,
|
|
5466
|
+
y: Jt.top + (ie.y + Rt) * H - T,
|
|
5467
|
+
width: Math.max(20, ie.width * H),
|
|
5468
5468
|
height: Math.max(_ * H, 50)
|
|
5469
5469
|
}), be(st(p));
|
|
5470
5470
|
const D = p.getRichText().clone();
|
|
@@ -5482,7 +5482,7 @@ function Ha(t) {
|
|
|
5482
5482
|
et,
|
|
5483
5483
|
H,
|
|
5484
5484
|
yt,
|
|
5485
|
-
|
|
5485
|
+
Rt,
|
|
5486
5486
|
Ie,
|
|
5487
5487
|
be,
|
|
5488
5488
|
je,
|
|
@@ -5497,11 +5497,11 @@ function Ha(t) {
|
|
|
5497
5497
|
]
|
|
5498
5498
|
), wn = xt(
|
|
5499
5499
|
(Y) => {
|
|
5500
|
-
const
|
|
5501
|
-
if (!
|
|
5502
|
-
const Z = ut.current ??
|
|
5500
|
+
const It = e.current;
|
|
5501
|
+
if (!It || d.getMode() === "idle") return;
|
|
5502
|
+
const Z = ut.current ?? It.getBoundingClientRect();
|
|
5503
5503
|
if (Y.clientX >= Z.left && Y.clientX <= Z.right && Y.clientY >= Z.top && Y.clientY <= Z.bottom) return;
|
|
5504
|
-
const
|
|
5504
|
+
const ie = {
|
|
5505
5505
|
clientX: Y.clientX,
|
|
5506
5506
|
clientY: Y.clientY,
|
|
5507
5507
|
altKey: Y.altKey,
|
|
@@ -5510,8 +5510,8 @@ function Ha(t) {
|
|
|
5510
5510
|
metaKey: Y.metaKey,
|
|
5511
5511
|
bubbles: !0,
|
|
5512
5512
|
cancelable: !0,
|
|
5513
|
-
currentTarget:
|
|
5514
|
-
target:
|
|
5513
|
+
currentTarget: It,
|
|
5514
|
+
target: It,
|
|
5515
5515
|
nativeEvent: Y,
|
|
5516
5516
|
type: "pointermove",
|
|
5517
5517
|
pointerId: Y.pointerId || 0,
|
|
@@ -5521,37 +5521,37 @@ function Ha(t) {
|
|
|
5521
5521
|
isPropagationStopped: () => !1,
|
|
5522
5522
|
isDefaultPrevented: () => Y.defaultPrevented
|
|
5523
5523
|
};
|
|
5524
|
-
In(
|
|
5524
|
+
In(ie);
|
|
5525
5525
|
},
|
|
5526
5526
|
[In, e, d]
|
|
5527
5527
|
), Tn = xt(
|
|
5528
5528
|
(Y) => {
|
|
5529
|
-
const
|
|
5530
|
-
if (!
|
|
5531
|
-
const Jt = Y.target, Z = Jt ?
|
|
5529
|
+
const It = e.current;
|
|
5530
|
+
if (!It) return;
|
|
5531
|
+
const Jt = Y.target, Z = Jt ? It.contains(Jt) : !1, q = at.current.has(Y.pointerId) || Gt.current !== null || zt.current !== null || Ot.current !== null || d.isInteracting();
|
|
5532
5532
|
if (!Z && !q) return;
|
|
5533
|
-
const
|
|
5533
|
+
const ie = {
|
|
5534
5534
|
clientX: Y.clientX,
|
|
5535
5535
|
clientY: Y.clientY,
|
|
5536
|
-
currentTarget:
|
|
5537
|
-
target:
|
|
5536
|
+
currentTarget: It,
|
|
5537
|
+
target: It,
|
|
5538
5538
|
pointerId: Y.pointerId || 0,
|
|
5539
5539
|
pointerType: Y.pointerType || "mouse"
|
|
5540
5540
|
};
|
|
5541
|
-
hn(
|
|
5541
|
+
hn(ie);
|
|
5542
5542
|
},
|
|
5543
5543
|
[hn, e, d]
|
|
5544
5544
|
);
|
|
5545
5545
|
return Vt(() => (document.addEventListener("pointermove", wn), document.addEventListener("pointerup", Tn), () => {
|
|
5546
5546
|
document.removeEventListener("pointermove", wn), document.removeEventListener("pointerup", Tn);
|
|
5547
5547
|
}), [wn, Tn]), {
|
|
5548
|
-
handlePointerDown:
|
|
5548
|
+
handlePointerDown: io,
|
|
5549
5549
|
handlePointerMove: In,
|
|
5550
5550
|
handlePointerUp: hn,
|
|
5551
|
-
handleDoubleClick:
|
|
5551
|
+
handleDoubleClick: jn
|
|
5552
5552
|
};
|
|
5553
5553
|
}
|
|
5554
|
-
function
|
|
5554
|
+
function qn(t) {
|
|
5555
5555
|
if (t.transformType !== "custom")
|
|
5556
5556
|
return t.text;
|
|
5557
5557
|
const n = t.getVisualBoundingBox().width, o = t.getText();
|
|
@@ -5603,7 +5603,7 @@ function Xa(t) {
|
|
|
5603
5603
|
setSelectionEnd: Et,
|
|
5604
5604
|
setEditPosition: H,
|
|
5605
5605
|
setCurrentFormattingStyle: yt,
|
|
5606
|
-
setCursorAnimationFrame:
|
|
5606
|
+
setCursorAnimationFrame: Rt,
|
|
5607
5607
|
setHandlesVersion: gt,
|
|
5608
5608
|
setElements: bt,
|
|
5609
5609
|
onElementUpdate: Yt,
|
|
@@ -5614,13 +5614,13 @@ function Xa(t) {
|
|
|
5614
5614
|
(d, B, F) => {
|
|
5615
5615
|
const ct = e.current;
|
|
5616
5616
|
if (!ct) return;
|
|
5617
|
-
const K = ct.getBoundingClientRect(),
|
|
5617
|
+
const K = ct.getBoundingClientRect(), Tt = d.getVisualBoundingBox(), wt = _e.toRadiansInverse(d.rotation), jt = d.getRotationAnchor(), $t = B - jt.x, O = F - jt.y, V = Math.cos(wt), le = Math.sin(wt), qt = $t * V - O * le, re = $t * le + O * V, Pe = qt + Tt.width / 2, xe = re + Tt.height / 2, Se = un(d, { x: Pe, y: xe }), De = Tt.height + 16, Ie = 6;
|
|
5618
5618
|
H({
|
|
5619
|
-
x: K.left + (
|
|
5620
|
-
y: K.top + (
|
|
5621
|
-
width: Math.max(20,
|
|
5619
|
+
x: K.left + (Tt.x + rt) * R - Ie,
|
|
5620
|
+
y: K.top + (Tt.y + I) * R - Ie,
|
|
5621
|
+
width: Math.max(20, Tt.width * R),
|
|
5622
5622
|
height: Math.max(De * R, 50)
|
|
5623
|
-
}), p(
|
|
5623
|
+
}), p(qn(d));
|
|
5624
5624
|
const be = d.getRichText().clone();
|
|
5625
5625
|
r.current = be, Q(be);
|
|
5626
5626
|
const je = d.getRichText().getStyleAt(Math.max(0, d.text.length - 1));
|
|
@@ -5634,7 +5634,7 @@ function Xa(t) {
|
|
|
5634
5634
|
const B = Math.min(v, N), F = Math.max(v, N);
|
|
5635
5635
|
if (B === F) {
|
|
5636
5636
|
const ct = b.clone(), K = ct.getText().length;
|
|
5637
|
-
ct.applyStyle(0, K, d), r.current = ct, Q(ct), p(ct.getText()), yt((
|
|
5637
|
+
ct.applyStyle(0, K, d), r.current = ct, Q(ct), p(ct.getText()), yt((Tt) => ({ ...Tt, ...d }));
|
|
5638
5638
|
} else {
|
|
5639
5639
|
const ct = b.clone();
|
|
5640
5640
|
ct.applyStyle(B, F, d), r.current = ct, Q(ct), p(ct.getText()), yt((K) => ({ ...K, ...d }));
|
|
@@ -5644,11 +5644,11 @@ function Xa(t) {
|
|
|
5644
5644
|
), ve = xt(() => {
|
|
5645
5645
|
if (!f || !b || !M) return null;
|
|
5646
5646
|
const d = Math.min(v, N), B = Math.max(v, N);
|
|
5647
|
-
return d === B ? d === 0 ? M instanceof
|
|
5647
|
+
return d === B ? d === 0 ? M instanceof oe ? M.getDefaultStyle() : {} : b.getStyleAt(Math.max(0, d - 1)) : b.getStyleAt(d);
|
|
5648
5648
|
}, [f, b, v, N, M]), L = xt(
|
|
5649
5649
|
(d) => {
|
|
5650
5650
|
if (!f || !b || !M) return;
|
|
5651
|
-
const B = ve(), K = !{ ...M instanceof
|
|
5651
|
+
const B = ve(), K = !{ ...M instanceof oe ? M.getDefaultStyle() : {}, ...B }[d];
|
|
5652
5652
|
Ut({ [d]: K });
|
|
5653
5653
|
},
|
|
5654
5654
|
[f, b, M, ve, Ut]
|
|
@@ -5658,15 +5658,15 @@ function Xa(t) {
|
|
|
5658
5658
|
if (M && d) {
|
|
5659
5659
|
const B = o.current;
|
|
5660
5660
|
if (B && M instanceof pt) {
|
|
5661
|
-
const F = M.clone(), ct = F.children.findIndex((
|
|
5661
|
+
const F = M.clone(), ct = F.children.findIndex((Tt) => Tt.id === B);
|
|
5662
5662
|
if (ct >= 0) {
|
|
5663
|
-
const
|
|
5664
|
-
|
|
5663
|
+
const Tt = F.children[ct];
|
|
5664
|
+
Tt instanceof oe && Tt.setRichText(d), F.updateBoundsFromChildren(!0);
|
|
5665
5665
|
}
|
|
5666
5666
|
Yt(F);
|
|
5667
5667
|
const K = F.children[ct];
|
|
5668
|
-
K && (Kt(K), Ht.update(K, R), gt((
|
|
5669
|
-
} else if (M instanceof
|
|
5668
|
+
K && (Kt(K), Ht.update(K, R), gt((Tt) => Tt + 1));
|
|
5669
|
+
} else if (M instanceof oe) {
|
|
5670
5670
|
const F = M.clone();
|
|
5671
5671
|
F.setRichText(d), Yt(F), Ht.update(F, R), gt((ct) => ct + 1);
|
|
5672
5672
|
}
|
|
@@ -5691,41 +5691,41 @@ function Xa(t) {
|
|
|
5691
5691
|
h.current = !1, (jt = n.current) == null || jt.focus(), n.current && n.current.setSelectionRange(v, N);
|
|
5692
5692
|
return;
|
|
5693
5693
|
}
|
|
5694
|
-
let K = document.activeElement,
|
|
5694
|
+
let K = document.activeElement, Tt = !1;
|
|
5695
5695
|
for (; K; ) {
|
|
5696
5696
|
const O = K.classList, V = K.getAttribute("data-slot");
|
|
5697
5697
|
if (V && (V.includes("popover") || V.includes("dialog"))) {
|
|
5698
|
-
|
|
5698
|
+
Tt = !0;
|
|
5699
5699
|
break;
|
|
5700
5700
|
}
|
|
5701
5701
|
if (K.hasAttribute("data-preserve-selection")) {
|
|
5702
|
-
|
|
5702
|
+
Tt = !0;
|
|
5703
5703
|
break;
|
|
5704
5704
|
}
|
|
5705
5705
|
if (O && (O.contains("toolbar") || O.contains("toolbar-items") || O.contains("toolbar-btn") || O.contains("toolbar-btn-sm") || O.contains("toolbar-btn-icon") || O.contains("toolbar-color") || O.contains("toolbar-label") || O.contains("toolbar-select") || O.contains("toolbar-select-sm") || O.contains("toolbar-group") || O.contains("toolbar-scroll") || O.contains("toolbar-color-label") || O.contains("toolbar-color-square") || O.contains("color-picker-dropdown") || O.contains("text-color-panel") || O.contains("tooltip-wrapper") || O.contains("font-dropdown-with-label") || O.contains("font-family-select-button") || O.contains("more-menu-btn") || O.contains("more-menu-toolbar") || O.contains("font-drawer-overlay") || O.contains("font-drawer-content") || O.contains("font-drawer-handle") || O.contains("font-drawer-handle-bar") || O.contains("font-dropdown-list-container") || O.contains("font-dropdown-search") || O.contains("font-search-input") || O.contains("font-category-filters") || O.contains("font-category-btn") || O.contains("font-grid-option") || O.contains("font-section") || O.contains("font-section-header") || O.contains("font-section-used") || O.contains("font-section-header-used") || O.contains("font-dropdown-list-grid") || O.contains("font-dropdown-list-grid-used") || O.contains("font-preview") || O.contains("font-name-label") || O.contains("font-size-slider-container") || O.contains("font-size-slider") || O.contains("font-size-icon-small") || O.contains("font-size-icon-large") || O.contains("font-icon-toggle") || O.contains("font-dropdown-empty") || O.contains("vaul-drawer-wrapper") || O.contains("vaul-overlay"))) {
|
|
5706
|
-
|
|
5706
|
+
Tt = !0;
|
|
5707
5707
|
break;
|
|
5708
5708
|
}
|
|
5709
5709
|
K = K.parentElement;
|
|
5710
5710
|
}
|
|
5711
|
-
if (!
|
|
5711
|
+
if (!Tt && x.current)
|
|
5712
5712
|
for (K = x.current; K; ) {
|
|
5713
5713
|
const O = K.classList, V = K.getAttribute("data-slot");
|
|
5714
5714
|
if (V && (V.includes("popover") || V.includes("dialog"))) {
|
|
5715
|
-
|
|
5715
|
+
Tt = !0;
|
|
5716
5716
|
break;
|
|
5717
5717
|
}
|
|
5718
5718
|
if (K.hasAttribute("data-preserve-selection")) {
|
|
5719
|
-
|
|
5719
|
+
Tt = !0;
|
|
5720
5720
|
break;
|
|
5721
5721
|
}
|
|
5722
5722
|
if (O && (O.contains("toolbar") || O.contains("toolbar-items") || O.contains("toolbar-btn") || O.contains("toolbar-btn-sm") || O.contains("toolbar-btn-icon") || O.contains("toolbar-color") || O.contains("toolbar-label") || O.contains("toolbar-select") || O.contains("toolbar-select-sm") || O.contains("toolbar-group") || O.contains("toolbar-scroll") || O.contains("toolbar-color-label") || O.contains("toolbar-color-square") || O.contains("color-picker-dropdown") || O.contains("text-color-panel") || O.contains("tooltip-wrapper") || O.contains("font-dropdown-with-label") || O.contains("font-family-select-button") || O.contains("more-menu-btn") || O.contains("more-menu-toolbar") || O.contains("vaul-drawer-wrapper") || O.contains("vaul-overlay"))) {
|
|
5723
|
-
|
|
5723
|
+
Tt = !0;
|
|
5724
5724
|
break;
|
|
5725
5725
|
}
|
|
5726
5726
|
K = K.parentElement;
|
|
5727
5727
|
}
|
|
5728
|
-
if (!
|
|
5728
|
+
if (!Tt)
|
|
5729
5729
|
X();
|
|
5730
5730
|
else {
|
|
5731
5731
|
const O = v, V = N;
|
|
@@ -5751,7 +5751,7 @@ function Xa(t) {
|
|
|
5751
5751
|
St(F), vt(F), Et(B.selectionEnd), i.current = F;
|
|
5752
5752
|
}, 0);
|
|
5753
5753
|
else if (d.key === "ArrowUp" || d.key === "ArrowDown") {
|
|
5754
|
-
if (M && M instanceof
|
|
5754
|
+
if (M && M instanceof oe) {
|
|
5755
5755
|
d.preventDefault();
|
|
5756
5756
|
const F = d.key === "ArrowUp" ? "up" : "down", ct = Hs(M, w, F);
|
|
5757
5757
|
St(ct), vt(ct), Et(ct), i.current = ct, B.setSelectionRange(ct, ct);
|
|
@@ -5769,7 +5769,7 @@ function Xa(t) {
|
|
|
5769
5769
|
if (!f) return;
|
|
5770
5770
|
let d, B = 0;
|
|
5771
5771
|
const F = 33, ct = (K) => {
|
|
5772
|
-
K - B >= F && (
|
|
5772
|
+
K - B >= F && (Rt((Tt) => (Tt + 1) % 1e3), B = K), d = requestAnimationFrame(ct);
|
|
5773
5773
|
};
|
|
5774
5774
|
return d = requestAnimationFrame(ct), () => cancelAnimationFrame(d);
|
|
5775
5775
|
}, [f]);
|
|
@@ -5792,7 +5792,7 @@ function Xa(t) {
|
|
|
5792
5792
|
F = b.getStyleAt(d - 1);
|
|
5793
5793
|
else {
|
|
5794
5794
|
const ct = E.find((K) => K.id === W);
|
|
5795
|
-
ct instanceof
|
|
5795
|
+
ct instanceof oe && (F = ct.getDefaultStyle());
|
|
5796
5796
|
}
|
|
5797
5797
|
F && !$(F, mt.current) && (mt.current = F, yt(F));
|
|
5798
5798
|
}
|
|
@@ -5809,15 +5809,15 @@ function Xa(t) {
|
|
|
5809
5809
|
const jt = d.children.find(($t) => $t.id === o.current);
|
|
5810
5810
|
jt && (B = jt);
|
|
5811
5811
|
}
|
|
5812
|
-
if (!(B instanceof
|
|
5812
|
+
if (!(B instanceof oe)) return;
|
|
5813
5813
|
const F = B.clone();
|
|
5814
5814
|
b && F.setRichText(b);
|
|
5815
|
-
const ct = F.getVisualBoundingBox(), K = e.current.getBoundingClientRect(),
|
|
5815
|
+
const ct = F.getVisualBoundingBox(), K = e.current.getBoundingClientRect(), Tt = ct.height + 16, wt = 6;
|
|
5816
5816
|
if (H({
|
|
5817
5817
|
x: K.left + (ct.x + rt) * R - wt,
|
|
5818
5818
|
y: K.top + (ct.y + I) * R - wt,
|
|
5819
5819
|
width: Math.max(20, ct.width * R),
|
|
5820
|
-
height: Math.max(
|
|
5820
|
+
height: Math.max(Tt * R, 50)
|
|
5821
5821
|
}), o.current && d instanceof pt) {
|
|
5822
5822
|
const jt = d.clone(), $t = jt.children.findIndex((O) => O.id === o.current);
|
|
5823
5823
|
$t >= 0 && (jt.children[$t] = F, jt.updateBoundsFromChildren(!0)), bt((O) => O.map((V) => V.id === jt.id ? jt : V)), Ht.update(F, R);
|
|
@@ -5832,8 +5832,8 @@ function Xa(t) {
|
|
|
5832
5832
|
const d = n.current, B = () => {
|
|
5833
5833
|
if (u.current || Date.now() - l.current < y)
|
|
5834
5834
|
return;
|
|
5835
|
-
const K = d.selectionStart || 0,
|
|
5836
|
-
St((wt) => wt ===
|
|
5835
|
+
const K = d.selectionStart || 0, Tt = d.selectionEnd || 0;
|
|
5836
|
+
St((wt) => wt === Tt ? wt : Tt), vt((wt) => wt === K ? wt : K), Et((wt) => wt === Tt ? wt : Tt), Lt == null || Lt();
|
|
5837
5837
|
};
|
|
5838
5838
|
d.addEventListener("click", B), d.addEventListener("keyup", B), d.addEventListener("select", B), d.addEventListener("mouseup", B);
|
|
5839
5839
|
const F = () => {
|
|
@@ -5847,26 +5847,26 @@ function Xa(t) {
|
|
|
5847
5847
|
const F = B.target;
|
|
5848
5848
|
if (F.tagName === "INPUT" || F.tagName === "TEXTAREA" || B.key !== "Enter" || f || !e.current) return;
|
|
5849
5849
|
const ct = e.current.getBoundingClientRect();
|
|
5850
|
-
if (P && P instanceof
|
|
5850
|
+
if (P && P instanceof oe && !(P instanceof pt) && !(P instanceof Ae) && !(P instanceof Yn)) {
|
|
5851
5851
|
B.preventDefault();
|
|
5852
|
-
const K = P.getVisualBoundingBox(),
|
|
5852
|
+
const K = P.getVisualBoundingBox(), Tt = K.height + 16, wt = 6;
|
|
5853
5853
|
H({
|
|
5854
5854
|
x: ct.left + (K.x + rt) * R - wt,
|
|
5855
5855
|
y: ct.top + (K.y + I) * R - wt,
|
|
5856
5856
|
width: Math.max(200, K.width * R),
|
|
5857
|
-
height: Math.max(
|
|
5858
|
-
}), p(
|
|
5857
|
+
height: Math.max(Tt * R, 50)
|
|
5858
|
+
}), p(qn(P)), j(!0), g.current = Date.now(), o.current = P.id;
|
|
5859
5859
|
return;
|
|
5860
5860
|
}
|
|
5861
|
-
if (M && M instanceof
|
|
5861
|
+
if (M && M instanceof oe && !(M instanceof pt) && !(M instanceof Ae) && !(M instanceof Yn)) {
|
|
5862
5862
|
B.preventDefault();
|
|
5863
|
-
const K = M.getVisualBoundingBox(),
|
|
5863
|
+
const K = M.getVisualBoundingBox(), Tt = K.height + 16, wt = 6;
|
|
5864
5864
|
H({
|
|
5865
5865
|
x: ct.left + (K.x + rt) * R - wt,
|
|
5866
5866
|
y: ct.top + (K.y + I) * R - wt,
|
|
5867
5867
|
width: Math.max(200, K.width * R),
|
|
5868
|
-
height: Math.max(
|
|
5869
|
-
}), p(
|
|
5868
|
+
height: Math.max(Tt * R, 50)
|
|
5869
|
+
}), p(qn(M)), j(!0), g.current = Date.now();
|
|
5870
5870
|
}
|
|
5871
5871
|
};
|
|
5872
5872
|
return window.addEventListener("keydown", d), () => window.removeEventListener("keydown", d);
|
|
@@ -5878,7 +5878,7 @@ function Xa(t) {
|
|
|
5878
5878
|
getSelectionStyle: ve,
|
|
5879
5879
|
toggleFormattingProperty: L,
|
|
5880
5880
|
enterTextEditMode: ye,
|
|
5881
|
-
getWrappedTextForEditing:
|
|
5881
|
+
getWrappedTextForEditing: qn
|
|
5882
5882
|
};
|
|
5883
5883
|
}
|
|
5884
5884
|
const Dr = Co(
|
|
@@ -5916,7 +5916,7 @@ const Dr = Co(
|
|
|
5916
5916
|
pieceFocus: p,
|
|
5917
5917
|
focusedPieceRect: Q
|
|
5918
5918
|
}, St) => {
|
|
5919
|
-
const { resolvedTheme: vt } = $r(), Et = kt(null), H = f || Et, yt = kt(null),
|
|
5919
|
+
const { resolvedTheme: vt } = $r(), Et = kt(null), H = f || Et, yt = kt(null), Rt = kt(!1), gt = kt(0), bt = kt(0), Yt = kt(0), Lt = kt(!1), Ht = kt(0), Kt = kt(null), ye = kt(0), Ut = kt(null), ve = kt({ start: null, end: null }), L = kt(null), X = kt(null), tt = kt(null), et = kt(null), ot = 400, mt = 300, $ = 50, d = 200, B = te.useMemo(() => {
|
|
5920
5920
|
if (!p || p === "spread") return null;
|
|
5921
5921
|
const Mt = (j == null ? void 0 : j.pieces) ?? [];
|
|
5922
5922
|
if (Mt.length <= 1) return null;
|
|
@@ -5932,7 +5932,7 @@ const Dr = Co(
|
|
|
5932
5932
|
return null;
|
|
5933
5933
|
}, [F, j]), {
|
|
5934
5934
|
isTouchDevice: K,
|
|
5935
|
-
canvasSize:
|
|
5935
|
+
canvasSize: Tt,
|
|
5936
5936
|
lastTouchTargetRef: wt,
|
|
5937
5937
|
effectiveViewPadding: jt,
|
|
5938
5938
|
paddedCanvasWidth: $t,
|
|
@@ -5953,7 +5953,7 @@ const Dr = Co(
|
|
|
5953
5953
|
artboardManager: n,
|
|
5954
5954
|
focusedPieceRect: F
|
|
5955
5955
|
}), {
|
|
5956
|
-
snapGuides:
|
|
5956
|
+
snapGuides: re,
|
|
5957
5957
|
setSnapGuides: Pe,
|
|
5958
5958
|
spacingIndicators: xe,
|
|
5959
5959
|
setSpacingIndicators: Se,
|
|
@@ -5975,7 +5975,7 @@ const Dr = Co(
|
|
|
5975
5975
|
setCursorAnimationFrame: Gt
|
|
5976
5976
|
} = Us({ elements: t }), [zt] = Dt(() => new li()), [he] = Dt(() => new ci({ showBorder: !1, showLabel: !1 })), [ce] = Dt(() => new di({ enabled: !0, showGuides: !0 })), [ze] = Dt(() => new ui({ enabled: !0, showLabels: !0 })), [He] = Dt(() => {
|
|
5977
5977
|
const Mt = new hi();
|
|
5978
|
-
return Mt.setResizePipeline(
|
|
5978
|
+
return Mt.setResizePipeline(Qn), Mt.setSnapHandler(ce), Mt;
|
|
5979
5979
|
});
|
|
5980
5980
|
Vt(() => {
|
|
5981
5981
|
he.setOptions({ borderRadius: qt });
|
|
@@ -5987,40 +5987,40 @@ const Dr = Co(
|
|
|
5987
5987
|
}, [ce, Q, B]);
|
|
5988
5988
|
const on = kt(t);
|
|
5989
5989
|
on.current = t;
|
|
5990
|
-
const
|
|
5991
|
-
|
|
5990
|
+
const At = t.find((Mt) => Mt.id === o), io = kt(At);
|
|
5991
|
+
io.current = At;
|
|
5992
5992
|
const [In, hn] = Dt("");
|
|
5993
5993
|
Vt(() => {
|
|
5994
5994
|
var ft;
|
|
5995
5995
|
if (!o) return;
|
|
5996
5996
|
const Mt = t.find((Zt) => Zt.id === o);
|
|
5997
5997
|
if (Mt)
|
|
5998
|
-
if (Mt instanceof
|
|
5998
|
+
if (Mt instanceof oe) {
|
|
5999
5999
|
const Zt = ((ft = Mt.text) == null ? void 0 : ft.slice(0, 40)) || "empty";
|
|
6000
6000
|
hn(`Selected text element: ${Zt}`);
|
|
6001
6001
|
} else Mt instanceof Ae ? hn("Selected image element") : Mt instanceof pt ? hn("Selected group") : hn("Selected element");
|
|
6002
6002
|
}, [o, t]);
|
|
6003
|
-
const
|
|
6004
|
-
|
|
6003
|
+
const jn = kt(n);
|
|
6004
|
+
jn.current = n;
|
|
6005
6005
|
const wn = kt(/* @__PURE__ */ new Map());
|
|
6006
6006
|
Vt(() => {
|
|
6007
6007
|
const Mt = (ft) => {
|
|
6008
|
-
const Zt = ft, ee =
|
|
6008
|
+
const Zt = ft, ee = jn.current.getActiveArtboardId(), ne = wn.current.get(ee) || [], ke = [];
|
|
6009
6009
|
return ne.forEach((Re) => {
|
|
6010
6010
|
Re instanceof pt ? ke.push(...Re.children) : ke.push(Re);
|
|
6011
6011
|
}), ce.snapDimensions(Zt, ke, Zt.startData);
|
|
6012
6012
|
};
|
|
6013
|
-
return
|
|
6014
|
-
|
|
6013
|
+
return Qn.addHook("afterResize", Mt), () => {
|
|
6014
|
+
Qn.removeHook("afterResize", Mt);
|
|
6015
6015
|
};
|
|
6016
6016
|
}, [ce]);
|
|
6017
|
-
const { cropController: Tn } = Ws(), { penTool: Y, penCursor:
|
|
6017
|
+
const { cropController: Tn } = Ws(), { penTool: Y, penCursor: It } = Fs({ selectedElement: At }), {
|
|
6018
6018
|
isEditing: Jt,
|
|
6019
6019
|
setIsEditing: Z,
|
|
6020
6020
|
editText: q,
|
|
6021
|
-
setEditText:
|
|
6021
|
+
setEditText: ie,
|
|
6022
6022
|
editPosition: A,
|
|
6023
|
-
setEditPosition:
|
|
6023
|
+
setEditPosition: Pt,
|
|
6024
6024
|
cursorPosition: k,
|
|
6025
6025
|
setCursorPosition: z,
|
|
6026
6026
|
selectionStart: G,
|
|
@@ -6036,7 +6036,7 @@ const Dr = Co(
|
|
|
6036
6036
|
editRichTextRef: lt,
|
|
6037
6037
|
currentFormattingStyle: it,
|
|
6038
6038
|
setCurrentFormattingStyle: Bt
|
|
6039
|
-
} = js({ selectedElement:
|
|
6039
|
+
} = js({ selectedElement: At, ref: St });
|
|
6040
6040
|
Vt(() => {
|
|
6041
6041
|
const Mt = Date.now() - Ht.current, ft = Kt.current;
|
|
6042
6042
|
ft && Mt < mt ? (G !== ft.start || dt !== ft.end) && (z(ft.cursor), J(ft.start), U(ft.end), yt.current && yt.current.setSelectionRange(ft.start, ft.end)) : ft && Mt >= mt && (Kt.current = null);
|
|
@@ -6050,13 +6050,13 @@ const Dr = Co(
|
|
|
6050
6050
|
updateMarqueeSelection: pe,
|
|
6051
6051
|
finishMarqueeSelection: Ve
|
|
6052
6052
|
} = Xs(), {
|
|
6053
|
-
multiSelectionGroupBoundsRef:
|
|
6053
|
+
multiSelectionGroupBoundsRef: se,
|
|
6054
6054
|
multiSelectionOBBRef: Ee
|
|
6055
6055
|
} = $s(r), {
|
|
6056
6056
|
activeChildElement: Ke,
|
|
6057
6057
|
updateActiveChild: Ue,
|
|
6058
6058
|
editingChildIdRef: Me
|
|
6059
|
-
} = _s({ elements: t, selectedElement:
|
|
6059
|
+
} = _s({ elements: t, selectedElement: At, transformHandles: zt, onActiveChildChange: u }), { hoverState: Xe, setHoverState: Oe } = zs({ onHoverChange: g }), Te = ln(() => {
|
|
6060
6060
|
const Mt = /* @__PURE__ */ new Map();
|
|
6061
6061
|
return t.forEach((ft) => {
|
|
6062
6062
|
const Zt = n.getArtboardIdForElement(ft.id);
|
|
@@ -6071,11 +6071,11 @@ const Dr = Co(
|
|
|
6071
6071
|
Vt(() => {
|
|
6072
6072
|
const Mt = (ee) => {
|
|
6073
6073
|
if (!Jt) {
|
|
6074
|
-
if (Y.isActive() &&
|
|
6074
|
+
if (Y.isActive() && At instanceof dn) {
|
|
6075
6075
|
if (ee.key === "Escape") {
|
|
6076
6076
|
ee.preventDefault(), Y.finishPath();
|
|
6077
|
-
const ne =
|
|
6078
|
-
l(
|
|
6077
|
+
const ne = At.clone();
|
|
6078
|
+
l(At, ne), Ct((ke) => ke + 1);
|
|
6079
6079
|
return;
|
|
6080
6080
|
} else if (ee.key === "Backspace" || ee.key === "Delete") {
|
|
6081
6081
|
ee.preventDefault(), Y.deleteLastPoint(), Ct((ne) => ne + 1);
|
|
@@ -6092,7 +6092,7 @@ const Dr = Co(
|
|
|
6092
6092
|
return window.addEventListener("keydown", Mt), window.addEventListener("keyup", ft), window.addEventListener("blur", Zt), () => {
|
|
6093
6093
|
window.removeEventListener("keydown", Mt), window.removeEventListener("keyup", ft), window.removeEventListener("blur", Zt);
|
|
6094
6094
|
};
|
|
6095
|
-
}, [Y,
|
|
6095
|
+
}, [Y, At, l, Ct, Jt]), Vt(() => {
|
|
6096
6096
|
if (!H.current || !L.current || He.getMode() === "drag" || He.getMode() === "resize")
|
|
6097
6097
|
return;
|
|
6098
6098
|
const { x: ft, y: Zt } = L.current;
|
|
@@ -6144,8 +6144,8 @@ const Dr = Co(
|
|
|
6144
6144
|
const {
|
|
6145
6145
|
handleTextEditBlur: An,
|
|
6146
6146
|
handleTextKeyDown: qe,
|
|
6147
|
-
applyFormattingToSelection:
|
|
6148
|
-
getSelectionStyle:
|
|
6147
|
+
applyFormattingToSelection: Nn,
|
|
6148
|
+
getSelectionStyle: Kn,
|
|
6149
6149
|
toggleFormattingProperty: Cn,
|
|
6150
6150
|
enterTextEditMode: Pn,
|
|
6151
6151
|
getWrappedTextForEditing: Le
|
|
@@ -6160,7 +6160,7 @@ const Dr = Co(
|
|
|
6160
6160
|
multiClickSelectionRef: Kt,
|
|
6161
6161
|
editPositionUpdateTimerRef: et,
|
|
6162
6162
|
draggingSelectionHandleRef: Ut,
|
|
6163
|
-
repositioningCursorRef:
|
|
6163
|
+
repositioningCursorRef: Rt,
|
|
6164
6164
|
editModeEnteredAtRef: Yt,
|
|
6165
6165
|
lastTouchTargetRef: wt,
|
|
6166
6166
|
MULTI_CLICK_DEBOUNCE: mt,
|
|
@@ -6172,19 +6172,19 @@ const Dr = Co(
|
|
|
6172
6172
|
selectionStart: G,
|
|
6173
6173
|
selectionEnd: dt,
|
|
6174
6174
|
selectedId: o,
|
|
6175
|
-
selectedElement:
|
|
6175
|
+
selectedElement: At,
|
|
6176
6176
|
activeChildElement: Ke,
|
|
6177
6177
|
elements: t,
|
|
6178
6178
|
zoom: w,
|
|
6179
6179
|
paddingOffsetX: V,
|
|
6180
6180
|
paddingOffsetY: le,
|
|
6181
6181
|
setIsEditing: Z,
|
|
6182
|
-
setEditText:
|
|
6182
|
+
setEditText: ie,
|
|
6183
6183
|
setEditRichText: D,
|
|
6184
6184
|
setCursorPosition: z,
|
|
6185
6185
|
setSelectionStart: J,
|
|
6186
6186
|
setSelectionEnd: U,
|
|
6187
|
-
setEditPosition:
|
|
6187
|
+
setEditPosition: Pt,
|
|
6188
6188
|
setCurrentFormattingStyle: Bt,
|
|
6189
6189
|
setCursorAnimationFrame: Gt,
|
|
6190
6190
|
setHandlesVersion: Ct,
|
|
@@ -6201,7 +6201,7 @@ const Dr = Co(
|
|
|
6201
6201
|
} = Ha({
|
|
6202
6202
|
canvasRef: H,
|
|
6203
6203
|
inputRef: yt,
|
|
6204
|
-
repositioningCursorRef:
|
|
6204
|
+
repositioningCursorRef: Rt,
|
|
6205
6205
|
lastClickTimeRef: gt,
|
|
6206
6206
|
clickCountRef: bt,
|
|
6207
6207
|
lastProcessedClickTimeRef: ye,
|
|
@@ -6216,7 +6216,7 @@ const Dr = Co(
|
|
|
6216
6216
|
editingChildIdRef: Me,
|
|
6217
6217
|
editRichTextRef: lt,
|
|
6218
6218
|
editModeEnteredAtRef: Yt,
|
|
6219
|
-
multiSelectionGroupBoundsRef:
|
|
6219
|
+
multiSelectionGroupBoundsRef: se,
|
|
6220
6220
|
MULTI_CLICK_THRESHOLD: ot,
|
|
6221
6221
|
MULTI_CLICK_DEBOUNCE: mt,
|
|
6222
6222
|
CLICK_DEDUP_THRESHOLD: $,
|
|
@@ -6228,7 +6228,7 @@ const Dr = Co(
|
|
|
6228
6228
|
isRotating: be,
|
|
6229
6229
|
isMarqueeSelecting: Nt,
|
|
6230
6230
|
isAltKeyPressed: De,
|
|
6231
|
-
selectedElement:
|
|
6231
|
+
selectedElement: At,
|
|
6232
6232
|
activeChildElement: Ke,
|
|
6233
6233
|
elements: t,
|
|
6234
6234
|
multiSelection: r,
|
|
@@ -6270,8 +6270,8 @@ const Dr = Co(
|
|
|
6270
6270
|
updateMarqueeSelection: pe,
|
|
6271
6271
|
finishMarqueeSelection: Ve,
|
|
6272
6272
|
enterTextEditMode: Pn,
|
|
6273
|
-
setEditPosition:
|
|
6274
|
-
setEditText:
|
|
6273
|
+
setEditPosition: Pt,
|
|
6274
|
+
setEditText: ie,
|
|
6275
6275
|
setEditRichText: D,
|
|
6276
6276
|
setIsEditing: Z,
|
|
6277
6277
|
setCurrentFormattingStyle: Bt,
|
|
@@ -6285,12 +6285,12 @@ const Dr = Co(
|
|
|
6285
6285
|
artboardManager: n,
|
|
6286
6286
|
artboardRenderer: he,
|
|
6287
6287
|
selectedId: o,
|
|
6288
|
-
selectedElement:
|
|
6288
|
+
selectedElement: At,
|
|
6289
6289
|
activeChildElement: Ke,
|
|
6290
6290
|
editingChildIdRef: Me,
|
|
6291
6291
|
transformHandles: zt,
|
|
6292
6292
|
stateMachine: He,
|
|
6293
|
-
canvasSize:
|
|
6293
|
+
canvasSize: Tt,
|
|
6294
6294
|
paddedCanvasWidth: $t,
|
|
6295
6295
|
paddedCanvasHeight: O,
|
|
6296
6296
|
paddingOffsetX: V,
|
|
@@ -6315,12 +6315,12 @@ const Dr = Co(
|
|
|
6315
6315
|
multiClickSelectionRef: Kt,
|
|
6316
6316
|
lastMultiClickTimeRef: Ht,
|
|
6317
6317
|
MULTI_CLICK_DEBOUNCE: mt,
|
|
6318
|
-
snapGuides:
|
|
6318
|
+
snapGuides: re,
|
|
6319
6319
|
spacingIndicators: xe,
|
|
6320
6320
|
isAltKeyPressed: De,
|
|
6321
6321
|
multiSelection: r,
|
|
6322
6322
|
multiSelectionOBBRef: Ee,
|
|
6323
|
-
multiSelectionGroupBoundsRef:
|
|
6323
|
+
multiSelectionGroupBoundsRef: se,
|
|
6324
6324
|
isMarqueeSelecting: Nt,
|
|
6325
6325
|
marqueeStart: de,
|
|
6326
6326
|
marqueeEnd: we,
|
|
@@ -6338,14 +6338,14 @@ const Dr = Co(
|
|
|
6338
6338
|
St,
|
|
6339
6339
|
() => ({
|
|
6340
6340
|
applyTextFormatting: (Mt) => {
|
|
6341
|
-
|
|
6341
|
+
Nn(Mt);
|
|
6342
6342
|
},
|
|
6343
6343
|
toggleFormattingProperty: (Mt) => {
|
|
6344
6344
|
Cn(Mt);
|
|
6345
6345
|
},
|
|
6346
6346
|
isEditingText: () => Jt,
|
|
6347
6347
|
isRotating: () => be,
|
|
6348
|
-
getSelectionStyle: () =>
|
|
6348
|
+
getSelectionStyle: () => Kn(),
|
|
6349
6349
|
getZoom: () => w,
|
|
6350
6350
|
forceRender: Ot,
|
|
6351
6351
|
getEditingState: () => ({
|
|
@@ -6356,12 +6356,12 @@ const Dr = Co(
|
|
|
6356
6356
|
selectionEnd: dt
|
|
6357
6357
|
}),
|
|
6358
6358
|
getCropState: () => ({
|
|
6359
|
-
isCropping:
|
|
6360
|
-
elementId: (
|
|
6359
|
+
isCropping: At instanceof Ae && At.isCropping,
|
|
6360
|
+
elementId: (At == null ? void 0 : At.id) || null
|
|
6361
6361
|
}),
|
|
6362
6362
|
getPaddingOffset: () => ({ x: V, y: le })
|
|
6363
6363
|
}),
|
|
6364
|
-
[
|
|
6364
|
+
[Nn, Cn, Jt, be, Kn, w, Ot, q, k, G, dt, At, V, le]
|
|
6365
6365
|
);
|
|
6366
6366
|
const Br = ln(() => {
|
|
6367
6367
|
if (!I || I.length === 0) return;
|
|
@@ -6429,7 +6429,7 @@ const Dr = Co(
|
|
|
6429
6429
|
background: j ? "transparent" : "var(--color-canvas-bg)",
|
|
6430
6430
|
width: `${$t * w}px`,
|
|
6431
6431
|
height: `${O * w}px`,
|
|
6432
|
-
cursor: Y.isActive() &&
|
|
6432
|
+
cursor: Y.isActive() && At instanceof dn ? It : void 0,
|
|
6433
6433
|
position: "absolute",
|
|
6434
6434
|
left: `${v}px`,
|
|
6435
6435
|
top: `${N}px`,
|
|
@@ -6439,12 +6439,12 @@ const Dr = Co(
|
|
|
6439
6439
|
}
|
|
6440
6440
|
),
|
|
6441
6441
|
Jt && (() => {
|
|
6442
|
-
let Mt =
|
|
6443
|
-
if (Me.current &&
|
|
6444
|
-
const Qt =
|
|
6442
|
+
let Mt = At;
|
|
6443
|
+
if (Me.current && At instanceof pt) {
|
|
6444
|
+
const Qt = At.children.find((Ft) => Ft.id === Me.current);
|
|
6445
6445
|
Qt && (Mt = Qt);
|
|
6446
6446
|
}
|
|
6447
|
-
const ft = Mt instanceof
|
|
6447
|
+
const ft = Mt instanceof oe ? Mt : null, Zt = (ft == null ? void 0 : ft.fontSize) || 24, ee = (ft == null ? void 0 : ft.fontFamily) || "Arial", ne = (ft == null ? void 0 : ft.bold) || !1, ke = (ft == null ? void 0 : ft.italic) || !1, Re = (ft == null ? void 0 : ft.textAlign) || "center", ge = /* @__PURE__ */ ue(
|
|
6448
6448
|
"textarea",
|
|
6449
6449
|
{
|
|
6450
6450
|
ref: yt,
|
|
@@ -6454,7 +6454,7 @@ const Dr = Co(
|
|
|
6454
6454
|
const Ft = Qt.target.value;
|
|
6455
6455
|
if (!T) {
|
|
6456
6456
|
const Fe = oi.fromPlainText(Ft, {});
|
|
6457
|
-
lt.current = Fe, D(Fe),
|
|
6457
|
+
lt.current = Fe, D(Fe), ie(Ft);
|
|
6458
6458
|
const Dn = Qt.target.selectionEnd;
|
|
6459
6459
|
z(Dn), J(Qt.target.selectionStart), U(Qt.target.selectionEnd);
|
|
6460
6460
|
return;
|
|
@@ -6469,9 +6469,9 @@ const Dr = Co(
|
|
|
6469
6469
|
const Ge = Be, gn = ae.length - Ye, mn = Ft.substring(Be, Ft.length - Ye);
|
|
6470
6470
|
if (gn > Ge && rn.delete(Ge, gn), mn.length > 0) {
|
|
6471
6471
|
let Fe;
|
|
6472
|
-
it ? Fe = it : Ge > 0 ? Fe = rn.getStyleAt(Ge - 1) :
|
|
6472
|
+
it ? Fe = it : Ge > 0 ? Fe = rn.getStyleAt(Ge - 1) : At instanceof oe ? Fe = At.getDefaultStyle() : Fe = {}, rn.insert(Ge, mn, Fe);
|
|
6473
6473
|
}
|
|
6474
|
-
lt.current = rn, D(rn),
|
|
6474
|
+
lt.current = rn, D(rn), ie(Ft);
|
|
6475
6475
|
const Je = Qt.target.selectionEnd;
|
|
6476
6476
|
z(Je), J(Qt.target.selectionStart), U(Qt.target.selectionEnd), C.current = Je;
|
|
6477
6477
|
const sn = Qt.target;
|
|
@@ -6482,11 +6482,11 @@ const Dr = Co(
|
|
|
6482
6482
|
onBlur: An,
|
|
6483
6483
|
onKeyDown: qe,
|
|
6484
6484
|
onPointerDown: (Qt) => {
|
|
6485
|
-
if (Qt.preventDefault(), !
|
|
6485
|
+
if (Qt.preventDefault(), !At || !(At instanceof oe) || !H.current) return;
|
|
6486
6486
|
const Ft = Date.now();
|
|
6487
6487
|
if (Ft - ye.current < $) return;
|
|
6488
6488
|
ye.current = Ft, Ft - Ht.current >= mt && (Kt.current = null);
|
|
6489
|
-
const ae = H.current.getBoundingClientRect(), rn = (Qt.clientX - ae.left) / w - V, Be = (Qt.clientY - ae.top) / w - le, Ye =
|
|
6489
|
+
const ae = H.current.getBoundingClientRect(), rn = (Qt.clientX - ae.left) / w - V, Be = (Qt.clientY - ae.top) / w - le, Ye = At.getVisualBoundingBox(), Ge = At.getRotationAnchor(), gn = _e.toRadiansInverse(At.rotation), mn = rn - Ge.x, Je = Be - Ge.y, sn = Math.cos(gn), Fe = Math.sin(gn), Dn = mn * sn - Je * Fe, so = mn * Fe + Je * sn, ao = Dn + Ye.width / 2, bn = so + Ye.height / 2, $e = un(At, { x: ao, y: bn });
|
|
6490
6490
|
Ft - gt.current < ot ? bt.current += 1 : bt.current = 1, gt.current = Ft;
|
|
6491
6491
|
const tn = q;
|
|
6492
6492
|
if (_.current = !1, bt.current >= 3)
|
|
@@ -6500,19 +6500,19 @@ const Dr = Co(
|
|
|
6500
6500
|
},
|
|
6501
6501
|
onPointerMove: (Qt) => {
|
|
6502
6502
|
if (Qt.buttons !== 1) return;
|
|
6503
|
-
if (Ut.current &&
|
|
6504
|
-
const Ln = H.current.getBoundingClientRect(), tn = (Qt.clientX - Ln.left) / w - V, Ze = (Qt.clientY - Ln.top) / w - le, Ao =
|
|
6505
|
-
let
|
|
6506
|
-
Ut.current === "start" && (en != null && en.start) ?
|
|
6507
|
-
const Or = Hr + Ao.width / 2, Yr = Xr +
|
|
6503
|
+
if (Ut.current && At instanceof oe && H.current) {
|
|
6504
|
+
const Ln = H.current.getBoundingClientRect(), tn = (Qt.clientX - Ln.left) / w - V, Ze = (Qt.clientY - Ln.top) / w - le, Ao = At.getVisualBoundingBox(), Po = At.getRotationAnchor(), Do = _e.toRadiansInverse(At.rotation), Lo = tn - Po.x, Bo = Ze - Po.y, Ho = Math.cos(Do), Xo = Math.sin(Do), Hr = Lo * Ho - Bo * Xo, Xr = Lo * Xo + Bo * Ho, en = ve.current;
|
|
6505
|
+
let lo = 0;
|
|
6506
|
+
Ut.current === "start" && (en != null && en.start) ? lo = en.start.textEdge.y - en.start.center.y : Ut.current === "end" && (en != null && en.end) && (lo = en.end.textEdge.y - en.end.center.y);
|
|
6507
|
+
const Or = Hr + Ao.width / 2, Yr = Xr + lo + Ao.height / 2, nn = un(At, { x: Or, y: Yr });
|
|
6508
6508
|
if (Ut.current === "start" ? nn <= dt ? (J(nn), z(nn)) : (J(dt), U(nn), z(nn), Ut.current = "end") : nn >= G ? (U(nn), z(nn)) : (U(G), J(nn), z(nn), Ut.current = "start"), yt.current) {
|
|
6509
6509
|
const Fr = Math.min(G, dt), _r = Math.max(G, dt);
|
|
6510
6510
|
yt.current.setSelectionRange(Fr, _r);
|
|
6511
6511
|
}
|
|
6512
6512
|
return;
|
|
6513
6513
|
}
|
|
6514
|
-
if (Lt.current || !
|
|
6515
|
-
const Ft = H.current.getBoundingClientRect(), ae = (Qt.clientX - Ft.left) / w - V, rn = (Qt.clientY - Ft.top) / w - le, Be =
|
|
6514
|
+
if (Lt.current || !At || !(At instanceof oe) || !H.current) return;
|
|
6515
|
+
const Ft = H.current.getBoundingClientRect(), ae = (Qt.clientX - Ft.left) / w - V, rn = (Qt.clientY - Ft.top) / w - le, Be = At.getVisualBoundingBox(), Ye = At.getRotationAnchor(), Ge = _e.toRadiansInverse(At.rotation), gn = ae - Ye.x, mn = rn - Ye.y, Je = Math.cos(Ge), sn = Math.sin(Ge), Fe = gn * Je - mn * sn, Dn = gn * sn + mn * Je, so = Fe + Be.width / 2, ao = Dn + Be.height / 2, bn = un(At, { x: so, y: ao }), $e = C.current;
|
|
6516
6516
|
if ($e !== bn && (_.current = !0), U(bn), z(bn), J($e), yt.current) {
|
|
6517
6517
|
const Ln = Math.min($e, bn), tn = Math.max($e, bn);
|
|
6518
6518
|
yt.current.setSelectionRange(Ln, tn);
|
|
@@ -6590,7 +6590,7 @@ const Oa = 0.25, Ya = 8, Fa = 0.1, _a = 4, za = 1e-3, sl = ({
|
|
|
6590
6590
|
handleElementUpdate: v,
|
|
6591
6591
|
setElements: N,
|
|
6592
6592
|
executeElementUpdate: W
|
|
6593
|
-
} =
|
|
6593
|
+
} = Wn(), {
|
|
6594
6594
|
zoom: M,
|
|
6595
6595
|
setZoom: P,
|
|
6596
6596
|
panOffset: E,
|
|
@@ -6606,7 +6606,7 @@ const Oa = 0.25, Ya = 8, Fa = 0.1, _a = 4, za = 1e-3, sl = ({
|
|
|
6606
6606
|
handleSelectionChange: Et,
|
|
6607
6607
|
setMultiSelection: H,
|
|
6608
6608
|
handleActiveChildChange: yt,
|
|
6609
|
-
setHoveredElementId:
|
|
6609
|
+
setHoveredElementId: Rt,
|
|
6610
6610
|
hideHandles: gt
|
|
6611
6611
|
} = jr(), {
|
|
6612
6612
|
setTextSelectionVersion: bt,
|
|
@@ -6686,7 +6686,7 @@ const Oa = 0.25, Ya = 8, Fa = 0.1, _a = 4, za = 1e-3, sl = ({
|
|
|
6686
6686
|
};
|
|
6687
6687
|
return window.addEventListener("pointerup", st), () => window.removeEventListener("pointerup", st);
|
|
6688
6688
|
}, [s, rt, I]);
|
|
6689
|
-
const
|
|
6689
|
+
const Tt = te.useMemo(() => {
|
|
6690
6690
|
if (!y || !x) return null;
|
|
6691
6691
|
const st = x.pieces ?? [];
|
|
6692
6692
|
if (st.length <= 1) return null;
|
|
@@ -6699,7 +6699,7 @@ const Oa = 0.25, Ya = 8, Fa = 0.1, _a = 4, za = 1e-3, sl = ({
|
|
|
6699
6699
|
} : null;
|
|
6700
6700
|
const ut = st.find((at) => at.id === y.pieceId);
|
|
6701
6701
|
return ut ? { x: ut.x, y: ut.y, width: ut.width, height: ut.height } : null;
|
|
6702
|
-
}, [y, x, d]), wt = Ls(
|
|
6702
|
+
}, [y, x, d]), wt = Ls(Tt);
|
|
6703
6703
|
te.useEffect(() => {
|
|
6704
6704
|
if (r !== void 0) {
|
|
6705
6705
|
ye(r);
|
|
@@ -6759,12 +6759,12 @@ const Oa = 0.25, Ya = 8, Fa = 0.1, _a = 4, za = 1e-3, sl = ({
|
|
|
6759
6759
|
}, [wt, Q]), te.useEffect(() => {
|
|
6760
6760
|
s && M !== tt.current && M > 0 && (ye(M), tt.current = M);
|
|
6761
6761
|
}, [s, M]);
|
|
6762
|
-
const O = wt ? wt.width : (d == null ? void 0 : d.width) ?? 0, V = wt ? wt.height : (d == null ? void 0 : d.height) ?? 0, le = O * jt, qt = V * jt,
|
|
6762
|
+
const O = wt ? wt.width : (d == null ? void 0 : d.width) ?? 0, V = wt ? wt.height : (d == null ? void 0 : d.height) ?? 0, le = O * jt, qt = V * jt, re = O * Kt;
|
|
6763
6763
|
let Pe = d ? a !== void 0 ? qt + a * 2 : qt / i : 0;
|
|
6764
6764
|
c !== void 0 && Pe > c && (Pe = c);
|
|
6765
6765
|
let xe = a, Se = a;
|
|
6766
6766
|
const De = ((Ne = Ht.current) == null ? void 0 : Ne.clientWidth) || Ut;
|
|
6767
|
-
a !== void 0 && L && De > 0 &&
|
|
6767
|
+
a !== void 0 && L && De > 0 && re > 0 && (xe = (De - re) / 2);
|
|
6768
6768
|
const Ie = Pe, be = te.useRef({ w: 0, h: 0 });
|
|
6769
6769
|
te.useEffect(() => {
|
|
6770
6770
|
const st = Ht.current;
|
|
@@ -6870,7 +6870,7 @@ const Oa = 0.25, Ya = 8, Fa = 0.1, _a = 4, za = 1e-3, sl = ({
|
|
|
6870
6870
|
onMultiSelectionChange: H,
|
|
6871
6871
|
onActiveChildChange: yt,
|
|
6872
6872
|
onTextSelectionChange: () => bt((st) => st + 1),
|
|
6873
|
-
onHoverChange:
|
|
6873
|
+
onHoverChange: Rt,
|
|
6874
6874
|
onCropModeEnter: Lt,
|
|
6875
6875
|
hideHandles: gt,
|
|
6876
6876
|
canvasRef: f,
|
|
@@ -7013,7 +7013,7 @@ const mo = Rn("useArtboards"), al = () => {
|
|
|
7013
7013
|
refreshArtboards: n,
|
|
7014
7014
|
setSelectedId: o,
|
|
7015
7015
|
setMultiSelection: r
|
|
7016
|
-
} =
|
|
7016
|
+
} = Wn(), i = e.getActiveArtboardId(), s = e.getActiveArtboard(), l = ln(() => t.map((f) => {
|
|
7017
7017
|
const b = e.getElementsOnArtboard(f.id).length;
|
|
7018
7018
|
return {
|
|
7019
7019
|
id: f.id,
|
|
@@ -7105,11 +7105,11 @@ function ll() {
|
|
|
7105
7105
|
artboardManager: e,
|
|
7106
7106
|
elements: n,
|
|
7107
7107
|
canvasRef: o
|
|
7108
|
-
} =
|
|
7108
|
+
} = Wn(), [r, i] = Dt(!1), [s, l] = Dt(!1), [a, c] = Dt([]), [u, h] = Dt({}), [g, x] = Dt({
|
|
7109
7109
|
totalExports: 0,
|
|
7110
7110
|
avgExportTime: 0,
|
|
7111
7111
|
isWorkerActive: !1
|
|
7112
|
-
}), y = kt(0), S = kt(null), f =
|
|
7112
|
+
}), y = kt(0), S = kt(null), f = uo.supportsWorkerExport(), m = xt(async (P, E = {}) => {
|
|
7113
7113
|
const R = t.find((I) => I.id === P);
|
|
7114
7114
|
if (!R)
|
|
7115
7115
|
throw new Error(`[useExport] Artboard ${P} not found`);
|
|
@@ -7125,7 +7125,7 @@ function ll() {
|
|
|
7125
7125
|
};
|
|
7126
7126
|
c((I) => [...I, rt]);
|
|
7127
7127
|
try {
|
|
7128
|
-
const I = Date.now(), j = w.current, p = e.getElementsOnArtboard(P), Q = j.filter((Et) => p.includes(Et.id)), St = await
|
|
7128
|
+
const I = Date.now(), j = w.current, p = e.getElementsOnArtboard(P), Q = j.filter((Et) => p.includes(Et.id)), St = await uo.exportArtboardToDataURL(
|
|
7129
7129
|
R,
|
|
7130
7130
|
Q,
|
|
7131
7131
|
o.current,
|
|
@@ -7174,7 +7174,7 @@ function ll() {
|
|
|
7174
7174
|
i(!0);
|
|
7175
7175
|
try {
|
|
7176
7176
|
const rt = w.current, I = e.getElementsOnArtboard(P), j = rt.filter((Q) => I.includes(Q.id));
|
|
7177
|
-
return await
|
|
7177
|
+
return await uo.exportArtboardToBlob(
|
|
7178
7178
|
R,
|
|
7179
7179
|
j,
|
|
7180
7180
|
o.current,
|
|
@@ -7222,10 +7222,10 @@ function ll() {
|
|
|
7222
7222
|
transparentBackground: !0
|
|
7223
7223
|
});
|
|
7224
7224
|
return { id: gt.id, dataUrl: bt };
|
|
7225
|
-
}), yt = await Promise.all(H),
|
|
7225
|
+
}), yt = await Promise.all(H), Rt = {};
|
|
7226
7226
|
for (const { id: gt, dataUrl: bt } of yt)
|
|
7227
|
-
|
|
7228
|
-
h((gt) => ({ ...gt, ...
|
|
7227
|
+
Rt[gt] = bt;
|
|
7228
|
+
h((gt) => ({ ...gt, ...Rt })), p && p(Rt);
|
|
7229
7229
|
} catch (H) {
|
|
7230
7230
|
$a.error("[useExport] Continuous export error:", H);
|
|
7231
7231
|
}
|
|
@@ -7583,7 +7583,7 @@ function kn(t, e) {
|
|
|
7583
7583
|
n.has(r) || (n.add(r), o.push(r));
|
|
7584
7584
|
return o;
|
|
7585
7585
|
}
|
|
7586
|
-
function
|
|
7586
|
+
function Gn(t, e) {
|
|
7587
7587
|
return { ...t, ...e };
|
|
7588
7588
|
}
|
|
7589
7589
|
const Na = ["topbar", "left", "canvas", "right", "bottombar"];
|
|
@@ -7602,11 +7602,11 @@ function Ka(t, e) {
|
|
|
7602
7602
|
tools: s.tools,
|
|
7603
7603
|
features: { ...s.features }
|
|
7604
7604
|
};
|
|
7605
|
-
l && (l.elements && (a.elements = kn(s.elements, l.elements)), l.transforms && (a.transforms = kn(s.transforms, l.transforms)), l.effects && (a.effects = kn(s.effects, l.effects)), l.panels && (a.panels = kn(s.panels, l.panels)), l.tools && (a.tools = kn(s.tools, l.tools)), l.features && (a.features =
|
|
7605
|
+
l && (l.elements && (a.elements = kn(s.elements, l.elements)), l.transforms && (a.transforms = kn(s.transforms, l.transforms)), l.effects && (a.effects = kn(s.effects, l.effects)), l.panels && (a.panels = kn(s.panels, l.panels)), l.tools && (a.tools = kn(s.tools, l.tools)), l.features && (a.features = Gn(
|
|
7606
7606
|
s.features,
|
|
7607
7607
|
l.features
|
|
7608
7608
|
)));
|
|
7609
|
-
const c = e.behavior ?
|
|
7609
|
+
const c = e.behavior ? Gn(t.behavior, e.behavior) : { ...t.behavior }, u = e.style ? Gn(t.style, e.style) : { ...t.style }, h = t.content ?? {}, g = e.content ? Gn(h, e.content) : { ...h };
|
|
7610
7610
|
return {
|
|
7611
7611
|
name: n,
|
|
7612
7612
|
layout: { slots: i },
|
|
@@ -7687,4 +7687,4 @@ export {
|
|
|
7687
7687
|
al as u,
|
|
7688
7688
|
pl as v
|
|
7689
7689
|
};
|
|
7690
|
-
//# sourceMappingURL=compose-
|
|
7690
|
+
//# sourceMappingURL=compose-DIPiisIw.js.map
|