@anu3ev/fabric-image-editor 0.5.1 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +366 -347
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var rs = Object.defineProperty, cs = Object.defineProperties;
|
|
2
|
+
var ds = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var Wt = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var De = Object.prototype.hasOwnProperty, Re = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var Le = (h, t, e) => t in h ? rs(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e, B = (h, t) => {
|
|
6
6
|
for (var e in t || (t = {}))
|
|
7
|
-
|
|
7
|
+
De.call(t, e) && Le(h, e, t[e]);
|
|
8
8
|
if (Wt)
|
|
9
9
|
for (var e of Wt(t))
|
|
10
|
-
|
|
10
|
+
Re.call(t, e) && Le(h, e, t[e]);
|
|
11
11
|
return h;
|
|
12
|
-
}, bt = (h, t) =>
|
|
12
|
+
}, bt = (h, t) => cs(h, ds(t));
|
|
13
13
|
var ut = (h, t) => {
|
|
14
14
|
var e = {};
|
|
15
15
|
for (var s in h)
|
|
16
|
-
|
|
16
|
+
De.call(h, s) && t.indexOf(s) < 0 && (e[s] = h[s]);
|
|
17
17
|
if (h != null && Wt)
|
|
18
18
|
for (var s of Wt(h))
|
|
19
|
-
t.indexOf(s) < 0 &&
|
|
19
|
+
t.indexOf(s) < 0 && Re.call(h, s) && (e[s] = h[s]);
|
|
20
20
|
return e;
|
|
21
21
|
};
|
|
22
22
|
var _ = (h, t, e) => new Promise((s, o) => {
|
|
@@ -35,12 +35,12 @@ var _ = (h, t, e) => new Promise((s, o) => {
|
|
|
35
35
|
}, a = (r) => r.done ? s(r.value) : Promise.resolve(r.value).then(n, i);
|
|
36
36
|
a((e = e.apply(h, t)).next());
|
|
37
37
|
});
|
|
38
|
-
import { ActiveSelection as
|
|
39
|
-
import { create as
|
|
40
|
-
import
|
|
41
|
-
var
|
|
38
|
+
import { ActiveSelection as k, Textbox as st, util as rt, controlsUtils as _e, InteractiveFabricObject as Ne, Point as $, FitContentLayout as Be, loadSVGFromURL as ls, FabricImage as Bt, Gradient as ke, Rect as hs, Circle as us, Triangle as gs, Group as wt, Color as fs, classRegistry as xe, loadSVGFromString as ps, Canvas as ms, Pattern as ys } from "fabric";
|
|
39
|
+
import { create as vs } from "jsondiffpatch";
|
|
40
|
+
import bs from "diff-match-patch";
|
|
41
|
+
var Ms = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", Y = 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 += Ms[s[t] & 63];
|
|
44
44
|
return e;
|
|
45
45
|
};
|
|
46
46
|
class xt {
|
|
@@ -98,7 +98,7 @@ class xt {
|
|
|
98
98
|
if (o.length === 1)
|
|
99
99
|
this.canvas.setActiveObject(o[0]);
|
|
100
100
|
else {
|
|
101
|
-
const i = new
|
|
101
|
+
const i = new k(o, {
|
|
102
102
|
canvas: this.canvas
|
|
103
103
|
});
|
|
104
104
|
this.canvas.setActiveObject(i);
|
|
@@ -106,7 +106,7 @@ class xt {
|
|
|
106
106
|
this.canvas.requestRenderAll();
|
|
107
107
|
return;
|
|
108
108
|
}
|
|
109
|
-
const n = new
|
|
109
|
+
const n = new k(t, {
|
|
110
110
|
canvas: this.canvas
|
|
111
111
|
});
|
|
112
112
|
this.editor.objectLockManager.lockObject({
|
|
@@ -220,7 +220,7 @@ class xt {
|
|
|
220
220
|
if (o || n) return;
|
|
221
221
|
this.isSpacePressed = !0, t.preventDefault();
|
|
222
222
|
const i = e.getActiveObject() || null;
|
|
223
|
-
i instanceof
|
|
223
|
+
i instanceof k ? this.savedSelection = i.getObjects().slice() : i && (this.savedSelection = [i]), e.discardActiveObject(), e.set({
|
|
224
224
|
selection: !1,
|
|
225
225
|
defaultCursor: "grab"
|
|
226
226
|
}), e.setCursor("grab"), s.canvasManager.getObjects().forEach((a) => {
|
|
@@ -259,7 +259,7 @@ class xt {
|
|
|
259
259
|
e.setActiveObject(t[0]);
|
|
260
260
|
return;
|
|
261
261
|
}
|
|
262
|
-
const o = t.filter((i) => s.canvasManager.getObjects().includes(i)), n = new
|
|
262
|
+
const o = t.filter((i) => s.canvasManager.getObjects().includes(i)), n = new k(o, { canvas: e });
|
|
263
263
|
e.setActiveObject(n);
|
|
264
264
|
}
|
|
265
265
|
// --- Обработчики для событий canvas (Fabric) ---
|
|
@@ -391,7 +391,7 @@ class xt {
|
|
|
391
391
|
};
|
|
392
392
|
}
|
|
393
393
|
}
|
|
394
|
-
class
|
|
394
|
+
class ws {
|
|
395
395
|
/**
|
|
396
396
|
* Класс для динамической загрузки внешних модулей.
|
|
397
397
|
*/
|
|
@@ -409,7 +409,7 @@ class Ms {
|
|
|
409
409
|
return this.loaders[t] ? (this.cache.has(t) || this.cache.set(t, this.loaders[t]()), this.cache.get(t)) : Promise.reject(new Error(`Unknown module "${t}"`));
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
|
-
function
|
|
412
|
+
function Ss(h) {
|
|
413
413
|
return new Worker(
|
|
414
414
|
"" + new URL("assets/worker-CN39s7P7.js", import.meta.url).href,
|
|
415
415
|
{
|
|
@@ -417,13 +417,13 @@ function ws(h) {
|
|
|
417
417
|
}
|
|
418
418
|
);
|
|
419
419
|
}
|
|
420
|
-
class
|
|
420
|
+
class As {
|
|
421
421
|
/**
|
|
422
422
|
* @param scriptUrl — URL скрипта воркера.
|
|
423
423
|
* По-умолчанию использует DefaultWorker из соседнего файла
|
|
424
424
|
*/
|
|
425
425
|
constructor(t) {
|
|
426
|
-
t ? this.worker = new Worker(t, { type: "module" }) : this.worker = new
|
|
426
|
+
t ? this.worker = new Worker(t, { type: "module" }) : this.worker = new Ss(), this._callbacks = /* @__PURE__ */ new Map(), this.worker.onmessage = this._handleMessage.bind(this);
|
|
427
427
|
}
|
|
428
428
|
/**
|
|
429
429
|
* Обработчик сообщений от воркера
|
|
@@ -463,26 +463,26 @@ class Ss {
|
|
|
463
463
|
this.worker.terminate();
|
|
464
464
|
}
|
|
465
465
|
}
|
|
466
|
-
const it = 12,
|
|
466
|
+
const it = 12, js = 2, de = 8, le = 20, Is = 100, he = 20, ue = 8, Cs = 100, Kt = 32, me = 1, Ts = "#2B2D33", ye = "#3D8BF4", ve = "#FFFFFF";
|
|
467
467
|
function Zt(h, t, e, s, o) {
|
|
468
|
-
const n = it, i =
|
|
469
|
-
h.save(), h.translate(t, e), h.rotate(
|
|
470
|
-
}
|
|
471
|
-
function xe(h, t, e, s, o) {
|
|
472
|
-
const n = ce, i = de, a = js;
|
|
473
|
-
h.save(), h.translate(t, e), h.rotate(lt.degreesToRadians(o.angle)), h.fillStyle = ye, h.strokeStyle = me, h.lineWidth = pe, h.beginPath(), h.roundRect(-n / 2, -i / 2, n, i, a), h.fill(), h.stroke(), h.restore();
|
|
468
|
+
const n = it, i = js;
|
|
469
|
+
h.save(), h.translate(t, e), h.rotate(rt.degreesToRadians(o.angle)), h.fillStyle = ve, h.strokeStyle = ye, h.lineWidth = me, h.beginPath(), h.roundRect(-n / 2, -n / 2, n, n, i), h.fill(), h.stroke(), h.restore();
|
|
474
470
|
}
|
|
475
471
|
function ze(h, t, e, s, o) {
|
|
476
|
-
const n =
|
|
477
|
-
h.save(), h.translate(t, e), h.rotate(
|
|
472
|
+
const n = de, i = le, a = Is;
|
|
473
|
+
h.save(), h.translate(t, e), h.rotate(rt.degreesToRadians(o.angle)), h.fillStyle = ve, h.strokeStyle = ye, h.lineWidth = me, h.beginPath(), h.roundRect(-n / 2, -i / 2, n, i, a), h.fill(), h.stroke(), h.restore();
|
|
474
|
+
}
|
|
475
|
+
function Pe(h, t, e, s, o) {
|
|
476
|
+
const n = he, i = ue, a = Cs;
|
|
477
|
+
h.save(), h.translate(t, e), h.rotate(rt.degreesToRadians(o.angle)), h.fillStyle = ve, h.strokeStyle = ye, h.lineWidth = me, h.beginPath(), h.roundRect(-n / 2, -i / 2, n, i, a), h.fill(), h.stroke(), h.restore();
|
|
478
478
|
}
|
|
479
|
-
const
|
|
480
|
-
|
|
481
|
-
function
|
|
482
|
-
const i =
|
|
483
|
-
h.save(), h.translate(t, e), h.rotate(
|
|
479
|
+
const Es = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", Je = new Image();
|
|
480
|
+
Je.src = Es;
|
|
481
|
+
function Os(h, t, e, s, o) {
|
|
482
|
+
const i = Kt / 2;
|
|
483
|
+
h.save(), h.translate(t, e), h.rotate(rt.degreesToRadians(o.angle)), h.fillStyle = Ts, h.beginPath(), h.arc(0, 0, i, 0, 2 * Math.PI), h.fill(), h.drawImage(Je, -i / 2, -i / 2, i, i), h.restore();
|
|
484
484
|
}
|
|
485
|
-
const
|
|
485
|
+
const Ls = {
|
|
486
486
|
// Угловые точки
|
|
487
487
|
tl: {
|
|
488
488
|
render: Zt,
|
|
@@ -514,41 +514,41 @@ const Os = {
|
|
|
514
514
|
},
|
|
515
515
|
// Середина вертикалей
|
|
516
516
|
ml: {
|
|
517
|
-
render:
|
|
518
|
-
sizeX:
|
|
519
|
-
sizeY:
|
|
517
|
+
render: ze,
|
|
518
|
+
sizeX: de,
|
|
519
|
+
sizeY: le,
|
|
520
520
|
offsetX: 0,
|
|
521
521
|
offsetY: 0
|
|
522
522
|
},
|
|
523
523
|
mr: {
|
|
524
|
-
render:
|
|
525
|
-
sizeX:
|
|
526
|
-
sizeY:
|
|
524
|
+
render: ze,
|
|
525
|
+
sizeX: de,
|
|
526
|
+
sizeY: le,
|
|
527
527
|
offsetX: 0,
|
|
528
528
|
offsetY: 0
|
|
529
529
|
},
|
|
530
530
|
// Середина горизонталей
|
|
531
531
|
mt: {
|
|
532
|
-
render:
|
|
533
|
-
sizeX:
|
|
534
|
-
sizeY:
|
|
532
|
+
render: Pe,
|
|
533
|
+
sizeX: he,
|
|
534
|
+
sizeY: ue,
|
|
535
535
|
offsetX: 0,
|
|
536
536
|
offsetY: 0
|
|
537
537
|
},
|
|
538
538
|
mb: {
|
|
539
|
-
render:
|
|
540
|
-
sizeX:
|
|
541
|
-
sizeY:
|
|
539
|
+
render: Pe,
|
|
540
|
+
sizeX: he,
|
|
541
|
+
sizeY: ue,
|
|
542
542
|
offsetX: 0,
|
|
543
543
|
offsetY: 0
|
|
544
544
|
},
|
|
545
545
|
// Специальный «rotate» контрол
|
|
546
546
|
mtr: {
|
|
547
|
-
render:
|
|
548
|
-
sizeX:
|
|
549
|
-
sizeY:
|
|
547
|
+
render: Os,
|
|
548
|
+
sizeX: Kt,
|
|
549
|
+
sizeY: Kt,
|
|
550
550
|
offsetX: 0,
|
|
551
|
-
offsetY: -
|
|
551
|
+
offsetY: -Kt
|
|
552
552
|
}
|
|
553
553
|
};
|
|
554
554
|
class Q {
|
|
@@ -567,7 +567,7 @@ class Q {
|
|
|
567
567
|
* Применяет конфигурацию контролов к набору по ключам из DEFAULT_CONTROLS.
|
|
568
568
|
*/
|
|
569
569
|
static applyControlOverrides(t) {
|
|
570
|
-
Object.entries(
|
|
570
|
+
Object.entries(Ls).forEach(([e, s]) => {
|
|
571
571
|
const o = t[e];
|
|
572
572
|
o && (Object.assign(o, s), e === "mtr" && (o.cursorStyle = "grab", o.mouseDownHandler = (n, i, a, r) => {
|
|
573
573
|
var d;
|
|
@@ -580,16 +580,16 @@ class Q {
|
|
|
580
580
|
* Регистрирует контролы и настройки поведения выделений.
|
|
581
581
|
*/
|
|
582
582
|
static apply() {
|
|
583
|
-
const t =
|
|
584
|
-
Q.applyControlOverrides(t),
|
|
585
|
-
const e =
|
|
586
|
-
Q.applyControlOverrides(e), e.mt && (e.mt.visible = !1), e.mb && (e.mb.visible = !1), Q.wrapWidthControl(e.ml), Q.wrapWidthControl(e.mr), st.ownDefaults.controls = e, Q.patchActiveSelectionBounds(),
|
|
583
|
+
const t = _e.createObjectDefaultControls();
|
|
584
|
+
Q.applyControlOverrides(t), Ne.ownDefaults.controls = t;
|
|
585
|
+
const e = _e.createTextboxDefaultControls();
|
|
586
|
+
Q.applyControlOverrides(e), e.mt && (e.mt.visible = !1), e.mb && (e.mb.visible = !1), Q.wrapWidthControl(e.ml), Q.wrapWidthControl(e.mr), st.ownDefaults.controls = e, Q.patchActiveSelectionBounds(), Ne.ownDefaults.snapAngle = 1;
|
|
587
587
|
}
|
|
588
588
|
/**
|
|
589
589
|
* Обновляет алгоритм расчёта границ ActiveSelection, чтобы учитывать фон и отступы текстовых объектов.
|
|
590
590
|
*/
|
|
591
591
|
static patchActiveSelectionBounds() {
|
|
592
|
-
const t =
|
|
592
|
+
const t = k.prototype, e = t._calcBoundsFromObjects;
|
|
593
593
|
t._calcBoundsFromObjects = function(...n) {
|
|
594
594
|
var g, f;
|
|
595
595
|
const i = (f = (g = this.getObjects) == null ? void 0 : g.call(this)) != null ? f : [];
|
|
@@ -630,12 +630,12 @@ class Q {
|
|
|
630
630
|
height: g
|
|
631
631
|
}), this.setPositionByOrigin(f, "center", "center"), this.setCoords(), a;
|
|
632
632
|
};
|
|
633
|
-
const o =
|
|
634
|
-
|
|
633
|
+
const o = Be.prototype.calcBoundingBox;
|
|
634
|
+
Be.prototype.calcBoundingBox = function(n, i) {
|
|
635
635
|
const { target: a, type: r, overrides: c } = i;
|
|
636
636
|
if (r === "imperative" && c)
|
|
637
637
|
return c;
|
|
638
|
-
if (!(a instanceof
|
|
638
|
+
if (!(a instanceof k))
|
|
639
639
|
return o.call(this, n, i);
|
|
640
640
|
Q.applyTextSelectionScalingLock({
|
|
641
641
|
selection: a,
|
|
@@ -854,8 +854,8 @@ N.registeredFontKeys = /* @__PURE__ */ new Set(), N.descriptorDefaults = {
|
|
|
854
854
|
featureSettings: "normal",
|
|
855
855
|
display: "auto"
|
|
856
856
|
};
|
|
857
|
-
let
|
|
858
|
-
const
|
|
857
|
+
let ge = N;
|
|
858
|
+
const Ds = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNi44NzUgMi41YS42MjUuNjI1IDAgMCAwLS42MjUuNjI0VjYuMjVIMy4xMjVhLjYyNS42MjUgMCAwIDAtLjYyNS42MjV2MTBjMCAuMzQ1LjI4LjYyNS42MjUuNjI1aDEwYy4zNDUgMCAuNjI1LS4yOC42MjUtLjYyNXYtMy4xMjZoMy4xMjVjLjM0NSAwIC42MjUtLjI4LjYyNS0uNjI1di0xMGEuNjI1LjYyNSAwIDAgMC0uNjI1LS42MjVoLTEwWm02Ljg3NSAxMGgyLjVWMy43NUg3LjV2Mi41aDUuNjI1Yy4zNDUgMCAuNjI1LjI4LjYyNS42MjV2NS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gMS44NzUgMCAwIDAtMS44NzUtMS44NzVoLTMuNzVabTQuMzc1IDIuNXYtLjYyNWEuNjI1LjYyNSAwIDAgMC0uNjI1LS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDAtLjYyNS42MjV2LjYyNWg1Wk01IDE2LjI1VjVoMTB2MTEuMjVINVpNOC4xMjUgNy41Yy4zNDUgMCAuNjI1LjI4LjYyNS42MjV2NWEuNjI1LjYyNSAwIDEgMS0xLjI1IDB2LTVjMC0uMzQ1LjI4LS42MjUuNjI1LS42MjVabTQuMzc1IDUuNjI1di01YS42MjUuNjI1IDAgMCAwLTEuMjUgMHY1YS42MjUuNjI1IDAgMSAwIDEuMjUgMFoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==", kt = {
|
|
859
859
|
style: {
|
|
860
860
|
position: "absolute",
|
|
861
861
|
display: "none",
|
|
@@ -922,14 +922,14 @@ const Ls = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMj
|
|
|
922
922
|
],
|
|
923
923
|
offsetTop: 50,
|
|
924
924
|
icons: {
|
|
925
|
-
copyPaste:
|
|
926
|
-
delete:
|
|
927
|
-
lock:
|
|
928
|
-
unlock:
|
|
925
|
+
copyPaste: Ds,
|
|
926
|
+
delete: zs,
|
|
927
|
+
lock: Rs,
|
|
928
|
+
unlock: _s,
|
|
929
929
|
bringToFront: ks,
|
|
930
|
-
sendToBack:
|
|
931
|
-
bringForward:
|
|
932
|
-
sendBackwards:
|
|
930
|
+
sendToBack: xs,
|
|
931
|
+
bringForward: Ns,
|
|
932
|
+
sendBackwards: Bs
|
|
933
933
|
},
|
|
934
934
|
handlers: {
|
|
935
935
|
copyPaste: (h) => _(null, null, function* () {
|
|
@@ -958,18 +958,18 @@ const Ls = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMj
|
|
|
958
958
|
}
|
|
959
959
|
}
|
|
960
960
|
};
|
|
961
|
-
class
|
|
961
|
+
class Ps {
|
|
962
962
|
constructor({ editor: t }) {
|
|
963
963
|
this.currentTarget = null, this.currentLocked = !1, this.isTransforming = !1, this.isTemporarilyHidden = !1, this.editor = t, this.canvas = t.canvas, this.options = t.options, this._initToolbar();
|
|
964
964
|
}
|
|
965
965
|
_initToolbar() {
|
|
966
966
|
if (!this.options.showToolbar) return;
|
|
967
967
|
const t = this.options.toolbar || {};
|
|
968
|
-
this.config = bt(
|
|
969
|
-
style:
|
|
970
|
-
btnStyle:
|
|
971
|
-
icons:
|
|
972
|
-
handlers:
|
|
968
|
+
this.config = bt(B(B({}, kt), t), {
|
|
969
|
+
style: B(B({}, kt.style), t.style || {}),
|
|
970
|
+
btnStyle: B(B({}, kt.btnStyle), t.btnStyle || {}),
|
|
971
|
+
icons: B(B({}, kt.icons), t.icons || {}),
|
|
972
|
+
handlers: B(B({}, kt.handlers), t.handlers || {})
|
|
973
973
|
}), this.currentTarget = null, this.currentLocked = !1, this.isTransforming = !1, this.isTemporarilyHidden = !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 = () => {
|
|
974
974
|
this.el.style.display = "none";
|
|
975
975
|
}, this._createDOM(), this._bindEvents();
|
|
@@ -1100,8 +1100,8 @@ const Us = {
|
|
|
1100
1100
|
"pointer-events": "none",
|
|
1101
1101
|
"white-space": "nowrap",
|
|
1102
1102
|
"box-shadow": "0 2px 8px rgba(0, 0, 0, 0.2)"
|
|
1103
|
-
}, Ue = 16,
|
|
1104
|
-
class
|
|
1103
|
+
}, Ue = 16, Ye = 16, Ys = "fabric-editor-angle-indicator";
|
|
1104
|
+
class be {
|
|
1105
1105
|
constructor({ editor: t }) {
|
|
1106
1106
|
this.isActive = !1, this.currentAngle = 0, this.editor = t, this.canvas = t.canvas, this.options = t.options, this._createDOM(), this._bindEvents();
|
|
1107
1107
|
}
|
|
@@ -1109,7 +1109,7 @@ class ve {
|
|
|
1109
1109
|
* Создание DOM-элемента индикатора
|
|
1110
1110
|
*/
|
|
1111
1111
|
_createDOM() {
|
|
1112
|
-
this.el = document.createElement("div"), this.el.className =
|
|
1112
|
+
this.el = document.createElement("div"), this.el.className = Ys, Object.entries(Us).forEach(([t, e]) => {
|
|
1113
1113
|
this.el.style.setProperty(t, e);
|
|
1114
1114
|
}), this.canvas.wrapperEl.appendChild(this.el);
|
|
1115
1115
|
}
|
|
@@ -1129,7 +1129,7 @@ class ve {
|
|
|
1129
1129
|
return;
|
|
1130
1130
|
}
|
|
1131
1131
|
const s = e.angle || 0;
|
|
1132
|
-
this.currentAngle =
|
|
1132
|
+
this.currentAngle = be._normalizeAngle(s), this.el.textContent = `${this.currentAngle}°`, this._positionIndicator(t.e), this.isActive || this._showIndicator();
|
|
1133
1133
|
}
|
|
1134
1134
|
/**
|
|
1135
1135
|
* Обработчик отпускания кнопки мыши
|
|
@@ -1160,9 +1160,9 @@ class ve {
|
|
|
1160
1160
|
*/
|
|
1161
1161
|
_positionIndicator(t) {
|
|
1162
1162
|
const e = this.canvas.wrapperEl.getBoundingClientRect();
|
|
1163
|
-
let s = t.clientX - e.left + Ue, o = t.clientY - e.top +
|
|
1163
|
+
let s = t.clientX - e.left + Ue, o = t.clientY - e.top + Ye;
|
|
1164
1164
|
const n = this.el.getBoundingClientRect(), i = n.width, a = n.height;
|
|
1165
|
-
s + i > e.width && (s = t.clientX - e.left - i - Ue), o + a > e.height && (o = t.clientY - e.top - a -
|
|
1165
|
+
s + i > e.width && (s = t.clientX - e.left - i - Ue), o + a > e.height && (o = t.clientY - e.top - a - Ye), this.el.style.left = `${s}px`, this.el.style.top = `${o}px`;
|
|
1166
1166
|
}
|
|
1167
1167
|
/**
|
|
1168
1168
|
* Показать индикатор
|
|
@@ -1193,7 +1193,7 @@ class ve {
|
|
|
1193
1193
|
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;
|
|
1194
1194
|
}
|
|
1195
1195
|
}
|
|
1196
|
-
const
|
|
1196
|
+
const ts = [
|
|
1197
1197
|
"selectable",
|
|
1198
1198
|
"evented",
|
|
1199
1199
|
"id",
|
|
@@ -1229,7 +1229,7 @@ const Je = [
|
|
|
1229
1229
|
"radiusBottomRight",
|
|
1230
1230
|
"radiusBottomLeft"
|
|
1231
1231
|
];
|
|
1232
|
-
class
|
|
1232
|
+
class Qt {
|
|
1233
1233
|
constructor({ editor: t }) {
|
|
1234
1234
|
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();
|
|
1235
1235
|
}
|
|
@@ -1241,7 +1241,7 @@ class Kt {
|
|
|
1241
1241
|
return this.patches[this.currentIndex - 1] || null;
|
|
1242
1242
|
}
|
|
1243
1243
|
_createDiffPatcher() {
|
|
1244
|
-
this.diffPatcher =
|
|
1244
|
+
this.diffPatcher = vs({
|
|
1245
1245
|
objectHash(t) {
|
|
1246
1246
|
const e = t, s = t, o = s.styles ? JSON.stringify(s.styles) : "";
|
|
1247
1247
|
return [
|
|
@@ -1291,7 +1291,7 @@ class Kt {
|
|
|
1291
1291
|
includeValueOnMove: !1
|
|
1292
1292
|
},
|
|
1293
1293
|
textDiff: {
|
|
1294
|
-
diffMatchPatch:
|
|
1294
|
+
diffMatchPatch: bs,
|
|
1295
1295
|
minLength: 60
|
|
1296
1296
|
}
|
|
1297
1297
|
});
|
|
@@ -1333,7 +1333,7 @@ class Kt {
|
|
|
1333
1333
|
if (console.log("saveState"), this.skipHistory) return;
|
|
1334
1334
|
console.time("saveState");
|
|
1335
1335
|
const t = this._withTemporaryUnlock(
|
|
1336
|
-
() => this.canvas.toDatalessObject([...
|
|
1336
|
+
() => this.canvas.toDatalessObject([...ts])
|
|
1337
1337
|
);
|
|
1338
1338
|
if (console.timeEnd("saveState"), !this.baseState) {
|
|
1339
1339
|
this.baseState = t, this.patches = [], this.currentIndex = 0, console.log("Базовое состояние сохранено.");
|
|
@@ -1381,8 +1381,8 @@ class Kt {
|
|
|
1381
1381
|
if (!t) return;
|
|
1382
1382
|
console.log("loadStateFromFullState fullState", t);
|
|
1383
1383
|
const { canvas: e, canvasManager: s, interactionBlocker: o, backgroundManager: n } = this.editor, { width: i, height: a } = e;
|
|
1384
|
-
o.overlayMask = null,
|
|
1385
|
-
|
|
1384
|
+
o.overlayMask = null, Qt._serializeCustomData(t), yield e.loadFromJSON(t, (l, u) => {
|
|
1385
|
+
Qt._deserializeCustomData(l, u);
|
|
1386
1386
|
});
|
|
1387
1387
|
const r = e.getObjects().find((l) => l.id === "montage-area");
|
|
1388
1388
|
r && (this.editor.montageArea = r, (i !== e.getWidth() || a !== e.getHeight()) && s.updateCanvas());
|
|
@@ -1496,7 +1496,7 @@ class Kt {
|
|
|
1496
1496
|
}
|
|
1497
1497
|
}
|
|
1498
1498
|
}
|
|
1499
|
-
const
|
|
1499
|
+
const Fs = 0.1, Hs = 2, Fe = 0.1, Ws = 90, It = 16, Ct = 16, ft = 4096, pt = 4096, He = "application/image-editor:", Gt = [
|
|
1500
1500
|
"format",
|
|
1501
1501
|
"uppercase",
|
|
1502
1502
|
"textCaseRaw",
|
|
@@ -1510,7 +1510,7 @@ const Ys = 0.1, Fs = 2, Ye = 0.1, Hs = 90, It = 16, Ct = 16, ft = 4096, pt = 409
|
|
|
1510
1510
|
"radiusTopRight",
|
|
1511
1511
|
"radiusBottomRight",
|
|
1512
1512
|
"radiusBottomLeft"
|
|
1513
|
-
],
|
|
1513
|
+
], Zs = 50;
|
|
1514
1514
|
class at {
|
|
1515
1515
|
constructor({ editor: t }) {
|
|
1516
1516
|
this.editor = t, this.options = t.options, this._createdBlobUrls = [], this.acceptContentTypes = this.editor.options.acceptContentTypes, this.acceptFormats = this.getAllowedFormatsFromContentTypes();
|
|
@@ -1584,20 +1584,20 @@ class at {
|
|
|
1584
1584
|
}
|
|
1585
1585
|
}), null;
|
|
1586
1586
|
if (this._createdBlobUrls.push(v), f === "svg") {
|
|
1587
|
-
const S = yield
|
|
1588
|
-
b =
|
|
1587
|
+
const S = yield ls(v);
|
|
1588
|
+
b = rt.groupSVGElements(S.objects, S.options);
|
|
1589
1589
|
} else
|
|
1590
|
-
b = yield
|
|
1590
|
+
b = yield Bt.fromURL(v, { crossOrigin: "anonymous" });
|
|
1591
1591
|
const { width: I, height: y } = b;
|
|
1592
|
-
if (b instanceof
|
|
1592
|
+
if (b instanceof Bt) {
|
|
1593
1593
|
const S = b.getElement();
|
|
1594
1594
|
let A = "";
|
|
1595
1595
|
if (S instanceof HTMLImageElement ? A = S.src : S instanceof HTMLCanvasElement && (A = S.toDataURL()), y > pt || I > ft) {
|
|
1596
1596
|
const M = yield this.resizeImageToBoundaries(A, "max"), C = URL.createObjectURL(M);
|
|
1597
|
-
this._createdBlobUrls.push(C), b = yield
|
|
1597
|
+
this._createdBlobUrls.push(C), b = yield Bt.fromURL(C, { crossOrigin: "anonymous" });
|
|
1598
1598
|
} else if (y < Ct || I < It) {
|
|
1599
1599
|
const M = yield this.resizeImageToBoundaries(A, "min"), C = URL.createObjectURL(M);
|
|
1600
|
-
this._createdBlobUrls.push(C), b = yield
|
|
1600
|
+
this._createdBlobUrls.push(C), b = yield Bt.fromURL(C, { crossOrigin: "anonymous" });
|
|
1601
1601
|
}
|
|
1602
1602
|
}
|
|
1603
1603
|
if (b.set("id", `${b.type}-${Y()}`), b.set("format", f), s === "scale-montage")
|
|
@@ -1734,21 +1734,21 @@ class at {
|
|
|
1734
1734
|
[w]
|
|
1735
1735
|
);
|
|
1736
1736
|
if (d) {
|
|
1737
|
-
const T = p * 0.264583, x = m * 0.264583, Z = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF,
|
|
1737
|
+
const T = p * 0.264583, x = m * 0.264583, Z = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, U = new Z({
|
|
1738
1738
|
orientation: T > x ? "landscape" : "portrait",
|
|
1739
1739
|
unit: "mm",
|
|
1740
1740
|
format: [T, x]
|
|
1741
1741
|
});
|
|
1742
|
-
if (
|
|
1742
|
+
if (U.addImage(String(S), "JPG", 0, 0, T, x), o) {
|
|
1743
1743
|
const X = {
|
|
1744
|
-
image:
|
|
1744
|
+
image: U.output("datauristring"),
|
|
1745
1745
|
format: "pdf",
|
|
1746
1746
|
contentType: "application/pdf",
|
|
1747
1747
|
fileName: e
|
|
1748
1748
|
};
|
|
1749
1749
|
return i.fire("editor:canvas-exported", X), X;
|
|
1750
1750
|
}
|
|
1751
|
-
const F =
|
|
1751
|
+
const F = U.output("blob"), L = {
|
|
1752
1752
|
image: new File([F], e, { type: "application/pdf" }),
|
|
1753
1753
|
format: "pdf",
|
|
1754
1754
|
contentType: "application/pdf",
|
|
@@ -1827,7 +1827,7 @@ class at {
|
|
|
1827
1827
|
};
|
|
1828
1828
|
return a.fire("editor:object-exported", v), v;
|
|
1829
1829
|
}
|
|
1830
|
-
if (n && c instanceof
|
|
1830
|
+
if (n && c instanceof Bt) {
|
|
1831
1831
|
const p = yield createImageBitmap(c.getElement()), m = yield r.post(
|
|
1832
1832
|
"toDataURL",
|
|
1833
1833
|
{
|
|
@@ -1998,11 +1998,11 @@ class at {
|
|
|
1998
1998
|
return e ? e[1] : "";
|
|
1999
1999
|
}
|
|
2000
2000
|
}
|
|
2001
|
-
const Mt = (h, t, e) => Math.max(Math.min(h, e), t),
|
|
2002
|
-
function
|
|
2001
|
+
const Mt = (h, t, e) => Math.max(Math.min(h, e), t), We = (h, t) => h * t, Gs = (h, t) => new $(h / 2, t / 2);
|
|
2002
|
+
function Vs(h) {
|
|
2003
2003
|
return ((h == null ? void 0 : h.type) === "image" || (h == null ? void 0 : h.format) === "svg") && typeof (h == null ? void 0 : h.width) == "number" && typeof (h == null ? void 0 : h.height) == "number";
|
|
2004
2004
|
}
|
|
2005
|
-
class
|
|
2005
|
+
class Xs {
|
|
2006
2006
|
/**
|
|
2007
2007
|
* @param options
|
|
2008
2008
|
* @param options.editor – экземпляр редактора
|
|
@@ -2035,7 +2035,7 @@ class Vs {
|
|
|
2035
2035
|
options: { canvasBackstoreWidth: a }
|
|
2036
2036
|
} = this.editor, { width: r, height: c } = i, d = Mt(Number(t), It, ft);
|
|
2037
2037
|
if (!a || a === "auto" || o ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreWidth(Number(a)) : this.setCanvasBackstoreWidth(d), i.set({ width: d }), (f = n.clipPath) == null || f.set({ width: d }), e) {
|
|
2038
|
-
const p = d / r, m =
|
|
2038
|
+
const p = d / r, m = We(c, p);
|
|
2039
2039
|
this.setResolutionHeight(m);
|
|
2040
2040
|
return;
|
|
2041
2041
|
}
|
|
@@ -2065,7 +2065,7 @@ class Vs {
|
|
|
2065
2065
|
options: { canvasBackstoreHeight: a }
|
|
2066
2066
|
} = this.editor, { width: r, height: c } = i, d = Mt(Number(t), Ct, pt);
|
|
2067
2067
|
if (!a || a === "auto" || o ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreHeight(Number(a)) : this.setCanvasBackstoreHeight(d), i.set({ height: d }), (f = n.clipPath) == null || f.set({ height: d }), e) {
|
|
2068
|
-
const p = d / c, m =
|
|
2068
|
+
const p = d / c, m = We(r, p);
|
|
2069
2069
|
this.setResolutionWidth(m);
|
|
2070
2070
|
return;
|
|
2071
2071
|
}
|
|
@@ -2083,7 +2083,7 @@ class Vs {
|
|
|
2083
2083
|
*/
|
|
2084
2084
|
centerMontageArea() {
|
|
2085
2085
|
var r;
|
|
2086
|
-
const { canvas: t, montageArea: e } = this.editor, s = t.getWidth(), o = t.getHeight(), n = t.getZoom(), i =
|
|
2086
|
+
const { canvas: t, montageArea: e } = this.editor, s = t.getWidth(), o = t.getHeight(), n = t.getZoom(), i = Gs(s, o);
|
|
2087
2087
|
e.set({
|
|
2088
2088
|
left: s / 2,
|
|
2089
2089
|
top: o / 2
|
|
@@ -2168,7 +2168,7 @@ class Vs {
|
|
|
2168
2168
|
if (d.length === 1)
|
|
2169
2169
|
t.setActiveObject(d[0]);
|
|
2170
2170
|
else {
|
|
2171
|
-
const l = new
|
|
2171
|
+
const l = new k(d, {
|
|
2172
2172
|
canvas: t
|
|
2173
2173
|
});
|
|
2174
2174
|
t.setActiveObject(l);
|
|
@@ -2334,7 +2334,7 @@ class Vs {
|
|
|
2334
2334
|
montageAreaHeight: r
|
|
2335
2335
|
}
|
|
2336
2336
|
} = this.editor, c = t || o.getActiveObject();
|
|
2337
|
-
if (!
|
|
2337
|
+
if (!Vs(c)) return;
|
|
2338
2338
|
const { width: d, height: l } = c;
|
|
2339
2339
|
let u = Math.min(d, ft), g = Math.min(l, pt);
|
|
2340
2340
|
if (e) {
|
|
@@ -2394,7 +2394,7 @@ class Vs {
|
|
|
2394
2394
|
);
|
|
2395
2395
|
}
|
|
2396
2396
|
}
|
|
2397
|
-
class
|
|
2397
|
+
class Ks {
|
|
2398
2398
|
constructor({ editor: t }) {
|
|
2399
2399
|
this.editor = t, this.options = t.options;
|
|
2400
2400
|
}
|
|
@@ -2405,7 +2405,7 @@ class Xs {
|
|
|
2405
2405
|
* @param options.withoutSave - Не сохранять состояние
|
|
2406
2406
|
* @fires editor:object-rotated
|
|
2407
2407
|
*/
|
|
2408
|
-
rotate(t =
|
|
2408
|
+
rotate(t = Ws, { withoutSave: e } = {}) {
|
|
2409
2409
|
const { canvas: s, historyManager: o } = this.editor, n = s.getActiveObject();
|
|
2410
2410
|
if (!n) return;
|
|
2411
2411
|
const i = n.angle + t;
|
|
@@ -2455,7 +2455,7 @@ class Xs {
|
|
|
2455
2455
|
withoutSave: s
|
|
2456
2456
|
} = {}) {
|
|
2457
2457
|
const { canvas: o, historyManager: n } = this.editor, i = t || o.getActiveObject();
|
|
2458
|
-
i && (i instanceof
|
|
2458
|
+
i && (i instanceof k ? i.getObjects().forEach((a) => {
|
|
2459
2459
|
a.set("opacity", e);
|
|
2460
2460
|
}) : i.set("opacity", e), o.renderAll(), s || n.saveState(), o.fire("editor:object-opacity-changed", {
|
|
2461
2461
|
object: i,
|
|
@@ -2482,12 +2482,12 @@ class Xs {
|
|
|
2482
2482
|
} = {}) {
|
|
2483
2483
|
const { canvas: n, historyManager: i } = this.editor, a = t || n.getActiveObject();
|
|
2484
2484
|
if (a) {
|
|
2485
|
-
if (a instanceof
|
|
2485
|
+
if (a instanceof k && !o) {
|
|
2486
2486
|
const r = a.getObjects();
|
|
2487
2487
|
n.discardActiveObject(), r.forEach((d) => {
|
|
2488
2488
|
this._fitSingleObject(d, e);
|
|
2489
2489
|
});
|
|
2490
|
-
const c = new
|
|
2490
|
+
const c = new k(r, { canvas: n });
|
|
2491
2491
|
n.setActiveObject(c);
|
|
2492
2492
|
} else
|
|
2493
2493
|
this._fitSingleObject(a, e);
|
|
@@ -2560,9 +2560,9 @@ class Xs {
|
|
|
2560
2560
|
});
|
|
2561
2561
|
}
|
|
2562
2562
|
}
|
|
2563
|
-
class
|
|
2563
|
+
class Qs {
|
|
2564
2564
|
constructor({ editor: t }) {
|
|
2565
|
-
this.editor = t, this.options = t.options, this.minZoom = this.options.minZoom ||
|
|
2565
|
+
this.editor = t, this.options = t.options, this.minZoom = this.options.minZoom || Fs, this.maxZoom = this.options.maxZoom || Hs, this.defaultZoom = this.options.defaultScale;
|
|
2566
2566
|
}
|
|
2567
2567
|
/**
|
|
2568
2568
|
* Вспомогательный метод для вычисления размеров масштабированной монтажной области
|
|
@@ -2651,7 +2651,7 @@ class Ks {
|
|
|
2651
2651
|
* @returns true если центрирование было применено
|
|
2652
2652
|
* @private
|
|
2653
2653
|
*/
|
|
2654
|
-
_applyViewportCentering(t, e = !1, s =
|
|
2654
|
+
_applyViewportCentering(t, e = !1, s = Fe) {
|
|
2655
2655
|
const { canvas: o } = this.editor, n = this._getScaledMontageDimensions(t), i = o.getWidth(), a = o.getHeight(), r = n.width > i || n.height > a, c = this._calculateFitZoom(), d = t - c;
|
|
2656
2656
|
if (!(!r || d) && !e)
|
|
2657
2657
|
return !1;
|
|
@@ -2726,7 +2726,7 @@ class Ks {
|
|
|
2726
2726
|
* @param options.pointY - Координата Y точки зума
|
|
2727
2727
|
* @fires editor:zoom-changed
|
|
2728
2728
|
*/
|
|
2729
|
-
zoom(t =
|
|
2729
|
+
zoom(t = Fe, e = {}) {
|
|
2730
2730
|
var g, f;
|
|
2731
2731
|
if (!t) return;
|
|
2732
2732
|
const { minZoom: s, maxZoom: o } = this, { canvas: n } = this.editor, i = t < 0, a = n.getZoom(), r = n.getCenterPoint(), c = (g = e.pointX) != null ? g : r.x, d = (f = e.pointY) != null ? f : r.y, l = new $(c, d);
|
|
@@ -2764,7 +2764,7 @@ class Ks {
|
|
|
2764
2764
|
}), this.editor.panConstraintManager.updateBounds();
|
|
2765
2765
|
}
|
|
2766
2766
|
}
|
|
2767
|
-
class
|
|
2767
|
+
class qs {
|
|
2768
2768
|
constructor({ editor: t }) {
|
|
2769
2769
|
this.editor = t, this.isBlocked = !1, this.overlayMask = null, this._createOverlay();
|
|
2770
2770
|
}
|
|
@@ -3156,7 +3156,7 @@ class St {
|
|
|
3156
3156
|
}) ? !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;
|
|
3157
3157
|
}
|
|
3158
3158
|
}
|
|
3159
|
-
class
|
|
3159
|
+
class qt {
|
|
3160
3160
|
constructor({ editor: t }) {
|
|
3161
3161
|
this.editor = t;
|
|
3162
3162
|
}
|
|
@@ -3171,7 +3171,7 @@ class Qt {
|
|
|
3171
3171
|
const { canvas: s, historyManager: o } = this.editor;
|
|
3172
3172
|
o.suspendHistory();
|
|
3173
3173
|
const n = t || s.getActiveObject();
|
|
3174
|
-
n && (n instanceof
|
|
3174
|
+
n && (n instanceof k ? n.getObjects().forEach((i) => {
|
|
3175
3175
|
s.bringObjectToFront(i);
|
|
3176
3176
|
}) : s.bringObjectToFront(n), s.renderAll(), o.resumeHistory(), e || o.saveState(), s.fire("editor:object-bring-to-front", {
|
|
3177
3177
|
object: n,
|
|
@@ -3189,7 +3189,7 @@ class Qt {
|
|
|
3189
3189
|
const { canvas: s, historyManager: o } = this.editor;
|
|
3190
3190
|
o.suspendHistory();
|
|
3191
3191
|
const n = t || s.getActiveObject();
|
|
3192
|
-
n && (n instanceof
|
|
3192
|
+
n && (n instanceof k ? qt._moveSelectionForward(s, n) : s.bringObjectForward(n), s.renderAll(), o.resumeHistory(), e || o.saveState(), s.fire("editor:object-bring-forward", {
|
|
3193
3193
|
object: n,
|
|
3194
3194
|
withoutSave: e
|
|
3195
3195
|
}));
|
|
@@ -3212,7 +3212,7 @@ class Qt {
|
|
|
3212
3212
|
n.suspendHistory();
|
|
3213
3213
|
const r = t || s.getActiveObject();
|
|
3214
3214
|
if (r) {
|
|
3215
|
-
if (r instanceof
|
|
3215
|
+
if (r instanceof k) {
|
|
3216
3216
|
const c = r.getObjects();
|
|
3217
3217
|
for (let d = c.length - 1; d >= 0; d -= 1)
|
|
3218
3218
|
s.sendObjectToBack(c[d]);
|
|
@@ -3240,7 +3240,7 @@ class Qt {
|
|
|
3240
3240
|
} = this.editor;
|
|
3241
3241
|
n.suspendHistory();
|
|
3242
3242
|
const r = t || s.getActiveObject();
|
|
3243
|
-
r && (r instanceof
|
|
3243
|
+
r && (r instanceof k ? qt._moveSelectionBackwards(s, r) : s.sendObjectBackwards(r), a && s.sendObjectToBack(a), s.sendObjectToBack(o), i && s.sendObjectToBack(i), s.renderAll(), n.resumeHistory(), e || n.saveState(), s.fire("editor:object-send-backwards", {
|
|
3244
3244
|
object: r,
|
|
3245
3245
|
withoutSave: e
|
|
3246
3246
|
}));
|
|
@@ -3284,7 +3284,7 @@ class Qt {
|
|
|
3284
3284
|
});
|
|
3285
3285
|
}
|
|
3286
3286
|
}
|
|
3287
|
-
class
|
|
3287
|
+
class $s {
|
|
3288
3288
|
/**
|
|
3289
3289
|
* Менеджер фигур для редактора.
|
|
3290
3290
|
* @param options - Опции и настройки менеджера фигур.
|
|
@@ -3324,7 +3324,7 @@ class qs {
|
|
|
3324
3324
|
"height",
|
|
3325
3325
|
"fill"
|
|
3326
3326
|
]);
|
|
3327
|
-
const { canvas: u } = this.editor, g = new
|
|
3327
|
+
const { canvas: u } = this.editor, g = new hs(B({
|
|
3328
3328
|
id: t,
|
|
3329
3329
|
left: e,
|
|
3330
3330
|
top: s,
|
|
@@ -3364,7 +3364,7 @@ class qs {
|
|
|
3364
3364
|
"radius",
|
|
3365
3365
|
"fill"
|
|
3366
3366
|
]);
|
|
3367
|
-
const { canvas: l } = this.editor, u = new
|
|
3367
|
+
const { canvas: l } = this.editor, u = new us(B({
|
|
3368
3368
|
id: t,
|
|
3369
3369
|
left: e,
|
|
3370
3370
|
top: s,
|
|
@@ -3406,7 +3406,7 @@ class qs {
|
|
|
3406
3406
|
"height",
|
|
3407
3407
|
"fill"
|
|
3408
3408
|
]);
|
|
3409
|
-
const { canvas: u } = this.editor, g = new
|
|
3409
|
+
const { canvas: u } = this.editor, g = new gs(B({
|
|
3410
3410
|
id: t,
|
|
3411
3411
|
left: e,
|
|
3412
3412
|
top: s,
|
|
@@ -3417,7 +3417,7 @@ class qs {
|
|
|
3417
3417
|
return !e && !s && u.centerObject(g), c || (u.add(g), r || u.setActiveObject(g), u.renderAll()), g;
|
|
3418
3418
|
}
|
|
3419
3419
|
}
|
|
3420
|
-
class
|
|
3420
|
+
class Js {
|
|
3421
3421
|
/**
|
|
3422
3422
|
* @param options
|
|
3423
3423
|
* @param options.editor - экземпляр редактора с доступом к canvas
|
|
@@ -3516,7 +3516,7 @@ class $s {
|
|
|
3516
3516
|
_copyTextToClipboard(t) {
|
|
3517
3517
|
return _(this, null, function* () {
|
|
3518
3518
|
try {
|
|
3519
|
-
const e = `${
|
|
3519
|
+
const e = `${He}${t}`;
|
|
3520
3520
|
return yield navigator.clipboard.writeText(e), console.info("Text copied to clipboard successfully"), !0;
|
|
3521
3521
|
} catch (e) {
|
|
3522
3522
|
const { errorManager: s } = this.editor;
|
|
@@ -3536,7 +3536,7 @@ class $s {
|
|
|
3536
3536
|
*/
|
|
3537
3537
|
_addClonedObjectToCanvas(t) {
|
|
3538
3538
|
const { canvas: e, historyManager: s } = this.editor;
|
|
3539
|
-
if (e.discardActiveObject(), t instanceof
|
|
3539
|
+
if (e.discardActiveObject(), t instanceof k) {
|
|
3540
3540
|
s.suspendHistory(), t.canvas = e, t.forEachObject((o) => {
|
|
3541
3541
|
e.add(o);
|
|
3542
3542
|
}), e.setActiveObject(t), e.requestRenderAll(), s.resumeHistory(), s.saveState();
|
|
@@ -3570,7 +3570,7 @@ class $s {
|
|
|
3570
3570
|
if (!s || s.locked) return !1;
|
|
3571
3571
|
try {
|
|
3572
3572
|
const o = yield s.clone(Gt);
|
|
3573
|
-
return o instanceof
|
|
3573
|
+
return o instanceof k && o.forEachObject((n) => {
|
|
3574
3574
|
n.set({
|
|
3575
3575
|
id: `${n.type}-${Y()}`,
|
|
3576
3576
|
evented: !0
|
|
@@ -3607,7 +3607,7 @@ class $s {
|
|
|
3607
3607
|
return;
|
|
3608
3608
|
}
|
|
3609
3609
|
const s = t.getData("text/plain");
|
|
3610
|
-
if (s && s.startsWith(
|
|
3610
|
+
if (s && s.startsWith(He)) {
|
|
3611
3611
|
this.paste();
|
|
3612
3612
|
return;
|
|
3613
3613
|
}
|
|
@@ -3656,7 +3656,7 @@ class $s {
|
|
|
3656
3656
|
if (!this.clipboard) return !1;
|
|
3657
3657
|
try {
|
|
3658
3658
|
const e = yield this.clipboard.clone(Gt);
|
|
3659
|
-
return t.discardActiveObject(), e instanceof
|
|
3659
|
+
return t.discardActiveObject(), e instanceof k && e.forEachObject((s) => {
|
|
3660
3660
|
s.set({
|
|
3661
3661
|
id: `${s.type}-${Y()}`,
|
|
3662
3662
|
evented: !0
|
|
@@ -3680,7 +3680,7 @@ class $s {
|
|
|
3680
3680
|
});
|
|
3681
3681
|
}
|
|
3682
3682
|
}
|
|
3683
|
-
class
|
|
3683
|
+
class $t {
|
|
3684
3684
|
constructor({ editor: t }) {
|
|
3685
3685
|
this.editor = t;
|
|
3686
3686
|
}
|
|
@@ -3706,7 +3706,7 @@ class qt {
|
|
|
3706
3706
|
editable: !1,
|
|
3707
3707
|
locked: !0
|
|
3708
3708
|
};
|
|
3709
|
-
i.set(a), !e &&
|
|
3709
|
+
i.set(a), !e && $t._isGroupOrSelection(i) && i.getObjects().forEach((c) => {
|
|
3710
3710
|
c.set(a);
|
|
3711
3711
|
}), o.renderAll(), s || n.saveState(), o.fire("editor:object-locked", {
|
|
3712
3712
|
object: i,
|
|
@@ -3735,7 +3735,7 @@ class qt {
|
|
|
3735
3735
|
editable: !0,
|
|
3736
3736
|
locked: !1
|
|
3737
3737
|
};
|
|
3738
|
-
n.set(i),
|
|
3738
|
+
n.set(i), $t._isGroupOrSelection(n) && n.getObjects().forEach((a) => {
|
|
3739
3739
|
a.set(i);
|
|
3740
3740
|
}), s.renderAll(), e || o.saveState(), s.fire("editor:object-unlocked", {
|
|
3741
3741
|
object: n,
|
|
@@ -3743,10 +3743,10 @@ class qt {
|
|
|
3743
3743
|
});
|
|
3744
3744
|
}
|
|
3745
3745
|
static _isGroupOrSelection(t) {
|
|
3746
|
-
return t instanceof
|
|
3746
|
+
return t instanceof k || t instanceof wt;
|
|
3747
3747
|
}
|
|
3748
3748
|
}
|
|
3749
|
-
class
|
|
3749
|
+
class to {
|
|
3750
3750
|
constructor({ editor: t }) {
|
|
3751
3751
|
this.editor = t;
|
|
3752
3752
|
}
|
|
@@ -3758,7 +3758,7 @@ class Js {
|
|
|
3758
3758
|
if (Array.isArray(t))
|
|
3759
3759
|
return t.length > 0 ? t : null;
|
|
3760
3760
|
const e = t || this.editor.canvas.getActiveObject();
|
|
3761
|
-
return !e || !(e instanceof
|
|
3761
|
+
return !e || !(e instanceof k) ? null : e.getObjects();
|
|
3762
3762
|
}
|
|
3763
3763
|
/**
|
|
3764
3764
|
* Получить группы для разгруппировки
|
|
@@ -3769,13 +3769,13 @@ class Js {
|
|
|
3769
3769
|
const s = t.filter((o) => o instanceof wt);
|
|
3770
3770
|
return s.length > 0 ? s : null;
|
|
3771
3771
|
}
|
|
3772
|
-
if (t instanceof
|
|
3772
|
+
if (t instanceof k) {
|
|
3773
3773
|
const s = t.getObjects().filter((o) => o instanceof wt);
|
|
3774
3774
|
return s.length > 0 ? s : null;
|
|
3775
3775
|
}
|
|
3776
3776
|
const e = t || this.editor.canvas.getActiveObject();
|
|
3777
3777
|
if (!e) return null;
|
|
3778
|
-
if (e instanceof
|
|
3778
|
+
if (e instanceof k) {
|
|
3779
3779
|
const s = e.getObjects().filter((o) => o instanceof wt);
|
|
3780
3780
|
return s.length > 0 ? s : null;
|
|
3781
3781
|
}
|
|
@@ -3832,7 +3832,7 @@ class Js {
|
|
|
3832
3832
|
s.add(l), i.push(l);
|
|
3833
3833
|
});
|
|
3834
3834
|
});
|
|
3835
|
-
const a = new
|
|
3835
|
+
const a = new k(i, {
|
|
3836
3836
|
canvas: s
|
|
3837
3837
|
});
|
|
3838
3838
|
s.setActiveObject(a), s.requestRenderAll();
|
|
@@ -3847,7 +3847,7 @@ class Js {
|
|
|
3847
3847
|
}
|
|
3848
3848
|
}
|
|
3849
3849
|
}
|
|
3850
|
-
class
|
|
3850
|
+
class eo {
|
|
3851
3851
|
constructor({ editor: t }) {
|
|
3852
3852
|
this.editor = t;
|
|
3853
3853
|
}
|
|
@@ -3858,11 +3858,11 @@ class to {
|
|
|
3858
3858
|
selectAll() {
|
|
3859
3859
|
const { canvas: t, canvasManager: e, objectLockManager: s } = this.editor;
|
|
3860
3860
|
t.discardActiveObject();
|
|
3861
|
-
const o = e.getObjects(), n = o.some((a) => a.locked), i = o.length > 1 ? new
|
|
3861
|
+
const o = e.getObjects(), n = o.some((a) => a.locked), i = o.length > 1 ? new k(e.getObjects(), { canvas: t }) : o[0];
|
|
3862
3862
|
n && s.lockObject({ object: i, skipInnerObjects: !0, withoutSave: !0 }), t.setActiveObject(i), t.requestRenderAll(), t.fire("editor:all-objects-selected", { selected: i });
|
|
3863
3863
|
}
|
|
3864
3864
|
}
|
|
3865
|
-
class
|
|
3865
|
+
class Me {
|
|
3866
3866
|
constructor({ editor: t }) {
|
|
3867
3867
|
this.editor = t;
|
|
3868
3868
|
}
|
|
@@ -3909,7 +3909,7 @@ class be {
|
|
|
3909
3909
|
s || n.suspendHistory();
|
|
3910
3910
|
const r = [];
|
|
3911
3911
|
if (a.forEach((d) => {
|
|
3912
|
-
if (
|
|
3912
|
+
if (Me._isUngroupableGroup(d)) {
|
|
3913
3913
|
const l = this._handleGroupDeletion(d);
|
|
3914
3914
|
r.push(...l);
|
|
3915
3915
|
return;
|
|
@@ -4070,7 +4070,7 @@ class zt {
|
|
|
4070
4070
|
message: i,
|
|
4071
4071
|
data: o
|
|
4072
4072
|
};
|
|
4073
|
-
this._buffer.push(
|
|
4073
|
+
this._buffer.push(B({
|
|
4074
4074
|
type: "editor:error"
|
|
4075
4075
|
}, a)), this.editor.canvas.fire("editor:error", a);
|
|
4076
4076
|
}
|
|
@@ -4098,7 +4098,7 @@ class zt {
|
|
|
4098
4098
|
message: i,
|
|
4099
4099
|
data: n
|
|
4100
4100
|
};
|
|
4101
|
-
this._buffer.push(
|
|
4101
|
+
this._buffer.push(B({
|
|
4102
4102
|
type: "editor:warning"
|
|
4103
4103
|
}, a)), this.editor.canvas.fire("editor:warning", a);
|
|
4104
4104
|
}
|
|
@@ -4111,7 +4111,7 @@ class zt {
|
|
|
4111
4111
|
return t ? Object.values(gt).some((e) => Object.values(e).includes(t)) : !1;
|
|
4112
4112
|
}
|
|
4113
4113
|
}
|
|
4114
|
-
class
|
|
4114
|
+
class so {
|
|
4115
4115
|
constructor({ editor: t }) {
|
|
4116
4116
|
this.currentBounds = null, this.editor = t;
|
|
4117
4117
|
}
|
|
@@ -4219,7 +4219,7 @@ const nt = ({
|
|
|
4219
4219
|
}
|
|
4220
4220
|
_getTransformedDimensions(t = {}) {
|
|
4221
4221
|
const { width: e, height: s } = this._getBackgroundDimensions();
|
|
4222
|
-
return super._getTransformedDimensions(bt(
|
|
4222
|
+
return super._getTransformedDimensions(bt(B({}, t), {
|
|
4223
4223
|
width: e,
|
|
4224
4224
|
height: s
|
|
4225
4225
|
}));
|
|
@@ -4229,7 +4229,7 @@ const nt = ({
|
|
|
4229
4229
|
*/
|
|
4230
4230
|
toObject(t = []) {
|
|
4231
4231
|
const e = super.toObject(t);
|
|
4232
|
-
return bt(
|
|
4232
|
+
return bt(B({}, e), {
|
|
4233
4233
|
backgroundOpacity: this.backgroundOpacity,
|
|
4234
4234
|
paddingTop: this.paddingTop,
|
|
4235
4235
|
paddingRight: this.paddingRight,
|
|
@@ -4290,7 +4290,7 @@ const nt = ({
|
|
|
4290
4290
|
const e = nt({ value: (o = this.backgroundOpacity) != null ? o : 1, min: 0, max: 1 });
|
|
4291
4291
|
let s;
|
|
4292
4292
|
try {
|
|
4293
|
-
s = new
|
|
4293
|
+
s = new fs(t);
|
|
4294
4294
|
} catch (n) {
|
|
4295
4295
|
return zt.emitError({
|
|
4296
4296
|
origin: "BackgroundTextbox",
|
|
@@ -4344,11 +4344,11 @@ jt.type = "background-textbox", jt.cacheProperties = [
|
|
|
4344
4344
|
"radiusBottomRight",
|
|
4345
4345
|
"radiusBottomLeft"
|
|
4346
4346
|
];
|
|
4347
|
-
let
|
|
4348
|
-
const
|
|
4347
|
+
let Jt = jt;
|
|
4348
|
+
const oo = () => {
|
|
4349
4349
|
var h;
|
|
4350
|
-
(h =
|
|
4351
|
-
},
|
|
4350
|
+
(h = xe) != null && h.setClass && xe.setClass(Jt, "background-textbox");
|
|
4351
|
+
}, no = ({ textbox: h }) => {
|
|
4352
4352
|
var s, o;
|
|
4353
4353
|
if (!h.isEditing) return null;
|
|
4354
4354
|
const t = (s = h.selectionStart) != null ? s : 0, e = (o = h.selectionEnd) != null ? o : t;
|
|
@@ -4356,16 +4356,16 @@ const so = () => {
|
|
|
4356
4356
|
start: Math.min(t, e),
|
|
4357
4357
|
end: Math.max(t, e)
|
|
4358
4358
|
};
|
|
4359
|
-
},
|
|
4359
|
+
}, io = ({ textbox: h }) => {
|
|
4360
4360
|
var e, s;
|
|
4361
4361
|
const t = (s = (e = h.text) == null ? void 0 : e.length) != null ? s : 0;
|
|
4362
4362
|
return t <= 0 ? null : { start: 0, end: t };
|
|
4363
|
-
},
|
|
4363
|
+
}, ao = ({ textbox: h, range: t }) => {
|
|
4364
4364
|
var s, o;
|
|
4365
4365
|
if (!t) return !1;
|
|
4366
4366
|
const e = (o = (s = h.text) == null ? void 0 : s.length) != null ? o : 0;
|
|
4367
4367
|
return e <= 0 ? !1 : t.start <= 0 && t.end >= e;
|
|
4368
|
-
},
|
|
4368
|
+
}, oe = ({
|
|
4369
4369
|
textbox: h,
|
|
4370
4370
|
styles: t,
|
|
4371
4371
|
range: e
|
|
@@ -4373,7 +4373,7 @@ const so = () => {
|
|
|
4373
4373
|
if (!t || !Object.keys(t).length) return !1;
|
|
4374
4374
|
const { start: s, end: o } = e;
|
|
4375
4375
|
return o <= s ? !1 : (h.setSelectionStyles(t, s, o), !0);
|
|
4376
|
-
},
|
|
4376
|
+
}, Ze = ({
|
|
4377
4377
|
textbox: h,
|
|
4378
4378
|
range: t,
|
|
4379
4379
|
property: e
|
|
@@ -4387,10 +4387,10 @@ const so = () => {
|
|
|
4387
4387
|
);
|
|
4388
4388
|
if (s.length)
|
|
4389
4389
|
return (o = s[0]) == null ? void 0 : o[e];
|
|
4390
|
-
},
|
|
4390
|
+
}, Ge = ({ strokeColor: h, width: t }) => {
|
|
4391
4391
|
if (!(t <= 0))
|
|
4392
4392
|
return h != null ? h : "#000000";
|
|
4393
|
-
},
|
|
4393
|
+
}, Ve = ({ width: h = 0 }) => h ? Math.max(0, h) : 0, ne = ({ value: h }) => typeof h == "string" ? h.toLocaleUpperCase() : "", J = 0.01;
|
|
4394
4394
|
class q {
|
|
4395
4395
|
constructor({ editor: t }) {
|
|
4396
4396
|
var e;
|
|
@@ -4411,11 +4411,11 @@ class q {
|
|
|
4411
4411
|
lockMovementY: !1
|
|
4412
4412
|
}), setTimeout(() => {
|
|
4413
4413
|
this.isTextEditingActive = !1, this.editor.historyManager.saveState();
|
|
4414
|
-
},
|
|
4414
|
+
}, Zs);
|
|
4415
4415
|
}, this._handleObjectScaling = (s) => {
|
|
4416
|
-
var Nt, W, yt, Yt, ht, Ft, vt,
|
|
4416
|
+
var Nt, W, yt, Yt, ht, Ft, vt, Se, Ae, je, Ie, Ce, Te;
|
|
4417
4417
|
const { target: o, transform: n } = s;
|
|
4418
|
-
if (o instanceof
|
|
4418
|
+
if (o instanceof k) {
|
|
4419
4419
|
this._handleActiveSelectionScaling({
|
|
4420
4420
|
selection: o,
|
|
4421
4421
|
transform: n
|
|
@@ -4433,11 +4433,11 @@ class q {
|
|
|
4433
4433
|
baseStyles: u
|
|
4434
4434
|
} = i, g = typeof ((Nt = n.original) == null ? void 0 : Nt.width) == "number" ? n.original.width : void 0, f = typeof ((W = n.original) == null ? void 0 : W.left) == "number" ? n.original.left : void 0, p = g != null ? g : a, m = f != null ? f : r, v = (yt = n.corner) != null ? yt : "", b = (Yt = n.action) != null ? Yt : "", I = ["ml", "mr"].includes(v) || b === "scaleX", y = ["mt", "mb"].includes(v) || b === "scaleY", w = ["tl", "tr", "bl", "br"].includes(v) || b === "scale", S = w || y;
|
|
4435
4435
|
if (!I && !y && !w) return;
|
|
4436
|
-
const A = Math.abs((Ft = (ht = o.scaleX) != null ? ht : n.scaleX) != null ? Ft : 1) || 1, M = Math.abs((
|
|
4436
|
+
const A = Math.abs((Ft = (ht = o.scaleX) != null ? ht : n.scaleX) != null ? Ft : 1) || 1, M = Math.abs((Se = (vt = o.scaleY) != null ? vt : n.scaleY) != null ? Se : 1) || 1, C = Math.max(1, p * A), j = Math.max(1, c * M), {
|
|
4437
4437
|
paddingTop: T = 0,
|
|
4438
4438
|
paddingRight: x = 0,
|
|
4439
4439
|
paddingBottom: Z = 0,
|
|
4440
|
-
paddingLeft:
|
|
4440
|
+
paddingLeft: U = 0,
|
|
4441
4441
|
radiusTopLeft: F = 0,
|
|
4442
4442
|
radiusTopRight: K = 0,
|
|
4443
4443
|
radiusBottomRight: L = 0,
|
|
@@ -4450,27 +4450,27 @@ class q {
|
|
|
4450
4450
|
right: Math.max(0, d.right * M),
|
|
4451
4451
|
bottom: Math.max(0, d.bottom * M),
|
|
4452
4452
|
left: Math.max(0, d.left * M)
|
|
4453
|
-
} : d,
|
|
4453
|
+
} : d, P = et ? {
|
|
4454
4454
|
topLeft: Math.max(0, l.topLeft * M),
|
|
4455
4455
|
topRight: Math.max(0, l.topRight * M),
|
|
4456
4456
|
bottomRight: Math.max(0, l.bottomRight * M),
|
|
4457
4457
|
bottomLeft: Math.max(0, l.bottomLeft * M)
|
|
4458
|
-
} : l,
|
|
4458
|
+
} : l, Pt = Object.keys(u).length > 0;
|
|
4459
4459
|
let mt;
|
|
4460
|
-
if (S &&
|
|
4461
|
-
const
|
|
4462
|
-
Object.entries(u).forEach(([
|
|
4463
|
-
if (!
|
|
4464
|
-
const
|
|
4465
|
-
Object.entries(
|
|
4460
|
+
if (S && Pt) {
|
|
4461
|
+
const ee = {};
|
|
4462
|
+
Object.entries(u).forEach(([is, Ee]) => {
|
|
4463
|
+
if (!Ee) return;
|
|
4464
|
+
const se = {};
|
|
4465
|
+
Object.entries(Ee).forEach(([as, Ht]) => {
|
|
4466
4466
|
if (!Ht) return;
|
|
4467
|
-
const
|
|
4468
|
-
typeof Ht.fontSize == "number" && (
|
|
4469
|
-
}), Object.keys(
|
|
4470
|
-
}), Object.keys(
|
|
4467
|
+
const Oe = B({}, Ht);
|
|
4468
|
+
typeof Ht.fontSize == "number" && (Oe.fontSize = Math.max(1, Ht.fontSize * M)), se[as] = Oe;
|
|
4469
|
+
}), Object.keys(se).length && (ee[is] = se);
|
|
4470
|
+
}), Object.keys(ee).length && (mt = ee);
|
|
4471
4471
|
}
|
|
4472
|
-
const Tt = (
|
|
4473
|
-
if (!Lt && !
|
|
4472
|
+
const Tt = (je = (Ae = n.originX) != null ? Ae : G) != null ? je : "left", Et = m + p, Ot = m + p / 2, te = H != null ? H : p, Lt = Math.abs(C - te) > J, Ut = Math.abs(j - (X != null ? X : c)) > J, Dt = Math.abs(z.top - T) > J || Math.abs(z.right - x) > J || Math.abs(z.bottom - Z) > J || Math.abs(z.left - U) > J, Rt = Math.abs(P.topLeft - F) > J || Math.abs(P.topRight - K) > J || Math.abs(P.bottomRight - L) > J || Math.abs(P.bottomLeft - R) > J;
|
|
4473
|
+
if (!Lt && !Ut && !Dt && !Rt) {
|
|
4474
4474
|
o.set({ scaleX: 1, scaleY: 1 }), n.scaleX = 1, n.scaleY = 1;
|
|
4475
4475
|
return;
|
|
4476
4476
|
}
|
|
@@ -4481,32 +4481,32 @@ class q {
|
|
|
4481
4481
|
paddingRight: z.right,
|
|
4482
4482
|
paddingBottom: z.bottom,
|
|
4483
4483
|
paddingLeft: z.left,
|
|
4484
|
-
radiusTopLeft:
|
|
4485
|
-
radiusTopRight:
|
|
4486
|
-
radiusBottomRight:
|
|
4487
|
-
radiusBottomLeft:
|
|
4484
|
+
radiusTopLeft: P.topLeft,
|
|
4485
|
+
radiusTopRight: P.topRight,
|
|
4486
|
+
radiusBottomRight: P.bottomRight,
|
|
4487
|
+
radiusBottomLeft: P.bottomLeft,
|
|
4488
4488
|
scaleX: 1,
|
|
4489
4489
|
scaleY: 1
|
|
4490
4490
|
});
|
|
4491
|
-
const
|
|
4492
|
-
let
|
|
4493
|
-
_t && (I || w) && (Tt === "right" ?
|
|
4491
|
+
const ct = (Ie = o.width) != null ? Ie : C, _t = Math.abs(ct - te) > J;
|
|
4492
|
+
let dt = m;
|
|
4493
|
+
_t && (I || w) && (Tt === "right" ? dt = Et - ct : Tt === "center" && (dt = Ot - ct / 2)), o.set({ left: dt }), i.baseLeft = dt, n.scaleX = 1, n.scaleY = 1;
|
|
4494
4494
|
const { original: ot } = n;
|
|
4495
|
-
ot && (ot.scaleX = 1, ot.scaleY = 1, ot.width =
|
|
4495
|
+
ot && (ot.scaleX = 1, ot.scaleY = 1, ot.width = ct, ot.height = o.height, ot.left = dt), o.setCoords(), this.canvas.requestRenderAll(), i.baseWidth = ct, i.baseFontSize = (Ce = o.fontSize) != null ? Ce : j, i.baseStyles = JSON.parse(JSON.stringify((Te = o.styles) != null ? Te : {})), i.basePadding = {
|
|
4496
4496
|
top: z.top,
|
|
4497
4497
|
right: z.right,
|
|
4498
4498
|
bottom: z.bottom,
|
|
4499
4499
|
left: z.left
|
|
4500
4500
|
}, i.baseRadii = {
|
|
4501
|
-
topLeft:
|
|
4502
|
-
topRight:
|
|
4503
|
-
bottomRight:
|
|
4504
|
-
bottomLeft:
|
|
4505
|
-
}, i.hasWidthChange = _t ||
|
|
4501
|
+
topLeft: P.topLeft,
|
|
4502
|
+
topRight: P.topRight,
|
|
4503
|
+
bottomRight: P.bottomRight,
|
|
4504
|
+
bottomLeft: P.bottomLeft
|
|
4505
|
+
}, i.hasWidthChange = _t || Ut || Dt || Rt;
|
|
4506
4506
|
}, this._handleObjectModified = (s) => {
|
|
4507
4507
|
var b, I, y;
|
|
4508
4508
|
const { target: o } = s;
|
|
4509
|
-
if (o instanceof
|
|
4509
|
+
if (o instanceof k) {
|
|
4510
4510
|
this._finalizeActiveSelectionScaling({
|
|
4511
4511
|
selection: o
|
|
4512
4512
|
});
|
|
@@ -4540,7 +4540,7 @@ class q {
|
|
|
4540
4540
|
target: o,
|
|
4541
4541
|
style: v
|
|
4542
4542
|
}), o.set({ scaleX: 1, scaleY: 1 }), o.setCoords();
|
|
4543
|
-
}, 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(),
|
|
4543
|
+
}, 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(), oo();
|
|
4544
4544
|
}
|
|
4545
4545
|
/**
|
|
4546
4546
|
* Добавляет новый текстовый объект на канвас.
|
|
@@ -4548,7 +4548,7 @@ class q {
|
|
|
4548
4548
|
* @param flags — флаги поведения
|
|
4549
4549
|
*/
|
|
4550
4550
|
addText(Z = {}, { withoutSelection: j = !1, withoutSave: T = !1, withoutAdding: x = !1 } = {}) {
|
|
4551
|
-
var
|
|
4551
|
+
var U = Z, {
|
|
4552
4552
|
id: t = `text-${Y()}`,
|
|
4553
4553
|
text: e = "Новый текст",
|
|
4554
4554
|
fontFamily: s,
|
|
@@ -4573,7 +4573,7 @@ class q {
|
|
|
4573
4573
|
radiusTopRight: S = 0,
|
|
4574
4574
|
radiusBottomRight: A = 0,
|
|
4575
4575
|
radiusBottomLeft: M = 0
|
|
4576
|
-
} =
|
|
4576
|
+
} = U, C = ut(U, [
|
|
4577
4577
|
"id",
|
|
4578
4578
|
"text",
|
|
4579
4579
|
"fontFamily",
|
|
@@ -4602,10 +4602,10 @@ class q {
|
|
|
4602
4602
|
var V;
|
|
4603
4603
|
const { historyManager: F } = this.editor, { canvas: K } = this;
|
|
4604
4604
|
F.suspendHistory();
|
|
4605
|
-
const L = s != null ? s : this._getDefaultFontFamily(), R =
|
|
4605
|
+
const L = s != null ? s : this._getDefaultFontFamily(), R = Ve({ width: g }), X = Ge({
|
|
4606
4606
|
strokeColor: u,
|
|
4607
4607
|
width: R
|
|
4608
|
-
}), H =
|
|
4608
|
+
}), H = B({
|
|
4609
4609
|
id: t,
|
|
4610
4610
|
fontFamily: L,
|
|
4611
4611
|
fontSize: o,
|
|
@@ -4630,14 +4630,14 @@ class q {
|
|
|
4630
4630
|
radiusTopRight: S,
|
|
4631
4631
|
radiusBottomRight: A,
|
|
4632
4632
|
radiusBottomLeft: M
|
|
4633
|
-
}, C), G = new
|
|
4633
|
+
}, C), G = new Jt(e, H);
|
|
4634
4634
|
if (G.textCaseRaw = (V = G.text) != null ? V : "", r) {
|
|
4635
|
-
const et =
|
|
4635
|
+
const et = ne({ value: G.textCaseRaw });
|
|
4636
4636
|
et !== G.text && G.set({ text: et });
|
|
4637
4637
|
}
|
|
4638
4638
|
return C.left === void 0 && C.top === void 0 && K.centerObject(G), x || K.add(G), j || K.setActiveObject(G), K.requestRenderAll(), F.resumeHistory(), T || F.saveState(), K.fire("editor:text-added", {
|
|
4639
4639
|
textbox: G,
|
|
4640
|
-
options: bt(
|
|
4640
|
+
options: bt(B({}, H), {
|
|
4641
4641
|
text: e,
|
|
4642
4642
|
bold: n,
|
|
4643
4643
|
italic: i,
|
|
@@ -4663,7 +4663,7 @@ class q {
|
|
|
4663
4663
|
* @param options.skipRender — не вызывать перерисовку канваса
|
|
4664
4664
|
*/
|
|
4665
4665
|
updateText({ target: t, style: e = {}, withoutSave: s, skipRender: o } = {}) {
|
|
4666
|
-
var Rt,
|
|
4666
|
+
var Rt, ct, _t, dt, ot, Nt;
|
|
4667
4667
|
const n = this._resolveTextObject(t);
|
|
4668
4668
|
if (!n) return null;
|
|
4669
4669
|
const { historyManager: i } = this.editor, { canvas: a } = this;
|
|
@@ -4690,7 +4690,7 @@ class q {
|
|
|
4690
4690
|
paddingLeft: T,
|
|
4691
4691
|
radiusTopLeft: x,
|
|
4692
4692
|
radiusTopRight: Z,
|
|
4693
|
-
radiusBottomRight:
|
|
4693
|
+
radiusBottomRight: U,
|
|
4694
4694
|
radiusBottomLeft: F
|
|
4695
4695
|
} = Dt, K = ut(Dt, [
|
|
4696
4696
|
"text",
|
|
@@ -4716,39 +4716,39 @@ class q {
|
|
|
4716
4716
|
"radiusTopRight",
|
|
4717
4717
|
"radiusBottomRight",
|
|
4718
4718
|
"radiusBottomLeft"
|
|
4719
|
-
]), L =
|
|
4720
|
-
if (d !== void 0 && (X && (G.fontFamily = d), z && (L.fontFamily = d,
|
|
4719
|
+
]), L = B({}, K), R = no({ textbox: n }), X = R ? this._expandRangeToFullLines({ textbox: n, range: R }) : null, H = {}, G = {}, V = {}, et = ao({ textbox: n, range: R }), z = !R || et, P = !R;
|
|
4720
|
+
if (d !== void 0 && (X && (G.fontFamily = d), z && (L.fontFamily = d, P && (V.fontFamily = d))), l !== void 0 && (X && (G.fontSize = l), z && (L.fontSize = l, P && (V.fontSize = l))), u !== void 0) {
|
|
4721
4721
|
const W = u ? "bold" : "normal";
|
|
4722
|
-
R && (H.fontWeight = W), z && (L.fontWeight = W,
|
|
4722
|
+
R && (H.fontWeight = W), z && (L.fontWeight = W, P && (V.fontWeight = W));
|
|
4723
4723
|
}
|
|
4724
4724
|
if (g !== void 0) {
|
|
4725
4725
|
const W = g ? "italic" : "normal";
|
|
4726
|
-
R && (H.fontStyle = W), z && (L.fontStyle = W,
|
|
4726
|
+
R && (H.fontStyle = W), z && (L.fontStyle = W, P && (V.fontStyle = W));
|
|
4727
4727
|
}
|
|
4728
|
-
if (f !== void 0 && (R && (H.underline = f), z && (L.underline = f,
|
|
4729
|
-
const W = R ?
|
|
4728
|
+
if (f !== void 0 && (R && (H.underline = f), z && (L.underline = f, P && (V.underline = f))), m !== void 0 && (R && (H.linethrough = m), z && (L.linethrough = m, P && (V.linethrough = m))), v !== void 0 && (L.textAlign = v), b !== void 0 && (R && (H.fill = b), z && (L.fill = b, P && (V.fill = b))), I !== void 0 || y !== void 0) {
|
|
4729
|
+
const W = R ? Ze({ textbox: n, range: R, property: "strokeWidth" }) : void 0, yt = R ? Ze({ textbox: n, range: R, property: "stroke" }) : void 0, Yt = (ct = (Rt = y != null ? y : W) != null ? Rt : n.strokeWidth) != null ? ct : 0, ht = Ve({ width: Yt }), Ft = (dt = (_t = I != null ? I : yt) != null ? _t : n.stroke) != null ? dt : void 0, vt = Ge({
|
|
4730
4730
|
strokeColor: Ft,
|
|
4731
4731
|
width: ht
|
|
4732
4732
|
});
|
|
4733
|
-
R && (H.stroke = vt, H.strokeWidth = ht), z && (L.stroke = vt, L.strokeWidth = ht,
|
|
4733
|
+
R && (H.stroke = vt, H.strokeWidth = ht), z && (L.stroke = vt, L.strokeWidth = ht, P && (V.stroke = vt, V.strokeWidth = ht));
|
|
4734
4734
|
}
|
|
4735
|
-
w !== void 0 && (L.opacity = w), S !== void 0 && (L.backgroundColor = S), A !== void 0 && (L.backgroundOpacity = A), M !== void 0 && (L.paddingTop = M), C !== void 0 && (L.paddingRight = C), j !== void 0 && (L.paddingBottom = j), T !== void 0 && (L.paddingLeft = T), x !== void 0 && (L.radiusTopLeft = x), Z !== void 0 && (L.radiusTopRight = Z),
|
|
4736
|
-
const
|
|
4735
|
+
w !== void 0 && (L.opacity = w), S !== void 0 && (L.backgroundColor = S), A !== void 0 && (L.backgroundOpacity = A), M !== void 0 && (L.paddingTop = M), C !== void 0 && (L.paddingRight = C), j !== void 0 && (L.paddingBottom = j), T !== void 0 && (L.paddingLeft = T), x !== void 0 && (L.radiusTopLeft = x), Z !== void 0 && (L.radiusTopRight = Z), U !== void 0 && (L.radiusBottomRight = U), F !== void 0 && (L.radiusBottomLeft = F);
|
|
4736
|
+
const Pt = (Nt = n.textCaseRaw) != null ? Nt : (ot = n.text) != null ? ot : "", mt = !!n.uppercase, Tt = c !== void 0, Et = Tt ? c != null ? c : "" : Pt, Ot = p != null ? p : mt;
|
|
4737
4737
|
if (Tt || Ot !== mt) {
|
|
4738
|
-
const W = Ot ?
|
|
4738
|
+
const W = Ot ? ne({ value: Et }) : Et;
|
|
4739
4739
|
L.text = W, n.textCaseRaw = Et;
|
|
4740
|
-
} else n.textCaseRaw === void 0 && (n.textCaseRaw =
|
|
4740
|
+
} else n.textCaseRaw === void 0 && (n.textCaseRaw = Pt);
|
|
4741
4741
|
n.uppercase = Ot, n.set(L);
|
|
4742
4742
|
let Lt = !1;
|
|
4743
4743
|
if (R) {
|
|
4744
|
-
const W =
|
|
4744
|
+
const W = oe({ textbox: n, styles: H, range: R }), yt = X ? oe({ textbox: n, styles: G, range: X }) : !1;
|
|
4745
4745
|
Lt = W || yt;
|
|
4746
4746
|
} else if (Object.keys(V).length) {
|
|
4747
|
-
const W =
|
|
4748
|
-
W && (Lt =
|
|
4747
|
+
const W = io({ textbox: n });
|
|
4748
|
+
W && (Lt = oe({ textbox: n, styles: V, range: W }));
|
|
4749
4749
|
}
|
|
4750
|
-
Lt && (n.dirty = !0), (S !== void 0 || A !== void 0 || M !== void 0 || C !== void 0 || j !== void 0 || T !== void 0 || x !== void 0 || Z !== void 0 ||
|
|
4751
|
-
const
|
|
4750
|
+
Lt && (n.dirty = !0), (S !== void 0 || A !== void 0 || M !== void 0 || C !== void 0 || j !== void 0 || T !== void 0 || x !== void 0 || Z !== void 0 || U !== void 0 || F !== void 0) && (n.dirty = !0), n.setCoords(), o || a.requestRenderAll(), i.resumeHistory(), s || i.saveState();
|
|
4751
|
+
const Ut = q._getSnapshot(n);
|
|
4752
4752
|
return a.fire("editor:text-updated", {
|
|
4753
4753
|
textbox: n,
|
|
4754
4754
|
target: t,
|
|
@@ -4759,7 +4759,7 @@ class q {
|
|
|
4759
4759
|
},
|
|
4760
4760
|
updates: L,
|
|
4761
4761
|
before: r,
|
|
4762
|
-
after:
|
|
4762
|
+
after: Ut,
|
|
4763
4763
|
selectionRange: R != null ? R : void 0,
|
|
4764
4764
|
selectionStyles: R && Object.keys(H).length ? H : void 0
|
|
4765
4765
|
}), n;
|
|
@@ -4809,7 +4809,7 @@ class q {
|
|
|
4809
4809
|
if (!q._isTextbox(e)) return;
|
|
4810
4810
|
const s = (i = e.text) != null ? i : "", o = !!e.uppercase, n = s.toLocaleLowerCase();
|
|
4811
4811
|
if (o) {
|
|
4812
|
-
const a =
|
|
4812
|
+
const a = ne({ value: n });
|
|
4813
4813
|
a !== s && e.set({ text: a }), e.textCaseRaw = n;
|
|
4814
4814
|
return;
|
|
4815
4815
|
}
|
|
@@ -4963,7 +4963,7 @@ class q {
|
|
|
4963
4963
|
radiusBottomLeft: T,
|
|
4964
4964
|
left: x,
|
|
4965
4965
|
top: Z,
|
|
4966
|
-
width:
|
|
4966
|
+
width: U,
|
|
4967
4967
|
height: F,
|
|
4968
4968
|
angle: K,
|
|
4969
4969
|
scaleX: L,
|
|
@@ -5000,7 +5000,7 @@ class q {
|
|
|
5000
5000
|
radiusBottomLeft: T,
|
|
5001
5001
|
left: x,
|
|
5002
5002
|
top: Z,
|
|
5003
|
-
width:
|
|
5003
|
+
width: U,
|
|
5004
5004
|
height: F,
|
|
5005
5005
|
angle: K,
|
|
5006
5006
|
scaleX: L,
|
|
@@ -5026,7 +5026,7 @@ const tt = ({
|
|
|
5026
5026
|
}) => {
|
|
5027
5027
|
const s = tt({ value: h });
|
|
5028
5028
|
return e ? s : s / (t || 1);
|
|
5029
|
-
},
|
|
5029
|
+
}, ro = ({
|
|
5030
5030
|
object: h,
|
|
5031
5031
|
baseWidth: t,
|
|
5032
5032
|
baseHeight: e,
|
|
@@ -5060,7 +5060,7 @@ const tt = ({
|
|
|
5060
5060
|
x: l + g / 2,
|
|
5061
5061
|
y: u + f / 2
|
|
5062
5062
|
};
|
|
5063
|
-
},
|
|
5063
|
+
}, co = ({
|
|
5064
5064
|
normalizedX: h,
|
|
5065
5065
|
normalizedY: t,
|
|
5066
5066
|
bounds: e,
|
|
@@ -5074,7 +5074,7 @@ const tt = ({
|
|
|
5074
5074
|
}
|
|
5075
5075
|
const c = n + h * a, d = i + t * r;
|
|
5076
5076
|
return new $(c, d);
|
|
5077
|
-
},
|
|
5077
|
+
}, lo = ({
|
|
5078
5078
|
object: h,
|
|
5079
5079
|
montageArea: t,
|
|
5080
5080
|
bounds: e
|
|
@@ -5089,7 +5089,7 @@ const tt = ({
|
|
|
5089
5089
|
} catch (s) {
|
|
5090
5090
|
return null;
|
|
5091
5091
|
}
|
|
5092
|
-
},
|
|
5092
|
+
}, lt = ({
|
|
5093
5093
|
object: h
|
|
5094
5094
|
}) => {
|
|
5095
5095
|
if (!h) return null;
|
|
@@ -5112,12 +5112,12 @@ const tt = ({
|
|
|
5112
5112
|
} catch (t) {
|
|
5113
5113
|
return null;
|
|
5114
5114
|
}
|
|
5115
|
-
},
|
|
5115
|
+
}, ho = ({
|
|
5116
5116
|
x1: h,
|
|
5117
5117
|
y1: t,
|
|
5118
5118
|
x2: e,
|
|
5119
5119
|
y2: s
|
|
5120
|
-
}) => (Math.atan2(s - t, e - h) * 180 / Math.PI + 360) % 360,
|
|
5120
|
+
}) => (Math.atan2(s - t, e - h) * 180 / Math.PI + 360) % 360, uo = (h) => {
|
|
5121
5121
|
if (!h || typeof h != "object") return null;
|
|
5122
5122
|
const { type: t, coords: e, colorStops: s } = h, o = Array.isArray(s) ? s : [], n = o[0], i = o[o.length - 1], a = typeof (n == null ? void 0 : n.color) == "string" ? n.color : void 0, r = typeof (i == null ? void 0 : i.color) == "string" ? i.color : a, c = typeof (n == null ? void 0 : n.offset) == "number" ? n.offset * 100 : void 0, d = typeof (i == null ? void 0 : i.offset) == "number" ? i.offset * 100 : void 0;
|
|
5123
5123
|
if (!a || !r || !e) return null;
|
|
@@ -5126,7 +5126,7 @@ const tt = ({
|
|
|
5126
5126
|
if (typeof l == "number" && typeof u == "number" && typeof g == "number" && typeof f == "number")
|
|
5127
5127
|
return {
|
|
5128
5128
|
type: "linear",
|
|
5129
|
-
angle:
|
|
5129
|
+
angle: ho({ x1: l, y1: u, x2: g, y2: f }),
|
|
5130
5130
|
startColor: a,
|
|
5131
5131
|
endColor: r,
|
|
5132
5132
|
startPosition: c,
|
|
@@ -5148,7 +5148,7 @@ const tt = ({
|
|
|
5148
5148
|
};
|
|
5149
5149
|
}
|
|
5150
5150
|
return null;
|
|
5151
|
-
},
|
|
5151
|
+
}, ie = "_templateCenterX", ae = "_templateCenterY", re = "_templateAnchorX", ce = "_templateAnchorY";
|
|
5152
5152
|
class D {
|
|
5153
5153
|
constructor({ editor: t }) {
|
|
5154
5154
|
this.editor = t;
|
|
@@ -5182,7 +5182,7 @@ class D {
|
|
|
5182
5182
|
baseWidth: m,
|
|
5183
5183
|
baseHeight: v,
|
|
5184
5184
|
montageArea: i != null ? i : null
|
|
5185
|
-
})), I = bt(
|
|
5185
|
+
})), I = bt(B({}, s), {
|
|
5186
5186
|
baseWidth: m,
|
|
5187
5187
|
baseHeight: v,
|
|
5188
5188
|
positionsNormalized: !0,
|
|
@@ -5283,7 +5283,7 @@ class D {
|
|
|
5283
5283
|
* Подготавливает объекты для сериализации.
|
|
5284
5284
|
*/
|
|
5285
5285
|
static _collectObjects(t) {
|
|
5286
|
-
return t ? t instanceof
|
|
5286
|
+
return t ? t instanceof k ? t.getObjects() : [t] : [];
|
|
5287
5287
|
}
|
|
5288
5288
|
/**
|
|
5289
5289
|
* Возвращает габариты объекта.
|
|
@@ -5314,7 +5314,7 @@ class D {
|
|
|
5314
5314
|
if (i)
|
|
5315
5315
|
return D._restoreImageScale({ revived: i, serialized: s }), i;
|
|
5316
5316
|
}
|
|
5317
|
-
const o = yield
|
|
5317
|
+
const o = yield rt.enlivenObjects([s]), n = o == null ? void 0 : o[0];
|
|
5318
5318
|
return n ? (D._restoreImageScale({ revived: n, serialized: s }), n) : null;
|
|
5319
5319
|
})))).filter((s) => !!s);
|
|
5320
5320
|
});
|
|
@@ -5359,7 +5359,7 @@ class D {
|
|
|
5359
5359
|
const e = typeof t.svgMarkup == "string" ? t.svgMarkup : null;
|
|
5360
5360
|
if (!e) return null;
|
|
5361
5361
|
try {
|
|
5362
|
-
const s = yield
|
|
5362
|
+
const s = yield ps(e), o = rt.groupSVGElements(s.objects, s.options), n = yield rt.enlivenObjectEnlivables(
|
|
5363
5363
|
D._prepareSerializableProps(t)
|
|
5364
5364
|
);
|
|
5365
5365
|
return o.set(n), o.setCoords(), o;
|
|
@@ -5372,7 +5372,7 @@ class D {
|
|
|
5372
5372
|
* Убирает технические поля сериализации, оставляя только применимые свойства.
|
|
5373
5373
|
*/
|
|
5374
5374
|
static _prepareSerializableProps(t) {
|
|
5375
|
-
const e =
|
|
5375
|
+
const e = B({}, t);
|
|
5376
5376
|
return delete e.svgMarkup, delete e.objects, delete e.path, delete e.paths, delete e.type, delete e.version, e;
|
|
5377
5377
|
}
|
|
5378
5378
|
/**
|
|
@@ -5418,14 +5418,14 @@ class D {
|
|
|
5418
5418
|
montageArea: a,
|
|
5419
5419
|
useRelativePositions: r
|
|
5420
5420
|
}) {
|
|
5421
|
-
const c = t, { x: d, y: l } =
|
|
5421
|
+
const c = t, { x: d, y: l } = ro({
|
|
5422
5422
|
object: t,
|
|
5423
5423
|
baseWidth: n,
|
|
5424
5424
|
baseHeight: i,
|
|
5425
5425
|
useRelativePositions: r,
|
|
5426
5426
|
centerKeys: {
|
|
5427
|
-
x:
|
|
5428
|
-
y:
|
|
5427
|
+
x: ie,
|
|
5428
|
+
y: ae
|
|
5429
5429
|
}
|
|
5430
5430
|
}), { scaleX: u, scaleY: g } = t, f = tt({ value: u, fallback: 1 }), p = tt({ value: g, fallback: 1 }), m = D._getPositioningBounds({
|
|
5431
5431
|
bounds: s,
|
|
@@ -5433,9 +5433,9 @@ class D {
|
|
|
5433
5433
|
baseHeight: i,
|
|
5434
5434
|
scale: e,
|
|
5435
5435
|
useRelativePositions: r,
|
|
5436
|
-
anchorX: D._resolveAnchor(c,
|
|
5437
|
-
anchorY: D._resolveAnchor(c,
|
|
5438
|
-
}), v =
|
|
5436
|
+
anchorX: D._resolveAnchor(c, re),
|
|
5437
|
+
anchorY: D._resolveAnchor(c, ce)
|
|
5438
|
+
}), v = co({
|
|
5439
5439
|
normalizedX: d,
|
|
5440
5440
|
normalizedY: l,
|
|
5441
5441
|
bounds: m,
|
|
@@ -5445,7 +5445,7 @@ class D {
|
|
|
5445
5445
|
t.set({
|
|
5446
5446
|
scaleX: b,
|
|
5447
5447
|
scaleY: I
|
|
5448
|
-
}), t.setPositionByOrigin(v, "center", "center"), t.setCoords(), delete c[
|
|
5448
|
+
}), t.setPositionByOrigin(v, "center", "center"), t.setCoords(), delete c[ie], delete c[ae], delete c[re], delete c[ce];
|
|
5449
5449
|
}
|
|
5450
5450
|
/**
|
|
5451
5451
|
* Возвращает bounds, в которых должны позиционироваться нормализованные объекты.
|
|
@@ -5496,7 +5496,7 @@ class D {
|
|
|
5496
5496
|
fallback: e
|
|
5497
5497
|
}) {
|
|
5498
5498
|
const { width: s, height: o } = e, r = t || {}, { baseWidth: n = s, baseHeight: i = o } = r, a = ut(r, ["baseWidth", "baseHeight"]);
|
|
5499
|
-
return
|
|
5499
|
+
return B({
|
|
5500
5500
|
baseWidth: n,
|
|
5501
5501
|
baseHeight: i
|
|
5502
5502
|
}, a);
|
|
@@ -5523,7 +5523,7 @@ class D {
|
|
|
5523
5523
|
t.setActiveObject(e[0]);
|
|
5524
5524
|
return;
|
|
5525
5525
|
}
|
|
5526
|
-
const s = new
|
|
5526
|
+
const s = new k(e, { canvas: t });
|
|
5527
5527
|
t.setActiveObject(s);
|
|
5528
5528
|
}
|
|
5529
5529
|
/**
|
|
@@ -5547,7 +5547,7 @@ class D {
|
|
|
5547
5547
|
baseHeight: o,
|
|
5548
5548
|
montageArea: n
|
|
5549
5549
|
}) {
|
|
5550
|
-
const i = t.toDatalessObject([...
|
|
5550
|
+
const i = t.toDatalessObject([...ts]);
|
|
5551
5551
|
if (D._isSvgObject(t)) {
|
|
5552
5552
|
const y = D._extractSvgMarkup(t);
|
|
5553
5553
|
y && (i.svgMarkup = y, delete i.objects, delete i.path);
|
|
@@ -5558,7 +5558,7 @@ class D {
|
|
|
5558
5558
|
top: r,
|
|
5559
5559
|
width: c,
|
|
5560
5560
|
height: d
|
|
5561
|
-
} = e, l = t.getBoundingRect(!1, !0), u = s || c || 1, g = o || d || 1, f =
|
|
5561
|
+
} = e, l = t.getBoundingRect(!1, !0), u = s || c || 1, g = o || d || 1, f = lo({
|
|
5562
5562
|
object: t,
|
|
5563
5563
|
montageArea: n,
|
|
5564
5564
|
bounds: e
|
|
@@ -5569,11 +5569,11 @@ class D {
|
|
|
5569
5569
|
y: (y.y - r) / g
|
|
5570
5570
|
};
|
|
5571
5571
|
})(), m = (l.left - a) / u, v = (l.top - r) / g, b = m + l.width / u, I = v + l.height / g;
|
|
5572
|
-
return i[
|
|
5572
|
+
return i[ie] = p.x, i[ae] = p.y, i[re] = D._detectAnchor({
|
|
5573
5573
|
center: p.x,
|
|
5574
5574
|
start: m,
|
|
5575
5575
|
end: b
|
|
5576
|
-
}), i[
|
|
5576
|
+
}), i[ce] = D._detectAnchor({
|
|
5577
5577
|
center: p.y,
|
|
5578
5578
|
start: v,
|
|
5579
5579
|
end: I
|
|
@@ -5607,7 +5607,7 @@ class D {
|
|
|
5607
5607
|
withoutSave: !0
|
|
5608
5608
|
}), !0;
|
|
5609
5609
|
if (a === "gradient") {
|
|
5610
|
-
const c =
|
|
5610
|
+
const c = uo(n);
|
|
5611
5611
|
if (c)
|
|
5612
5612
|
return e.setGradientBackground({
|
|
5613
5613
|
gradient: c,
|
|
@@ -5658,7 +5658,7 @@ class D {
|
|
|
5658
5658
|
*/
|
|
5659
5659
|
static _cloneCustomData(t) {
|
|
5660
5660
|
if (!(!t || typeof t != "object"))
|
|
5661
|
-
return
|
|
5661
|
+
return B({}, t);
|
|
5662
5662
|
}
|
|
5663
5663
|
/**
|
|
5664
5664
|
* Извлекает src изображения из FabricImage или его исходного элемента.
|
|
@@ -5677,8 +5677,17 @@ class D {
|
|
|
5677
5677
|
const s = t;
|
|
5678
5678
|
return typeof s.src == "string" ? s.src : null;
|
|
5679
5679
|
}
|
|
5680
|
+
/**
|
|
5681
|
+
* Оживляет сериализованный объект, восстанавливая вложенные описания (градиенты, клиппаты и т.д.).
|
|
5682
|
+
* @param serialized - исходное сериализованное описание Fabric-объекта
|
|
5683
|
+
* @returns оживлённый объект с восстановленными вложенными структурами
|
|
5684
|
+
*/
|
|
5685
|
+
// eslint-disable-next-line class-methods-use-this
|
|
5686
|
+
enlivenObjectEnlivables(t) {
|
|
5687
|
+
return rt.enlivenObjectEnlivables(t);
|
|
5688
|
+
}
|
|
5680
5689
|
}
|
|
5681
|
-
const
|
|
5690
|
+
const go = 5, es = "#3D8BF4", fe = 1, Xt = 1, Xe = ({
|
|
5682
5691
|
anchors: h,
|
|
5683
5692
|
positions: t,
|
|
5684
5693
|
threshold: e
|
|
@@ -5693,16 +5702,16 @@ const uo = 5, ts = "#3D8BF4", ge = 1, Ve = ({
|
|
|
5693
5702
|
delta: s,
|
|
5694
5703
|
guidePosition: n
|
|
5695
5704
|
};
|
|
5696
|
-
},
|
|
5705
|
+
}, fo = ({
|
|
5697
5706
|
activeBounds: h,
|
|
5698
5707
|
threshold: t,
|
|
5699
5708
|
anchors: e
|
|
5700
5709
|
}) => {
|
|
5701
|
-
const { left: s, right: o, centerX: n, top: i, bottom: a, centerY: r } = h, c =
|
|
5710
|
+
const { left: s, right: o, centerX: n, top: i, bottom: a, centerY: r } = h, c = Xe({
|
|
5702
5711
|
anchors: e.vertical,
|
|
5703
5712
|
positions: [s, n, o],
|
|
5704
5713
|
threshold: t
|
|
5705
|
-
}), d =
|
|
5714
|
+
}), d = Xe({
|
|
5706
5715
|
anchors: e.horizontal,
|
|
5707
5716
|
positions: [i, r, a],
|
|
5708
5717
|
threshold: t
|
|
@@ -5718,7 +5727,7 @@ const uo = 5, ts = "#3D8BF4", ge = 1, Ve = ({
|
|
|
5718
5727
|
deltaY: d.delta,
|
|
5719
5728
|
guides: l
|
|
5720
5729
|
};
|
|
5721
|
-
},
|
|
5730
|
+
}, ss = ({
|
|
5722
5731
|
activeBounds: h,
|
|
5723
5732
|
aligned: t,
|
|
5724
5733
|
threshold: e,
|
|
@@ -5790,7 +5799,7 @@ const uo = 5, ts = "#3D8BF4", ge = 1, Ve = ({
|
|
|
5790
5799
|
}
|
|
5791
5800
|
}
|
|
5792
5801
|
return c;
|
|
5793
|
-
},
|
|
5802
|
+
}, po = ({
|
|
5794
5803
|
activeBounds: h,
|
|
5795
5804
|
candidates: t,
|
|
5796
5805
|
threshold: e,
|
|
@@ -5849,7 +5858,7 @@ const uo = 5, ts = "#3D8BF4", ge = 1, Ve = ({
|
|
|
5849
5858
|
if (A >= 0) {
|
|
5850
5859
|
const M = A / 2, C = n - y.bottom, j = w.top - i, T = Math.abs(C - M), x = Math.abs(j - M), Z = Math.max(T, x);
|
|
5851
5860
|
if (Z <= e) {
|
|
5852
|
-
const
|
|
5861
|
+
const U = M - C, F = i + U, K = {
|
|
5853
5862
|
type: "vertical",
|
|
5854
5863
|
axis: o,
|
|
5855
5864
|
refStart: y.bottom,
|
|
@@ -5858,11 +5867,11 @@ const uo = 5, ts = "#3D8BF4", ge = 1, Ve = ({
|
|
|
5858
5867
|
activeEnd: F + M,
|
|
5859
5868
|
distance: M
|
|
5860
5869
|
};
|
|
5861
|
-
m.push({ delta:
|
|
5870
|
+
m.push({ delta: U, guide: K, diff: Z });
|
|
5862
5871
|
}
|
|
5863
5872
|
}
|
|
5864
5873
|
}
|
|
5865
|
-
const b =
|
|
5874
|
+
const b = ss({
|
|
5866
5875
|
activeBounds: h,
|
|
5867
5876
|
aligned: c,
|
|
5868
5877
|
threshold: e,
|
|
@@ -5876,7 +5885,7 @@ const uo = 5, ts = "#3D8BF4", ge = 1, Ve = ({
|
|
|
5876
5885
|
delta: I.delta,
|
|
5877
5886
|
guide: I.guide
|
|
5878
5887
|
};
|
|
5879
|
-
},
|
|
5888
|
+
}, mo = ({
|
|
5880
5889
|
activeBounds: h,
|
|
5881
5890
|
candidates: t,
|
|
5882
5891
|
threshold: e,
|
|
@@ -5935,7 +5944,7 @@ const uo = 5, ts = "#3D8BF4", ge = 1, Ve = ({
|
|
|
5935
5944
|
if (A >= 0) {
|
|
5936
5945
|
const M = A / 2, C = n - y.right, j = w.left - i, T = Math.abs(C - M), x = Math.abs(j - M), Z = Math.max(T, x);
|
|
5937
5946
|
if (Z <= e) {
|
|
5938
|
-
const
|
|
5947
|
+
const U = M - C, F = i + U, K = {
|
|
5939
5948
|
type: "horizontal",
|
|
5940
5949
|
axis: o,
|
|
5941
5950
|
refStart: y.right,
|
|
@@ -5944,11 +5953,11 @@ const uo = 5, ts = "#3D8BF4", ge = 1, Ve = ({
|
|
|
5944
5953
|
activeEnd: F + M,
|
|
5945
5954
|
distance: M
|
|
5946
5955
|
};
|
|
5947
|
-
m.push({ delta:
|
|
5956
|
+
m.push({ delta: U, guide: K, diff: Z });
|
|
5948
5957
|
}
|
|
5949
5958
|
}
|
|
5950
5959
|
}
|
|
5951
|
-
const b =
|
|
5960
|
+
const b = ss({
|
|
5952
5961
|
activeBounds: h,
|
|
5953
5962
|
aligned: c,
|
|
5954
5963
|
threshold: e,
|
|
@@ -5962,18 +5971,18 @@ const uo = 5, ts = "#3D8BF4", ge = 1, Ve = ({
|
|
|
5962
5971
|
delta: I.delta,
|
|
5963
5972
|
guide: I.guide
|
|
5964
5973
|
};
|
|
5965
|
-
},
|
|
5974
|
+
}, yo = ({
|
|
5966
5975
|
activeBounds: h,
|
|
5967
5976
|
candidates: t,
|
|
5968
5977
|
threshold: e,
|
|
5969
5978
|
spacingPatterns: s
|
|
5970
5979
|
}) => {
|
|
5971
|
-
const o =
|
|
5980
|
+
const o = po({
|
|
5972
5981
|
activeBounds: h,
|
|
5973
5982
|
candidates: t,
|
|
5974
5983
|
threshold: e,
|
|
5975
5984
|
patterns: s.vertical
|
|
5976
|
-
}), n =
|
|
5985
|
+
}), n = mo({
|
|
5977
5986
|
activeBounds: h,
|
|
5978
5987
|
candidates: t,
|
|
5979
5988
|
threshold: e,
|
|
@@ -5984,7 +5993,7 @@ const uo = 5, ts = "#3D8BF4", ge = 1, Ve = ({
|
|
|
5984
5993
|
deltaY: o.delta,
|
|
5985
5994
|
guides: i
|
|
5986
5995
|
};
|
|
5987
|
-
},
|
|
5996
|
+
}, vo = ({
|
|
5988
5997
|
context: h,
|
|
5989
5998
|
x: t,
|
|
5990
5999
|
y: e,
|
|
@@ -5994,7 +6003,7 @@ const uo = 5, ts = "#3D8BF4", ge = 1, Ve = ({
|
|
|
5994
6003
|
}) => {
|
|
5995
6004
|
const i = Math.min(n, s / 2, o / 2);
|
|
5996
6005
|
h.moveTo(t + i, e), h.lineTo(t + s - i, e), h.quadraticCurveTo(t + s, e, t + s, e + i), h.lineTo(t + s, e + o - i), h.quadraticCurveTo(t + s, e + o, t + s - i, e + o), h.lineTo(t + i, e + o), h.quadraticCurveTo(t, e + o, t, e + o - i), h.lineTo(t, e + i), h.quadraticCurveTo(t, e, t + i, e), h.closePath();
|
|
5997
|
-
},
|
|
6006
|
+
}, pe = ({
|
|
5998
6007
|
context: h,
|
|
5999
6008
|
type: t,
|
|
6000
6009
|
axis: e,
|
|
@@ -6014,7 +6023,7 @@ const uo = 5, ts = "#3D8BF4", ge = 1, Ve = ({
|
|
|
6014
6023
|
const p = i || 1, m = 12 / p, v = l / p, b = u / p, I = (s + o) / 2 + g, y = t === "vertical" ? e + f : I, w = t === "vertical" ? I : e + f;
|
|
6015
6024
|
h.save(), h.setLineDash([]), h.fillStyle = a, h.strokeStyle = a, h.lineWidth = d / p, h.font = `${m}px ${c}`, h.textAlign = "center", h.textBaseline = "middle";
|
|
6016
6025
|
const A = h.measureText(n).width + v * 2, M = m + v * 2, C = y - A / 2, j = w - M / 2;
|
|
6017
|
-
h.beginPath(),
|
|
6026
|
+
h.beginPath(), vo({
|
|
6018
6027
|
context: h,
|
|
6019
6028
|
x: C,
|
|
6020
6029
|
y: j,
|
|
@@ -6022,7 +6031,7 @@ const uo = 5, ts = "#3D8BF4", ge = 1, Ve = ({
|
|
|
6022
6031
|
height: M,
|
|
6023
6032
|
radius: b
|
|
6024
6033
|
}), h.fill(), h.fillStyle = r, h.fillText(n, y, w), h.restore();
|
|
6025
|
-
},
|
|
6034
|
+
}, bo = ({
|
|
6026
6035
|
context: h,
|
|
6027
6036
|
guide: t,
|
|
6028
6037
|
zoom: e
|
|
@@ -6037,8 +6046,8 @@ const uo = 5, ts = "#3D8BF4", ge = 1, Ve = ({
|
|
|
6037
6046
|
distance: c
|
|
6038
6047
|
} = t, d = Math.round(c).toString();
|
|
6039
6048
|
h.beginPath(), s === "vertical" ? (h.moveTo(o, n), h.lineTo(o, i), h.moveTo(o, a), h.lineTo(o, r)) : (h.moveTo(n, o), h.lineTo(i, o), h.moveTo(a, o), h.lineTo(r, o)), h.stroke();
|
|
6040
|
-
const l =
|
|
6041
|
-
|
|
6049
|
+
const l = es;
|
|
6050
|
+
pe({
|
|
6042
6051
|
context: h,
|
|
6043
6052
|
type: s,
|
|
6044
6053
|
axis: o,
|
|
@@ -6047,8 +6056,8 @@ const uo = 5, ts = "#3D8BF4", ge = 1, Ve = ({
|
|
|
6047
6056
|
text: d,
|
|
6048
6057
|
zoom: e,
|
|
6049
6058
|
color: l,
|
|
6050
|
-
lineWidth:
|
|
6051
|
-
}),
|
|
6059
|
+
lineWidth: fe
|
|
6060
|
+
}), pe({
|
|
6052
6061
|
context: h,
|
|
6053
6062
|
type: s,
|
|
6054
6063
|
axis: o,
|
|
@@ -6057,9 +6066,9 @@ const uo = 5, ts = "#3D8BF4", ge = 1, Ve = ({
|
|
|
6057
6066
|
text: d,
|
|
6058
6067
|
zoom: e,
|
|
6059
6068
|
color: l,
|
|
6060
|
-
lineWidth:
|
|
6069
|
+
lineWidth: fe
|
|
6061
6070
|
});
|
|
6062
|
-
},
|
|
6071
|
+
}, Ke = ({
|
|
6063
6072
|
anchors: h,
|
|
6064
6073
|
bounds: t
|
|
6065
6074
|
}) => {
|
|
@@ -6072,7 +6081,7 @@ const uo = 5, ts = "#3D8BF4", ge = 1, Ve = ({
|
|
|
6072
6081
|
centerY: a
|
|
6073
6082
|
} = t;
|
|
6074
6083
|
h.vertical.push(e, o, s), h.horizontal.push(n, a, i);
|
|
6075
|
-
},
|
|
6084
|
+
}, Qe = ({
|
|
6076
6085
|
bounds: h,
|
|
6077
6086
|
type: t,
|
|
6078
6087
|
primaryStart: e,
|
|
@@ -6099,30 +6108,30 @@ const uo = 5, ts = "#3D8BF4", ge = 1, Ve = ({
|
|
|
6099
6108
|
});
|
|
6100
6109
|
}
|
|
6101
6110
|
return o;
|
|
6102
|
-
},
|
|
6111
|
+
}, Mo = ({
|
|
6103
6112
|
bounds: h
|
|
6104
6113
|
}) => {
|
|
6105
|
-
const t =
|
|
6114
|
+
const t = Qe({
|
|
6106
6115
|
bounds: h,
|
|
6107
6116
|
type: "vertical",
|
|
6108
6117
|
primaryStart: "top",
|
|
6109
6118
|
primaryEnd: "bottom"
|
|
6110
|
-
}), e =
|
|
6119
|
+
}), e = Qe({
|
|
6111
6120
|
bounds: h,
|
|
6112
6121
|
type: "horizontal",
|
|
6113
6122
|
primaryStart: "left",
|
|
6114
6123
|
primaryEnd: "right"
|
|
6115
6124
|
});
|
|
6116
6125
|
return { vertical: t, horizontal: e };
|
|
6117
|
-
},
|
|
6126
|
+
}, wo = ["montage-area", "background", "interaction-blocker"], os = ({
|
|
6118
6127
|
activeObject: h
|
|
6119
6128
|
}) => {
|
|
6120
6129
|
const t = /* @__PURE__ */ new Set();
|
|
6121
|
-
return h && (t.add(h), h instanceof
|
|
6122
|
-
},
|
|
6130
|
+
return h && (t.add(h), h instanceof k && h.getObjects().forEach((e) => t.add(e))), t;
|
|
6131
|
+
}, ns = ({
|
|
6123
6132
|
object: h,
|
|
6124
6133
|
excluded: t,
|
|
6125
|
-
ignoredIds: e =
|
|
6134
|
+
ignoredIds: e = wo
|
|
6126
6135
|
}) => {
|
|
6127
6136
|
if (t.has(h)) return !0;
|
|
6128
6137
|
const { visible: s = !0 } = h;
|
|
@@ -6130,7 +6139,7 @@ const uo = 5, ts = "#3D8BF4", ge = 1, Ve = ({
|
|
|
6130
6139
|
const { id: o } = h;
|
|
6131
6140
|
return !!(o && e.includes(o));
|
|
6132
6141
|
};
|
|
6133
|
-
class
|
|
6142
|
+
class So {
|
|
6134
6143
|
/**
|
|
6135
6144
|
* Создаёт менеджер прилипания и инициализирует слушатели событий.
|
|
6136
6145
|
*/
|
|
@@ -6177,51 +6186,51 @@ class wo {
|
|
|
6177
6186
|
* Выполняет привязку объекта к ближайшим линиям при его перемещении.
|
|
6178
6187
|
*/
|
|
6179
6188
|
_handleObjectMoving(t) {
|
|
6180
|
-
var
|
|
6189
|
+
var p, m;
|
|
6181
6190
|
const { target: e, e: s } = t;
|
|
6182
6191
|
if (!e) {
|
|
6183
6192
|
this._clearGuides();
|
|
6184
6193
|
return;
|
|
6185
6194
|
}
|
|
6186
|
-
if (s != null && s.ctrlKey) {
|
|
6187
|
-
this._clearGuides();
|
|
6195
|
+
if (!!(s != null && s.ctrlKey)) {
|
|
6196
|
+
this._clearGuides(), this._applyMovementStep({ target: e });
|
|
6188
6197
|
return;
|
|
6189
6198
|
}
|
|
6190
6199
|
!this.anchors.vertical.length && !this.anchors.horizontal.length && this._cacheAnchors({ activeObject: e });
|
|
6191
|
-
let
|
|
6192
|
-
if (!
|
|
6200
|
+
let n = lt({ object: e });
|
|
6201
|
+
if (!n) {
|
|
6193
6202
|
this._clearGuides();
|
|
6194
6203
|
return;
|
|
6195
6204
|
}
|
|
6196
|
-
const { canvas:
|
|
6197
|
-
activeBounds:
|
|
6198
|
-
threshold:
|
|
6205
|
+
const { canvas: i } = this, a = i.getZoom() || 1, r = go / a, c = fo({
|
|
6206
|
+
activeBounds: n,
|
|
6207
|
+
threshold: r,
|
|
6199
6208
|
anchors: this.anchors
|
|
6200
|
-
}), { deltaX:
|
|
6201
|
-
if (
|
|
6202
|
-
const { left:
|
|
6209
|
+
}), { deltaX: d, deltaY: l, guides: u } = c;
|
|
6210
|
+
if (d !== 0 || l !== 0) {
|
|
6211
|
+
const { left: v = 0, top: b = 0 } = e;
|
|
6203
6212
|
e.set({
|
|
6204
|
-
left:
|
|
6205
|
-
top:
|
|
6206
|
-
}), e.setCoords(),
|
|
6207
|
-
}
|
|
6208
|
-
const
|
|
6209
|
-
activeBounds:
|
|
6210
|
-
candidates:
|
|
6211
|
-
threshold:
|
|
6213
|
+
left: v + d,
|
|
6214
|
+
top: b + l
|
|
6215
|
+
}), e.setCoords(), n = (p = lt({ object: e })) != null ? p : n;
|
|
6216
|
+
}
|
|
6217
|
+
const g = this.cachedTargetBounds.length ? this.cachedTargetBounds : this._collectTargets({ activeObject: e }).map((v) => lt({ object: v })).filter((v) => !!v), f = yo({
|
|
6218
|
+
activeBounds: n,
|
|
6219
|
+
candidates: g,
|
|
6220
|
+
threshold: r,
|
|
6212
6221
|
spacingPatterns: this.spacingPatterns
|
|
6213
6222
|
});
|
|
6214
|
-
if (
|
|
6215
|
-
const { left:
|
|
6223
|
+
if (f.deltaX !== 0 || f.deltaY !== 0) {
|
|
6224
|
+
const { left: v = 0, top: b = 0 } = e;
|
|
6216
6225
|
e.set({
|
|
6217
|
-
left:
|
|
6218
|
-
top:
|
|
6219
|
-
}), e.setCoords(),
|
|
6226
|
+
left: v + f.deltaX,
|
|
6227
|
+
top: b + f.deltaY
|
|
6228
|
+
}), e.setCoords(), n = (m = lt({ object: e })) != null ? m : n;
|
|
6220
6229
|
}
|
|
6221
6230
|
this._applyGuides({
|
|
6222
|
-
guides:
|
|
6223
|
-
spacingGuides:
|
|
6224
|
-
});
|
|
6231
|
+
guides: u,
|
|
6232
|
+
spacingGuides: f.guides
|
|
6233
|
+
}), this._applyMovementStep({ target: e });
|
|
6225
6234
|
}
|
|
6226
6235
|
/**
|
|
6227
6236
|
* Очищает направляющие и кеш после окончания перетаскивания.
|
|
@@ -6244,11 +6253,11 @@ class wo {
|
|
|
6244
6253
|
const { canvas: t, guideBounds: e } = this, s = t.getSelectionContext();
|
|
6245
6254
|
if (!s) return;
|
|
6246
6255
|
const o = e != null ? e : this._calculateViewportBounds(), { left: n, right: i, top: a, bottom: r } = o, { viewportTransform: c } = t, d = t.getZoom() || 1;
|
|
6247
|
-
s.save(), Array.isArray(c) && s.transform(...c), s.lineWidth =
|
|
6256
|
+
s.save(), Array.isArray(c) && s.transform(...c), s.lineWidth = fe / d, s.strokeStyle = es, s.setLineDash([4, 4]);
|
|
6248
6257
|
for (const l of this.activeGuides)
|
|
6249
6258
|
s.beginPath(), l.type === "vertical" ? (s.moveTo(l.position, a), s.lineTo(l.position, r)) : (s.moveTo(n, l.position), s.lineTo(i, l.position)), s.stroke();
|
|
6250
6259
|
for (const l of this.activeSpacingGuides)
|
|
6251
|
-
|
|
6260
|
+
bo({
|
|
6252
6261
|
context: s,
|
|
6253
6262
|
guide: l,
|
|
6254
6263
|
zoom: d
|
|
@@ -6280,18 +6289,28 @@ class wo {
|
|
|
6280
6289
|
_clearAnchors() {
|
|
6281
6290
|
this.anchors = { vertical: [], horizontal: [] }, this.spacingPatterns = { vertical: [], horizontal: [] }, this.cachedTargetBounds = [];
|
|
6282
6291
|
}
|
|
6292
|
+
/**
|
|
6293
|
+
* Применяет шаг перемещения, округляя координаты объекта к сетке MOVE_SNAP_STEP.
|
|
6294
|
+
*/
|
|
6295
|
+
_applyMovementStep({ target: t }) {
|
|
6296
|
+
const { left: e = 0, top: s = 0 } = t, o = Math.round(e / Xt) * Xt, n = Math.round(s / Xt) * Xt;
|
|
6297
|
+
o === e && n === s || (t.set({
|
|
6298
|
+
left: o,
|
|
6299
|
+
top: n
|
|
6300
|
+
}), t.setCoords());
|
|
6301
|
+
}
|
|
6283
6302
|
/**
|
|
6284
6303
|
* Сохраняет линии для прилипания от всех доступных объектов и монтажной области.
|
|
6285
6304
|
*/
|
|
6286
6305
|
_cacheAnchors({ activeObject: t }) {
|
|
6287
6306
|
const e = this._collectTargets({ activeObject: t }), s = { vertical: [], horizontal: [] }, o = [];
|
|
6288
6307
|
for (const a of e) {
|
|
6289
|
-
const r =
|
|
6290
|
-
r && (
|
|
6308
|
+
const r = lt({ object: a });
|
|
6309
|
+
r && (Ke({ anchors: s, bounds: r }), o.push(r));
|
|
6291
6310
|
}
|
|
6292
|
-
const { montageArea: n } = this.editor, i =
|
|
6311
|
+
const { montageArea: n } = this.editor, i = lt({ object: n });
|
|
6293
6312
|
if (i) {
|
|
6294
|
-
|
|
6313
|
+
Ke({ anchors: s, bounds: i });
|
|
6295
6314
|
const { left: a, right: r, top: c, bottom: d } = i;
|
|
6296
6315
|
this.guideBounds = {
|
|
6297
6316
|
left: a,
|
|
@@ -6301,15 +6320,15 @@ class wo {
|
|
|
6301
6320
|
};
|
|
6302
6321
|
} else
|
|
6303
6322
|
this.guideBounds = this._calculateViewportBounds();
|
|
6304
|
-
this.anchors = s, this.spacingPatterns =
|
|
6323
|
+
this.anchors = s, this.spacingPatterns = Mo({ bounds: o }), this.cachedTargetBounds = o;
|
|
6305
6324
|
}
|
|
6306
6325
|
/**
|
|
6307
6326
|
* Собирает объекты, подходящие для прилипания, исключая активный объект и запрещённые id.
|
|
6308
6327
|
*/
|
|
6309
6328
|
_collectTargets({ activeObject: t }) {
|
|
6310
|
-
const e =
|
|
6329
|
+
const e = os({ activeObject: t }), s = [];
|
|
6311
6330
|
return this.canvas.forEachObject((o) => {
|
|
6312
|
-
|
|
6331
|
+
ns({ object: o, excluded: e }) || s.push(o);
|
|
6313
6332
|
}), s;
|
|
6314
6333
|
}
|
|
6315
6334
|
/**
|
|
@@ -6332,7 +6351,7 @@ class wo {
|
|
|
6332
6351
|
};
|
|
6333
6352
|
}
|
|
6334
6353
|
}
|
|
6335
|
-
const
|
|
6354
|
+
const qe = "#3D8BF4", $e = 1;
|
|
6336
6355
|
class At {
|
|
6337
6356
|
/**
|
|
6338
6357
|
* Создаёт менеджер измерений и инициализирует события.
|
|
@@ -6438,7 +6457,7 @@ class At {
|
|
|
6438
6457
|
this._clearGuides();
|
|
6439
6458
|
return;
|
|
6440
6459
|
}
|
|
6441
|
-
const n =
|
|
6460
|
+
const n = lt({ object: o });
|
|
6442
6461
|
if (!n) {
|
|
6443
6462
|
this._clearGuides();
|
|
6444
6463
|
return;
|
|
@@ -6446,7 +6465,7 @@ class At {
|
|
|
6446
6465
|
const i = At._resolveTarget({
|
|
6447
6466
|
event: t,
|
|
6448
6467
|
activeObject: o
|
|
6449
|
-
}), { montageArea: a } = s, r = i != null ? i : a, c = r === a, d =
|
|
6468
|
+
}), { montageArea: a } = s, r = i != null ? i : a, c = r === a, d = lt({ object: r });
|
|
6450
6469
|
if (!d) {
|
|
6451
6470
|
this._clearGuides();
|
|
6452
6471
|
return;
|
|
@@ -6473,8 +6492,8 @@ class At {
|
|
|
6473
6492
|
event: t,
|
|
6474
6493
|
activeObject: e
|
|
6475
6494
|
}) {
|
|
6476
|
-
const { target: s } = t, o =
|
|
6477
|
-
return s && !
|
|
6495
|
+
const { target: s } = t, o = os({ activeObject: e });
|
|
6496
|
+
return s && !ns({ object: s, excluded: o }) ? s : null;
|
|
6478
6497
|
}
|
|
6479
6498
|
/**
|
|
6480
6499
|
* Собирает вертикальные и горизонтальные направляющие расстояний.
|
|
@@ -6642,10 +6661,10 @@ class At {
|
|
|
6642
6661
|
const { canvas: t } = this, e = t.getSelectionContext();
|
|
6643
6662
|
if (!e) return;
|
|
6644
6663
|
const { viewportTransform: s } = t, o = t.getZoom() || 1, n = this.activeGuides.some((c) => c.type === "vertical"), i = this.activeGuides.some((c) => c.type === "horizontal"), a = n && i && !this.isTargetMontageArea, r = a ? 12 / o : 0;
|
|
6645
|
-
e.save(), Array.isArray(s) && e.transform(...s), e.lineWidth =
|
|
6664
|
+
e.save(), Array.isArray(s) && e.transform(...s), e.lineWidth = $e / o, e.strokeStyle = qe, e.setLineDash([]);
|
|
6646
6665
|
for (const c of this.activeGuides) {
|
|
6647
6666
|
const { type: d, axis: l, start: u, end: g, distance: f } = c, p = Math.abs(g - u), m = u <= g ? -1 : 1, v = a ? m * (p / 2 + r) : 0, b = 0;
|
|
6648
|
-
e.beginPath(), d === "vertical" ? (e.moveTo(l, u), e.lineTo(l, g)) : (e.moveTo(u, l), e.lineTo(g, l)), e.stroke(),
|
|
6667
|
+
e.beginPath(), d === "vertical" ? (e.moveTo(l, u), e.lineTo(l, g)) : (e.moveTo(u, l), e.lineTo(g, l)), e.stroke(), pe({
|
|
6649
6668
|
context: e,
|
|
6650
6669
|
type: d,
|
|
6651
6670
|
axis: l,
|
|
@@ -6653,8 +6672,8 @@ class At {
|
|
|
6653
6672
|
end: g,
|
|
6654
6673
|
text: Math.round(f).toString(),
|
|
6655
6674
|
zoom: o,
|
|
6656
|
-
color:
|
|
6657
|
-
lineWidth:
|
|
6675
|
+
color: qe,
|
|
6676
|
+
lineWidth: $e,
|
|
6658
6677
|
offsetAlongAxis: v,
|
|
6659
6678
|
offsetPerpendicular: b
|
|
6660
6679
|
});
|
|
@@ -6680,7 +6699,7 @@ class At {
|
|
|
6680
6699
|
(e = t == null ? void 0 : t.showAfterTemporary) == null || e.call(t), this.isToolbarHidden = !1;
|
|
6681
6700
|
}
|
|
6682
6701
|
}
|
|
6683
|
-
class
|
|
6702
|
+
class we {
|
|
6684
6703
|
/**
|
|
6685
6704
|
* Конструктор класса ImageEditor.
|
|
6686
6705
|
* @param canvasId - идентификатор канваса, в котором будет создан редактор
|
|
@@ -6710,7 +6729,7 @@ class Me {
|
|
|
6710
6729
|
showRotationAngle: d,
|
|
6711
6730
|
_onReadyCallback: l
|
|
6712
6731
|
} = this.options;
|
|
6713
|
-
if (Q.apply(), this.canvas = new
|
|
6732
|
+
if (Q.apply(), this.canvas = new ms(this.containerId, this.options), this.moduleLoader = new ws(), this.workerManager = new As(), this.errorManager = new zt({ editor: this }), this.historyManager = new Qt({ editor: this }), this.toolbar = new Ps({ editor: this }), this.transformManager = new Ks({ editor: this }), this.zoomManager = new Qs({ editor: this }), this.canvasManager = new Xs({ editor: this }), this.imageManager = new at({ editor: this }), this.layerManager = new qt({ editor: this }), this.shapeManager = new $s({ editor: this }), this.interactionBlocker = new qs({ editor: this }), this.backgroundManager = new St({ editor: this }), this.clipboardManager = new Js({ editor: this }), this.objectLockManager = new $t({ editor: this }), this.groupingManager = new to({ editor: this }), this.selectionManager = new eo({ editor: this }), this.deletionManager = new Me({ editor: this }), this.panConstraintManager = new so({ editor: this }), this.snappingManager = new So({ editor: this }), this.measurementManager = new At({ editor: this }), this.fontManager = new ge((u = this.options.fonts) != null ? u : []), this.textManager = new q({ editor: this }), this.templateManager = new D({ editor: this }), d && (this.angleIndicator = new be({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.listeners = new xt({ editor: this, options: this.options }), this.canvasManager.setEditorContainerWidth(t), this.canvasManager.setEditorContainerHeight(e), this.canvasManager.setCanvasWrapperWidth(s), this.canvasManager.setCanvasWrapperHeight(o), this.canvasManager.setCanvasCSSWidth(n), this.canvasManager.setCanvasCSSHeight(i), this.canvasManager.updateCanvas(), this.zoomManager.calculateAndApplyDefaultZoom(), yield this.fontManager.loadFonts(), a != null && a.source) {
|
|
6714
6733
|
const {
|
|
6715
6734
|
source: g,
|
|
6716
6735
|
scale: f = `image-${c}`,
|
|
@@ -6732,7 +6751,7 @@ class Me {
|
|
|
6732
6751
|
this.montageArea = this.shapeManager.addRectangle({
|
|
6733
6752
|
width: t,
|
|
6734
6753
|
height: e,
|
|
6735
|
-
fill:
|
|
6754
|
+
fill: we._createMosaicPattern(),
|
|
6736
6755
|
stroke: null,
|
|
6737
6756
|
strokeWidth: 0,
|
|
6738
6757
|
selectable: !1,
|
|
@@ -6783,7 +6802,7 @@ class Me {
|
|
|
6783
6802
|
const t = document.createElement("canvas");
|
|
6784
6803
|
t.width = 20, t.height = 20;
|
|
6785
6804
|
const e = t.getContext("2d");
|
|
6786
|
-
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
|
|
6805
|
+
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 ys({
|
|
6787
6806
|
source: t,
|
|
6788
6807
|
repeat: "repeat"
|
|
6789
6808
|
});
|
|
@@ -6815,7 +6834,7 @@ const E = [
|
|
|
6815
6834
|
"U+0490-0491",
|
|
6816
6835
|
"U+04B0-04B1",
|
|
6817
6836
|
"U+2116"
|
|
6818
|
-
].join(", "),
|
|
6837
|
+
].join(", "), Ao = [
|
|
6819
6838
|
{
|
|
6820
6839
|
family: "Arial",
|
|
6821
6840
|
source: 'local("Arial"), local("Liberation Sans"), local("DejaVu Sans")',
|
|
@@ -7605,7 +7624,7 @@ const E = [
|
|
|
7605
7624
|
unicodeRange: E
|
|
7606
7625
|
}
|
|
7607
7626
|
}
|
|
7608
|
-
],
|
|
7627
|
+
], jo = {
|
|
7609
7628
|
/**
|
|
7610
7629
|
* Опции редактора
|
|
7611
7630
|
*/
|
|
@@ -7697,20 +7716,20 @@ const E = [
|
|
|
7697
7716
|
/**
|
|
7698
7717
|
* Список шрифтов, которые будут доступны в редакторе по умолчанию.
|
|
7699
7718
|
*/
|
|
7700
|
-
fonts:
|
|
7719
|
+
fonts: Ao
|
|
7701
7720
|
};
|
|
7702
|
-
function
|
|
7703
|
-
const e =
|
|
7721
|
+
function Oo(h, t = {}) {
|
|
7722
|
+
const e = B(B({}, jo), t), s = document.getElementById(h);
|
|
7704
7723
|
if (!s)
|
|
7705
7724
|
return Promise.reject(new Error(`Контейнер с ID "${h}" не найден.`));
|
|
7706
7725
|
const o = document.createElement("canvas");
|
|
7707
7726
|
return o.id = `${h}-canvas`, s.appendChild(o), e.editorContainer = s, new Promise((n) => {
|
|
7708
7727
|
e._onReadyCallback = n;
|
|
7709
|
-
const i = new
|
|
7728
|
+
const i = new we(o.id, e);
|
|
7710
7729
|
window[h] = i;
|
|
7711
7730
|
});
|
|
7712
7731
|
}
|
|
7713
7732
|
export {
|
|
7714
|
-
|
|
7733
|
+
Oo as default
|
|
7715
7734
|
};
|
|
7716
7735
|
//# sourceMappingURL=main.js.map
|