@snowcone-app/canvas 0.21.1 → 0.21.3
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/STYLING_CONTRACT.md +14 -0
- package/dist/{CanvasRenderer-CwiYq8qg.js → CanvasRenderer-6_HhR4-q.js} +170 -188
- package/dist/CanvasRenderer-6_HhR4-q.js.map +1 -0
- package/dist/{CanvasStateV1-BFabcAKC.js → CanvasStateV1-DmZ1Qvvn.js} +38 -38
- package/dist/{CanvasStateV1-BFabcAKC.js.map → CanvasStateV1-DmZ1Qvvn.js.map} +1 -1
- package/dist/{ContextualToolbars--vTtorNg.js → ContextualToolbars-BDEt9ND0.js} +2047 -2324
- package/dist/ContextualToolbars-BDEt9ND0.js.map +1 -0
- package/dist/{EditorCanvasImpl-2ZgIUVpK.js → EditorCanvasImpl-M7rw1c1k.js} +8 -8
- package/dist/{EditorCanvasImpl-2ZgIUVpK.js.map → EditorCanvasImpl-M7rw1c1k.js.map} +1 -1
- package/dist/{ExportManager-DK7CdI-G.js → ExportManager-DoU4VK6h.js} +603 -498
- package/dist/ExportManager-DoU4VK6h.js.map +1 -0
- package/dist/{FontAnalyzer-BpsTYowD.js → FontAnalyzer-CwIpgTGd.js} +309 -299
- package/dist/{FontAnalyzer-BpsTYowD.js.map → FontAnalyzer-CwIpgTGd.js.map} +1 -1
- package/dist/ImagePanel-BwqFDKvW.js +951 -0
- package/dist/ImagePanel-BwqFDKvW.js.map +1 -0
- package/dist/{SnowconeCanvas-DqZicdxK.js → SnowconeCanvas-Cx7nXlBI.js} +22 -21
- package/dist/{SnowconeCanvas-DqZicdxK.js.map → SnowconeCanvas-Cx7nXlBI.js.map} +1 -1
- package/dist/{UnifiedFontService-B1PGVu8O.js → UnifiedFontService-CC3CSmH5.js} +1242 -1188
- package/dist/UnifiedFontService-CC3CSmH5.js.map +1 -0
- package/dist/advanced.mjs +100 -99
- package/dist/advanced.mjs.map +1 -1
- package/dist/components/editor/LazyImageBrowser.d.ts +7 -0
- package/dist/components/editor/commerceStore.d.ts +13 -0
- package/dist/custom-icons-BW6hqmkL.js +236 -0
- package/dist/custom-icons-BW6hqmkL.js.map +1 -0
- package/dist/{design-builder-CPF60RU2.js → design-builder-CT4DHIPe.js} +2 -2
- package/dist/{design-builder-CPF60RU2.js.map → design-builder-CT4DHIPe.js.map} +1 -1
- package/dist/{editorErrors-CK1RISFa.js → editorErrors-B2mb1sVN.js} +2 -2
- package/dist/{editorErrors-CK1RISFa.js.map → editorErrors-B2mb1sVN.js.map} +1 -1
- package/dist/{embed-2tp6Ue90.js → embed-QBZkgWDr.js} +288 -273
- package/dist/{embed-2tp6Ue90.js.map → embed-QBZkgWDr.js.map} +1 -1
- package/dist/embed.mjs +6 -6
- package/dist/guards-8rkFAMBs.js +24 -0
- package/dist/guards-8rkFAMBs.js.map +1 -0
- package/dist/index.mjs +8 -8
- package/dist/internals.mjs +11 -11
- package/dist/rendering/element-painters.d.ts +4 -2
- package/dist/style.css +1 -1
- package/dist/{template-fields-FgImixyv.js → template-fields-C2pSfMBh.js} +59 -41
- package/dist/template-fields-C2pSfMBh.js.map +1 -0
- package/dist/testing.mjs +4 -4
- package/dist/{usePieceGuideBundle-Ctnu5k2D.js → usePieceGuideBundle-CbJJg66S.js} +2 -2
- package/dist/{usePieceGuideBundle-Ctnu5k2D.js.map → usePieceGuideBundle-CbJJg66S.js.map} +1 -1
- package/dist/validation-C9Fe9ahK.js +8367 -0
- package/dist/validation-C9Fe9ahK.js.map +1 -0
- package/example/package.json +1 -1
- package/package.json +3 -2
- package/dist/CanvasRenderer-CwiYq8qg.js.map +0 -1
- package/dist/ContextualToolbars--vTtorNg.js.map +0 -1
- package/dist/ExportManager-DK7CdI-G.js.map +0 -1
- package/dist/UnifiedFontService-B1PGVu8O.js.map +0 -1
- package/dist/template-fields-FgImixyv.js.map +0 -1
- package/dist/validation-3YEMnKLB.js +0 -9308
- package/dist/validation-3YEMnKLB.js.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { V as
|
|
2
|
-
import { T as Bt, a as
|
|
1
|
+
import { V as te, X as ee, ar as tt, Y as zt, aE as ne, aC as se, av as Vt, aB as oe, au as ht, aF as ie, aG as Ft, aH as ae, aI as re, c as $t, aJ as le, aK as he, aL as ce, aM as de, a3 as jt, $ as qt, a5 as ft, a0 as Ut, a1 as Ht, a4 as fe, a7 as ge, aN as Ot, aO as ue, aP as pe, aQ as ye, I as be, aR as Se, aS as me, aT as Q } from "./FontAnalyzer-CwIpgTGd.js";
|
|
2
|
+
import { T as Bt, a as Te, u as ve, K as we, z as kt, L as Yt, M as Ce, N as Me, O as xe } from "./ExportManager-DoU4VK6h.js";
|
|
3
|
+
import { i as Lt, a as Re } from "./guards-8rkFAMBs.js";
|
|
3
4
|
const it = {
|
|
4
5
|
// Canvas-specific
|
|
5
6
|
canvas: {
|
|
@@ -14,30 +15,30 @@ const it = {
|
|
|
14
15
|
spacingLabelFontSize: 11,
|
|
15
16
|
spacingLabelFontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
16
17
|
}
|
|
17
|
-
},
|
|
18
|
-
function
|
|
19
|
-
return
|
|
18
|
+
}, ke = 2, Mt = 6, Pe = 16, Ae = 5, Ee = 5, Zt = 0.5;
|
|
19
|
+
function Gt(M) {
|
|
20
|
+
return ke / M;
|
|
20
21
|
}
|
|
21
|
-
function
|
|
22
|
-
return Mt /
|
|
22
|
+
function Fe(M) {
|
|
23
|
+
return Mt / M;
|
|
23
24
|
}
|
|
24
|
-
function
|
|
25
|
-
return
|
|
25
|
+
function Ie(M) {
|
|
26
|
+
return Pe / M;
|
|
26
27
|
}
|
|
27
|
-
function
|
|
28
|
-
return [
|
|
28
|
+
function Oe(M) {
|
|
29
|
+
return [Ae / M, Ee / M];
|
|
29
30
|
}
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
const n =
|
|
33
|
-
|
|
31
|
+
function He(M, t, e, o) {
|
|
32
|
+
M.save();
|
|
33
|
+
const n = Zt / o;
|
|
34
|
+
M.translate(t, e), M.scale(n, n), M.strokeStyle = "#000", M.lineWidth = 1.5, M.lineCap = "round", M.lineJoin = "round", M.translate(-12, -12), M.beginPath(), M.moveTo(21, 12), M.arc(12, 12, 9, 0, -Math.PI / 2, !0), M.bezierCurveTo(3.5, 4.5, 4, 6, 3, 8), M.stroke(), M.beginPath(), M.moveTo(3, 3), M.lineTo(3, 8), M.lineTo(8, 8), M.stroke(), M.beginPath(), M.moveTo(3, 12), M.arc(12, 12, 9, Math.PI, Math.PI / 2, !0), M.bezierCurveTo(20.5, 19.5, 20, 18, 21, 16), M.stroke(), M.beginPath(), M.moveTo(16, 16), M.lineTo(21, 16), M.lineTo(21, 21), M.stroke(), M.restore();
|
|
34
35
|
}
|
|
35
|
-
function
|
|
36
|
-
const i =
|
|
37
|
-
|
|
36
|
+
function Ye(M, t, e, o = 1, n = "#3b82f6", s = !1) {
|
|
37
|
+
const i = Ie(o);
|
|
38
|
+
M.save(), M.fillStyle = "#fff", M.strokeStyle = n, M.lineWidth = s ? Gt(o) * 1.25 : Gt(o), M.beginPath(), M.arc(t, e, i, 0, Math.PI * 2), M.fill(), M.stroke(), He(M, t, e, o), M.restore();
|
|
38
39
|
}
|
|
39
40
|
const Xt = Mt * 2;
|
|
40
|
-
class
|
|
41
|
+
class Ge {
|
|
41
42
|
constructor() {
|
|
42
43
|
this.resizeHandles = [], this.rotationHandle = null, this.elementRotation = 0, this.rotationAnchor = { x: 0, y: 0 };
|
|
43
44
|
}
|
|
@@ -54,8 +55,8 @@ class Ne {
|
|
|
54
55
|
y: n.y - a,
|
|
55
56
|
width: n.width + a * 2,
|
|
56
57
|
height: n.height + a * 2
|
|
57
|
-
}, l =
|
|
58
|
-
this.resizeHandles = l.filter((c) => !(!i.includes(c.anchor) || h && c.anchor.includes("middle"))), this.rotationHandle =
|
|
58
|
+
}, l = te(r, t.rotation, s), h = Math.abs(t.rotation % 360) > 0.1;
|
|
59
|
+
this.resizeHandles = l.filter((c) => !(!i.includes(c.anchor) || h && c.anchor.includes("middle"))), this.rotationHandle = ee(
|
|
59
60
|
r,
|
|
60
61
|
t.rotation,
|
|
61
62
|
s,
|
|
@@ -98,7 +99,7 @@ class Ne {
|
|
|
98
99
|
t.save();
|
|
99
100
|
const s = e.x * n, i = e.y * n, a = Mt * 2.67;
|
|
100
101
|
t.fillStyle = "#fff", t.strokeStyle = tt(t.canvas), t.lineWidth = o ? 2.5 : 2, t.beginPath(), t.arc(s, i, a, 0, Math.PI * 2), t.fill(), t.stroke();
|
|
101
|
-
const r =
|
|
102
|
+
const r = Zt;
|
|
102
103
|
t.translate(s, i), t.scale(r, r), t.strokeStyle = "#000", t.lineWidth = 1.5, t.lineCap = "round", t.lineJoin = "round", t.translate(-12, -12), t.beginPath(), t.moveTo(21, 12), t.arc(12, 12, 9, 0, -Math.PI / 2, !0), t.bezierCurveTo(3.5, 4.5, 4, 6, 3, 8), t.stroke(), t.beginPath(), t.moveTo(3, 3), t.lineTo(3, 8), t.lineTo(8, 8), t.stroke(), t.beginPath(), t.moveTo(3, 12), t.arc(12, 12, 9, Math.PI, Math.PI / 2, !0), t.bezierCurveTo(20.5, 19.5, 20, 18, 21, 16), t.stroke(), t.beginPath(), t.moveTo(16, 16), t.lineTo(21, 16), t.lineTo(21, 21), t.stroke(), t.restore();
|
|
103
104
|
}
|
|
104
105
|
/**
|
|
@@ -114,7 +115,7 @@ class Ne {
|
|
|
114
115
|
* @param zoom - Current zoom level (radius scales inversely with zoom)
|
|
115
116
|
*/
|
|
116
117
|
hitTestResize(t, e, o = 1) {
|
|
117
|
-
const n =
|
|
118
|
+
const n = se / o;
|
|
118
119
|
for (const s of this.resizeHandles)
|
|
119
120
|
if (zt(t, e, s.x, s.y, n))
|
|
120
121
|
return s;
|
|
@@ -142,7 +143,7 @@ class Ne {
|
|
|
142
143
|
*/
|
|
143
144
|
getCursor(t, e) {
|
|
144
145
|
const o = t.anchor.includes("middle") ? "edge" : "corner";
|
|
145
|
-
return
|
|
146
|
+
return ne(
|
|
146
147
|
t.x,
|
|
147
148
|
t.y,
|
|
148
149
|
this.rotationAnchor.x,
|
|
@@ -153,7 +154,7 @@ class Ne {
|
|
|
153
154
|
);
|
|
154
155
|
}
|
|
155
156
|
}
|
|
156
|
-
class
|
|
157
|
+
class Be {
|
|
157
158
|
/**
|
|
158
159
|
* Calculate new dimensions and position for a resize operation
|
|
159
160
|
*/
|
|
@@ -192,21 +193,21 @@ class We {
|
|
|
192
193
|
);
|
|
193
194
|
if (k) {
|
|
194
195
|
const I = t, _ = s.transformData, H = k.frozenWidth ?? ((W = I.transformData) == null ? void 0 : W.width) ?? u, V = I.imageAspectRatio || (_ != null && _.width && (_ != null && _.height) ? _.width / _.height : null);
|
|
195
|
-
let
|
|
196
|
-
|
|
197
|
-
const at = u !== 0 ? H / u : 1, gt = p !== 0 ?
|
|
198
|
-
b = c * at, g = d * gt, f = H, y =
|
|
196
|
+
let Y = k.frozenHeight;
|
|
197
|
+
Y == null && (V && V !== 0 ? Y = H / V : (O = I.transformData) != null && O.height ? Y = I.transformData.height : Y = p);
|
|
198
|
+
const at = u !== 0 ? H / u : 1, gt = p !== 0 ? Y / p : 1;
|
|
199
|
+
b = c * at, g = d * gt, f = H, y = Y, v = !0;
|
|
199
200
|
}
|
|
200
201
|
}
|
|
201
202
|
}
|
|
202
203
|
}
|
|
203
204
|
f = Math.max(50, f), y = Math.max(40, y);
|
|
204
|
-
const S = t.clone(),
|
|
205
|
+
const S = t.clone(), C = S.resize(e.anchor, f, y, s);
|
|
205
206
|
if (!e.anchor.includes("middle") && ((D = S.stroke) != null && D.enabled) && s.strokeWidth !== void 0 && s.strokeWidth > 0) {
|
|
206
207
|
const F = s.width ?? 1, E = s.height ?? 1, $ = Math.sqrt(f / F * (y / E)), j = Math.max(1, Math.round(s.strokeWidth * $ * 10) / 10);
|
|
207
208
|
S.stroke = { ...S.stroke, width: j };
|
|
208
209
|
}
|
|
209
|
-
const x = v ||
|
|
210
|
+
const x = v || C === !1, P = e.anchor.includes("top") || e.anchor.includes("bottom"), w = "isCropping" in S && S.isCropping, A = "isGroup" in S && S.isGroup;
|
|
210
211
|
if (P && !w && !A) {
|
|
211
212
|
const F = t.getRotationAnchor(), E = this._calculateFixedCornerOffset({
|
|
212
213
|
element: t,
|
|
@@ -234,7 +235,7 @@ class We {
|
|
|
234
235
|
handle: o,
|
|
235
236
|
rotationAnchor: n
|
|
236
237
|
}) {
|
|
237
|
-
const s = new Vt(t), { cos: i, sin: a } = s.getRenderingCosSin(), r = t.getVisualBoundingBox(), l = e.getVisualBoundingBox(), h = n, c = e.getRotationAnchor(), d = this._getFixedLocalCoords(o.anchor, r.width, r.height), u = d.x, p = d.y, b = r.x - h.x, g = r.y - h.y, f = b + u, y = g + p, m = f * i - y * a, T = f * a + y * i, v = h.x + m, S = h.y + T,
|
|
238
|
+
const s = new Vt(t), { cos: i, sin: a } = s.getRenderingCosSin(), r = t.getVisualBoundingBox(), l = e.getVisualBoundingBox(), h = n, c = e.getRotationAnchor(), d = this._getFixedLocalCoords(o.anchor, r.width, r.height), u = d.x, p = d.y, b = r.x - h.x, g = r.y - h.y, f = b + u, y = g + p, m = f * i - y * a, T = f * a + y * i, v = h.x + m, S = h.y + T, C = this._getFixedLocalCoords(o.anchor, l.width, l.height), R = C.x, x = C.y, P = l.x - c.x, w = l.y - c.y, A = P + R, B = w + x, L = A * i - B * a, W = A * a + B * i, O = c.x + L, D = c.y + W;
|
|
238
239
|
return {
|
|
239
240
|
x: v - O,
|
|
240
241
|
y: S - D
|
|
@@ -275,7 +276,7 @@ class We {
|
|
|
275
276
|
return n;
|
|
276
277
|
}
|
|
277
278
|
}
|
|
278
|
-
class
|
|
279
|
+
class Le {
|
|
279
280
|
constructor() {
|
|
280
281
|
this.hooks = {
|
|
281
282
|
beforeResize: [],
|
|
@@ -330,7 +331,7 @@ class De {
|
|
|
330
331
|
*/
|
|
331
332
|
executeResize(t) {
|
|
332
333
|
const e = this.runHooks("beforeResize", t);
|
|
333
|
-
let o =
|
|
334
|
+
let o = Be.calculateResize({
|
|
334
335
|
...e,
|
|
335
336
|
snapSystem: t.snapSystem
|
|
336
337
|
});
|
|
@@ -345,8 +346,8 @@ class De {
|
|
|
345
346
|
return this.runHooks("afterPositionUpdate", o).position;
|
|
346
347
|
}
|
|
347
348
|
}
|
|
348
|
-
const
|
|
349
|
-
class
|
|
349
|
+
const Xe = new Le();
|
|
350
|
+
class Ne {
|
|
350
351
|
constructor(t = null) {
|
|
351
352
|
this.state = "IDLE", this.context = {
|
|
352
353
|
mode: null,
|
|
@@ -544,7 +545,7 @@ class $e {
|
|
|
544
545
|
updateRotate(t, e, o, n) {
|
|
545
546
|
if (this.state !== "ROTATING")
|
|
546
547
|
throw new Error("Cannot update rotate: not in ROTATING state");
|
|
547
|
-
const s = this.context.startData, a = (
|
|
548
|
+
const s = this.context.startData, a = (oe(o, n, t, e) - s.startAngle) * 180 / Math.PI;
|
|
548
549
|
let r = s.currentRotation - a;
|
|
549
550
|
return r = (r % 360 + 360) % 360, r > 180 && (r -= 360), this.snapHandler && this.snapHandler.snapRotation && this.context.element ? this.snapHandler.snapRotation(r, this.context.element) : r;
|
|
550
551
|
}
|
|
@@ -864,25 +865,25 @@ class Nt {
|
|
|
864
865
|
return `${Math.floor(t / this.cellSize)},${Math.floor(e / this.cellSize)}`;
|
|
865
866
|
}
|
|
866
867
|
}
|
|
867
|
-
function lt(
|
|
868
|
-
const t =
|
|
868
|
+
function lt(M) {
|
|
869
|
+
const t = M.transformData;
|
|
869
870
|
if (t && "width" in t && typeof t.width == "number")
|
|
870
871
|
return t.width;
|
|
871
872
|
}
|
|
872
|
-
function St(
|
|
873
|
-
const t =
|
|
873
|
+
function St(M) {
|
|
874
|
+
const t = M.transformData;
|
|
874
875
|
if (t && "height" in t && typeof t.height == "number")
|
|
875
876
|
return t.height;
|
|
876
877
|
}
|
|
877
|
-
function wt(
|
|
878
|
-
const e =
|
|
878
|
+
function wt(M, t) {
|
|
879
|
+
const e = M.transformData;
|
|
879
880
|
return e && "width" in e ? (e.width = t, !0) : !1;
|
|
880
881
|
}
|
|
881
|
-
function Pt(
|
|
882
|
-
const e =
|
|
882
|
+
function Pt(M, t) {
|
|
883
|
+
const e = M.transformData;
|
|
883
884
|
return e && "height" in e ? (e.height = t, !0) : !1;
|
|
884
885
|
}
|
|
885
|
-
class
|
|
886
|
+
class Ke {
|
|
886
887
|
constructor(t = {}) {
|
|
887
888
|
this._extraSnapRects = [], this.snapThreshold = t.snapThreshold || it.canvas.snapThreshold, this.enabled = t.enabled !== !1, this.showGuides = t.showGuides !== !1, this.guides = [], this.activeSnaps = {
|
|
888
889
|
x: null,
|
|
@@ -996,9 +997,9 @@ class je {
|
|
|
996
997
|
for (const [y, m] of Object.entries(s)) {
|
|
997
998
|
const T = this._spatialGrid.queryNearAxis("x", m.x, this.snapThreshold);
|
|
998
999
|
for (const S of T) {
|
|
999
|
-
const
|
|
1000
|
-
if (!
|
|
1001
|
-
const R =
|
|
1000
|
+
const C = this._anchorMetadata.get(S.id);
|
|
1001
|
+
if (!C) continue;
|
|
1002
|
+
const R = C.point, x = C.anchorKey, P = Math.abs(m.x - R.x);
|
|
1002
1003
|
if (P < this.snapThreshold) {
|
|
1003
1004
|
const w = {
|
|
1004
1005
|
snapTo: R.x,
|
|
@@ -1019,9 +1020,9 @@ class je {
|
|
|
1019
1020
|
}
|
|
1020
1021
|
const v = this._spatialGrid.queryNearAxis("y", m.y, this.snapThreshold);
|
|
1021
1022
|
for (const S of v) {
|
|
1022
|
-
const
|
|
1023
|
-
if (!
|
|
1024
|
-
const R =
|
|
1023
|
+
const C = this._anchorMetadata.get(S.id);
|
|
1024
|
+
if (!C) continue;
|
|
1025
|
+
const R = C.point, x = C.anchorKey, P = Math.abs(m.y - R.y);
|
|
1025
1026
|
if (P < this.snapThreshold) {
|
|
1026
1027
|
const w = {
|
|
1027
1028
|
snapTo: R.y,
|
|
@@ -1437,7 +1438,7 @@ class je {
|
|
|
1437
1438
|
* @returns {object} Modified resize result with adjusted element
|
|
1438
1439
|
*/
|
|
1439
1440
|
snapDimensions(t, e, o = null) {
|
|
1440
|
-
var S,
|
|
1441
|
+
var S, C, R, x, P;
|
|
1441
1442
|
if (!this.enabled || !e)
|
|
1442
1443
|
return this.clearGuides(), t;
|
|
1443
1444
|
const { element: n } = t, s = t.handle;
|
|
@@ -1472,7 +1473,7 @@ class je {
|
|
|
1472
1473
|
I && I.includes("right") ? this._adjustElementForRightResize(w, g, s) : I && I.includes("left") ? this._adjustElementForLeftResize(w, g, s) : w.x += g;
|
|
1473
1474
|
}
|
|
1474
1475
|
if (f !== 0) {
|
|
1475
|
-
const k = (
|
|
1476
|
+
const k = (C = this.activeSnaps.y) == null ? void 0 : C.anchorKey, I = k == null ? void 0 : k.toLowerCase();
|
|
1476
1477
|
I && I.includes("bottom") ? this._adjustElementForBottomResize(w, f, s) : I && I.includes("top") ? this._adjustElementForTopResize(w, f, s) : w.y += f;
|
|
1477
1478
|
}
|
|
1478
1479
|
} else
|
|
@@ -1484,8 +1485,8 @@ class je {
|
|
|
1484
1485
|
const k = this.activeSnaps.x || this.activeSnaps.y;
|
|
1485
1486
|
let I = L, _ = W;
|
|
1486
1487
|
k && (I = k.frozenWidth ?? I, _ = k.frozenHeight ?? _);
|
|
1487
|
-
const H = lt(n), V = St(n),
|
|
1488
|
-
|
|
1488
|
+
const H = lt(n), V = St(n), Y = w.imageAspectRatio || (H && V ? H / V : null);
|
|
1489
|
+
Y && Y !== 0 && (_ = I / Y), wt(w, I), Pt(w, _), k && (k.frozenWidth = I, k.frozenHeight = _);
|
|
1489
1490
|
}
|
|
1490
1491
|
} else
|
|
1491
1492
|
(((R = this.activeSnaps.y) == null ? void 0 : R.isPositionBasedSnap) || !1) && (lt(w) !== void 0 ? wt(w, L) : w.width !== void 0 && (w.width = L));
|
|
@@ -1507,12 +1508,12 @@ class je {
|
|
|
1507
1508
|
if (!this.enabled) return t;
|
|
1508
1509
|
const n = [0, 45, 90, 135, 180, 225, 270, 315, 360], s = 5;
|
|
1509
1510
|
for (const i of n)
|
|
1510
|
-
if (
|
|
1511
|
+
if (ie(t, i, s))
|
|
1511
1512
|
return i;
|
|
1512
1513
|
return t;
|
|
1513
1514
|
}
|
|
1514
1515
|
}
|
|
1515
|
-
class
|
|
1516
|
+
class $e {
|
|
1516
1517
|
constructor(t = {}) {
|
|
1517
1518
|
this.lastSnapTarget = null, this.detectionThreshold = t.detectionThreshold || 100, this.minDistance = t.minDistance || 10, this.enabled = t.enabled !== !1, this.showLabels = t.showLabels !== !1, this.indicators = [];
|
|
1518
1519
|
}
|
|
@@ -1569,8 +1570,8 @@ class qe {
|
|
|
1569
1570
|
}
|
|
1570
1571
|
const y = [];
|
|
1571
1572
|
for (let T = 0; T < p.length - 1; T++) {
|
|
1572
|
-
const v = p[T].getVisualBoundingBox(),
|
|
1573
|
-
y.push(
|
|
1573
|
+
const v = p[T].getVisualBoundingBox(), C = p[T + 1].getVisualBoundingBox().y - (v.y + v.height);
|
|
1574
|
+
y.push(C);
|
|
1574
1575
|
}
|
|
1575
1576
|
let m = null;
|
|
1576
1577
|
if (g) {
|
|
@@ -1615,8 +1616,8 @@ class qe {
|
|
|
1615
1616
|
}
|
|
1616
1617
|
const y = [];
|
|
1617
1618
|
for (let T = 0; T < b.length - 1; T++) {
|
|
1618
|
-
const v = b[T].getVisualBoundingBox(),
|
|
1619
|
-
y.push(
|
|
1619
|
+
const v = b[T].getVisualBoundingBox(), C = b[T + 1].getVisualBoundingBox().x - (v.x + v.width);
|
|
1620
|
+
y.push(C);
|
|
1620
1621
|
}
|
|
1621
1622
|
let m = null;
|
|
1622
1623
|
if (g) {
|
|
@@ -1734,16 +1735,16 @@ class qe {
|
|
|
1734
1735
|
labelY: g,
|
|
1735
1736
|
isAltHover: !0
|
|
1736
1737
|
}), a++);
|
|
1737
|
-
let m = 0, T = !1, v = 0, S = 0,
|
|
1738
|
+
let m = 0, T = !1, v = 0, S = 0, C = 0;
|
|
1738
1739
|
const x = 30 * (r % 2 === 0 ? 1 : -1);
|
|
1739
|
-
h.y >= n.y + n.height ? (m = h.y - (n.y + n.height), m >= this.minDistance && (T = !0, v = (n.x + n.width / 2 + h.x + h.width / 2) / 2 + x, S = n.y + n.height,
|
|
1740
|
+
h.y >= n.y + n.height ? (m = h.y - (n.y + n.height), m >= this.minDistance && (T = !0, v = (n.x + n.width / 2 + h.x + h.width / 2) / 2 + x, S = n.y + n.height, C = h.y)) : n.y >= h.y + h.height && (m = n.y - (h.y + h.height), m >= this.minDistance && (T = !0, v = (n.x + n.width / 2 + h.x + h.width / 2) / 2 + x, S = h.y + h.height, C = n.y)), T && (o.push({
|
|
1740
1741
|
type: "vertical",
|
|
1741
1742
|
distance: Math.round(m),
|
|
1742
1743
|
x: v,
|
|
1743
1744
|
y1: S,
|
|
1744
|
-
y2:
|
|
1745
|
+
y2: C,
|
|
1745
1746
|
labelX: v,
|
|
1746
|
-
labelY: (S +
|
|
1747
|
+
labelY: (S + C) / 2,
|
|
1747
1748
|
isAltHover: !0
|
|
1748
1749
|
}), r++);
|
|
1749
1750
|
}
|
|
@@ -1944,7 +1945,7 @@ class qe {
|
|
|
1944
1945
|
}
|
|
1945
1946
|
}
|
|
1946
1947
|
}
|
|
1947
|
-
const
|
|
1948
|
+
const Wt = $t("ArtboardRenderer"), We = {
|
|
1948
1949
|
showLabel: !0,
|
|
1949
1950
|
showBorder: !0,
|
|
1950
1951
|
borderColor: "",
|
|
@@ -1962,9 +1963,9 @@ const Lt = $t("ArtboardRenderer"), _e = {
|
|
|
1962
1963
|
borderRadius: 0
|
|
1963
1964
|
// Default to no border radius (sharp corners)
|
|
1964
1965
|
};
|
|
1965
|
-
class
|
|
1966
|
+
class Jt {
|
|
1966
1967
|
constructor(t = {}) {
|
|
1967
|
-
this.options = { ...
|
|
1968
|
+
this.options = { ...We, ...t };
|
|
1968
1969
|
}
|
|
1969
1970
|
/**
|
|
1970
1971
|
* Render an artboard
|
|
@@ -1989,7 +1990,7 @@ class Qt {
|
|
|
1989
1990
|
const o = Bt.getTexture(e.backgroundTexture), n = Bt.getTexturePresetColor(e.backgroundTexture);
|
|
1990
1991
|
if (t.fillStyle = n, t.fillRect(e.x, e.y, e.width, e.height), !o || !o.complete) {
|
|
1991
1992
|
Bt.loadTexture(e.backgroundTexture).catch((s) => {
|
|
1992
|
-
|
|
1993
|
+
Wt.error("Failed to load texture:", s);
|
|
1993
1994
|
});
|
|
1994
1995
|
return;
|
|
1995
1996
|
}
|
|
@@ -2010,7 +2011,7 @@ class Qt {
|
|
|
2010
2011
|
* Render artboard border (respects clipShape and borderRadius option)
|
|
2011
2012
|
*/
|
|
2012
2013
|
renderBorder(t, e, o) {
|
|
2013
|
-
const { x: n, y: s, width: i, height: a, clipShape: r } = e, l = this.options.borderColor ||
|
|
2014
|
+
const { x: n, y: s, width: i, height: a, clipShape: r } = e, l = this.options.borderColor || ae(), h = this.options.selectedBorderColor || tt();
|
|
2014
2015
|
if (t.strokeStyle = o ? h : l, t.lineWidth = o ? this.options.selectedBorderWidth : this.options.borderWidth, t.beginPath(), !r || r === "rectangle")
|
|
2015
2016
|
if (this.options.borderRadius > 0) {
|
|
2016
2017
|
const c = Math.min(this.options.borderRadius, Math.min(i, a) / 2);
|
|
@@ -2029,7 +2030,7 @@ class Qt {
|
|
|
2029
2030
|
t.save(), t.translate(n, s), t.stroke(c), t.restore();
|
|
2030
2031
|
return;
|
|
2031
2032
|
} catch (c) {
|
|
2032
|
-
|
|
2033
|
+
Wt.warn("Invalid SVG path for border, falling back to rectangle:", c), t.rect(n, s, i, a);
|
|
2033
2034
|
}
|
|
2034
2035
|
t.stroke();
|
|
2035
2036
|
}
|
|
@@ -2039,7 +2040,7 @@ class Qt {
|
|
|
2039
2040
|
renderLabel(t, e, o) {
|
|
2040
2041
|
const n = this.options.labelFontSize, s = this.options.labelPadding, i = `${e.name} (${Math.round(e.width)} × ${Math.round(e.height)})`, a = e.x, r = e.y - s;
|
|
2041
2042
|
t.font = `${n}px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`;
|
|
2042
|
-
const l = this.options.selectedBorderColor || tt(), h = this.options.labelColor ||
|
|
2043
|
+
const l = this.options.selectedBorderColor || tt(), h = this.options.labelColor || re();
|
|
2043
2044
|
t.fillStyle = o ? l : h, t.textAlign = "left", t.textBaseline = "bottom", t.fillText(i, a, r);
|
|
2044
2045
|
}
|
|
2045
2046
|
/**
|
|
@@ -2083,7 +2084,7 @@ class Qt {
|
|
|
2083
2084
|
t.translate(o, n), t.clip(r), t.translate(-o, -n);
|
|
2084
2085
|
return;
|
|
2085
2086
|
} catch (r) {
|
|
2086
|
-
|
|
2087
|
+
Wt.warn("Invalid SVG path, falling back to rectangle:", r), t.rect(o, n, s, i);
|
|
2087
2088
|
}
|
|
2088
2089
|
t.clip();
|
|
2089
2090
|
}
|
|
@@ -2142,7 +2143,7 @@ class Qt {
|
|
|
2142
2143
|
* Use this when exporting to ensure preview background is never included
|
|
2143
2144
|
*/
|
|
2144
2145
|
static createForExport(t = {}) {
|
|
2145
|
-
return new
|
|
2146
|
+
return new Jt({
|
|
2146
2147
|
...t,
|
|
2147
2148
|
showPreviewBackground: !1
|
|
2148
2149
|
// CRITICAL: Never show preview in exports
|
|
@@ -2155,21 +2156,6 @@ class Qt {
|
|
|
2155
2156
|
return !!(this.options.showPreviewBackground && t.previewBackgroundColor && t.previewBackgroundColor !== "transparent");
|
|
2156
2157
|
}
|
|
2157
2158
|
}
|
|
2158
|
-
function Ue(C) {
|
|
2159
|
-
return C instanceof fe;
|
|
2160
|
-
}
|
|
2161
|
-
function ze(C) {
|
|
2162
|
-
return C instanceof jt;
|
|
2163
|
-
}
|
|
2164
|
-
function Wt(C) {
|
|
2165
|
-
return C instanceof he;
|
|
2166
|
-
}
|
|
2167
|
-
function Ze(C) {
|
|
2168
|
-
return C instanceof de;
|
|
2169
|
-
}
|
|
2170
|
-
function Je(C) {
|
|
2171
|
-
return C instanceof ce;
|
|
2172
|
-
}
|
|
2173
2159
|
class mt {
|
|
2174
2160
|
/**
|
|
2175
2161
|
* Render selection box layer
|
|
@@ -2195,14 +2181,14 @@ class mt {
|
|
|
2195
2181
|
const i = e.getVisualBoundingBox(), a = Math.round(i.width), r = Math.round(i.height), l = `${a} × ${r}`, h = o.rotationHandle, c = h.x * s, d = h.y * s - 20;
|
|
2196
2182
|
t.save(), t.font = "10px system-ui, -apple-system, sans-serif";
|
|
2197
2183
|
const p = t.measureText(l).width + 12, b = 18;
|
|
2198
|
-
t.shadowColor =
|
|
2184
|
+
t.shadowColor = le(t.canvas), t.shadowBlur = 4, t.shadowOffsetY = 1, t.fillStyle = he(t.canvas), t.beginPath(), t.roundRect(
|
|
2199
2185
|
c - p / 2,
|
|
2200
2186
|
d - b / 2,
|
|
2201
2187
|
p,
|
|
2202
2188
|
b,
|
|
2203
2189
|
3
|
|
2204
2190
|
// Smaller border radius
|
|
2205
|
-
), t.fill(), t.shadowColor = "transparent", t.shadowBlur = 0, t.shadowOffsetY = 0, t.fillStyle =
|
|
2191
|
+
), t.fill(), t.shadowColor = "transparent", t.shadowBlur = 0, t.shadowOffsetY = 0, t.fillStyle = ce(t.canvas), t.textAlign = "center", t.textBaseline = "middle", t.fillText(l, c, d + 0.5), t.restore();
|
|
2206
2192
|
}
|
|
2207
2193
|
/**
|
|
2208
2194
|
* Render transform handles layer
|
|
@@ -2240,7 +2226,7 @@ class _t {
|
|
|
2240
2226
|
const c = performance.now() - e.startTime;
|
|
2241
2227
|
h = Math.min(c / r, 1) * l;
|
|
2242
2228
|
}
|
|
2243
|
-
t.strokeStyle =
|
|
2229
|
+
t.strokeStyle = de(t.canvas), t.globalAlpha = h, t.lineWidth = 3, this.renderElementOutline(t, a, s, i), t.restore();
|
|
2244
2230
|
}
|
|
2245
2231
|
/**
|
|
2246
2232
|
* Render outline for a specific element type
|
|
@@ -2287,10 +2273,10 @@ class _t {
|
|
|
2287
2273
|
const f = d[(g + 1) % 3], y = f.x - b.x, m = f.y - b.y, T = Math.sqrt(y * y + m * m);
|
|
2288
2274
|
return { x: m / T, y: -y / T };
|
|
2289
2275
|
}), p = d.map((b, g) => {
|
|
2290
|
-
const f = u[(g + 2) % 3], y = u[g], m = f.x + y.x, T = f.y + y.y, v = Math.sqrt(m * m + T * T), S = (m * f.x + T * f.y) / v,
|
|
2276
|
+
const f = u[(g + 2) % 3], y = u[g], m = f.x + y.x, T = f.y + y.y, v = Math.sqrt(m * m + T * T), S = (m * f.x + T * f.y) / v, C = l / S;
|
|
2291
2277
|
return {
|
|
2292
|
-
x: b.x + m / v *
|
|
2293
|
-
y: b.y + T / v *
|
|
2278
|
+
x: b.x + m / v * C,
|
|
2279
|
+
y: b.y + T / v * C
|
|
2294
2280
|
};
|
|
2295
2281
|
});
|
|
2296
2282
|
t.moveTo(p[0].x, p[0].y), t.lineTo(p[1].x, p[1].y), t.lineTo(p[2].x, p[2].y), t.closePath();
|
|
@@ -2368,7 +2354,7 @@ class _t {
|
|
|
2368
2354
|
*/
|
|
2369
2355
|
static renderHoverRingEffect(t, e, o) {
|
|
2370
2356
|
t.save(), t.translate(e.x * o, e.y * o), o !== 1 && t.scale(o, o);
|
|
2371
|
-
const n = e.fontSize, s = e.fontFamily, i = e.bold || !1, a = e.italic || !1, r = e.textAlign || "center", l =
|
|
2357
|
+
const n = e.fontSize, s = e.fontFamily, i = e.bold || !1, a = e.italic || !1, r = e.textAlign || "center", l = jt(n, s, i, a), h = n * 1.2, c = 4 / o, d = 4 / o, u = document.createElement("canvas");
|
|
2372
2358
|
u.width = t.canvas.width, u.height = t.canvas.height;
|
|
2373
2359
|
const p = u.getContext("2d");
|
|
2374
2360
|
if (!p) {
|
|
@@ -2378,19 +2364,19 @@ class _t {
|
|
|
2378
2364
|
p.setTransform(t.getTransform()), p.textBaseline = "alphabetic", p.lineJoin = "round";
|
|
2379
2365
|
const b = e.getRichText ? e.getRichText() : null;
|
|
2380
2366
|
if (b) {
|
|
2381
|
-
const g =
|
|
2367
|
+
const g = qt(b), f = [], y = [];
|
|
2382
2368
|
g.forEach((v) => {
|
|
2383
2369
|
if (e.transformType === "custom" && e.transformData) {
|
|
2384
|
-
const S = e.transformData.width - ft * 2,
|
|
2370
|
+
const S = e.transformData.width - ft * 2, C = Ut(v, S, {
|
|
2385
2371
|
fontSize: n,
|
|
2386
2372
|
fontFamily: s,
|
|
2387
2373
|
bold: i,
|
|
2388
2374
|
italic: a
|
|
2389
2375
|
});
|
|
2390
|
-
|
|
2376
|
+
C.forEach((R, x) => {
|
|
2391
2377
|
f.push(R), y.push({
|
|
2392
2378
|
isParagraphStart: x === 0,
|
|
2393
|
-
isParagraphEnd: x ===
|
|
2379
|
+
isParagraphEnd: x === C.length - 1
|
|
2394
2380
|
});
|
|
2395
2381
|
});
|
|
2396
2382
|
} else
|
|
@@ -2404,7 +2390,7 @@ class _t {
|
|
|
2404
2390
|
const T = -m / 2;
|
|
2405
2391
|
f.forEach((v, S) => {
|
|
2406
2392
|
var D, F;
|
|
2407
|
-
const
|
|
2393
|
+
const C = y[S].isParagraphStart, R = y[S].isParagraphEnd;
|
|
2408
2394
|
let x = 0;
|
|
2409
2395
|
const P = v.map((E) => E.text).join(""), w = ((D = P.match(/^ +/)) == null ? void 0 : D[0].length) || 0, A = ((F = P.match(/ +$/)) == null ? void 0 : F[0].length) || 0;
|
|
2410
2396
|
let B = 0;
|
|
@@ -2412,15 +2398,15 @@ class _t {
|
|
|
2412
2398
|
const $ = E.style.fontSize !== void 0 ? E.style.fontSize : n, j = E.style.fontFamily !== void 0 ? E.style.fontFamily : s, J = E.style.bold !== void 0 ? E.style.bold : i, X = E.style.italic !== void 0 ? E.style.italic : a;
|
|
2413
2399
|
let k = E.text;
|
|
2414
2400
|
const I = B, _ = B + E.text.length;
|
|
2415
|
-
if (!
|
|
2401
|
+
if (!C && w > 0 && I < w) {
|
|
2416
2402
|
const H = Math.min(w - I, E.text.length);
|
|
2417
2403
|
k = k.substring(H);
|
|
2418
2404
|
}
|
|
2419
2405
|
if (!R && A > 0) {
|
|
2420
2406
|
const H = P.length - A;
|
|
2421
2407
|
if (_ > H) {
|
|
2422
|
-
const V = !
|
|
2423
|
-
k = k.substring(0,
|
|
2408
|
+
const V = !C && I < w ? Math.min(w - I, E.text.length) : 0, Y = Math.max(0, H - I - V);
|
|
2409
|
+
k = k.substring(0, Y);
|
|
2424
2410
|
}
|
|
2425
2411
|
}
|
|
2426
2412
|
k.length > 0 && (t.save(), t.font = Ht($, j, J, X), x += t.measureText(k).width, t.restore()), B += E.text.length;
|
|
@@ -2435,15 +2421,15 @@ class _t {
|
|
|
2435
2421
|
const J = E.style.bold !== void 0 ? E.style.bold : i, X = E.style.italic !== void 0 ? E.style.italic : a;
|
|
2436
2422
|
let k = E.text;
|
|
2437
2423
|
const I = B, _ = B + E.text.length;
|
|
2438
|
-
if (!
|
|
2424
|
+
if (!C && w > 0 && I < w) {
|
|
2439
2425
|
const H = Math.min(w - I, E.text.length);
|
|
2440
2426
|
k = k.substring(H);
|
|
2441
2427
|
}
|
|
2442
2428
|
if (!R && A > 0) {
|
|
2443
2429
|
const H = P.length - A;
|
|
2444
2430
|
if (_ > H) {
|
|
2445
|
-
const V = !
|
|
2446
|
-
k = k.substring(0,
|
|
2431
|
+
const V = !C && I < w ? Math.min(w - I, E.text.length) : 0, Y = Math.max(0, H - I - V);
|
|
2432
|
+
k = k.substring(0, Y);
|
|
2447
2433
|
}
|
|
2448
2434
|
}
|
|
2449
2435
|
B += E.text.length, k.length > 0 && (p.font = Ht($, j, J, X), p.textAlign = "left", p.globalCompositeOperation = "source-over", p.strokeStyle = t.strokeStyle, p.globalAlpha = Math.min(t.globalAlpha * 1.6, 0.8), p.lineWidth = (d + c) * 2, p.strokeText(k, W, O), p.globalCompositeOperation = "destination-out", p.globalAlpha = 1, p.lineWidth = d * 2, p.strokeText(k, W, O), p.fillText(k, W, O), W += p.measureText(k).width);
|
|
@@ -2453,9 +2439,9 @@ class _t {
|
|
|
2453
2439
|
t.font = Ht(n, s, i, a), p.font = t.font, p.textAlign = r;
|
|
2454
2440
|
let g, f;
|
|
2455
2441
|
if (e.transformType === "custom" && e.transformData) {
|
|
2456
|
-
const
|
|
2442
|
+
const C = e.transformData.width - ft * 2, { lines: R } = fe(
|
|
2457
2443
|
e.text,
|
|
2458
|
-
|
|
2444
|
+
C,
|
|
2459
2445
|
n,
|
|
2460
2446
|
s,
|
|
2461
2447
|
i,
|
|
@@ -2467,17 +2453,17 @@ class _t {
|
|
|
2467
2453
|
} else {
|
|
2468
2454
|
g = e.text.split(`
|
|
2469
2455
|
`);
|
|
2470
|
-
const
|
|
2456
|
+
const C = e.text.includes(`
|
|
2471
2457
|
`);
|
|
2472
|
-
g =
|
|
2458
|
+
g = Te(g, C);
|
|
2473
2459
|
}
|
|
2474
2460
|
g.length === 0 ? f = 0 : g.length === 1 ? f = l.height : f = (g.length - 1) * h + l.height;
|
|
2475
2461
|
const y = -f / 2, m = e.text.includes(`
|
|
2476
2462
|
`), T = e.transformType === "custom" && e.transformData ? e.transformData.width : 0, v = -T / 2;
|
|
2477
2463
|
let S = v + ft;
|
|
2478
|
-
r === "center" ? S = v + T / 2 : r === "right" && (S = v + T - ft), g.forEach((
|
|
2464
|
+
r === "center" ? S = v + T / 2 : r === "right" && (S = v + T - ft), g.forEach((C, R) => {
|
|
2479
2465
|
const x = y + l.ascent + R * h, P = m || R === 0, w = m || R === g.length - 1;
|
|
2480
|
-
let A =
|
|
2466
|
+
let A = C;
|
|
2481
2467
|
P || (A = A.replace(/^ +/, "")), w || (A = A.replace(/ +$/, "")), p.globalCompositeOperation = "source-over", p.strokeStyle = t.strokeStyle, p.globalAlpha = Math.min(t.globalAlpha * 1.6, 0.8), p.lineWidth = (d + c) * 2, p.lineJoin = "round", p.strokeText(A, S, x), p.globalCompositeOperation = "destination-out", p.globalAlpha = 1, p.lineWidth = d * 2, p.strokeText(A, S, x), p.fillText(A, S, x);
|
|
2482
2468
|
});
|
|
2483
2469
|
}
|
|
@@ -2561,7 +2547,7 @@ class _t {
|
|
|
2561
2547
|
let a = -o.reduce((r, l) => r + l, 0) / 2;
|
|
2562
2548
|
return e.forEach((r, l) => {
|
|
2563
2549
|
const h = o[l], c = a + h / 2, d = c / (n.width / 2), u = n.amplitude * t.fontSize * Math.sin(n.frequency * Math.PI * d), p = n.amplitude * n.frequency * Math.PI * Math.cos(n.frequency * Math.PI * d);
|
|
2564
|
-
s.push({ x: c, y: u, angle: 0, skewY: p *
|
|
2550
|
+
s.push({ x: c, y: u, angle: 0, skewY: p * ge }), a += h;
|
|
2565
2551
|
}), s;
|
|
2566
2552
|
}
|
|
2567
2553
|
/**
|
|
@@ -2648,7 +2634,7 @@ class Ct {
|
|
|
2648
2634
|
const s = `${n}`;
|
|
2649
2635
|
t.font = `600 ${it.canvas.spacingLabelFontSize}px ${it.canvas.spacingLabelFontFamily}`;
|
|
2650
2636
|
const a = t.measureText(s).width, r = it.canvas.spacingLabelFontSize, l = 4, h = a + l * 2, c = r + l * 2;
|
|
2651
|
-
t.fillStyle = Ot(t.canvas), t.beginPath(), t.roundRect(e - h / 2, o - c / 2, h, c,
|
|
2637
|
+
t.fillStyle = Ot(t.canvas), t.beginPath(), t.roundRect(e - h / 2, o - c / 2, h, c, ue), t.fill(), t.fillStyle = pe, t.textAlign = "center", t.textBaseline = "middle", t.fillText(s, e, o);
|
|
2652
2638
|
}
|
|
2653
2639
|
}
|
|
2654
2640
|
class Dt {
|
|
@@ -2665,14 +2651,14 @@ class Dt {
|
|
|
2665
2651
|
}
|
|
2666
2652
|
const g = s.fontSize || 24, f = s.fontFamily || "Arial", y = s.bold || !1, m = s.italic || !1, T = s.underline || !1, v = s.strikethrough || !1, S = s.textAlign || "center";
|
|
2667
2653
|
t.save(), t.translate(s.x, s.y), t.rotate(-s.rotation * Math.PI / 180);
|
|
2668
|
-
const
|
|
2654
|
+
const C = jt(g, f, y, m), R = C.height, x = g * 1.2;
|
|
2669
2655
|
let P, w, A;
|
|
2670
2656
|
if (h && s.transformType === "custom" && s.transformData.width) {
|
|
2671
2657
|
const X = s.transformData.width - ft * 2;
|
|
2672
2658
|
A = X;
|
|
2673
|
-
const k =
|
|
2659
|
+
const k = qt(h);
|
|
2674
2660
|
P = [], w = [], k.forEach((I) => {
|
|
2675
|
-
const _ =
|
|
2661
|
+
const _ = Ut(I, X, {
|
|
2676
2662
|
fontSize: s.fontSize,
|
|
2677
2663
|
fontFamily: s.fontFamily,
|
|
2678
2664
|
bold: s.bold,
|
|
@@ -2697,32 +2683,32 @@ class Dt {
|
|
|
2697
2683
|
// Each line is its own paragraph
|
|
2698
2684
|
isParagraphEnd: !0
|
|
2699
2685
|
}));
|
|
2700
|
-
const B = P.length > 1 ?
|
|
2686
|
+
const B = P.length > 1 ? C.height + (P.length - 1) * x : C.height;
|
|
2701
2687
|
let L = -B / 2, W = 0, O = L, D = R;
|
|
2702
2688
|
const F = [];
|
|
2703
2689
|
let E = 0;
|
|
2704
2690
|
P.forEach((X, k) => {
|
|
2705
|
-
var V,
|
|
2691
|
+
var V, Y;
|
|
2706
2692
|
const I = w[k].isParagraphStart, _ = w[k].isParagraphEnd, H = [];
|
|
2707
2693
|
X.forEach((at) => {
|
|
2708
2694
|
Array.from(at.text).forEach((ct) => {
|
|
2709
|
-
let
|
|
2695
|
+
let G = g, ot = f, et = y, U = m;
|
|
2710
2696
|
if (h && E < l.length) {
|
|
2711
2697
|
const Z = h.getStyleAt(E);
|
|
2712
|
-
|
|
2698
|
+
G = Z.fontSize || g, ot = Z.fontFamily || f, et = Z.bold !== void 0 ? Z.bold : y, U = Z.italic !== void 0 ? Z.italic : m;
|
|
2713
2699
|
}
|
|
2714
2700
|
t.save();
|
|
2715
2701
|
const nt = et ? "bold" : "normal", z = U ? "italic" : "normal";
|
|
2716
|
-
t.font = `${z} ${nt} ${
|
|
2702
|
+
t.font = `${z} ${nt} ${G}px "${ot}", Arial, sans-serif`;
|
|
2717
2703
|
const q = t.measureText(ct).width;
|
|
2718
|
-
t.restore(), H.push({ char: ct, width: q, fontSize:
|
|
2704
|
+
t.restore(), H.push({ char: ct, width: q, fontSize: G, index: E }), E++;
|
|
2719
2705
|
});
|
|
2720
2706
|
});
|
|
2721
2707
|
{
|
|
2722
|
-
const at = k === 0, gt = k === P.length - 1, ct = H.map((z) => z.char).join(""),
|
|
2708
|
+
const at = k === 0, gt = k === P.length - 1, ct = H.map((z) => z.char).join(""), G = ((V = ct.match(/^ +/)) == null ? void 0 : V[0].length) || 0, ot = ((Y = ct.match(/ +$/)) == null ? void 0 : Y[0].length) || 0;
|
|
2723
2709
|
let et = 0;
|
|
2724
2710
|
for (let z = 0; z < H.length; z++)
|
|
2725
|
-
!at && z <
|
|
2711
|
+
!at && z < G || !gt && z >= H.length - ot || (et += H[z].width);
|
|
2726
2712
|
let U;
|
|
2727
2713
|
S === "center" ? U = -et / 2 : S === "right" ? U = A !== void 0 ? A / 2 - et : -et : U = A !== void 0 ? -A / 2 : 0;
|
|
2728
2714
|
let nt = U;
|
|
@@ -2747,7 +2733,7 @@ class Dt {
|
|
|
2747
2733
|
const rt = H[st], xt = rt.char === " ";
|
|
2748
2734
|
let yt = !0;
|
|
2749
2735
|
if (xt) {
|
|
2750
|
-
const Rt = st <
|
|
2736
|
+
const Rt = st < G, N = st >= H.length - ot, Tt = !I && G > 0, vt = !_ && ot > 0;
|
|
2751
2737
|
yt = !(Rt && Tt || N && vt);
|
|
2752
2738
|
}
|
|
2753
2739
|
yt && (pt += rt.width);
|
|
@@ -2762,11 +2748,11 @@ class Dt {
|
|
|
2762
2748
|
let j = null, J = null;
|
|
2763
2749
|
if ($) {
|
|
2764
2750
|
const X = Math.min(a, r), k = Math.max(a, r);
|
|
2765
|
-
t.save(), t.fillStyle =
|
|
2751
|
+
t.save(), t.fillStyle = ye(t.canvas);
|
|
2766
2752
|
let I = 0, _ = -B / 2;
|
|
2767
2753
|
if (P.forEach((H, V) => {
|
|
2768
2754
|
var ot, et;
|
|
2769
|
-
const
|
|
2755
|
+
const Y = w[V].isParagraphStart, at = w[V].isParagraphEnd, gt = V === 0, ct = V === P.length - 1, G = [];
|
|
2770
2756
|
if (H.forEach((U) => {
|
|
2771
2757
|
Array.from(U.text).forEach((nt) => {
|
|
2772
2758
|
const z = U.style || {}, q = z.fontSize !== void 0 ? z.fontSize : g, Z = z.fontFamily !== void 0 ? z.fontFamily : f, ut = z.bold !== void 0 ? z.bold : y, dt = z.italic !== void 0 ? z.italic : m;
|
|
@@ -2774,27 +2760,27 @@ class Dt {
|
|
|
2774
2760
|
const pt = ut ? "bold" : "normal", st = dt ? "italic" : "normal";
|
|
2775
2761
|
t.font = `${st} ${pt} ${q}px "${Z}", Arial, sans-serif`;
|
|
2776
2762
|
const rt = t.measureText(nt).width;
|
|
2777
|
-
t.restore(),
|
|
2763
|
+
t.restore(), G.push({ char: nt, index: I, width: rt, style: z }), I++;
|
|
2778
2764
|
});
|
|
2779
|
-
}),
|
|
2780
|
-
const U =
|
|
2765
|
+
}), G.length > 0) {
|
|
2766
|
+
const U = G[0].index, nt = G[G.length - 1].index;
|
|
2781
2767
|
if (k > U && X <= nt) {
|
|
2782
2768
|
t.save();
|
|
2783
|
-
const z =
|
|
2769
|
+
const z = G.map((N) => N.char).join(""), q = ((ot = z.match(/^ +/)) == null ? void 0 : ot[0].length) || 0, Z = ((et = z.match(/ +$/)) == null ? void 0 : et[0].length) || 0;
|
|
2784
2770
|
let ut = 0;
|
|
2785
|
-
for (let N = 0; N <
|
|
2786
|
-
!gt && N < q || !ct && N >=
|
|
2771
|
+
for (let N = 0; N < G.length; N++)
|
|
2772
|
+
!gt && N < q || !ct && N >= G.length - Z || (ut += G[N].width);
|
|
2787
2773
|
let dt = 0;
|
|
2788
2774
|
S === "center" ? dt = -ut / 2 : S === "right" && (dt = -ut);
|
|
2789
2775
|
const pt = Math.max(X, U), st = Math.min(k, nt + 1);
|
|
2790
2776
|
let rt = 0;
|
|
2791
|
-
for (let N = 0; N <
|
|
2792
|
-
const Tt =
|
|
2777
|
+
for (let N = 0; N < G.length && G[N].index < pt; N++) {
|
|
2778
|
+
const Tt = G[N], vt = N < q, At = N >= G.length - Z, Et = !Y && q > 0, It = !at && Z > 0;
|
|
2793
2779
|
!(vt && Et || At && It) && (rt += Tt.width);
|
|
2794
2780
|
}
|
|
2795
2781
|
let xt = 0;
|
|
2796
|
-
for (let N = 0; N <
|
|
2797
|
-
const Tt =
|
|
2782
|
+
for (let N = 0; N < G.length && G[N].index < st; N++) {
|
|
2783
|
+
const Tt = G[N], vt = N < q, At = N >= G.length - Z, Et = !Y && q > 0, It = !at && Z > 0;
|
|
2798
2784
|
!(vt && Et || At && It) && (xt += Tt.width);
|
|
2799
2785
|
}
|
|
2800
2786
|
const yt = dt + rt, Rt = xt - rt;
|
|
@@ -2805,7 +2791,7 @@ class Dt {
|
|
|
2805
2791
|
}), t.restore(), h) {
|
|
2806
2792
|
t.save();
|
|
2807
2793
|
const H = s.transformType === "custom" ? s.transformData : null, V = H != null && H.width ? H.width - ft * 2 : void 0;
|
|
2808
|
-
|
|
2794
|
+
ve(t, h, {
|
|
2809
2795
|
fontSize: g,
|
|
2810
2796
|
fontFamily: f,
|
|
2811
2797
|
color: s.color || "#000000",
|
|
@@ -2822,15 +2808,15 @@ class Dt {
|
|
|
2822
2808
|
t.save();
|
|
2823
2809
|
const H = tt(t.canvas);
|
|
2824
2810
|
t.fillStyle = H, t.strokeStyle = H, t.lineWidth = _, t.lineCap = "round";
|
|
2825
|
-
const V = { x: X.x, y: X.y - I },
|
|
2826
|
-
t.beginPath(), t.moveTo(X.x, X.y), t.lineTo(X.x, X.y + R), t.stroke(), t.beginPath(), t.arc(V.x, V.y, I, 0, Math.PI * 2), t.fill(), t.strokeStyle = "white", t.lineWidth = 2 / p, t.stroke(), t.strokeStyle = H, t.lineWidth = _, t.beginPath(), t.moveTo(k.x, k.y - R), t.lineTo(k.x, k.y), t.stroke(), t.beginPath(), t.arc(
|
|
2811
|
+
const V = { x: X.x, y: X.y - I }, Y = { x: k.x, y: k.y + I };
|
|
2812
|
+
t.beginPath(), t.moveTo(X.x, X.y), t.lineTo(X.x, X.y + R), t.stroke(), t.beginPath(), t.arc(V.x, V.y, I, 0, Math.PI * 2), t.fill(), t.strokeStyle = "white", t.lineWidth = 2 / p, t.stroke(), t.strokeStyle = H, t.lineWidth = _, t.beginPath(), t.moveTo(k.x, k.y - R), t.lineTo(k.x, k.y), t.stroke(), t.beginPath(), t.arc(Y.x, Y.y, I, 0, Math.PI * 2), t.fill(), t.strokeStyle = "white", t.lineWidth = 2 / p, t.stroke(), t.restore(), u && (u.current = {
|
|
2827
2813
|
start: {
|
|
2828
2814
|
center: V,
|
|
2829
2815
|
textEdge: X
|
|
2830
2816
|
// Original selection edge (top-left of selection on first line)
|
|
2831
2817
|
},
|
|
2832
2818
|
end: {
|
|
2833
|
-
center:
|
|
2819
|
+
center: Y,
|
|
2834
2820
|
textEdge: k
|
|
2835
2821
|
// Original selection edge (bottom-right of selection on last line)
|
|
2836
2822
|
}
|
|
@@ -2886,10 +2872,10 @@ class Dt {
|
|
|
2886
2872
|
* Shows both image resize handles and crop handles
|
|
2887
2873
|
*/
|
|
2888
2874
|
static renderCropBoxLayer(t, e, o, n = 1) {
|
|
2889
|
-
if (!(e instanceof
|
|
2875
|
+
if (!(e instanceof be) || !e.isCropping) return;
|
|
2890
2876
|
const s = e, i = s.getCropBoxBounds();
|
|
2891
2877
|
if (!i) return;
|
|
2892
|
-
const a = 4 / n, r = 2 / n, l =
|
|
2878
|
+
const a = 4 / n, r = 2 / n, l = Se / n, h = me / n, c = 1 / n;
|
|
2893
2879
|
t.save(), t.translate(e.x * n, e.y * n), t.rotate(ht.toRadians(e.rotation));
|
|
2894
2880
|
const d = s.transformData.flipHorizontal ? -1 : 1, u = s.transformData.flipVertical ? -1 : 1;
|
|
2895
2881
|
t.scale(d * n, u * n);
|
|
@@ -2902,8 +2888,8 @@ class Dt {
|
|
|
2902
2888
|
t.fillStyle = "rgba(0, 0, 0, 0.5)", i.y > T.y && t.fillRect(T.x, T.y, T.width, i.y - T.y);
|
|
2903
2889
|
const v = i.y + i.height, S = T.y + T.height;
|
|
2904
2890
|
v < S && t.fillRect(T.x, v, T.width, S - v), i.x > T.x && t.fillRect(T.x, i.y, i.x - T.x, i.height);
|
|
2905
|
-
const
|
|
2906
|
-
|
|
2891
|
+
const C = i.x + i.width, R = T.x + T.width;
|
|
2892
|
+
C < R && t.fillRect(C, i.y, R - C, i.height), t.strokeStyle = tt(t.canvas), t.lineWidth = r, t.strokeRect(i.x, i.y, i.width, i.height), t.strokeStyle = "rgba(255, 255, 255, 0.5)", t.lineWidth = c;
|
|
2907
2893
|
const x = i.width / 3;
|
|
2908
2894
|
t.beginPath(), t.moveTo(i.x + x, i.y), t.lineTo(i.x + x, i.y + i.height), t.moveTo(i.x + 2 * x, i.y), t.lineTo(i.x + 2 * x, i.y + i.height), t.stroke();
|
|
2909
2895
|
const P = i.height / 3;
|
|
@@ -2951,7 +2937,8 @@ class Dt {
|
|
|
2951
2937
|
}
|
|
2952
2938
|
}
|
|
2953
2939
|
}
|
|
2954
|
-
|
|
2940
|
+
xe();
|
|
2941
|
+
const De = $t("CanvasRenderer"), K = class K {
|
|
2955
2942
|
/**
|
|
2956
2943
|
* Get a pooled offscreen canvas for clipping content, only recreating
|
|
2957
2944
|
* when dimensions change. Eliminates per-frame canvas allocation.
|
|
@@ -2975,7 +2962,7 @@ const Ve = $t("CanvasRenderer"), K = class K {
|
|
|
2975
2962
|
e.render(t, o, n);
|
|
2976
2963
|
} catch (s) {
|
|
2977
2964
|
const i = s instanceof Error ? s : new Error(String(s));
|
|
2978
|
-
|
|
2965
|
+
De.error(`Failed to render element ${e.id}:`, i), K.onRenderError && K.onRenderError({
|
|
2979
2966
|
category: "render",
|
|
2980
2967
|
message: `Failed to render element: ${i.message}`,
|
|
2981
2968
|
originalError: i,
|
|
@@ -3047,12 +3034,12 @@ const Ve = $t("CanvasRenderer"), K = class K {
|
|
|
3047
3034
|
const v = new Path2D();
|
|
3048
3035
|
v.rect(g, f, y - g, m - f);
|
|
3049
3036
|
for (const S of T.pieces) {
|
|
3050
|
-
const
|
|
3037
|
+
const C = new Path2D(S.d), R = S.rotation ?? 0, x = new DOMMatrix();
|
|
3051
3038
|
if (x.translateSelf(o.x + S.x, o.y + S.y), R !== 0) {
|
|
3052
3039
|
const P = (S.baseWidth ?? 0) / 2, w = (S.baseHeight ?? 0) / 2, A = R === 90 || R === 270, B = A ? S.baseHeight ?? 0 : S.baseWidth ?? 0, L = A ? S.baseWidth ?? 0 : S.baseHeight ?? 0;
|
|
3053
3040
|
x.translateSelf(B / 2, L / 2), x.rotateSelf(R), x.translateSelf(-P, -w);
|
|
3054
3041
|
}
|
|
3055
|
-
v.addPath(
|
|
3042
|
+
v.addPath(C, x);
|
|
3056
3043
|
}
|
|
3057
3044
|
t.clip(v, "evenodd");
|
|
3058
3045
|
} else
|
|
@@ -3075,8 +3062,8 @@ const Ve = $t("CanvasRenderer"), K = class K {
|
|
|
3075
3062
|
b.clear(), e.forEach((f, y) => {
|
|
3076
3063
|
var m, T, v;
|
|
3077
3064
|
if (f.blendMode === "knockout" || f.blendMode === "clip") {
|
|
3078
|
-
const S = u[y],
|
|
3079
|
-
P && (R === "artboard" || w.length > 0) && (w.forEach((B) => B.id && b.add(B.id)),
|
|
3065
|
+
const S = u[y], C = f.blendMode === "knockout" ? "destination-out" : "destination-in", R = ((m = S.knockoutParts) == null ? void 0 : m.scope) || "group", x = u.findIndex((B) => B.id === S.id), P = ((T = S.knockoutParts) == null ? void 0 : T.fill) || ((v = S.knockoutParts) == null ? void 0 : v.stroke), w = R === "artboard" && x !== -1 ? u.slice(0, x) : [];
|
|
3066
|
+
P && (R === "artboard" || w.length > 0) && (w.forEach((B) => B.id && b.add(B.id)), we(
|
|
3080
3067
|
t,
|
|
3081
3068
|
S,
|
|
3082
3069
|
u,
|
|
@@ -3086,7 +3073,7 @@ const Ve = $t("CanvasRenderer"), K = class K {
|
|
|
3086
3073
|
},
|
|
3087
3074
|
i,
|
|
3088
3075
|
a,
|
|
3089
|
-
|
|
3076
|
+
C
|
|
3090
3077
|
), b.add(f.id));
|
|
3091
3078
|
}
|
|
3092
3079
|
}), e.some((f) => !b.has(f.id) && f.isClipping) ? this._renderWithClipping(
|
|
@@ -3102,21 +3089,21 @@ const Ve = $t("CanvasRenderer"), K = class K {
|
|
|
3102
3089
|
) : e.forEach((f) => {
|
|
3103
3090
|
var R, x;
|
|
3104
3091
|
if (b.has(f.id) || f.visible === !1) return;
|
|
3105
|
-
const y = f.id === o, m = (n == null ? void 0 : n.type) === "element" && ((R = n == null ? void 0 : n.data) == null ? void 0 : R.id) === f.id, T = c && d &&
|
|
3092
|
+
const y = f.id === o, m = (n == null ? void 0 : n.type) === "element" && ((R = n == null ? void 0 : n.data) == null ? void 0 : R.id) === f.id, T = c && d && Lt(f) && f.id === o, v = y && !T, S = u[e.indexOf(f)], C = ((x = S == null ? void 0 : S.distressEffect) == null ? void 0 : x.enabled) && S.distressEffect.style === "custom" && S.distressEffect.textureUrl;
|
|
3106
3093
|
if (S && S.masks && S.masks.length > 0)
|
|
3107
3094
|
kt(t, S, (P) => {
|
|
3108
3095
|
const w = (A) => {
|
|
3109
3096
|
r && (A.save(), A.globalAlpha = Q), this.safeRender(A, f, v, m), r && A.restore();
|
|
3110
3097
|
};
|
|
3111
|
-
if (
|
|
3098
|
+
if (C) {
|
|
3112
3099
|
const A = f.getVisualBoundingBox();
|
|
3113
|
-
|
|
3100
|
+
Yt(P, S.distressEffect, A, w);
|
|
3114
3101
|
} else
|
|
3115
3102
|
w(P);
|
|
3116
3103
|
});
|
|
3117
|
-
else if (
|
|
3104
|
+
else if (C) {
|
|
3118
3105
|
const P = f.getVisualBoundingBox();
|
|
3119
|
-
|
|
3106
|
+
Yt(t, S.distressEffect, P, (w) => {
|
|
3120
3107
|
r && (w.save(), w.globalAlpha = Q), this.safeRender(w, f, v, m), r && w.restore();
|
|
3121
3108
|
});
|
|
3122
3109
|
} else l && !h && a && v ? this.renderElementWithOverflowDimming(t, f, a, v, m, r) : l && a ? (t.save(), this.applyArtboardClipPath(t, a), r && (t.globalAlpha = Q), this.safeRender(t, f, v, m), t.restore()) : (r && (t.save(), t.globalAlpha = Q), this.safeRender(t, f, v, m), r && t.restore());
|
|
@@ -3150,7 +3137,7 @@ const Ve = $t("CanvasRenderer"), K = class K {
|
|
|
3150
3137
|
if (!y.mask)
|
|
3151
3138
|
y.content.forEach((m, T) => {
|
|
3152
3139
|
var P;
|
|
3153
|
-
const v = m.id === n, S = (s == null ? void 0 : s.type) === "element" && ((P = s == null ? void 0 : s.data) == null ? void 0 : P.id) === m.id,
|
|
3140
|
+
const v = m.id === n, S = (s == null ? void 0 : s.type) === "element" && ((P = s == null ? void 0 : s.data) == null ? void 0 : P.id) === m.id, C = i && a && Lt(m) && m.id === n, R = v && !C, x = y.contentConfigs[T];
|
|
3154
3141
|
x && x.masks && x.masks.length > 0 ? kt(t, x, (w) => {
|
|
3155
3142
|
l && (w.save(), w.globalAlpha = Q), m.render(w, R, S), l && w.restore();
|
|
3156
3143
|
}) : (l && (t.save(), t.globalAlpha = Q), m.render(t, R, S), l && t.restore());
|
|
@@ -3160,7 +3147,7 @@ const Ve = $t("CanvasRenderer"), K = class K {
|
|
|
3160
3147
|
if (!T) continue;
|
|
3161
3148
|
T.setTransform(1, 0, 0, 1, 0, 0), T.clearRect(0, 0, c, d), T.globalCompositeOperation = "source-over", T.setTransform(u), y.content.forEach((x, P) => {
|
|
3162
3149
|
var O;
|
|
3163
|
-
const w = x.id === n, A = (s == null ? void 0 : s.type) === "element" && ((O = s == null ? void 0 : s.data) == null ? void 0 : O.id) === x.id, B = i && a &&
|
|
3150
|
+
const w = x.id === n, A = (s == null ? void 0 : s.type) === "element" && ((O = s == null ? void 0 : s.data) == null ? void 0 : O.id) === x.id, B = i && a && Lt(x) && x.id === n, L = w && !B, W = y.contentConfigs[P];
|
|
3164
3151
|
W && W.masks && W.masks.length > 0 ? kt(T, W, (D) => {
|
|
3165
3152
|
l && (D.save(), D.globalAlpha = Q), x.render(D, L, A), l && D.restore();
|
|
3166
3153
|
}) : (l && (T.save(), T.globalAlpha = Q), x.render(T, L, A), l && T.restore());
|
|
@@ -3168,10 +3155,10 @@ const Ve = $t("CanvasRenderer"), K = class K {
|
|
|
3168
3155
|
const v = this._getMaskCanvas(c, d), S = v.getContext("2d");
|
|
3169
3156
|
if (!S) continue;
|
|
3170
3157
|
S.setTransform(1, 0, 0, 1, 0, 0), S.clearRect(0, 0, c, d), S.globalCompositeOperation = "source-over", S.setTransform(u);
|
|
3171
|
-
const
|
|
3158
|
+
const C = y.mask.id === n, R = (s == null ? void 0 : s.type) === "element" && ((f = s == null ? void 0 : s.data) == null ? void 0 : f.id) === y.mask.id;
|
|
3172
3159
|
y.maskConfig && y.maskConfig.masks && y.maskConfig.masks.length > 0 ? kt(S, y.maskConfig, (x) => {
|
|
3173
|
-
l && (x.save(), x.globalAlpha = Q), y.mask.render(x,
|
|
3174
|
-
}) : (l && (S.save(), S.globalAlpha = Q), y.mask.render(S,
|
|
3160
|
+
l && (x.save(), x.globalAlpha = Q), y.mask.render(x, C, R), l && x.restore();
|
|
3161
|
+
}) : (l && (S.save(), S.globalAlpha = Q), y.mask.render(S, C, R), l && S.restore()), T.globalCompositeOperation = "destination-in", T.setTransform(1, 0, 0, 1, 0, 0), T.drawImage(v, 0, 0), t.save(), t.setTransform(1, 0, 0, 1, 0, 0), t.drawImage(m, 0, 0), t.restore();
|
|
3175
3162
|
}
|
|
3176
3163
|
}
|
|
3177
3164
|
// =========================================================================
|
|
@@ -3289,10 +3276,10 @@ const Ve = $t("CanvasRenderer"), K = class K {
|
|
|
3289
3276
|
d,
|
|
3290
3277
|
b,
|
|
3291
3278
|
g
|
|
3292
|
-
), f != null && f.enabled && c &&
|
|
3279
|
+
), f != null && f.enabled && c && Ce(t, f, c, h), y != null && y.enabled && c && Me(t, y, c, h), i && m && n && Dt.renderEditModeLayer(t, n, m, u), u !== 1) {
|
|
3293
3280
|
t.save();
|
|
3294
|
-
const
|
|
3295
|
-
t.setTransform(
|
|
3281
|
+
const C = t.getTransform().a / u, R = p.x * u * C, x = p.y * u * C;
|
|
3282
|
+
t.setTransform(C, 0, 0, C, R, x);
|
|
3296
3283
|
}
|
|
3297
3284
|
const T = r.map((S) => ({
|
|
3298
3285
|
...S,
|
|
@@ -3350,7 +3337,7 @@ const Ve = $t("CanvasRenderer"), K = class K {
|
|
|
3350
3337
|
const m = t.getTransform().a / b, T = g.x * b * m, v = g.y * b * m;
|
|
3351
3338
|
t.setTransform(m, 0, 0, m, T, v);
|
|
3352
3339
|
}
|
|
3353
|
-
if (e &&
|
|
3340
|
+
if (e && Re(e) && e.isCropping)
|
|
3354
3341
|
o && Dt.renderCropBoxLayer(t, e, o, b);
|
|
3355
3342
|
else if (!l && n && mt.renderSelectionLayer(t, e, n, b), o && n && mt.renderPositionSizeInfo(t, e, o, n, b), !l && o && n && mt.renderHandlesLayer(
|
|
3356
3343
|
t,
|
|
@@ -3365,8 +3352,8 @@ const Ve = $t("CanvasRenderer"), K = class K {
|
|
|
3365
3352
|
), !h) {
|
|
3366
3353
|
if (u) {
|
|
3367
3354
|
t.save();
|
|
3368
|
-
const y = u, m = y.x * b, T = y.y * b, v = y.width * b, S = y.height * b,
|
|
3369
|
-
t.beginPath(),
|
|
3355
|
+
const y = u, m = y.x * b, T = y.y * b, v = y.width * b, S = y.height * b, C = (y.borderRadius ?? 0) * b;
|
|
3356
|
+
t.beginPath(), C > 0 ? t.roundRect(m, T, v, S, C) : t.rect(m, T, v, S), t.clip();
|
|
3370
3357
|
}
|
|
3371
3358
|
_t.renderHoverLayer(t, a, r, c, b, d), u && t.restore();
|
|
3372
3359
|
}
|
|
@@ -3376,22 +3363,17 @@ const Ve = $t("CanvasRenderer"), K = class K {
|
|
|
3376
3363
|
K._contentCanvas = null, K._contentCanvasSize = { width: 0, height: 0 }, K._maskCanvas = null, K._maskCanvasSize = { width: 0, height: 0 }, K._cachedElementsRef = null, K._cachedElementConfigs = null, K._cachedElementMap = null, K._knockoutRenderedIds = /* @__PURE__ */ new Set(), K.onRenderError = null;
|
|
3377
3364
|
let Kt = K;
|
|
3378
3365
|
export {
|
|
3379
|
-
|
|
3366
|
+
Ke as A,
|
|
3380
3367
|
Kt as C,
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
Ye as
|
|
3391
|
-
Yt as g,
|
|
3392
|
-
Ge as h,
|
|
3393
|
-
Wt as i,
|
|
3394
|
-
Ke as j,
|
|
3395
|
-
Xe as r
|
|
3368
|
+
Ne as I,
|
|
3369
|
+
Le as R,
|
|
3370
|
+
$e as S,
|
|
3371
|
+
Ge as T,
|
|
3372
|
+
Jt as a,
|
|
3373
|
+
Oe as b,
|
|
3374
|
+
Fe as c,
|
|
3375
|
+
Xe as d,
|
|
3376
|
+
Gt as g,
|
|
3377
|
+
Ye as r
|
|
3396
3378
|
};
|
|
3397
|
-
//# sourceMappingURL=CanvasRenderer-
|
|
3379
|
+
//# sourceMappingURL=CanvasRenderer-6_HhR4-q.js.map
|