@snowcone-app/canvas 0.30.0 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/STYLING_CONTRACT.md +2 -2
- package/dist/{CanvasRenderer-BEf0hXeF.js → CanvasRenderer-hpJ05JGO.js} +4 -4
- package/dist/{CanvasRenderer-BEf0hXeF.js.map → CanvasRenderer-hpJ05JGO.js.map} +1 -1
- package/dist/{CanvasStateV1-BDSyYo4A.js → CanvasStateV1-jLOibojY.js} +11 -4
- package/dist/{CanvasStateV1-BDSyYo4A.js.map → CanvasStateV1-jLOibojY.js.map} +1 -1
- package/dist/{ContextualToolbars-C3D_6sep.js → ContextualToolbars-DRbuUE7W.js} +2086 -1985
- package/dist/ContextualToolbars-DRbuUE7W.js.map +1 -0
- package/dist/{EditorCanvasImpl-DXeBz2CX.js → EditorCanvasImpl-P2GHPNA3.js} +19 -20
- package/dist/{EditorCanvasImpl-DXeBz2CX.js.map → EditorCanvasImpl-P2GHPNA3.js.map} +1 -1
- package/dist/{ExportManager-DUdis6se.js → ExportManager-Bkzzyxgw.js} +400 -261
- package/dist/ExportManager-Bkzzyxgw.js.map +1 -0
- package/dist/{FontAnalyzer-DKG5JK0x.js → FontAnalyzer-BYhwxDhe.js} +1084 -1034
- package/dist/FontAnalyzer-BYhwxDhe.js.map +1 -0
- package/dist/{ImagePanel-CBgGqmVV.js → ImagePanel-CEr0_FYy.js} +49 -49
- package/dist/{ImagePanel-CBgGqmVV.js.map → ImagePanel-CEr0_FYy.js.map} +1 -1
- package/dist/{SnowconeCanvas-BWPBngvI.js → SnowconeCanvas-Fa0isFpO.js} +27 -27
- package/dist/{SnowconeCanvas-BWPBngvI.js.map → SnowconeCanvas-Fa0isFpO.js.map} +1 -1
- package/dist/advanced.mjs +14 -14
- package/dist/components/ImageToolbar.d.ts +4 -0
- package/dist/components/toolbars/EmbeddedToolbarLayout.d.ts +2 -0
- package/dist/components/toolbars/SecondaryPanels.d.ts +17 -1
- package/dist/components/toolbars/index.d.ts +2 -2
- package/dist/components/ui/SliderRow.d.ts +6 -0
- package/dist/components/ui/toolbar-button.d.ts +2 -2
- package/dist/core/image-adjustments.d.ts +32 -0
- package/dist/{custom-icons-BIaRovwG.js → custom-icons-Co4rcW0S.js} +7 -7
- package/dist/{custom-icons-BIaRovwG.js.map → custom-icons-Co4rcW0S.js.map} +1 -1
- package/dist/design-builder-CBG2hKc8.js +1672 -0
- package/dist/design-builder-CBG2hKc8.js.map +1 -0
- package/dist/{embed-Csez1hui.js → embed-D4TIzO7g.js} +110 -111
- package/dist/{embed-Csez1hui.js.map → embed-D4TIzO7g.js.map} +1 -1
- package/dist/embed.mjs +53 -54
- package/dist/embed.mjs.map +1 -1
- package/dist/{guards-BSoX73yg.js → guards-DgZuwVgu.js} +2 -2
- package/dist/{guards-BSoX73yg.js.map → guards-DgZuwVgu.js.map} +1 -1
- package/dist/hooks/elementPatch.d.ts +7 -2
- package/dist/index.mjs +41 -41
- package/dist/internals.mjs +196 -127
- package/dist/internals.mjs.map +1 -1
- package/dist/rendering/element-painters.d.ts +0 -13
- package/dist/rendering/element-serializer.d.ts +3 -1
- package/dist/rendering/image-adjustments.d.ts +24 -0
- package/dist/rendering/renderer-types.d.ts +8 -1
- package/dist/state/CanvasStateV1.d.ts +5 -0
- package/dist/template-fields-CvFcr5zy.js +505 -0
- package/dist/template-fields-CvFcr5zy.js.map +1 -0
- package/dist/testing.mjs +40 -41
- package/dist/testing.mjs.map +1 -1
- package/dist/types/index.d.ts +21 -0
- package/dist/{UnifiedFontService-Co9tQ59z.js → useCommands-bPXY9rCh.js} +2344 -2103
- package/dist/useCommands-bPXY9rCh.js.map +1 -0
- package/dist/{usePieceGuideBundle-CRLY2iQa.js → usePieceGuideBundle-Bj98nPk0.js} +2 -2
- package/dist/{usePieceGuideBundle-CRLY2iQa.js.map → usePieceGuideBundle-Bj98nPk0.js.map} +1 -1
- package/dist/utils/featureApplied.d.ts +2 -0
- package/dist/{validation-BGEl9rrE.js → validation-CsTlSvJJ.js} +465 -465
- package/dist/{validation-BGEl9rrE.js.map → validation-CsTlSvJJ.js.map} +1 -1
- package/dist/workers/export-worker.bundle.string.d.ts +1 -1
- package/example/package.json +1 -1
- package/package.json +1 -1
- package/dist/ContextualToolbars-C3D_6sep.js.map +0 -1
- package/dist/ExportManager-DUdis6se.js.map +0 -1
- package/dist/FontAnalyzer-DKG5JK0x.js.map +0 -1
- package/dist/UnifiedFontService-Co9tQ59z.js.map +0 -1
- package/dist/design-builder-JYLO_Hyi.js +0 -470
- package/dist/design-builder-JYLO_Hyi.js.map +0 -1
- package/dist/editorErrors-WzaNxU1Y.js +0 -1206
- package/dist/editorErrors-WzaNxU1Y.js.map +0 -1
- package/dist/template-fields-DYPW7bVU.js +0 -716
- package/dist/template-fields-DYPW7bVU.js.map +0 -1
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
function
|
|
1
|
+
function ne(r) {
|
|
2
2
|
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
|
|
3
3
|
}
|
|
4
|
-
var
|
|
5
|
-
function
|
|
4
|
+
var Wt = { exports: {} }, O = Wt.exports = {}, X, N;
|
|
5
|
+
function Ct() {
|
|
6
6
|
throw new Error("setTimeout has not been defined");
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function vt() {
|
|
9
9
|
throw new Error("clearTimeout has not been defined");
|
|
10
10
|
}
|
|
11
11
|
(function() {
|
|
12
12
|
try {
|
|
13
|
-
typeof setTimeout == "function" ? X = setTimeout : X =
|
|
13
|
+
typeof setTimeout == "function" ? X = setTimeout : X = Ct;
|
|
14
14
|
} catch {
|
|
15
|
-
X =
|
|
15
|
+
X = Ct;
|
|
16
16
|
}
|
|
17
17
|
try {
|
|
18
|
-
typeof clearTimeout == "function" ?
|
|
18
|
+
typeof clearTimeout == "function" ? N = clearTimeout : N = vt;
|
|
19
19
|
} catch {
|
|
20
|
-
|
|
20
|
+
N = vt;
|
|
21
21
|
}
|
|
22
22
|
})();
|
|
23
|
-
function
|
|
23
|
+
function zt(r) {
|
|
24
24
|
if (X === setTimeout)
|
|
25
25
|
return setTimeout(r, 0);
|
|
26
|
-
if ((X ===
|
|
26
|
+
if ((X === Ct || !X) && setTimeout)
|
|
27
27
|
return X = setTimeout, setTimeout(r, 0);
|
|
28
28
|
try {
|
|
29
29
|
return X(r, 0);
|
|
@@ -35,35 +35,35 @@ function Pt(r) {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
if (
|
|
38
|
+
function ae(r) {
|
|
39
|
+
if (N === clearTimeout)
|
|
40
40
|
return clearTimeout(r);
|
|
41
|
-
if ((
|
|
42
|
-
return
|
|
41
|
+
if ((N === vt || !N) && clearTimeout)
|
|
42
|
+
return N = clearTimeout, clearTimeout(r);
|
|
43
43
|
try {
|
|
44
|
-
return
|
|
44
|
+
return N(r);
|
|
45
45
|
} catch {
|
|
46
46
|
try {
|
|
47
|
-
return
|
|
47
|
+
return N.call(null, r);
|
|
48
48
|
} catch {
|
|
49
|
-
return
|
|
49
|
+
return N.call(this, r);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
var
|
|
54
|
-
function
|
|
55
|
-
!K || !V || (K = !1, V.length ?
|
|
53
|
+
var _ = [], K = !1, V, dt = -1;
|
|
54
|
+
function he() {
|
|
55
|
+
!K || !V || (K = !1, V.length ? _ = V.concat(_) : dt = -1, _.length && Xt());
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function Xt() {
|
|
58
58
|
if (!K) {
|
|
59
|
-
var r =
|
|
59
|
+
var r = zt(he);
|
|
60
60
|
K = !0;
|
|
61
|
-
for (var t =
|
|
62
|
-
for (V =
|
|
61
|
+
for (var t = _.length; t; ) {
|
|
62
|
+
for (V = _, _ = []; ++dt < t; )
|
|
63
63
|
V && V[dt].run();
|
|
64
|
-
dt = -1, t =
|
|
64
|
+
dt = -1, t = _.length;
|
|
65
65
|
}
|
|
66
|
-
V = null, K = !1,
|
|
66
|
+
V = null, K = !1, ae(r);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
O.nextTick = function(r) {
|
|
@@ -71,12 +71,12 @@ O.nextTick = function(r) {
|
|
|
71
71
|
if (arguments.length > 1)
|
|
72
72
|
for (var e = 1; e < arguments.length; e++)
|
|
73
73
|
t[e - 1] = arguments[e];
|
|
74
|
-
|
|
74
|
+
_.push(new Nt(r, t)), _.length === 1 && !K && zt(Xt);
|
|
75
75
|
};
|
|
76
|
-
function
|
|
76
|
+
function Nt(r, t) {
|
|
77
77
|
this.fun = r, this.array = t;
|
|
78
78
|
}
|
|
79
|
-
|
|
79
|
+
Nt.prototype.run = function() {
|
|
80
80
|
this.fun.apply(null, this.array);
|
|
81
81
|
};
|
|
82
82
|
O.title = "browser";
|
|
@@ -85,17 +85,17 @@ O.env = {};
|
|
|
85
85
|
O.argv = [];
|
|
86
86
|
O.version = "";
|
|
87
87
|
O.versions = {};
|
|
88
|
-
function
|
|
89
|
-
}
|
|
90
|
-
O.on =
|
|
91
|
-
O.addListener =
|
|
92
|
-
O.once =
|
|
93
|
-
O.off =
|
|
94
|
-
O.removeListener =
|
|
95
|
-
O.removeAllListeners =
|
|
96
|
-
O.emit =
|
|
97
|
-
O.prependListener =
|
|
98
|
-
O.prependOnceListener =
|
|
88
|
+
function Y() {
|
|
89
|
+
}
|
|
90
|
+
O.on = Y;
|
|
91
|
+
O.addListener = Y;
|
|
92
|
+
O.once = Y;
|
|
93
|
+
O.off = Y;
|
|
94
|
+
O.removeListener = Y;
|
|
95
|
+
O.removeAllListeners = Y;
|
|
96
|
+
O.emit = Y;
|
|
97
|
+
O.prependListener = Y;
|
|
98
|
+
O.prependOnceListener = Y;
|
|
99
99
|
O.listeners = function(r) {
|
|
100
100
|
return [];
|
|
101
101
|
};
|
|
@@ -111,12 +111,12 @@ O.chdir = function(r) {
|
|
|
111
111
|
O.umask = function() {
|
|
112
112
|
return 0;
|
|
113
113
|
};
|
|
114
|
-
var
|
|
115
|
-
const ft = /* @__PURE__ */
|
|
116
|
-
let
|
|
114
|
+
var le = Wt.exports;
|
|
115
|
+
const ft = /* @__PURE__ */ ne(le);
|
|
116
|
+
let Bt = 1;
|
|
117
117
|
class nt {
|
|
118
118
|
constructor(t = {}) {
|
|
119
|
-
this.transformType = "artboard", this.id = t.id || `artboard-${
|
|
119
|
+
this.transformType = "artboard", this.id = t.id || `artboard-${Bt++}`, this.name = t.name || `Artboard ${Bt}`, this.x = t.x !== void 0 ? t.x : 0, this.y = t.y !== void 0 ? t.y : 0, this.width = t.width || 1920, this.height = t.height || 1080, this.backgroundColor = t.backgroundColor || "#ffffff", t.backgroundType ? this.backgroundType = t.backgroundType : t.backgroundColor === "transparent" ? this.backgroundType = "transparent" : t.backgroundTexture ? this.backgroundType = "texture" : this.backgroundType = "color", this.backgroundTexture = t.backgroundTexture, this.exportBackground = t.exportBackground ?? !1, this.clipShape = t.clipShape, this.previewBackgroundColor = t.previewBackgroundColor, this.role = t.role, this.distressTexture = t.distressTexture ? { ...t.distressTexture } : void 0, this.imageMask = t.imageMask ? { ...t.imageMask } : void 0, this.elementIds = new Set(t.elementIds || []);
|
|
120
120
|
}
|
|
121
121
|
/**
|
|
122
122
|
* Get bounding box of the artboard
|
|
@@ -192,7 +192,7 @@ class nt {
|
|
|
192
192
|
* Returns true if point is near the border (within tolerance)
|
|
193
193
|
*/
|
|
194
194
|
hitTestBorder(t, e, i = 5) {
|
|
195
|
-
const
|
|
195
|
+
const s = t >= this.x - i && t <= this.x + this.width + i, o = e >= this.y - i && e <= this.y + this.height + i, a = Math.abs(t - this.x) <= i && o, n = Math.abs(t - (this.x + this.width)) <= i && o, h = Math.abs(e - this.y) <= i && s, l = Math.abs(e - (this.y + this.height)) <= i && s;
|
|
196
196
|
return a || n || h || l;
|
|
197
197
|
}
|
|
198
198
|
/**
|
|
@@ -274,7 +274,7 @@ class nt {
|
|
|
274
274
|
this.x = t, this.y = e;
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
|
-
class
|
|
277
|
+
class ri {
|
|
278
278
|
constructor() {
|
|
279
279
|
this.artboards = /* @__PURE__ */ new Map(), this.elementToArtboard = /* @__PURE__ */ new Map(), this.activeArtboardId = null;
|
|
280
280
|
}
|
|
@@ -302,11 +302,11 @@ class ti {
|
|
|
302
302
|
if (!e)
|
|
303
303
|
return [];
|
|
304
304
|
const i = e.getElementIds();
|
|
305
|
-
if (i.forEach((
|
|
306
|
-
this.elementToArtboard.delete(
|
|
305
|
+
if (i.forEach((s) => {
|
|
306
|
+
this.elementToArtboard.delete(s);
|
|
307
307
|
}), this.artboards.delete(t), this.activeArtboardId === t) {
|
|
308
|
-
const
|
|
309
|
-
this.activeArtboardId =
|
|
308
|
+
const s = Array.from(this.artboards.keys());
|
|
309
|
+
this.activeArtboardId = s.length > 0 ? s[0] : null;
|
|
310
310
|
}
|
|
311
311
|
return i;
|
|
312
312
|
}
|
|
@@ -353,10 +353,10 @@ class ti {
|
|
|
353
353
|
const i = this.artboards.get(e);
|
|
354
354
|
if (!i)
|
|
355
355
|
return !1;
|
|
356
|
-
const
|
|
357
|
-
if (
|
|
358
|
-
const
|
|
359
|
-
|
|
356
|
+
const s = this.elementToArtboard.get(t);
|
|
357
|
+
if (s) {
|
|
358
|
+
const o = this.artboards.get(s);
|
|
359
|
+
o == null || o.removeElementId(t);
|
|
360
360
|
}
|
|
361
361
|
return i.addElementId(t), this.elementToArtboard.set(t, e), !0;
|
|
362
362
|
}
|
|
@@ -396,19 +396,19 @@ class ti {
|
|
|
396
396
|
*/
|
|
397
397
|
findArtboardAtPoint(t, e) {
|
|
398
398
|
const i = Array.from(this.artboards.values()).reverse();
|
|
399
|
-
for (const
|
|
400
|
-
if (
|
|
401
|
-
return
|
|
399
|
+
for (const s of i)
|
|
400
|
+
if (s.containsPoint(t, e))
|
|
401
|
+
return s;
|
|
402
402
|
return null;
|
|
403
403
|
}
|
|
404
404
|
/**
|
|
405
405
|
* Find artboard border at point (for resize handles)
|
|
406
406
|
*/
|
|
407
407
|
findArtboardBorderAtPoint(t, e, i = 5) {
|
|
408
|
-
const
|
|
409
|
-
for (const
|
|
410
|
-
if (
|
|
411
|
-
return
|
|
408
|
+
const s = Array.from(this.artboards.values()).reverse();
|
|
409
|
+
for (const o of s)
|
|
410
|
+
if (o.hitTestBorder(t, e, i))
|
|
411
|
+
return o;
|
|
412
412
|
return null;
|
|
413
413
|
}
|
|
414
414
|
/**
|
|
@@ -449,8 +449,8 @@ class ti {
|
|
|
449
449
|
reorderArtboards(t, e) {
|
|
450
450
|
const i = Array.from(this.artboards.entries());
|
|
451
451
|
if (t < 0 || t >= i.length || e < 0 || e >= i.length || t === e) return;
|
|
452
|
-
const [
|
|
453
|
-
i.splice(e, 0,
|
|
452
|
+
const [s] = i.splice(t, 1);
|
|
453
|
+
i.splice(e, 0, s), this.artboards = new Map(i);
|
|
454
454
|
}
|
|
455
455
|
/**
|
|
456
456
|
* Clear all artboards
|
|
@@ -473,8 +473,8 @@ class ti {
|
|
|
473
473
|
fromJSON(t) {
|
|
474
474
|
this.clear(), t.artboards.forEach((e) => {
|
|
475
475
|
const i = nt.fromJSON(e);
|
|
476
|
-
this.artboards.set(i.id, i), i.getElementIds().forEach((
|
|
477
|
-
this.elementToArtboard.set(
|
|
476
|
+
this.artboards.set(i.id, i), i.getElementIds().forEach((s) => {
|
|
477
|
+
this.elementToArtboard.set(s, i.id);
|
|
478
478
|
});
|
|
479
479
|
}), this.activeArtboardId = t.activeArtboardId;
|
|
480
480
|
}
|
|
@@ -484,11 +484,11 @@ class ti {
|
|
|
484
484
|
*/
|
|
485
485
|
validateMappings(t) {
|
|
486
486
|
const e = new Set(t.map((i) => i.id));
|
|
487
|
-
for (const [i,
|
|
487
|
+
for (const [i, s] of this.elementToArtboard.entries())
|
|
488
488
|
e.has(i) || this.removeElementFromArtboard(i);
|
|
489
489
|
for (const i of this.artboards.values()) {
|
|
490
|
-
const
|
|
491
|
-
i.clearElementIds(),
|
|
490
|
+
const s = i.getElementIds().filter((o) => e.has(o));
|
|
491
|
+
i.clearElementIds(), s.forEach((o) => i.addElementId(o));
|
|
492
492
|
}
|
|
493
493
|
}
|
|
494
494
|
}
|
|
@@ -521,7 +521,7 @@ const I = {
|
|
|
521
521
|
return t > 180 && (t -= 360), t;
|
|
522
522
|
}
|
|
523
523
|
};
|
|
524
|
-
let
|
|
524
|
+
let ce = 1;
|
|
525
525
|
class Q {
|
|
526
526
|
/** Whether this element clips content below it (derived from blendMode === 'clip') */
|
|
527
527
|
get isClipping() {
|
|
@@ -531,7 +531,7 @@ class Q {
|
|
|
531
531
|
t ? (this.blendMode = "clip", this.knockoutParts || (this.knockoutParts = { fill: !0, scope: "group" })) : this.blendMode === "clip" && (this.blendMode = "normal");
|
|
532
532
|
}
|
|
533
533
|
constructor(t = {}) {
|
|
534
|
-
this.id = t.id || `element-${
|
|
534
|
+
this.id = t.id || `element-${ce++}`, this.x = t.x !== void 0 ? t.x : 100, this.y = t.y !== void 0 ? t.y : 100, this.rotation = t.rotation !== void 0 ? t.rotation : 0, this.opacity = t.opacity !== void 0 ? t.opacity : 1, this.transformType = t.transformType || "custom", this.transformData = t.transformData || {}, this.blendMode = t.blendMode, this.knockoutParts = t.knockoutParts, this.stroke = t.stroke, this.masks = t.masks, this.distressEffect = t.distressEffect, t.isClipping && !t.blendMode && (this.blendMode = "clip", this.knockoutParts || (this.knockoutParts = { fill: !0, scope: "group" })), this.name = t.name, this.visible = t.visible !== void 0 ? t.visible : !0, this.locked = t.locked !== void 0 ? t.locked : !1;
|
|
535
535
|
}
|
|
536
536
|
/**
|
|
537
537
|
* Get visual bounding box (tight fit around actual rendered content)
|
|
@@ -554,7 +554,7 @@ class Q {
|
|
|
554
554
|
* Uses visual bounding box for better user experience
|
|
555
555
|
*/
|
|
556
556
|
hitTest(t, e) {
|
|
557
|
-
const i = this.getVisualBoundingBox(),
|
|
557
|
+
const i = this.getVisualBoundingBox(), s = this.getRotationAnchor(), o = I.toRadiansInverse(this.rotation), a = Math.cos(o), n = Math.sin(o), h = t - s.x, l = e - s.y, c = h * a - l * n, g = h * n + l * a, d = s.x + c, f = s.y + g;
|
|
558
558
|
return d >= i.x && d <= i.x + i.width && f >= i.y && f <= i.y + i.height;
|
|
559
559
|
}
|
|
560
560
|
/**
|
|
@@ -665,10 +665,10 @@ class P {
|
|
|
665
665
|
* @returns Point in local coordinates
|
|
666
666
|
*/
|
|
667
667
|
worldToLocal(t, e) {
|
|
668
|
-
const i = this.element.rotation * Math.PI / 180,
|
|
668
|
+
const i = this.element.rotation * Math.PI / 180, s = Math.cos(i), o = Math.sin(i), a = t - this.element.x, n = e - this.element.y;
|
|
669
669
|
return {
|
|
670
|
-
x: a *
|
|
671
|
-
y: a *
|
|
670
|
+
x: a * s - n * o,
|
|
671
|
+
y: a * o + n * s
|
|
672
672
|
};
|
|
673
673
|
}
|
|
674
674
|
/**
|
|
@@ -681,7 +681,7 @@ class P {
|
|
|
681
681
|
* @returns Point in world coordinates
|
|
682
682
|
*/
|
|
683
683
|
localToWorld(t, e) {
|
|
684
|
-
const i = -this.element.rotation * Math.PI / 180,
|
|
684
|
+
const i = -this.element.rotation * Math.PI / 180, s = Math.cos(i), o = Math.sin(i), a = t * s - e * o, n = t * o + e * s;
|
|
685
685
|
return {
|
|
686
686
|
x: this.element.x + a,
|
|
687
687
|
y: this.element.y + n
|
|
@@ -697,10 +697,10 @@ class P {
|
|
|
697
697
|
* @returns Delta in local space
|
|
698
698
|
*/
|
|
699
699
|
worldDeltaToLocal(t, e) {
|
|
700
|
-
const i = this.element.rotation * Math.PI / 180,
|
|
700
|
+
const i = this.element.rotation * Math.PI / 180, s = Math.cos(i), o = Math.sin(i);
|
|
701
701
|
return {
|
|
702
|
-
dx: t *
|
|
703
|
-
dy: t *
|
|
702
|
+
dx: t * s - e * o,
|
|
703
|
+
dy: t * o + e * s
|
|
704
704
|
};
|
|
705
705
|
}
|
|
706
706
|
/**
|
|
@@ -712,10 +712,10 @@ class P {
|
|
|
712
712
|
* @returns Delta in world space
|
|
713
713
|
*/
|
|
714
714
|
localDeltaToWorld(t, e) {
|
|
715
|
-
const i = -this.element.rotation * Math.PI / 180,
|
|
715
|
+
const i = -this.element.rotation * Math.PI / 180, s = Math.cos(i), o = Math.sin(i);
|
|
716
716
|
return {
|
|
717
|
-
dx: t *
|
|
718
|
-
dy: t *
|
|
717
|
+
dx: t * s - e * o,
|
|
718
|
+
dy: t * o + e * s
|
|
719
719
|
};
|
|
720
720
|
}
|
|
721
721
|
/**
|
|
@@ -729,11 +729,11 @@ class P {
|
|
|
729
729
|
* @param angleDegrees - Rotation angle in degrees (positive = clockwise in UI)
|
|
730
730
|
* @returns Rotated point in world space
|
|
731
731
|
*/
|
|
732
|
-
static rotatePointAroundAnchor(t, e, i,
|
|
733
|
-
const a = -
|
|
732
|
+
static rotatePointAroundAnchor(t, e, i, s, o) {
|
|
733
|
+
const a = -o * Math.PI / 180, n = Math.cos(a), h = Math.sin(a), l = t - i, c = e - s, g = l * n - c * h, d = l * h + c * n;
|
|
734
734
|
return {
|
|
735
735
|
x: i + g,
|
|
736
|
-
y:
|
|
736
|
+
y: s + d
|
|
737
737
|
};
|
|
738
738
|
}
|
|
739
739
|
/**
|
|
@@ -791,7 +791,7 @@ class P {
|
|
|
791
791
|
return new P(t);
|
|
792
792
|
}
|
|
793
793
|
}
|
|
794
|
-
const
|
|
794
|
+
const de = [
|
|
795
795
|
// Bold/Display Fonts - Perfect for statements and headlines (49 fonts)
|
|
796
796
|
{
|
|
797
797
|
name: "Bebas Neue",
|
|
@@ -2267,10 +2267,10 @@ const he = [
|
|
|
2267
2267
|
description: "Humanist monospace"
|
|
2268
2268
|
}
|
|
2269
2269
|
];
|
|
2270
|
-
function
|
|
2271
|
-
return
|
|
2270
|
+
function ge() {
|
|
2271
|
+
return de.map((r) => r.name);
|
|
2272
2272
|
}
|
|
2273
|
-
const
|
|
2273
|
+
const ni = {
|
|
2274
2274
|
system: "System Fonts",
|
|
2275
2275
|
display: "Bold & Display",
|
|
2276
2276
|
"sans-serif": "Sans Serif",
|
|
@@ -2282,99 +2282,99 @@ const ei = {
|
|
|
2282
2282
|
decorative: "Decorative & Unique",
|
|
2283
2283
|
monospace: "Monospace"
|
|
2284
2284
|
};
|
|
2285
|
-
function
|
|
2285
|
+
function _t(r) {
|
|
2286
2286
|
if (typeof window > "u" || typeof document > "u")
|
|
2287
2287
|
return "oklch(0% 0 0)";
|
|
2288
2288
|
const t = r || document.documentElement;
|
|
2289
2289
|
return getComputedStyle(t).getPropertyValue("--accent").trim() || "oklch(0% 0 0)";
|
|
2290
2290
|
}
|
|
2291
|
-
function
|
|
2291
|
+
function fe(r) {
|
|
2292
2292
|
return typeof window > "u" || typeof document > "u" ? "light" : document.documentElement.getAttribute("data-theme") || "light";
|
|
2293
2293
|
}
|
|
2294
|
-
function
|
|
2295
|
-
return
|
|
2294
|
+
function Yt() {
|
|
2295
|
+
return fe().includes("dark") ? "#60a5fa" : "#3b82f6";
|
|
2296
2296
|
}
|
|
2297
|
-
function
|
|
2297
|
+
function ai(r) {
|
|
2298
2298
|
if (typeof window > "u" || typeof document > "u")
|
|
2299
2299
|
return "#FF0000";
|
|
2300
2300
|
const t = r || document.documentElement;
|
|
2301
2301
|
return getComputedStyle(t).getPropertyValue("--color-spacing-indicator").trim() || "#FF0000";
|
|
2302
2302
|
}
|
|
2303
|
-
function
|
|
2304
|
-
const e =
|
|
2303
|
+
function hi(r = 0.1, t) {
|
|
2304
|
+
const e = _t(t);
|
|
2305
2305
|
if (e.startsWith("oklch("))
|
|
2306
2306
|
return `${e.slice(0, -1)} / ${r})`;
|
|
2307
2307
|
if (e.startsWith("#")) {
|
|
2308
|
-
const i = e.replace("#", ""),
|
|
2309
|
-
return `rgba(${
|
|
2308
|
+
const i = e.replace("#", ""), s = parseInt(i.substring(0, 2), 16), o = parseInt(i.substring(2, 4), 16), a = parseInt(i.substring(4, 6), 16);
|
|
2309
|
+
return `rgba(${s}, ${o}, ${a}, ${r})`;
|
|
2310
2310
|
}
|
|
2311
2311
|
return e;
|
|
2312
2312
|
}
|
|
2313
|
-
function
|
|
2313
|
+
function li(r) {
|
|
2314
2314
|
if (typeof window > "u" || typeof document > "u")
|
|
2315
2315
|
return "oklch(0% 0 0 / 0.45)";
|
|
2316
2316
|
const t = r || document.documentElement;
|
|
2317
2317
|
return getComputedStyle(t).getPropertyValue("--color-text-selection").trim() || "oklch(0% 0 0 / 0.45)";
|
|
2318
2318
|
}
|
|
2319
|
-
function
|
|
2319
|
+
function ci(r) {
|
|
2320
2320
|
if (typeof window > "u" || typeof document > "u")
|
|
2321
2321
|
return "#b5f747";
|
|
2322
2322
|
const t = r || document.documentElement;
|
|
2323
2323
|
return getComputedStyle(t).getPropertyValue("--color-accent-hover").trim() || "#b5f747";
|
|
2324
2324
|
}
|
|
2325
|
-
function
|
|
2325
|
+
function ue(r) {
|
|
2326
2326
|
if (typeof window > "u" || typeof document > "u")
|
|
2327
2327
|
return "oklch(0.2103 0.0059 285.89)";
|
|
2328
2328
|
const t = r || document.documentElement;
|
|
2329
2329
|
return getComputedStyle(t).getPropertyValue("--foreground").trim() || "oklch(0.2103 0.0059 285.89)";
|
|
2330
2330
|
}
|
|
2331
|
-
function
|
|
2331
|
+
function di(r) {
|
|
2332
2332
|
if (typeof window > "u" || typeof document > "u")
|
|
2333
2333
|
return "oklch(0.9607 0 0)";
|
|
2334
2334
|
const t = r || document.documentElement;
|
|
2335
2335
|
return getComputedStyle(t).getPropertyValue("--background").trim() || "oklch(0.9607 0 0)";
|
|
2336
2336
|
}
|
|
2337
|
-
function
|
|
2338
|
-
const t =
|
|
2337
|
+
function gi(r) {
|
|
2338
|
+
const t = ue(r);
|
|
2339
2339
|
return t.startsWith("oklch(") ? `${t.slice(0, -1)} / 0.2)` : "rgba(0,0,0,0.2)";
|
|
2340
2340
|
}
|
|
2341
|
-
function
|
|
2341
|
+
function fi(r) {
|
|
2342
2342
|
if (typeof window > "u" || typeof document > "u")
|
|
2343
2343
|
return "oklch(0% 0 0 / 0.2)";
|
|
2344
2344
|
const t = document.documentElement;
|
|
2345
2345
|
return getComputedStyle(t).getPropertyValue("--divider").trim() || "oklch(0% 0 0 / 0.2)";
|
|
2346
2346
|
}
|
|
2347
|
-
function
|
|
2347
|
+
function ui(r) {
|
|
2348
2348
|
if (typeof window > "u" || typeof document > "u")
|
|
2349
2349
|
return "oklch(0% 0 0 / 0.5)";
|
|
2350
2350
|
const t = document.documentElement, e = getComputedStyle(t).getPropertyValue("--foreground").trim();
|
|
2351
2351
|
return e.startsWith("oklch(") ? `${e.slice(0, -1)} / 0.5)` : e || "oklch(0% 0 0 / 0.5)";
|
|
2352
2352
|
}
|
|
2353
|
-
function
|
|
2353
|
+
function mi(r) {
|
|
2354
2354
|
if (typeof window > "u" || typeof document > "u")
|
|
2355
2355
|
return "#b5f747";
|
|
2356
2356
|
const t = document.documentElement;
|
|
2357
2357
|
return getComputedStyle(t).getPropertyValue("--color-accent-hover-border").trim() || "#b5f747";
|
|
2358
2358
|
}
|
|
2359
|
-
function
|
|
2359
|
+
function pi(r) {
|
|
2360
2360
|
if (typeof window > "u" || typeof document > "u")
|
|
2361
2361
|
return "oklch(0.2103 0.0059 285.89)";
|
|
2362
2362
|
const t = document.documentElement;
|
|
2363
2363
|
return getComputedStyle(t).getPropertyValue("--foreground").trim() || "oklch(0.2103 0.0059 285.89)";
|
|
2364
2364
|
}
|
|
2365
|
-
function
|
|
2365
|
+
function yi(r) {
|
|
2366
2366
|
if (typeof window > "u" || typeof document > "u")
|
|
2367
2367
|
return "oklch(1 0 0)";
|
|
2368
2368
|
const t = document.documentElement;
|
|
2369
2369
|
return getComputedStyle(t).getPropertyValue("--background").trim() || "oklch(1 0 0)";
|
|
2370
2370
|
}
|
|
2371
|
-
function
|
|
2371
|
+
function wi(r) {
|
|
2372
2372
|
if (typeof window > "u" || typeof document > "u")
|
|
2373
2373
|
return "oklch(0.2103 0.0059 285.89 / 0.5)";
|
|
2374
2374
|
const t = document.documentElement, e = getComputedStyle(t).getPropertyValue("--foreground").trim();
|
|
2375
2375
|
return e.startsWith("oklch(") ? `${e.slice(0, -1)} / 0.5)` : e || "oklch(0.2103 0.0059 285.89 / 0.5)";
|
|
2376
2376
|
}
|
|
2377
|
-
const
|
|
2377
|
+
const bi = 1, xi = "#ffffff", me = 20, Si = 6, Ci = 24, pe = 16, ye = 36, we = 24, vi = 4, Ti = "#FFFFFF", Fi = 2, Ai = 0.1, Mi = ge(), Di = [8, 10, 12, 14, 16, 18, 20, 24, 28, 32, 36, 48, 64, 72, 96, 128], j = 0, Ut = 1.2, Gt = 50, be = 8, xe = 999, Se = /* @__PURE__ */ new Set([
|
|
2378
2378
|
"Arial",
|
|
2379
2379
|
"Arial Black",
|
|
2380
2380
|
"Verdana",
|
|
@@ -2395,9 +2395,9 @@ const ui = 1, mi = "#ffffff", ge = 20, pi = 6, yi = 24, fe = 16, ue = 36, me = 2
|
|
|
2395
2395
|
"Monaco",
|
|
2396
2396
|
"Consolas",
|
|
2397
2397
|
"Courier"
|
|
2398
|
-
]),
|
|
2399
|
-
var
|
|
2400
|
-
class
|
|
2398
|
+
]), Ce = 0.3;
|
|
2399
|
+
var ve = /* @__PURE__ */ ((r) => (r[r.DEBUG = 0] = "DEBUG", r[r.INFO = 1] = "INFO", r[r.WARN = 2] = "WARN", r[r.ERROR = 3] = "ERROR", r[r.NONE = 4] = "NONE", r))(ve || {});
|
|
2400
|
+
class Te {
|
|
2401
2401
|
constructor() {
|
|
2402
2402
|
var t;
|
|
2403
2403
|
this.level = 0, this.enabled = typeof ft < "u" && ((t = ft.env) == null ? void 0 : t.NODE_ENV) !== "production";
|
|
@@ -2454,10 +2454,10 @@ class Se {
|
|
|
2454
2454
|
* Create a scoped logger with a prefix for a specific module
|
|
2455
2455
|
*/
|
|
2456
2456
|
scope(t) {
|
|
2457
|
-
return new
|
|
2457
|
+
return new Fe(this, t);
|
|
2458
2458
|
}
|
|
2459
2459
|
}
|
|
2460
|
-
class
|
|
2460
|
+
class Fe {
|
|
2461
2461
|
constructor(t, e) {
|
|
2462
2462
|
this.logger = t, this.scopeName = e;
|
|
2463
2463
|
}
|
|
@@ -2474,8 +2474,8 @@ class Ce {
|
|
|
2474
2474
|
this.logger.error(`[${this.scopeName}] ${t}`, ...e);
|
|
2475
2475
|
}
|
|
2476
2476
|
}
|
|
2477
|
-
const
|
|
2478
|
-
function
|
|
2477
|
+
const Ae = new Te(), pt = (r) => Ae.scope(r), Me = pt("ImageLoadEvents"), Tt = /* @__PURE__ */ new Set();
|
|
2478
|
+
function Ii(r) {
|
|
2479
2479
|
return Tt.add(r), () => {
|
|
2480
2480
|
Tt.delete(r);
|
|
2481
2481
|
};
|
|
@@ -2485,7 +2485,7 @@ function et(r) {
|
|
|
2485
2485
|
try {
|
|
2486
2486
|
t(r);
|
|
2487
2487
|
} catch (e) {
|
|
2488
|
-
|
|
2488
|
+
Me.error("Listener error:", e);
|
|
2489
2489
|
}
|
|
2490
2490
|
});
|
|
2491
2491
|
}
|
|
@@ -2513,16 +2513,16 @@ class J {
|
|
|
2513
2513
|
return e.refCount++, e.image;
|
|
2514
2514
|
const i = new Image();
|
|
2515
2515
|
i.crossOrigin = "anonymous";
|
|
2516
|
-
const
|
|
2516
|
+
const s = {
|
|
2517
2517
|
image: i,
|
|
2518
2518
|
refCount: 1,
|
|
2519
2519
|
loaded: !1
|
|
2520
2520
|
};
|
|
2521
2521
|
return i.onload = () => {
|
|
2522
|
-
|
|
2522
|
+
s.loaded = !0;
|
|
2523
2523
|
}, i.onerror = () => {
|
|
2524
|
-
|
|
2525
|
-
}, this.cache.set(t,
|
|
2524
|
+
s.loaded = !0;
|
|
2525
|
+
}, this.cache.set(t, s), (!t.includes(":") || /^https?:\/\/|^data:|^blob:/.test(t)) && (i.src = t), i;
|
|
2526
2526
|
}
|
|
2527
2527
|
/**
|
|
2528
2528
|
* Release a reference to a cached image.
|
|
@@ -2571,26 +2571,62 @@ class J {
|
|
|
2571
2571
|
this.cache.clear();
|
|
2572
2572
|
}
|
|
2573
2573
|
}
|
|
2574
|
-
const
|
|
2574
|
+
const ki = Object.freeze({
|
|
2575
|
+
brightness: 1,
|
|
2576
|
+
contrast: 1,
|
|
2577
|
+
saturation: 1
|
|
2578
|
+
}), xt = 1e-3;
|
|
2579
|
+
function Dt(r) {
|
|
2580
|
+
return r ? Math.abs(r.brightness - 1) < xt && Math.abs(r.contrast - 1) < xt && Math.abs(r.saturation - 1) < xt : !0;
|
|
2581
|
+
}
|
|
2582
|
+
function De(r) {
|
|
2583
|
+
if (Dt(r)) return;
|
|
2584
|
+
const t = (e) => Math.round(e * 100) / 100;
|
|
2585
|
+
return {
|
|
2586
|
+
brightness: t(r.brightness),
|
|
2587
|
+
contrast: t(r.contrast),
|
|
2588
|
+
saturation: t(r.saturation)
|
|
2589
|
+
};
|
|
2590
|
+
}
|
|
2591
|
+
function Ei(r) {
|
|
2592
|
+
if (Dt(r)) return "neutral";
|
|
2593
|
+
const t = r;
|
|
2594
|
+
return `b${t.brightness}c${t.contrast}s${t.saturation}`;
|
|
2595
|
+
}
|
|
2596
|
+
let Ft = null;
|
|
2597
|
+
function Oi(r) {
|
|
2598
|
+
Ft = r;
|
|
2599
|
+
}
|
|
2600
|
+
function Ie(r, t) {
|
|
2601
|
+
if (Dt(t)) return r;
|
|
2602
|
+
if (!Ft)
|
|
2603
|
+
throw new Error(
|
|
2604
|
+
"[image-adjustments] no adjusted-source provider registered. Painting an image with non-neutral adjustments requires the rendering engine: import 'src/rendering/image-adjustments.js' (rendering/element-painters does this for every paint driver; a direct element.render() call in a test must import it too)."
|
|
2605
|
+
);
|
|
2606
|
+
return Ft(r, t);
|
|
2607
|
+
}
|
|
2608
|
+
const it = pt("ImageElement"), Rt = 3e4, Ht = 3, ke = 1e3;
|
|
2575
2609
|
function x(r) {
|
|
2576
2610
|
return r.transformData;
|
|
2577
2611
|
}
|
|
2578
2612
|
class yt extends Q {
|
|
2579
2613
|
// Track URL acquired from ImageCache for release on destroy
|
|
2580
2614
|
constructor(t = {}) {
|
|
2581
|
-
var
|
|
2615
|
+
var i, s, o, a, n, h, l, c, g, d, f;
|
|
2582
2616
|
super(t), this.svgBlobUrl = null, this.loadTimeoutId = null, this.retryAttempt = 0, this.cachedImageUrl = null, this.transformType = "image", this.transformData = {
|
|
2583
2617
|
type: "image",
|
|
2584
|
-
width: ((
|
|
2585
|
-
height: ((
|
|
2618
|
+
width: ((i = t.transformData) == null ? void 0 : i.width) || 200,
|
|
2619
|
+
height: ((s = t.transformData) == null ? void 0 : s.height) || 200,
|
|
2586
2620
|
cropX: ((o = t.transformData) == null ? void 0 : o.cropX) ?? 0,
|
|
2587
|
-
cropY: ((
|
|
2588
|
-
cropWidth: ((
|
|
2589
|
-
cropHeight: ((
|
|
2590
|
-
flipHorizontal: ((
|
|
2591
|
-
flipVertical: ((
|
|
2592
|
-
borderRadius: ((
|
|
2593
|
-
}
|
|
2621
|
+
cropY: ((a = t.transformData) == null ? void 0 : a.cropY) ?? 0,
|
|
2622
|
+
cropWidth: ((n = t.transformData) == null ? void 0 : n.cropWidth) ?? 1,
|
|
2623
|
+
cropHeight: ((h = t.transformData) == null ? void 0 : h.cropHeight) ?? 1,
|
|
2624
|
+
flipHorizontal: ((l = t.transformData) == null ? void 0 : l.flipHorizontal) ?? !1,
|
|
2625
|
+
flipVertical: ((c = t.transformData) == null ? void 0 : c.flipVertical) ?? !1,
|
|
2626
|
+
borderRadius: ((g = t.transformData) == null ? void 0 : g.borderRadius) ?? 0
|
|
2627
|
+
};
|
|
2628
|
+
const e = De((d = t.transformData) == null ? void 0 : d.adjustments);
|
|
2629
|
+
e && (this.transformData.adjustments = e), this.imageUrl = t.imageUrl || "", this.imageLoaded = !1, this.imageElement = null, this.imageAspectRatio = t.imageAspectRatio || 1, this.isSvg = ((f = t.imageUrl) == null ? void 0 : f.toLowerCase().endsWith(".svg")) || !1, this.preserveDimensions = t.preserveDimensions ?? !1, this.imageLoadState = t.imageUrl ? "loading" : "loaded", this.imageLoadError = null, this.isCropping = !1, this.onLoadCallback = t.onLoadCallback || null, this.imageUrl && this.loadImage(this.imageUrl);
|
|
2594
2630
|
}
|
|
2595
2631
|
/**
|
|
2596
2632
|
* Load image from URL
|
|
@@ -2619,40 +2655,40 @@ class yt extends Q {
|
|
|
2619
2655
|
this.clearLoadTimeout(), this.releaseImageCache();
|
|
2620
2656
|
const i = J.getInstance().acquire(t);
|
|
2621
2657
|
this.cachedImageUrl = t;
|
|
2622
|
-
let
|
|
2623
|
-
const
|
|
2624
|
-
|
|
2658
|
+
let s = !1;
|
|
2659
|
+
const o = () => {
|
|
2660
|
+
s = !0, this.clearLoadTimeout();
|
|
2625
2661
|
};
|
|
2626
2662
|
if (i.complete && i.naturalWidth > 0) {
|
|
2627
|
-
|
|
2663
|
+
o(), this.imageElement = i, this.imageLoaded = !0, this.imageLoadState = "loaded", this.imageLoadError = null, this.imageAspectRatio = i.naturalWidth / i.naturalHeight, this.preserveDimensions || (this.transformData.height = this.transformData.width / this.imageAspectRatio), this.onLoadCallback && this.onLoadCallback(this.clone()), et(this.id);
|
|
2628
2664
|
return;
|
|
2629
2665
|
}
|
|
2630
2666
|
const a = i.onload, n = i.onerror;
|
|
2631
2667
|
i.onload = (l) => {
|
|
2632
|
-
|
|
2668
|
+
s || (o(), this.imageElement = i, this.imageLoaded = !0, this.imageLoadState = "loaded", this.imageLoadError = null, this.imageAspectRatio = i.naturalWidth / i.naturalHeight, this.preserveDimensions || (this.transformData.height = this.transformData.width / this.imageAspectRatio), this.onLoadCallback && this.onLoadCallback(this.clone()), et(this.id), a && a !== i.onload && a(l));
|
|
2633
2669
|
}, i.onerror = (l) => {
|
|
2634
|
-
if (
|
|
2635
|
-
|
|
2670
|
+
if (s) return;
|
|
2671
|
+
o();
|
|
2636
2672
|
const c = new Error(`Failed to load image: ${t}`);
|
|
2637
2673
|
this.handleLoadFailure(t, c), n && n !== i.onerror && n(l);
|
|
2638
2674
|
}, this.loadTimeoutId = setTimeout(() => {
|
|
2639
|
-
if (
|
|
2640
|
-
|
|
2641
|
-
const l = new Error(`Image load timed out after ${
|
|
2675
|
+
if (s) return;
|
|
2676
|
+
o(), i.src = "";
|
|
2677
|
+
const l = new Error(`Image load timed out after ${Rt}ms: ${t}`);
|
|
2642
2678
|
this.handleLoadFailure(t, l);
|
|
2643
|
-
},
|
|
2679
|
+
}, Rt), (!i.src || i.src !== t) && (i.src = t), !s && i.complete && i.naturalWidth > 0 && ((h = i.onload) == null || h.call(i, new Event("load")));
|
|
2644
2680
|
}
|
|
2645
2681
|
/**
|
|
2646
2682
|
* Handle a load failure - either retry with backoff or set error state.
|
|
2647
2683
|
*/
|
|
2648
2684
|
handleLoadFailure(t, e) {
|
|
2649
|
-
if (this.retryAttempt++, this.retryAttempt <
|
|
2650
|
-
const i =
|
|
2685
|
+
if (this.retryAttempt++, this.retryAttempt < Ht) {
|
|
2686
|
+
const i = ke * Math.pow(2, this.retryAttempt - 1);
|
|
2651
2687
|
it.warn(`Image load attempt ${this.retryAttempt} failed, retrying in ${i}ms:`, t), this.imageLoadState = "retrying", this.imageLoadError = e, et(this.id), this.loadTimeoutId = setTimeout(() => {
|
|
2652
2688
|
this.attemptLoadRegularImage(t);
|
|
2653
2689
|
}, i);
|
|
2654
2690
|
} else
|
|
2655
|
-
it.error(`Image load failed after ${
|
|
2691
|
+
it.error(`Image load failed after ${Ht} attempts:`, t), this.imageLoaded = !1, this.imageLoadState = "error", this.imageLoadError = e, et(this.id);
|
|
2656
2692
|
}
|
|
2657
2693
|
/**
|
|
2658
2694
|
* Clear any pending load timeout
|
|
@@ -2689,10 +2725,10 @@ class yt extends Q {
|
|
|
2689
2725
|
this.revokeSvgBlobUrl();
|
|
2690
2726
|
const e = new Image();
|
|
2691
2727
|
e.crossOrigin = "anonymous", e.onload = () => {
|
|
2692
|
-
const
|
|
2693
|
-
|
|
2694
|
-
const
|
|
2695
|
-
|
|
2728
|
+
const s = document.createElement("canvas");
|
|
2729
|
+
s.width = e.width * 4, s.height = e.height * 4;
|
|
2730
|
+
const o = s.getContext("2d");
|
|
2731
|
+
o.scale(4, 4), o.drawImage(e, 0, 0), s.toBlob((a) => {
|
|
2696
2732
|
if (!a) {
|
|
2697
2733
|
it.error("Failed to convert SVG to blob"), this.imageLoaded = !1;
|
|
2698
2734
|
return;
|
|
@@ -2713,10 +2749,10 @@ class yt extends Q {
|
|
|
2713
2749
|
getBoundingBox() {
|
|
2714
2750
|
if (this.isCropping) {
|
|
2715
2751
|
const t = this.transformData.width * this.transformData.cropWidth, e = this.transformData.height * this.transformData.cropHeight;
|
|
2716
|
-
let i = this.transformData.width / 2 - (this.transformData.cropX * this.transformData.width + t / 2),
|
|
2717
|
-
const
|
|
2718
|
-
i *=
|
|
2719
|
-
const n = Math.cos(I.toRadians(this.rotation)), h = Math.sin(I.toRadians(this.rotation)), l = i * n -
|
|
2752
|
+
let i = this.transformData.width / 2 - (this.transformData.cropX * this.transformData.width + t / 2), s = this.transformData.height / 2 - (this.transformData.cropY * this.transformData.height + e / 2);
|
|
2753
|
+
const o = this.transformData.flipHorizontal ? -1 : 1, a = this.transformData.flipVertical ? -1 : 1;
|
|
2754
|
+
i *= o, s *= a;
|
|
2755
|
+
const n = Math.cos(I.toRadians(this.rotation)), h = Math.sin(I.toRadians(this.rotation)), l = i * n - s * h, c = i * h + s * n, g = this.x + l, d = this.y + c;
|
|
2720
2756
|
return {
|
|
2721
2757
|
x: g - this.transformData.width / 2,
|
|
2722
2758
|
y: d - this.transformData.height / 2,
|
|
@@ -2754,10 +2790,10 @@ class yt extends Q {
|
|
|
2754
2790
|
getRotationAnchor() {
|
|
2755
2791
|
if (this.isCropping) {
|
|
2756
2792
|
const t = this.transformData.width * this.transformData.cropWidth, e = this.transformData.height * this.transformData.cropHeight;
|
|
2757
|
-
let i = this.transformData.width / 2 - (this.transformData.cropX * this.transformData.width + t / 2),
|
|
2758
|
-
const
|
|
2759
|
-
i *=
|
|
2760
|
-
const n = Math.cos(I.toRadians(this.rotation)), h = Math.sin(I.toRadians(this.rotation)), l = i * n -
|
|
2793
|
+
let i = this.transformData.width / 2 - (this.transformData.cropX * this.transformData.width + t / 2), s = this.transformData.height / 2 - (this.transformData.cropY * this.transformData.height + e / 2);
|
|
2794
|
+
const o = this.transformData.flipHorizontal ? -1 : 1, a = this.transformData.flipVertical ? -1 : 1;
|
|
2795
|
+
i *= o, s *= a;
|
|
2796
|
+
const n = Math.cos(I.toRadians(this.rotation)), h = Math.sin(I.toRadians(this.rotation)), l = i * n - s * h, c = i * h + s * n;
|
|
2761
2797
|
return {
|
|
2762
2798
|
x: this.x + l,
|
|
2763
2799
|
y: this.y + c
|
|
@@ -2774,10 +2810,10 @@ class yt extends Q {
|
|
|
2774
2810
|
hitTest(t, e) {
|
|
2775
2811
|
const i = this.worldToLocal(t, e);
|
|
2776
2812
|
if (this.isCropping) {
|
|
2777
|
-
const
|
|
2813
|
+
const s = this.transformData.width * this.transformData.cropWidth, o = this.transformData.height * this.transformData.cropHeight, a = this.transformData.width / 2 - (this.transformData.cropX * this.transformData.width + s / 2), n = this.transformData.height / 2 - (this.transformData.cropY * this.transformData.height + o / 2), h = this.transformData.width / 2, l = this.transformData.height / 2;
|
|
2778
2814
|
return i.x >= a - h && i.x <= a + h && i.y >= n - l && i.y <= n + l;
|
|
2779
2815
|
} else {
|
|
2780
|
-
const
|
|
2816
|
+
const s = this.transformData.width * this.transformData.cropWidth, o = this.transformData.height * this.transformData.cropHeight, a = s / 2, n = o / 2;
|
|
2781
2817
|
return i.x >= -a && i.x <= a && i.y >= -n && i.y <= n;
|
|
2782
2818
|
}
|
|
2783
2819
|
}
|
|
@@ -2789,57 +2825,61 @@ class yt extends Q {
|
|
|
2789
2825
|
this.renderPlaceholder(t);
|
|
2790
2826
|
return;
|
|
2791
2827
|
}
|
|
2828
|
+
const s = Ie(
|
|
2829
|
+
this.imageElement,
|
|
2830
|
+
this.transformData.adjustments
|
|
2831
|
+
), o = s.width, a = s.height;
|
|
2792
2832
|
t.save(), this.opacity !== void 0 && this.opacity !== 1 && (t.globalAlpha = this.opacity), t.translate(this.x, this.y), t.rotate(I.toRadians(this.rotation));
|
|
2793
|
-
const
|
|
2794
|
-
if (t.scale(
|
|
2795
|
-
const
|
|
2796
|
-
if (
|
|
2833
|
+
const n = this.transformData.flipHorizontal ? -1 : 1, h = this.transformData.flipVertical ? -1 : 1;
|
|
2834
|
+
if (t.scale(n, h), this.isCropping) {
|
|
2835
|
+
const l = this.transformData.width * this.transformData.cropWidth, c = this.transformData.height * this.transformData.cropHeight, g = this.transformData.width / 2 - (this.transformData.cropX * this.transformData.width + l / 2), d = this.transformData.height / 2 - (this.transformData.cropY * this.transformData.height + c / 2), f = g - this.transformData.width / 2, u = d - this.transformData.height / 2, m = this.transformData.borderRadius || 0;
|
|
2836
|
+
if (m > 0) {
|
|
2797
2837
|
t.save();
|
|
2798
|
-
const
|
|
2799
|
-
|
|
2838
|
+
const p = Math.min(
|
|
2839
|
+
m / 100 * Math.min(this.transformData.width, this.transformData.height),
|
|
2800
2840
|
this.transformData.width / 2,
|
|
2801
2841
|
this.transformData.height / 2
|
|
2802
2842
|
);
|
|
2803
|
-
t.beginPath(), t.roundRect(
|
|
2843
|
+
t.beginPath(), t.roundRect(f, u, this.transformData.width, this.transformData.height, p), t.clip();
|
|
2804
2844
|
}
|
|
2805
2845
|
t.drawImage(
|
|
2806
|
-
|
|
2846
|
+
s,
|
|
2807
2847
|
0,
|
|
2808
2848
|
0,
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2849
|
+
o,
|
|
2850
|
+
a,
|
|
2851
|
+
f,
|
|
2852
|
+
u,
|
|
2813
2853
|
this.transformData.width,
|
|
2814
2854
|
this.transformData.height
|
|
2815
|
-
),
|
|
2855
|
+
), m > 0 && t.restore();
|
|
2816
2856
|
} else if (this.masks && this.masks.length > 0) {
|
|
2817
|
-
const
|
|
2857
|
+
const l = this.transformData.width * this.transformData.cropWidth, c = this.transformData.height * this.transformData.cropHeight, g = -l / 2, d = -c / 2, f = g - this.transformData.cropX * this.transformData.width, u = d - this.transformData.cropY * this.transformData.height;
|
|
2818
2858
|
t.drawImage(
|
|
2819
|
-
|
|
2859
|
+
s,
|
|
2820
2860
|
0,
|
|
2821
2861
|
0,
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2862
|
+
o,
|
|
2863
|
+
a,
|
|
2864
|
+
f,
|
|
2865
|
+
u,
|
|
2826
2866
|
this.transformData.width,
|
|
2827
2867
|
this.transformData.height
|
|
2828
2868
|
);
|
|
2829
2869
|
} else {
|
|
2830
|
-
const
|
|
2870
|
+
const l = this.transformData.width * this.transformData.cropWidth, c = this.transformData.height * this.transformData.cropHeight, g = -l / 2, d = -c / 2, f = this.transformData.borderRadius || 0;
|
|
2831
2871
|
t.save();
|
|
2832
|
-
const
|
|
2833
|
-
t.beginPath(), t.roundRect(
|
|
2834
|
-
const
|
|
2872
|
+
const u = Math.min(f / 100 * Math.min(l, c), l / 2, c / 2);
|
|
2873
|
+
t.beginPath(), t.roundRect(g, d, l, c, u), t.clip();
|
|
2874
|
+
const m = g - this.transformData.cropX * this.transformData.width, p = d - this.transformData.cropY * this.transformData.height;
|
|
2835
2875
|
t.drawImage(
|
|
2836
|
-
|
|
2876
|
+
s,
|
|
2837
2877
|
0,
|
|
2838
2878
|
0,
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2879
|
+
o,
|
|
2880
|
+
a,
|
|
2881
|
+
m,
|
|
2882
|
+
p,
|
|
2843
2883
|
this.transformData.width,
|
|
2844
2884
|
this.transformData.height
|
|
2845
2885
|
), t.restore();
|
|
@@ -2852,51 +2892,51 @@ class yt extends Q {
|
|
|
2852
2892
|
*/
|
|
2853
2893
|
renderPlaceholder(t) {
|
|
2854
2894
|
t.save(), t.translate(this.x, this.y), t.rotate(I.toRadians(this.rotation));
|
|
2855
|
-
const e = this.transformData.width * this.transformData.cropWidth, i = this.transformData.height * this.transformData.cropHeight,
|
|
2895
|
+
const e = this.transformData.width * this.transformData.cropWidth, i = this.transformData.height * this.transformData.cropHeight, s = -e / 2, o = -i / 2;
|
|
2856
2896
|
let a, n, h;
|
|
2857
|
-
this.imageLoadState === "error" ? (a = "#f0e0e0", n = "#993333", h = "Image failed to load") : this.imageLoadState === "retrying" ? (a = "#e0e0e0", n = "#666", h = "Retrying...") : this.imageLoadState === "loading" ? (a = "#e0e0e0", n = "#666", h = "Loading...") : (a = "#e0e0e0", n = "#666", h = this.imageUrl ? "Loading..." : "No image"), t.fillStyle = a, t.fillRect(
|
|
2897
|
+
this.imageLoadState === "error" ? (a = "#f0e0e0", n = "#993333", h = "Image failed to load") : this.imageLoadState === "retrying" ? (a = "#e0e0e0", n = "#666", h = "Retrying...") : this.imageLoadState === "loading" ? (a = "#e0e0e0", n = "#666", h = "Loading...") : (a = "#e0e0e0", n = "#666", h = this.imageUrl ? "Loading..." : "No image"), t.fillStyle = a, t.fillRect(s, o, e, i), t.fillStyle = n, t.font = "14px system-ui, -apple-system, sans-serif", t.textAlign = "center", t.textBaseline = "middle", t.fillText(h, 0, 0), t.restore();
|
|
2858
2898
|
}
|
|
2859
2899
|
/**
|
|
2860
2900
|
* Handle resize - maintain aspect ratio
|
|
2861
2901
|
* @returns {boolean} true if resize was applied
|
|
2862
2902
|
*/
|
|
2863
|
-
resize(t, e, i,
|
|
2864
|
-
let
|
|
2865
|
-
this.isCropping ? (
|
|
2866
|
-
const n = (
|
|
2903
|
+
resize(t, e, i, s) {
|
|
2904
|
+
let o, a;
|
|
2905
|
+
this.isCropping ? (o = e / x(s).width, a = i / x(s).height) : (o = e / (s.width ?? 1), a = i / (s.height ?? 1));
|
|
2906
|
+
const n = (o + a) / 2;
|
|
2867
2907
|
let h = t;
|
|
2868
|
-
this.isCropping && (h = this.remapAnchorForFlips(t,
|
|
2908
|
+
this.isCropping && (h = this.remapAnchorForFlips(t, s));
|
|
2869
2909
|
let l = n;
|
|
2870
2910
|
if (this.isCropping) {
|
|
2871
|
-
const B = this.transformData.width / x(
|
|
2911
|
+
const B = this.transformData.width / x(s).width;
|
|
2872
2912
|
n < B && (l = this.calculateMinScaleForCropBounds(
|
|
2873
2913
|
h,
|
|
2874
|
-
|
|
2914
|
+
s,
|
|
2875
2915
|
n,
|
|
2876
2916
|
B
|
|
2877
2917
|
));
|
|
2878
2918
|
}
|
|
2879
|
-
this.transformData.width = x(
|
|
2919
|
+
this.transformData.width = x(s).width * l, this.transformData.height = this.transformData.width / this.imageAspectRatio, this.rotation = s.rotation;
|
|
2880
2920
|
let c, g;
|
|
2881
2921
|
if (this.isCropping) {
|
|
2882
|
-
const B = (x(
|
|
2883
|
-
c =
|
|
2922
|
+
const B = (x(s).cropX + x(s).cropWidth / 2) * x(s).width - x(s).width / 2, A = (x(s).cropY + x(s).cropHeight / 2) * x(s).height - x(s).height / 2, k = B, R = A, E = P.fromSnapshot(s).localDeltaToWorld(k, R), W = E.dx, z = E.dy;
|
|
2923
|
+
c = s.x - W, g = s.y - z;
|
|
2884
2924
|
} else {
|
|
2885
|
-
const B = (x(
|
|
2886
|
-
c =
|
|
2925
|
+
const B = (x(s).cropX + x(s).cropWidth / 2) * x(s).width - x(s).width / 2, A = (x(s).cropY + x(s).cropHeight / 2) * x(s).height - x(s).height / 2, k = B, R = A, E = P.fromSnapshot(s).localDeltaToWorld(k, R), W = E.dx, z = E.dy;
|
|
2926
|
+
c = s.x - W, g = s.y - z;
|
|
2887
2927
|
}
|
|
2888
2928
|
let d, f, u = 0, m = 0;
|
|
2889
|
-
h === "top-left" ? (u = x(
|
|
2890
|
-
const y = P.fromSnapshot(
|
|
2929
|
+
h === "top-left" ? (u = x(s).width / 2, m = x(s).height / 2) : h === "top-right" ? (u = -x(s).width / 2, m = x(s).height / 2) : h === "bottom-left" ? (u = x(s).width / 2, m = -x(s).height / 2) : h === "bottom-right" ? (u = -x(s).width / 2, m = -x(s).height / 2) : h === "middle-left" ? (u = x(s).width / 2, m = 0) : h === "middle-right" ? (u = -x(s).width / 2, m = 0) : h === "middle-top" ? (u = 0, m = x(s).height / 2) : h === "middle-bottom" && (u = 0, m = -x(s).height / 2);
|
|
2930
|
+
const y = P.fromSnapshot(s).localDeltaToWorld(u, m), w = y.dx, S = y.dy;
|
|
2891
2931
|
d = c + w, f = g + S;
|
|
2892
|
-
let b = 0,
|
|
2893
|
-
h === "top-left" ? (b = this.transformData.width / 2,
|
|
2894
|
-
const M = new P(this).localDeltaToWorld(b,
|
|
2932
|
+
let b = 0, v = 0;
|
|
2933
|
+
h === "top-left" ? (b = this.transformData.width / 2, v = this.transformData.height / 2) : h === "top-right" ? (b = -this.transformData.width / 2, v = this.transformData.height / 2) : h === "bottom-left" ? (b = this.transformData.width / 2, v = -this.transformData.height / 2) : h === "bottom-right" ? (b = -this.transformData.width / 2, v = -this.transformData.height / 2) : h === "middle-left" ? (b = this.transformData.width / 2, v = 0) : h === "middle-right" ? (b = -this.transformData.width / 2, v = 0) : h === "middle-top" ? (b = 0, v = this.transformData.height / 2) : h === "middle-bottom" && (b = 0, v = -this.transformData.height / 2);
|
|
2934
|
+
const M = new P(this).localDeltaToWorld(b, v), F = M.dx, T = M.dy, D = d - F, U = f - T;
|
|
2895
2935
|
if (this.isCropping) {
|
|
2896
|
-
const B =
|
|
2936
|
+
const B = s.x, A = s.y, k = x(s).cropWidth * x(s).width, R = x(s).cropHeight * x(s).height;
|
|
2897
2937
|
this.x = B, this.y = A;
|
|
2898
|
-
const H = k / this.transformData.width, E = R / this.transformData.height, W = B - D, z = A - U,
|
|
2899
|
-
this.transformData.cropX =
|
|
2938
|
+
const H = k / this.transformData.width, E = R / this.transformData.height, W = B - D, z = A - U, Ot = new P(this).worldDeltaToLocal(W, z), te = Ot.dx, ee = Ot.dy, ie = this.transformData.width / 2 + te, se = this.transformData.height / 2 + ee, oe = ie / this.transformData.width - H / 2, re = se / this.transformData.height - E / 2;
|
|
2939
|
+
this.transformData.cropX = oe, this.transformData.cropY = re, this.transformData.cropWidth = H, this.transformData.cropHeight = E;
|
|
2900
2940
|
} else {
|
|
2901
2941
|
const B = (this.transformData.cropX + this.transformData.cropWidth / 2) * this.transformData.width - this.transformData.width / 2, A = (this.transformData.cropY + this.transformData.cropHeight / 2) * this.transformData.height - this.transformData.height / 2, k = B, R = A, E = new P(this).localDeltaToWorld(k, R), W = E.dx, z = E.dy;
|
|
2902
2942
|
this.x = D + W, this.y = U + z;
|
|
@@ -2955,9 +2995,9 @@ class yt extends Q {
|
|
|
2955
2995
|
// bottom-left
|
|
2956
2996
|
{ x: t.x + t.width, y: t.y + t.height }
|
|
2957
2997
|
// bottom-right
|
|
2958
|
-
].map((
|
|
2959
|
-
x: this.x +
|
|
2960
|
-
y: this.y +
|
|
2998
|
+
].map((o) => ({
|
|
2999
|
+
x: this.x + o.x * e - o.y * i,
|
|
3000
|
+
y: this.y + o.x * i + o.y * e
|
|
2961
3001
|
}));
|
|
2962
3002
|
}
|
|
2963
3003
|
/**
|
|
@@ -2965,8 +3005,8 @@ class yt extends Q {
|
|
|
2965
3005
|
* Local coordinates are relative to this.x, this.y (the center of the visible area)
|
|
2966
3006
|
*/
|
|
2967
3007
|
worldToLocal(t, e) {
|
|
2968
|
-
const i = t - this.x,
|
|
2969
|
-
let n = i *
|
|
3008
|
+
const i = t - this.x, s = e - this.y, o = Math.cos(I.toRadiansInverse(this.rotation)), a = Math.sin(I.toRadiansInverse(this.rotation));
|
|
3009
|
+
let n = i * o - s * a, h = i * a + s * o;
|
|
2970
3010
|
const l = this.transformData.flipHorizontal ? -1 : 1, c = this.transformData.flipVertical ? -1 : 1;
|
|
2971
3011
|
return n *= l, h *= c, {
|
|
2972
3012
|
x: n,
|
|
@@ -2979,9 +3019,9 @@ class yt extends Q {
|
|
|
2979
3019
|
* Canvas transformations are applied in reverse: scale -> rotate -> translate
|
|
2980
3020
|
*/
|
|
2981
3021
|
localToWorld(t, e) {
|
|
2982
|
-
const i = this.transformData.flipHorizontal ? -1 : 1,
|
|
2983
|
-
let
|
|
2984
|
-
const n = Math.cos(I.toRadians(this.rotation)), h = Math.sin(I.toRadians(this.rotation)), l =
|
|
3022
|
+
const i = this.transformData.flipHorizontal ? -1 : 1, s = this.transformData.flipVertical ? -1 : 1;
|
|
3023
|
+
let o = t * i, a = e * s;
|
|
3024
|
+
const n = Math.cos(I.toRadians(this.rotation)), h = Math.sin(I.toRadians(this.rotation)), l = o * n - a * h, c = o * h + a * n;
|
|
2985
3025
|
return {
|
|
2986
3026
|
x: this.x + l,
|
|
2987
3027
|
y: this.y + c
|
|
@@ -2996,29 +3036,29 @@ class yt extends Q {
|
|
|
2996
3036
|
*/
|
|
2997
3037
|
hitTestCropHandle(t, e, i = 1) {
|
|
2998
3038
|
if (!this.isCropping) return null;
|
|
2999
|
-
const
|
|
3000
|
-
if (!
|
|
3001
|
-
const
|
|
3002
|
-
{ x:
|
|
3003
|
-
{ x:
|
|
3004
|
-
{ x:
|
|
3005
|
-
{ x:
|
|
3039
|
+
const s = this.getCropBoxBounds();
|
|
3040
|
+
if (!s) return null;
|
|
3041
|
+
const o = this.worldToLocal(t, e), a = 1 / i, n = pe * a, h = ye * a, l = we * a, c = [
|
|
3042
|
+
{ x: s.x, y: s.y, anchor: "top-left" },
|
|
3043
|
+
{ x: s.x + s.width, y: s.y, anchor: "top-right" },
|
|
3044
|
+
{ x: s.x, y: s.y + s.height, anchor: "bottom-left" },
|
|
3045
|
+
{ x: s.x + s.width, y: s.y + s.height, anchor: "bottom-right" }
|
|
3006
3046
|
];
|
|
3007
3047
|
for (const d of c) {
|
|
3008
|
-
const f =
|
|
3048
|
+
const f = o.x - d.x, u = o.y - d.y;
|
|
3009
3049
|
if (Math.sqrt(f * f + u * u) <= n) {
|
|
3010
3050
|
const p = this.localToWorld(d.x, d.y);
|
|
3011
3051
|
return { type: "corner", anchor: d.anchor, worldX: p.x, worldY: p.y };
|
|
3012
3052
|
}
|
|
3013
3053
|
}
|
|
3014
3054
|
const g = [
|
|
3015
|
-
{ x:
|
|
3016
|
-
{ x:
|
|
3017
|
-
{ x:
|
|
3018
|
-
{ x:
|
|
3055
|
+
{ x: s.x + s.width / 2, y: s.y, anchor: "top", orientation: "horizontal" },
|
|
3056
|
+
{ x: s.x + s.width / 2, y: s.y + s.height, anchor: "bottom", orientation: "horizontal" },
|
|
3057
|
+
{ x: s.x, y: s.y + s.height / 2, anchor: "left", orientation: "vertical" },
|
|
3058
|
+
{ x: s.x + s.width, y: s.y + s.height / 2, anchor: "right", orientation: "vertical" }
|
|
3019
3059
|
];
|
|
3020
3060
|
for (const d of g) {
|
|
3021
|
-
const f =
|
|
3061
|
+
const f = o.x - d.x, u = o.y - d.y;
|
|
3022
3062
|
let m, p;
|
|
3023
3063
|
if (d.orientation === "horizontal" ? (m = h / 2, p = l / 2) : (m = l / 2, p = h / 2), Math.abs(f) <= m && Math.abs(u) <= p) {
|
|
3024
3064
|
const y = this.localToWorld(d.x, d.y);
|
|
@@ -3035,8 +3075,8 @@ class yt extends Q {
|
|
|
3035
3075
|
if (!this.isCropping) return !1;
|
|
3036
3076
|
const i = this.getCropBoxBounds();
|
|
3037
3077
|
if (!i) return !1;
|
|
3038
|
-
const
|
|
3039
|
-
return
|
|
3078
|
+
const s = this.worldToLocal(t, e);
|
|
3079
|
+
return s.x >= i.x && s.x <= i.x + i.width && s.y >= i.y && s.y <= i.y + i.height;
|
|
3040
3080
|
}
|
|
3041
3081
|
/**
|
|
3042
3082
|
* Update crop box (normalized 0-1 coordinates)
|
|
@@ -3046,46 +3086,46 @@ class yt extends Q {
|
|
|
3046
3086
|
* @param {number} cropHeight - Normalized height (0-1)
|
|
3047
3087
|
* @param {boolean} adjustPosition - Whether to adjust this.x, this.y to keep visual position stable (default: false)
|
|
3048
3088
|
*/
|
|
3049
|
-
updateCrop(t, e, i,
|
|
3050
|
-
let n = Math.max(0.1, Math.min(1, i)), h = Math.max(0.1, Math.min(1,
|
|
3089
|
+
updateCrop(t, e, i, s, o = !1) {
|
|
3090
|
+
let n = Math.max(0.1, Math.min(1, i)), h = Math.max(0.1, Math.min(1, s)), l = Math.max(0, Math.min(1 - n, t)), c = Math.max(0, Math.min(1 - h, e));
|
|
3051
3091
|
l + n > 1 && (n = 1 - l), c + h > 1 && (h = 1 - c);
|
|
3052
3092
|
let g = 0, d = 0;
|
|
3053
|
-
if (
|
|
3093
|
+
if (o) {
|
|
3054
3094
|
const f = this.transformData.cropX * this.transformData.width + this.transformData.cropWidth * this.transformData.width / 2, u = this.transformData.cropY * this.transformData.height + this.transformData.cropHeight * this.transformData.height / 2, m = l * this.transformData.width + n * this.transformData.width / 2, p = c * this.transformData.height + h * this.transformData.height / 2, y = m - f, w = p - u, S = Math.cos(I.toRadians(this.rotation)), b = Math.sin(I.toRadians(this.rotation));
|
|
3055
3095
|
g = y * S - w * b, d = y * b + w * S;
|
|
3056
3096
|
}
|
|
3057
|
-
this.transformData.cropX = l, this.transformData.cropY = c, this.transformData.cropWidth = n, this.transformData.cropHeight = h,
|
|
3097
|
+
this.transformData.cropX = l, this.transformData.cropY = c, this.transformData.cropWidth = n, this.transformData.cropHeight = h, o && (this.x += g, this.y += d);
|
|
3058
3098
|
}
|
|
3059
3099
|
/**
|
|
3060
3100
|
* Get the local position of the corner opposite to the given anchor
|
|
3061
3101
|
* Corners are relative to frame center
|
|
3062
3102
|
*/
|
|
3063
3103
|
getOppositeCornerLocalPosition(t, e, i) {
|
|
3064
|
-
const
|
|
3104
|
+
const s = e / 2, o = i / 2;
|
|
3065
3105
|
return {
|
|
3066
|
-
"top-left": { x:
|
|
3106
|
+
"top-left": { x: s, y: o },
|
|
3067
3107
|
// Opposite is bottom-right
|
|
3068
|
-
"top-right": { x: -
|
|
3108
|
+
"top-right": { x: -s, y: o },
|
|
3069
3109
|
// Opposite is bottom-left
|
|
3070
|
-
"bottom-left": { x:
|
|
3110
|
+
"bottom-left": { x: s, y: -o },
|
|
3071
3111
|
// Opposite is top-right
|
|
3072
|
-
"bottom-right": { x: -
|
|
3112
|
+
"bottom-right": { x: -s, y: -o },
|
|
3073
3113
|
// Opposite is top-left
|
|
3074
|
-
top: { x: 0, y:
|
|
3114
|
+
top: { x: 0, y: o },
|
|
3075
3115
|
// Opposite is bottom edge
|
|
3076
|
-
bottom: { x: 0, y: -
|
|
3116
|
+
bottom: { x: 0, y: -o },
|
|
3077
3117
|
// Opposite is top edge
|
|
3078
|
-
left: { x:
|
|
3118
|
+
left: { x: s, y: 0 },
|
|
3079
3119
|
// Opposite is right edge
|
|
3080
|
-
right: { x: -
|
|
3120
|
+
right: { x: -s, y: 0 },
|
|
3081
3121
|
// Opposite is left edge
|
|
3082
|
-
"middle-top": { x: 0, y:
|
|
3122
|
+
"middle-top": { x: 0, y: o },
|
|
3083
3123
|
// Opposite is bottom edge
|
|
3084
|
-
"middle-bottom": { x: 0, y: -
|
|
3124
|
+
"middle-bottom": { x: 0, y: -o },
|
|
3085
3125
|
// Opposite is top edge
|
|
3086
|
-
"middle-left": { x:
|
|
3126
|
+
"middle-left": { x: s, y: 0 },
|
|
3087
3127
|
// Opposite is right edge
|
|
3088
|
-
"middle-right": { x: -
|
|
3128
|
+
"middle-right": { x: -s, y: 0 }
|
|
3089
3129
|
// Opposite is left edge
|
|
3090
3130
|
}[t];
|
|
3091
3131
|
}
|
|
@@ -3094,7 +3134,7 @@ class yt extends Q {
|
|
|
3094
3134
|
* In crop mode, this.x/y is the crop center, not the frame center
|
|
3095
3135
|
*/
|
|
3096
3136
|
calculateFrameCenterFromCropCenter(t) {
|
|
3097
|
-
const e = x(t).width * x(t).cropWidth, i = x(t).height * x(t).cropHeight,
|
|
3137
|
+
const e = x(t).width * x(t).cropWidth, i = x(t).height * x(t).cropHeight, s = x(t).width / 2 - (x(t).cropX * x(t).width + e / 2), o = x(t).height / 2 - (x(t).cropY * x(t).height + i / 2), n = new P(t).localDeltaToWorld(s, o);
|
|
3098
3138
|
return {
|
|
3099
3139
|
x: t.x + n.dx,
|
|
3100
3140
|
y: t.y + n.dy
|
|
@@ -3108,10 +3148,10 @@ class yt extends Q {
|
|
|
3108
3148
|
t,
|
|
3109
3149
|
x(e).width,
|
|
3110
3150
|
x(e).height
|
|
3111
|
-
),
|
|
3151
|
+
), s = this.calculateFrameCenterFromCropCenter(e), a = new P(e).localDeltaToWorld(i.x, i.y);
|
|
3112
3152
|
return {
|
|
3113
|
-
x:
|
|
3114
|
-
y:
|
|
3153
|
+
x: s.x + a.dx,
|
|
3154
|
+
y: s.y + a.dy
|
|
3115
3155
|
};
|
|
3116
3156
|
}
|
|
3117
3157
|
/**
|
|
@@ -3119,15 +3159,15 @@ class yt extends Q {
|
|
|
3119
3159
|
* The opposite corner from the anchor stays fixed in world space
|
|
3120
3160
|
*/
|
|
3121
3161
|
calculateFrameCenterAfterResize(t, e, i) {
|
|
3122
|
-
const
|
|
3162
|
+
const s = this.getFixedCornerWorldPosition(e, i), o = x(i).width * t, a = o / this.imageAspectRatio, n = this.getOppositeCornerLocalPosition(e, o, a), l = new P({
|
|
3123
3163
|
x: 0,
|
|
3124
3164
|
// Will calculate frame center
|
|
3125
3165
|
y: 0,
|
|
3126
3166
|
rotation: i.rotation
|
|
3127
3167
|
}).localDeltaToWorld(n.x, n.y);
|
|
3128
3168
|
return {
|
|
3129
|
-
x:
|
|
3130
|
-
y:
|
|
3169
|
+
x: s.x - l.dx,
|
|
3170
|
+
y: s.y - l.dy
|
|
3131
3171
|
};
|
|
3132
3172
|
}
|
|
3133
3173
|
/**
|
|
@@ -3136,7 +3176,7 @@ class yt extends Q {
|
|
|
3136
3176
|
* would be positioned within the frame after resize.
|
|
3137
3177
|
*/
|
|
3138
3178
|
calculateCropStateAtScale(t, e, i) {
|
|
3139
|
-
const
|
|
3179
|
+
const s = x(i).width * t, o = s / this.imageAspectRatio, a = x(i).cropWidth * x(i).width, n = x(i).cropHeight * x(i).height, h = a / s, l = n / o, c = this.calculateFrameCenterAfterResize(t, e, i), g = {
|
|
3140
3180
|
x: i.x,
|
|
3141
3181
|
// In crop mode, this.x/y is the crop center
|
|
3142
3182
|
y: i.y
|
|
@@ -3144,7 +3184,7 @@ class yt extends Q {
|
|
|
3144
3184
|
x: c.x,
|
|
3145
3185
|
y: c.y,
|
|
3146
3186
|
rotation: i.rotation
|
|
3147
|
-
}).worldDeltaToLocal(d, f), p =
|
|
3187
|
+
}).worldDeltaToLocal(d, f), p = s / 2 + m.dx, y = o / 2 + m.dy, w = p / s - h / 2, S = y / o - l / 2;
|
|
3148
3188
|
return {
|
|
3149
3189
|
cropX: w,
|
|
3150
3190
|
cropY: S,
|
|
@@ -3156,20 +3196,20 @@ class yt extends Q {
|
|
|
3156
3196
|
* Check if a given scale keeps crop within frame bounds
|
|
3157
3197
|
*/
|
|
3158
3198
|
isScaleValidForCropBounds(t, e, i) {
|
|
3159
|
-
const
|
|
3160
|
-
if (
|
|
3199
|
+
const o = this.calculateCropStateAtScale(t, e, i);
|
|
3200
|
+
if (o.cropWidth > 1 + 1e-4 || o.cropHeight > 1 + 1e-4)
|
|
3161
3201
|
return !1;
|
|
3162
|
-
const a =
|
|
3202
|
+
const a = o.cropX, n = o.cropX + o.cropWidth, h = o.cropY, l = o.cropY + o.cropHeight;
|
|
3163
3203
|
return a >= -1e-4 && h >= -1e-4 && n <= 1 + 1e-4 && l <= 1 + 1e-4;
|
|
3164
3204
|
}
|
|
3165
3205
|
/**
|
|
3166
3206
|
* Calculate minimum scale that keeps crop within frame bounds
|
|
3167
3207
|
* Uses binary search to find the largest scale >= proposedScale that satisfies constraints
|
|
3168
3208
|
*/
|
|
3169
|
-
calculateMinScaleForCropBounds(t, e, i,
|
|
3209
|
+
calculateMinScaleForCropBounds(t, e, i, s) {
|
|
3170
3210
|
if (this.isScaleValidForCropBounds(i, t, e))
|
|
3171
3211
|
return i;
|
|
3172
|
-
let n = i, h =
|
|
3212
|
+
let n = i, h = s;
|
|
3173
3213
|
for (let l = 0; l < 20; l++) {
|
|
3174
3214
|
const c = (n + h) / 2;
|
|
3175
3215
|
if (this.isScaleValidForCropBounds(c, t, e) ? h = c : n = c, Math.abs(h - n) < 1e-4)
|
|
@@ -3182,15 +3222,15 @@ class yt extends Q {
|
|
|
3182
3222
|
*/
|
|
3183
3223
|
remapAnchorForFlips(t, e) {
|
|
3184
3224
|
let i = t;
|
|
3185
|
-
const
|
|
3186
|
-
return
|
|
3225
|
+
const s = x(e).flipHorizontal, o = x(e).flipVertical;
|
|
3226
|
+
return s && (i.includes("left") ? i = i.replace("left", "right") : i.includes("right") && (i = i.replace("right", "left"))), o && (i.includes("top") ? i = i.replace("top", "bottom") : i.includes("bottom") && (i = i.replace("bottom", "top"))), i;
|
|
3187
3227
|
}
|
|
3188
3228
|
/**
|
|
3189
3229
|
* Clone this element
|
|
3190
3230
|
*/
|
|
3191
3231
|
clone() {
|
|
3192
|
-
const t = this.toJSON(), { imageUrl: e, ...i } = t,
|
|
3193
|
-
return
|
|
3232
|
+
const t = this.toJSON(), { imageUrl: e, ...i } = t, s = new yt(i);
|
|
3233
|
+
return s.imageUrl = this.imageUrl, s.imageElement = this.imageElement, s.imageLoaded = this.imageLoaded, s.imageAspectRatio = this.imageAspectRatio, s.isCropping = this.isCropping, s.onLoadCallback = this.onLoadCallback, s.isSvg = this.isSvg, s.imageLoadState = this.imageLoadState, s.imageLoadError = this.imageLoadError, s.preserveDimensions = this.preserveDimensions, s;
|
|
3194
3234
|
}
|
|
3195
3235
|
/**
|
|
3196
3236
|
* Serialize to JSON
|
|
@@ -3212,7 +3252,12 @@ class yt extends Q {
|
|
|
3212
3252
|
imageAspectRatio: this.imageAspectRatio,
|
|
3213
3253
|
preserveDimensions: this.preserveDimensions,
|
|
3214
3254
|
// dimension lock for cover crop must survive save→load
|
|
3215
|
-
transformData: {
|
|
3255
|
+
transformData: {
|
|
3256
|
+
...this.transformData,
|
|
3257
|
+
// Deep-copy the nested adjustments object so serialized state (and
|
|
3258
|
+
// clones built from it) never alias this element's live state.
|
|
3259
|
+
...this.transformData.adjustments ? { adjustments: { ...this.transformData.adjustments } } : {}
|
|
3260
|
+
}
|
|
3216
3261
|
};
|
|
3217
3262
|
}
|
|
3218
3263
|
/**
|
|
@@ -3224,27 +3269,27 @@ class yt extends Q {
|
|
|
3224
3269
|
this.clearLoadTimeout(), this.releaseImageCache(), this.revokeSvgBlobUrl(), this.imageElement = null, this.onLoadCallback = null, this.imageLoadError = null;
|
|
3225
3270
|
}
|
|
3226
3271
|
}
|
|
3227
|
-
const
|
|
3228
|
-
let
|
|
3229
|
-
function
|
|
3272
|
+
const $t = /* @__PURE__ */ new Map();
|
|
3273
|
+
let At = null;
|
|
3274
|
+
function Vt(r) {
|
|
3230
3275
|
return new Error(
|
|
3231
3276
|
`[paint-registry] no painter registered for ${r}. Element painting requires the rendering engine: import 'src/rendering/element-painters.js' (every paint driver — CanvasRenderer, ExportManager, ElementPreviewRenderer — does this; a direct element.render() call in a test must import it too).`
|
|
3232
3277
|
);
|
|
3233
3278
|
}
|
|
3234
|
-
function
|
|
3235
|
-
|
|
3279
|
+
function Bi(r, t) {
|
|
3280
|
+
$t.set(r, t);
|
|
3236
3281
|
}
|
|
3237
3282
|
function gt(r) {
|
|
3238
|
-
const t =
|
|
3239
|
-
if (!t) throw
|
|
3283
|
+
const t = $t.get(r);
|
|
3284
|
+
if (!t) throw Vt(`text transform "${r}"`);
|
|
3240
3285
|
return t;
|
|
3241
3286
|
}
|
|
3242
|
-
function
|
|
3243
|
-
|
|
3287
|
+
function Ri(r) {
|
|
3288
|
+
At = r;
|
|
3244
3289
|
}
|
|
3245
|
-
function
|
|
3246
|
-
if (!
|
|
3247
|
-
return
|
|
3290
|
+
function Ee() {
|
|
3291
|
+
if (!At) throw Vt("group clipping");
|
|
3292
|
+
return At;
|
|
3248
3293
|
}
|
|
3249
3294
|
class L {
|
|
3250
3295
|
constructor(t = []) {
|
|
@@ -3293,31 +3338,31 @@ class L {
|
|
|
3293
3338
|
applyStyle(t, e, i) {
|
|
3294
3339
|
if (t >= e || t < 0 || e > this.getLength())
|
|
3295
3340
|
return;
|
|
3296
|
-
const
|
|
3297
|
-
let
|
|
3341
|
+
const s = [];
|
|
3342
|
+
let o = 0;
|
|
3298
3343
|
for (const a of this.spans) {
|
|
3299
|
-
const n =
|
|
3344
|
+
const n = o, h = o + a.text.length;
|
|
3300
3345
|
if (h <= t) {
|
|
3301
|
-
|
|
3346
|
+
s.push(a), o = h;
|
|
3302
3347
|
continue;
|
|
3303
3348
|
}
|
|
3304
3349
|
if (n >= e) {
|
|
3305
|
-
|
|
3350
|
+
s.push(a), o = h;
|
|
3306
3351
|
continue;
|
|
3307
3352
|
}
|
|
3308
3353
|
const l = Math.max(t, n), c = Math.min(e, h);
|
|
3309
|
-
l > n &&
|
|
3354
|
+
l > n && s.push({
|
|
3310
3355
|
text: a.text.substring(0, l - n),
|
|
3311
3356
|
style: a.style
|
|
3312
|
-
}),
|
|
3357
|
+
}), s.push({
|
|
3313
3358
|
text: a.text.substring(l - n, c - n),
|
|
3314
3359
|
style: { ...a.style, ...i }
|
|
3315
|
-
}), c < h &&
|
|
3360
|
+
}), c < h && s.push({
|
|
3316
3361
|
text: a.text.substring(c - n),
|
|
3317
3362
|
style: a.style
|
|
3318
|
-
}),
|
|
3363
|
+
}), o = h;
|
|
3319
3364
|
}
|
|
3320
|
-
this.spans =
|
|
3365
|
+
this.spans = s, this.normalize();
|
|
3321
3366
|
}
|
|
3322
3367
|
/**
|
|
3323
3368
|
* Insert text at a specific position with a given style
|
|
@@ -3327,24 +3372,24 @@ class L {
|
|
|
3327
3372
|
*/
|
|
3328
3373
|
insert(t, e, i) {
|
|
3329
3374
|
if (e.length === 0) return;
|
|
3330
|
-
const
|
|
3331
|
-
let
|
|
3375
|
+
const s = [];
|
|
3376
|
+
let o = 0;
|
|
3332
3377
|
for (const a of this.spans) {
|
|
3333
|
-
const n =
|
|
3334
|
-
if (t <= n &&
|
|
3378
|
+
const n = o, h = o + a.text.length;
|
|
3379
|
+
if (t <= n && s.length === 0 && s.push({ text: e, style: i }), t > n && t <= h) {
|
|
3335
3380
|
const l = t - n;
|
|
3336
|
-
|
|
3381
|
+
s.push({
|
|
3337
3382
|
text: a.text.substring(0, l),
|
|
3338
3383
|
style: a.style
|
|
3339
|
-
}),
|
|
3384
|
+
}), s.push({ text: e, style: i }), s.push({
|
|
3340
3385
|
text: a.text.substring(l),
|
|
3341
3386
|
style: a.style
|
|
3342
|
-
}),
|
|
3387
|
+
}), o = h;
|
|
3343
3388
|
continue;
|
|
3344
3389
|
}
|
|
3345
|
-
|
|
3390
|
+
s.push(a), o = h;
|
|
3346
3391
|
}
|
|
3347
|
-
t >= this.getLength() && !
|
|
3392
|
+
t >= this.getLength() && !s.some((a) => a.text === e) && s.push({ text: e, style: i }), this.spans = s, this.normalize();
|
|
3348
3393
|
}
|
|
3349
3394
|
/**
|
|
3350
3395
|
* Delete text in a character range
|
|
@@ -3355,28 +3400,28 @@ class L {
|
|
|
3355
3400
|
const i = this.getLength();
|
|
3356
3401
|
if (t = Math.max(0, Math.min(t, i)), e = Math.max(0, Math.min(e, i)), t >= e)
|
|
3357
3402
|
return;
|
|
3358
|
-
const
|
|
3359
|
-
let
|
|
3403
|
+
const s = [];
|
|
3404
|
+
let o = 0;
|
|
3360
3405
|
for (const a of this.spans) {
|
|
3361
|
-
const n =
|
|
3406
|
+
const n = o, h = o + a.text.length;
|
|
3362
3407
|
if (h <= t) {
|
|
3363
|
-
|
|
3408
|
+
s.push(a), o = h;
|
|
3364
3409
|
continue;
|
|
3365
3410
|
}
|
|
3366
3411
|
if (n >= e) {
|
|
3367
|
-
|
|
3412
|
+
s.push(a), o = h;
|
|
3368
3413
|
continue;
|
|
3369
3414
|
}
|
|
3370
3415
|
const l = Math.max(t, n), c = Math.min(e, h);
|
|
3371
|
-
l > n &&
|
|
3416
|
+
l > n && s.push({
|
|
3372
3417
|
text: a.text.substring(0, l - n),
|
|
3373
3418
|
style: a.style
|
|
3374
|
-
}), c < h &&
|
|
3419
|
+
}), c < h && s.push({
|
|
3375
3420
|
text: a.text.substring(c - n),
|
|
3376
3421
|
style: a.style
|
|
3377
|
-
}),
|
|
3422
|
+
}), o = h;
|
|
3378
3423
|
}
|
|
3379
|
-
this.spans =
|
|
3424
|
+
this.spans = s.length > 0 ? s : [{ text: "", style: {} }], this.normalize();
|
|
3380
3425
|
}
|
|
3381
3426
|
/**
|
|
3382
3427
|
* Normalize spans by:
|
|
@@ -3393,11 +3438,11 @@ class L {
|
|
|
3393
3438
|
const t = [];
|
|
3394
3439
|
let e = this.spans[0];
|
|
3395
3440
|
for (let i = 1; i < this.spans.length; i++) {
|
|
3396
|
-
const
|
|
3397
|
-
this.stylesEqual(e.style,
|
|
3398
|
-
text: e.text +
|
|
3441
|
+
const s = this.spans[i];
|
|
3442
|
+
this.stylesEqual(e.style, s.style) ? e = {
|
|
3443
|
+
text: e.text + s.text,
|
|
3399
3444
|
style: e.style
|
|
3400
|
-
} : (t.push(e), e =
|
|
3445
|
+
} : (t.push(e), e = s);
|
|
3401
3446
|
}
|
|
3402
3447
|
t.push(e), this.spans = t;
|
|
3403
3448
|
}
|
|
@@ -3442,65 +3487,65 @@ class L {
|
|
|
3442
3487
|
return new L(t.spans);
|
|
3443
3488
|
}
|
|
3444
3489
|
}
|
|
3445
|
-
function
|
|
3490
|
+
function Hi(r) {
|
|
3446
3491
|
return r.type === "custom";
|
|
3447
3492
|
}
|
|
3448
|
-
function
|
|
3493
|
+
function Pi(r) {
|
|
3449
3494
|
return r.type === "circle";
|
|
3450
3495
|
}
|
|
3451
|
-
function
|
|
3496
|
+
function Li(r) {
|
|
3452
3497
|
return r.type === "arch";
|
|
3453
3498
|
}
|
|
3454
|
-
function
|
|
3499
|
+
function Wi(r) {
|
|
3455
3500
|
return r.type === "wave";
|
|
3456
3501
|
}
|
|
3457
|
-
function
|
|
3502
|
+
function zi(r) {
|
|
3458
3503
|
return r.type === "flag";
|
|
3459
3504
|
}
|
|
3460
|
-
function
|
|
3505
|
+
function Xi(r) {
|
|
3461
3506
|
return r.type === "image";
|
|
3462
3507
|
}
|
|
3463
|
-
function
|
|
3508
|
+
function Ni(r) {
|
|
3464
3509
|
return r.type === "group";
|
|
3465
3510
|
}
|
|
3466
|
-
function
|
|
3511
|
+
function _i(r) {
|
|
3467
3512
|
return r.transformType !== "image" && r.transformType !== "group";
|
|
3468
3513
|
}
|
|
3469
|
-
function
|
|
3514
|
+
function Yi(r) {
|
|
3470
3515
|
return r.transformType === "image";
|
|
3471
3516
|
}
|
|
3472
|
-
function
|
|
3517
|
+
function Ui(r) {
|
|
3473
3518
|
return r.transformType === "custom";
|
|
3474
3519
|
}
|
|
3475
|
-
function
|
|
3520
|
+
function Gi(r) {
|
|
3476
3521
|
return r.transformType === "circle";
|
|
3477
3522
|
}
|
|
3478
|
-
function
|
|
3523
|
+
function $i(r) {
|
|
3479
3524
|
return r.transformType === "group";
|
|
3480
3525
|
}
|
|
3481
|
-
function
|
|
3526
|
+
function Vi(r) {
|
|
3482
3527
|
return r.transformType === "shape";
|
|
3483
3528
|
}
|
|
3484
|
-
function
|
|
3529
|
+
function Ji(r) {
|
|
3485
3530
|
return r.transformType === "path";
|
|
3486
3531
|
}
|
|
3487
|
-
function
|
|
3532
|
+
function qi(r) {
|
|
3488
3533
|
return r.type === "shape";
|
|
3489
3534
|
}
|
|
3490
|
-
function
|
|
3535
|
+
function ji(r) {
|
|
3491
3536
|
return r.type === "path";
|
|
3492
3537
|
}
|
|
3493
|
-
function
|
|
3538
|
+
function Zi(r) {
|
|
3494
3539
|
var t;
|
|
3495
3540
|
return ((t = r.stroke) == null ? void 0 : t.enabled) === !0;
|
|
3496
3541
|
}
|
|
3497
|
-
function
|
|
3542
|
+
function Ki(r) {
|
|
3498
3543
|
return Array.isArray(r.masks) && r.masks.length > 0;
|
|
3499
3544
|
}
|
|
3500
|
-
function
|
|
3545
|
+
function Qi(r) {
|
|
3501
3546
|
return r.blendMode === "knockout" || r.blendMode === "clip";
|
|
3502
3547
|
}
|
|
3503
|
-
function
|
|
3548
|
+
function ts(r) {
|
|
3504
3549
|
var t;
|
|
3505
3550
|
return ((t = r.distressEffect) == null ? void 0 : t.enabled) === !0;
|
|
3506
3551
|
}
|
|
@@ -3525,8 +3570,8 @@ class q extends Q {
|
|
|
3525
3570
|
* handled by SelectionRenderer and HoverRenderer.
|
|
3526
3571
|
*/
|
|
3527
3572
|
render(t, e = !1, i = !1) {
|
|
3528
|
-
const
|
|
3529
|
-
this.opacity !== void 0 && this.opacity !== 1 && (t.globalAlpha = this.opacity), gt(this.transformType)(t, this.toJSON()), t.globalAlpha =
|
|
3573
|
+
const s = t.globalAlpha;
|
|
3574
|
+
this.opacity !== void 0 && this.opacity !== 1 && (t.globalAlpha = this.opacity), gt(this.transformType)(t, this.toJSON()), t.globalAlpha = s;
|
|
3530
3575
|
}
|
|
3531
3576
|
/**
|
|
3532
3577
|
* Serialize to JSON
|
|
@@ -3605,14 +3650,14 @@ class q extends Q {
|
|
|
3605
3650
|
* Apply character-level formatting to a text range
|
|
3606
3651
|
*/
|
|
3607
3652
|
applyFormatting(t, e, i) {
|
|
3608
|
-
const
|
|
3609
|
-
|
|
3653
|
+
const s = this.getRichText();
|
|
3654
|
+
s.applyStyle(t, e, i), this.text = s.getText();
|
|
3610
3655
|
}
|
|
3611
3656
|
/**
|
|
3612
3657
|
* Update font size
|
|
3613
3658
|
*/
|
|
3614
3659
|
setFontSize(t) {
|
|
3615
|
-
this.fontSize = Math.max(
|
|
3660
|
+
this.fontSize = Math.max(be, Math.min(xe, t));
|
|
3616
3661
|
}
|
|
3617
3662
|
/**
|
|
3618
3663
|
* Update color
|
|
@@ -3622,15 +3667,15 @@ class q extends Q {
|
|
|
3622
3667
|
const e = this.color;
|
|
3623
3668
|
if (this.color = t, this.richText)
|
|
3624
3669
|
for (let i = 0; i < this.richText.spans.length; i++) {
|
|
3625
|
-
const
|
|
3626
|
-
(
|
|
3670
|
+
const s = this.richText.spans[i];
|
|
3671
|
+
(s.style.color === void 0 || s.style.color === e) && (s.style.color = t);
|
|
3627
3672
|
}
|
|
3628
3673
|
}
|
|
3629
3674
|
/**
|
|
3630
3675
|
* Handle resize transform
|
|
3631
3676
|
* Must be implemented by subclasses
|
|
3632
3677
|
*/
|
|
3633
|
-
resize(t, e, i,
|
|
3678
|
+
resize(t, e, i, s) {
|
|
3634
3679
|
throw new Error("resize() must be implemented by subclass");
|
|
3635
3680
|
}
|
|
3636
3681
|
/**
|
|
@@ -3646,20 +3691,20 @@ class q extends Q {
|
|
|
3646
3691
|
};
|
|
3647
3692
|
}
|
|
3648
3693
|
}
|
|
3649
|
-
function
|
|
3694
|
+
function Oe(r) {
|
|
3650
3695
|
return Array.from(r).length;
|
|
3651
3696
|
}
|
|
3652
3697
|
function wt(r, t, e) {
|
|
3653
|
-
return e ? r + e *
|
|
3698
|
+
return e ? r + e * Oe(t) : r;
|
|
3654
3699
|
}
|
|
3655
|
-
function
|
|
3656
|
-
const i = Array.from(t),
|
|
3657
|
-
let
|
|
3700
|
+
function Be(r, t, e) {
|
|
3701
|
+
const i = Array.from(t), s = [0];
|
|
3702
|
+
let o = "";
|
|
3658
3703
|
for (let a = 0; a < i.length; a++)
|
|
3659
|
-
|
|
3660
|
-
return
|
|
3704
|
+
o += i[a], s.push(r.measureText(o).width + e * (a + 1));
|
|
3705
|
+
return s;
|
|
3661
3706
|
}
|
|
3662
|
-
function
|
|
3707
|
+
function Re(r, t, e) {
|
|
3663
3708
|
switch (r.textAlign) {
|
|
3664
3709
|
case "center":
|
|
3665
3710
|
return t - e / 2;
|
|
@@ -3670,23 +3715,23 @@ function Ie(r, t, e) {
|
|
|
3670
3715
|
return t;
|
|
3671
3716
|
}
|
|
3672
3717
|
}
|
|
3673
|
-
function
|
|
3674
|
-
if (!
|
|
3675
|
-
t[r](e, i,
|
|
3718
|
+
function Jt(r, t, e, i, s, o) {
|
|
3719
|
+
if (!o || e.length === 0) {
|
|
3720
|
+
t[r](e, i, s);
|
|
3676
3721
|
return;
|
|
3677
3722
|
}
|
|
3678
|
-
const a =
|
|
3723
|
+
const a = Be(t, e, o), n = a[a.length - 1], h = Re(t, i, n), l = t.textAlign;
|
|
3679
3724
|
t.textAlign = "left";
|
|
3680
3725
|
const c = Array.from(e);
|
|
3681
3726
|
for (let g = 0; g < c.length; g++)
|
|
3682
|
-
t[r](c[g], h + a[g],
|
|
3727
|
+
t[r](c[g], h + a[g], s);
|
|
3683
3728
|
t.textAlign = l;
|
|
3684
3729
|
}
|
|
3685
|
-
function
|
|
3686
|
-
|
|
3730
|
+
function es(r, t, e, i, s) {
|
|
3731
|
+
Jt("fillText", r, t, e, i, s);
|
|
3687
3732
|
}
|
|
3688
|
-
function
|
|
3689
|
-
|
|
3733
|
+
function is(r, t, e, i, s) {
|
|
3734
|
+
Jt("strokeText", r, t, e, i, s);
|
|
3690
3735
|
}
|
|
3691
3736
|
let ht = null;
|
|
3692
3737
|
function bt() {
|
|
@@ -3700,12 +3745,12 @@ function bt() {
|
|
|
3700
3745
|
return ht;
|
|
3701
3746
|
}
|
|
3702
3747
|
function at(r, t, e = !1, i = !1) {
|
|
3703
|
-
const
|
|
3704
|
-
return i &&
|
|
3748
|
+
const s = [];
|
|
3749
|
+
return i && s.push("italic"), e && s.push("bold"), s.push(`${r}px`), s.push(t), s.join(" ");
|
|
3705
3750
|
}
|
|
3706
|
-
function
|
|
3751
|
+
function It(r, t, e, i, s = !1, o = !1, a, n = !1, h) {
|
|
3707
3752
|
const c = bt().getContext("2d");
|
|
3708
|
-
c.font = at(e, i,
|
|
3753
|
+
c.font = at(e, i, s, o);
|
|
3709
3754
|
const g = (h == null ? void 0 : h.letterSpacing) ?? 0, d = (A) => wt(c.measureText(A).width, A, g);
|
|
3710
3755
|
if (r.trim().length === 0)
|
|
3711
3756
|
return [r];
|
|
@@ -3714,7 +3759,7 @@ function At(r, t, e, i, o = !1, s = !1, a, n = !1, h) {
|
|
|
3714
3759
|
const A = r.split(`
|
|
3715
3760
|
`), k = [];
|
|
3716
3761
|
for (let R = 0; R < A.length; R++) {
|
|
3717
|
-
const H = A[R], E =
|
|
3762
|
+
const H = A[R], E = It(H, t, e, i, s, o, void 0, n, h);
|
|
3718
3763
|
k.push(...E);
|
|
3719
3764
|
}
|
|
3720
3765
|
return k;
|
|
@@ -3730,78 +3775,78 @@ function At(r, t, e, i, o = !1, s = !1, a, n = !1, h) {
|
|
|
3730
3775
|
}
|
|
3731
3776
|
return A.length > 0 && (A[0] = m + A[0], A[A.length - 1] = A[A.length - 1] + p), A;
|
|
3732
3777
|
}
|
|
3733
|
-
const S = w.join(" "), b = m + S + p,
|
|
3734
|
-
if (
|
|
3778
|
+
const S = w.join(" "), b = m + S + p, v = d(b), C = t < 200, F = n ? 0 : Math.max(20, t * (n ? 0 : C ? 0.08 : 0.05));
|
|
3779
|
+
if (v <= t + F)
|
|
3735
3780
|
return [b];
|
|
3736
|
-
const
|
|
3781
|
+
const T = [];
|
|
3737
3782
|
let D = "";
|
|
3738
3783
|
const B = n ? 0 : Math.max(15, t * (n ? 0 : C ? 0.05 : 0.03));
|
|
3739
3784
|
for (let A = 0; A < w.length; A++) {
|
|
3740
3785
|
const k = w[A];
|
|
3741
3786
|
if (d(k) > t + B) {
|
|
3742
|
-
D.length > 0 && (
|
|
3787
|
+
D.length > 0 && (T.push(D), D = "");
|
|
3743
3788
|
const H = Array.from(k);
|
|
3744
3789
|
let E = "";
|
|
3745
3790
|
for (const W of H) {
|
|
3746
3791
|
const z = E + W;
|
|
3747
|
-
d(z) > t + B && E.length > 0 ? (
|
|
3792
|
+
d(z) > t + B && E.length > 0 ? (T.push(E), E = W) : E = z;
|
|
3748
3793
|
}
|
|
3749
3794
|
D = E;
|
|
3750
3795
|
} else {
|
|
3751
3796
|
const H = D.length > 0 ? D + " " + k : k;
|
|
3752
|
-
d(H) > t + B && D.length > 0 ? (
|
|
3797
|
+
d(H) > t + B && D.length > 0 ? (T.push(D), D = k) : D = H;
|
|
3753
3798
|
}
|
|
3754
3799
|
}
|
|
3755
|
-
if (D.length > 0 &&
|
|
3800
|
+
if (D.length > 0 && T.push(D), T.length > 0) {
|
|
3756
3801
|
if (m.length > 0) {
|
|
3757
|
-
const A = m +
|
|
3758
|
-
d(A) > t + B ?
|
|
3802
|
+
const A = m + T[0];
|
|
3803
|
+
d(A) > t + B ? T.unshift(m) : T[0] = A;
|
|
3759
3804
|
}
|
|
3760
3805
|
if (p.length > 0) {
|
|
3761
|
-
const A =
|
|
3762
|
-
d(k) > t + B ?
|
|
3806
|
+
const A = T.length - 1, k = T[A] + p;
|
|
3807
|
+
d(k) > t + B ? T.push(p) : T[A] = k;
|
|
3763
3808
|
}
|
|
3764
3809
|
}
|
|
3765
|
-
return
|
|
3810
|
+
return T;
|
|
3766
3811
|
}
|
|
3767
|
-
function
|
|
3812
|
+
function Pt(r, t, e, i = !1, s = !1, o = 0) {
|
|
3768
3813
|
const n = bt().getContext("2d");
|
|
3769
|
-
return n.font = at(t, e, i,
|
|
3814
|
+
return n.font = at(t, e, i, s), wt(n.measureText(r).width, r, o);
|
|
3770
3815
|
}
|
|
3771
|
-
function
|
|
3772
|
-
const
|
|
3773
|
-
|
|
3774
|
-
const n =
|
|
3816
|
+
function Mt(r, t, e = !1, i = !1) {
|
|
3817
|
+
const o = bt().getContext("2d");
|
|
3818
|
+
o.font = at(r, t, e, i);
|
|
3819
|
+
const n = o.measureText("ÁÉÍgjpqy"), h = n.actualBoundingBoxAscent || r * 0.8, l = n.actualBoundingBoxDescent || r * 0.2, c = h + l;
|
|
3775
3820
|
return { ascent: h, descent: l, height: c };
|
|
3776
3821
|
}
|
|
3777
|
-
function
|
|
3778
|
-
const l = (h == null ? void 0 : h.letterSpacing) ?? 0, c =
|
|
3779
|
-
`), d = c.map((b,
|
|
3780
|
-
isParagraphStart: !g &&
|
|
3781
|
-
isParagraphEnd: !g &&
|
|
3822
|
+
function Lt(r, t, e, i, s = !1, o = !1, a, n = !1, h) {
|
|
3823
|
+
const l = (h == null ? void 0 : h.letterSpacing) ?? 0, c = It(r, t, e, i, s, o, a, n, h), g = r.includes(`
|
|
3824
|
+
`), d = c.map((b, v) => ({
|
|
3825
|
+
isParagraphStart: !g && v === 0,
|
|
3826
|
+
isParagraphEnd: !g && v === c.length - 1
|
|
3782
3827
|
})), u = bt().getContext("2d");
|
|
3783
|
-
u.font = at(e, i,
|
|
3828
|
+
u.font = at(e, i, s, o);
|
|
3784
3829
|
let m = 0;
|
|
3785
|
-
const p =
|
|
3830
|
+
const p = Mt(e, i, s, o);
|
|
3786
3831
|
let y = 0;
|
|
3787
|
-
c.forEach((b,
|
|
3788
|
-
const C = d[
|
|
3832
|
+
c.forEach((b, v) => {
|
|
3833
|
+
const C = d[v].isParagraphStart, M = d[v].isParagraphEnd;
|
|
3789
3834
|
let F = b;
|
|
3790
3835
|
if (!C) {
|
|
3791
|
-
const
|
|
3836
|
+
const T = b.match(/^ +/), D = T ? T[0].length : 0;
|
|
3792
3837
|
D > 0 && (F = F.substring(D));
|
|
3793
3838
|
}
|
|
3794
3839
|
if (!M) {
|
|
3795
|
-
const
|
|
3840
|
+
const T = F.match(/ +$/), D = T ? T[0].length : 0;
|
|
3796
3841
|
D > 0 && (F = F.substring(0, F.length - D));
|
|
3797
3842
|
}
|
|
3798
3843
|
if (y++, F.length > 0) {
|
|
3799
|
-
const
|
|
3800
|
-
m = Math.max(m,
|
|
3844
|
+
const T = wt(u.measureText(F).width, F, l);
|
|
3845
|
+
m = Math.max(m, T);
|
|
3801
3846
|
}
|
|
3802
3847
|
});
|
|
3803
3848
|
let w;
|
|
3804
|
-
const S = (h == null ? void 0 : h.lineHeight) ??
|
|
3849
|
+
const S = (h == null ? void 0 : h.lineHeight) ?? Ut;
|
|
3805
3850
|
if (y === 1)
|
|
3806
3851
|
w = p.height;
|
|
3807
3852
|
else if (y === 0)
|
|
@@ -3817,7 +3862,7 @@ function Rt(r, t, e, i, o = !1, s = !1, a, n = !1, h) {
|
|
|
3817
3862
|
};
|
|
3818
3863
|
}
|
|
3819
3864
|
let lt = null;
|
|
3820
|
-
function
|
|
3865
|
+
function He() {
|
|
3821
3866
|
if (!lt)
|
|
3822
3867
|
if (typeof OffscreenCanvas < "u")
|
|
3823
3868
|
lt = new OffscreenCanvas(1, 1).getContext("2d");
|
|
@@ -3827,10 +3872,10 @@ function ke() {
|
|
|
3827
3872
|
throw new Error("No canvas context available");
|
|
3828
3873
|
return lt;
|
|
3829
3874
|
}
|
|
3830
|
-
function
|
|
3831
|
-
const i =
|
|
3832
|
-
const w = y.fontSize || e.fontSize, S = y.fontFamily || e.fontFamily, b = y.bold !== void 0 ? y.bold : e.bold || !1,
|
|
3833
|
-
return i.font = at(w, S, b,
|
|
3875
|
+
function Pe(r, t, e) {
|
|
3876
|
+
const i = He(), s = [], o = (p, y) => {
|
|
3877
|
+
const w = y.fontSize || e.fontSize, S = y.fontFamily || e.fontFamily, b = y.bold !== void 0 ? y.bold : e.bold || !1, v = y.italic !== void 0 ? y.italic : e.italic || !1, C = y.letterSpacing !== void 0 ? y.letterSpacing : e.letterSpacing ?? 0;
|
|
3878
|
+
return i.font = at(w, S, b, v), wt(i.measureText(p).width, p, C);
|
|
3834
3879
|
}, a = (p, y) => p.fontSize === y.fontSize && p.fontFamily === y.fontFamily && p.color === y.color && p.bold === y.bold && p.italic === y.italic && p.underline === y.underline && p.strikethrough === y.strikethrough && p.letterSpacing === y.letterSpacing, n = [];
|
|
3835
3880
|
r.forEach((p) => {
|
|
3836
3881
|
n.length > 0 && a(n[n.length - 1].style, p.style) ? n[n.length - 1].text += p.text : n.push({ text: p.text, style: p.style });
|
|
@@ -3850,7 +3895,7 @@ function Ee(r, t, e) {
|
|
|
3850
3895
|
g.length > 0 && c.push({ text: g, startIdx: d, endIdx: h.length - 1 });
|
|
3851
3896
|
let f = [], u = 0;
|
|
3852
3897
|
const m = () => {
|
|
3853
|
-
f.length > 0 && (
|
|
3898
|
+
f.length > 0 && (s.push(f), f = [], u = 0);
|
|
3854
3899
|
};
|
|
3855
3900
|
return c.forEach((p, y) => {
|
|
3856
3901
|
const w = [];
|
|
@@ -3860,21 +3905,21 @@ function Ee(r, t, e) {
|
|
|
3860
3905
|
M !== S ? (w.push({ text: b, style: n[S].style }), b = h[C], S = M) : b += h[C];
|
|
3861
3906
|
}
|
|
3862
3907
|
b.length > 0 && w.push({ text: b, style: n[S].style });
|
|
3863
|
-
const
|
|
3908
|
+
const v = w.reduce((C, M) => C + o(M.text, M.style), 0);
|
|
3864
3909
|
if (p.text === " ") {
|
|
3865
3910
|
if (f.length > 0) {
|
|
3866
3911
|
const C = f[f.length - 1];
|
|
3867
3912
|
a(C.style, w[0].style) ? C.text += " " : f.push({ text: " ", style: w[0].style });
|
|
3868
3913
|
} else
|
|
3869
3914
|
f.push({ text: " ", style: w[0].style });
|
|
3870
|
-
u +=
|
|
3871
|
-
} else if (
|
|
3915
|
+
u += v;
|
|
3916
|
+
} else if (v > t) {
|
|
3872
3917
|
f.length > 0 && m();
|
|
3873
3918
|
for (const C of w) {
|
|
3874
3919
|
const M = Array.from(C.text);
|
|
3875
3920
|
let F = "";
|
|
3876
|
-
for (const
|
|
3877
|
-
const D =
|
|
3921
|
+
for (const T of M) {
|
|
3922
|
+
const D = o(T, C.style);
|
|
3878
3923
|
if (u + D > t && u > 0) {
|
|
3879
3924
|
if (F.length > 0) {
|
|
3880
3925
|
if (f.length > 0) {
|
|
@@ -3886,44 +3931,44 @@ function Ee(r, t, e) {
|
|
|
3886
3931
|
}
|
|
3887
3932
|
m();
|
|
3888
3933
|
}
|
|
3889
|
-
F +=
|
|
3934
|
+
F += T, u += D;
|
|
3890
3935
|
}
|
|
3891
3936
|
if (F.length > 0)
|
|
3892
3937
|
if (f.length > 0) {
|
|
3893
|
-
const
|
|
3894
|
-
a(
|
|
3938
|
+
const T = f[f.length - 1];
|
|
3939
|
+
a(T.style, C.style) ? T.text += F : f.push({ text: F, style: C.style });
|
|
3895
3940
|
} else
|
|
3896
3941
|
f.push({ text: F, style: C.style });
|
|
3897
3942
|
}
|
|
3898
3943
|
} else
|
|
3899
|
-
u +
|
|
3944
|
+
u + v > t && f.length > 0 && m(), w.forEach((C) => {
|
|
3900
3945
|
if (f.length > 0) {
|
|
3901
3946
|
const M = f[f.length - 1];
|
|
3902
3947
|
a(M.style, C.style) ? M.text += C.text : f.push({ ...C });
|
|
3903
3948
|
} else
|
|
3904
3949
|
f.push({ ...C });
|
|
3905
|
-
}), u +=
|
|
3906
|
-
}), m(),
|
|
3950
|
+
}), u += v;
|
|
3951
|
+
}), m(), s.length === 0 && s.push([]), s;
|
|
3907
3952
|
}
|
|
3908
|
-
function
|
|
3953
|
+
function Le(r) {
|
|
3909
3954
|
const t = [];
|
|
3910
3955
|
let e = [];
|
|
3911
3956
|
return r.spans.forEach((i) => {
|
|
3912
|
-
const
|
|
3957
|
+
const s = i.text.split(`
|
|
3913
3958
|
`);
|
|
3914
|
-
|
|
3915
|
-
|
|
3959
|
+
s.forEach((o, a) => {
|
|
3960
|
+
o.length > 0 && e.push({ text: o, style: i.style }), a < s.length - 1 && (t.push(e), e = []);
|
|
3916
3961
|
});
|
|
3917
3962
|
}), e.length > 0 && t.push(e), t.length === 0 && t.push([]), t;
|
|
3918
3963
|
}
|
|
3919
|
-
function
|
|
3964
|
+
function st(r) {
|
|
3920
3965
|
return typeof r.width == "number" ? r.width : void 0;
|
|
3921
3966
|
}
|
|
3922
|
-
function
|
|
3967
|
+
function qt(r, t) {
|
|
3923
3968
|
r.width = t;
|
|
3924
3969
|
}
|
|
3925
|
-
function
|
|
3926
|
-
const i = e.transformData,
|
|
3970
|
+
function We(r, t, e) {
|
|
3971
|
+
const i = e.transformData, s = st(i), o = s !== void 0 ? s : e.width ?? 0, a = t / o, n = e.fontSize ?? r.fontSize, h = n * a;
|
|
3927
3972
|
let l;
|
|
3928
3973
|
if (h < 16 ? l = Math.round(h) : l = Math.round(h * 2) / 2, r.setFontSize(l), e.richText && e.richText instanceof L && typeof r.setRichText == "function") {
|
|
3929
3974
|
const f = e.richText.clone();
|
|
@@ -3935,33 +3980,33 @@ function Be(r, t, e) {
|
|
|
3935
3980
|
r.setRichText(f);
|
|
3936
3981
|
}
|
|
3937
3982
|
const c = r.transformData;
|
|
3938
|
-
if (
|
|
3939
|
-
const d = n > 0 ? l / n : a, f =
|
|
3940
|
-
|
|
3983
|
+
if (st(c) !== void 0 && s !== void 0) {
|
|
3984
|
+
const d = n > 0 ? l / n : a, f = s * d;
|
|
3985
|
+
qt(c, Math.max(20, Math.ceil(f)));
|
|
3941
3986
|
}
|
|
3942
3987
|
}
|
|
3943
|
-
function
|
|
3988
|
+
function ze(r, t, e, i) {
|
|
3944
3989
|
if (t !== "middle-left" && t !== "middle-right")
|
|
3945
3990
|
return;
|
|
3946
3991
|
r.fontSize = i.fontSize ?? r.fontSize;
|
|
3947
|
-
const
|
|
3948
|
-
if (
|
|
3949
|
-
|
|
3950
|
-
const a = I.toRadiansInverse(r.rotation), n = Math.cos(a), h = Math.sin(a), l = i.transformData, g =
|
|
3992
|
+
const s = r.transformData;
|
|
3993
|
+
if (st(s) !== void 0) {
|
|
3994
|
+
qt(s, Math.max(Gt, e));
|
|
3995
|
+
const a = I.toRadiansInverse(r.rotation), n = Math.cos(a), h = Math.sin(a), l = i.transformData, g = st(l) ?? i.width ?? 0, f = (st(s) ?? 0) - g;
|
|
3951
3996
|
t === "middle-left" ? (r.x = i.x - f / 2 * n, r.y = i.y - f / 2 * h) : t === "middle-right" && (r.x = i.x + f / 2 * n, r.y = i.y + f / 2 * h);
|
|
3952
3997
|
}
|
|
3953
3998
|
}
|
|
3954
|
-
function
|
|
3955
|
-
const
|
|
3956
|
-
|
|
3999
|
+
function jt(r, t, e, i, s) {
|
|
4000
|
+
const o = t.includes("top") || t.includes("bottom"), a = t.includes("middle");
|
|
4001
|
+
o ? We(r, e, s) : a && ze(r, t, e, s);
|
|
3957
4002
|
}
|
|
3958
|
-
class
|
|
4003
|
+
class Xe extends q {
|
|
3959
4004
|
// Temporary property used during resize operations only
|
|
3960
4005
|
constructor(t = {}) {
|
|
3961
4006
|
super(t), this.transformType = "custom";
|
|
3962
4007
|
const e = t.transformData, i = (e == null ? void 0 : e.width) !== void 0 ? e.width : Math.max(
|
|
3963
|
-
|
|
3964
|
-
|
|
4008
|
+
Gt,
|
|
4009
|
+
Pt(this.text, this.fontSize, this.fontFamily, this.bold, this.italic, this.letterSpacing ?? 0) + j * 2
|
|
3965
4010
|
);
|
|
3966
4011
|
this.transformData = {
|
|
3967
4012
|
type: "custom",
|
|
@@ -3974,31 +4019,31 @@ class He extends q {
|
|
|
3974
4019
|
* Returns the total height based on the tallest font in each line
|
|
3975
4020
|
*/
|
|
3976
4021
|
calculateRichTextHeight() {
|
|
3977
|
-
const t = this.getRichText(), e = this.transformData.width - j * 2, i =
|
|
4022
|
+
const t = this.getRichText(), e = this.transformData.width - j * 2, i = Le(t), s = [];
|
|
3978
4023
|
if (i.forEach((h) => {
|
|
3979
|
-
|
|
4024
|
+
Pe(h, e, {
|
|
3980
4025
|
fontSize: this.fontSize,
|
|
3981
4026
|
fontFamily: this.fontFamily,
|
|
3982
4027
|
bold: this.bold,
|
|
3983
4028
|
italic: this.italic,
|
|
3984
4029
|
letterSpacing: this.letterSpacing
|
|
3985
4030
|
}).forEach((c) => {
|
|
3986
|
-
|
|
4031
|
+
s.push(c);
|
|
3987
4032
|
});
|
|
3988
|
-
}),
|
|
4033
|
+
}), s.length === 0)
|
|
3989
4034
|
return 0;
|
|
3990
|
-
let
|
|
3991
|
-
|
|
4035
|
+
let o = 0, a = 0;
|
|
4036
|
+
s.forEach((h) => {
|
|
3992
4037
|
h.forEach((l) => {
|
|
3993
|
-
const c = l.style.fontSize !== void 0 ? l.style.fontSize : this.fontSize, g = l.style.fontFamily !== void 0 ? l.style.fontFamily : this.fontFamily, d = l.style.bold !== void 0 ? l.style.bold : this.bold, f = l.style.italic !== void 0 ? l.style.italic : this.italic, u =
|
|
3994
|
-
|
|
4038
|
+
const c = l.style.fontSize !== void 0 ? l.style.fontSize : this.fontSize, g = l.style.fontFamily !== void 0 ? l.style.fontFamily : this.fontFamily, d = l.style.bold !== void 0 ? l.style.bold : this.bold, f = l.style.italic !== void 0 ? l.style.italic : this.italic, u = Mt(c, g, d, f);
|
|
4039
|
+
o = Math.max(o, u.height), a = Math.max(a, u.ascent);
|
|
3995
4040
|
});
|
|
3996
4041
|
});
|
|
3997
|
-
const n = this.fontSize * (this.lineHeight ??
|
|
3998
|
-
if (
|
|
3999
|
-
return
|
|
4042
|
+
const n = this.fontSize * (this.lineHeight ?? Ut);
|
|
4043
|
+
if (s.length === 1)
|
|
4044
|
+
return o;
|
|
4000
4045
|
{
|
|
4001
|
-
const h =
|
|
4046
|
+
const h = Mt(this.fontSize, this.fontFamily, this.bold, this.italic), l = (s.length - 1) * n + h.height, c = Math.max(0, a - h.ascent), g = Math.max(0, o - a - (h.height - h.ascent));
|
|
4002
4047
|
return l + c + g;
|
|
4003
4048
|
}
|
|
4004
4049
|
}
|
|
@@ -4020,7 +4065,7 @@ class He extends q {
|
|
|
4020
4065
|
getBoundingBox() {
|
|
4021
4066
|
const t = this.transformData.width - j * 2;
|
|
4022
4067
|
let e;
|
|
4023
|
-
return this.hasPerCharacterFormatting() ? e = this.calculateRichTextHeight() : e =
|
|
4068
|
+
return this.hasPerCharacterFormatting() ? e = this.calculateRichTextHeight() : e = Lt(
|
|
4024
4069
|
this.text,
|
|
4025
4070
|
t,
|
|
4026
4071
|
this.fontSize,
|
|
@@ -4047,7 +4092,7 @@ class He extends q {
|
|
|
4047
4092
|
getVisualBoundingBox() {
|
|
4048
4093
|
const t = this.transformData.width - j * 2;
|
|
4049
4094
|
let e;
|
|
4050
|
-
this.hasPerCharacterFormatting() ? e = this.calculateRichTextHeight() : e =
|
|
4095
|
+
this.hasPerCharacterFormatting() ? e = this.calculateRichTextHeight() : e = Lt(
|
|
4051
4096
|
this.text,
|
|
4052
4097
|
t,
|
|
4053
4098
|
this.fontSize,
|
|
@@ -4085,13 +4130,13 @@ class He extends q {
|
|
|
4085
4130
|
*/
|
|
4086
4131
|
render(t, e = !1, i = !1) {
|
|
4087
4132
|
var n;
|
|
4088
|
-
const
|
|
4089
|
-
if (
|
|
4090
|
-
this.renderWithOffscreen(t,
|
|
4133
|
+
const s = this.opacity ?? 1, o = !!((n = this.stroke) != null && n.enabled);
|
|
4134
|
+
if (s < 1 && o) {
|
|
4135
|
+
this.renderWithOffscreen(t, s);
|
|
4091
4136
|
return;
|
|
4092
4137
|
}
|
|
4093
4138
|
const a = t.globalAlpha;
|
|
4094
|
-
|
|
4139
|
+
s !== 1 && (t.globalAlpha = s), gt("custom")(t, this.toJSON()), t.globalAlpha = a;
|
|
4095
4140
|
}
|
|
4096
4141
|
/**
|
|
4097
4142
|
* Render stroke+fill to an offscreen canvas at full opacity, then composite
|
|
@@ -4099,7 +4144,7 @@ class He extends q {
|
|
|
4099
4144
|
*/
|
|
4100
4145
|
renderWithOffscreen(t, e) {
|
|
4101
4146
|
var d;
|
|
4102
|
-
const
|
|
4147
|
+
const s = (((d = this.stroke) == null ? void 0 : d.width) || 0) + 20, o = this.getVisualBoundingBox(), a = Math.ceil(o.width + s * 2), n = Math.ceil(o.height + s * 2), h = document.createElement("canvas");
|
|
4103
4148
|
h.width = a, h.height = n;
|
|
4104
4149
|
const l = h.getContext("2d");
|
|
4105
4150
|
if (!l) {
|
|
@@ -4107,14 +4152,14 @@ class He extends q {
|
|
|
4107
4152
|
t.globalAlpha = e, gt("custom")(t, this.toJSON()), t.globalAlpha = f;
|
|
4108
4153
|
return;
|
|
4109
4154
|
}
|
|
4110
|
-
const c =
|
|
4155
|
+
const c = o.x + o.width / 2, g = o.y + o.height / 2;
|
|
4111
4156
|
l.translate(a / 2 - c, n / 2 - g), gt("custom")(l, this.toJSON()), t.save(), t.globalAlpha = e, t.drawImage(h, c - a / 2, g - n / 2), t.restore();
|
|
4112
4157
|
}
|
|
4113
4158
|
/**
|
|
4114
4159
|
* Override getTransformStartData to capture initial line count
|
|
4115
4160
|
*/
|
|
4116
4161
|
getTransformStartData() {
|
|
4117
|
-
const t = super.getTransformStartData(), e = this.transformData.width - j * 2, i =
|
|
4162
|
+
const t = super.getTransformStartData(), e = this.transformData.width - j * 2, i = It(this.text, e, this.fontSize, this.fontFamily, this.bold, this.italic, void 0, !1, {
|
|
4118
4163
|
letterSpacing: this.letterSpacing
|
|
4119
4164
|
});
|
|
4120
4165
|
return t.lineCount = i.length, t;
|
|
@@ -4124,9 +4169,9 @@ class He extends q {
|
|
|
4124
4169
|
* Corner handles: uniform scale (fontSize and width both change) - line count locked
|
|
4125
4170
|
* Side handles: only width changes - text re-wraps naturally
|
|
4126
4171
|
*/
|
|
4127
|
-
resize(t, e, i,
|
|
4128
|
-
if (t === "top-left" || t === "top-right" || t === "bottom-left" || t === "bottom-right" || (this._lockedLineCount = void 0),
|
|
4129
|
-
const n =
|
|
4172
|
+
resize(t, e, i, s) {
|
|
4173
|
+
if (t === "top-left" || t === "top-right" || t === "bottom-left" || t === "bottom-right" || (this._lockedLineCount = void 0), jt(this, t, e, i, s), this._lockedLineCount !== void 0 && this._lockedLineCount > 0) {
|
|
4174
|
+
const n = Pt(
|
|
4130
4175
|
this.text,
|
|
4131
4176
|
this.fontSize,
|
|
4132
4177
|
this.fontFamily,
|
|
@@ -4178,32 +4223,32 @@ class He extends q {
|
|
|
4178
4223
|
};
|
|
4179
4224
|
}
|
|
4180
4225
|
}
|
|
4181
|
-
function
|
|
4182
|
-
const
|
|
4226
|
+
function Ne(r, t, e, i) {
|
|
4227
|
+
const s = I.toRadians(i), o = Math.cos(s), a = Math.sin(s);
|
|
4183
4228
|
let n = 0, h = 0;
|
|
4184
4229
|
e === "top-left" ? (n = r.width, h = r.height) : e === "top-right" ? (n = 0, h = r.height) : e === "bottom-left" ? (n = r.width, h = 0) : e === "bottom-right" && (n = 0, h = 0);
|
|
4185
|
-
const l = r.x + (n *
|
|
4230
|
+
const l = r.x + (n * o - h * a), c = r.y + (n * a + h * o);
|
|
4186
4231
|
let g = 0, d = 0;
|
|
4187
4232
|
e === "top-left" ? (g = t.width, d = t.height) : e === "top-right" ? (g = 0, d = t.height) : e === "bottom-left" ? (g = t.width, d = 0) : e === "bottom-right" && (g = 0, d = 0);
|
|
4188
|
-
const f = l - (g *
|
|
4233
|
+
const f = l - (g * o - d * a), u = c - (g * a + d * o);
|
|
4189
4234
|
return { x: f, y: u };
|
|
4190
4235
|
}
|
|
4191
|
-
function
|
|
4192
|
-
const
|
|
4236
|
+
function ss(r, t, e, i = 1) {
|
|
4237
|
+
const s = r.width / 2, o = r.height + me / i, a = r.x + s, n = r.y + o, h = I.toRadians(t), l = Math.cos(h), c = Math.sin(h), g = a - e.x, d = n - e.y, f = g * l - d * c, u = g * c + d * l;
|
|
4193
4238
|
return {
|
|
4194
4239
|
x: e.x + f,
|
|
4195
4240
|
y: e.y + u
|
|
4196
4241
|
};
|
|
4197
4242
|
}
|
|
4198
|
-
function
|
|
4199
|
-
const i = I.toRadians(t),
|
|
4200
|
-
const d = r.x + c, f = r.y + g, u = d - e.x, m = f - e.y, p = u *
|
|
4243
|
+
function os(r, t, e) {
|
|
4244
|
+
const i = I.toRadians(t), s = Math.cos(i), o = Math.sin(i), a = (c, g) => {
|
|
4245
|
+
const d = r.x + c, f = r.y + g, u = d - e.x, m = f - e.y, p = u * s - m * o, y = u * o + m * s;
|
|
4201
4246
|
return {
|
|
4202
4247
|
x: e.x + p,
|
|
4203
4248
|
y: e.y + y
|
|
4204
4249
|
};
|
|
4205
4250
|
}, { width: n, height: h } = r, l = (c, g, d, f) => {
|
|
4206
|
-
const u = a(d, f), m =
|
|
4251
|
+
const u = a(d, f), m = _e(
|
|
4207
4252
|
u.x,
|
|
4208
4253
|
u.y,
|
|
4209
4254
|
e.x,
|
|
@@ -4232,35 +4277,35 @@ function ji(r, t, e) {
|
|
|
4232
4277
|
l("edge", "middle-bottom", n / 2, h)
|
|
4233
4278
|
];
|
|
4234
4279
|
}
|
|
4235
|
-
function
|
|
4236
|
-
const
|
|
4237
|
-
return
|
|
4280
|
+
function rs(r, t, e, i, s) {
|
|
4281
|
+
const o = r - e, a = t - i;
|
|
4282
|
+
return o * o + a * a <= s * s;
|
|
4238
4283
|
}
|
|
4239
|
-
function
|
|
4240
|
-
const
|
|
4284
|
+
function ns(r, t, e, i) {
|
|
4285
|
+
const s = I.toRadiansInverse(i), o = Math.cos(s), a = Math.sin(s), n = r - e.x, h = t - e.y, l = n * o - h * a, c = n * a + h * o;
|
|
4241
4286
|
return l >= 0 && l <= e.width && c >= 0 && c <= e.height;
|
|
4242
4287
|
}
|
|
4243
|
-
function tt(r, t, e = "Arial", i = !1,
|
|
4244
|
-
const a = document.createElement("canvas").getContext("2d"), n = i ? "bold" : "normal", h =
|
|
4288
|
+
function tt(r, t, e = "Arial", i = !1, s = !1) {
|
|
4289
|
+
const a = document.createElement("canvas").getContext("2d"), n = i ? "bold" : "normal", h = s ? "italic" : "normal";
|
|
4245
4290
|
return a.font = `${h} ${n} ${t}px ${e}`, a.measureText(r).width;
|
|
4246
4291
|
}
|
|
4247
|
-
function
|
|
4292
|
+
function as(r) {
|
|
4248
4293
|
return {
|
|
4249
4294
|
x: r.x + r.width / 2,
|
|
4250
4295
|
y: r.y + r.height / 2
|
|
4251
4296
|
};
|
|
4252
4297
|
}
|
|
4253
|
-
function
|
|
4298
|
+
function hs(r, t, e, i) {
|
|
4254
4299
|
return Math.atan2(i - t, e - r);
|
|
4255
4300
|
}
|
|
4256
|
-
function
|
|
4301
|
+
function ls(r, t, e) {
|
|
4257
4302
|
return Math.abs(r - t) <= e;
|
|
4258
4303
|
}
|
|
4259
|
-
function
|
|
4304
|
+
function _e(r, t, e, i, s, o = 0, a = "") {
|
|
4260
4305
|
const n = r - e, h = t - i;
|
|
4261
4306
|
let l = Math.atan2(h, n) * (180 / Math.PI);
|
|
4262
|
-
if (l = (l % 360 + 360) % 360,
|
|
4263
|
-
if (Math.abs(
|
|
4307
|
+
if (l = (l % 360 + 360) % 360, s === "corner") {
|
|
4308
|
+
if (Math.abs(o) < 0.1) {
|
|
4264
4309
|
if (a === "top-left" || a === "bottom-right")
|
|
4265
4310
|
return "nwse-resize";
|
|
4266
4311
|
if (a === "top-right" || a === "bottom-left")
|
|
@@ -4273,17 +4318,17 @@ function Le(r, t, e, i, o, s = 0, a = "") {
|
|
|
4273
4318
|
return c >= 45 && c < 135 ? "ns-resize" : "ew-resize";
|
|
4274
4319
|
}
|
|
4275
4320
|
}
|
|
4276
|
-
function
|
|
4321
|
+
function Ye(r) {
|
|
4277
4322
|
if (!r.getTransform)
|
|
4278
4323
|
return 1;
|
|
4279
4324
|
const t = r.getTransform();
|
|
4280
4325
|
return Math.sqrt(t.a * t.a + t.b * t.b);
|
|
4281
4326
|
}
|
|
4282
|
-
function
|
|
4283
|
-
const i =
|
|
4284
|
-
r.lineWidth = i > 0 ? t / i : t, e.length > 0 && r.setLineDash(i > 0 ? e.map((
|
|
4327
|
+
function cs(r, t, e = []) {
|
|
4328
|
+
const i = Ye(r);
|
|
4329
|
+
r.lineWidth = i > 0 ? t / i : t, e.length > 0 && r.setLineDash(i > 0 ? e.map((s) => s / i) : e);
|
|
4285
4330
|
}
|
|
4286
|
-
class
|
|
4331
|
+
class Ue extends q {
|
|
4287
4332
|
constructor(t = {}) {
|
|
4288
4333
|
super(t), this.transformType = "circle";
|
|
4289
4334
|
const e = t.transformData;
|
|
@@ -4313,11 +4358,11 @@ class ze extends q {
|
|
|
4313
4358
|
* For circular text, calculate the arc bounds where text actually appears
|
|
4314
4359
|
*/
|
|
4315
4360
|
getVisualBoundingBox() {
|
|
4316
|
-
const t = this.transformData.radius * this.transformData.scale, e = this.fontSize * this.transformData.scale,
|
|
4361
|
+
const t = this.transformData.radius * this.transformData.scale, e = this.fontSize * this.transformData.scale, s = tt(this.text, e, this.fontFamily, this.bold, this.italic) / t, o = -Math.PI / 2 - s / 2, a = -Math.PI / 2 + s / 2, n = t > e / 2 ? t - e / 2 : t * 0.1, h = t + e / 2;
|
|
4317
4362
|
let l = 1 / 0, c = -1 / 0, g = 1 / 0, d = -1 / 0;
|
|
4318
4363
|
const f = 10;
|
|
4319
4364
|
for (let u = 0; u <= f; u++) {
|
|
4320
|
-
const m =
|
|
4365
|
+
const m = o + (a - o) * (u / f), p = this.x + Math.cos(m) * n, y = this.y + Math.sin(m) * n, w = this.x + Math.cos(m) * h, S = this.y + Math.sin(m) * h;
|
|
4321
4366
|
l = Math.min(l, p, w), c = Math.max(c, p, w), g = Math.min(g, y, S), d = Math.max(d, y, S);
|
|
4322
4367
|
}
|
|
4323
4368
|
return {
|
|
@@ -4336,15 +4381,15 @@ class ze extends q {
|
|
|
4336
4381
|
* Handle resize
|
|
4337
4382
|
* For circle, we maintain uniform scale and keep scale on the transform
|
|
4338
4383
|
*/
|
|
4339
|
-
resize(t, e, i,
|
|
4340
|
-
const
|
|
4384
|
+
resize(t, e, i, s) {
|
|
4385
|
+
const o = s.transformData, a = (e + i) / 2, n = (s.width + s.height) / 2, h = a / n, l = o.scale * h, c = Math.max(0.1, Math.min(10, l));
|
|
4341
4386
|
this.transformData.scale = c;
|
|
4342
|
-
const g = this.getBoundingBox(), d =
|
|
4387
|
+
const g = this.getBoundingBox(), d = Ne(
|
|
4343
4388
|
{
|
|
4344
|
-
x:
|
|
4345
|
-
y:
|
|
4346
|
-
width:
|
|
4347
|
-
height:
|
|
4389
|
+
x: s.x - o.radius * o.scale,
|
|
4390
|
+
y: s.y - o.radius * o.scale,
|
|
4391
|
+
width: o.radius * 2 * o.scale,
|
|
4392
|
+
height: o.radius * 2 * o.scale
|
|
4348
4393
|
},
|
|
4349
4394
|
{ width: g.width, height: g.height },
|
|
4350
4395
|
t,
|
|
@@ -4413,7 +4458,7 @@ class ze extends q {
|
|
|
4413
4458
|
};
|
|
4414
4459
|
}
|
|
4415
4460
|
}
|
|
4416
|
-
class
|
|
4461
|
+
class Ge extends q {
|
|
4417
4462
|
constructor(t = {}) {
|
|
4418
4463
|
super(t), this.transformType = "arch";
|
|
4419
4464
|
const e = t.transformData;
|
|
@@ -4433,10 +4478,10 @@ class Xe extends q {
|
|
|
4433
4478
|
};
|
|
4434
4479
|
}
|
|
4435
4480
|
getVisualBoundingBox() {
|
|
4436
|
-
const t = this.text.split(""), e = t.map((u) => tt(u, this.fontSize, this.fontFamily)), i = e.reduce((u, m) => u + m, 0),
|
|
4481
|
+
const t = this.text.split(""), e = t.map((u) => tt(u, this.fontSize, this.fontFamily)), i = e.reduce((u, m) => u + m, 0), s = this.transformData.width / 2, o = 0.3, n = this.fontSize / 2;
|
|
4437
4482
|
let h = 1 / 0, l = -1 / 0, c = 1 / 0, g = -1 / 0, d = -i / 2;
|
|
4438
4483
|
t.forEach((u, m) => {
|
|
4439
|
-
const p = e[m], y = d + p / 2, w = y /
|
|
4484
|
+
const p = e[m], y = d + p / 2, w = y / s, S = (Math.pow(w, 2) - 1) * this.transformData.archHeight * this.fontSize, b = 2 * w * this.transformData.archHeight;
|
|
4440
4485
|
[
|
|
4441
4486
|
{ x: -p / 2, y: -n },
|
|
4442
4487
|
// top-left
|
|
@@ -4447,8 +4492,8 @@ class Xe extends q {
|
|
|
4447
4492
|
{ x: p / 2, y: n }
|
|
4448
4493
|
// bottom-right
|
|
4449
4494
|
].forEach((C) => {
|
|
4450
|
-
const M = C.x, F = C.y + b *
|
|
4451
|
-
h = Math.min(h,
|
|
4495
|
+
const M = C.x, F = C.y + b * o * C.x, T = y + M, D = S + F;
|
|
4496
|
+
h = Math.min(h, T), l = Math.max(l, T), c = Math.min(c, D), g = Math.max(g, D);
|
|
4452
4497
|
}), d += p;
|
|
4453
4498
|
});
|
|
4454
4499
|
const f = 2;
|
|
@@ -4459,22 +4504,22 @@ class Xe extends q {
|
|
|
4459
4504
|
height: g - c
|
|
4460
4505
|
};
|
|
4461
4506
|
}
|
|
4462
|
-
resize(t, e, i,
|
|
4463
|
-
const
|
|
4464
|
-
if (
|
|
4465
|
-
const h = e /
|
|
4507
|
+
resize(t, e, i, s) {
|
|
4508
|
+
const o = t.includes("top") || t.includes("bottom"), a = t.includes("middle"), n = s.transformData;
|
|
4509
|
+
if (o) {
|
|
4510
|
+
const h = e / s.width, l = s.fontSize * h;
|
|
4466
4511
|
this.setFontSize(l);
|
|
4467
4512
|
const c = n.width * h;
|
|
4468
4513
|
this.transformData.width = Math.max(50, c);
|
|
4469
4514
|
} else if (a && (t === "middle-left" || t === "middle-right")) {
|
|
4470
|
-
this.fontSize =
|
|
4471
|
-
const h = e -
|
|
4515
|
+
this.fontSize = s.fontSize, this.transformData.width = Math.max(50, e);
|
|
4516
|
+
const h = e - s.width, l = this.rotation * Math.PI / 180, c = Math.cos(l), g = Math.sin(l);
|
|
4472
4517
|
if (t === "middle-left") {
|
|
4473
4518
|
const d = -h / 2;
|
|
4474
|
-
this.x =
|
|
4519
|
+
this.x = s.x + d * c, this.y = s.y + d * g;
|
|
4475
4520
|
} else if (t === "middle-right") {
|
|
4476
4521
|
const d = h / 2;
|
|
4477
|
-
this.x =
|
|
4522
|
+
this.x = s.x + d * c, this.y = s.y + d * g;
|
|
4478
4523
|
}
|
|
4479
4524
|
}
|
|
4480
4525
|
}
|
|
@@ -4506,7 +4551,7 @@ class Xe extends q {
|
|
|
4506
4551
|
};
|
|
4507
4552
|
}
|
|
4508
4553
|
}
|
|
4509
|
-
const
|
|
4554
|
+
const ot = {
|
|
4510
4555
|
amplitude: 0.2,
|
|
4511
4556
|
// 20% - subtle wave effect
|
|
4512
4557
|
frequency: 1.2,
|
|
@@ -4518,22 +4563,22 @@ const st = {
|
|
|
4518
4563
|
frequency: 2,
|
|
4519
4564
|
// Standard flag frequency
|
|
4520
4565
|
width: 200
|
|
4521
|
-
},
|
|
4566
|
+
}, $e = {
|
|
4522
4567
|
archHeight: 0.5
|
|
4523
|
-
},
|
|
4568
|
+
}, Ve = {
|
|
4524
4569
|
leanAmount: 0
|
|
4525
|
-
},
|
|
4570
|
+
}, Je = {
|
|
4526
4571
|
ascendAngle: -15
|
|
4527
4572
|
};
|
|
4528
|
-
class
|
|
4573
|
+
class qe extends q {
|
|
4529
4574
|
constructor(t = {}) {
|
|
4530
4575
|
super(t), this.transformType = "wave";
|
|
4531
4576
|
const e = t.transformData;
|
|
4532
4577
|
this.transformData = {
|
|
4533
4578
|
type: "wave",
|
|
4534
|
-
amplitude: (e == null ? void 0 : e.amplitude) ??
|
|
4535
|
-
frequency: (e == null ? void 0 : e.frequency) ??
|
|
4536
|
-
width: (e == null ? void 0 : e.width) ??
|
|
4579
|
+
amplitude: (e == null ? void 0 : e.amplitude) ?? ot.amplitude,
|
|
4580
|
+
frequency: (e == null ? void 0 : e.frequency) ?? ot.frequency,
|
|
4581
|
+
width: (e == null ? void 0 : e.width) ?? ot.width
|
|
4537
4582
|
};
|
|
4538
4583
|
}
|
|
4539
4584
|
getBoundingBox() {
|
|
@@ -4546,21 +4591,21 @@ class Ue extends q {
|
|
|
4546
4591
|
};
|
|
4547
4592
|
}
|
|
4548
4593
|
getVisualBoundingBox() {
|
|
4549
|
-
const t = this.text.split(""), e = t.map((d) => tt(d, this.fontSize, this.fontFamily)), i = e.reduce((d, f) => d + f, 0),
|
|
4594
|
+
const t = this.text.split(""), e = t.map((d) => tt(d, this.fontSize, this.fontFamily)), i = e.reduce((d, f) => d + f, 0), o = this.fontSize / 2;
|
|
4550
4595
|
let a = 1 / 0, n = -1 / 0, h = 1 / 0, l = -1 / 0, c = -i / 2;
|
|
4551
4596
|
t.forEach((d, f) => {
|
|
4552
4597
|
const u = e[f], m = c + u / 2, p = m / (this.transformData.width / 2), y = this.transformData.amplitude * this.fontSize * Math.sin(this.transformData.frequency * Math.PI * p), w = this.transformData.amplitude * this.transformData.frequency * Math.PI * Math.cos(this.transformData.frequency * Math.PI * p);
|
|
4553
4598
|
[
|
|
4554
|
-
{ x: -u / 2, y: -
|
|
4599
|
+
{ x: -u / 2, y: -o },
|
|
4555
4600
|
// top-left
|
|
4556
|
-
{ x: u / 2, y: -
|
|
4601
|
+
{ x: u / 2, y: -o },
|
|
4557
4602
|
// top-right
|
|
4558
|
-
{ x: -u / 2, y:
|
|
4603
|
+
{ x: -u / 2, y: o },
|
|
4559
4604
|
// bottom-left
|
|
4560
|
-
{ x: u / 2, y:
|
|
4605
|
+
{ x: u / 2, y: o }
|
|
4561
4606
|
// bottom-right
|
|
4562
4607
|
].forEach((b) => {
|
|
4563
|
-
const
|
|
4608
|
+
const v = b.x, C = b.y + w * Ce * b.x, M = m + v, F = y + C;
|
|
4564
4609
|
a = Math.min(a, M), n = Math.max(n, M), h = Math.min(h, F), l = Math.max(l, F);
|
|
4565
4610
|
}), c += u;
|
|
4566
4611
|
});
|
|
@@ -4572,8 +4617,8 @@ class Ue extends q {
|
|
|
4572
4617
|
height: l - h
|
|
4573
4618
|
};
|
|
4574
4619
|
}
|
|
4575
|
-
resize(t, e, i,
|
|
4576
|
-
|
|
4620
|
+
resize(t, e, i, s) {
|
|
4621
|
+
jt(this, t, e, i, s);
|
|
4577
4622
|
}
|
|
4578
4623
|
getEnabledAnchors() {
|
|
4579
4624
|
return ["top-left", "top-right", "bottom-left", "bottom-right"];
|
|
@@ -4594,7 +4639,7 @@ class Ue extends q {
|
|
|
4594
4639
|
};
|
|
4595
4640
|
}
|
|
4596
4641
|
}
|
|
4597
|
-
class
|
|
4642
|
+
class je extends q {
|
|
4598
4643
|
constructor(t = {}) {
|
|
4599
4644
|
super(t), this.transformType = "flag";
|
|
4600
4645
|
const e = t.transformData;
|
|
@@ -4615,10 +4660,10 @@ class Ge extends q {
|
|
|
4615
4660
|
};
|
|
4616
4661
|
}
|
|
4617
4662
|
getVisualBoundingBox() {
|
|
4618
|
-
const t = this.text.split(""), e = t.map((f) => tt(f, this.fontSize, this.fontFamily)), i = e.reduce((f, u) => f + u, 0),
|
|
4663
|
+
const t = this.text.split(""), e = t.map((f) => tt(f, this.fontSize, this.fontFamily)), i = e.reduce((f, u) => f + u, 0), s = 0.3, a = this.fontSize / 2;
|
|
4619
4664
|
let n = 1 / 0, h = -1 / 0, l = 1 / 0, c = -1 / 0, g = -i / 2;
|
|
4620
4665
|
t.forEach((f, u) => {
|
|
4621
|
-
const m = e[u], p = g + m / 2, y = p / (this.transformData.width / 2), w = Math.abs(y), S = this.transformData.amplitude * w, b = S * this.fontSize * Math.sin(this.transformData.frequency * Math.PI * y),
|
|
4666
|
+
const m = e[u], p = g + m / 2, y = p / (this.transformData.width / 2), w = Math.abs(y), S = this.transformData.amplitude * w, b = S * this.fontSize * Math.sin(this.transformData.frequency * Math.PI * y), v = S * this.transformData.frequency * Math.PI * Math.cos(this.transformData.frequency * Math.PI * y), C = this.transformData.amplitude * Math.sign(y) * Math.sin(this.transformData.frequency * Math.PI * y), M = v + C;
|
|
4622
4667
|
[
|
|
4623
4668
|
{ x: -m / 2, y: -a },
|
|
4624
4669
|
// top-left
|
|
@@ -4628,8 +4673,8 @@ class Ge extends q {
|
|
|
4628
4673
|
// bottom-left
|
|
4629
4674
|
{ x: m / 2, y: a }
|
|
4630
4675
|
// bottom-right
|
|
4631
|
-
].forEach((
|
|
4632
|
-
const D =
|
|
4676
|
+
].forEach((T) => {
|
|
4677
|
+
const D = T.x, U = T.y + M * s * T.x, B = p + D, A = b + U;
|
|
4633
4678
|
n = Math.min(n, B), h = Math.max(h, B), l = Math.min(l, A), c = Math.max(c, A);
|
|
4634
4679
|
}), g += m;
|
|
4635
4680
|
});
|
|
@@ -4641,22 +4686,22 @@ class Ge extends q {
|
|
|
4641
4686
|
height: c - l
|
|
4642
4687
|
};
|
|
4643
4688
|
}
|
|
4644
|
-
resize(t, e, i,
|
|
4645
|
-
const
|
|
4646
|
-
if (
|
|
4647
|
-
const h = e /
|
|
4689
|
+
resize(t, e, i, s) {
|
|
4690
|
+
const o = t.includes("top") || t.includes("bottom"), a = t.includes("middle"), n = s.transformData;
|
|
4691
|
+
if (o) {
|
|
4692
|
+
const h = e / s.width, l = s.fontSize * h;
|
|
4648
4693
|
this.setFontSize(l);
|
|
4649
4694
|
const c = n.width * h;
|
|
4650
4695
|
this.transformData.width = Math.max(50, c);
|
|
4651
4696
|
} else if (a && (t === "middle-left" || t === "middle-right")) {
|
|
4652
|
-
this.fontSize =
|
|
4653
|
-
const h = e -
|
|
4697
|
+
this.fontSize = s.fontSize, this.transformData.width = Math.max(50, e);
|
|
4698
|
+
const h = e - s.width, l = this.rotation * Math.PI / 180, c = Math.cos(l), g = Math.sin(l);
|
|
4654
4699
|
if (t === "middle-left") {
|
|
4655
4700
|
const d = -h / 2;
|
|
4656
|
-
this.x =
|
|
4701
|
+
this.x = s.x + d * c, this.y = s.y + d * g;
|
|
4657
4702
|
} else if (t === "middle-right") {
|
|
4658
4703
|
const d = h / 2;
|
|
4659
|
-
this.x =
|
|
4704
|
+
this.x = s.x + d * c, this.y = s.y + d * g;
|
|
4660
4705
|
}
|
|
4661
4706
|
}
|
|
4662
4707
|
}
|
|
@@ -4690,7 +4735,7 @@ class Ge extends q {
|
|
|
4690
4735
|
};
|
|
4691
4736
|
}
|
|
4692
4737
|
}
|
|
4693
|
-
class
|
|
4738
|
+
class Ze extends q {
|
|
4694
4739
|
constructor(t = {}) {
|
|
4695
4740
|
super(t), this.transformType = "lean";
|
|
4696
4741
|
const e = t.transformData;
|
|
@@ -4710,7 +4755,7 @@ class $e extends q {
|
|
|
4710
4755
|
};
|
|
4711
4756
|
}
|
|
4712
4757
|
getVisualBoundingBox() {
|
|
4713
|
-
const e = tt(this.text, this.fontSize, this.fontFamily), i = this.fontSize * 1.2,
|
|
4758
|
+
const e = tt(this.text, this.fontSize, this.fontFamily), i = this.fontSize * 1.2, s = -this.transformData.leanAmount * Math.PI / 4, o = Math.tan(s), a = [
|
|
4714
4759
|
{ x: -e / 2, y: -i / 2 },
|
|
4715
4760
|
// top-left
|
|
4716
4761
|
{ x: e / 2, y: -i / 2 },
|
|
@@ -4722,7 +4767,7 @@ class $e extends q {
|
|
|
4722
4767
|
];
|
|
4723
4768
|
let n = 1 / 0, h = -1 / 0, l = 1 / 0, c = -1 / 0;
|
|
4724
4769
|
a.forEach((d) => {
|
|
4725
|
-
const f = d.x +
|
|
4770
|
+
const f = d.x + o * d.y, u = d.y;
|
|
4726
4771
|
n = Math.min(n, f), h = Math.max(h, f), l = Math.min(l, u), c = Math.max(c, u);
|
|
4727
4772
|
});
|
|
4728
4773
|
const g = 2;
|
|
@@ -4733,22 +4778,22 @@ class $e extends q {
|
|
|
4733
4778
|
height: c - l
|
|
4734
4779
|
};
|
|
4735
4780
|
}
|
|
4736
|
-
resize(t, e, i,
|
|
4737
|
-
const
|
|
4738
|
-
if (
|
|
4739
|
-
const h = e /
|
|
4781
|
+
resize(t, e, i, s) {
|
|
4782
|
+
const o = t.includes("top") || t.includes("bottom"), a = t.includes("middle"), n = s.transformData;
|
|
4783
|
+
if (o) {
|
|
4784
|
+
const h = e / s.width, l = s.fontSize * h;
|
|
4740
4785
|
this.setFontSize(l);
|
|
4741
4786
|
const c = n.width * h;
|
|
4742
4787
|
this.transformData.width = Math.max(50, c);
|
|
4743
4788
|
} else if (a && (t === "middle-left" || t === "middle-right")) {
|
|
4744
|
-
this.fontSize =
|
|
4789
|
+
this.fontSize = s.fontSize, this.transformData.width = Math.max(50, e);
|
|
4745
4790
|
const h = e - n.width, l = this.rotation * Math.PI / 180, c = Math.cos(l), g = Math.sin(l);
|
|
4746
4791
|
if (t === "middle-left") {
|
|
4747
4792
|
const d = -h / 2;
|
|
4748
|
-
this.x =
|
|
4793
|
+
this.x = s.x + d * c, this.y = s.y + d * g;
|
|
4749
4794
|
} else if (t === "middle-right") {
|
|
4750
4795
|
const d = h / 2;
|
|
4751
|
-
this.x =
|
|
4796
|
+
this.x = s.x + d * c, this.y = s.y + d * g;
|
|
4752
4797
|
}
|
|
4753
4798
|
}
|
|
4754
4799
|
}
|
|
@@ -4780,7 +4825,7 @@ class $e extends q {
|
|
|
4780
4825
|
};
|
|
4781
4826
|
}
|
|
4782
4827
|
}
|
|
4783
|
-
class
|
|
4828
|
+
class Ke extends q {
|
|
4784
4829
|
constructor(t = {}) {
|
|
4785
4830
|
super(t), this.transformType = "ascend";
|
|
4786
4831
|
const e = t.transformData;
|
|
@@ -4791,19 +4836,19 @@ class Ve extends q {
|
|
|
4791
4836
|
};
|
|
4792
4837
|
}
|
|
4793
4838
|
getBoundingBox() {
|
|
4794
|
-
const t = this.transformData.ascendAngle * Math.PI / 180, e = this.transformData.width, i = e * Math.tan(t),
|
|
4839
|
+
const t = this.transformData.ascendAngle * Math.PI / 180, e = this.transformData.width, i = e * Math.tan(t), s = Math.abs(i) + this.fontSize * 1.2, o = i > 0 ? -s : 0;
|
|
4795
4840
|
return {
|
|
4796
4841
|
x: this.x - e / 2,
|
|
4797
|
-
y: this.y +
|
|
4842
|
+
y: this.y + o,
|
|
4798
4843
|
width: e,
|
|
4799
|
-
height:
|
|
4844
|
+
height: s
|
|
4800
4845
|
};
|
|
4801
4846
|
}
|
|
4802
4847
|
getVisualBoundingBox() {
|
|
4803
|
-
const t = this.text.split(""), e = t.map((m) => tt(m, this.fontSize, this.fontFamily)), i = e.reduce((m, p) => m + p, 0),
|
|
4848
|
+
const t = this.text.split(""), e = t.map((m) => tt(m, this.fontSize, this.fontFamily)), i = e.reduce((m, p) => m + p, 0), s = this.transformData.ascendAngle * Math.PI / 180, o = Math.tan(s), a = 1, h = this.fontSize / 2;
|
|
4804
4849
|
let l = 1 / 0, c = -1 / 0, g = 1 / 0, d = -1 / 0, f = -i / 2;
|
|
4805
4850
|
t.forEach((m, p) => {
|
|
4806
|
-
const y = e[p], w = f + y / 2, S = w *
|
|
4851
|
+
const y = e[p], w = f + y / 2, S = w * o;
|
|
4807
4852
|
[
|
|
4808
4853
|
{ x: -y / 2, y: -h },
|
|
4809
4854
|
// top-left
|
|
@@ -4813,9 +4858,9 @@ class Ve extends q {
|
|
|
4813
4858
|
// bottom-left
|
|
4814
4859
|
{ x: y / 2, y: h }
|
|
4815
4860
|
// bottom-right
|
|
4816
|
-
].forEach((
|
|
4817
|
-
const C =
|
|
4818
|
-
l = Math.min(l, F), c = Math.max(c, F), g = Math.min(g,
|
|
4861
|
+
].forEach((v) => {
|
|
4862
|
+
const C = v.x, M = v.y + o * a * v.x, F = w + C, T = S + M;
|
|
4863
|
+
l = Math.min(l, F), c = Math.max(c, F), g = Math.min(g, T), d = Math.max(d, T);
|
|
4819
4864
|
}), f += y;
|
|
4820
4865
|
});
|
|
4821
4866
|
const u = 2;
|
|
@@ -4826,22 +4871,22 @@ class Ve extends q {
|
|
|
4826
4871
|
height: d - g
|
|
4827
4872
|
};
|
|
4828
4873
|
}
|
|
4829
|
-
resize(t, e, i,
|
|
4830
|
-
const
|
|
4831
|
-
if (
|
|
4832
|
-
const h = e /
|
|
4874
|
+
resize(t, e, i, s) {
|
|
4875
|
+
const o = t.includes("top") || t.includes("bottom"), a = t.includes("middle"), n = s.transformData;
|
|
4876
|
+
if (o) {
|
|
4877
|
+
const h = e / s.width, l = s.fontSize * h;
|
|
4833
4878
|
this.setFontSize(l);
|
|
4834
4879
|
const c = n.width * h;
|
|
4835
4880
|
this.transformData.width = Math.max(50, c);
|
|
4836
4881
|
} else if (a && (t === "middle-left" || t === "middle-right")) {
|
|
4837
|
-
this.fontSize =
|
|
4838
|
-
const h = e -
|
|
4882
|
+
this.fontSize = s.fontSize, this.transformData.width = Math.max(50, e);
|
|
4883
|
+
const h = e - s.width, l = this.rotation * Math.PI / 180, c = Math.cos(l), g = Math.sin(l);
|
|
4839
4884
|
if (t === "middle-left") {
|
|
4840
4885
|
const d = -h / 2;
|
|
4841
|
-
this.x =
|
|
4886
|
+
this.x = s.x + d * c, this.y = s.y + d * g;
|
|
4842
4887
|
} else if (t === "middle-right") {
|
|
4843
4888
|
const d = h / 2;
|
|
4844
|
-
this.x =
|
|
4889
|
+
this.x = s.x + d * c, this.y = s.y + d * g;
|
|
4845
4890
|
}
|
|
4846
4891
|
}
|
|
4847
4892
|
}
|
|
@@ -4873,16 +4918,16 @@ class Ve extends q {
|
|
|
4873
4918
|
};
|
|
4874
4919
|
}
|
|
4875
4920
|
}
|
|
4876
|
-
class
|
|
4921
|
+
class kt extends Q {
|
|
4877
4922
|
constructor(t = {}) {
|
|
4878
|
-
var i,
|
|
4923
|
+
var i, s, o, a, n, h, l, c, g, d, f;
|
|
4879
4924
|
super(t), this.transformType = "shape";
|
|
4880
4925
|
const e = "rectangle";
|
|
4881
4926
|
this.transformData = {
|
|
4882
4927
|
type: "shape",
|
|
4883
4928
|
shapeType: ((i = t.transformData) == null ? void 0 : i.shapeType) || e,
|
|
4884
|
-
width: ((
|
|
4885
|
-
height: ((
|
|
4929
|
+
width: ((s = t.transformData) == null ? void 0 : s.width) || 200,
|
|
4930
|
+
height: ((o = t.transformData) == null ? void 0 : o.height) || 200,
|
|
4886
4931
|
borderRadius: ((a = t.transformData) == null ? void 0 : a.borderRadius) ?? 3,
|
|
4887
4932
|
// Default 3% radius (~6px on 200x200 shape, matches hover border)
|
|
4888
4933
|
radiusX: (n = t.transformData) == null ? void 0 : n.radiusX,
|
|
@@ -4890,7 +4935,7 @@ class Mt extends Q {
|
|
|
4890
4935
|
sides: ((l = t.transformData) == null ? void 0 : l.sides) ?? 5,
|
|
4891
4936
|
points: ((c = t.transformData) == null ? void 0 : c.points) ?? 5,
|
|
4892
4937
|
innerRadius: ((g = t.transformData) == null ? void 0 : g.innerRadius) ?? 0.4,
|
|
4893
|
-
fillColor: ((d = t.transformData) == null ? void 0 : d.fillColor) ||
|
|
4938
|
+
fillColor: ((d = t.transformData) == null ? void 0 : d.fillColor) || Yt(),
|
|
4894
4939
|
fillOpacity: ((f = t.transformData) == null ? void 0 : f.fillOpacity) ?? 1
|
|
4895
4940
|
};
|
|
4896
4941
|
}
|
|
@@ -4925,34 +4970,34 @@ class Mt extends Q {
|
|
|
4925
4970
|
getVisualBoundingBox() {
|
|
4926
4971
|
const { shapeType: t, width: e, height: i } = this.transformData;
|
|
4927
4972
|
if (t === "circle") {
|
|
4928
|
-
const
|
|
4973
|
+
const s = Math.min(e, i) / 2;
|
|
4929
4974
|
return {
|
|
4930
|
-
x: this.x -
|
|
4931
|
-
y: this.y -
|
|
4932
|
-
width:
|
|
4933
|
-
height:
|
|
4975
|
+
x: this.x - s,
|
|
4976
|
+
y: this.y - s,
|
|
4977
|
+
width: s * 2,
|
|
4978
|
+
height: s * 2
|
|
4934
4979
|
};
|
|
4935
4980
|
}
|
|
4936
4981
|
if (t === "polygon" || t === "star") {
|
|
4937
|
-
const
|
|
4938
|
-
let
|
|
4982
|
+
const s = Math.min(e, i) / 2;
|
|
4983
|
+
let o = 1 / 0, a = 1 / 0, n = -1 / 0, h = -1 / 0;
|
|
4939
4984
|
if (t === "polygon") {
|
|
4940
4985
|
const l = this.transformData.sides || 5;
|
|
4941
4986
|
for (let c = 0; c < l; c++) {
|
|
4942
|
-
const g = c * 2 * Math.PI / l - Math.PI / 2, d =
|
|
4943
|
-
d <
|
|
4987
|
+
const g = c * 2 * Math.PI / l - Math.PI / 2, d = s * Math.cos(g), f = s * Math.sin(g);
|
|
4988
|
+
d < o && (o = d), d > n && (n = d), f < a && (a = f), f > h && (h = f);
|
|
4944
4989
|
}
|
|
4945
4990
|
} else {
|
|
4946
|
-
const l = this.transformData.points || 5, c =
|
|
4991
|
+
const l = this.transformData.points || 5, c = s, g = c * (this.transformData.innerRadius ?? 0.4);
|
|
4947
4992
|
for (let d = 0; d < l * 2; d++) {
|
|
4948
4993
|
const f = d * Math.PI / l - Math.PI / 2, u = d % 2 === 0 ? c : g, m = u * Math.cos(f), p = u * Math.sin(f);
|
|
4949
|
-
m <
|
|
4994
|
+
m < o && (o = m), m > n && (n = m), p < a && (a = p), p > h && (h = p);
|
|
4950
4995
|
}
|
|
4951
4996
|
}
|
|
4952
4997
|
return {
|
|
4953
|
-
x: this.x +
|
|
4998
|
+
x: this.x + o,
|
|
4954
4999
|
y: this.y + a,
|
|
4955
|
-
width: n -
|
|
5000
|
+
width: n - o,
|
|
4956
5001
|
height: h - a
|
|
4957
5002
|
};
|
|
4958
5003
|
}
|
|
@@ -4969,14 +5014,14 @@ class Mt extends Q {
|
|
|
4969
5014
|
*/
|
|
4970
5015
|
render(t, e = !1, i = !1) {
|
|
4971
5016
|
var n;
|
|
4972
|
-
const
|
|
4973
|
-
if (
|
|
4974
|
-
this.renderWithOffscreen(t,
|
|
5017
|
+
const s = this.opacity ?? 1, o = !!((n = this.stroke) != null && n.enabled);
|
|
5018
|
+
if (s < 1 && o) {
|
|
5019
|
+
this.renderWithOffscreen(t, s);
|
|
4975
5020
|
return;
|
|
4976
5021
|
}
|
|
4977
5022
|
t.save(), t.translate(this.x, this.y), t.rotate(I.toRadians(this.rotation)), t.fillStyle = this.transformData.fillColor || "#3b82f6";
|
|
4978
5023
|
const a = this.transformData.fillOpacity ?? 1;
|
|
4979
|
-
t.globalAlpha =
|
|
5024
|
+
t.globalAlpha = s * a, this.renderShape(t), t.restore(), o && this.renderStroke(t, s);
|
|
4980
5025
|
}
|
|
4981
5026
|
/**
|
|
4982
5027
|
* Render fill+stroke to a temporary canvas at full opacity, then composite
|
|
@@ -4984,7 +5029,7 @@ class Mt extends Q {
|
|
|
4984
5029
|
*/
|
|
4985
5030
|
renderWithOffscreen(t, e) {
|
|
4986
5031
|
var f;
|
|
4987
|
-
const { width: i, height:
|
|
5032
|
+
const { width: i, height: s } = this.transformData, a = (((f = this.stroke) == null ? void 0 : f.width) || 2) + 2, n = Math.ceil(i + a * 2), h = Math.ceil(s + a * 2), l = document.createElement("canvas");
|
|
4988
5033
|
l.width = n, l.height = h;
|
|
4989
5034
|
const c = l.getContext("2d");
|
|
4990
5035
|
if (!c) {
|
|
@@ -5008,55 +5053,55 @@ class Mt extends Q {
|
|
|
5008
5053
|
* Trace the shape path without filling or stroking — used by offscreen render
|
|
5009
5054
|
*/
|
|
5010
5055
|
traceShapePath(t) {
|
|
5011
|
-
const { shapeType: e, width: i, height:
|
|
5056
|
+
const { shapeType: e, width: i, height: s } = this.transformData;
|
|
5012
5057
|
switch (e) {
|
|
5013
5058
|
case "rectangle": {
|
|
5014
|
-
const
|
|
5015
|
-
if (
|
|
5016
|
-
const h = Math.min(
|
|
5017
|
-
t.roundRect(a, n, i,
|
|
5059
|
+
const o = this.transformData.borderRadius || 0, a = -i / 2, n = -s / 2;
|
|
5060
|
+
if (o > 0) {
|
|
5061
|
+
const h = Math.min(o / 100 * Math.min(i, s), i / 2, s / 2);
|
|
5062
|
+
t.roundRect(a, n, i, s, h);
|
|
5018
5063
|
} else
|
|
5019
|
-
t.rect(a, n, i,
|
|
5064
|
+
t.rect(a, n, i, s);
|
|
5020
5065
|
break;
|
|
5021
5066
|
}
|
|
5022
5067
|
case "circle": {
|
|
5023
|
-
const
|
|
5024
|
-
t.arc(0, 0,
|
|
5068
|
+
const o = Math.min(i, s) / 2;
|
|
5069
|
+
t.arc(0, 0, o, 0, Math.PI * 2);
|
|
5025
5070
|
break;
|
|
5026
5071
|
}
|
|
5027
5072
|
case "ellipse":
|
|
5028
|
-
t.ellipse(0, 0, i / 2,
|
|
5073
|
+
t.ellipse(0, 0, i / 2, s / 2, 0, 0, Math.PI * 2);
|
|
5029
5074
|
break;
|
|
5030
5075
|
case "triangle": {
|
|
5031
|
-
const
|
|
5032
|
-
t.moveTo(0, -a), t.lineTo(
|
|
5076
|
+
const o = i / 2, a = s / 2;
|
|
5077
|
+
t.moveTo(0, -a), t.lineTo(o, a), t.lineTo(-o, a), t.closePath();
|
|
5033
5078
|
break;
|
|
5034
5079
|
}
|
|
5035
5080
|
case "polygon": {
|
|
5036
|
-
const
|
|
5037
|
-
for (let n = 0; n <
|
|
5038
|
-
const h = n * 2 * Math.PI /
|
|
5081
|
+
const o = this.transformData.sides || 5, a = Math.min(i, s) / 2;
|
|
5082
|
+
for (let n = 0; n < o; n++) {
|
|
5083
|
+
const h = n * 2 * Math.PI / o - Math.PI / 2, l = a * Math.cos(h), c = a * Math.sin(h);
|
|
5039
5084
|
n === 0 ? t.moveTo(l, c) : t.lineTo(l, c);
|
|
5040
5085
|
}
|
|
5041
5086
|
t.closePath();
|
|
5042
5087
|
break;
|
|
5043
5088
|
}
|
|
5044
5089
|
case "star": {
|
|
5045
|
-
const
|
|
5046
|
-
for (let h = 0; h <
|
|
5047
|
-
const l = h * Math.PI /
|
|
5090
|
+
const o = this.transformData.points || 5, a = Math.min(i, s) / 2, n = a * (this.transformData.innerRadius || 0.4);
|
|
5091
|
+
for (let h = 0; h < o * 2; h++) {
|
|
5092
|
+
const l = h * Math.PI / o - Math.PI / 2, c = h % 2 === 0 ? a : n, g = c * Math.cos(l), d = c * Math.sin(l);
|
|
5048
5093
|
h === 0 ? t.moveTo(g, d) : t.lineTo(g, d);
|
|
5049
5094
|
}
|
|
5050
5095
|
t.closePath();
|
|
5051
5096
|
break;
|
|
5052
5097
|
}
|
|
5053
5098
|
case "line": {
|
|
5054
|
-
const
|
|
5055
|
-
t.rect(-
|
|
5099
|
+
const o = i / 2, a = s / 2;
|
|
5100
|
+
t.rect(-o, -a, i, s);
|
|
5056
5101
|
break;
|
|
5057
5102
|
}
|
|
5058
5103
|
default:
|
|
5059
|
-
t.rect(-i / 2, -
|
|
5104
|
+
t.rect(-i / 2, -s / 2, i, s);
|
|
5060
5105
|
}
|
|
5061
5106
|
}
|
|
5062
5107
|
/**
|
|
@@ -5066,32 +5111,32 @@ class Mt extends Q {
|
|
|
5066
5111
|
t.save(), t.translate(this.x, this.y), t.rotate(I.toRadians(this.rotation));
|
|
5067
5112
|
const i = this.stroke;
|
|
5068
5113
|
t.strokeStyle = i.color || "#000000", t.lineWidth = i.width || 2, t.lineCap = i.lineCap || "round", t.lineJoin = i.lineJoin || "round", t.globalAlpha = e * (i.opacity ?? 1), i.dashArray && i.dashArray.length > 0 && t.setLineDash(i.dashArray);
|
|
5069
|
-
const { shapeType:
|
|
5070
|
-
switch (t.beginPath(),
|
|
5114
|
+
const { shapeType: s, width: o, height: a } = this.transformData;
|
|
5115
|
+
switch (t.beginPath(), s) {
|
|
5071
5116
|
case "rectangle": {
|
|
5072
|
-
const n = this.transformData.borderRadius || 0, h = -
|
|
5117
|
+
const n = this.transformData.borderRadius || 0, h = -o / 2, l = -a / 2;
|
|
5073
5118
|
if (n > 0) {
|
|
5074
|
-
const c = Math.min(n / 100 * Math.min(
|
|
5075
|
-
t.roundRect(h, l,
|
|
5119
|
+
const c = Math.min(n / 100 * Math.min(o, a), o / 2, a / 2);
|
|
5120
|
+
t.roundRect(h, l, o, a, c);
|
|
5076
5121
|
} else
|
|
5077
|
-
t.rect(h, l,
|
|
5122
|
+
t.rect(h, l, o, a);
|
|
5078
5123
|
break;
|
|
5079
5124
|
}
|
|
5080
5125
|
case "circle": {
|
|
5081
|
-
const n = Math.min(
|
|
5126
|
+
const n = Math.min(o, a) / 2;
|
|
5082
5127
|
t.arc(0, 0, n, 0, Math.PI * 2);
|
|
5083
5128
|
break;
|
|
5084
5129
|
}
|
|
5085
5130
|
case "ellipse":
|
|
5086
|
-
t.ellipse(0, 0,
|
|
5131
|
+
t.ellipse(0, 0, o / 2, a / 2, 0, 0, Math.PI * 2);
|
|
5087
5132
|
break;
|
|
5088
5133
|
case "triangle": {
|
|
5089
|
-
const n =
|
|
5134
|
+
const n = o / 2, h = a / 2;
|
|
5090
5135
|
t.moveTo(0, -h), t.lineTo(n, h), t.lineTo(-n, h), t.closePath();
|
|
5091
5136
|
break;
|
|
5092
5137
|
}
|
|
5093
5138
|
case "polygon": {
|
|
5094
|
-
const n = this.transformData.sides || 5, h = Math.min(
|
|
5139
|
+
const n = this.transformData.sides || 5, h = Math.min(o, a) / 2;
|
|
5095
5140
|
for (let l = 0; l < n; l++) {
|
|
5096
5141
|
const c = l * 2 * Math.PI / n - Math.PI / 2, g = h * Math.cos(c), d = h * Math.sin(c);
|
|
5097
5142
|
l === 0 ? t.moveTo(g, d) : t.lineTo(g, d);
|
|
@@ -5100,7 +5145,7 @@ class Mt extends Q {
|
|
|
5100
5145
|
break;
|
|
5101
5146
|
}
|
|
5102
5147
|
case "star": {
|
|
5103
|
-
const n = this.transformData.points || 5, h = Math.min(
|
|
5148
|
+
const n = this.transformData.points || 5, h = Math.min(o, a) / 2, l = h * (this.transformData.innerRadius || 0.4);
|
|
5104
5149
|
for (let c = 0; c < n * 2; c++) {
|
|
5105
5150
|
const g = c * Math.PI / n - Math.PI / 2, d = c % 2 === 0 ? h : l, f = d * Math.cos(g), u = d * Math.sin(g);
|
|
5106
5151
|
c === 0 ? t.moveTo(f, u) : t.lineTo(f, u);
|
|
@@ -5109,12 +5154,12 @@ class Mt extends Q {
|
|
|
5109
5154
|
break;
|
|
5110
5155
|
}
|
|
5111
5156
|
case "line": {
|
|
5112
|
-
const n =
|
|
5113
|
-
t.rect(-n, -h,
|
|
5157
|
+
const n = o / 2, h = a / 2;
|
|
5158
|
+
t.rect(-n, -h, o, a);
|
|
5114
5159
|
break;
|
|
5115
5160
|
}
|
|
5116
5161
|
default:
|
|
5117
|
-
t.rect(-
|
|
5162
|
+
t.rect(-o / 2, -a / 2, o, a);
|
|
5118
5163
|
}
|
|
5119
5164
|
t.stroke(), t.restore();
|
|
5120
5165
|
}
|
|
@@ -5122,32 +5167,32 @@ class Mt extends Q {
|
|
|
5122
5167
|
* Render the specific shape based on shapeType
|
|
5123
5168
|
*/
|
|
5124
5169
|
renderShape(t) {
|
|
5125
|
-
const { shapeType: e, width: i, height:
|
|
5170
|
+
const { shapeType: e, width: i, height: s } = this.transformData;
|
|
5126
5171
|
switch (t.beginPath(), e) {
|
|
5127
5172
|
case "rectangle":
|
|
5128
|
-
this.renderRectangle(t, i,
|
|
5173
|
+
this.renderRectangle(t, i, s);
|
|
5129
5174
|
break;
|
|
5130
5175
|
case "circle":
|
|
5131
|
-
this.renderCircle(t, Math.min(i,
|
|
5176
|
+
this.renderCircle(t, Math.min(i, s) / 2);
|
|
5132
5177
|
break;
|
|
5133
5178
|
case "ellipse":
|
|
5134
|
-
this.renderEllipse(t, i / 2,
|
|
5179
|
+
this.renderEllipse(t, i / 2, s / 2);
|
|
5135
5180
|
break;
|
|
5136
5181
|
case "triangle":
|
|
5137
|
-
this.renderTriangle(t, i,
|
|
5182
|
+
this.renderTriangle(t, i, s);
|
|
5138
5183
|
break;
|
|
5139
5184
|
case "polygon":
|
|
5140
|
-
this.renderPolygon(t, Math.min(i,
|
|
5185
|
+
this.renderPolygon(t, Math.min(i, s) / 2);
|
|
5141
5186
|
break;
|
|
5142
5187
|
case "star":
|
|
5143
|
-
this.renderStar(t, Math.min(i,
|
|
5188
|
+
this.renderStar(t, Math.min(i, s) / 2);
|
|
5144
5189
|
break;
|
|
5145
5190
|
case "line":
|
|
5146
|
-
this.renderLine(t, i,
|
|
5191
|
+
this.renderLine(t, i, s);
|
|
5147
5192
|
return;
|
|
5148
5193
|
// Line uses stroke, not fill
|
|
5149
5194
|
default:
|
|
5150
|
-
this.renderRectangle(t, i,
|
|
5195
|
+
this.renderRectangle(t, i, s);
|
|
5151
5196
|
}
|
|
5152
5197
|
t.fill();
|
|
5153
5198
|
}
|
|
@@ -5155,12 +5200,12 @@ class Mt extends Q {
|
|
|
5155
5200
|
* Render a rectangle (with optional border radius)
|
|
5156
5201
|
*/
|
|
5157
5202
|
renderRectangle(t, e, i) {
|
|
5158
|
-
const
|
|
5159
|
-
if (
|
|
5160
|
-
const n = Math.min(
|
|
5161
|
-
t.roundRect(
|
|
5203
|
+
const s = this.transformData.borderRadius || 0, o = -e / 2, a = -i / 2;
|
|
5204
|
+
if (s > 0) {
|
|
5205
|
+
const n = Math.min(s / 100 * Math.min(e, i), e / 2, i / 2);
|
|
5206
|
+
t.roundRect(o, a, e, i, n);
|
|
5162
5207
|
} else
|
|
5163
|
-
t.rect(
|
|
5208
|
+
t.rect(o, a, e, i);
|
|
5164
5209
|
}
|
|
5165
5210
|
/**
|
|
5166
5211
|
* Render a circle
|
|
@@ -5178,16 +5223,16 @@ class Mt extends Q {
|
|
|
5178
5223
|
* Render a triangle (isosceles, pointing up)
|
|
5179
5224
|
*/
|
|
5180
5225
|
renderTriangle(t, e, i) {
|
|
5181
|
-
const
|
|
5182
|
-
t.moveTo(0, -
|
|
5226
|
+
const s = e / 2, o = i / 2;
|
|
5227
|
+
t.moveTo(0, -o), t.lineTo(s, o), t.lineTo(-s, o), t.closePath();
|
|
5183
5228
|
}
|
|
5184
5229
|
/**
|
|
5185
5230
|
* Render a regular polygon
|
|
5186
5231
|
*/
|
|
5187
5232
|
renderPolygon(t, e) {
|
|
5188
|
-
const i = Math.max(3, Math.min(20, this.transformData.sides || 5)),
|
|
5233
|
+
const i = Math.max(3, Math.min(20, this.transformData.sides || 5)), s = Math.PI * 2 / i, o = -Math.PI / 2;
|
|
5189
5234
|
for (let a = 0; a <= i; a++) {
|
|
5190
|
-
const n =
|
|
5235
|
+
const n = o + s * a, h = Math.cos(n) * e, l = Math.sin(n) * e;
|
|
5191
5236
|
a === 0 ? t.moveTo(h, l) : t.lineTo(h, l);
|
|
5192
5237
|
}
|
|
5193
5238
|
t.closePath();
|
|
@@ -5196,9 +5241,9 @@ class Mt extends Q {
|
|
|
5196
5241
|
* Render a star
|
|
5197
5242
|
*/
|
|
5198
5243
|
renderStar(t, e) {
|
|
5199
|
-
const i = Math.max(3, Math.min(20, this.transformData.points || 5)),
|
|
5244
|
+
const i = Math.max(3, Math.min(20, this.transformData.points || 5)), s = Math.max(0.1, Math.min(0.9, this.transformData.innerRadius || 0.4)), o = e * s, a = Math.PI / i, n = -Math.PI / 2;
|
|
5200
5245
|
for (let h = 0; h < i * 2; h++) {
|
|
5201
|
-
const l = n + a * h, c = h % 2 === 0 ? e :
|
|
5246
|
+
const l = n + a * h, c = h % 2 === 0 ? e : o, g = Math.cos(l) * c, d = Math.sin(l) * c;
|
|
5202
5247
|
h === 0 ? t.moveTo(g, d) : t.lineTo(g, d);
|
|
5203
5248
|
}
|
|
5204
5249
|
t.closePath();
|
|
@@ -5207,20 +5252,20 @@ class Mt extends Q {
|
|
|
5207
5252
|
* Render a line
|
|
5208
5253
|
*/
|
|
5209
5254
|
renderLine(t, e, i) {
|
|
5210
|
-
const
|
|
5211
|
-
t.moveTo(-
|
|
5255
|
+
const s = e / 2, o = i;
|
|
5256
|
+
t.moveTo(-s, 0), t.lineTo(s, 0), t.strokeStyle = this.transformData.fillColor || "#3b82f6", t.lineWidth = o, t.lineCap = "round", t.stroke();
|
|
5212
5257
|
}
|
|
5213
5258
|
/**
|
|
5214
5259
|
* Handle resize - maintain aspect ratio for circles, free resize for others
|
|
5215
5260
|
*/
|
|
5216
|
-
resize(t, e, i,
|
|
5217
|
-
const { shapeType:
|
|
5218
|
-
if (
|
|
5219
|
-
const c = Math.max(e /
|
|
5220
|
-
this.transformData.width =
|
|
5221
|
-
} else
|
|
5222
|
-
this.rotation =
|
|
5223
|
-
const a = this.getFixedCorner(t,
|
|
5261
|
+
resize(t, e, i, s) {
|
|
5262
|
+
const { shapeType: o } = this.transformData;
|
|
5263
|
+
if (o === "circle" || o === "polygon" || o === "star") {
|
|
5264
|
+
const c = Math.max(e / s.transformData.width, i / s.transformData.height);
|
|
5265
|
+
this.transformData.width = s.transformData.width * c, this.transformData.height = s.transformData.height * c;
|
|
5266
|
+
} else o === "line" ? (this.transformData.width = e, this.transformData.height = s.transformData.height) : (this.transformData.width = e, this.transformData.height = i);
|
|
5267
|
+
this.rotation = s.rotation;
|
|
5268
|
+
const a = this.getFixedCorner(t, s), n = this.getOppositeAnchor(t), h = this.getBoundingBox(), l = this.getCornerOffset(n, h);
|
|
5224
5269
|
return this.x = a.x - l.x, this.y = a.y - l.y, !0;
|
|
5225
5270
|
}
|
|
5226
5271
|
/**
|
|
@@ -5252,71 +5297,71 @@ class Mt extends Q {
|
|
|
5252
5297
|
width: e.transformData.width,
|
|
5253
5298
|
height: e.transformData.height
|
|
5254
5299
|
};
|
|
5255
|
-
let
|
|
5300
|
+
let s, o;
|
|
5256
5301
|
switch (t) {
|
|
5257
5302
|
case "top-left":
|
|
5258
|
-
|
|
5303
|
+
s = i.x + i.width, o = i.y + i.height;
|
|
5259
5304
|
break;
|
|
5260
5305
|
case "top-right":
|
|
5261
|
-
|
|
5306
|
+
s = i.x, o = i.y + i.height;
|
|
5262
5307
|
break;
|
|
5263
5308
|
case "bottom-left":
|
|
5264
|
-
|
|
5309
|
+
s = i.x + i.width, o = i.y;
|
|
5265
5310
|
break;
|
|
5266
5311
|
case "bottom-right":
|
|
5267
|
-
|
|
5312
|
+
s = i.x, o = i.y;
|
|
5268
5313
|
break;
|
|
5269
5314
|
case "middle-left":
|
|
5270
|
-
|
|
5315
|
+
s = i.x + i.width, o = i.y + i.height / 2;
|
|
5271
5316
|
break;
|
|
5272
5317
|
case "middle-right":
|
|
5273
|
-
|
|
5318
|
+
s = i.x, o = i.y + i.height / 2;
|
|
5274
5319
|
break;
|
|
5275
5320
|
case "middle-top":
|
|
5276
|
-
|
|
5321
|
+
s = i.x + i.width / 2, o = i.y + i.height;
|
|
5277
5322
|
break;
|
|
5278
5323
|
case "middle-bottom":
|
|
5279
|
-
|
|
5324
|
+
s = i.x + i.width / 2, o = i.y;
|
|
5280
5325
|
break;
|
|
5281
5326
|
default:
|
|
5282
|
-
|
|
5327
|
+
s = i.x + i.width / 2, o = i.y + i.height / 2;
|
|
5283
5328
|
}
|
|
5284
|
-
return { x:
|
|
5329
|
+
return { x: s, y: o };
|
|
5285
5330
|
}
|
|
5286
5331
|
/**
|
|
5287
5332
|
* Get the offset of a corner from the center
|
|
5288
5333
|
*/
|
|
5289
5334
|
getCornerOffset(t, e) {
|
|
5290
|
-
let i,
|
|
5335
|
+
let i, s;
|
|
5291
5336
|
switch (t) {
|
|
5292
5337
|
case "top-left":
|
|
5293
|
-
i = -e.width / 2,
|
|
5338
|
+
i = -e.width / 2, s = -e.height / 2;
|
|
5294
5339
|
break;
|
|
5295
5340
|
case "top-right":
|
|
5296
|
-
i = e.width / 2,
|
|
5341
|
+
i = e.width / 2, s = -e.height / 2;
|
|
5297
5342
|
break;
|
|
5298
5343
|
case "bottom-left":
|
|
5299
|
-
i = -e.width / 2,
|
|
5344
|
+
i = -e.width / 2, s = e.height / 2;
|
|
5300
5345
|
break;
|
|
5301
5346
|
case "bottom-right":
|
|
5302
|
-
i = e.width / 2,
|
|
5347
|
+
i = e.width / 2, s = e.height / 2;
|
|
5303
5348
|
break;
|
|
5304
5349
|
case "middle-left":
|
|
5305
|
-
i = -e.width / 2,
|
|
5350
|
+
i = -e.width / 2, s = 0;
|
|
5306
5351
|
break;
|
|
5307
5352
|
case "middle-right":
|
|
5308
|
-
i = e.width / 2,
|
|
5353
|
+
i = e.width / 2, s = 0;
|
|
5309
5354
|
break;
|
|
5310
5355
|
case "middle-top":
|
|
5311
|
-
i = 0,
|
|
5356
|
+
i = 0, s = -e.height / 2;
|
|
5312
5357
|
break;
|
|
5313
5358
|
case "middle-bottom":
|
|
5314
|
-
i = 0,
|
|
5359
|
+
i = 0, s = e.height / 2;
|
|
5315
5360
|
break;
|
|
5316
5361
|
default:
|
|
5317
|
-
i = 0,
|
|
5362
|
+
i = 0, s = 0;
|
|
5318
5363
|
}
|
|
5319
|
-
return { x: i, y:
|
|
5364
|
+
return { x: i, y: s };
|
|
5320
5365
|
}
|
|
5321
5366
|
/**
|
|
5322
5367
|
* Get enabled anchors - all 8 anchors for most shapes, only corners for circles/polygons
|
|
@@ -5338,7 +5383,7 @@ class Mt extends Q {
|
|
|
5338
5383
|
* Clone this element
|
|
5339
5384
|
*/
|
|
5340
5385
|
clone() {
|
|
5341
|
-
return new
|
|
5386
|
+
return new kt(this.toJSON());
|
|
5342
5387
|
}
|
|
5343
5388
|
/**
|
|
5344
5389
|
* Serialize to JSON
|
|
@@ -5360,17 +5405,17 @@ class Mt extends Q {
|
|
|
5360
5405
|
};
|
|
5361
5406
|
}
|
|
5362
5407
|
}
|
|
5363
|
-
class
|
|
5408
|
+
class Et extends Q {
|
|
5364
5409
|
constructor(t = {}) {
|
|
5365
|
-
var e, i,
|
|
5410
|
+
var e, i, s, o, a, n, h, l, c, g;
|
|
5366
5411
|
super(t), this.transformType = "path", this.transformData = {
|
|
5367
5412
|
type: "path",
|
|
5368
5413
|
points: ((e = t.transformData) == null ? void 0 : e.points) || [],
|
|
5369
5414
|
closed: ((i = t.transformData) == null ? void 0 : i.closed) ?? !1,
|
|
5370
|
-
width: ((
|
|
5371
|
-
height: ((
|
|
5415
|
+
width: ((s = t.transformData) == null ? void 0 : s.width) || 200,
|
|
5416
|
+
height: ((o = t.transformData) == null ? void 0 : o.height) || 200,
|
|
5372
5417
|
fillEnabled: ((a = t.transformData) == null ? void 0 : a.fillEnabled) ?? !1,
|
|
5373
|
-
fillColor: ((n = t.transformData) == null ? void 0 : n.fillColor) ||
|
|
5418
|
+
fillColor: ((n = t.transformData) == null ? void 0 : n.fillColor) || Yt(),
|
|
5374
5419
|
fillOpacity: ((h = t.transformData) == null ? void 0 : h.fillOpacity) ?? 1,
|
|
5375
5420
|
strokeEnabled: ((l = t.transformData) == null ? void 0 : l.strokeEnabled) ?? !0,
|
|
5376
5421
|
strokeColor: ((c = t.transformData) == null ? void 0 : c.strokeColor) || "#000000",
|
|
@@ -5416,11 +5461,11 @@ class Dt extends Q {
|
|
|
5416
5461
|
* @param p3 End point
|
|
5417
5462
|
* @param t Parameter from 0 to 1
|
|
5418
5463
|
*/
|
|
5419
|
-
bezierPoint(t, e, i,
|
|
5420
|
-
const a = 1 -
|
|
5464
|
+
bezierPoint(t, e, i, s, o) {
|
|
5465
|
+
const a = 1 - o, n = a * a, h = n * a, l = o * o, c = l * o;
|
|
5421
5466
|
return {
|
|
5422
|
-
x: h * t.x + 3 * n *
|
|
5423
|
-
y: h * t.y + 3 * n *
|
|
5467
|
+
x: h * t.x + 3 * n * o * e.x + 3 * a * l * i.x + c * s.x,
|
|
5468
|
+
y: h * t.y + 3 * n * o * e.y + 3 * a * l * i.y + c * s.y
|
|
5424
5469
|
};
|
|
5425
5470
|
}
|
|
5426
5471
|
/**
|
|
@@ -5432,14 +5477,14 @@ class Dt extends Q {
|
|
|
5432
5477
|
const { points: t } = this.transformData;
|
|
5433
5478
|
if (t.length === 0)
|
|
5434
5479
|
return { x: 0, y: 0, width: 0, height: 0 };
|
|
5435
|
-
let e = 1 / 0, i = 1 / 0,
|
|
5480
|
+
let e = 1 / 0, i = 1 / 0, s = -1 / 0, o = -1 / 0;
|
|
5436
5481
|
for (let d = 0; d < t.length; d++) {
|
|
5437
5482
|
const f = t[d], u = t[(d + 1) % t.length];
|
|
5438
5483
|
if (d === t.length - 1 && !this.transformData.closed) {
|
|
5439
|
-
e = Math.min(e, f.x), i = Math.min(i, f.y),
|
|
5484
|
+
e = Math.min(e, f.x), i = Math.min(i, f.y), s = Math.max(s, f.x), o = Math.max(o, f.y);
|
|
5440
5485
|
break;
|
|
5441
5486
|
}
|
|
5442
|
-
if (e = Math.min(e, f.x), i = Math.min(i, f.y),
|
|
5487
|
+
if (e = Math.min(e, f.x), i = Math.min(i, f.y), s = Math.max(s, f.x), o = Math.max(o, f.y), f.handleOut || u.handleIn) {
|
|
5443
5488
|
const p = { x: f.x, y: f.y }, y = {
|
|
5444
5489
|
x: f.x + (((h = f.handleOut) == null ? void 0 : h.x) || 0),
|
|
5445
5490
|
y: f.y + (((l = f.handleOut) == null ? void 0 : l.y) || 0)
|
|
@@ -5447,9 +5492,9 @@ class Dt extends Q {
|
|
|
5447
5492
|
x: u.x + (((c = u.handleIn) == null ? void 0 : c.x) || 0),
|
|
5448
5493
|
y: u.y + (((g = u.handleIn) == null ? void 0 : g.y) || 0)
|
|
5449
5494
|
}, S = { x: u.x, y: u.y }, b = 20;
|
|
5450
|
-
for (let
|
|
5451
|
-
const C =
|
|
5452
|
-
e = Math.min(e, M.x), i = Math.min(i, M.y),
|
|
5495
|
+
for (let v = 0; v <= b; v++) {
|
|
5496
|
+
const C = v / b, M = this.bezierPoint(p, y, w, S, C);
|
|
5497
|
+
e = Math.min(e, M.x), i = Math.min(i, M.y), s = Math.max(s, M.x), o = Math.max(o, M.y);
|
|
5453
5498
|
}
|
|
5454
5499
|
}
|
|
5455
5500
|
}
|
|
@@ -5457,8 +5502,8 @@ class Dt extends Q {
|
|
|
5457
5502
|
return {
|
|
5458
5503
|
x: e - n,
|
|
5459
5504
|
y: i - n,
|
|
5460
|
-
width:
|
|
5461
|
-
height:
|
|
5505
|
+
width: s - e + a,
|
|
5506
|
+
height: o - i + a
|
|
5462
5507
|
};
|
|
5463
5508
|
}
|
|
5464
5509
|
/**
|
|
@@ -5472,28 +5517,28 @@ class Dt extends Q {
|
|
|
5472
5517
|
* Render the path
|
|
5473
5518
|
*/
|
|
5474
5519
|
render(t, e = !1, i = !1) {
|
|
5475
|
-
const { points:
|
|
5476
|
-
if (
|
|
5520
|
+
const { points: s, closed: o, fillEnabled: a, fillColor: n, fillOpacity: h, strokeEnabled: l, strokeColor: c, strokeWidth: g } = this.transformData;
|
|
5521
|
+
if (s.length === 0)
|
|
5477
5522
|
return;
|
|
5478
5523
|
t.save(), t.translate(this.x, this.y), t.rotate(I.toRadians(this.rotation));
|
|
5479
5524
|
const d = this.calculatePathBounds(), f = d.x + d.width / 2, u = d.y + d.height / 2;
|
|
5480
|
-
t.translate(-f, -u), t.beginPath(), this.renderPath(t), a &&
|
|
5525
|
+
t.translate(-f, -u), t.beginPath(), this.renderPath(t), a && o && n && (t.fillStyle = n, t.globalAlpha = h ?? 1, t.fill()), l && c && g && (t.strokeStyle = c, t.lineWidth = g, t.lineCap = "round", t.lineJoin = "round", t.globalAlpha = 1, t.stroke()), t.restore();
|
|
5481
5526
|
}
|
|
5482
5527
|
/**
|
|
5483
5528
|
* Render the path using Canvas API bezier curves
|
|
5484
5529
|
*/
|
|
5485
5530
|
renderPath(t) {
|
|
5486
|
-
var
|
|
5531
|
+
var o, a, n, h;
|
|
5487
5532
|
const { points: e, closed: i } = this.transformData;
|
|
5488
5533
|
if (e.length === 0) return;
|
|
5489
|
-
const
|
|
5490
|
-
t.moveTo(
|
|
5534
|
+
const s = e[0];
|
|
5535
|
+
t.moveTo(s.x, s.y);
|
|
5491
5536
|
for (let l = 0; l < e.length; l++) {
|
|
5492
5537
|
const c = e[l], g = e[(l + 1) % e.length];
|
|
5493
5538
|
if (l === e.length - 1 && !i)
|
|
5494
5539
|
break;
|
|
5495
5540
|
if (c.handleOut || g.handleIn) {
|
|
5496
|
-
const f = c.x + (((
|
|
5541
|
+
const f = c.x + (((o = c.handleOut) == null ? void 0 : o.x) || 0), u = c.y + (((a = c.handleOut) == null ? void 0 : a.y) || 0), m = g.x + (((n = g.handleIn) == null ? void 0 : n.x) || 0), p = g.y + (((h = g.handleIn) == null ? void 0 : h.y) || 0);
|
|
5497
5542
|
t.bezierCurveTo(f, u, m, p, g.x, g.y);
|
|
5498
5543
|
} else
|
|
5499
5544
|
t.lineTo(g.x, g.y);
|
|
@@ -5503,11 +5548,11 @@ class Dt extends Q {
|
|
|
5503
5548
|
/**
|
|
5504
5549
|
* Handle resize - scale all points relative to center
|
|
5505
5550
|
*/
|
|
5506
|
-
resize(t, e, i,
|
|
5507
|
-
const
|
|
5508
|
-
if (
|
|
5551
|
+
resize(t, e, i, s) {
|
|
5552
|
+
const o = s.transformData.width, a = s.transformData.height;
|
|
5553
|
+
if (o === 0 || a === 0)
|
|
5509
5554
|
return !1;
|
|
5510
|
-
const n = e /
|
|
5555
|
+
const n = e / o, h = i / a, l = s.transformData.points;
|
|
5511
5556
|
let c = 1 / 0, g = 1 / 0, d = -1 / 0, f = -1 / 0;
|
|
5512
5557
|
for (const b of l)
|
|
5513
5558
|
c = Math.min(c, b.x), g = Math.min(g, b.y), d = Math.max(d, b.x), f = Math.max(f, b.y);
|
|
@@ -5518,8 +5563,8 @@ class Dt extends Q {
|
|
|
5518
5563
|
y: m + (b.y - m) * h,
|
|
5519
5564
|
handleIn: b.handleIn ? { x: b.handleIn.x * n, y: b.handleIn.y * h } : void 0,
|
|
5520
5565
|
handleOut: b.handleOut ? { x: b.handleOut.x * n, y: b.handleOut.y * h } : void 0
|
|
5521
|
-
})), this.transformData.width = e, this.transformData.height = i, this.rotation =
|
|
5522
|
-
const p = this.getFixedCorner(t,
|
|
5566
|
+
})), this.transformData.width = e, this.transformData.height = i, this.rotation = s.rotation;
|
|
5567
|
+
const p = this.getFixedCorner(t, s), y = this.getOppositeAnchor(t), w = this.getBoundingBox(), S = this.getCornerOffset(y, w);
|
|
5523
5568
|
return this.x = p.x - S.x, this.y = p.y - S.y, !0;
|
|
5524
5569
|
}
|
|
5525
5570
|
/**
|
|
@@ -5551,71 +5596,71 @@ class Dt extends Q {
|
|
|
5551
5596
|
width: e.transformData.width,
|
|
5552
5597
|
height: e.transformData.height
|
|
5553
5598
|
};
|
|
5554
|
-
let
|
|
5599
|
+
let s, o;
|
|
5555
5600
|
switch (t) {
|
|
5556
5601
|
case "top-left":
|
|
5557
|
-
|
|
5602
|
+
s = i.x + i.width, o = i.y + i.height;
|
|
5558
5603
|
break;
|
|
5559
5604
|
case "top-right":
|
|
5560
|
-
|
|
5605
|
+
s = i.x, o = i.y + i.height;
|
|
5561
5606
|
break;
|
|
5562
5607
|
case "bottom-left":
|
|
5563
|
-
|
|
5608
|
+
s = i.x + i.width, o = i.y;
|
|
5564
5609
|
break;
|
|
5565
5610
|
case "bottom-right":
|
|
5566
|
-
|
|
5611
|
+
s = i.x, o = i.y;
|
|
5567
5612
|
break;
|
|
5568
5613
|
case "middle-left":
|
|
5569
|
-
|
|
5614
|
+
s = i.x + i.width, o = i.y + i.height / 2;
|
|
5570
5615
|
break;
|
|
5571
5616
|
case "middle-right":
|
|
5572
|
-
|
|
5617
|
+
s = i.x, o = i.y + i.height / 2;
|
|
5573
5618
|
break;
|
|
5574
5619
|
case "middle-top":
|
|
5575
|
-
|
|
5620
|
+
s = i.x + i.width / 2, o = i.y + i.height;
|
|
5576
5621
|
break;
|
|
5577
5622
|
case "middle-bottom":
|
|
5578
|
-
|
|
5623
|
+
s = i.x + i.width / 2, o = i.y;
|
|
5579
5624
|
break;
|
|
5580
5625
|
default:
|
|
5581
|
-
|
|
5626
|
+
s = i.x + i.width / 2, o = i.y + i.height / 2;
|
|
5582
5627
|
}
|
|
5583
|
-
return { x:
|
|
5628
|
+
return { x: s, y: o };
|
|
5584
5629
|
}
|
|
5585
5630
|
/**
|
|
5586
5631
|
* Get the offset of a corner from the center
|
|
5587
5632
|
*/
|
|
5588
5633
|
getCornerOffset(t, e) {
|
|
5589
|
-
let i,
|
|
5634
|
+
let i, s;
|
|
5590
5635
|
switch (t) {
|
|
5591
5636
|
case "top-left":
|
|
5592
|
-
i = -e.width / 2,
|
|
5637
|
+
i = -e.width / 2, s = -e.height / 2;
|
|
5593
5638
|
break;
|
|
5594
5639
|
case "top-right":
|
|
5595
|
-
i = e.width / 2,
|
|
5640
|
+
i = e.width / 2, s = -e.height / 2;
|
|
5596
5641
|
break;
|
|
5597
5642
|
case "bottom-left":
|
|
5598
|
-
i = -e.width / 2,
|
|
5643
|
+
i = -e.width / 2, s = e.height / 2;
|
|
5599
5644
|
break;
|
|
5600
5645
|
case "bottom-right":
|
|
5601
|
-
i = e.width / 2,
|
|
5646
|
+
i = e.width / 2, s = e.height / 2;
|
|
5602
5647
|
break;
|
|
5603
5648
|
case "middle-left":
|
|
5604
|
-
i = -e.width / 2,
|
|
5649
|
+
i = -e.width / 2, s = 0;
|
|
5605
5650
|
break;
|
|
5606
5651
|
case "middle-right":
|
|
5607
|
-
i = e.width / 2,
|
|
5652
|
+
i = e.width / 2, s = 0;
|
|
5608
5653
|
break;
|
|
5609
5654
|
case "middle-top":
|
|
5610
|
-
i = 0,
|
|
5655
|
+
i = 0, s = -e.height / 2;
|
|
5611
5656
|
break;
|
|
5612
5657
|
case "middle-bottom":
|
|
5613
|
-
i = 0,
|
|
5658
|
+
i = 0, s = e.height / 2;
|
|
5614
5659
|
break;
|
|
5615
5660
|
default:
|
|
5616
|
-
i = 0,
|
|
5661
|
+
i = 0, s = 0;
|
|
5617
5662
|
}
|
|
5618
|
-
return { x: i, y:
|
|
5663
|
+
return { x: i, y: s };
|
|
5619
5664
|
}
|
|
5620
5665
|
/**
|
|
5621
5666
|
* Get enabled anchors - all 8 anchors for free resize
|
|
@@ -5636,7 +5681,7 @@ class Dt extends Q {
|
|
|
5636
5681
|
* Clone this element
|
|
5637
5682
|
*/
|
|
5638
5683
|
clone() {
|
|
5639
|
-
return new
|
|
5684
|
+
return new Et(this.toJSON());
|
|
5640
5685
|
}
|
|
5641
5686
|
/**
|
|
5642
5687
|
* Serialize to JSON
|
|
@@ -5666,7 +5711,7 @@ class Dt extends Q {
|
|
|
5666
5711
|
};
|
|
5667
5712
|
}
|
|
5668
5713
|
}
|
|
5669
|
-
const
|
|
5714
|
+
const Qe = {
|
|
5670
5715
|
circle: [
|
|
5671
5716
|
{
|
|
5672
5717
|
key: "reverse",
|
|
@@ -5679,7 +5724,7 @@ const Je = {
|
|
|
5679
5724
|
{
|
|
5680
5725
|
key: "archHeight",
|
|
5681
5726
|
label: "Arch Height",
|
|
5682
|
-
defaultInternalValue:
|
|
5727
|
+
defaultInternalValue: $e.archHeight,
|
|
5683
5728
|
// Slider 0-100 maps to internal -1 to 1
|
|
5684
5729
|
toSlider: (r) => (r + 1) / 2 * 100,
|
|
5685
5730
|
fromSlider: (r) => r / 100 * 2 - 1,
|
|
@@ -5690,7 +5735,7 @@ const Je = {
|
|
|
5690
5735
|
{
|
|
5691
5736
|
key: "amplitude",
|
|
5692
5737
|
label: "Wave Amplitude",
|
|
5693
|
-
defaultInternalValue:
|
|
5738
|
+
defaultInternalValue: ot.amplitude,
|
|
5694
5739
|
// Slider 0-100 maps to internal -0.5 to 0.5 (-50% to +50%)
|
|
5695
5740
|
toSlider: (r) => (r + 0.5) * 100,
|
|
5696
5741
|
fromSlider: (r) => r / 100 - 0.5,
|
|
@@ -5699,7 +5744,7 @@ const Je = {
|
|
|
5699
5744
|
{
|
|
5700
5745
|
key: "frequency",
|
|
5701
5746
|
label: "Wave Frequency",
|
|
5702
|
-
defaultInternalValue:
|
|
5747
|
+
defaultInternalValue: ot.frequency,
|
|
5703
5748
|
step: 5,
|
|
5704
5749
|
// 5% steps for smoother control
|
|
5705
5750
|
// Slider 0-100 maps to internal 1 to 5
|
|
@@ -5732,7 +5777,7 @@ const Je = {
|
|
|
5732
5777
|
{
|
|
5733
5778
|
key: "leanAmount",
|
|
5734
5779
|
label: "Lean Amount",
|
|
5735
|
-
defaultInternalValue:
|
|
5780
|
+
defaultInternalValue: Ve.leanAmount,
|
|
5736
5781
|
// Slider 0-100 maps to internal -0.5 to 0.5
|
|
5737
5782
|
// Display as -100% to 100%
|
|
5738
5783
|
toSlider: (r) => (r + 0.5) * 100,
|
|
@@ -5744,7 +5789,7 @@ const Je = {
|
|
|
5744
5789
|
{
|
|
5745
5790
|
key: "ascendAngle",
|
|
5746
5791
|
label: "Ascend Amount",
|
|
5747
|
-
defaultInternalValue:
|
|
5792
|
+
defaultInternalValue: Je.ascendAngle,
|
|
5748
5793
|
// Slider 0-100 maps to internal angle +30° to -30°
|
|
5749
5794
|
// Display: slider 0 = -100% (down), slider 50 = 0%, slider 100 = +100% (up)
|
|
5750
5795
|
toSlider: (r) => (30 - r) / 60 * 100,
|
|
@@ -5820,19 +5865,19 @@ const Je = {
|
|
|
5820
5865
|
toDisplay: (r) => `${(r * 100).toFixed(0)}%`
|
|
5821
5866
|
}
|
|
5822
5867
|
]
|
|
5823
|
-
},
|
|
5824
|
-
{ id: "custom", label: "CUSTOM", Component:
|
|
5868
|
+
}, Zt = [
|
|
5869
|
+
{ id: "custom", label: "CUSTOM", Component: Xe },
|
|
5825
5870
|
// NOTE: distort transform is not yet implemented. Removed from registry
|
|
5826
5871
|
// to prevent it from appearing in UI that iterates over registered transforms.
|
|
5827
5872
|
// Re-add with a valid Component when implementation is ready.
|
|
5828
|
-
{ id: "circle", label: "CIRCLE", Component:
|
|
5829
|
-
{ id: "lean", label: "LEAN", Component:
|
|
5830
|
-
{ id: "arch", label: "ARCH", Component:
|
|
5831
|
-
{ id: "ascend", label: "ASCEND", Component:
|
|
5832
|
-
{ id: "wave", label: "WAVE", Component:
|
|
5833
|
-
{ id: "flag", label: "FLAG", Component:
|
|
5834
|
-
{ id: "shape", label: "SHAPE", Component:
|
|
5835
|
-
{ id: "path", label: "PATH", Component:
|
|
5873
|
+
{ id: "circle", label: "CIRCLE", Component: Ue },
|
|
5874
|
+
{ id: "lean", label: "LEAN", Component: Ze },
|
|
5875
|
+
{ id: "arch", label: "ARCH", Component: Ge },
|
|
5876
|
+
{ id: "ascend", label: "ASCEND", Component: Ke },
|
|
5877
|
+
{ id: "wave", label: "WAVE", Component: qe },
|
|
5878
|
+
{ id: "flag", label: "FLAG", Component: je },
|
|
5879
|
+
{ id: "shape", label: "SHAPE", Component: kt },
|
|
5880
|
+
{ id: "path", label: "PATH", Component: Et },
|
|
5836
5881
|
{ id: "image", label: "IMAGE", Component: yt },
|
|
5837
5882
|
// Use a getter to break circular dependency: GroupElement imports getTransformById
|
|
5838
5883
|
// from this module, so GroupElement may be in the TDZ during module evaluation.
|
|
@@ -5840,9 +5885,9 @@ const Je = {
|
|
|
5840
5885
|
{ id: "group", label: "GROUP", get Component() {
|
|
5841
5886
|
return mt;
|
|
5842
5887
|
} }
|
|
5843
|
-
],
|
|
5844
|
-
function
|
|
5845
|
-
if (
|
|
5888
|
+
], Kt = new Set(Zt.map((r) => r.id)), ut = /* @__PURE__ */ new Map();
|
|
5889
|
+
function ds(r, t) {
|
|
5890
|
+
if (Kt.has(r))
|
|
5846
5891
|
throw new Error(
|
|
5847
5892
|
`Cannot register transform type "${r}": conflicts with built-in type`
|
|
5848
5893
|
);
|
|
@@ -5852,19 +5897,19 @@ function oo(r, t) {
|
|
|
5852
5897
|
);
|
|
5853
5898
|
ut.set(r, t);
|
|
5854
5899
|
}
|
|
5855
|
-
function
|
|
5856
|
-
if (
|
|
5900
|
+
function gs(r) {
|
|
5901
|
+
if (Kt.has(r))
|
|
5857
5902
|
throw new Error(
|
|
5858
5903
|
`Cannot unregister transform type "${r}": built-in types cannot be removed`
|
|
5859
5904
|
);
|
|
5860
5905
|
return ut.delete(r);
|
|
5861
5906
|
}
|
|
5862
|
-
function
|
|
5863
|
-
const t =
|
|
5907
|
+
function ti(r) {
|
|
5908
|
+
const t = Zt.find((e) => e.id === r);
|
|
5864
5909
|
return t || ut.get(r);
|
|
5865
5910
|
}
|
|
5866
|
-
function
|
|
5867
|
-
return
|
|
5911
|
+
function fs(r) {
|
|
5912
|
+
return Qe[r] || [];
|
|
5868
5913
|
}
|
|
5869
5914
|
class mt extends Q {
|
|
5870
5915
|
constructor(t = {}) {
|
|
@@ -5881,7 +5926,7 @@ class mt extends Q {
|
|
|
5881
5926
|
*/
|
|
5882
5927
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- JSON deserialization: config comes from toJSON() and constructors accept Partial<Config> with varying signatures
|
|
5883
5928
|
_reconstructChildFromJSON(t) {
|
|
5884
|
-
const e = t.transformType || t.type, i =
|
|
5929
|
+
const e = t.transformType || t.type, i = ti(e);
|
|
5885
5930
|
if (!i || !i.Component)
|
|
5886
5931
|
throw new Error(`Unknown transform type: ${e}`);
|
|
5887
5932
|
return new i.Component(t);
|
|
@@ -5893,17 +5938,17 @@ class mt extends Q {
|
|
|
5893
5938
|
getBoundingBox() {
|
|
5894
5939
|
if (this.children.length === 0)
|
|
5895
5940
|
return { x: this.x - 50, y: this.y - 50, width: 100, height: 100 };
|
|
5896
|
-
let t = 1 / 0, e = 1 / 0, i = -1 / 0,
|
|
5897
|
-
return this.children.forEach((
|
|
5898
|
-
const a =
|
|
5899
|
-
this._getRotatedCorners(
|
|
5900
|
-
t = Math.min(t, h.x), e = Math.min(e, h.y), i = Math.max(i, h.x),
|
|
5941
|
+
let t = 1 / 0, e = 1 / 0, i = -1 / 0, s = -1 / 0;
|
|
5942
|
+
return this.children.forEach((o) => {
|
|
5943
|
+
const a = o.getVisualBoundingBox();
|
|
5944
|
+
this._getRotatedCorners(o, a).forEach((h) => {
|
|
5945
|
+
t = Math.min(t, h.x), e = Math.min(e, h.y), i = Math.max(i, h.x), s = Math.max(s, h.y);
|
|
5901
5946
|
});
|
|
5902
5947
|
}), {
|
|
5903
5948
|
x: t,
|
|
5904
5949
|
y: e,
|
|
5905
5950
|
width: i - t,
|
|
5906
|
-
height:
|
|
5951
|
+
height: s - e
|
|
5907
5952
|
};
|
|
5908
5953
|
}
|
|
5909
5954
|
/**
|
|
@@ -5927,7 +5972,7 @@ class mt extends Q {
|
|
|
5927
5972
|
* Get the four corners of an element's bounding box in world space
|
|
5928
5973
|
*/
|
|
5929
5974
|
_getRotatedCorners(t, e) {
|
|
5930
|
-
const i = new P(t),
|
|
5975
|
+
const i = new P(t), s = e.x + e.width / 2, o = e.y + e.height / 2, a = s - t.x, n = o - t.y;
|
|
5931
5976
|
return [
|
|
5932
5977
|
{ localX: a - e.width / 2, localY: n - e.height / 2 },
|
|
5933
5978
|
{ localX: a + e.width / 2, localY: n - e.height / 2 },
|
|
@@ -5967,8 +6012,8 @@ class mt extends Q {
|
|
|
5967
6012
|
* Elements with isClipping=true clip all elements below them in the group
|
|
5968
6013
|
*/
|
|
5969
6014
|
render(t, e = !1, i = !1) {
|
|
5970
|
-
const
|
|
5971
|
-
|
|
6015
|
+
const s = this.children.filter((a) => a.visible !== !1);
|
|
6016
|
+
s.some((a) => a.isClipping) ? Ee()(t, s) : s.forEach((a) => {
|
|
5972
6017
|
a.render(t, !1);
|
|
5973
6018
|
}), e ? this._renderGroupOutline(t, 1) : i && this._renderGroupOutline(t, 0.3);
|
|
5974
6019
|
}
|
|
@@ -5978,9 +6023,9 @@ class mt extends Q {
|
|
|
5978
6023
|
*/
|
|
5979
6024
|
_renderGroupOutline(t, e = 1) {
|
|
5980
6025
|
const i = this.getOrientedBoundingBox();
|
|
5981
|
-
t.save(), t.globalAlpha = e, t.strokeStyle =
|
|
5982
|
-
const
|
|
5983
|
-
this.rotation !== 0 && (t.translate(
|
|
6026
|
+
t.save(), t.globalAlpha = e, t.strokeStyle = _t(), t.lineWidth = 2, t.setLineDash([5, 5]);
|
|
6027
|
+
const s = this._rotationCenterX || this.x, o = this._rotationCenterY || this.y;
|
|
6028
|
+
this.rotation !== 0 && (t.translate(s, o), t.rotate(-this.rotation * Math.PI / 180), t.translate(-s, -o)), t.strokeRect(i.x, i.y, i.width, i.height), t.setLineDash([]), t.restore();
|
|
5984
6029
|
}
|
|
5985
6030
|
/**
|
|
5986
6031
|
* Get oriented bounding box (uses cached base dimensions for stability during rotation)
|
|
@@ -5997,13 +6042,13 @@ class mt extends Q {
|
|
|
5997
6042
|
if (this._baseBBoxWidth > 0 && this._baseBBoxHeight > 0)
|
|
5998
6043
|
t = this._baseBBoxWidth, e = this._baseBBoxHeight;
|
|
5999
6044
|
else {
|
|
6000
|
-
const
|
|
6001
|
-
t =
|
|
6045
|
+
const o = this.getBoundingBox();
|
|
6046
|
+
t = o.width, e = o.height, this._baseBBoxWidth = t, this._baseBBoxHeight = e;
|
|
6002
6047
|
}
|
|
6003
|
-
const i = this._rotationCenterX || this.x,
|
|
6048
|
+
const i = this._rotationCenterX || this.x, s = this._rotationCenterY || this.y;
|
|
6004
6049
|
return {
|
|
6005
6050
|
x: i - t / 2,
|
|
6006
|
-
y:
|
|
6051
|
+
y: s - e / 2,
|
|
6007
6052
|
width: t,
|
|
6008
6053
|
height: e
|
|
6009
6054
|
};
|
|
@@ -6022,52 +6067,52 @@ class mt extends Q {
|
|
|
6022
6067
|
setRotation(t) {
|
|
6023
6068
|
const e = t - this.rotation;
|
|
6024
6069
|
this.rotation = t;
|
|
6025
|
-
const i = this._rotationCenterX || this.x,
|
|
6026
|
-
this.children.forEach((
|
|
6027
|
-
const a = P.rotatePointAroundAnchor(
|
|
6028
|
-
|
|
6029
|
-
}), this.x = i, this.y =
|
|
6070
|
+
const i = this._rotationCenterX || this.x, s = this._rotationCenterY || this.y;
|
|
6071
|
+
this.children.forEach((o) => {
|
|
6072
|
+
const a = P.rotatePointAroundAnchor(o.x, o.y, i, s, e);
|
|
6073
|
+
o.x = a.x, o.y = a.y, o.setRotation(o.rotation + e);
|
|
6074
|
+
}), this.x = i, this.y = s;
|
|
6030
6075
|
}
|
|
6031
6076
|
/**
|
|
6032
6077
|
* Resize the group (scales all children proportionally)
|
|
6033
6078
|
* Uses the same fixed-corner approach as multi-selection resize
|
|
6034
6079
|
*/
|
|
6035
|
-
resize(t, e, i,
|
|
6036
|
-
if (!
|
|
6080
|
+
resize(t, e, i, s) {
|
|
6081
|
+
if (!s.childrenStartData || !s.width || !s.height)
|
|
6037
6082
|
return;
|
|
6038
|
-
const
|
|
6083
|
+
const o = e / s.width, a = i / s.height, n = (o + a) / 2;
|
|
6039
6084
|
let h, l;
|
|
6040
6085
|
switch (t) {
|
|
6041
6086
|
case "top-left":
|
|
6042
|
-
h =
|
|
6087
|
+
h = s.width / 2, l = s.height / 2;
|
|
6043
6088
|
break;
|
|
6044
6089
|
case "top-right":
|
|
6045
|
-
h = -
|
|
6090
|
+
h = -s.width / 2, l = s.height / 2;
|
|
6046
6091
|
break;
|
|
6047
6092
|
case "bottom-left":
|
|
6048
|
-
h =
|
|
6093
|
+
h = s.width / 2, l = -s.height / 2;
|
|
6049
6094
|
break;
|
|
6050
6095
|
case "bottom-right":
|
|
6051
|
-
h = -
|
|
6096
|
+
h = -s.width / 2, l = -s.height / 2;
|
|
6052
6097
|
break;
|
|
6053
6098
|
default:
|
|
6054
6099
|
h = 0, l = 0;
|
|
6055
6100
|
}
|
|
6056
|
-
const c = -
|
|
6101
|
+
const c = -s.rotation * Math.PI / 180, g = Math.cos(c), d = Math.sin(c), f = s.x + (h * g - l * d), u = s.y + (h * d + l * g);
|
|
6057
6102
|
this.children.forEach((y, w) => {
|
|
6058
|
-
const S =
|
|
6103
|
+
const S = s.childrenStartData[w], b = S.x - f, v = S.y - u, C = f + b * n, M = u + v * n;
|
|
6059
6104
|
if (y.x = C, y.y = M, y instanceof yt) {
|
|
6060
|
-
const F = S.transformData,
|
|
6061
|
-
y.transformData.width =
|
|
6105
|
+
const F = S.transformData, T = F.width * n, D = F.height * n;
|
|
6106
|
+
y.transformData.width = T, y.transformData.height = D;
|
|
6062
6107
|
} else if (y instanceof mt) {
|
|
6063
|
-
const F = (S.width ?? 0) * n,
|
|
6064
|
-
y.resize(t, F,
|
|
6108
|
+
const F = (S.width ?? 0) * n, T = (S.height ?? 0) * n;
|
|
6109
|
+
y.resize(t, F, T, S);
|
|
6065
6110
|
} else {
|
|
6066
|
-
const F = (S.width ?? 0) * n,
|
|
6067
|
-
y.resize(t, F,
|
|
6111
|
+
const F = (S.width ?? 0) * n, T = (S.height ?? 0) * n;
|
|
6112
|
+
y.resize(t, F, T, S);
|
|
6068
6113
|
}
|
|
6069
|
-
}), this._baseBBoxWidth =
|
|
6070
|
-
const m =
|
|
6114
|
+
}), this._baseBBoxWidth = s.width * n, this._baseBBoxHeight = s.height * n;
|
|
6115
|
+
const m = s.x - f, p = s.y - u;
|
|
6071
6116
|
this.x = f + m * n, this.y = u + p * n, this._rotationCenterX = this.x, this._rotationCenterY = this.y;
|
|
6072
6117
|
}
|
|
6073
6118
|
/**
|
|
@@ -6075,16 +6120,16 @@ class mt extends Q {
|
|
|
6075
6120
|
* Use cached base dimensions instead of axis-aligned bbox for consistency with visual border
|
|
6076
6121
|
*/
|
|
6077
6122
|
getTransformStartData() {
|
|
6078
|
-
const t = this._baseBBoxWidth > 0 ? this._baseBBoxWidth : this.getBoundingBox().width, e = this._baseBBoxHeight > 0 ? this._baseBBoxHeight : this.getBoundingBox().height, i = this._rotationCenterX || this.x,
|
|
6123
|
+
const t = this._baseBBoxWidth > 0 ? this._baseBBoxWidth : this.getBoundingBox().width, e = this._baseBBoxHeight > 0 ? this._baseBBoxHeight : this.getBoundingBox().height, i = this._rotationCenterX || this.x, s = this._rotationCenterY || this.y;
|
|
6079
6124
|
return {
|
|
6080
6125
|
id: this.id,
|
|
6081
6126
|
x: i,
|
|
6082
|
-
y:
|
|
6127
|
+
y: s,
|
|
6083
6128
|
width: t,
|
|
6084
6129
|
height: e,
|
|
6085
6130
|
rotation: this.rotation,
|
|
6086
6131
|
transformData: this.transformData,
|
|
6087
|
-
childrenStartData: this.children.map((
|
|
6132
|
+
childrenStartData: this.children.map((o) => o.getTransformStartData())
|
|
6088
6133
|
};
|
|
6089
6134
|
}
|
|
6090
6135
|
/**
|
|
@@ -6092,10 +6137,10 @@ class mt extends Q {
|
|
|
6092
6137
|
* This allows clicking anywhere within the selection border to drag the group
|
|
6093
6138
|
*/
|
|
6094
6139
|
hitTest(t, e) {
|
|
6095
|
-
const i = this.getOrientedBoundingBox(),
|
|
6140
|
+
const i = this.getOrientedBoundingBox(), s = this._rotationCenterX || this.x, o = this._rotationCenterY || this.y;
|
|
6096
6141
|
if (this.rotation === 0)
|
|
6097
6142
|
return t >= i.x && t <= i.x + i.width && e >= i.y && e <= i.y + i.height;
|
|
6098
|
-
const a = this.rotation * Math.PI / 180, n = Math.cos(a), h = Math.sin(a), l = t -
|
|
6143
|
+
const a = this.rotation * Math.PI / 180, n = Math.cos(a), h = Math.sin(a), l = t - s, c = e - o, g = s + (l * n - c * h), d = o + (l * h + c * n);
|
|
6099
6144
|
return g >= i.x && g <= i.x + i.width && d >= i.y && d <= i.y + i.height;
|
|
6100
6145
|
}
|
|
6101
6146
|
/**
|
|
@@ -6162,9 +6207,9 @@ class mt extends Q {
|
|
|
6162
6207
|
*/
|
|
6163
6208
|
hitTestChild(t, e) {
|
|
6164
6209
|
for (let i = this.children.length - 1; i >= 0; i--) {
|
|
6165
|
-
const
|
|
6166
|
-
if (
|
|
6167
|
-
return
|
|
6210
|
+
const s = this.children[i];
|
|
6211
|
+
if (s.hitTest(t, e))
|
|
6212
|
+
return s;
|
|
6168
6213
|
}
|
|
6169
6214
|
return null;
|
|
6170
6215
|
}
|
|
@@ -6209,8 +6254,8 @@ class Z {
|
|
|
6209
6254
|
getAllByName(t) {
|
|
6210
6255
|
const e = [];
|
|
6211
6256
|
for (const i of this.order) {
|
|
6212
|
-
const
|
|
6213
|
-
|
|
6257
|
+
const s = this.byId.get(i);
|
|
6258
|
+
s && s.name === t && e.push(s);
|
|
6214
6259
|
}
|
|
6215
6260
|
return e;
|
|
6216
6261
|
}
|
|
@@ -6231,8 +6276,8 @@ class Z {
|
|
|
6231
6276
|
const i = this.clone();
|
|
6232
6277
|
if (t !== e.id) {
|
|
6233
6278
|
i.byId.delete(t);
|
|
6234
|
-
const
|
|
6235
|
-
|
|
6279
|
+
const s = i.order.indexOf(t);
|
|
6280
|
+
s !== -1 && (i.order[s] = e.id);
|
|
6236
6281
|
}
|
|
6237
6282
|
return i.byId.set(e.id, e), i;
|
|
6238
6283
|
}
|
|
@@ -6245,8 +6290,8 @@ class Z {
|
|
|
6245
6290
|
insertAfter(t, e) {
|
|
6246
6291
|
const i = this.clone();
|
|
6247
6292
|
i.byId.set(t.id, t);
|
|
6248
|
-
const
|
|
6249
|
-
return
|
|
6293
|
+
const s = i.order.indexOf(e);
|
|
6294
|
+
return s !== -1 ? i.order.splice(s + 1, 0, t.id) : i.order.push(t.id), i;
|
|
6250
6295
|
}
|
|
6251
6296
|
/** Remove an element by ID. */
|
|
6252
6297
|
remove(t) {
|
|
@@ -6257,7 +6302,7 @@ class Z {
|
|
|
6257
6302
|
/** Reorder element to a new index in the render order. */
|
|
6258
6303
|
reorder(t, e) {
|
|
6259
6304
|
const i = this.clone();
|
|
6260
|
-
return i.order = i.order.filter((
|
|
6305
|
+
return i.order = i.order.filter((s) => s !== t), i.order.splice(e, 0, t), i;
|
|
6261
6306
|
}
|
|
6262
6307
|
/**
|
|
6263
6308
|
* Apply a batch update: replace elements whose IDs match.
|
|
@@ -6311,15 +6356,15 @@ class Z {
|
|
|
6311
6356
|
return t.byId = new Map(this.byId), t.order = [...this.order], t;
|
|
6312
6357
|
}
|
|
6313
6358
|
}
|
|
6314
|
-
class
|
|
6359
|
+
class us extends Error {
|
|
6315
6360
|
constructor(t, e, i = {}) {
|
|
6316
6361
|
super(`[Editor] ${t}: ${e}`), this.name = "EditorError", this.code = t, this.data = { code: t, ...i };
|
|
6317
6362
|
}
|
|
6318
6363
|
}
|
|
6319
|
-
function
|
|
6364
|
+
function ms(r) {
|
|
6320
6365
|
return r instanceof Error && r.name === "EditorError" && "code" in r;
|
|
6321
6366
|
}
|
|
6322
|
-
function
|
|
6367
|
+
function ps() {
|
|
6323
6368
|
var r;
|
|
6324
6369
|
return typeof ft < "u" && ((r = ft.env) == null ? void 0 : r.NODE_ENV) !== "production";
|
|
6325
6370
|
}
|
|
@@ -6337,9 +6382,9 @@ class $ {
|
|
|
6337
6382
|
throw new Error("Command.undo() must be implemented");
|
|
6338
6383
|
}
|
|
6339
6384
|
}
|
|
6340
|
-
class
|
|
6341
|
-
constructor(t, e, i,
|
|
6342
|
-
super(), this.elementId = t, this.oldElement = e ? e.clone() : null, this.newElement = i ? i.clone() : null, this.onUpdate =
|
|
6385
|
+
class ys extends $ {
|
|
6386
|
+
constructor(t, e, i, s) {
|
|
6387
|
+
super(), this.elementId = t, this.oldElement = e ? e.clone() : null, this.newElement = i ? i.clone() : null, this.onUpdate = s;
|
|
6343
6388
|
}
|
|
6344
6389
|
execute() {
|
|
6345
6390
|
this.newElement && this.onUpdate(this.newElement);
|
|
@@ -6348,7 +6393,7 @@ class lo extends $ {
|
|
|
6348
6393
|
this.oldElement && this.onUpdate(this.oldElement);
|
|
6349
6394
|
}
|
|
6350
6395
|
}
|
|
6351
|
-
class
|
|
6396
|
+
class ws extends $ {
|
|
6352
6397
|
constructor(t, e, i) {
|
|
6353
6398
|
super(), this.element = t.clone(), this.onAdd = e, this.onRemove = i;
|
|
6354
6399
|
}
|
|
@@ -6359,7 +6404,7 @@ class co extends $ {
|
|
|
6359
6404
|
this.onRemove(this.element.id);
|
|
6360
6405
|
}
|
|
6361
6406
|
}
|
|
6362
|
-
class
|
|
6407
|
+
class bs extends $ {
|
|
6363
6408
|
constructor(t, e, i) {
|
|
6364
6409
|
super(), this.element = t.clone(), this.onAdd = e, this.onRemove = i;
|
|
6365
6410
|
}
|
|
@@ -6370,7 +6415,7 @@ class go extends $ {
|
|
|
6370
6415
|
this.onAdd(this.element);
|
|
6371
6416
|
}
|
|
6372
6417
|
}
|
|
6373
|
-
class
|
|
6418
|
+
class ei extends $ {
|
|
6374
6419
|
constructor(t) {
|
|
6375
6420
|
super(), this.commands = t;
|
|
6376
6421
|
}
|
|
@@ -6402,7 +6447,7 @@ class ct {
|
|
|
6402
6447
|
executeBatch(t) {
|
|
6403
6448
|
if (t.length === 0)
|
|
6404
6449
|
return;
|
|
6405
|
-
const e = new
|
|
6450
|
+
const e = new ei(t);
|
|
6406
6451
|
this.execute(e);
|
|
6407
6452
|
}
|
|
6408
6453
|
/**
|
|
@@ -6447,7 +6492,7 @@ class ct {
|
|
|
6447
6492
|
};
|
|
6448
6493
|
}
|
|
6449
6494
|
}
|
|
6450
|
-
class
|
|
6495
|
+
class xs extends $ {
|
|
6451
6496
|
constructor(t, e) {
|
|
6452
6497
|
super(), this.artboard = t.clone(), this.artboardManager = e;
|
|
6453
6498
|
}
|
|
@@ -6467,7 +6512,7 @@ class fo extends $ {
|
|
|
6467
6512
|
this.artboardManager.deleteArtboard(this.artboard.id);
|
|
6468
6513
|
}
|
|
6469
6514
|
}
|
|
6470
|
-
class
|
|
6515
|
+
class Ss extends $ {
|
|
6471
6516
|
constructor(t, e) {
|
|
6472
6517
|
super(), this.artboard = t.clone(), this.artboardManager = e, this.elementsOnArtboard = t.getElementIds();
|
|
6473
6518
|
}
|
|
@@ -6490,9 +6535,9 @@ class uo extends $ {
|
|
|
6490
6535
|
});
|
|
6491
6536
|
}
|
|
6492
6537
|
}
|
|
6493
|
-
class
|
|
6494
|
-
constructor(t, e, i,
|
|
6495
|
-
super(), this.artboardId = t, this.oldProperties = { ...e }, this.newProperties = { ...i }, this.artboardManager =
|
|
6538
|
+
class Cs extends $ {
|
|
6539
|
+
constructor(t, e, i, s) {
|
|
6540
|
+
super(), this.artboardId = t, this.oldProperties = { ...e }, this.newProperties = { ...i }, this.artboardManager = s;
|
|
6496
6541
|
}
|
|
6497
6542
|
execute() {
|
|
6498
6543
|
this.artboardManager.updateArtboard(this.artboardId, this.newProperties);
|
|
@@ -6501,9 +6546,9 @@ class mo extends $ {
|
|
|
6501
6546
|
this.artboardManager.updateArtboard(this.artboardId, this.oldProperties);
|
|
6502
6547
|
}
|
|
6503
6548
|
}
|
|
6504
|
-
class
|
|
6505
|
-
constructor(t, e, i,
|
|
6506
|
-
super(), this.draggedId = t, this.targetId = e, this.position = i, this.oldOrder = [...
|
|
6549
|
+
class vs extends $ {
|
|
6550
|
+
constructor(t, e, i, s, o) {
|
|
6551
|
+
super(), this.draggedId = t, this.targetId = e, this.position = i, this.oldOrder = [...s], this.onReorder = o, this.newOrder = this.calculateNewOrder();
|
|
6507
6552
|
}
|
|
6508
6553
|
calculateNewOrder() {
|
|
6509
6554
|
const t = [...this.oldOrder], e = t.indexOf(this.draggedId);
|
|
@@ -6511,8 +6556,8 @@ class po extends $ {
|
|
|
6511
6556
|
t.splice(e, 1);
|
|
6512
6557
|
const i = t.indexOf(this.targetId);
|
|
6513
6558
|
if (i === -1) return t;
|
|
6514
|
-
const
|
|
6515
|
-
return t.splice(
|
|
6559
|
+
const s = this.position === "before" ? i : i + 1;
|
|
6560
|
+
return t.splice(s, 0, this.draggedId), t;
|
|
6516
6561
|
}
|
|
6517
6562
|
execute() {
|
|
6518
6563
|
this.onReorder(this.newOrder);
|
|
@@ -6521,8 +6566,8 @@ class po extends $ {
|
|
|
6521
6566
|
this.onReorder(this.oldOrder);
|
|
6522
6567
|
}
|
|
6523
6568
|
}
|
|
6524
|
-
const
|
|
6525
|
-
class
|
|
6569
|
+
const ii = pt("HybridHistoryManager");
|
|
6570
|
+
class Ts {
|
|
6526
6571
|
constructor(t, e = 50) {
|
|
6527
6572
|
this.commandExecutedCallbacks = [], this.globalHistory = new ct(e), this.artboardHistories = /* @__PURE__ */ new Map(), this.lastOperation = null, this.artboardManager = t, this.maxHistorySize = e;
|
|
6528
6573
|
}
|
|
@@ -6540,11 +6585,11 @@ class yo {
|
|
|
6540
6585
|
* Notify all callbacks that a command was executed
|
|
6541
6586
|
*/
|
|
6542
6587
|
notifyCommandExecuted(t, e, i) {
|
|
6543
|
-
for (const
|
|
6588
|
+
for (const s of this.commandExecutedCallbacks)
|
|
6544
6589
|
try {
|
|
6545
|
-
|
|
6546
|
-
} catch (
|
|
6547
|
-
|
|
6590
|
+
s(t, e, i);
|
|
6591
|
+
} catch (o) {
|
|
6592
|
+
ii.error("Error in command executed callback:", o);
|
|
6548
6593
|
}
|
|
6549
6594
|
}
|
|
6550
6595
|
/**
|
|
@@ -6583,8 +6628,8 @@ class yo {
|
|
|
6583
6628
|
artboardId: t,
|
|
6584
6629
|
timestamp: Date.now()
|
|
6585
6630
|
};
|
|
6586
|
-
const
|
|
6587
|
-
this.notifyCommandExecuted(
|
|
6631
|
+
const s = i.history[i.currentIndex];
|
|
6632
|
+
this.notifyCommandExecuted(s, "artboard", t);
|
|
6588
6633
|
}
|
|
6589
6634
|
/**
|
|
6590
6635
|
* Execute a command on a specific artboard
|
|
@@ -6750,12 +6795,12 @@ class yo {
|
|
|
6750
6795
|
*/
|
|
6751
6796
|
getState() {
|
|
6752
6797
|
const t = this.globalHistory.getState(), e = /* @__PURE__ */ new Map();
|
|
6753
|
-
return this.artboardHistories.forEach((i,
|
|
6754
|
-
const
|
|
6755
|
-
e.set(
|
|
6756
|
-
canUndo:
|
|
6757
|
-
canRedo:
|
|
6758
|
-
historySize:
|
|
6798
|
+
return this.artboardHistories.forEach((i, s) => {
|
|
6799
|
+
const o = i.getState();
|
|
6800
|
+
e.set(s, {
|
|
6801
|
+
canUndo: o.canUndo,
|
|
6802
|
+
canRedo: o.canRedo,
|
|
6803
|
+
historySize: o.historySize
|
|
6759
6804
|
});
|
|
6760
6805
|
}), {
|
|
6761
6806
|
global: {
|
|
@@ -6817,11 +6862,11 @@ class yo {
|
|
|
6817
6862
|
}
|
|
6818
6863
|
}
|
|
6819
6864
|
const G = pt("FontAnalyzer");
|
|
6820
|
-
let
|
|
6821
|
-
async function
|
|
6822
|
-
return
|
|
6865
|
+
let St = null;
|
|
6866
|
+
async function si() {
|
|
6867
|
+
return St || (St = await import("./browser-module-DFvKXBUE.js")), St;
|
|
6823
6868
|
}
|
|
6824
|
-
class
|
|
6869
|
+
class oi {
|
|
6825
6870
|
constructor() {
|
|
6826
6871
|
this.fontCache = /* @__PURE__ */ new Map(), this.failedFonts = /* @__PURE__ */ new Set(), this.CACHE_DURATION = 1e3 * 60 * 30, this.MAX_CACHE_SIZE = 5;
|
|
6827
6872
|
}
|
|
@@ -6833,15 +6878,15 @@ class Qe {
|
|
|
6833
6878
|
evictOldestFont() {
|
|
6834
6879
|
if (this.fontCache.size <= this.MAX_CACHE_SIZE) return;
|
|
6835
6880
|
let t = null, e = Date.now();
|
|
6836
|
-
this.fontCache.forEach((i,
|
|
6837
|
-
i.timestamp < e && (e = i.timestamp, t =
|
|
6881
|
+
this.fontCache.forEach((i, s) => {
|
|
6882
|
+
i.timestamp < e && (e = i.timestamp, t = s);
|
|
6838
6883
|
}), t && this.fontCache.delete(t);
|
|
6839
6884
|
}
|
|
6840
6885
|
/**
|
|
6841
6886
|
* Check if a font is a system font
|
|
6842
6887
|
*/
|
|
6843
6888
|
isSystemFont(t) {
|
|
6844
|
-
return
|
|
6889
|
+
return Se.has(t);
|
|
6845
6890
|
}
|
|
6846
6891
|
/**
|
|
6847
6892
|
* Get Google Fonts API URL for a specific font family
|
|
@@ -6854,7 +6899,7 @@ class Qe {
|
|
|
6854
6899
|
*/
|
|
6855
6900
|
async extractFontFileUrl(t, e = 400) {
|
|
6856
6901
|
try {
|
|
6857
|
-
const i = this.getGoogleFontUrl(t, e),
|
|
6902
|
+
const i = this.getGoogleFontUrl(t, e), o = await (await fetch(i)).text(), a = /@font-face\s*{([^}]*)}/g, n = Array.from(o.matchAll(a));
|
|
6858
6903
|
if (n.length === 0)
|
|
6859
6904
|
return G.warn("No @font-face found in CSS"), null;
|
|
6860
6905
|
let h = null, l = -1;
|
|
@@ -6879,24 +6924,24 @@ class Qe {
|
|
|
6879
6924
|
const i = `${t}-${e}`;
|
|
6880
6925
|
if (this.failedFonts.has(i))
|
|
6881
6926
|
return null;
|
|
6882
|
-
const
|
|
6883
|
-
if (
|
|
6884
|
-
return
|
|
6927
|
+
const s = this.fontCache.get(i);
|
|
6928
|
+
if (s && Date.now() - s.timestamp < this.CACHE_DURATION)
|
|
6929
|
+
return s.timestamp = Date.now(), s.font;
|
|
6885
6930
|
try {
|
|
6886
|
-
const
|
|
6887
|
-
if (!
|
|
6931
|
+
const o = await this.extractFontFileUrl(t, e);
|
|
6932
|
+
if (!o)
|
|
6888
6933
|
return this.failedFonts.add(i), null;
|
|
6889
|
-
const a = await fetch(
|
|
6934
|
+
const a = await fetch(o);
|
|
6890
6935
|
if (!a.ok)
|
|
6891
6936
|
return G.error(`Font fetch failed: ${a.status} ${a.statusText}`), this.failedFonts.add(i), null;
|
|
6892
|
-
const n = await a.arrayBuffer(), h = new Uint8Array(n), c = (await
|
|
6937
|
+
const n = await a.arrayBuffer(), h = new Uint8Array(n), c = (await si()).create(h), g = "fonts" in c ? c.fonts[0] : c;
|
|
6893
6938
|
return this.fontCache.set(i, {
|
|
6894
6939
|
font: g,
|
|
6895
|
-
url:
|
|
6940
|
+
url: o,
|
|
6896
6941
|
timestamp: Date.now()
|
|
6897
6942
|
}), this.evictOldestFont(), g;
|
|
6898
|
-
} catch (
|
|
6899
|
-
return G.error(`Error loading font ${t}:`,
|
|
6943
|
+
} catch (o) {
|
|
6944
|
+
return G.error(`Error loading font ${t}:`, o), this.failedFonts.add(i), null;
|
|
6900
6945
|
}
|
|
6901
6946
|
}
|
|
6902
6947
|
/**
|
|
@@ -6904,8 +6949,8 @@ class Qe {
|
|
|
6904
6949
|
* Returns null if font is not cached - font should be pre-loaded before rendering
|
|
6905
6950
|
*/
|
|
6906
6951
|
getFontSync(t, e = 400) {
|
|
6907
|
-
const i = `${t}-${e}`,
|
|
6908
|
-
return
|
|
6952
|
+
const i = `${t}-${e}`, s = this.fontCache.get(i);
|
|
6953
|
+
return s && Date.now() - s.timestamp < this.CACHE_DURATION ? (s.timestamp = Date.now(), s.font) : null;
|
|
6909
6954
|
}
|
|
6910
6955
|
/**
|
|
6911
6956
|
* Clear font cache (useful for debugging or forcing reload)
|
|
@@ -6925,13 +6970,13 @@ class Qe {
|
|
|
6925
6970
|
var n, h;
|
|
6926
6971
|
if (this.isSystemFont(t))
|
|
6927
6972
|
return [];
|
|
6928
|
-
const
|
|
6929
|
-
if (!
|
|
6973
|
+
const s = await this.loadFont(t, e);
|
|
6974
|
+
if (!s)
|
|
6930
6975
|
return [];
|
|
6931
|
-
const
|
|
6976
|
+
const o = [], a = Math.min(s.numGlyphs, i);
|
|
6932
6977
|
for (let l = 0; l < a; l++)
|
|
6933
6978
|
try {
|
|
6934
|
-
const c =
|
|
6979
|
+
const c = s.getGlyph(l);
|
|
6935
6980
|
if (!c || !c.name || c.name === ".notdef" || c.name.startsWith(".null"))
|
|
6936
6981
|
continue;
|
|
6937
6982
|
const g = c.codePoints || [];
|
|
@@ -6956,42 +7001,42 @@ class Qe {
|
|
|
6956
7001
|
const m = c.name.toLowerCase();
|
|
6957
7002
|
if (m.includes("swash") || m.includes("cswh") ? u = "swash" : c.name.match(/\.(alt|ss\d+|cv\d+|salt|ornament)/) || c.name.match(/_\d+$/) ? u = "stylistic" : m.match(/liga|dlig/) && (u = "ligature"), u === "default")
|
|
6958
7003
|
continue;
|
|
6959
|
-
d && d.length > 0 &&
|
|
7004
|
+
d && d.length > 0 && o.push({
|
|
6960
7005
|
glyphIndex: c.id,
|
|
6961
7006
|
unicode: d,
|
|
6962
7007
|
name: f,
|
|
6963
7008
|
category: u,
|
|
6964
|
-
previewDataUrl: this.generateGlyphPreview(
|
|
7009
|
+
previewDataUrl: this.generateGlyphPreview(s, c.id, 80)
|
|
6965
7010
|
});
|
|
6966
7011
|
} catch {
|
|
6967
7012
|
}
|
|
6968
|
-
return
|
|
7013
|
+
return o;
|
|
6969
7014
|
}
|
|
6970
7015
|
/**
|
|
6971
7016
|
* Get glyph alternates for a specific character
|
|
6972
7017
|
*/
|
|
6973
7018
|
async getGlyphAlternates(t, e, i = 400) {
|
|
6974
7019
|
var l, c, g, d;
|
|
6975
|
-
const
|
|
6976
|
-
if (!
|
|
7020
|
+
const s = await this.loadFont(t, i);
|
|
7021
|
+
if (!s)
|
|
6977
7022
|
return [];
|
|
6978
|
-
const
|
|
7023
|
+
const o = [], a = e.codePointAt(0);
|
|
6979
7024
|
if (a === void 0)
|
|
6980
7025
|
return [];
|
|
6981
|
-
const n =
|
|
6982
|
-
n &&
|
|
7026
|
+
const n = s.glyphForCodePoint(a);
|
|
7027
|
+
n && o.push({
|
|
6983
7028
|
glyphIndex: n.id,
|
|
6984
7029
|
unicode: e,
|
|
6985
7030
|
name: n.name || "Default",
|
|
6986
7031
|
category: "default",
|
|
6987
|
-
previewDataUrl: this.generateGlyphPreview(
|
|
7032
|
+
previewDataUrl: this.generateGlyphPreview(s, n.id, 80)
|
|
6988
7033
|
});
|
|
6989
7034
|
const h = n == null ? void 0 : n.name;
|
|
6990
7035
|
if (h) {
|
|
6991
7036
|
let f = 0;
|
|
6992
|
-
for (let u = 0; u <
|
|
7037
|
+
for (let u = 0; u < s.numGlyphs; u++)
|
|
6993
7038
|
try {
|
|
6994
|
-
const m =
|
|
7039
|
+
const m = s.getGlyph(u);
|
|
6995
7040
|
if (!m || !m.name) continue;
|
|
6996
7041
|
if ([
|
|
6997
7042
|
new RegExp(`^${h}\\.(swash|alt|ss\\d+|salt|ornament)`, "i"),
|
|
@@ -7009,19 +7054,19 @@ class Qe {
|
|
|
7009
7054
|
const S = (c = m.name.match(/\.ss(\d+)/)) == null ? void 0 : c[1];
|
|
7010
7055
|
w = `${e} Stylistic Set ${S}`;
|
|
7011
7056
|
}
|
|
7012
|
-
|
|
7057
|
+
o.push({
|
|
7013
7058
|
glyphIndex: m.id,
|
|
7014
7059
|
unicode: e,
|
|
7015
7060
|
name: w,
|
|
7016
7061
|
category: "stylistic",
|
|
7017
|
-
previewDataUrl: this.generateGlyphPreview(
|
|
7062
|
+
previewDataUrl: this.generateGlyphPreview(s, m.id, 80)
|
|
7018
7063
|
});
|
|
7019
7064
|
}
|
|
7020
7065
|
} catch {
|
|
7021
7066
|
}
|
|
7022
7067
|
}
|
|
7023
|
-
if (
|
|
7024
|
-
const f =
|
|
7068
|
+
if (s.GSUB) {
|
|
7069
|
+
const f = s.GSUB;
|
|
7025
7070
|
if (f.featureList)
|
|
7026
7071
|
for (const u of f.featureList) {
|
|
7027
7072
|
const m = u.tag;
|
|
@@ -7034,13 +7079,13 @@ class Qe {
|
|
|
7034
7079
|
const S = w.coverage;
|
|
7035
7080
|
if (!S) continue;
|
|
7036
7081
|
if (this.getCoverageIndex(S, n.id) !== -1) {
|
|
7037
|
-
const
|
|
7038
|
-
|
|
7039
|
-
glyphIndex:
|
|
7082
|
+
const v = this.getSubstituteGlyph(w, n.id);
|
|
7083
|
+
v !== null && o.push({
|
|
7084
|
+
glyphIndex: v,
|
|
7040
7085
|
unicode: e,
|
|
7041
7086
|
name: `${e} (${m})`,
|
|
7042
7087
|
category: this.categorizeFeature(m),
|
|
7043
|
-
previewDataUrl: this.generateGlyphPreview(
|
|
7088
|
+
previewDataUrl: this.generateGlyphPreview(s, v, 80)
|
|
7044
7089
|
});
|
|
7045
7090
|
}
|
|
7046
7091
|
}
|
|
@@ -7048,17 +7093,17 @@ class Qe {
|
|
|
7048
7093
|
for (const w of y.subtables || []) {
|
|
7049
7094
|
const S = w.coverage;
|
|
7050
7095
|
if (!S) continue;
|
|
7051
|
-
const b = this.getCoverageIndex(S, n.id),
|
|
7052
|
-
if (b !== -1 &&
|
|
7053
|
-
const C =
|
|
7096
|
+
const b = this.getCoverageIndex(S, n.id), v = w;
|
|
7097
|
+
if (b !== -1 && v.alternateSets) {
|
|
7098
|
+
const C = v.alternateSets[b];
|
|
7054
7099
|
if (C)
|
|
7055
7100
|
for (const M of C)
|
|
7056
|
-
|
|
7101
|
+
o.push({
|
|
7057
7102
|
glyphIndex: M,
|
|
7058
7103
|
unicode: e,
|
|
7059
7104
|
name: `${e} (${m} alt)`,
|
|
7060
7105
|
category: this.categorizeFeature(m),
|
|
7061
|
-
previewDataUrl: this.generateGlyphPreview(
|
|
7106
|
+
previewDataUrl: this.generateGlyphPreview(s, M, 80)
|
|
7062
7107
|
});
|
|
7063
7108
|
}
|
|
7064
7109
|
}
|
|
@@ -7066,7 +7111,7 @@ class Qe {
|
|
|
7066
7111
|
}
|
|
7067
7112
|
}
|
|
7068
7113
|
}
|
|
7069
|
-
return
|
|
7114
|
+
return o;
|
|
7070
7115
|
}
|
|
7071
7116
|
/**
|
|
7072
7117
|
* Get available OpenType features for a font
|
|
@@ -7076,38 +7121,38 @@ class Qe {
|
|
|
7076
7121
|
if (!i)
|
|
7077
7122
|
return G.warn(`Font ${t} failed to load`), [];
|
|
7078
7123
|
try {
|
|
7079
|
-
const
|
|
7124
|
+
const s = [];
|
|
7080
7125
|
if (i.GSUB && i.GSUB.featureList) {
|
|
7081
|
-
const
|
|
7126
|
+
const o = /* @__PURE__ */ new Set();
|
|
7082
7127
|
for (const a of i.GSUB.featureList)
|
|
7083
|
-
a.tag &&
|
|
7084
|
-
|
|
7128
|
+
a.tag && o.add(a.tag);
|
|
7129
|
+
s.push(...Array.from(o));
|
|
7085
7130
|
}
|
|
7086
7131
|
if (i.GPOS && i.GPOS.featureList) {
|
|
7087
|
-
const
|
|
7132
|
+
const o = /* @__PURE__ */ new Set();
|
|
7088
7133
|
for (const a of i.GPOS.featureList)
|
|
7089
|
-
a.tag &&
|
|
7090
|
-
|
|
7134
|
+
a.tag && o.add(a.tag);
|
|
7135
|
+
s.push(...Array.from(o));
|
|
7091
7136
|
}
|
|
7092
|
-
return
|
|
7093
|
-
} catch (
|
|
7094
|
-
return G.error(`Error getting features for ${t}:`,
|
|
7137
|
+
return s;
|
|
7138
|
+
} catch (s) {
|
|
7139
|
+
return G.error(`Error getting features for ${t}:`, s), [];
|
|
7095
7140
|
}
|
|
7096
7141
|
}
|
|
7097
7142
|
/**
|
|
7098
7143
|
* Generate a preview image for a glyph
|
|
7099
7144
|
*/
|
|
7100
7145
|
generateGlyphPreview(t, e, i = 80) {
|
|
7101
|
-
const
|
|
7102
|
-
|
|
7103
|
-
const
|
|
7104
|
-
if (!
|
|
7146
|
+
const s = document.createElement("canvas");
|
|
7147
|
+
s.width = i, s.height = i;
|
|
7148
|
+
const o = s.getContext("2d");
|
|
7149
|
+
if (!o)
|
|
7105
7150
|
return "";
|
|
7106
7151
|
try {
|
|
7107
7152
|
const a = t.getGlyph(e);
|
|
7108
7153
|
if (!a)
|
|
7109
7154
|
return "";
|
|
7110
|
-
|
|
7155
|
+
o.clearRect(0, 0, i, i);
|
|
7111
7156
|
const n = a.bbox;
|
|
7112
7157
|
if (!n)
|
|
7113
7158
|
return "";
|
|
@@ -7118,7 +7163,7 @@ class Qe {
|
|
|
7118
7163
|
if (!p)
|
|
7119
7164
|
return "";
|
|
7120
7165
|
const y = new Path2D(p);
|
|
7121
|
-
return
|
|
7166
|
+
return o.save(), o.translate(u, m), o.scale(g, -g), o.translate(-d, -f), o.fillStyle = "#000000", o.fill(y), o.restore(), s.toDataURL("image/png");
|
|
7122
7167
|
} catch (a) {
|
|
7123
7168
|
return G.error("Error generating glyph preview:", a), "";
|
|
7124
7169
|
}
|
|
@@ -7181,10 +7226,10 @@ class Qe {
|
|
|
7181
7226
|
return t.glyphs.indexOf(e);
|
|
7182
7227
|
if (t.format === 2 && t.ranges) {
|
|
7183
7228
|
const i = t.ranges;
|
|
7184
|
-
for (let
|
|
7185
|
-
const
|
|
7186
|
-
if (e >=
|
|
7187
|
-
return
|
|
7229
|
+
for (let s = 0; s < i.length; s++) {
|
|
7230
|
+
const o = i[s];
|
|
7231
|
+
if (e >= o.start && e <= o.end)
|
|
7232
|
+
return o.index + (e - o.start);
|
|
7188
7233
|
}
|
|
7189
7234
|
}
|
|
7190
7235
|
return -1;
|
|
@@ -7197,9 +7242,9 @@ class Qe {
|
|
|
7197
7242
|
if (t.substFormat === 1 && typeof t.deltaGlyphId == "number")
|
|
7198
7243
|
return e + t.deltaGlyphId;
|
|
7199
7244
|
if (t.substFormat === 2 && t.substitute) {
|
|
7200
|
-
const i = this.getCoverageIndex(t.coverage, e),
|
|
7201
|
-
if (i !== -1 &&
|
|
7202
|
-
return
|
|
7245
|
+
const i = this.getCoverageIndex(t.coverage, e), s = t.substitute;
|
|
7246
|
+
if (i !== -1 && s[i] !== void 0)
|
|
7247
|
+
return s[i];
|
|
7203
7248
|
}
|
|
7204
7249
|
return null;
|
|
7205
7250
|
}
|
|
@@ -7210,9 +7255,9 @@ class Qe {
|
|
|
7210
7255
|
const i = await this.loadFont(t, e);
|
|
7211
7256
|
if (!i)
|
|
7212
7257
|
return 0;
|
|
7213
|
-
let
|
|
7214
|
-
const
|
|
7215
|
-
for (let a = 0; a <
|
|
7258
|
+
let s = 0;
|
|
7259
|
+
const o = Math.min(i.numGlyphs, 1500);
|
|
7260
|
+
for (let a = 0; a < o; a++)
|
|
7216
7261
|
try {
|
|
7217
7262
|
const n = i.getGlyph(a);
|
|
7218
7263
|
if (!n || !n.name || n.name === ".notdef" || n.name.startsWith(".null"))
|
|
@@ -7225,10 +7270,10 @@ class Qe {
|
|
|
7225
7270
|
}
|
|
7226
7271
|
let c = "default";
|
|
7227
7272
|
const g = n.name.toLowerCase();
|
|
7228
|
-
g.includes("swash") || g.includes("cswh") ? c = "swash" : n.name.match(/\.(alt|ss\d+|cv\d+|salt|ornament)/) || n.name.match(/_\d+$/) ? c = "stylistic" : g.match(/liga|dlig/) && (c = "ligature"), c !== "default" && l && l.length > 0 &&
|
|
7273
|
+
g.includes("swash") || g.includes("cswh") ? c = "swash" : n.name.match(/\.(alt|ss\d+|cv\d+|salt|ornament)/) || n.name.match(/_\d+$/) ? c = "stylistic" : g.match(/liga|dlig/) && (c = "ligature"), c !== "default" && l && l.length > 0 && s++;
|
|
7229
7274
|
} catch {
|
|
7230
7275
|
}
|
|
7231
|
-
return
|
|
7276
|
+
return s;
|
|
7232
7277
|
}
|
|
7233
7278
|
/**
|
|
7234
7279
|
* Get cache statistics
|
|
@@ -7240,129 +7285,134 @@ class Qe {
|
|
|
7240
7285
|
};
|
|
7241
7286
|
}
|
|
7242
7287
|
}
|
|
7243
|
-
const
|
|
7288
|
+
const Fs = new oi();
|
|
7244
7289
|
export {
|
|
7245
|
-
|
|
7290
|
+
ve as $,
|
|
7246
7291
|
nt as A,
|
|
7247
7292
|
Q as B,
|
|
7248
|
-
|
|
7249
|
-
|
|
7250
|
-
|
|
7251
|
-
|
|
7293
|
+
Fs as C,
|
|
7294
|
+
ps as D,
|
|
7295
|
+
us as E,
|
|
7296
|
+
Di as F,
|
|
7252
7297
|
mt as G,
|
|
7253
|
-
|
|
7298
|
+
de as H,
|
|
7254
7299
|
yt as I,
|
|
7255
|
-
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
|
|
7260
|
-
|
|
7261
|
-
|
|
7262
|
-
|
|
7300
|
+
De as J,
|
|
7301
|
+
Dt as K,
|
|
7302
|
+
Ei as L,
|
|
7303
|
+
Oi as M,
|
|
7304
|
+
Ge as N,
|
|
7305
|
+
ri as O,
|
|
7306
|
+
Et as P,
|
|
7307
|
+
Ke as Q,
|
|
7263
7308
|
L as R,
|
|
7264
|
-
|
|
7309
|
+
kt as S,
|
|
7265
7310
|
q as T,
|
|
7266
|
-
|
|
7267
|
-
|
|
7268
|
-
|
|
7269
|
-
|
|
7270
|
-
|
|
7271
|
-
|
|
7272
|
-
|
|
7273
|
-
|
|
7274
|
-
|
|
7275
|
-
|
|
7276
|
-
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
|
|
7280
|
-
|
|
7281
|
-
|
|
7282
|
-
|
|
7283
|
-
|
|
7284
|
-
|
|
7285
|
-
|
|
7286
|
-
|
|
7287
|
-
|
|
7288
|
-
|
|
7289
|
-
|
|
7290
|
-
|
|
7291
|
-
|
|
7292
|
-
|
|
7293
|
-
|
|
7294
|
-
|
|
7295
|
-
|
|
7296
|
-
|
|
7297
|
-
|
|
7298
|
-
|
|
7299
|
-
|
|
7300
|
-
|
|
7301
|
-
|
|
7302
|
-
|
|
7303
|
-
|
|
7304
|
-
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
|
|
7312
|
-
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
|
|
7319
|
-
|
|
7320
|
-
|
|
7321
|
-
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
|
|
7325
|
-
|
|
7326
|
-
|
|
7327
|
-
|
|
7328
|
-
|
|
7329
|
-
|
|
7330
|
-
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
7334
|
-
|
|
7335
|
-
|
|
7336
|
-
|
|
7337
|
-
|
|
7338
|
-
|
|
7339
|
-
|
|
7340
|
-
|
|
7341
|
-
|
|
7342
|
-
|
|
7311
|
+
ys as U,
|
|
7312
|
+
Ue as V,
|
|
7313
|
+
Xe as W,
|
|
7314
|
+
Z as X,
|
|
7315
|
+
je as Y,
|
|
7316
|
+
Ts as Z,
|
|
7317
|
+
Ze as _,
|
|
7318
|
+
Ki as a,
|
|
7319
|
+
Si as a$,
|
|
7320
|
+
qe as a0,
|
|
7321
|
+
Ne as a1,
|
|
7322
|
+
os as a2,
|
|
7323
|
+
ss as a3,
|
|
7324
|
+
rs as a4,
|
|
7325
|
+
ns as a5,
|
|
7326
|
+
Ae as a6,
|
|
7327
|
+
Le as a7,
|
|
7328
|
+
Pe as a8,
|
|
7329
|
+
at as a9,
|
|
7330
|
+
pi as aA,
|
|
7331
|
+
_t as aB,
|
|
7332
|
+
yi as aC,
|
|
7333
|
+
wi as aD,
|
|
7334
|
+
I as aE,
|
|
7335
|
+
P as aF,
|
|
7336
|
+
Ai as aG,
|
|
7337
|
+
cs as aH,
|
|
7338
|
+
me as aI,
|
|
7339
|
+
hi as aJ,
|
|
7340
|
+
mi as aK,
|
|
7341
|
+
hs as aL,
|
|
7342
|
+
pe as aM,
|
|
7343
|
+
as as aN,
|
|
7344
|
+
_e as aO,
|
|
7345
|
+
ls as aP,
|
|
7346
|
+
vi as aQ,
|
|
7347
|
+
fi as aR,
|
|
7348
|
+
ui as aS,
|
|
7349
|
+
gi as aT,
|
|
7350
|
+
ue as aU,
|
|
7351
|
+
di as aV,
|
|
7352
|
+
ci as aW,
|
|
7353
|
+
ai as aX,
|
|
7354
|
+
Fi as aY,
|
|
7355
|
+
Ti as aZ,
|
|
7356
|
+
li as a_,
|
|
7357
|
+
Pt as aa,
|
|
7358
|
+
Mt as ab,
|
|
7359
|
+
Lt as ac,
|
|
7360
|
+
Ut as ad,
|
|
7361
|
+
is as ae,
|
|
7362
|
+
j as af,
|
|
7363
|
+
wt as ag,
|
|
7364
|
+
es as ah,
|
|
7365
|
+
Ce as ai,
|
|
7366
|
+
Bi as aj,
|
|
7367
|
+
Ri as ak,
|
|
7368
|
+
J as al,
|
|
7369
|
+
ws as am,
|
|
7370
|
+
bs as an,
|
|
7371
|
+
xs as ao,
|
|
7372
|
+
Ss as ap,
|
|
7373
|
+
Cs as aq,
|
|
7374
|
+
vs as ar,
|
|
7375
|
+
be as as,
|
|
7376
|
+
xe as at,
|
|
7377
|
+
xi as au,
|
|
7378
|
+
$e as av,
|
|
7379
|
+
ot as aw,
|
|
7380
|
+
Ii as ax,
|
|
7381
|
+
It as ay,
|
|
7382
|
+
Yt as az,
|
|
7383
|
+
Zi as b,
|
|
7384
|
+
Ci as b0,
|
|
7385
|
+
bi as b1,
|
|
7386
|
+
ni as b2,
|
|
7387
|
+
Zt as b3,
|
|
7388
|
+
fs as b4,
|
|
7389
|
+
Mi as b5,
|
|
7390
|
+
Ve as b6,
|
|
7391
|
+
rt as b7,
|
|
7392
|
+
ki as b8,
|
|
7343
7393
|
pt as c,
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
|
|
7356
|
-
|
|
7357
|
-
|
|
7358
|
-
|
|
7359
|
-
|
|
7360
|
-
|
|
7361
|
-
|
|
7362
|
-
|
|
7363
|
-
|
|
7364
|
-
|
|
7365
|
-
|
|
7394
|
+
Gi as d,
|
|
7395
|
+
Pi as e,
|
|
7396
|
+
Ui as f,
|
|
7397
|
+
ti as g,
|
|
7398
|
+
ts as h,
|
|
7399
|
+
Li as i,
|
|
7400
|
+
Hi as j,
|
|
7401
|
+
zi as k,
|
|
7402
|
+
$i as l,
|
|
7403
|
+
Ni as m,
|
|
7404
|
+
Yi as n,
|
|
7405
|
+
Xi as o,
|
|
7406
|
+
Qi as p,
|
|
7407
|
+
Ji as q,
|
|
7408
|
+
ds as r,
|
|
7409
|
+
ji as s,
|
|
7410
|
+
Vi as t,
|
|
7411
|
+
gs as u,
|
|
7412
|
+
qi as v,
|
|
7413
|
+
_i as w,
|
|
7414
|
+
Wi as x,
|
|
7415
|
+
ms as y,
|
|
7366
7416
|
ft as z
|
|
7367
7417
|
};
|
|
7368
|
-
//# sourceMappingURL=FontAnalyzer-
|
|
7418
|
+
//# sourceMappingURL=FontAnalyzer-BYhwxDhe.js.map
|