@anu3ev/fabric-image-editor 0.4.5 → 0.4.6
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 +1429 -868
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
var Ne = Object.defineProperty,
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var Ne = Object.defineProperty, Re = Object.defineProperties;
|
|
2
|
+
var ke = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var zt = Object.getOwnPropertySymbols;
|
|
4
4
|
var ue = Object.prototype.hasOwnProperty, fe = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var ge = (d, t, e) => t in d ? Ne(d, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : d[t] = e,
|
|
5
|
+
var ge = (d, t, e) => t in d ? Ne(d, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : d[t] = e, N = (d, t) => {
|
|
6
6
|
for (var e in t || (t = {}))
|
|
7
7
|
ue.call(t, e) && ge(d, e, t[e]);
|
|
8
|
-
if (
|
|
9
|
-
for (var e of
|
|
8
|
+
if (zt)
|
|
9
|
+
for (var e of zt(t))
|
|
10
10
|
fe.call(t, e) && ge(d, e, t[e]);
|
|
11
11
|
return d;
|
|
12
|
-
},
|
|
13
|
-
var
|
|
12
|
+
}, Tt = (d, t) => Re(d, ke(t));
|
|
13
|
+
var nt = (d, t) => {
|
|
14
14
|
var e = {};
|
|
15
15
|
for (var s in d)
|
|
16
16
|
ue.call(d, s) && t.indexOf(s) < 0 && (e[s] = d[s]);
|
|
17
|
-
if (d != null &&
|
|
18
|
-
for (var s of
|
|
17
|
+
if (d != null && zt)
|
|
18
|
+
for (var s of zt(d))
|
|
19
19
|
t.indexOf(s) < 0 && fe.call(d, s) && (e[s] = d[s]);
|
|
20
20
|
return e;
|
|
21
21
|
};
|
|
22
|
-
var
|
|
23
|
-
var
|
|
22
|
+
var O = (d, t, e) => new Promise((s, o) => {
|
|
23
|
+
var i = (r) => {
|
|
24
24
|
try {
|
|
25
25
|
a(e.next(r));
|
|
26
26
|
} catch (c) {
|
|
27
27
|
o(c);
|
|
28
28
|
}
|
|
29
|
-
},
|
|
29
|
+
}, n = (r) => {
|
|
30
30
|
try {
|
|
31
31
|
a(e.throw(r));
|
|
32
32
|
} catch (c) {
|
|
33
33
|
o(c);
|
|
34
34
|
}
|
|
35
|
-
}, a = (r) => r.done ? s(r.value) : Promise.resolve(r.value).then(
|
|
35
|
+
}, a = (r) => r.done ? s(r.value) : Promise.resolve(r.value).then(i, n);
|
|
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 x, Textbox as et, util as vt, controlsUtils as me, InteractiveFabricObject as pe, loadSVGFromURL as xe, FabricImage as Et, Point as dt, Gradient as ye, Rect as Be, Circle as _e, Triangle as Ue, Group as ft, Color as ze, classRegistry as Me, Canvas as Fe, Pattern as Ye } from "fabric";
|
|
39
|
+
import { create as Pe } from "jsondiffpatch";
|
|
40
|
+
import We from "diff-match-patch";
|
|
41
|
+
var He = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", F = 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 += He[s[t] & 63];
|
|
44
44
|
return e;
|
|
45
45
|
};
|
|
46
|
-
class
|
|
46
|
+
class Dt {
|
|
47
47
|
/**
|
|
48
48
|
* Конструктор принимает редактор и опции.
|
|
49
49
|
* @param params
|
|
@@ -61,7 +61,7 @@ class Lt {
|
|
|
61
61
|
* @param params.options.adaptCanvasToContainerOnResize — адаптировать канвас к размерам контейнера при изменении размеров окна
|
|
62
62
|
*/
|
|
63
63
|
constructor({ editor: t, options: e = {} }) {
|
|
64
|
-
this.isDragging = !1, this.lastMouseX = 0, this.lastMouseY = 0, this.isUndoRedoKeyPressed = !1, this.isSpacePressed = !1, this.savedSelection = [], this.canvasDragging = !1, this.mouseWheelZooming = !1, this.bringToFrontOnSelection = !1, this.resetObjectFitByDoubleClick = !1, this.copyObjectsByHotkey = !1, this.pasteImageFromClipboard = !1, this.undoRedoByHotKeys = !1, this.selectAllByHotkey = !1, this.deleteObjectsByHotkey = !1, this.adaptCanvasToContainerOnResize = !1, this.editor = t, this.canvas = t.canvas, this.options = e, this.handleContainerResizeBound =
|
|
64
|
+
this.isDragging = !1, this.lastMouseX = 0, this.lastMouseY = 0, this.isUndoRedoKeyPressed = !1, this.isSpacePressed = !1, this.savedSelection = [], this.canvasDragging = !1, this.mouseWheelZooming = !1, this.bringToFrontOnSelection = !1, this.resetObjectFitByDoubleClick = !1, this.copyObjectsByHotkey = !1, this.pasteImageFromClipboard = !1, this.undoRedoByHotKeys = !1, this.selectAllByHotkey = !1, this.deleteObjectsByHotkey = !1, this.adaptCanvasToContainerOnResize = !1, this.editor = t, this.canvas = t.canvas, this.options = e, this.handleContainerResizeBound = Dt.debounce(this.handleContainerResize.bind(this), 500), this.handleCopyEventBound = this.handleCopyEvent.bind(this), this.handlePasteEventBound = this.handlePasteEvent.bind(this), this.handleUndoRedoEventBound = this.handleUndoRedoEvent.bind(this), this.handleUndoRedoKeyUpBound = this.handleUndoRedoKeyUp.bind(this), this.handleSelectAllEventBound = this.handleSelectAllEvent.bind(this), this.handleDeleteObjectsEventBound = this.handleDeleteObjectsEvent.bind(this), this.handleSpaceKeyDownBound = this.handleSpaceKeyDown.bind(this), this.handleSpaceKeyUpBound = this.handleSpaceKeyUp.bind(this), this.handleObjectModifiedHistoryBound = Dt.debounce(this.handleObjectModifiedHistory.bind(this), 300), this.handleObjectRotatingHistoryBound = Dt.debounce(this.handleObjectRotatingHistory.bind(this), 300), this.handleObjectAddedHistoryBound = this.handleObjectAddedHistory.bind(this), this.handleObjectRemovedHistoryBound = this.handleObjectRemovedHistory.bind(this), this.handleOverlayUpdateBound = this.handleOverlayUpdate.bind(this), this.handleBackgroundUpdateBound = this.handleBackgroundUpdate.bind(this), this.handleCanvasDragStartBound = this.handleCanvasDragStart.bind(this), this.handleCanvasDraggingBound = this.handleCanvasDragging.bind(this), this.handleCanvasDragEndBound = this.handleCanvasDragEnd.bind(this), this.handleMouseWheelZoomBound = this.handleMouseWheelZoom.bind(this), this.handleBringToFrontBound = this.handleBringToFront.bind(this), this.handleResetObjectFitBound = this.handleResetObjectFit.bind(this), this.handleLockedSelectionBound = this._filterLockedSelection.bind(this), this.init();
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
67
|
* Инициализация всех обработчиков согласно опциям.
|
|
@@ -72,14 +72,14 @@ class Lt {
|
|
|
72
72
|
canvasDragging: e,
|
|
73
73
|
mouseWheelZooming: s,
|
|
74
74
|
bringToFrontOnSelection: o,
|
|
75
|
-
copyObjectsByHotkey:
|
|
76
|
-
pasteImageFromClipboard:
|
|
75
|
+
copyObjectsByHotkey: i,
|
|
76
|
+
pasteImageFromClipboard: n,
|
|
77
77
|
undoRedoByHotKeys: a,
|
|
78
78
|
selectAllByHotkey: r,
|
|
79
79
|
deleteObjectsByHotkey: c,
|
|
80
80
|
resetObjectFitByDoubleClick: h
|
|
81
81
|
} = this.options;
|
|
82
|
-
e && (this.canvas.on("mouse:down", this.handleCanvasDragStartBound), this.canvas.on("mouse:move", this.handleCanvasDraggingBound), this.canvas.on("mouse:up", this.handleCanvasDragEndBound), document.addEventListener("keydown", this.handleSpaceKeyDownBound, { capture: !0 }), document.addEventListener("keyup", this.handleSpaceKeyUpBound, { capture: !0 })), s && this.canvas.on("mouse:wheel", this.handleMouseWheelZoomBound), o && (this.canvas.on("selection:created", this.handleBringToFrontBound), this.canvas.on("selection:updated", this.handleBringToFrontBound)), h && this.canvas.on("mouse:dblclick", this.handleResetObjectFitBound), t && window.addEventListener("resize", this.handleContainerResizeBound, { capture: !0 }),
|
|
82
|
+
e && (this.canvas.on("mouse:down", this.handleCanvasDragStartBound), this.canvas.on("mouse:move", this.handleCanvasDraggingBound), this.canvas.on("mouse:up", this.handleCanvasDragEndBound), document.addEventListener("keydown", this.handleSpaceKeyDownBound, { capture: !0 }), document.addEventListener("keyup", this.handleSpaceKeyUpBound, { capture: !0 })), s && this.canvas.on("mouse:wheel", this.handleMouseWheelZoomBound), o && (this.canvas.on("selection:created", this.handleBringToFrontBound), this.canvas.on("selection:updated", this.handleBringToFrontBound)), h && this.canvas.on("mouse:dblclick", this.handleResetObjectFitBound), t && window.addEventListener("resize", this.handleContainerResizeBound, { capture: !0 }), i && document.addEventListener("keydown", this.handleCopyEventBound, { capture: !0 }), n && document.addEventListener("paste", this.handlePasteEventBound, { capture: !0 }), a && (document.addEventListener("keydown", this.handleUndoRedoEventBound, { capture: !0 }), document.addEventListener("keyup", this.handleUndoRedoKeyUpBound, { capture: !0 })), r && document.addEventListener("keydown", this.handleSelectAllEventBound, { capture: !0 }), c && document.addEventListener("keydown", this.handleDeleteObjectsEventBound, { capture: !0 }), this.canvas.on("object:modified", this.handleObjectModifiedHistoryBound), this.canvas.on("object:rotating", this.handleObjectRotatingHistoryBound), this.canvas.on("object:added", this.handleObjectAddedHistoryBound), this.canvas.on("object:removed", this.handleObjectRemovedHistoryBound), this.canvas.on("object:added", this.handleOverlayUpdateBound), this.canvas.on("selection:created", this.handleOverlayUpdateBound), this.canvas.on("selection:created", this.handleLockedSelectionBound), this.canvas.on("selection:updated", this.handleLockedSelectionBound), this.canvas.on("object:added", this.handleBackgroundUpdateBound), this.canvas.on("selection:created", this.handleBackgroundUpdateBound);
|
|
83
83
|
}
|
|
84
84
|
/**
|
|
85
85
|
* При массовом выделении объектов удаляем из него залоченные.
|
|
@@ -90,7 +90,7 @@ class Lt {
|
|
|
90
90
|
_filterLockedSelection({ selected: t, e }) {
|
|
91
91
|
if (!(t != null && t.length) || !(e instanceof MouseEvent) || t.length === 1) return;
|
|
92
92
|
const { lockedObjects: s, unlockedObjects: o } = t.reduce(
|
|
93
|
-
(
|
|
93
|
+
(n, a) => a.locked ? (n.lockedObjects.push(a), n) : (n.unlockedObjects.push(a), n),
|
|
94
94
|
{ lockedObjects: [], unlockedObjects: [] }
|
|
95
95
|
);
|
|
96
96
|
if (s.length === 0) return;
|
|
@@ -98,22 +98,22 @@ class Lt {
|
|
|
98
98
|
if (o.length === 1)
|
|
99
99
|
this.canvas.setActiveObject(o[0]);
|
|
100
100
|
else {
|
|
101
|
-
const
|
|
101
|
+
const n = new x(o, {
|
|
102
102
|
canvas: this.canvas
|
|
103
103
|
});
|
|
104
|
-
this.canvas.setActiveObject(
|
|
104
|
+
this.canvas.setActiveObject(n);
|
|
105
105
|
}
|
|
106
106
|
this.canvas.requestRenderAll();
|
|
107
107
|
return;
|
|
108
108
|
}
|
|
109
|
-
const
|
|
109
|
+
const i = new x(t, {
|
|
110
110
|
canvas: this.canvas
|
|
111
111
|
});
|
|
112
112
|
this.editor.objectLockManager.lockObject({
|
|
113
|
-
object:
|
|
113
|
+
object: i,
|
|
114
114
|
skipInnerObjects: !0,
|
|
115
115
|
withoutSave: !0
|
|
116
|
-
}), this.canvas.setActiveObject(
|
|
116
|
+
}), this.canvas.setActiveObject(i), this.canvas.requestRenderAll();
|
|
117
117
|
}
|
|
118
118
|
/**
|
|
119
119
|
* Обработчики для сохранения состояния редактора в истории.
|
|
@@ -175,9 +175,9 @@ class Lt {
|
|
|
175
175
|
* @param event.code — код клавиши
|
|
176
176
|
*/
|
|
177
177
|
handleUndoRedoEvent(t) {
|
|
178
|
-
return
|
|
179
|
-
const { ctrlKey: e, metaKey: s, code: o, repeat:
|
|
180
|
-
this._shouldIgnoreKeyboardEvent(t) || !e && !s ||
|
|
178
|
+
return O(this, null, function* () {
|
|
179
|
+
const { ctrlKey: e, metaKey: s, code: o, repeat: i } = t;
|
|
180
|
+
this._shouldIgnoreKeyboardEvent(t) || !e && !s || i || !/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
|
});
|
|
182
182
|
}
|
|
183
183
|
/**
|
|
@@ -216,11 +216,11 @@ class Lt {
|
|
|
216
216
|
*/
|
|
217
217
|
handleSpaceKeyDown(t) {
|
|
218
218
|
if (t.code !== "Space" || this._shouldIgnoreKeyboardEvent(t)) return;
|
|
219
|
-
const { canvas: e, editor: s, isSpacePressed: o, isDragging:
|
|
220
|
-
if (o ||
|
|
219
|
+
const { canvas: e, editor: s, isSpacePressed: o, isDragging: i } = this;
|
|
220
|
+
if (o || i) return;
|
|
221
221
|
this.isSpacePressed = !0, t.preventDefault();
|
|
222
|
-
const
|
|
223
|
-
|
|
222
|
+
const n = e.getActiveObject() || null;
|
|
223
|
+
n instanceof x ? this.savedSelection = n.getObjects().slice() : n && (this.savedSelection = [n]), e.discardActiveObject(), e.set({
|
|
224
224
|
selection: !1,
|
|
225
225
|
defaultCursor: "grab"
|
|
226
226
|
}), e.setCursor("grab"), s.canvasManager.getObjects().forEach((a) => {
|
|
@@ -259,8 +259,8 @@ class Lt {
|
|
|
259
259
|
e.setActiveObject(t[0]);
|
|
260
260
|
return;
|
|
261
261
|
}
|
|
262
|
-
const o = t.filter((
|
|
263
|
-
e.setActiveObject(
|
|
262
|
+
const o = t.filter((n) => s.canvasManager.getObjects().includes(n)), i = new x(o, { canvas: e });
|
|
263
|
+
e.setActiveObject(i);
|
|
264
264
|
}
|
|
265
265
|
// --- Обработчики для событий canvas (Fabric) ---
|
|
266
266
|
/**
|
|
@@ -282,7 +282,7 @@ class Lt {
|
|
|
282
282
|
const { panConstraintManager: e, montageArea: s } = this.editor;
|
|
283
283
|
if (!e.isPanAllowed())
|
|
284
284
|
return;
|
|
285
|
-
const o = this.canvas.viewportTransform,
|
|
285
|
+
const o = this.canvas.viewportTransform, i = o[4] + (t.clientX - this.lastMouseX), n = o[5] + (t.clientY - this.lastMouseY), a = e.constrainPan(i, n);
|
|
286
286
|
o[4] = a.x, o[5] = a.y, s.setCoords(), this.canvas.requestRenderAll(), this.lastMouseX = t.clientX, this.lastMouseY = t.clientY;
|
|
287
287
|
}
|
|
288
288
|
/**
|
|
@@ -301,8 +301,8 @@ class Lt {
|
|
|
301
301
|
* @returns Шаг изменения зума
|
|
302
302
|
*/
|
|
303
303
|
_calculateAdaptiveZoomStep(t) {
|
|
304
|
-
const e = this.canvas.getZoom(), s = 0.05,
|
|
305
|
-
return -(e * s *
|
|
304
|
+
const e = this.canvas.getZoom(), s = 0.05, i = t / 100;
|
|
305
|
+
return -(e * s * i);
|
|
306
306
|
}
|
|
307
307
|
/**
|
|
308
308
|
* Обработчик зума колесиком мыши. Работает при зажатом Ctrl или Cmd.
|
|
@@ -341,21 +341,21 @@ class Lt {
|
|
|
341
341
|
_shouldIgnoreKeyboardEvent(t) {
|
|
342
342
|
const e = document.activeElement, s = t.target, o = ["input", "textarea", "select"];
|
|
343
343
|
if (s) {
|
|
344
|
-
const
|
|
345
|
-
if (t.type === "paste" && o.includes(
|
|
344
|
+
const n = s.tagName.toLowerCase();
|
|
345
|
+
if (t.type === "paste" && o.includes(n)) {
|
|
346
346
|
const a = e == null ? void 0 : e.tagName.toLowerCase();
|
|
347
347
|
return !!(a && o.includes(a));
|
|
348
348
|
}
|
|
349
|
-
if (o.includes(
|
|
349
|
+
if (o.includes(n) || s.contentEditable === "true")
|
|
350
350
|
return !0;
|
|
351
351
|
}
|
|
352
352
|
if (e && e !== s) {
|
|
353
|
-
const
|
|
354
|
-
if (o.includes(
|
|
353
|
+
const n = e.tagName.toLowerCase();
|
|
354
|
+
if (o.includes(n) || e.contentEditable === "true") return !0;
|
|
355
355
|
}
|
|
356
|
-
const
|
|
357
|
-
if (
|
|
358
|
-
let r =
|
|
356
|
+
const i = window.getSelection();
|
|
357
|
+
if (i && !i.isCollapsed && i.rangeCount > 0) {
|
|
358
|
+
let r = i.getRangeAt(0).commonAncestorContainer;
|
|
359
359
|
r.nodeType === Node.TEXT_NODE && (r = r.parentElement);
|
|
360
360
|
const { keyboardIgnoreSelectors: c } = this.options;
|
|
361
361
|
if (c != null && c.length && r)
|
|
@@ -436,12 +436,12 @@ class Ge {
|
|
|
436
436
|
* @returns
|
|
437
437
|
*/
|
|
438
438
|
_handleMessage({ data: t }) {
|
|
439
|
-
const { requestId: e, success: s, data: o, error:
|
|
440
|
-
if (!
|
|
439
|
+
const { requestId: e, success: s, data: o, error: i } = t, n = this._callbacks.get(e);
|
|
440
|
+
if (!n) {
|
|
441
441
|
console.warn(`No callback found for requestId: ${e}`);
|
|
442
442
|
return;
|
|
443
443
|
}
|
|
444
|
-
s ?
|
|
444
|
+
s ? n.resolve(o) : n.reject(new Error(i)), this._callbacks.delete(e);
|
|
445
445
|
}
|
|
446
446
|
/**
|
|
447
447
|
* Универсальный метод отправки команды в воркер
|
|
@@ -451,9 +451,9 @@ class Ge {
|
|
|
451
451
|
* @returns Promise, который будет выполнен, когда воркер вернет ответ
|
|
452
452
|
*/
|
|
453
453
|
post(t, e, s = []) {
|
|
454
|
-
const o = `${t}:${
|
|
455
|
-
return new Promise((
|
|
456
|
-
this._callbacks.set(o, { resolve:
|
|
454
|
+
const o = `${t}:${F(8)}`;
|
|
455
|
+
return new Promise((i, n) => {
|
|
456
|
+
this._callbacks.set(o, { resolve: i, reject: n }), this.worker.postMessage({ action: t, payload: e, requestId: o }, s);
|
|
457
457
|
});
|
|
458
458
|
}
|
|
459
459
|
/**
|
|
@@ -463,50 +463,50 @@ class Ge {
|
|
|
463
463
|
this.worker.terminate();
|
|
464
464
|
}
|
|
465
465
|
}
|
|
466
|
-
const q = 12, Xe = 2,
|
|
467
|
-
function
|
|
468
|
-
const
|
|
469
|
-
d.save(), d.translate(t, e), d.rotate(vt.degreesToRadians(o.angle)), d.fillStyle =
|
|
466
|
+
const q = 12, Xe = 2, $t = 8, qt = 20, Ke = 100, te = 20, ee = 8, Qe = 100, Zt = 32, oe = 1, Je = "#2B2D33", ie = "#3D8BF4", ne = "#FFFFFF";
|
|
467
|
+
function Ft(d, t, e, s, o) {
|
|
468
|
+
const i = q, n = Xe;
|
|
469
|
+
d.save(), d.translate(t, e), d.rotate(vt.degreesToRadians(o.angle)), d.fillStyle = ne, d.strokeStyle = ie, d.lineWidth = oe, d.beginPath(), d.roundRect(-i / 2, -i / 2, i, i, n), d.fill(), d.stroke(), d.restore();
|
|
470
470
|
}
|
|
471
471
|
function be(d, t, e, s, o) {
|
|
472
|
-
const
|
|
473
|
-
d.save(), d.translate(t, e), d.rotate(vt.degreesToRadians(o.angle)), d.fillStyle =
|
|
472
|
+
const i = $t, n = qt, a = Ke;
|
|
473
|
+
d.save(), d.translate(t, e), d.rotate(vt.degreesToRadians(o.angle)), d.fillStyle = ne, d.strokeStyle = ie, d.lineWidth = oe, d.beginPath(), d.roundRect(-i / 2, -n / 2, i, n, a), d.fill(), d.stroke(), d.restore();
|
|
474
474
|
}
|
|
475
475
|
function ve(d, t, e, s, o) {
|
|
476
|
-
const
|
|
477
|
-
d.save(), d.translate(t, e), d.rotate(vt.degreesToRadians(o.angle)), d.fillStyle =
|
|
476
|
+
const i = te, n = ee, a = Qe;
|
|
477
|
+
d.save(), d.translate(t, e), d.rotate(vt.degreesToRadians(o.angle)), d.fillStyle = ne, d.strokeStyle = ie, d.lineWidth = oe, d.beginPath(), d.roundRect(-i / 2, -n / 2, i, n, a), d.fill(), d.stroke(), d.restore();
|
|
478
478
|
}
|
|
479
|
-
const
|
|
480
|
-
|
|
479
|
+
const $e = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", De = new Image();
|
|
480
|
+
De.src = $e;
|
|
481
481
|
function qe(d, t, e, s, o) {
|
|
482
|
-
const
|
|
483
|
-
d.save(), d.translate(t, e), d.rotate(vt.degreesToRadians(o.angle)), d.fillStyle =
|
|
482
|
+
const n = Zt / 2;
|
|
483
|
+
d.save(), d.translate(t, e), d.rotate(vt.degreesToRadians(o.angle)), d.fillStyle = Je, d.beginPath(), d.arc(0, 0, n, 0, 2 * Math.PI), d.fill(), d.drawImage(De, -n / 2, -n / 2, n, n), d.restore();
|
|
484
484
|
}
|
|
485
485
|
const ts = {
|
|
486
486
|
// Угловые точки
|
|
487
487
|
tl: {
|
|
488
|
-
render:
|
|
488
|
+
render: Ft,
|
|
489
489
|
sizeX: q,
|
|
490
490
|
sizeY: q,
|
|
491
491
|
offsetX: 0,
|
|
492
492
|
offsetY: 0
|
|
493
493
|
},
|
|
494
494
|
tr: {
|
|
495
|
-
render:
|
|
495
|
+
render: Ft,
|
|
496
496
|
sizeX: q,
|
|
497
497
|
sizeY: q,
|
|
498
498
|
offsetX: 0,
|
|
499
499
|
offsetY: 0
|
|
500
500
|
},
|
|
501
501
|
bl: {
|
|
502
|
-
render:
|
|
502
|
+
render: Ft,
|
|
503
503
|
sizeX: q,
|
|
504
504
|
sizeY: q,
|
|
505
505
|
offsetX: 0,
|
|
506
506
|
offsetY: 0
|
|
507
507
|
},
|
|
508
508
|
br: {
|
|
509
|
-
render:
|
|
509
|
+
render: Ft,
|
|
510
510
|
sizeX: q,
|
|
511
511
|
sizeY: q,
|
|
512
512
|
offsetX: 0,
|
|
@@ -515,14 +515,14 @@ const ts = {
|
|
|
515
515
|
// Середина вертикалей
|
|
516
516
|
ml: {
|
|
517
517
|
render: be,
|
|
518
|
-
sizeX:
|
|
518
|
+
sizeX: $t,
|
|
519
519
|
sizeY: qt,
|
|
520
520
|
offsetX: 0,
|
|
521
521
|
offsetY: 0
|
|
522
522
|
},
|
|
523
523
|
mr: {
|
|
524
524
|
render: be,
|
|
525
|
-
sizeX:
|
|
525
|
+
sizeX: $t,
|
|
526
526
|
sizeY: qt,
|
|
527
527
|
offsetX: 0,
|
|
528
528
|
offsetY: 0
|
|
@@ -545,27 +545,27 @@ const ts = {
|
|
|
545
545
|
// Специальный «rotate» контрол
|
|
546
546
|
mtr: {
|
|
547
547
|
render: qe,
|
|
548
|
-
sizeX:
|
|
549
|
-
sizeY:
|
|
548
|
+
sizeX: Zt,
|
|
549
|
+
sizeY: Zt,
|
|
550
550
|
offsetX: 0,
|
|
551
|
-
offsetY: -
|
|
551
|
+
offsetY: -Zt
|
|
552
552
|
}
|
|
553
553
|
};
|
|
554
554
|
class mt {
|
|
555
555
|
static wrapWidthControl(t) {
|
|
556
556
|
if (!(t != null && t.actionHandler)) return;
|
|
557
557
|
const e = t.actionHandler;
|
|
558
|
-
t.actionHandler = (s, o,
|
|
558
|
+
t.actionHandler = (s, o, i, n) => {
|
|
559
559
|
const a = o == null ? void 0 : o.target;
|
|
560
|
-
return !a || a.locked || a.lockScalingX ? !1 : e(s, o,
|
|
560
|
+
return !a || a.locked || a.lockScalingX ? !1 : e(s, o, i, n);
|
|
561
561
|
};
|
|
562
562
|
}
|
|
563
563
|
static applyControlOverrides(t) {
|
|
564
564
|
Object.entries(ts).forEach(([e, s]) => {
|
|
565
565
|
const o = t[e];
|
|
566
|
-
o && (Object.assign(o, s), e === "mtr" && (o.cursorStyle = "grab", o.mouseDownHandler = (
|
|
566
|
+
o && (Object.assign(o, s), e === "mtr" && (o.cursorStyle = "grab", o.mouseDownHandler = (i, n, a, r) => {
|
|
567
567
|
var h;
|
|
568
|
-
const c =
|
|
568
|
+
const c = n == null ? void 0 : n.target;
|
|
569
569
|
(h = c == null ? void 0 : c.canvas) == null || h.setCursor("grabbing");
|
|
570
570
|
}));
|
|
571
571
|
});
|
|
@@ -577,7 +577,7 @@ class mt {
|
|
|
577
577
|
mt.applyControlOverrides(e), e.mt && (e.mt.visible = !1), e.mb && (e.mb.visible = !1), mt.wrapWidthControl(e.ml), mt.wrapWidthControl(e.mr), et.ownDefaults.controls = e, pe.ownDefaults.snapAngle = 1;
|
|
578
578
|
}
|
|
579
579
|
}
|
|
580
|
-
const
|
|
580
|
+
const E = class E {
|
|
581
581
|
constructor(t = []) {
|
|
582
582
|
this.fonts = t;
|
|
583
583
|
}
|
|
@@ -585,38 +585,38 @@ 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((
|
|
594
|
+
const s = t.map((i) => E.loadFont(i, 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
|
-
const s = typeof FontFace != "undefined", o = (c = t.family) == null ? void 0 : c.trim(),
|
|
602
|
-
if (!o || !
|
|
603
|
-
const
|
|
604
|
-
if (!
|
|
605
|
-
if (
|
|
606
|
-
|
|
601
|
+
const s = typeof FontFace != "undefined", o = (c = t.family) == null ? void 0 : c.trim(), i = (h = t.source) == null ? void 0 : h.trim();
|
|
602
|
+
if (!o || !i) return;
|
|
603
|
+
const n = E.normalizeFontSource(i), a = E.getDescriptorSnapshot(t.descriptors), r = E.getFontRegistrationKey(o, n, a);
|
|
604
|
+
if (!E.registeredFontKeys.has(r)) {
|
|
605
|
+
if (E.isFontFaceAlreadyApplied(e, o, a)) {
|
|
606
|
+
E.registeredFontKeys.add(r);
|
|
607
607
|
return;
|
|
608
608
|
}
|
|
609
609
|
if (s && e.fonts && typeof e.fonts.add == "function")
|
|
610
610
|
try {
|
|
611
|
-
const g = yield new FontFace(o,
|
|
612
|
-
e.fonts.add(g),
|
|
611
|
+
const g = yield new FontFace(o, n, t.descriptors).load();
|
|
612
|
+
e.fonts.add(g), E.registeredFontKeys.add(r);
|
|
613
613
|
return;
|
|
614
614
|
} catch (l) {
|
|
615
615
|
console.warn(`Не удалось загрузить шрифт "${o}" через FontFace API`, l);
|
|
616
616
|
}
|
|
617
|
-
|
|
617
|
+
E.injectFontFace({
|
|
618
618
|
font: t,
|
|
619
|
-
source:
|
|
619
|
+
source: n,
|
|
620
620
|
doc: e,
|
|
621
621
|
registrationKey: r
|
|
622
622
|
});
|
|
@@ -630,19 +630,19 @@ const w = class w {
|
|
|
630
630
|
registrationKey: o
|
|
631
631
|
}) {
|
|
632
632
|
var h;
|
|
633
|
-
const { descriptors:
|
|
634
|
-
if (!
|
|
633
|
+
const { descriptors: i } = t, n = (h = t.family) == null ? void 0 : h.trim();
|
|
634
|
+
if (!n) return;
|
|
635
635
|
const a = s.createElement("style");
|
|
636
|
-
a.setAttribute("data-editor-font",
|
|
637
|
-
const r =
|
|
636
|
+
a.setAttribute("data-editor-font", n), a.setAttribute("data-editor-font-key", o);
|
|
637
|
+
const r = E.descriptorsToCss(i), c = [
|
|
638
638
|
"@font-face {",
|
|
639
|
-
` font-family: ${
|
|
639
|
+
` font-family: ${E.formatFontFamilyForCss(n)};`,
|
|
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), E.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 = E.descriptorDefaults;
|
|
669
669
|
return {
|
|
670
|
-
style:
|
|
671
|
-
weight:
|
|
672
|
-
stretch:
|
|
673
|
-
unicodeRange:
|
|
674
|
-
variant:
|
|
675
|
-
featureSettings:
|
|
676
|
-
display:
|
|
670
|
+
style: E.normalizeDescriptorValue(t == null ? void 0 : t.style, e.style),
|
|
671
|
+
weight: E.normalizeDescriptorValue(t == null ? void 0 : t.weight, e.weight),
|
|
672
|
+
stretch: E.normalizeDescriptorValue(t == null ? void 0 : t.stretch, e.stretch),
|
|
673
|
+
unicodeRange: E.normalizeDescriptorValue(t == null ? void 0 : t.unicodeRange, e.unicodeRange),
|
|
674
|
+
variant: E.normalizeDescriptorValue(t == null ? void 0 : t.variant, e.variant),
|
|
675
|
+
featureSettings: E.normalizeDescriptorValue(t == null ? void 0 : t.featureSettings, e.featureSettings),
|
|
676
|
+
display: E.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
|
+
E.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
|
|
699
|
-
let
|
|
698
|
+
const i = E.normalizeFamilyName(e);
|
|
699
|
+
let n = !1;
|
|
700
700
|
try {
|
|
701
701
|
o.forEach((a) => {
|
|
702
|
-
if (
|
|
703
|
-
const c =
|
|
702
|
+
if (n || E.normalizeFamilyName(a.family) !== i) return;
|
|
703
|
+
const c = E.getDescriptorSnapshot({
|
|
704
704
|
style: a.style,
|
|
705
705
|
weight: a.weight,
|
|
706
706
|
stretch: a.stretch,
|
|
@@ -709,12 +709,12 @@ const w = class w {
|
|
|
709
709
|
featureSettings: a.featureSettings,
|
|
710
710
|
display: a.display
|
|
711
711
|
});
|
|
712
|
-
|
|
712
|
+
E.areDescriptorSnapshotsEqual(s, c) && (n = !0);
|
|
713
713
|
});
|
|
714
714
|
} catch (a) {
|
|
715
715
|
return console.warn("Не удалось проверить, загружен ли шрифт ранее через FontFaceSet", a), !1;
|
|
716
716
|
}
|
|
717
|
-
return
|
|
717
|
+
return n;
|
|
718
718
|
}
|
|
719
719
|
static descriptorsToCss(t) {
|
|
720
720
|
if (!t) return [];
|
|
@@ -731,12 +731,12 @@ const w = class w {
|
|
|
731
731
|
lineGapOverride: "line-gap-override"
|
|
732
732
|
};
|
|
733
733
|
return Object.entries(t).filter(([, s]) => s != null && `${s}`.length > 0).map(([s, o]) => {
|
|
734
|
-
var
|
|
735
|
-
return `${(
|
|
734
|
+
var n;
|
|
735
|
+
return `${(n = e[s]) != null ? n : s}: ${o};`;
|
|
736
736
|
});
|
|
737
737
|
}
|
|
738
738
|
};
|
|
739
|
-
|
|
739
|
+
E.registeredFontKeys = /* @__PURE__ */ new Set(), E.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 se =
|
|
749
|
-
const es = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNi44NzUgMi41YS42MjUuNjI1IDAgMCAwLS42MjUuNjI0VjYuMjVIMy4xMjVhLjYyNS42MjUgMCAwIDAtLjYyNS42MjV2MTBjMCAuMzQ1LjI4LjYyNS42MjUuNjI1aDEwYy4zNDUgMCAuNjI1LS4yOC42MjUtLjYyNXYtMy4xMjZoMy4xMjVjLjM0NSAwIC42MjUtLjI4LjYyNS0uNjI1di0xMGEuNjI1LjYyNSAwIDAgMC0uNjI1LS42MjVoLTEwWm02Ljg3NSAxMGgyLjVWMy43NUg3LjV2Mi41aDUuNjI1Yy4zNDUgMCAuNjI1LjI4LjYyNS42MjV2NS42MjRabS0xMCAzLjc1VjcuNWg4Ljc1djguNzVIMy43NVoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==", ss = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMi41IDcuNWMwLS42OS41Ni0xLjI1IDEuMjUtMS4yNWgxMi41Yy42OSAwIDEuMjUuNTYgMS4yNSAxLjI1djguNzVjMCAuNjktLjU2IDEuMjUtMS4yNSAxLjI1SDMuNzVjLS42OSAwLTEuMjUtLjU2LTEuMjUtMS4yNVY3LjVabTEzLjc1IDBIMy43NXY4Ljc1aDEyLjVWNy41WiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTAgMS44NzVhMi4xODggMi4xODggMCAwIDAtMi4xODggMi4xODh2Mi44MTJhLjYyNS42MjUgMCAxIDEtMS4yNSAwVjQuMDYyYTMuNDM3IDMuNDM3IDAgMSAxIDYuODc1IDB2Mi44MTNhLjYyNS42MjUgMCAxIDEtMS4yNSAwVjQuMDYyQTIuMTg4IDIuMTg4IDAgMCAwIDEwIDEuODc2WiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTEwIDEyLjgxM2EuOTM3LjkzNyAwIDEgMCAwLTEuODc1LjkzNy45MzcgMCAwIDAgMCAxLjg3NFoiLz48L3N2Zz4=", os = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE2LjI1IDYuMjVINy41VjQuMzc1YTIuNSAyLjUgMCAwIDEgMi41LTIuNWMxLjIgMCAyLjI4MS44NiAyLjUxMiAyYS42MjUuNjI1IDAgMCAwIDEuMjI2LS4yNWMtLjM1NC0xLjczOC0xLjkyNS0zLTMuNzM4LTNhMy43NTQgMy43NTQgMCAwIDAtMy43NSAzLjc1VjYuMjVoLTIuNUExLjI1IDEuMjUgMCAwIDAgMi41IDcuNXY4Ljc1YTEuMjUgMS4yNSAwIDAgMCAxLjI1IDEuMjVoMTIuNWExLjI1IDEuMjUgMCAwIDAgMS4yNS0xLjI1VjcuNWExLjI1IDEuMjUgMCAwIDAtMS4yNS0xLjI1Wm0wIDEwSDMuNzVWNy41aDEyLjV2OC43NVptLTUuMzEzLTQuMzc1YS45MzcuOTM3IDAgMSAxLTEuODc0IDAgLjkzNy45MzcgMCAwIDEgMS44NzQgMFoiLz48L3N2Zz4K",
|
|
748
|
+
let se = E;
|
|
749
|
+
const es = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNi44NzUgMi41YS42MjUuNjI1IDAgMCAwLS42MjUuNjI0VjYuMjVIMy4xMjVhLjYyNS42MjUgMCAwIDAtLjYyNS42MjV2MTBjMCAuMzQ1LjI4LjYyNS42MjUuNjI1aDEwYy4zNDUgMCAuNjI1LS4yOC42MjUtLjYyNXYtMy4xMjZoMy4xMjVjLjM0NSAwIC42MjUtLjI4LjYyNS0uNjI1di0xMGEuNjI1LjYyNSAwIDAgMC0uNjI1LS42MjVoLTEwWm02Ljg3NSAxMGgyLjVWMy43NUg3LjV2Mi41aDUuNjI1Yy4zNDUgMCAuNjI1LjI4LjYyNS42MjV2NS42MjRabS0xMCAzLjc1VjcuNWg4Ljc1djguNzVIMy43NVoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==", ss = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMi41IDcuNWMwLS42OS41Ni0xLjI1IDEuMjUtMS4yNWgxMi41Yy42OSAwIDEuMjUuNTYgMS4yNSAxLjI1djguNzVjMCAuNjktLjU2IDEuMjUtMS4yNSAxLjI1SDMuNzVjLS42OSAwLTEuMjUtLjU2LTEuMjUtMS4yNVY3LjVabTEzLjc1IDBIMy43NXY4Ljc1aDEyLjVWNy41WiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTAgMS44NzVhMi4xODggMi4xODggMCAwIDAtMi4xODggMi4xODh2Mi44MTJhLjYyNS42MjUgMCAxIDEtMS4yNSAwVjQuMDYyYTMuNDM3IDMuNDM3IDAgMSAxIDYuODc1IDB2Mi44MTNhLjYyNS42MjUgMCAxIDEtMS4yNSAwVjQuMDYyQTIuMTg4IDIuMTg4IDAgMCAwIDEwIDEuODc2WiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTEwIDEyLjgxM2EuOTM3LjkzNyAwIDEgMCAwLTEuODc1LjkzNy45MzcgMCAwIDAgMCAxLjg3NFoiLz48L3N2Zz4=", os = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE2LjI1IDYuMjVINy41VjQuMzc1YTIuNSAyLjUgMCAwIDEgMi41LTIuNWMxLjIgMCAyLjI4MS44NiAyLjUxMiAyYS42MjUuNjI1IDAgMCAwIDEuMjI2LS4yNWMtLjM1NC0xLjczOC0xLjkyNS0zLTMuNzM4LTNhMy43NTQgMy43NTQgMCAwIDAtMy43NSAzLjc1VjYuMjVoLTIuNUExLjI1IDEuMjUgMCAwIDAgMi41IDcuNXY4Ljc1YTEuMjUgMS4yNSAwIDAgMCAxLjI1IDEuMjVoMTIuNWExLjI1IDEuMjUgMCAwIDAgMS4yNS0xLjI1VjcuNWExLjI1IDEuMjUgMCAwIDAtMS4yNS0xLjI1Wm0wIDEwSDMuNzVWNy41aDEyLjV2OC43NVptLTUuMzEzLTQuMzc1YS45MzcuOTM3IDAgMSAxLTEuODc0IDAgLjkzNy45MzcgMCAwIDEgMS44NzQgMFoiLz48L3N2Zz4K", is = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTIuNSA4LjEyNSAxMCAxMi41bDcuNS00LjM3NUwxMCAzLjc1IDIuNSA4LjEyNVoiLz48cGF0aCBmaWxsPSIjZmZmIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik05LjY4NSAzLjIxYS42MjUuNjI1IDAgMCAxIC42MyAwbDcuNSA0LjM3NWEuNjI1LjYyNSAwIDAgMSAwIDEuMDhsLTcuNSA0LjM3NWEuNjI1LjYyNSAwIDAgMS0uNjMgMGwtNy41LTQuMzc1YS42MjUuNjI1IDAgMCAxIDAtMS4wOGw3LjUtNC4zNzVaTTMuNzQgOC4xMjUgMTAgMTEuNzc2bDYuMjYtMy42NTFMMTAgNC40NzQgMy43NCA4LjEyNVoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjxwYXRoIGZpbGw9IiNmZmYiIGZpbGwtcnVsZT0iZXZlbm9kZCIgZD0iTTUuNCA5LjQ2YS42MjUuNjI1IDAgMCAxIC42MyAwTDEwIDExLjc3NmwzLjk3LTIuMzE2YS42MjUuNjI1IDAgMCAxIC42MyAwbDMuMjE1IDEuODc1YS42MjUuNjI1IDAgMCAxIDAgMS4wOGwtNy41IDQuMzc1YS42MjUuNjI1IDAgMCAxLS42MyAwbC03LjUtNC4zNzVhLjYyNS42MjUgMCAwIDEgMC0xLjA4TDUuNCA5LjQ2Wm0tMS42NiAyLjQxNUwxMCAxNS41MjZsNi4yNi0zLjY1MS0xLjk3NC0xLjE1MS0zLjk3MSAyLjMxNmEuNjI1LjYyNSAwIDAgMS0uNjMgMGwtMy45Ny0yLjMxNi0xLjk3NSAxLjE1MVoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==", ns = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNOS42ODUgMy4yMWEuNjI1LjYyNSAwIDAgMSAuNjMgMGw3LjUgNC4zNzVhLjYyNS42MjUgMCAwIDEgMCAxLjA4bC03LjUgNC4zNzVhLjYyNS42MjUgMCAwIDEtLjYzIDBsLTcuNS00LjM3NWEuNjI1LjYyNSAwIDAgMSAwLTEuMDhsNy41LTQuMzc1Wk0zLjc0IDguMTI1IDEwIDExLjc3Nmw2LjI2LTMuNjUxTDEwIDQuNDc0IDMuNzQgOC4xMjVaIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48cGF0aCBmaWxsPSIjZmZmIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik01LjcxNCAxMCAxMCAxMi41bDQuMjg2LTIuNSAzLjIxNCAxLjg3NUwxMCAxNi4yNWwtNy41LTQuMzc1TDUuNzE0IDEwWiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNS40IDkuNDZhLjYyNS42MjUgMCAwIDEgLjYzIDBMMTAgMTEuNzc2bDMuOTctMi4zMTZhLjYyNS42MjUgMCAwIDEgLjYzIDBsMy4yMTUgMS44NzVhLjYyNS42MjUgMCAwIDEgMCAxLjA4bC03LjUgNC4zNzVhLjYyNS42MjUgMCAwIDEtLjYzIDBsLTcuNS00LjM3NWEuNjI1LjYyNSAwIDAgMSAwLTEuMDhMNS40IDkuNDZabS0xLjY2IDIuNDE1TDEwIDE1LjUyNmw2LjI2LTMuNjUxLTEuOTc0LTEuMTUxLTMuOTcxIDIuMzE2YS42MjUuNjI1IDAgMCAxLS42MyAwbC0zLjk3LTIuMzE2LTEuOTc1IDEuMTUxWiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+", as = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0ibTIuNSA2LjI1IDcuNSA0LjM3NSA3LjUtNC4zNzVMMTAgMS44NzUgMi41IDYuMjVaIi8+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNOS42ODUgMS4zMzVhLjYyNS42MjUgMCAwIDEgLjYzIDBsNy41IDQuMzc1YS42MjUuNjI1IDAgMCAxIDAgMS4wOGwtNy41IDQuMzc1YS42MjUuNjI1IDAgMCAxLS42MyAwbC03LjUtNC4zNzVhLjYyNS42MjUgMCAwIDEgMC0xLjA4bDcuNS00LjM3NVpNMy43NCA2LjI1IDEwIDkuOTAxbDYuMjYtMy42NTFMMTAgMi41OTkgMy43NCA2LjI1WiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNS40IDExLjMzNWEuNjI1LjYyNSAwIDAgMSAuNjMgMEwxMCAxMy42NTFsMy45Ny0yLjMxNmEuNjI1LjYyNSAwIDAgMSAuNjMgMGwzLjIxNSAxLjg3NWEuNjI1LjYyNSAwIDAgMSAwIDEuMDhsLTcuNSA0LjM3NWEuNjI1LjYyNSAwIDAgMS0uNjMgMGwtNy41LTQuMzc1YS42MjUuNjI1IDAgMCAxIDAtMS4wOEw1LjQgMTEuMzM1Wk0zLjc0IDEzLjc1IDEwIDE3LjQwMWw2LjI2LTMuNjUxLTEuOTc0LTEuMTUxLTMuOTcxIDIuMzE2YS42MjUuNjI1IDAgMCAxLS42MyAwbC0zLjk3LTIuMzE2TDMuNzQgMTMuNzVaIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48cGF0aCBmaWxsPSIjZmZmIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik01LjQgNy41ODVhLjYyNS42MjUgMCAwIDEgLjYzIDBMMTAgOS45MDFsMy45Ny0yLjMxNmEuNjI1LjYyNSAwIDAgMSAuNjMgMGwzLjIxNSAxLjg3NWEuNjI1LjYyNSAwIDAgMSAwIDEuMDhsLTcuNSA0LjM3NWEuNjI1LjYyNSAwIDAgMS0uNjMgMGwtNy41LTQuMzc1YS42MjUuNjI1IDAgMCAxIDAtMS4wOEw1LjQgNy41ODVaTTMuNzQgMTAgMTAgMTMuNjUxIDE2LjI2IDEwbC0xLjk3NC0xLjE1MS0zLjk3MSAyLjMxNmEuNjI1LjYyNSAwIDAgMS0uNjMgMGwtMy45Ny0yLjMxNkwzLjc0IDEwWiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+", rs = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMS45NiAxMy40MzVhLjYyNS42MjUgMCAwIDEgLjg1NS0uMjI1TDEwIDE3LjQwMWw3LjE4NS00LjE5YS42MjUuNjI1IDAgMCAxIC42MyAxLjA3OWwtNy41IDQuMzc1YS42MjUuNjI1IDAgMCAxLS42MyAwbC03LjUtNC4zNzVhLjYyNS42MjUgMCAwIDEtLjIyNS0uODU1Wk05LjY4NSAxLjMzNWEuNjI1LjYyNSAwIDAgMSAuNjMgMGw3LjUgNC4zNzVhLjYyNS42MjUgMCAwIDEgMCAxLjA4bC03LjUgNC4zNzVhLjYyNS42MjUgMCAwIDEtLjYzIDBsLTcuNS00LjM3NWEuNjI1LjYyNSAwIDAgMSAwLTEuMDhsNy41LTQuMzc1Wk0zLjc0IDYuMjUgMTAgOS45MDFsNi4yNi0zLjY1MUwxMCAyLjU5OSAzLjc0IDYuMjVaIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48cGF0aCBmaWxsPSIjZmZmIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGQ9Im01LjcxNCAxMS44NzUgNC4yODYgMi41IDQuMjg2LTIuNUwxNy41IDEzLjc1IDEwIDE4LjEyNSAyLjUgMTMuNzVsMy4yMTQtMS44NzVaIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48cGF0aCBmaWxsPSIjZmZmIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik01LjQgMTEuMzM1YS42MjUuNjI1IDAgMCAxIC42MyAwTDEwIDEzLjY1MWwzLjk3LTIuMzE2YS42MjUuNjI1IDAgMCAxIC42MyAwbDMuMjE1IDEuODc1YS42MjUuNjI1IDAgMCAxIDAgMS4wOGwtNy41IDQuMzc1YS42MjUuNjI1IDAgMCAxLS42MyAwbC03LjUtNC4zNzVhLjYyNS42MjUgMCAwIDEgMC0xLjA4TDUuNCAxMS4zMzVaTTMuNzQgMTMuNzUgMTAgMTcuNDAxbDYuMjYtMy42NTEtMS45NzQtMS4xNTEtMy45NzEgMi4zMTZhLjYyNS42MjUgMCAwIDEtLjYzIDBsLTMuOTctMi4zMTZMMy43NCAxMy43NVoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjxwYXRoIGZpbGw9IiNmZmYiIGZpbGwtcnVsZT0iZXZlbm9kZCIgZD0iTTUuNCA3LjU4NWEuNjI1LjYyNSAwIDAgMSAuNjMgMEwxMCA5LjkwMWwzLjk3LTIuMzE2YS42MjUuNjI1IDAgMCAxIC42MyAwbDMuMjE1IDEuODc1YS42MjUuNjI1IDAgMCAxIDAgMS4wOGwtNy41IDQuMzc1YS42MjUuNjI1IDAgMCAxLS42MyAwbC03LjUtNC4zNzVhLjYyNS42MjUgMCAwIDEgMC0xLjA4TDUuNCA3LjU4NVpNMy43NCAxMCAxMCAxMy42NTEgMTYuMjYgMTBsLTEuOTc0LTEuMTUxLTMuOTcxIDIuMzE2YS42MjUuNjI1IDAgMCAxLS42MyAwbC0zLjk3LTIuMzE2TDMuNzQgMTBaIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=", cs = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI0VDNEU0MCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNOC4xMjUgMS4yNUExLjg3NSAxLjg3NSAwIDAgMCA2LjI1IDMuMTI1di42MjVIMy4xMjVhLjYyNS42MjUgMCAwIDAgMCAxLjI1aC42MjV2MTEuMjVBMS4yNSAxLjI1IDAgMCAwIDUgMTcuNWgxMGExLjI1IDEuMjUgMCAwIDAgMS4yNS0xLjI1VjVoLjYyNWEuNjI1LjYyNSAwIDAgMCAwLTEuMjVIMTMuNzV2LS42MjVhMS44NzUgMS44NzUgMCAwIDAtMS44NzUtMS44NzVoLTMuNzVabTQuMzc1IDIuNXYtLjYyNWEuNjI1LjYyNSAwIDAgMC0uNjI1LS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDAtLjYyNS42MjV2LjYyNWg1Wk01IDE2LjI1VjVoMTB2MTEuMjVINVpNOC4xMjUgNy41Yy4zNDUgMCAuNjI1LjI4LjYyNS42MjV2NWEuNjI1LjYyNSAwIDEgMS0xLjI1IDB2LTVjMC0uMzQ1LjI4LS42MjUuNjI1LS42MjVabTQuMzc1IDUuNjI1di01YS42MjUuNjI1IDAgMCAwLTEuMjUgMHY1YS42MjUuNjI1IDAgMSAwIDEuMjUgMFoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==", Ot = {
|
|
750
750
|
style: {
|
|
751
751
|
position: "absolute",
|
|
752
752
|
display: "none",
|
|
@@ -819,11 +819,11 @@ const es = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMj
|
|
|
819
819
|
unlock: os,
|
|
820
820
|
bringToFront: as,
|
|
821
821
|
sendToBack: rs,
|
|
822
|
-
bringForward:
|
|
823
|
-
sendBackwards:
|
|
822
|
+
bringForward: is,
|
|
823
|
+
sendBackwards: ns
|
|
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) => {
|
|
@@ -856,11 +856,11 @@ class ds {
|
|
|
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(N(N({}, Ot), t), {
|
|
860
|
+
style: N(N({}, Ot.style), t.style || {}),
|
|
861
|
+
btnStyle: N(N({}, Ot.btnStyle), t.btnStyle || {}),
|
|
862
|
+
icons: N(N({}, Ot.icons), t.icons || {}),
|
|
863
|
+
handlers: N(N({}, Ot.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();
|
|
@@ -887,8 +887,8 @@ class ds {
|
|
|
887
887
|
_renderButtons(t) {
|
|
888
888
|
this.el.innerHTML = "";
|
|
889
889
|
for (const e of t) {
|
|
890
|
-
const { name: s, handle: o } = e, { icons:
|
|
891
|
-
r.innerHTML =
|
|
890
|
+
const { name: s, handle: o } = e, { icons: i = {}, btnStyle: n, handlers: a = {} } = this.config, r = document.createElement("button");
|
|
891
|
+
r.innerHTML = i[o] ? `<img src="${i[o]}" title="${s}" />` : s, Object.assign(r.style, n), r.onclick = () => {
|
|
892
892
|
var c;
|
|
893
893
|
return (c = a[o]) == null ? void 0 : c.call(a, this.editor);
|
|
894
894
|
}, r.onmousedown = (c) => {
|
|
@@ -951,7 +951,7 @@ class ds {
|
|
|
951
951
|
}
|
|
952
952
|
const { el: e, config: s, canvas: o } = this;
|
|
953
953
|
t.setCoords();
|
|
954
|
-
const
|
|
954
|
+
const i = o.getZoom(), [, , , , n, a] = o.viewportTransform, { x: r } = t.getCenterPoint(), { top: c, height: h } = t.getBoundingRect(), g = r * i + n - e.offsetWidth / 2, u = s.offsetTop || 0, f = (c + h) * i + a + u;
|
|
955
955
|
Object.assign(e.style, {
|
|
956
956
|
left: `${g}px`,
|
|
957
957
|
top: `${f}px`,
|
|
@@ -979,7 +979,7 @@ 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
|
-
},
|
|
982
|
+
}, we = 16, je = 16, hs = "fabric-editor-angle-indicator";
|
|
983
983
|
class ae {
|
|
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();
|
|
@@ -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 +
|
|
1043
|
-
const
|
|
1044
|
-
s +
|
|
1042
|
+
let s = t.clientX - e.left + we, o = t.clientY - e.top + je;
|
|
1043
|
+
const i = this.el.getBoundingClientRect(), n = i.width, a = i.height;
|
|
1044
|
+
s + n > e.width && (s = t.clientX - e.left - n - we), o + a > e.height && (o = t.clientY - e.top - a - je), 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 Le = [
|
|
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 Vt {
|
|
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 = Pe({
|
|
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: We,
|
|
1174
1174
|
minLength: 60
|
|
1175
1175
|
}
|
|
1176
1176
|
});
|
|
@@ -1201,8 +1201,8 @@ class Zt {
|
|
|
1201
1201
|
getFullState() {
|
|
1202
1202
|
const { baseState: t, currentIndex: e, patches: s } = this;
|
|
1203
1203
|
let o = JSON.parse(JSON.stringify(t));
|
|
1204
|
-
for (let
|
|
1205
|
-
o = this.diffPatcher.patch(o, s[
|
|
1204
|
+
for (let i = 0; i < e; i += 1)
|
|
1205
|
+
o = this.diffPatcher.patch(o, s[i].diff);
|
|
1206
1206
|
return console.log("getFullState state", o), o;
|
|
1207
1207
|
}
|
|
1208
1208
|
/**
|
|
@@ -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([...Le])
|
|
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: F(), 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,19 +1256,19 @@ 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
|
-
const { canvas: e, canvasManager: s, interactionBlocker: o, backgroundManager:
|
|
1263
|
-
o.overlayMask = null,
|
|
1264
|
-
|
|
1262
|
+
const { canvas: e, canvasManager: s, interactionBlocker: o, backgroundManager: i } = this.editor, { width: n, height: a } = e;
|
|
1263
|
+
o.overlayMask = null, Vt._serializeCustomData(t), yield e.loadFromJSON(t, (l, g) => {
|
|
1264
|
+
Vt._deserializeCustomData(l, g);
|
|
1265
1265
|
});
|
|
1266
1266
|
const r = e.getObjects().find((l) => l.id === "montage-area");
|
|
1267
|
-
r && (this.editor.montageArea = r, (
|
|
1267
|
+
r && (this.editor.montageArea = r, (n !== e.getWidth() || a !== e.getHeight()) && s.updateCanvas());
|
|
1268
1268
|
const c = e.getObjects().find((l) => l.id === "overlay-mask");
|
|
1269
1269
|
c && (o.overlayMask = c, o.overlayMask.visible = !1);
|
|
1270
1270
|
const h = e.getObjects().find((l) => l.id === "background");
|
|
1271
|
-
h ? (
|
|
1271
|
+
h ? (i.backgroundObject = h, i.refresh()) : i.removeBackground({ withoutSave: !0 }), e.renderAll(), e.fire("editor:history-state-loaded", {
|
|
1272
1272
|
fullState: t,
|
|
1273
1273
|
currentIndex: this.currentIndex,
|
|
1274
1274
|
totalChangesCount: this.totalChangesCount,
|
|
@@ -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("Нет состояний для повтора.");
|
|
@@ -1353,9 +1353,9 @@ class Zt {
|
|
|
1353
1353
|
});
|
|
1354
1354
|
}
|
|
1355
1355
|
_withTemporaryUnlock(t) {
|
|
1356
|
-
var o,
|
|
1356
|
+
var o, i, n;
|
|
1357
1357
|
const e = [];
|
|
1358
|
-
((
|
|
1358
|
+
((n = (i = (o = this.canvas).getObjects) == null ? void 0 : i.call(o)) != null ? n : []).forEach((a) => {
|
|
1359
1359
|
const r = typeof a.type == "string" ? a.type.toLowerCase() : "";
|
|
1360
1360
|
if (!(r === "textbox" || r === "i-text" || typeof a.isEditing == "boolean") || a.locked) return;
|
|
1361
1361
|
const h = !!a.lockMovementX, l = !!a.lockMovementY;
|
|
@@ -1375,7 +1375,7 @@ class Zt {
|
|
|
1375
1375
|
}
|
|
1376
1376
|
}
|
|
1377
1377
|
}
|
|
1378
|
-
const gs = 0.1, us = 2,
|
|
1378
|
+
const gs = 0.1, us = 2, Ae = 0.1, fs = 90, Mt = 16, bt = 16, rt = 4096, ct = 4096, Se = "application/image-editor:", Yt = [
|
|
1379
1379
|
"format",
|
|
1380
1380
|
"uppercase",
|
|
1381
1381
|
"textCaseRaw",
|
|
@@ -1407,13 +1407,13 @@ 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}`,
|
|
1414
1414
|
withoutSave: o = !1,
|
|
1415
|
-
fromClipboard:
|
|
1416
|
-
isBackground:
|
|
1415
|
+
fromClipboard: i = !1,
|
|
1416
|
+
isBackground: n = !1,
|
|
1417
1417
|
withoutSelection: a = !1
|
|
1418
1418
|
} = t;
|
|
1419
1419
|
if (!e) return null;
|
|
@@ -1431,8 +1431,8 @@ class tt {
|
|
|
1431
1431
|
contentType: u,
|
|
1432
1432
|
acceptContentTypes: m,
|
|
1433
1433
|
acceptFormats: y,
|
|
1434
|
-
fromClipboard:
|
|
1435
|
-
isBackground:
|
|
1434
|
+
fromClipboard: i,
|
|
1435
|
+
isBackground: n,
|
|
1436
1436
|
withoutSelection: a
|
|
1437
1437
|
}
|
|
1438
1438
|
}), null;
|
|
@@ -1457,47 +1457,47 @@ class tt {
|
|
|
1457
1457
|
contentType: u,
|
|
1458
1458
|
acceptContentTypes: m,
|
|
1459
1459
|
acceptFormats: y,
|
|
1460
|
-
fromClipboard:
|
|
1461
|
-
isBackground:
|
|
1460
|
+
fromClipboard: i,
|
|
1461
|
+
isBackground: n,
|
|
1462
1462
|
withoutSelection: a
|
|
1463
1463
|
}
|
|
1464
1464
|
}), null;
|
|
1465
1465
|
if (this._createdBlobUrls.push(p), f === "svg") {
|
|
1466
|
-
const b = yield
|
|
1466
|
+
const b = yield xe(p);
|
|
1467
1467
|
M = vt.groupSVGElements(b.objects, b.options);
|
|
1468
1468
|
} else
|
|
1469
|
-
M = yield
|
|
1470
|
-
const { width:
|
|
1471
|
-
if (M instanceof
|
|
1469
|
+
M = yield Et.fromURL(p, { crossOrigin: "anonymous" });
|
|
1470
|
+
const { width: j, height: T } = M;
|
|
1471
|
+
if (M instanceof Et) {
|
|
1472
1472
|
const b = M.getElement();
|
|
1473
1473
|
let I = "";
|
|
1474
|
-
if (b instanceof HTMLImageElement ? I = b.src : b instanceof HTMLCanvasElement && (I = b.toDataURL()),
|
|
1475
|
-
const
|
|
1476
|
-
this._createdBlobUrls.push(
|
|
1477
|
-
} else if (
|
|
1478
|
-
const
|
|
1479
|
-
this._createdBlobUrls.push(
|
|
1474
|
+
if (b instanceof HTMLImageElement ? I = b.src : b instanceof HTMLCanvasElement && (I = b.toDataURL()), T > ct || j > rt) {
|
|
1475
|
+
const _ = yield this.resizeImageToBoundaries(I, "max"), R = URL.createObjectURL(_);
|
|
1476
|
+
this._createdBlobUrls.push(R), M = yield Et.fromURL(R, { crossOrigin: "anonymous" });
|
|
1477
|
+
} else if (T < bt || j < Mt) {
|
|
1478
|
+
const _ = yield this.resizeImageToBoundaries(I, "min"), R = URL.createObjectURL(_);
|
|
1479
|
+
this._createdBlobUrls.push(R), M = yield Et.fromURL(R, { crossOrigin: "anonymous" });
|
|
1480
1480
|
}
|
|
1481
1481
|
}
|
|
1482
|
-
if (M.set("id", `${M.type}-${
|
|
1482
|
+
if (M.set("id", `${M.type}-${F()}`), M.set("format", f), s === "scale-montage")
|
|
1483
1483
|
this.editor.canvasManager.scaleMontageAreaToImage({ object: M, withoutSave: !0 });
|
|
1484
1484
|
else {
|
|
1485
|
-
const { width: b, height: I } = c,
|
|
1486
|
-
s === "image-contain" &&
|
|
1485
|
+
const { width: b, height: I } = c, _ = this.calculateScaleFactor({ imageObject: M, scaleType: s });
|
|
1486
|
+
s === "image-contain" && _ < 1 ? h.fitObject({ object: M, type: "contain", withoutSave: !0 }) : s === "image-cover" && (j > b || T > I) && 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
|
-
const
|
|
1489
|
+
const B = {
|
|
1490
1490
|
image: M,
|
|
1491
1491
|
format: f,
|
|
1492
1492
|
contentType: u,
|
|
1493
1493
|
scale: s,
|
|
1494
1494
|
withoutSave: o,
|
|
1495
1495
|
source: e,
|
|
1496
|
-
fromClipboard:
|
|
1497
|
-
isBackground:
|
|
1496
|
+
fromClipboard: i,
|
|
1497
|
+
isBackground: n,
|
|
1498
1498
|
withoutSelection: a
|
|
1499
1499
|
};
|
|
1500
|
-
return r.fire("editor:image-imported",
|
|
1500
|
+
return r.fire("editor:image-imported", B), B;
|
|
1501
1501
|
} catch (p) {
|
|
1502
1502
|
return g.emitError({
|
|
1503
1503
|
origin: "ImageManager",
|
|
@@ -1510,8 +1510,8 @@ class tt {
|
|
|
1510
1510
|
contentType: u,
|
|
1511
1511
|
scale: s,
|
|
1512
1512
|
withoutSave: o,
|
|
1513
|
-
fromClipboard:
|
|
1514
|
-
isBackground:
|
|
1513
|
+
fromClipboard: i,
|
|
1514
|
+
isBackground: n,
|
|
1515
1515
|
withoutSelection: a
|
|
1516
1516
|
}
|
|
1517
1517
|
}), l.resumeHistory(), null;
|
|
@@ -1527,7 +1527,7 @@ class tt {
|
|
|
1527
1527
|
* @returns возвращает Promise с Blob-объектом уменьшенного изображения
|
|
1528
1528
|
*/
|
|
1529
1529
|
resizeImageToBoundaries(t, e = "max") {
|
|
1530
|
-
return
|
|
1530
|
+
return O(this, null, function* () {
|
|
1531
1531
|
let s = `Размер изображения больше максимального размера канваса, поэтому оно будет уменьшено до максимальных размеров c сохранением пропорций: ${rt}x${ct}`;
|
|
1532
1532
|
e === "min" && (s = `Размер изображения меньше минимального размера канваса, поэтому оно будет увеличено до минимальных размеров c сохранением пропорций: ${Mt}x${bt}`);
|
|
1533
1533
|
const o = {
|
|
@@ -1559,105 +1559,105 @@ 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",
|
|
1566
1566
|
exportAsBase64: o = !1,
|
|
1567
|
-
exportAsBlob:
|
|
1568
|
-
} = t, { canvas:
|
|
1567
|
+
exportAsBlob: i = !1
|
|
1568
|
+
} = t, { canvas: n, montageArea: a, workerManager: r, interactionBlocker: c } = this.editor;
|
|
1569
1569
|
try {
|
|
1570
1570
|
const h = s === "application/pdf", l = h ? "image/jpg" : s, g = tt.getFormatFromContentType(l);
|
|
1571
1571
|
a.setCoords();
|
|
1572
|
-
const { left: u, top: f, width: m, height: y } = a.getBoundingRect(), p = yield
|
|
1572
|
+
const { left: u, top: f, width: m, height: y } = a.getBoundingRect(), p = yield n.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((A) => A.id === a.id);
|
|
1575
1575
|
if (M && (M.visible = !1), c != null && c.isBlocked) {
|
|
1576
|
-
const
|
|
1577
|
-
|
|
1576
|
+
const A = p.getObjects().find((k) => k.id === c.overlayMask.id);
|
|
1577
|
+
A && (A.visible = !1);
|
|
1578
1578
|
}
|
|
1579
1579
|
p.viewportTransform = [1, 0, 0, 1, -u, -f], p.setDimensions({ width: m, height: y }, { backstoreOnly: !0 }), p.renderAll();
|
|
1580
|
-
const
|
|
1581
|
-
if (g === "svg" &&
|
|
1582
|
-
const
|
|
1580
|
+
const j = p.getObjects().filter((A) => A.format).every((A) => A.format === "svg");
|
|
1581
|
+
if (g === "svg" && j) {
|
|
1582
|
+
const A = p.toSVG();
|
|
1583
1583
|
p.dispose();
|
|
1584
|
-
const
|
|
1585
|
-
image: tt._exportSVGStringAsFile(
|
|
1584
|
+
const U = {
|
|
1585
|
+
image: tt._exportSVGStringAsFile(A, {
|
|
1586
1586
|
exportAsBase64: o,
|
|
1587
|
-
exportAsBlob:
|
|
1587
|
+
exportAsBlob: i,
|
|
1588
1588
|
fileName: e
|
|
1589
1589
|
}),
|
|
1590
1590
|
format: "svg",
|
|
1591
1591
|
contentType: "image/svg+xml",
|
|
1592
1592
|
fileName: e.replace(/\.[^/.]+$/, ".svg")
|
|
1593
1593
|
};
|
|
1594
|
-
return
|
|
1594
|
+
return n.fire("editor:canvas-exported", U), U;
|
|
1595
1595
|
}
|
|
1596
|
-
const
|
|
1597
|
-
p.getElement().toBlob((
|
|
1598
|
-
|
|
1596
|
+
const T = yield new Promise((A, k) => {
|
|
1597
|
+
p.getElement().toBlob((U) => {
|
|
1598
|
+
U ? A(U) : k(new Error("Failed to create Blob from canvas"));
|
|
1599
1599
|
});
|
|
1600
1600
|
});
|
|
1601
|
-
if (p.dispose(),
|
|
1602
|
-
const
|
|
1603
|
-
image:
|
|
1601
|
+
if (p.dispose(), i) {
|
|
1602
|
+
const A = {
|
|
1603
|
+
image: T,
|
|
1604
1604
|
format: g,
|
|
1605
1605
|
contentType: l,
|
|
1606
1606
|
fileName: e
|
|
1607
1607
|
};
|
|
1608
|
-
return
|
|
1608
|
+
return n.fire("editor:canvas-exported", A), A;
|
|
1609
1609
|
}
|
|
1610
|
-
const
|
|
1610
|
+
const B = yield createImageBitmap(T), b = yield r.post(
|
|
1611
1611
|
"toDataURL",
|
|
1612
|
-
{ format: g, quality: 1, bitmap:
|
|
1613
|
-
[
|
|
1612
|
+
{ format: g, quality: 1, bitmap: B },
|
|
1613
|
+
[B]
|
|
1614
1614
|
);
|
|
1615
1615
|
if (h) {
|
|
1616
|
-
const
|
|
1617
|
-
orientation:
|
|
1616
|
+
const k = m * 0.264583, U = y * 0.264583, G = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, Z = new G({
|
|
1617
|
+
orientation: k > U ? "landscape" : "portrait",
|
|
1618
1618
|
unit: "mm",
|
|
1619
|
-
format: [
|
|
1619
|
+
format: [k, U]
|
|
1620
1620
|
});
|
|
1621
|
-
if (
|
|
1622
|
-
const
|
|
1623
|
-
image:
|
|
1621
|
+
if (Z.addImage(String(b), "JPG", 0, 0, k, U), o) {
|
|
1622
|
+
const z = {
|
|
1623
|
+
image: Z.output("datauristring"),
|
|
1624
1624
|
format: "pdf",
|
|
1625
1625
|
contentType: "application/pdf",
|
|
1626
1626
|
fileName: e
|
|
1627
1627
|
};
|
|
1628
|
-
return
|
|
1628
|
+
return n.fire("editor:canvas-exported", z), z;
|
|
1629
1629
|
}
|
|
1630
|
-
const
|
|
1631
|
-
image: new File([
|
|
1630
|
+
const V = Z.output("blob"), S = {
|
|
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
|
|
1636
|
+
return n.fire("editor:canvas-exported", S), S;
|
|
1637
1637
|
}
|
|
1638
1638
|
if (o) {
|
|
1639
|
-
const
|
|
1639
|
+
const A = {
|
|
1640
1640
|
image: b,
|
|
1641
1641
|
format: g,
|
|
1642
1642
|
contentType: l,
|
|
1643
1643
|
fileName: e
|
|
1644
1644
|
};
|
|
1645
|
-
return
|
|
1645
|
+
return n.fire("editor:canvas-exported", A), A;
|
|
1646
1646
|
}
|
|
1647
|
-
const I = g === "svg" && !
|
|
1648
|
-
image: new File([
|
|
1647
|
+
const I = g === "svg" && !j ? e.replace(/\.[^/.]+$/, ".png") : e, R = {
|
|
1648
|
+
image: new File([T], I, { type: l }),
|
|
1649
1649
|
format: g,
|
|
1650
1650
|
contentType: l,
|
|
1651
1651
|
fileName: I
|
|
1652
1652
|
};
|
|
1653
|
-
return
|
|
1653
|
+
return n.fire("editor:canvas-exported", R), R;
|
|
1654
1654
|
} catch (h) {
|
|
1655
1655
|
return this.editor.errorManager.emitError({
|
|
1656
1656
|
origin: "ImageManager",
|
|
1657
1657
|
method: "exportCanvasAsImageFile",
|
|
1658
1658
|
code: "IMAGE_EXPORT_FAILED",
|
|
1659
1659
|
message: `Ошибка экспорта изображения: ${h.message}`,
|
|
1660
|
-
data: { contentType: s, fileName: e, exportAsBase64: o, exportAsBlob:
|
|
1660
|
+
data: { contentType: s, fileName: e, exportAsBase64: o, exportAsBlob: i }
|
|
1661
1661
|
}), null;
|
|
1662
1662
|
}
|
|
1663
1663
|
});
|
|
@@ -1674,13 +1674,13 @@ 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",
|
|
1681
1681
|
contentType: o = "image/png",
|
|
1682
|
-
exportAsBase64:
|
|
1683
|
-
exportAsBlob:
|
|
1682
|
+
exportAsBase64: i = !1,
|
|
1683
|
+
exportAsBlob: n = !1
|
|
1684
1684
|
} = t, { canvas: a, workerManager: r } = this.editor, c = e || a.getActiveObject();
|
|
1685
1685
|
if (!c)
|
|
1686
1686
|
return this.editor.errorManager.emitError({
|
|
@@ -1688,14 +1688,14 @@ class tt {
|
|
|
1688
1688
|
method: "exportObjectAsImageFile",
|
|
1689
1689
|
code: "NO_OBJECT_SELECTED",
|
|
1690
1690
|
message: "Не выбран объект для экспорта",
|
|
1691
|
-
data: { contentType: o, fileName: s, exportAsBase64:
|
|
1691
|
+
data: { contentType: o, fileName: s, exportAsBase64: i, exportAsBlob: n }
|
|
1692
1692
|
}), null;
|
|
1693
1693
|
try {
|
|
1694
1694
|
const h = tt.getFormatFromContentType(o);
|
|
1695
1695
|
if (h === "svg") {
|
|
1696
1696
|
const m = c.toSVG(), y = tt._exportSVGStringAsFile(m, {
|
|
1697
|
-
exportAsBase64:
|
|
1698
|
-
exportAsBlob:
|
|
1697
|
+
exportAsBase64: i,
|
|
1698
|
+
exportAsBlob: n,
|
|
1699
1699
|
fileName: s
|
|
1700
1700
|
}), p = {
|
|
1701
1701
|
object: c,
|
|
@@ -1706,7 +1706,7 @@ class tt {
|
|
|
1706
1706
|
};
|
|
1707
1707
|
return a.fire("editor:object-exported", p), p;
|
|
1708
1708
|
}
|
|
1709
|
-
if (
|
|
1709
|
+
if (i && c instanceof Et) {
|
|
1710
1710
|
const m = yield createImageBitmap(c.getElement()), y = yield r.post(
|
|
1711
1711
|
"toDataURL",
|
|
1712
1712
|
{
|
|
@@ -1731,7 +1731,7 @@ class tt {
|
|
|
1731
1731
|
p ? m(p) : y(new Error("Failed to create Blob from canvas"));
|
|
1732
1732
|
});
|
|
1733
1733
|
});
|
|
1734
|
-
if (
|
|
1734
|
+
if (n) {
|
|
1735
1735
|
const m = {
|
|
1736
1736
|
object: c,
|
|
1737
1737
|
image: g,
|
|
@@ -1755,7 +1755,7 @@ class tt {
|
|
|
1755
1755
|
method: "exportObjectAsImageFile",
|
|
1756
1756
|
code: "IMAGE_EXPORT_FAILED",
|
|
1757
1757
|
message: `Ошибка экспорта объекта: ${h.message}`,
|
|
1758
|
-
data: { contentType: o, fileName: s, exportAsBase64:
|
|
1758
|
+
data: { contentType: o, fileName: s, exportAsBase64: i, exportAsBlob: n }
|
|
1759
1759
|
}), null;
|
|
1760
1760
|
}
|
|
1761
1761
|
});
|
|
@@ -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";
|
|
@@ -1822,11 +1822,11 @@ class tt {
|
|
|
1822
1822
|
getContentTypeFromExtension(t) {
|
|
1823
1823
|
var e;
|
|
1824
1824
|
try {
|
|
1825
|
-
const o = (e = new URL(t).pathname.split(".").pop()) == null ? void 0 : e.toLowerCase(),
|
|
1826
|
-
return this.acceptContentTypes.forEach((
|
|
1827
|
-
const a = tt.getFormatFromContentType(
|
|
1828
|
-
a && (
|
|
1829
|
-
}), o &&
|
|
1825
|
+
const o = (e = new URL(t).pathname.split(".").pop()) == null ? void 0 : e.toLowerCase(), i = {};
|
|
1826
|
+
return this.acceptContentTypes.forEach((n) => {
|
|
1827
|
+
const a = tt.getFormatFromContentType(n);
|
|
1828
|
+
a && (i[a] = n);
|
|
1829
|
+
}), o && i[o] || "application/octet-stream";
|
|
1830
1830
|
} catch (s) {
|
|
1831
1831
|
return console.warn("Не удалось определить расширение из URL:", t, s), "application/octet-stream";
|
|
1832
1832
|
}
|
|
@@ -1844,8 +1844,8 @@ class tt {
|
|
|
1844
1844
|
}) {
|
|
1845
1845
|
const { montageArea: s } = this.editor;
|
|
1846
1846
|
if (!s || !t) return 1;
|
|
1847
|
-
const o = s.width,
|
|
1848
|
-
return e === "contain" || e === "image-contain" ? Math.min(o /
|
|
1847
|
+
const o = s.width, i = s.height, { width: n, height: a } = t;
|
|
1848
|
+
return e === "contain" || e === "image-contain" ? Math.min(o / n, i / a) : e === "cover" || e === "image-cover" ? Math.max(o / n, i / a) : 1;
|
|
1849
1849
|
}
|
|
1850
1850
|
/**
|
|
1851
1851
|
* Преобразует SVG-строку в Blob, файл, или base64
|
|
@@ -1877,7 +1877,7 @@ class tt {
|
|
|
1877
1877
|
return e ? e[1] : "";
|
|
1878
1878
|
}
|
|
1879
1879
|
}
|
|
1880
|
-
const ut = (d, t, e) => Math.max(Math.min(d, e), t),
|
|
1880
|
+
const ut = (d, t, e) => Math.max(Math.min(d, e), t), Ie = (d, t) => d * t, ps = (d, t) => new dt(d / 2, t / 2);
|
|
1881
1881
|
function ys(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
|
}
|
|
@@ -1909,17 +1909,17 @@ class Ms {
|
|
|
1909
1909
|
var f;
|
|
1910
1910
|
if (!t) return;
|
|
1911
1911
|
const {
|
|
1912
|
-
canvas:
|
|
1913
|
-
montageArea:
|
|
1912
|
+
canvas: i,
|
|
1913
|
+
montageArea: n,
|
|
1914
1914
|
options: { canvasBackstoreWidth: a }
|
|
1915
|
-
} = this.editor, { width: r, height: c } =
|
|
1916
|
-
if (!a || a === "auto" || o ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreWidth(Number(a)) : this.setCanvasBackstoreWidth(h),
|
|
1917
|
-
const m = h / r, y =
|
|
1915
|
+
} = this.editor, { width: r, height: c } = n, h = ut(Number(t), Mt, rt);
|
|
1916
|
+
if (!a || a === "auto" || o ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreWidth(Number(a)) : this.setCanvasBackstoreWidth(h), n.set({ width: h }), (f = i.clipPath) == null || f.set({ width: h }), e) {
|
|
1917
|
+
const m = h / r, y = Ie(c, m);
|
|
1918
1918
|
this.setResolutionHeight(y);
|
|
1919
1919
|
return;
|
|
1920
1920
|
}
|
|
1921
|
-
const { left: l, top: g } = this.getObjectDefaultCoords(
|
|
1922
|
-
|
|
1921
|
+
const { left: l, top: g } = this.getObjectDefaultCoords(n), u = i.getZoom();
|
|
1922
|
+
i.setViewportTransform([u, 0, 0, u, l, g]), this.centerMontageArea(), s || this.editor.historyManager.saveState(), i.fire("editor:resolution-width-changed", {
|
|
1923
1923
|
width: h,
|
|
1924
1924
|
preserveProportional: e,
|
|
1925
1925
|
withoutSave: s,
|
|
@@ -1939,17 +1939,17 @@ class Ms {
|
|
|
1939
1939
|
var f;
|
|
1940
1940
|
if (!t) return;
|
|
1941
1941
|
const {
|
|
1942
|
-
canvas:
|
|
1943
|
-
montageArea:
|
|
1942
|
+
canvas: i,
|
|
1943
|
+
montageArea: n,
|
|
1944
1944
|
options: { canvasBackstoreHeight: a }
|
|
1945
|
-
} = this.editor, { width: r, height: c } =
|
|
1946
|
-
if (!a || a === "auto" || o ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreHeight(Number(a)) : this.setCanvasBackstoreHeight(h),
|
|
1947
|
-
const m = h / c, y =
|
|
1945
|
+
} = this.editor, { width: r, height: c } = n, h = ut(Number(t), bt, ct);
|
|
1946
|
+
if (!a || a === "auto" || o ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreHeight(Number(a)) : this.setCanvasBackstoreHeight(h), n.set({ height: h }), (f = i.clipPath) == null || f.set({ height: h }), e) {
|
|
1947
|
+
const m = h / c, y = Ie(r, m);
|
|
1948
1948
|
this.setResolutionWidth(y);
|
|
1949
1949
|
return;
|
|
1950
1950
|
}
|
|
1951
|
-
const { left: l, top: g } = this.getObjectDefaultCoords(
|
|
1952
|
-
|
|
1951
|
+
const { left: l, top: g } = this.getObjectDefaultCoords(n), u = i.getZoom();
|
|
1952
|
+
i.setViewportTransform([u, 0, 0, u, l, g]), this.centerMontageArea(), s || this.editor.historyManager.saveState(), i.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(),
|
|
1965
|
+
const { canvas: t, montageArea: e } = this.editor, s = t.getWidth(), o = t.getHeight(), i = t.getZoom(), n = ps(s, o);
|
|
1966
1966
|
e.set({
|
|
1967
1967
|
left: s / 2,
|
|
1968
1968
|
top: o / 2
|
|
@@ -1971,7 +1971,7 @@ class Ms {
|
|
|
1971
1971
|
top: o / 2
|
|
1972
1972
|
}), t.renderAll();
|
|
1973
1973
|
const a = t.viewportTransform;
|
|
1974
|
-
a[4] = s / 2 -
|
|
1974
|
+
a[4] = s / 2 - n.x * i, a[5] = o / 2 - n.y * i, t.setViewportTransform(a), t.renderAll();
|
|
1975
1975
|
}
|
|
1976
1976
|
/**
|
|
1977
1977
|
* Метод для получения координат объекта с учетом текущего зума
|
|
@@ -1987,7 +1987,7 @@ class Ms {
|
|
|
1987
1987
|
code: "NO_ACTIVE_OBJECT",
|
|
1988
1988
|
message: "Не выбран объект для получения координат"
|
|
1989
1989
|
}), { left: 0, top: 0 };
|
|
1990
|
-
const { width: o, height:
|
|
1990
|
+
const { width: o, height: i } = s, n = e.getZoom(), a = (o - o * n) / 2, r = (i - i * n) / 2;
|
|
1991
1991
|
return { left: a, top: r };
|
|
1992
1992
|
}
|
|
1993
1993
|
/**
|
|
@@ -2013,8 +2013,8 @@ class Ms {
|
|
|
2013
2013
|
* с учётом минимальных и максимальных значений.
|
|
2014
2014
|
*/
|
|
2015
2015
|
adaptCanvasToContainer() {
|
|
2016
|
-
const { canvas: t } = this.editor, e = this.getEditorContainer(), s = e.clientWidth, o = e.clientHeight,
|
|
2017
|
-
t.setDimensions({ width:
|
|
2016
|
+
const { canvas: t } = this.editor, e = this.getEditorContainer(), s = e.clientWidth, o = e.clientHeight, i = ut(s, Mt, rt), n = ut(o, bt, ct);
|
|
2017
|
+
t.setDimensions({ width: i, height: n }, { backstoreOnly: !0 });
|
|
2018
2018
|
}
|
|
2019
2019
|
/**
|
|
2020
2020
|
* Обновляет размеры канваса без изменения позиций объектов.
|
|
@@ -2029,9 +2029,9 @@ class Ms {
|
|
|
2029
2029
|
width: s,
|
|
2030
2030
|
height: o
|
|
2031
2031
|
}
|
|
2032
|
-
} = this.editor,
|
|
2032
|
+
} = this.editor, i = e.left, n = e.top;
|
|
2033
2033
|
this.setResolutionWidth(s, { adaptCanvasToContainer: !0, withoutSave: !0 }), this.setResolutionHeight(o, { adaptCanvasToContainer: !0, withoutSave: !0 }), this.centerMontageArea();
|
|
2034
|
-
const a = e.left -
|
|
2034
|
+
const a = e.left - i, r = e.top - n;
|
|
2035
2035
|
if (a !== 0 || r !== 0) {
|
|
2036
2036
|
const c = t.getActiveObject(), h = [];
|
|
2037
2037
|
if ((c == null ? void 0 : c.type) === "activeselection") {
|
|
@@ -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 x(h, {
|
|
2051
2051
|
canvas: t
|
|
2052
2052
|
});
|
|
2053
2053
|
t.setActiveObject(l);
|
|
@@ -2165,32 +2165,32 @@ class Ms {
|
|
|
2165
2165
|
*/
|
|
2166
2166
|
setDisplayDimension({ element: t = "canvas", dimension: e, value: s } = {}) {
|
|
2167
2167
|
if (!s) return;
|
|
2168
|
-
const { canvas: o } = this.editor,
|
|
2168
|
+
const { canvas: o } = this.editor, i = [];
|
|
2169
2169
|
switch (t) {
|
|
2170
2170
|
case "canvas":
|
|
2171
|
-
|
|
2171
|
+
i.push(o.lowerCanvasEl, o.upperCanvasEl);
|
|
2172
2172
|
break;
|
|
2173
2173
|
case "wrapper":
|
|
2174
|
-
|
|
2174
|
+
i.push(o.wrapperEl);
|
|
2175
2175
|
break;
|
|
2176
2176
|
case "container":
|
|
2177
|
-
|
|
2177
|
+
i.push(this.getEditorContainer());
|
|
2178
2178
|
break;
|
|
2179
2179
|
default:
|
|
2180
|
-
|
|
2180
|
+
i.push(o.lowerCanvasEl, o.upperCanvasEl);
|
|
2181
2181
|
}
|
|
2182
|
-
const
|
|
2182
|
+
const n = e === "width" ? "width" : "height";
|
|
2183
2183
|
if (typeof s == "string") {
|
|
2184
|
-
|
|
2185
|
-
r.style[
|
|
2184
|
+
i.forEach((r) => {
|
|
2185
|
+
r.style[n] = s;
|
|
2186
2186
|
});
|
|
2187
2187
|
return;
|
|
2188
2188
|
}
|
|
2189
2189
|
if (isNaN(s)) return;
|
|
2190
2190
|
const a = `${s}px`;
|
|
2191
|
-
|
|
2192
|
-
r.style[
|
|
2193
|
-
}), o.fire(`editor:display-${t}-${
|
|
2191
|
+
i.forEach((r) => {
|
|
2192
|
+
r.style[n] = a;
|
|
2193
|
+
}), o.fire(`editor:display-${t}-${n}-changed`, {
|
|
2194
2194
|
element: t,
|
|
2195
2195
|
value: s
|
|
2196
2196
|
});
|
|
@@ -2206,8 +2206,8 @@ class Ms {
|
|
|
2206
2206
|
scaleMontageAreaToImage({ object: t, preserveAspectRatio: e, withoutSave: s } = {}) {
|
|
2207
2207
|
const {
|
|
2208
2208
|
canvas: o,
|
|
2209
|
-
montageArea:
|
|
2210
|
-
transformManager:
|
|
2209
|
+
montageArea: i,
|
|
2210
|
+
transformManager: n,
|
|
2211
2211
|
options: {
|
|
2212
2212
|
montageAreaWidth: a,
|
|
2213
2213
|
montageAreaHeight: r
|
|
@@ -2220,10 +2220,10 @@ class Ms {
|
|
|
2220
2220
|
const {
|
|
2221
2221
|
width: f,
|
|
2222
2222
|
height: m
|
|
2223
|
-
} =
|
|
2223
|
+
} = i, y = h / f, p = l / m, M = Math.max(y, p);
|
|
2224
2224
|
g = f * M, u = m * M;
|
|
2225
2225
|
}
|
|
2226
|
-
this.setResolutionWidth(g, { withoutSave: !0 }), this.setResolutionHeight(u, { withoutSave: !0 }), this.editor.backgroundManager.backgroundObject && this.editor.backgroundManager.refresh(), (h > a || l > r) && this.editor.zoomManager.calculateAndApplyDefaultZoom(),
|
|
2226
|
+
this.setResolutionWidth(g, { withoutSave: !0 }), this.setResolutionHeight(u, { withoutSave: !0 }), this.editor.backgroundManager.backgroundObject && this.editor.backgroundManager.refresh(), (h > a || l > r) && this.editor.zoomManager.calculateAndApplyDefaultZoom(), n.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
2228
|
width: g,
|
|
2229
2229
|
height: u,
|
|
@@ -2251,11 +2251,11 @@ class Ms {
|
|
|
2251
2251
|
transformManager: s,
|
|
2252
2252
|
historyManager: o,
|
|
2253
2253
|
options: {
|
|
2254
|
-
montageAreaWidth:
|
|
2255
|
-
montageAreaHeight:
|
|
2254
|
+
montageAreaWidth: i,
|
|
2255
|
+
montageAreaHeight: n
|
|
2256
2256
|
}
|
|
2257
2257
|
} = this.editor;
|
|
2258
|
-
this.editor.zoomManager.resetZoom(), this.setResolutionWidth(
|
|
2258
|
+
this.editor.zoomManager.resetZoom(), this.setResolutionWidth(i, { withoutSave: !0 }), this.setResolutionHeight(n, { withoutSave: !0 }), e.renderAll(), s.resetObjects(), t || o.saveState(), e.fire("editor:default-scale-set");
|
|
2259
2259
|
}
|
|
2260
2260
|
/**
|
|
2261
2261
|
* Получение всех объектов внутри монтажной области редактора
|
|
@@ -2269,7 +2269,7 @@ class Ms {
|
|
|
2269
2269
|
backgroundManager: { backgroundObject: o }
|
|
2270
2270
|
} = this.editor;
|
|
2271
2271
|
return t.getObjects().filter(
|
|
2272
|
-
(
|
|
2272
|
+
(n) => n.id !== e.id && n.id !== (s == null ? void 0 : s.id) && n.id !== (o == null ? void 0 : o.id)
|
|
2273
2273
|
);
|
|
2274
2274
|
}
|
|
2275
2275
|
}
|
|
@@ -2285,13 +2285,13 @@ class bs {
|
|
|
2285
2285
|
* @fires editor:object-rotated
|
|
2286
2286
|
*/
|
|
2287
2287
|
rotate(t = fs, { withoutSave: e } = {}) {
|
|
2288
|
-
const { canvas: s, historyManager: o } = this.editor,
|
|
2289
|
-
if (!
|
|
2290
|
-
const
|
|
2291
|
-
|
|
2292
|
-
object:
|
|
2288
|
+
const { canvas: s, historyManager: o } = this.editor, i = s.getActiveObject();
|
|
2289
|
+
if (!i) return;
|
|
2290
|
+
const n = i.angle + t;
|
|
2291
|
+
i.rotate(n), i.setCoords(), s.renderAll(), e || o.saveState(), s.fire("editor:object-rotated", {
|
|
2292
|
+
object: i,
|
|
2293
2293
|
withoutSave: e,
|
|
2294
|
-
angle:
|
|
2294
|
+
angle: n
|
|
2295
2295
|
});
|
|
2296
2296
|
}
|
|
2297
2297
|
/**
|
|
@@ -2333,11 +2333,11 @@ class bs {
|
|
|
2333
2333
|
opacity: e = 1,
|
|
2334
2334
|
withoutSave: s
|
|
2335
2335
|
} = {}) {
|
|
2336
|
-
const { canvas: o, historyManager:
|
|
2337
|
-
|
|
2336
|
+
const { canvas: o, historyManager: i } = this.editor, n = t || o.getActiveObject();
|
|
2337
|
+
n && (n instanceof x ? n.getObjects().forEach((a) => {
|
|
2338
2338
|
a.set("opacity", e);
|
|
2339
|
-
}) :
|
|
2340
|
-
object:
|
|
2339
|
+
}) : n.set("opacity", e), o.renderAll(), s || i.saveState(), o.fire("editor:object-opacity-changed", {
|
|
2340
|
+
object: n,
|
|
2341
2341
|
opacity: e,
|
|
2342
2342
|
withoutSave: s
|
|
2343
2343
|
}));
|
|
@@ -2359,18 +2359,18 @@ class bs {
|
|
|
2359
2359
|
withoutSave: s,
|
|
2360
2360
|
fitAsOneObject: o
|
|
2361
2361
|
} = {}) {
|
|
2362
|
-
const { canvas:
|
|
2362
|
+
const { canvas: i, historyManager: n } = this.editor, a = t || i.getActiveObject();
|
|
2363
2363
|
if (a) {
|
|
2364
|
-
if (a instanceof
|
|
2364
|
+
if (a instanceof x && !o) {
|
|
2365
2365
|
const r = a.getObjects();
|
|
2366
|
-
|
|
2366
|
+
i.discardActiveObject(), r.forEach((h) => {
|
|
2367
2367
|
this._fitSingleObject(h, e);
|
|
2368
2368
|
});
|
|
2369
|
-
const c = new
|
|
2370
|
-
|
|
2369
|
+
const c = new x(r, { canvas: i });
|
|
2370
|
+
i.setActiveObject(c);
|
|
2371
2371
|
} else
|
|
2372
2372
|
this._fitSingleObject(a, e);
|
|
2373
|
-
|
|
2373
|
+
i.renderAll(), s || n.saveState(), i.fire("editor:object-fitted", {
|
|
2374
2374
|
object: a,
|
|
2375
2375
|
type: e,
|
|
2376
2376
|
withoutSave: s,
|
|
@@ -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:
|
|
2389
|
-
let
|
|
2390
|
-
e === "contain" ?
|
|
2391
|
-
scaleX: a *
|
|
2392
|
-
scaleY: r *
|
|
2388
|
+
const { canvas: s, montageArea: o } = this.editor, { width: i, height: n, scaleX: a = 1, scaleY: r = 1, angle: c = 0 } = t, h = i * Math.abs(a), l = n * Math.abs(r), g = c * Math.PI / 180, u = Math.abs(Math.cos(g)), f = Math.abs(Math.sin(g)), m = h * u + l * f, y = h * f + l * u, p = o.width, M = o.height;
|
|
2389
|
+
let j;
|
|
2390
|
+
e === "contain" ? j = Math.min(p / m, M / y) : j = Math.max(p / m, M / y), t.set({
|
|
2391
|
+
scaleX: a * j,
|
|
2392
|
+
scaleY: r * j
|
|
2393
2393
|
}), s.centerObject(t);
|
|
2394
2394
|
}
|
|
2395
2395
|
/**
|
|
@@ -2411,8 +2411,8 @@ class bs {
|
|
|
2411
2411
|
resetObject({ object: t, alwaysFitObject: e = !1, withoutSave: s = !1 } = {}) {
|
|
2412
2412
|
const {
|
|
2413
2413
|
canvas: o,
|
|
2414
|
-
montageArea:
|
|
2415
|
-
imageManager:
|
|
2414
|
+
montageArea: i,
|
|
2415
|
+
imageManager: n,
|
|
2416
2416
|
historyManager: a,
|
|
2417
2417
|
options: { scaleType: r }
|
|
2418
2418
|
} = this.editor, c = t || o.getActiveObject();
|
|
@@ -2426,7 +2426,7 @@ class bs {
|
|
|
2426
2426
|
}), e)
|
|
2427
2427
|
this.fitObject({ object: c, withoutSave: !0, fitAsOneObject: !0 });
|
|
2428
2428
|
else {
|
|
2429
|
-
const { width: l, height: g } =
|
|
2429
|
+
const { width: l, height: g } = i, { width: u, height: f } = c, m = n.calculateScaleFactor({
|
|
2430
2430
|
imageObject: c,
|
|
2431
2431
|
scaleType: r
|
|
2432
2432
|
});
|
|
@@ -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),
|
|
2466
|
+
const { canvas: e, montageArea: s } = this.editor, o = e.getPointer(t, !0), i = e.viewportTransform, n = 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 * n + i[4], g = r * n + i[4], u = c * n + i[5], f = h * n + i[5], m = Math.max(l, Math.min(g, o.x)), y = Math.max(u, Math.min(f, o.y));
|
|
2467
2467
|
return {
|
|
2468
2468
|
x: m,
|
|
2469
2469
|
y
|
|
@@ -2475,8 +2475,8 @@ class vs {
|
|
|
2475
2475
|
* @private
|
|
2476
2476
|
*/
|
|
2477
2477
|
_calculateFitZoom() {
|
|
2478
|
-
const { canvas: t, montageArea: e } = this.editor, s = t.getWidth(), o = t.getHeight(),
|
|
2479
|
-
return Math.max(
|
|
2478
|
+
const { canvas: t, montageArea: e } = this.editor, s = t.getWidth(), o = t.getHeight(), i = s / e.width, n = o / e.height;
|
|
2479
|
+
return Math.max(i, n);
|
|
2480
2480
|
}
|
|
2481
2481
|
/**
|
|
2482
2482
|
* Вычисляет целевую позицию viewport для центрирования монтажной области
|
|
@@ -2485,9 +2485,9 @@ class vs {
|
|
|
2485
2485
|
* @private
|
|
2486
2486
|
*/
|
|
2487
2487
|
_calculateTargetViewportPosition(t) {
|
|
2488
|
-
const { canvas: e, montageArea: s } = this.editor, o = e.getWidth(),
|
|
2488
|
+
const { canvas: e, montageArea: s } = this.editor, o = e.getWidth(), i = e.getHeight(), n = o / 2, a = i / 2, r = s.left, c = s.top;
|
|
2489
2489
|
return {
|
|
2490
|
-
x:
|
|
2490
|
+
x: n - r * t,
|
|
2491
2491
|
y: a - c * t
|
|
2492
2492
|
};
|
|
2493
2493
|
}
|
|
@@ -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,
|
|
2501
|
+
const { canvas: e, montageArea: s } = this.editor, o = e.viewportTransform, i = e.getWidth(), n = 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, g = (-o[4] + i) / t, u = -o[5] / t, f = (-o[5] + n) / t, m = l < a, y = g > r, p = u < c, M = f > h;
|
|
2502
2502
|
if (!(m || y || p || M)) return 0;
|
|
2503
|
-
const
|
|
2504
|
-
return Math.max(
|
|
2503
|
+
const T = Math.max(0, a - l), B = Math.max(0, g - r), b = Math.max(0, c - u), I = Math.max(0, f - h), _ = Math.max(T, B), R = Math.max(b, I), A = _ / i, k = R / n;
|
|
2504
|
+
return Math.max(A, k);
|
|
2505
2505
|
}
|
|
2506
2506
|
/**
|
|
2507
2507
|
* Вычисляет плавный шаг перемещения viewport к центру с ускорением
|
|
@@ -2513,12 +2513,12 @@ class vs {
|
|
|
2513
2513
|
* @returns Вычисленный шаг перемещения viewport
|
|
2514
2514
|
* @private
|
|
2515
2515
|
*/
|
|
2516
|
-
_calculateSmoothCenteringStep(t, e, s, o,
|
|
2517
|
-
const { canvas:
|
|
2516
|
+
_calculateSmoothCenteringStep(t, e, s, o, i) {
|
|
2517
|
+
const { canvas: n, montageArea: a } = this.editor, r = n.viewportTransform, c = n.getWidth(), h = n.getHeight(), l = t.x - r[4], g = t.y - r[5], u = Math.abs(o), f = e - s;
|
|
2518
2518
|
if (Math.abs(f) / u <= 0.1)
|
|
2519
2519
|
return { x: l, y: g };
|
|
2520
|
-
const y = c / 2, p = h / 2, M = a.left,
|
|
2521
|
-
return { x:
|
|
2520
|
+
const y = c / 2, p = h / 2, M = a.left, j = a.top, T = y - M * s, B = p - j * s, b = (T - r[4]) / (e - s), I = (B - r[5]) / (e - s), _ = b * u, R = I * u, A = _ * i, k = R * i, U = Math.abs(A) > Math.abs(l) ? l : A, G = Math.abs(k) > Math.abs(g) ? g : k;
|
|
2521
|
+
return { x: U, y: G };
|
|
2522
2522
|
}
|
|
2523
2523
|
/**
|
|
2524
2524
|
* Применяет плавное центрирование viewport при приближении к defaultZoom.
|
|
@@ -2530,8 +2530,8 @@ class vs {
|
|
|
2530
2530
|
* @returns true если центрирование было применено
|
|
2531
2531
|
* @private
|
|
2532
2532
|
*/
|
|
2533
|
-
_applyViewportCentering(t, e = !1, s =
|
|
2534
|
-
const { canvas: o } = this.editor,
|
|
2533
|
+
_applyViewportCentering(t, e = !1, s = Ae) {
|
|
2534
|
+
const { canvas: o } = this.editor, i = this._getScaledMontageDimensions(t), n = o.getWidth(), a = o.getHeight(), r = i.width > n || i.height > a, c = this._calculateFitZoom(), h = t - c;
|
|
2535
2535
|
if (!(!r || h) && !e)
|
|
2536
2536
|
return !1;
|
|
2537
2537
|
const g = o.viewportTransform, u = this._calculateTargetViewportPosition(t);
|
|
@@ -2554,7 +2554,7 @@ class vs {
|
|
|
2554
2554
|
* @param scale - Желаемый масштаб относительно размеров контейнера редактора.
|
|
2555
2555
|
*/
|
|
2556
2556
|
calculateAndApplyDefaultZoom(t = this.options.defaultScale) {
|
|
2557
|
-
const { canvas: e } = this.editor, s = e.editorContainer, o = s.clientWidth || e.getWidth(),
|
|
2557
|
+
const { canvas: e } = this.editor, s = e.editorContainer, o = s.clientWidth || e.getWidth(), i = s.clientHeight || e.getHeight(), { width: n, height: a } = this.editor.montageArea, r = o / n * t, c = i / a * t;
|
|
2558
2558
|
this.defaultZoom = Math.min(r, c), this.setZoom(), this.editor.panConstraintManager.updateBounds();
|
|
2559
2559
|
}
|
|
2560
2560
|
/**
|
|
@@ -2568,8 +2568,8 @@ class vs {
|
|
|
2568
2568
|
* @fires editor:zoom-changed
|
|
2569
2569
|
*/
|
|
2570
2570
|
handleMouseWheelZoom(t, e) {
|
|
2571
|
-
const { canvas: s, montageArea: o } = this.editor,
|
|
2572
|
-
if (
|
|
2571
|
+
const { canvas: s, montageArea: o } = this.editor, i = s.getZoom(), n = t < 0, a = this._getScaledMontageDimensions(i), r = s.getWidth(), c = s.getHeight(), h = a.width > r || a.height > c;
|
|
2572
|
+
if (n) {
|
|
2573
2573
|
if (!h)
|
|
2574
2574
|
this.zoom(t, {
|
|
2575
2575
|
pointX: o.left,
|
|
@@ -2605,14 +2605,14 @@ class vs {
|
|
|
2605
2605
|
* @param options.pointY - Координата Y точки зума
|
|
2606
2606
|
* @fires editor:zoom-changed
|
|
2607
2607
|
*/
|
|
2608
|
-
zoom(t =
|
|
2608
|
+
zoom(t = Ae, e = {}) {
|
|
2609
2609
|
var u, f;
|
|
2610
2610
|
if (!t) return;
|
|
2611
|
-
const { minZoom: s, maxZoom: o } = this, { canvas:
|
|
2611
|
+
const { minZoom: s, maxZoom: o } = this, { canvas: i } = this.editor, n = t < 0, a = i.getZoom(), r = i.getCenterPoint(), c = (u = e.pointX) != null ? u : r.x, h = (f = e.pointY) != null ? f : r.y, l = new dt(c, h);
|
|
2612
2612
|
this.editor.montageArea.setCoords(), this.editor.canvas.requestRenderAll();
|
|
2613
2613
|
let g = Number((a + Number(t)).toFixed(3));
|
|
2614
|
-
g > o && (g = o), g < s && (g = s),
|
|
2615
|
-
currentZoom:
|
|
2614
|
+
g > o && (g = o), g < s && (g = s), i.zoomToPoint(l, g), this.editor.panConstraintManager.updateBounds(), this._applyViewportCentering(g, n, t), i.fire("editor:zoom-changed", {
|
|
2615
|
+
currentZoom: i.getZoom(),
|
|
2616
2616
|
zoom: g,
|
|
2617
2617
|
point: l
|
|
2618
2618
|
});
|
|
@@ -2623,12 +2623,12 @@ 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,
|
|
2627
|
-
let
|
|
2628
|
-
t > s && (
|
|
2626
|
+
const { minZoom: e, maxZoom: s } = this, { canvas: o } = this.editor, i = new dt(o.getCenterPoint());
|
|
2627
|
+
let n = t;
|
|
2628
|
+
t > s && (n = s), t < e && (n = e), o.zoomToPoint(i, n), o.fire("editor:zoom-changed", {
|
|
2629
2629
|
currentZoom: o.getZoom(),
|
|
2630
|
-
zoom:
|
|
2631
|
-
point:
|
|
2630
|
+
zoom: n,
|
|
2631
|
+
point: i
|
|
2632
2632
|
}), this.editor.panConstraintManager.updateBounds();
|
|
2633
2633
|
}
|
|
2634
2634
|
/**
|
|
@@ -2643,7 +2643,7 @@ class vs {
|
|
|
2643
2643
|
}), this.editor.panConstraintManager.updateBounds();
|
|
2644
2644
|
}
|
|
2645
2645
|
}
|
|
2646
|
-
class
|
|
2646
|
+
class ws {
|
|
2647
2647
|
constructor({ editor: t }) {
|
|
2648
2648
|
this.editor = t, this.isBlocked = !1, this.overlayMask = null, this._createOverlay();
|
|
2649
2649
|
}
|
|
@@ -2673,8 +2673,8 @@ class js {
|
|
|
2673
2673
|
const { canvas: t, montageArea: e, historyManager: s } = this.editor;
|
|
2674
2674
|
if (!e || !this.overlayMask) return;
|
|
2675
2675
|
s.suspendHistory(), e.setCoords();
|
|
2676
|
-
const { left: o, top:
|
|
2677
|
-
this.overlayMask.set({ left: o, top:
|
|
2676
|
+
const { left: o, top: i, width: n, height: a } = e.getBoundingRect();
|
|
2677
|
+
this.overlayMask.set({ left: o, top: i, width: n, height: a }), t.discardActiveObject(), this.editor.layerManager.bringToFront(this.overlayMask, { withoutSave: !0 }), s.resumeHistory();
|
|
2678
2678
|
}
|
|
2679
2679
|
/**
|
|
2680
2680
|
* Выключает редактор:
|
|
@@ -2717,26 +2717,26 @@ class pt {
|
|
|
2717
2717
|
}) {
|
|
2718
2718
|
var o;
|
|
2719
2719
|
try {
|
|
2720
|
-
const { historyManager:
|
|
2721
|
-
if (
|
|
2722
|
-
if (
|
|
2723
|
-
|
|
2720
|
+
const { historyManager: i } = this.editor, { backgroundObject: n } = this;
|
|
2721
|
+
if (i.suspendHistory(), n && n.backgroundType === "color") {
|
|
2722
|
+
if (n.fill === t) {
|
|
2723
|
+
i.resumeHistory();
|
|
2724
2724
|
return;
|
|
2725
2725
|
}
|
|
2726
|
-
|
|
2726
|
+
n.set({
|
|
2727
2727
|
fill: t,
|
|
2728
|
-
backgroundId: `background-${
|
|
2728
|
+
backgroundId: `background-${F()}`
|
|
2729
2729
|
}), this.editor.canvas.requestRenderAll();
|
|
2730
2730
|
} else
|
|
2731
2731
|
this._removeCurrentBackground(), this._createColorBackground(t);
|
|
2732
|
-
(o = this.backgroundObject) == null || o.set({ customData: e }), this.editor.canvas.fire("editor:background:changed", { type: "color", color: t }),
|
|
2733
|
-
} catch (
|
|
2732
|
+
(o = this.backgroundObject) == null || o.set({ customData: e }), this.editor.canvas.fire("editor:background:changed", { type: "color", color: t }), i.resumeHistory(), s || i.saveState();
|
|
2733
|
+
} catch (i) {
|
|
2734
2734
|
this.editor.errorManager.emitError({
|
|
2735
2735
|
code: "BACKGROUND_CREATION_FAILED",
|
|
2736
2736
|
origin: "BackgroundManager",
|
|
2737
2737
|
method: "setColorBackground",
|
|
2738
2738
|
message: "Не удалось установить цветовой фон",
|
|
2739
|
-
data: { error:
|
|
2739
|
+
data: { error: i }
|
|
2740
2740
|
});
|
|
2741
2741
|
}
|
|
2742
2742
|
}
|
|
@@ -2753,30 +2753,30 @@ class pt {
|
|
|
2753
2753
|
}) {
|
|
2754
2754
|
var o;
|
|
2755
2755
|
try {
|
|
2756
|
-
const { historyManager:
|
|
2757
|
-
if (
|
|
2756
|
+
const { historyManager: i } = this.editor, { backgroundObject: n } = this;
|
|
2757
|
+
if (i.suspendHistory(), n && n.backgroundType === "gradient") {
|
|
2758
2758
|
const a = pt._createFabricGradient(t);
|
|
2759
|
-
if (pt._isGradientEqual(
|
|
2760
|
-
|
|
2759
|
+
if (pt._isGradientEqual(n.fill, a)) {
|
|
2760
|
+
i.resumeHistory();
|
|
2761
2761
|
return;
|
|
2762
2762
|
}
|
|
2763
|
-
|
|
2763
|
+
n.set({
|
|
2764
2764
|
fill: a,
|
|
2765
|
-
backgroundId: `background-${
|
|
2765
|
+
backgroundId: `background-${F()}`
|
|
2766
2766
|
}), this.editor.canvas.requestRenderAll();
|
|
2767
2767
|
} else
|
|
2768
2768
|
this._removeCurrentBackground(), this._createGradientBackground(t);
|
|
2769
2769
|
(o = this.backgroundObject) == null || o.set({ customData: e }), this.editor.canvas.fire("editor:background:changed", {
|
|
2770
2770
|
type: "gradient",
|
|
2771
2771
|
gradientParams: t
|
|
2772
|
-
}),
|
|
2773
|
-
} catch (
|
|
2772
|
+
}), i.resumeHistory(), s || i.saveState();
|
|
2773
|
+
} catch (i) {
|
|
2774
2774
|
this.editor.errorManager.emitError({
|
|
2775
2775
|
code: "BACKGROUND_CREATION_FAILED",
|
|
2776
2776
|
origin: "BackgroundManager",
|
|
2777
2777
|
method: "setGradientBackground",
|
|
2778
2778
|
message: "Не удалось установить градиентный фон",
|
|
2779
|
-
data: { error:
|
|
2779
|
+
data: { error: i }
|
|
2780
2780
|
});
|
|
2781
2781
|
}
|
|
2782
2782
|
}
|
|
@@ -2789,8 +2789,8 @@ class pt {
|
|
|
2789
2789
|
startColor: e,
|
|
2790
2790
|
endColor: s,
|
|
2791
2791
|
startPosition: o,
|
|
2792
|
-
endPosition:
|
|
2793
|
-
customData:
|
|
2792
|
+
endPosition: i,
|
|
2793
|
+
customData: n = {},
|
|
2794
2794
|
withoutSave: a = !1
|
|
2795
2795
|
}) {
|
|
2796
2796
|
this.setGradientBackground({
|
|
@@ -2800,9 +2800,9 @@ class pt {
|
|
|
2800
2800
|
startColor: e,
|
|
2801
2801
|
endColor: s,
|
|
2802
2802
|
startPosition: o,
|
|
2803
|
-
endPosition:
|
|
2803
|
+
endPosition: i
|
|
2804
2804
|
},
|
|
2805
|
-
customData:
|
|
2805
|
+
customData: n,
|
|
2806
2806
|
withoutSave: a
|
|
2807
2807
|
});
|
|
2808
2808
|
}
|
|
@@ -2815,8 +2815,8 @@ class pt {
|
|
|
2815
2815
|
centerY: e,
|
|
2816
2816
|
radius: s,
|
|
2817
2817
|
startColor: o,
|
|
2818
|
-
endColor:
|
|
2819
|
-
startPosition:
|
|
2818
|
+
endColor: i,
|
|
2819
|
+
startPosition: n,
|
|
2820
2820
|
endPosition: a,
|
|
2821
2821
|
customData: r = {},
|
|
2822
2822
|
withoutSave: c = !1
|
|
@@ -2828,8 +2828,8 @@ class pt {
|
|
|
2828
2828
|
centerY: e,
|
|
2829
2829
|
radius: s,
|
|
2830
2830
|
startColor: o,
|
|
2831
|
-
endColor:
|
|
2832
|
-
startPosition:
|
|
2831
|
+
endColor: i,
|
|
2832
|
+
startPosition: n,
|
|
2833
2833
|
endPosition: a
|
|
2834
2834
|
},
|
|
2835
2835
|
customData: r,
|
|
@@ -2843,25 +2843,25 @@ 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
|
|
2850
2850
|
}) {
|
|
2851
2851
|
try {
|
|
2852
|
-
const { historyManager:
|
|
2853
|
-
|
|
2852
|
+
const { historyManager: i } = this.editor;
|
|
2853
|
+
i.suspendHistory(), yield this._createImageBackground(t, e), this.editor.canvas.fire("editor:background:changed", {
|
|
2854
2854
|
type: "image",
|
|
2855
2855
|
imageSource: t,
|
|
2856
2856
|
backgroundObject: this.backgroundObject
|
|
2857
|
-
}),
|
|
2858
|
-
} catch (
|
|
2857
|
+
}), i.resumeHistory(), s || i.saveState();
|
|
2858
|
+
} catch (i) {
|
|
2859
2859
|
this.editor.errorManager.emitError({
|
|
2860
2860
|
code: "BACKGROUND_CREATION_FAILED",
|
|
2861
2861
|
origin: "BackgroundManager",
|
|
2862
2862
|
method: "setImageBackground",
|
|
2863
2863
|
message: "Не удалось установить изображение в качестве фона",
|
|
2864
|
-
data: { error:
|
|
2864
|
+
data: { error: i }
|
|
2865
2865
|
});
|
|
2866
2866
|
}
|
|
2867
2867
|
});
|
|
@@ -2893,8 +2893,8 @@ class pt {
|
|
|
2893
2893
|
const { canvas: t, montageArea: e, historyManager: s } = this.editor;
|
|
2894
2894
|
if (!e || !this.backgroundObject) return;
|
|
2895
2895
|
s.suspendHistory(), this.editor.transformManager.fitObject({ object: this.backgroundObject, withoutSave: !0, type: "cover" });
|
|
2896
|
-
const o = t.getObjects(),
|
|
2897
|
-
this.backgroundObject &&
|
|
2896
|
+
const o = t.getObjects(), i = o.indexOf(e), n = o.indexOf(this.backgroundObject);
|
|
2897
|
+
this.backgroundObject && n !== i + 1 && t.moveObjectTo(this.backgroundObject, i + 1), t.requestRenderAll(), s.resumeHistory();
|
|
2898
2898
|
}
|
|
2899
2899
|
/**
|
|
2900
2900
|
* Создает цветовой фон.
|
|
@@ -2909,7 +2909,7 @@ class pt {
|
|
|
2909
2909
|
hasControls: !1,
|
|
2910
2910
|
id: "background",
|
|
2911
2911
|
backgroundType: "color",
|
|
2912
|
-
backgroundId: `background-${
|
|
2912
|
+
backgroundId: `background-${F()}`
|
|
2913
2913
|
}, { withoutSelection: !0 }), this.refresh();
|
|
2914
2914
|
}
|
|
2915
2915
|
/**
|
|
@@ -2926,7 +2926,7 @@ class pt {
|
|
|
2926
2926
|
hasControls: !1,
|
|
2927
2927
|
id: "background",
|
|
2928
2928
|
backgroundType: "gradient",
|
|
2929
|
-
backgroundId: `background-${
|
|
2929
|
+
backgroundId: `background-${F()}`
|
|
2930
2930
|
}, { withoutSelection: !0 }), this.refresh();
|
|
2931
2931
|
const e = pt._createFabricGradient(t);
|
|
2932
2932
|
this.backgroundObject.set("fill", e), this.editor.canvas.requestRenderAll();
|
|
@@ -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-${F()}`,
|
|
2958
2958
|
customData: e
|
|
2959
2959
|
}), this._removeCurrentBackground(), this.backgroundObject = s, this.refresh();
|
|
2960
2960
|
});
|
|
@@ -2974,10 +2974,10 @@ class pt {
|
|
|
2974
2974
|
startColor: e,
|
|
2975
2975
|
endColor: s,
|
|
2976
2976
|
startPosition: o = 0,
|
|
2977
|
-
endPosition:
|
|
2978
|
-
} = t,
|
|
2977
|
+
endPosition: i = 100
|
|
2978
|
+
} = t, n = [
|
|
2979
2979
|
{ offset: o / 100, color: e },
|
|
2980
|
-
{ offset:
|
|
2980
|
+
{ offset: i / 100, color: s }
|
|
2981
2981
|
];
|
|
2982
2982
|
if (t.type === "linear") {
|
|
2983
2983
|
const l = t.angle * Math.PI / 180, g = pt._angleToCoords(l);
|
|
@@ -2985,7 +2985,7 @@ class pt {
|
|
|
2985
2985
|
type: "linear",
|
|
2986
2986
|
gradientUnits: "percentage",
|
|
2987
2987
|
coords: g,
|
|
2988
|
-
colorStops:
|
|
2988
|
+
colorStops: n
|
|
2989
2989
|
});
|
|
2990
2990
|
}
|
|
2991
2991
|
const {
|
|
@@ -3004,7 +3004,7 @@ class pt {
|
|
|
3004
3004
|
type: "radial",
|
|
3005
3005
|
gradientUnits: "percentage",
|
|
3006
3006
|
coords: h,
|
|
3007
|
-
colorStops:
|
|
3007
|
+
colorStops: n
|
|
3008
3008
|
});
|
|
3009
3009
|
}
|
|
3010
3010
|
/**
|
|
@@ -3029,13 +3029,13 @@ class pt {
|
|
|
3029
3029
|
static _isGradientEqual(t, e) {
|
|
3030
3030
|
if (!t || !e || t.type !== e.type) return !1;
|
|
3031
3031
|
const s = t.colorStops || [], o = e.colorStops || [];
|
|
3032
|
-
return s.length !== o.length || !s.every((
|
|
3032
|
+
return s.length !== o.length || !s.every((n, a) => {
|
|
3033
3033
|
const r = o[a];
|
|
3034
|
-
return
|
|
3034
|
+
return n.color === r.color && Math.abs(n.offset - r.offset) < 1e-4;
|
|
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 Gt {
|
|
3039
3039
|
constructor({ editor: t }) {
|
|
3040
3040
|
this.editor = t;
|
|
3041
3041
|
}
|
|
@@ -3049,11 +3049,11 @@ class Vt {
|
|
|
3049
3049
|
bringToFront(t, { withoutSave: e } = {}) {
|
|
3050
3050
|
const { canvas: s, historyManager: o } = this.editor;
|
|
3051
3051
|
o.suspendHistory();
|
|
3052
|
-
const
|
|
3053
|
-
|
|
3054
|
-
s.bringObjectToFront(
|
|
3055
|
-
}) : s.bringObjectToFront(
|
|
3056
|
-
object:
|
|
3052
|
+
const i = t || s.getActiveObject();
|
|
3053
|
+
i && (i instanceof x ? i.getObjects().forEach((n) => {
|
|
3054
|
+
s.bringObjectToFront(n);
|
|
3055
|
+
}) : s.bringObjectToFront(i), s.renderAll(), o.resumeHistory(), e || o.saveState(), s.fire("editor:object-bring-to-front", {
|
|
3056
|
+
object: i,
|
|
3057
3057
|
withoutSave: e
|
|
3058
3058
|
}));
|
|
3059
3059
|
}
|
|
@@ -3067,9 +3067,9 @@ class Vt {
|
|
|
3067
3067
|
bringForward(t, { withoutSave: e } = {}) {
|
|
3068
3068
|
const { canvas: s, historyManager: o } = this.editor;
|
|
3069
3069
|
o.suspendHistory();
|
|
3070
|
-
const
|
|
3071
|
-
|
|
3072
|
-
object:
|
|
3070
|
+
const i = t || s.getActiveObject();
|
|
3071
|
+
i && (i instanceof x ? Gt._moveSelectionForward(s, i) : s.bringObjectForward(i), s.renderAll(), o.resumeHistory(), e || o.saveState(), s.fire("editor:object-bring-forward", {
|
|
3072
|
+
object: i,
|
|
3073
3073
|
withoutSave: e
|
|
3074
3074
|
}));
|
|
3075
3075
|
}
|
|
@@ -3084,20 +3084,20 @@ class Vt {
|
|
|
3084
3084
|
const {
|
|
3085
3085
|
canvas: s,
|
|
3086
3086
|
montageArea: o,
|
|
3087
|
-
historyManager:
|
|
3088
|
-
interactionBlocker: { overlayMask:
|
|
3087
|
+
historyManager: i,
|
|
3088
|
+
interactionBlocker: { overlayMask: n },
|
|
3089
3089
|
backgroundManager: { backgroundObject: a }
|
|
3090
3090
|
} = this.editor;
|
|
3091
|
-
|
|
3091
|
+
i.suspendHistory();
|
|
3092
3092
|
const r = t || s.getActiveObject();
|
|
3093
3093
|
if (r) {
|
|
3094
|
-
if (r instanceof
|
|
3094
|
+
if (r instanceof x) {
|
|
3095
3095
|
const c = r.getObjects();
|
|
3096
3096
|
for (let h = c.length - 1; h >= 0; h -= 1)
|
|
3097
3097
|
s.sendObjectToBack(c[h]);
|
|
3098
3098
|
} else
|
|
3099
3099
|
s.sendObjectToBack(r);
|
|
3100
|
-
a && s.sendObjectToBack(a), s.sendObjectToBack(o),
|
|
3100
|
+
a && s.sendObjectToBack(a), s.sendObjectToBack(o), n && s.sendObjectToBack(n), s.renderAll(), i.resumeHistory(), e || i.saveState(), s.fire("editor:object-send-to-back", {
|
|
3101
3101
|
object: r,
|
|
3102
3102
|
withoutSave: e
|
|
3103
3103
|
});
|
|
@@ -3113,13 +3113,13 @@ class Vt {
|
|
|
3113
3113
|
const {
|
|
3114
3114
|
canvas: s,
|
|
3115
3115
|
montageArea: o,
|
|
3116
|
-
historyManager:
|
|
3117
|
-
interactionBlocker: { overlayMask:
|
|
3116
|
+
historyManager: i,
|
|
3117
|
+
interactionBlocker: { overlayMask: n },
|
|
3118
3118
|
backgroundManager: { backgroundObject: a }
|
|
3119
3119
|
} = this.editor;
|
|
3120
|
-
|
|
3120
|
+
i.suspendHistory();
|
|
3121
3121
|
const r = t || s.getActiveObject();
|
|
3122
|
-
r && (r instanceof
|
|
3122
|
+
r && (r instanceof x ? Gt._moveSelectionBackwards(s, r) : s.sendObjectBackwards(r), a && s.sendObjectToBack(a), s.sendObjectToBack(o), n && s.sendObjectToBack(n), s.renderAll(), i.resumeHistory(), e || i.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 js {
|
|
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-${F()}`,
|
|
3193
3193
|
left: e,
|
|
3194
3194
|
top: s,
|
|
3195
3195
|
width: o = 100,
|
|
3196
|
-
height:
|
|
3197
|
-
fill:
|
|
3198
|
-
} = l, a =
|
|
3196
|
+
height: i = 100,
|
|
3197
|
+
fill: n = "blue"
|
|
3198
|
+
} = l, a = nt(l, [
|
|
3199
3199
|
"id",
|
|
3200
3200
|
"left",
|
|
3201
3201
|
"top",
|
|
@@ -3203,13 +3203,13 @@ class As {
|
|
|
3203
3203
|
"height",
|
|
3204
3204
|
"fill"
|
|
3205
3205
|
]);
|
|
3206
|
-
const { canvas: g } = this.editor, u = new Be(
|
|
3206
|
+
const { canvas: g } = this.editor, u = new Be(N({
|
|
3207
3207
|
id: t,
|
|
3208
3208
|
left: e,
|
|
3209
3209
|
top: s,
|
|
3210
3210
|
width: o,
|
|
3211
|
-
height:
|
|
3212
|
-
fill:
|
|
3211
|
+
height: i,
|
|
3212
|
+
fill: n
|
|
3213
3213
|
}, a));
|
|
3214
3214
|
return !e && !s && g.centerObject(u), c || (g.add(u), r || g.setActiveObject(u), g.renderAll()), u;
|
|
3215
3215
|
}
|
|
@@ -3231,25 +3231,25 @@ 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-${F()}`,
|
|
3235
3235
|
left: e,
|
|
3236
3236
|
top: s,
|
|
3237
3237
|
radius: o = 50,
|
|
3238
|
-
fill:
|
|
3239
|
-
} = h,
|
|
3238
|
+
fill: i = "green"
|
|
3239
|
+
} = h, n = nt(h, [
|
|
3240
3240
|
"id",
|
|
3241
3241
|
"left",
|
|
3242
3242
|
"top",
|
|
3243
3243
|
"radius",
|
|
3244
3244
|
"fill"
|
|
3245
3245
|
]);
|
|
3246
|
-
const { canvas: l } = this.editor, g = new _e(
|
|
3246
|
+
const { canvas: l } = this.editor, g = new _e(N({
|
|
3247
3247
|
id: t,
|
|
3248
3248
|
left: e,
|
|
3249
3249
|
top: s,
|
|
3250
|
-
fill:
|
|
3250
|
+
fill: i,
|
|
3251
3251
|
radius: o
|
|
3252
|
-
},
|
|
3252
|
+
}, n));
|
|
3253
3253
|
return !e && !s && l.centerObject(g), r || (l.add(g), a || l.setActiveObject(g), l.renderAll()), g;
|
|
3254
3254
|
}
|
|
3255
3255
|
/**
|
|
@@ -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-${F()}`,
|
|
3275
3275
|
left: e,
|
|
3276
3276
|
top: s,
|
|
3277
3277
|
width: o = 100,
|
|
3278
|
-
height:
|
|
3279
|
-
fill:
|
|
3280
|
-
} = l, a =
|
|
3278
|
+
height: i = 100,
|
|
3279
|
+
fill: n = "yellow"
|
|
3280
|
+
} = l, a = nt(l, [
|
|
3281
3281
|
"id",
|
|
3282
3282
|
"left",
|
|
3283
3283
|
"top",
|
|
@@ -3285,18 +3285,18 @@ class As {
|
|
|
3285
3285
|
"height",
|
|
3286
3286
|
"fill"
|
|
3287
3287
|
]);
|
|
3288
|
-
const { canvas: g } = this.editor, u = new Ue(
|
|
3288
|
+
const { canvas: g } = this.editor, u = new Ue(N({
|
|
3289
3289
|
id: t,
|
|
3290
3290
|
left: e,
|
|
3291
3291
|
top: s,
|
|
3292
|
-
fill:
|
|
3292
|
+
fill: n,
|
|
3293
3293
|
width: o,
|
|
3294
|
-
height:
|
|
3294
|
+
height: i
|
|
3295
3295
|
}, a));
|
|
3296
3296
|
return !e && !s && g.centerObject(u), c || (g.add(u), r || g.setActiveObject(u), g.renderAll()), u;
|
|
3297
3297
|
}
|
|
3298
3298
|
}
|
|
3299
|
-
class
|
|
3299
|
+
class As {
|
|
3300
3300
|
/**
|
|
3301
3301
|
* @param options
|
|
3302
3302
|
* @param options.editor - экземпляр редактора с доступом к canvas
|
|
@@ -3324,7 +3324,7 @@ 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
3330
|
const o = yield t.clone(Yt);
|
|
@@ -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({
|
|
@@ -3371,12 +3371,12 @@ class Is {
|
|
|
3371
3371
|
* Копирование изображения в буфер обмена
|
|
3372
3372
|
*/
|
|
3373
3373
|
_copyImageToClipboard(t, e) {
|
|
3374
|
-
return
|
|
3374
|
+
return O(this, null, function* () {
|
|
3375
3375
|
try {
|
|
3376
|
-
const o = t.toCanvasElement({ enableRetinaScaling: !1 }).toDataURL(),
|
|
3376
|
+
const o = t.toCanvasElement({ enableRetinaScaling: !1 }).toDataURL(), i = o.slice(5).split(";")[0], n = o.split(",")[1], a = atob(n), r = new Uint8Array(a.length);
|
|
3377
3377
|
for (let l = 0; l < a.length; l += 1)
|
|
3378
3378
|
r[l] = a.charCodeAt(l);
|
|
3379
|
-
const c = new Blob([r.buffer], { type:
|
|
3379
|
+
const c = new Blob([r.buffer], { type: i }), h = new ClipboardItem({ [i]: c });
|
|
3380
3380
|
return yield navigator.clipboard.write([h]), console.info("Image copied to clipboard successfully"), !0;
|
|
3381
3381
|
} catch (s) {
|
|
3382
3382
|
return this.editor.errorManager.emitWarning({
|
|
@@ -3393,9 +3393,9 @@ class Is {
|
|
|
3393
3393
|
* Копирование текста в буфер обмена
|
|
3394
3394
|
*/
|
|
3395
3395
|
_copyTextToClipboard(t) {
|
|
3396
|
-
return
|
|
3396
|
+
return O(this, null, function* () {
|
|
3397
3397
|
try {
|
|
3398
|
-
const e = `${
|
|
3398
|
+
const e = `${Se}${t}`;
|
|
3399
3399
|
return yield navigator.clipboard.writeText(e), console.info("Text copied to clipboard successfully"), !0;
|
|
3400
3400
|
} catch (e) {
|
|
3401
3401
|
const { errorManager: s } = this.editor;
|
|
@@ -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 x) {
|
|
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,25 +3444,25 @@ 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
3451
|
const o = yield s.clone(Yt);
|
|
3452
|
-
return o instanceof
|
|
3453
|
-
|
|
3454
|
-
id: `${
|
|
3452
|
+
return o instanceof x && o.forEachObject((i) => {
|
|
3453
|
+
i.set({
|
|
3454
|
+
id: `${i.type}-${F()}`,
|
|
3455
3455
|
evented: !0
|
|
3456
3456
|
});
|
|
3457
3457
|
}), o.set({
|
|
3458
|
-
id: `${o.type}-${
|
|
3458
|
+
id: `${o.type}-${F()}`,
|
|
3459
3459
|
left: o.left + 10,
|
|
3460
3460
|
top: o.top + 10,
|
|
3461
3461
|
evented: !0
|
|
3462
3462
|
}), this._addClonedObjectToCanvas(o), e.fire("editor:object-duplicated", { object: o }), !0;
|
|
3463
3463
|
} catch (o) {
|
|
3464
|
-
const { errorManager:
|
|
3465
|
-
return
|
|
3464
|
+
const { errorManager: i } = this.editor;
|
|
3465
|
+
return i.emitError({
|
|
3466
3466
|
origin: "ClipboardManager",
|
|
3467
3467
|
method: "copyPaste",
|
|
3468
3468
|
code: "COPY_PASTE_FAILED",
|
|
@@ -3479,19 +3479,19 @@ 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();
|
|
3486
3486
|
return;
|
|
3487
3487
|
}
|
|
3488
3488
|
const s = t.getData("text/plain");
|
|
3489
|
-
if (s && s.startsWith(
|
|
3489
|
+
if (s && s.startsWith(Se)) {
|
|
3490
3490
|
this.paste();
|
|
3491
3491
|
return;
|
|
3492
3492
|
}
|
|
3493
|
-
const { items: o } = t,
|
|
3494
|
-
if (
|
|
3493
|
+
const { items: o } = t, i = o[o.length - 1], n = i.getAsFile();
|
|
3494
|
+
if (i.type !== "text/html" && n) {
|
|
3495
3495
|
const c = new FileReader();
|
|
3496
3496
|
c.onload = (h) => {
|
|
3497
3497
|
h.target && this._handleImageImport(h.target.result).catch((l) => {
|
|
@@ -3503,7 +3503,7 @@ class Is {
|
|
|
3503
3503
|
data: l
|
|
3504
3504
|
});
|
|
3505
3505
|
});
|
|
3506
|
-
}, c.readAsDataURL(
|
|
3506
|
+
}, c.readAsDataURL(n);
|
|
3507
3507
|
return;
|
|
3508
3508
|
}
|
|
3509
3509
|
const a = t.getData("text/html");
|
|
@@ -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
3537
|
const e = yield this.clipboard.clone(Yt);
|
|
3538
|
-
return t.discardActiveObject(), e instanceof
|
|
3538
|
+
return t.discardActiveObject(), e instanceof x && e.forEachObject((s) => {
|
|
3539
3539
|
s.set({
|
|
3540
|
-
id: `${s.type}-${
|
|
3540
|
+
id: `${s.type}-${F()}`,
|
|
3541
3541
|
evented: !0
|
|
3542
3542
|
});
|
|
3543
3543
|
}), e.set({
|
|
3544
|
-
id: `${e.type}-${
|
|
3544
|
+
id: `${e.type}-${F()}`,
|
|
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 Xt {
|
|
3563
3563
|
constructor({ editor: t }) {
|
|
3564
3564
|
this.editor = t;
|
|
3565
3565
|
}
|
|
@@ -3572,8 +3572,8 @@ class Gt {
|
|
|
3572
3572
|
* @fires editor:object-locked
|
|
3573
3573
|
*/
|
|
3574
3574
|
lockObject({ object: t, skipInnerObjects: e, withoutSave: s } = {}) {
|
|
3575
|
-
const { canvas: o, historyManager:
|
|
3576
|
-
if (!
|
|
3575
|
+
const { canvas: o, historyManager: i } = this.editor, n = t || o.getActiveObject();
|
|
3576
|
+
if (!n || n.locked) return;
|
|
3577
3577
|
const a = {
|
|
3578
3578
|
lockMovementX: !0,
|
|
3579
3579
|
lockMovementY: !0,
|
|
@@ -3585,10 +3585,10 @@ class Gt {
|
|
|
3585
3585
|
editable: !1,
|
|
3586
3586
|
locked: !0
|
|
3587
3587
|
};
|
|
3588
|
-
|
|
3588
|
+
n.set(a), !e && Xt._isGroupOrSelection(n) && n.getObjects().forEach((c) => {
|
|
3589
3589
|
c.set(a);
|
|
3590
|
-
}), o.renderAll(), s ||
|
|
3591
|
-
object:
|
|
3590
|
+
}), o.renderAll(), s || i.saveState(), o.fire("editor:object-locked", {
|
|
3591
|
+
object: n,
|
|
3592
3592
|
skipInnerObjects: e,
|
|
3593
3593
|
withoutSave: s
|
|
3594
3594
|
});
|
|
@@ -3601,9 +3601,9 @@ class Gt {
|
|
|
3601
3601
|
* @fires editor:object-unlocked
|
|
3602
3602
|
*/
|
|
3603
3603
|
unlockObject({ object: t, withoutSave: e } = {}) {
|
|
3604
|
-
const { canvas: s, historyManager: o } = this.editor,
|
|
3605
|
-
if (!
|
|
3606
|
-
const
|
|
3604
|
+
const { canvas: s, historyManager: o } = this.editor, i = t || s.getActiveObject();
|
|
3605
|
+
if (!i) return;
|
|
3606
|
+
const n = {
|
|
3607
3607
|
lockMovementX: !1,
|
|
3608
3608
|
lockMovementY: !1,
|
|
3609
3609
|
lockRotation: !1,
|
|
@@ -3614,18 +3614,18 @@ class Gt {
|
|
|
3614
3614
|
editable: !0,
|
|
3615
3615
|
locked: !1
|
|
3616
3616
|
};
|
|
3617
|
-
|
|
3618
|
-
a.set(
|
|
3617
|
+
i.set(n), Xt._isGroupOrSelection(i) && i.getObjects().forEach((a) => {
|
|
3618
|
+
a.set(n);
|
|
3619
3619
|
}), s.renderAll(), e || o.saveState(), s.fire("editor:object-unlocked", {
|
|
3620
|
-
object:
|
|
3620
|
+
object: i,
|
|
3621
3621
|
withoutSave: e
|
|
3622
3622
|
});
|
|
3623
3623
|
}
|
|
3624
3624
|
static _isGroupOrSelection(t) {
|
|
3625
|
-
return t instanceof
|
|
3625
|
+
return t instanceof x || t instanceof ft;
|
|
3626
3626
|
}
|
|
3627
3627
|
}
|
|
3628
|
-
class
|
|
3628
|
+
class Ss {
|
|
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 x) ? null : e.getObjects();
|
|
3641
3641
|
}
|
|
3642
3642
|
/**
|
|
3643
3643
|
* Получить группы для разгруппировки
|
|
@@ -3648,13 +3648,13 @@ class Cs {
|
|
|
3648
3648
|
const s = t.filter((o) => o instanceof ft);
|
|
3649
3649
|
return s.length > 0 ? s : null;
|
|
3650
3650
|
}
|
|
3651
|
-
if (t instanceof
|
|
3651
|
+
if (t instanceof x) {
|
|
3652
3652
|
const s = t.getObjects().filter((o) => o instanceof ft);
|
|
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
|
|
3657
|
+
if (e instanceof x) {
|
|
3658
3658
|
const s = e.getObjects().filter((o) => o instanceof ft);
|
|
3659
3659
|
return s.length > 0 ? s : null;
|
|
3660
3660
|
}
|
|
@@ -3671,16 +3671,16 @@ class Cs {
|
|
|
3671
3671
|
target: t,
|
|
3672
3672
|
withoutSave: e = !1
|
|
3673
3673
|
} = {}) {
|
|
3674
|
-
const { canvas: s, historyManager: o } = this.editor,
|
|
3675
|
-
if (!
|
|
3674
|
+
const { canvas: s, historyManager: o } = this.editor, i = this._getObjectsToGroup(t);
|
|
3675
|
+
if (!i) return null;
|
|
3676
3676
|
try {
|
|
3677
3677
|
o.suspendHistory();
|
|
3678
|
-
const
|
|
3679
|
-
id: `group-${
|
|
3678
|
+
const n = new ft(i, {
|
|
3679
|
+
id: `group-${F()}`
|
|
3680
3680
|
});
|
|
3681
|
-
|
|
3681
|
+
i.forEach((r) => s.remove(r)), s.add(n), s.setActiveObject(n), s.requestRenderAll();
|
|
3682
3682
|
const a = {
|
|
3683
|
-
group:
|
|
3683
|
+
group: n,
|
|
3684
3684
|
withoutSave: e
|
|
3685
3685
|
};
|
|
3686
3686
|
return s.fire("editor:objects-grouped", a), a;
|
|
@@ -3700,24 +3700,24 @@ class Cs {
|
|
|
3700
3700
|
target: t,
|
|
3701
3701
|
withoutSave: e = !1
|
|
3702
3702
|
} = {}) {
|
|
3703
|
-
const { canvas: s, historyManager: o } = this.editor,
|
|
3704
|
-
if (!
|
|
3703
|
+
const { canvas: s, historyManager: o } = this.editor, i = this._getGroupsToUngroup(t);
|
|
3704
|
+
if (!i) return null;
|
|
3705
3705
|
try {
|
|
3706
3706
|
o.suspendHistory();
|
|
3707
|
-
const
|
|
3708
|
-
|
|
3707
|
+
const n = [];
|
|
3708
|
+
i.forEach((c) => {
|
|
3709
3709
|
const h = c.removeAll();
|
|
3710
3710
|
s.remove(c), h.forEach((l) => {
|
|
3711
|
-
s.add(l),
|
|
3711
|
+
s.add(l), n.push(l);
|
|
3712
3712
|
});
|
|
3713
3713
|
});
|
|
3714
|
-
const a = new
|
|
3714
|
+
const a = new x(n, {
|
|
3715
3715
|
canvas: s
|
|
3716
3716
|
});
|
|
3717
3717
|
s.setActiveObject(a), s.requestRenderAll();
|
|
3718
3718
|
const r = {
|
|
3719
3719
|
selection: a,
|
|
3720
|
-
ungroupedObjects:
|
|
3720
|
+
ungroupedObjects: n,
|
|
3721
3721
|
withoutSave: e
|
|
3722
3722
|
};
|
|
3723
3723
|
return s.fire("editor:objects-ungrouped", r), r;
|
|
@@ -3726,7 +3726,7 @@ class Cs {
|
|
|
3726
3726
|
}
|
|
3727
3727
|
}
|
|
3728
3728
|
}
|
|
3729
|
-
class
|
|
3729
|
+
class Is {
|
|
3730
3730
|
constructor({ editor: t }) {
|
|
3731
3731
|
this.editor = t;
|
|
3732
3732
|
}
|
|
@@ -3737,8 +3737,8 @@ 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(),
|
|
3741
|
-
|
|
3740
|
+
const o = e.getObjects(), i = o.some((a) => a.locked), n = o.length > 1 ? new x(e.getObjects(), { canvas: t }) : o[0];
|
|
3741
|
+
i && s.lockObject({ object: n, skipInnerObjects: !0, withoutSave: !0 }), t.setActiveObject(n), t.requestRenderAll(), t.fire("editor:all-objects-selected", { selected: n });
|
|
3742
3742
|
}
|
|
3743
3743
|
}
|
|
3744
3744
|
class re {
|
|
@@ -3783,9 +3783,9 @@ class re {
|
|
|
3783
3783
|
withoutSave: e = !1,
|
|
3784
3784
|
_isRecursiveCall: s = !1
|
|
3785
3785
|
} = {}) {
|
|
3786
|
-
const { canvas: o, historyManager:
|
|
3786
|
+
const { canvas: o, historyManager: i } = this.editor, a = (t || o.getActiveObjects()).filter((h) => !h.locked);
|
|
3787
3787
|
if (!(a != null && a.length)) return null;
|
|
3788
|
-
s ||
|
|
3788
|
+
s || i.suspendHistory();
|
|
3789
3789
|
const r = [];
|
|
3790
3790
|
if (a.forEach((h) => {
|
|
3791
3791
|
if (re._isUngroupableGroup(h)) {
|
|
@@ -3795,7 +3795,7 @@ class re {
|
|
|
3795
3795
|
}
|
|
3796
3796
|
o.remove(h), r.push(h);
|
|
3797
3797
|
}), s) return null;
|
|
3798
|
-
o.discardActiveObject(), o.renderAll(),
|
|
3798
|
+
o.discardActiveObject(), o.renderAll(), i.resumeHistory(), e || i.saveState();
|
|
3799
3799
|
const c = {
|
|
3800
3800
|
objects: r,
|
|
3801
3801
|
withoutSave: e
|
|
@@ -3908,7 +3908,7 @@ const at = {
|
|
|
3908
3908
|
APPLY_FAILED: "TEMPLATE_APPLY_FAILED"
|
|
3909
3909
|
}
|
|
3910
3910
|
};
|
|
3911
|
-
class
|
|
3911
|
+
class Lt {
|
|
3912
3912
|
constructor({ editor: t }) {
|
|
3913
3913
|
this._buffer = [], this.editor = t;
|
|
3914
3914
|
}
|
|
@@ -3934,22 +3934,22 @@ class Xt {
|
|
|
3934
3934
|
* @param options.message — текст ошибки (опционально, если не передан, то используется код ошибки)
|
|
3935
3935
|
* @fires editor:error
|
|
3936
3936
|
*/
|
|
3937
|
-
emitError({ origin: t = "ImageEditor", method: e = "Unknown Method", code: s, data: o, message:
|
|
3938
|
-
if (!
|
|
3937
|
+
emitError({ origin: t = "ImageEditor", method: e = "Unknown Method", code: s, data: o, message: i }) {
|
|
3938
|
+
if (!Lt.isValidErrorCode(s)) {
|
|
3939
3939
|
console.warn("Неизвестный код ошибки: ", { code: s, origin: t, method: e });
|
|
3940
3940
|
return;
|
|
3941
3941
|
}
|
|
3942
3942
|
if (!s) return;
|
|
3943
|
-
const
|
|
3944
|
-
console.error(`${t}. ${e}. ${s}. ${
|
|
3943
|
+
const n = i || s;
|
|
3944
|
+
console.error(`${t}. ${e}. ${s}. ${n}`, o);
|
|
3945
3945
|
const a = {
|
|
3946
3946
|
code: s,
|
|
3947
3947
|
origin: t,
|
|
3948
3948
|
method: e,
|
|
3949
|
-
message:
|
|
3949
|
+
message: n,
|
|
3950
3950
|
data: o
|
|
3951
3951
|
};
|
|
3952
|
-
this._buffer.push(
|
|
3952
|
+
this._buffer.push(N({
|
|
3953
3953
|
type: "editor:error"
|
|
3954
3954
|
}, a)), this.editor.canvas.fire("editor:error", a);
|
|
3955
3955
|
}
|
|
@@ -3963,21 +3963,21 @@ class Xt {
|
|
|
3963
3963
|
* @param options.message — текст предупреждения (опционально, если не передан, то используется код предупреждения)
|
|
3964
3964
|
* @fires editor:warning
|
|
3965
3965
|
*/
|
|
3966
|
-
emitWarning({ origin: t = "ImageEditor", method: e = "Unknown Method", code: s, message: o, data:
|
|
3967
|
-
if (!
|
|
3966
|
+
emitWarning({ origin: t = "ImageEditor", method: e = "Unknown Method", code: s, message: o, data: i }) {
|
|
3967
|
+
if (!Lt.isValidErrorCode(s)) {
|
|
3968
3968
|
console.warn("Неизвестный код предупреждения: ", { code: s, origin: t, method: e });
|
|
3969
3969
|
return;
|
|
3970
3970
|
}
|
|
3971
|
-
const
|
|
3972
|
-
console.warn(`${t}. ${e}. ${s}. ${
|
|
3971
|
+
const n = o || s;
|
|
3972
|
+
console.warn(`${t}. ${e}. ${s}. ${n}`, i);
|
|
3973
3973
|
const a = {
|
|
3974
3974
|
code: s,
|
|
3975
3975
|
origin: t,
|
|
3976
3976
|
method: e,
|
|
3977
|
-
message:
|
|
3978
|
-
data:
|
|
3977
|
+
message: n,
|
|
3978
|
+
data: i
|
|
3979
3979
|
};
|
|
3980
|
-
this._buffer.push(
|
|
3980
|
+
this._buffer.push(N({
|
|
3981
3981
|
type: "editor:warning"
|
|
3982
3982
|
}, a)), this.editor.canvas.fire("editor:warning", a);
|
|
3983
3983
|
}
|
|
@@ -3990,7 +3990,7 @@ class Xt {
|
|
|
3990
3990
|
return t ? Object.values(at).some((e) => Object.values(e).includes(t)) : !1;
|
|
3991
3991
|
}
|
|
3992
3992
|
}
|
|
3993
|
-
class
|
|
3993
|
+
class Cs {
|
|
3994
3994
|
constructor({ editor: t }) {
|
|
3995
3995
|
this.currentBounds = null, this.editor = t;
|
|
3996
3996
|
}
|
|
@@ -4003,8 +4003,8 @@ class ws {
|
|
|
4003
4003
|
* @returns Объект с границами перетаскивания
|
|
4004
4004
|
*/
|
|
4005
4005
|
calculatePanBounds() {
|
|
4006
|
-
const { canvas: t, montageArea: e, zoomManager: s } = this.editor, { defaultZoom: o } = s,
|
|
4007
|
-
if (
|
|
4006
|
+
const { canvas: t, montageArea: e, zoomManager: s } = this.editor, { defaultZoom: o } = s, i = t.getZoom();
|
|
4007
|
+
if (i <= o)
|
|
4008
4008
|
return {
|
|
4009
4009
|
minX: 0,
|
|
4010
4010
|
maxX: 0,
|
|
@@ -4012,7 +4012,7 @@ class ws {
|
|
|
4012
4012
|
maxY: 0,
|
|
4013
4013
|
canPan: !1
|
|
4014
4014
|
};
|
|
4015
|
-
const
|
|
4015
|
+
const n = e.width * i, a = e.height * i, r = n / 2, c = a / 2;
|
|
4016
4016
|
return {
|
|
4017
4017
|
minX: -r,
|
|
4018
4018
|
maxX: r,
|
|
@@ -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,
|
|
4043
|
+
const { canvas: s, montageArea: o } = this.editor, i = s.getZoom(), n = o.left, a = o.top, r = s.getWidth() / 2, c = s.getHeight() / 2, h = n * i + t - r, l = a * i + e - c, g = Math.max(
|
|
4044
4044
|
this.currentBounds.minX,
|
|
4045
4045
|
Math.min(this.currentBounds.maxX, h)
|
|
4046
4046
|
), u = Math.max(
|
|
4047
4047
|
this.currentBounds.minY,
|
|
4048
4048
|
Math.min(this.currentBounds.maxY, l)
|
|
4049
|
-
), f = g + r -
|
|
4049
|
+
), f = g + r - n * i, m = u + c - a * i;
|
|
4050
4050
|
return {
|
|
4051
4051
|
x: f,
|
|
4052
4052
|
y: m
|
|
@@ -4064,7 +4064,7 @@ class ws {
|
|
|
4064
4064
|
* @returns Объект с координатами смещения
|
|
4065
4065
|
*/
|
|
4066
4066
|
getCurrentOffset() {
|
|
4067
|
-
const { canvas: t, montageArea: e } = this.editor, s = t.getZoom(), o = t.viewportTransform,
|
|
4067
|
+
const { canvas: t, montageArea: e } = this.editor, s = t.getZoom(), o = t.viewportTransform, i = e.left, n = e.top, a = t.getWidth() / 2, r = t.getHeight() / 2, c = i * s + o[4] - a, h = n * s + o[5] - r;
|
|
4068
4068
|
return { x: c, y: h };
|
|
4069
4069
|
}
|
|
4070
4070
|
/**
|
|
@@ -4075,14 +4075,10 @@ class ws {
|
|
|
4075
4075
|
this.currentBounds = this.calculatePanBounds();
|
|
4076
4076
|
}
|
|
4077
4077
|
}
|
|
4078
|
-
const
|
|
4078
|
+
const $ = ({ value: d, min: t, max: e }) => Math.min(Math.max(d, t), e), yt = class yt extends et {
|
|
4079
4079
|
constructor(t, e = {}) {
|
|
4080
|
-
var s, o,
|
|
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;
|
|
4080
|
+
var s, o, i, n, a, r, c, h, l;
|
|
4081
|
+
super(t, e), this.backgroundOpacity = (s = e.backgroundOpacity) != null ? s : 1, this.paddingTop = (o = e.paddingTop) != null ? o : 0, this.paddingRight = (i = e.paddingRight) != null ? i : 0, this.paddingBottom = (n = e.paddingBottom) != null ? n : 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
4082
|
}
|
|
4087
4083
|
_getLeftOffset() {
|
|
4088
4084
|
const { width: t } = this._getBackgroundDimensions(), { left: e } = this._getPadding();
|
|
@@ -4098,7 +4094,7 @@ const J = ({ value: d, min: t, max: e }) => Math.min(Math.max(d, t), e), yt = cl
|
|
|
4098
4094
|
}
|
|
4099
4095
|
_getTransformedDimensions(t = {}) {
|
|
4100
4096
|
const { width: e, height: s } = this._getBackgroundDimensions();
|
|
4101
|
-
return super._getTransformedDimensions(
|
|
4097
|
+
return super._getTransformedDimensions(Tt(N({}, t), {
|
|
4102
4098
|
width: e,
|
|
4103
4099
|
height: s
|
|
4104
4100
|
}));
|
|
@@ -4106,30 +4102,9 @@ const J = ({ value: d, min: t, max: e }) => Math.min(Math.max(d, t), e), yt = cl
|
|
|
4106
4102
|
_renderBackground(t) {
|
|
4107
4103
|
var s, o;
|
|
4108
4104
|
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({
|
|
4105
|
+
if (e && e) {
|
|
4106
|
+
const i = this._getPadding(), n = (s = this.width) != null ? s : 0, a = (o = this.height) != null ? o : 0, r = n + i.left + i.right, c = a + i.top + i.bottom, h = this._getCornerRadii({ width: r, height: c }), l = this._getLeftOffset() - i.left, g = this._getTopOffset() - i.top;
|
|
4107
|
+
t.save(), yt._renderRoundedRect({
|
|
4133
4108
|
ctx: t,
|
|
4134
4109
|
height: c,
|
|
4135
4110
|
left: l,
|
|
@@ -4140,21 +4115,21 @@ const J = ({ value: d, min: t, max: e }) => Math.min(Math.max(d, t), e), yt = cl
|
|
|
4140
4115
|
}
|
|
4141
4116
|
}
|
|
4142
4117
|
_getBackgroundDimensions() {
|
|
4143
|
-
var o,
|
|
4144
|
-
const t = (
|
|
4118
|
+
var o, i, n, a;
|
|
4119
|
+
const t = (i = (o = this.width) != null ? o : this.calcTextWidth()) != null ? i : 0, e = (a = (n = this.height) != null ? n : this.calcTextHeight()) != null ? a : 0, s = this._getPadding();
|
|
4145
4120
|
return {
|
|
4146
4121
|
height: e + s.top + s.bottom,
|
|
4147
4122
|
width: t + s.left + s.right
|
|
4148
4123
|
};
|
|
4149
4124
|
}
|
|
4150
4125
|
_getCornerRadii({ width: t, height: e }) {
|
|
4151
|
-
var
|
|
4152
|
-
const s = t / 2, o = e / 2,
|
|
4126
|
+
var n, a, r, c;
|
|
4127
|
+
const s = t / 2, o = e / 2, i = Math.min(s, o);
|
|
4153
4128
|
return {
|
|
4154
|
-
bottomLeft:
|
|
4155
|
-
bottomRight:
|
|
4156
|
-
topLeft:
|
|
4157
|
-
topRight:
|
|
4129
|
+
bottomLeft: $({ value: (n = this.radiusBottomLeft) != null ? n : 0, min: 0, max: i }),
|
|
4130
|
+
bottomRight: $({ value: (a = this.radiusBottomRight) != null ? a : 0, min: 0, max: i }),
|
|
4131
|
+
topLeft: $({ value: (r = this.radiusTopLeft) != null ? r : 0, min: 0, max: i }),
|
|
4132
|
+
topRight: $({ value: (c = this.radiusTopRight) != null ? c : 0, min: 0, max: i })
|
|
4158
4133
|
};
|
|
4159
4134
|
}
|
|
4160
4135
|
_getPadding() {
|
|
@@ -4170,12 +4145,18 @@ const J = ({ value: d, min: t, max: e }) => Math.min(Math.max(d, t), e), yt = cl
|
|
|
4170
4145
|
var o;
|
|
4171
4146
|
const t = this.backgroundColor;
|
|
4172
4147
|
if (!t) return null;
|
|
4173
|
-
const e =
|
|
4148
|
+
const e = $({ value: (o = this.backgroundOpacity) != null ? o : 1, min: 0, max: 1 });
|
|
4174
4149
|
let s;
|
|
4175
4150
|
try {
|
|
4176
4151
|
s = new ze(t);
|
|
4177
|
-
} catch (
|
|
4178
|
-
return
|
|
4152
|
+
} catch (i) {
|
|
4153
|
+
return Lt.emitError({
|
|
4154
|
+
origin: "BackgroundTextbox",
|
|
4155
|
+
method: "_getEffectiveBackgroundFill",
|
|
4156
|
+
code: "INVALID_COLOR_VALUE",
|
|
4157
|
+
message: `Некорректное значение цвета фона: ${t}`,
|
|
4158
|
+
data: { color: t, error: i }
|
|
4159
|
+
}), null;
|
|
4179
4160
|
}
|
|
4180
4161
|
return s.setAlpha(e), s.toRgba();
|
|
4181
4162
|
}
|
|
@@ -4184,16 +4165,16 @@ const J = ({ value: d, min: t, max: e }) => Math.min(Math.max(d, t), e), yt = cl
|
|
|
4184
4165
|
height: e,
|
|
4185
4166
|
left: s,
|
|
4186
4167
|
radii: o,
|
|
4187
|
-
top:
|
|
4188
|
-
width:
|
|
4168
|
+
top: i,
|
|
4169
|
+
width: n
|
|
4189
4170
|
}) {
|
|
4190
|
-
const a = s +
|
|
4171
|
+
const a = s + n, r = i + e, {
|
|
4191
4172
|
topLeft: c,
|
|
4192
4173
|
topRight: h,
|
|
4193
4174
|
bottomRight: l,
|
|
4194
4175
|
bottomLeft: g
|
|
4195
|
-
} = o, u =
|
|
4196
|
-
t.beginPath(), t.moveTo(s + u,
|
|
4176
|
+
} = o, u = $({ value: c, min: 0, max: n }), f = $({ value: h, min: 0, max: n }), m = $({ value: l, min: 0, max: n }), y = $({ value: g, min: 0, max: n });
|
|
4177
|
+
t.beginPath(), t.moveTo(s + u, i), t.lineTo(a - f, i), t.quadraticCurveTo(a, i, a, i + 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, i + u), t.quadraticCurveTo(s, i, s + u, i), t.closePath();
|
|
4197
4178
|
}
|
|
4198
4179
|
};
|
|
4199
4180
|
yt.type = "background-textbox", yt.cacheProperties = [
|
|
@@ -4221,11 +4202,11 @@ yt.type = "background-textbox", yt.cacheProperties = [
|
|
|
4221
4202
|
"radiusBottomRight",
|
|
4222
4203
|
"radiusBottomLeft"
|
|
4223
4204
|
];
|
|
4224
|
-
let
|
|
4225
|
-
const
|
|
4205
|
+
let Kt = yt;
|
|
4206
|
+
const Ts = () => {
|
|
4226
4207
|
var d;
|
|
4227
|
-
(d = Me) != null && d.setClass && Me.setClass(
|
|
4228
|
-
},
|
|
4208
|
+
(d = Me) != null && d.setClass && Me.setClass(Kt, "background-textbox");
|
|
4209
|
+
}, Es = ({ textbox: d }) => {
|
|
4229
4210
|
var s, o;
|
|
4230
4211
|
if (!d.isEditing) return null;
|
|
4231
4212
|
const t = (s = d.selectionStart) != null ? s : 0, e = (o = d.selectionEnd) != null ? o : t;
|
|
@@ -4237,12 +4218,12 @@ const Es = () => {
|
|
|
4237
4218
|
var e, s;
|
|
4238
4219
|
const t = (s = (e = d.text) == null ? void 0 : e.length) != null ? s : 0;
|
|
4239
4220
|
return t <= 0 ? null : { start: 0, end: t };
|
|
4240
|
-
},
|
|
4221
|
+
}, Ds = ({ textbox: d, range: t }) => {
|
|
4241
4222
|
var s, o;
|
|
4242
4223
|
if (!t) return !1;
|
|
4243
4224
|
const e = (o = (s = d.text) == null ? void 0 : s.length) != null ? o : 0;
|
|
4244
4225
|
return e <= 0 ? !1 : t.start <= 0 && t.end >= e;
|
|
4245
|
-
},
|
|
4226
|
+
}, Ce = ({
|
|
4246
4227
|
textbox: d,
|
|
4247
4228
|
styles: t,
|
|
4248
4229
|
range: e
|
|
@@ -4250,7 +4231,7 @@ const Es = () => {
|
|
|
4250
4231
|
if (!t || !Object.keys(t).length) return !1;
|
|
4251
4232
|
const { start: s, end: o } = e;
|
|
4252
4233
|
return o <= s ? !1 : (d.setSelectionStyles(t, s, o), !0);
|
|
4253
|
-
},
|
|
4234
|
+
}, Te = ({
|
|
4254
4235
|
textbox: d,
|
|
4255
4236
|
range: t,
|
|
4256
4237
|
property: e
|
|
@@ -4264,11 +4245,11 @@ const Es = () => {
|
|
|
4264
4245
|
);
|
|
4265
4246
|
if (s.length)
|
|
4266
4247
|
return (o = s[0]) == null ? void 0 : o[e];
|
|
4267
|
-
},
|
|
4248
|
+
}, Ee = ({ strokeColor: d, width: t }) => {
|
|
4268
4249
|
if (!(t <= 0))
|
|
4269
4250
|
return d != null ? d : "#000000";
|
|
4270
|
-
}, Oe = ({ width: d = 0 }) => d ? Math.max(0, d) : 0,
|
|
4271
|
-
class
|
|
4251
|
+
}, Oe = ({ width: d = 0 }) => d ? Math.max(0, d) : 0, Jt = ({ value: d }) => typeof d == "string" ? d.toLocaleUpperCase() : "", K = 0.01;
|
|
4252
|
+
class Q {
|
|
4272
4253
|
constructor({ editor: t }) {
|
|
4273
4254
|
var e;
|
|
4274
4255
|
this._handleTextEditingEntered = () => {
|
|
@@ -4276,24 +4257,24 @@ class K {
|
|
|
4276
4257
|
}, this._handleTextChanged = (s) => {
|
|
4277
4258
|
var r;
|
|
4278
4259
|
const { target: o } = s;
|
|
4279
|
-
if (!
|
|
4280
|
-
const
|
|
4281
|
-
if (
|
|
4282
|
-
const c =
|
|
4283
|
-
c !==
|
|
4260
|
+
if (!Q._isTextbox(o)) return;
|
|
4261
|
+
const i = (r = o.text) != null ? r : "", n = !!o.uppercase, a = i.toLocaleLowerCase();
|
|
4262
|
+
if (n) {
|
|
4263
|
+
const c = Jt({ value: a });
|
|
4264
|
+
c !== i && o.set({ text: c }), o.textCaseRaw = a;
|
|
4284
4265
|
return;
|
|
4285
4266
|
}
|
|
4286
|
-
o.textCaseRaw =
|
|
4267
|
+
o.textCaseRaw = i;
|
|
4287
4268
|
}, this._handleTextEditingExited = (s) => {
|
|
4288
4269
|
var a, r;
|
|
4289
4270
|
const { target: o } = s;
|
|
4290
|
-
if (!
|
|
4291
|
-
const
|
|
4271
|
+
if (!Q._isTextbox(o)) return;
|
|
4272
|
+
const i = (a = o.text) != null ? a : "";
|
|
4292
4273
|
if (!!o.uppercase) {
|
|
4293
|
-
const c = (r = o.textCaseRaw) != null ? r :
|
|
4274
|
+
const c = (r = o.textCaseRaw) != null ? r : i.toLocaleLowerCase();
|
|
4294
4275
|
o.textCaseRaw = c;
|
|
4295
4276
|
} else
|
|
4296
|
-
o.textCaseRaw =
|
|
4277
|
+
o.textCaseRaw = i;
|
|
4297
4278
|
o.locked || o.set({
|
|
4298
4279
|
lockMovementX: !1,
|
|
4299
4280
|
lockMovementY: !1
|
|
@@ -4301,82 +4282,82 @@ class K {
|
|
|
4301
4282
|
this.isTextEditingActive = !1, this.editor.historyManager.saveState();
|
|
4302
4283
|
}, ms);
|
|
4303
4284
|
}, this._handleObjectScaling = (s) => {
|
|
4304
|
-
var
|
|
4305
|
-
const { target: o, transform:
|
|
4306
|
-
if (!
|
|
4285
|
+
var St, It, Ct, W, Bt, _t, it, Ut, gt, de, le, he;
|
|
4286
|
+
const { target: o, transform: i } = s;
|
|
4287
|
+
if (!Q._isTextbox(o) || !i) return;
|
|
4307
4288
|
o.isScaling = !0;
|
|
4308
|
-
const
|
|
4289
|
+
const n = this._ensureScalingState(o), {
|
|
4309
4290
|
baseWidth: a,
|
|
4310
4291
|
baseLeft: r,
|
|
4311
4292
|
baseFontSize: c,
|
|
4312
4293
|
basePadding: h,
|
|
4313
4294
|
baseRadii: l
|
|
4314
|
-
} =
|
|
4315
|
-
if (!M && !
|
|
4316
|
-
const
|
|
4317
|
-
paddingTop:
|
|
4318
|
-
paddingRight:
|
|
4319
|
-
paddingBottom:
|
|
4320
|
-
paddingLeft:
|
|
4321
|
-
radiusTopLeft:
|
|
4322
|
-
radiusTopRight:
|
|
4323
|
-
radiusBottomRight:
|
|
4324
|
-
radiusBottomLeft:
|
|
4325
|
-
fontSize:
|
|
4295
|
+
} = n, g = typeof ((St = i.original) == null ? void 0 : St.width) == "number" ? i.original.width : void 0, u = typeof ((It = i.original) == null ? void 0 : It.left) == "number" ? i.original.left : void 0, f = g != null ? g : a, m = u != null ? u : r, y = (Ct = i.corner) != null ? Ct : "", p = (W = i.action) != null ? W : "", M = ["ml", "mr"].includes(y) || p === "scaleX", j = ["mt", "mb"].includes(y) || p === "scaleY", T = ["tl", "tr", "bl", "br"].includes(y) || p === "scale";
|
|
4296
|
+
if (!M && !j && !T) return;
|
|
4297
|
+
const B = Math.abs((_t = (Bt = o.scaleX) != null ? Bt : i.scaleX) != null ? _t : 1) || 1, b = Math.abs((Ut = (it = o.scaleY) != null ? it : i.scaleY) != null ? Ut : 1) || 1, I = Math.max(1, f * B), _ = Math.max(1, c * b), {
|
|
4298
|
+
paddingTop: R = 0,
|
|
4299
|
+
paddingRight: A = 0,
|
|
4300
|
+
paddingBottom: k = 0,
|
|
4301
|
+
paddingLeft: U = 0,
|
|
4302
|
+
radiusTopLeft: G = 0,
|
|
4303
|
+
radiusTopRight: Z = 0,
|
|
4304
|
+
radiusBottomRight: V = 0,
|
|
4305
|
+
radiusBottomLeft: X = 0,
|
|
4306
|
+
fontSize: S,
|
|
4326
4307
|
width: C,
|
|
4327
|
-
originX:
|
|
4328
|
-
} = o,
|
|
4308
|
+
originX: z = "left"
|
|
4309
|
+
} = o, P = T || j, H = T || j, L = P ? {
|
|
4329
4310
|
top: Math.max(0, h.top * b),
|
|
4330
4311
|
right: Math.max(0, h.right * b),
|
|
4331
4312
|
bottom: Math.max(0, h.bottom * b),
|
|
4332
4313
|
left: Math.max(0, h.left * b)
|
|
4333
|
-
} : h,
|
|
4314
|
+
} : h, D = H ? {
|
|
4334
4315
|
topLeft: Math.max(0, l.topLeft * b),
|
|
4335
4316
|
topRight: Math.max(0, l.topRight * b),
|
|
4336
4317
|
bottomRight: Math.max(0, l.bottomRight * b),
|
|
4337
4318
|
bottomLeft: Math.max(0, l.bottomLeft * b)
|
|
4338
|
-
} : l,
|
|
4339
|
-
if (!
|
|
4340
|
-
o.set({ scaleX: 1, scaleY: 1 }),
|
|
4319
|
+
} : l, wt = (de = (gt = i.originX) != null ? gt : z) != null ? de : "left", Rt = m + f, kt = m + f / 2, lt = C != null ? C : f, jt = Math.abs(I - lt) > K, Qt = Math.abs(_ - (S != null ? S : c)) > K, ht = Math.abs(L.top - R) > K || Math.abs(L.right - A) > K || Math.abs(L.bottom - k) > K || Math.abs(L.left - U) > K, xt = Math.abs(D.topLeft - G) > K || Math.abs(D.topRight - Z) > K || Math.abs(D.bottomRight - V) > K || Math.abs(D.bottomLeft - X) > K;
|
|
4320
|
+
if (!jt && !Qt && !ht && !xt) {
|
|
4321
|
+
o.set({ scaleX: 1, scaleY: 1 }), i.scaleX = 1, i.scaleY = 1;
|
|
4341
4322
|
return;
|
|
4342
4323
|
}
|
|
4343
4324
|
o.set({
|
|
4344
4325
|
width: I,
|
|
4345
|
-
fontSize:
|
|
4346
|
-
paddingTop:
|
|
4347
|
-
paddingRight:
|
|
4348
|
-
paddingBottom:
|
|
4349
|
-
paddingLeft:
|
|
4350
|
-
radiusTopLeft:
|
|
4351
|
-
radiusTopRight:
|
|
4352
|
-
radiusBottomRight:
|
|
4353
|
-
radiusBottomLeft:
|
|
4326
|
+
fontSize: T || j ? _ : c,
|
|
4327
|
+
paddingTop: L.top,
|
|
4328
|
+
paddingRight: L.right,
|
|
4329
|
+
paddingBottom: L.bottom,
|
|
4330
|
+
paddingLeft: L.left,
|
|
4331
|
+
radiusTopLeft: D.topLeft,
|
|
4332
|
+
radiusTopRight: D.topRight,
|
|
4333
|
+
radiusBottomRight: D.bottomRight,
|
|
4334
|
+
radiusBottomLeft: D.bottomLeft,
|
|
4354
4335
|
scaleX: 1,
|
|
4355
4336
|
scaleY: 1
|
|
4356
4337
|
});
|
|
4357
|
-
const st = (le = o.width) != null ? le : I,
|
|
4338
|
+
const st = (le = o.width) != null ? le : I, At = Math.abs(st - lt) > K;
|
|
4358
4339
|
let ot = m;
|
|
4359
|
-
|
|
4360
|
-
const { original:
|
|
4361
|
-
|
|
4362
|
-
top:
|
|
4363
|
-
right:
|
|
4364
|
-
bottom:
|
|
4365
|
-
left:
|
|
4366
|
-
},
|
|
4367
|
-
topLeft:
|
|
4368
|
-
topRight:
|
|
4369
|
-
bottomRight:
|
|
4370
|
-
bottomLeft:
|
|
4371
|
-
},
|
|
4340
|
+
At && (M || T) && (wt === "right" ? ot = Rt - st : wt === "center" && (ot = kt - st / 2)), o.set({ left: ot }), n.baseLeft = ot, i.scaleX = 1, i.scaleY = 1;
|
|
4341
|
+
const { original: J } = i;
|
|
4342
|
+
J && (J.scaleX = 1, J.scaleY = 1, J.width = st, J.height = o.height, J.left = ot), o.setCoords(), this.canvas.requestRenderAll(), n.baseWidth = st, n.baseFontSize = (he = o.fontSize) != null ? he : _, n.basePadding = {
|
|
4343
|
+
top: L.top,
|
|
4344
|
+
right: L.right,
|
|
4345
|
+
bottom: L.bottom,
|
|
4346
|
+
left: L.left
|
|
4347
|
+
}, n.baseRadii = {
|
|
4348
|
+
topLeft: D.topLeft,
|
|
4349
|
+
topRight: D.topRight,
|
|
4350
|
+
bottomRight: D.bottomRight,
|
|
4351
|
+
bottomLeft: D.bottomLeft
|
|
4352
|
+
}, n.hasWidthChange = At || Qt || ht || xt;
|
|
4372
4353
|
}, this._handleObjectModified = (s) => {
|
|
4373
4354
|
var y, p, M;
|
|
4374
4355
|
const { target: o } = s;
|
|
4375
|
-
if (!
|
|
4356
|
+
if (!Q._isTextbox(o)) return;
|
|
4376
4357
|
o.isScaling = !1;
|
|
4377
|
-
const
|
|
4378
|
-
if (this.scalingState.delete(o), !(
|
|
4379
|
-
const
|
|
4358
|
+
const i = this.scalingState.get(o);
|
|
4359
|
+
if (this.scalingState.delete(o), !(i != null && i.hasWidthChange)) return;
|
|
4360
|
+
const n = (y = o.width) != null ? y : o.calcTextWidth(), a = (M = (p = o.fontSize) != null ? p : i == null ? void 0 : i.baseFontSize) != null ? M : 16, {
|
|
4380
4361
|
paddingTop: r = 0,
|
|
4381
4362
|
paddingRight: c = 0,
|
|
4382
4363
|
paddingBottom: h = 0,
|
|
@@ -4389,7 +4370,7 @@ class K {
|
|
|
4389
4370
|
this.updateText({
|
|
4390
4371
|
target: o,
|
|
4391
4372
|
style: {
|
|
4392
|
-
width:
|
|
4373
|
+
width: n,
|
|
4393
4374
|
fontSize: a,
|
|
4394
4375
|
paddingTop: r,
|
|
4395
4376
|
paddingRight: c,
|
|
@@ -4401,21 +4382,21 @@ class K {
|
|
|
4401
4382
|
radiusBottomLeft: m
|
|
4402
4383
|
}
|
|
4403
4384
|
}), 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(),
|
|
4385
|
+
}, 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(), Ts();
|
|
4405
4386
|
}
|
|
4406
4387
|
/**
|
|
4407
4388
|
* Добавляет новый текстовый объект на канвас.
|
|
4408
4389
|
* @param options — настройки текста
|
|
4409
4390
|
* @param flags — флаги поведения
|
|
4410
4391
|
*/
|
|
4411
|
-
addText(
|
|
4412
|
-
var
|
|
4413
|
-
id: t = `text-${
|
|
4392
|
+
addText(G = {}, { withoutSelection: A = !1, withoutSave: k = !1, withoutAdding: U = !1 } = {}) {
|
|
4393
|
+
var Z = G, {
|
|
4394
|
+
id: t = `text-${F()}`,
|
|
4414
4395
|
text: e = "Новый текст",
|
|
4415
4396
|
fontFamily: s,
|
|
4416
4397
|
fontSize: o = 48,
|
|
4417
|
-
bold:
|
|
4418
|
-
italic:
|
|
4398
|
+
bold: i = !1,
|
|
4399
|
+
italic: n = !1,
|
|
4419
4400
|
underline: a = !1,
|
|
4420
4401
|
uppercase: r = !1,
|
|
4421
4402
|
strikethrough: c = !1,
|
|
@@ -4428,13 +4409,13 @@ class K {
|
|
|
4428
4409
|
backgroundOpacity: y = 1,
|
|
4429
4410
|
paddingTop: p = 0,
|
|
4430
4411
|
paddingRight: M = 0,
|
|
4431
|
-
paddingBottom:
|
|
4432
|
-
paddingLeft:
|
|
4433
|
-
radiusTopLeft:
|
|
4412
|
+
paddingBottom: j = 0,
|
|
4413
|
+
paddingLeft: T = 0,
|
|
4414
|
+
radiusTopLeft: B = 0,
|
|
4434
4415
|
radiusTopRight: b = 0,
|
|
4435
4416
|
radiusBottomRight: I = 0,
|
|
4436
|
-
radiusBottomLeft:
|
|
4437
|
-
} =
|
|
4417
|
+
radiusBottomLeft: _ = 0
|
|
4418
|
+
} = Z, R = nt(Z, [
|
|
4438
4419
|
"id",
|
|
4439
4420
|
"text",
|
|
4440
4421
|
"fontFamily",
|
|
@@ -4460,24 +4441,24 @@ class K {
|
|
|
4460
4441
|
"radiusBottomRight",
|
|
4461
4442
|
"radiusBottomLeft"
|
|
4462
4443
|
]);
|
|
4463
|
-
var
|
|
4464
|
-
const { historyManager:
|
|
4465
|
-
|
|
4466
|
-
const
|
|
4444
|
+
var L;
|
|
4445
|
+
const { historyManager: V } = this.editor, { canvas: X } = this;
|
|
4446
|
+
V.suspendHistory();
|
|
4447
|
+
const S = s != null ? s : this._getDefaultFontFamily(), C = Oe({ width: u }), z = Ee({
|
|
4467
4448
|
strokeColor: g,
|
|
4468
4449
|
width: C
|
|
4469
|
-
}),
|
|
4450
|
+
}), P = N({
|
|
4470
4451
|
id: t,
|
|
4471
|
-
fontFamily:
|
|
4452
|
+
fontFamily: S,
|
|
4472
4453
|
fontSize: o,
|
|
4473
|
-
fontWeight:
|
|
4474
|
-
fontStyle:
|
|
4454
|
+
fontWeight: i ? "bold" : "normal",
|
|
4455
|
+
fontStyle: n ? "italic" : "normal",
|
|
4475
4456
|
underline: a,
|
|
4476
4457
|
uppercase: r,
|
|
4477
4458
|
linethrough: c,
|
|
4478
4459
|
textAlign: h,
|
|
4479
4460
|
fill: l,
|
|
4480
|
-
stroke:
|
|
4461
|
+
stroke: z,
|
|
4481
4462
|
strokeWidth: C,
|
|
4482
4463
|
strokeUniform: !0,
|
|
4483
4464
|
opacity: f,
|
|
@@ -4485,35 +4466,35 @@ class K {
|
|
|
4485
4466
|
backgroundOpacity: y,
|
|
4486
4467
|
paddingTop: p,
|
|
4487
4468
|
paddingRight: M,
|
|
4488
|
-
paddingBottom:
|
|
4489
|
-
paddingLeft:
|
|
4490
|
-
radiusTopLeft:
|
|
4469
|
+
paddingBottom: j,
|
|
4470
|
+
paddingLeft: T,
|
|
4471
|
+
radiusTopLeft: B,
|
|
4491
4472
|
radiusTopRight: b,
|
|
4492
4473
|
radiusBottomRight: I,
|
|
4493
|
-
radiusBottomLeft:
|
|
4494
|
-
},
|
|
4495
|
-
if (
|
|
4496
|
-
const
|
|
4497
|
-
|
|
4498
|
-
}
|
|
4499
|
-
return
|
|
4500
|
-
textbox:
|
|
4501
|
-
options:
|
|
4474
|
+
radiusBottomLeft: _
|
|
4475
|
+
}, R), H = new Kt(e, P);
|
|
4476
|
+
if (H.textCaseRaw = (L = H.text) != null ? L : "", r) {
|
|
4477
|
+
const D = Jt({ value: H.textCaseRaw });
|
|
4478
|
+
D !== H.text && H.set({ text: D });
|
|
4479
|
+
}
|
|
4480
|
+
return R.left === void 0 && R.top === void 0 && X.centerObject(H), U || X.add(H), A || X.setActiveObject(H), X.requestRenderAll(), V.resumeHistory(), k || V.saveState(), X.fire("editor:text-added", {
|
|
4481
|
+
textbox: H,
|
|
4482
|
+
options: Tt(N({}, P), {
|
|
4502
4483
|
text: e,
|
|
4503
|
-
bold:
|
|
4504
|
-
italic:
|
|
4484
|
+
bold: i,
|
|
4485
|
+
italic: n,
|
|
4505
4486
|
strikethrough: c,
|
|
4506
4487
|
align: h,
|
|
4507
4488
|
color: l,
|
|
4508
|
-
strokeColor:
|
|
4489
|
+
strokeColor: z,
|
|
4509
4490
|
strokeWidth: C
|
|
4510
4491
|
}),
|
|
4511
4492
|
flags: {
|
|
4512
|
-
withoutSelection: !!
|
|
4513
|
-
withoutSave: !!
|
|
4514
|
-
withoutAdding: !!
|
|
4493
|
+
withoutSelection: !!A,
|
|
4494
|
+
withoutSave: !!k,
|
|
4495
|
+
withoutAdding: !!U
|
|
4515
4496
|
}
|
|
4516
|
-
}),
|
|
4497
|
+
}), H;
|
|
4517
4498
|
}
|
|
4518
4499
|
/**
|
|
4519
4500
|
* Обновляет текстовый объект.
|
|
@@ -4524,12 +4505,12 @@ class K {
|
|
|
4524
4505
|
* @param options.skipRender — не вызывать перерисовку канваса
|
|
4525
4506
|
*/
|
|
4526
4507
|
updateText({ target: t, style: e = {}, withoutSave: s, skipRender: o } = {}) {
|
|
4527
|
-
var
|
|
4528
|
-
const
|
|
4529
|
-
if (!
|
|
4530
|
-
const { historyManager:
|
|
4531
|
-
|
|
4532
|
-
const r =
|
|
4508
|
+
var At, ot, J, St, It, Ct;
|
|
4509
|
+
const i = this._resolveTextObject(t);
|
|
4510
|
+
if (!i) return null;
|
|
4511
|
+
const { historyManager: n } = this.editor, { canvas: a } = this;
|
|
4512
|
+
n.suspendHistory();
|
|
4513
|
+
const r = Q._getSnapshot(i), st = e, {
|
|
4533
4514
|
text: c,
|
|
4534
4515
|
fontFamily: h,
|
|
4535
4516
|
fontSize: l,
|
|
@@ -4540,20 +4521,20 @@ class K {
|
|
|
4540
4521
|
strikethrough: y,
|
|
4541
4522
|
align: p,
|
|
4542
4523
|
color: M,
|
|
4543
|
-
strokeColor:
|
|
4544
|
-
strokeWidth:
|
|
4545
|
-
opacity:
|
|
4524
|
+
strokeColor: j,
|
|
4525
|
+
strokeWidth: T,
|
|
4526
|
+
opacity: B,
|
|
4546
4527
|
backgroundColor: b,
|
|
4547
4528
|
backgroundOpacity: I,
|
|
4548
|
-
paddingTop:
|
|
4549
|
-
paddingRight:
|
|
4550
|
-
paddingBottom:
|
|
4551
|
-
paddingLeft:
|
|
4552
|
-
radiusTopLeft:
|
|
4553
|
-
radiusTopRight:
|
|
4554
|
-
radiusBottomRight:
|
|
4555
|
-
radiusBottomLeft:
|
|
4556
|
-
} = st,
|
|
4529
|
+
paddingTop: _,
|
|
4530
|
+
paddingRight: R,
|
|
4531
|
+
paddingBottom: A,
|
|
4532
|
+
paddingLeft: k,
|
|
4533
|
+
radiusTopLeft: U,
|
|
4534
|
+
radiusTopRight: G,
|
|
4535
|
+
radiusBottomRight: Z,
|
|
4536
|
+
radiusBottomLeft: V
|
|
4537
|
+
} = st, X = nt(st, [
|
|
4557
4538
|
"text",
|
|
4558
4539
|
"fontFamily",
|
|
4559
4540
|
"fontSize",
|
|
@@ -4577,52 +4558,52 @@ class K {
|
|
|
4577
4558
|
"radiusTopRight",
|
|
4578
4559
|
"radiusBottomRight",
|
|
4579
4560
|
"radiusBottomLeft"
|
|
4580
|
-
]),
|
|
4581
|
-
if (h !== void 0 && (C && (
|
|
4582
|
-
const
|
|
4583
|
-
C && (
|
|
4561
|
+
]), S = N({}, X), C = Es({ textbox: i }), z = {}, P = {}, H = Ds({ textbox: i, range: C }), L = !C || H, D = !C;
|
|
4562
|
+
if (h !== void 0 && (C && (z.fontFamily = h), L && (S.fontFamily = h, D && (P.fontFamily = h))), l !== void 0 && (S.fontSize = l), g !== void 0) {
|
|
4563
|
+
const W = g ? "bold" : "normal";
|
|
4564
|
+
C && (z.fontWeight = W), L && (S.fontWeight = W, D && (P.fontWeight = W));
|
|
4584
4565
|
}
|
|
4585
4566
|
if (u !== void 0) {
|
|
4586
|
-
const
|
|
4587
|
-
C && (
|
|
4567
|
+
const W = u ? "italic" : "normal";
|
|
4568
|
+
C && (z.fontStyle = W), L && (S.fontStyle = W, D && (P.fontStyle = W));
|
|
4588
4569
|
}
|
|
4589
|
-
if (f !== void 0 && (C && (
|
|
4590
|
-
const
|
|
4591
|
-
strokeColor:
|
|
4592
|
-
width:
|
|
4570
|
+
if (f !== void 0 && (C && (z.underline = f), L && (S.underline = f, D && (P.underline = f))), y !== void 0 && (C && (z.linethrough = y), L && (S.linethrough = y, D && (P.linethrough = y))), p !== void 0 && (S.textAlign = p), M !== void 0 && (C && (z.fill = M), L && (S.fill = M, D && (P.fill = M))), j !== void 0 || T !== void 0) {
|
|
4571
|
+
const W = C ? Te({ textbox: i, range: C, property: "strokeWidth" }) : void 0, Bt = C ? Te({ textbox: i, range: C, property: "stroke" }) : void 0, _t = (ot = (At = T != null ? T : W) != null ? At : i.strokeWidth) != null ? ot : 0, it = Oe({ width: _t }), Ut = (St = (J = j != null ? j : Bt) != null ? J : i.stroke) != null ? St : void 0, gt = Ee({
|
|
4572
|
+
strokeColor: Ut,
|
|
4573
|
+
width: it
|
|
4593
4574
|
});
|
|
4594
|
-
C && (
|
|
4595
|
-
}
|
|
4596
|
-
|
|
4597
|
-
const
|
|
4598
|
-
if (kt ||
|
|
4599
|
-
const
|
|
4600
|
-
|
|
4601
|
-
} else
|
|
4602
|
-
|
|
4575
|
+
C && (z.stroke = gt, z.strokeWidth = it), L && (S.stroke = gt, S.strokeWidth = it, D && (P.stroke = gt, P.strokeWidth = it));
|
|
4576
|
+
}
|
|
4577
|
+
B !== void 0 && (S.opacity = B), b !== void 0 && (S.backgroundColor = b), I !== void 0 && (S.backgroundOpacity = I), _ !== void 0 && (S.paddingTop = _), R !== void 0 && (S.paddingRight = R), A !== void 0 && (S.paddingBottom = A), k !== void 0 && (S.paddingLeft = k), U !== void 0 && (S.radiusTopLeft = U), G !== void 0 && (S.radiusTopRight = G), Z !== void 0 && (S.radiusBottomRight = Z), V !== void 0 && (S.radiusBottomLeft = V);
|
|
4578
|
+
const wt = (Ct = i.textCaseRaw) != null ? Ct : (It = i.text) != null ? It : "", Rt = !!i.uppercase, kt = c !== void 0, lt = kt ? c != null ? c : "" : wt, jt = m != null ? m : Rt;
|
|
4579
|
+
if (kt || jt !== Rt) {
|
|
4580
|
+
const W = jt ? Jt({ value: lt }) : lt;
|
|
4581
|
+
S.text = W, i.textCaseRaw = lt;
|
|
4582
|
+
} else i.textCaseRaw === void 0 && (i.textCaseRaw = wt);
|
|
4583
|
+
i.uppercase = jt, i.set(S);
|
|
4603
4584
|
let ht = !1;
|
|
4604
4585
|
if (C)
|
|
4605
|
-
ht =
|
|
4606
|
-
else if (Object.keys(
|
|
4607
|
-
const
|
|
4608
|
-
|
|
4586
|
+
ht = Ce({ textbox: i, styles: z, range: C });
|
|
4587
|
+
else if (Object.keys(P).length) {
|
|
4588
|
+
const W = Os({ textbox: i });
|
|
4589
|
+
W && (ht = Ce({ textbox: i, styles: P, range: W }));
|
|
4609
4590
|
}
|
|
4610
|
-
ht && (
|
|
4611
|
-
const xt =
|
|
4591
|
+
ht && (i.dirty = !0), (b !== void 0 || I !== void 0 || _ !== void 0 || R !== void 0 || A !== void 0 || k !== void 0 || U !== void 0 || G !== void 0 || Z !== void 0 || V !== void 0) && (i.dirty = !0), i.setCoords(), o || a.requestRenderAll(), n.resumeHistory(), s || n.saveState();
|
|
4592
|
+
const xt = Q._getSnapshot(i);
|
|
4612
4593
|
return a.fire("editor:text-updated", {
|
|
4613
|
-
textbox:
|
|
4594
|
+
textbox: i,
|
|
4614
4595
|
target: t,
|
|
4615
4596
|
style: e,
|
|
4616
4597
|
options: {
|
|
4617
4598
|
withoutSave: !!s,
|
|
4618
4599
|
skipRender: !!o
|
|
4619
4600
|
},
|
|
4620
|
-
updates:
|
|
4601
|
+
updates: S,
|
|
4621
4602
|
before: r,
|
|
4622
4603
|
after: xt,
|
|
4623
4604
|
selectionRange: C != null ? C : void 0,
|
|
4624
|
-
selectionStyles: C && Object.keys(
|
|
4625
|
-
}),
|
|
4605
|
+
selectionStyles: C && Object.keys(z).length ? z : void 0
|
|
4606
|
+
}), i;
|
|
4626
4607
|
}
|
|
4627
4608
|
/**
|
|
4628
4609
|
* Уничтожает менеджер и снимает слушатели.
|
|
@@ -4639,10 +4620,10 @@ class K {
|
|
|
4639
4620
|
const { canvas: e } = this;
|
|
4640
4621
|
if (!t) {
|
|
4641
4622
|
const s = e.getActiveObject();
|
|
4642
|
-
return
|
|
4623
|
+
return Q._isTextbox(s) ? s : null;
|
|
4643
4624
|
}
|
|
4644
4625
|
if (typeof t == "string") {
|
|
4645
|
-
const s = e.getObjects().find((o) =>
|
|
4626
|
+
const s = e.getObjects().find((o) => Q._isTextbox(o) && o.id === t);
|
|
4646
4627
|
return s != null ? s : null;
|
|
4647
4628
|
}
|
|
4648
4629
|
return null;
|
|
@@ -4664,10 +4645,10 @@ class K {
|
|
|
4664
4645
|
* Создаёт или возвращает сохранённое состояние для текущего цикла масштабирования текста.
|
|
4665
4646
|
*/
|
|
4666
4647
|
_ensureScalingState(t) {
|
|
4667
|
-
var s, o,
|
|
4648
|
+
var s, o, i;
|
|
4668
4649
|
let e = this.scalingState.get(t);
|
|
4669
4650
|
if (!e) {
|
|
4670
|
-
const
|
|
4651
|
+
const n = (s = t.width) != null ? s : t.calcTextWidth(), a = (o = t.left) != null ? o : 0, r = (i = t.fontSize) != null ? i : 16, {
|
|
4671
4652
|
paddingTop: c = 0,
|
|
4672
4653
|
paddingRight: h = 0,
|
|
4673
4654
|
paddingBottom: l = 0,
|
|
@@ -4679,7 +4660,7 @@ class K {
|
|
|
4679
4660
|
radiusBottomLeft: y = 0
|
|
4680
4661
|
} = t;
|
|
4681
4662
|
e = {
|
|
4682
|
-
baseWidth:
|
|
4663
|
+
baseWidth: n,
|
|
4683
4664
|
baseFontSize: r,
|
|
4684
4665
|
baseLeft: a,
|
|
4685
4666
|
basePadding: {
|
|
@@ -4704,17 +4685,17 @@ class K {
|
|
|
4704
4685
|
*/
|
|
4705
4686
|
static _getSnapshot(t) {
|
|
4706
4687
|
const e = ({
|
|
4707
|
-
snapshot:
|
|
4708
|
-
entries:
|
|
4688
|
+
snapshot: P,
|
|
4689
|
+
entries: H
|
|
4709
4690
|
}) => {
|
|
4710
|
-
Object.entries(
|
|
4711
|
-
|
|
4691
|
+
Object.entries(H).forEach(([L, D]) => {
|
|
4692
|
+
D != null && (P[L] = D);
|
|
4712
4693
|
});
|
|
4713
4694
|
}, {
|
|
4714
4695
|
id: s,
|
|
4715
4696
|
text: o,
|
|
4716
|
-
textCaseRaw:
|
|
4717
|
-
uppercase:
|
|
4697
|
+
textCaseRaw: i,
|
|
4698
|
+
uppercase: n,
|
|
4718
4699
|
fontFamily: a,
|
|
4719
4700
|
fontSize: r,
|
|
4720
4701
|
fontWeight: c,
|
|
@@ -4727,32 +4708,32 @@ class K {
|
|
|
4727
4708
|
strokeWidth: y,
|
|
4728
4709
|
opacity: p,
|
|
4729
4710
|
backgroundColor: M,
|
|
4730
|
-
backgroundOpacity:
|
|
4731
|
-
paddingTop:
|
|
4732
|
-
paddingRight:
|
|
4711
|
+
backgroundOpacity: j,
|
|
4712
|
+
paddingTop: T,
|
|
4713
|
+
paddingRight: B,
|
|
4733
4714
|
paddingBottom: b,
|
|
4734
4715
|
paddingLeft: I,
|
|
4735
|
-
radiusTopLeft:
|
|
4736
|
-
radiusTopRight:
|
|
4737
|
-
radiusBottomRight:
|
|
4738
|
-
radiusBottomLeft:
|
|
4739
|
-
left:
|
|
4740
|
-
top:
|
|
4741
|
-
width:
|
|
4742
|
-
height:
|
|
4743
|
-
angle:
|
|
4744
|
-
scaleX:
|
|
4716
|
+
radiusTopLeft: _,
|
|
4717
|
+
radiusTopRight: R,
|
|
4718
|
+
radiusBottomRight: A,
|
|
4719
|
+
radiusBottomLeft: k,
|
|
4720
|
+
left: U,
|
|
4721
|
+
top: G,
|
|
4722
|
+
width: Z,
|
|
4723
|
+
height: V,
|
|
4724
|
+
angle: X,
|
|
4725
|
+
scaleX: S,
|
|
4745
4726
|
scaleY: C
|
|
4746
|
-
} = t,
|
|
4727
|
+
} = t, z = {
|
|
4747
4728
|
id: s,
|
|
4748
|
-
uppercase: !!
|
|
4729
|
+
uppercase: !!n,
|
|
4749
4730
|
textAlign: u
|
|
4750
4731
|
};
|
|
4751
4732
|
return e({
|
|
4752
|
-
snapshot:
|
|
4733
|
+
snapshot: z,
|
|
4753
4734
|
entries: {
|
|
4754
4735
|
text: o,
|
|
4755
|
-
textCaseRaw:
|
|
4736
|
+
textCaseRaw: i,
|
|
4756
4737
|
fontFamily: a,
|
|
4757
4738
|
fontSize: r,
|
|
4758
4739
|
fontWeight: c,
|
|
@@ -4764,24 +4745,24 @@ class K {
|
|
|
4764
4745
|
strokeWidth: y,
|
|
4765
4746
|
opacity: p,
|
|
4766
4747
|
backgroundColor: M,
|
|
4767
|
-
backgroundOpacity:
|
|
4768
|
-
paddingTop:
|
|
4769
|
-
paddingRight:
|
|
4748
|
+
backgroundOpacity: j,
|
|
4749
|
+
paddingTop: T,
|
|
4750
|
+
paddingRight: B,
|
|
4770
4751
|
paddingBottom: b,
|
|
4771
4752
|
paddingLeft: I,
|
|
4772
|
-
radiusTopLeft:
|
|
4773
|
-
radiusTopRight:
|
|
4774
|
-
radiusBottomRight:
|
|
4775
|
-
radiusBottomLeft:
|
|
4776
|
-
left:
|
|
4777
|
-
top:
|
|
4778
|
-
width:
|
|
4779
|
-
height:
|
|
4780
|
-
angle:
|
|
4781
|
-
scaleX:
|
|
4753
|
+
radiusTopLeft: _,
|
|
4754
|
+
radiusTopRight: R,
|
|
4755
|
+
radiusBottomRight: A,
|
|
4756
|
+
radiusBottomLeft: k,
|
|
4757
|
+
left: U,
|
|
4758
|
+
top: G,
|
|
4759
|
+
width: Z,
|
|
4760
|
+
height: V,
|
|
4761
|
+
angle: X,
|
|
4762
|
+
scaleX: S,
|
|
4782
4763
|
scaleY: C
|
|
4783
4764
|
}
|
|
4784
|
-
}),
|
|
4765
|
+
}), z;
|
|
4785
4766
|
}
|
|
4786
4767
|
/**
|
|
4787
4768
|
* Возвращает первый доступный шрифт или дефолтный Arial.
|
|
@@ -4791,7 +4772,7 @@ class K {
|
|
|
4791
4772
|
return (e = (t = this.fonts[0]) == null ? void 0 : t.family) != null ? e : "Arial";
|
|
4792
4773
|
}
|
|
4793
4774
|
}
|
|
4794
|
-
const
|
|
4775
|
+
const Nt = ({
|
|
4795
4776
|
value: d,
|
|
4796
4777
|
fallback: t = 0
|
|
4797
4778
|
}) => typeof d == "number" && Number.isFinite(d) ? d : typeof t == "number" && Number.isFinite(t) ? t : 0, Pt = ({
|
|
@@ -4799,25 +4780,25 @@ const Dt = ({
|
|
|
4799
4780
|
dimension: t,
|
|
4800
4781
|
useRelativePositions: e
|
|
4801
4782
|
}) => {
|
|
4802
|
-
const s =
|
|
4783
|
+
const s = Nt({ value: d });
|
|
4803
4784
|
return e ? s : s / (t || 1);
|
|
4804
|
-
},
|
|
4785
|
+
}, Ls = ({
|
|
4805
4786
|
object: d,
|
|
4806
4787
|
baseWidth: t,
|
|
4807
4788
|
baseHeight: e,
|
|
4808
4789
|
useRelativePositions: s,
|
|
4809
4790
|
centerKeys: o
|
|
4810
4791
|
}) => {
|
|
4811
|
-
const
|
|
4812
|
-
if (typeof
|
|
4792
|
+
const i = d;
|
|
4793
|
+
if (typeof i[o.x] == "number" && typeof i[o.y] == "number")
|
|
4813
4794
|
return {
|
|
4814
4795
|
x: Pt({
|
|
4815
|
-
value:
|
|
4796
|
+
value: i[o.x],
|
|
4816
4797
|
dimension: t,
|
|
4817
4798
|
useRelativePositions: s
|
|
4818
4799
|
}),
|
|
4819
4800
|
y: Pt({
|
|
4820
|
-
value:
|
|
4801
|
+
value: i[o.y],
|
|
4821
4802
|
dimension: e,
|
|
4822
4803
|
useRelativePositions: s
|
|
4823
4804
|
})
|
|
@@ -4830,7 +4811,7 @@ const Dt = ({
|
|
|
4830
4811
|
value: r,
|
|
4831
4812
|
dimension: e,
|
|
4832
4813
|
useRelativePositions: s
|
|
4833
|
-
}), u =
|
|
4814
|
+
}), u = Nt({ value: c }) / (t || 1), f = Nt({ value: h }) / (e || 1);
|
|
4834
4815
|
return {
|
|
4835
4816
|
x: l + u / 2,
|
|
4836
4817
|
y: g + f / 2
|
|
@@ -4842,21 +4823,21 @@ const Dt = ({
|
|
|
4842
4823
|
targetSize: s,
|
|
4843
4824
|
montageArea: o
|
|
4844
4825
|
}) => {
|
|
4845
|
-
const { left:
|
|
4826
|
+
const { left: i, top: n, width: a, height: r } = e;
|
|
4846
4827
|
if (!o) {
|
|
4847
|
-
const { width: l, height: g } = s, u =
|
|
4828
|
+
const { width: l, height: g } = s, u = i + d * (l || a), f = n + t * (g || r);
|
|
4848
4829
|
return new dt(u, f);
|
|
4849
4830
|
}
|
|
4850
|
-
const c =
|
|
4831
|
+
const c = i + d * a, h = n + t * r;
|
|
4851
4832
|
return new dt(c, h);
|
|
4852
|
-
},
|
|
4833
|
+
}, Rs = ({
|
|
4853
4834
|
object: d,
|
|
4854
4835
|
montageArea: t,
|
|
4855
4836
|
bounds: e
|
|
4856
4837
|
}) => {
|
|
4857
4838
|
if (!t || !e) return null;
|
|
4858
4839
|
try {
|
|
4859
|
-
const s = d.getCenterPoint(), { left: o, top:
|
|
4840
|
+
const s = d.getCenterPoint(), { left: o, top: i, width: n, height: a } = e, r = s.x - o, c = s.y - i, h = r / n, l = c / a;
|
|
4860
4841
|
return {
|
|
4861
4842
|
x: h,
|
|
4862
4843
|
y: l
|
|
@@ -4864,21 +4845,21 @@ const Dt = ({
|
|
|
4864
4845
|
} catch (s) {
|
|
4865
4846
|
return null;
|
|
4866
4847
|
}
|
|
4867
|
-
},
|
|
4848
|
+
}, ks = ({
|
|
4868
4849
|
x1: d,
|
|
4869
4850
|
y1: t,
|
|
4870
4851
|
x2: e,
|
|
4871
4852
|
y2: s
|
|
4872
|
-
}) => (Math.atan2(s - t, e - d) * 180 / Math.PI + 360) % 360,
|
|
4853
|
+
}) => (Math.atan2(s - t, e - d) * 180 / Math.PI + 360) % 360, xs = (d) => {
|
|
4873
4854
|
if (!d || typeof d != "object") return null;
|
|
4874
|
-
const { type: t, coords: e, colorStops: s } = d, o = Array.isArray(s) ? s : [],
|
|
4855
|
+
const { type: t, coords: e, colorStops: s } = d, o = Array.isArray(s) ? s : [], i = o[0], n = o[o.length - 1], a = typeof (i == null ? void 0 : i.color) == "string" ? i.color : void 0, r = typeof (n == null ? void 0 : n.color) == "string" ? n.color : a, c = typeof (i == null ? void 0 : i.offset) == "number" ? i.offset * 100 : void 0, h = typeof (n == null ? void 0 : n.offset) == "number" ? n.offset * 100 : void 0;
|
|
4875
4856
|
if (!a || !r || !e) return null;
|
|
4876
4857
|
if (t === "linear") {
|
|
4877
4858
|
const { x1: l, y1: g, x2: u, y2: f } = e;
|
|
4878
4859
|
if (typeof l == "number" && typeof g == "number" && typeof u == "number" && typeof f == "number")
|
|
4879
4860
|
return {
|
|
4880
4861
|
type: "linear",
|
|
4881
|
-
angle:
|
|
4862
|
+
angle: ks({ x1: l, y1: g, x2: u, y2: f }),
|
|
4882
4863
|
startColor: a,
|
|
4883
4864
|
endColor: r,
|
|
4884
4865
|
startPosition: c,
|
|
@@ -4900,8 +4881,8 @@ const Dt = ({
|
|
|
4900
4881
|
};
|
|
4901
4882
|
}
|
|
4902
4883
|
return null;
|
|
4903
|
-
},
|
|
4904
|
-
class
|
|
4884
|
+
}, Wt = "_templateCenterX", Ht = "_templateCenterY";
|
|
4885
|
+
class Y {
|
|
4905
4886
|
constructor({ editor: t }) {
|
|
4906
4887
|
this.editor = t;
|
|
4907
4888
|
}
|
|
@@ -4916,11 +4897,11 @@ class z {
|
|
|
4916
4897
|
withBackground: o = !1
|
|
4917
4898
|
} = {}) {
|
|
4918
4899
|
const {
|
|
4919
|
-
canvas:
|
|
4920
|
-
montageArea:
|
|
4900
|
+
canvas: i,
|
|
4901
|
+
montageArea: n,
|
|
4921
4902
|
errorManager: a,
|
|
4922
4903
|
backgroundManager: r
|
|
4923
|
-
} = this.editor, c =
|
|
4904
|
+
} = this.editor, c = i.getActiveObject(), h = Y._collectObjects(c), { backgroundObject: l } = r != null ? r : {}, g = o && l ? [l] : [], u = [...h, ...g];
|
|
4924
4905
|
if (!u.length)
|
|
4925
4906
|
return a.emitWarning({
|
|
4926
4907
|
origin: "TemplateManager",
|
|
@@ -4928,21 +4909,21 @@ class z {
|
|
|
4928
4909
|
code: at.TEMPLATE_MANAGER.NO_OBJECTS_SELECTED,
|
|
4929
4910
|
message: "Нет объектов для сериализации шаблона"
|
|
4930
4911
|
}), null;
|
|
4931
|
-
const f =
|
|
4932
|
-
object:
|
|
4912
|
+
const f = Y._getBounds(n), m = Y._getMontageSize({ montageArea: n, bounds: f }), y = m.width, p = m.height, M = u.map((B) => Y._serializeObject({
|
|
4913
|
+
object: B,
|
|
4933
4914
|
bounds: f,
|
|
4934
4915
|
baseWidth: y,
|
|
4935
4916
|
baseHeight: p,
|
|
4936
|
-
montageArea:
|
|
4937
|
-
})),
|
|
4917
|
+
montageArea: n != null ? n : null
|
|
4918
|
+
})), j = Tt(N({}, s), {
|
|
4938
4919
|
baseWidth: y,
|
|
4939
4920
|
baseHeight: p,
|
|
4940
4921
|
positionsNormalized: !0,
|
|
4941
4922
|
previewId: e != null ? e : s.previewId
|
|
4942
4923
|
});
|
|
4943
4924
|
return {
|
|
4944
|
-
id: t != null ? t : `template-${
|
|
4945
|
-
meta:
|
|
4925
|
+
id: t != null ? t : `template-${F()}`,
|
|
4926
|
+
meta: j,
|
|
4946
4927
|
objects: M
|
|
4947
4928
|
};
|
|
4948
4929
|
}
|
|
@@ -4953,14 +4934,14 @@ class z {
|
|
|
4953
4934
|
* @param options.data - данные для заполнения текстов по customData.templateField
|
|
4954
4935
|
*/
|
|
4955
4936
|
applyTemplate(s) {
|
|
4956
|
-
return
|
|
4937
|
+
return O(this, arguments, function* ({
|
|
4957
4938
|
template: t,
|
|
4958
4939
|
data: e
|
|
4959
4940
|
}) {
|
|
4960
4941
|
const {
|
|
4961
4942
|
canvas: o,
|
|
4962
|
-
montageArea:
|
|
4963
|
-
historyManager:
|
|
4943
|
+
montageArea: i,
|
|
4944
|
+
historyManager: n,
|
|
4964
4945
|
errorManager: a,
|
|
4965
4946
|
backgroundManager: r
|
|
4966
4947
|
} = this.editor, { objects: c, meta: h, id: l } = t != null ? t : {};
|
|
@@ -4971,7 +4952,7 @@ class z {
|
|
|
4971
4952
|
code: at.TEMPLATE_MANAGER.INVALID_TEMPLATE,
|
|
4972
4953
|
message: "Шаблон не содержит объектов"
|
|
4973
4954
|
}), null;
|
|
4974
|
-
const g =
|
|
4955
|
+
const g = Y._getBounds(i);
|
|
4975
4956
|
if (!g)
|
|
4976
4957
|
return a.emitWarning({
|
|
4977
4958
|
origin: "TemplateManager",
|
|
@@ -4979,43 +4960,43 @@ class z {
|
|
|
4979
4960
|
code: at.TEMPLATE_MANAGER.INVALID_TARGET,
|
|
4980
4961
|
message: "Не удалось определить границы монтажной области"
|
|
4981
4962
|
}), null;
|
|
4982
|
-
const u =
|
|
4963
|
+
const u = Y._getMontageSize({ montageArea: i, bounds: g }), f = Y._normalizeMeta({ meta: h, fallback: u }), m = Y._calculateScale({ meta: f, target: u }), y = !!f.positionsNormalized;
|
|
4983
4964
|
let p = !1, M = !1;
|
|
4984
|
-
|
|
4965
|
+
n.suspendHistory();
|
|
4985
4966
|
try {
|
|
4986
|
-
const
|
|
4987
|
-
if (!
|
|
4967
|
+
const j = yield Y._enlivenObjects(c);
|
|
4968
|
+
if (!j.length)
|
|
4988
4969
|
return a.emitWarning({
|
|
4989
4970
|
origin: "TemplateManager",
|
|
4990
4971
|
method: "applyTemplate",
|
|
4991
4972
|
code: at.TEMPLATE_MANAGER.INVALID_TEMPLATE,
|
|
4992
4973
|
message: "Не удалось создать объекты шаблона"
|
|
4993
4974
|
}), null;
|
|
4994
|
-
const { backgroundObject:
|
|
4995
|
-
|
|
4996
|
-
backgroundObject:
|
|
4975
|
+
const { backgroundObject: T, contentObjects: B } = Y._extractBackgroundObject(j);
|
|
4976
|
+
T && (M = yield Y._applyBackgroundFromObject({
|
|
4977
|
+
backgroundObject: T,
|
|
4997
4978
|
backgroundManager: r,
|
|
4998
4979
|
errorManager: a
|
|
4999
4980
|
}));
|
|
5000
|
-
const b =
|
|
4981
|
+
const b = B.map((I) => (Y._applyTextOverrides({ object: I, data: e }), Y._transformObject({
|
|
5001
4982
|
object: I,
|
|
5002
4983
|
scale: m,
|
|
5003
4984
|
bounds: g,
|
|
5004
4985
|
targetSize: u,
|
|
5005
4986
|
baseWidth: f.baseWidth,
|
|
5006
4987
|
baseHeight: f.baseHeight,
|
|
5007
|
-
montageArea:
|
|
4988
|
+
montageArea: i,
|
|
5008
4989
|
useRelativePositions: y
|
|
5009
4990
|
}), I.set({
|
|
5010
|
-
id: `${I.type}-${
|
|
4991
|
+
id: `${I.type}-${F()}`,
|
|
5011
4992
|
evented: !0
|
|
5012
4993
|
}), o.add(I), I));
|
|
5013
|
-
return !b.length && !M ? null : (p = b.length > 0 || M, b.length &&
|
|
4994
|
+
return !b.length && !M ? null : (p = b.length > 0 || M, b.length && Y._activateObjects({ canvas: o, objects: b }), o.requestRenderAll(), o.fire("editor:template-applied", {
|
|
5014
4995
|
template: t,
|
|
5015
4996
|
objects: b,
|
|
5016
4997
|
bounds: g
|
|
5017
4998
|
}), b);
|
|
5018
|
-
} catch (
|
|
4999
|
+
} catch (j) {
|
|
5019
5000
|
return a.emitError({
|
|
5020
5001
|
origin: "TemplateManager",
|
|
5021
5002
|
method: "applyTemplate",
|
|
@@ -5023,11 +5004,11 @@ class z {
|
|
|
5023
5004
|
message: "Ошибка применения шаблона",
|
|
5024
5005
|
data: {
|
|
5025
5006
|
templateId: l,
|
|
5026
|
-
error:
|
|
5007
|
+
error: j
|
|
5027
5008
|
}
|
|
5028
5009
|
}), null;
|
|
5029
5010
|
} finally {
|
|
5030
|
-
|
|
5011
|
+
n.resumeHistory(), p && n.saveState();
|
|
5031
5012
|
}
|
|
5032
5013
|
});
|
|
5033
5014
|
}
|
|
@@ -5035,7 +5016,7 @@ class z {
|
|
|
5035
5016
|
* Подготавливает объекты для сериализации.
|
|
5036
5017
|
*/
|
|
5037
5018
|
static _collectObjects(t) {
|
|
5038
|
-
return t ? t instanceof
|
|
5019
|
+
return t ? t instanceof x ? t.getObjects() : [t] : [];
|
|
5039
5020
|
}
|
|
5040
5021
|
/**
|
|
5041
5022
|
* Возвращает габариты объекта.
|
|
@@ -5059,7 +5040,7 @@ class z {
|
|
|
5059
5040
|
* Превращает plain-описание объектов в Fabric объекты.
|
|
5060
5041
|
*/
|
|
5061
5042
|
static _enlivenObjects(t) {
|
|
5062
|
-
return
|
|
5043
|
+
return O(this, null, function* () {
|
|
5063
5044
|
const e = yield vt.enlivenObjects(t);
|
|
5064
5045
|
return e != null ? e : [];
|
|
5065
5046
|
});
|
|
@@ -5072,21 +5053,21 @@ class z {
|
|
|
5072
5053
|
scale: e,
|
|
5073
5054
|
bounds: s,
|
|
5074
5055
|
targetSize: o,
|
|
5075
|
-
baseWidth:
|
|
5076
|
-
baseHeight:
|
|
5056
|
+
baseWidth: i,
|
|
5057
|
+
baseHeight: n,
|
|
5077
5058
|
montageArea: a,
|
|
5078
5059
|
useRelativePositions: r
|
|
5079
5060
|
}) {
|
|
5080
|
-
const { x: c, y: h } =
|
|
5061
|
+
const { x: c, y: h } = Ls({
|
|
5081
5062
|
object: t,
|
|
5082
|
-
baseWidth:
|
|
5083
|
-
baseHeight:
|
|
5063
|
+
baseWidth: i,
|
|
5064
|
+
baseHeight: n,
|
|
5084
5065
|
useRelativePositions: r,
|
|
5085
5066
|
centerKeys: {
|
|
5086
|
-
x:
|
|
5067
|
+
x: Wt,
|
|
5087
5068
|
y: Ht
|
|
5088
5069
|
}
|
|
5089
|
-
}), { scaleX: l, scaleY: g } = t, u =
|
|
5070
|
+
}), { scaleX: l, scaleY: g } = t, u = Nt({ value: l, fallback: 1 }), f = Nt({ value: g, fallback: 1 }), m = Ns({
|
|
5090
5071
|
normalizedX: c,
|
|
5091
5072
|
normalizedY: h,
|
|
5092
5073
|
bounds: s,
|
|
@@ -5098,7 +5079,7 @@ class z {
|
|
|
5098
5079
|
scaleY: p
|
|
5099
5080
|
}), t.setPositionByOrigin(m, "center", "center"), t.setCoords();
|
|
5100
5081
|
const M = t;
|
|
5101
|
-
delete M[
|
|
5082
|
+
delete M[Wt], delete M[Ht];
|
|
5102
5083
|
}
|
|
5103
5084
|
/**
|
|
5104
5085
|
* Нормализует мета-данные шаблона.
|
|
@@ -5107,10 +5088,10 @@ class z {
|
|
|
5107
5088
|
meta: t,
|
|
5108
5089
|
fallback: e
|
|
5109
5090
|
}) {
|
|
5110
|
-
const { width: s, height: o } = e, r = t || {}, { baseWidth:
|
|
5111
|
-
return
|
|
5112
|
-
baseWidth:
|
|
5113
|
-
baseHeight:
|
|
5091
|
+
const { width: s, height: o } = e, r = t || {}, { baseWidth: i = s, baseHeight: n = o } = r, a = nt(r, ["baseWidth", "baseHeight"]);
|
|
5092
|
+
return N({
|
|
5093
|
+
baseWidth: i,
|
|
5094
|
+
baseHeight: n
|
|
5114
5095
|
}, a);
|
|
5115
5096
|
}
|
|
5116
5097
|
/**
|
|
@@ -5120,7 +5101,7 @@ class z {
|
|
|
5120
5101
|
meta: t,
|
|
5121
5102
|
target: e
|
|
5122
5103
|
}) {
|
|
5123
|
-
const { width: s, height: o } = e, { baseWidth:
|
|
5104
|
+
const { width: s, height: o } = e, { baseWidth: i, baseHeight: n } = t, a = s / (i || s || 1), r = o / (n || o || 1);
|
|
5124
5105
|
return Math.min(a, r);
|
|
5125
5106
|
}
|
|
5126
5107
|
/**
|
|
@@ -5135,7 +5116,7 @@ class z {
|
|
|
5135
5116
|
t.setActiveObject(e[0]);
|
|
5136
5117
|
return;
|
|
5137
5118
|
}
|
|
5138
|
-
const s = new
|
|
5119
|
+
const s = new x(e, { canvas: t });
|
|
5139
5120
|
t.setActiveObject(s);
|
|
5140
5121
|
}
|
|
5141
5122
|
/**
|
|
@@ -5146,7 +5127,7 @@ class z {
|
|
|
5146
5127
|
data: e
|
|
5147
5128
|
}) {
|
|
5148
5129
|
if (!("text" in t)) return;
|
|
5149
|
-
const s = t.customData, { templateField: o, text:
|
|
5130
|
+
const s = t.customData, { templateField: o, text: i } = s != null ? s : {}, n = typeof o == "string" ? o : void 0, a = typeof i == "string" ? i : void 0, r = n && e ? e[n] : void 0, c = r != null ? r : a;
|
|
5150
5131
|
typeof c == "string" && (t.text = c);
|
|
5151
5132
|
}
|
|
5152
5133
|
/**
|
|
@@ -5157,57 +5138,57 @@ class z {
|
|
|
5157
5138
|
bounds: e,
|
|
5158
5139
|
baseWidth: s,
|
|
5159
5140
|
baseHeight: o,
|
|
5160
|
-
montageArea:
|
|
5141
|
+
montageArea: i
|
|
5161
5142
|
}) {
|
|
5162
|
-
const
|
|
5163
|
-
if (!e) return
|
|
5143
|
+
const n = t.toDatalessObject([...Le]);
|
|
5144
|
+
if (!e) return n;
|
|
5164
5145
|
const {
|
|
5165
5146
|
left: a,
|
|
5166
5147
|
top: r,
|
|
5167
5148
|
width: c,
|
|
5168
5149
|
height: h
|
|
5169
|
-
} = e, l = t.getBoundingRect(!1, !0), g = s || c || 1, u = o || h || 1, f =
|
|
5150
|
+
} = e, l = t.getBoundingRect(!1, !0), g = s || c || 1, u = o || h || 1, f = Rs({
|
|
5170
5151
|
object: t,
|
|
5171
|
-
montageArea:
|
|
5152
|
+
montageArea: i,
|
|
5172
5153
|
bounds: e
|
|
5173
5154
|
});
|
|
5174
5155
|
if (f)
|
|
5175
|
-
|
|
5156
|
+
n[Wt] = f.x, n[Ht] = f.y;
|
|
5176
5157
|
else {
|
|
5177
5158
|
const m = t.getCenterPoint();
|
|
5178
|
-
|
|
5159
|
+
n[Wt] = (m.x - a) / g, n[Ht] = (m.y - r) / u;
|
|
5179
5160
|
}
|
|
5180
|
-
return
|
|
5161
|
+
return n.left = (l.left - a) / g, n.top = (l.top - r) / u, n;
|
|
5181
5162
|
}
|
|
5182
5163
|
/**
|
|
5183
5164
|
* Делит список объектов на фон и контент по id === 'background'.
|
|
5184
5165
|
*/
|
|
5185
5166
|
static _extractBackgroundObject(t) {
|
|
5186
|
-
const e = t.findIndex((
|
|
5167
|
+
const e = t.findIndex((i) => i.id === "background");
|
|
5187
5168
|
if (e === -1)
|
|
5188
5169
|
return { backgroundObject: null, contentObjects: t };
|
|
5189
|
-
const s = t[e], o = t.filter((
|
|
5170
|
+
const s = t[e], o = t.filter((i, n) => n !== e);
|
|
5190
5171
|
return { backgroundObject: s, contentObjects: o };
|
|
5191
5172
|
}
|
|
5192
5173
|
/**
|
|
5193
5174
|
* Применяет фоновый объект шаблона к текущему холсту через BackgroundManager.
|
|
5194
5175
|
*/
|
|
5195
5176
|
static _applyBackgroundFromObject(o) {
|
|
5196
|
-
return
|
|
5177
|
+
return O(this, arguments, function* ({
|
|
5197
5178
|
backgroundObject: t,
|
|
5198
5179
|
backgroundManager: e,
|
|
5199
5180
|
errorManager: s
|
|
5200
5181
|
}) {
|
|
5201
5182
|
try {
|
|
5202
|
-
const { fill:
|
|
5203
|
-
if (a === "color" && typeof
|
|
5183
|
+
const { fill: i, customData: n } = t, { backgroundType: a } = t, r = Y._cloneCustomData(n);
|
|
5184
|
+
if (a === "color" && typeof i == "string")
|
|
5204
5185
|
return e.setColorBackground({
|
|
5205
|
-
color:
|
|
5186
|
+
color: i,
|
|
5206
5187
|
customData: r,
|
|
5207
5188
|
withoutSave: !0
|
|
5208
5189
|
}), !0;
|
|
5209
5190
|
if (a === "gradient") {
|
|
5210
|
-
const c =
|
|
5191
|
+
const c = xs(i);
|
|
5211
5192
|
if (c)
|
|
5212
5193
|
return e.setGradientBackground({
|
|
5213
5194
|
gradient: c,
|
|
@@ -5216,7 +5197,7 @@ class z {
|
|
|
5216
5197
|
}), !0;
|
|
5217
5198
|
}
|
|
5218
5199
|
if (a === "image") {
|
|
5219
|
-
const c =
|
|
5200
|
+
const c = Y._getImageSource(t);
|
|
5220
5201
|
if (c)
|
|
5221
5202
|
return yield e.setImageBackground({
|
|
5222
5203
|
imageSource: c,
|
|
@@ -5224,13 +5205,13 @@ class z {
|
|
|
5224
5205
|
withoutSave: !0
|
|
5225
5206
|
}), !0;
|
|
5226
5207
|
}
|
|
5227
|
-
} catch (
|
|
5208
|
+
} catch (i) {
|
|
5228
5209
|
s.emitWarning({
|
|
5229
5210
|
origin: "TemplateManager",
|
|
5230
5211
|
method: "applyTemplate",
|
|
5231
5212
|
code: at.TEMPLATE_MANAGER.APPLY_FAILED,
|
|
5232
5213
|
message: "Не удалось применить фон из шаблона",
|
|
5233
|
-
data:
|
|
5214
|
+
data: i
|
|
5234
5215
|
});
|
|
5235
5216
|
}
|
|
5236
5217
|
return !1;
|
|
@@ -5243,11 +5224,11 @@ class z {
|
|
|
5243
5224
|
montageArea: t,
|
|
5244
5225
|
bounds: e
|
|
5245
5226
|
}) {
|
|
5246
|
-
var
|
|
5227
|
+
var i, n;
|
|
5247
5228
|
const s = (e == null ? void 0 : e.width) || 0, o = (e == null ? void 0 : e.height) || 0;
|
|
5248
5229
|
return t ? {
|
|
5249
|
-
width: ((
|
|
5250
|
-
height: ((
|
|
5230
|
+
width: ((i = t.getScaledWidth) == null ? void 0 : i.call(t)) || t.width || s,
|
|
5231
|
+
height: ((n = t.getScaledHeight) == null ? void 0 : n.call(t)) || t.height || o
|
|
5251
5232
|
} : {
|
|
5252
5233
|
width: s,
|
|
5253
5234
|
height: o
|
|
@@ -5258,7 +5239,7 @@ class z {
|
|
|
5258
5239
|
*/
|
|
5259
5240
|
static _cloneCustomData(t) {
|
|
5260
5241
|
if (!(!t || typeof t != "object"))
|
|
5261
|
-
return
|
|
5242
|
+
return N({}, t);
|
|
5262
5243
|
}
|
|
5263
5244
|
/**
|
|
5264
5245
|
* Извлекает src изображения из FabricImage или его исходного элемента.
|
|
@@ -5285,7 +5266,7 @@ class ce {
|
|
|
5285
5266
|
* @param options - опции и настройки редактора
|
|
5286
5267
|
*/
|
|
5287
5268
|
constructor(t, e) {
|
|
5288
|
-
this.options = e, this.containerId = t, this.editorId = `${t}-${
|
|
5269
|
+
this.options = e, this.containerId = t, this.editorId = `${t}-${F()}`, this.clipboard = null, this.init();
|
|
5289
5270
|
}
|
|
5290
5271
|
/**
|
|
5291
5272
|
* Инициализация редактора.
|
|
@@ -5293,22 +5274,22 @@ class ce {
|
|
|
5293
5274
|
* @fires editor:ready
|
|
5294
5275
|
*/
|
|
5295
5276
|
init() {
|
|
5296
|
-
return
|
|
5277
|
+
return O(this, null, function* () {
|
|
5297
5278
|
var g;
|
|
5298
5279
|
const {
|
|
5299
5280
|
editorContainerWidth: t,
|
|
5300
5281
|
editorContainerHeight: e,
|
|
5301
5282
|
canvasWrapperWidth: s,
|
|
5302
5283
|
canvasWrapperHeight: o,
|
|
5303
|
-
canvasCSSWidth:
|
|
5304
|
-
canvasCSSHeight:
|
|
5284
|
+
canvasCSSWidth: i,
|
|
5285
|
+
canvasCSSHeight: n,
|
|
5305
5286
|
initialImage: a,
|
|
5306
5287
|
initialStateJSON: r,
|
|
5307
5288
|
scaleType: c,
|
|
5308
5289
|
showRotationAngle: h,
|
|
5309
5290
|
_onReadyCallback: l
|
|
5310
5291
|
} = this.options;
|
|
5311
|
-
if (mt.apply(), this.canvas = new
|
|
5292
|
+
if (mt.apply(), this.canvas = new Fe(this.containerId, this.options), this.moduleLoader = new Ze(), this.workerManager = new Ge(), this.errorManager = new Lt({ editor: this }), this.historyManager = new Vt({ editor: this }), this.toolbar = new ds({ editor: this }), this.transformManager = new bs({ editor: this }), this.zoomManager = new vs({ editor: this }), this.canvasManager = new Ms({ editor: this }), this.imageManager = new tt({ editor: this }), this.layerManager = new Gt({ editor: this }), this.shapeManager = new js({ editor: this }), this.interactionBlocker = new ws({ editor: this }), this.backgroundManager = new pt({ editor: this }), this.clipboardManager = new As({ editor: this }), this.objectLockManager = new Xt({ editor: this }), this.groupingManager = new Ss({ editor: this }), this.selectionManager = new Is({ editor: this }), this.deletionManager = new re({ editor: this }), this.panConstraintManager = new Cs({ editor: this }), this.fontManager = new se((g = this.options.fonts) != null ? g : []), this.textManager = new Q({ editor: this }), this.templateManager = new Y({ editor: this }), h && (this.angleIndicator = new ae({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.listeners = new Dt({ editor: this, options: this.options }), this.canvasManager.setEditorContainerWidth(t), this.canvasManager.setEditorContainerHeight(e), this.canvasManager.setCanvasWrapperWidth(s), this.canvasManager.setCanvasWrapperHeight(o), this.canvasManager.setCanvasCSSWidth(i), this.canvasManager.setCanvasCSSHeight(n), this.canvasManager.updateCanvas(), this.zoomManager.calculateAndApplyDefaultZoom(), yield this.fontManager.loadFonts(), a != null && a.source) {
|
|
5312
5293
|
const {
|
|
5313
5294
|
source: u,
|
|
5314
5295
|
scale: f = `image-${c}`,
|
|
@@ -5381,13 +5362,13 @@ class ce {
|
|
|
5381
5362
|
const t = document.createElement("canvas");
|
|
5382
5363
|
t.width = 20, t.height = 20;
|
|
5383
5364
|
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
|
|
5365
|
+
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 Ye({
|
|
5385
5366
|
source: t,
|
|
5386
5367
|
repeat: "repeat"
|
|
5387
5368
|
});
|
|
5388
5369
|
}
|
|
5389
5370
|
}
|
|
5390
|
-
const
|
|
5371
|
+
const v = [
|
|
5391
5372
|
"U+0000-00FF",
|
|
5392
5373
|
"U+0131",
|
|
5393
5374
|
"U+0152-0153",
|
|
@@ -5407,7 +5388,7 @@ const X = [
|
|
|
5407
5388
|
"U+2215",
|
|
5408
5389
|
"U+FEFF",
|
|
5409
5390
|
"U+FFFD"
|
|
5410
|
-
].join(", "),
|
|
5391
|
+
].join(", "), w = [
|
|
5411
5392
|
"U+0301",
|
|
5412
5393
|
"U+0400-045F",
|
|
5413
5394
|
"U+0490-0491",
|
|
@@ -5430,7 +5411,7 @@ const X = [
|
|
|
5430
5411
|
style: "normal",
|
|
5431
5412
|
weight: "400",
|
|
5432
5413
|
display: "swap",
|
|
5433
|
-
unicodeRange:
|
|
5414
|
+
unicodeRange: w
|
|
5434
5415
|
}
|
|
5435
5416
|
},
|
|
5436
5417
|
{
|
|
@@ -5440,7 +5421,7 @@ const X = [
|
|
|
5440
5421
|
style: "normal",
|
|
5441
5422
|
weight: "400",
|
|
5442
5423
|
display: "swap",
|
|
5443
|
-
unicodeRange:
|
|
5424
|
+
unicodeRange: v
|
|
5444
5425
|
}
|
|
5445
5426
|
},
|
|
5446
5427
|
{
|
|
@@ -5450,7 +5431,7 @@ const X = [
|
|
|
5450
5431
|
style: "normal",
|
|
5451
5432
|
weight: "700",
|
|
5452
5433
|
display: "swap",
|
|
5453
|
-
unicodeRange:
|
|
5434
|
+
unicodeRange: w
|
|
5454
5435
|
}
|
|
5455
5436
|
},
|
|
5456
5437
|
{
|
|
@@ -5460,7 +5441,7 @@ const X = [
|
|
|
5460
5441
|
style: "normal",
|
|
5461
5442
|
weight: "700",
|
|
5462
5443
|
display: "swap",
|
|
5463
|
-
unicodeRange:
|
|
5444
|
+
unicodeRange: v
|
|
5464
5445
|
}
|
|
5465
5446
|
},
|
|
5466
5447
|
{
|
|
@@ -5470,7 +5451,7 @@ const X = [
|
|
|
5470
5451
|
style: "normal",
|
|
5471
5452
|
weight: "200 700",
|
|
5472
5453
|
display: "swap",
|
|
5473
|
-
unicodeRange:
|
|
5454
|
+
unicodeRange: w
|
|
5474
5455
|
}
|
|
5475
5456
|
},
|
|
5476
5457
|
{
|
|
@@ -5480,7 +5461,7 @@ const X = [
|
|
|
5480
5461
|
style: "normal",
|
|
5481
5462
|
weight: "200 700",
|
|
5482
5463
|
display: "swap",
|
|
5483
|
-
unicodeRange:
|
|
5464
|
+
unicodeRange: v
|
|
5484
5465
|
}
|
|
5485
5466
|
},
|
|
5486
5467
|
{
|
|
@@ -5490,7 +5471,7 @@ const X = [
|
|
|
5490
5471
|
style: "normal",
|
|
5491
5472
|
weight: "300 900",
|
|
5492
5473
|
display: "swap",
|
|
5493
|
-
unicodeRange:
|
|
5474
|
+
unicodeRange: w
|
|
5494
5475
|
}
|
|
5495
5476
|
},
|
|
5496
5477
|
{
|
|
@@ -5500,7 +5481,7 @@ const X = [
|
|
|
5500
5481
|
style: "normal",
|
|
5501
5482
|
weight: "300 900",
|
|
5502
5483
|
display: "swap",
|
|
5503
|
-
unicodeRange:
|
|
5484
|
+
unicodeRange: v
|
|
5504
5485
|
}
|
|
5505
5486
|
},
|
|
5506
5487
|
{
|
|
@@ -5510,7 +5491,7 @@ const X = [
|
|
|
5510
5491
|
style: "normal",
|
|
5511
5492
|
weight: "400 700",
|
|
5512
5493
|
display: "swap",
|
|
5513
|
-
unicodeRange:
|
|
5494
|
+
unicodeRange: w
|
|
5514
5495
|
}
|
|
5515
5496
|
},
|
|
5516
5497
|
{
|
|
@@ -5520,7 +5501,7 @@ const X = [
|
|
|
5520
5501
|
style: "normal",
|
|
5521
5502
|
weight: "400 700",
|
|
5522
5503
|
display: "swap",
|
|
5523
|
-
unicodeRange:
|
|
5504
|
+
unicodeRange: v
|
|
5524
5505
|
}
|
|
5525
5506
|
},
|
|
5526
5507
|
{
|
|
@@ -5530,7 +5511,7 @@ const X = [
|
|
|
5530
5511
|
style: "normal",
|
|
5531
5512
|
weight: "300 700",
|
|
5532
5513
|
display: "swap",
|
|
5533
|
-
unicodeRange:
|
|
5514
|
+
unicodeRange: w
|
|
5534
5515
|
}
|
|
5535
5516
|
},
|
|
5536
5517
|
{
|
|
@@ -5540,7 +5521,7 @@ const X = [
|
|
|
5540
5521
|
style: "normal",
|
|
5541
5522
|
weight: "300 700",
|
|
5542
5523
|
display: "swap",
|
|
5543
|
-
unicodeRange:
|
|
5524
|
+
unicodeRange: v
|
|
5544
5525
|
}
|
|
5545
5526
|
},
|
|
5546
5527
|
{
|
|
@@ -5550,7 +5531,7 @@ const X = [
|
|
|
5550
5531
|
style: "normal",
|
|
5551
5532
|
weight: "300 700",
|
|
5552
5533
|
display: "swap",
|
|
5553
|
-
unicodeRange:
|
|
5534
|
+
unicodeRange: w
|
|
5554
5535
|
}
|
|
5555
5536
|
},
|
|
5556
5537
|
{
|
|
@@ -5560,7 +5541,7 @@ const X = [
|
|
|
5560
5541
|
style: "normal",
|
|
5561
5542
|
weight: "300 700",
|
|
5562
5543
|
display: "swap",
|
|
5563
|
-
unicodeRange:
|
|
5544
|
+
unicodeRange: v
|
|
5564
5545
|
}
|
|
5565
5546
|
},
|
|
5566
5547
|
{
|
|
@@ -5570,7 +5551,7 @@ const X = [
|
|
|
5570
5551
|
style: "normal",
|
|
5571
5552
|
weight: "400",
|
|
5572
5553
|
display: "swap",
|
|
5573
|
-
unicodeRange:
|
|
5554
|
+
unicodeRange: w
|
|
5574
5555
|
}
|
|
5575
5556
|
},
|
|
5576
5557
|
{
|
|
@@ -5580,7 +5561,7 @@ const X = [
|
|
|
5580
5561
|
style: "normal",
|
|
5581
5562
|
weight: "400",
|
|
5582
5563
|
display: "swap",
|
|
5583
|
-
unicodeRange:
|
|
5564
|
+
unicodeRange: v
|
|
5584
5565
|
}
|
|
5585
5566
|
},
|
|
5586
5567
|
{
|
|
@@ -5590,7 +5571,7 @@ const X = [
|
|
|
5590
5571
|
style: "normal",
|
|
5591
5572
|
weight: "400 700",
|
|
5592
5573
|
display: "swap",
|
|
5593
|
-
unicodeRange:
|
|
5574
|
+
unicodeRange: w
|
|
5594
5575
|
}
|
|
5595
5576
|
},
|
|
5596
5577
|
{
|
|
@@ -5600,7 +5581,7 @@ const X = [
|
|
|
5600
5581
|
style: "normal",
|
|
5601
5582
|
weight: "400 700",
|
|
5602
5583
|
display: "swap",
|
|
5603
|
-
unicodeRange:
|
|
5584
|
+
unicodeRange: v
|
|
5604
5585
|
}
|
|
5605
5586
|
},
|
|
5606
5587
|
{
|
|
@@ -5610,7 +5591,7 @@ const X = [
|
|
|
5610
5591
|
style: "normal",
|
|
5611
5592
|
weight: "100 900",
|
|
5612
5593
|
display: "swap",
|
|
5613
|
-
unicodeRange:
|
|
5594
|
+
unicodeRange: w
|
|
5614
5595
|
}
|
|
5615
5596
|
},
|
|
5616
5597
|
{
|
|
@@ -5620,7 +5601,587 @@ const X = [
|
|
|
5620
5601
|
style: "normal",
|
|
5621
5602
|
weight: "100 900",
|
|
5622
5603
|
display: "swap",
|
|
5623
|
-
unicodeRange:
|
|
5604
|
+
unicodeRange: v
|
|
5605
|
+
}
|
|
5606
|
+
},
|
|
5607
|
+
{
|
|
5608
|
+
family: "Anonymous Pro",
|
|
5609
|
+
source: 'url(https://fonts.gstatic.com/s/anonymouspro/v22/rP2Bp2a15UIB7Un-bOeISG3pHl829RH9.woff2) format("woff2")',
|
|
5610
|
+
descriptors: {
|
|
5611
|
+
style: "normal",
|
|
5612
|
+
weight: "400",
|
|
5613
|
+
display: "swap",
|
|
5614
|
+
unicodeRange: w
|
|
5615
|
+
}
|
|
5616
|
+
},
|
|
5617
|
+
{
|
|
5618
|
+
family: "Anonymous Pro",
|
|
5619
|
+
source: 'url(https://fonts.gstatic.com/s/anonymouspro/v22/rP2Bp2a15UIB7Un-bOeISG3pHls29Q.woff2) format("woff2")',
|
|
5620
|
+
descriptors: {
|
|
5621
|
+
style: "normal",
|
|
5622
|
+
weight: "400",
|
|
5623
|
+
display: "swap",
|
|
5624
|
+
unicodeRange: v
|
|
5625
|
+
}
|
|
5626
|
+
},
|
|
5627
|
+
{
|
|
5628
|
+
family: "Anonymous Pro",
|
|
5629
|
+
source: 'url(https://fonts.gstatic.com/s/anonymouspro/v22/rP2cp2a15UIB7Un-bOeISG3pFuAT4Crc7ZOy.woff2) format("woff2")',
|
|
5630
|
+
descriptors: {
|
|
5631
|
+
style: "normal",
|
|
5632
|
+
weight: "700",
|
|
5633
|
+
display: "swap",
|
|
5634
|
+
unicodeRange: w
|
|
5635
|
+
}
|
|
5636
|
+
},
|
|
5637
|
+
{
|
|
5638
|
+
family: "Anonymous Pro",
|
|
5639
|
+
source: 'url(https://fonts.gstatic.com/s/anonymouspro/v22/rP2cp2a15UIB7Un-bOeISG3pFuAT4C7c7Q.woff2) format("woff2")',
|
|
5640
|
+
descriptors: {
|
|
5641
|
+
style: "normal",
|
|
5642
|
+
weight: "700",
|
|
5643
|
+
display: "swap",
|
|
5644
|
+
unicodeRange: v
|
|
5645
|
+
}
|
|
5646
|
+
},
|
|
5647
|
+
{
|
|
5648
|
+
family: "El Messiri",
|
|
5649
|
+
source: 'url(https://fonts.gstatic.com/s/elmessiri/v25/K2F0fZBRmr9vQ1pHEey6MomAAhLz.woff2) format("woff2")',
|
|
5650
|
+
descriptors: {
|
|
5651
|
+
style: "normal",
|
|
5652
|
+
weight: "400 700",
|
|
5653
|
+
display: "swap",
|
|
5654
|
+
unicodeRange: w
|
|
5655
|
+
}
|
|
5656
|
+
},
|
|
5657
|
+
{
|
|
5658
|
+
family: "El Messiri",
|
|
5659
|
+
source: 'url(https://fonts.gstatic.com/s/elmessiri/v25/K2F0fZBRmr9vQ1pHEey6Mo2AAg.woff2) format("woff2")',
|
|
5660
|
+
descriptors: {
|
|
5661
|
+
style: "normal",
|
|
5662
|
+
weight: "400 700",
|
|
5663
|
+
display: "swap",
|
|
5664
|
+
unicodeRange: v
|
|
5665
|
+
}
|
|
5666
|
+
},
|
|
5667
|
+
{
|
|
5668
|
+
family: "Exo 2",
|
|
5669
|
+
source: 'url(https://fonts.gstatic.com/s/exo2/v26/7cHmv4okm5zmbtYsK-4E4Q.woff2) format("woff2")',
|
|
5670
|
+
descriptors: {
|
|
5671
|
+
style: "normal",
|
|
5672
|
+
weight: "100 900",
|
|
5673
|
+
display: "swap",
|
|
5674
|
+
unicodeRange: w
|
|
5675
|
+
}
|
|
5676
|
+
},
|
|
5677
|
+
{
|
|
5678
|
+
family: "Exo 2",
|
|
5679
|
+
source: 'url(https://fonts.gstatic.com/s/exo2/v26/7cHmv4okm5zmbtYoK-4.woff2) format("woff2")',
|
|
5680
|
+
descriptors: {
|
|
5681
|
+
style: "normal",
|
|
5682
|
+
weight: "100 900",
|
|
5683
|
+
display: "swap",
|
|
5684
|
+
unicodeRange: v
|
|
5685
|
+
}
|
|
5686
|
+
},
|
|
5687
|
+
{
|
|
5688
|
+
family: "Fira Sans",
|
|
5689
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9C4kDNxMZdWfMOD5Vn9LjNYTLHdQ.woff2) format("woff2")',
|
|
5690
|
+
descriptors: {
|
|
5691
|
+
style: "normal",
|
|
5692
|
+
weight: "100",
|
|
5693
|
+
display: "swap",
|
|
5694
|
+
unicodeRange: w
|
|
5695
|
+
}
|
|
5696
|
+
},
|
|
5697
|
+
{
|
|
5698
|
+
family: "Fira Sans",
|
|
5699
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9C4kDNxMZdWfMOD5Vn9LjJYTI.woff2) format("woff2")',
|
|
5700
|
+
descriptors: {
|
|
5701
|
+
style: "normal",
|
|
5702
|
+
weight: "100",
|
|
5703
|
+
display: "swap",
|
|
5704
|
+
unicodeRange: v
|
|
5705
|
+
}
|
|
5706
|
+
},
|
|
5707
|
+
{
|
|
5708
|
+
family: "Fira Sans",
|
|
5709
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9B4kDNxMZdWfMOD5VnWKneQhf6TF0.woff2) format("woff2")',
|
|
5710
|
+
descriptors: {
|
|
5711
|
+
style: "normal",
|
|
5712
|
+
weight: "200",
|
|
5713
|
+
display: "swap",
|
|
5714
|
+
unicodeRange: w
|
|
5715
|
+
}
|
|
5716
|
+
},
|
|
5717
|
+
{
|
|
5718
|
+
family: "Fira Sans",
|
|
5719
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9B4kDNxMZdWfMOD5VnWKneRhf6.woff2) format("woff2")',
|
|
5720
|
+
descriptors: {
|
|
5721
|
+
style: "normal",
|
|
5722
|
+
weight: "200",
|
|
5723
|
+
display: "swap",
|
|
5724
|
+
unicodeRange: v
|
|
5725
|
+
}
|
|
5726
|
+
},
|
|
5727
|
+
{
|
|
5728
|
+
family: "Fira Sans",
|
|
5729
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9B4kDNxMZdWfMOD5VnPKreQhf6TF0.woff2) format("woff2")',
|
|
5730
|
+
descriptors: {
|
|
5731
|
+
style: "normal",
|
|
5732
|
+
weight: "300",
|
|
5733
|
+
display: "swap",
|
|
5734
|
+
unicodeRange: w
|
|
5735
|
+
}
|
|
5736
|
+
},
|
|
5737
|
+
{
|
|
5738
|
+
family: "Fira Sans",
|
|
5739
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9B4kDNxMZdWfMOD5VnPKreRhf6.woff2) format("woff2")',
|
|
5740
|
+
descriptors: {
|
|
5741
|
+
style: "normal",
|
|
5742
|
+
weight: "300",
|
|
5743
|
+
display: "swap",
|
|
5744
|
+
unicodeRange: v
|
|
5745
|
+
}
|
|
5746
|
+
},
|
|
5747
|
+
{
|
|
5748
|
+
family: "Fira Sans",
|
|
5749
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9E4kDNxMZdWfMOD5Vvk4jLeTY.woff2) format("woff2")',
|
|
5750
|
+
descriptors: {
|
|
5751
|
+
style: "normal",
|
|
5752
|
+
weight: "400",
|
|
5753
|
+
display: "swap",
|
|
5754
|
+
unicodeRange: w
|
|
5755
|
+
}
|
|
5756
|
+
},
|
|
5757
|
+
{
|
|
5758
|
+
family: "Fira Sans",
|
|
5759
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9E4kDNxMZdWfMOD5Vvl4jL.woff2) format("woff2")',
|
|
5760
|
+
descriptors: {
|
|
5761
|
+
style: "normal",
|
|
5762
|
+
weight: "400",
|
|
5763
|
+
display: "swap",
|
|
5764
|
+
unicodeRange: v
|
|
5765
|
+
}
|
|
5766
|
+
},
|
|
5767
|
+
{
|
|
5768
|
+
family: "Fira Sans",
|
|
5769
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9B4kDNxMZdWfMOD5VnZKveQhf6TF0.woff2) format("woff2")',
|
|
5770
|
+
descriptors: {
|
|
5771
|
+
style: "normal",
|
|
5772
|
+
weight: "500",
|
|
5773
|
+
display: "swap",
|
|
5774
|
+
unicodeRange: w
|
|
5775
|
+
}
|
|
5776
|
+
},
|
|
5777
|
+
{
|
|
5778
|
+
family: "Fira Sans",
|
|
5779
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9B4kDNxMZdWfMOD5VnZKveRhf6.woff2) format("woff2")',
|
|
5780
|
+
descriptors: {
|
|
5781
|
+
style: "normal",
|
|
5782
|
+
weight: "500",
|
|
5783
|
+
display: "swap",
|
|
5784
|
+
unicodeRange: v
|
|
5785
|
+
}
|
|
5786
|
+
},
|
|
5787
|
+
{
|
|
5788
|
+
family: "Fira Sans",
|
|
5789
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9B4kDNxMZdWfMOD5VnSKzeQhf6TF0.woff2) format("woff2")',
|
|
5790
|
+
descriptors: {
|
|
5791
|
+
style: "normal",
|
|
5792
|
+
weight: "600",
|
|
5793
|
+
display: "swap",
|
|
5794
|
+
unicodeRange: w
|
|
5795
|
+
}
|
|
5796
|
+
},
|
|
5797
|
+
{
|
|
5798
|
+
family: "Fira Sans",
|
|
5799
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9B4kDNxMZdWfMOD5VnSKzeRhf6.woff2) format("woff2")',
|
|
5800
|
+
descriptors: {
|
|
5801
|
+
style: "normal",
|
|
5802
|
+
weight: "600",
|
|
5803
|
+
display: "swap",
|
|
5804
|
+
unicodeRange: v
|
|
5805
|
+
}
|
|
5806
|
+
},
|
|
5807
|
+
{
|
|
5808
|
+
family: "Fira Sans",
|
|
5809
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9B4kDNxMZdWfMOD5VnLK3eQhf6TF0.woff2) format("woff2")',
|
|
5810
|
+
descriptors: {
|
|
5811
|
+
style: "normal",
|
|
5812
|
+
weight: "700",
|
|
5813
|
+
display: "swap",
|
|
5814
|
+
unicodeRange: w
|
|
5815
|
+
}
|
|
5816
|
+
},
|
|
5817
|
+
{
|
|
5818
|
+
family: "Fira Sans",
|
|
5819
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9B4kDNxMZdWfMOD5VnLK3eRhf6.woff2) format("woff2")',
|
|
5820
|
+
descriptors: {
|
|
5821
|
+
style: "normal",
|
|
5822
|
+
weight: "700",
|
|
5823
|
+
display: "swap",
|
|
5824
|
+
unicodeRange: v
|
|
5825
|
+
}
|
|
5826
|
+
},
|
|
5827
|
+
{
|
|
5828
|
+
family: "Fira Sans",
|
|
5829
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9B4kDNxMZdWfMOD5VnMK7eQhf6TF0.woff2) format("woff2")',
|
|
5830
|
+
descriptors: {
|
|
5831
|
+
style: "normal",
|
|
5832
|
+
weight: "800",
|
|
5833
|
+
display: "swap",
|
|
5834
|
+
unicodeRange: w
|
|
5835
|
+
}
|
|
5836
|
+
},
|
|
5837
|
+
{
|
|
5838
|
+
family: "Fira Sans",
|
|
5839
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9B4kDNxMZdWfMOD5VnMK7eRhf6.woff2) format("woff2")',
|
|
5840
|
+
descriptors: {
|
|
5841
|
+
style: "normal",
|
|
5842
|
+
weight: "800",
|
|
5843
|
+
display: "swap",
|
|
5844
|
+
unicodeRange: v
|
|
5845
|
+
}
|
|
5846
|
+
},
|
|
5847
|
+
{
|
|
5848
|
+
family: "Fira Sans",
|
|
5849
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9B4kDNxMZdWfMOD5VnFK_eQhf6TF0.woff2) format("woff2")',
|
|
5850
|
+
descriptors: {
|
|
5851
|
+
style: "normal",
|
|
5852
|
+
weight: "900",
|
|
5853
|
+
display: "swap",
|
|
5854
|
+
unicodeRange: w
|
|
5855
|
+
}
|
|
5856
|
+
},
|
|
5857
|
+
{
|
|
5858
|
+
family: "Fira Sans",
|
|
5859
|
+
source: 'url(https://fonts.gstatic.com/s/firasans/v18/va9B4kDNxMZdWfMOD5VnFK_eRhf6.woff2) format("woff2")',
|
|
5860
|
+
descriptors: {
|
|
5861
|
+
style: "normal",
|
|
5862
|
+
weight: "900",
|
|
5863
|
+
display: "swap",
|
|
5864
|
+
unicodeRange: v
|
|
5865
|
+
}
|
|
5866
|
+
},
|
|
5867
|
+
{
|
|
5868
|
+
family: "Istok Web",
|
|
5869
|
+
source: 'url(https://fonts.gstatic.com/s/istokweb/v26/3qTvojGmgSyUukBzKslpAmt_xkI.woff2) format("woff2")',
|
|
5870
|
+
descriptors: {
|
|
5871
|
+
style: "normal",
|
|
5872
|
+
weight: "400",
|
|
5873
|
+
display: "swap",
|
|
5874
|
+
unicodeRange: w
|
|
5875
|
+
}
|
|
5876
|
+
},
|
|
5877
|
+
{
|
|
5878
|
+
family: "Istok Web",
|
|
5879
|
+
source: 'url(https://fonts.gstatic.com/s/istokweb/v26/3qTvojGmgSyUukBzKslpBmt_.woff2) format("woff2")',
|
|
5880
|
+
descriptors: {
|
|
5881
|
+
style: "normal",
|
|
5882
|
+
weight: "400",
|
|
5883
|
+
display: "swap",
|
|
5884
|
+
unicodeRange: v
|
|
5885
|
+
}
|
|
5886
|
+
},
|
|
5887
|
+
{
|
|
5888
|
+
family: "Istok Web",
|
|
5889
|
+
source: 'url(https://fonts.gstatic.com/s/istokweb/v26/3qTqojGmgSyUukBzKslhvU5q_WMVUBc.woff2) format("woff2")',
|
|
5890
|
+
descriptors: {
|
|
5891
|
+
style: "normal",
|
|
5892
|
+
weight: "700",
|
|
5893
|
+
display: "swap",
|
|
5894
|
+
unicodeRange: w
|
|
5895
|
+
}
|
|
5896
|
+
},
|
|
5897
|
+
{
|
|
5898
|
+
family: "Istok Web",
|
|
5899
|
+
source: 'url(https://fonts.gstatic.com/s/istokweb/v26/3qTqojGmgSyUukBzKslhvU5q-WMV.woff2) format("woff2")',
|
|
5900
|
+
descriptors: {
|
|
5901
|
+
style: "normal",
|
|
5902
|
+
weight: "700",
|
|
5903
|
+
display: "swap",
|
|
5904
|
+
unicodeRange: v
|
|
5905
|
+
}
|
|
5906
|
+
},
|
|
5907
|
+
{
|
|
5908
|
+
family: "Jost",
|
|
5909
|
+
source: 'url(https://fonts.gstatic.com/s/jost/v20/92zatBhPNqw73oDd4iYl.woff2) format("woff2")',
|
|
5910
|
+
descriptors: {
|
|
5911
|
+
style: "normal",
|
|
5912
|
+
weight: "100 900",
|
|
5913
|
+
display: "swap",
|
|
5914
|
+
unicodeRange: w
|
|
5915
|
+
}
|
|
5916
|
+
},
|
|
5917
|
+
{
|
|
5918
|
+
family: "Jost",
|
|
5919
|
+
source: 'url(https://fonts.gstatic.com/s/jost/v20/92zatBhPNqw73oTd4g.woff2) format("woff2")',
|
|
5920
|
+
descriptors: {
|
|
5921
|
+
style: "normal",
|
|
5922
|
+
weight: "100 900",
|
|
5923
|
+
display: "swap",
|
|
5924
|
+
unicodeRange: v
|
|
5925
|
+
}
|
|
5926
|
+
},
|
|
5927
|
+
{
|
|
5928
|
+
family: "Jura",
|
|
5929
|
+
source: 'url(https://fonts.gstatic.com/s/jura/v34/z7NbdRfiaC4VXcBJURRD.woff2) format("woff2")',
|
|
5930
|
+
descriptors: {
|
|
5931
|
+
style: "normal",
|
|
5932
|
+
weight: "300 700",
|
|
5933
|
+
display: "swap",
|
|
5934
|
+
unicodeRange: w
|
|
5935
|
+
}
|
|
5936
|
+
},
|
|
5937
|
+
{
|
|
5938
|
+
family: "Jura",
|
|
5939
|
+
source: 'url(https://fonts.gstatic.com/s/jura/v34/z7NbdRfiaC4VXcRJUQ.woff2) format("woff2")',
|
|
5940
|
+
descriptors: {
|
|
5941
|
+
style: "normal",
|
|
5942
|
+
weight: "300 700",
|
|
5943
|
+
display: "swap",
|
|
5944
|
+
unicodeRange: v
|
|
5945
|
+
}
|
|
5946
|
+
},
|
|
5947
|
+
{
|
|
5948
|
+
family: "Lobster",
|
|
5949
|
+
source: 'url(https://fonts.gstatic.com/s/lobster/v32/neILzCirqoswsqX9zoamM5Ez.woff2) format("woff2")',
|
|
5950
|
+
descriptors: {
|
|
5951
|
+
style: "normal",
|
|
5952
|
+
weight: "400",
|
|
5953
|
+
display: "swap",
|
|
5954
|
+
unicodeRange: w
|
|
5955
|
+
}
|
|
5956
|
+
},
|
|
5957
|
+
{
|
|
5958
|
+
family: "Lobster",
|
|
5959
|
+
source: 'url(https://fonts.gstatic.com/s/lobster/v32/neILzCirqoswsqX9zoKmMw.woff2) format("woff2")',
|
|
5960
|
+
descriptors: {
|
|
5961
|
+
style: "normal",
|
|
5962
|
+
weight: "400",
|
|
5963
|
+
display: "swap",
|
|
5964
|
+
unicodeRange: v
|
|
5965
|
+
}
|
|
5966
|
+
},
|
|
5967
|
+
{
|
|
5968
|
+
family: "Manrope",
|
|
5969
|
+
source: 'url(https://fonts.gstatic.com/s/manrope/v20/xn7gYHE41ni1AdIRggOxSuXd.woff2) format("woff2")',
|
|
5970
|
+
descriptors: {
|
|
5971
|
+
style: "normal",
|
|
5972
|
+
weight: "200 800",
|
|
5973
|
+
display: "swap",
|
|
5974
|
+
unicodeRange: w
|
|
5975
|
+
}
|
|
5976
|
+
},
|
|
5977
|
+
{
|
|
5978
|
+
family: "Manrope",
|
|
5979
|
+
source: 'url(https://fonts.gstatic.com/s/manrope/v20/xn7gYHE41ni1AdIRggexSg.woff2) format("woff2")',
|
|
5980
|
+
descriptors: {
|
|
5981
|
+
style: "normal",
|
|
5982
|
+
weight: "200 800",
|
|
5983
|
+
display: "swap",
|
|
5984
|
+
unicodeRange: v
|
|
5985
|
+
}
|
|
5986
|
+
},
|
|
5987
|
+
{
|
|
5988
|
+
family: "Montserrat",
|
|
5989
|
+
source: 'url(https://fonts.gstatic.com/s/montserrat/v31/JTUSjIg1_i6t8kCHKm459W1hyzbi.woff2) format("woff2")',
|
|
5990
|
+
descriptors: {
|
|
5991
|
+
style: "normal",
|
|
5992
|
+
weight: "100 900",
|
|
5993
|
+
display: "swap",
|
|
5994
|
+
unicodeRange: w
|
|
5995
|
+
}
|
|
5996
|
+
},
|
|
5997
|
+
{
|
|
5998
|
+
family: "Montserrat",
|
|
5999
|
+
source: 'url(https://fonts.gstatic.com/s/montserrat/v31/JTUSjIg1_i6t8kCHKm459Wlhyw.woff2) format("woff2")',
|
|
6000
|
+
descriptors: {
|
|
6001
|
+
style: "normal",
|
|
6002
|
+
weight: "100 900",
|
|
6003
|
+
display: "swap",
|
|
6004
|
+
unicodeRange: v
|
|
6005
|
+
}
|
|
6006
|
+
},
|
|
6007
|
+
{
|
|
6008
|
+
family: "Neucha",
|
|
6009
|
+
source: 'url(https://fonts.gstatic.com/s/neucha/v18/q5uGsou0JOdh94bfuQltOxU.woff2) format("woff2")',
|
|
6010
|
+
descriptors: {
|
|
6011
|
+
style: "normal",
|
|
6012
|
+
weight: "400",
|
|
6013
|
+
display: "swap",
|
|
6014
|
+
unicodeRange: w
|
|
6015
|
+
}
|
|
6016
|
+
},
|
|
6017
|
+
{
|
|
6018
|
+
family: "Neucha",
|
|
6019
|
+
source: 'url(https://fonts.gstatic.com/s/neucha/v18/q5uGsou0JOdh94bfvQlt.woff2) format("woff2")',
|
|
6020
|
+
descriptors: {
|
|
6021
|
+
style: "normal",
|
|
6022
|
+
weight: "400",
|
|
6023
|
+
display: "swap",
|
|
6024
|
+
unicodeRange: v
|
|
6025
|
+
}
|
|
6026
|
+
},
|
|
6027
|
+
{
|
|
6028
|
+
family: "Noto Serif",
|
|
6029
|
+
source: 'url(https://fonts.gstatic.com/s/notoserif/v33/ga6daw1J5X9T9RW6j9bNVls-hfgvz8JcMofYTYf-D33Esw.woff2) format("woff2")',
|
|
6030
|
+
descriptors: {
|
|
6031
|
+
style: "normal",
|
|
6032
|
+
weight: "100 900",
|
|
6033
|
+
display: "swap",
|
|
6034
|
+
unicodeRange: w
|
|
6035
|
+
}
|
|
6036
|
+
},
|
|
6037
|
+
{
|
|
6038
|
+
family: "Noto Serif",
|
|
6039
|
+
source: 'url(https://fonts.gstatic.com/s/notoserif/v33/ga6daw1J5X9T9RW6j9bNVls-hfgvz8JcMofYTYf6D30.woff2) format("woff2")',
|
|
6040
|
+
descriptors: {
|
|
6041
|
+
style: "normal",
|
|
6042
|
+
weight: "100 900",
|
|
6043
|
+
display: "swap",
|
|
6044
|
+
unicodeRange: v
|
|
6045
|
+
}
|
|
6046
|
+
},
|
|
6047
|
+
{
|
|
6048
|
+
family: "Open Sans",
|
|
6049
|
+
source: 'url(https://fonts.gstatic.com/s/opensans/v44/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSumu1aB.woff2) format("woff2")',
|
|
6050
|
+
descriptors: {
|
|
6051
|
+
style: "normal",
|
|
6052
|
+
weight: "300 800",
|
|
6053
|
+
display: "swap",
|
|
6054
|
+
unicodeRange: w
|
|
6055
|
+
}
|
|
6056
|
+
},
|
|
6057
|
+
{
|
|
6058
|
+
family: "Open Sans",
|
|
6059
|
+
source: 'url(https://fonts.gstatic.com/s/opensans/v44/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTS-muw.woff2) format("woff2")',
|
|
6060
|
+
descriptors: {
|
|
6061
|
+
style: "normal",
|
|
6062
|
+
weight: "300 800",
|
|
6063
|
+
display: "swap",
|
|
6064
|
+
unicodeRange: v
|
|
6065
|
+
}
|
|
6066
|
+
},
|
|
6067
|
+
{
|
|
6068
|
+
family: "PT Serif",
|
|
6069
|
+
source: 'url(https://fonts.gstatic.com/s/ptserif/v19/EJRVQgYoZZY2vCFuvAFSzr-tdg.woff2) format("woff2")',
|
|
6070
|
+
descriptors: {
|
|
6071
|
+
style: "normal",
|
|
6072
|
+
weight: "400",
|
|
6073
|
+
display: "swap",
|
|
6074
|
+
unicodeRange: w
|
|
6075
|
+
}
|
|
6076
|
+
},
|
|
6077
|
+
{
|
|
6078
|
+
family: "PT Serif",
|
|
6079
|
+
source: 'url(https://fonts.gstatic.com/s/ptserif/v19/EJRVQgYoZZY2vCFuvAFWzr8.woff2) format("woff2")',
|
|
6080
|
+
descriptors: {
|
|
6081
|
+
style: "normal",
|
|
6082
|
+
weight: "400",
|
|
6083
|
+
display: "swap",
|
|
6084
|
+
unicodeRange: v
|
|
6085
|
+
}
|
|
6086
|
+
},
|
|
6087
|
+
{
|
|
6088
|
+
family: "PT Serif",
|
|
6089
|
+
source: 'url(https://fonts.gstatic.com/s/ptserif/v19/EJRSQgYoZZY2vCFuvAnt66qWVyvHpA.woff2) format("woff2")',
|
|
6090
|
+
descriptors: {
|
|
6091
|
+
style: "normal",
|
|
6092
|
+
weight: "700",
|
|
6093
|
+
display: "swap",
|
|
6094
|
+
unicodeRange: w
|
|
6095
|
+
}
|
|
6096
|
+
},
|
|
6097
|
+
{
|
|
6098
|
+
family: "PT Serif",
|
|
6099
|
+
source: 'url(https://fonts.gstatic.com/s/ptserif/v19/EJRSQgYoZZY2vCFuvAnt66qSVys.woff2) format("woff2")',
|
|
6100
|
+
descriptors: {
|
|
6101
|
+
style: "normal",
|
|
6102
|
+
weight: "700",
|
|
6103
|
+
display: "swap",
|
|
6104
|
+
unicodeRange: v
|
|
6105
|
+
}
|
|
6106
|
+
},
|
|
6107
|
+
{
|
|
6108
|
+
family: "Playfair",
|
|
6109
|
+
source: 'url(https://fonts.gstatic.com/s/playfair/v10/0nk2C9D7PO4KhmUJ5_zTZ-wCMUXynAK-5UQzVItagFk.woff2) format("woff2")',
|
|
6110
|
+
descriptors: {
|
|
6111
|
+
style: "normal",
|
|
6112
|
+
weight: "300 900",
|
|
6113
|
+
display: "swap",
|
|
6114
|
+
unicodeRange: w
|
|
6115
|
+
}
|
|
6116
|
+
},
|
|
6117
|
+
{
|
|
6118
|
+
family: "Playfair",
|
|
6119
|
+
source: 'url(https://fonts.gstatic.com/s/playfair/v10/0nk2C9D7PO4KhmUJ5_zTZ-wCMUXynAK-5UQzUIta.woff2) format("woff2")',
|
|
6120
|
+
descriptors: {
|
|
6121
|
+
style: "normal",
|
|
6122
|
+
weight: "300 900",
|
|
6123
|
+
display: "swap",
|
|
6124
|
+
unicodeRange: v
|
|
6125
|
+
}
|
|
6126
|
+
},
|
|
6127
|
+
{
|
|
6128
|
+
family: "Press Start 2P",
|
|
6129
|
+
source: 'url(https://fonts.gstatic.com/s/pressstart2p/v16/e3t4euO8T-267oIAQAu6jDQyK3nRivN04w.woff2) format("woff2")',
|
|
6130
|
+
descriptors: {
|
|
6131
|
+
style: "normal",
|
|
6132
|
+
weight: "400",
|
|
6133
|
+
display: "swap",
|
|
6134
|
+
unicodeRange: w
|
|
6135
|
+
}
|
|
6136
|
+
},
|
|
6137
|
+
{
|
|
6138
|
+
family: "Press Start 2P",
|
|
6139
|
+
source: 'url(https://fonts.gstatic.com/s/pressstart2p/v16/e3t4euO8T-267oIAQAu6jDQyK3nVivM.woff2) format("woff2")',
|
|
6140
|
+
descriptors: {
|
|
6141
|
+
style: "normal",
|
|
6142
|
+
weight: "400",
|
|
6143
|
+
display: "swap",
|
|
6144
|
+
unicodeRange: v
|
|
6145
|
+
}
|
|
6146
|
+
},
|
|
6147
|
+
{
|
|
6148
|
+
family: "Raleway",
|
|
6149
|
+
source: 'url(https://fonts.gstatic.com/s/raleway/v37/1Ptug8zYS_SKggPNyCkIT5lu.woff2) format("woff2")',
|
|
6150
|
+
descriptors: {
|
|
6151
|
+
style: "normal",
|
|
6152
|
+
weight: "100 900",
|
|
6153
|
+
display: "swap",
|
|
6154
|
+
unicodeRange: w
|
|
6155
|
+
}
|
|
6156
|
+
},
|
|
6157
|
+
{
|
|
6158
|
+
family: "Raleway",
|
|
6159
|
+
source: 'url(https://fonts.gstatic.com/s/raleway/v37/1Ptug8zYS_SKggPNyC0ITw.woff2) format("woff2")',
|
|
6160
|
+
descriptors: {
|
|
6161
|
+
style: "normal",
|
|
6162
|
+
weight: "100 900",
|
|
6163
|
+
display: "swap",
|
|
6164
|
+
unicodeRange: v
|
|
6165
|
+
}
|
|
6166
|
+
},
|
|
6167
|
+
{
|
|
6168
|
+
family: "Roboto",
|
|
6169
|
+
source: 'url(https://fonts.gstatic.com/s/roboto/v50/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3iUBGEe.woff2) format("woff2")',
|
|
6170
|
+
descriptors: {
|
|
6171
|
+
style: "normal",
|
|
6172
|
+
weight: "100 900",
|
|
6173
|
+
display: "swap",
|
|
6174
|
+
unicodeRange: w
|
|
6175
|
+
}
|
|
6176
|
+
},
|
|
6177
|
+
{
|
|
6178
|
+
family: "Roboto",
|
|
6179
|
+
source: 'url(https://fonts.gstatic.com/s/roboto/v50/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3yUBA.woff2) format("woff2")',
|
|
6180
|
+
descriptors: {
|
|
6181
|
+
style: "normal",
|
|
6182
|
+
weight: "100 900",
|
|
6183
|
+
display: "swap",
|
|
6184
|
+
unicodeRange: v
|
|
5624
6185
|
}
|
|
5625
6186
|
}
|
|
5626
6187
|
], _s = {
|
|
@@ -5717,18 +6278,18 @@ const X = [
|
|
|
5717
6278
|
*/
|
|
5718
6279
|
fonts: Bs
|
|
5719
6280
|
};
|
|
5720
|
-
function
|
|
5721
|
-
const e =
|
|
6281
|
+
function Ps(d, t = {}) {
|
|
6282
|
+
const e = N(N({}, _s), t), s = document.getElementById(d);
|
|
5722
6283
|
if (!s)
|
|
5723
6284
|
return Promise.reject(new Error(`Контейнер с ID "${d}" не найден.`));
|
|
5724
6285
|
const o = document.createElement("canvas");
|
|
5725
|
-
return o.id = `${d}-canvas`, s.appendChild(o), e.editorContainer = s, new Promise((
|
|
5726
|
-
e._onReadyCallback =
|
|
5727
|
-
const
|
|
5728
|
-
window[d] =
|
|
6286
|
+
return o.id = `${d}-canvas`, s.appendChild(o), e.editorContainer = s, new Promise((i) => {
|
|
6287
|
+
e._onReadyCallback = i;
|
|
6288
|
+
const n = new ce(o.id, e);
|
|
6289
|
+
window[d] = n;
|
|
5729
6290
|
});
|
|
5730
6291
|
}
|
|
5731
6292
|
export {
|
|
5732
|
-
|
|
6293
|
+
Ps as default
|
|
5733
6294
|
};
|
|
5734
6295
|
//# sourceMappingURL=main.js.map
|