@anu3ev/fabric-image-editor 0.1.43 → 0.1.44
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 +322 -320
- package/package.json +4 -2
package/dist/main.js
CHANGED
|
@@ -21,18 +21,18 @@ var X = (o, e) => {
|
|
|
21
21
|
var Q = (o, e, t) => new Promise((a, n) => {
|
|
22
22
|
var i = (c) => {
|
|
23
23
|
try {
|
|
24
|
-
|
|
24
|
+
r(t.next(c));
|
|
25
25
|
} catch (u) {
|
|
26
26
|
n(u);
|
|
27
27
|
}
|
|
28
|
-
},
|
|
28
|
+
}, s = (c) => {
|
|
29
29
|
try {
|
|
30
|
-
|
|
30
|
+
r(t.throw(c));
|
|
31
31
|
} catch (u) {
|
|
32
32
|
n(u);
|
|
33
33
|
}
|
|
34
|
-
},
|
|
35
|
-
|
|
34
|
+
}, r = (c) => c.done ? a(c.value) : Promise.resolve(c.value).then(i, s);
|
|
35
|
+
r((t = t.apply(o, e)).next());
|
|
36
36
|
});
|
|
37
37
|
import { ActiveSelection as T, util as P, controlsUtils as Oe, InteractiveFabricObject as Te, loadSVGFromURL as ke, FabricImage as ee, Point as K, Rect as xe, Circle as Be, Triangle as Ze, Group as ze, Canvas as Ue, Pattern as _e } from "fabric";
|
|
38
38
|
import { create as He } from "jsondiffpatch";
|
|
@@ -70,13 +70,13 @@ class R {
|
|
|
70
70
|
mouseWheelZooming: a,
|
|
71
71
|
bringToFrontOnSelection: n,
|
|
72
72
|
copyObjectsByHotkey: i,
|
|
73
|
-
pasteImageFromClipboard:
|
|
74
|
-
undoRedoByHotKeys:
|
|
73
|
+
pasteImageFromClipboard: s,
|
|
74
|
+
undoRedoByHotKeys: r,
|
|
75
75
|
selectAllByHotkey: c,
|
|
76
76
|
deleteObjectsByHotkey: u,
|
|
77
77
|
resetObjectFitByDoubleClick: l
|
|
78
78
|
} = this.options;
|
|
79
|
-
t && (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 })), a && this.canvas.on("mouse:wheel", this.handleMouseWheelZoomBound), n && (this.canvas.on("selection:created", this.handleBringToFrontBound), this.canvas.on("selection:updated", this.handleBringToFrontBound)), l && this.canvas.on("mouse:dblclick", this.handleResetObjectFitBound), e && window.addEventListener("resize", this.handleContainerResizeBound, { capture: !0 }), i && document.addEventListener("keydown", this.handleCopyEventBound, { capture: !0 }),
|
|
79
|
+
t && (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 })), a && this.canvas.on("mouse:wheel", this.handleMouseWheelZoomBound), n && (this.canvas.on("selection:created", this.handleBringToFrontBound), this.canvas.on("selection:updated", this.handleBringToFrontBound)), l && this.canvas.on("mouse:dblclick", this.handleResetObjectFitBound), e && window.addEventListener("resize", this.handleContainerResizeBound, { capture: !0 }), i && document.addEventListener("keydown", this.handleCopyEventBound, { capture: !0 }), s && document.addEventListener("paste", this.handlePasteEventBound, { capture: !0 }), r && (document.addEventListener("keydown", this.handleUndoRedoEventBound, { capture: !0 }), document.addEventListener("keyup", this.handleUndoRedoKeyUpBound, { capture: !0 })), c && document.addEventListener("keydown", this.handleSelectAllEventBound, { capture: !0 }), u && 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);
|
|
80
80
|
}
|
|
81
81
|
/**
|
|
82
82
|
* При массовом выделении объектов удаляем из него залоченные.
|
|
@@ -85,8 +85,8 @@ class R {
|
|
|
85
85
|
* @param {TPointerEvent} [params.e] - событие указателя (опционально)
|
|
86
86
|
*/
|
|
87
87
|
_filterLockedSelection({ selected: e, e: t }) {
|
|
88
|
-
if (!(e != null && e.length) || !(t instanceof MouseEvent) || e.length === 1 || !e.some((
|
|
89
|
-
const n = e.filter((
|
|
88
|
+
if (!(e != null && e.length) || !(t instanceof MouseEvent) || e.length === 1 || !e.some((s) => s.locked)) return;
|
|
89
|
+
const n = e.filter((s) => !s.locked);
|
|
90
90
|
if (n.length === 0) {
|
|
91
91
|
this.canvas.discardActiveObject();
|
|
92
92
|
return;
|
|
@@ -201,8 +201,8 @@ class R {
|
|
|
201
201
|
n || i || (this.isSpacePressed = !0, e.preventDefault(), t.set({
|
|
202
202
|
selection: !1,
|
|
203
203
|
defaultCursor: "grab"
|
|
204
|
-
}), t.setCursor("grab"), a.canvasManager.getObjects().forEach((
|
|
205
|
-
|
|
204
|
+
}), t.setCursor("grab"), a.canvasManager.getObjects().forEach((s) => {
|
|
205
|
+
s.set({
|
|
206
206
|
selectable: !1,
|
|
207
207
|
evented: !1
|
|
208
208
|
});
|
|
@@ -297,9 +297,8 @@ class R {
|
|
|
297
297
|
static debounce(e, t) {
|
|
298
298
|
let a = null;
|
|
299
299
|
return function(...n) {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
e.apply(i, n);
|
|
300
|
+
a !== null && clearTimeout(a), a = setTimeout(() => {
|
|
301
|
+
e.apply(this, n);
|
|
303
302
|
}, t);
|
|
304
303
|
};
|
|
305
304
|
}
|
|
@@ -350,9 +349,9 @@ class Pe {
|
|
|
350
349
|
requestId: a,
|
|
351
350
|
success: n,
|
|
352
351
|
data: i,
|
|
353
|
-
error:
|
|
354
|
-
} = t,
|
|
355
|
-
|
|
352
|
+
error: s
|
|
353
|
+
} = t, r = this._callbacks.get(a);
|
|
354
|
+
r && (n ? r.resolve(i) : r.reject(new Error(s)), this._callbacks.delete(a));
|
|
356
355
|
}
|
|
357
356
|
/**
|
|
358
357
|
* Универсальный метод отправки команды в воркер
|
|
@@ -363,10 +362,10 @@ class Pe {
|
|
|
363
362
|
*/
|
|
364
363
|
post(e, t) {
|
|
365
364
|
var a = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [], n = "".concat(e, ":").concat(A(8));
|
|
366
|
-
return new Promise((i,
|
|
365
|
+
return new Promise((i, s) => {
|
|
367
366
|
this._callbacks.set(n, {
|
|
368
367
|
resolve: i,
|
|
369
|
-
reject:
|
|
368
|
+
reject: s
|
|
370
369
|
}), this.worker.postMessage({
|
|
371
370
|
action: e,
|
|
372
371
|
payload: t,
|
|
@@ -381,26 +380,26 @@ class Pe {
|
|
|
381
380
|
this.worker.terminate();
|
|
382
381
|
}
|
|
383
382
|
}
|
|
384
|
-
|
|
383
|
+
const I = 12, We = 2, ae = 8, ne = 20, Fe = 100, ie = 20, se = 8, Ve = 100, re = 32, oe = 1, Ge = "#2B2D33", ce = "#3D8BF4", ue = "#FFFFFF";
|
|
385
384
|
function J(o, e, t, a, n) {
|
|
386
|
-
|
|
387
|
-
o.save(), o.translate(e, t), o.rotate(P.degreesToRadians(n.angle)), o.fillStyle = ue, o.strokeStyle = ce, o.lineWidth = oe, o.beginPath(), o.roundRect(-12 / 2, -12 / 2, i, i,
|
|
385
|
+
const i = I, s = We;
|
|
386
|
+
o.save(), o.translate(e, t), o.rotate(P.degreesToRadians(n.angle)), o.fillStyle = ue, o.strokeStyle = ce, o.lineWidth = oe, o.beginPath(), o.roundRect(-12 / 2, -12 / 2, i, i, s), o.fill(), o.stroke(), o.restore();
|
|
388
387
|
}
|
|
389
388
|
function ye(o, e, t, a, n) {
|
|
390
|
-
|
|
391
|
-
o.save(), o.translate(e, t), o.rotate(P.degreesToRadians(n.angle)), o.fillStyle = ue, o.strokeStyle = ce, o.lineWidth = oe, o.beginPath(), o.roundRect(-8 / 2, -20 / 2, i,
|
|
389
|
+
const i = ae, s = ne, r = Fe;
|
|
390
|
+
o.save(), o.translate(e, t), o.rotate(P.degreesToRadians(n.angle)), o.fillStyle = ue, o.strokeStyle = ce, o.lineWidth = oe, o.beginPath(), o.roundRect(-8 / 2, -20 / 2, i, s, r), o.fill(), o.stroke(), o.restore();
|
|
392
391
|
}
|
|
393
392
|
function be(o, e, t, a, n) {
|
|
394
|
-
|
|
395
|
-
o.save(), o.translate(e, t), o.rotate(P.degreesToRadians(n.angle)), o.fillStyle = ue, o.strokeStyle = ce, o.lineWidth = oe, o.beginPath(), o.roundRect(-20 / 2, -8 / 2, i,
|
|
393
|
+
const i = ie, s = se, r = Ve;
|
|
394
|
+
o.save(), o.translate(e, t), o.rotate(P.degreesToRadians(n.angle)), o.fillStyle = ue, o.strokeStyle = ce, o.lineWidth = oe, o.beginPath(), o.roundRect(-20 / 2, -8 / 2, i, s, r), o.fill(), o.stroke(), o.restore();
|
|
396
395
|
}
|
|
397
|
-
|
|
396
|
+
const Xe = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", Ce = new Image();
|
|
398
397
|
Ce.src = Xe;
|
|
399
398
|
function Qe(o, e, t, a, n) {
|
|
400
|
-
|
|
401
|
-
o.save(), o.translate(e, t), o.rotate(P.degreesToRadians(n.angle)), o.fillStyle = Ge, o.beginPath(), o.arc(0, 0,
|
|
399
|
+
const s = re / 2;
|
|
400
|
+
o.save(), o.translate(e, t), o.rotate(P.degreesToRadians(n.angle)), o.fillStyle = Ge, o.beginPath(), o.arc(0, 0, s, 0, 2 * Math.PI), o.fill(), o.drawImage(Ce, -16 / 2, -16 / 2, s, s), o.restore();
|
|
402
401
|
}
|
|
403
|
-
|
|
402
|
+
const Je = {
|
|
404
403
|
// Угловые точки
|
|
405
404
|
tl: {
|
|
406
405
|
render: J,
|
|
@@ -449,65 +448,64 @@ var Je = {
|
|
|
449
448
|
mt: {
|
|
450
449
|
render: be,
|
|
451
450
|
sizeX: ie,
|
|
452
|
-
sizeY:
|
|
451
|
+
sizeY: se,
|
|
453
452
|
offsetX: 0,
|
|
454
453
|
offsetY: 0
|
|
455
454
|
},
|
|
456
455
|
mb: {
|
|
457
456
|
render: be,
|
|
458
457
|
sizeX: ie,
|
|
459
|
-
sizeY:
|
|
458
|
+
sizeY: se,
|
|
460
459
|
offsetX: 0,
|
|
461
460
|
offsetY: 0
|
|
462
461
|
},
|
|
463
462
|
// Специальный «rotate» контрол
|
|
464
463
|
mtr: {
|
|
465
464
|
render: Qe,
|
|
466
|
-
sizeX:
|
|
467
|
-
sizeY:
|
|
465
|
+
sizeX: re,
|
|
466
|
+
sizeY: re,
|
|
468
467
|
offsetX: 0,
|
|
469
468
|
offsetY: -32
|
|
470
469
|
}
|
|
471
470
|
};
|
|
472
471
|
class Ke {
|
|
473
472
|
static apply() {
|
|
474
|
-
|
|
475
|
-
Object.entries(Je).forEach((t) => {
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
u.canvas.setCursor("grabbing");
|
|
473
|
+
const e = Oe.createObjectDefaultControls();
|
|
474
|
+
Object.entries(Je).forEach(([t, a]) => {
|
|
475
|
+
Object.assign(e[t], {
|
|
476
|
+
render: a.render,
|
|
477
|
+
sizeX: a.sizeX,
|
|
478
|
+
sizeY: a.sizeY,
|
|
479
|
+
offsetX: a.offsetX,
|
|
480
|
+
offsetY: a.offsetY
|
|
481
|
+
}), t === "mtr" && (e[t].cursorStyle = "grab", e[t].mouseDownHandler = (i, s, r, c) => {
|
|
482
|
+
var l;
|
|
483
|
+
(l = s.target.canvas) == null || l.setCursor("grabbing");
|
|
486
484
|
});
|
|
487
485
|
}), Te.ownDefaults.controls = e;
|
|
488
486
|
}
|
|
489
487
|
}
|
|
490
|
-
var $e = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNi44NzUgMi41YS42MjUuNjI1IDAgMCAwLS42MjUuNjI0VjYuMjVIMy4xMjVhLjYyNS42MjUgMCAwIDAtLjYyNS42MjV2MTBjMCAuMzQ1LjI4LjYyNS42MjUuNjI1aDEwYy4zNDUgMCAuNjI1LS4yOC42MjUtLjYyNXYtMy4xMjZoMy4xMjVjLjM0NSAwIC42MjUtLjI4LjYyNS0uNjI1di0xMGEuNjI1LjYyNSAwIDAgMC0uNjI1LS42MjVoLTEwWm02Ljg3NSAxMGgyLjVWMy43NUg3LjV2Mi41aDUuNjI1Yy4zNDUgMCAuNjI1LjI4LjYyNS42MjV2NS42MjRabS0xMCAzLjc1VjcuNWg4Ljc1djguNzVIMy43NVoiIGN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xLjI1VjVoLjYyNWEuNjI1LjYyNSAwIDAgMCAwLTEuMjVIMTMuNzV2LS42MjVhMS44NzUgMS44NzUgMCAwIDAtMS44NzUtMS44NzVoLTMuNzVabTQuMzc1IDIuNXYtLjYyNWEuNjI1LjYyNSAwIDAgMC0uNjI1LS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDAtLjYyNS42MjV2LjYyNWg1Wk01IDE2LjI1VjVoMTB2MTEuMjVINVpNOC4xMjUgNy41Yy4zNDUgMCAuNjI1LjI4LjYyNS42MjV2NWEuNjI1LjYyNSAwIDEgMS0xLjI1IDB2LTVjMC0uMzQ1LjI4LS42MjUuNjI1LS42MjVabTQuMzc1IDUuNjI1di01YS42MjUuNjI1IDAgMCAwLTEuMjUgMHY1YS42MjUuNjI1IDAgMSAwIDEuMjUgMFoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==";
|
|
489
|
+
function pe(o, e, t, a, n, i, s) {
|
|
492
490
|
try {
|
|
493
|
-
var
|
|
491
|
+
var r = o[i](s), c = r.value;
|
|
494
492
|
} catch (u) {
|
|
495
493
|
return void t(u);
|
|
496
494
|
}
|
|
497
|
-
|
|
495
|
+
r.done ? e(c) : Promise.resolve(c).then(a, n);
|
|
498
496
|
}
|
|
499
|
-
function
|
|
497
|
+
function rt(o) {
|
|
500
498
|
return function() {
|
|
501
499
|
var e = this, t = arguments;
|
|
502
500
|
return new Promise(function(a, n) {
|
|
503
501
|
var i = o.apply(e, t);
|
|
504
|
-
function r(c) {
|
|
505
|
-
pe(i, a, n, r, s, "next", c);
|
|
506
|
-
}
|
|
507
502
|
function s(c) {
|
|
508
|
-
pe(i, a, n,
|
|
503
|
+
pe(i, a, n, s, r, "next", c);
|
|
504
|
+
}
|
|
505
|
+
function r(c) {
|
|
506
|
+
pe(i, a, n, s, r, "throw", c);
|
|
509
507
|
}
|
|
510
|
-
|
|
508
|
+
s(void 0);
|
|
511
509
|
});
|
|
512
510
|
};
|
|
513
511
|
}
|
|
@@ -571,7 +569,7 @@ const Y = {
|
|
|
571
569
|
offsetTop: 50,
|
|
572
570
|
icons: {
|
|
573
571
|
copyPaste: $e,
|
|
574
|
-
delete:
|
|
572
|
+
delete: st,
|
|
575
573
|
lock: qe,
|
|
576
574
|
unlock: et,
|
|
577
575
|
bringToFront: nt,
|
|
@@ -581,7 +579,7 @@ const Y = {
|
|
|
581
579
|
},
|
|
582
580
|
handlers: {
|
|
583
581
|
copyPaste: function() {
|
|
584
|
-
var o =
|
|
582
|
+
var o = rt(function* (t) {
|
|
585
583
|
yield t.clipboardManager.copy(), yield t.clipboardManager.paste();
|
|
586
584
|
});
|
|
587
585
|
function e(t) {
|
|
@@ -700,16 +698,16 @@ class dt {
|
|
|
700
698
|
this.el.innerHTML = "";
|
|
701
699
|
var a = function() {
|
|
702
700
|
var {
|
|
703
|
-
name:
|
|
704
|
-
handle:
|
|
701
|
+
name: s,
|
|
702
|
+
handle: r
|
|
705
703
|
} = n, {
|
|
706
704
|
icons: c,
|
|
707
705
|
btnStyle: u,
|
|
708
706
|
handlers: l
|
|
709
707
|
} = t.config, d = document.createElement("button");
|
|
710
|
-
d.innerHTML = c[
|
|
708
|
+
d.innerHTML = c[r] ? '<img src="'.concat(c[r], '" title="').concat(s, '" />') : s, Object.assign(d.style, u), d.onclick = () => {
|
|
711
709
|
var h;
|
|
712
|
-
return (h = l[
|
|
710
|
+
return (h = l[r]) === null || h === void 0 ? void 0 : h.call(l, t.editor);
|
|
713
711
|
}, t.el.appendChild(d);
|
|
714
712
|
};
|
|
715
713
|
for (var n of e)
|
|
@@ -782,12 +780,12 @@ class dt {
|
|
|
782
780
|
canvas: n
|
|
783
781
|
} = this;
|
|
784
782
|
e.setCoords();
|
|
785
|
-
var i = n.getZoom(), [, , , ,
|
|
783
|
+
var i = n.getZoom(), [, , , , s, r] = n.viewportTransform, {
|
|
786
784
|
x: c
|
|
787
785
|
} = e.getCenterPoint(), {
|
|
788
786
|
top: u,
|
|
789
787
|
height: l
|
|
790
|
-
} = e.getBoundingRect(!1, !0), d = c * i +
|
|
788
|
+
} = e.getBoundingRect(!1, !0), d = c * i + s, h = d - t.offsetWidth / 2, g = (u + l) * i + r + a.offsetTop;
|
|
791
789
|
Object.assign(t.style, {
|
|
792
790
|
left: "".concat(h, "px"),
|
|
793
791
|
top: "".concat(g, "px"),
|
|
@@ -802,26 +800,26 @@ class dt {
|
|
|
802
800
|
this.el.removeEventListener("mouseover", this._onBtnOver), this.el.removeEventListener("mouseout", this._onBtnOut), this.canvas.off("mouse:down", this._onMouseDown), this.canvas.off("object:moving", this._onObjectMoving), this.canvas.off("object:scaling", this._onObjectScaling), this.canvas.off("object:rotating", this._onObjectRotating), this.canvas.off("mouse:up", this._onMouseUp), this.canvas.off("object:modified", this._onObjectModified), this.canvas.off("selection:created", this._onSelectionChange), this.canvas.off("selection:updated", this._onSelectionChange), this.canvas.off("selection:changed", this._onSelectionChange), this.canvas.off("after:render", this._onSelectionChange), this.canvas.off("selection:cleared", this._onSelectionClear), this.el.remove();
|
|
803
801
|
}
|
|
804
802
|
}
|
|
805
|
-
function Ae(o, e, t, a, n, i,
|
|
803
|
+
function Ae(o, e, t, a, n, i, s) {
|
|
806
804
|
try {
|
|
807
|
-
var
|
|
805
|
+
var r = o[i](s), c = r.value;
|
|
808
806
|
} catch (u) {
|
|
809
807
|
return void t(u);
|
|
810
808
|
}
|
|
811
|
-
|
|
809
|
+
r.done ? e(c) : Promise.resolve(c).then(a, n);
|
|
812
810
|
}
|
|
813
811
|
function te(o) {
|
|
814
812
|
return function() {
|
|
815
813
|
var e = this, t = arguments;
|
|
816
814
|
return new Promise(function(a, n) {
|
|
817
815
|
var i = o.apply(e, t);
|
|
818
|
-
function r(c) {
|
|
819
|
-
Ae(i, a, n, r, s, "next", c);
|
|
820
|
-
}
|
|
821
816
|
function s(c) {
|
|
822
|
-
Ae(i, a, n,
|
|
817
|
+
Ae(i, a, n, s, r, "next", c);
|
|
818
|
+
}
|
|
819
|
+
function r(c) {
|
|
820
|
+
Ae(i, a, n, s, r, "throw", c);
|
|
823
821
|
}
|
|
824
|
-
|
|
822
|
+
s(void 0);
|
|
825
823
|
});
|
|
826
824
|
};
|
|
827
825
|
}
|
|
@@ -928,12 +926,12 @@ class lt {
|
|
|
928
926
|
canvasManager: n,
|
|
929
927
|
interactionBlocker: i
|
|
930
928
|
} = t.editor, {
|
|
931
|
-
width:
|
|
932
|
-
height:
|
|
929
|
+
width: s,
|
|
930
|
+
height: r
|
|
933
931
|
} = a;
|
|
934
932
|
yield a.loadFromJSON(e);
|
|
935
933
|
var c = a.getObjects().find((l) => l.id === "montage-area");
|
|
936
|
-
c && (t.editor.montageArea = c, (
|
|
934
|
+
c && (t.editor.montageArea = c, (s !== e.width || r !== e.height) && n.updateCanvasAndFitObjects());
|
|
937
935
|
var u = a.getObjects().find((l) => l.id === "overlay-mask");
|
|
938
936
|
u && (i.overlayMask = u, i.overlayMask.visible = !1), a.renderAll(), a.fire("editor:history-state-loaded", {
|
|
939
937
|
fullState: e,
|
|
@@ -1015,27 +1013,27 @@ class lt {
|
|
|
1015
1013
|
})();
|
|
1016
1014
|
}
|
|
1017
1015
|
}
|
|
1018
|
-
const ht = 0.1, gt = 2,
|
|
1019
|
-
function Se(o, e, t, a, n, i,
|
|
1016
|
+
const ht = 0.1, gt = 2, Mt = 0.1, vt = 90, x = 16, B = 16, w = 4096, O = 4096;
|
|
1017
|
+
function Se(o, e, t, a, n, i, s) {
|
|
1020
1018
|
try {
|
|
1021
|
-
var
|
|
1019
|
+
var r = o[i](s), c = r.value;
|
|
1022
1020
|
} catch (u) {
|
|
1023
1021
|
return void t(u);
|
|
1024
1022
|
}
|
|
1025
|
-
|
|
1023
|
+
r.done ? e(c) : Promise.resolve(c).then(a, n);
|
|
1026
1024
|
}
|
|
1027
1025
|
function k(o) {
|
|
1028
1026
|
return function() {
|
|
1029
1027
|
var e = this, t = arguments;
|
|
1030
1028
|
return new Promise(function(a, n) {
|
|
1031
1029
|
var i = o.apply(e, t);
|
|
1032
|
-
function r(c) {
|
|
1033
|
-
Se(i, a, n, r, s, "next", c);
|
|
1034
|
-
}
|
|
1035
1030
|
function s(c) {
|
|
1036
|
-
Se(i, a, n,
|
|
1031
|
+
Se(i, a, n, s, r, "next", c);
|
|
1032
|
+
}
|
|
1033
|
+
function r(c) {
|
|
1034
|
+
Se(i, a, n, s, r, "throw", c);
|
|
1037
1035
|
}
|
|
1038
|
-
|
|
1036
|
+
s(void 0);
|
|
1039
1037
|
});
|
|
1040
1038
|
};
|
|
1041
1039
|
}
|
|
@@ -1072,14 +1070,14 @@ class D {
|
|
|
1072
1070
|
} = e;
|
|
1073
1071
|
if (!a) return null;
|
|
1074
1072
|
var {
|
|
1075
|
-
canvas:
|
|
1076
|
-
montageArea:
|
|
1073
|
+
canvas: s,
|
|
1074
|
+
montageArea: r,
|
|
1077
1075
|
transformManager: c,
|
|
1078
1076
|
historyManager: u,
|
|
1079
1077
|
errorManager: l
|
|
1080
1078
|
} = t.editor, d = yield t.getContentType(a), h = D.getFormatFromContentType(d), {
|
|
1081
1079
|
acceptContentTypes: g,
|
|
1082
|
-
acceptFormats:
|
|
1080
|
+
acceptFormats: v
|
|
1083
1081
|
} = t;
|
|
1084
1082
|
if (!t.isAllowedContentType(d)) {
|
|
1085
1083
|
var f = "Неверный contentType для изображения: ".concat(d, ". Ожидается один из: ").concat(t.acceptContentTypes.join(", "), ".");
|
|
@@ -1093,13 +1091,13 @@ class D {
|
|
|
1093
1091
|
format: h,
|
|
1094
1092
|
contentType: d,
|
|
1095
1093
|
acceptContentTypes: g,
|
|
1096
|
-
acceptFormats:
|
|
1094
|
+
acceptFormats: v
|
|
1097
1095
|
}
|
|
1098
1096
|
}), null;
|
|
1099
1097
|
}
|
|
1100
1098
|
u.suspendHistory();
|
|
1101
1099
|
try {
|
|
1102
|
-
var m,
|
|
1100
|
+
var m, M;
|
|
1103
1101
|
if (a instanceof File)
|
|
1104
1102
|
m = URL.createObjectURL(a);
|
|
1105
1103
|
else if (typeof a == "string") {
|
|
@@ -1121,64 +1119,64 @@ class D {
|
|
|
1121
1119
|
format: h,
|
|
1122
1120
|
contentType: d,
|
|
1123
1121
|
acceptContentTypes: g,
|
|
1124
|
-
acceptFormats:
|
|
1122
|
+
acceptFormats: v
|
|
1125
1123
|
}
|
|
1126
1124
|
}), null;
|
|
1127
1125
|
if (t._createdBlobUrls.push(m), h === "svg") {
|
|
1128
1126
|
var E = yield ke(m);
|
|
1129
|
-
|
|
1127
|
+
M = P.groupSVGElements(E.objects, E.options);
|
|
1130
1128
|
} else
|
|
1131
|
-
|
|
1129
|
+
M = yield ee.fromURL(m, {
|
|
1132
1130
|
crossOrigin: "anonymous"
|
|
1133
1131
|
});
|
|
1134
1132
|
var {
|
|
1135
1133
|
width: L,
|
|
1136
1134
|
height: y
|
|
1137
|
-
} =
|
|
1135
|
+
} = M;
|
|
1138
1136
|
if (y > O || L > w) {
|
|
1139
|
-
var b = yield t.resizeImageToBoundaries(
|
|
1140
|
-
t._createdBlobUrls.push(Z),
|
|
1137
|
+
var b = yield t.resizeImageToBoundaries(M._element.src, "max"), Z = URL.createObjectURL(b);
|
|
1138
|
+
t._createdBlobUrls.push(Z), M = yield ee.fromURL(Z, {
|
|
1141
1139
|
crossOrigin: "anonymous"
|
|
1142
1140
|
});
|
|
1143
1141
|
} else if (y < B || L < x) {
|
|
1144
|
-
var W = yield t.resizeImageToBoundaries(
|
|
1145
|
-
t._createdBlobUrls.push(z),
|
|
1142
|
+
var W = yield t.resizeImageToBoundaries(M._element.src, "min"), z = URL.createObjectURL(W);
|
|
1143
|
+
t._createdBlobUrls.push(z), M = yield ee.fromURL(z, {
|
|
1146
1144
|
crossOrigin: "anonymous"
|
|
1147
1145
|
});
|
|
1148
1146
|
}
|
|
1149
|
-
if (
|
|
1147
|
+
if (M.set("id", "".concat(M.type, "-").concat(A())), M.set("format", h), n === "scale-montage")
|
|
1150
1148
|
t.editor.canvasManager.scaleMontageAreaToImage({
|
|
1151
|
-
object:
|
|
1149
|
+
object: M,
|
|
1152
1150
|
withoutSave: !0
|
|
1153
1151
|
});
|
|
1154
1152
|
else {
|
|
1155
1153
|
var {
|
|
1156
1154
|
width: F,
|
|
1157
1155
|
height: U
|
|
1158
|
-
} =
|
|
1159
|
-
imageObject:
|
|
1156
|
+
} = r, _ = t.calculateScaleFactor({
|
|
1157
|
+
imageObject: M,
|
|
1160
1158
|
scaleType: n
|
|
1161
1159
|
});
|
|
1162
1160
|
n === "image-contain" && _ < 1 ? c.fitObject({
|
|
1163
|
-
object:
|
|
1161
|
+
object: M,
|
|
1164
1162
|
type: "contain",
|
|
1165
1163
|
withoutSave: !0
|
|
1166
1164
|
}) : n === "image-cover" && (L > F || y > U) && c.fitObject({
|
|
1167
|
-
object:
|
|
1165
|
+
object: M,
|
|
1168
1166
|
type: "cover",
|
|
1169
1167
|
withoutSave: !0
|
|
1170
1168
|
});
|
|
1171
1169
|
}
|
|
1172
|
-
|
|
1170
|
+
s.add(M), s.centerObject(M), s.setActiveObject(M), s.renderAll(), u.resumeHistory(), i || u.saveState();
|
|
1173
1171
|
var V = {
|
|
1174
|
-
image:
|
|
1172
|
+
image: M,
|
|
1175
1173
|
format: h,
|
|
1176
1174
|
contentType: d,
|
|
1177
1175
|
scale: n,
|
|
1178
1176
|
withoutSave: i,
|
|
1179
1177
|
source: a
|
|
1180
1178
|
};
|
|
1181
|
-
return
|
|
1179
|
+
return s.fire("editor:image-imported", V), V;
|
|
1182
1180
|
} catch (H) {
|
|
1183
1181
|
return l.emitError({
|
|
1184
1182
|
origin: "ImageManager",
|
|
@@ -1209,7 +1207,7 @@ class D {
|
|
|
1209
1207
|
return k(function* () {
|
|
1210
1208
|
var n = t.length > 1 && t[1] !== void 0 ? t[1] : "max", i = "Размер изображения больше максимального размера канваса, поэтому оно будет уменьшено до максимальных размеров c сохранением пропорций: ".concat(w, "x").concat(O);
|
|
1211
1209
|
n === "min" && (i = "Размер изображения меньше минимального размера канваса, поэтому оно будет увеличено до минимальных размеров c сохранением пропорций: ".concat(x, "x").concat(B));
|
|
1212
|
-
var
|
|
1210
|
+
var s = {
|
|
1213
1211
|
dataURL: e,
|
|
1214
1212
|
sizeType: n,
|
|
1215
1213
|
maxWidth: w,
|
|
@@ -1222,8 +1220,8 @@ class D {
|
|
|
1222
1220
|
method: "resizeImageToBoundaries",
|
|
1223
1221
|
code: "IMAGE_RESIZE_WARNING",
|
|
1224
1222
|
message: i,
|
|
1225
|
-
data:
|
|
1226
|
-
}), a.editor.workerManager.post("resizeImage",
|
|
1223
|
+
data: s
|
|
1224
|
+
}), a.editor.workerManager.post("resizeImage", s);
|
|
1227
1225
|
})();
|
|
1228
1226
|
}
|
|
1229
1227
|
/**
|
|
@@ -1244,9 +1242,9 @@ class D {
|
|
|
1244
1242
|
fileName: a = "image.png",
|
|
1245
1243
|
contentType: n = "image/png",
|
|
1246
1244
|
exportAsBase64: i = !1,
|
|
1247
|
-
exportAsBlob:
|
|
1245
|
+
exportAsBlob: s = !1
|
|
1248
1246
|
} = e.length > 0 && e[0] !== void 0 ? e[0] : {}, {
|
|
1249
|
-
canvas:
|
|
1247
|
+
canvas: r,
|
|
1250
1248
|
montageArea: c,
|
|
1251
1249
|
workerManager: u
|
|
1252
1250
|
} = t.editor;
|
|
@@ -1255,25 +1253,25 @@ class D {
|
|
|
1255
1253
|
c.setCoords();
|
|
1256
1254
|
var {
|
|
1257
1255
|
left: g,
|
|
1258
|
-
top:
|
|
1256
|
+
top: v,
|
|
1259
1257
|
width: f,
|
|
1260
1258
|
height: m
|
|
1261
|
-
} = c.getBoundingRect(),
|
|
1262
|
-
["image/jpg", "image/jpeg"].includes(d) && (
|
|
1263
|
-
var S =
|
|
1264
|
-
S.visible = !1,
|
|
1259
|
+
} = c.getBoundingRect(), M = yield r.clone(["id", "format", "locked"]);
|
|
1260
|
+
["image/jpg", "image/jpeg"].includes(d) && (M.backgroundColor = "#ffffff");
|
|
1261
|
+
var S = M.getObjects().find((p) => p.id === c.id);
|
|
1262
|
+
S.visible = !1, M.viewportTransform = [1, 0, 0, 1, -g, -v], M.setDimensions({
|
|
1265
1263
|
width: f,
|
|
1266
1264
|
height: m
|
|
1267
1265
|
}, {
|
|
1268
1266
|
backstoreOnly: !0
|
|
1269
|
-
}),
|
|
1270
|
-
var N =
|
|
1267
|
+
}), M.renderAll();
|
|
1268
|
+
var N = M.getObjects().filter((p) => p.format).every((p) => p.format === "svg");
|
|
1271
1269
|
if (h === "svg" && N) {
|
|
1272
|
-
var E =
|
|
1273
|
-
|
|
1270
|
+
var E = M.toSVG();
|
|
1271
|
+
M.dispose();
|
|
1274
1272
|
var L = D._exportSVGStringAsFile(E, {
|
|
1275
1273
|
exportAsBase64: i,
|
|
1276
|
-
exportAsBlob:
|
|
1274
|
+
exportAsBlob: s,
|
|
1277
1275
|
fileName: a
|
|
1278
1276
|
}), y = {
|
|
1279
1277
|
image: L,
|
|
@@ -1281,19 +1279,19 @@ class D {
|
|
|
1281
1279
|
contentType: "image/svg+xml",
|
|
1282
1280
|
fileName: a.replace(/\.[^/.]+$/, ".svg")
|
|
1283
1281
|
};
|
|
1284
|
-
return
|
|
1282
|
+
return r.fire("editor:canvas-exported", y), y;
|
|
1285
1283
|
}
|
|
1286
1284
|
var b = yield new Promise((p) => {
|
|
1287
|
-
|
|
1285
|
+
M.getElement().toBlob(p);
|
|
1288
1286
|
});
|
|
1289
|
-
if (
|
|
1287
|
+
if (M.dispose(), s) {
|
|
1290
1288
|
var Z = {
|
|
1291
1289
|
image: b,
|
|
1292
1290
|
format: h,
|
|
1293
1291
|
contentType: d,
|
|
1294
1292
|
fileName: a
|
|
1295
1293
|
};
|
|
1296
|
-
return
|
|
1294
|
+
return r.fire("editor:canvas-exported", Z), Z;
|
|
1297
1295
|
}
|
|
1298
1296
|
var W = yield createImageBitmap(b), z = yield u.post("toDataURL", {
|
|
1299
1297
|
format: h,
|
|
@@ -1313,7 +1311,7 @@ class D {
|
|
|
1313
1311
|
contentType: "application/pdf",
|
|
1314
1312
|
fileName: a
|
|
1315
1313
|
};
|
|
1316
|
-
return
|
|
1314
|
+
return r.fire("editor:canvas-exported", le), le;
|
|
1317
1315
|
}
|
|
1318
1316
|
var Ne = H.output("blob"), Ee = new File([Ne], a, {
|
|
1319
1317
|
type: "application/pdf"
|
|
@@ -1323,7 +1321,7 @@ class D {
|
|
|
1323
1321
|
contentType: "application/pdf",
|
|
1324
1322
|
fileName: a
|
|
1325
1323
|
};
|
|
1326
|
-
return
|
|
1324
|
+
return r.fire("editor:canvas-exported", he), he;
|
|
1327
1325
|
}
|
|
1328
1326
|
if (i) {
|
|
1329
1327
|
var ge = {
|
|
@@ -1332,17 +1330,17 @@ class D {
|
|
|
1332
1330
|
contentType: d,
|
|
1333
1331
|
fileName: a
|
|
1334
1332
|
};
|
|
1335
|
-
return
|
|
1333
|
+
return r.fire("editor:canvas-exported", ge), ge;
|
|
1336
1334
|
}
|
|
1337
|
-
var
|
|
1335
|
+
var Me = h === "svg" && !N ? a.replace(/\.[^/.]+$/, ".png") : a, Le = new File([b], Me, {
|
|
1338
1336
|
type: d
|
|
1339
|
-
}),
|
|
1337
|
+
}), ve = {
|
|
1340
1338
|
image: Le,
|
|
1341
1339
|
format: h,
|
|
1342
1340
|
contentType: d,
|
|
1343
|
-
fileName:
|
|
1341
|
+
fileName: Me
|
|
1344
1342
|
};
|
|
1345
|
-
return
|
|
1343
|
+
return r.fire("editor:canvas-exported", ve), ve;
|
|
1346
1344
|
} catch (p) {
|
|
1347
1345
|
return t.editor.errorManager.emitError({
|
|
1348
1346
|
origin: "ImageManager",
|
|
@@ -1353,7 +1351,7 @@ class D {
|
|
|
1353
1351
|
contentType: n,
|
|
1354
1352
|
fileName: a,
|
|
1355
1353
|
exportAsBase64: i,
|
|
1356
|
-
exportAsBlob:
|
|
1354
|
+
exportAsBlob: s
|
|
1357
1355
|
}
|
|
1358
1356
|
}), "";
|
|
1359
1357
|
}
|
|
@@ -1377,8 +1375,8 @@ class D {
|
|
|
1377
1375
|
object: a,
|
|
1378
1376
|
fileName: n = "image.png",
|
|
1379
1377
|
contentType: i = "image/png",
|
|
1380
|
-
exportAsBase64:
|
|
1381
|
-
exportAsBlob:
|
|
1378
|
+
exportAsBase64: s = !1,
|
|
1379
|
+
exportAsBlob: r = !1
|
|
1382
1380
|
} = e.length > 0 && e[0] !== void 0 ? e[0] : {}, {
|
|
1383
1381
|
canvas: c,
|
|
1384
1382
|
workerManager: u
|
|
@@ -1392,42 +1390,42 @@ class D {
|
|
|
1392
1390
|
data: {
|
|
1393
1391
|
contentType: i,
|
|
1394
1392
|
fileName: n,
|
|
1395
|
-
exportAsBase64:
|
|
1396
|
-
exportAsBlob:
|
|
1393
|
+
exportAsBase64: s,
|
|
1394
|
+
exportAsBlob: r
|
|
1397
1395
|
}
|
|
1398
1396
|
}), "";
|
|
1399
1397
|
try {
|
|
1400
1398
|
var d = D.getFormatFromContentType(i);
|
|
1401
1399
|
if (d === "svg") {
|
|
1402
1400
|
var h = l.toSVG(), g = t._exportSVGStringAsFile(h, {
|
|
1403
|
-
exportAsBase64:
|
|
1404
|
-
exportAsBlob:
|
|
1401
|
+
exportAsBase64: s,
|
|
1402
|
+
exportAsBlob: r,
|
|
1405
1403
|
fileName: n
|
|
1406
|
-
}),
|
|
1404
|
+
}), v = {
|
|
1407
1405
|
image: g,
|
|
1408
1406
|
format: d,
|
|
1409
1407
|
contentType: "image/svg+xml",
|
|
1410
1408
|
fileName: n.replace(/\.[^/.]+$/, ".svg")
|
|
1411
1409
|
};
|
|
1412
|
-
return c.fire("editor:object-exported",
|
|
1410
|
+
return c.fire("editor:object-exported", v), v;
|
|
1413
1411
|
}
|
|
1414
|
-
if (
|
|
1412
|
+
if (s) {
|
|
1415
1413
|
var f = yield createImageBitmap(l._element), m = yield u.post("toDataURL", {
|
|
1416
1414
|
format: d,
|
|
1417
1415
|
quality: 1,
|
|
1418
1416
|
bitmap: f
|
|
1419
|
-
}, [f]),
|
|
1417
|
+
}, [f]), M = {
|
|
1420
1418
|
image: m,
|
|
1421
1419
|
format: d,
|
|
1422
1420
|
contentType: i,
|
|
1423
1421
|
fileName: n
|
|
1424
1422
|
};
|
|
1425
|
-
return c.fire("editor:object-exported",
|
|
1423
|
+
return c.fire("editor:object-exported", M), M;
|
|
1426
1424
|
}
|
|
1427
1425
|
var S = l.toCanvasElement(), N = yield new Promise((b) => {
|
|
1428
1426
|
S.toBlob(b);
|
|
1429
1427
|
});
|
|
1430
|
-
if (
|
|
1428
|
+
if (r) {
|
|
1431
1429
|
var E = {
|
|
1432
1430
|
image: N,
|
|
1433
1431
|
format: d,
|
|
@@ -1454,8 +1452,8 @@ class D {
|
|
|
1454
1452
|
data: {
|
|
1455
1453
|
contentType: i,
|
|
1456
1454
|
fileName: n,
|
|
1457
|
-
exportAsBase64:
|
|
1458
|
-
exportAsBlob:
|
|
1455
|
+
exportAsBase64: s,
|
|
1456
|
+
exportAsBlob: r
|
|
1459
1457
|
}
|
|
1460
1458
|
}), "";
|
|
1461
1459
|
}
|
|
@@ -1549,8 +1547,8 @@ class D {
|
|
|
1549
1547
|
}), i = n.headers.get("content-type");
|
|
1550
1548
|
if (i && i.startsWith("image/"))
|
|
1551
1549
|
return i.split(";")[0];
|
|
1552
|
-
} catch (
|
|
1553
|
-
console.warn("HEAD запрос неудачен, определяем тип по расширению:",
|
|
1550
|
+
} catch (s) {
|
|
1551
|
+
console.warn("HEAD запрос неудачен, определяем тип по расширению:", s);
|
|
1554
1552
|
}
|
|
1555
1553
|
return t.getContentTypeFromExtension(e);
|
|
1556
1554
|
})();
|
|
@@ -1564,12 +1562,12 @@ class D {
|
|
|
1564
1562
|
getContentTypeFromExtension(e) {
|
|
1565
1563
|
try {
|
|
1566
1564
|
var t, a = new URL(e), n = (t = a.pathname.split(".").pop()) === null || t === void 0 ? void 0 : t.toLowerCase(), i = {};
|
|
1567
|
-
return this.acceptContentTypes.forEach((
|
|
1568
|
-
var
|
|
1569
|
-
|
|
1565
|
+
return this.acceptContentTypes.forEach((s) => {
|
|
1566
|
+
var r = D.getFormatFromContentType(s);
|
|
1567
|
+
r && (i[r] = s);
|
|
1570
1568
|
}), i[n] || "application/octet-stream";
|
|
1571
|
-
} catch (
|
|
1572
|
-
return console.warn("Не удалось определить расширение из URL:", e,
|
|
1569
|
+
} catch (s) {
|
|
1570
|
+
return console.warn("Не удалось определить расширение из URL:", e, s), "application/octet-stream";
|
|
1573
1571
|
}
|
|
1574
1572
|
}
|
|
1575
1573
|
/**
|
|
@@ -1586,11 +1584,11 @@ class D {
|
|
|
1586
1584
|
montageArea: n
|
|
1587
1585
|
} = this.editor;
|
|
1588
1586
|
if (!n || !t) return 1;
|
|
1589
|
-
var i = n.width,
|
|
1590
|
-
width:
|
|
1587
|
+
var i = n.width, s = n.height, {
|
|
1588
|
+
width: r,
|
|
1591
1589
|
height: c
|
|
1592
1590
|
} = t;
|
|
1593
|
-
return a === "contain" || a === "image-contain" ? Math.min(i /
|
|
1591
|
+
return a === "contain" || a === "image-contain" ? Math.min(i / r, s / c) : a === "cover" || a === "image-cover" ? Math.max(i / r, s / c) : 1;
|
|
1594
1592
|
}
|
|
1595
1593
|
}
|
|
1596
1594
|
class mt {
|
|
@@ -1611,19 +1609,19 @@ class mt {
|
|
|
1611
1609
|
* @fires editor:resolution-width-changed
|
|
1612
1610
|
*/
|
|
1613
1611
|
setResolutionWidth(e, { preserveProportional: t, withoutSave: a, adaptCanvasToContainer: n } = {}) {
|
|
1614
|
-
var
|
|
1612
|
+
var v;
|
|
1615
1613
|
if (!e) return;
|
|
1616
1614
|
const {
|
|
1617
1615
|
canvas: i,
|
|
1618
|
-
montageArea:
|
|
1619
|
-
options: { canvasBackstoreWidth:
|
|
1620
|
-
} = this.editor, { width: c, height: u } =
|
|
1621
|
-
if (!
|
|
1616
|
+
montageArea: s,
|
|
1617
|
+
options: { canvasBackstoreWidth: r }
|
|
1618
|
+
} = this.editor, { width: c, height: u } = s, l = Math.max(Math.min(Number(e), w), x);
|
|
1619
|
+
if (!r || r === "auto" || n ? this.adaptCanvasToContainer() : r ? this.setCanvasBackstoreWidth(Number(r)) : this.setCanvasBackstoreWidth(l), s.set({ width: l }), (v = i.clipPath) == null || v.set({ width: l }), t) {
|
|
1622
1620
|
const f = l / c, m = u * f;
|
|
1623
1621
|
this.setResolutionHeight(m);
|
|
1624
1622
|
return;
|
|
1625
1623
|
}
|
|
1626
|
-
const { left: d, top: h } = this.getObjectDefaultCoords(
|
|
1624
|
+
const { left: d, top: h } = this.getObjectDefaultCoords(s), g = i.getZoom();
|
|
1627
1625
|
i.setViewportTransform([g, 0, 0, g, d, h]), this.centerMontageArea(), a || this.editor.historyManager.saveState(), i.fire("editor:resolution-width-changed", {
|
|
1628
1626
|
width: l,
|
|
1629
1627
|
preserveProportional: t,
|
|
@@ -1641,19 +1639,19 @@ class mt {
|
|
|
1641
1639
|
* @fires editor:resolution-height-changed
|
|
1642
1640
|
*/
|
|
1643
1641
|
setResolutionHeight(e, { preserveProportional: t, withoutSave: a, adaptCanvasToContainer: n } = {}) {
|
|
1644
|
-
var
|
|
1642
|
+
var v;
|
|
1645
1643
|
if (!e) return;
|
|
1646
1644
|
const {
|
|
1647
1645
|
canvas: i,
|
|
1648
|
-
montageArea:
|
|
1649
|
-
options: { canvasBackstoreHeight:
|
|
1650
|
-
} = this.editor, { width: c, height: u } =
|
|
1651
|
-
if (!
|
|
1646
|
+
montageArea: s,
|
|
1647
|
+
options: { canvasBackstoreHeight: r }
|
|
1648
|
+
} = this.editor, { width: c, height: u } = s, l = Math.max(Math.min(Number(e), O), B);
|
|
1649
|
+
if (!r || r === "auto" || n ? this.adaptCanvasToContainer() : r ? this.setCanvasBackstoreHeight(Number(r)) : this.setCanvasBackstoreHeight(l), s.set({ height: l }), (v = i.clipPath) == null || v.set({ height: l }), t) {
|
|
1652
1650
|
const f = l / u, m = c * f;
|
|
1653
1651
|
this.setResolutionWidth(m);
|
|
1654
1652
|
return;
|
|
1655
1653
|
}
|
|
1656
|
-
const { left: d, top: h } = this.getObjectDefaultCoords(
|
|
1654
|
+
const { left: d, top: h } = this.getObjectDefaultCoords(s), g = i.getZoom();
|
|
1657
1655
|
i.setViewportTransform([g, 0, 0, g, d, h]), this.centerMontageArea(), a || this.editor.historyManager.saveState(), i.fire("editor:resolution-height-changed", {
|
|
1658
1656
|
height: l,
|
|
1659
1657
|
preserveProportional: t,
|
|
@@ -1667,7 +1665,7 @@ class mt {
|
|
|
1667
1665
|
*/
|
|
1668
1666
|
centerMontageArea() {
|
|
1669
1667
|
var c;
|
|
1670
|
-
const { canvas: e, montageArea: t } = this.editor, a = e.getWidth(), n = e.getHeight(), i = e.getZoom(),
|
|
1668
|
+
const { canvas: e, montageArea: t } = this.editor, a = e.getWidth(), n = e.getHeight(), i = e.getZoom(), s = new K(a / 2, n / 2);
|
|
1671
1669
|
t.set({
|
|
1672
1670
|
left: a / 2,
|
|
1673
1671
|
top: n / 2
|
|
@@ -1675,8 +1673,8 @@ class mt {
|
|
|
1675
1673
|
left: a / 2,
|
|
1676
1674
|
top: n / 2
|
|
1677
1675
|
}), e.renderAll();
|
|
1678
|
-
const
|
|
1679
|
-
|
|
1676
|
+
const r = e.viewportTransform;
|
|
1677
|
+
r[4] = a / 2 - s.x * i, r[5] = n / 2 - s.y * i, e.setViewportTransform(r), e.renderAll();
|
|
1680
1678
|
}
|
|
1681
1679
|
/**
|
|
1682
1680
|
* Метод для получения координат объекта с учетом текущего зума
|
|
@@ -1692,8 +1690,8 @@ class mt {
|
|
|
1692
1690
|
code: "NO_ACTIVE_OBJECT",
|
|
1693
1691
|
message: "Не выбран объект для получения координат"
|
|
1694
1692
|
}), { left: 0, top: 0 };
|
|
1695
|
-
const { width: n, height: i } = a,
|
|
1696
|
-
return { left:
|
|
1693
|
+
const { width: n, height: i } = a, s = t.getZoom(), r = (n - n * s) / 2, c = (i - i * s) / 2;
|
|
1694
|
+
return { left: r, top: c };
|
|
1697
1695
|
}
|
|
1698
1696
|
/**
|
|
1699
1697
|
* Устанавливаем ширину канваса в backstore (для экспорта)
|
|
@@ -1719,8 +1717,8 @@ class mt {
|
|
|
1719
1717
|
* с учётом минимальных и максимальных значений.
|
|
1720
1718
|
*/
|
|
1721
1719
|
adaptCanvasToContainer() {
|
|
1722
|
-
const { canvas: e } = this.editor, t = e.editorContainer, a = t.clientWidth, n = t.clientHeight, i = Math.max(Math.min(a, w), x),
|
|
1723
|
-
console.log("adaptCanvasToContainer newWidth", i), console.log("adaptCanvasToContainer newHeight",
|
|
1720
|
+
const { canvas: e } = this.editor, t = e.editorContainer, a = t.clientWidth, n = t.clientHeight, i = Math.max(Math.min(a, w), x), s = Math.max(Math.min(n, O), B);
|
|
1721
|
+
console.log("adaptCanvasToContainer newWidth", i), console.log("adaptCanvasToContainer newHeight", s), e.setDimensions({ width: i, height: s }, { backstoreOnly: !0 });
|
|
1724
1722
|
}
|
|
1725
1723
|
/**
|
|
1726
1724
|
* Обновляет размеры канваса и вписывает объекты в монтажную область.
|
|
@@ -1754,11 +1752,11 @@ class mt {
|
|
|
1754
1752
|
* @param {Number} zoom — текущее значение zoom (например, 1, 1.2, 2 и т.д.)
|
|
1755
1753
|
*/
|
|
1756
1754
|
updateCssDimensionsForZoom(e) {
|
|
1757
|
-
const { canvas: t, montageArea: a } = this.editor, n = a.width * e, i = a.height * e,
|
|
1758
|
-
if (!(
|
|
1759
|
-
const
|
|
1755
|
+
const { canvas: t, montageArea: a } = this.editor, n = a.width * e, i = a.height * e, s = t.wrapperEl.parentNode;
|
|
1756
|
+
if (!(s instanceof HTMLElement)) return;
|
|
1757
|
+
const r = n <= s.clientWidth ? "100%" : n, c = i <= s.clientHeight ? "100%" : i;
|
|
1760
1758
|
t.setDimensions(
|
|
1761
|
-
{ width:
|
|
1759
|
+
{ width: r, height: c },
|
|
1762
1760
|
{ cssOnly: !0 }
|
|
1763
1761
|
);
|
|
1764
1762
|
}
|
|
@@ -1845,32 +1843,32 @@ class mt {
|
|
|
1845
1843
|
*/
|
|
1846
1844
|
setDisplayDimension({ element: e = "canvas", dimension: t, value: a } = {}) {
|
|
1847
1845
|
if (!a) return;
|
|
1848
|
-
const { canvas: n, options: { editorContainer: i } } = this.editor,
|
|
1846
|
+
const { canvas: n, options: { editorContainer: i } } = this.editor, s = [];
|
|
1849
1847
|
switch (e) {
|
|
1850
1848
|
case "canvas":
|
|
1851
|
-
|
|
1849
|
+
s.push(n.lowerCanvasEl, n.upperCanvasEl);
|
|
1852
1850
|
break;
|
|
1853
1851
|
case "wrapper":
|
|
1854
|
-
|
|
1852
|
+
s.push(n.wrapperEl);
|
|
1855
1853
|
break;
|
|
1856
1854
|
case "container":
|
|
1857
|
-
|
|
1855
|
+
s.push(i);
|
|
1858
1856
|
break;
|
|
1859
1857
|
default:
|
|
1860
|
-
|
|
1858
|
+
s.push(n.lowerCanvasEl, n.upperCanvasEl);
|
|
1861
1859
|
}
|
|
1862
|
-
const
|
|
1860
|
+
const r = t === "width" ? "width" : "height";
|
|
1863
1861
|
if (typeof a == "string") {
|
|
1864
|
-
|
|
1865
|
-
u.style[
|
|
1862
|
+
s.forEach((u) => {
|
|
1863
|
+
u.style[r] = a;
|
|
1866
1864
|
});
|
|
1867
1865
|
return;
|
|
1868
1866
|
}
|
|
1869
1867
|
if (isNaN(a)) return;
|
|
1870
1868
|
const c = `${a}px`;
|
|
1871
|
-
|
|
1872
|
-
u.style[
|
|
1873
|
-
}), n.fire(`editor:display-${e}-${
|
|
1869
|
+
s.forEach((u) => {
|
|
1870
|
+
u.style[r] = c;
|
|
1871
|
+
}), n.fire(`editor:display-${e}-${r}-changed`, {
|
|
1874
1872
|
element: e,
|
|
1875
1873
|
value: a
|
|
1876
1874
|
});
|
|
@@ -1887,9 +1885,9 @@ class mt {
|
|
|
1887
1885
|
const {
|
|
1888
1886
|
canvas: n,
|
|
1889
1887
|
montageArea: i,
|
|
1890
|
-
transformManager:
|
|
1888
|
+
transformManager: s,
|
|
1891
1889
|
options: {
|
|
1892
|
-
montageAreaWidth:
|
|
1890
|
+
montageAreaWidth: r,
|
|
1893
1891
|
montageAreaHeight: c
|
|
1894
1892
|
}
|
|
1895
1893
|
} = this.editor, u = e || n.getActiveObject();
|
|
@@ -1898,12 +1896,12 @@ class mt {
|
|
|
1898
1896
|
let h = Math.min(l, w), g = Math.min(d, O);
|
|
1899
1897
|
if (t) {
|
|
1900
1898
|
const {
|
|
1901
|
-
width:
|
|
1899
|
+
width: v,
|
|
1902
1900
|
height: f
|
|
1903
|
-
} = i, m = l /
|
|
1904
|
-
h =
|
|
1901
|
+
} = i, m = l / v, M = d / f, S = Math.max(m, M);
|
|
1902
|
+
h = v * S, g = f * S;
|
|
1905
1903
|
}
|
|
1906
|
-
this.setResolutionWidth(h, { withoutSave: !0 }), this.setResolutionHeight(g, { withoutSave: !0 }), (l >
|
|
1904
|
+
this.setResolutionWidth(h, { withoutSave: !0 }), this.setResolutionHeight(g, { withoutSave: !0 }), (l > r || d > c) && s.calculateAndApplyDefaultZoom(), s.resetObject(u, { withoutSave: !0 }), n.centerObject(u), n.renderAll(), a || this.editor.historyManager.saveState(), n.fire("editor:montage-area-scaled-to-image", {
|
|
1907
1905
|
object: u,
|
|
1908
1906
|
width: h,
|
|
1909
1907
|
height: g,
|
|
@@ -1932,10 +1930,10 @@ class mt {
|
|
|
1932
1930
|
historyManager: n,
|
|
1933
1931
|
options: {
|
|
1934
1932
|
montageAreaWidth: i,
|
|
1935
|
-
montageAreaHeight:
|
|
1933
|
+
montageAreaHeight: s
|
|
1936
1934
|
}
|
|
1937
1935
|
} = this.editor;
|
|
1938
|
-
a.resetZoom(), this.setResolutionWidth(i, { withoutSave: !0 }), this.setResolutionHeight(
|
|
1936
|
+
a.resetZoom(), this.setResolutionWidth(i, { withoutSave: !0 }), this.setResolutionHeight(s, { withoutSave: !0 }), t.renderAll(), a.resetObjects(), e || n.saveState(), t.fire("editor:default-scale-set");
|
|
1939
1937
|
}
|
|
1940
1938
|
/**
|
|
1941
1939
|
* Получение всех объектов внутри монтажной области редактора
|
|
@@ -1958,7 +1956,7 @@ class ft {
|
|
|
1958
1956
|
* @param {Number} [scale] - Желаемый масштаб относительно размеров контейнера редактора.
|
|
1959
1957
|
*/
|
|
1960
1958
|
calculateAndApplyDefaultZoom(e = this.options.defaultScale) {
|
|
1961
|
-
const { canvas: t } = this.editor, a = t.editorContainer, n = a.clientWidth, i = a.clientHeight, { width:
|
|
1959
|
+
const { canvas: t } = this.editor, a = t.editorContainer, n = a.clientWidth, i = a.clientHeight, { width: s, height: r } = this.editor.montageArea, c = n / s * e, u = i / r * e;
|
|
1962
1960
|
this.defaultZoom = Math.min(c, u);
|
|
1963
1961
|
const { defaultZoom: l, maxZoomFactor: d, minZoom: h, maxZoom: g } = this;
|
|
1964
1962
|
this.minZoom = Math.min(l / d, h), this.maxZoom = Math.max(l * d, g), this.setZoom();
|
|
@@ -1972,13 +1970,13 @@ class ft {
|
|
|
1972
1970
|
* @fires editor:zoom-changed
|
|
1973
1971
|
* Если передавать координаты курсора, то нужно быть аккуратнее, так как юзер может выйти за пределы рабочей области
|
|
1974
1972
|
*/
|
|
1975
|
-
zoom(e =
|
|
1973
|
+
zoom(e = Mt, t = {}) {
|
|
1976
1974
|
var h, g;
|
|
1977
1975
|
if (!e) return;
|
|
1978
|
-
const { minZoom: a, maxZoom: n } = this, { canvas: i } = this.editor,
|
|
1979
|
-
let d = Number((
|
|
1976
|
+
const { minZoom: a, maxZoom: n } = this, { canvas: i } = this.editor, s = i.getZoom(), r = i.getCenterPoint(), c = (h = t.pointX) != null ? h : r.x, u = (g = t.pointY) != null ? g : r.y, l = new K(c, u);
|
|
1977
|
+
let d = Number((s + Number(e)).toFixed(2));
|
|
1980
1978
|
d > n && (d = n), d < a && (d = a), i.zoomToPoint(l, d), console.log({
|
|
1981
|
-
currentZoom:
|
|
1979
|
+
currentZoom: s,
|
|
1982
1980
|
zoom: d,
|
|
1983
1981
|
point: l
|
|
1984
1982
|
}), i.fire("editor:zoom-changed", {
|
|
@@ -1994,10 +1992,10 @@ class ft {
|
|
|
1994
1992
|
*/
|
|
1995
1993
|
setZoom(e = this.defaultZoom) {
|
|
1996
1994
|
const { minZoom: t, maxZoom: a } = this, { canvas: n } = this.editor, i = new K(n.getCenterPoint());
|
|
1997
|
-
let
|
|
1998
|
-
e > a && (
|
|
1995
|
+
let s = e;
|
|
1996
|
+
e > a && (s = a), e < t && (s = t), n.zoomToPoint(i, s), n.fire("editor:zoom-changed", {
|
|
1999
1997
|
currentZoom: n.getZoom(),
|
|
2000
|
-
zoom:
|
|
1998
|
+
zoom: s,
|
|
2001
1999
|
point: i
|
|
2002
2000
|
});
|
|
2003
2001
|
}
|
|
@@ -2019,14 +2017,14 @@ class ft {
|
|
|
2019
2017
|
* @param {Boolean} options.withoutSave - Не сохранять состояние
|
|
2020
2018
|
* @fires editor:object-rotated
|
|
2021
2019
|
*/
|
|
2022
|
-
rotate(e =
|
|
2020
|
+
rotate(e = vt, { withoutSave: t } = {}) {
|
|
2023
2021
|
const { canvas: a, historyManager: n } = this.editor, i = a.getActiveObject();
|
|
2024
2022
|
if (!i) return;
|
|
2025
|
-
const
|
|
2026
|
-
i.rotate(
|
|
2023
|
+
const s = i.angle + e;
|
|
2024
|
+
i.rotate(s), i.setCoords(), a.renderAll(), t || n.saveState(), a.fire("editor:object-rotated", {
|
|
2027
2025
|
object: i,
|
|
2028
2026
|
withoutSave: t,
|
|
2029
|
-
angle:
|
|
2027
|
+
angle: s
|
|
2030
2028
|
});
|
|
2031
2029
|
}
|
|
2032
2030
|
/**
|
|
@@ -2065,11 +2063,11 @@ class ft {
|
|
|
2065
2063
|
opacity: t = 1,
|
|
2066
2064
|
withoutSave: a
|
|
2067
2065
|
} = {}) {
|
|
2068
|
-
const { canvas: n, historyManager: i } = this.editor,
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
}) :
|
|
2072
|
-
object:
|
|
2066
|
+
const { canvas: n, historyManager: i } = this.editor, s = e || n.getActiveObject();
|
|
2067
|
+
s && (s instanceof T ? s.getObjects().forEach((r) => {
|
|
2068
|
+
r.set("opacity", t);
|
|
2069
|
+
}) : s.set("opacity", t), n.renderAll(), a || i.saveState(), n.fire("editor:object-opacity-changed", {
|
|
2070
|
+
object: s,
|
|
2073
2071
|
opacity: t,
|
|
2074
2072
|
withoutSave: a
|
|
2075
2073
|
}));
|
|
@@ -2091,24 +2089,24 @@ class ft {
|
|
|
2091
2089
|
withoutSave: a,
|
|
2092
2090
|
fitAsOneObject: n
|
|
2093
2091
|
} = {}) {
|
|
2094
|
-
const { canvas: i, imageManager:
|
|
2092
|
+
const { canvas: i, imageManager: s, historyManager: r } = this.editor, c = e || i.getActiveObject();
|
|
2095
2093
|
if (c) {
|
|
2096
2094
|
if (c.set("angle", 0), c instanceof T && !n) {
|
|
2097
2095
|
const u = c.getObjects();
|
|
2098
2096
|
i.discardActiveObject(), u.forEach((d) => {
|
|
2099
|
-
const h =
|
|
2097
|
+
const h = s.calculateScaleFactor({ imageObject: d, scaleType: t });
|
|
2100
2098
|
d.scale(h), i.centerObject(d);
|
|
2101
2099
|
});
|
|
2102
2100
|
const l = new T(u, { canvas: i });
|
|
2103
2101
|
i.setActiveObject(l);
|
|
2104
2102
|
} else {
|
|
2105
|
-
const u =
|
|
2103
|
+
const u = s.calculateScaleFactor({
|
|
2106
2104
|
imageObject: c,
|
|
2107
2105
|
scaleType: t
|
|
2108
2106
|
});
|
|
2109
2107
|
c.scale(u), i.centerObject(c);
|
|
2110
2108
|
}
|
|
2111
|
-
i.renderAll(), a ||
|
|
2109
|
+
i.renderAll(), a || r.saveState(), i.fire("editor:object-fitted", {
|
|
2112
2110
|
object: c,
|
|
2113
2111
|
type: t,
|
|
2114
2112
|
withoutSave: a,
|
|
@@ -2137,12 +2135,12 @@ class ft {
|
|
|
2137
2135
|
const {
|
|
2138
2136
|
canvas: n,
|
|
2139
2137
|
montageArea: i,
|
|
2140
|
-
imageManager:
|
|
2141
|
-
historyManager:
|
|
2138
|
+
imageManager: s,
|
|
2139
|
+
historyManager: r,
|
|
2142
2140
|
options: { scaleType: c }
|
|
2143
2141
|
} = this.editor, u = e || n.getActiveObject();
|
|
2144
2142
|
if (!u || u.locked) return;
|
|
2145
|
-
if (
|
|
2143
|
+
if (r.suspendHistory(), u.type === "image" || u.format === "svg" || u.set({
|
|
2146
2144
|
scaleX: 1,
|
|
2147
2145
|
scaleY: 1,
|
|
2148
2146
|
flipX: !1,
|
|
@@ -2151,13 +2149,13 @@ class ft {
|
|
|
2151
2149
|
}), t)
|
|
2152
2150
|
this.fitObject({ object: u, withoutSave: !0, fitAsOneObject: !0 });
|
|
2153
2151
|
else {
|
|
2154
|
-
const { width: d, height: h } = i, { width: g, height:
|
|
2152
|
+
const { width: d, height: h } = i, { width: g, height: v } = u, f = s.calculateScaleFactor({
|
|
2155
2153
|
imageObject: u,
|
|
2156
2154
|
scaleType: c
|
|
2157
2155
|
});
|
|
2158
|
-
c === "contain" && f < 1 || c === "cover" && (g > d ||
|
|
2156
|
+
c === "contain" && f < 1 || c === "cover" && (g > d || v > h) ? this.fitObject({ object: u, withoutSave: !0, fitAsOneObject: !0 }) : u.set({ scaleX: 1, scaleY: 1 });
|
|
2159
2157
|
}
|
|
2160
|
-
u.set({ flipX: !1, flipY: !1, angle: 0 }), n.centerObject(u), n.renderAll(),
|
|
2158
|
+
u.set({ flipX: !1, flipY: !1, angle: 0 }), n.centerObject(u), n.renderAll(), r.resumeHistory(), a || r.saveState(), n.fire("editor:object-reset", {
|
|
2161
2159
|
object: u,
|
|
2162
2160
|
withoutSave: a,
|
|
2163
2161
|
alwaysFitObject: t
|
|
@@ -2215,14 +2213,14 @@ class jt {
|
|
|
2215
2213
|
var {
|
|
2216
2214
|
left: n,
|
|
2217
2215
|
top: i,
|
|
2218
|
-
width:
|
|
2219
|
-
height:
|
|
2216
|
+
width: s,
|
|
2217
|
+
height: r
|
|
2220
2218
|
} = t.getBoundingRect();
|
|
2221
2219
|
this.overlayMask.set({
|
|
2222
2220
|
left: n,
|
|
2223
2221
|
top: i,
|
|
2224
|
-
width:
|
|
2225
|
-
height:
|
|
2222
|
+
width: s,
|
|
2223
|
+
height: r
|
|
2226
2224
|
}), e.discardActiveObject(), this.editor.layerManager.bringToFront(this.overlayMask, {
|
|
2227
2225
|
withoutSave: !0
|
|
2228
2226
|
}), a.resumeHistory();
|
|
@@ -2291,8 +2289,8 @@ class $ {
|
|
|
2291
2289
|
} = this.editor;
|
|
2292
2290
|
n.suspendHistory();
|
|
2293
2291
|
var i = e || a.getActiveObject();
|
|
2294
|
-
i && (i.type === "activeselection" ? i.getObjects().forEach((
|
|
2295
|
-
a.bringObjectToFront(
|
|
2292
|
+
i && (i.type === "activeselection" ? i.getObjects().forEach((s) => {
|
|
2293
|
+
a.bringObjectToFront(s);
|
|
2296
2294
|
}) : a.bringObjectToFront(i), a.renderAll(), n.resumeHistory(), t || n.saveState(), a.fire("editor:object-bring-to-front", {
|
|
2297
2295
|
object: i,
|
|
2298
2296
|
withoutSave: t
|
|
@@ -2334,19 +2332,19 @@ class $ {
|
|
|
2334
2332
|
montageArea: n,
|
|
2335
2333
|
historyManager: i,
|
|
2336
2334
|
interactionBlocker: {
|
|
2337
|
-
overlayMask:
|
|
2335
|
+
overlayMask: s
|
|
2338
2336
|
}
|
|
2339
2337
|
} = this.editor;
|
|
2340
2338
|
i.suspendHistory();
|
|
2341
|
-
var
|
|
2342
|
-
if (
|
|
2343
|
-
if (
|
|
2344
|
-
for (var c =
|
|
2339
|
+
var r = e || a.getActiveObject();
|
|
2340
|
+
if (r) {
|
|
2341
|
+
if (r.type === "activeselection")
|
|
2342
|
+
for (var c = r.getObjects(), u = c.length - 1; u >= 0; u -= 1)
|
|
2345
2343
|
a.sendObjectToBack(c[u]);
|
|
2346
2344
|
else
|
|
2347
|
-
a.sendObjectToBack(
|
|
2348
|
-
a.sendObjectToBack(n), a.sendObjectToBack(
|
|
2349
|
-
object:
|
|
2345
|
+
a.sendObjectToBack(r);
|
|
2346
|
+
a.sendObjectToBack(n), a.sendObjectToBack(s), a.renderAll(), i.resumeHistory(), t || i.saveState(), a.fire("editor:object-send-to-back", {
|
|
2347
|
+
object: r,
|
|
2350
2348
|
withoutSave: t
|
|
2351
2349
|
});
|
|
2352
2350
|
}
|
|
@@ -2365,13 +2363,13 @@ class $ {
|
|
|
2365
2363
|
montageArea: n,
|
|
2366
2364
|
historyManager: i,
|
|
2367
2365
|
interactionBlocker: {
|
|
2368
|
-
overlayMask:
|
|
2366
|
+
overlayMask: s
|
|
2369
2367
|
}
|
|
2370
2368
|
} = this.editor;
|
|
2371
2369
|
i.suspendHistory();
|
|
2372
|
-
var
|
|
2373
|
-
|
|
2374
|
-
object:
|
|
2370
|
+
var r = e || a.getActiveObject();
|
|
2371
|
+
r && (r.type === "activeselection" ? $._moveSelectionBackwards(a, r) : a.sendObjectBackwards(r), a.sendObjectToBack(n), a.sendObjectToBack(s), a.renderAll(), i.resumeHistory(), t || i.saveState(), a.fire("editor:object-send-backwards", {
|
|
2372
|
+
object: r,
|
|
2375
2373
|
withoutSave: t
|
|
2376
2374
|
}));
|
|
2377
2375
|
}
|
|
@@ -2383,20 +2381,20 @@ class $ {
|
|
|
2383
2381
|
* @private
|
|
2384
2382
|
*/
|
|
2385
2383
|
static _moveSelectionForward(e, t) {
|
|
2386
|
-
for (var a = e.getObjects(), n = t.getObjects(), i = n.map((l) => a.indexOf(l)),
|
|
2384
|
+
for (var a = e.getObjects(), n = t.getObjects(), i = n.map((l) => a.indexOf(l)), s = -1, r = function(d) {
|
|
2387
2385
|
var h = a[d];
|
|
2388
2386
|
if (!n.includes(h) && i.some((g) => d > g))
|
|
2389
|
-
return
|
|
2390
|
-
}, c = 0; c < a.length && !
|
|
2387
|
+
return s = d, 1;
|
|
2388
|
+
}, c = 0; c < a.length && !r(c); c += 1)
|
|
2391
2389
|
;
|
|
2392
|
-
if (
|
|
2390
|
+
if (s !== -1) {
|
|
2393
2391
|
var u = n.map((l) => ({
|
|
2394
2392
|
obj: l,
|
|
2395
2393
|
index: a.indexOf(l)
|
|
2396
2394
|
})).sort((l, d) => d.index - l.index);
|
|
2397
2395
|
u.forEach((l) => {
|
|
2398
2396
|
var d = a.indexOf(l.obj);
|
|
2399
|
-
d <
|
|
2397
|
+
d < s && (e.moveObjectTo(l.obj, s), s = d);
|
|
2400
2398
|
});
|
|
2401
2399
|
}
|
|
2402
2400
|
}
|
|
@@ -2408,8 +2406,8 @@ class $ {
|
|
|
2408
2406
|
* @private
|
|
2409
2407
|
*/
|
|
2410
2408
|
static _moveSelectionBackwards(e, t) {
|
|
2411
|
-
for (var a = e.getObjects(), n = t.getObjects(), i = Math.min(...n.map((
|
|
2412
|
-
e.moveObjectTo(n[
|
|
2409
|
+
for (var a = e.getObjects(), n = t.getObjects(), i = Math.min(...n.map((r) => a.indexOf(r))), s = n.length - 1; s >= 0; s -= 1)
|
|
2410
|
+
e.moveObjectTo(n[s], i - 1);
|
|
2413
2411
|
}
|
|
2414
2412
|
}
|
|
2415
2413
|
class yt {
|
|
@@ -2443,8 +2441,8 @@ class yt {
|
|
|
2443
2441
|
top: a,
|
|
2444
2442
|
width: n = 100,
|
|
2445
2443
|
height: i = 100,
|
|
2446
|
-
fill:
|
|
2447
|
-
} = d,
|
|
2444
|
+
fill: s = "blue"
|
|
2445
|
+
} = d, r = X(d, [
|
|
2448
2446
|
"id",
|
|
2449
2447
|
"left",
|
|
2450
2448
|
"top",
|
|
@@ -2458,8 +2456,8 @@ class yt {
|
|
|
2458
2456
|
top: a,
|
|
2459
2457
|
width: n,
|
|
2460
2458
|
height: i,
|
|
2461
|
-
fill:
|
|
2462
|
-
},
|
|
2459
|
+
fill: s
|
|
2460
|
+
}, r));
|
|
2463
2461
|
return !t && !a && h.centerObject(g), u || (h.add(g), c || h.setActiveObject(g), h.renderAll()), g;
|
|
2464
2462
|
}
|
|
2465
2463
|
/**
|
|
@@ -2478,14 +2476,14 @@ class yt {
|
|
|
2478
2476
|
* @param {Object} flags.withoutSelection - Не выделять объект
|
|
2479
2477
|
* @param {Object} flags.withoutAdding - Не добавлять объект в canvas
|
|
2480
2478
|
*/
|
|
2481
|
-
addCircle(u = {}, { withoutSelection:
|
|
2479
|
+
addCircle(u = {}, { withoutSelection: r, withoutAdding: c } = {}) {
|
|
2482
2480
|
var l = u, {
|
|
2483
2481
|
id: e = `circle-${A()}`,
|
|
2484
2482
|
left: t,
|
|
2485
2483
|
top: a,
|
|
2486
2484
|
radius: n = 50,
|
|
2487
2485
|
fill: i = "green"
|
|
2488
|
-
} = l,
|
|
2486
|
+
} = l, s = X(l, [
|
|
2489
2487
|
"id",
|
|
2490
2488
|
"left",
|
|
2491
2489
|
"top",
|
|
@@ -2498,8 +2496,8 @@ class yt {
|
|
|
2498
2496
|
top: a,
|
|
2499
2497
|
fill: i,
|
|
2500
2498
|
radius: n
|
|
2501
|
-
},
|
|
2502
|
-
return !t && !a && d.centerObject(h), c || (d.add(h),
|
|
2499
|
+
}, s));
|
|
2500
|
+
return !t && !a && d.centerObject(h), c || (d.add(h), r || d.setActiveObject(h), d.renderAll()), h;
|
|
2503
2501
|
}
|
|
2504
2502
|
/**
|
|
2505
2503
|
* Добавление треугольника
|
|
@@ -2525,8 +2523,8 @@ class yt {
|
|
|
2525
2523
|
top: a,
|
|
2526
2524
|
width: n = 100,
|
|
2527
2525
|
height: i = 100,
|
|
2528
|
-
fill:
|
|
2529
|
-
} = d,
|
|
2526
|
+
fill: s = "yellow"
|
|
2527
|
+
} = d, r = X(d, [
|
|
2530
2528
|
"id",
|
|
2531
2529
|
"left",
|
|
2532
2530
|
"top",
|
|
@@ -2538,10 +2536,10 @@ class yt {
|
|
|
2538
2536
|
id: e,
|
|
2539
2537
|
left: t,
|
|
2540
2538
|
top: a,
|
|
2541
|
-
fill:
|
|
2539
|
+
fill: s,
|
|
2542
2540
|
width: n,
|
|
2543
2541
|
height: i
|
|
2544
|
-
},
|
|
2542
|
+
}, r));
|
|
2545
2543
|
return !t && !a && h.centerObject(g), u || (h.add(g), c || h.setActiveObject(g), h.renderAll()), g;
|
|
2546
2544
|
}
|
|
2547
2545
|
}
|
|
@@ -2560,16 +2558,19 @@ class bt {
|
|
|
2560
2558
|
copy() {
|
|
2561
2559
|
const { canvas: e, errorManager: t } = this.editor, a = e.getActiveObject();
|
|
2562
2560
|
if (!a) return;
|
|
2563
|
-
if (typeof ClipboardItem == "undefined" || !navigator.clipboard)
|
|
2564
|
-
|
|
2561
|
+
if (typeof ClipboardItem == "undefined" || !navigator.clipboard) {
|
|
2562
|
+
t.emitWarning({
|
|
2565
2563
|
origin: "ClipboardManager",
|
|
2566
2564
|
method: "copy",
|
|
2567
2565
|
code: "CLIPBOARD_NOT_SUPPORTED",
|
|
2566
|
+
// eslint-disable-next-line max-len
|
|
2568
2567
|
message: "ClipboardManager. navigator.clipboard не поддерживается в этом браузере или отсутствует соединение по HTTPS-протоколу."
|
|
2569
2568
|
}), this._cloneAndFire(e, a);
|
|
2569
|
+
return;
|
|
2570
|
+
}
|
|
2570
2571
|
if (a.type !== "image") {
|
|
2571
2572
|
const h = `application/image-editor:${JSON.stringify(a.toObject(["format"]))}`;
|
|
2572
|
-
|
|
2573
|
+
navigator.clipboard.writeText(h).catch((g) => {
|
|
2573
2574
|
t.emitWarning({
|
|
2574
2575
|
origin: "ClipboardManager",
|
|
2575
2576
|
method: "copy",
|
|
@@ -2578,11 +2579,12 @@ class bt {
|
|
|
2578
2579
|
data: g
|
|
2579
2580
|
});
|
|
2580
2581
|
}), this._cloneAndFire(e, a);
|
|
2582
|
+
return;
|
|
2581
2583
|
}
|
|
2582
|
-
const i = a.toCanvasElement().toDataURL(),
|
|
2583
|
-
for (let h = 0; h < c.length; h
|
|
2584
|
+
const i = a.toCanvasElement().toDataURL(), s = i.slice(5).split(";")[0], r = i.split(",")[1], c = atob(r), u = new Uint8Array(c.length);
|
|
2585
|
+
for (let h = 0; h < c.length; h += 1)
|
|
2584
2586
|
u[h] = c.charCodeAt(h);
|
|
2585
|
-
const l = new Blob([u.buffer], { type:
|
|
2587
|
+
const l = new Blob([u.buffer], { type: s }), d = new ClipboardItem({ [s]: l });
|
|
2586
2588
|
navigator.clipboard.write([d]).catch((h) => {
|
|
2587
2589
|
t.emitWarning({
|
|
2588
2590
|
origin: "ClipboardManager",
|
|
@@ -2617,16 +2619,16 @@ class bt {
|
|
|
2617
2619
|
* @param {Array} event.clipboardData.items — элементы буфера обмена
|
|
2618
2620
|
*/
|
|
2619
2621
|
handlePasteEvent({ clipboardData: e }) {
|
|
2620
|
-
var
|
|
2621
|
-
if (!((
|
|
2622
|
+
var s;
|
|
2623
|
+
if (!((s = e == null ? void 0 : e.items) != null && s.length)) return;
|
|
2622
2624
|
const { imageManager: t } = this.editor, { items: a } = e, n = a[a.length - 1];
|
|
2623
2625
|
if (n.type !== "text/html") {
|
|
2624
|
-
const
|
|
2625
|
-
if (!
|
|
2626
|
+
const r = n.getAsFile();
|
|
2627
|
+
if (!r) return;
|
|
2626
2628
|
const c = new FileReader();
|
|
2627
2629
|
c.onload = (u) => {
|
|
2628
2630
|
u.target && this.editor.imageManager.importImage({ source: u.target.result });
|
|
2629
|
-
}, c.readAsDataURL(
|
|
2631
|
+
}, c.readAsDataURL(r);
|
|
2630
2632
|
return;
|
|
2631
2633
|
}
|
|
2632
2634
|
const i = e.getData("text/html");
|
|
@@ -2686,9 +2688,9 @@ class pt {
|
|
|
2686
2688
|
} = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, {
|
|
2687
2689
|
canvas: n,
|
|
2688
2690
|
historyManager: i
|
|
2689
|
-
} = this.editor,
|
|
2690
|
-
if (!(!
|
|
2691
|
-
var
|
|
2691
|
+
} = this.editor, s = e || n.getActiveObject();
|
|
2692
|
+
if (!(!s || s.locked)) {
|
|
2693
|
+
var r = {
|
|
2692
2694
|
lockMovementX: !0,
|
|
2693
2695
|
lockMovementY: !0,
|
|
2694
2696
|
lockRotation: !0,
|
|
@@ -2698,12 +2700,12 @@ class pt {
|
|
|
2698
2700
|
lockSkewingY: !0,
|
|
2699
2701
|
locked: !0
|
|
2700
2702
|
};
|
|
2701
|
-
|
|
2702
|
-
var c = !t && ["activeselection", "group"].includes(
|
|
2703
|
-
c &&
|
|
2704
|
-
u.set(
|
|
2703
|
+
s.set(r);
|
|
2704
|
+
var c = !t && ["activeselection", "group"].includes(s.type);
|
|
2705
|
+
c && s.getObjects().forEach((u) => {
|
|
2706
|
+
u.set(r);
|
|
2705
2707
|
}), n.renderAll(), a || i.saveState(), n.fire("editor:object-locked", {
|
|
2706
|
-
object:
|
|
2708
|
+
object: s,
|
|
2707
2709
|
skipInnerObjects: t,
|
|
2708
2710
|
withoutSave: a
|
|
2709
2711
|
});
|
|
@@ -2726,7 +2728,7 @@ class pt {
|
|
|
2726
2728
|
historyManager: n
|
|
2727
2729
|
} = this.editor, i = e || a.getActiveObject();
|
|
2728
2730
|
if (i) {
|
|
2729
|
-
var
|
|
2731
|
+
var s = {
|
|
2730
2732
|
lockMovementX: !1,
|
|
2731
2733
|
lockMovementY: !1,
|
|
2732
2734
|
lockRotation: !1,
|
|
@@ -2736,8 +2738,8 @@ class pt {
|
|
|
2736
2738
|
lockSkewingY: !1,
|
|
2737
2739
|
locked: !1
|
|
2738
2740
|
};
|
|
2739
|
-
i.set(
|
|
2740
|
-
|
|
2741
|
+
i.set(s), ["activeselection", "group"].includes(i.type) && i.getObjects().forEach((r) => {
|
|
2742
|
+
r.set(s);
|
|
2741
2743
|
}), a.renderAll(), t || n.saveState(), a.fire("editor:object-unlocked", {
|
|
2742
2744
|
object: i,
|
|
2743
2745
|
withoutSave: t
|
|
@@ -2774,10 +2776,10 @@ class It {
|
|
|
2774
2776
|
n.suspendHistory();
|
|
2775
2777
|
var i = e || a.getActiveObject();
|
|
2776
2778
|
if (i && i.type === "activeselection") {
|
|
2777
|
-
var
|
|
2778
|
-
|
|
2779
|
+
var s = i.getObjects(), r = new ze(s);
|
|
2780
|
+
s.forEach((c) => a.remove(c)), r.set("id", "".concat(r.type, "-").concat(A())), a.add(r), a.setActiveObject(r), a.renderAll(), n.resumeHistory(), t || n.saveState(), a.fire("editor:objects-grouped", {
|
|
2779
2781
|
object: i,
|
|
2780
|
-
group:
|
|
2782
|
+
group: r,
|
|
2781
2783
|
withoutSave: t
|
|
2782
2784
|
});
|
|
2783
2785
|
}
|
|
@@ -2800,14 +2802,14 @@ class It {
|
|
|
2800
2802
|
n.suspendHistory();
|
|
2801
2803
|
var i = e || a.getActiveObject();
|
|
2802
2804
|
if (!(!i || i.type !== "group")) {
|
|
2803
|
-
var
|
|
2804
|
-
a.remove(i),
|
|
2805
|
-
var
|
|
2805
|
+
var s = i.removeAll();
|
|
2806
|
+
a.remove(i), s.forEach((c) => a.add(c));
|
|
2807
|
+
var r = new T(s, {
|
|
2806
2808
|
canvas: a
|
|
2807
2809
|
});
|
|
2808
|
-
a.setActiveObject(
|
|
2810
|
+
a.setActiveObject(r), a.renderAll(), n.resumeHistory(), t || n.saveState(), a.fire("editor:objects-ungrouped", {
|
|
2809
2811
|
object: i,
|
|
2810
|
-
selection:
|
|
2812
|
+
selection: r,
|
|
2811
2813
|
withoutSave: t
|
|
2812
2814
|
});
|
|
2813
2815
|
}
|
|
@@ -2835,15 +2837,15 @@ class At {
|
|
|
2835
2837
|
objectLockManager: a
|
|
2836
2838
|
} = this.editor;
|
|
2837
2839
|
e.discardActiveObject();
|
|
2838
|
-
var n = t.getObjects(), i = n.some((
|
|
2840
|
+
var n = t.getObjects(), i = n.some((r) => r.locked), s = n.length > 1 ? new T(t.getObjects(), {
|
|
2839
2841
|
canvas: e
|
|
2840
2842
|
}) : n[0];
|
|
2841
2843
|
i && a.lockObject({
|
|
2842
|
-
object:
|
|
2844
|
+
object: s,
|
|
2843
2845
|
skipInnerObjects: !0,
|
|
2844
2846
|
withoutSave: !0
|
|
2845
|
-
}), e.setActiveObject(
|
|
2846
|
-
selected:
|
|
2847
|
+
}), e.setActiveObject(s), e.requestRenderAll(), e.fire("editor:all-objects-selected", {
|
|
2848
|
+
selected: s
|
|
2847
2849
|
});
|
|
2848
2850
|
}
|
|
2849
2851
|
}
|
|
@@ -2873,15 +2875,15 @@ class St {
|
|
|
2873
2875
|
canvas: a,
|
|
2874
2876
|
historyManager: n,
|
|
2875
2877
|
groupingManager: i
|
|
2876
|
-
} = this.editor,
|
|
2877
|
-
|
|
2878
|
-
if (
|
|
2879
|
-
i.ungroup(
|
|
2878
|
+
} = this.editor, s = (e || a.getActiveObjects()).filter((r) => !r.locked);
|
|
2879
|
+
s != null && s.length && (n.suspendHistory(), s.forEach((r) => {
|
|
2880
|
+
if (r.type === "group" && r.format !== "svg") {
|
|
2881
|
+
i.ungroup(r), this.deleteSelectedObjects();
|
|
2880
2882
|
return;
|
|
2881
2883
|
}
|
|
2882
|
-
a.remove(
|
|
2884
|
+
a.remove(r);
|
|
2883
2885
|
}), a.discardActiveObject(), a.renderAll(), n.resumeHistory(), t || n.saveState(), a.fire("editor:objects-deleted", {
|
|
2884
|
-
objects:
|
|
2886
|
+
objects: s,
|
|
2885
2887
|
withoutSave: t
|
|
2886
2888
|
}));
|
|
2887
2889
|
}
|
|
@@ -2970,18 +2972,18 @@ class q {
|
|
|
2970
2972
|
return;
|
|
2971
2973
|
}
|
|
2972
2974
|
if (!a) return;
|
|
2973
|
-
const
|
|
2974
|
-
console.error(`${e}. ${t}. ${a}. ${
|
|
2975
|
-
const
|
|
2975
|
+
const s = i || a;
|
|
2976
|
+
console.error(`${e}. ${t}. ${a}. ${s}`, n);
|
|
2977
|
+
const r = {
|
|
2976
2978
|
code: a,
|
|
2977
2979
|
origin: e,
|
|
2978
2980
|
method: t,
|
|
2979
|
-
message:
|
|
2981
|
+
message: s,
|
|
2980
2982
|
data: n
|
|
2981
2983
|
};
|
|
2982
2984
|
this._buffer.push(C({
|
|
2983
2985
|
type: "editor:error"
|
|
2984
|
-
},
|
|
2986
|
+
}, r)), this.editor.canvas.fire("editor:error", r);
|
|
2985
2987
|
}
|
|
2986
2988
|
/**
|
|
2987
2989
|
* Эмитит предупреждение через fabricjs
|
|
@@ -2998,18 +3000,18 @@ class q {
|
|
|
2998
3000
|
console.warn("Неизвестный код предупреждения: ", { code: a, origin: e, method: t });
|
|
2999
3001
|
return;
|
|
3000
3002
|
}
|
|
3001
|
-
const
|
|
3002
|
-
console.warn(`${e}. ${t}. ${a}. ${
|
|
3003
|
-
const
|
|
3003
|
+
const s = n || a;
|
|
3004
|
+
console.warn(`${e}. ${t}. ${a}. ${s}`, i);
|
|
3005
|
+
const r = {
|
|
3004
3006
|
code: a,
|
|
3005
3007
|
origin: e,
|
|
3006
3008
|
method: t,
|
|
3007
|
-
message:
|
|
3009
|
+
message: s,
|
|
3008
3010
|
data: i
|
|
3009
3011
|
};
|
|
3010
3012
|
this._buffer.push(C({
|
|
3011
3013
|
type: "editor:warning"
|
|
3012
|
-
},
|
|
3014
|
+
}, r)), this.editor.canvas.fire("editor:warning", r);
|
|
3013
3015
|
}
|
|
3014
3016
|
static isValidErrorCode(e) {
|
|
3015
3017
|
return e ? Object.values(Ct).some((t) => Object.values(t).includes(e)) : !1;
|
|
@@ -3032,18 +3034,18 @@ class de {
|
|
|
3032
3034
|
canvasWrapperWidth: a,
|
|
3033
3035
|
canvasWrapperHeight: n,
|
|
3034
3036
|
canvasCSSWidth: i,
|
|
3035
|
-
canvasCSSHeight:
|
|
3036
|
-
initialImage:
|
|
3037
|
+
canvasCSSHeight: s,
|
|
3038
|
+
initialImage: r,
|
|
3037
3039
|
initialStateJSON: c,
|
|
3038
3040
|
scaleType: u,
|
|
3039
3041
|
_onReadyCallback: l
|
|
3040
3042
|
} = this.options;
|
|
3041
|
-
if (Ke.apply(), this.canvas = new Ue(this.containerId, this.options), this.moduleLoader = new Re(), this.workerManager = new Pe(), this.errorManager = new q({ editor: this }), this.historyManager = new lt({ editor: this }), this.toolbar = new dt({ editor: this }), this.transformManager = new ft({ editor: this }), this.canvasManager = new mt({ editor: this }), this.imageManager = new D({ editor: this }), this.layerManager = new $({ editor: this }), this.shapeManager = new yt({ editor: this }), this.interactionBlocker = new jt({ editor: this }), this.clipboardManager = new bt({ editor: this }), this.objectLockManager = new pt({ editor: this }), this.groupingManager = new It({ editor: this }), this.selectionManager = new At({ editor: this }), this.deletionManager = new St({ editor: this }), this._createMontageArea(), this._createClippingArea(), this.listeners = new R({ editor: this, options: this.options }), this.canvasManager.setEditorContainerWidth(e), this.canvasManager.setEditorContainerHeight(t), this.canvasManager.setCanvasWrapperWidth(a), this.canvasManager.setCanvasWrapperHeight(n), this.canvasManager.setCanvasCSSWidth(i), this.canvasManager.setCanvasCSSHeight(
|
|
3043
|
+
if (Ke.apply(), this.canvas = new Ue(this.containerId, this.options), this.moduleLoader = new Re(), this.workerManager = new Pe(), this.errorManager = new q({ editor: this }), this.historyManager = new lt({ editor: this }), this.toolbar = new dt({ editor: this }), this.transformManager = new ft({ editor: this }), this.canvasManager = new mt({ editor: this }), this.imageManager = new D({ editor: this }), this.layerManager = new $({ editor: this }), this.shapeManager = new yt({ editor: this }), this.interactionBlocker = new jt({ editor: this }), this.clipboardManager = new bt({ editor: this }), this.objectLockManager = new pt({ editor: this }), this.groupingManager = new It({ editor: this }), this.selectionManager = new At({ editor: this }), this.deletionManager = new St({ editor: this }), this._createMontageArea(), this._createClippingArea(), this.listeners = new R({ editor: this, options: this.options }), this.canvasManager.setEditorContainerWidth(e), this.canvasManager.setEditorContainerHeight(t), this.canvasManager.setCanvasWrapperWidth(a), this.canvasManager.setCanvasWrapperHeight(n), this.canvasManager.setCanvasCSSWidth(i), this.canvasManager.setCanvasCSSHeight(s), r != null && r.source) {
|
|
3042
3044
|
const {
|
|
3043
3045
|
source: d,
|
|
3044
3046
|
scale: h = `image-${u}`,
|
|
3045
3047
|
withoutSave: g = !0
|
|
3046
|
-
} =
|
|
3048
|
+
} = r;
|
|
3047
3049
|
yield this.imageManager.importImage({ source: d, scale: h, withoutSave: g });
|
|
3048
3050
|
} else
|
|
3049
3051
|
this.canvasManager.setDefaultScale({ withoutSave: !0 });
|
|
@@ -3203,8 +3205,8 @@ function wt(o, e = {}) {
|
|
|
3203
3205
|
const n = document.createElement("canvas");
|
|
3204
3206
|
return n.id = `${o}-canvas`, a.appendChild(n), t.editorContainer = a, new Promise((i) => {
|
|
3205
3207
|
t._onReadyCallback = i;
|
|
3206
|
-
const
|
|
3207
|
-
window[o] =
|
|
3208
|
+
const s = new de(n.id, t);
|
|
3209
|
+
window[o] = s;
|
|
3208
3210
|
});
|
|
3209
3211
|
}
|
|
3210
3212
|
export {
|