@anu3ev/fabric-image-editor 0.4.5 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +1517 -783
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var Re = Object.defineProperty, xe = Object.defineProperties;
|
|
2
|
+
var Be = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var zt = Object.getOwnPropertySymbols;
|
|
4
|
+
var me = Object.prototype.hasOwnProperty, pe = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var fe = (d, t, e) => t in d ? Re(d, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : d[t] = e, k = (d, t) => {
|
|
6
6
|
for (var e in t || (t = {}))
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var e of
|
|
10
|
-
|
|
7
|
+
me.call(t, e) && fe(d, e, t[e]);
|
|
8
|
+
if (zt)
|
|
9
|
+
for (var e of zt(t))
|
|
10
|
+
pe.call(t, e) && fe(d, e, t[e]);
|
|
11
11
|
return d;
|
|
12
|
-
},
|
|
13
|
-
var
|
|
12
|
+
}, Tt = (d, t) => xe(d, Be(t));
|
|
13
|
+
var rt = (d, t) => {
|
|
14
14
|
var e = {};
|
|
15
15
|
for (var s in d)
|
|
16
|
-
|
|
17
|
-
if (d != null &&
|
|
18
|
-
for (var s of
|
|
19
|
-
t.indexOf(s) < 0 &&
|
|
16
|
+
me.call(d, s) && t.indexOf(s) < 0 && (e[s] = d[s]);
|
|
17
|
+
if (d != null && zt)
|
|
18
|
+
for (var s of zt(d))
|
|
19
|
+
t.indexOf(s) < 0 && pe.call(d, s) && (e[s] = d[s]);
|
|
20
20
|
return e;
|
|
21
21
|
};
|
|
22
|
-
var
|
|
22
|
+
var O = (d, t, e) => new Promise((s, o) => {
|
|
23
23
|
var n = (r) => {
|
|
24
24
|
try {
|
|
25
25
|
a(e.next(r));
|
|
@@ -35,12 +35,12 @@ var E = (d, t, e) => new Promise((s, o) => {
|
|
|
35
35
|
}, a = (r) => r.done ? s(r.value) : Promise.resolve(r.value).then(n, i);
|
|
36
36
|
a((e = e.apply(d, t)).next());
|
|
37
37
|
});
|
|
38
|
-
import { ActiveSelection as
|
|
39
|
-
import { create as
|
|
40
|
-
import
|
|
41
|
-
var
|
|
38
|
+
import { ActiveSelection as U, Textbox as st, util as it, controlsUtils as ye, InteractiveFabricObject as Me, loadSVGFromURL as _e, FabricImage as Ot, Point as ht, Gradient as ve, Rect as Ue, Circle as ze, Triangle as Ye, Group as pt, Color as Pe, classRegistry as be, loadSVGFromString as Fe, Canvas as We, Pattern as He } from "fabric";
|
|
39
|
+
import { create as Ze } from "jsondiffpatch";
|
|
40
|
+
import Ve from "diff-match-patch";
|
|
41
|
+
var Ge = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", P = function() {
|
|
42
42
|
for (var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 21, e = "", s = crypto.getRandomValues(new Uint8Array(t |= 0)); t--; )
|
|
43
|
-
e +=
|
|
43
|
+
e += Ge[s[t] & 63];
|
|
44
44
|
return e;
|
|
45
45
|
};
|
|
46
46
|
class Lt {
|
|
@@ -98,7 +98,7 @@ class Lt {
|
|
|
98
98
|
if (o.length === 1)
|
|
99
99
|
this.canvas.setActiveObject(o[0]);
|
|
100
100
|
else {
|
|
101
|
-
const i = new
|
|
101
|
+
const i = new U(o, {
|
|
102
102
|
canvas: this.canvas
|
|
103
103
|
});
|
|
104
104
|
this.canvas.setActiveObject(i);
|
|
@@ -106,7 +106,7 @@ class Lt {
|
|
|
106
106
|
this.canvas.requestRenderAll();
|
|
107
107
|
return;
|
|
108
108
|
}
|
|
109
|
-
const n = new
|
|
109
|
+
const n = new U(t, {
|
|
110
110
|
canvas: this.canvas
|
|
111
111
|
});
|
|
112
112
|
this.editor.objectLockManager.lockObject({
|
|
@@ -175,7 +175,7 @@ class Lt {
|
|
|
175
175
|
* @param event.code — код клавиши
|
|
176
176
|
*/
|
|
177
177
|
handleUndoRedoEvent(t) {
|
|
178
|
-
return
|
|
178
|
+
return O(this, null, function* () {
|
|
179
179
|
const { ctrlKey: e, metaKey: s, code: o, repeat: n } = t;
|
|
180
180
|
this._shouldIgnoreKeyboardEvent(t) || !e && !s || n || !/Mac/i.test(navigator.userAgent) && this.isUndoRedoKeyPressed || (o === "KeyZ" ? (t.preventDefault(), this.isUndoRedoKeyPressed = !0, yield this.editor.historyManager.undo()) : o === "KeyY" && (t.preventDefault(), this.isUndoRedoKeyPressed = !0, yield this.editor.historyManager.redo()));
|
|
181
181
|
});
|
|
@@ -220,7 +220,7 @@ class Lt {
|
|
|
220
220
|
if (o || n) return;
|
|
221
221
|
this.isSpacePressed = !0, t.preventDefault();
|
|
222
222
|
const i = e.getActiveObject() || null;
|
|
223
|
-
i instanceof
|
|
223
|
+
i instanceof U ? this.savedSelection = i.getObjects().slice() : i && (this.savedSelection = [i]), e.discardActiveObject(), e.set({
|
|
224
224
|
selection: !1,
|
|
225
225
|
defaultCursor: "grab"
|
|
226
226
|
}), e.setCursor("grab"), s.canvasManager.getObjects().forEach((a) => {
|
|
@@ -259,7 +259,7 @@ class Lt {
|
|
|
259
259
|
e.setActiveObject(t[0]);
|
|
260
260
|
return;
|
|
261
261
|
}
|
|
262
|
-
const o = t.filter((i) => s.canvasManager.getObjects().includes(i)), n = new
|
|
262
|
+
const o = t.filter((i) => s.canvasManager.getObjects().includes(i)), n = new U(o, { canvas: e });
|
|
263
263
|
e.setActiveObject(n);
|
|
264
264
|
}
|
|
265
265
|
// --- Обработчики для событий canvas (Fabric) ---
|
|
@@ -330,7 +330,7 @@ class Lt {
|
|
|
330
330
|
*/
|
|
331
331
|
handleResetObjectFit(t) {
|
|
332
332
|
const e = t == null ? void 0 : t.target;
|
|
333
|
-
!e || e instanceof
|
|
333
|
+
!e || e instanceof st || this.editor.transformManager.resetObject({ object: e });
|
|
334
334
|
}
|
|
335
335
|
/**
|
|
336
336
|
* Проверяет, должно ли событие клавиатуры быть проигнорировано
|
|
@@ -391,7 +391,7 @@ class Lt {
|
|
|
391
391
|
};
|
|
392
392
|
}
|
|
393
393
|
}
|
|
394
|
-
class
|
|
394
|
+
class Xe {
|
|
395
395
|
/**
|
|
396
396
|
* Класс для динамической загрузки внешних модулей.
|
|
397
397
|
*/
|
|
@@ -409,7 +409,7 @@ class Ze {
|
|
|
409
409
|
return this.loaders[t] ? (this.cache.has(t) || this.cache.set(t, this.loaders[t]()), this.cache.get(t)) : Promise.reject(new Error(`Unknown module "${t}"`));
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
|
-
function
|
|
412
|
+
function Ke(d) {
|
|
413
413
|
return new Worker(
|
|
414
414
|
"" + new URL("assets/worker-CN39s7P7.js", import.meta.url).href,
|
|
415
415
|
{
|
|
@@ -417,13 +417,13 @@ function Ve(d) {
|
|
|
417
417
|
}
|
|
418
418
|
);
|
|
419
419
|
}
|
|
420
|
-
class
|
|
420
|
+
class Qe {
|
|
421
421
|
/**
|
|
422
422
|
* @param scriptUrl — URL скрипта воркера.
|
|
423
423
|
* По-умолчанию использует DefaultWorker из соседнего файла
|
|
424
424
|
*/
|
|
425
425
|
constructor(t) {
|
|
426
|
-
t ? this.worker = new Worker(t, { type: "module" }) : this.worker = new
|
|
426
|
+
t ? this.worker = new Worker(t, { type: "module" }) : this.worker = new Ke(), this._callbacks = /* @__PURE__ */ new Map(), this.worker.onmessage = this._handleMessage.bind(this);
|
|
427
427
|
}
|
|
428
428
|
/**
|
|
429
429
|
* Обработчик сообщений от воркера
|
|
@@ -451,7 +451,7 @@ class Ge {
|
|
|
451
451
|
* @returns Promise, который будет выполнен, когда воркер вернет ответ
|
|
452
452
|
*/
|
|
453
453
|
post(t, e, s = []) {
|
|
454
|
-
const o = `${t}:${
|
|
454
|
+
const o = `${t}:${P(8)}`;
|
|
455
455
|
return new Promise((n, i) => {
|
|
456
456
|
this._callbacks.set(o, { resolve: n, reject: i }), this.worker.postMessage({ action: t, payload: e, requestId: o }, s);
|
|
457
457
|
});
|
|
@@ -463,95 +463,95 @@ class Ge {
|
|
|
463
463
|
this.worker.terminate();
|
|
464
464
|
}
|
|
465
465
|
}
|
|
466
|
-
const
|
|
467
|
-
function
|
|
468
|
-
const n =
|
|
469
|
-
d.save(), d.translate(t, e), d.rotate(
|
|
466
|
+
const tt = 12, $e = 2, te = 8, ee = 20, Je = 100, se = 20, oe = 8, qe = 100, Wt = 32, ie = 1, ts = "#2B2D33", ae = "#3D8BF4", re = "#FFFFFF";
|
|
467
|
+
function Yt(d, t, e, s, o) {
|
|
468
|
+
const n = tt, i = $e;
|
|
469
|
+
d.save(), d.translate(t, e), d.rotate(it.degreesToRadians(o.angle)), d.fillStyle = re, d.strokeStyle = ae, d.lineWidth = ie, d.beginPath(), d.roundRect(-n / 2, -n / 2, n, n, i), d.fill(), d.stroke(), d.restore();
|
|
470
470
|
}
|
|
471
|
-
function
|
|
472
|
-
const n =
|
|
473
|
-
d.save(), d.translate(t, e), d.rotate(
|
|
471
|
+
function we(d, t, e, s, o) {
|
|
472
|
+
const n = te, i = ee, a = Je;
|
|
473
|
+
d.save(), d.translate(t, e), d.rotate(it.degreesToRadians(o.angle)), d.fillStyle = re, d.strokeStyle = ae, d.lineWidth = ie, d.beginPath(), d.roundRect(-n / 2, -i / 2, n, i, a), d.fill(), d.stroke(), d.restore();
|
|
474
474
|
}
|
|
475
|
-
function
|
|
476
|
-
const n =
|
|
477
|
-
d.save(), d.translate(t, e), d.rotate(
|
|
475
|
+
function je(d, t, e, s, o) {
|
|
476
|
+
const n = se, i = oe, a = qe;
|
|
477
|
+
d.save(), d.translate(t, e), d.rotate(it.degreesToRadians(o.angle)), d.fillStyle = re, d.strokeStyle = ae, d.lineWidth = ie, d.beginPath(), d.roundRect(-n / 2, -i / 2, n, i, a), d.fill(), d.stroke(), d.restore();
|
|
478
478
|
}
|
|
479
|
-
const
|
|
480
|
-
|
|
481
|
-
function
|
|
479
|
+
const es = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", Ne = new Image();
|
|
480
|
+
Ne.src = es;
|
|
481
|
+
function ss(d, t, e, s, o) {
|
|
482
482
|
const i = Wt / 2;
|
|
483
|
-
d.save(), d.translate(t, e), d.rotate(
|
|
483
|
+
d.save(), d.translate(t, e), d.rotate(it.degreesToRadians(o.angle)), d.fillStyle = ts, d.beginPath(), d.arc(0, 0, i, 0, 2 * Math.PI), d.fill(), d.drawImage(Ne, -i / 2, -i / 2, i, i), d.restore();
|
|
484
484
|
}
|
|
485
|
-
const
|
|
485
|
+
const os = {
|
|
486
486
|
// Угловые точки
|
|
487
487
|
tl: {
|
|
488
|
-
render:
|
|
489
|
-
sizeX:
|
|
490
|
-
sizeY:
|
|
488
|
+
render: Yt,
|
|
489
|
+
sizeX: tt,
|
|
490
|
+
sizeY: tt,
|
|
491
491
|
offsetX: 0,
|
|
492
492
|
offsetY: 0
|
|
493
493
|
},
|
|
494
494
|
tr: {
|
|
495
|
-
render:
|
|
496
|
-
sizeX:
|
|
497
|
-
sizeY:
|
|
495
|
+
render: Yt,
|
|
496
|
+
sizeX: tt,
|
|
497
|
+
sizeY: tt,
|
|
498
498
|
offsetX: 0,
|
|
499
499
|
offsetY: 0
|
|
500
500
|
},
|
|
501
501
|
bl: {
|
|
502
|
-
render:
|
|
503
|
-
sizeX:
|
|
504
|
-
sizeY:
|
|
502
|
+
render: Yt,
|
|
503
|
+
sizeX: tt,
|
|
504
|
+
sizeY: tt,
|
|
505
505
|
offsetX: 0,
|
|
506
506
|
offsetY: 0
|
|
507
507
|
},
|
|
508
508
|
br: {
|
|
509
|
-
render:
|
|
510
|
-
sizeX:
|
|
511
|
-
sizeY:
|
|
509
|
+
render: Yt,
|
|
510
|
+
sizeX: tt,
|
|
511
|
+
sizeY: tt,
|
|
512
512
|
offsetX: 0,
|
|
513
513
|
offsetY: 0
|
|
514
514
|
},
|
|
515
515
|
// Середина вертикалей
|
|
516
516
|
ml: {
|
|
517
|
-
render:
|
|
518
|
-
sizeX:
|
|
519
|
-
sizeY:
|
|
517
|
+
render: we,
|
|
518
|
+
sizeX: te,
|
|
519
|
+
sizeY: ee,
|
|
520
520
|
offsetX: 0,
|
|
521
521
|
offsetY: 0
|
|
522
522
|
},
|
|
523
523
|
mr: {
|
|
524
|
-
render:
|
|
525
|
-
sizeX:
|
|
526
|
-
sizeY:
|
|
524
|
+
render: we,
|
|
525
|
+
sizeX: te,
|
|
526
|
+
sizeY: ee,
|
|
527
527
|
offsetX: 0,
|
|
528
528
|
offsetY: 0
|
|
529
529
|
},
|
|
530
530
|
// Середина горизонталей
|
|
531
531
|
mt: {
|
|
532
|
-
render:
|
|
533
|
-
sizeX:
|
|
534
|
-
sizeY:
|
|
532
|
+
render: je,
|
|
533
|
+
sizeX: se,
|
|
534
|
+
sizeY: oe,
|
|
535
535
|
offsetX: 0,
|
|
536
536
|
offsetY: 0
|
|
537
537
|
},
|
|
538
538
|
mb: {
|
|
539
|
-
render:
|
|
540
|
-
sizeX:
|
|
541
|
-
sizeY:
|
|
539
|
+
render: je,
|
|
540
|
+
sizeX: se,
|
|
541
|
+
sizeY: oe,
|
|
542
542
|
offsetX: 0,
|
|
543
543
|
offsetY: 0
|
|
544
544
|
},
|
|
545
545
|
// Специальный «rotate» контрол
|
|
546
546
|
mtr: {
|
|
547
|
-
render:
|
|
547
|
+
render: ss,
|
|
548
548
|
sizeX: Wt,
|
|
549
549
|
sizeY: Wt,
|
|
550
550
|
offsetX: 0,
|
|
551
551
|
offsetY: -Wt
|
|
552
552
|
}
|
|
553
553
|
};
|
|
554
|
-
class
|
|
554
|
+
class yt {
|
|
555
555
|
static wrapWidthControl(t) {
|
|
556
556
|
if (!(t != null && t.actionHandler)) return;
|
|
557
557
|
const e = t.actionHandler;
|
|
@@ -561,7 +561,7 @@ class mt {
|
|
|
561
561
|
};
|
|
562
562
|
}
|
|
563
563
|
static applyControlOverrides(t) {
|
|
564
|
-
Object.entries(
|
|
564
|
+
Object.entries(os).forEach(([e, s]) => {
|
|
565
565
|
const o = t[e];
|
|
566
566
|
o && (Object.assign(o, s), e === "mtr" && (o.cursorStyle = "grab", o.mouseDownHandler = (n, i, a, r) => {
|
|
567
567
|
var h;
|
|
@@ -571,13 +571,13 @@ class mt {
|
|
|
571
571
|
});
|
|
572
572
|
}
|
|
573
573
|
static apply() {
|
|
574
|
-
const t =
|
|
575
|
-
|
|
576
|
-
const e =
|
|
577
|
-
|
|
574
|
+
const t = ye.createObjectDefaultControls();
|
|
575
|
+
yt.applyControlOverrides(t), Me.ownDefaults.controls = t;
|
|
576
|
+
const e = ye.createTextboxDefaultControls();
|
|
577
|
+
yt.applyControlOverrides(e), e.mt && (e.mt.visible = !1), e.mb && (e.mb.visible = !1), yt.wrapWidthControl(e.ml), yt.wrapWidthControl(e.mr), st.ownDefaults.controls = e, Me.ownDefaults.snapAngle = 1;
|
|
578
578
|
}
|
|
579
579
|
}
|
|
580
|
-
const
|
|
580
|
+
const D = class D {
|
|
581
581
|
constructor(t = []) {
|
|
582
582
|
this.fonts = t;
|
|
583
583
|
}
|
|
@@ -585,36 +585,36 @@ const w = class w {
|
|
|
585
585
|
this.fonts = t;
|
|
586
586
|
}
|
|
587
587
|
loadFonts() {
|
|
588
|
-
return
|
|
588
|
+
return O(this, null, function* () {
|
|
589
589
|
var o;
|
|
590
590
|
const t = (o = this.fonts) != null ? o : [];
|
|
591
591
|
if (!t.length) return;
|
|
592
592
|
const e = typeof document != "undefined" ? document : void 0;
|
|
593
593
|
if (!e) return;
|
|
594
|
-
const s = t.map((n) =>
|
|
594
|
+
const s = t.map((n) => D.loadFont(n, e));
|
|
595
595
|
yield Promise.allSettled(s);
|
|
596
596
|
});
|
|
597
597
|
}
|
|
598
598
|
static loadFont(t, e) {
|
|
599
|
-
return
|
|
599
|
+
return O(this, null, function* () {
|
|
600
600
|
var c, h;
|
|
601
601
|
const s = typeof FontFace != "undefined", o = (c = t.family) == null ? void 0 : c.trim(), n = (h = t.source) == null ? void 0 : h.trim();
|
|
602
602
|
if (!o || !n) return;
|
|
603
|
-
const i =
|
|
604
|
-
if (!
|
|
605
|
-
if (
|
|
606
|
-
|
|
603
|
+
const i = D.normalizeFontSource(n), a = D.getDescriptorSnapshot(t.descriptors), r = D.getFontRegistrationKey(o, i, a);
|
|
604
|
+
if (!D.registeredFontKeys.has(r)) {
|
|
605
|
+
if (D.isFontFaceAlreadyApplied(e, o, a)) {
|
|
606
|
+
D.registeredFontKeys.add(r);
|
|
607
607
|
return;
|
|
608
608
|
}
|
|
609
609
|
if (s && e.fonts && typeof e.fonts.add == "function")
|
|
610
610
|
try {
|
|
611
|
-
const
|
|
612
|
-
e.fonts.add(
|
|
611
|
+
const u = yield new FontFace(o, i, t.descriptors).load();
|
|
612
|
+
e.fonts.add(u), D.registeredFontKeys.add(r);
|
|
613
613
|
return;
|
|
614
614
|
} catch (l) {
|
|
615
615
|
console.warn(`Не удалось загрузить шрифт "${o}" через FontFace API`, l);
|
|
616
616
|
}
|
|
617
|
-
|
|
617
|
+
D.injectFontFace({
|
|
618
618
|
font: t,
|
|
619
619
|
source: i,
|
|
620
620
|
doc: e,
|
|
@@ -634,15 +634,15 @@ const w = class w {
|
|
|
634
634
|
if (!i) return;
|
|
635
635
|
const a = s.createElement("style");
|
|
636
636
|
a.setAttribute("data-editor-font", i), a.setAttribute("data-editor-font-key", o);
|
|
637
|
-
const r =
|
|
637
|
+
const r = D.descriptorsToCss(n), c = [
|
|
638
638
|
"@font-face {",
|
|
639
|
-
` font-family: ${
|
|
639
|
+
` font-family: ${D.formatFontFamilyForCss(i)};`,
|
|
640
640
|
` src: ${e};`,
|
|
641
641
|
...r.map((l) => ` ${l}`),
|
|
642
642
|
"}"
|
|
643
643
|
];
|
|
644
644
|
a.textContent = c.join(`
|
|
645
|
-
`), s.head.appendChild(a),
|
|
645
|
+
`), s.head.appendChild(a), D.registeredFontKeys.add(o);
|
|
646
646
|
}
|
|
647
647
|
static normalizeFontSource(t) {
|
|
648
648
|
const e = t.trim();
|
|
@@ -665,15 +665,15 @@ const w = class w {
|
|
|
665
665
|
return t ? t.trim().replace(/^['"]+|['"]+$/g, "").toLowerCase() : "";
|
|
666
666
|
}
|
|
667
667
|
static getDescriptorSnapshot(t) {
|
|
668
|
-
const e =
|
|
668
|
+
const e = D.descriptorDefaults;
|
|
669
669
|
return {
|
|
670
|
-
style:
|
|
671
|
-
weight:
|
|
672
|
-
stretch:
|
|
673
|
-
unicodeRange:
|
|
674
|
-
variant:
|
|
675
|
-
featureSettings:
|
|
676
|
-
display:
|
|
670
|
+
style: D.normalizeDescriptorValue(t == null ? void 0 : t.style, e.style),
|
|
671
|
+
weight: D.normalizeDescriptorValue(t == null ? void 0 : t.weight, e.weight),
|
|
672
|
+
stretch: D.normalizeDescriptorValue(t == null ? void 0 : t.stretch, e.stretch),
|
|
673
|
+
unicodeRange: D.normalizeDescriptorValue(t == null ? void 0 : t.unicodeRange, e.unicodeRange),
|
|
674
|
+
variant: D.normalizeDescriptorValue(t == null ? void 0 : t.variant, e.variant),
|
|
675
|
+
featureSettings: D.normalizeDescriptorValue(t == null ? void 0 : t.featureSettings, e.featureSettings),
|
|
676
|
+
display: D.normalizeDescriptorValue(t == null ? void 0 : t.display, e.display)
|
|
677
677
|
};
|
|
678
678
|
}
|
|
679
679
|
static areDescriptorSnapshotsEqual(t, e) {
|
|
@@ -681,7 +681,7 @@ const w = class w {
|
|
|
681
681
|
}
|
|
682
682
|
static getFontRegistrationKey(t, e, s) {
|
|
683
683
|
return [
|
|
684
|
-
|
|
684
|
+
D.normalizeFamilyName(t),
|
|
685
685
|
e,
|
|
686
686
|
s.style,
|
|
687
687
|
s.weight,
|
|
@@ -695,12 +695,12 @@ const w = class w {
|
|
|
695
695
|
static isFontFaceAlreadyApplied(t, e, s) {
|
|
696
696
|
const o = t.fonts;
|
|
697
697
|
if (!o || typeof o.forEach != "function") return !1;
|
|
698
|
-
const n =
|
|
698
|
+
const n = D.normalizeFamilyName(e);
|
|
699
699
|
let i = !1;
|
|
700
700
|
try {
|
|
701
701
|
o.forEach((a) => {
|
|
702
|
-
if (i ||
|
|
703
|
-
const c =
|
|
702
|
+
if (i || D.normalizeFamilyName(a.family) !== n) return;
|
|
703
|
+
const c = D.getDescriptorSnapshot({
|
|
704
704
|
style: a.style,
|
|
705
705
|
weight: a.weight,
|
|
706
706
|
stretch: a.stretch,
|
|
@@ -709,7 +709,7 @@ const w = class w {
|
|
|
709
709
|
featureSettings: a.featureSettings,
|
|
710
710
|
display: a.display
|
|
711
711
|
});
|
|
712
|
-
|
|
712
|
+
D.areDescriptorSnapshotsEqual(s, c) && (i = !0);
|
|
713
713
|
});
|
|
714
714
|
} catch (a) {
|
|
715
715
|
return console.warn("Не удалось проверить, загружен ли шрифт ранее через FontFaceSet", a), !1;
|
|
@@ -736,7 +736,7 @@ const w = class w {
|
|
|
736
736
|
});
|
|
737
737
|
}
|
|
738
738
|
};
|
|
739
|
-
|
|
739
|
+
D.registeredFontKeys = /* @__PURE__ */ new Set(), D.descriptorDefaults = {
|
|
740
740
|
style: "normal",
|
|
741
741
|
weight: "normal",
|
|
742
742
|
stretch: "normal",
|
|
@@ -745,8 +745,8 @@ w.registeredFontKeys = /* @__PURE__ */ new Set(), w.descriptorDefaults = {
|
|
|
745
745
|
featureSettings: "normal",
|
|
746
746
|
display: "auto"
|
|
747
747
|
};
|
|
748
|
-
let
|
|
749
|
-
const
|
|
748
|
+
let ne = D;
|
|
749
|
+
const ns = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNi44NzUgMi41YS42MjUuNjI1IDAgMCAwLS42MjUuNjI0VjYuMjVIMy4xMjVhLjYyNS42MjUgMCAwIDAtLjYyNS42MjV2MTBjMCAuMzQ1LjI4LjYyNS42MjUuNjI1aDEwYy4zNDUgMCAuNjI1LS4yOC42MjUtLjYyNXYtMy4xMjZoMy4xMjVjLjM0NSAwIC42MjUtLjI4LjYyNS0uNjI1di0xMGEuNjI1LjYyNSAwIDAgMC0uNjI1LS42MjVoLTEwWm02Ljg3NSAxMGgyLjVWMy43NUg3LjV2Mi41aDUuNjI1Yy4zNDUgMCAuNjI1LjI4LjYyNS42MjV2NS42MjRabS0xMCAzLjc1VjcuNWg4Ljc1djguNzVIMy43NVoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==", is = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMi41IDcuNWMwLS42OS41Ni0xLjI1IDEuMjUtMS4yNWgxMi41Yy42OSAwIDEuMjUuNTYgMS4yNSAxLjI1djguNzVjMCAuNjktLjU2IDEuMjUtMS4yNSAxLjI1SDMuNzVjLS42OSAwLTEuMjUtLjU2LTEuMjUtMS4yNVY3LjVabTEzLjc1IDBIMy43NXY4Ljc1aDEyLjVWNy41WiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTAgMS44NzVhMi4xODggMi4xODggMCAwIDAtMi4xODggMi4xODh2Mi44MTJhLjYyNS42MjUgMCAxIDEtMS4yNSAwVjQuMDYyYTMuNDM3IDMuNDM3IDAgMSAxIDYuODc1IDB2Mi44MTNhLjYyNS42MjUgMCAxIDEtMS4yNSAwVjQuMDYyQTIuMTg4IDIuMTg4IDAgMCAwIDEwIDEuODc2WiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTEwIDEyLjgxM2EuOTM3LjkzNyAwIDEgMCAwLTEuODc1LjkzNy45MzcgMCAwIDAgMCAxLjg3NFoiLz48L3N2Zz4=", as = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE2LjI1IDYuMjVINy41VjQuMzc1YTIuNSAyLjUgMCAwIDEgMi41LTIuNWMxLjIgMCAyLjI4MS44NiAyLjUxMiAyYS42MjUuNjI1IDAgMCAwIDEuMjI2LS4yNWMtLjM1NC0xLjczOC0xLjkyNS0zLTMuNzM4LTNhMy43NTQgMy43NTQgMCAwIDAtMy43NSAzLjc1VjYuMjVoLTIuNUExLjI1IDEuMjUgMCAwIDAgMi41IDcuNXY4Ljc1YTEuMjUgMS4yNSAwIDAgMCAxLjI1IDEuMjVoMTIuNWExLjI1IDEuMjUgMCAwIDAgMS4yNS0xLjI1VjcuNWExLjI1IDEuMjUgMCAwIDAtMS4yNS0xLjI1Wm0wIDEwSDMuNzVWNy41aDEyLjV2OC43NVptLTUuMzEzLTQuMzc1YS45MzcuOTM3IDAgMSAxLTEuODc0IDAgLjkzNy45MzcgMCAwIDEgMS44NzQgMFoiLz48L3N2Zz4K", rs = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTIuNSA4LjEyNSAxMCAxMi41bDcuNS00LjM3NUwxMCAzLjc1IDIuNSA4LjEyNVoiLz48cGF0aCBmaWxsPSIjZmZmIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik05LjY4NSAzLjIxYS42MjUuNjI1IDAgMCAxIC42MyAwbDcuNSA0LjM3NWEuNjI1LjYyNSAwIDAgMSAwIDEuMDhsLTcuNSA0LjM3NWEuNjI1LjYyNSAwIDAgMS0uNjMgMGwtNy41LTQuMzc1YS42MjUuNjI1IDAgMCAxIDAtMS4wOGw3LjUtNC4zNzVaTTMuNzQgOC4xMjUgMTAgMTEuNzc2bDYuMjYtMy42NTFMMTAgNC40NzQgMy43NCA4LjEyNVoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjxwYXRoIGZpbGw9IiNmZmYiIGZpbGwtcnVsZT0iZXZlbm9kZCIgZD0iTTUuNCA5LjQ2YS42MjUuNjI1IDAgMCAxIC42MyAwTDEwIDExLjc3NmwzLjk3LTIuMzE2YS42MjUuNjI1IDAgMCAxIC42MyAwbDMuMjE1IDEuODc1YS42MjUuNjI1IDAgMCAxIDAgMS4wOGwtNy41IDQuMzc1YS42MjUuNjI1IDAgMCAxLS42MyAwbC03LjUtNC4zNzVhLjYyNS42MjUgMCAwIDEgMC0xLjA4TDUuNCA5LjQ2Wm0tMS42NiAyLjQxNUwxMCAxNS41MjZsNi4yNi0zLjY1MS0xLjk3NC0xLjE1MS0zLjk3MSAyLjMxNmEuNjI1LjYyNSAwIDAgMS0uNjMgMGwtMy45Ny0yLjMxNi0xLjk3NSAxLjE1MVoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==", cs = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNOS42ODUgMy4yMWEuNjI1LjYyNSAwIDAgMSAuNjMgMGw3LjUgNC4zNzVhLjYyNS42MjUgMCAwIDEgMCAxLjA4bC03LjUgNC4zNzVhLjYyNS42MjUgMCAwIDEtLjYzIDBsLTcuNS00LjM3NWEuNjI1LjYyNSAwIDAgMSAwLTEuMDhsNy41LTQuMzc1Wk0zLjc0IDguMTI1IDEwIDExLjc3Nmw2LjI2LTMuNjUxTDEwIDQuNDc0IDMuNzQgOC4xMjVaIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48cGF0aCBmaWxsPSIjZmZmIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik01LjcxNCAxMCAxMCAxMi41bDQuMjg2LTIuNSAzLjIxNCAxLjg3NUwxMCAxNi4yNWwtNy41LTQuMzc1TDUuNzE0IDEwWiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNS40IDkuNDZhLjYyNS42MjUgMCAwIDEgLjYzIDBMMTAgMTEuNzc2bDMuOTctMi4zMTZhLjYyNS42MjUgMCAwIDEgLjYzIDBsMy4yMTUgMS44NzVhLjYyNS42MjUgMCAwIDEgMCAxLjA4bC03LjUgNC4zNzVhLjYyNS42MjUgMCAwIDEtLjYzIDBsLTcuNS00LjM3NWEuNjI1LjYyNSAwIDAgMSAwLTEuMDhMNS40IDkuNDZabS0xLjY2IDIuNDE1TDEwIDE1LjUyNmw2LjI2LTMuNjUxLTEuOTc0LTEuMTUxLTMuOTcxIDIuMzE2YS42MjUuNjI1IDAgMCAxLS42MyAwbC0zLjk3LTIuMzE2LTEuOTc1IDEuMTUxWiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+", ds = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0ibTIuNSA2LjI1IDcuNSA0LjM3NSA3LjUtNC4zNzVMMTAgMS44NzUgMi41IDYuMjVaIi8+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNOS42ODUgMS4zMzVhLjYyNS42MjUgMCAwIDEgLjYzIDBsNy41IDQuMzc1YS42MjUuNjI1IDAgMCAxIDAgMS4wOGwtNy41IDQuMzc1YS42MjUuNjI1IDAgMCAxLS42MyAwbC03LjUtNC4zNzVhLjYyNS42MjUgMCAwIDEgMC0xLjA4bDcuNS00LjM3NVpNMy43NCA2LjI1IDEwIDkuOTAxbDYuMjYtMy42NTFMMTAgMi41OTkgMy43NCA2LjI1WiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNS40IDExLjMzNWEuNjI1LjYyNSAwIDAgMSAuNjMgMEwxMCAxMy42NTFsMy45Ny0yLjMxNmEuNjI1LjYyNSAwIDAgMSAuNjMgMGwzLjIxNSAxLjg3NWEuNjI1LjYyNSAwIDAgMSAwIDEuMDhsLTcuNSA0LjM3NWEuNjI1LjYyNSAwIDAgMS0uNjMgMGwtNy41LTQuMzc1YS42MjUuNjI1IDAgMCAxIDAtMS4wOEw1LjQgMTEuMzM1Wk0zLjc0IDEzLjc1IDEwIDE3LjQwMWw2LjI2LTMuNjUxLTEuOTc0LTEuMTUxLTMuOTcxIDIuMzE2YS42MjUuNjI1IDAgMCAxLS42MyAwbC0zLjk3LTIuMzE2TDMuNzQgMTMuNzVaIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48cGF0aCBmaWxsPSIjZmZmIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik01LjQgNy41ODVhLjYyNS42MjUgMCAwIDEgLjYzIDBMMTAgOS45MDFsMy45Ny0yLjMxNmEuNjI1LjYyNSAwIDAgMSAuNjMgMGwzLjIxNSAxLjg3NWEuNjI1LjYyNSAwIDAgMSAwIDEuMDhsLTcuNSA0LjM3NWEuNjI1LjYyNSAwIDAgMS0uNjMgMGwtNy41LTQuMzc1YS42MjUuNjI1IDAgMCAxIDAtMS4wOEw1LjQgNy41ODVaTTMuNzQgMTAgMTAgMTMuNjUxIDE2LjI2IDEwbC0xLjk3NC0xLjE1MS0zLjk3MSAyLjMxNmEuNjI1LjYyNSAwIDAgMS0uNjMgMGwtMy45Ny0yLjMxNkwzLjc0IDEwWiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+", ls = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMS45NiAxMy40MzVhLjYyNS42MjUgMCAwIDEgLjg1NS0uMjI1TDEwIDE3LjQwMWw3LjE4NS00LjE5YS42MjUuNjI1IDAgMCAxIC42MyAxLjA3OWwtNy41IDQuMzc1YS42MjUuNjI1IDAgMCAxLS42MyAwbC03LjUtNC4zNzVhLjYyNS42MjUgMCAwIDEtLjIyNS0uODU1Wk05LjY4NSAxLjMzNWEuNjI1LjYyNSAwIDAgMSAuNjMgMGw3LjUgNC4zNzVhLjYyNS42MjUgMCAwIDEgMCAxLjA4bC03LjUgNC4zNzVhLjYyNS42MjUgMCAwIDEtLjYzIDBsLTcuNS00LjM3NWEuNjI1LjYyNSAwIDAgMSAwLTEuMDhsNy41LTQuMzc1Wk0zLjc0IDYuMjUgMTAgOS45MDFsNi4yNi0zLjY1MUwxMCAyLjU5OSAzLjc0IDYuMjVaIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48cGF0aCBmaWxsPSIjZmZmIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGQ9Im01LjcxNCAxMS44NzUgNC4yODYgMi41IDQuMjg2LTIuNUwxNy41IDEzLjc1IDEwIDE4LjEyNSAyLjUgMTMuNzVsMy4yMTQtMS44NzVaIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48cGF0aCBmaWxsPSIjZmZmIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik01LjQgMTEuMzM1YS42MjUuNjI1IDAgMCAxIC42MyAwTDEwIDEzLjY1MWwzLjk3LTIuMzE2YS42MjUuNjI1IDAgMCAxIC42MyAwbDMuMjE1IDEuODc1YS42MjUuNjI1IDAgMCAxIDAgMS4wOGwtNy41IDQuMzc1YS42MjUuNjI1IDAgMCAxLS42MyAwbC03LjUtNC4zNzVhLjYyNS42MjUgMCAwIDEgMC0xLjA4TDUuNCAxMS4zMzVaTTMuNzQgMTMuNzUgMTAgMTcuNDAxbDYuMjYtMy42NTEtMS45NzQtMS4xNTEtMy45NzEgMi4zMTZhLjYyNS42MjUgMCAwIDEtLjYzIDBsLTMuOTctMi4zMTZMMy43NCAxMy43NVoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjxwYXRoIGZpbGw9IiNmZmYiIGZpbGwtcnVsZT0iZXZlbm9kZCIgZD0iTTUuNCA3LjU4NWEuNjI1LjYyNSAwIDAgMSAuNjMgMEwxMCA5LjkwMWwzLjk3LTIuMzE2YS42MjUuNjI1IDAgMCAxIC42MyAwbDMuMjE1IDEuODc1YS42MjUuNjI1IDAgMCAxIDAgMS4wOGwtNy41IDQuMzc1YS42MjUuNjI1IDAgMCAxLS42MyAwbC03LjUtNC4zNzVhLjYyNS42MjUgMCAwIDEgMC0xLjA4TDUuNCA3LjU4NVpNMy43NCAxMCAxMCAxMy42NTEgMTYuMjYgMTBsLTEuOTc0LTEuMTUxLTMuOTcxIDIuMzE2YS42MjUuNjI1IDAgMCAxLS42MyAwbC0zLjk3LTIuMzE2TDMuNzQgMTBaIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=", hs = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI0VDNEU0MCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNOC4xMjUgMS4yNUExLjg3NSAxLjg3NSAwIDAgMCA2LjI1IDMuMTI1di42MjVIMy4xMjVhLjYyNS42MjUgMCAwIDAgMCAxLjI1aC42MjV2MTEuMjVBMS4yNSAxLjI1IDAgMCAwIDUgMTcuNWgxMGExLjI1IDEuMjUgMCAwIDAgMS4yNS0xLjI1VjVoLjYyNWEuNjI1LjYyNSAwIDAgMCAwLTEuMjVIMTMuNzV2LS42MjVhMS44NzUgMS44NzUgMCAwIDAtMS44NzUtMS44NzVoLTMuNzVabTQuMzc1IDIuNXYtLjYyNWEuNjI1LjYyNSAwIDAgMC0uNjI1LS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDAtLjYyNS42MjV2LjYyNWg1Wk01IDE2LjI1VjVoMTB2MTEuMjVINVpNOC4xMjUgNy41Yy4zNDUgMCAuNjI1LjI4LjYyNS42MjV2NWEuNjI1LjYyNSAwIDEgMS0xLjI1IDB2LTVjMC0uMzQ1LjI4LS42MjUuNjI1LS42MjVabTQuMzc1IDUuNjI1di01YS42MjUuNjI1IDAgMCAwLTEuMjUgMHY1YS42MjUuNjI1IDAgMSAwIDEuMjUgMFoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==", Dt = {
|
|
750
750
|
style: {
|
|
751
751
|
position: "absolute",
|
|
752
752
|
display: "none",
|
|
@@ -813,17 +813,17 @@ const es = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMj
|
|
|
813
813
|
],
|
|
814
814
|
offsetTop: 50,
|
|
815
815
|
icons: {
|
|
816
|
-
copyPaste:
|
|
817
|
-
delete:
|
|
818
|
-
lock:
|
|
819
|
-
unlock:
|
|
820
|
-
bringToFront:
|
|
821
|
-
sendToBack:
|
|
822
|
-
bringForward:
|
|
823
|
-
sendBackwards:
|
|
816
|
+
copyPaste: ns,
|
|
817
|
+
delete: hs,
|
|
818
|
+
lock: is,
|
|
819
|
+
unlock: as,
|
|
820
|
+
bringToFront: ds,
|
|
821
|
+
sendToBack: ls,
|
|
822
|
+
bringForward: rs,
|
|
823
|
+
sendBackwards: cs
|
|
824
824
|
},
|
|
825
825
|
handlers: {
|
|
826
|
-
copyPaste: (d) =>
|
|
826
|
+
copyPaste: (d) => O(null, null, function* () {
|
|
827
827
|
d.clipboardManager.copyPaste();
|
|
828
828
|
}),
|
|
829
829
|
delete: (d) => {
|
|
@@ -849,18 +849,18 @@ const es = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMj
|
|
|
849
849
|
}
|
|
850
850
|
}
|
|
851
851
|
};
|
|
852
|
-
class
|
|
852
|
+
class us {
|
|
853
853
|
constructor({ editor: t }) {
|
|
854
854
|
this.currentTarget = null, this.currentLocked = !1, this.isTransforming = !1, this.editor = t, this.canvas = t.canvas, this.options = t.options, this._initToolbar();
|
|
855
855
|
}
|
|
856
856
|
_initToolbar() {
|
|
857
857
|
if (!this.options.showToolbar) return;
|
|
858
858
|
const t = this.options.toolbar || {};
|
|
859
|
-
this.config =
|
|
860
|
-
style:
|
|
861
|
-
btnStyle:
|
|
862
|
-
icons:
|
|
863
|
-
handlers:
|
|
859
|
+
this.config = Tt(k(k({}, Dt), t), {
|
|
860
|
+
style: k(k({}, Dt.style), t.style || {}),
|
|
861
|
+
btnStyle: k(k({}, Dt.btnStyle), t.btnStyle || {}),
|
|
862
|
+
icons: k(k({}, Dt.icons), t.icons || {}),
|
|
863
|
+
handlers: k(k({}, Dt.handlers), t.handlers || {})
|
|
864
864
|
}), this.currentTarget = null, this.currentLocked = !1, this.isTransforming = !1, this._onMouseDown = this._handleMouseDown.bind(this), this._onObjectMoving = this._startTransform.bind(this), this._onObjectScaling = this._startTransform.bind(this), this._onObjectRotating = this._startTransform.bind(this), this._onMouseUp = this._endTransform.bind(this), this._onObjectModified = this._endTransform.bind(this), this._onSelectionChange = this._updateToolbar.bind(this), this._onSelectionClear = () => {
|
|
865
865
|
this.el.style.display = "none";
|
|
866
866
|
}, this._createDOM(), this._bindEvents();
|
|
@@ -951,9 +951,9 @@ class ds {
|
|
|
951
951
|
}
|
|
952
952
|
const { el: e, config: s, canvas: o } = this;
|
|
953
953
|
t.setCoords();
|
|
954
|
-
const n = o.getZoom(), [, , , , i, a] = o.viewportTransform, { x: r } = t.getCenterPoint(), { top: c, height: h } = t.getBoundingRect(),
|
|
954
|
+
const n = o.getZoom(), [, , , , i, a] = o.viewportTransform, { x: r } = t.getCenterPoint(), { top: c, height: h } = t.getBoundingRect(), u = r * n + i - e.offsetWidth / 2, g = s.offsetTop || 0, f = (c + h) * n + a + g;
|
|
955
955
|
Object.assign(e.style, {
|
|
956
|
-
left: `${
|
|
956
|
+
left: `${u}px`,
|
|
957
957
|
top: `${f}px`,
|
|
958
958
|
display: "flex"
|
|
959
959
|
});
|
|
@@ -965,7 +965,7 @@ class ds {
|
|
|
965
965
|
this.el.removeEventListener("mouseover", this._onBtnOver), this.el.removeEventListener("mouseout", this._onBtnOut), this.canvas.off("mouse:down", this._onMouseDown), this.canvas.off("object:moving", this._onObjectMoving), this.canvas.off("object:scaling", this._onObjectScaling), this.canvas.off("object:rotating", this._onObjectRotating), this.canvas.off("mouse:up", this._onMouseUp), this.canvas.off("object:modified", this._onObjectModified), this.canvas.off("selection:created", this._onSelectionChange), this.canvas.off("selection:updated", this._onSelectionChange), this.canvas.off("after:render", this._onSelectionChange), this.canvas.off("selection:cleared", this._onSelectionClear), this.el.remove();
|
|
966
966
|
}
|
|
967
967
|
}
|
|
968
|
-
const
|
|
968
|
+
const gs = {
|
|
969
969
|
position: "absolute",
|
|
970
970
|
display: "none",
|
|
971
971
|
background: "#2B2D33",
|
|
@@ -979,8 +979,8 @@ const ls = {
|
|
|
979
979
|
"pointer-events": "none",
|
|
980
980
|
"white-space": "nowrap",
|
|
981
981
|
"box-shadow": "0 2px 8px rgba(0, 0, 0, 0.2)"
|
|
982
|
-
},
|
|
983
|
-
class
|
|
982
|
+
}, Ae = 16, Se = 16, fs = "fabric-editor-angle-indicator";
|
|
983
|
+
class ce {
|
|
984
984
|
constructor({ editor: t }) {
|
|
985
985
|
this.isActive = !1, this.currentAngle = 0, this.editor = t, this.canvas = t.canvas, this.options = t.options, this._createDOM(), this._bindEvents();
|
|
986
986
|
}
|
|
@@ -988,7 +988,7 @@ class ae {
|
|
|
988
988
|
* Создание DOM-элемента индикатора
|
|
989
989
|
*/
|
|
990
990
|
_createDOM() {
|
|
991
|
-
this.el = document.createElement("div"), this.el.className =
|
|
991
|
+
this.el = document.createElement("div"), this.el.className = fs, Object.entries(gs).forEach(([t, e]) => {
|
|
992
992
|
this.el.style.setProperty(t, e);
|
|
993
993
|
}), this.canvas.wrapperEl.appendChild(this.el);
|
|
994
994
|
}
|
|
@@ -1008,7 +1008,7 @@ class ae {
|
|
|
1008
1008
|
return;
|
|
1009
1009
|
}
|
|
1010
1010
|
const s = e.angle || 0;
|
|
1011
|
-
this.currentAngle =
|
|
1011
|
+
this.currentAngle = ce._normalizeAngle(s), this.el.textContent = `${this.currentAngle}°`, this._positionIndicator(t.e), this.isActive || this._showIndicator();
|
|
1012
1012
|
}
|
|
1013
1013
|
/**
|
|
1014
1014
|
* Обработчик отпускания кнопки мыши
|
|
@@ -1039,9 +1039,9 @@ class ae {
|
|
|
1039
1039
|
*/
|
|
1040
1040
|
_positionIndicator(t) {
|
|
1041
1041
|
const e = this.canvas.wrapperEl.getBoundingClientRect();
|
|
1042
|
-
let s = t.clientX - e.left +
|
|
1042
|
+
let s = t.clientX - e.left + Ae, o = t.clientY - e.top + Se;
|
|
1043
1043
|
const n = this.el.getBoundingClientRect(), i = n.width, a = n.height;
|
|
1044
|
-
s + i > e.width && (s = t.clientX - e.left - i -
|
|
1044
|
+
s + i > e.width && (s = t.clientX - e.left - i - Ae), o + a > e.height && (o = t.clientY - e.top - a - Se), this.el.style.left = `${s}px`, this.el.style.top = `${o}px`;
|
|
1045
1045
|
}
|
|
1046
1046
|
/**
|
|
1047
1047
|
* Показать индикатор
|
|
@@ -1072,7 +1072,7 @@ class ae {
|
|
|
1072
1072
|
this.canvas && (this.canvas.off("object:rotating", this._onObjectRotating), this.canvas.off("mouse:up", this._onMouseUp), this.canvas.off("object:modified", this._onObjectModified), this.canvas.off("selection:cleared", this._onSelectionCleared)), (t = this.el) != null && t.parentNode && this.el.parentNode.removeChild(this.el), this.el = null, this.editor = null, this.canvas = null, this.options = null;
|
|
1073
1073
|
}
|
|
1074
1074
|
}
|
|
1075
|
-
const
|
|
1075
|
+
const ke = [
|
|
1076
1076
|
"selectable",
|
|
1077
1077
|
"evented",
|
|
1078
1078
|
"id",
|
|
@@ -1108,7 +1108,7 @@ const De = [
|
|
|
1108
1108
|
"radiusBottomRight",
|
|
1109
1109
|
"radiusBottomLeft"
|
|
1110
1110
|
];
|
|
1111
|
-
class
|
|
1111
|
+
class Ht {
|
|
1112
1112
|
constructor({ editor: t }) {
|
|
1113
1113
|
this.editor = t, this.canvas = t.canvas, this._historySuspendCount = 0, this.baseState = null, this.patches = [], this.currentIndex = 0, this.maxHistoryLength = t.options.maxHistoryLength, this.totalChangesCount = 0, this.baseStateChangesCount = 0, this._createDiffPatcher();
|
|
1114
1114
|
}
|
|
@@ -1120,7 +1120,7 @@ class Zt {
|
|
|
1120
1120
|
return this.patches[this.currentIndex - 1] || null;
|
|
1121
1121
|
}
|
|
1122
1122
|
_createDiffPatcher() {
|
|
1123
|
-
this.diffPatcher =
|
|
1123
|
+
this.diffPatcher = Ze({
|
|
1124
1124
|
objectHash(t) {
|
|
1125
1125
|
const e = t, s = t, o = s.styles ? JSON.stringify(s.styles) : "";
|
|
1126
1126
|
return [
|
|
@@ -1170,7 +1170,7 @@ class Zt {
|
|
|
1170
1170
|
includeValueOnMove: !1
|
|
1171
1171
|
},
|
|
1172
1172
|
textDiff: {
|
|
1173
|
-
diffMatchPatch:
|
|
1173
|
+
diffMatchPatch: Ve,
|
|
1174
1174
|
minLength: 60
|
|
1175
1175
|
}
|
|
1176
1176
|
});
|
|
@@ -1212,7 +1212,7 @@ class Zt {
|
|
|
1212
1212
|
if (console.log("saveState"), this.skipHistory) return;
|
|
1213
1213
|
console.time("saveState");
|
|
1214
1214
|
const t = this._withTemporaryUnlock(
|
|
1215
|
-
() => this.canvas.toDatalessObject([...
|
|
1215
|
+
() => this.canvas.toDatalessObject([...ke])
|
|
1216
1216
|
);
|
|
1217
1217
|
if (console.timeEnd("saveState"), !this.baseState) {
|
|
1218
1218
|
this.baseState = t, this.patches = [], this.currentIndex = 0, console.log("Базовое состояние сохранено.");
|
|
@@ -1223,7 +1223,7 @@ class Zt {
|
|
|
1223
1223
|
console.log("Нет изменений для сохранения.");
|
|
1224
1224
|
return;
|
|
1225
1225
|
}
|
|
1226
|
-
console.log("baseState", this.baseState), this.currentIndex < this.patches.length && this.patches.splice(this.currentIndex), console.log("diff", s), this.totalChangesCount += 1, this.patches.push({ id:
|
|
1226
|
+
console.log("baseState", this.baseState), this.currentIndex < this.patches.length && this.patches.splice(this.currentIndex), console.log("diff", s), this.totalChangesCount += 1, this.patches.push({ id: P(), diff: s }), this.currentIndex += 1, this.patches.length > this.maxHistoryLength && (this.baseState = this.diffPatcher.patch(this.baseState, this.patches[0].diff), this.patches.shift(), this.currentIndex -= 1, this.baseStateChangesCount += 1), console.log("Состояние сохранено. Текущий индекс истории:", this.currentIndex);
|
|
1227
1227
|
}
|
|
1228
1228
|
/**
|
|
1229
1229
|
* Сериализует customData объектов в строку. Это необходимо чтобы при вызове loadFromJSON fabricjs не пытался обрабатывать свойства внутри customData, как свойства FabricObject, если их названия совпадают с зарезервированными.
|
|
@@ -1256,12 +1256,12 @@ class Zt {
|
|
|
1256
1256
|
* @fires editor:history-state-loaded
|
|
1257
1257
|
*/
|
|
1258
1258
|
loadStateFromFullState(t) {
|
|
1259
|
-
return
|
|
1259
|
+
return O(this, null, function* () {
|
|
1260
1260
|
if (!t) return;
|
|
1261
1261
|
console.log("loadStateFromFullState fullState", t);
|
|
1262
1262
|
const { canvas: e, canvasManager: s, interactionBlocker: o, backgroundManager: n } = this.editor, { width: i, height: a } = e;
|
|
1263
|
-
o.overlayMask = null,
|
|
1264
|
-
|
|
1263
|
+
o.overlayMask = null, Ht._serializeCustomData(t), yield e.loadFromJSON(t, (l, u) => {
|
|
1264
|
+
Ht._deserializeCustomData(l, u);
|
|
1265
1265
|
});
|
|
1266
1266
|
const r = e.getObjects().find((l) => l.id === "montage-area");
|
|
1267
1267
|
r && (this.editor.montageArea = r, (i !== e.getWidth() || a !== e.getHeight()) && s.updateCanvas());
|
|
@@ -1283,7 +1283,7 @@ class Zt {
|
|
|
1283
1283
|
* @fires editor:undo
|
|
1284
1284
|
*/
|
|
1285
1285
|
undo() {
|
|
1286
|
-
return
|
|
1286
|
+
return O(this, null, function* () {
|
|
1287
1287
|
if (!this.skipHistory) {
|
|
1288
1288
|
if (this.currentIndex <= 0) {
|
|
1289
1289
|
console.log("Нет предыдущих состояний для отмены.");
|
|
@@ -1320,7 +1320,7 @@ class Zt {
|
|
|
1320
1320
|
* @fires editor:redo
|
|
1321
1321
|
*/
|
|
1322
1322
|
redo() {
|
|
1323
|
-
return
|
|
1323
|
+
return O(this, null, function* () {
|
|
1324
1324
|
if (!this.skipHistory) {
|
|
1325
1325
|
if (this.currentIndex >= this.patches.length) {
|
|
1326
1326
|
console.log("Нет состояний для повтора.");
|
|
@@ -1375,7 +1375,7 @@ class Zt {
|
|
|
1375
1375
|
}
|
|
1376
1376
|
}
|
|
1377
1377
|
}
|
|
1378
|
-
const
|
|
1378
|
+
const ms = 0.1, ps = 2, Ie = 0.1, ys = 90, bt = 16, wt = 16, dt = 4096, lt = 4096, Ce = "application/image-editor:", Pt = [
|
|
1379
1379
|
"format",
|
|
1380
1380
|
"uppercase",
|
|
1381
1381
|
"textCaseRaw",
|
|
@@ -1389,8 +1389,8 @@ const gs = 0.1, us = 2, Ie = 0.1, fs = 90, Mt = 16, bt = 16, rt = 4096, ct = 409
|
|
|
1389
1389
|
"radiusTopRight",
|
|
1390
1390
|
"radiusBottomRight",
|
|
1391
1391
|
"radiusBottomLeft"
|
|
1392
|
-
],
|
|
1393
|
-
class
|
|
1392
|
+
], Ms = 50;
|
|
1393
|
+
class et {
|
|
1394
1394
|
constructor({ editor: t }) {
|
|
1395
1395
|
this.editor = t, this.options = t.options, this._createdBlobUrls = [], this.acceptContentTypes = this.editor.options.acceptContentTypes, this.acceptFormats = this.getAllowedFormatsFromContentTypes();
|
|
1396
1396
|
}
|
|
@@ -1407,7 +1407,7 @@ class tt {
|
|
|
1407
1407
|
* @returns возвращает Promise с объектом изображения или null в случае ошибки
|
|
1408
1408
|
*/
|
|
1409
1409
|
importImage(t) {
|
|
1410
|
-
return
|
|
1410
|
+
return O(this, null, function* () {
|
|
1411
1411
|
const {
|
|
1412
1412
|
source: e,
|
|
1413
1413
|
scale: s = `image-${this.options.scaleType}`,
|
|
@@ -1417,10 +1417,10 @@ class tt {
|
|
|
1417
1417
|
withoutSelection: a = !1
|
|
1418
1418
|
} = t;
|
|
1419
1419
|
if (!e) return null;
|
|
1420
|
-
const { canvas: r, montageArea: c, transformManager: h, historyManager: l, errorManager:
|
|
1421
|
-
if (!this.isAllowedContentType(
|
|
1422
|
-
const p = `Неверный contentType для изображения: ${
|
|
1423
|
-
return
|
|
1420
|
+
const { canvas: r, montageArea: c, transformManager: h, historyManager: l, errorManager: u } = this.editor, g = yield this.getContentType(e), f = et.getFormatFromContentType(g), { acceptContentTypes: m, acceptFormats: y } = this;
|
|
1421
|
+
if (!this.isAllowedContentType(g)) {
|
|
1422
|
+
const p = `Неверный contentType для изображения: ${g}. Ожидается один из: ${this.acceptContentTypes.join(", ")}.`;
|
|
1423
|
+
return u.emitError({
|
|
1424
1424
|
origin: "ImageManager",
|
|
1425
1425
|
method: "importImage",
|
|
1426
1426
|
code: "INVALID_CONTENT_TYPE",
|
|
@@ -1428,7 +1428,7 @@ class tt {
|
|
|
1428
1428
|
data: {
|
|
1429
1429
|
source: e,
|
|
1430
1430
|
format: f,
|
|
1431
|
-
contentType:
|
|
1431
|
+
contentType: g,
|
|
1432
1432
|
acceptContentTypes: m,
|
|
1433
1433
|
acceptFormats: y,
|
|
1434
1434
|
fromClipboard: n,
|
|
@@ -1443,10 +1443,10 @@ class tt {
|
|
|
1443
1443
|
if (e instanceof File)
|
|
1444
1444
|
p = URL.createObjectURL(e);
|
|
1445
1445
|
else if (typeof e == "string") {
|
|
1446
|
-
const
|
|
1447
|
-
p = URL.createObjectURL(
|
|
1446
|
+
const S = yield (yield fetch(e, { mode: "cors" })).blob();
|
|
1447
|
+
p = URL.createObjectURL(S);
|
|
1448
1448
|
} else
|
|
1449
|
-
return
|
|
1449
|
+
return u.emitError({
|
|
1450
1450
|
origin: "ImageManager",
|
|
1451
1451
|
method: "importImage",
|
|
1452
1452
|
code: "INVALID_SOURCE_TYPE",
|
|
@@ -1454,7 +1454,7 @@ class tt {
|
|
|
1454
1454
|
data: {
|
|
1455
1455
|
source: e,
|
|
1456
1456
|
format: f,
|
|
1457
|
-
contentType:
|
|
1457
|
+
contentType: g,
|
|
1458
1458
|
acceptContentTypes: m,
|
|
1459
1459
|
acceptFormats: y,
|
|
1460
1460
|
fromClipboard: n,
|
|
@@ -1463,33 +1463,33 @@ class tt {
|
|
|
1463
1463
|
}
|
|
1464
1464
|
}), null;
|
|
1465
1465
|
if (this._createdBlobUrls.push(p), f === "svg") {
|
|
1466
|
-
const
|
|
1467
|
-
M =
|
|
1466
|
+
const v = yield _e(p);
|
|
1467
|
+
M = it.groupSVGElements(v.objects, v.options);
|
|
1468
1468
|
} else
|
|
1469
|
-
M = yield
|
|
1470
|
-
const { width:
|
|
1471
|
-
if (M instanceof
|
|
1472
|
-
const
|
|
1473
|
-
let
|
|
1474
|
-
if (
|
|
1475
|
-
const
|
|
1476
|
-
this._createdBlobUrls.push(
|
|
1477
|
-
} else if (
|
|
1478
|
-
const
|
|
1479
|
-
this._createdBlobUrls.push(
|
|
1469
|
+
M = yield Ot.fromURL(p, { crossOrigin: "anonymous" });
|
|
1470
|
+
const { width: b, height: A } = M;
|
|
1471
|
+
if (M instanceof Ot) {
|
|
1472
|
+
const v = M.getElement();
|
|
1473
|
+
let S = "";
|
|
1474
|
+
if (v instanceof HTMLImageElement ? S = v.src : v instanceof HTMLCanvasElement && (S = v.toDataURL()), A > lt || b > dt) {
|
|
1475
|
+
const L = yield this.resizeImageToBoundaries(S, "max"), B = URL.createObjectURL(L);
|
|
1476
|
+
this._createdBlobUrls.push(B), M = yield Ot.fromURL(B, { crossOrigin: "anonymous" });
|
|
1477
|
+
} else if (A < wt || b < bt) {
|
|
1478
|
+
const L = yield this.resizeImageToBoundaries(S, "min"), B = URL.createObjectURL(L);
|
|
1479
|
+
this._createdBlobUrls.push(B), M = yield Ot.fromURL(B, { crossOrigin: "anonymous" });
|
|
1480
1480
|
}
|
|
1481
1481
|
}
|
|
1482
|
-
if (M.set("id", `${M.type}-${
|
|
1482
|
+
if (M.set("id", `${M.type}-${P()}`), M.set("format", f), s === "scale-montage")
|
|
1483
1483
|
this.editor.canvasManager.scaleMontageAreaToImage({ object: M, withoutSave: !0 });
|
|
1484
1484
|
else {
|
|
1485
|
-
const { width:
|
|
1486
|
-
s === "image-contain" &&
|
|
1485
|
+
const { width: v, height: S } = c, L = this.calculateScaleFactor({ imageObject: M, scaleType: s });
|
|
1486
|
+
s === "image-contain" && L < 1 ? h.fitObject({ object: M, type: "contain", withoutSave: !0 }) : s === "image-cover" && (b > v || A > S) && h.fitObject({ object: M, type: "cover", withoutSave: !0 });
|
|
1487
1487
|
}
|
|
1488
1488
|
r.add(M), r.centerObject(M), a || r.setActiveObject(M), r.renderAll(), l.resumeHistory(), o || l.saveState();
|
|
1489
1489
|
const x = {
|
|
1490
1490
|
image: M,
|
|
1491
1491
|
format: f,
|
|
1492
|
-
contentType:
|
|
1492
|
+
contentType: g,
|
|
1493
1493
|
scale: s,
|
|
1494
1494
|
withoutSave: o,
|
|
1495
1495
|
source: e,
|
|
@@ -1499,7 +1499,7 @@ class tt {
|
|
|
1499
1499
|
};
|
|
1500
1500
|
return r.fire("editor:image-imported", x), x;
|
|
1501
1501
|
} catch (p) {
|
|
1502
|
-
return
|
|
1502
|
+
return u.emitError({
|
|
1503
1503
|
origin: "ImageManager",
|
|
1504
1504
|
method: "importImage",
|
|
1505
1505
|
code: "IMPORT_FAILED",
|
|
@@ -1507,7 +1507,7 @@ class tt {
|
|
|
1507
1507
|
data: {
|
|
1508
1508
|
source: e,
|
|
1509
1509
|
format: f,
|
|
1510
|
-
contentType:
|
|
1510
|
+
contentType: g,
|
|
1511
1511
|
scale: s,
|
|
1512
1512
|
withoutSave: o,
|
|
1513
1513
|
fromClipboard: n,
|
|
@@ -1527,16 +1527,16 @@ class tt {
|
|
|
1527
1527
|
* @returns возвращает Promise с Blob-объектом уменьшенного изображения
|
|
1528
1528
|
*/
|
|
1529
1529
|
resizeImageToBoundaries(t, e = "max") {
|
|
1530
|
-
return
|
|
1531
|
-
let s = `Размер изображения больше максимального размера канваса, поэтому оно будет уменьшено до максимальных размеров c сохранением пропорций: ${
|
|
1532
|
-
e === "min" && (s = `Размер изображения меньше минимального размера канваса, поэтому оно будет увеличено до минимальных размеров c сохранением пропорций: ${
|
|
1530
|
+
return O(this, null, function* () {
|
|
1531
|
+
let s = `Размер изображения больше максимального размера канваса, поэтому оно будет уменьшено до максимальных размеров c сохранением пропорций: ${dt}x${lt}`;
|
|
1532
|
+
e === "min" && (s = `Размер изображения меньше минимального размера канваса, поэтому оно будет увеличено до минимальных размеров c сохранением пропорций: ${bt}x${wt}`);
|
|
1533
1533
|
const o = {
|
|
1534
1534
|
dataURL: t,
|
|
1535
1535
|
sizeType: e,
|
|
1536
|
-
maxWidth:
|
|
1537
|
-
maxHeight:
|
|
1538
|
-
minWidth:
|
|
1539
|
-
minHeight:
|
|
1536
|
+
maxWidth: dt,
|
|
1537
|
+
maxHeight: lt,
|
|
1538
|
+
minWidth: bt,
|
|
1539
|
+
minHeight: wt
|
|
1540
1540
|
};
|
|
1541
1541
|
return this.editor.errorManager.emitWarning({
|
|
1542
1542
|
origin: "ImageManager",
|
|
@@ -1559,7 +1559,7 @@ class tt {
|
|
|
1559
1559
|
* @fires editor:canvas-exported
|
|
1560
1560
|
*/
|
|
1561
1561
|
exportCanvasAsImageFile() {
|
|
1562
|
-
return
|
|
1562
|
+
return O(this, arguments, function* (t = {}) {
|
|
1563
1563
|
const {
|
|
1564
1564
|
fileName: e = "image.png",
|
|
1565
1565
|
contentType: s = "image/png",
|
|
@@ -1567,22 +1567,22 @@ class tt {
|
|
|
1567
1567
|
exportAsBlob: n = !1
|
|
1568
1568
|
} = t, { canvas: i, montageArea: a, workerManager: r, interactionBlocker: c } = this.editor;
|
|
1569
1569
|
try {
|
|
1570
|
-
const h = s === "application/pdf", l = h ? "image/jpg" : s,
|
|
1570
|
+
const h = s === "application/pdf", l = h ? "image/jpg" : s, u = et.getFormatFromContentType(l);
|
|
1571
1571
|
a.setCoords();
|
|
1572
|
-
const { left:
|
|
1572
|
+
const { left: g, top: f, width: m, height: y } = a.getBoundingRect(), p = yield i.clone(["id", "format", "locked"]);
|
|
1573
1573
|
p.enableRetinaScaling = !1, ["image/jpg", "image/jpeg"].includes(l) && (p.backgroundColor = "#ffffff");
|
|
1574
|
-
const M = p.getObjects().find((
|
|
1574
|
+
const M = p.getObjects().find((I) => I.id === a.id);
|
|
1575
1575
|
if (M && (M.visible = !1), c != null && c.isBlocked) {
|
|
1576
|
-
const
|
|
1577
|
-
|
|
1576
|
+
const I = p.getObjects().find((_) => _.id === c.overlayMask.id);
|
|
1577
|
+
I && (I.visible = !1);
|
|
1578
1578
|
}
|
|
1579
|
-
p.viewportTransform = [1, 0, 0, 1, -
|
|
1580
|
-
const
|
|
1581
|
-
if (
|
|
1582
|
-
const
|
|
1579
|
+
p.viewportTransform = [1, 0, 0, 1, -g, -f], p.setDimensions({ width: m, height: y }, { backstoreOnly: !0 }), p.renderAll();
|
|
1580
|
+
const b = p.getObjects().filter((I) => I.format).every((I) => I.format === "svg");
|
|
1581
|
+
if (u === "svg" && b) {
|
|
1582
|
+
const I = p.toSVG();
|
|
1583
1583
|
p.dispose();
|
|
1584
|
-
const
|
|
1585
|
-
image:
|
|
1584
|
+
const z = {
|
|
1585
|
+
image: et._exportSVGStringAsFile(I, {
|
|
1586
1586
|
exportAsBase64: o,
|
|
1587
1587
|
exportAsBlob: n,
|
|
1588
1588
|
fileName: e
|
|
@@ -1591,66 +1591,66 @@ class tt {
|
|
|
1591
1591
|
contentType: "image/svg+xml",
|
|
1592
1592
|
fileName: e.replace(/\.[^/.]+$/, ".svg")
|
|
1593
1593
|
};
|
|
1594
|
-
return i.fire("editor:canvas-exported",
|
|
1594
|
+
return i.fire("editor:canvas-exported", z), z;
|
|
1595
1595
|
}
|
|
1596
|
-
const
|
|
1597
|
-
p.getElement().toBlob((
|
|
1598
|
-
|
|
1596
|
+
const A = yield new Promise((I, _) => {
|
|
1597
|
+
p.getElement().toBlob((z) => {
|
|
1598
|
+
z ? I(z) : _(new Error("Failed to create Blob from canvas"));
|
|
1599
1599
|
});
|
|
1600
1600
|
});
|
|
1601
1601
|
if (p.dispose(), n) {
|
|
1602
|
-
const
|
|
1603
|
-
image:
|
|
1604
|
-
format:
|
|
1602
|
+
const I = {
|
|
1603
|
+
image: A,
|
|
1604
|
+
format: u,
|
|
1605
1605
|
contentType: l,
|
|
1606
1606
|
fileName: e
|
|
1607
1607
|
};
|
|
1608
|
-
return i.fire("editor:canvas-exported",
|
|
1608
|
+
return i.fire("editor:canvas-exported", I), I;
|
|
1609
1609
|
}
|
|
1610
|
-
const x = yield createImageBitmap(
|
|
1610
|
+
const x = yield createImageBitmap(A), v = yield r.post(
|
|
1611
1611
|
"toDataURL",
|
|
1612
|
-
{ format:
|
|
1612
|
+
{ format: u, quality: 1, bitmap: x },
|
|
1613
1613
|
[x]
|
|
1614
1614
|
);
|
|
1615
1615
|
if (h) {
|
|
1616
|
-
const
|
|
1617
|
-
orientation:
|
|
1616
|
+
const _ = m * 0.264583, z = y * 0.264583, G = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, Z = new G({
|
|
1617
|
+
orientation: _ > z ? "landscape" : "portrait",
|
|
1618
1618
|
unit: "mm",
|
|
1619
|
-
format: [
|
|
1619
|
+
format: [_, z]
|
|
1620
1620
|
});
|
|
1621
|
-
if (
|
|
1622
|
-
const
|
|
1623
|
-
image:
|
|
1621
|
+
if (Z.addImage(String(v), "JPG", 0, 0, _, z), o) {
|
|
1622
|
+
const Y = {
|
|
1623
|
+
image: Z.output("datauristring"),
|
|
1624
1624
|
format: "pdf",
|
|
1625
1625
|
contentType: "application/pdf",
|
|
1626
1626
|
fileName: e
|
|
1627
1627
|
};
|
|
1628
|
-
return i.fire("editor:canvas-exported",
|
|
1628
|
+
return i.fire("editor:canvas-exported", Y), Y;
|
|
1629
1629
|
}
|
|
1630
|
-
const
|
|
1631
|
-
image: new File([
|
|
1630
|
+
const V = Z.output("blob"), C = {
|
|
1631
|
+
image: new File([V], e, { type: "application/pdf" }),
|
|
1632
1632
|
format: "pdf",
|
|
1633
1633
|
contentType: "application/pdf",
|
|
1634
1634
|
fileName: e
|
|
1635
1635
|
};
|
|
1636
|
-
return i.fire("editor:canvas-exported",
|
|
1636
|
+
return i.fire("editor:canvas-exported", C), C;
|
|
1637
1637
|
}
|
|
1638
1638
|
if (o) {
|
|
1639
|
-
const
|
|
1640
|
-
image:
|
|
1641
|
-
format:
|
|
1639
|
+
const I = {
|
|
1640
|
+
image: v,
|
|
1641
|
+
format: u,
|
|
1642
1642
|
contentType: l,
|
|
1643
1643
|
fileName: e
|
|
1644
1644
|
};
|
|
1645
|
-
return i.fire("editor:canvas-exported",
|
|
1645
|
+
return i.fire("editor:canvas-exported", I), I;
|
|
1646
1646
|
}
|
|
1647
|
-
const
|
|
1648
|
-
image: new File([
|
|
1649
|
-
format:
|
|
1647
|
+
const S = u === "svg" && !b ? e.replace(/\.[^/.]+$/, ".png") : e, B = {
|
|
1648
|
+
image: new File([A], S, { type: l }),
|
|
1649
|
+
format: u,
|
|
1650
1650
|
contentType: l,
|
|
1651
|
-
fileName:
|
|
1651
|
+
fileName: S
|
|
1652
1652
|
};
|
|
1653
|
-
return i.fire("editor:canvas-exported",
|
|
1653
|
+
return i.fire("editor:canvas-exported", B), B;
|
|
1654
1654
|
} catch (h) {
|
|
1655
1655
|
return this.editor.errorManager.emitError({
|
|
1656
1656
|
origin: "ImageManager",
|
|
@@ -1674,7 +1674,7 @@ class tt {
|
|
|
1674
1674
|
* @fires editor:object-exported
|
|
1675
1675
|
*/
|
|
1676
1676
|
exportObjectAsImageFile() {
|
|
1677
|
-
return
|
|
1677
|
+
return O(this, arguments, function* (t = {}) {
|
|
1678
1678
|
const {
|
|
1679
1679
|
object: e,
|
|
1680
1680
|
fileName: s = "image.png",
|
|
@@ -1691,9 +1691,9 @@ class tt {
|
|
|
1691
1691
|
data: { contentType: o, fileName: s, exportAsBase64: n, exportAsBlob: i }
|
|
1692
1692
|
}), null;
|
|
1693
1693
|
try {
|
|
1694
|
-
const h =
|
|
1694
|
+
const h = et.getFormatFromContentType(o);
|
|
1695
1695
|
if (h === "svg") {
|
|
1696
|
-
const m = c.toSVG(), y =
|
|
1696
|
+
const m = c.toSVG(), y = et._exportSVGStringAsFile(m, {
|
|
1697
1697
|
exportAsBase64: n,
|
|
1698
1698
|
exportAsBlob: i,
|
|
1699
1699
|
fileName: s
|
|
@@ -1706,7 +1706,7 @@ class tt {
|
|
|
1706
1706
|
};
|
|
1707
1707
|
return a.fire("editor:object-exported", p), p;
|
|
1708
1708
|
}
|
|
1709
|
-
if (n && c instanceof
|
|
1709
|
+
if (n && c instanceof Ot) {
|
|
1710
1710
|
const m = yield createImageBitmap(c.getElement()), y = yield r.post(
|
|
1711
1711
|
"toDataURL",
|
|
1712
1712
|
{
|
|
@@ -1726,7 +1726,7 @@ class tt {
|
|
|
1726
1726
|
}
|
|
1727
1727
|
const l = c.toCanvasElement({
|
|
1728
1728
|
enableRetinaScaling: !1
|
|
1729
|
-
}),
|
|
1729
|
+
}), u = yield new Promise((m, y) => {
|
|
1730
1730
|
l.toBlob((p) => {
|
|
1731
1731
|
p ? m(p) : y(new Error("Failed to create Blob from canvas"));
|
|
1732
1732
|
});
|
|
@@ -1734,16 +1734,16 @@ class tt {
|
|
|
1734
1734
|
if (i) {
|
|
1735
1735
|
const m = {
|
|
1736
1736
|
object: c,
|
|
1737
|
-
image:
|
|
1737
|
+
image: u,
|
|
1738
1738
|
format: h,
|
|
1739
1739
|
contentType: o,
|
|
1740
1740
|
fileName: s
|
|
1741
1741
|
};
|
|
1742
1742
|
return a.fire("editor:object-exported", m), m;
|
|
1743
1743
|
}
|
|
1744
|
-
const
|
|
1744
|
+
const g = new File([u], s, { type: o }), f = {
|
|
1745
1745
|
object: c,
|
|
1746
|
-
image:
|
|
1746
|
+
image: g,
|
|
1747
1747
|
format: h,
|
|
1748
1748
|
contentType: o,
|
|
1749
1749
|
fileName: s
|
|
@@ -1771,7 +1771,7 @@ class tt {
|
|
|
1771
1771
|
* @returns массив допустимых форматов изображений
|
|
1772
1772
|
*/
|
|
1773
1773
|
getAllowedFormatsFromContentTypes() {
|
|
1774
|
-
return this.acceptContentTypes.map((t) =>
|
|
1774
|
+
return this.acceptContentTypes.map((t) => et.getFormatFromContentType(t)).filter((t) => t);
|
|
1775
1775
|
}
|
|
1776
1776
|
/**
|
|
1777
1777
|
* Проверяет, является ли contentType допустимым типом изображения.
|
|
@@ -1787,7 +1787,7 @@ class tt {
|
|
|
1787
1787
|
* @public
|
|
1788
1788
|
*/
|
|
1789
1789
|
getContentType(t) {
|
|
1790
|
-
return
|
|
1790
|
+
return O(this, null, function* () {
|
|
1791
1791
|
return typeof t == "string" ? this.getContentTypeFromUrl(t) : t.type || "application/octet-stream";
|
|
1792
1792
|
});
|
|
1793
1793
|
}
|
|
@@ -1798,7 +1798,7 @@ class tt {
|
|
|
1798
1798
|
* @public
|
|
1799
1799
|
*/
|
|
1800
1800
|
getContentTypeFromUrl(t) {
|
|
1801
|
-
return
|
|
1801
|
+
return O(this, null, function* () {
|
|
1802
1802
|
if (t.startsWith("data:")) {
|
|
1803
1803
|
const e = t.match(/^data:([^;]+)/);
|
|
1804
1804
|
return e ? e[1] : "application/octet-stream";
|
|
@@ -1824,7 +1824,7 @@ class tt {
|
|
|
1824
1824
|
try {
|
|
1825
1825
|
const o = (e = new URL(t).pathname.split(".").pop()) == null ? void 0 : e.toLowerCase(), n = {};
|
|
1826
1826
|
return this.acceptContentTypes.forEach((i) => {
|
|
1827
|
-
const a =
|
|
1827
|
+
const a = et.getFormatFromContentType(i);
|
|
1828
1828
|
a && (n[a] = i);
|
|
1829
1829
|
}), o && n[o] || "application/octet-stream";
|
|
1830
1830
|
} catch (s) {
|
|
@@ -1877,11 +1877,11 @@ class tt {
|
|
|
1877
1877
|
return e ? e[1] : "";
|
|
1878
1878
|
}
|
|
1879
1879
|
}
|
|
1880
|
-
const
|
|
1881
|
-
function
|
|
1880
|
+
const mt = (d, t, e) => Math.max(Math.min(d, e), t), Ee = (d, t) => d * t, vs = (d, t) => new ht(d / 2, t / 2);
|
|
1881
|
+
function bs(d) {
|
|
1882
1882
|
return ((d == null ? void 0 : d.type) === "image" || (d == null ? void 0 : d.format) === "svg") && typeof (d == null ? void 0 : d.width) == "number" && typeof (d == null ? void 0 : d.height) == "number";
|
|
1883
1883
|
}
|
|
1884
|
-
class
|
|
1884
|
+
class ws {
|
|
1885
1885
|
/**
|
|
1886
1886
|
* @param options
|
|
1887
1887
|
* @param options.editor – экземпляр редактора
|
|
@@ -1912,14 +1912,14 @@ class Ms {
|
|
|
1912
1912
|
canvas: n,
|
|
1913
1913
|
montageArea: i,
|
|
1914
1914
|
options: { canvasBackstoreWidth: a }
|
|
1915
|
-
} = this.editor, { width: r, height: c } = i, h =
|
|
1915
|
+
} = this.editor, { width: r, height: c } = i, h = mt(Number(t), bt, dt);
|
|
1916
1916
|
if (!a || a === "auto" || o ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreWidth(Number(a)) : this.setCanvasBackstoreWidth(h), i.set({ width: h }), (f = n.clipPath) == null || f.set({ width: h }), e) {
|
|
1917
|
-
const m = h / r, y =
|
|
1917
|
+
const m = h / r, y = Ee(c, m);
|
|
1918
1918
|
this.setResolutionHeight(y);
|
|
1919
1919
|
return;
|
|
1920
1920
|
}
|
|
1921
|
-
const { left: l, top:
|
|
1922
|
-
n.setViewportTransform([
|
|
1921
|
+
const { left: l, top: u } = this.getObjectDefaultCoords(i), g = n.getZoom();
|
|
1922
|
+
n.setViewportTransform([g, 0, 0, g, l, u]), this.centerMontageArea(), s || this.editor.historyManager.saveState(), n.fire("editor:resolution-width-changed", {
|
|
1923
1923
|
width: h,
|
|
1924
1924
|
preserveProportional: e,
|
|
1925
1925
|
withoutSave: s,
|
|
@@ -1942,14 +1942,14 @@ class Ms {
|
|
|
1942
1942
|
canvas: n,
|
|
1943
1943
|
montageArea: i,
|
|
1944
1944
|
options: { canvasBackstoreHeight: a }
|
|
1945
|
-
} = this.editor, { width: r, height: c } = i, h =
|
|
1945
|
+
} = this.editor, { width: r, height: c } = i, h = mt(Number(t), wt, lt);
|
|
1946
1946
|
if (!a || a === "auto" || o ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreHeight(Number(a)) : this.setCanvasBackstoreHeight(h), i.set({ height: h }), (f = n.clipPath) == null || f.set({ height: h }), e) {
|
|
1947
|
-
const m = h / c, y =
|
|
1947
|
+
const m = h / c, y = Ee(r, m);
|
|
1948
1948
|
this.setResolutionWidth(y);
|
|
1949
1949
|
return;
|
|
1950
1950
|
}
|
|
1951
|
-
const { left: l, top:
|
|
1952
|
-
n.setViewportTransform([
|
|
1951
|
+
const { left: l, top: u } = this.getObjectDefaultCoords(i), g = n.getZoom();
|
|
1952
|
+
n.setViewportTransform([g, 0, 0, g, l, u]), this.centerMontageArea(), s || this.editor.historyManager.saveState(), n.fire("editor:resolution-height-changed", {
|
|
1953
1953
|
height: h,
|
|
1954
1954
|
preserveProportional: e,
|
|
1955
1955
|
withoutSave: s,
|
|
@@ -1962,7 +1962,7 @@ class Ms {
|
|
|
1962
1962
|
*/
|
|
1963
1963
|
centerMontageArea() {
|
|
1964
1964
|
var r;
|
|
1965
|
-
const { canvas: t, montageArea: e } = this.editor, s = t.getWidth(), o = t.getHeight(), n = t.getZoom(), i =
|
|
1965
|
+
const { canvas: t, montageArea: e } = this.editor, s = t.getWidth(), o = t.getHeight(), n = t.getZoom(), i = vs(s, o);
|
|
1966
1966
|
e.set({
|
|
1967
1967
|
left: s / 2,
|
|
1968
1968
|
top: o / 2
|
|
@@ -1995,7 +1995,7 @@ class Ms {
|
|
|
1995
1995
|
*/
|
|
1996
1996
|
setCanvasBackstoreWidth(t) {
|
|
1997
1997
|
if (!t || typeof t != "number") return;
|
|
1998
|
-
const e =
|
|
1998
|
+
const e = mt(t, bt, dt);
|
|
1999
1999
|
this.editor.canvas.setDimensions({ width: e }, { backstoreOnly: !0 });
|
|
2000
2000
|
}
|
|
2001
2001
|
/**
|
|
@@ -2004,7 +2004,7 @@ class Ms {
|
|
|
2004
2004
|
*/
|
|
2005
2005
|
setCanvasBackstoreHeight(t) {
|
|
2006
2006
|
if (!t || typeof t != "number") return;
|
|
2007
|
-
const e =
|
|
2007
|
+
const e = mt(t, wt, lt);
|
|
2008
2008
|
this.editor.canvas.setDimensions({ height: e }, { backstoreOnly: !0 });
|
|
2009
2009
|
}
|
|
2010
2010
|
/**
|
|
@@ -2013,7 +2013,7 @@ class Ms {
|
|
|
2013
2013
|
* с учётом минимальных и максимальных значений.
|
|
2014
2014
|
*/
|
|
2015
2015
|
adaptCanvasToContainer() {
|
|
2016
|
-
const { canvas: t } = this.editor, e = this.getEditorContainer(), s = e.clientWidth, o = e.clientHeight, n =
|
|
2016
|
+
const { canvas: t } = this.editor, e = this.getEditorContainer(), s = e.clientWidth, o = e.clientHeight, n = mt(s, bt, dt), i = mt(o, wt, lt);
|
|
2017
2017
|
t.setDimensions({ width: n, height: i }, { backstoreOnly: !0 });
|
|
2018
2018
|
}
|
|
2019
2019
|
/**
|
|
@@ -2047,7 +2047,7 @@ class Ms {
|
|
|
2047
2047
|
if (h.length === 1)
|
|
2048
2048
|
t.setActiveObject(h[0]);
|
|
2049
2049
|
else {
|
|
2050
|
-
const l = new
|
|
2050
|
+
const l = new U(h, {
|
|
2051
2051
|
canvas: t
|
|
2052
2052
|
});
|
|
2053
2053
|
t.setActiveObject(l);
|
|
@@ -2213,20 +2213,20 @@ class Ms {
|
|
|
2213
2213
|
montageAreaHeight: r
|
|
2214
2214
|
}
|
|
2215
2215
|
} = this.editor, c = t || o.getActiveObject();
|
|
2216
|
-
if (!
|
|
2216
|
+
if (!bs(c)) return;
|
|
2217
2217
|
const { width: h, height: l } = c;
|
|
2218
|
-
let
|
|
2218
|
+
let u = Math.min(h, dt), g = Math.min(l, lt);
|
|
2219
2219
|
if (e) {
|
|
2220
2220
|
const {
|
|
2221
2221
|
width: f,
|
|
2222
2222
|
height: m
|
|
2223
2223
|
} = n, y = h / f, p = l / m, M = Math.max(y, p);
|
|
2224
|
-
|
|
2224
|
+
u = f * M, g = m * M;
|
|
2225
2225
|
}
|
|
2226
|
-
this.setResolutionWidth(
|
|
2226
|
+
this.setResolutionWidth(u, { withoutSave: !0 }), this.setResolutionHeight(g, { withoutSave: !0 }), this.editor.backgroundManager.backgroundObject && this.editor.backgroundManager.refresh(), (h > a || l > r) && this.editor.zoomManager.calculateAndApplyDefaultZoom(), i.resetObject({ object: c, withoutSave: !0 }), o.centerObject(c), o.renderAll(), s || this.editor.historyManager.saveState(), o.fire("editor:montage-area-scaled-to-image", {
|
|
2227
2227
|
object: c,
|
|
2228
|
-
width:
|
|
2229
|
-
height:
|
|
2228
|
+
width: u,
|
|
2229
|
+
height: g,
|
|
2230
2230
|
preserveAspectRatio: e,
|
|
2231
2231
|
withoutSave: s
|
|
2232
2232
|
});
|
|
@@ -2273,7 +2273,7 @@ class Ms {
|
|
|
2273
2273
|
);
|
|
2274
2274
|
}
|
|
2275
2275
|
}
|
|
2276
|
-
class
|
|
2276
|
+
class js {
|
|
2277
2277
|
constructor({ editor: t }) {
|
|
2278
2278
|
this.editor = t, this.options = t.options;
|
|
2279
2279
|
}
|
|
@@ -2284,7 +2284,7 @@ class bs {
|
|
|
2284
2284
|
* @param options.withoutSave - Не сохранять состояние
|
|
2285
2285
|
* @fires editor:object-rotated
|
|
2286
2286
|
*/
|
|
2287
|
-
rotate(t =
|
|
2287
|
+
rotate(t = ys, { withoutSave: e } = {}) {
|
|
2288
2288
|
const { canvas: s, historyManager: o } = this.editor, n = s.getActiveObject();
|
|
2289
2289
|
if (!n) return;
|
|
2290
2290
|
const i = n.angle + t;
|
|
@@ -2334,7 +2334,7 @@ class bs {
|
|
|
2334
2334
|
withoutSave: s
|
|
2335
2335
|
} = {}) {
|
|
2336
2336
|
const { canvas: o, historyManager: n } = this.editor, i = t || o.getActiveObject();
|
|
2337
|
-
i && (i instanceof
|
|
2337
|
+
i && (i instanceof U ? i.getObjects().forEach((a) => {
|
|
2338
2338
|
a.set("opacity", e);
|
|
2339
2339
|
}) : i.set("opacity", e), o.renderAll(), s || n.saveState(), o.fire("editor:object-opacity-changed", {
|
|
2340
2340
|
object: i,
|
|
@@ -2361,12 +2361,12 @@ class bs {
|
|
|
2361
2361
|
} = {}) {
|
|
2362
2362
|
const { canvas: n, historyManager: i } = this.editor, a = t || n.getActiveObject();
|
|
2363
2363
|
if (a) {
|
|
2364
|
-
if (a instanceof
|
|
2364
|
+
if (a instanceof U && !o) {
|
|
2365
2365
|
const r = a.getObjects();
|
|
2366
2366
|
n.discardActiveObject(), r.forEach((h) => {
|
|
2367
2367
|
this._fitSingleObject(h, e);
|
|
2368
2368
|
});
|
|
2369
|
-
const c = new
|
|
2369
|
+
const c = new U(r, { canvas: n });
|
|
2370
2370
|
n.setActiveObject(c);
|
|
2371
2371
|
} else
|
|
2372
2372
|
this._fitSingleObject(a, e);
|
|
@@ -2385,11 +2385,11 @@ class bs {
|
|
|
2385
2385
|
* @private
|
|
2386
2386
|
*/
|
|
2387
2387
|
_fitSingleObject(t, e) {
|
|
2388
|
-
const { canvas: s, montageArea: o } = this.editor, { width: n, height: i, scaleX: a = 1, scaleY: r = 1, angle: c = 0 } = t, h = n * Math.abs(a), l = i * Math.abs(r),
|
|
2389
|
-
let
|
|
2390
|
-
e === "contain" ?
|
|
2391
|
-
scaleX: a *
|
|
2392
|
-
scaleY: r *
|
|
2388
|
+
const { canvas: s, montageArea: o } = this.editor, { width: n, height: i, scaleX: a = 1, scaleY: r = 1, angle: c = 0 } = t, h = n * Math.abs(a), l = i * Math.abs(r), u = c * Math.PI / 180, g = Math.abs(Math.cos(u)), f = Math.abs(Math.sin(u)), m = h * g + l * f, y = h * f + l * g, p = o.width, M = o.height;
|
|
2389
|
+
let b;
|
|
2390
|
+
e === "contain" ? b = Math.min(p / m, M / y) : b = Math.max(p / m, M / y), t.set({
|
|
2391
|
+
scaleX: a * b,
|
|
2392
|
+
scaleY: r * b
|
|
2393
2393
|
}), s.centerObject(t);
|
|
2394
2394
|
}
|
|
2395
2395
|
/**
|
|
@@ -2426,11 +2426,11 @@ class bs {
|
|
|
2426
2426
|
}), e)
|
|
2427
2427
|
this.fitObject({ object: c, withoutSave: !0, fitAsOneObject: !0 });
|
|
2428
2428
|
else {
|
|
2429
|
-
const { width: l, height:
|
|
2429
|
+
const { width: l, height: u } = n, { width: g, height: f } = c, m = i.calculateScaleFactor({
|
|
2430
2430
|
imageObject: c,
|
|
2431
2431
|
scaleType: r
|
|
2432
2432
|
});
|
|
2433
|
-
r === "contain" && m < 1 || r === "cover" && (
|
|
2433
|
+
r === "contain" && m < 1 || r === "cover" && (g > l || f > u) ? this.fitObject({ object: c, withoutSave: !0, fitAsOneObject: !0 }) : c.set({ scaleX: 1, scaleY: 1 });
|
|
2434
2434
|
}
|
|
2435
2435
|
c.set({ flipX: !1, flipY: !1, angle: 0 }), o.centerObject(c), o.renderAll(), a.resumeHistory(), s || a.saveState(), o.fire("editor:object-reset", {
|
|
2436
2436
|
object: c,
|
|
@@ -2439,9 +2439,9 @@ class bs {
|
|
|
2439
2439
|
});
|
|
2440
2440
|
}
|
|
2441
2441
|
}
|
|
2442
|
-
class
|
|
2442
|
+
class As {
|
|
2443
2443
|
constructor({ editor: t }) {
|
|
2444
|
-
this.editor = t, this.options = t.options, this.minZoom = this.options.minZoom ||
|
|
2444
|
+
this.editor = t, this.options = t.options, this.minZoom = this.options.minZoom || ms, this.maxZoom = this.options.maxZoom || ps, this.defaultZoom = this.options.defaultScale;
|
|
2445
2445
|
}
|
|
2446
2446
|
/**
|
|
2447
2447
|
* Вспомогательный метод для вычисления размеров масштабированной монтажной области
|
|
@@ -2463,7 +2463,7 @@ class vs {
|
|
|
2463
2463
|
* @private
|
|
2464
2464
|
*/
|
|
2465
2465
|
_getClampedPointerCoordinates(t) {
|
|
2466
|
-
const { canvas: e, montageArea: s } = this.editor, o = e.getPointer(t, !0), n = e.viewportTransform, i = e.getZoom(), a = s.left - s.width / 2, r = s.left + s.width / 2, c = s.top - s.height / 2, h = s.top + s.height / 2, l = a * i + n[4],
|
|
2466
|
+
const { canvas: e, montageArea: s } = this.editor, o = e.getPointer(t, !0), n = e.viewportTransform, i = e.getZoom(), a = s.left - s.width / 2, r = s.left + s.width / 2, c = s.top - s.height / 2, h = s.top + s.height / 2, l = a * i + n[4], u = r * i + n[4], g = c * i + n[5], f = h * i + n[5], m = Math.max(l, Math.min(u, o.x)), y = Math.max(g, Math.min(f, o.y));
|
|
2467
2467
|
return {
|
|
2468
2468
|
x: m,
|
|
2469
2469
|
y
|
|
@@ -2498,10 +2498,10 @@ class vs {
|
|
|
2498
2498
|
* @private
|
|
2499
2499
|
*/
|
|
2500
2500
|
_calculateEmptySpaceRatio(t) {
|
|
2501
|
-
const { canvas: e, montageArea: s } = this.editor, o = e.viewportTransform, n = e.getWidth(), i = e.getHeight(), a = s.left - s.width / 2, r = s.left + s.width / 2, c = s.top - s.height / 2, h = s.top + s.height / 2, l = -o[4] / t,
|
|
2501
|
+
const { canvas: e, montageArea: s } = this.editor, o = e.viewportTransform, n = e.getWidth(), i = e.getHeight(), a = s.left - s.width / 2, r = s.left + s.width / 2, c = s.top - s.height / 2, h = s.top + s.height / 2, l = -o[4] / t, u = (-o[4] + n) / t, g = -o[5] / t, f = (-o[5] + i) / t, m = l < a, y = u > r, p = g < c, M = f > h;
|
|
2502
2502
|
if (!(m || y || p || M)) return 0;
|
|
2503
|
-
const
|
|
2504
|
-
return Math.max(
|
|
2503
|
+
const A = Math.max(0, a - l), x = Math.max(0, u - r), v = Math.max(0, c - g), S = Math.max(0, f - h), L = Math.max(A, x), B = Math.max(v, S), I = L / n, _ = B / i;
|
|
2504
|
+
return Math.max(I, _);
|
|
2505
2505
|
}
|
|
2506
2506
|
/**
|
|
2507
2507
|
* Вычисляет плавный шаг перемещения viewport к центру с ускорением
|
|
@@ -2514,11 +2514,11 @@ class vs {
|
|
|
2514
2514
|
* @private
|
|
2515
2515
|
*/
|
|
2516
2516
|
_calculateSmoothCenteringStep(t, e, s, o, n) {
|
|
2517
|
-
const { canvas: i, montageArea: a } = this.editor, r = i.viewportTransform, c = i.getWidth(), h = i.getHeight(), l = t.x - r[4],
|
|
2518
|
-
if (Math.abs(f) /
|
|
2519
|
-
return { x: l, y:
|
|
2520
|
-
const y = c / 2, p = h / 2, M = a.left,
|
|
2521
|
-
return { x:
|
|
2517
|
+
const { canvas: i, montageArea: a } = this.editor, r = i.viewportTransform, c = i.getWidth(), h = i.getHeight(), l = t.x - r[4], u = t.y - r[5], g = Math.abs(o), f = e - s;
|
|
2518
|
+
if (Math.abs(f) / g <= 0.1)
|
|
2519
|
+
return { x: l, y: u };
|
|
2520
|
+
const y = c / 2, p = h / 2, M = a.left, b = a.top, A = y - M * s, x = p - b * s, v = (A - r[4]) / (e - s), S = (x - r[5]) / (e - s), L = v * g, B = S * g, I = L * n, _ = B * n, z = Math.abs(I) > Math.abs(l) ? l : I, G = Math.abs(_) > Math.abs(u) ? u : _;
|
|
2521
|
+
return { x: z, y: G };
|
|
2522
2522
|
}
|
|
2523
2523
|
/**
|
|
2524
2524
|
* Применяет плавное центрирование viewport при приближении к defaultZoom.
|
|
@@ -2534,14 +2534,14 @@ class vs {
|
|
|
2534
2534
|
const { canvas: o } = this.editor, n = this._getScaledMontageDimensions(t), i = o.getWidth(), a = o.getHeight(), r = n.width > i || n.height > a, c = this._calculateFitZoom(), h = t - c;
|
|
2535
2535
|
if (!(!r || h) && !e)
|
|
2536
2536
|
return !1;
|
|
2537
|
-
const
|
|
2537
|
+
const u = o.viewportTransform, g = this._calculateTargetViewportPosition(t);
|
|
2538
2538
|
if (!r)
|
|
2539
|
-
return
|
|
2539
|
+
return u[4] = g.x, u[5] = g.y, o.setViewportTransform(u), !0;
|
|
2540
2540
|
if (e && !r) {
|
|
2541
2541
|
const f = this._calculateEmptySpaceRatio(t);
|
|
2542
2542
|
if (f > 0) {
|
|
2543
|
-
const m = this._calculateSmoothCenteringStep(
|
|
2544
|
-
return
|
|
2543
|
+
const m = this._calculateSmoothCenteringStep(g, t, c, s, f);
|
|
2544
|
+
return u[4] += m.x, u[5] += m.y, o.setViewportTransform(u), !0;
|
|
2545
2545
|
}
|
|
2546
2546
|
}
|
|
2547
2547
|
return !1;
|
|
@@ -2576,10 +2576,10 @@ class vs {
|
|
|
2576
2576
|
pointY: o.top
|
|
2577
2577
|
});
|
|
2578
2578
|
else {
|
|
2579
|
-
const
|
|
2579
|
+
const u = this._getClampedPointerCoordinates(e);
|
|
2580
2580
|
this.zoom(t, {
|
|
2581
|
-
pointX:
|
|
2582
|
-
pointY:
|
|
2581
|
+
pointX: u.x,
|
|
2582
|
+
pointY: u.y
|
|
2583
2583
|
});
|
|
2584
2584
|
}
|
|
2585
2585
|
return;
|
|
@@ -2606,14 +2606,14 @@ class vs {
|
|
|
2606
2606
|
* @fires editor:zoom-changed
|
|
2607
2607
|
*/
|
|
2608
2608
|
zoom(t = Ie, e = {}) {
|
|
2609
|
-
var
|
|
2609
|
+
var g, f;
|
|
2610
2610
|
if (!t) return;
|
|
2611
|
-
const { minZoom: s, maxZoom: o } = this, { canvas: n } = this.editor, i = t < 0, a = n.getZoom(), r = n.getCenterPoint(), c = (
|
|
2611
|
+
const { minZoom: s, maxZoom: o } = this, { canvas: n } = this.editor, i = t < 0, a = n.getZoom(), r = n.getCenterPoint(), c = (g = e.pointX) != null ? g : r.x, h = (f = e.pointY) != null ? f : r.y, l = new ht(c, h);
|
|
2612
2612
|
this.editor.montageArea.setCoords(), this.editor.canvas.requestRenderAll();
|
|
2613
|
-
let
|
|
2614
|
-
|
|
2613
|
+
let u = Number((a + Number(t)).toFixed(3));
|
|
2614
|
+
u > o && (u = o), u < s && (u = s), n.zoomToPoint(l, u), this.editor.panConstraintManager.updateBounds(), this._applyViewportCentering(u, i, t), n.fire("editor:zoom-changed", {
|
|
2615
2615
|
currentZoom: n.getZoom(),
|
|
2616
|
-
zoom:
|
|
2616
|
+
zoom: u,
|
|
2617
2617
|
point: l
|
|
2618
2618
|
});
|
|
2619
2619
|
}
|
|
@@ -2623,7 +2623,7 @@ class vs {
|
|
|
2623
2623
|
* @fires editor:zoom-changed
|
|
2624
2624
|
*/
|
|
2625
2625
|
setZoom(t = this.defaultZoom) {
|
|
2626
|
-
const { minZoom: e, maxZoom: s } = this, { canvas: o } = this.editor, n = new
|
|
2626
|
+
const { minZoom: e, maxZoom: s } = this, { canvas: o } = this.editor, n = new ht(o.getCenterPoint());
|
|
2627
2627
|
let i = t;
|
|
2628
2628
|
t > s && (i = s), t < e && (i = e), o.zoomToPoint(n, i), o.fire("editor:zoom-changed", {
|
|
2629
2629
|
currentZoom: o.getZoom(),
|
|
@@ -2636,14 +2636,14 @@ class vs {
|
|
|
2636
2636
|
* @fires editor:zoom-changed
|
|
2637
2637
|
*/
|
|
2638
2638
|
resetZoom() {
|
|
2639
|
-
const { canvas: t } = this.editor, e = new
|
|
2639
|
+
const { canvas: t } = this.editor, e = new ht(t.getCenterPoint());
|
|
2640
2640
|
t.zoomToPoint(e, this.defaultZoom), this.editor.canvas.fire("editor:zoom-changed", {
|
|
2641
2641
|
currentZoom: t.getZoom(),
|
|
2642
2642
|
point: e
|
|
2643
2643
|
}), this.editor.panConstraintManager.updateBounds();
|
|
2644
2644
|
}
|
|
2645
2645
|
}
|
|
2646
|
-
class
|
|
2646
|
+
class Ss {
|
|
2647
2647
|
constructor({ editor: t }) {
|
|
2648
2648
|
this.editor = t, this.isBlocked = !1, this.overlayMask = null, this._createOverlay();
|
|
2649
2649
|
}
|
|
@@ -2700,7 +2700,7 @@ class js {
|
|
|
2700
2700
|
}), t.upperCanvasEl.style.pointerEvents = "", t.lowerCanvasEl.style.pointerEvents = "", this.overlayMask.visible = !1, t.requestRenderAll(), t.fire("editor:enabled"), s.resumeHistory();
|
|
2701
2701
|
}
|
|
2702
2702
|
}
|
|
2703
|
-
class
|
|
2703
|
+
class Mt {
|
|
2704
2704
|
constructor({ editor: t }) {
|
|
2705
2705
|
this.editor = t, this.backgroundObject = null;
|
|
2706
2706
|
}
|
|
@@ -2725,7 +2725,7 @@ class pt {
|
|
|
2725
2725
|
}
|
|
2726
2726
|
i.set({
|
|
2727
2727
|
fill: t,
|
|
2728
|
-
backgroundId: `background-${
|
|
2728
|
+
backgroundId: `background-${P()}`
|
|
2729
2729
|
}), this.editor.canvas.requestRenderAll();
|
|
2730
2730
|
} else
|
|
2731
2731
|
this._removeCurrentBackground(), this._createColorBackground(t);
|
|
@@ -2755,14 +2755,14 @@ class pt {
|
|
|
2755
2755
|
try {
|
|
2756
2756
|
const { historyManager: n } = this.editor, { backgroundObject: i } = this;
|
|
2757
2757
|
if (n.suspendHistory(), i && i.backgroundType === "gradient") {
|
|
2758
|
-
const a =
|
|
2759
|
-
if (
|
|
2758
|
+
const a = Mt._createFabricGradient(t);
|
|
2759
|
+
if (Mt._isGradientEqual(i.fill, a)) {
|
|
2760
2760
|
n.resumeHistory();
|
|
2761
2761
|
return;
|
|
2762
2762
|
}
|
|
2763
2763
|
i.set({
|
|
2764
2764
|
fill: a,
|
|
2765
|
-
backgroundId: `background-${
|
|
2765
|
+
backgroundId: `background-${P()}`
|
|
2766
2766
|
}), this.editor.canvas.requestRenderAll();
|
|
2767
2767
|
} else
|
|
2768
2768
|
this._removeCurrentBackground(), this._createGradientBackground(t);
|
|
@@ -2843,7 +2843,7 @@ class pt {
|
|
|
2843
2843
|
* @param options.withoutSave - Если true, не сохранять состояние в историю
|
|
2844
2844
|
*/
|
|
2845
2845
|
setImageBackground(o) {
|
|
2846
|
-
return
|
|
2846
|
+
return O(this, arguments, function* ({
|
|
2847
2847
|
imageSource: t,
|
|
2848
2848
|
customData: e = {},
|
|
2849
2849
|
withoutSave: s = !1
|
|
@@ -2909,7 +2909,7 @@ class pt {
|
|
|
2909
2909
|
hasControls: !1,
|
|
2910
2910
|
id: "background",
|
|
2911
2911
|
backgroundType: "color",
|
|
2912
|
-
backgroundId: `background-${
|
|
2912
|
+
backgroundId: `background-${P()}`
|
|
2913
2913
|
}, { withoutSelection: !0 }), this.refresh();
|
|
2914
2914
|
}
|
|
2915
2915
|
/**
|
|
@@ -2926,9 +2926,9 @@ class pt {
|
|
|
2926
2926
|
hasControls: !1,
|
|
2927
2927
|
id: "background",
|
|
2928
2928
|
backgroundType: "gradient",
|
|
2929
|
-
backgroundId: `background-${
|
|
2929
|
+
backgroundId: `background-${P()}`
|
|
2930
2930
|
}, { withoutSelection: !0 }), this.refresh();
|
|
2931
|
-
const e =
|
|
2931
|
+
const e = Mt._createFabricGradient(t);
|
|
2932
2932
|
this.backgroundObject.set("fill", e), this.editor.canvas.requestRenderAll();
|
|
2933
2933
|
}
|
|
2934
2934
|
/**
|
|
@@ -2936,7 +2936,7 @@ class pt {
|
|
|
2936
2936
|
* @param source - источник изображения (URL или File)
|
|
2937
2937
|
*/
|
|
2938
2938
|
_createImageBackground(t, e) {
|
|
2939
|
-
return
|
|
2939
|
+
return O(this, null, function* () {
|
|
2940
2940
|
var o;
|
|
2941
2941
|
const { image: s } = (o = yield this.editor.imageManager.importImage({
|
|
2942
2942
|
source: t,
|
|
@@ -2954,7 +2954,7 @@ class pt {
|
|
|
2954
2954
|
hasControls: !1,
|
|
2955
2955
|
id: "background",
|
|
2956
2956
|
backgroundType: "image",
|
|
2957
|
-
backgroundId: `background-${
|
|
2957
|
+
backgroundId: `background-${P()}`,
|
|
2958
2958
|
customData: e
|
|
2959
2959
|
}), this._removeCurrentBackground(), this.backgroundObject = s, this.refresh();
|
|
2960
2960
|
});
|
|
@@ -2980,11 +2980,11 @@ class pt {
|
|
|
2980
2980
|
{ offset: n / 100, color: s }
|
|
2981
2981
|
];
|
|
2982
2982
|
if (t.type === "linear") {
|
|
2983
|
-
const l = t.angle * Math.PI / 180,
|
|
2984
|
-
return new
|
|
2983
|
+
const l = t.angle * Math.PI / 180, u = Mt._angleToCoords(l);
|
|
2984
|
+
return new ve({
|
|
2985
2985
|
type: "linear",
|
|
2986
2986
|
gradientUnits: "percentage",
|
|
2987
|
-
coords:
|
|
2987
|
+
coords: u,
|
|
2988
2988
|
colorStops: i
|
|
2989
2989
|
});
|
|
2990
2990
|
}
|
|
@@ -3000,7 +3000,7 @@ class pt {
|
|
|
3000
3000
|
r1: 0,
|
|
3001
3001
|
r2: c / 100
|
|
3002
3002
|
};
|
|
3003
|
-
return new
|
|
3003
|
+
return new ve({
|
|
3004
3004
|
type: "radial",
|
|
3005
3005
|
gradientUnits: "percentage",
|
|
3006
3006
|
coords: h,
|
|
@@ -3035,7 +3035,7 @@ class pt {
|
|
|
3035
3035
|
}) ? !1 : t.type === "linear" && e.type === "linear" ? Math.abs(t.coords.x1 - e.coords.x1) < 1e-4 && Math.abs(t.coords.y1 - e.coords.y1) < 1e-4 && Math.abs(t.coords.x2 - e.coords.x2) < 1e-4 && Math.abs(t.coords.y2 - e.coords.y2) < 1e-4 : t.type === "radial" && e.type === "radial" ? Math.abs(t.coords.x1 - e.coords.x1) < 1e-4 && Math.abs(t.coords.y1 - e.coords.y1) < 1e-4 && Math.abs(t.coords.x2 - e.coords.x2) < 1e-4 && Math.abs(t.coords.y2 - e.coords.y2) < 1e-4 && Math.abs(t.coords.r1 - e.coords.r1) < 1e-4 && Math.abs(t.coords.r2 - e.coords.r2) < 1e-4 : !1;
|
|
3036
3036
|
}
|
|
3037
3037
|
}
|
|
3038
|
-
class
|
|
3038
|
+
class Zt {
|
|
3039
3039
|
constructor({ editor: t }) {
|
|
3040
3040
|
this.editor = t;
|
|
3041
3041
|
}
|
|
@@ -3050,7 +3050,7 @@ class Vt {
|
|
|
3050
3050
|
const { canvas: s, historyManager: o } = this.editor;
|
|
3051
3051
|
o.suspendHistory();
|
|
3052
3052
|
const n = t || s.getActiveObject();
|
|
3053
|
-
n && (n instanceof
|
|
3053
|
+
n && (n instanceof U ? n.getObjects().forEach((i) => {
|
|
3054
3054
|
s.bringObjectToFront(i);
|
|
3055
3055
|
}) : s.bringObjectToFront(n), s.renderAll(), o.resumeHistory(), e || o.saveState(), s.fire("editor:object-bring-to-front", {
|
|
3056
3056
|
object: n,
|
|
@@ -3068,7 +3068,7 @@ class Vt {
|
|
|
3068
3068
|
const { canvas: s, historyManager: o } = this.editor;
|
|
3069
3069
|
o.suspendHistory();
|
|
3070
3070
|
const n = t || s.getActiveObject();
|
|
3071
|
-
n && (n instanceof
|
|
3071
|
+
n && (n instanceof U ? Zt._moveSelectionForward(s, n) : s.bringObjectForward(n), s.renderAll(), o.resumeHistory(), e || o.saveState(), s.fire("editor:object-bring-forward", {
|
|
3072
3072
|
object: n,
|
|
3073
3073
|
withoutSave: e
|
|
3074
3074
|
}));
|
|
@@ -3091,7 +3091,7 @@ class Vt {
|
|
|
3091
3091
|
n.suspendHistory();
|
|
3092
3092
|
const r = t || s.getActiveObject();
|
|
3093
3093
|
if (r) {
|
|
3094
|
-
if (r instanceof
|
|
3094
|
+
if (r instanceof U) {
|
|
3095
3095
|
const c = r.getObjects();
|
|
3096
3096
|
for (let h = c.length - 1; h >= 0; h -= 1)
|
|
3097
3097
|
s.sendObjectToBack(c[h]);
|
|
@@ -3119,7 +3119,7 @@ class Vt {
|
|
|
3119
3119
|
} = this.editor;
|
|
3120
3120
|
n.suspendHistory();
|
|
3121
3121
|
const r = t || s.getActiveObject();
|
|
3122
|
-
r && (r instanceof
|
|
3122
|
+
r && (r instanceof U ? Zt._moveSelectionBackwards(s, r) : s.sendObjectBackwards(r), a && s.sendObjectToBack(a), s.sendObjectToBack(o), i && s.sendObjectToBack(i), s.renderAll(), n.resumeHistory(), e || n.saveState(), s.fire("editor:object-send-backwards", {
|
|
3123
3123
|
object: r,
|
|
3124
3124
|
withoutSave: e
|
|
3125
3125
|
}));
|
|
@@ -3163,7 +3163,7 @@ class Vt {
|
|
|
3163
3163
|
});
|
|
3164
3164
|
}
|
|
3165
3165
|
}
|
|
3166
|
-
class
|
|
3166
|
+
class Is {
|
|
3167
3167
|
/**
|
|
3168
3168
|
* Менеджер фигур для редактора.
|
|
3169
3169
|
* @param options - Опции и настройки менеджера фигур.
|
|
@@ -3189,13 +3189,13 @@ class As {
|
|
|
3189
3189
|
*/
|
|
3190
3190
|
addRectangle(h = {}, { withoutSelection: r, withoutAdding: c } = {}) {
|
|
3191
3191
|
var l = h, {
|
|
3192
|
-
id: t = `rect-${
|
|
3192
|
+
id: t = `rect-${P()}`,
|
|
3193
3193
|
left: e,
|
|
3194
3194
|
top: s,
|
|
3195
3195
|
width: o = 100,
|
|
3196
3196
|
height: n = 100,
|
|
3197
3197
|
fill: i = "blue"
|
|
3198
|
-
} = l, a =
|
|
3198
|
+
} = l, a = rt(l, [
|
|
3199
3199
|
"id",
|
|
3200
3200
|
"left",
|
|
3201
3201
|
"top",
|
|
@@ -3203,7 +3203,7 @@ class As {
|
|
|
3203
3203
|
"height",
|
|
3204
3204
|
"fill"
|
|
3205
3205
|
]);
|
|
3206
|
-
const { canvas:
|
|
3206
|
+
const { canvas: u } = this.editor, g = new Ue(k({
|
|
3207
3207
|
id: t,
|
|
3208
3208
|
left: e,
|
|
3209
3209
|
top: s,
|
|
@@ -3211,7 +3211,7 @@ class As {
|
|
|
3211
3211
|
height: n,
|
|
3212
3212
|
fill: i
|
|
3213
3213
|
}, a));
|
|
3214
|
-
return !e && !s &&
|
|
3214
|
+
return !e && !s && u.centerObject(g), c || (u.add(g), r || u.setActiveObject(g), u.renderAll()), g;
|
|
3215
3215
|
}
|
|
3216
3216
|
/**
|
|
3217
3217
|
* Добавление круга
|
|
@@ -3231,26 +3231,26 @@ class As {
|
|
|
3231
3231
|
*/
|
|
3232
3232
|
addCircle(c = {}, { withoutSelection: a, withoutAdding: r } = {}) {
|
|
3233
3233
|
var h = c, {
|
|
3234
|
-
id: t = `circle-${
|
|
3234
|
+
id: t = `circle-${P()}`,
|
|
3235
3235
|
left: e,
|
|
3236
3236
|
top: s,
|
|
3237
3237
|
radius: o = 50,
|
|
3238
3238
|
fill: n = "green"
|
|
3239
|
-
} = h, i =
|
|
3239
|
+
} = h, i = rt(h, [
|
|
3240
3240
|
"id",
|
|
3241
3241
|
"left",
|
|
3242
3242
|
"top",
|
|
3243
3243
|
"radius",
|
|
3244
3244
|
"fill"
|
|
3245
3245
|
]);
|
|
3246
|
-
const { canvas: l } = this.editor,
|
|
3246
|
+
const { canvas: l } = this.editor, u = new ze(k({
|
|
3247
3247
|
id: t,
|
|
3248
3248
|
left: e,
|
|
3249
3249
|
top: s,
|
|
3250
3250
|
fill: n,
|
|
3251
3251
|
radius: o
|
|
3252
3252
|
}, i));
|
|
3253
|
-
return !e && !s && l.centerObject(
|
|
3253
|
+
return !e && !s && l.centerObject(u), r || (l.add(u), a || l.setActiveObject(u), l.renderAll()), u;
|
|
3254
3254
|
}
|
|
3255
3255
|
/**
|
|
3256
3256
|
* Добавление треугольника
|
|
@@ -3271,13 +3271,13 @@ class As {
|
|
|
3271
3271
|
*/
|
|
3272
3272
|
addTriangle(h = {}, { withoutSelection: r, withoutAdding: c } = {}) {
|
|
3273
3273
|
var l = h, {
|
|
3274
|
-
id: t = `triangle-${
|
|
3274
|
+
id: t = `triangle-${P()}`,
|
|
3275
3275
|
left: e,
|
|
3276
3276
|
top: s,
|
|
3277
3277
|
width: o = 100,
|
|
3278
3278
|
height: n = 100,
|
|
3279
3279
|
fill: i = "yellow"
|
|
3280
|
-
} = l, a =
|
|
3280
|
+
} = l, a = rt(l, [
|
|
3281
3281
|
"id",
|
|
3282
3282
|
"left",
|
|
3283
3283
|
"top",
|
|
@@ -3285,7 +3285,7 @@ class As {
|
|
|
3285
3285
|
"height",
|
|
3286
3286
|
"fill"
|
|
3287
3287
|
]);
|
|
3288
|
-
const { canvas:
|
|
3288
|
+
const { canvas: u } = this.editor, g = new Ye(k({
|
|
3289
3289
|
id: t,
|
|
3290
3290
|
left: e,
|
|
3291
3291
|
top: s,
|
|
@@ -3293,10 +3293,10 @@ class As {
|
|
|
3293
3293
|
width: o,
|
|
3294
3294
|
height: n
|
|
3295
3295
|
}, a));
|
|
3296
|
-
return !e && !s &&
|
|
3296
|
+
return !e && !s && u.centerObject(g), c || (u.add(g), r || u.setActiveObject(g), u.renderAll()), g;
|
|
3297
3297
|
}
|
|
3298
3298
|
}
|
|
3299
|
-
class
|
|
3299
|
+
class Cs {
|
|
3300
3300
|
/**
|
|
3301
3301
|
* @param options
|
|
3302
3302
|
* @param options.editor - экземпляр редактора с доступом к canvas
|
|
@@ -3324,10 +3324,10 @@ class Is {
|
|
|
3324
3324
|
* Асинхронное клонирование для внутреннего буфера
|
|
3325
3325
|
*/
|
|
3326
3326
|
_cloneToInternalClipboard(t) {
|
|
3327
|
-
return
|
|
3327
|
+
return O(this, null, function* () {
|
|
3328
3328
|
const { canvas: e, errorManager: s } = this.editor;
|
|
3329
3329
|
try {
|
|
3330
|
-
const o = yield t.clone(
|
|
3330
|
+
const o = yield t.clone(Pt);
|
|
3331
3331
|
this.clipboard = o, e.fire("editor:object-copied", { object: o });
|
|
3332
3332
|
} catch (o) {
|
|
3333
3333
|
s.emitError({
|
|
@@ -3344,7 +3344,7 @@ class Is {
|
|
|
3344
3344
|
* Копирование в системный буфер обмена
|
|
3345
3345
|
*/
|
|
3346
3346
|
_copyToSystemClipboard(t) {
|
|
3347
|
-
return
|
|
3347
|
+
return O(this, null, function* () {
|
|
3348
3348
|
const { errorManager: e } = this.editor;
|
|
3349
3349
|
if (typeof ClipboardItem == "undefined" || !navigator.clipboard)
|
|
3350
3350
|
return e.emitWarning({
|
|
@@ -3354,7 +3354,7 @@ class Is {
|
|
|
3354
3354
|
message: "navigator.clipboard не поддерживается в этом браузере или отсутствует HTTPS-соединение."
|
|
3355
3355
|
}), !1;
|
|
3356
3356
|
try {
|
|
3357
|
-
const s = t.toObject(
|
|
3357
|
+
const s = t.toObject(Pt), o = JSON.stringify(s);
|
|
3358
3358
|
return t.type === "image" ? this._copyImageToClipboard(t, o) : this._copyTextToClipboard(o);
|
|
3359
3359
|
} catch (s) {
|
|
3360
3360
|
return e.emitError({
|
|
@@ -3371,7 +3371,7 @@ class Is {
|
|
|
3371
3371
|
* Копирование изображения в буфер обмена
|
|
3372
3372
|
*/
|
|
3373
3373
|
_copyImageToClipboard(t, e) {
|
|
3374
|
-
return
|
|
3374
|
+
return O(this, null, function* () {
|
|
3375
3375
|
try {
|
|
3376
3376
|
const o = t.toCanvasElement({ enableRetinaScaling: !1 }).toDataURL(), n = o.slice(5).split(";")[0], i = o.split(",")[1], a = atob(i), r = new Uint8Array(a.length);
|
|
3377
3377
|
for (let l = 0; l < a.length; l += 1)
|
|
@@ -3393,7 +3393,7 @@ class Is {
|
|
|
3393
3393
|
* Копирование текста в буфер обмена
|
|
3394
3394
|
*/
|
|
3395
3395
|
_copyTextToClipboard(t) {
|
|
3396
|
-
return
|
|
3396
|
+
return O(this, null, function* () {
|
|
3397
3397
|
try {
|
|
3398
3398
|
const e = `${Ce}${t}`;
|
|
3399
3399
|
return yield navigator.clipboard.writeText(e), console.info("Text copied to clipboard successfully"), !0;
|
|
@@ -3415,7 +3415,7 @@ class Is {
|
|
|
3415
3415
|
*/
|
|
3416
3416
|
_addClonedObjectToCanvas(t) {
|
|
3417
3417
|
const { canvas: e, historyManager: s } = this.editor;
|
|
3418
|
-
if (e.discardActiveObject(), t instanceof
|
|
3418
|
+
if (e.discardActiveObject(), t instanceof U) {
|
|
3419
3419
|
s.suspendHistory(), t.canvas = e, t.forEachObject((o) => {
|
|
3420
3420
|
e.add(o);
|
|
3421
3421
|
}), e.setActiveObject(t), e.requestRenderAll(), s.resumeHistory(), s.saveState();
|
|
@@ -3428,7 +3428,7 @@ class Is {
|
|
|
3428
3428
|
* @param source - источник изображения (data URL или URL)
|
|
3429
3429
|
*/
|
|
3430
3430
|
_handleImageImport(t) {
|
|
3431
|
-
return
|
|
3431
|
+
return O(this, null, function* () {
|
|
3432
3432
|
var s;
|
|
3433
3433
|
const { image: e } = (s = yield this.editor.imageManager.importImage({
|
|
3434
3434
|
source: t,
|
|
@@ -3444,18 +3444,18 @@ class Is {
|
|
|
3444
3444
|
* @fires editor:object-pasted
|
|
3445
3445
|
*/
|
|
3446
3446
|
copyPaste(t) {
|
|
3447
|
-
return
|
|
3447
|
+
return O(this, null, function* () {
|
|
3448
3448
|
const { canvas: e } = this.editor, s = t || e.getActiveObject();
|
|
3449
3449
|
if (!s || s.locked) return !1;
|
|
3450
3450
|
try {
|
|
3451
|
-
const o = yield s.clone(
|
|
3452
|
-
return o instanceof
|
|
3451
|
+
const o = yield s.clone(Pt);
|
|
3452
|
+
return o instanceof U && o.forEachObject((n) => {
|
|
3453
3453
|
n.set({
|
|
3454
|
-
id: `${n.type}-${
|
|
3454
|
+
id: `${n.type}-${P()}`,
|
|
3455
3455
|
evented: !0
|
|
3456
3456
|
});
|
|
3457
3457
|
}), o.set({
|
|
3458
|
-
id: `${o.type}-${
|
|
3458
|
+
id: `${o.type}-${P()}`,
|
|
3459
3459
|
left: o.left + 10,
|
|
3460
3460
|
top: o.top + 10,
|
|
3461
3461
|
evented: !0
|
|
@@ -3479,7 +3479,7 @@ class Is {
|
|
|
3479
3479
|
* @param event.clipboardData.items — элементы буфера обмена
|
|
3480
3480
|
*/
|
|
3481
3481
|
handlePasteEvent(e) {
|
|
3482
|
-
return
|
|
3482
|
+
return O(this, arguments, function* ({ clipboardData: t }) {
|
|
3483
3483
|
var r;
|
|
3484
3484
|
if (!((r = t == null ? void 0 : t.items) != null && r.length)) {
|
|
3485
3485
|
this.paste();
|
|
@@ -3510,13 +3510,13 @@ class Is {
|
|
|
3510
3510
|
if (a) {
|
|
3511
3511
|
const l = new DOMParser().parseFromString(a, "text/html").querySelector("img");
|
|
3512
3512
|
if (l != null && l.src) {
|
|
3513
|
-
this._handleImageImport(l.src).catch((
|
|
3513
|
+
this._handleImageImport(l.src).catch((u) => {
|
|
3514
3514
|
this.editor.errorManager.emitError({
|
|
3515
3515
|
origin: "ClipboardManager",
|
|
3516
3516
|
method: "handlePasteEvent",
|
|
3517
3517
|
code: "PASTE_HTML_IMAGE_FAILED",
|
|
3518
3518
|
message: "Ошибка вставки изображения из HTML",
|
|
3519
|
-
data:
|
|
3519
|
+
data: u
|
|
3520
3520
|
});
|
|
3521
3521
|
});
|
|
3522
3522
|
return;
|
|
@@ -3530,18 +3530,18 @@ class Is {
|
|
|
3530
3530
|
* @fires editor:object-pasted
|
|
3531
3531
|
*/
|
|
3532
3532
|
paste() {
|
|
3533
|
-
return
|
|
3533
|
+
return O(this, null, function* () {
|
|
3534
3534
|
const { canvas: t } = this.editor;
|
|
3535
3535
|
if (!this.clipboard) return !1;
|
|
3536
3536
|
try {
|
|
3537
|
-
const e = yield this.clipboard.clone(
|
|
3538
|
-
return t.discardActiveObject(), e instanceof
|
|
3537
|
+
const e = yield this.clipboard.clone(Pt);
|
|
3538
|
+
return t.discardActiveObject(), e instanceof U && e.forEachObject((s) => {
|
|
3539
3539
|
s.set({
|
|
3540
|
-
id: `${s.type}-${
|
|
3540
|
+
id: `${s.type}-${P()}`,
|
|
3541
3541
|
evented: !0
|
|
3542
3542
|
});
|
|
3543
3543
|
}), e.set({
|
|
3544
|
-
id: `${e.type}-${
|
|
3544
|
+
id: `${e.type}-${P()}`,
|
|
3545
3545
|
left: e.left + 10,
|
|
3546
3546
|
top: e.top + 10,
|
|
3547
3547
|
evented: !0
|
|
@@ -3559,7 +3559,7 @@ class Is {
|
|
|
3559
3559
|
});
|
|
3560
3560
|
}
|
|
3561
3561
|
}
|
|
3562
|
-
class
|
|
3562
|
+
class Vt {
|
|
3563
3563
|
constructor({ editor: t }) {
|
|
3564
3564
|
this.editor = t;
|
|
3565
3565
|
}
|
|
@@ -3585,7 +3585,7 @@ class Gt {
|
|
|
3585
3585
|
editable: !1,
|
|
3586
3586
|
locked: !0
|
|
3587
3587
|
};
|
|
3588
|
-
i.set(a), !e &&
|
|
3588
|
+
i.set(a), !e && Vt._isGroupOrSelection(i) && i.getObjects().forEach((c) => {
|
|
3589
3589
|
c.set(a);
|
|
3590
3590
|
}), o.renderAll(), s || n.saveState(), o.fire("editor:object-locked", {
|
|
3591
3591
|
object: i,
|
|
@@ -3614,7 +3614,7 @@ class Gt {
|
|
|
3614
3614
|
editable: !0,
|
|
3615
3615
|
locked: !1
|
|
3616
3616
|
};
|
|
3617
|
-
n.set(i),
|
|
3617
|
+
n.set(i), Vt._isGroupOrSelection(n) && n.getObjects().forEach((a) => {
|
|
3618
3618
|
a.set(i);
|
|
3619
3619
|
}), s.renderAll(), e || o.saveState(), s.fire("editor:object-unlocked", {
|
|
3620
3620
|
object: n,
|
|
@@ -3622,10 +3622,10 @@ class Gt {
|
|
|
3622
3622
|
});
|
|
3623
3623
|
}
|
|
3624
3624
|
static _isGroupOrSelection(t) {
|
|
3625
|
-
return t instanceof
|
|
3625
|
+
return t instanceof U || t instanceof pt;
|
|
3626
3626
|
}
|
|
3627
3627
|
}
|
|
3628
|
-
class
|
|
3628
|
+
class Es {
|
|
3629
3629
|
constructor({ editor: t }) {
|
|
3630
3630
|
this.editor = t;
|
|
3631
3631
|
}
|
|
@@ -3637,7 +3637,7 @@ class Cs {
|
|
|
3637
3637
|
if (Array.isArray(t))
|
|
3638
3638
|
return t.length > 0 ? t : null;
|
|
3639
3639
|
const e = t || this.editor.canvas.getActiveObject();
|
|
3640
|
-
return !e || !(e instanceof
|
|
3640
|
+
return !e || !(e instanceof U) ? null : e.getObjects();
|
|
3641
3641
|
}
|
|
3642
3642
|
/**
|
|
3643
3643
|
* Получить группы для разгруппировки
|
|
@@ -3645,20 +3645,20 @@ class Cs {
|
|
|
3645
3645
|
*/
|
|
3646
3646
|
_getGroupsToUngroup(t) {
|
|
3647
3647
|
if (Array.isArray(t)) {
|
|
3648
|
-
const s = t.filter((o) => o instanceof
|
|
3648
|
+
const s = t.filter((o) => o instanceof pt);
|
|
3649
3649
|
return s.length > 0 ? s : null;
|
|
3650
3650
|
}
|
|
3651
|
-
if (t instanceof
|
|
3652
|
-
const s = t.getObjects().filter((o) => o instanceof
|
|
3651
|
+
if (t instanceof U) {
|
|
3652
|
+
const s = t.getObjects().filter((o) => o instanceof pt);
|
|
3653
3653
|
return s.length > 0 ? s : null;
|
|
3654
3654
|
}
|
|
3655
3655
|
const e = t || this.editor.canvas.getActiveObject();
|
|
3656
3656
|
if (!e) return null;
|
|
3657
|
-
if (e instanceof
|
|
3658
|
-
const s = e.getObjects().filter((o) => o instanceof
|
|
3657
|
+
if (e instanceof U) {
|
|
3658
|
+
const s = e.getObjects().filter((o) => o instanceof pt);
|
|
3659
3659
|
return s.length > 0 ? s : null;
|
|
3660
3660
|
}
|
|
3661
|
-
return e instanceof
|
|
3661
|
+
return e instanceof pt ? [e] : null;
|
|
3662
3662
|
}
|
|
3663
3663
|
/**
|
|
3664
3664
|
* Группировка объектов
|
|
@@ -3675,8 +3675,8 @@ class Cs {
|
|
|
3675
3675
|
if (!n) return null;
|
|
3676
3676
|
try {
|
|
3677
3677
|
o.suspendHistory();
|
|
3678
|
-
const i = new
|
|
3679
|
-
id: `group-${
|
|
3678
|
+
const i = new pt(n, {
|
|
3679
|
+
id: `group-${P()}`
|
|
3680
3680
|
});
|
|
3681
3681
|
n.forEach((r) => s.remove(r)), s.add(i), s.setActiveObject(i), s.requestRenderAll();
|
|
3682
3682
|
const a = {
|
|
@@ -3711,7 +3711,7 @@ class Cs {
|
|
|
3711
3711
|
s.add(l), i.push(l);
|
|
3712
3712
|
});
|
|
3713
3713
|
});
|
|
3714
|
-
const a = new
|
|
3714
|
+
const a = new U(i, {
|
|
3715
3715
|
canvas: s
|
|
3716
3716
|
});
|
|
3717
3717
|
s.setActiveObject(a), s.requestRenderAll();
|
|
@@ -3726,7 +3726,7 @@ class Cs {
|
|
|
3726
3726
|
}
|
|
3727
3727
|
}
|
|
3728
3728
|
}
|
|
3729
|
-
class
|
|
3729
|
+
class Ts {
|
|
3730
3730
|
constructor({ editor: t }) {
|
|
3731
3731
|
this.editor = t;
|
|
3732
3732
|
}
|
|
@@ -3737,11 +3737,11 @@ class Ss {
|
|
|
3737
3737
|
selectAll() {
|
|
3738
3738
|
const { canvas: t, canvasManager: e, objectLockManager: s } = this.editor;
|
|
3739
3739
|
t.discardActiveObject();
|
|
3740
|
-
const o = e.getObjects(), n = o.some((a) => a.locked), i = o.length > 1 ? new
|
|
3740
|
+
const o = e.getObjects(), n = o.some((a) => a.locked), i = o.length > 1 ? new U(e.getObjects(), { canvas: t }) : o[0];
|
|
3741
3741
|
n && s.lockObject({ object: i, skipInnerObjects: !0, withoutSave: !0 }), t.setActiveObject(i), t.requestRenderAll(), t.fire("editor:all-objects-selected", { selected: i });
|
|
3742
3742
|
}
|
|
3743
3743
|
}
|
|
3744
|
-
class
|
|
3744
|
+
class de {
|
|
3745
3745
|
constructor({ editor: t }) {
|
|
3746
3746
|
this.editor = t;
|
|
3747
3747
|
}
|
|
@@ -3788,7 +3788,7 @@ class re {
|
|
|
3788
3788
|
s || n.suspendHistory();
|
|
3789
3789
|
const r = [];
|
|
3790
3790
|
if (a.forEach((h) => {
|
|
3791
|
-
if (
|
|
3791
|
+
if (de._isUngroupableGroup(h)) {
|
|
3792
3792
|
const l = this._handleGroupDeletion(h);
|
|
3793
3793
|
r.push(...l);
|
|
3794
3794
|
return;
|
|
@@ -3803,7 +3803,7 @@ class re {
|
|
|
3803
3803
|
return o.fire("editor:objects-deleted", c), c;
|
|
3804
3804
|
}
|
|
3805
3805
|
}
|
|
3806
|
-
const
|
|
3806
|
+
const ct = {
|
|
3807
3807
|
IMAGE_MANAGER: {
|
|
3808
3808
|
/**
|
|
3809
3809
|
* Некорректный Content-Type изображения
|
|
@@ -3908,7 +3908,7 @@ const at = {
|
|
|
3908
3908
|
APPLY_FAILED: "TEMPLATE_APPLY_FAILED"
|
|
3909
3909
|
}
|
|
3910
3910
|
};
|
|
3911
|
-
class
|
|
3911
|
+
class Nt {
|
|
3912
3912
|
constructor({ editor: t }) {
|
|
3913
3913
|
this._buffer = [], this.editor = t;
|
|
3914
3914
|
}
|
|
@@ -3935,7 +3935,7 @@ class Xt {
|
|
|
3935
3935
|
* @fires editor:error
|
|
3936
3936
|
*/
|
|
3937
3937
|
emitError({ origin: t = "ImageEditor", method: e = "Unknown Method", code: s, data: o, message: n }) {
|
|
3938
|
-
if (!
|
|
3938
|
+
if (!Nt.isValidErrorCode(s)) {
|
|
3939
3939
|
console.warn("Неизвестный код ошибки: ", { code: s, origin: t, method: e });
|
|
3940
3940
|
return;
|
|
3941
3941
|
}
|
|
@@ -3949,7 +3949,7 @@ class Xt {
|
|
|
3949
3949
|
message: i,
|
|
3950
3950
|
data: o
|
|
3951
3951
|
};
|
|
3952
|
-
this._buffer.push(
|
|
3952
|
+
this._buffer.push(k({
|
|
3953
3953
|
type: "editor:error"
|
|
3954
3954
|
}, a)), this.editor.canvas.fire("editor:error", a);
|
|
3955
3955
|
}
|
|
@@ -3964,7 +3964,7 @@ class Xt {
|
|
|
3964
3964
|
* @fires editor:warning
|
|
3965
3965
|
*/
|
|
3966
3966
|
emitWarning({ origin: t = "ImageEditor", method: e = "Unknown Method", code: s, message: o, data: n }) {
|
|
3967
|
-
if (!
|
|
3967
|
+
if (!Nt.isValidErrorCode(s)) {
|
|
3968
3968
|
console.warn("Неизвестный код предупреждения: ", { code: s, origin: t, method: e });
|
|
3969
3969
|
return;
|
|
3970
3970
|
}
|
|
@@ -3977,7 +3977,7 @@ class Xt {
|
|
|
3977
3977
|
message: i,
|
|
3978
3978
|
data: n
|
|
3979
3979
|
};
|
|
3980
|
-
this._buffer.push(
|
|
3980
|
+
this._buffer.push(k({
|
|
3981
3981
|
type: "editor:warning"
|
|
3982
3982
|
}, a)), this.editor.canvas.fire("editor:warning", a);
|
|
3983
3983
|
}
|
|
@@ -3987,10 +3987,10 @@ class Xt {
|
|
|
3987
3987
|
* @returns true, если код допустим, иначе false
|
|
3988
3988
|
*/
|
|
3989
3989
|
static isValidErrorCode(t) {
|
|
3990
|
-
return t ? Object.values(
|
|
3990
|
+
return t ? Object.values(ct).some((e) => Object.values(e).includes(t)) : !1;
|
|
3991
3991
|
}
|
|
3992
3992
|
}
|
|
3993
|
-
class
|
|
3993
|
+
class Os {
|
|
3994
3994
|
constructor({ editor: t }) {
|
|
3995
3995
|
this.currentBounds = null, this.editor = t;
|
|
3996
3996
|
}
|
|
@@ -4040,13 +4040,13 @@ class ws {
|
|
|
4040
4040
|
constrainPan(t, e) {
|
|
4041
4041
|
if (!this.currentBounds || !this.currentBounds.canPan)
|
|
4042
4042
|
return { x: 0, y: 0 };
|
|
4043
|
-
const { canvas: s, montageArea: o } = this.editor, n = s.getZoom(), i = o.left, a = o.top, r = s.getWidth() / 2, c = s.getHeight() / 2, h = i * n + t - r, l = a * n + e - c,
|
|
4043
|
+
const { canvas: s, montageArea: o } = this.editor, n = s.getZoom(), i = o.left, a = o.top, r = s.getWidth() / 2, c = s.getHeight() / 2, h = i * n + t - r, l = a * n + e - c, u = Math.max(
|
|
4044
4044
|
this.currentBounds.minX,
|
|
4045
4045
|
Math.min(this.currentBounds.maxX, h)
|
|
4046
|
-
),
|
|
4046
|
+
), g = Math.max(
|
|
4047
4047
|
this.currentBounds.minY,
|
|
4048
4048
|
Math.min(this.currentBounds.maxY, l)
|
|
4049
|
-
), f =
|
|
4049
|
+
), f = u + r - i * n, m = g + c - a * n;
|
|
4050
4050
|
return {
|
|
4051
4051
|
x: f,
|
|
4052
4052
|
y: m
|
|
@@ -4075,14 +4075,14 @@ class ws {
|
|
|
4075
4075
|
this.currentBounds = this.calculatePanBounds();
|
|
4076
4076
|
}
|
|
4077
4077
|
}
|
|
4078
|
-
const
|
|
4078
|
+
const q = ({
|
|
4079
|
+
value: d,
|
|
4080
|
+
min: t,
|
|
4081
|
+
max: e
|
|
4082
|
+
}) => Math.min(Math.max(d, t), e), vt = class vt extends st {
|
|
4079
4083
|
constructor(t, e = {}) {
|
|
4080
4084
|
var s, o, n, i, a, r, c, h, l;
|
|
4081
|
-
super(t, e), this.
|
|
4082
|
-
id: this.id,
|
|
4083
|
-
text: t,
|
|
4084
|
-
options: e
|
|
4085
|
-
}), this.backgroundOpacity = (s = e.backgroundOpacity) != null ? s : 1, this.paddingTop = (o = e.paddingTop) != null ? o : 0, this.paddingRight = (n = e.paddingRight) != null ? n : 0, this.paddingBottom = (i = e.paddingBottom) != null ? i : 0, this.paddingLeft = (a = e.paddingLeft) != null ? a : 0, this.radiusTopLeft = (r = e.radiusTopLeft) != null ? r : 0, this.radiusTopRight = (c = e.radiusTopRight) != null ? c : 0, this.radiusBottomRight = (h = e.radiusBottomRight) != null ? h : 0, this.radiusBottomLeft = (l = e.radiusBottomLeft) != null ? l : 0;
|
|
4085
|
+
super(t, e), this.backgroundOpacity = (s = e.backgroundOpacity) != null ? s : 1, this.paddingTop = (o = e.paddingTop) != null ? o : 0, this.paddingRight = (n = e.paddingRight) != null ? n : 0, this.paddingBottom = (i = e.paddingBottom) != null ? i : 0, this.paddingLeft = (a = e.paddingLeft) != null ? a : 0, this.radiusTopLeft = (r = e.radiusTopLeft) != null ? r : 0, this.radiusTopRight = (c = e.radiusTopRight) != null ? c : 0, this.radiusBottomRight = (h = e.radiusBottomRight) != null ? h : 0, this.radiusBottomLeft = (l = e.radiusBottomLeft) != null ? l : 0;
|
|
4086
4086
|
}
|
|
4087
4087
|
_getLeftOffset() {
|
|
4088
4088
|
const { width: t } = this._getBackgroundDimensions(), { left: e } = this._getPadding();
|
|
@@ -4094,11 +4094,11 @@ const J = ({ value: d, min: t, max: e }) => Math.min(Math.max(d, t), e), yt = cl
|
|
|
4094
4094
|
}
|
|
4095
4095
|
_getNonTransformedDimensions() {
|
|
4096
4096
|
const { width: t, height: e } = this._getBackgroundDimensions();
|
|
4097
|
-
return new
|
|
4097
|
+
return new ht(t, e).scalarAdd(this.strokeWidth);
|
|
4098
4098
|
}
|
|
4099
4099
|
_getTransformedDimensions(t = {}) {
|
|
4100
4100
|
const { width: e, height: s } = this._getBackgroundDimensions();
|
|
4101
|
-
return super._getTransformedDimensions(
|
|
4101
|
+
return super._getTransformedDimensions(Tt(k({}, t), {
|
|
4102
4102
|
width: e,
|
|
4103
4103
|
height: s
|
|
4104
4104
|
}));
|
|
@@ -4106,35 +4106,14 @@ const J = ({ value: d, min: t, max: e }) => Math.min(Math.max(d, t), e), yt = cl
|
|
|
4106
4106
|
_renderBackground(t) {
|
|
4107
4107
|
var s, o;
|
|
4108
4108
|
const e = this._getEffectiveBackgroundFill();
|
|
4109
|
-
if (
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
backgroundColor: this.backgroundColor,
|
|
4113
|
-
backgroundOpacity: this.backgroundOpacity
|
|
4114
|
-
});
|
|
4115
|
-
return;
|
|
4116
|
-
}
|
|
4117
|
-
if (e) {
|
|
4118
|
-
const n = this._getPadding(), i = (s = this.width) != null ? s : 0, a = (o = this.height) != null ? o : 0, r = i + n.left + n.right, c = a + n.top + n.bottom, h = this._getCornerRadii({ width: r, height: c }), l = this._getLeftOffset() - n.left, g = this._getTopOffset() - n.top;
|
|
4119
|
-
console.log("[BackgroundTextbox] draw background", {
|
|
4120
|
-
id: this.id,
|
|
4121
|
-
fill: e,
|
|
4122
|
-
padding: n,
|
|
4123
|
-
radii: h,
|
|
4124
|
-
textWidth: i,
|
|
4125
|
-
textHeight: a,
|
|
4126
|
-
width: r,
|
|
4127
|
-
height: c,
|
|
4128
|
-
startX: l,
|
|
4129
|
-
startY: g,
|
|
4130
|
-
opacity: this.opacity,
|
|
4131
|
-
backgroundOpacity: this.backgroundOpacity
|
|
4132
|
-
}), t.save(), yt._renderRoundedRect({
|
|
4109
|
+
if (e && e) {
|
|
4110
|
+
const n = this._getPadding(), i = (s = this.width) != null ? s : 0, a = (o = this.height) != null ? o : 0, r = i + n.left + n.right, c = a + n.top + n.bottom, h = this._getCornerRadii({ width: r, height: c }), l = this._getLeftOffset() - n.left, u = this._getTopOffset() - n.top;
|
|
4111
|
+
t.save(), vt._renderRoundedRect({
|
|
4133
4112
|
ctx: t,
|
|
4134
4113
|
height: c,
|
|
4135
4114
|
left: l,
|
|
4136
4115
|
radii: h,
|
|
4137
|
-
top:
|
|
4116
|
+
top: u,
|
|
4138
4117
|
width: r
|
|
4139
4118
|
}), t.fillStyle = e, t.fill(), t.restore();
|
|
4140
4119
|
}
|
|
@@ -4151,10 +4130,10 @@ const J = ({ value: d, min: t, max: e }) => Math.min(Math.max(d, t), e), yt = cl
|
|
|
4151
4130
|
var i, a, r, c;
|
|
4152
4131
|
const s = t / 2, o = e / 2, n = Math.min(s, o);
|
|
4153
4132
|
return {
|
|
4154
|
-
bottomLeft:
|
|
4155
|
-
bottomRight:
|
|
4156
|
-
topLeft:
|
|
4157
|
-
topRight:
|
|
4133
|
+
bottomLeft: q({ value: (i = this.radiusBottomLeft) != null ? i : 0, min: 0, max: n }),
|
|
4134
|
+
bottomRight: q({ value: (a = this.radiusBottomRight) != null ? a : 0, min: 0, max: n }),
|
|
4135
|
+
topLeft: q({ value: (r = this.radiusTopLeft) != null ? r : 0, min: 0, max: n }),
|
|
4136
|
+
topRight: q({ value: (c = this.radiusTopRight) != null ? c : 0, min: 0, max: n })
|
|
4158
4137
|
};
|
|
4159
4138
|
}
|
|
4160
4139
|
_getPadding() {
|
|
@@ -4170,12 +4149,18 @@ const J = ({ value: d, min: t, max: e }) => Math.min(Math.max(d, t), e), yt = cl
|
|
|
4170
4149
|
var o;
|
|
4171
4150
|
const t = this.backgroundColor;
|
|
4172
4151
|
if (!t) return null;
|
|
4173
|
-
const e =
|
|
4152
|
+
const e = q({ value: (o = this.backgroundOpacity) != null ? o : 1, min: 0, max: 1 });
|
|
4174
4153
|
let s;
|
|
4175
4154
|
try {
|
|
4176
|
-
s = new
|
|
4155
|
+
s = new Pe(t);
|
|
4177
4156
|
} catch (n) {
|
|
4178
|
-
return
|
|
4157
|
+
return Nt.emitError({
|
|
4158
|
+
origin: "BackgroundTextbox",
|
|
4159
|
+
method: "_getEffectiveBackgroundFill",
|
|
4160
|
+
code: "INVALID_COLOR_VALUE",
|
|
4161
|
+
message: `Некорректное значение цвета фона: ${t}`,
|
|
4162
|
+
data: { color: t, error: n }
|
|
4163
|
+
}), null;
|
|
4179
4164
|
}
|
|
4180
4165
|
return s.setAlpha(e), s.toRgba();
|
|
4181
4166
|
}
|
|
@@ -4191,13 +4176,13 @@ const J = ({ value: d, min: t, max: e }) => Math.min(Math.max(d, t), e), yt = cl
|
|
|
4191
4176
|
topLeft: c,
|
|
4192
4177
|
topRight: h,
|
|
4193
4178
|
bottomRight: l,
|
|
4194
|
-
bottomLeft:
|
|
4195
|
-
} = o,
|
|
4196
|
-
t.beginPath(), t.moveTo(s +
|
|
4179
|
+
bottomLeft: u
|
|
4180
|
+
} = o, g = q({ value: c, min: 0, max: i }), f = q({ value: h, min: 0, max: i }), m = q({ value: l, min: 0, max: i }), y = q({ value: u, min: 0, max: i });
|
|
4181
|
+
t.beginPath(), t.moveTo(s + g, n), t.lineTo(a - f, n), t.quadraticCurveTo(a, n, a, n + f), t.lineTo(a, r - m), t.quadraticCurveTo(a, r, a - m, r), t.lineTo(s + y, r), t.quadraticCurveTo(s, r, s, r - y), t.lineTo(s, n + g), t.quadraticCurveTo(s, n, s + g, n), t.closePath();
|
|
4197
4182
|
}
|
|
4198
4183
|
};
|
|
4199
|
-
|
|
4200
|
-
...Array.isArray(
|
|
4184
|
+
vt.type = "background-textbox", vt.cacheProperties = [
|
|
4185
|
+
...Array.isArray(st.cacheProperties) ? st.cacheProperties : [],
|
|
4201
4186
|
"backgroundColor",
|
|
4202
4187
|
"backgroundOpacity",
|
|
4203
4188
|
"paddingTop",
|
|
@@ -4208,8 +4193,8 @@ yt.type = "background-textbox", yt.cacheProperties = [
|
|
|
4208
4193
|
"radiusTopRight",
|
|
4209
4194
|
"radiusBottomRight",
|
|
4210
4195
|
"radiusBottomLeft"
|
|
4211
|
-
],
|
|
4212
|
-
...Array.isArray(
|
|
4196
|
+
], vt.stateProperties = [
|
|
4197
|
+
...Array.isArray(st.stateProperties) ? st.stateProperties : [],
|
|
4213
4198
|
"backgroundColor",
|
|
4214
4199
|
"backgroundOpacity",
|
|
4215
4200
|
"paddingTop",
|
|
@@ -4221,11 +4206,11 @@ yt.type = "background-textbox", yt.cacheProperties = [
|
|
|
4221
4206
|
"radiusBottomRight",
|
|
4222
4207
|
"radiusBottomLeft"
|
|
4223
4208
|
];
|
|
4224
|
-
let
|
|
4225
|
-
const
|
|
4209
|
+
let Gt = vt;
|
|
4210
|
+
const Ds = () => {
|
|
4226
4211
|
var d;
|
|
4227
|
-
(d =
|
|
4228
|
-
},
|
|
4212
|
+
(d = be) != null && d.setClass && be.setClass(Gt, "background-textbox");
|
|
4213
|
+
}, Ls = ({ textbox: d }) => {
|
|
4229
4214
|
var s, o;
|
|
4230
4215
|
if (!d.isEditing) return null;
|
|
4231
4216
|
const t = (s = d.selectionStart) != null ? s : 0, e = (o = d.selectionEnd) != null ? o : t;
|
|
@@ -4233,16 +4218,16 @@ const Es = () => {
|
|
|
4233
4218
|
start: Math.min(t, e),
|
|
4234
4219
|
end: Math.max(t, e)
|
|
4235
4220
|
};
|
|
4236
|
-
},
|
|
4221
|
+
}, Ns = ({ textbox: d }) => {
|
|
4237
4222
|
var e, s;
|
|
4238
4223
|
const t = (s = (e = d.text) == null ? void 0 : e.length) != null ? s : 0;
|
|
4239
4224
|
return t <= 0 ? null : { start: 0, end: t };
|
|
4240
|
-
},
|
|
4225
|
+
}, ks = ({ textbox: d, range: t }) => {
|
|
4241
4226
|
var s, o;
|
|
4242
4227
|
if (!t) return !1;
|
|
4243
4228
|
const e = (o = (s = d.text) == null ? void 0 : s.length) != null ? o : 0;
|
|
4244
4229
|
return e <= 0 ? !1 : t.start <= 0 && t.end >= e;
|
|
4245
|
-
},
|
|
4230
|
+
}, Te = ({
|
|
4246
4231
|
textbox: d,
|
|
4247
4232
|
styles: t,
|
|
4248
4233
|
range: e
|
|
@@ -4250,7 +4235,7 @@ const Es = () => {
|
|
|
4250
4235
|
if (!t || !Object.keys(t).length) return !1;
|
|
4251
4236
|
const { start: s, end: o } = e;
|
|
4252
4237
|
return o <= s ? !1 : (d.setSelectionStyles(t, s, o), !0);
|
|
4253
|
-
},
|
|
4238
|
+
}, Oe = ({
|
|
4254
4239
|
textbox: d,
|
|
4255
4240
|
range: t,
|
|
4256
4241
|
property: e
|
|
@@ -4264,30 +4249,19 @@ const Es = () => {
|
|
|
4264
4249
|
);
|
|
4265
4250
|
if (s.length)
|
|
4266
4251
|
return (o = s[0]) == null ? void 0 : o[e];
|
|
4267
|
-
},
|
|
4252
|
+
}, De = ({ strokeColor: d, width: t }) => {
|
|
4268
4253
|
if (!(t <= 0))
|
|
4269
4254
|
return d != null ? d : "#000000";
|
|
4270
|
-
},
|
|
4271
|
-
class
|
|
4255
|
+
}, Le = ({ width: d = 0 }) => d ? Math.max(0, d) : 0, Kt = ({ value: d }) => typeof d == "string" ? d.toLocaleUpperCase() : "", K = 0.01;
|
|
4256
|
+
class Q {
|
|
4272
4257
|
constructor({ editor: t }) {
|
|
4273
4258
|
var e;
|
|
4274
4259
|
this._handleTextEditingEntered = () => {
|
|
4275
4260
|
this.isTextEditingActive = !0;
|
|
4276
|
-
}, this._handleTextChanged = (s) => {
|
|
4277
|
-
var r;
|
|
4278
|
-
const { target: o } = s;
|
|
4279
|
-
if (!K._isTextbox(o)) return;
|
|
4280
|
-
const n = (r = o.text) != null ? r : "", i = !!o.uppercase, a = n.toLocaleLowerCase();
|
|
4281
|
-
if (i) {
|
|
4282
|
-
const c = Qt({ value: a });
|
|
4283
|
-
c !== n && o.set({ text: c }), o.textCaseRaw = a;
|
|
4284
|
-
return;
|
|
4285
|
-
}
|
|
4286
|
-
o.textCaseRaw = n;
|
|
4287
4261
|
}, this._handleTextEditingExited = (s) => {
|
|
4288
4262
|
var a, r;
|
|
4289
4263
|
const { target: o } = s;
|
|
4290
|
-
if (!
|
|
4264
|
+
if (!Q._isTextbox(o)) return;
|
|
4291
4265
|
const n = (a = o.text) != null ? a : "";
|
|
4292
4266
|
if (!!o.uppercase) {
|
|
4293
4267
|
const c = (r = o.textCaseRaw) != null ? r : n.toLocaleLowerCase();
|
|
@@ -4299,11 +4273,11 @@ class K {
|
|
|
4299
4273
|
lockMovementY: !1
|
|
4300
4274
|
}), setTimeout(() => {
|
|
4301
4275
|
this.isTextEditingActive = !1, this.editor.historyManager.saveState();
|
|
4302
|
-
},
|
|
4276
|
+
}, Ms);
|
|
4303
4277
|
}, this._handleObjectScaling = (s) => {
|
|
4304
|
-
var
|
|
4278
|
+
var It, Ct, Et, W, Bt, _t, at, Ut, ft, he, ue, ge;
|
|
4305
4279
|
const { target: o, transform: n } = s;
|
|
4306
|
-
if (!
|
|
4280
|
+
if (!Q._isTextbox(o) || !n) return;
|
|
4307
4281
|
o.isScaling = !0;
|
|
4308
4282
|
const i = this._ensureScalingState(o), {
|
|
4309
4283
|
baseWidth: a,
|
|
@@ -4311,68 +4285,68 @@ class K {
|
|
|
4311
4285
|
baseFontSize: c,
|
|
4312
4286
|
basePadding: h,
|
|
4313
4287
|
baseRadii: l
|
|
4314
|
-
} = i,
|
|
4315
|
-
if (!M && !
|
|
4316
|
-
const x = Math.abs((
|
|
4317
|
-
paddingTop:
|
|
4318
|
-
paddingRight:
|
|
4319
|
-
paddingBottom:
|
|
4320
|
-
paddingLeft:
|
|
4321
|
-
radiusTopLeft:
|
|
4322
|
-
radiusTopRight:
|
|
4323
|
-
radiusBottomRight:
|
|
4324
|
-
radiusBottomLeft:
|
|
4325
|
-
fontSize:
|
|
4326
|
-
width:
|
|
4327
|
-
originX:
|
|
4328
|
-
} = o,
|
|
4329
|
-
top: Math.max(0, h.top *
|
|
4330
|
-
right: Math.max(0, h.right *
|
|
4331
|
-
bottom: Math.max(0, h.bottom *
|
|
4332
|
-
left: Math.max(0, h.left *
|
|
4333
|
-
} : h,
|
|
4334
|
-
topLeft: Math.max(0, l.topLeft *
|
|
4335
|
-
topRight: Math.max(0, l.topRight *
|
|
4336
|
-
bottomRight: Math.max(0, l.bottomRight *
|
|
4337
|
-
bottomLeft: Math.max(0, l.bottomLeft *
|
|
4338
|
-
} : l, jt = (
|
|
4339
|
-
if (!At && !
|
|
4288
|
+
} = i, u = typeof ((It = n.original) == null ? void 0 : It.width) == "number" ? n.original.width : void 0, g = typeof ((Ct = n.original) == null ? void 0 : Ct.left) == "number" ? n.original.left : void 0, f = u != null ? u : a, m = g != null ? g : r, y = (Et = n.corner) != null ? Et : "", p = (W = n.action) != null ? W : "", M = ["ml", "mr"].includes(y) || p === "scaleX", b = ["mt", "mb"].includes(y) || p === "scaleY", A = ["tl", "tr", "bl", "br"].includes(y) || p === "scale";
|
|
4289
|
+
if (!M && !b && !A) return;
|
|
4290
|
+
const x = Math.abs((_t = (Bt = o.scaleX) != null ? Bt : n.scaleX) != null ? _t : 1) || 1, v = Math.abs((Ut = (at = o.scaleY) != null ? at : n.scaleY) != null ? Ut : 1) || 1, S = Math.max(1, f * x), L = Math.max(1, c * v), {
|
|
4291
|
+
paddingTop: B = 0,
|
|
4292
|
+
paddingRight: I = 0,
|
|
4293
|
+
paddingBottom: _ = 0,
|
|
4294
|
+
paddingLeft: z = 0,
|
|
4295
|
+
radiusTopLeft: G = 0,
|
|
4296
|
+
radiusTopRight: Z = 0,
|
|
4297
|
+
radiusBottomRight: V = 0,
|
|
4298
|
+
radiusBottomLeft: X = 0,
|
|
4299
|
+
fontSize: C,
|
|
4300
|
+
width: T,
|
|
4301
|
+
originX: Y = "left"
|
|
4302
|
+
} = o, F = A || b, H = A || b, R = F ? {
|
|
4303
|
+
top: Math.max(0, h.top * v),
|
|
4304
|
+
right: Math.max(0, h.right * v),
|
|
4305
|
+
bottom: Math.max(0, h.bottom * v),
|
|
4306
|
+
left: Math.max(0, h.left * v)
|
|
4307
|
+
} : h, N = H ? {
|
|
4308
|
+
topLeft: Math.max(0, l.topLeft * v),
|
|
4309
|
+
topRight: Math.max(0, l.topRight * v),
|
|
4310
|
+
bottomRight: Math.max(0, l.bottomRight * v),
|
|
4311
|
+
bottomLeft: Math.max(0, l.bottomLeft * v)
|
|
4312
|
+
} : l, jt = (he = (ft = n.originX) != null ? ft : Y) != null ? he : "left", kt = m + f, Rt = m + f / 2, ut = T != null ? T : f, At = Math.abs(S - ut) > K, Xt = Math.abs(L - (C != null ? C : c)) > K, gt = Math.abs(R.top - B) > K || Math.abs(R.right - I) > K || Math.abs(R.bottom - _) > K || Math.abs(R.left - z) > K, xt = Math.abs(N.topLeft - G) > K || Math.abs(N.topRight - Z) > K || Math.abs(N.bottomRight - V) > K || Math.abs(N.bottomLeft - X) > K;
|
|
4313
|
+
if (!At && !Xt && !gt && !xt) {
|
|
4340
4314
|
o.set({ scaleX: 1, scaleY: 1 }), n.scaleX = 1, n.scaleY = 1;
|
|
4341
4315
|
return;
|
|
4342
4316
|
}
|
|
4343
4317
|
o.set({
|
|
4344
|
-
width:
|
|
4345
|
-
fontSize:
|
|
4346
|
-
paddingTop:
|
|
4347
|
-
paddingRight:
|
|
4348
|
-
paddingBottom:
|
|
4349
|
-
paddingLeft:
|
|
4350
|
-
radiusTopLeft:
|
|
4351
|
-
radiusTopRight:
|
|
4352
|
-
radiusBottomRight:
|
|
4353
|
-
radiusBottomLeft:
|
|
4318
|
+
width: S,
|
|
4319
|
+
fontSize: A || b ? L : c,
|
|
4320
|
+
paddingTop: R.top,
|
|
4321
|
+
paddingRight: R.right,
|
|
4322
|
+
paddingBottom: R.bottom,
|
|
4323
|
+
paddingLeft: R.left,
|
|
4324
|
+
radiusTopLeft: N.topLeft,
|
|
4325
|
+
radiusTopRight: N.topRight,
|
|
4326
|
+
radiusBottomRight: N.bottomRight,
|
|
4327
|
+
radiusBottomLeft: N.bottomLeft,
|
|
4354
4328
|
scaleX: 1,
|
|
4355
4329
|
scaleY: 1
|
|
4356
4330
|
});
|
|
4357
|
-
const
|
|
4358
|
-
let
|
|
4359
|
-
|
|
4360
|
-
const { original:
|
|
4361
|
-
|
|
4362
|
-
top:
|
|
4363
|
-
right:
|
|
4364
|
-
bottom:
|
|
4365
|
-
left:
|
|
4331
|
+
const ot = (ue = o.width) != null ? ue : S, St = Math.abs(ot - ut) > K;
|
|
4332
|
+
let nt = m;
|
|
4333
|
+
St && (M || A) && (jt === "right" ? nt = kt - ot : jt === "center" && (nt = Rt - ot / 2)), o.set({ left: nt }), i.baseLeft = nt, n.scaleX = 1, n.scaleY = 1;
|
|
4334
|
+
const { original: J } = n;
|
|
4335
|
+
J && (J.scaleX = 1, J.scaleY = 1, J.width = ot, J.height = o.height, J.left = nt), o.setCoords(), this.canvas.requestRenderAll(), i.baseWidth = ot, i.baseFontSize = (ge = o.fontSize) != null ? ge : L, i.basePadding = {
|
|
4336
|
+
top: R.top,
|
|
4337
|
+
right: R.right,
|
|
4338
|
+
bottom: R.bottom,
|
|
4339
|
+
left: R.left
|
|
4366
4340
|
}, i.baseRadii = {
|
|
4367
|
-
topLeft:
|
|
4368
|
-
topRight:
|
|
4369
|
-
bottomRight:
|
|
4370
|
-
bottomLeft:
|
|
4371
|
-
}, i.hasWidthChange =
|
|
4341
|
+
topLeft: N.topLeft,
|
|
4342
|
+
topRight: N.topRight,
|
|
4343
|
+
bottomRight: N.bottomRight,
|
|
4344
|
+
bottomLeft: N.bottomLeft
|
|
4345
|
+
}, i.hasWidthChange = St || Xt || gt || xt;
|
|
4372
4346
|
}, this._handleObjectModified = (s) => {
|
|
4373
4347
|
var y, p, M;
|
|
4374
4348
|
const { target: o } = s;
|
|
4375
|
-
if (!
|
|
4349
|
+
if (!Q._isTextbox(o)) return;
|
|
4376
4350
|
o.isScaling = !1;
|
|
4377
4351
|
const n = this.scalingState.get(o);
|
|
4378
4352
|
if (this.scalingState.delete(o), !(n != null && n.hasWidthChange)) return;
|
|
@@ -4381,8 +4355,8 @@ class K {
|
|
|
4381
4355
|
paddingRight: c = 0,
|
|
4382
4356
|
paddingBottom: h = 0,
|
|
4383
4357
|
paddingLeft: l = 0,
|
|
4384
|
-
radiusTopLeft:
|
|
4385
|
-
radiusTopRight:
|
|
4358
|
+
radiusTopLeft: u = 0,
|
|
4359
|
+
radiusTopRight: g = 0,
|
|
4386
4360
|
radiusBottomRight: f = 0,
|
|
4387
4361
|
radiusBottomLeft: m = 0
|
|
4388
4362
|
} = o;
|
|
@@ -4395,22 +4369,22 @@ class K {
|
|
|
4395
4369
|
paddingRight: c,
|
|
4396
4370
|
paddingBottom: h,
|
|
4397
4371
|
paddingLeft: l,
|
|
4398
|
-
radiusTopLeft:
|
|
4399
|
-
radiusTopRight:
|
|
4372
|
+
radiusTopLeft: u,
|
|
4373
|
+
radiusTopRight: g,
|
|
4400
4374
|
radiusBottomRight: f,
|
|
4401
4375
|
radiusBottomLeft: m
|
|
4402
4376
|
}
|
|
4403
4377
|
}), o.set({ scaleX: 1, scaleY: 1 }), o.setCoords();
|
|
4404
|
-
}, this.editor = t, this.canvas = t.canvas, this.fonts = (e = t.options.fonts) != null ? e : [], this.scalingState = /* @__PURE__ */ new WeakMap(), this.isTextEditingActive = !1, this._bindEvents(),
|
|
4378
|
+
}, this.editor = t, this.canvas = t.canvas, this.fonts = (e = t.options.fonts) != null ? e : [], this.scalingState = /* @__PURE__ */ new WeakMap(), this.isTextEditingActive = !1, this._bindEvents(), Ds();
|
|
4405
4379
|
}
|
|
4406
4380
|
/**
|
|
4407
4381
|
* Добавляет новый текстовый объект на канвас.
|
|
4408
4382
|
* @param options — настройки текста
|
|
4409
4383
|
* @param flags — флаги поведения
|
|
4410
4384
|
*/
|
|
4411
|
-
addText(
|
|
4412
|
-
var
|
|
4413
|
-
id: t = `text-${
|
|
4385
|
+
addText(G = {}, { withoutSelection: I = !1, withoutSave: _ = !1, withoutAdding: z = !1 } = {}) {
|
|
4386
|
+
var Z = G, {
|
|
4387
|
+
id: t = `text-${P()}`,
|
|
4414
4388
|
text: e = "Новый текст",
|
|
4415
4389
|
fontFamily: s,
|
|
4416
4390
|
fontSize: o = 48,
|
|
@@ -4421,20 +4395,20 @@ class K {
|
|
|
4421
4395
|
strikethrough: c = !1,
|
|
4422
4396
|
align: h = "left",
|
|
4423
4397
|
color: l = "#000000",
|
|
4424
|
-
strokeColor:
|
|
4425
|
-
strokeWidth:
|
|
4398
|
+
strokeColor: u,
|
|
4399
|
+
strokeWidth: g = 0,
|
|
4426
4400
|
opacity: f = 1,
|
|
4427
4401
|
backgroundColor: m,
|
|
4428
4402
|
backgroundOpacity: y = 1,
|
|
4429
4403
|
paddingTop: p = 0,
|
|
4430
4404
|
paddingRight: M = 0,
|
|
4431
|
-
paddingBottom:
|
|
4432
|
-
paddingLeft:
|
|
4405
|
+
paddingBottom: b = 0,
|
|
4406
|
+
paddingLeft: A = 0,
|
|
4433
4407
|
radiusTopLeft: x = 0,
|
|
4434
|
-
radiusTopRight:
|
|
4435
|
-
radiusBottomRight:
|
|
4436
|
-
radiusBottomLeft:
|
|
4437
|
-
} =
|
|
4408
|
+
radiusTopRight: v = 0,
|
|
4409
|
+
radiusBottomRight: S = 0,
|
|
4410
|
+
radiusBottomLeft: L = 0
|
|
4411
|
+
} = Z, B = rt(Z, [
|
|
4438
4412
|
"id",
|
|
4439
4413
|
"text",
|
|
4440
4414
|
"fontFamily",
|
|
@@ -4460,15 +4434,15 @@ class K {
|
|
|
4460
4434
|
"radiusBottomRight",
|
|
4461
4435
|
"radiusBottomLeft"
|
|
4462
4436
|
]);
|
|
4463
|
-
var
|
|
4464
|
-
const { historyManager:
|
|
4465
|
-
|
|
4466
|
-
const
|
|
4467
|
-
strokeColor:
|
|
4468
|
-
width:
|
|
4469
|
-
}),
|
|
4437
|
+
var R;
|
|
4438
|
+
const { historyManager: V } = this.editor, { canvas: X } = this;
|
|
4439
|
+
V.suspendHistory();
|
|
4440
|
+
const C = s != null ? s : this._getDefaultFontFamily(), T = Le({ width: g }), Y = De({
|
|
4441
|
+
strokeColor: u,
|
|
4442
|
+
width: T
|
|
4443
|
+
}), F = k({
|
|
4470
4444
|
id: t,
|
|
4471
|
-
fontFamily:
|
|
4445
|
+
fontFamily: C,
|
|
4472
4446
|
fontSize: o,
|
|
4473
4447
|
fontWeight: n ? "bold" : "normal",
|
|
4474
4448
|
fontStyle: i ? "italic" : "normal",
|
|
@@ -4477,43 +4451,43 @@ class K {
|
|
|
4477
4451
|
linethrough: c,
|
|
4478
4452
|
textAlign: h,
|
|
4479
4453
|
fill: l,
|
|
4480
|
-
stroke:
|
|
4481
|
-
strokeWidth:
|
|
4454
|
+
stroke: Y,
|
|
4455
|
+
strokeWidth: T,
|
|
4482
4456
|
strokeUniform: !0,
|
|
4483
4457
|
opacity: f,
|
|
4484
4458
|
backgroundColor: m,
|
|
4485
4459
|
backgroundOpacity: y,
|
|
4486
4460
|
paddingTop: p,
|
|
4487
4461
|
paddingRight: M,
|
|
4488
|
-
paddingBottom:
|
|
4489
|
-
paddingLeft:
|
|
4462
|
+
paddingBottom: b,
|
|
4463
|
+
paddingLeft: A,
|
|
4490
4464
|
radiusTopLeft: x,
|
|
4491
|
-
radiusTopRight:
|
|
4492
|
-
radiusBottomRight:
|
|
4493
|
-
radiusBottomLeft:
|
|
4494
|
-
},
|
|
4495
|
-
if (
|
|
4496
|
-
const
|
|
4497
|
-
|
|
4498
|
-
}
|
|
4499
|
-
return
|
|
4500
|
-
textbox:
|
|
4501
|
-
options:
|
|
4465
|
+
radiusTopRight: v,
|
|
4466
|
+
radiusBottomRight: S,
|
|
4467
|
+
radiusBottomLeft: L
|
|
4468
|
+
}, B), H = new Gt(e, F);
|
|
4469
|
+
if (H.textCaseRaw = (R = H.text) != null ? R : "", r) {
|
|
4470
|
+
const N = Kt({ value: H.textCaseRaw });
|
|
4471
|
+
N !== H.text && H.set({ text: N });
|
|
4472
|
+
}
|
|
4473
|
+
return B.left === void 0 && B.top === void 0 && X.centerObject(H), z || X.add(H), I || X.setActiveObject(H), X.requestRenderAll(), V.resumeHistory(), _ || V.saveState(), X.fire("editor:text-added", {
|
|
4474
|
+
textbox: H,
|
|
4475
|
+
options: Tt(k({}, F), {
|
|
4502
4476
|
text: e,
|
|
4503
4477
|
bold: n,
|
|
4504
4478
|
italic: i,
|
|
4505
4479
|
strikethrough: c,
|
|
4506
4480
|
align: h,
|
|
4507
4481
|
color: l,
|
|
4508
|
-
strokeColor:
|
|
4509
|
-
strokeWidth:
|
|
4482
|
+
strokeColor: Y,
|
|
4483
|
+
strokeWidth: T
|
|
4510
4484
|
}),
|
|
4511
4485
|
flags: {
|
|
4512
|
-
withoutSelection: !!
|
|
4513
|
-
withoutSave: !!
|
|
4514
|
-
withoutAdding: !!
|
|
4486
|
+
withoutSelection: !!I,
|
|
4487
|
+
withoutSave: !!_,
|
|
4488
|
+
withoutAdding: !!z
|
|
4515
4489
|
}
|
|
4516
|
-
}),
|
|
4490
|
+
}), H;
|
|
4517
4491
|
}
|
|
4518
4492
|
/**
|
|
4519
4493
|
* Обновляет текстовый объект.
|
|
@@ -4524,36 +4498,36 @@ class K {
|
|
|
4524
4498
|
* @param options.skipRender — не вызывать перерисовку канваса
|
|
4525
4499
|
*/
|
|
4526
4500
|
updateText({ target: t, style: e = {}, withoutSave: s, skipRender: o } = {}) {
|
|
4527
|
-
var
|
|
4501
|
+
var St, nt, J, It, Ct, Et;
|
|
4528
4502
|
const n = this._resolveTextObject(t);
|
|
4529
4503
|
if (!n) return null;
|
|
4530
4504
|
const { historyManager: i } = this.editor, { canvas: a } = this;
|
|
4531
4505
|
i.suspendHistory();
|
|
4532
|
-
const r =
|
|
4506
|
+
const r = Q._getSnapshot(n), ot = e, {
|
|
4533
4507
|
text: c,
|
|
4534
4508
|
fontFamily: h,
|
|
4535
4509
|
fontSize: l,
|
|
4536
|
-
bold:
|
|
4537
|
-
italic:
|
|
4510
|
+
bold: u,
|
|
4511
|
+
italic: g,
|
|
4538
4512
|
underline: f,
|
|
4539
4513
|
uppercase: m,
|
|
4540
4514
|
strikethrough: y,
|
|
4541
4515
|
align: p,
|
|
4542
4516
|
color: M,
|
|
4543
|
-
strokeColor:
|
|
4544
|
-
strokeWidth:
|
|
4517
|
+
strokeColor: b,
|
|
4518
|
+
strokeWidth: A,
|
|
4545
4519
|
opacity: x,
|
|
4546
|
-
backgroundColor:
|
|
4547
|
-
backgroundOpacity:
|
|
4548
|
-
paddingTop:
|
|
4549
|
-
paddingRight:
|
|
4550
|
-
paddingBottom:
|
|
4551
|
-
paddingLeft:
|
|
4552
|
-
radiusTopLeft:
|
|
4553
|
-
radiusTopRight:
|
|
4554
|
-
radiusBottomRight:
|
|
4555
|
-
radiusBottomLeft:
|
|
4556
|
-
} =
|
|
4520
|
+
backgroundColor: v,
|
|
4521
|
+
backgroundOpacity: S,
|
|
4522
|
+
paddingTop: L,
|
|
4523
|
+
paddingRight: B,
|
|
4524
|
+
paddingBottom: I,
|
|
4525
|
+
paddingLeft: _,
|
|
4526
|
+
radiusTopLeft: z,
|
|
4527
|
+
radiusTopRight: G,
|
|
4528
|
+
radiusBottomRight: Z,
|
|
4529
|
+
radiusBottomLeft: V
|
|
4530
|
+
} = ot, X = rt(ot, [
|
|
4557
4531
|
"text",
|
|
4558
4532
|
"fontFamily",
|
|
4559
4533
|
"fontSize",
|
|
@@ -4577,38 +4551,38 @@ class K {
|
|
|
4577
4551
|
"radiusTopRight",
|
|
4578
4552
|
"radiusBottomRight",
|
|
4579
4553
|
"radiusBottomLeft"
|
|
4580
|
-
]),
|
|
4581
|
-
if (h !== void 0 && (
|
|
4582
|
-
const
|
|
4583
|
-
|
|
4584
|
-
}
|
|
4585
|
-
if (
|
|
4586
|
-
const
|
|
4587
|
-
|
|
4588
|
-
}
|
|
4589
|
-
if (f !== void 0 && (
|
|
4590
|
-
const
|
|
4591
|
-
strokeColor:
|
|
4592
|
-
width:
|
|
4554
|
+
]), C = k({}, X), T = Ls({ textbox: n }), Y = {}, F = {}, H = ks({ textbox: n, range: T }), R = !T || H, N = !T;
|
|
4555
|
+
if (h !== void 0 && (T && (Y.fontFamily = h), R && (C.fontFamily = h, N && (F.fontFamily = h))), l !== void 0 && (C.fontSize = l), u !== void 0) {
|
|
4556
|
+
const W = u ? "bold" : "normal";
|
|
4557
|
+
T && (Y.fontWeight = W), R && (C.fontWeight = W, N && (F.fontWeight = W));
|
|
4558
|
+
}
|
|
4559
|
+
if (g !== void 0) {
|
|
4560
|
+
const W = g ? "italic" : "normal";
|
|
4561
|
+
T && (Y.fontStyle = W), R && (C.fontStyle = W, N && (F.fontStyle = W));
|
|
4562
|
+
}
|
|
4563
|
+
if (f !== void 0 && (T && (Y.underline = f), R && (C.underline = f, N && (F.underline = f))), y !== void 0 && (T && (Y.linethrough = y), R && (C.linethrough = y, N && (F.linethrough = y))), p !== void 0 && (C.textAlign = p), M !== void 0 && (T && (Y.fill = M), R && (C.fill = M, N && (F.fill = M))), b !== void 0 || A !== void 0) {
|
|
4564
|
+
const W = T ? Oe({ textbox: n, range: T, property: "strokeWidth" }) : void 0, Bt = T ? Oe({ textbox: n, range: T, property: "stroke" }) : void 0, _t = (nt = (St = A != null ? A : W) != null ? St : n.strokeWidth) != null ? nt : 0, at = Le({ width: _t }), Ut = (It = (J = b != null ? b : Bt) != null ? J : n.stroke) != null ? It : void 0, ft = De({
|
|
4565
|
+
strokeColor: Ut,
|
|
4566
|
+
width: at
|
|
4593
4567
|
});
|
|
4594
|
-
|
|
4568
|
+
T && (Y.stroke = ft, Y.strokeWidth = at), R && (C.stroke = ft, C.strokeWidth = at, N && (F.stroke = ft, F.strokeWidth = at));
|
|
4595
4569
|
}
|
|
4596
|
-
x !== void 0 && (
|
|
4597
|
-
const jt = (
|
|
4598
|
-
if (
|
|
4599
|
-
const
|
|
4600
|
-
|
|
4570
|
+
x !== void 0 && (C.opacity = x), v !== void 0 && (C.backgroundColor = v), S !== void 0 && (C.backgroundOpacity = S), L !== void 0 && (C.paddingTop = L), B !== void 0 && (C.paddingRight = B), I !== void 0 && (C.paddingBottom = I), _ !== void 0 && (C.paddingLeft = _), z !== void 0 && (C.radiusTopLeft = z), G !== void 0 && (C.radiusTopRight = G), Z !== void 0 && (C.radiusBottomRight = Z), V !== void 0 && (C.radiusBottomLeft = V);
|
|
4571
|
+
const jt = (Et = n.textCaseRaw) != null ? Et : (Ct = n.text) != null ? Ct : "", kt = !!n.uppercase, Rt = c !== void 0, ut = Rt ? c != null ? c : "" : jt, At = m != null ? m : kt;
|
|
4572
|
+
if (Rt || At !== kt) {
|
|
4573
|
+
const W = At ? Kt({ value: ut }) : ut;
|
|
4574
|
+
C.text = W, n.textCaseRaw = ut;
|
|
4601
4575
|
} else n.textCaseRaw === void 0 && (n.textCaseRaw = jt);
|
|
4602
|
-
n.uppercase = At, n.set(
|
|
4603
|
-
let
|
|
4604
|
-
if (
|
|
4605
|
-
|
|
4606
|
-
else if (Object.keys(
|
|
4607
|
-
const
|
|
4608
|
-
|
|
4609
|
-
}
|
|
4610
|
-
|
|
4611
|
-
const xt =
|
|
4576
|
+
n.uppercase = At, n.set(C);
|
|
4577
|
+
let gt = !1;
|
|
4578
|
+
if (T)
|
|
4579
|
+
gt = Te({ textbox: n, styles: Y, range: T });
|
|
4580
|
+
else if (Object.keys(F).length) {
|
|
4581
|
+
const W = Ns({ textbox: n });
|
|
4582
|
+
W && (gt = Te({ textbox: n, styles: F, range: W }));
|
|
4583
|
+
}
|
|
4584
|
+
gt && (n.dirty = !0), (v !== void 0 || S !== void 0 || L !== void 0 || B !== void 0 || I !== void 0 || _ !== void 0 || z !== void 0 || G !== void 0 || Z !== void 0 || V !== void 0) && (n.dirty = !0), n.setCoords(), o || a.requestRenderAll(), i.resumeHistory(), s || i.saveState();
|
|
4585
|
+
const xt = Q._getSnapshot(n);
|
|
4612
4586
|
return a.fire("editor:text-updated", {
|
|
4613
4587
|
textbox: n,
|
|
4614
4588
|
target: t,
|
|
@@ -4617,11 +4591,11 @@ class K {
|
|
|
4617
4591
|
withoutSave: !!s,
|
|
4618
4592
|
skipRender: !!o
|
|
4619
4593
|
},
|
|
4620
|
-
updates:
|
|
4594
|
+
updates: C,
|
|
4621
4595
|
before: r,
|
|
4622
4596
|
after: xt,
|
|
4623
|
-
selectionRange:
|
|
4624
|
-
selectionStyles:
|
|
4597
|
+
selectionRange: T != null ? T : void 0,
|
|
4598
|
+
selectionStyles: T && Object.keys(Y).length ? Y : void 0
|
|
4625
4599
|
}), n;
|
|
4626
4600
|
}
|
|
4627
4601
|
/**
|
|
@@ -4635,14 +4609,14 @@ class K {
|
|
|
4635
4609
|
* Возвращает активный текст или ищет по id.
|
|
4636
4610
|
*/
|
|
4637
4611
|
_resolveTextObject(t) {
|
|
4638
|
-
if (t instanceof
|
|
4612
|
+
if (t instanceof st) return t;
|
|
4639
4613
|
const { canvas: e } = this;
|
|
4640
4614
|
if (!t) {
|
|
4641
4615
|
const s = e.getActiveObject();
|
|
4642
|
-
return
|
|
4616
|
+
return Q._isTextbox(s) ? s : null;
|
|
4643
4617
|
}
|
|
4644
4618
|
if (typeof t == "string") {
|
|
4645
|
-
const s = e.getObjects().find((o) =>
|
|
4619
|
+
const s = e.getObjects().find((o) => Q._isTextbox(o) && o.id === t);
|
|
4646
4620
|
return s != null ? s : null;
|
|
4647
4621
|
}
|
|
4648
4622
|
return null;
|
|
@@ -4651,14 +4625,29 @@ class K {
|
|
|
4651
4625
|
* Проверяет, является ли объект текстовым блоком редактора.
|
|
4652
4626
|
*/
|
|
4653
4627
|
static _isTextbox(t) {
|
|
4654
|
-
return !!t && t instanceof
|
|
4628
|
+
return !!t && t instanceof st;
|
|
4655
4629
|
}
|
|
4656
4630
|
/**
|
|
4657
4631
|
* Вешает обработчики событий Fabric для работы с текстом.
|
|
4658
4632
|
*/
|
|
4659
4633
|
_bindEvents() {
|
|
4660
4634
|
const { canvas: t } = this;
|
|
4661
|
-
t.on("object:scaling", this._handleObjectScaling), t.on("object:modified", this._handleObjectModified), t.on("text:editing:entered", this._handleTextEditingEntered), t.on("text:editing:exited", this._handleTextEditingExited), t.on("text:changed",
|
|
4635
|
+
t.on("object:scaling", this._handleObjectScaling), t.on("object:modified", this._handleObjectModified), t.on("text:editing:entered", this._handleTextEditingEntered), t.on("text:editing:exited", this._handleTextEditingExited), t.on("text:changed", Q._handleTextChanged);
|
|
4636
|
+
}
|
|
4637
|
+
/**
|
|
4638
|
+
* Реагирует на изменение текста в режиме редактирования: синхронизирует textCaseRaw и uppercase.
|
|
4639
|
+
*/
|
|
4640
|
+
static _handleTextChanged(t) {
|
|
4641
|
+
var i;
|
|
4642
|
+
const { target: e } = t;
|
|
4643
|
+
if (!Q._isTextbox(e)) return;
|
|
4644
|
+
const s = (i = e.text) != null ? i : "", o = !!e.uppercase, n = s.toLocaleLowerCase();
|
|
4645
|
+
if (o) {
|
|
4646
|
+
const a = Kt({ value: n });
|
|
4647
|
+
a !== s && e.set({ text: a }), e.textCaseRaw = n;
|
|
4648
|
+
return;
|
|
4649
|
+
}
|
|
4650
|
+
e.textCaseRaw = s;
|
|
4662
4651
|
}
|
|
4663
4652
|
/**
|
|
4664
4653
|
* Создаёт или возвращает сохранённое состояние для текущего цикла масштабирования текста.
|
|
@@ -4671,9 +4660,9 @@ class K {
|
|
|
4671
4660
|
paddingTop: c = 0,
|
|
4672
4661
|
paddingRight: h = 0,
|
|
4673
4662
|
paddingBottom: l = 0,
|
|
4674
|
-
paddingLeft:
|
|
4663
|
+
paddingLeft: u = 0
|
|
4675
4664
|
} = t, {
|
|
4676
|
-
radiusTopLeft:
|
|
4665
|
+
radiusTopLeft: g = 0,
|
|
4677
4666
|
radiusTopRight: f = 0,
|
|
4678
4667
|
radiusBottomRight: m = 0,
|
|
4679
4668
|
radiusBottomLeft: y = 0
|
|
@@ -4686,10 +4675,10 @@ class K {
|
|
|
4686
4675
|
top: c,
|
|
4687
4676
|
right: h,
|
|
4688
4677
|
bottom: l,
|
|
4689
|
-
left:
|
|
4678
|
+
left: u
|
|
4690
4679
|
},
|
|
4691
4680
|
baseRadii: {
|
|
4692
|
-
topLeft:
|
|
4681
|
+
topLeft: g,
|
|
4693
4682
|
topRight: f,
|
|
4694
4683
|
bottomRight: m,
|
|
4695
4684
|
bottomLeft: y
|
|
@@ -4704,11 +4693,11 @@ class K {
|
|
|
4704
4693
|
*/
|
|
4705
4694
|
static _getSnapshot(t) {
|
|
4706
4695
|
const e = ({
|
|
4707
|
-
snapshot:
|
|
4708
|
-
entries:
|
|
4696
|
+
snapshot: F,
|
|
4697
|
+
entries: H
|
|
4709
4698
|
}) => {
|
|
4710
|
-
Object.entries(
|
|
4711
|
-
|
|
4699
|
+
Object.entries(H).forEach(([R, N]) => {
|
|
4700
|
+
N != null && (F[R] = N);
|
|
4712
4701
|
});
|
|
4713
4702
|
}, {
|
|
4714
4703
|
id: s,
|
|
@@ -4720,36 +4709,36 @@ class K {
|
|
|
4720
4709
|
fontWeight: c,
|
|
4721
4710
|
fontStyle: h,
|
|
4722
4711
|
underline: l,
|
|
4723
|
-
linethrough:
|
|
4724
|
-
textAlign:
|
|
4712
|
+
linethrough: u,
|
|
4713
|
+
textAlign: g,
|
|
4725
4714
|
fill: f,
|
|
4726
4715
|
stroke: m,
|
|
4727
4716
|
strokeWidth: y,
|
|
4728
4717
|
opacity: p,
|
|
4729
4718
|
backgroundColor: M,
|
|
4730
|
-
backgroundOpacity:
|
|
4731
|
-
paddingTop:
|
|
4719
|
+
backgroundOpacity: b,
|
|
4720
|
+
paddingTop: A,
|
|
4732
4721
|
paddingRight: x,
|
|
4733
|
-
paddingBottom:
|
|
4734
|
-
paddingLeft:
|
|
4735
|
-
radiusTopLeft:
|
|
4736
|
-
radiusTopRight:
|
|
4737
|
-
radiusBottomRight:
|
|
4738
|
-
radiusBottomLeft:
|
|
4739
|
-
left:
|
|
4740
|
-
top:
|
|
4741
|
-
width:
|
|
4742
|
-
height:
|
|
4743
|
-
angle:
|
|
4744
|
-
scaleX:
|
|
4745
|
-
scaleY:
|
|
4746
|
-
} = t,
|
|
4722
|
+
paddingBottom: v,
|
|
4723
|
+
paddingLeft: S,
|
|
4724
|
+
radiusTopLeft: L,
|
|
4725
|
+
radiusTopRight: B,
|
|
4726
|
+
radiusBottomRight: I,
|
|
4727
|
+
radiusBottomLeft: _,
|
|
4728
|
+
left: z,
|
|
4729
|
+
top: G,
|
|
4730
|
+
width: Z,
|
|
4731
|
+
height: V,
|
|
4732
|
+
angle: X,
|
|
4733
|
+
scaleX: C,
|
|
4734
|
+
scaleY: T
|
|
4735
|
+
} = t, Y = {
|
|
4747
4736
|
id: s,
|
|
4748
4737
|
uppercase: !!i,
|
|
4749
|
-
textAlign:
|
|
4738
|
+
textAlign: g
|
|
4750
4739
|
};
|
|
4751
4740
|
return e({
|
|
4752
|
-
snapshot:
|
|
4741
|
+
snapshot: Y,
|
|
4753
4742
|
entries: {
|
|
4754
4743
|
text: o,
|
|
4755
4744
|
textCaseRaw: n,
|
|
@@ -4758,30 +4747,30 @@ class K {
|
|
|
4758
4747
|
fontWeight: c,
|
|
4759
4748
|
fontStyle: h,
|
|
4760
4749
|
underline: l,
|
|
4761
|
-
linethrough:
|
|
4750
|
+
linethrough: u,
|
|
4762
4751
|
fill: f,
|
|
4763
4752
|
stroke: m,
|
|
4764
4753
|
strokeWidth: y,
|
|
4765
4754
|
opacity: p,
|
|
4766
4755
|
backgroundColor: M,
|
|
4767
|
-
backgroundOpacity:
|
|
4768
|
-
paddingTop:
|
|
4756
|
+
backgroundOpacity: b,
|
|
4757
|
+
paddingTop: A,
|
|
4769
4758
|
paddingRight: x,
|
|
4770
|
-
paddingBottom:
|
|
4771
|
-
paddingLeft:
|
|
4772
|
-
radiusTopLeft:
|
|
4773
|
-
radiusTopRight:
|
|
4774
|
-
radiusBottomRight:
|
|
4775
|
-
radiusBottomLeft:
|
|
4776
|
-
left:
|
|
4777
|
-
top:
|
|
4778
|
-
width:
|
|
4779
|
-
height:
|
|
4780
|
-
angle:
|
|
4781
|
-
scaleX:
|
|
4782
|
-
scaleY:
|
|
4759
|
+
paddingBottom: v,
|
|
4760
|
+
paddingLeft: S,
|
|
4761
|
+
radiusTopLeft: L,
|
|
4762
|
+
radiusTopRight: B,
|
|
4763
|
+
radiusBottomRight: I,
|
|
4764
|
+
radiusBottomLeft: _,
|
|
4765
|
+
left: z,
|
|
4766
|
+
top: G,
|
|
4767
|
+
width: Z,
|
|
4768
|
+
height: V,
|
|
4769
|
+
angle: X,
|
|
4770
|
+
scaleX: C,
|
|
4771
|
+
scaleY: T
|
|
4783
4772
|
}
|
|
4784
|
-
}),
|
|
4773
|
+
}), Y;
|
|
4785
4774
|
}
|
|
4786
4775
|
/**
|
|
4787
4776
|
* Возвращает первый доступный шрифт или дефолтный Arial.
|
|
@@ -4791,17 +4780,17 @@ class K {
|
|
|
4791
4780
|
return (e = (t = this.fonts[0]) == null ? void 0 : t.family) != null ? e : "Arial";
|
|
4792
4781
|
}
|
|
4793
4782
|
}
|
|
4794
|
-
const
|
|
4783
|
+
const $ = ({
|
|
4795
4784
|
value: d,
|
|
4796
4785
|
fallback: t = 0
|
|
4797
|
-
}) => typeof d == "number" && Number.isFinite(d) ? d : typeof t == "number" && Number.isFinite(t) ? t : 0,
|
|
4786
|
+
}) => typeof d == "number" && Number.isFinite(d) ? d : typeof t == "number" && Number.isFinite(t) ? t : 0, Ft = ({
|
|
4798
4787
|
value: d,
|
|
4799
4788
|
dimension: t,
|
|
4800
4789
|
useRelativePositions: e
|
|
4801
4790
|
}) => {
|
|
4802
|
-
const s =
|
|
4791
|
+
const s = $({ value: d });
|
|
4803
4792
|
return e ? s : s / (t || 1);
|
|
4804
|
-
},
|
|
4793
|
+
}, Rs = ({
|
|
4805
4794
|
object: d,
|
|
4806
4795
|
baseWidth: t,
|
|
4807
4796
|
baseHeight: e,
|
|
@@ -4811,31 +4800,31 @@ const Dt = ({
|
|
|
4811
4800
|
const n = d;
|
|
4812
4801
|
if (typeof n[o.x] == "number" && typeof n[o.y] == "number")
|
|
4813
4802
|
return {
|
|
4814
|
-
x:
|
|
4803
|
+
x: Ft({
|
|
4815
4804
|
value: n[o.x],
|
|
4816
4805
|
dimension: t,
|
|
4817
4806
|
useRelativePositions: s
|
|
4818
4807
|
}),
|
|
4819
|
-
y:
|
|
4808
|
+
y: Ft({
|
|
4820
4809
|
value: n[o.y],
|
|
4821
4810
|
dimension: e,
|
|
4822
4811
|
useRelativePositions: s
|
|
4823
4812
|
})
|
|
4824
4813
|
};
|
|
4825
|
-
const { left: a, top: r, width: c, height: h } = d, l =
|
|
4814
|
+
const { left: a, top: r, width: c, height: h } = d, l = Ft({
|
|
4826
4815
|
value: a,
|
|
4827
4816
|
dimension: t,
|
|
4828
4817
|
useRelativePositions: s
|
|
4829
|
-
}),
|
|
4818
|
+
}), u = Ft({
|
|
4830
4819
|
value: r,
|
|
4831
4820
|
dimension: e,
|
|
4832
4821
|
useRelativePositions: s
|
|
4833
|
-
}),
|
|
4822
|
+
}), g = $({ value: c }) / (t || 1), f = $({ value: h }) / (e || 1);
|
|
4834
4823
|
return {
|
|
4835
|
-
x: l +
|
|
4836
|
-
y:
|
|
4824
|
+
x: l + g / 2,
|
|
4825
|
+
y: u + f / 2
|
|
4837
4826
|
};
|
|
4838
|
-
},
|
|
4827
|
+
}, xs = ({
|
|
4839
4828
|
normalizedX: d,
|
|
4840
4829
|
normalizedY: t,
|
|
4841
4830
|
bounds: e,
|
|
@@ -4844,12 +4833,12 @@ const Dt = ({
|
|
|
4844
4833
|
}) => {
|
|
4845
4834
|
const { left: n, top: i, width: a, height: r } = e;
|
|
4846
4835
|
if (!o) {
|
|
4847
|
-
const { width: l, height:
|
|
4848
|
-
return new
|
|
4836
|
+
const { width: l, height: u } = s, g = n + d * (l || a), f = i + t * (u || r);
|
|
4837
|
+
return new ht(g, f);
|
|
4849
4838
|
}
|
|
4850
4839
|
const c = n + d * a, h = i + t * r;
|
|
4851
|
-
return new
|
|
4852
|
-
},
|
|
4840
|
+
return new ht(c, h);
|
|
4841
|
+
}, Bs = ({
|
|
4853
4842
|
object: d,
|
|
4854
4843
|
montageArea: t,
|
|
4855
4844
|
bounds: e
|
|
@@ -4864,21 +4853,21 @@ const Dt = ({
|
|
|
4864
4853
|
} catch (s) {
|
|
4865
4854
|
return null;
|
|
4866
4855
|
}
|
|
4867
|
-
},
|
|
4856
|
+
}, _s = ({
|
|
4868
4857
|
x1: d,
|
|
4869
4858
|
y1: t,
|
|
4870
4859
|
x2: e,
|
|
4871
4860
|
y2: s
|
|
4872
|
-
}) => (Math.atan2(s - t, e - d) * 180 / Math.PI + 360) % 360,
|
|
4861
|
+
}) => (Math.atan2(s - t, e - d) * 180 / Math.PI + 360) % 360, Us = (d) => {
|
|
4873
4862
|
if (!d || typeof d != "object") return null;
|
|
4874
4863
|
const { type: t, coords: e, colorStops: s } = d, o = Array.isArray(s) ? s : [], n = o[0], i = o[o.length - 1], a = typeof (n == null ? void 0 : n.color) == "string" ? n.color : void 0, r = typeof (i == null ? void 0 : i.color) == "string" ? i.color : a, c = typeof (n == null ? void 0 : n.offset) == "number" ? n.offset * 100 : void 0, h = typeof (i == null ? void 0 : i.offset) == "number" ? i.offset * 100 : void 0;
|
|
4875
4864
|
if (!a || !r || !e) return null;
|
|
4876
4865
|
if (t === "linear") {
|
|
4877
|
-
const { x1: l, y1:
|
|
4878
|
-
if (typeof l == "number" && typeof
|
|
4866
|
+
const { x1: l, y1: u, x2: g, y2: f } = e;
|
|
4867
|
+
if (typeof l == "number" && typeof u == "number" && typeof g == "number" && typeof f == "number")
|
|
4879
4868
|
return {
|
|
4880
4869
|
type: "linear",
|
|
4881
|
-
angle:
|
|
4870
|
+
angle: _s({ x1: l, y1: u, x2: g, y2: f }),
|
|
4882
4871
|
startColor: a,
|
|
4883
4872
|
endColor: r,
|
|
4884
4873
|
startPosition: c,
|
|
@@ -4886,13 +4875,13 @@ const Dt = ({
|
|
|
4886
4875
|
};
|
|
4887
4876
|
}
|
|
4888
4877
|
if (t === "radial") {
|
|
4889
|
-
const { x1: l, y1:
|
|
4890
|
-
if (typeof l == "number" && typeof
|
|
4878
|
+
const { x1: l, y1: u, r2: g } = e;
|
|
4879
|
+
if (typeof l == "number" && typeof u == "number" && typeof g == "number")
|
|
4891
4880
|
return {
|
|
4892
4881
|
type: "radial",
|
|
4893
4882
|
centerX: l * 100,
|
|
4894
|
-
centerY:
|
|
4895
|
-
radius:
|
|
4883
|
+
centerY: u * 100,
|
|
4884
|
+
radius: g * 100,
|
|
4896
4885
|
startColor: a,
|
|
4897
4886
|
endColor: r,
|
|
4898
4887
|
startPosition: c,
|
|
@@ -4900,8 +4889,8 @@ const Dt = ({
|
|
|
4900
4889
|
};
|
|
4901
4890
|
}
|
|
4902
4891
|
return null;
|
|
4903
|
-
},
|
|
4904
|
-
class
|
|
4892
|
+
}, Qt = "_templateCenterX", $t = "_templateCenterY", Jt = "_templateAnchorX", qt = "_templateAnchorY";
|
|
4893
|
+
class E {
|
|
4905
4894
|
constructor({ editor: t }) {
|
|
4906
4895
|
this.editor = t;
|
|
4907
4896
|
}
|
|
@@ -4920,29 +4909,29 @@ class z {
|
|
|
4920
4909
|
montageArea: i,
|
|
4921
4910
|
errorManager: a,
|
|
4922
4911
|
backgroundManager: r
|
|
4923
|
-
} = this.editor, c = n.getActiveObject(), h =
|
|
4924
|
-
if (!
|
|
4912
|
+
} = this.editor, c = n.getActiveObject(), h = E._collectObjects(c), { backgroundObject: l } = r != null ? r : {}, u = o && l ? [l] : [], g = [...h, ...u];
|
|
4913
|
+
if (!g.length)
|
|
4925
4914
|
return a.emitWarning({
|
|
4926
4915
|
origin: "TemplateManager",
|
|
4927
4916
|
method: "serializeSelection",
|
|
4928
|
-
code:
|
|
4917
|
+
code: ct.TEMPLATE_MANAGER.NO_OBJECTS_SELECTED,
|
|
4929
4918
|
message: "Нет объектов для сериализации шаблона"
|
|
4930
4919
|
}), null;
|
|
4931
|
-
const f =
|
|
4920
|
+
const f = E._getBounds(i), m = E._getMontageSize({ montageArea: i, bounds: f }), y = m.width, p = m.height, M = g.map((x) => E._serializeObject({
|
|
4932
4921
|
object: x,
|
|
4933
4922
|
bounds: f,
|
|
4934
4923
|
baseWidth: y,
|
|
4935
4924
|
baseHeight: p,
|
|
4936
4925
|
montageArea: i != null ? i : null
|
|
4937
|
-
})),
|
|
4926
|
+
})), b = Tt(k({}, s), {
|
|
4938
4927
|
baseWidth: y,
|
|
4939
4928
|
baseHeight: p,
|
|
4940
4929
|
positionsNormalized: !0,
|
|
4941
4930
|
previewId: e != null ? e : s.previewId
|
|
4942
4931
|
});
|
|
4943
4932
|
return {
|
|
4944
|
-
id: t != null ? t : `template-${
|
|
4945
|
-
meta:
|
|
4933
|
+
id: t != null ? t : `template-${P()}`,
|
|
4934
|
+
meta: b,
|
|
4946
4935
|
objects: M
|
|
4947
4936
|
};
|
|
4948
4937
|
}
|
|
@@ -4953,7 +4942,7 @@ class z {
|
|
|
4953
4942
|
* @param options.data - данные для заполнения текстов по customData.templateField
|
|
4954
4943
|
*/
|
|
4955
4944
|
applyTemplate(s) {
|
|
4956
|
-
return
|
|
4945
|
+
return O(this, arguments, function* ({
|
|
4957
4946
|
template: t,
|
|
4958
4947
|
data: e
|
|
4959
4948
|
}) {
|
|
@@ -4968,62 +4957,62 @@ class z {
|
|
|
4968
4957
|
return a.emitWarning({
|
|
4969
4958
|
origin: "TemplateManager",
|
|
4970
4959
|
method: "applyTemplate",
|
|
4971
|
-
code:
|
|
4960
|
+
code: ct.TEMPLATE_MANAGER.INVALID_TEMPLATE,
|
|
4972
4961
|
message: "Шаблон не содержит объектов"
|
|
4973
4962
|
}), null;
|
|
4974
|
-
const
|
|
4975
|
-
if (!
|
|
4963
|
+
const u = E._getBounds(n);
|
|
4964
|
+
if (!u)
|
|
4976
4965
|
return a.emitWarning({
|
|
4977
4966
|
origin: "TemplateManager",
|
|
4978
4967
|
method: "applyTemplate",
|
|
4979
|
-
code:
|
|
4968
|
+
code: ct.TEMPLATE_MANAGER.INVALID_TARGET,
|
|
4980
4969
|
message: "Не удалось определить границы монтажной области"
|
|
4981
4970
|
}), null;
|
|
4982
|
-
const
|
|
4971
|
+
const g = E._getMontageSize({ montageArea: n, bounds: u }), f = E._normalizeMeta({ meta: h, fallback: g }), m = E._calculateScale({ meta: f, target: g }), y = !!f.positionsNormalized;
|
|
4983
4972
|
let p = !1, M = !1;
|
|
4984
4973
|
i.suspendHistory();
|
|
4985
4974
|
try {
|
|
4986
|
-
const
|
|
4987
|
-
if (!
|
|
4975
|
+
const b = yield E._enlivenObjects(c);
|
|
4976
|
+
if (!b.length)
|
|
4988
4977
|
return a.emitWarning({
|
|
4989
4978
|
origin: "TemplateManager",
|
|
4990
4979
|
method: "applyTemplate",
|
|
4991
|
-
code:
|
|
4980
|
+
code: ct.TEMPLATE_MANAGER.INVALID_TEMPLATE,
|
|
4992
4981
|
message: "Не удалось создать объекты шаблона"
|
|
4993
4982
|
}), null;
|
|
4994
|
-
const { backgroundObject:
|
|
4995
|
-
|
|
4996
|
-
backgroundObject:
|
|
4983
|
+
const { backgroundObject: A, contentObjects: x } = E._extractBackgroundObject(b);
|
|
4984
|
+
A && (M = yield E._applyBackgroundFromObject({
|
|
4985
|
+
backgroundObject: A,
|
|
4997
4986
|
backgroundManager: r,
|
|
4998
4987
|
errorManager: a
|
|
4999
4988
|
}));
|
|
5000
|
-
const
|
|
5001
|
-
object:
|
|
4989
|
+
const v = x.map((S) => (E._applyTextOverrides({ object: S, data: e }), E._transformObject({
|
|
4990
|
+
object: S,
|
|
5002
4991
|
scale: m,
|
|
5003
|
-
bounds:
|
|
5004
|
-
targetSize:
|
|
4992
|
+
bounds: u,
|
|
4993
|
+
targetSize: g,
|
|
5005
4994
|
baseWidth: f.baseWidth,
|
|
5006
4995
|
baseHeight: f.baseHeight,
|
|
5007
4996
|
montageArea: n,
|
|
5008
4997
|
useRelativePositions: y
|
|
5009
|
-
}),
|
|
5010
|
-
id: `${
|
|
4998
|
+
}), S.set({
|
|
4999
|
+
id: `${S.type}-${P()}`,
|
|
5011
5000
|
evented: !0
|
|
5012
|
-
}), o.add(
|
|
5013
|
-
return !
|
|
5001
|
+
}), o.add(S), S));
|
|
5002
|
+
return !v.length && !M ? null : (p = v.length > 0 || M, v.length && E._activateObjects({ canvas: o, objects: v }), o.requestRenderAll(), o.fire("editor:template-applied", {
|
|
5014
5003
|
template: t,
|
|
5015
|
-
objects:
|
|
5016
|
-
bounds:
|
|
5017
|
-
}),
|
|
5018
|
-
} catch (
|
|
5004
|
+
objects: v,
|
|
5005
|
+
bounds: u
|
|
5006
|
+
}), v);
|
|
5007
|
+
} catch (b) {
|
|
5019
5008
|
return a.emitError({
|
|
5020
5009
|
origin: "TemplateManager",
|
|
5021
5010
|
method: "applyTemplate",
|
|
5022
|
-
code:
|
|
5011
|
+
code: ct.TEMPLATE_MANAGER.APPLY_FAILED,
|
|
5023
5012
|
message: "Ошибка применения шаблона",
|
|
5024
5013
|
data: {
|
|
5025
5014
|
templateId: l,
|
|
5026
|
-
error:
|
|
5015
|
+
error: b
|
|
5027
5016
|
}
|
|
5028
5017
|
}), null;
|
|
5029
5018
|
} finally {
|
|
@@ -5035,7 +5024,7 @@ class z {
|
|
|
5035
5024
|
* Подготавливает объекты для сериализации.
|
|
5036
5025
|
*/
|
|
5037
5026
|
static _collectObjects(t) {
|
|
5038
|
-
return t ? t instanceof
|
|
5027
|
+
return t ? t instanceof U ? t.getObjects() : [t] : [];
|
|
5039
5028
|
}
|
|
5040
5029
|
/**
|
|
5041
5030
|
* Возвращает габариты объекта.
|
|
@@ -5056,14 +5045,120 @@ class z {
|
|
|
5056
5045
|
}
|
|
5057
5046
|
}
|
|
5058
5047
|
/**
|
|
5059
|
-
|
|
5060
|
-
|
|
5048
|
+
* Превращает plain-описание объектов в Fabric объекты.
|
|
5049
|
+
*/
|
|
5061
5050
|
static _enlivenObjects(t) {
|
|
5062
|
-
return
|
|
5063
|
-
|
|
5064
|
-
|
|
5051
|
+
return O(this, null, function* () {
|
|
5052
|
+
return (yield Promise.all(t.map((s) => O(null, null, function* () {
|
|
5053
|
+
if (E._hasSerializedSvgMarkup(s)) {
|
|
5054
|
+
const i = yield E._reviveSvgObject(s);
|
|
5055
|
+
if (i)
|
|
5056
|
+
return E._restoreImageScale({ revived: i, serialized: s }), i;
|
|
5057
|
+
}
|
|
5058
|
+
const o = yield it.enlivenObjects([s]), n = o == null ? void 0 : o[0];
|
|
5059
|
+
return n ? (E._restoreImageScale({ revived: n, serialized: s }), n) : null;
|
|
5060
|
+
})))).filter((s) => !!s);
|
|
5061
|
+
});
|
|
5062
|
+
}
|
|
5063
|
+
/**
|
|
5064
|
+
* Восстанавливает масштаб изображения, если его фактический размер отличается от сериализованного.
|
|
5065
|
+
*/
|
|
5066
|
+
static _restoreImageScale({
|
|
5067
|
+
revived: t,
|
|
5068
|
+
serialized: e
|
|
5069
|
+
}) {
|
|
5070
|
+
if ((typeof t.type == "string" ? t.type.toLowerCase() : "") !== "image") return;
|
|
5071
|
+
const {
|
|
5072
|
+
width: o,
|
|
5073
|
+
height: n,
|
|
5074
|
+
scaleX: i,
|
|
5075
|
+
scaleY: a
|
|
5076
|
+
} = e, r = t, c = "getElement" in r && typeof r.getElement == "function" ? r.getElement() : null, {
|
|
5077
|
+
naturalWidth: h = 0,
|
|
5078
|
+
naturalHeight: l = 0,
|
|
5079
|
+
width: u = 0,
|
|
5080
|
+
height: g = 0
|
|
5081
|
+
} = c instanceof HTMLImageElement ? c : {
|
|
5082
|
+
naturalWidth: 0,
|
|
5083
|
+
naturalHeight: 0,
|
|
5084
|
+
width: 0,
|
|
5085
|
+
height: 0
|
|
5086
|
+
}, f = $({ value: h || u || r.width, fallback: 0 }), m = $({ value: l || g || r.height, fallback: 0 }), y = $({ value: o, fallback: f }), p = $({ value: n, fallback: m }), M = $({ value: i, fallback: r.scaleX || 1 }), b = $({ value: a, fallback: r.scaleY || 1 }), A = y * M, x = p * b, v = f ? A / f : null, S = m ? x / m : null, L = {};
|
|
5087
|
+
f > 0 && (L.width = f), m > 0 && (L.height = m), v && v > 0 && (L.scaleX = v), S && S > 0 && (L.scaleY = S), r.set(L);
|
|
5088
|
+
}
|
|
5089
|
+
/**
|
|
5090
|
+
* Проверяет, содержит ли сериализованный объект инлайн SVG.
|
|
5091
|
+
*/
|
|
5092
|
+
static _hasSerializedSvgMarkup(t) {
|
|
5093
|
+
return typeof t.svgMarkup == "string" && !!t.svgMarkup.trim();
|
|
5094
|
+
}
|
|
5095
|
+
/**
|
|
5096
|
+
* Восстанавливает SVG-объект из компактного описания.
|
|
5097
|
+
*/
|
|
5098
|
+
static _reviveSvgObject(t) {
|
|
5099
|
+
return O(this, null, function* () {
|
|
5100
|
+
const e = typeof t.svgMarkup == "string" ? t.svgMarkup : null;
|
|
5101
|
+
if (!e) return null;
|
|
5102
|
+
try {
|
|
5103
|
+
const s = yield Fe(e), o = it.groupSVGElements(s.objects, s.options), n = E._prepareSerializableProps(t), i = yield E._reviveClipPath(n.clipPath);
|
|
5104
|
+
return i ? n.clipPath = i : "clipPath" in n && delete n.clipPath, o.set(n), o.setCoords(), o;
|
|
5105
|
+
} catch (s) {
|
|
5106
|
+
return null;
|
|
5107
|
+
}
|
|
5108
|
+
});
|
|
5109
|
+
}
|
|
5110
|
+
/**
|
|
5111
|
+
* Восстанавливает clipPath из сериализованного объекта в инстанс FabricObject.
|
|
5112
|
+
*/
|
|
5113
|
+
static _reviveClipPath(t) {
|
|
5114
|
+
return O(this, null, function* () {
|
|
5115
|
+
var e;
|
|
5116
|
+
if (!t || typeof t != "object") return null;
|
|
5117
|
+
try {
|
|
5118
|
+
const s = yield it.enlivenObjects([t]);
|
|
5119
|
+
return (e = s == null ? void 0 : s[0]) != null ? e : null;
|
|
5120
|
+
} catch (s) {
|
|
5121
|
+
return null;
|
|
5122
|
+
}
|
|
5065
5123
|
});
|
|
5066
5124
|
}
|
|
5125
|
+
/**
|
|
5126
|
+
* Убирает технические поля сериализации, оставляя только применимые свойства.
|
|
5127
|
+
*/
|
|
5128
|
+
static _prepareSerializableProps(t) {
|
|
5129
|
+
const e = k({}, t);
|
|
5130
|
+
return delete e.svgMarkup, delete e.objects, delete e.path, delete e.paths, delete e.type, delete e.version, e;
|
|
5131
|
+
}
|
|
5132
|
+
/**
|
|
5133
|
+
* Определяет, что объект представляет SVG.
|
|
5134
|
+
*/
|
|
5135
|
+
static _isSvgObject(t) {
|
|
5136
|
+
return t.format === "svg";
|
|
5137
|
+
}
|
|
5138
|
+
/**
|
|
5139
|
+
* Превращает объект в компактную SVG-строку, добавляя корневой тег при необходимости.
|
|
5140
|
+
*/
|
|
5141
|
+
static _extractSvgMarkup(t) {
|
|
5142
|
+
const e = t.toSVG;
|
|
5143
|
+
if (typeof e != "function") return null;
|
|
5144
|
+
try {
|
|
5145
|
+
const s = e.call(t);
|
|
5146
|
+
if (!s) return null;
|
|
5147
|
+
if (/<svg[\s>]/i.test(s)) return s;
|
|
5148
|
+
const { width: n, height: i } = t.getBoundingRect(!1, !0), a = n || t.width || 0, r = i || t.height || 0;
|
|
5149
|
+
return `
|
|
5150
|
+
<svg
|
|
5151
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
5152
|
+
width="${a}"
|
|
5153
|
+
height="${r}"
|
|
5154
|
+
viewBox="0 0 ${a} ${r}">
|
|
5155
|
+
${s}
|
|
5156
|
+
</svg>
|
|
5157
|
+
`;
|
|
5158
|
+
} catch (s) {
|
|
5159
|
+
return null;
|
|
5160
|
+
}
|
|
5161
|
+
}
|
|
5067
5162
|
/**
|
|
5068
5163
|
* Трансформирует объект в координаты целевой области.
|
|
5069
5164
|
*/
|
|
@@ -5077,28 +5172,75 @@ class z {
|
|
|
5077
5172
|
montageArea: a,
|
|
5078
5173
|
useRelativePositions: r
|
|
5079
5174
|
}) {
|
|
5080
|
-
const { x:
|
|
5175
|
+
const c = t, { x: h, y: l } = Rs({
|
|
5081
5176
|
object: t,
|
|
5082
5177
|
baseWidth: n,
|
|
5083
5178
|
baseHeight: i,
|
|
5084
5179
|
useRelativePositions: r,
|
|
5085
5180
|
centerKeys: {
|
|
5086
|
-
x:
|
|
5087
|
-
y:
|
|
5181
|
+
x: Qt,
|
|
5182
|
+
y: $t
|
|
5088
5183
|
}
|
|
5089
|
-
}), { scaleX:
|
|
5090
|
-
normalizedX: c,
|
|
5091
|
-
normalizedY: h,
|
|
5184
|
+
}), { scaleX: u, scaleY: g } = t, f = $({ value: u, fallback: 1 }), m = $({ value: g, fallback: 1 }), y = E._getPositioningBounds({
|
|
5092
5185
|
bounds: s,
|
|
5186
|
+
baseWidth: n,
|
|
5187
|
+
baseHeight: i,
|
|
5188
|
+
scale: e,
|
|
5189
|
+
useRelativePositions: r,
|
|
5190
|
+
anchorX: E._resolveAnchor(c, Jt),
|
|
5191
|
+
anchorY: E._resolveAnchor(c, qt)
|
|
5192
|
+
}), p = xs({
|
|
5193
|
+
normalizedX: h,
|
|
5194
|
+
normalizedY: l,
|
|
5195
|
+
bounds: y,
|
|
5093
5196
|
targetSize: o,
|
|
5094
5197
|
montageArea: a
|
|
5095
|
-
}),
|
|
5198
|
+
}), M = f * e, b = m * e;
|
|
5096
5199
|
t.set({
|
|
5097
|
-
scaleX:
|
|
5098
|
-
scaleY:
|
|
5099
|
-
}), t.setPositionByOrigin(
|
|
5100
|
-
|
|
5101
|
-
|
|
5200
|
+
scaleX: M,
|
|
5201
|
+
scaleY: b
|
|
5202
|
+
}), t.setPositionByOrigin(p, "center", "center"), t.setCoords(), delete c[Qt], delete c[$t], delete c[Jt], delete c[qt];
|
|
5203
|
+
}
|
|
5204
|
+
/**
|
|
5205
|
+
* Возвращает bounds, в которых должны позиционироваться нормализованные объекты.
|
|
5206
|
+
* Для нормализованных позиций используем размеры сцены после масштабирования (letterbox/pillarbox).
|
|
5207
|
+
*/
|
|
5208
|
+
static _getPositioningBounds({
|
|
5209
|
+
bounds: t,
|
|
5210
|
+
baseWidth: e,
|
|
5211
|
+
baseHeight: s,
|
|
5212
|
+
scale: o,
|
|
5213
|
+
useRelativePositions: n,
|
|
5214
|
+
anchorX: i,
|
|
5215
|
+
anchorY: a
|
|
5216
|
+
}) {
|
|
5217
|
+
if (!n) return t;
|
|
5218
|
+
const r = (e || t.width) * o, c = (s || t.height) * o, h = t.width - r, l = t.height - c, u = t.left + E._calculateAnchorOffset(i, h), g = t.top + E._calculateAnchorOffset(a, l);
|
|
5219
|
+
return {
|
|
5220
|
+
left: u,
|
|
5221
|
+
top: g,
|
|
5222
|
+
width: r,
|
|
5223
|
+
height: c
|
|
5224
|
+
};
|
|
5225
|
+
}
|
|
5226
|
+
static _calculateAnchorOffset(t, e) {
|
|
5227
|
+
return e <= 0 ? 0 : t === "end" ? e : t === "center" ? e / 2 : 0;
|
|
5228
|
+
}
|
|
5229
|
+
static _resolveAnchor(t, e) {
|
|
5230
|
+
const s = t[e];
|
|
5231
|
+
return s === "center" || s === "end" || s === "start" ? s : "start";
|
|
5232
|
+
}
|
|
5233
|
+
static _detectAnchor({
|
|
5234
|
+
start: t,
|
|
5235
|
+
end: e
|
|
5236
|
+
}) {
|
|
5237
|
+
const s = t <= 0.05, o = e >= 0.95, n = t < 0, i = e > 1, a = e - t, r = Math.max(0, t), c = Math.max(0, 1 - e);
|
|
5238
|
+
if (s && o || n && i)
|
|
5239
|
+
return a >= 0.98 ? "center" : r <= c ? "start" : "end";
|
|
5240
|
+
if (s || n) return "start";
|
|
5241
|
+
if (o || i) return "end";
|
|
5242
|
+
const h = r - c;
|
|
5243
|
+
return Math.abs(h) <= 0.1 ? "center" : h < 0 ? "start" : "end";
|
|
5102
5244
|
}
|
|
5103
5245
|
/**
|
|
5104
5246
|
* Нормализует мета-данные шаблона.
|
|
@@ -5107,8 +5249,8 @@ class z {
|
|
|
5107
5249
|
meta: t,
|
|
5108
5250
|
fallback: e
|
|
5109
5251
|
}) {
|
|
5110
|
-
const { width: s, height: o } = e, r = t || {}, { baseWidth: n = s, baseHeight: i = o } = r, a =
|
|
5111
|
-
return
|
|
5252
|
+
const { width: s, height: o } = e, r = t || {}, { baseWidth: n = s, baseHeight: i = o } = r, a = rt(r, ["baseWidth", "baseHeight"]);
|
|
5253
|
+
return k({
|
|
5112
5254
|
baseWidth: n,
|
|
5113
5255
|
baseHeight: i
|
|
5114
5256
|
}, a);
|
|
@@ -5135,7 +5277,7 @@ class z {
|
|
|
5135
5277
|
t.setActiveObject(e[0]);
|
|
5136
5278
|
return;
|
|
5137
5279
|
}
|
|
5138
|
-
const s = new
|
|
5280
|
+
const s = new U(e, { canvas: t });
|
|
5139
5281
|
t.setActiveObject(s);
|
|
5140
5282
|
}
|
|
5141
5283
|
/**
|
|
@@ -5159,25 +5301,37 @@ class z {
|
|
|
5159
5301
|
baseHeight: o,
|
|
5160
5302
|
montageArea: n
|
|
5161
5303
|
}) {
|
|
5162
|
-
const i = t.toDatalessObject([...
|
|
5304
|
+
const i = t.toDatalessObject([...ke]);
|
|
5305
|
+
if (E._isSvgObject(t)) {
|
|
5306
|
+
const A = E._extractSvgMarkup(t);
|
|
5307
|
+
A && (i.svgMarkup = A, delete i.objects, delete i.path);
|
|
5308
|
+
}
|
|
5163
5309
|
if (!e) return i;
|
|
5164
5310
|
const {
|
|
5165
5311
|
left: a,
|
|
5166
5312
|
top: r,
|
|
5167
5313
|
width: c,
|
|
5168
5314
|
height: h
|
|
5169
|
-
} = e, l = t.getBoundingRect(!1, !0),
|
|
5315
|
+
} = e, l = t.getBoundingRect(!1, !0), u = s || c || 1, g = o || h || 1, f = Bs({
|
|
5170
5316
|
object: t,
|
|
5171
5317
|
montageArea: n,
|
|
5172
5318
|
bounds: e
|
|
5173
|
-
})
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
}
|
|
5180
|
-
return i
|
|
5319
|
+
}), m = f != null ? f : (() => {
|
|
5320
|
+
const A = t.getCenterPoint();
|
|
5321
|
+
return {
|
|
5322
|
+
x: (A.x - a) / u,
|
|
5323
|
+
y: (A.y - r) / g
|
|
5324
|
+
};
|
|
5325
|
+
})(), y = (l.left - a) / u, p = (l.top - r) / g, M = y + l.width / u, b = p + l.height / g;
|
|
5326
|
+
return i[Qt] = m.x, i[$t] = m.y, i[Jt] = E._detectAnchor({
|
|
5327
|
+
center: m.x,
|
|
5328
|
+
start: y,
|
|
5329
|
+
end: M
|
|
5330
|
+
}), i[qt] = E._detectAnchor({
|
|
5331
|
+
center: m.y,
|
|
5332
|
+
start: p,
|
|
5333
|
+
end: b
|
|
5334
|
+
}), i.left = y, i.top = p, i;
|
|
5181
5335
|
}
|
|
5182
5336
|
/**
|
|
5183
5337
|
* Делит список объектов на фон и контент по id === 'background'.
|
|
@@ -5193,13 +5347,13 @@ class z {
|
|
|
5193
5347
|
* Применяет фоновый объект шаблона к текущему холсту через BackgroundManager.
|
|
5194
5348
|
*/
|
|
5195
5349
|
static _applyBackgroundFromObject(o) {
|
|
5196
|
-
return
|
|
5350
|
+
return O(this, arguments, function* ({
|
|
5197
5351
|
backgroundObject: t,
|
|
5198
5352
|
backgroundManager: e,
|
|
5199
5353
|
errorManager: s
|
|
5200
5354
|
}) {
|
|
5201
5355
|
try {
|
|
5202
|
-
const { fill: n, customData: i } = t, { backgroundType: a } = t, r =
|
|
5356
|
+
const { fill: n, customData: i } = t, { backgroundType: a } = t, r = E._cloneCustomData(i);
|
|
5203
5357
|
if (a === "color" && typeof n == "string")
|
|
5204
5358
|
return e.setColorBackground({
|
|
5205
5359
|
color: n,
|
|
@@ -5207,7 +5361,7 @@ class z {
|
|
|
5207
5361
|
withoutSave: !0
|
|
5208
5362
|
}), !0;
|
|
5209
5363
|
if (a === "gradient") {
|
|
5210
|
-
const c =
|
|
5364
|
+
const c = Us(n);
|
|
5211
5365
|
if (c)
|
|
5212
5366
|
return e.setGradientBackground({
|
|
5213
5367
|
gradient: c,
|
|
@@ -5216,7 +5370,7 @@ class z {
|
|
|
5216
5370
|
}), !0;
|
|
5217
5371
|
}
|
|
5218
5372
|
if (a === "image") {
|
|
5219
|
-
const c =
|
|
5373
|
+
const c = E._getImageSource(t);
|
|
5220
5374
|
if (c)
|
|
5221
5375
|
return yield e.setImageBackground({
|
|
5222
5376
|
imageSource: c,
|
|
@@ -5228,7 +5382,7 @@ class z {
|
|
|
5228
5382
|
s.emitWarning({
|
|
5229
5383
|
origin: "TemplateManager",
|
|
5230
5384
|
method: "applyTemplate",
|
|
5231
|
-
code:
|
|
5385
|
+
code: ct.TEMPLATE_MANAGER.APPLY_FAILED,
|
|
5232
5386
|
message: "Не удалось применить фон из шаблона",
|
|
5233
5387
|
data: n
|
|
5234
5388
|
});
|
|
@@ -5258,7 +5412,7 @@ class z {
|
|
|
5258
5412
|
*/
|
|
5259
5413
|
static _cloneCustomData(t) {
|
|
5260
5414
|
if (!(!t || typeof t != "object"))
|
|
5261
|
-
return
|
|
5415
|
+
return k({}, t);
|
|
5262
5416
|
}
|
|
5263
5417
|
/**
|
|
5264
5418
|
* Извлекает src изображения из FabricImage или его исходного элемента.
|
|
@@ -5278,14 +5432,14 @@ class z {
|
|
|
5278
5432
|
return typeof s.src == "string" ? s.src : null;
|
|
5279
5433
|
}
|
|
5280
5434
|
}
|
|
5281
|
-
class
|
|
5435
|
+
class le {
|
|
5282
5436
|
/**
|
|
5283
5437
|
* Конструктор класса ImageEditor.
|
|
5284
5438
|
* @param canvasId - идентификатор канваса, в котором будет создан редактор
|
|
5285
5439
|
* @param options - опции и настройки редактора
|
|
5286
5440
|
*/
|
|
5287
5441
|
constructor(t, e) {
|
|
5288
|
-
this.options = e, this.containerId = t, this.editorId = `${t}-${
|
|
5442
|
+
this.options = e, this.containerId = t, this.editorId = `${t}-${P()}`, this.clipboard = null, this.init();
|
|
5289
5443
|
}
|
|
5290
5444
|
/**
|
|
5291
5445
|
* Инициализация редактора.
|
|
@@ -5293,8 +5447,8 @@ class ce {
|
|
|
5293
5447
|
* @fires editor:ready
|
|
5294
5448
|
*/
|
|
5295
5449
|
init() {
|
|
5296
|
-
return
|
|
5297
|
-
var
|
|
5450
|
+
return O(this, null, function* () {
|
|
5451
|
+
var u;
|
|
5298
5452
|
const {
|
|
5299
5453
|
editorContainerWidth: t,
|
|
5300
5454
|
editorContainerHeight: e,
|
|
@@ -5308,13 +5462,13 @@ class ce {
|
|
|
5308
5462
|
showRotationAngle: h,
|
|
5309
5463
|
_onReadyCallback: l
|
|
5310
5464
|
} = this.options;
|
|
5311
|
-
if (
|
|
5465
|
+
if (yt.apply(), this.canvas = new We(this.containerId, this.options), this.moduleLoader = new Xe(), this.workerManager = new Qe(), this.errorManager = new Nt({ editor: this }), this.historyManager = new Ht({ editor: this }), this.toolbar = new us({ editor: this }), this.transformManager = new js({ editor: this }), this.zoomManager = new As({ editor: this }), this.canvasManager = new ws({ editor: this }), this.imageManager = new et({ editor: this }), this.layerManager = new Zt({ editor: this }), this.shapeManager = new Is({ editor: this }), this.interactionBlocker = new Ss({ editor: this }), this.backgroundManager = new Mt({ editor: this }), this.clipboardManager = new Cs({ editor: this }), this.objectLockManager = new Vt({ editor: this }), this.groupingManager = new Es({ editor: this }), this.selectionManager = new Ts({ editor: this }), this.deletionManager = new de({ editor: this }), this.panConstraintManager = new Os({ editor: this }), this.fontManager = new ne((u = this.options.fonts) != null ? u : []), this.textManager = new Q({ editor: this }), this.templateManager = new E({ editor: this }), h && (this.angleIndicator = new ce({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.listeners = new Lt({ editor: this, options: this.options }), this.canvasManager.setEditorContainerWidth(t), this.canvasManager.setEditorContainerHeight(e), this.canvasManager.setCanvasWrapperWidth(s), this.canvasManager.setCanvasWrapperHeight(o), this.canvasManager.setCanvasCSSWidth(n), this.canvasManager.setCanvasCSSHeight(i), this.canvasManager.updateCanvas(), this.zoomManager.calculateAndApplyDefaultZoom(), yield this.fontManager.loadFonts(), a != null && a.source) {
|
|
5312
5466
|
const {
|
|
5313
|
-
source:
|
|
5467
|
+
source: g,
|
|
5314
5468
|
scale: f = `image-${c}`,
|
|
5315
5469
|
withoutSave: m = !0
|
|
5316
5470
|
} = a;
|
|
5317
|
-
yield this.imageManager.importImage({ source:
|
|
5471
|
+
yield this.imageManager.importImage({ source: g, scale: f, withoutSave: m });
|
|
5318
5472
|
}
|
|
5319
5473
|
r && this.historyManager.loadStateFromFullState(r), this.historyManager.saveState(), console.log("editor:ready"), this.canvas.fire("editor:ready", this), typeof l == "function" && l(this);
|
|
5320
5474
|
});
|
|
@@ -5330,7 +5484,7 @@ class ce {
|
|
|
5330
5484
|
this.montageArea = this.shapeManager.addRectangle({
|
|
5331
5485
|
width: t,
|
|
5332
5486
|
height: e,
|
|
5333
|
-
fill:
|
|
5487
|
+
fill: le._createMosaicPattern(),
|
|
5334
5488
|
stroke: null,
|
|
5335
5489
|
strokeWidth: 0,
|
|
5336
5490
|
selectable: !1,
|
|
@@ -5381,13 +5535,13 @@ class ce {
|
|
|
5381
5535
|
const t = document.createElement("canvas");
|
|
5382
5536
|
t.width = 20, t.height = 20;
|
|
5383
5537
|
const e = t.getContext("2d");
|
|
5384
|
-
return e.fillStyle = "#ddd", e.fillRect(0, 0, 40, 40), e.fillStyle = "#ccc", e.fillRect(0, 0, 10, 10), e.fillRect(10, 10, 10, 10), new
|
|
5538
|
+
return e.fillStyle = "#ddd", e.fillRect(0, 0, 40, 40), e.fillStyle = "#ccc", e.fillRect(0, 0, 10, 10), e.fillRect(10, 10, 10, 10), new He({
|
|
5385
5539
|
source: t,
|
|
5386
5540
|
repeat: "repeat"
|
|
5387
5541
|
});
|
|
5388
5542
|
}
|
|
5389
5543
|
}
|
|
5390
|
-
const
|
|
5544
|
+
const w = [
|
|
5391
5545
|
"U+0000-00FF",
|
|
5392
5546
|
"U+0131",
|
|
5393
5547
|
"U+0152-0153",
|
|
@@ -5407,13 +5561,13 @@ const X = [
|
|
|
5407
5561
|
"U+2215",
|
|
5408
5562
|
"U+FEFF",
|
|
5409
5563
|
"U+FFFD"
|
|
5410
|
-
].join(", "),
|
|
5564
|
+
].join(", "), j = [
|
|
5411
5565
|
"U+0301",
|
|
5412
5566
|
"U+0400-045F",
|
|
5413
5567
|
"U+0490-0491",
|
|
5414
5568
|
"U+04B0-04B1",
|
|
5415
5569
|
"U+2116"
|
|
5416
|
-
].join(", "),
|
|
5570
|
+
].join(", "), zs = [
|
|
5417
5571
|
{
|
|
5418
5572
|
family: "Arial",
|
|
5419
5573
|
source: 'local("Arial"), local("Liberation Sans"), local("DejaVu Sans")',
|
|
@@ -5430,7 +5584,7 @@ const X = [
|
|
|
5430
5584
|
style: "normal",
|
|
5431
5585
|
weight: "400",
|
|
5432
5586
|
display: "swap",
|
|
5433
|
-
unicodeRange:
|
|
5587
|
+
unicodeRange: j
|
|
5434
5588
|
}
|
|
5435
5589
|
},
|
|
5436
5590
|
{
|
|
@@ -5440,7 +5594,7 @@ const X = [
|
|
|
5440
5594
|
style: "normal",
|
|
5441
5595
|
weight: "400",
|
|
5442
5596
|
display: "swap",
|
|
5443
|
-
unicodeRange:
|
|
5597
|
+
unicodeRange: w
|
|
5444
5598
|
}
|
|
5445
5599
|
},
|
|
5446
5600
|
{
|
|
@@ -5450,7 +5604,7 @@ const X = [
|
|
|
5450
5604
|
style: "normal",
|
|
5451
5605
|
weight: "700",
|
|
5452
5606
|
display: "swap",
|
|
5453
|
-
unicodeRange:
|
|
5607
|
+
unicodeRange: j
|
|
5454
5608
|
}
|
|
5455
5609
|
},
|
|
5456
5610
|
{
|
|
@@ -5460,7 +5614,7 @@ const X = [
|
|
|
5460
5614
|
style: "normal",
|
|
5461
5615
|
weight: "700",
|
|
5462
5616
|
display: "swap",
|
|
5463
|
-
unicodeRange:
|
|
5617
|
+
unicodeRange: w
|
|
5464
5618
|
}
|
|
5465
5619
|
},
|
|
5466
5620
|
{
|
|
@@ -5470,7 +5624,7 @@ const X = [
|
|
|
5470
5624
|
style: "normal",
|
|
5471
5625
|
weight: "200 700",
|
|
5472
5626
|
display: "swap",
|
|
5473
|
-
unicodeRange:
|
|
5627
|
+
unicodeRange: j
|
|
5474
5628
|
}
|
|
5475
5629
|
},
|
|
5476
5630
|
{
|
|
@@ -5480,7 +5634,7 @@ const X = [
|
|
|
5480
5634
|
style: "normal",
|
|
5481
5635
|
weight: "200 700",
|
|
5482
5636
|
display: "swap",
|
|
5483
|
-
unicodeRange:
|
|
5637
|
+
unicodeRange: w
|
|
5484
5638
|
}
|
|
5485
5639
|
},
|
|
5486
5640
|
{
|
|
@@ -5490,7 +5644,7 @@ const X = [
|
|
|
5490
5644
|
style: "normal",
|
|
5491
5645
|
weight: "300 900",
|
|
5492
5646
|
display: "swap",
|
|
5493
|
-
unicodeRange:
|
|
5647
|
+
unicodeRange: j
|
|
5494
5648
|
}
|
|
5495
5649
|
},
|
|
5496
5650
|
{
|
|
@@ -5500,7 +5654,7 @@ const X = [
|
|
|
5500
5654
|
style: "normal",
|
|
5501
5655
|
weight: "300 900",
|
|
5502
5656
|
display: "swap",
|
|
5503
|
-
unicodeRange:
|
|
5657
|
+
unicodeRange: w
|
|
5504
5658
|
}
|
|
5505
5659
|
},
|
|
5506
5660
|
{
|
|
@@ -5510,7 +5664,7 @@ const X = [
|
|
|
5510
5664
|
style: "normal",
|
|
5511
5665
|
weight: "400 700",
|
|
5512
5666
|
display: "swap",
|
|
5513
|
-
unicodeRange:
|
|
5667
|
+
unicodeRange: j
|
|
5514
5668
|
}
|
|
5515
5669
|
},
|
|
5516
5670
|
{
|
|
@@ -5520,7 +5674,7 @@ const X = [
|
|
|
5520
5674
|
style: "normal",
|
|
5521
5675
|
weight: "400 700",
|
|
5522
5676
|
display: "swap",
|
|
5523
|
-
unicodeRange:
|
|
5677
|
+
unicodeRange: w
|
|
5524
5678
|
}
|
|
5525
5679
|
},
|
|
5526
5680
|
{
|
|
@@ -5530,7 +5684,7 @@ const X = [
|
|
|
5530
5684
|
style: "normal",
|
|
5531
5685
|
weight: "300 700",
|
|
5532
5686
|
display: "swap",
|
|
5533
|
-
unicodeRange:
|
|
5687
|
+
unicodeRange: j
|
|
5534
5688
|
}
|
|
5535
5689
|
},
|
|
5536
5690
|
{
|
|
@@ -5540,7 +5694,7 @@ const X = [
|
|
|
5540
5694
|
style: "normal",
|
|
5541
5695
|
weight: "300 700",
|
|
5542
5696
|
display: "swap",
|
|
5543
|
-
unicodeRange:
|
|
5697
|
+
unicodeRange: w
|
|
5544
5698
|
}
|
|
5545
5699
|
},
|
|
5546
5700
|
{
|
|
@@ -5550,7 +5704,7 @@ const X = [
|
|
|
5550
5704
|
style: "normal",
|
|
5551
5705
|
weight: "300 700",
|
|
5552
5706
|
display: "swap",
|
|
5553
|
-
unicodeRange:
|
|
5707
|
+
unicodeRange: j
|
|
5554
5708
|
}
|
|
5555
5709
|
},
|
|
5556
5710
|
{
|
|
@@ -5560,7 +5714,7 @@ const X = [
|
|
|
5560
5714
|
style: "normal",
|
|
5561
5715
|
weight: "300 700",
|
|
5562
5716
|
display: "swap",
|
|
5563
|
-
unicodeRange:
|
|
5717
|
+
unicodeRange: w
|
|
5564
5718
|
}
|
|
5565
5719
|
},
|
|
5566
5720
|
{
|
|
@@ -5570,7 +5724,7 @@ const X = [
|
|
|
5570
5724
|
style: "normal",
|
|
5571
5725
|
weight: "400",
|
|
5572
5726
|
display: "swap",
|
|
5573
|
-
unicodeRange:
|
|
5727
|
+
unicodeRange: j
|
|
5574
5728
|
}
|
|
5575
5729
|
},
|
|
5576
5730
|
{
|
|
@@ -5580,7 +5734,7 @@ const X = [
|
|
|
5580
5734
|
style: "normal",
|
|
5581
5735
|
weight: "400",
|
|
5582
5736
|
display: "swap",
|
|
5583
|
-
unicodeRange:
|
|
5737
|
+
unicodeRange: w
|
|
5584
5738
|
}
|
|
5585
5739
|
},
|
|
5586
5740
|
{
|
|
@@ -5590,7 +5744,7 @@ const X = [
|
|
|
5590
5744
|
style: "normal",
|
|
5591
5745
|
weight: "400 700",
|
|
5592
5746
|
display: "swap",
|
|
5593
|
-
unicodeRange:
|
|
5747
|
+
unicodeRange: j
|
|
5594
5748
|
}
|
|
5595
5749
|
},
|
|
5596
5750
|
{
|
|
@@ -5600,7 +5754,7 @@ const X = [
|
|
|
5600
5754
|
style: "normal",
|
|
5601
5755
|
weight: "400 700",
|
|
5602
5756
|
display: "swap",
|
|
5603
|
-
unicodeRange:
|
|
5757
|
+
unicodeRange: w
|
|
5604
5758
|
}
|
|
5605
5759
|
},
|
|
5606
5760
|
{
|
|
@@ -5610,7 +5764,7 @@ const X = [
|
|
|
5610
5764
|
style: "normal",
|
|
5611
5765
|
weight: "100 900",
|
|
5612
5766
|
display: "swap",
|
|
5613
|
-
unicodeRange:
|
|
5767
|
+
unicodeRange: j
|
|
5614
5768
|
}
|
|
5615
5769
|
},
|
|
5616
5770
|
{
|
|
@@ -5620,10 +5774,590 @@ const X = [
|
|
|
5620
5774
|
style: "normal",
|
|
5621
5775
|
weight: "100 900",
|
|
5622
5776
|
display: "swap",
|
|
5623
|
-
unicodeRange:
|
|
5777
|
+
unicodeRange: w
|
|
5778
|
+
}
|
|
5779
|
+
},
|
|
5780
|
+
{
|
|
5781
|
+
family: "Anonymous Pro",
|
|
5782
|
+
source: 'url(https://fonts.gstatic.com/s/anonymouspro/v22/rP2Bp2a15UIB7Un-bOeISG3pHl829RH9.woff2) format("woff2")',
|
|
5783
|
+
descriptors: {
|
|
5784
|
+
style: "normal",
|
|
5785
|
+
weight: "400",
|
|
5786
|
+
display: "swap",
|
|
5787
|
+
unicodeRange: j
|
|
5788
|
+
}
|
|
5789
|
+
},
|
|
5790
|
+
{
|
|
5791
|
+
family: "Anonymous Pro",
|
|
5792
|
+
source: 'url(https://fonts.gstatic.com/s/anonymouspro/v22/rP2Bp2a15UIB7Un-bOeISG3pHls29Q.woff2) format("woff2")',
|
|
5793
|
+
descriptors: {
|
|
5794
|
+
style: "normal",
|
|
5795
|
+
weight: "400",
|
|
5796
|
+
display: "swap",
|
|
5797
|
+
unicodeRange: w
|
|
5798
|
+
}
|
|
5799
|
+
},
|
|
5800
|
+
{
|
|
5801
|
+
family: "Anonymous Pro",
|
|
5802
|
+
source: 'url(https://fonts.gstatic.com/s/anonymouspro/v22/rP2cp2a15UIB7Un-bOeISG3pFuAT4Crc7ZOy.woff2) format("woff2")',
|
|
5803
|
+
descriptors: {
|
|
5804
|
+
style: "normal",
|
|
5805
|
+
weight: "700",
|
|
5806
|
+
display: "swap",
|
|
5807
|
+
unicodeRange: j
|
|
5808
|
+
}
|
|
5809
|
+
},
|
|
5810
|
+
{
|
|
5811
|
+
family: "Anonymous Pro",
|
|
5812
|
+
source: 'url(https://fonts.gstatic.com/s/anonymouspro/v22/rP2cp2a15UIB7Un-bOeISG3pFuAT4C7c7Q.woff2) format("woff2")',
|
|
5813
|
+
descriptors: {
|
|
5814
|
+
style: "normal",
|
|
5815
|
+
weight: "700",
|
|
5816
|
+
display: "swap",
|
|
5817
|
+
unicodeRange: w
|
|
5818
|
+
}
|
|
5819
|
+
},
|
|
5820
|
+
{
|
|
5821
|
+
family: "El Messiri",
|
|
5822
|
+
source: 'url(https://fonts.gstatic.com/s/elmessiri/v25/K2F0fZBRmr9vQ1pHEey6MomAAhLz.woff2) format("woff2")',
|
|
5823
|
+
descriptors: {
|
|
5824
|
+
style: "normal",
|
|
5825
|
+
weight: "400 700",
|
|
5826
|
+
display: "swap",
|
|
5827
|
+
unicodeRange: j
|
|
5828
|
+
}
|
|
5829
|
+
},
|
|
5830
|
+
{
|
|
5831
|
+
family: "El Messiri",
|
|
5832
|
+
source: 'url(https://fonts.gstatic.com/s/elmessiri/v25/K2F0fZBRmr9vQ1pHEey6Mo2AAg.woff2) format("woff2")',
|
|
5833
|
+
descriptors: {
|
|
5834
|
+
style: "normal",
|
|
5835
|
+
weight: "400 700",
|
|
5836
|
+
display: "swap",
|
|
5837
|
+
unicodeRange: w
|
|
5838
|
+
}
|
|
5839
|
+
},
|
|
5840
|
+
{
|
|
5841
|
+
family: "Exo 2",
|
|
5842
|
+
source: 'url(https://fonts.gstatic.com/s/exo2/v26/7cHmv4okm5zmbtYsK-4E4Q.woff2) format("woff2")',
|
|
5843
|
+
descriptors: {
|
|
5844
|
+
style: "normal",
|
|
5845
|
+
weight: "100 900",
|
|
5846
|
+
display: "swap",
|
|
5847
|
+
unicodeRange: j
|
|
5848
|
+
}
|
|
5849
|
+
},
|
|
5850
|
+
{
|
|
5851
|
+
family: "Exo 2",
|
|
5852
|
+
source: 'url(https://fonts.gstatic.com/s/exo2/v26/7cHmv4okm5zmbtYoK-4.woff2) format("woff2")',
|
|
5853
|
+
descriptors: {
|
|
5854
|
+
style: "normal",
|
|
5855
|
+
weight: "100 900",
|
|
5856
|
+
display: "swap",
|
|
5857
|
+
unicodeRange: w
|
|
5858
|
+
}
|
|
5859
|
+
},
|
|
5860
|
+
{
|
|
5861
|
+
family: "Fira Sans",
|
|
5862
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9C4kDNxMZdWfMOD5Vn9LjNYTLHdQ.woff2) format("woff2")',
|
|
5863
|
+
descriptors: {
|
|
5864
|
+
style: "normal",
|
|
5865
|
+
weight: "100",
|
|
5866
|
+
display: "swap",
|
|
5867
|
+
unicodeRange: j
|
|
5868
|
+
}
|
|
5869
|
+
},
|
|
5870
|
+
{
|
|
5871
|
+
family: "Fira Sans",
|
|
5872
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9C4kDNxMZdWfMOD5Vn9LjJYTI.woff2) format("woff2")',
|
|
5873
|
+
descriptors: {
|
|
5874
|
+
style: "normal",
|
|
5875
|
+
weight: "100",
|
|
5876
|
+
display: "swap",
|
|
5877
|
+
unicodeRange: w
|
|
5878
|
+
}
|
|
5879
|
+
},
|
|
5880
|
+
{
|
|
5881
|
+
family: "Fira Sans",
|
|
5882
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9B4kDNxMZdWfMOD5VnWKneQhf6TF0.woff2) format("woff2")',
|
|
5883
|
+
descriptors: {
|
|
5884
|
+
style: "normal",
|
|
5885
|
+
weight: "200",
|
|
5886
|
+
display: "swap",
|
|
5887
|
+
unicodeRange: j
|
|
5888
|
+
}
|
|
5889
|
+
},
|
|
5890
|
+
{
|
|
5891
|
+
family: "Fira Sans",
|
|
5892
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9B4kDNxMZdWfMOD5VnWKneRhf6.woff2) format("woff2")',
|
|
5893
|
+
descriptors: {
|
|
5894
|
+
style: "normal",
|
|
5895
|
+
weight: "200",
|
|
5896
|
+
display: "swap",
|
|
5897
|
+
unicodeRange: w
|
|
5898
|
+
}
|
|
5899
|
+
},
|
|
5900
|
+
{
|
|
5901
|
+
family: "Fira Sans",
|
|
5902
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9B4kDNxMZdWfMOD5VnPKreQhf6TF0.woff2) format("woff2")',
|
|
5903
|
+
descriptors: {
|
|
5904
|
+
style: "normal",
|
|
5905
|
+
weight: "300",
|
|
5906
|
+
display: "swap",
|
|
5907
|
+
unicodeRange: j
|
|
5908
|
+
}
|
|
5909
|
+
},
|
|
5910
|
+
{
|
|
5911
|
+
family: "Fira Sans",
|
|
5912
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9B4kDNxMZdWfMOD5VnPKreRhf6.woff2) format("woff2")',
|
|
5913
|
+
descriptors: {
|
|
5914
|
+
style: "normal",
|
|
5915
|
+
weight: "300",
|
|
5916
|
+
display: "swap",
|
|
5917
|
+
unicodeRange: w
|
|
5918
|
+
}
|
|
5919
|
+
},
|
|
5920
|
+
{
|
|
5921
|
+
family: "Fira Sans",
|
|
5922
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9E4kDNxMZdWfMOD5Vvk4jLeTY.woff2) format("woff2")',
|
|
5923
|
+
descriptors: {
|
|
5924
|
+
style: "normal",
|
|
5925
|
+
weight: "400",
|
|
5926
|
+
display: "swap",
|
|
5927
|
+
unicodeRange: j
|
|
5928
|
+
}
|
|
5929
|
+
},
|
|
5930
|
+
{
|
|
5931
|
+
family: "Fira Sans",
|
|
5932
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9E4kDNxMZdWfMOD5Vvl4jL.woff2) format("woff2")',
|
|
5933
|
+
descriptors: {
|
|
5934
|
+
style: "normal",
|
|
5935
|
+
weight: "400",
|
|
5936
|
+
display: "swap",
|
|
5937
|
+
unicodeRange: w
|
|
5938
|
+
}
|
|
5939
|
+
},
|
|
5940
|
+
{
|
|
5941
|
+
family: "Fira Sans",
|
|
5942
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9B4kDNxMZdWfMOD5VnZKveQhf6TF0.woff2) format("woff2")',
|
|
5943
|
+
descriptors: {
|
|
5944
|
+
style: "normal",
|
|
5945
|
+
weight: "500",
|
|
5946
|
+
display: "swap",
|
|
5947
|
+
unicodeRange: j
|
|
5948
|
+
}
|
|
5949
|
+
},
|
|
5950
|
+
{
|
|
5951
|
+
family: "Fira Sans",
|
|
5952
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9B4kDNxMZdWfMOD5VnZKveRhf6.woff2) format("woff2")',
|
|
5953
|
+
descriptors: {
|
|
5954
|
+
style: "normal",
|
|
5955
|
+
weight: "500",
|
|
5956
|
+
display: "swap",
|
|
5957
|
+
unicodeRange: w
|
|
5958
|
+
}
|
|
5959
|
+
},
|
|
5960
|
+
{
|
|
5961
|
+
family: "Fira Sans",
|
|
5962
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9B4kDNxMZdWfMOD5VnSKzeQhf6TF0.woff2) format("woff2")',
|
|
5963
|
+
descriptors: {
|
|
5964
|
+
style: "normal",
|
|
5965
|
+
weight: "600",
|
|
5966
|
+
display: "swap",
|
|
5967
|
+
unicodeRange: j
|
|
5968
|
+
}
|
|
5969
|
+
},
|
|
5970
|
+
{
|
|
5971
|
+
family: "Fira Sans",
|
|
5972
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9B4kDNxMZdWfMOD5VnSKzeRhf6.woff2) format("woff2")',
|
|
5973
|
+
descriptors: {
|
|
5974
|
+
style: "normal",
|
|
5975
|
+
weight: "600",
|
|
5976
|
+
display: "swap",
|
|
5977
|
+
unicodeRange: w
|
|
5978
|
+
}
|
|
5979
|
+
},
|
|
5980
|
+
{
|
|
5981
|
+
family: "Fira Sans",
|
|
5982
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9B4kDNxMZdWfMOD5VnLK3eQhf6TF0.woff2) format("woff2")',
|
|
5983
|
+
descriptors: {
|
|
5984
|
+
style: "normal",
|
|
5985
|
+
weight: "700",
|
|
5986
|
+
display: "swap",
|
|
5987
|
+
unicodeRange: j
|
|
5988
|
+
}
|
|
5989
|
+
},
|
|
5990
|
+
{
|
|
5991
|
+
family: "Fira Sans",
|
|
5992
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9B4kDNxMZdWfMOD5VnLK3eRhf6.woff2) format("woff2")',
|
|
5993
|
+
descriptors: {
|
|
5994
|
+
style: "normal",
|
|
5995
|
+
weight: "700",
|
|
5996
|
+
display: "swap",
|
|
5997
|
+
unicodeRange: w
|
|
5998
|
+
}
|
|
5999
|
+
},
|
|
6000
|
+
{
|
|
6001
|
+
family: "Fira Sans",
|
|
6002
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9B4kDNxMZdWfMOD5VnMK7eQhf6TF0.woff2) format("woff2")',
|
|
6003
|
+
descriptors: {
|
|
6004
|
+
style: "normal",
|
|
6005
|
+
weight: "800",
|
|
6006
|
+
display: "swap",
|
|
6007
|
+
unicodeRange: j
|
|
6008
|
+
}
|
|
6009
|
+
},
|
|
6010
|
+
{
|
|
6011
|
+
family: "Fira Sans",
|
|
6012
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9B4kDNxMZdWfMOD5VnMK7eRhf6.woff2) format("woff2")',
|
|
6013
|
+
descriptors: {
|
|
6014
|
+
style: "normal",
|
|
6015
|
+
weight: "800",
|
|
6016
|
+
display: "swap",
|
|
6017
|
+
unicodeRange: w
|
|
6018
|
+
}
|
|
6019
|
+
},
|
|
6020
|
+
{
|
|
6021
|
+
family: "Fira Sans",
|
|
6022
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9B4kDNxMZdWfMOD5VnFK_eQhf6TF0.woff2) format("woff2")',
|
|
6023
|
+
descriptors: {
|
|
6024
|
+
style: "normal",
|
|
6025
|
+
weight: "900",
|
|
6026
|
+
display: "swap",
|
|
6027
|
+
unicodeRange: j
|
|
6028
|
+
}
|
|
6029
|
+
},
|
|
6030
|
+
{
|
|
6031
|
+
family: "Fira Sans",
|
|
6032
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9B4kDNxMZdWfMOD5VnFK_eRhf6.woff2) format("woff2")',
|
|
6033
|
+
descriptors: {
|
|
6034
|
+
style: "normal",
|
|
6035
|
+
weight: "900",
|
|
6036
|
+
display: "swap",
|
|
6037
|
+
unicodeRange: w
|
|
6038
|
+
}
|
|
6039
|
+
},
|
|
6040
|
+
{
|
|
6041
|
+
family: "Istok Web",
|
|
6042
|
+
source: 'url(https://fonts.gstatic.com/s/istokweb/v26/3qTvojGmgSyUukBzKslpAmt_xkI.woff2) format("woff2")',
|
|
6043
|
+
descriptors: {
|
|
6044
|
+
style: "normal",
|
|
6045
|
+
weight: "400",
|
|
6046
|
+
display: "swap",
|
|
6047
|
+
unicodeRange: j
|
|
6048
|
+
}
|
|
6049
|
+
},
|
|
6050
|
+
{
|
|
6051
|
+
family: "Istok Web",
|
|
6052
|
+
source: 'url(https://fonts.gstatic.com/s/istokweb/v26/3qTvojGmgSyUukBzKslpBmt_.woff2) format("woff2")',
|
|
6053
|
+
descriptors: {
|
|
6054
|
+
style: "normal",
|
|
6055
|
+
weight: "400",
|
|
6056
|
+
display: "swap",
|
|
6057
|
+
unicodeRange: w
|
|
6058
|
+
}
|
|
6059
|
+
},
|
|
6060
|
+
{
|
|
6061
|
+
family: "Istok Web",
|
|
6062
|
+
source: 'url(https://fonts.gstatic.com/s/istokweb/v26/3qTqojGmgSyUukBzKslhvU5q_WMVUBc.woff2) format("woff2")',
|
|
6063
|
+
descriptors: {
|
|
6064
|
+
style: "normal",
|
|
6065
|
+
weight: "700",
|
|
6066
|
+
display: "swap",
|
|
6067
|
+
unicodeRange: j
|
|
6068
|
+
}
|
|
6069
|
+
},
|
|
6070
|
+
{
|
|
6071
|
+
family: "Istok Web",
|
|
6072
|
+
source: 'url(https://fonts.gstatic.com/s/istokweb/v26/3qTqojGmgSyUukBzKslhvU5q-WMV.woff2) format("woff2")',
|
|
6073
|
+
descriptors: {
|
|
6074
|
+
style: "normal",
|
|
6075
|
+
weight: "700",
|
|
6076
|
+
display: "swap",
|
|
6077
|
+
unicodeRange: w
|
|
6078
|
+
}
|
|
6079
|
+
},
|
|
6080
|
+
{
|
|
6081
|
+
family: "Jost",
|
|
6082
|
+
source: 'url(https://fonts.gstatic.com/s/jost/v20/92zatBhPNqw73oDd4iYl.woff2) format("woff2")',
|
|
6083
|
+
descriptors: {
|
|
6084
|
+
style: "normal",
|
|
6085
|
+
weight: "100 900",
|
|
6086
|
+
display: "swap",
|
|
6087
|
+
unicodeRange: j
|
|
6088
|
+
}
|
|
6089
|
+
},
|
|
6090
|
+
{
|
|
6091
|
+
family: "Jost",
|
|
6092
|
+
source: 'url(https://fonts.gstatic.com/s/jost/v20/92zatBhPNqw73oTd4g.woff2) format("woff2")',
|
|
6093
|
+
descriptors: {
|
|
6094
|
+
style: "normal",
|
|
6095
|
+
weight: "100 900",
|
|
6096
|
+
display: "swap",
|
|
6097
|
+
unicodeRange: w
|
|
6098
|
+
}
|
|
6099
|
+
},
|
|
6100
|
+
{
|
|
6101
|
+
family: "Jura",
|
|
6102
|
+
source: 'url(https://fonts.gstatic.com/s/jura/v34/z7NbdRfiaC4VXcBJURRD.woff2) format("woff2")',
|
|
6103
|
+
descriptors: {
|
|
6104
|
+
style: "normal",
|
|
6105
|
+
weight: "300 700",
|
|
6106
|
+
display: "swap",
|
|
6107
|
+
unicodeRange: j
|
|
6108
|
+
}
|
|
6109
|
+
},
|
|
6110
|
+
{
|
|
6111
|
+
family: "Jura",
|
|
6112
|
+
source: 'url(https://fonts.gstatic.com/s/jura/v34/z7NbdRfiaC4VXcRJUQ.woff2) format("woff2")',
|
|
6113
|
+
descriptors: {
|
|
6114
|
+
style: "normal",
|
|
6115
|
+
weight: "300 700",
|
|
6116
|
+
display: "swap",
|
|
6117
|
+
unicodeRange: w
|
|
6118
|
+
}
|
|
6119
|
+
},
|
|
6120
|
+
{
|
|
6121
|
+
family: "Lobster",
|
|
6122
|
+
source: 'url(https://fonts.gstatic.com/s/lobster/v32/neILzCirqoswsqX9zoamM5Ez.woff2) format("woff2")',
|
|
6123
|
+
descriptors: {
|
|
6124
|
+
style: "normal",
|
|
6125
|
+
weight: "400",
|
|
6126
|
+
display: "swap",
|
|
6127
|
+
unicodeRange: j
|
|
6128
|
+
}
|
|
6129
|
+
},
|
|
6130
|
+
{
|
|
6131
|
+
family: "Lobster",
|
|
6132
|
+
source: 'url(https://fonts.gstatic.com/s/lobster/v32/neILzCirqoswsqX9zoKmMw.woff2) format("woff2")',
|
|
6133
|
+
descriptors: {
|
|
6134
|
+
style: "normal",
|
|
6135
|
+
weight: "400",
|
|
6136
|
+
display: "swap",
|
|
6137
|
+
unicodeRange: w
|
|
6138
|
+
}
|
|
6139
|
+
},
|
|
6140
|
+
{
|
|
6141
|
+
family: "Manrope",
|
|
6142
|
+
source: 'url(https://fonts.gstatic.com/s/manrope/v20/xn7gYHE41ni1AdIRggOxSuXd.woff2) format("woff2")',
|
|
6143
|
+
descriptors: {
|
|
6144
|
+
style: "normal",
|
|
6145
|
+
weight: "200 800",
|
|
6146
|
+
display: "swap",
|
|
6147
|
+
unicodeRange: j
|
|
6148
|
+
}
|
|
6149
|
+
},
|
|
6150
|
+
{
|
|
6151
|
+
family: "Manrope",
|
|
6152
|
+
source: 'url(https://fonts.gstatic.com/s/manrope/v20/xn7gYHE41ni1AdIRggexSg.woff2) format("woff2")',
|
|
6153
|
+
descriptors: {
|
|
6154
|
+
style: "normal",
|
|
6155
|
+
weight: "200 800",
|
|
6156
|
+
display: "swap",
|
|
6157
|
+
unicodeRange: w
|
|
6158
|
+
}
|
|
6159
|
+
},
|
|
6160
|
+
{
|
|
6161
|
+
family: "Montserrat",
|
|
6162
|
+
source: 'url(https://fonts.gstatic.com/s/montserrat/v31/JTUSjIg1_i6t8kCHKm459W1hyzbi.woff2) format("woff2")',
|
|
6163
|
+
descriptors: {
|
|
6164
|
+
style: "normal",
|
|
6165
|
+
weight: "100 900",
|
|
6166
|
+
display: "swap",
|
|
6167
|
+
unicodeRange: j
|
|
6168
|
+
}
|
|
6169
|
+
},
|
|
6170
|
+
{
|
|
6171
|
+
family: "Montserrat",
|
|
6172
|
+
source: 'url(https://fonts.gstatic.com/s/montserrat/v31/JTUSjIg1_i6t8kCHKm459Wlhyw.woff2) format("woff2")',
|
|
6173
|
+
descriptors: {
|
|
6174
|
+
style: "normal",
|
|
6175
|
+
weight: "100 900",
|
|
6176
|
+
display: "swap",
|
|
6177
|
+
unicodeRange: w
|
|
6178
|
+
}
|
|
6179
|
+
},
|
|
6180
|
+
{
|
|
6181
|
+
family: "Neucha",
|
|
6182
|
+
source: 'url(https://fonts.gstatic.com/s/neucha/v18/q5uGsou0JOdh94bfuQltOxU.woff2) format("woff2")',
|
|
6183
|
+
descriptors: {
|
|
6184
|
+
style: "normal",
|
|
6185
|
+
weight: "400",
|
|
6186
|
+
display: "swap",
|
|
6187
|
+
unicodeRange: j
|
|
6188
|
+
}
|
|
6189
|
+
},
|
|
6190
|
+
{
|
|
6191
|
+
family: "Neucha",
|
|
6192
|
+
source: 'url(https://fonts.gstatic.com/s/neucha/v18/q5uGsou0JOdh94bfvQlt.woff2) format("woff2")',
|
|
6193
|
+
descriptors: {
|
|
6194
|
+
style: "normal",
|
|
6195
|
+
weight: "400",
|
|
6196
|
+
display: "swap",
|
|
6197
|
+
unicodeRange: w
|
|
6198
|
+
}
|
|
6199
|
+
},
|
|
6200
|
+
{
|
|
6201
|
+
family: "Noto Serif",
|
|
6202
|
+
source: 'url(https://fonts.gstatic.com/s/notoserif/v33/ga6daw1J5X9T9RW6j9bNVls-hfgvz8JcMofYTYf-D33Esw.woff2) format("woff2")',
|
|
6203
|
+
descriptors: {
|
|
6204
|
+
style: "normal",
|
|
6205
|
+
weight: "100 900",
|
|
6206
|
+
display: "swap",
|
|
6207
|
+
unicodeRange: j
|
|
6208
|
+
}
|
|
6209
|
+
},
|
|
6210
|
+
{
|
|
6211
|
+
family: "Noto Serif",
|
|
6212
|
+
source: 'url(https://fonts.gstatic.com/s/notoserif/v33/ga6daw1J5X9T9RW6j9bNVls-hfgvz8JcMofYTYf6D30.woff2) format("woff2")',
|
|
6213
|
+
descriptors: {
|
|
6214
|
+
style: "normal",
|
|
6215
|
+
weight: "100 900",
|
|
6216
|
+
display: "swap",
|
|
6217
|
+
unicodeRange: w
|
|
6218
|
+
}
|
|
6219
|
+
},
|
|
6220
|
+
{
|
|
6221
|
+
family: "Open Sans",
|
|
6222
|
+
source: 'url(https://fonts.gstatic.com/s/opensans/v44/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSumu1aB.woff2) format("woff2")',
|
|
6223
|
+
descriptors: {
|
|
6224
|
+
style: "normal",
|
|
6225
|
+
weight: "300 800",
|
|
6226
|
+
display: "swap",
|
|
6227
|
+
unicodeRange: j
|
|
6228
|
+
}
|
|
6229
|
+
},
|
|
6230
|
+
{
|
|
6231
|
+
family: "Open Sans",
|
|
6232
|
+
source: 'url(https://fonts.gstatic.com/s/opensans/v44/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTS-muw.woff2) format("woff2")',
|
|
6233
|
+
descriptors: {
|
|
6234
|
+
style: "normal",
|
|
6235
|
+
weight: "300 800",
|
|
6236
|
+
display: "swap",
|
|
6237
|
+
unicodeRange: w
|
|
6238
|
+
}
|
|
6239
|
+
},
|
|
6240
|
+
{
|
|
6241
|
+
family: "PT Serif",
|
|
6242
|
+
source: 'url(https://fonts.gstatic.com/s/ptserif/v19/EJRVQgYoZZY2vCFuvAFSzr-tdg.woff2) format("woff2")',
|
|
6243
|
+
descriptors: {
|
|
6244
|
+
style: "normal",
|
|
6245
|
+
weight: "400",
|
|
6246
|
+
display: "swap",
|
|
6247
|
+
unicodeRange: j
|
|
6248
|
+
}
|
|
6249
|
+
},
|
|
6250
|
+
{
|
|
6251
|
+
family: "PT Serif",
|
|
6252
|
+
source: 'url(https://fonts.gstatic.com/s/ptserif/v19/EJRVQgYoZZY2vCFuvAFWzr8.woff2) format("woff2")',
|
|
6253
|
+
descriptors: {
|
|
6254
|
+
style: "normal",
|
|
6255
|
+
weight: "400",
|
|
6256
|
+
display: "swap",
|
|
6257
|
+
unicodeRange: w
|
|
6258
|
+
}
|
|
6259
|
+
},
|
|
6260
|
+
{
|
|
6261
|
+
family: "PT Serif",
|
|
6262
|
+
source: 'url(https://fonts.gstatic.com/s/ptserif/v19/EJRSQgYoZZY2vCFuvAnt66qWVyvHpA.woff2) format("woff2")',
|
|
6263
|
+
descriptors: {
|
|
6264
|
+
style: "normal",
|
|
6265
|
+
weight: "700",
|
|
6266
|
+
display: "swap",
|
|
6267
|
+
unicodeRange: j
|
|
6268
|
+
}
|
|
6269
|
+
},
|
|
6270
|
+
{
|
|
6271
|
+
family: "PT Serif",
|
|
6272
|
+
source: 'url(https://fonts.gstatic.com/s/ptserif/v19/EJRSQgYoZZY2vCFuvAnt66qSVys.woff2) format("woff2")',
|
|
6273
|
+
descriptors: {
|
|
6274
|
+
style: "normal",
|
|
6275
|
+
weight: "700",
|
|
6276
|
+
display: "swap",
|
|
6277
|
+
unicodeRange: w
|
|
6278
|
+
}
|
|
6279
|
+
},
|
|
6280
|
+
{
|
|
6281
|
+
family: "Playfair",
|
|
6282
|
+
source: 'url(https://fonts.gstatic.com/s/playfair/v10/0nk2C9D7PO4KhmUJ5_zTZ-wCMUXynAK-5UQzVItagFk.woff2) format("woff2")',
|
|
6283
|
+
descriptors: {
|
|
6284
|
+
style: "normal",
|
|
6285
|
+
weight: "300 900",
|
|
6286
|
+
display: "swap",
|
|
6287
|
+
unicodeRange: j
|
|
6288
|
+
}
|
|
6289
|
+
},
|
|
6290
|
+
{
|
|
6291
|
+
family: "Playfair",
|
|
6292
|
+
source: 'url(https://fonts.gstatic.com/s/playfair/v10/0nk2C9D7PO4KhmUJ5_zTZ-wCMUXynAK-5UQzUIta.woff2) format("woff2")',
|
|
6293
|
+
descriptors: {
|
|
6294
|
+
style: "normal",
|
|
6295
|
+
weight: "300 900",
|
|
6296
|
+
display: "swap",
|
|
6297
|
+
unicodeRange: w
|
|
6298
|
+
}
|
|
6299
|
+
},
|
|
6300
|
+
{
|
|
6301
|
+
family: "Press Start 2P",
|
|
6302
|
+
source: 'url(https://fonts.gstatic.com/s/pressstart2p/v16/e3t4euO8T-267oIAQAu6jDQyK3nRivN04w.woff2) format("woff2")',
|
|
6303
|
+
descriptors: {
|
|
6304
|
+
style: "normal",
|
|
6305
|
+
weight: "400",
|
|
6306
|
+
display: "swap",
|
|
6307
|
+
unicodeRange: j
|
|
6308
|
+
}
|
|
6309
|
+
},
|
|
6310
|
+
{
|
|
6311
|
+
family: "Press Start 2P",
|
|
6312
|
+
source: 'url(https://fonts.gstatic.com/s/pressstart2p/v16/e3t4euO8T-267oIAQAu6jDQyK3nVivM.woff2) format("woff2")',
|
|
6313
|
+
descriptors: {
|
|
6314
|
+
style: "normal",
|
|
6315
|
+
weight: "400",
|
|
6316
|
+
display: "swap",
|
|
6317
|
+
unicodeRange: w
|
|
6318
|
+
}
|
|
6319
|
+
},
|
|
6320
|
+
{
|
|
6321
|
+
family: "Raleway",
|
|
6322
|
+
source: 'url(https://fonts.gstatic.com/s/raleway/v37/1Ptug8zYS_SKggPNyCkIT5lu.woff2) format("woff2")',
|
|
6323
|
+
descriptors: {
|
|
6324
|
+
style: "normal",
|
|
6325
|
+
weight: "100 900",
|
|
6326
|
+
display: "swap",
|
|
6327
|
+
unicodeRange: j
|
|
6328
|
+
}
|
|
6329
|
+
},
|
|
6330
|
+
{
|
|
6331
|
+
family: "Raleway",
|
|
6332
|
+
source: 'url(https://fonts.gstatic.com/s/raleway/v37/1Ptug8zYS_SKggPNyC0ITw.woff2) format("woff2")',
|
|
6333
|
+
descriptors: {
|
|
6334
|
+
style: "normal",
|
|
6335
|
+
weight: "100 900",
|
|
6336
|
+
display: "swap",
|
|
6337
|
+
unicodeRange: w
|
|
6338
|
+
}
|
|
6339
|
+
},
|
|
6340
|
+
{
|
|
6341
|
+
family: "Roboto",
|
|
6342
|
+
source: 'url(https://fonts.gstatic.com/s/roboto/v50/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3iUBGEe.woff2) format("woff2")',
|
|
6343
|
+
descriptors: {
|
|
6344
|
+
style: "normal",
|
|
6345
|
+
weight: "100 900",
|
|
6346
|
+
display: "swap",
|
|
6347
|
+
unicodeRange: j
|
|
6348
|
+
}
|
|
6349
|
+
},
|
|
6350
|
+
{
|
|
6351
|
+
family: "Roboto",
|
|
6352
|
+
source: 'url(https://fonts.gstatic.com/s/roboto/v50/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3yUBA.woff2) format("woff2")',
|
|
6353
|
+
descriptors: {
|
|
6354
|
+
style: "normal",
|
|
6355
|
+
weight: "100 900",
|
|
6356
|
+
display: "swap",
|
|
6357
|
+
unicodeRange: w
|
|
5624
6358
|
}
|
|
5625
6359
|
}
|
|
5626
|
-
],
|
|
6360
|
+
], Ys = {
|
|
5627
6361
|
/**
|
|
5628
6362
|
* Опции редактора
|
|
5629
6363
|
*/
|
|
@@ -5715,20 +6449,20 @@ const X = [
|
|
|
5715
6449
|
/**
|
|
5716
6450
|
* Список шрифтов, которые будут доступны в редакторе по умолчанию.
|
|
5717
6451
|
*/
|
|
5718
|
-
fonts:
|
|
6452
|
+
fonts: zs
|
|
5719
6453
|
};
|
|
5720
|
-
function
|
|
5721
|
-
const e =
|
|
6454
|
+
function Zs(d, t = {}) {
|
|
6455
|
+
const e = k(k({}, Ys), t), s = document.getElementById(d);
|
|
5722
6456
|
if (!s)
|
|
5723
6457
|
return Promise.reject(new Error(`Контейнер с ID "${d}" не найден.`));
|
|
5724
6458
|
const o = document.createElement("canvas");
|
|
5725
6459
|
return o.id = `${d}-canvas`, s.appendChild(o), e.editorContainer = s, new Promise((n) => {
|
|
5726
6460
|
e._onReadyCallback = n;
|
|
5727
|
-
const i = new
|
|
6461
|
+
const i = new le(o.id, e);
|
|
5728
6462
|
window[d] = i;
|
|
5729
6463
|
});
|
|
5730
6464
|
}
|
|
5731
6465
|
export {
|
|
5732
|
-
|
|
6466
|
+
Zs as default
|
|
5733
6467
|
};
|
|
5734
6468
|
//# sourceMappingURL=main.js.map
|