@anu3ev/fabric-image-editor 0.6.1 → 0.6.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 +330 -329
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -10,7 +10,7 @@ var Xe = (h, t, e) => t in h ? _n(h, t, { enumerable: !0, configurable: !0, writ
|
|
|
10
10
|
qe.call(t, e) && Xe(h, e, t[e]);
|
|
11
11
|
return h;
|
|
12
12
|
}, It = (h, t) => Ln(h, Dn(t));
|
|
13
|
-
var
|
|
13
|
+
var Mt = (h, t) => {
|
|
14
14
|
var e = {};
|
|
15
15
|
for (var n in h)
|
|
16
16
|
Ke.call(h, n) && t.indexOf(n) < 0 && (e[n] = h[n]);
|
|
@@ -35,7 +35,7 @@ var Z = (h, t, e) => new Promise((n, s) => {
|
|
|
35
35
|
}, a = (r) => r.done ? n(r.value) : Promise.resolve(r.value).then(o, i);
|
|
36
36
|
a((e = e.apply(h, t)).next());
|
|
37
37
|
});
|
|
38
|
-
import { ActiveSelection as K, Textbox as ct, util as
|
|
38
|
+
import { ActiveSelection as K, Textbox as ct, util as vt, controlsUtils as Je, InteractiveFabricObject as Qe, Point as lt, FitContentLayout as $e, loadSVGFromURL as xn, FabricImage as Kt, Gradient as tn, Rect as kn, Circle as Rn, Triangle as Bn, Group as Nt, Color as Nn, classRegistry as en, loadSVGFromString as Pn, Canvas as zn, Pattern as Fn } from "fabric";
|
|
39
39
|
import { create as Un } from "jsondiffpatch";
|
|
40
40
|
import Wn from "diff-match-patch";
|
|
41
41
|
var Yn = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", et = function() {
|
|
@@ -457,52 +457,52 @@ class Gn {
|
|
|
457
457
|
this.worker.terminate();
|
|
458
458
|
}
|
|
459
459
|
}
|
|
460
|
-
const
|
|
460
|
+
const wt = 12, Vn = 2, Oe = 8, _e = 20, Xn = 100, Le = 20, De = 8, Kn = 100, me = 32, Fe = 1, qn = "#2B2D33", Ue = "#3D8BF4", We = "#FFFFFF";
|
|
461
461
|
function he(h, t, e, n, s) {
|
|
462
|
-
const o =
|
|
463
|
-
h.save(), h.translate(t, e), h.rotate(
|
|
462
|
+
const o = wt, i = Vn;
|
|
463
|
+
h.save(), h.translate(t, e), h.rotate(vt.degreesToRadians(s.angle)), h.fillStyle = We, h.strokeStyle = Ue, h.lineWidth = Fe, h.beginPath(), h.roundRect(-o / 2, -o / 2, o, o, i), h.fill(), h.stroke(), h.restore();
|
|
464
464
|
}
|
|
465
465
|
function sn(h, t, e, n, s) {
|
|
466
466
|
const o = Oe, i = _e, a = Xn;
|
|
467
|
-
h.save(), h.translate(t, e), h.rotate(
|
|
467
|
+
h.save(), h.translate(t, e), h.rotate(vt.degreesToRadians(s.angle)), h.fillStyle = We, h.strokeStyle = Ue, h.lineWidth = Fe, h.beginPath(), h.roundRect(-o / 2, -i / 2, o, i, a), h.fill(), h.stroke(), h.restore();
|
|
468
468
|
}
|
|
469
469
|
function on(h, t, e, n, s) {
|
|
470
470
|
const o = Le, i = De, a = Kn;
|
|
471
|
-
h.save(), h.translate(t, e), h.rotate(
|
|
471
|
+
h.save(), h.translate(t, e), h.rotate(vt.degreesToRadians(s.angle)), h.fillStyle = We, h.strokeStyle = Ue, h.lineWidth = Fe, h.beginPath(), h.roundRect(-o / 2, -i / 2, o, i, a), h.fill(), h.stroke(), h.restore();
|
|
472
472
|
}
|
|
473
473
|
const Jn = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", wn = new Image();
|
|
474
474
|
wn.src = Jn;
|
|
475
475
|
function Qn(h, t, e, n, s) {
|
|
476
476
|
const i = me / 2;
|
|
477
|
-
h.save(), h.translate(t, e), h.rotate(
|
|
477
|
+
h.save(), h.translate(t, e), h.rotate(vt.degreesToRadians(s.angle)), h.fillStyle = qn, h.beginPath(), h.arc(0, 0, i, 0, 2 * Math.PI), h.fill(), h.drawImage(wn, -i / 2, -i / 2, i, i), h.restore();
|
|
478
478
|
}
|
|
479
479
|
const $n = {
|
|
480
480
|
// Угловые точки
|
|
481
481
|
tl: {
|
|
482
482
|
render: he,
|
|
483
|
-
sizeX:
|
|
484
|
-
sizeY:
|
|
483
|
+
sizeX: wt,
|
|
484
|
+
sizeY: wt,
|
|
485
485
|
offsetX: 0,
|
|
486
486
|
offsetY: 0
|
|
487
487
|
},
|
|
488
488
|
tr: {
|
|
489
489
|
render: he,
|
|
490
|
-
sizeX:
|
|
491
|
-
sizeY:
|
|
490
|
+
sizeX: wt,
|
|
491
|
+
sizeY: wt,
|
|
492
492
|
offsetX: 0,
|
|
493
493
|
offsetY: 0
|
|
494
494
|
},
|
|
495
495
|
bl: {
|
|
496
496
|
render: he,
|
|
497
|
-
sizeX:
|
|
498
|
-
sizeY:
|
|
497
|
+
sizeX: wt,
|
|
498
|
+
sizeY: wt,
|
|
499
499
|
offsetX: 0,
|
|
500
500
|
offsetY: 0
|
|
501
501
|
},
|
|
502
502
|
br: {
|
|
503
503
|
render: he,
|
|
504
|
-
sizeX:
|
|
505
|
-
sizeY:
|
|
504
|
+
sizeX: wt,
|
|
505
|
+
sizeY: wt,
|
|
506
506
|
offsetX: 0,
|
|
507
507
|
offsetY: 0
|
|
508
508
|
},
|
|
@@ -849,7 +849,7 @@ X.registeredFontKeys = /* @__PURE__ */ new Set(), X.descriptorDefaults = {
|
|
|
849
849
|
display: "auto"
|
|
850
850
|
};
|
|
851
851
|
let xe = X;
|
|
852
|
-
const ts = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNi44NzUgMi41YS42MjUuNjI1IDAgMCAwLS42MjUuNjI0VjYuMjVIMy4xMjVhLjYyNS42MjUgMCAwIDAtLjYyNS42MjV2MTBjMCAuMzQ1LjI4LjYyNS42MjUuNjI1aDEwYy4zNDUgMCAuNjI1LS4yOC42MjUtLjYyNXYtMy4xMjZoMy4xMjVjLjM0NSAwIC42MjUtLjI4LjYyNS0uNjI1di0xMGEuNjI1LjYyNSAwIDAgMC0uNjI1LS42MjVoLTEwWm02Ljg3NSAxMGgyLjVWMy43NUg3LjV2Mi41aDUuNjI1Yy4zNDUgMCAuNjI1LjI4LjYyNS42MjV2NS42MjRabS0xMCAzLjc1VjcuNWg4Ljc1djguNzVIMy43NVoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==", es = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMi41IDcuNWMwLS42OS41Ni0xLjI1IDEuMjUtMS4yNWgxMi41Yy42OSAwIDEuMjUuNTYgMS4yNSAxLjI1djguNzVjMCAuNjktLjU2IDEu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gMTBsLTEuOTc0LTEuMTUxLTMuOTcxIDIuMzE2YS42MjUuNjI1IDAgMCAxLS42MyAwbC0zLjk3LTIuMzE2TDMuNzQgMTBaIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=", rs = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI0VDNEU0MCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNOC4xMjUgMS4yNUExLjg3NSAxLjg3NSAwIDAgMCA2LjI1IDMuMTI1di42MjVIMy4xMjVhLjYyNS42MjUgMCAwIDAgMCAxLjI1aC42MjV2MTEuMjVBMS4yNSAxLjI1IDAgMCAwIDUgMTcuNWgxMGExLjI1IDEuMjUgMCAwIDAgMS4yNS0xLjI1VjVoLjYyNWEuNjI1LjYyNSAwIDAgMCAwLTEuMjVIMTMuNzV2LS42MjVhMS44NzUgMS44NzUgMCAwIDAtMS44NzUtMS44NzVoLTMuNzVabTQuMzc1IDIuNXYtLjYyNWEuNjI1LjYyNSAwIDAgMC0uNjI1LS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDAtLjYyNS42MjV2LjYyNWg1Wk01IDE2LjI1VjVoMTB2MTEuMjVINVpNOC4xMjUgNy41Yy4zNDUgMCAuNjI1LjI4LjYyNS42MjV2NWEuNjI1LjYyNSAwIDEgMS0xLjI1IDB2LTVjMC0uMzQ1LjI4LS42MjUuNjI1LS42MjVabTQuMzc1IDUuNjI1di01YS42MjUuNjI1IDAgMCAwLTEuMjUgMHY1YS42MjUuNjI1IDAgMSAwIDEuMjUgMFoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==", qt = {
|
|
853
853
|
style: {
|
|
854
854
|
position: "absolute",
|
|
855
855
|
display: "none",
|
|
@@ -959,11 +959,11 @@ class cs {
|
|
|
959
959
|
_initToolbar() {
|
|
960
960
|
if (!this.options.showToolbar) return;
|
|
961
961
|
const t = this.options.toolbar || {};
|
|
962
|
-
this.config = It(F(F({},
|
|
963
|
-
style: F(F({},
|
|
964
|
-
btnStyle: F(F({},
|
|
965
|
-
icons: F(F({},
|
|
966
|
-
handlers: F(F({},
|
|
962
|
+
this.config = It(F(F({}, qt), t), {
|
|
963
|
+
style: F(F({}, qt.style), t.style || {}),
|
|
964
|
+
btnStyle: F(F({}, qt.btnStyle), t.btnStyle || {}),
|
|
965
|
+
icons: F(F({}, qt.icons), t.icons || {}),
|
|
966
|
+
handlers: F(F({}, qt.handlers), t.handlers || {})
|
|
967
967
|
}), 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 = () => {
|
|
968
968
|
this.el.style.display = "none";
|
|
969
969
|
}, this._createDOM(), this._bindEvents();
|
|
@@ -1800,7 +1800,7 @@ class J {
|
|
|
1800
1800
|
}
|
|
1801
1801
|
}
|
|
1802
1802
|
}
|
|
1803
|
-
const hs = 0.1, us = 2, cn = 0.1, fs = 90,
|
|
1803
|
+
const hs = 0.1, us = 2, cn = 0.1, fs = 90, Qt = 16, $t = 16, Pt = 4096, zt = 4096, ln = "application/image-editor:", ue = [
|
|
1804
1804
|
"format",
|
|
1805
1805
|
"customData",
|
|
1806
1806
|
"contentType",
|
|
@@ -1819,7 +1819,7 @@ const hs = 0.1, us = 2, cn = 0.1, fs = 90, $t = 16, te = 16, zt = 4096, Ft = 409
|
|
|
1819
1819
|
"radiusBottomLeft",
|
|
1820
1820
|
"lineFontDefaults"
|
|
1821
1821
|
], gs = 50;
|
|
1822
|
-
class
|
|
1822
|
+
class te {
|
|
1823
1823
|
constructor({ editor: t }) {
|
|
1824
1824
|
this.editor = t, this.options = t.options, this._createdBlobUrls = [], this.acceptContentTypes = this.editor.options.acceptContentTypes, this.acceptFormats = this.getAllowedFormatsFromContentTypes();
|
|
1825
1825
|
}
|
|
@@ -1869,7 +1869,7 @@ class pt {
|
|
|
1869
1869
|
cache: e
|
|
1870
1870
|
}) {
|
|
1871
1871
|
var o;
|
|
1872
|
-
if (
|
|
1872
|
+
if (te._isBlobOrDataUrl({ src: t })) return t;
|
|
1873
1873
|
if (e.has(t))
|
|
1874
1874
|
return (o = e.get(t)) != null ? o : null;
|
|
1875
1875
|
const s = yield this._fetchAsBlobUrl({ src: t });
|
|
@@ -1922,7 +1922,7 @@ class pt {
|
|
|
1922
1922
|
customData: c = null
|
|
1923
1923
|
} = t;
|
|
1924
1924
|
if (!e) return null;
|
|
1925
|
-
const { canvas: l, montageArea: d, transformManager: u, historyManager: f, errorManager: p } = this.editor, m = yield this.getContentType(e), g =
|
|
1925
|
+
const { canvas: l, montageArea: d, transformManager: u, historyManager: f, errorManager: p } = this.editor, m = yield this.getContentType(e), g = this.getFormatFromContentType(m), { acceptContentTypes: y, acceptFormats: b } = this;
|
|
1926
1926
|
if (!this.isAllowedContentType(m)) {
|
|
1927
1927
|
const A = `Неверный contentType для изображения: ${m}. Ожидается один из: ${this.acceptContentTypes.join(", ")}.`;
|
|
1928
1928
|
return p.emitError({
|
|
@@ -1972,27 +1972,27 @@ class pt {
|
|
|
1972
1972
|
}), f.resumeHistory(), null;
|
|
1973
1973
|
if (g === "svg") {
|
|
1974
1974
|
const v = yield xn(A);
|
|
1975
|
-
w =
|
|
1975
|
+
w = vt.groupSVGElements(v.objects, v.options);
|
|
1976
1976
|
} else
|
|
1977
|
-
w = yield
|
|
1977
|
+
w = yield Kt.fromURL(A, { crossOrigin: "anonymous" });
|
|
1978
1978
|
const { width: T, height: E } = w;
|
|
1979
|
-
if (w instanceof
|
|
1979
|
+
if (w instanceof Kt) {
|
|
1980
1980
|
const v = w.getElement();
|
|
1981
1981
|
let S = "";
|
|
1982
|
-
if (v instanceof HTMLImageElement ? S = v.src : v instanceof HTMLCanvasElement && (S = v.toDataURL()), E >
|
|
1982
|
+
if (v instanceof HTMLImageElement ? S = v.src : v instanceof HTMLCanvasElement && (S = v.toDataURL()), E > zt || T > Pt) {
|
|
1983
1983
|
const M = yield this.resizeImageToBoundaries({
|
|
1984
1984
|
dataURL: S,
|
|
1985
1985
|
sizeType: "max",
|
|
1986
1986
|
contentType: m
|
|
1987
|
-
}),
|
|
1988
|
-
this._createdBlobUrls.push(
|
|
1989
|
-
} else if (E <
|
|
1987
|
+
}), C = URL.createObjectURL(M);
|
|
1988
|
+
this._createdBlobUrls.push(C), w = yield Kt.fromURL(C, { crossOrigin: "anonymous" });
|
|
1989
|
+
} else if (E < $t || T < Qt) {
|
|
1990
1990
|
const M = yield this.resizeImageToBoundaries({
|
|
1991
1991
|
dataURL: S,
|
|
1992
1992
|
sizeType: "min",
|
|
1993
1993
|
contentType: m
|
|
1994
|
-
}),
|
|
1995
|
-
this._createdBlobUrls.push(
|
|
1994
|
+
}), C = URL.createObjectURL(M);
|
|
1995
|
+
this._createdBlobUrls.push(C), w = yield Kt.fromURL(C, { crossOrigin: "anonymous" });
|
|
1996
1996
|
}
|
|
1997
1997
|
}
|
|
1998
1998
|
if (w.set("id", `${w.type}-${et()}`), w.set("format", g), w.set("contentType", m), w.set("customData", c || null), n === "scale-montage")
|
|
@@ -2001,7 +2001,7 @@ class pt {
|
|
|
2001
2001
|
const { width: v, height: S } = d, M = this.calculateScaleFactor({ imageObject: w, scaleType: n });
|
|
2002
2002
|
n === "image-contain" && M < 1 ? u.fitObject({ object: w, type: "contain", withoutSave: !0 }) : n === "image-cover" && (T > v || E > S) && u.fitObject({ object: w, type: "cover", withoutSave: !0 });
|
|
2003
2003
|
}
|
|
2004
|
-
const
|
|
2004
|
+
const I = {
|
|
2005
2005
|
image: w,
|
|
2006
2006
|
format: g,
|
|
2007
2007
|
contentType: m,
|
|
@@ -2014,7 +2014,7 @@ class pt {
|
|
|
2014
2014
|
withoutAdding: r,
|
|
2015
2015
|
customData: c
|
|
2016
2016
|
};
|
|
2017
|
-
return r ? (f.resumeHistory(), l.fire("editor:image-imported",
|
|
2017
|
+
return r ? (f.resumeHistory(), l.fire("editor:image-imported", I), I) : (l.add(w), l.centerObject(w), a || l.setActiveObject(w), l.renderAll(), f.resumeHistory(), s || f.saveState(), l.fire("editor:image-imported", I), I);
|
|
2018
2018
|
} catch (A) {
|
|
2019
2019
|
return p.emitError({
|
|
2020
2020
|
origin: "ImageManager",
|
|
@@ -2061,10 +2061,10 @@ class pt {
|
|
|
2061
2061
|
sizeType: n = "max",
|
|
2062
2062
|
contentType: s = "image/png",
|
|
2063
2063
|
quality: o = 1,
|
|
2064
|
-
maxWidth: i =
|
|
2065
|
-
maxHeight: a =
|
|
2066
|
-
minWidth: r =
|
|
2067
|
-
minHeight: c =
|
|
2064
|
+
maxWidth: i = Pt,
|
|
2065
|
+
maxHeight: a = zt,
|
|
2066
|
+
minWidth: r = Qt,
|
|
2067
|
+
minHeight: c = $t,
|
|
2068
2068
|
asBase64: l = !1,
|
|
2069
2069
|
emitMessage: d = !0
|
|
2070
2070
|
} = t, { errorManager: u, workerManager: f } = this.editor, p = {
|
|
@@ -2119,13 +2119,13 @@ class pt {
|
|
|
2119
2119
|
exportAsBlob: o = !1
|
|
2120
2120
|
} = t, { canvas: i, montageArea: a, workerManager: r, interactionBlocker: c } = this.editor;
|
|
2121
2121
|
try {
|
|
2122
|
-
const l = n === "application/pdf", d = l ? "image/jpg" : n, u =
|
|
2122
|
+
const l = n === "application/pdf", d = l ? "image/jpg" : n, u = this.getFormatFromContentType(d);
|
|
2123
2123
|
a.setCoords();
|
|
2124
2124
|
const { left: f, top: p, width: m, height: g } = a.getBoundingRect(), y = yield i.clone(["id", "format", "locked"]);
|
|
2125
2125
|
y.enableRetinaScaling = !1, ["image/jpg", "image/jpeg"].includes(d) && (y.backgroundColor = "#ffffff");
|
|
2126
2126
|
const b = y.getObjects().find((M) => M.id === a.id);
|
|
2127
2127
|
if (b && (b.visible = !1), c != null && c.isBlocked) {
|
|
2128
|
-
const M = y.getObjects().find((
|
|
2128
|
+
const M = y.getObjects().find((C) => C.id === c.overlayMask.id);
|
|
2129
2129
|
M && (M.visible = !1);
|
|
2130
2130
|
}
|
|
2131
2131
|
y.viewportTransform = [1, 0, 0, 1, -f, -p], y.setDimensions({ width: m, height: g }, { backstoreOnly: !0 }), y.renderAll();
|
|
@@ -2134,7 +2134,7 @@ class pt {
|
|
|
2134
2134
|
const M = y.toSVG();
|
|
2135
2135
|
y.dispose();
|
|
2136
2136
|
const O = {
|
|
2137
|
-
image:
|
|
2137
|
+
image: te._exportSVGStringAsFile(M, {
|
|
2138
2138
|
exportAsBase64: s,
|
|
2139
2139
|
exportAsBlob: o,
|
|
2140
2140
|
fileName: e
|
|
@@ -2145,10 +2145,10 @@ class pt {
|
|
|
2145
2145
|
};
|
|
2146
2146
|
return i.fire("editor:canvas-exported", O), O;
|
|
2147
2147
|
}
|
|
2148
|
-
const w = yield new Promise((M,
|
|
2148
|
+
const w = yield new Promise((M, C) => {
|
|
2149
2149
|
y.getElement().toBlob(
|
|
2150
2150
|
(O) => {
|
|
2151
|
-
O ? M(O) :
|
|
2151
|
+
O ? M(O) : C(new Error("Failed to create Blob from canvas"));
|
|
2152
2152
|
},
|
|
2153
2153
|
d,
|
|
2154
2154
|
1
|
|
@@ -2173,12 +2173,12 @@ class pt {
|
|
|
2173
2173
|
[T]
|
|
2174
2174
|
);
|
|
2175
2175
|
if (l) {
|
|
2176
|
-
const
|
|
2177
|
-
orientation:
|
|
2176
|
+
const C = m * 0.264583, O = g * 0.264583, L = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, U = new L({
|
|
2177
|
+
orientation: C > O ? "landscape" : "portrait",
|
|
2178
2178
|
unit: "mm",
|
|
2179
|
-
format: [
|
|
2179
|
+
format: [C, O]
|
|
2180
2180
|
});
|
|
2181
|
-
if (U.addImage(String(E), "JPG", 0, 0,
|
|
2181
|
+
if (U.addImage(String(E), "JPG", 0, 0, C, O), s) {
|
|
2182
2182
|
const x = {
|
|
2183
2183
|
image: U.output("datauristring"),
|
|
2184
2184
|
format: "pdf",
|
|
@@ -2204,11 +2204,11 @@ class pt {
|
|
|
2204
2204
|
};
|
|
2205
2205
|
return i.fire("editor:canvas-exported", M), M;
|
|
2206
2206
|
}
|
|
2207
|
-
const
|
|
2208
|
-
image: new File([w],
|
|
2207
|
+
const I = u === "svg" && !A ? e.replace(/\.[^/.]+$/, ".png") : e, S = {
|
|
2208
|
+
image: new File([w], I, { type: d }),
|
|
2209
2209
|
format: u,
|
|
2210
2210
|
contentType: d,
|
|
2211
|
-
fileName:
|
|
2211
|
+
fileName: I
|
|
2212
2212
|
};
|
|
2213
2213
|
return i.fire("editor:canvas-exported", S), S;
|
|
2214
2214
|
} catch (l) {
|
|
@@ -2242,7 +2242,7 @@ class pt {
|
|
|
2242
2242
|
contentType: s,
|
|
2243
2243
|
exportAsBase64: o = !1,
|
|
2244
2244
|
exportAsBlob: i = !1
|
|
2245
|
-
} = t, { canvas: a, workerManager: r } = this.editor, c = e || a.getActiveObject(), l = s != null ? s : "image/png", d =
|
|
2245
|
+
} = t, { canvas: a, workerManager: r } = this.editor, c = e || a.getActiveObject(), l = s != null ? s : "image/png", d = this.getFormatFromContentType(l) || "png", u = n != null ? n : `image.${d}`;
|
|
2246
2246
|
if (!c)
|
|
2247
2247
|
return this.editor.errorManager.emitError({
|
|
2248
2248
|
origin: "ImageManager",
|
|
@@ -2251,10 +2251,10 @@ class pt {
|
|
|
2251
2251
|
message: "Не выбран объект для экспорта",
|
|
2252
2252
|
data: { contentType: l, fileName: u, exportAsBase64: o, exportAsBlob: i }
|
|
2253
2253
|
}), null;
|
|
2254
|
-
const { contentType: f, format: p = "" } = c, m = (b = s != null ? s : f) != null ? b : "image/png", g =
|
|
2254
|
+
const { contentType: f, format: p = "" } = c, m = (b = s != null ? s : f) != null ? b : "image/png", g = this.getFormatFromContentType(m) || p || "png", y = n != null ? n : `image.${g}`;
|
|
2255
2255
|
try {
|
|
2256
2256
|
if (g === "svg") {
|
|
2257
|
-
const
|
|
2257
|
+
const I = c.toSVG(), v = te._exportSVGStringAsFile(I, {
|
|
2258
2258
|
exportAsBase64: o,
|
|
2259
2259
|
exportAsBlob: i,
|
|
2260
2260
|
fileName: y
|
|
@@ -2267,15 +2267,15 @@ class pt {
|
|
|
2267
2267
|
};
|
|
2268
2268
|
return a.fire("editor:object-exported", S), S;
|
|
2269
2269
|
}
|
|
2270
|
-
if (o && c instanceof
|
|
2271
|
-
const
|
|
2270
|
+
if (o && c instanceof Kt) {
|
|
2271
|
+
const I = yield createImageBitmap(c.getElement()), v = yield r.post(
|
|
2272
2272
|
"toDataURL",
|
|
2273
2273
|
{
|
|
2274
2274
|
contentType: m,
|
|
2275
2275
|
quality: 1,
|
|
2276
|
-
bitmap:
|
|
2276
|
+
bitmap: I
|
|
2277
2277
|
},
|
|
2278
|
-
[
|
|
2278
|
+
[I]
|
|
2279
2279
|
), S = {
|
|
2280
2280
|
object: c,
|
|
2281
2281
|
image: v,
|
|
@@ -2287,20 +2287,20 @@ class pt {
|
|
|
2287
2287
|
}
|
|
2288
2288
|
const A = c.toCanvasElement({
|
|
2289
2289
|
enableRetinaScaling: !1
|
|
2290
|
-
}), w = yield new Promise((
|
|
2290
|
+
}), w = yield new Promise((I, v) => {
|
|
2291
2291
|
A.toBlob((S) => {
|
|
2292
|
-
S ?
|
|
2292
|
+
S ? I(S) : v(new Error("Failed to create Blob from canvas"));
|
|
2293
2293
|
});
|
|
2294
2294
|
});
|
|
2295
2295
|
if (i) {
|
|
2296
|
-
const
|
|
2296
|
+
const I = {
|
|
2297
2297
|
object: c,
|
|
2298
2298
|
image: w,
|
|
2299
2299
|
format: g,
|
|
2300
2300
|
contentType: m,
|
|
2301
2301
|
fileName: y
|
|
2302
2302
|
};
|
|
2303
|
-
return a.fire("editor:object-exported",
|
|
2303
|
+
return a.fire("editor:object-exported", I), I;
|
|
2304
2304
|
}
|
|
2305
2305
|
const T = new File([w], y, { type: m }), E = {
|
|
2306
2306
|
object: c,
|
|
@@ -2337,7 +2337,7 @@ class pt {
|
|
|
2337
2337
|
* @returns массив допустимых форматов изображений
|
|
2338
2338
|
*/
|
|
2339
2339
|
getAllowedFormatsFromContentTypes() {
|
|
2340
|
-
return this.acceptContentTypes.map((t) =>
|
|
2340
|
+
return this.acceptContentTypes.map((t) => this.getFormatFromContentType(t)).filter((t) => t);
|
|
2341
2341
|
}
|
|
2342
2342
|
/**
|
|
2343
2343
|
* Проверяет, является ли contentType допустимым типом изображения.
|
|
@@ -2390,7 +2390,7 @@ class pt {
|
|
|
2390
2390
|
try {
|
|
2391
2391
|
const s = (e = new URL(t).pathname.split(".").pop()) == null ? void 0 : e.toLowerCase(), o = {};
|
|
2392
2392
|
return this.acceptContentTypes.forEach((i) => {
|
|
2393
|
-
const a =
|
|
2393
|
+
const a = this.getFormatFromContentType(i);
|
|
2394
2394
|
a && (o[a] = i);
|
|
2395
2395
|
}), s && o[s] || "application/octet-stream";
|
|
2396
2396
|
} catch (n) {
|
|
@@ -2436,14 +2436,14 @@ class pt {
|
|
|
2436
2436
|
* отбросив любую часть после «+» или «;»
|
|
2437
2437
|
* @param contentType
|
|
2438
2438
|
* @returns формат, например 'png', 'jpeg', 'svg'
|
|
2439
|
-
* @
|
|
2439
|
+
* @public
|
|
2440
2440
|
*/
|
|
2441
|
-
|
|
2441
|
+
getFormatFromContentType(t = "") {
|
|
2442
2442
|
const e = t.match(/^[^/]+\/([^+;]+)/);
|
|
2443
2443
|
return e ? e[1] : "";
|
|
2444
2444
|
}
|
|
2445
2445
|
}
|
|
2446
|
-
const
|
|
2446
|
+
const Ct = (h, t, e) => Math.max(Math.min(h, e), t), dn = (h, t) => h * t, ps = (h, t) => new lt(h / 2, t / 2);
|
|
2447
2447
|
function ms(h) {
|
|
2448
2448
|
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";
|
|
2449
2449
|
}
|
|
@@ -2467,11 +2467,11 @@ class ys {
|
|
|
2467
2467
|
* Если точка находится за пределами монтажной области, она проецируется на ближайшую границу монтажной области.
|
|
2468
2468
|
*/
|
|
2469
2469
|
getVisibleCenterPoint() {
|
|
2470
|
-
const { canvas: t, montageArea: e } = this.editor, n = t.getZoom(), s = t.viewportTransform, o = t.getWidth(), i = t.getHeight(), a = (o / 2 - s[4]) / n, r = (i / 2 - s[5]) / n, c = e.width / 2, l = e.height / 2, d =
|
|
2470
|
+
const { canvas: t, montageArea: e } = this.editor, n = t.getZoom(), s = t.viewportTransform, o = t.getWidth(), i = t.getHeight(), a = (o / 2 - s[4]) / n, r = (i / 2 - s[5]) / n, c = e.width / 2, l = e.height / 2, d = Ct(
|
|
2471
2471
|
a,
|
|
2472
2472
|
e.left - c,
|
|
2473
2473
|
e.left + c
|
|
2474
|
-
), u =
|
|
2474
|
+
), u = Ct(
|
|
2475
2475
|
r,
|
|
2476
2476
|
e.top - l,
|
|
2477
2477
|
e.top + l
|
|
@@ -2494,7 +2494,7 @@ class ys {
|
|
|
2494
2494
|
canvas: o,
|
|
2495
2495
|
montageArea: i,
|
|
2496
2496
|
options: { canvasBackstoreWidth: a }
|
|
2497
|
-
} = this.editor, { width: r, height: c } = i, l =
|
|
2497
|
+
} = this.editor, { width: r, height: c } = i, l = Ct(Number(t), Qt, Pt);
|
|
2498
2498
|
if (!a || a === "auto" || s ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreWidth(Number(a)) : this.setCanvasBackstoreWidth(l), i.set({ width: l }), (p = o.clipPath) == null || p.set({ width: l }), e) {
|
|
2499
2499
|
const m = l / r, g = dn(c, m);
|
|
2500
2500
|
this.setResolutionHeight(g);
|
|
@@ -2524,7 +2524,7 @@ class ys {
|
|
|
2524
2524
|
canvas: o,
|
|
2525
2525
|
montageArea: i,
|
|
2526
2526
|
options: { canvasBackstoreHeight: a }
|
|
2527
|
-
} = this.editor, { width: r, height: c } = i, l =
|
|
2527
|
+
} = this.editor, { width: r, height: c } = i, l = Ct(Number(t), $t, zt);
|
|
2528
2528
|
if (!a || a === "auto" || s ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreHeight(Number(a)) : this.setCanvasBackstoreHeight(l), i.set({ height: l }), (p = o.clipPath) == null || p.set({ height: l }), e) {
|
|
2529
2529
|
const m = l / c, g = dn(r, m);
|
|
2530
2530
|
this.setResolutionWidth(g);
|
|
@@ -2577,7 +2577,7 @@ class ys {
|
|
|
2577
2577
|
*/
|
|
2578
2578
|
setCanvasBackstoreWidth(t) {
|
|
2579
2579
|
if (!t || typeof t != "number") return;
|
|
2580
|
-
const e =
|
|
2580
|
+
const e = Ct(t, Qt, Pt);
|
|
2581
2581
|
this.editor.canvas.setDimensions({ width: e }, { backstoreOnly: !0 });
|
|
2582
2582
|
}
|
|
2583
2583
|
/**
|
|
@@ -2586,7 +2586,7 @@ class ys {
|
|
|
2586
2586
|
*/
|
|
2587
2587
|
setCanvasBackstoreHeight(t) {
|
|
2588
2588
|
if (!t || typeof t != "number") return;
|
|
2589
|
-
const e =
|
|
2589
|
+
const e = Ct(t, $t, zt);
|
|
2590
2590
|
this.editor.canvas.setDimensions({ height: e }, { backstoreOnly: !0 });
|
|
2591
2591
|
}
|
|
2592
2592
|
/**
|
|
@@ -2595,7 +2595,7 @@ class ys {
|
|
|
2595
2595
|
* с учётом минимальных и максимальных значений.
|
|
2596
2596
|
*/
|
|
2597
2597
|
adaptCanvasToContainer() {
|
|
2598
|
-
const { canvas: t } = this.editor, e = this.getEditorContainer(), n = e.clientWidth, s = e.clientHeight, o =
|
|
2598
|
+
const { canvas: t } = this.editor, e = this.getEditorContainer(), n = e.clientWidth, s = e.clientHeight, o = Ct(n, Qt, Pt), i = Ct(s, $t, zt);
|
|
2599
2599
|
t.setDimensions({ width: o, height: i }, { backstoreOnly: !0 });
|
|
2600
2600
|
}
|
|
2601
2601
|
/**
|
|
@@ -2797,7 +2797,7 @@ class ys {
|
|
|
2797
2797
|
} = this.editor, c = t || s.getActiveObject();
|
|
2798
2798
|
if (!ms(c)) return;
|
|
2799
2799
|
const { width: l, height: d } = c;
|
|
2800
|
-
let u = Math.min(l,
|
|
2800
|
+
let u = Math.min(l, Pt), f = Math.min(d, zt);
|
|
2801
2801
|
if (e) {
|
|
2802
2802
|
const {
|
|
2803
2803
|
width: p,
|
|
@@ -3091,8 +3091,8 @@ class bs {
|
|
|
3091
3091
|
_calculateEmptySpaceRatio(t) {
|
|
3092
3092
|
const { canvas: e, montageArea: n } = this.editor, s = e.viewportTransform, o = e.getWidth(), i = e.getHeight(), a = n.left - n.width / 2, r = n.left + n.width / 2, c = n.top - n.height / 2, l = n.top + n.height / 2, d = -s[4] / t, u = (-s[4] + o) / t, f = -s[5] / t, p = (-s[5] + i) / t, m = d < a, g = u > r, y = f < c, b = p > l;
|
|
3093
3093
|
if (!(m || g || y || b)) return 0;
|
|
3094
|
-
const w = Math.max(0, a - d), T = Math.max(0, u - r), E = Math.max(0, c - f),
|
|
3095
|
-
return Math.max(M,
|
|
3094
|
+
const w = Math.max(0, a - d), T = Math.max(0, u - r), E = Math.max(0, c - f), I = Math.max(0, p - l), v = Math.max(w, T), S = Math.max(E, I), M = v / o, C = S / i;
|
|
3095
|
+
return Math.max(M, C);
|
|
3096
3096
|
}
|
|
3097
3097
|
/**
|
|
3098
3098
|
* Вычисляет плавный шаг перемещения viewport к центру с ускорением
|
|
@@ -3108,7 +3108,7 @@ class bs {
|
|
|
3108
3108
|
const { canvas: i, montageArea: a } = this.editor, r = i.viewportTransform, c = i.getWidth(), l = i.getHeight(), d = t.x - r[4], u = t.y - r[5], f = Math.abs(s), p = e - n;
|
|
3109
3109
|
if (Math.abs(p) / f <= 0.1)
|
|
3110
3110
|
return { x: d, y: u };
|
|
3111
|
-
const g = c / 2, y = l / 2, b = a.left, A = a.top, w = g - b * n, T = y - A * n, E = (w - r[4]) / (e - n),
|
|
3111
|
+
const g = c / 2, y = l / 2, b = a.left, A = a.top, w = g - b * n, T = y - A * n, E = (w - r[4]) / (e - n), I = (T - r[5]) / (e - n), v = E * f, S = I * f, M = v * o, C = S * o, O = Math.abs(M) > Math.abs(d) ? d : M, L = Math.abs(C) > Math.abs(u) ? u : C;
|
|
3112
3112
|
return { x: O, y: L };
|
|
3113
3113
|
}
|
|
3114
3114
|
/**
|
|
@@ -3291,7 +3291,7 @@ class Ms {
|
|
|
3291
3291
|
}), t.upperCanvasEl.style.pointerEvents = "", t.lowerCanvasEl.style.pointerEvents = "", this.overlayMask.visible = !1, t.requestRenderAll(), t.fire("editor:enabled"), n.resumeHistory(), n.flushDeferredSaveAfterUnblock();
|
|
3292
3292
|
}
|
|
3293
3293
|
}
|
|
3294
|
-
class
|
|
3294
|
+
class Ft {
|
|
3295
3295
|
constructor({ editor: t }) {
|
|
3296
3296
|
this.editor = t, this.backgroundObject = null;
|
|
3297
3297
|
}
|
|
@@ -3354,8 +3354,8 @@ class Ut {
|
|
|
3354
3354
|
try {
|
|
3355
3355
|
const { historyManager: i } = this.editor, { backgroundObject: a } = this;
|
|
3356
3356
|
if (i.suspendHistory(), a && a.backgroundType === "gradient") {
|
|
3357
|
-
const r =
|
|
3358
|
-
if (
|
|
3357
|
+
const r = Ft._createFabricGradient(t);
|
|
3358
|
+
if (Ft._isGradientEqual(a.fill, r)) {
|
|
3359
3359
|
i.resumeHistory();
|
|
3360
3360
|
return;
|
|
3361
3361
|
}
|
|
@@ -3538,7 +3538,7 @@ class Ut {
|
|
|
3538
3538
|
backgroundType: "gradient",
|
|
3539
3539
|
backgroundId: `background-${et()}`
|
|
3540
3540
|
}, { withoutSelection: !0 }), this.refresh();
|
|
3541
|
-
const e =
|
|
3541
|
+
const e = Ft._createFabricGradient(t);
|
|
3542
3542
|
this.backgroundObject.set("fill", e), this.editor.canvas.requestRenderAll();
|
|
3543
3543
|
}
|
|
3544
3544
|
/**
|
|
@@ -3598,7 +3598,7 @@ class Ut {
|
|
|
3598
3598
|
{ offset: 0, color: "#000000" },
|
|
3599
3599
|
{ offset: 1, color: "#ffffff" }
|
|
3600
3600
|
], t.type === "linear") {
|
|
3601
|
-
const u = t.angle * Math.PI / 180, f =
|
|
3601
|
+
const u = t.angle * Math.PI / 180, f = Ft._angleToCoords(u);
|
|
3602
3602
|
return new tn({
|
|
3603
3603
|
type: "linear",
|
|
3604
3604
|
gradientUnits: "percentage",
|
|
@@ -3813,7 +3813,7 @@ class Ss {
|
|
|
3813
3813
|
width: s = 100,
|
|
3814
3814
|
height: o = 100,
|
|
3815
3815
|
fill: i = "blue"
|
|
3816
|
-
} = d, a =
|
|
3816
|
+
} = d, a = Mt(d, [
|
|
3817
3817
|
"id",
|
|
3818
3818
|
"left",
|
|
3819
3819
|
"top",
|
|
@@ -3854,7 +3854,7 @@ class Ss {
|
|
|
3854
3854
|
top: n,
|
|
3855
3855
|
radius: s = 50,
|
|
3856
3856
|
fill: o = "green"
|
|
3857
|
-
} = l, i =
|
|
3857
|
+
} = l, i = Mt(l, [
|
|
3858
3858
|
"id",
|
|
3859
3859
|
"left",
|
|
3860
3860
|
"top",
|
|
@@ -3895,7 +3895,7 @@ class Ss {
|
|
|
3895
3895
|
width: s = 100,
|
|
3896
3896
|
height: o = 100,
|
|
3897
3897
|
fill: i = "yellow"
|
|
3898
|
-
} = d, a =
|
|
3898
|
+
} = d, a = Mt(d, [
|
|
3899
3899
|
"id",
|
|
3900
3900
|
"left",
|
|
3901
3901
|
"top",
|
|
@@ -4089,8 +4089,9 @@ class ws {
|
|
|
4089
4089
|
importOptions: e = {}
|
|
4090
4090
|
}) {
|
|
4091
4091
|
var r;
|
|
4092
|
-
const s = It(F({
|
|
4093
|
-
source: t
|
|
4092
|
+
const s = It(F({
|
|
4093
|
+
source: t
|
|
4094
|
+
}, e), {
|
|
4094
4095
|
fromClipboard: !0
|
|
4095
4096
|
}), o = yield this.editor.imageManager.importImage(s), i = o == null ? void 0 : o.image, a = (r = o == null ? void 0 : o.source) != null ? r : t;
|
|
4096
4097
|
i && this.editor.canvas.fire("editor:object-pasted", {
|
|
@@ -4292,7 +4293,7 @@ class ve {
|
|
|
4292
4293
|
});
|
|
4293
4294
|
}
|
|
4294
4295
|
static _isGroupOrSelection(t) {
|
|
4295
|
-
return t instanceof K || t instanceof
|
|
4296
|
+
return t instanceof K || t instanceof Nt;
|
|
4296
4297
|
}
|
|
4297
4298
|
}
|
|
4298
4299
|
class As {
|
|
@@ -4315,20 +4316,20 @@ class As {
|
|
|
4315
4316
|
*/
|
|
4316
4317
|
_getGroupsToUngroup(t) {
|
|
4317
4318
|
if (Array.isArray(t)) {
|
|
4318
|
-
const n = t.filter((s) => s instanceof
|
|
4319
|
+
const n = t.filter((s) => s instanceof Nt);
|
|
4319
4320
|
return n.length > 0 ? n : null;
|
|
4320
4321
|
}
|
|
4321
4322
|
if (t instanceof K) {
|
|
4322
|
-
const n = t.getObjects().filter((s) => s instanceof
|
|
4323
|
+
const n = t.getObjects().filter((s) => s instanceof Nt);
|
|
4323
4324
|
return n.length > 0 ? n : null;
|
|
4324
4325
|
}
|
|
4325
4326
|
const e = t || this.editor.canvas.getActiveObject();
|
|
4326
4327
|
if (!e) return null;
|
|
4327
4328
|
if (e instanceof K) {
|
|
4328
|
-
const n = e.getObjects().filter((s) => s instanceof
|
|
4329
|
+
const n = e.getObjects().filter((s) => s instanceof Nt);
|
|
4329
4330
|
return n.length > 0 ? n : null;
|
|
4330
4331
|
}
|
|
4331
|
-
return e instanceof
|
|
4332
|
+
return e instanceof Nt ? [e] : null;
|
|
4332
4333
|
}
|
|
4333
4334
|
/**
|
|
4334
4335
|
* Группировка объектов
|
|
@@ -4345,7 +4346,7 @@ class As {
|
|
|
4345
4346
|
if (!o) return null;
|
|
4346
4347
|
try {
|
|
4347
4348
|
s.suspendHistory();
|
|
4348
|
-
const i = new
|
|
4349
|
+
const i = new Nt(o, {
|
|
4349
4350
|
id: `group-${et()}`
|
|
4350
4351
|
});
|
|
4351
4352
|
o.forEach((r) => n.remove(r)), n.add(i), n.setActiveObject(i), n.requestRenderAll();
|
|
@@ -4751,7 +4752,7 @@ class He {
|
|
|
4751
4752
|
return s.fire("editor:objects-deleted", c), c;
|
|
4752
4753
|
}
|
|
4753
4754
|
}
|
|
4754
|
-
const
|
|
4755
|
+
const _t = {
|
|
4755
4756
|
IMAGE_MANAGER: {
|
|
4756
4757
|
/**
|
|
4757
4758
|
* Некорректный Content-Type изображения
|
|
@@ -4943,7 +4944,7 @@ class ne {
|
|
|
4943
4944
|
* @returns true, если код допустим, иначе false
|
|
4944
4945
|
*/
|
|
4945
4946
|
static isValidErrorCode(t) {
|
|
4946
|
-
return t ? Object.values(
|
|
4947
|
+
return t ? Object.values(_t).some((e) => Object.values(e).includes(t)) : !1;
|
|
4947
4948
|
}
|
|
4948
4949
|
}
|
|
4949
4950
|
class js {
|
|
@@ -5031,7 +5032,7 @@ class js {
|
|
|
5031
5032
|
this.currentBounds = this.calculatePanBounds();
|
|
5032
5033
|
}
|
|
5033
5034
|
}
|
|
5034
|
-
const
|
|
5035
|
+
const Is = ({ textbox: h }) => {
|
|
5035
5036
|
var n, s;
|
|
5036
5037
|
if (!h.isEditing) return null;
|
|
5037
5038
|
const t = (n = h.selectionStart) != null ? n : 0, e = (s = h.selectionEnd) != null ? s : t;
|
|
@@ -5039,7 +5040,7 @@ const Cs = ({ textbox: h }) => {
|
|
|
5039
5040
|
start: Math.min(t, e),
|
|
5040
5041
|
end: Math.max(t, e)
|
|
5041
5042
|
};
|
|
5042
|
-
},
|
|
5043
|
+
}, Cs = ({ textbox: h }) => {
|
|
5043
5044
|
var e, n;
|
|
5044
5045
|
const t = (n = (e = h.text) == null ? void 0 : e.length) != null ? n : 0;
|
|
5045
5046
|
return t <= 0 ? null : { start: 0, end: t };
|
|
@@ -5070,11 +5071,11 @@ const Cs = ({ textbox: h }) => {
|
|
|
5070
5071
|
);
|
|
5071
5072
|
if (n.length)
|
|
5072
5073
|
return (s = n[0]) == null ? void 0 : s[e];
|
|
5073
|
-
}, Re = ({ strokeColor: h, width: t }) => t <= 0 ? null : h != null ? h : "#000000", Be = ({ width: h = 0 }) => h ? Math.max(0, h) : 0,
|
|
5074
|
+
}, Re = ({ strokeColor: h, width: t }) => t <= 0 ? null : h != null ? h : "#000000", Be = ({ width: h = 0 }) => h ? Math.max(0, h) : 0, Ie = ({ value: h }) => typeof h == "string" ? h.toLocaleUpperCase() : "", St = ({
|
|
5074
5075
|
value: h,
|
|
5075
5076
|
min: t,
|
|
5076
5077
|
max: e
|
|
5077
|
-
}) => Math.min(Math.max(h, t), e),
|
|
5078
|
+
}) => Math.min(Math.max(h, t), e), Wt = class Wt extends ct {
|
|
5078
5079
|
constructor(t, e = {}) {
|
|
5079
5080
|
var n, s, o, i, a, r, c, l, d, u;
|
|
5080
5081
|
super(t, e), this.backgroundOpacity = (n = e.backgroundOpacity) != null ? n : 1, this.lineFontDefaults = (s = e.lineFontDefaults) != null ? s : void 0, this.paddingTop = (o = e.paddingTop) != null ? o : 0, this.paddingRight = (i = e.paddingRight) != null ? i : 0, this.paddingBottom = (a = e.paddingBottom) != null ? a : 0, this.paddingLeft = (r = e.paddingLeft) != null ? r : 0, this.radiusTopLeft = (c = e.radiusTopLeft) != null ? c : 0, this.radiusTopRight = (l = e.radiusTopRight) != null ? l : 0, this.radiusBottomRight = (d = e.radiusBottomRight) != null ? d : 0, this.radiusBottomLeft = (u = e.radiusBottomLeft) != null ? u : 0, this._roundDimensions();
|
|
@@ -5127,7 +5128,7 @@ const Cs = ({ textbox: h }) => {
|
|
|
5127
5128
|
const e = this._getEffectiveBackgroundFill();
|
|
5128
5129
|
if (e && e) {
|
|
5129
5130
|
const o = this._getPadding(), i = (n = this.width) != null ? n : 0, a = (s = this.height) != null ? s : 0, r = i + o.left + o.right, c = a + o.top + o.bottom, l = this._getCornerRadii({ width: r, height: c }), d = this._getLeftOffset() - o.left, u = this._getTopOffset() - o.top;
|
|
5130
|
-
t.save(),
|
|
5131
|
+
t.save(), Wt._renderRoundedRect({
|
|
5131
5132
|
ctx: t,
|
|
5132
5133
|
height: c,
|
|
5133
5134
|
left: d,
|
|
@@ -5163,14 +5164,14 @@ const Cs = ({ textbox: h }) => {
|
|
|
5163
5164
|
continue;
|
|
5164
5165
|
}
|
|
5165
5166
|
const A = c[g], w = b / o, T = this._getLineLeftOffset(g);
|
|
5166
|
-
let E = 0,
|
|
5167
|
+
let E = 0, I = 0, v = this.getValueOfPropertyAt(g, 0, e), S = this._getDecorationColorAt(g, 0), M = this.getValueOfPropertyAt(g, 0, "textDecorationThickness"), C = v, O = S, L = M;
|
|
5167
5168
|
const U = l + w * (1 - r);
|
|
5168
5169
|
let z = this.getHeightOfChar(g, 0), j = this.getValueOfPropertyAt(g, 0, "deltaY");
|
|
5169
5170
|
for (let x = 0, B = A.length; x < B; x += 1) {
|
|
5170
5171
|
const _ = this.__charBounds[g][x];
|
|
5171
|
-
|
|
5172
|
+
C = this.getValueOfPropertyAt(g, x, e), O = this._getDecorationColorAt(g, x), L = this.getValueOfPropertyAt(g, x, "textDecorationThickness");
|
|
5172
5173
|
const D = this.getHeightOfChar(g, x), P = this.getValueOfPropertyAt(g, x, "deltaY");
|
|
5173
|
-
if (u &&
|
|
5174
|
+
if (u && C && O) {
|
|
5174
5175
|
const k = s * L / 1e3;
|
|
5175
5176
|
t.save(), t.fillStyle = S, t.translate(_.renderLeft, _.renderTop), t.rotate(_.angle), t.fillRect(
|
|
5176
5177
|
-_.kernedWidth / 2,
|
|
@@ -5178,25 +5179,25 @@ const Cs = ({ textbox: h }) => {
|
|
|
5178
5179
|
_.kernedWidth,
|
|
5179
5180
|
k
|
|
5180
5181
|
), t.restore();
|
|
5181
|
-
} else if ((
|
|
5182
|
+
} else if ((C !== v || O !== S || D !== z || L !== M || P !== j) && I > 0) {
|
|
5182
5183
|
const k = s * M / 1e3;
|
|
5183
5184
|
let V = d + T + E;
|
|
5184
|
-
n === "rtl" && (V = a - V -
|
|
5185
|
+
n === "rtl" && (V = a - V - I), v && S && M && (t.fillStyle = S, t.fillRect(
|
|
5185
5186
|
V,
|
|
5186
5187
|
U + p * z + j - m * k,
|
|
5187
|
-
|
|
5188
|
+
I,
|
|
5188
5189
|
k
|
|
5189
|
-
)), E = _.left,
|
|
5190
|
+
)), E = _.left, I = _.width, v = C, M = L, S = O, z = D, j = P;
|
|
5190
5191
|
} else
|
|
5191
|
-
|
|
5192
|
+
I += _.kernedWidth;
|
|
5192
5193
|
}
|
|
5193
5194
|
let R = d + T + E;
|
|
5194
|
-
n === "rtl" && (R = a - R -
|
|
5195
|
+
n === "rtl" && (R = a - R - I), t.fillStyle = O;
|
|
5195
5196
|
const N = s * L / 1e3;
|
|
5196
|
-
|
|
5197
|
+
C && O && L && t.fillRect(
|
|
5197
5198
|
R,
|
|
5198
5199
|
U + p * z + j - m * N,
|
|
5199
|
-
|
|
5200
|
+
I - f,
|
|
5200
5201
|
N
|
|
5201
5202
|
), l += b;
|
|
5202
5203
|
}
|
|
@@ -5226,10 +5227,10 @@ const Cs = ({ textbox: h }) => {
|
|
|
5226
5227
|
var i, a, r, c;
|
|
5227
5228
|
const n = t / 2, s = e / 2, o = Math.min(n, s);
|
|
5228
5229
|
return {
|
|
5229
|
-
bottomLeft:
|
|
5230
|
-
bottomRight:
|
|
5231
|
-
topLeft:
|
|
5232
|
-
topRight:
|
|
5230
|
+
bottomLeft: St({ value: (i = this.radiusBottomLeft) != null ? i : 0, min: 0, max: o }),
|
|
5231
|
+
bottomRight: St({ value: (a = this.radiusBottomRight) != null ? a : 0, min: 0, max: o }),
|
|
5232
|
+
topLeft: St({ value: (r = this.radiusTopLeft) != null ? r : 0, min: 0, max: o }),
|
|
5233
|
+
topRight: St({ value: (c = this.radiusTopRight) != null ? c : 0, min: 0, max: o })
|
|
5233
5234
|
};
|
|
5234
5235
|
}
|
|
5235
5236
|
_getPadding() {
|
|
@@ -5245,7 +5246,7 @@ const Cs = ({ textbox: h }) => {
|
|
|
5245
5246
|
var s;
|
|
5246
5247
|
const t = this.backgroundColor;
|
|
5247
5248
|
if (!t) return null;
|
|
5248
|
-
const e =
|
|
5249
|
+
const e = St({ value: (s = this.backgroundOpacity) != null ? s : 1, min: 0, max: 1 });
|
|
5249
5250
|
let n;
|
|
5250
5251
|
try {
|
|
5251
5252
|
n = new Nn(t);
|
|
@@ -5273,7 +5274,7 @@ const Cs = ({ textbox: h }) => {
|
|
|
5273
5274
|
topRight: l,
|
|
5274
5275
|
bottomRight: d,
|
|
5275
5276
|
bottomLeft: u
|
|
5276
|
-
} = s, f =
|
|
5277
|
+
} = s, f = St({ value: c, min: 0, max: i }), p = St({ value: l, min: 0, max: i }), m = St({ value: d, min: 0, max: i }), g = St({ value: u, min: 0, max: i });
|
|
5277
5278
|
t.beginPath(), t.moveTo(n + f, o), t.lineTo(a - p, o), t.quadraticCurveTo(a, o, a, o + p), t.lineTo(a, r - m), t.quadraticCurveTo(a, r, a - m, r), t.lineTo(n + g, r), t.quadraticCurveTo(n, r, n, r - g), t.lineTo(n, o + f), t.quadraticCurveTo(n, o, n + f, o), t.closePath();
|
|
5278
5279
|
}
|
|
5279
5280
|
/**
|
|
@@ -5287,7 +5288,7 @@ const Cs = ({ textbox: h }) => {
|
|
|
5287
5288
|
n !== t && (this.width = Math.max(0, n)), s !== e && (this.height = Math.max(0, s));
|
|
5288
5289
|
}
|
|
5289
5290
|
};
|
|
5290
|
-
|
|
5291
|
+
Wt.type = "background-textbox", Wt.cacheProperties = [
|
|
5291
5292
|
...Array.isArray(ct.cacheProperties) ? ct.cacheProperties : [],
|
|
5292
5293
|
"backgroundColor",
|
|
5293
5294
|
"backgroundOpacity",
|
|
@@ -5300,7 +5301,7 @@ Yt.type = "background-textbox", Yt.cacheProperties = [
|
|
|
5300
5301
|
"radiusTopRight",
|
|
5301
5302
|
"radiusBottomRight",
|
|
5302
5303
|
"radiusBottomLeft"
|
|
5303
|
-
],
|
|
5304
|
+
], Wt.stateProperties = [
|
|
5304
5305
|
...Array.isArray(ct.stateProperties) ? ct.stateProperties : [],
|
|
5305
5306
|
"backgroundColor",
|
|
5306
5307
|
"backgroundOpacity",
|
|
@@ -5314,7 +5315,7 @@ Yt.type = "background-textbox", Yt.cacheProperties = [
|
|
|
5314
5315
|
"radiusBottomRight",
|
|
5315
5316
|
"radiusBottomLeft"
|
|
5316
5317
|
];
|
|
5317
|
-
let be =
|
|
5318
|
+
let be = Wt;
|
|
5318
5319
|
const Es = () => {
|
|
5319
5320
|
var h;
|
|
5320
5321
|
(h = en) != null && h.setClass && en.setClass(be, "background-textbox");
|
|
@@ -5552,7 +5553,7 @@ const Es = () => {
|
|
|
5552
5553
|
if (s !== void 0 || o !== void 0 || i !== void 0 || a !== void 0 || r !== void 0 || c !== void 0) return !0;
|
|
5553
5554
|
}
|
|
5554
5555
|
return !1;
|
|
5555
|
-
},
|
|
5556
|
+
}, Ot = ({
|
|
5556
5557
|
textbox: h
|
|
5557
5558
|
}) => {
|
|
5558
5559
|
const { width: t, height: e, calcTextWidth: n, calcTextHeight: s } = h, o = typeof n == "function" ? n.call(h) : void 0, i = typeof s == "function" ? s.call(h) : void 0, a = pn({
|
|
@@ -5585,7 +5586,7 @@ class rt {
|
|
|
5585
5586
|
if (!rt._isTextbox(s) || this.lineDefaultsSyncing.has(s)) return;
|
|
5586
5587
|
const { text: o = "", uppercase: i, autoExpand: a } = s, r = !!i, c = a !== !1, l = o.toLocaleLowerCase();
|
|
5587
5588
|
if (r) {
|
|
5588
|
-
const f =
|
|
5589
|
+
const f = Ie({ value: l });
|
|
5589
5590
|
f !== o && s.set({ text: f }), s.textCaseRaw = l;
|
|
5590
5591
|
} else
|
|
5591
5592
|
s.textCaseRaw = o;
|
|
@@ -5593,7 +5594,7 @@ class rt {
|
|
|
5593
5594
|
let d = !1;
|
|
5594
5595
|
c && (d = this._autoExpandTextboxWidth(s));
|
|
5595
5596
|
let u = !1;
|
|
5596
|
-
d || (u =
|
|
5597
|
+
d || (u = Ot({ textbox: s })), (d || u) && (s.setCoords(), s.dirty = !0), this._syncLineFontDefaultsOnTextChanged({ textbox: s });
|
|
5597
5598
|
}, this._handleTextEditingExited = (n) => {
|
|
5598
5599
|
var c, l, d;
|
|
5599
5600
|
const { target: s } = n;
|
|
@@ -5605,7 +5606,7 @@ class rt {
|
|
|
5605
5606
|
s.textCaseRaw = u;
|
|
5606
5607
|
} else
|
|
5607
5608
|
s.textCaseRaw = o;
|
|
5608
|
-
|
|
5609
|
+
Ot({ textbox: s }) && (s.setCoords(), s.dirty = !0, this.canvas.requestRenderAll()), s.locked || s.set({
|
|
5609
5610
|
lockMovementX: !1,
|
|
5610
5611
|
lockMovementY: !1
|
|
5611
5612
|
});
|
|
@@ -5628,10 +5629,10 @@ class rt {
|
|
|
5628
5629
|
s.set({ width: m });
|
|
5629
5630
|
const { width: g = 0 } = s, y = p - g;
|
|
5630
5631
|
if (y !== 0 && o && o.corner === "ml") {
|
|
5631
|
-
const A = ((l = s.angle) != null ? l : 0) * Math.PI / 180, w = Math.cos(A), T = Math.sin(A), E = (d = s.scaleX) != null ? d : 1,
|
|
5632
|
+
const A = ((l = s.angle) != null ? l : 0) * Math.PI / 180, w = Math.cos(A), T = Math.sin(A), E = (d = s.scaleX) != null ? d : 1, I = y * E;
|
|
5632
5633
|
s.set({
|
|
5633
|
-
left: ((u = s.left) != null ? u : 0) +
|
|
5634
|
-
top: ((f = s.top) != null ? f : 0) +
|
|
5634
|
+
left: ((u = s.left) != null ? u : 0) + I * w,
|
|
5635
|
+
top: ((f = s.top) != null ? f : 0) + I * T
|
|
5635
5636
|
});
|
|
5636
5637
|
}
|
|
5637
5638
|
}
|
|
@@ -5642,7 +5643,7 @@ class rt {
|
|
|
5642
5643
|
event: i != null ? i : null
|
|
5643
5644
|
});
|
|
5644
5645
|
}, this._handleObjectScaling = (n) => {
|
|
5645
|
-
var ie, Se, oe, ae, re,
|
|
5646
|
+
var ie, Se, oe, ae, re, kt, we, ce, Ht, Zt, Gt, Vt, Xt;
|
|
5646
5647
|
const { target: s, transform: o } = n;
|
|
5647
5648
|
if (s instanceof K || !rt._isTextbox(s) || !o) return;
|
|
5648
5649
|
s.isScaling = !0;
|
|
@@ -5654,9 +5655,9 @@ class rt {
|
|
|
5654
5655
|
baseRadii: d,
|
|
5655
5656
|
baseStyles: u,
|
|
5656
5657
|
baseLineFontDefaults: f
|
|
5657
|
-
} = i, p = typeof ((ie = o.original) == null ? void 0 : ie.width) == "number" ? o.original.width : void 0, m = typeof ((Se = o.original) == null ? void 0 : Se.left) == "number" ? o.original.left : void 0, g = p != null ? p : a, y = m != null ? m : r, b = (oe = o.corner) != null ? oe : "", A = (ae = o.action) != null ? ae : "", w = ["ml", "mr"].includes(b) || A === "scaleX", T = ["mt", "mb"].includes(b) || A === "scaleY", E = ["tl", "tr", "bl", "br"].includes(b) || A === "scale",
|
|
5658
|
+
} = i, p = typeof ((ie = o.original) == null ? void 0 : ie.width) == "number" ? o.original.width : void 0, m = typeof ((Se = o.original) == null ? void 0 : Se.left) == "number" ? o.original.left : void 0, g = p != null ? p : a, y = m != null ? m : r, b = (oe = o.corner) != null ? oe : "", A = (ae = o.action) != null ? ae : "", w = ["ml", "mr"].includes(b) || A === "scaleX", T = ["mt", "mb"].includes(b) || A === "scaleY", E = ["tl", "tr", "bl", "br"].includes(b) || A === "scale", I = E || T;
|
|
5658
5659
|
if (!w && !T && !E) return;
|
|
5659
|
-
const v = Math.abs((
|
|
5660
|
+
const v = Math.abs((kt = (re = s.scaleX) != null ? re : o.scaleX) != null ? kt : 1) || 1, S = Math.abs((ce = (we = s.scaleY) != null ? we : o.scaleY) != null ? ce : 1) || 1, M = Math.max(1, g * v), C = Math.max(1, Math.round(M)), O = Math.max(1, c * S), {
|
|
5660
5661
|
paddingTop: L = 0,
|
|
5661
5662
|
paddingRight: U = 0,
|
|
5662
5663
|
paddingBottom: z = 0,
|
|
@@ -5680,31 +5681,31 @@ class rt {
|
|
|
5680
5681
|
bottomLeft: Math.max(0, d.bottomLeft * S)
|
|
5681
5682
|
} : d, tt = Object.keys(u).length > 0;
|
|
5682
5683
|
let at;
|
|
5683
|
-
if (
|
|
5684
|
-
const
|
|
5684
|
+
if (I && tt) {
|
|
5685
|
+
const Rt = {};
|
|
5685
5686
|
Object.entries(u).forEach(([le, Q]) => {
|
|
5686
5687
|
if (!Q) return;
|
|
5687
5688
|
const st = {};
|
|
5688
|
-
Object.entries(Q).forEach(([Ae,
|
|
5689
|
-
if (!
|
|
5690
|
-
const Ve = F({},
|
|
5691
|
-
typeof
|
|
5692
|
-
}), Object.keys(st).length && (
|
|
5693
|
-
}), Object.keys(
|
|
5689
|
+
Object.entries(Q).forEach(([Ae, Bt]) => {
|
|
5690
|
+
if (!Bt) return;
|
|
5691
|
+
const Ve = F({}, Bt);
|
|
5692
|
+
typeof Bt.fontSize == "number" && (Ve.fontSize = Math.max(1, Bt.fontSize * S)), st[Ae] = Ve;
|
|
5693
|
+
}), Object.keys(st).length && (Rt[le] = st);
|
|
5694
|
+
}), Object.keys(Rt).length && (at = Rt);
|
|
5694
5695
|
}
|
|
5695
5696
|
let gt;
|
|
5696
|
-
|
|
5697
|
+
I && (gt = gn({
|
|
5697
5698
|
lineFontDefaults: f,
|
|
5698
5699
|
scale: S
|
|
5699
5700
|
}));
|
|
5700
|
-
const
|
|
5701
|
-
if (!
|
|
5701
|
+
const At = (Zt = (Ht = o.originX) != null ? Ht : P) != null ? Zt : "left", dt = y + g, ht = y + g / 2, Tt = D != null ? D : g, jt = C !== Tt, Lt = Math.abs(O - (_ != null ? _ : c)) > it, Dt = Math.abs(H.top - L) > it || Math.abs(H.right - U) > it || Math.abs(H.bottom - z) > it || Math.abs(H.left - j) > it, xt = Math.abs(q.topLeft - R) > it || Math.abs(q.topRight - N) > it || Math.abs(q.bottomRight - x) > it || Math.abs(q.bottomLeft - B) > it;
|
|
5702
|
+
if (!jt && !Lt && !Dt && !xt) {
|
|
5702
5703
|
s.set({ scaleX: 1, scaleY: 1 }), o.scaleX = 1, o.scaleY = 1;
|
|
5703
5704
|
return;
|
|
5704
5705
|
}
|
|
5705
5706
|
at && (s.styles = at), gt && (s.lineFontDefaults = gt), s.set({
|
|
5706
|
-
width:
|
|
5707
|
-
fontSize:
|
|
5707
|
+
width: C,
|
|
5708
|
+
fontSize: I ? O : c,
|
|
5708
5709
|
paddingTop: H.top,
|
|
5709
5710
|
paddingRight: H.right,
|
|
5710
5711
|
paddingBottom: H.bottom,
|
|
@@ -5716,13 +5717,13 @@ class rt {
|
|
|
5716
5717
|
scaleX: 1,
|
|
5717
5718
|
scaleY: 1
|
|
5718
5719
|
});
|
|
5719
|
-
const
|
|
5720
|
-
|
|
5721
|
-
const
|
|
5722
|
-
let
|
|
5723
|
-
se && (w || E) && (
|
|
5724
|
-
const { original:
|
|
5725
|
-
|
|
5720
|
+
const Yt = Ot({ textbox: s });
|
|
5721
|
+
Yt && (s.dirty = !0);
|
|
5722
|
+
const pt = (Gt = s.width) != null ? Gt : C, se = pt !== Tt;
|
|
5723
|
+
let Et = y;
|
|
5724
|
+
se && (w || E) && (At === "right" ? Et = dt - pt : At === "center" && (Et = ht - pt / 2)), s.set({ left: Et }), i.baseLeft = Et, o.scaleX = 1, o.scaleY = 1;
|
|
5725
|
+
const { original: bt } = o;
|
|
5726
|
+
bt && (bt.scaleX = 1, bt.scaleY = 1, bt.width = pt, bt.height = s.height, bt.left = Et), s.setCoords(), this.canvas.requestRenderAll(), i.baseWidth = pt, i.baseFontSize = (Vt = s.fontSize) != null ? Vt : O, i.baseStyles = JSON.parse(JSON.stringify((Xt = s.styles) != null ? Xt : {})), i.baseLineFontDefaults = fn({
|
|
5726
5727
|
lineFontDefaults: s.lineFontDefaults
|
|
5727
5728
|
}), i.basePadding = {
|
|
5728
5729
|
top: H.top,
|
|
@@ -5734,19 +5735,19 @@ class rt {
|
|
|
5734
5735
|
topRight: q.topRight,
|
|
5735
5736
|
bottomRight: q.bottomRight,
|
|
5736
5737
|
bottomLeft: q.bottomLeft
|
|
5737
|
-
}, i.hasWidthChange = se ||
|
|
5738
|
+
}, i.hasWidthChange = se || Lt || Dt || xt || Yt;
|
|
5738
5739
|
}, this._handleObjectModified = (n) => {
|
|
5739
5740
|
var b, A, w;
|
|
5740
5741
|
const { target: s } = n;
|
|
5741
5742
|
if (s instanceof K) {
|
|
5742
5743
|
const T = s.getObjects();
|
|
5743
5744
|
if (!T.some((M) => rt._isTextbox(M))) return;
|
|
5744
|
-
const { scaleX:
|
|
5745
|
-
if (Math.abs(
|
|
5745
|
+
const { scaleX: I = 1, scaleY: v = 1 } = s;
|
|
5746
|
+
if (Math.abs(I - 1) < it && Math.abs(v - 1) < it) return;
|
|
5746
5747
|
this.canvas.discardActiveObject(), T.forEach((M) => {
|
|
5747
|
-
var
|
|
5748
|
+
var C, O, L, U;
|
|
5748
5749
|
if (rt._isTextbox(M)) {
|
|
5749
|
-
const z = (
|
|
5750
|
+
const z = (C = M.scaleX) != null ? C : 1, j = (O = M.scaleY) != null ? O : 1, R = ((L = M.fontSize) != null ? L : 16) * j, N = ((U = M.width) != null ? U : 0) * z, x = j, {
|
|
5750
5751
|
paddingTop: B = 0,
|
|
5751
5752
|
paddingRight: _ = 0,
|
|
5752
5753
|
paddingBottom: D = 0,
|
|
@@ -5767,10 +5768,10 @@ class rt {
|
|
|
5767
5768
|
radiusBottomRight: Math.max(0, H * x),
|
|
5768
5769
|
radiusBottomLeft: Math.max(0, q * x)
|
|
5769
5770
|
};
|
|
5770
|
-
let
|
|
5771
|
-
tt && Object.keys(tt).length > 0 && (
|
|
5772
|
-
Object.values(
|
|
5773
|
-
typeof
|
|
5771
|
+
let At = tt;
|
|
5772
|
+
tt && Object.keys(tt).length > 0 && (At = JSON.parse(JSON.stringify(tt)), Object.values(At).forEach((Tt) => {
|
|
5773
|
+
Object.values(Tt).forEach((jt) => {
|
|
5774
|
+
typeof jt.fontSize == "number" && (jt.fontSize = Math.max(1, jt.fontSize * x));
|
|
5774
5775
|
});
|
|
5775
5776
|
}));
|
|
5776
5777
|
const dt = gn({
|
|
@@ -5782,9 +5783,9 @@ class rt {
|
|
|
5782
5783
|
scaleX: 1,
|
|
5783
5784
|
scaleY: 1
|
|
5784
5785
|
}, at), gt), {
|
|
5785
|
-
styles:
|
|
5786
|
+
styles: At
|
|
5786
5787
|
});
|
|
5787
|
-
dt && (ht.lineFontDefaults = dt), M.set(ht),
|
|
5788
|
+
dt && (ht.lineFontDefaults = dt), M.set(ht), Ot({ textbox: M });
|
|
5788
5789
|
}
|
|
5789
5790
|
M.setCoords();
|
|
5790
5791
|
});
|
|
@@ -5829,7 +5830,7 @@ class rt {
|
|
|
5829
5830
|
* @param options — настройки текста
|
|
5830
5831
|
* @param flags — флаги поведения
|
|
5831
5832
|
*/
|
|
5832
|
-
addText(U = {}, { withoutSelection:
|
|
5833
|
+
addText(U = {}, { withoutSelection: C = !1, withoutSave: O = !1, withoutAdding: L = !1 } = {}) {
|
|
5833
5834
|
var z = U, {
|
|
5834
5835
|
id: t = `text-${et()}`,
|
|
5835
5836
|
text: e = "Новый текст",
|
|
@@ -5853,10 +5854,10 @@ class rt {
|
|
|
5853
5854
|
paddingBottom: w = 0,
|
|
5854
5855
|
paddingLeft: T = 0,
|
|
5855
5856
|
radiusTopLeft: E = 0,
|
|
5856
|
-
radiusTopRight:
|
|
5857
|
+
radiusTopRight: I = 0,
|
|
5857
5858
|
radiusBottomRight: v = 0,
|
|
5858
5859
|
radiusBottomLeft: S = 0
|
|
5859
|
-
} = z, M =
|
|
5860
|
+
} = z, M = Mt(z, [
|
|
5860
5861
|
"id",
|
|
5861
5862
|
"text",
|
|
5862
5863
|
"autoExpand",
|
|
@@ -5911,15 +5912,15 @@ class rt {
|
|
|
5911
5912
|
paddingBottom: w,
|
|
5912
5913
|
paddingLeft: T,
|
|
5913
5914
|
radiusTopLeft: E,
|
|
5914
|
-
radiusTopRight:
|
|
5915
|
+
radiusTopRight: I,
|
|
5915
5916
|
radiusBottomRight: v,
|
|
5916
5917
|
radiusBottomLeft: S
|
|
5917
5918
|
}, M), D = new be(e, _), P = n !== !1;
|
|
5918
5919
|
if (D.autoExpand = P, D.textCaseRaw = (V = D.text) != null ? V : "", c) {
|
|
5919
|
-
const H =
|
|
5920
|
+
const H = Ie({ value: D.textCaseRaw });
|
|
5920
5921
|
H !== D.text && D.set({ text: H });
|
|
5921
5922
|
}
|
|
5922
|
-
return
|
|
5923
|
+
return Ot({ textbox: D }) && (D.dirty = !0), M.left === void 0 && M.top === void 0 && R.centerObject(D), L || R.add(D), C || R.setActiveObject(D), R.requestRenderAll(), j.resumeHistory(), O || j.saveState(), R.fire("editor:text-added", {
|
|
5923
5924
|
textbox: D,
|
|
5924
5925
|
options: It(F({}, _), {
|
|
5925
5926
|
text: e,
|
|
@@ -5932,7 +5933,7 @@ class rt {
|
|
|
5932
5933
|
strokeWidth: x
|
|
5933
5934
|
}),
|
|
5934
5935
|
flags: {
|
|
5935
|
-
withoutSelection: !!
|
|
5936
|
+
withoutSelection: !!C,
|
|
5936
5937
|
withoutSave: !!O,
|
|
5937
5938
|
withoutAdding: !!L
|
|
5938
5939
|
}
|
|
@@ -5954,16 +5955,16 @@ class rt {
|
|
|
5954
5955
|
skipRender: s,
|
|
5955
5956
|
selectionRange: o
|
|
5956
5957
|
} = {}) {
|
|
5957
|
-
var
|
|
5958
|
+
var Ht, Gt, Vt, Xt, Rt, le;
|
|
5958
5959
|
const i = this._resolveTextObject(t);
|
|
5959
5960
|
if (!i) return null;
|
|
5960
5961
|
const { text: a = "" } = i, { historyManager: r } = this.editor, { canvas: c } = this;
|
|
5961
5962
|
r.suspendHistory();
|
|
5962
|
-
const l = rt._getSnapshot(i), d = (
|
|
5963
|
+
const l = rt._getSnapshot(i), d = (Ht = i.originY) != null ? Ht : "top", u = i.getPointByOrigin("center", d), f = {
|
|
5963
5964
|
originY: d,
|
|
5964
5965
|
x: u.x,
|
|
5965
5966
|
y: u.y
|
|
5966
|
-
},
|
|
5967
|
+
}, Zt = e, {
|
|
5967
5968
|
text: p,
|
|
5968
5969
|
autoExpand: m,
|
|
5969
5970
|
fontFamily: g,
|
|
@@ -5973,11 +5974,11 @@ class rt {
|
|
|
5973
5974
|
underline: w,
|
|
5974
5975
|
uppercase: T,
|
|
5975
5976
|
strikethrough: E,
|
|
5976
|
-
align:
|
|
5977
|
+
align: I,
|
|
5977
5978
|
color: v,
|
|
5978
5979
|
strokeColor: S,
|
|
5979
5980
|
strokeWidth: M,
|
|
5980
|
-
opacity:
|
|
5981
|
+
opacity: C,
|
|
5981
5982
|
backgroundColor: O,
|
|
5982
5983
|
backgroundOpacity: L,
|
|
5983
5984
|
paddingTop: U,
|
|
@@ -5988,7 +5989,7 @@ class rt {
|
|
|
5988
5989
|
radiusTopRight: x,
|
|
5989
5990
|
radiusBottomRight: B,
|
|
5990
5991
|
radiusBottomLeft: _
|
|
5991
|
-
} =
|
|
5992
|
+
} = Zt, D = Mt(Zt, [
|
|
5992
5993
|
"text",
|
|
5993
5994
|
"autoExpand",
|
|
5994
5995
|
"fontFamily",
|
|
@@ -6016,9 +6017,9 @@ class rt {
|
|
|
6016
6017
|
]), P = F({}, D), k = o !== void 0 ? Ls({
|
|
6017
6018
|
text: a,
|
|
6018
6019
|
range: o
|
|
6019
|
-
}) :
|
|
6020
|
+
}) : Is({ textbox: i }), V = k ? Ds({ textbox: i, range: k }) : null, H = {}, q = {}, tt = {};
|
|
6020
6021
|
let at, gt;
|
|
6021
|
-
const
|
|
6022
|
+
const At = Ts({ textbox: i, range: k }), dt = !k || At, ht = !k;
|
|
6022
6023
|
if (g !== void 0 && (V && (q.fontFamily = g), dt && (P.fontFamily = g, ht && (tt.fontFamily = g))), y !== void 0 && (V && (q.fontSize = y), dt && (P.fontSize = y, ht && (tt.fontSize = y))), b !== void 0) {
|
|
6023
6024
|
const Q = b ? "bold" : "normal";
|
|
6024
6025
|
k && (H.fontWeight = Q), dt && (P.fontWeight = Q, ht && (tt.fontWeight = Q));
|
|
@@ -6027,38 +6028,38 @@ class rt {
|
|
|
6027
6028
|
const Q = A ? "italic" : "normal";
|
|
6028
6029
|
k && (H.fontStyle = Q), dt && (P.fontStyle = Q, ht && (tt.fontStyle = Q));
|
|
6029
6030
|
}
|
|
6030
|
-
if (w !== void 0 && (k && (H.underline = w), dt && (P.underline = w, ht && (tt.underline = w))), E !== void 0 && (k && (H.linethrough = E), dt && (P.linethrough = E, ht && (tt.linethrough = E))),
|
|
6031
|
-
const Q = k ? hn({ textbox: i, range: k, property: "strokeWidth" }) : void 0, st = k ? hn({ textbox: i, range: k, property: "stroke" }) : void 0, Ae = (
|
|
6031
|
+
if (w !== void 0 && (k && (H.underline = w), dt && (P.underline = w, ht && (tt.underline = w))), E !== void 0 && (k && (H.linethrough = E), dt && (P.linethrough = E, ht && (tt.linethrough = E))), I !== void 0 && (P.textAlign = I), v !== void 0 && (k && (H.fill = v), dt && (P.fill = v, ht && (tt.fill = v))), S !== void 0 || M !== void 0) {
|
|
6032
|
+
const Q = k ? hn({ textbox: i, range: k, property: "strokeWidth" }) : void 0, st = k ? hn({ textbox: i, range: k, property: "stroke" }) : void 0, Ae = (Vt = (Gt = M != null ? M : Q) != null ? Gt : i.strokeWidth) != null ? Vt : 0;
|
|
6032
6033
|
gt = Be({ width: Ae });
|
|
6033
|
-
const
|
|
6034
|
+
const Bt = (Rt = (Xt = S != null ? S : st) != null ? Xt : i.stroke) != null ? Rt : void 0;
|
|
6034
6035
|
at = Re({
|
|
6035
|
-
strokeColor:
|
|
6036
|
+
strokeColor: Bt,
|
|
6036
6037
|
width: gt
|
|
6037
6038
|
}), k && (H.stroke = at, H.strokeWidth = gt), dt && (P.stroke = at, P.strokeWidth = gt, ht && (tt.stroke = at, tt.strokeWidth = gt));
|
|
6038
6039
|
}
|
|
6039
|
-
|
|
6040
|
-
const
|
|
6041
|
-
if (
|
|
6042
|
-
const Q =
|
|
6043
|
-
P.text = Q, i.textCaseRaw =
|
|
6044
|
-
} else i.textCaseRaw === void 0 && (i.textCaseRaw =
|
|
6045
|
-
i.uppercase =
|
|
6046
|
-
let
|
|
6040
|
+
C !== void 0 && (P.opacity = C), O !== void 0 && (P.backgroundColor = O), L !== void 0 && (P.backgroundOpacity = L), U !== void 0 && (P.paddingTop = U), z !== void 0 && (P.paddingRight = z), j !== void 0 && (P.paddingBottom = j), R !== void 0 && (P.paddingLeft = R), N !== void 0 && (P.radiusTopLeft = N), x !== void 0 && (P.radiusTopRight = x), B !== void 0 && (P.radiusBottomRight = B), _ !== void 0 && (P.radiusBottomLeft = _);
|
|
6041
|
+
const Tt = (le = i.textCaseRaw) != null ? le : a, jt = !!i.uppercase, Lt = p !== void 0, Dt = Lt ? p != null ? p : "" : Tt, xt = T != null ? T : jt, Yt = xt !== jt;
|
|
6042
|
+
if (Lt || Yt) {
|
|
6043
|
+
const Q = xt ? Ie({ value: Dt }) : Dt;
|
|
6044
|
+
P.text = Q, i.textCaseRaw = Dt;
|
|
6045
|
+
} else i.textCaseRaw === void 0 && (i.textCaseRaw = Tt);
|
|
6046
|
+
i.uppercase = xt, i.set(P);
|
|
6047
|
+
let pt = !1;
|
|
6047
6048
|
if (k) {
|
|
6048
6049
|
const Q = je({ textbox: i, styles: H, range: k }), st = V ? je({ textbox: i, styles: q, range: V }) : !1;
|
|
6049
|
-
|
|
6050
|
+
pt = Q || st;
|
|
6050
6051
|
} else if (Object.keys(tt).length) {
|
|
6051
|
-
const Q =
|
|
6052
|
-
Q && (
|
|
6052
|
+
const Q = Cs({ textbox: i });
|
|
6053
|
+
Q && (pt = je({ textbox: i, styles: tt, range: Q }));
|
|
6053
6054
|
}
|
|
6054
|
-
const se =
|
|
6055
|
+
const se = pt && mn({
|
|
6055
6056
|
stylesList: [
|
|
6056
6057
|
H,
|
|
6057
6058
|
q,
|
|
6058
6059
|
tt
|
|
6059
6060
|
]
|
|
6060
6061
|
});
|
|
6061
|
-
if (
|
|
6062
|
+
if (pt && (i.dirty = !0), V && (g !== void 0 || y !== void 0)) {
|
|
6062
6063
|
const Q = xs({
|
|
6063
6064
|
textbox: i,
|
|
6064
6065
|
range: V
|
|
@@ -6081,20 +6082,20 @@ class rt {
|
|
|
6081
6082
|
});
|
|
6082
6083
|
}
|
|
6083
6084
|
se && (i.initDimensions(), i.dirty = !0), (O !== void 0 || L !== void 0 || U !== void 0 || z !== void 0 || j !== void 0 || R !== void 0 || N !== void 0 || x !== void 0 || B !== void 0 || _ !== void 0) && (i.dirty = !0);
|
|
6084
|
-
const
|
|
6085
|
+
const Et = mn({
|
|
6085
6086
|
stylesList: [
|
|
6086
6087
|
P,
|
|
6087
6088
|
H,
|
|
6088
6089
|
q,
|
|
6089
6090
|
tt
|
|
6090
6091
|
]
|
|
6091
|
-
}), { autoExpand:
|
|
6092
|
-
ie ? i.autoExpand = m !== !1 :
|
|
6093
|
-
const ae = Object.prototype.hasOwnProperty.call(P, "width"), re = oe && !ae && (
|
|
6094
|
-
let
|
|
6095
|
-
re && (
|
|
6092
|
+
}), { autoExpand: bt } = i, ie = m !== void 0, oe = (m != null ? m : bt) !== !1;
|
|
6093
|
+
ie ? i.autoExpand = m !== !1 : bt === void 0 && (i.autoExpand = !0);
|
|
6094
|
+
const ae = Object.prototype.hasOwnProperty.call(P, "width"), re = oe && !ae && (Lt || Yt || Et);
|
|
6095
|
+
let kt = !1;
|
|
6096
|
+
re && (kt = this._autoExpandTextboxWidth(i, {
|
|
6096
6097
|
anchor: f
|
|
6097
|
-
}),
|
|
6098
|
+
}), kt && (i.dirty = !0)), (kt ? !1 : Ot({ textbox: i })) && (i.dirty = !0), i.setCoords(), s || c.requestRenderAll(), r.resumeHistory(), n || r.saveState();
|
|
6098
6099
|
const ce = rt._getSnapshot(i);
|
|
6099
6100
|
return c.fire("editor:text-updated", {
|
|
6100
6101
|
textbox: i,
|
|
@@ -6116,7 +6117,7 @@ class rt {
|
|
|
6116
6117
|
*/
|
|
6117
6118
|
// eslint-disable-next-line class-methods-use-this
|
|
6118
6119
|
stylesFromArray(t, e) {
|
|
6119
|
-
return
|
|
6120
|
+
return vt.stylesFromArray(t, e);
|
|
6120
6121
|
}
|
|
6121
6122
|
/**
|
|
6122
6123
|
* Уничтожает менеджер и снимает слушатели.
|
|
@@ -6217,15 +6218,15 @@ class rt {
|
|
|
6217
6218
|
b = D, A = !0, w = !0;
|
|
6218
6219
|
}
|
|
6219
6220
|
}
|
|
6220
|
-
let
|
|
6221
|
+
let I = null;
|
|
6221
6222
|
if (l && typeof c == "number") {
|
|
6222
6223
|
const j = t.get2DCursorLocation(c), { lineIndex: R } = j;
|
|
6223
|
-
Number.isFinite(R) && (
|
|
6224
|
+
Number.isFinite(R) && (I = R);
|
|
6224
6225
|
}
|
|
6225
|
-
let v = s, S = !1, M = !1,
|
|
6226
|
+
let v = s, S = !1, M = !1, C, O = null;
|
|
6226
6227
|
for (let j = 0; j < p.length; j += 1) {
|
|
6227
6228
|
const R = (z = p[j]) != null ? z : "", N = b ? b[j] : void 0;
|
|
6228
|
-
if (N && (
|
|
6229
|
+
if (N && (C = N), R.length !== 0) {
|
|
6229
6230
|
if (N) {
|
|
6230
6231
|
const k = Os({
|
|
6231
6232
|
lineText: R,
|
|
@@ -6236,8 +6237,8 @@ class rt {
|
|
|
6236
6237
|
}
|
|
6237
6238
|
continue;
|
|
6238
6239
|
}
|
|
6239
|
-
const B = N != null ? N :
|
|
6240
|
-
(B == null ? void 0 : B.fontFamily) !== void 0 ? _.fontFamily = B.fontFamily : o !== void 0 && (_.fontFamily = o), (B == null ? void 0 : B.fontSize) !== void 0 ? _.fontSize = B.fontSize : i !== void 0 && (_.fontSize = i), (B == null ? void 0 : B.fill) !== void 0 ? _.fill = B.fill : T !== void 0 && (_.fill = T), (B == null ? void 0 : B.stroke) !== void 0 ? _.stroke = B.stroke : E !== void 0 && (_.stroke = E), !N && Object.keys(_).length && (b || (b = {}, w = !0), w || (b = F({}, b), w = !0), b[j] = _, A = !0,
|
|
6240
|
+
const B = N != null ? N : C, _ = {};
|
|
6241
|
+
(B == null ? void 0 : B.fontFamily) !== void 0 ? _.fontFamily = B.fontFamily : o !== void 0 && (_.fontFamily = o), (B == null ? void 0 : B.fontSize) !== void 0 ? _.fontSize = B.fontSize : i !== void 0 && (_.fontSize = i), (B == null ? void 0 : B.fill) !== void 0 ? _.fill = B.fill : T !== void 0 && (_.fill = T), (B == null ? void 0 : B.stroke) !== void 0 ? _.stroke = B.stroke : E !== void 0 && (_.stroke = E), !N && Object.keys(_).length && (b || (b = {}, w = !0), w || (b = F({}, b), w = !0), b[j] = _, A = !0, C = _), N && (C = N), I !== null && I === j && (O = _);
|
|
6241
6242
|
const D = {};
|
|
6242
6243
|
_.fontFamily !== void 0 && (D.fontFamily = _.fontFamily), _.fontSize !== void 0 && (D.fontSize = _.fontSize), _.fill !== void 0 && (D.fill = _.fill), _.stroke !== void 0 && (D.stroke = _.stroke);
|
|
6243
6244
|
const P = Object.keys(D).length > 0;
|
|
@@ -6261,15 +6262,15 @@ class rt {
|
|
|
6261
6262
|
* но не шире монтажной области, и удерживает объект в её пределах.
|
|
6262
6263
|
*/
|
|
6263
6264
|
_autoExpandTextboxWidth(t, { anchor: e } = {}) {
|
|
6264
|
-
var
|
|
6265
|
+
var I, v, S, M, C, O, L, U, z, j, R, N, x;
|
|
6265
6266
|
const { montageArea: n } = this.editor;
|
|
6266
6267
|
if (!n) return !1;
|
|
6267
6268
|
const s = typeof t.text == "string" ? t.text : "";
|
|
6268
6269
|
if (!s.length) return !1;
|
|
6269
6270
|
n.setCoords();
|
|
6270
|
-
const o = n.getBoundingRect(!1, !0), i = (
|
|
6271
|
+
const o = n.getBoundingRect(!1, !0), i = (I = o.width) != null ? I : 0;
|
|
6271
6272
|
if (!Number.isFinite(i) || i <= 0) return !1;
|
|
6272
|
-
const a = e != null ? e : (v = this.editingAnchorState) == null ? void 0 : v.get(t), r = (M = (S = a == null ? void 0 : a.originY) != null ? S : t.originY) != null ? M : "top", c = Math.abs((
|
|
6273
|
+
const a = e != null ? e : (v = this.editingAnchorState) == null ? void 0 : v.get(t), r = (M = (S = a == null ? void 0 : a.originY) != null ? S : t.originY) != null ? M : "top", c = Math.abs((C = t.scaleX) != null ? C : 1) || 1, l = (O = t.paddingLeft) != null ? O : 0, d = (L = t.paddingRight) != null ? L : 0, u = (U = t.strokeWidth) != null ? U : 0, f = Math.max(
|
|
6273
6274
|
1,
|
|
6274
6275
|
i / c - l - d - u
|
|
6275
6276
|
);
|
|
@@ -6285,7 +6286,7 @@ class rt {
|
|
|
6285
6286
|
f,
|
|
6286
6287
|
Math.max(b, A)
|
|
6287
6288
|
);
|
|
6288
|
-
y && (w = f), Math.abs(((R = t.width) != null ? R : 0) - w) > it && (t.set({ width: w }), t.initDimensions(), m = !0),
|
|
6289
|
+
y && (w = f), Math.abs(((R = t.width) != null ? R : 0) - w) > it && (t.set({ width: w }), t.initDimensions(), m = !0), Ot({ textbox: t }) && (m = !0), a && (t.setPositionByOrigin(new lt(a.x, a.y), "center", r), m = !0);
|
|
6289
6290
|
const E = zs({
|
|
6290
6291
|
textbox: t,
|
|
6291
6292
|
montageLeft: (N = o.left) != null ? N : 0,
|
|
@@ -6372,11 +6373,11 @@ class rt {
|
|
|
6372
6373
|
backgroundOpacity: w,
|
|
6373
6374
|
paddingTop: T,
|
|
6374
6375
|
paddingRight: E,
|
|
6375
|
-
paddingBottom:
|
|
6376
|
+
paddingBottom: I,
|
|
6376
6377
|
paddingLeft: v,
|
|
6377
6378
|
radiusTopLeft: S,
|
|
6378
6379
|
radiusTopRight: M,
|
|
6379
|
-
radiusBottomRight:
|
|
6380
|
+
radiusBottomRight: C,
|
|
6380
6381
|
radiusBottomLeft: O,
|
|
6381
6382
|
left: L,
|
|
6382
6383
|
top: U,
|
|
@@ -6410,11 +6411,11 @@ class rt {
|
|
|
6410
6411
|
backgroundOpacity: w,
|
|
6411
6412
|
paddingTop: T,
|
|
6412
6413
|
paddingRight: E,
|
|
6413
|
-
paddingBottom:
|
|
6414
|
+
paddingBottom: I,
|
|
6414
6415
|
paddingLeft: v,
|
|
6415
6416
|
radiusTopLeft: S,
|
|
6416
6417
|
radiusTopRight: M,
|
|
6417
|
-
radiusBottomRight:
|
|
6418
|
+
radiusBottomRight: C,
|
|
6418
6419
|
radiusBottomLeft: O,
|
|
6419
6420
|
left: L,
|
|
6420
6421
|
top: U,
|
|
@@ -6509,7 +6510,7 @@ const fe = ({
|
|
|
6509
6510
|
} catch (n) {
|
|
6510
6511
|
return null;
|
|
6511
6512
|
}
|
|
6512
|
-
},
|
|
6513
|
+
}, mt = ({
|
|
6513
6514
|
object: h
|
|
6514
6515
|
}) => {
|
|
6515
6516
|
if (!h) return null;
|
|
@@ -6573,7 +6574,7 @@ const fe = ({
|
|
|
6573
6574
|
};
|
|
6574
6575
|
}
|
|
6575
6576
|
return null;
|
|
6576
|
-
},
|
|
6577
|
+
}, Jt = "_templateCenterX", Ce = "_templateCenterY", pe = "_templateAnchorX", Te = "_templateAnchorY";
|
|
6577
6578
|
class G {
|
|
6578
6579
|
constructor({ editor: t }) {
|
|
6579
6580
|
this.editor = t;
|
|
@@ -6598,7 +6599,7 @@ class G {
|
|
|
6598
6599
|
return a.emitWarning({
|
|
6599
6600
|
origin: "TemplateManager",
|
|
6600
6601
|
method: "serializeSelection",
|
|
6601
|
-
code:
|
|
6602
|
+
code: _t.TEMPLATE_MANAGER.NO_OBJECTS_SELECTED,
|
|
6602
6603
|
message: "Нет объектов для сериализации шаблона"
|
|
6603
6604
|
}), null;
|
|
6604
6605
|
const p = G._getBounds(i), m = G._getMontageSize({ montageArea: i, bounds: p }), g = m.width, y = m.height, b = f.map((T) => G._serializeObject({
|
|
@@ -6639,7 +6640,7 @@ class G {
|
|
|
6639
6640
|
return i.emitWarning({
|
|
6640
6641
|
origin: "TemplateManager",
|
|
6641
6642
|
method: "applyTemplate",
|
|
6642
|
-
code:
|
|
6643
|
+
code: _t.TEMPLATE_MANAGER.INVALID_TEMPLATE,
|
|
6643
6644
|
message: "Шаблон не содержит объектов"
|
|
6644
6645
|
}), null;
|
|
6645
6646
|
const d = G._getBounds(s);
|
|
@@ -6647,7 +6648,7 @@ class G {
|
|
|
6647
6648
|
return i.emitWarning({
|
|
6648
6649
|
origin: "TemplateManager",
|
|
6649
6650
|
method: "applyTemplate",
|
|
6650
|
-
code:
|
|
6651
|
+
code: _t.TEMPLATE_MANAGER.INVALID_TARGET,
|
|
6651
6652
|
message: "Не удалось определить границы монтажной области"
|
|
6652
6653
|
}), null;
|
|
6653
6654
|
const u = G._getMontageSize({ montageArea: s, bounds: d }), f = G._normalizeMeta({ meta: c, fallback: u }), p = G._calculateScale({ meta: f, target: u }), m = !!f.positionsNormalized;
|
|
@@ -6659,7 +6660,7 @@ class G {
|
|
|
6659
6660
|
return i.emitWarning({
|
|
6660
6661
|
origin: "TemplateManager",
|
|
6661
6662
|
method: "applyTemplate",
|
|
6662
|
-
code:
|
|
6663
|
+
code: _t.TEMPLATE_MANAGER.INVALID_TEMPLATE,
|
|
6663
6664
|
message: "Не удалось создать объекты шаблона"
|
|
6664
6665
|
}), null;
|
|
6665
6666
|
const { backgroundObject: A, contentObjects: w } = G._extractBackgroundObject(b);
|
|
@@ -6693,7 +6694,7 @@ class G {
|
|
|
6693
6694
|
return i.emitError({
|
|
6694
6695
|
origin: "TemplateManager",
|
|
6695
6696
|
method: "applyTemplate",
|
|
6696
|
-
code:
|
|
6697
|
+
code: _t.TEMPLATE_MANAGER.APPLY_FAILED,
|
|
6697
6698
|
message: "Ошибка применения шаблона",
|
|
6698
6699
|
data: {
|
|
6699
6700
|
templateId: l,
|
|
@@ -6740,7 +6741,7 @@ class G {
|
|
|
6740
6741
|
if (i)
|
|
6741
6742
|
return G._restoreImageScale({ revived: i, serialized: n }), i;
|
|
6742
6743
|
}
|
|
6743
|
-
const s = yield
|
|
6744
|
+
const s = yield vt.enlivenObjects([n]), o = s == null ? void 0 : s[0];
|
|
6744
6745
|
return o ? (G._restoreImageScale({ revived: o, serialized: n }), o) : null;
|
|
6745
6746
|
})))).filter((n) => !!n);
|
|
6746
6747
|
});
|
|
@@ -6769,12 +6770,12 @@ class G {
|
|
|
6769
6770
|
naturalHeight: 0,
|
|
6770
6771
|
width: 0,
|
|
6771
6772
|
height: 0
|
|
6772
|
-
}, m = nt({ value: d || f || c.width, fallback: 0 }), g = nt({ value: u || p || c.height, fallback: 0 }), y = nt({ value: s, fallback: m }), b = nt({ value: o, fallback: g }), A = nt({ value: i, fallback: c.scaleX || 1 }), w = nt({ value: a, fallback: c.scaleY || 1 }), T = y * A, E = b * w,
|
|
6773
|
-
if (
|
|
6773
|
+
}, m = nt({ value: d || f || c.width, fallback: 0 }), g = nt({ value: u || p || c.height, fallback: 0 }), y = nt({ value: s, fallback: m }), b = nt({ value: o, fallback: g }), A = nt({ value: i, fallback: c.scaleX || 1 }), w = nt({ value: a, fallback: c.scaleY || 1 }), T = y * A, E = b * w, I = m > 0, v = g > 0, S = T > 0, M = E > 0, C = G._resolveImageFit({ customData: r }), O = {};
|
|
6774
|
+
if (I && (O.width = m), v && (O.height = g), !I || !v) {
|
|
6774
6775
|
c.set(O);
|
|
6775
6776
|
return;
|
|
6776
6777
|
}
|
|
6777
|
-
if (
|
|
6778
|
+
if (C === "stretch") {
|
|
6778
6779
|
const U = S ? T / m : null, z = M ? E / g : null;
|
|
6779
6780
|
U && U > 0 && (O.scaleX = U), z && z > 0 && (O.scaleY = z), c.set(O);
|
|
6780
6781
|
return;
|
|
@@ -6810,7 +6811,7 @@ class G {
|
|
|
6810
6811
|
const e = typeof t.svgMarkup == "string" ? t.svgMarkup : null;
|
|
6811
6812
|
if (!e) return null;
|
|
6812
6813
|
try {
|
|
6813
|
-
const n = yield Pn(e), s =
|
|
6814
|
+
const n = yield Pn(e), s = vt.groupSVGElements(n.objects, n.options), o = yield vt.enlivenObjectEnlivables(
|
|
6814
6815
|
G._prepareSerializableProps(t)
|
|
6815
6816
|
);
|
|
6816
6817
|
return s.set(o), s.setCoords(), s;
|
|
@@ -6875,8 +6876,8 @@ class G {
|
|
|
6875
6876
|
baseHeight: i,
|
|
6876
6877
|
useRelativePositions: r,
|
|
6877
6878
|
centerKeys: {
|
|
6878
|
-
x:
|
|
6879
|
-
y:
|
|
6879
|
+
x: Jt,
|
|
6880
|
+
y: Ce
|
|
6880
6881
|
}
|
|
6881
6882
|
}), { scaleX: u, scaleY: f } = t, p = nt({ value: u, fallback: 1 }), m = nt({ value: f, fallback: 1 }), g = G._getPositioningBounds({
|
|
6882
6883
|
bounds: n,
|
|
@@ -6896,7 +6897,7 @@ class G {
|
|
|
6896
6897
|
t.set({
|
|
6897
6898
|
scaleX: b,
|
|
6898
6899
|
scaleY: A
|
|
6899
|
-
}), t.setPositionByOrigin(y, "center", "center"), t.setCoords(), delete c[
|
|
6900
|
+
}), t.setPositionByOrigin(y, "center", "center"), t.setCoords(), delete c[Jt], delete c[Ce], delete c[pe], delete c[Te];
|
|
6900
6901
|
}
|
|
6901
6902
|
/**
|
|
6902
6903
|
* Возвращает bounds, в которых должны позиционироваться нормализованные объекты.
|
|
@@ -6943,7 +6944,7 @@ class G {
|
|
|
6943
6944
|
meta: t,
|
|
6944
6945
|
fallback: e
|
|
6945
6946
|
}) {
|
|
6946
|
-
const { width: n, height: s } = e, r = t || {}, { baseWidth: o = n, baseHeight: i = s } = r, a =
|
|
6947
|
+
const { width: n, height: s } = e, r = t || {}, { baseWidth: o = n, baseHeight: i = s } = r, a = Mt(r, ["baseWidth", "baseHeight"]);
|
|
6947
6948
|
return F({
|
|
6948
6949
|
baseWidth: o,
|
|
6949
6950
|
baseHeight: i
|
|
@@ -6995,16 +6996,16 @@ class G {
|
|
|
6995
6996
|
} = t, r = nt({ value: e, fallback: 0 }), c = t, l = nt({ value: c.paddingLeft, fallback: 0 }), d = nt({ value: c.paddingRight, fallback: 0 }), u = nt({ value: i, fallback: 1 }), f = nt({ value: a, fallback: 0 }) * u, p = nt({ value: o, fallback: 0 }), m = p * u, g = l * u, y = d * u, b = m + g + y + f;
|
|
6996
6997
|
if (!s || !p || !r) return;
|
|
6997
6998
|
t.setCoords();
|
|
6998
|
-
const A = t, w = A[
|
|
6999
|
+
const A = t, w = A[Jt], T = typeof w == "number" ? w : null, E = G._resolveAnchor(A, pe), I = b / r, v = T !== null ? T - I / 2 : null, S = T !== null ? T + I / 2 : null, M = t.getCenterPoint();
|
|
6999
7000
|
t.set("width", s), t.initDimensions();
|
|
7000
|
-
const
|
|
7001
|
+
const C = G._getLongestLineWidth({
|
|
7001
7002
|
textbox: t,
|
|
7002
7003
|
text: n
|
|
7003
|
-
}), O =
|
|
7004
|
+
}), O = C > p ? C + 1 : p;
|
|
7004
7005
|
t.set("width", O), t.initDimensions(), t.setPositionByOrigin(M, "center", "center"), t.setCoords();
|
|
7005
7006
|
const U = (O * u + g + y + f) / r;
|
|
7006
7007
|
let z = T;
|
|
7007
|
-
E === "start" && v !== null ? z = Math.max(0, v) + U / 2 : E === "end" && S !== null && (z = Math.min(1, S) - U / 2), typeof z == "number" && (A[
|
|
7008
|
+
E === "start" && v !== null ? z = Math.max(0, v) + U / 2 : E === "end" && S !== null && (z = Math.min(1, S) - U / 2), typeof z == "number" && (A[Jt] = z);
|
|
7008
7009
|
}
|
|
7009
7010
|
/**
|
|
7010
7011
|
* Возвращает ширину самой длинной строки текстового объекта.
|
|
@@ -7056,7 +7057,7 @@ class G {
|
|
|
7056
7057
|
y: (w.y - r) / f
|
|
7057
7058
|
};
|
|
7058
7059
|
})(), g = (d.left - a) / u, y = (d.top - r) / f, b = g + d.width / u, A = y + d.height / f;
|
|
7059
|
-
return i[
|
|
7060
|
+
return i[Jt] = m.x, i[Ce] = m.y, i[pe] = G._detectAnchor({
|
|
7060
7061
|
center: m.x,
|
|
7061
7062
|
start: g,
|
|
7062
7063
|
end: b
|
|
@@ -7118,7 +7119,7 @@ class G {
|
|
|
7118
7119
|
n.emitWarning({
|
|
7119
7120
|
origin: "TemplateManager",
|
|
7120
7121
|
method: "applyTemplate",
|
|
7121
|
-
code:
|
|
7122
|
+
code: _t.TEMPLATE_MANAGER.APPLY_FAILED,
|
|
7122
7123
|
message: "Не удалось применить фон из шаблона",
|
|
7123
7124
|
data: o
|
|
7124
7125
|
});
|
|
@@ -7174,7 +7175,7 @@ class G {
|
|
|
7174
7175
|
*/
|
|
7175
7176
|
// eslint-disable-next-line class-methods-use-this
|
|
7176
7177
|
enlivenObjectEnlivables(t) {
|
|
7177
|
-
return
|
|
7178
|
+
return vt.enlivenObjectEnlivables(t);
|
|
7178
7179
|
}
|
|
7179
7180
|
}
|
|
7180
7181
|
const Ee = 5, An = "#3D8BF4", Ne = 1, ot = 2, jn = ({
|
|
@@ -7185,7 +7186,7 @@ const Ee = 5, An = "#3D8BF4", Ne = 1, ot = 2, jn = ({
|
|
|
7185
7186
|
}) => Math.min(t, n) - Math.max(h, e), Ze = ({
|
|
7186
7187
|
value: h,
|
|
7187
7188
|
step: t
|
|
7188
|
-
}) => Math.round(h / t) * t,
|
|
7189
|
+
}) => Math.round(h / t) * t, yt = ({
|
|
7189
7190
|
value: h,
|
|
7190
7191
|
step: t
|
|
7191
7192
|
}) => Ze({ value: h, step: t }) === h, ee = ({
|
|
@@ -7205,7 +7206,7 @@ const Ee = 5, An = "#3D8BF4", Ne = 1, ot = 2, jn = ({
|
|
|
7205
7206
|
start: e,
|
|
7206
7207
|
end: n
|
|
7207
7208
|
};
|
|
7208
|
-
},
|
|
7209
|
+
}, In = ({
|
|
7209
7210
|
items: h,
|
|
7210
7211
|
axis: t
|
|
7211
7212
|
}) => {
|
|
@@ -7253,7 +7254,7 @@ const Ee = 5, An = "#3D8BF4", Ne = 1, ot = 2, jn = ({
|
|
|
7253
7254
|
if (d - a >= 0) return r;
|
|
7254
7255
|
}
|
|
7255
7256
|
return null;
|
|
7256
|
-
},
|
|
7257
|
+
}, Cn = ({
|
|
7257
7258
|
items: h
|
|
7258
7259
|
}) => {
|
|
7259
7260
|
for (let t = 0; t < h.length; t += 1) {
|
|
@@ -7363,8 +7364,8 @@ const Ee = 5, An = "#3D8BF4", Ne = 1, ot = 2, jn = ({
|
|
|
7363
7364
|
const l = [];
|
|
7364
7365
|
for (const v of c)
|
|
7365
7366
|
l.push({ bounds: v, isActive: !1 });
|
|
7366
|
-
l.push({ bounds: h, isActive: !0 }),
|
|
7367
|
-
const d =
|
|
7367
|
+
l.push({ bounds: h, isActive: !0 }), In({ items: l, axis: "top" });
|
|
7368
|
+
const d = Cn({ items: l });
|
|
7368
7369
|
if (d === -1)
|
|
7369
7370
|
return { delta: 0, guide: null };
|
|
7370
7371
|
const u = [], f = i - o, p = Me({
|
|
@@ -7379,14 +7380,14 @@ const Ee = 5, An = "#3D8BF4", Ne = 1, ot = 2, jn = ({
|
|
|
7379
7380
|
direction: "next"
|
|
7380
7381
|
}), g = p === null ? null : l[p], y = m === null ? null : l[m];
|
|
7381
7382
|
if (g && y) {
|
|
7382
|
-
const { bounds: v } = g, { bounds: S } = y, { bottom: M } = v, { top:
|
|
7383
|
+
const { bounds: v } = g, { bounds: S } = y, { bottom: M } = v, { top: C } = S, L = C - M - f;
|
|
7383
7384
|
if (L >= 0) {
|
|
7384
7385
|
const U = L / 2;
|
|
7385
|
-
if (
|
|
7386
|
-
const j = Ze({ value: U, step: ot }), R = o - M, N =
|
|
7386
|
+
if (yt({ value: U, step: ot })) {
|
|
7387
|
+
const j = Ze({ value: U, step: ot }), R = o - M, N = C - i, x = Math.abs(R - j), B = Math.abs(N - j), _ = Math.max(x, B);
|
|
7387
7388
|
if (_ <= e) {
|
|
7388
7389
|
const D = j - R;
|
|
7389
|
-
if (
|
|
7390
|
+
if (yt({ value: D, step: ot })) {
|
|
7390
7391
|
const k = i + D, V = {
|
|
7391
7392
|
type: "vertical",
|
|
7392
7393
|
axis: s,
|
|
@@ -7418,20 +7419,20 @@ const Ee = 5, An = "#3D8BF4", Ne = 1, ot = 2, jn = ({
|
|
|
7418
7419
|
const {
|
|
7419
7420
|
beforeIndex: S,
|
|
7420
7421
|
afterIndex: M,
|
|
7421
|
-
start:
|
|
7422
|
+
start: C,
|
|
7422
7423
|
end: O,
|
|
7423
7424
|
distance: L
|
|
7424
7425
|
} = v;
|
|
7425
|
-
if (!(S === d || M === d || !
|
|
7426
|
+
if (!(S === d || M === d || !yt({ value: L, step: ot }))) {
|
|
7426
7427
|
if (A !== null && T) {
|
|
7427
7428
|
const z = Math.abs(A - L);
|
|
7428
7429
|
if (z <= e) {
|
|
7429
7430
|
const j = L - A;
|
|
7430
|
-
if (!
|
|
7431
|
+
if (!yt({ value: j, step: ot })) continue;
|
|
7431
7432
|
const N = o + j, { bottom: x } = T, B = {
|
|
7432
7433
|
type: "vertical",
|
|
7433
7434
|
axis: s,
|
|
7434
|
-
refStart:
|
|
7435
|
+
refStart: C,
|
|
7435
7436
|
refEnd: O,
|
|
7436
7437
|
activeStart: x,
|
|
7437
7438
|
activeEnd: N,
|
|
@@ -7444,11 +7445,11 @@ const Ee = 5, An = "#3D8BF4", Ne = 1, ot = 2, jn = ({
|
|
|
7444
7445
|
const z = Math.abs(w - L);
|
|
7445
7446
|
if (z <= e) {
|
|
7446
7447
|
const j = w - L;
|
|
7447
|
-
if (!
|
|
7448
|
+
if (!yt({ value: j, step: ot })) continue;
|
|
7448
7449
|
const N = i + j, { top: x } = E, B = {
|
|
7449
7450
|
type: "vertical",
|
|
7450
7451
|
axis: s,
|
|
7451
|
-
refStart:
|
|
7452
|
+
refStart: C,
|
|
7452
7453
|
refEnd: O,
|
|
7453
7454
|
activeStart: N,
|
|
7454
7455
|
activeEnd: x,
|
|
@@ -7461,14 +7462,14 @@ const Ee = 5, An = "#3D8BF4", Ne = 1, ot = 2, jn = ({
|
|
|
7461
7462
|
}
|
|
7462
7463
|
if (!u.length)
|
|
7463
7464
|
return { delta: 0, guide: null };
|
|
7464
|
-
let
|
|
7465
|
+
let I = u[0];
|
|
7465
7466
|
for (let v = 1; v < u.length; v += 1) {
|
|
7466
7467
|
const S = u[v];
|
|
7467
|
-
S.diff <
|
|
7468
|
+
S.diff < I.diff && (I = S);
|
|
7468
7469
|
}
|
|
7469
7470
|
return {
|
|
7470
|
-
delta:
|
|
7471
|
-
guide:
|
|
7471
|
+
delta: I.delta,
|
|
7472
|
+
guide: I.guide
|
|
7472
7473
|
};
|
|
7473
7474
|
}, Vs = ({
|
|
7474
7475
|
activeBounds: h,
|
|
@@ -7500,8 +7501,8 @@ const Ee = 5, An = "#3D8BF4", Ne = 1, ot = 2, jn = ({
|
|
|
7500
7501
|
const l = [];
|
|
7501
7502
|
for (const v of c)
|
|
7502
7503
|
l.push({ bounds: v, isActive: !1 });
|
|
7503
|
-
l.push({ bounds: h, isActive: !0 }),
|
|
7504
|
-
const d =
|
|
7504
|
+
l.push({ bounds: h, isActive: !0 }), In({ items: l, axis: "left" });
|
|
7505
|
+
const d = Cn({ items: l });
|
|
7505
7506
|
if (d === -1)
|
|
7506
7507
|
return { delta: 0, guide: null };
|
|
7507
7508
|
const u = [], f = i - o, p = Me({
|
|
@@ -7516,14 +7517,14 @@ const Ee = 5, An = "#3D8BF4", Ne = 1, ot = 2, jn = ({
|
|
|
7516
7517
|
direction: "next"
|
|
7517
7518
|
}), g = p === null ? null : l[p], y = m === null ? null : l[m];
|
|
7518
7519
|
if (g && y) {
|
|
7519
|
-
const { bounds: v } = g, { bounds: S } = y, { right: M } = v, { left:
|
|
7520
|
+
const { bounds: v } = g, { bounds: S } = y, { right: M } = v, { left: C } = S, L = C - M - f;
|
|
7520
7521
|
if (L >= 0) {
|
|
7521
7522
|
const U = L / 2;
|
|
7522
|
-
if (
|
|
7523
|
-
const j = Ze({ value: U, step: ot }), R = o - M, N =
|
|
7523
|
+
if (yt({ value: U, step: ot })) {
|
|
7524
|
+
const j = Ze({ value: U, step: ot }), R = o - M, N = C - i, x = Math.abs(R - j), B = Math.abs(N - j), _ = Math.max(x, B);
|
|
7524
7525
|
if (_ <= e) {
|
|
7525
7526
|
const D = j - R;
|
|
7526
|
-
if (
|
|
7527
|
+
if (yt({ value: D, step: ot })) {
|
|
7527
7528
|
const k = i + D, V = {
|
|
7528
7529
|
type: "horizontal",
|
|
7529
7530
|
axis: s,
|
|
@@ -7555,20 +7556,20 @@ const Ee = 5, An = "#3D8BF4", Ne = 1, ot = 2, jn = ({
|
|
|
7555
7556
|
const {
|
|
7556
7557
|
beforeIndex: S,
|
|
7557
7558
|
afterIndex: M,
|
|
7558
|
-
start:
|
|
7559
|
+
start: C,
|
|
7559
7560
|
end: O,
|
|
7560
7561
|
distance: L
|
|
7561
7562
|
} = v;
|
|
7562
|
-
if (!(S === d || M === d || !
|
|
7563
|
+
if (!(S === d || M === d || !yt({ value: L, step: ot }))) {
|
|
7563
7564
|
if (A !== null && T) {
|
|
7564
7565
|
const z = Math.abs(A - L);
|
|
7565
7566
|
if (z <= e) {
|
|
7566
7567
|
const j = L - A;
|
|
7567
|
-
if (!
|
|
7568
|
+
if (!yt({ value: j, step: ot })) continue;
|
|
7568
7569
|
const N = o + j, { right: x } = T, B = {
|
|
7569
7570
|
type: "horizontal",
|
|
7570
7571
|
axis: s,
|
|
7571
|
-
refStart:
|
|
7572
|
+
refStart: C,
|
|
7572
7573
|
refEnd: O,
|
|
7573
7574
|
activeStart: x,
|
|
7574
7575
|
activeEnd: N,
|
|
@@ -7581,11 +7582,11 @@ const Ee = 5, An = "#3D8BF4", Ne = 1, ot = 2, jn = ({
|
|
|
7581
7582
|
const z = Math.abs(w - L);
|
|
7582
7583
|
if (z <= e) {
|
|
7583
7584
|
const j = w - L;
|
|
7584
|
-
if (!
|
|
7585
|
+
if (!yt({ value: j, step: ot })) continue;
|
|
7585
7586
|
const N = i + j, { left: x } = E, B = {
|
|
7586
7587
|
type: "horizontal",
|
|
7587
7588
|
axis: s,
|
|
7588
|
-
refStart:
|
|
7589
|
+
refStart: C,
|
|
7589
7590
|
refEnd: O,
|
|
7590
7591
|
activeStart: N,
|
|
7591
7592
|
activeEnd: x,
|
|
@@ -7598,14 +7599,14 @@ const Ee = 5, An = "#3D8BF4", Ne = 1, ot = 2, jn = ({
|
|
|
7598
7599
|
}
|
|
7599
7600
|
if (!u.length)
|
|
7600
7601
|
return { delta: 0, guide: null };
|
|
7601
|
-
let
|
|
7602
|
+
let I = u[0];
|
|
7602
7603
|
for (let v = 1; v < u.length; v += 1) {
|
|
7603
7604
|
const S = u[v];
|
|
7604
|
-
S.diff <
|
|
7605
|
+
S.diff < I.diff && (I = S);
|
|
7605
7606
|
}
|
|
7606
7607
|
return {
|
|
7607
|
-
delta:
|
|
7608
|
-
guide:
|
|
7608
|
+
delta: I.delta,
|
|
7609
|
+
guide: I.guide
|
|
7609
7610
|
};
|
|
7610
7611
|
}, Xs = ({
|
|
7611
7612
|
activeBounds: h,
|
|
@@ -7658,12 +7659,12 @@ const Ee = 5, An = "#3D8BF4", Ne = 1, ot = 2, jn = ({
|
|
|
7658
7659
|
}) => {
|
|
7659
7660
|
const m = i || 1, g = 12 / m, y = d / m, b = u / m, A = (n + s) / 2 + f, w = t === "vertical" ? e + p : A, T = t === "vertical" ? A : e + p;
|
|
7660
7661
|
h.save(), h.setLineDash([]), h.fillStyle = a, h.strokeStyle = a, h.lineWidth = l / m, h.font = `${g}px ${c}`, h.textAlign = "center", h.textBaseline = "middle";
|
|
7661
|
-
const
|
|
7662
|
+
const I = h.measureText(o).width + y * 2, v = g + y * 2, S = w - I / 2, M = T - v / 2;
|
|
7662
7663
|
h.beginPath(), Ks({
|
|
7663
7664
|
context: h,
|
|
7664
7665
|
x: S,
|
|
7665
7666
|
y: M,
|
|
7666
|
-
width:
|
|
7667
|
+
width: I,
|
|
7667
7668
|
height: v,
|
|
7668
7669
|
radius: b
|
|
7669
7670
|
}), h.fill(), h.fillStyle = r, h.fillText(o, w, T), h.restore();
|
|
@@ -7833,7 +7834,7 @@ class $ {
|
|
|
7833
7834
|
return;
|
|
7834
7835
|
}
|
|
7835
7836
|
$._applyMovementStep({ target: e }), !this.anchors.vertical.length && !this.anchors.horizontal.length && this._cacheAnchors({ activeObject: e });
|
|
7836
|
-
let o =
|
|
7837
|
+
let o = mt({ object: e });
|
|
7837
7838
|
if (!o) {
|
|
7838
7839
|
this._clearGuides();
|
|
7839
7840
|
return;
|
|
@@ -7848,9 +7849,9 @@ class $ {
|
|
|
7848
7849
|
e.set({
|
|
7849
7850
|
left: y + l,
|
|
7850
7851
|
top: b + d
|
|
7851
|
-
}), e.setCoords(), o = (m =
|
|
7852
|
+
}), e.setCoords(), o = (m = mt({ object: e })) != null ? m : o;
|
|
7852
7853
|
}
|
|
7853
|
-
const f = this.cachedTargetBounds.length ? this.cachedTargetBounds : this._collectTargets({ activeObject: e }).map((y) =>
|
|
7854
|
+
const f = this.cachedTargetBounds.length ? this.cachedTargetBounds : this._collectTargets({ activeObject: e }).map((y) => mt({ object: y })).filter((y) => !!y), p = Xs({
|
|
7854
7855
|
activeBounds: o,
|
|
7855
7856
|
candidates: f,
|
|
7856
7857
|
threshold: r,
|
|
@@ -7861,7 +7862,7 @@ class $ {
|
|
|
7861
7862
|
e.set({
|
|
7862
7863
|
left: y + p.deltaX,
|
|
7863
7864
|
top: b + p.deltaY
|
|
7864
|
-
}), e.setCoords(), o = (g =
|
|
7865
|
+
}), e.setCoords(), o = (g = mt({ object: e })) != null ? g : o;
|
|
7865
7866
|
}
|
|
7866
7867
|
this._applyGuides({
|
|
7867
7868
|
guides: u,
|
|
@@ -7895,7 +7896,7 @@ class $ {
|
|
|
7895
7896
|
horizontal: d
|
|
7896
7897
|
} = c;
|
|
7897
7898
|
!l.length && !d.length && this._cacheAnchors({ activeObject: e });
|
|
7898
|
-
const u =
|
|
7899
|
+
const u = mt({ object: e });
|
|
7899
7900
|
if (!u) {
|
|
7900
7901
|
this._clearGuides();
|
|
7901
7902
|
return;
|
|
@@ -7908,23 +7909,23 @@ class $ {
|
|
|
7908
7909
|
originY: A = "top",
|
|
7909
7910
|
scaleX: w = 1,
|
|
7910
7911
|
scaleY: T = 1
|
|
7911
|
-
} = e, E = g != null ? g : b,
|
|
7912
|
+
} = e, E = g != null ? g : b, I = y != null ? y : A, v = $._collectVerticalSnapCandidates({
|
|
7912
7913
|
bounds: u,
|
|
7913
7914
|
originX: E,
|
|
7914
7915
|
shouldSnapX: i
|
|
7915
7916
|
}), S = $._collectHorizontalSnapCandidates({
|
|
7916
7917
|
bounds: u,
|
|
7917
|
-
originY:
|
|
7918
|
+
originY: I,
|
|
7918
7919
|
shouldSnapY: a
|
|
7919
7920
|
}), M = $._findAxisSnapCandidate({
|
|
7920
7921
|
anchors: l,
|
|
7921
7922
|
candidates: v,
|
|
7922
7923
|
threshold: m
|
|
7923
|
-
}),
|
|
7924
|
+
}), C = $._findAxisSnapCandidate({
|
|
7924
7925
|
anchors: d,
|
|
7925
7926
|
candidates: S,
|
|
7926
7927
|
threshold: m
|
|
7927
|
-
}), { guidePosition: O } = M, { guidePosition: L } =
|
|
7928
|
+
}), { guidePosition: O } = M, { guidePosition: L } = C, U = O !== null, z = L !== null;
|
|
7928
7929
|
if (!U && !z) {
|
|
7929
7930
|
this._clearGuides();
|
|
7930
7931
|
return;
|
|
@@ -7935,9 +7936,9 @@ class $ {
|
|
|
7935
7936
|
const B = $._resolveUniformScale({
|
|
7936
7937
|
bounds: u,
|
|
7937
7938
|
originX: E,
|
|
7938
|
-
originY:
|
|
7939
|
+
originY: I,
|
|
7939
7940
|
verticalSnap: M,
|
|
7940
|
-
horizontalSnap:
|
|
7941
|
+
horizontalSnap: C
|
|
7941
7942
|
});
|
|
7942
7943
|
if (B) {
|
|
7943
7944
|
const { scaleFactor: _, guide: D } = B;
|
|
@@ -7972,8 +7973,8 @@ class $ {
|
|
|
7972
7973
|
if (z) {
|
|
7973
7974
|
const V = $._resolveDesiredHeight({
|
|
7974
7975
|
bounds: u,
|
|
7975
|
-
originY:
|
|
7976
|
-
snap:
|
|
7976
|
+
originY: I,
|
|
7977
|
+
snap: C
|
|
7977
7978
|
});
|
|
7978
7979
|
if (V !== null) {
|
|
7979
7980
|
const H = $._resolveScaleForHeight({
|
|
@@ -7999,8 +8000,8 @@ class $ {
|
|
|
7999
8000
|
return;
|
|
8000
8001
|
}
|
|
8001
8002
|
if (x) {
|
|
8002
|
-
const B = e.getRelativeCenterPoint(), _ = e.translateToOriginPoint(B, E,
|
|
8003
|
-
R !== null && (D.scaleX = R, s.scaleX = R), N !== null && (D.scaleY = N, s.scaleY = N), Object.keys(D).length && (e.set(D), e.setPositionByOrigin(_, E,
|
|
8003
|
+
const B = e.getRelativeCenterPoint(), _ = e.translateToOriginPoint(B, E, I), D = {};
|
|
8004
|
+
R !== null && (D.scaleX = R, s.scaleX = R), N !== null && (D.scaleY = N, s.scaleY = N), Object.keys(D).length && (e.set(D), e.setPositionByOrigin(_, E, I), e.setCoords());
|
|
8004
8005
|
}
|
|
8005
8006
|
this._applyGuides({
|
|
8006
8007
|
guides: j,
|
|
@@ -8034,7 +8035,7 @@ class $ {
|
|
|
8034
8035
|
horizontal: c
|
|
8035
8036
|
} = a;
|
|
8036
8037
|
!r.length && !c.length && this._cacheAnchors({ activeObject: t });
|
|
8037
|
-
const l =
|
|
8038
|
+
const l = mt({ object: t });
|
|
8038
8039
|
if (!l) {
|
|
8039
8040
|
this._clearGuides();
|
|
8040
8041
|
return;
|
|
@@ -8055,18 +8056,18 @@ class $ {
|
|
|
8055
8056
|
this._clearGuides();
|
|
8056
8057
|
return;
|
|
8057
8058
|
}
|
|
8058
|
-
const
|
|
8059
|
+
const I = $._resolveDesiredWidth({
|
|
8059
8060
|
bounds: l,
|
|
8060
8061
|
originX: b,
|
|
8061
8062
|
snap: T
|
|
8062
8063
|
});
|
|
8063
|
-
if (
|
|
8064
|
+
if (I === null) {
|
|
8064
8065
|
this._clearGuides();
|
|
8065
8066
|
return;
|
|
8066
8067
|
}
|
|
8067
8068
|
const v = $._resolveTextWidthForBounds({
|
|
8068
8069
|
target: t,
|
|
8069
|
-
boundsWidth:
|
|
8070
|
+
boundsWidth: I
|
|
8070
8071
|
});
|
|
8071
8072
|
if (v === null) {
|
|
8072
8073
|
this._clearGuides();
|
|
@@ -8074,8 +8075,8 @@ class $ {
|
|
|
8074
8075
|
}
|
|
8075
8076
|
const { width: S = 0 } = t;
|
|
8076
8077
|
if (v !== S) {
|
|
8077
|
-
const M = t.getRelativeCenterPoint(),
|
|
8078
|
-
t.set({ width: v }), t.setPositionByOrigin(
|
|
8078
|
+
const M = t.getRelativeCenterPoint(), C = t.translateToOriginPoint(M, b, A);
|
|
8079
|
+
t.set({ width: v }), t.setPositionByOrigin(C, b, A), t.setCoords();
|
|
8079
8080
|
}
|
|
8080
8081
|
this._applyGuides({
|
|
8081
8082
|
guides: [
|
|
@@ -8409,10 +8410,10 @@ class $ {
|
|
|
8409
8410
|
_cacheAnchors({ activeObject: t }) {
|
|
8410
8411
|
const e = this._collectTargets({ activeObject: t }), n = { vertical: [], horizontal: [] }, s = [];
|
|
8411
8412
|
for (const a of e) {
|
|
8412
|
-
const r =
|
|
8413
|
+
const r = mt({ object: a });
|
|
8413
8414
|
r && (vn({ anchors: n, bounds: r }), s.push(r));
|
|
8414
8415
|
}
|
|
8415
|
-
const { montageArea: o } = this.editor, i =
|
|
8416
|
+
const { montageArea: o } = this.editor, i = mt({ object: o });
|
|
8416
8417
|
if (i) {
|
|
8417
8418
|
vn({ anchors: n, bounds: i });
|
|
8418
8419
|
const { left: a, right: r, top: c, bottom: l } = i;
|
|
@@ -8456,7 +8457,7 @@ class $ {
|
|
|
8456
8457
|
}
|
|
8457
8458
|
}
|
|
8458
8459
|
const Mn = "#3D8BF4", Sn = 1;
|
|
8459
|
-
class
|
|
8460
|
+
class Ut {
|
|
8460
8461
|
/**
|
|
8461
8462
|
* Создаёт менеджер измерений и инициализирует события.
|
|
8462
8463
|
*/
|
|
@@ -8561,15 +8562,15 @@ class Wt {
|
|
|
8561
8562
|
this._clearGuides();
|
|
8562
8563
|
return;
|
|
8563
8564
|
}
|
|
8564
|
-
const o =
|
|
8565
|
+
const o = mt({ object: s });
|
|
8565
8566
|
if (!o) {
|
|
8566
8567
|
this._clearGuides();
|
|
8567
8568
|
return;
|
|
8568
8569
|
}
|
|
8569
|
-
const i =
|
|
8570
|
+
const i = Ut._resolveTarget({
|
|
8570
8571
|
event: t,
|
|
8571
8572
|
activeObject: s
|
|
8572
|
-
}), { montageArea: a } = n, r = i != null ? i : a, c = r === a, l =
|
|
8573
|
+
}), { montageArea: a } = n, r = i != null ? i : a, c = r === a, l = mt({ object: r });
|
|
8573
8574
|
if (!l) {
|
|
8574
8575
|
this._clearGuides();
|
|
8575
8576
|
return;
|
|
@@ -8578,7 +8579,7 @@ class Wt {
|
|
|
8578
8579
|
this._clearGuides();
|
|
8579
8580
|
return;
|
|
8580
8581
|
}
|
|
8581
|
-
const u =
|
|
8582
|
+
const u = Ut._buildGuides({
|
|
8582
8583
|
activeBounds: o,
|
|
8583
8584
|
targetBounds: l,
|
|
8584
8585
|
targetIsMontageArea: c
|
|
@@ -8607,11 +8608,11 @@ class Wt {
|
|
|
8607
8608
|
targetBounds: e,
|
|
8608
8609
|
targetIsMontageArea: n
|
|
8609
8610
|
}) {
|
|
8610
|
-
const s =
|
|
8611
|
+
const s = Ut._buildHorizontalGuides({
|
|
8611
8612
|
activeBounds: t,
|
|
8612
8613
|
targetBounds: e,
|
|
8613
8614
|
targetIsMontageArea: n
|
|
8614
|
-
}), o =
|
|
8615
|
+
}), o = Ut._buildVerticalGuides({
|
|
8615
8616
|
activeBounds: t,
|
|
8616
8617
|
targetBounds: e,
|
|
8617
8618
|
targetIsMontageArea: n
|
|
@@ -8641,34 +8642,34 @@ class Wt {
|
|
|
8641
8642
|
} = e, m = Math.max(a, u), g = Math.min(r, f), b = g >= m ? (m + g) / 2 : (c + p) / 2;
|
|
8642
8643
|
if (l >= i) {
|
|
8643
8644
|
if (n) return s;
|
|
8644
|
-
const
|
|
8645
|
-
return
|
|
8645
|
+
const C = l - i;
|
|
8646
|
+
return C > 0 && s.push({
|
|
8646
8647
|
type: "horizontal",
|
|
8647
8648
|
axis: b,
|
|
8648
8649
|
start: i,
|
|
8649
8650
|
end: l,
|
|
8650
|
-
distance:
|
|
8651
|
+
distance: C
|
|
8651
8652
|
}), s;
|
|
8652
8653
|
}
|
|
8653
8654
|
if (d <= o) {
|
|
8654
8655
|
if (n) return s;
|
|
8655
|
-
const
|
|
8656
|
-
return
|
|
8656
|
+
const C = o - d;
|
|
8657
|
+
return C > 0 && s.push({
|
|
8657
8658
|
type: "horizontal",
|
|
8658
8659
|
axis: b,
|
|
8659
8660
|
start: d,
|
|
8660
8661
|
end: o,
|
|
8661
|
-
distance:
|
|
8662
|
+
distance: C
|
|
8662
8663
|
}), s;
|
|
8663
8664
|
}
|
|
8664
8665
|
if (!n) return s;
|
|
8665
|
-
const A = o < l, w = i > d, T = Math.min(o, l), E = Math.max(o, l),
|
|
8666
|
-
|
|
8666
|
+
const A = o < l, w = i > d, T = Math.min(o, l), E = Math.max(o, l), I = E - T;
|
|
8667
|
+
I > 0 && !A && s.push({
|
|
8667
8668
|
type: "horizontal",
|
|
8668
8669
|
axis: b,
|
|
8669
8670
|
start: T,
|
|
8670
8671
|
end: E,
|
|
8671
|
-
distance:
|
|
8672
|
+
distance: I
|
|
8672
8673
|
});
|
|
8673
8674
|
const v = Math.min(i, d), S = Math.max(i, d), M = S - v;
|
|
8674
8675
|
return M > 0 && !w && s.push({
|
|
@@ -8702,34 +8703,34 @@ class Wt {
|
|
|
8702
8703
|
} = e, m = Math.max(a, u), g = Math.min(r, f), b = g >= m ? (m + g) / 2 : (c + p) / 2;
|
|
8703
8704
|
if (l >= i) {
|
|
8704
8705
|
if (n) return s;
|
|
8705
|
-
const
|
|
8706
|
-
return
|
|
8706
|
+
const C = l - i;
|
|
8707
|
+
return C > 0 && s.push({
|
|
8707
8708
|
type: "vertical",
|
|
8708
8709
|
axis: b,
|
|
8709
8710
|
start: i,
|
|
8710
8711
|
end: l,
|
|
8711
|
-
distance:
|
|
8712
|
+
distance: C
|
|
8712
8713
|
}), s;
|
|
8713
8714
|
}
|
|
8714
8715
|
if (d <= o) {
|
|
8715
8716
|
if (n) return s;
|
|
8716
|
-
const
|
|
8717
|
-
return
|
|
8717
|
+
const C = o - d;
|
|
8718
|
+
return C > 0 && s.push({
|
|
8718
8719
|
type: "vertical",
|
|
8719
8720
|
axis: b,
|
|
8720
8721
|
start: d,
|
|
8721
8722
|
end: o,
|
|
8722
|
-
distance:
|
|
8723
|
+
distance: C
|
|
8723
8724
|
}), s;
|
|
8724
8725
|
}
|
|
8725
8726
|
if (!n) return s;
|
|
8726
|
-
const A = o < l, w = i > d, T = Math.min(o, l), E = Math.max(o, l),
|
|
8727
|
-
|
|
8727
|
+
const A = o < l, w = i > d, T = Math.min(o, l), E = Math.max(o, l), I = E - T;
|
|
8728
|
+
I > 0 && !A && s.push({
|
|
8728
8729
|
type: "vertical",
|
|
8729
8730
|
axis: b,
|
|
8730
8731
|
start: T,
|
|
8731
8732
|
end: E,
|
|
8732
|
-
distance:
|
|
8733
|
+
distance: I
|
|
8733
8734
|
});
|
|
8734
8735
|
const v = Math.min(i, d), S = Math.max(i, d), M = S - v;
|
|
8735
8736
|
return M > 0 && !w && s.push({
|
|
@@ -8833,7 +8834,7 @@ class Ge {
|
|
|
8833
8834
|
showRotationAngle: l,
|
|
8834
8835
|
_onReadyCallback: d
|
|
8835
8836
|
} = this.options;
|
|
8836
|
-
if (ut.apply(), this.canvas = new zn(this.containerId, this.options), this.moduleLoader = new Hn(), this.workerManager = new Gn(), this.errorManager = new ne({ editor: this }), this.historyManager = new J({ editor: this }), this.toolbar = new cs({ editor: this }), this.transformManager = new vs({ editor: this }), this.zoomManager = new bs({ editor: this }), this.canvasManager = new ys({ editor: this }), this.imageManager = new
|
|
8837
|
+
if (ut.apply(), this.canvas = new zn(this.containerId, this.options), this.moduleLoader = new Hn(), this.workerManager = new Gn(), this.errorManager = new ne({ editor: this }), this.historyManager = new J({ editor: this }), this.toolbar = new cs({ editor: this }), this.transformManager = new vs({ editor: this }), this.zoomManager = new bs({ editor: this }), this.canvasManager = new ys({ editor: this }), this.imageManager = new te({ editor: this }), this.layerManager = new ye({ editor: this }), this.shapeManager = new Ss({ editor: this }), this.interactionBlocker = new Ms({ editor: this }), this.backgroundManager = new Ft({ editor: this }), this.clipboardManager = new ws({ editor: this }), this.objectLockManager = new ve({ editor: this }), this.groupingManager = new As({ editor: this }), this.selectionManager = new ft({ editor: this }), this.deletionManager = new He({ editor: this }), this.panConstraintManager = new js({ editor: this }), this.snappingManager = new $({ editor: this }), this.measurementManager = new Ut({ editor: this }), this.fontManager = new xe((u = this.options.fonts) != null ? u : []), this.textManager = new rt({ editor: this }), this.templateManager = new G({ editor: this }), l && (this.angleIndicator = new Ye({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.listeners = new ze({ editor: this, options: this.options }), this.canvasManager.setEditorContainerWidth(t), this.canvasManager.setEditorContainerHeight(e), this.canvasManager.setCanvasWrapperWidth(n), this.canvasManager.setCanvasWrapperHeight(s), this.canvasManager.setCanvasCSSWidth(o), this.canvasManager.setCanvasCSSHeight(i), this.canvasManager.updateCanvas(), this.zoomManager.calculateAndApplyDefaultZoom(), yield this.fontManager.loadFonts(), r) {
|
|
8837
8838
|
this.historyManager.suspendHistory();
|
|
8838
8839
|
try {
|
|
8839
8840
|
const m = yield this.imageManager.prepareInitialState({
|
|
@@ -8846,7 +8847,7 @@ class Ge {
|
|
|
8846
8847
|
source: g,
|
|
8847
8848
|
scale: y = `image-${c}`,
|
|
8848
8849
|
withoutSave: b = !0
|
|
8849
|
-
} = f, A =
|
|
8850
|
+
} = f, A = Mt(f, [
|
|
8850
8851
|
"source",
|
|
8851
8852
|
"scale",
|
|
8852
8853
|
"withoutSave"
|
|
@@ -8868,7 +8869,7 @@ class Ge {
|
|
|
8868
8869
|
source: m,
|
|
8869
8870
|
scale: g = `image-${c}`,
|
|
8870
8871
|
withoutSave: y = !0
|
|
8871
|
-
} = p, b =
|
|
8872
|
+
} = p, b = Mt(p, [
|
|
8872
8873
|
"source",
|
|
8873
8874
|
"scale",
|
|
8874
8875
|
"withoutSave"
|