@anu3ev/fabric-image-editor 0.6.2 → 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 +327 -327
- 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",
|
|
@@ -4293,7 +4293,7 @@ class ve {
|
|
|
4293
4293
|
});
|
|
4294
4294
|
}
|
|
4295
4295
|
static _isGroupOrSelection(t) {
|
|
4296
|
-
return t instanceof K || t instanceof
|
|
4296
|
+
return t instanceof K || t instanceof Nt;
|
|
4297
4297
|
}
|
|
4298
4298
|
}
|
|
4299
4299
|
class As {
|
|
@@ -4316,20 +4316,20 @@ class As {
|
|
|
4316
4316
|
*/
|
|
4317
4317
|
_getGroupsToUngroup(t) {
|
|
4318
4318
|
if (Array.isArray(t)) {
|
|
4319
|
-
const n = t.filter((s) => s instanceof
|
|
4319
|
+
const n = t.filter((s) => s instanceof Nt);
|
|
4320
4320
|
return n.length > 0 ? n : null;
|
|
4321
4321
|
}
|
|
4322
4322
|
if (t instanceof K) {
|
|
4323
|
-
const n = t.getObjects().filter((s) => s instanceof
|
|
4323
|
+
const n = t.getObjects().filter((s) => s instanceof Nt);
|
|
4324
4324
|
return n.length > 0 ? n : null;
|
|
4325
4325
|
}
|
|
4326
4326
|
const e = t || this.editor.canvas.getActiveObject();
|
|
4327
4327
|
if (!e) return null;
|
|
4328
4328
|
if (e instanceof K) {
|
|
4329
|
-
const n = e.getObjects().filter((s) => s instanceof
|
|
4329
|
+
const n = e.getObjects().filter((s) => s instanceof Nt);
|
|
4330
4330
|
return n.length > 0 ? n : null;
|
|
4331
4331
|
}
|
|
4332
|
-
return e instanceof
|
|
4332
|
+
return e instanceof Nt ? [e] : null;
|
|
4333
4333
|
}
|
|
4334
4334
|
/**
|
|
4335
4335
|
* Группировка объектов
|
|
@@ -4346,7 +4346,7 @@ class As {
|
|
|
4346
4346
|
if (!o) return null;
|
|
4347
4347
|
try {
|
|
4348
4348
|
s.suspendHistory();
|
|
4349
|
-
const i = new
|
|
4349
|
+
const i = new Nt(o, {
|
|
4350
4350
|
id: `group-${et()}`
|
|
4351
4351
|
});
|
|
4352
4352
|
o.forEach((r) => n.remove(r)), n.add(i), n.setActiveObject(i), n.requestRenderAll();
|
|
@@ -4752,7 +4752,7 @@ class He {
|
|
|
4752
4752
|
return s.fire("editor:objects-deleted", c), c;
|
|
4753
4753
|
}
|
|
4754
4754
|
}
|
|
4755
|
-
const
|
|
4755
|
+
const _t = {
|
|
4756
4756
|
IMAGE_MANAGER: {
|
|
4757
4757
|
/**
|
|
4758
4758
|
* Некорректный Content-Type изображения
|
|
@@ -4944,7 +4944,7 @@ class ne {
|
|
|
4944
4944
|
* @returns true, если код допустим, иначе false
|
|
4945
4945
|
*/
|
|
4946
4946
|
static isValidErrorCode(t) {
|
|
4947
|
-
return t ? Object.values(
|
|
4947
|
+
return t ? Object.values(_t).some((e) => Object.values(e).includes(t)) : !1;
|
|
4948
4948
|
}
|
|
4949
4949
|
}
|
|
4950
4950
|
class js {
|
|
@@ -5032,7 +5032,7 @@ class js {
|
|
|
5032
5032
|
this.currentBounds = this.calculatePanBounds();
|
|
5033
5033
|
}
|
|
5034
5034
|
}
|
|
5035
|
-
const
|
|
5035
|
+
const Is = ({ textbox: h }) => {
|
|
5036
5036
|
var n, s;
|
|
5037
5037
|
if (!h.isEditing) return null;
|
|
5038
5038
|
const t = (n = h.selectionStart) != null ? n : 0, e = (s = h.selectionEnd) != null ? s : t;
|
|
@@ -5040,7 +5040,7 @@ const Cs = ({ textbox: h }) => {
|
|
|
5040
5040
|
start: Math.min(t, e),
|
|
5041
5041
|
end: Math.max(t, e)
|
|
5042
5042
|
};
|
|
5043
|
-
},
|
|
5043
|
+
}, Cs = ({ textbox: h }) => {
|
|
5044
5044
|
var e, n;
|
|
5045
5045
|
const t = (n = (e = h.text) == null ? void 0 : e.length) != null ? n : 0;
|
|
5046
5046
|
return t <= 0 ? null : { start: 0, end: t };
|
|
@@ -5071,11 +5071,11 @@ const Cs = ({ textbox: h }) => {
|
|
|
5071
5071
|
);
|
|
5072
5072
|
if (n.length)
|
|
5073
5073
|
return (s = n[0]) == null ? void 0 : s[e];
|
|
5074
|
-
}, 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 = ({
|
|
5075
5075
|
value: h,
|
|
5076
5076
|
min: t,
|
|
5077
5077
|
max: e
|
|
5078
|
-
}) => Math.min(Math.max(h, t), e),
|
|
5078
|
+
}) => Math.min(Math.max(h, t), e), Wt = class Wt extends ct {
|
|
5079
5079
|
constructor(t, e = {}) {
|
|
5080
5080
|
var n, s, o, i, a, r, c, l, d, u;
|
|
5081
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();
|
|
@@ -5128,7 +5128,7 @@ const Cs = ({ textbox: h }) => {
|
|
|
5128
5128
|
const e = this._getEffectiveBackgroundFill();
|
|
5129
5129
|
if (e && e) {
|
|
5130
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;
|
|
5131
|
-
t.save(),
|
|
5131
|
+
t.save(), Wt._renderRoundedRect({
|
|
5132
5132
|
ctx: t,
|
|
5133
5133
|
height: c,
|
|
5134
5134
|
left: d,
|
|
@@ -5164,14 +5164,14 @@ const Cs = ({ textbox: h }) => {
|
|
|
5164
5164
|
continue;
|
|
5165
5165
|
}
|
|
5166
5166
|
const A = c[g], w = b / o, T = this._getLineLeftOffset(g);
|
|
5167
|
-
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;
|
|
5168
5168
|
const U = l + w * (1 - r);
|
|
5169
5169
|
let z = this.getHeightOfChar(g, 0), j = this.getValueOfPropertyAt(g, 0, "deltaY");
|
|
5170
5170
|
for (let x = 0, B = A.length; x < B; x += 1) {
|
|
5171
5171
|
const _ = this.__charBounds[g][x];
|
|
5172
|
-
|
|
5172
|
+
C = this.getValueOfPropertyAt(g, x, e), O = this._getDecorationColorAt(g, x), L = this.getValueOfPropertyAt(g, x, "textDecorationThickness");
|
|
5173
5173
|
const D = this.getHeightOfChar(g, x), P = this.getValueOfPropertyAt(g, x, "deltaY");
|
|
5174
|
-
if (u &&
|
|
5174
|
+
if (u && C && O) {
|
|
5175
5175
|
const k = s * L / 1e3;
|
|
5176
5176
|
t.save(), t.fillStyle = S, t.translate(_.renderLeft, _.renderTop), t.rotate(_.angle), t.fillRect(
|
|
5177
5177
|
-_.kernedWidth / 2,
|
|
@@ -5179,25 +5179,25 @@ const Cs = ({ textbox: h }) => {
|
|
|
5179
5179
|
_.kernedWidth,
|
|
5180
5180
|
k
|
|
5181
5181
|
), t.restore();
|
|
5182
|
-
} else if ((
|
|
5182
|
+
} else if ((C !== v || O !== S || D !== z || L !== M || P !== j) && I > 0) {
|
|
5183
5183
|
const k = s * M / 1e3;
|
|
5184
5184
|
let V = d + T + E;
|
|
5185
|
-
n === "rtl" && (V = a - V -
|
|
5185
|
+
n === "rtl" && (V = a - V - I), v && S && M && (t.fillStyle = S, t.fillRect(
|
|
5186
5186
|
V,
|
|
5187
5187
|
U + p * z + j - m * k,
|
|
5188
|
-
|
|
5188
|
+
I,
|
|
5189
5189
|
k
|
|
5190
|
-
)), E = _.left,
|
|
5190
|
+
)), E = _.left, I = _.width, v = C, M = L, S = O, z = D, j = P;
|
|
5191
5191
|
} else
|
|
5192
|
-
|
|
5192
|
+
I += _.kernedWidth;
|
|
5193
5193
|
}
|
|
5194
5194
|
let R = d + T + E;
|
|
5195
|
-
n === "rtl" && (R = a - R -
|
|
5195
|
+
n === "rtl" && (R = a - R - I), t.fillStyle = O;
|
|
5196
5196
|
const N = s * L / 1e3;
|
|
5197
|
-
|
|
5197
|
+
C && O && L && t.fillRect(
|
|
5198
5198
|
R,
|
|
5199
5199
|
U + p * z + j - m * N,
|
|
5200
|
-
|
|
5200
|
+
I - f,
|
|
5201
5201
|
N
|
|
5202
5202
|
), l += b;
|
|
5203
5203
|
}
|
|
@@ -5227,10 +5227,10 @@ const Cs = ({ textbox: h }) => {
|
|
|
5227
5227
|
var i, a, r, c;
|
|
5228
5228
|
const n = t / 2, s = e / 2, o = Math.min(n, s);
|
|
5229
5229
|
return {
|
|
5230
|
-
bottomLeft:
|
|
5231
|
-
bottomRight:
|
|
5232
|
-
topLeft:
|
|
5233
|
-
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 })
|
|
5234
5234
|
};
|
|
5235
5235
|
}
|
|
5236
5236
|
_getPadding() {
|
|
@@ -5246,7 +5246,7 @@ const Cs = ({ textbox: h }) => {
|
|
|
5246
5246
|
var s;
|
|
5247
5247
|
const t = this.backgroundColor;
|
|
5248
5248
|
if (!t) return null;
|
|
5249
|
-
const e =
|
|
5249
|
+
const e = St({ value: (s = this.backgroundOpacity) != null ? s : 1, min: 0, max: 1 });
|
|
5250
5250
|
let n;
|
|
5251
5251
|
try {
|
|
5252
5252
|
n = new Nn(t);
|
|
@@ -5274,7 +5274,7 @@ const Cs = ({ textbox: h }) => {
|
|
|
5274
5274
|
topRight: l,
|
|
5275
5275
|
bottomRight: d,
|
|
5276
5276
|
bottomLeft: u
|
|
5277
|
-
} = 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 });
|
|
5278
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();
|
|
5279
5279
|
}
|
|
5280
5280
|
/**
|
|
@@ -5288,7 +5288,7 @@ const Cs = ({ textbox: h }) => {
|
|
|
5288
5288
|
n !== t && (this.width = Math.max(0, n)), s !== e && (this.height = Math.max(0, s));
|
|
5289
5289
|
}
|
|
5290
5290
|
};
|
|
5291
|
-
|
|
5291
|
+
Wt.type = "background-textbox", Wt.cacheProperties = [
|
|
5292
5292
|
...Array.isArray(ct.cacheProperties) ? ct.cacheProperties : [],
|
|
5293
5293
|
"backgroundColor",
|
|
5294
5294
|
"backgroundOpacity",
|
|
@@ -5301,7 +5301,7 @@ Yt.type = "background-textbox", Yt.cacheProperties = [
|
|
|
5301
5301
|
"radiusTopRight",
|
|
5302
5302
|
"radiusBottomRight",
|
|
5303
5303
|
"radiusBottomLeft"
|
|
5304
|
-
],
|
|
5304
|
+
], Wt.stateProperties = [
|
|
5305
5305
|
...Array.isArray(ct.stateProperties) ? ct.stateProperties : [],
|
|
5306
5306
|
"backgroundColor",
|
|
5307
5307
|
"backgroundOpacity",
|
|
@@ -5315,7 +5315,7 @@ Yt.type = "background-textbox", Yt.cacheProperties = [
|
|
|
5315
5315
|
"radiusBottomRight",
|
|
5316
5316
|
"radiusBottomLeft"
|
|
5317
5317
|
];
|
|
5318
|
-
let be =
|
|
5318
|
+
let be = Wt;
|
|
5319
5319
|
const Es = () => {
|
|
5320
5320
|
var h;
|
|
5321
5321
|
(h = en) != null && h.setClass && en.setClass(be, "background-textbox");
|
|
@@ -5553,7 +5553,7 @@ const Es = () => {
|
|
|
5553
5553
|
if (s !== void 0 || o !== void 0 || i !== void 0 || a !== void 0 || r !== void 0 || c !== void 0) return !0;
|
|
5554
5554
|
}
|
|
5555
5555
|
return !1;
|
|
5556
|
-
},
|
|
5556
|
+
}, Ot = ({
|
|
5557
5557
|
textbox: h
|
|
5558
5558
|
}) => {
|
|
5559
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({
|
|
@@ -5586,7 +5586,7 @@ class rt {
|
|
|
5586
5586
|
if (!rt._isTextbox(s) || this.lineDefaultsSyncing.has(s)) return;
|
|
5587
5587
|
const { text: o = "", uppercase: i, autoExpand: a } = s, r = !!i, c = a !== !1, l = o.toLocaleLowerCase();
|
|
5588
5588
|
if (r) {
|
|
5589
|
-
const f =
|
|
5589
|
+
const f = Ie({ value: l });
|
|
5590
5590
|
f !== o && s.set({ text: f }), s.textCaseRaw = l;
|
|
5591
5591
|
} else
|
|
5592
5592
|
s.textCaseRaw = o;
|
|
@@ -5594,7 +5594,7 @@ class rt {
|
|
|
5594
5594
|
let d = !1;
|
|
5595
5595
|
c && (d = this._autoExpandTextboxWidth(s));
|
|
5596
5596
|
let u = !1;
|
|
5597
|
-
d || (u =
|
|
5597
|
+
d || (u = Ot({ textbox: s })), (d || u) && (s.setCoords(), s.dirty = !0), this._syncLineFontDefaultsOnTextChanged({ textbox: s });
|
|
5598
5598
|
}, this._handleTextEditingExited = (n) => {
|
|
5599
5599
|
var c, l, d;
|
|
5600
5600
|
const { target: s } = n;
|
|
@@ -5606,7 +5606,7 @@ class rt {
|
|
|
5606
5606
|
s.textCaseRaw = u;
|
|
5607
5607
|
} else
|
|
5608
5608
|
s.textCaseRaw = o;
|
|
5609
|
-
|
|
5609
|
+
Ot({ textbox: s }) && (s.setCoords(), s.dirty = !0, this.canvas.requestRenderAll()), s.locked || s.set({
|
|
5610
5610
|
lockMovementX: !1,
|
|
5611
5611
|
lockMovementY: !1
|
|
5612
5612
|
});
|
|
@@ -5629,10 +5629,10 @@ class rt {
|
|
|
5629
5629
|
s.set({ width: m });
|
|
5630
5630
|
const { width: g = 0 } = s, y = p - g;
|
|
5631
5631
|
if (y !== 0 && o && o.corner === "ml") {
|
|
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,
|
|
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;
|
|
5633
5633
|
s.set({
|
|
5634
|
-
left: ((u = s.left) != null ? u : 0) +
|
|
5635
|
-
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
|
|
5636
5636
|
});
|
|
5637
5637
|
}
|
|
5638
5638
|
}
|
|
@@ -5643,7 +5643,7 @@ class rt {
|
|
|
5643
5643
|
event: i != null ? i : null
|
|
5644
5644
|
});
|
|
5645
5645
|
}, this._handleObjectScaling = (n) => {
|
|
5646
|
-
var ie, Se, oe, ae, re,
|
|
5646
|
+
var ie, Se, oe, ae, re, kt, we, ce, Ht, Zt, Gt, Vt, Xt;
|
|
5647
5647
|
const { target: s, transform: o } = n;
|
|
5648
5648
|
if (s instanceof K || !rt._isTextbox(s) || !o) return;
|
|
5649
5649
|
s.isScaling = !0;
|
|
@@ -5655,9 +5655,9 @@ class rt {
|
|
|
5655
5655
|
baseRadii: d,
|
|
5656
5656
|
baseStyles: u,
|
|
5657
5657
|
baseLineFontDefaults: f
|
|
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",
|
|
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;
|
|
5659
5659
|
if (!w && !T && !E) return;
|
|
5660
|
-
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), {
|
|
5661
5661
|
paddingTop: L = 0,
|
|
5662
5662
|
paddingRight: U = 0,
|
|
5663
5663
|
paddingBottom: z = 0,
|
|
@@ -5681,31 +5681,31 @@ class rt {
|
|
|
5681
5681
|
bottomLeft: Math.max(0, d.bottomLeft * S)
|
|
5682
5682
|
} : d, tt = Object.keys(u).length > 0;
|
|
5683
5683
|
let at;
|
|
5684
|
-
if (
|
|
5685
|
-
const
|
|
5684
|
+
if (I && tt) {
|
|
5685
|
+
const Rt = {};
|
|
5686
5686
|
Object.entries(u).forEach(([le, Q]) => {
|
|
5687
5687
|
if (!Q) return;
|
|
5688
5688
|
const st = {};
|
|
5689
|
-
Object.entries(Q).forEach(([Ae,
|
|
5690
|
-
if (!
|
|
5691
|
-
const Ve = F({},
|
|
5692
|
-
typeof
|
|
5693
|
-
}), Object.keys(st).length && (
|
|
5694
|
-
}), 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);
|
|
5695
5695
|
}
|
|
5696
5696
|
let gt;
|
|
5697
|
-
|
|
5697
|
+
I && (gt = gn({
|
|
5698
5698
|
lineFontDefaults: f,
|
|
5699
5699
|
scale: S
|
|
5700
5700
|
}));
|
|
5701
|
-
const
|
|
5702
|
-
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) {
|
|
5703
5703
|
s.set({ scaleX: 1, scaleY: 1 }), o.scaleX = 1, o.scaleY = 1;
|
|
5704
5704
|
return;
|
|
5705
5705
|
}
|
|
5706
5706
|
at && (s.styles = at), gt && (s.lineFontDefaults = gt), s.set({
|
|
5707
|
-
width:
|
|
5708
|
-
fontSize:
|
|
5707
|
+
width: C,
|
|
5708
|
+
fontSize: I ? O : c,
|
|
5709
5709
|
paddingTop: H.top,
|
|
5710
5710
|
paddingRight: H.right,
|
|
5711
5711
|
paddingBottom: H.bottom,
|
|
@@ -5717,13 +5717,13 @@ class rt {
|
|
|
5717
5717
|
scaleX: 1,
|
|
5718
5718
|
scaleY: 1
|
|
5719
5719
|
});
|
|
5720
|
-
const
|
|
5721
|
-
|
|
5722
|
-
const
|
|
5723
|
-
let
|
|
5724
|
-
se && (w || E) && (
|
|
5725
|
-
const { original:
|
|
5726
|
-
|
|
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({
|
|
5727
5727
|
lineFontDefaults: s.lineFontDefaults
|
|
5728
5728
|
}), i.basePadding = {
|
|
5729
5729
|
top: H.top,
|
|
@@ -5735,19 +5735,19 @@ class rt {
|
|
|
5735
5735
|
topRight: q.topRight,
|
|
5736
5736
|
bottomRight: q.bottomRight,
|
|
5737
5737
|
bottomLeft: q.bottomLeft
|
|
5738
|
-
}, i.hasWidthChange = se ||
|
|
5738
|
+
}, i.hasWidthChange = se || Lt || Dt || xt || Yt;
|
|
5739
5739
|
}, this._handleObjectModified = (n) => {
|
|
5740
5740
|
var b, A, w;
|
|
5741
5741
|
const { target: s } = n;
|
|
5742
5742
|
if (s instanceof K) {
|
|
5743
5743
|
const T = s.getObjects();
|
|
5744
5744
|
if (!T.some((M) => rt._isTextbox(M))) return;
|
|
5745
|
-
const { scaleX:
|
|
5746
|
-
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;
|
|
5747
5747
|
this.canvas.discardActiveObject(), T.forEach((M) => {
|
|
5748
|
-
var
|
|
5748
|
+
var C, O, L, U;
|
|
5749
5749
|
if (rt._isTextbox(M)) {
|
|
5750
|
-
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, {
|
|
5751
5751
|
paddingTop: B = 0,
|
|
5752
5752
|
paddingRight: _ = 0,
|
|
5753
5753
|
paddingBottom: D = 0,
|
|
@@ -5768,10 +5768,10 @@ class rt {
|
|
|
5768
5768
|
radiusBottomRight: Math.max(0, H * x),
|
|
5769
5769
|
radiusBottomLeft: Math.max(0, q * x)
|
|
5770
5770
|
};
|
|
5771
|
-
let
|
|
5772
|
-
tt && Object.keys(tt).length > 0 && (
|
|
5773
|
-
Object.values(
|
|
5774
|
-
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));
|
|
5775
5775
|
});
|
|
5776
5776
|
}));
|
|
5777
5777
|
const dt = gn({
|
|
@@ -5783,9 +5783,9 @@ class rt {
|
|
|
5783
5783
|
scaleX: 1,
|
|
5784
5784
|
scaleY: 1
|
|
5785
5785
|
}, at), gt), {
|
|
5786
|
-
styles:
|
|
5786
|
+
styles: At
|
|
5787
5787
|
});
|
|
5788
|
-
dt && (ht.lineFontDefaults = dt), M.set(ht),
|
|
5788
|
+
dt && (ht.lineFontDefaults = dt), M.set(ht), Ot({ textbox: M });
|
|
5789
5789
|
}
|
|
5790
5790
|
M.setCoords();
|
|
5791
5791
|
});
|
|
@@ -5830,7 +5830,7 @@ class rt {
|
|
|
5830
5830
|
* @param options — настройки текста
|
|
5831
5831
|
* @param flags — флаги поведения
|
|
5832
5832
|
*/
|
|
5833
|
-
addText(U = {}, { withoutSelection:
|
|
5833
|
+
addText(U = {}, { withoutSelection: C = !1, withoutSave: O = !1, withoutAdding: L = !1 } = {}) {
|
|
5834
5834
|
var z = U, {
|
|
5835
5835
|
id: t = `text-${et()}`,
|
|
5836
5836
|
text: e = "Новый текст",
|
|
@@ -5854,10 +5854,10 @@ class rt {
|
|
|
5854
5854
|
paddingBottom: w = 0,
|
|
5855
5855
|
paddingLeft: T = 0,
|
|
5856
5856
|
radiusTopLeft: E = 0,
|
|
5857
|
-
radiusTopRight:
|
|
5857
|
+
radiusTopRight: I = 0,
|
|
5858
5858
|
radiusBottomRight: v = 0,
|
|
5859
5859
|
radiusBottomLeft: S = 0
|
|
5860
|
-
} = z, M =
|
|
5860
|
+
} = z, M = Mt(z, [
|
|
5861
5861
|
"id",
|
|
5862
5862
|
"text",
|
|
5863
5863
|
"autoExpand",
|
|
@@ -5912,15 +5912,15 @@ class rt {
|
|
|
5912
5912
|
paddingBottom: w,
|
|
5913
5913
|
paddingLeft: T,
|
|
5914
5914
|
radiusTopLeft: E,
|
|
5915
|
-
radiusTopRight:
|
|
5915
|
+
radiusTopRight: I,
|
|
5916
5916
|
radiusBottomRight: v,
|
|
5917
5917
|
radiusBottomLeft: S
|
|
5918
5918
|
}, M), D = new be(e, _), P = n !== !1;
|
|
5919
5919
|
if (D.autoExpand = P, D.textCaseRaw = (V = D.text) != null ? V : "", c) {
|
|
5920
|
-
const H =
|
|
5920
|
+
const H = Ie({ value: D.textCaseRaw });
|
|
5921
5921
|
H !== D.text && D.set({ text: H });
|
|
5922
5922
|
}
|
|
5923
|
-
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", {
|
|
5924
5924
|
textbox: D,
|
|
5925
5925
|
options: It(F({}, _), {
|
|
5926
5926
|
text: e,
|
|
@@ -5933,7 +5933,7 @@ class rt {
|
|
|
5933
5933
|
strokeWidth: x
|
|
5934
5934
|
}),
|
|
5935
5935
|
flags: {
|
|
5936
|
-
withoutSelection: !!
|
|
5936
|
+
withoutSelection: !!C,
|
|
5937
5937
|
withoutSave: !!O,
|
|
5938
5938
|
withoutAdding: !!L
|
|
5939
5939
|
}
|
|
@@ -5955,16 +5955,16 @@ class rt {
|
|
|
5955
5955
|
skipRender: s,
|
|
5956
5956
|
selectionRange: o
|
|
5957
5957
|
} = {}) {
|
|
5958
|
-
var
|
|
5958
|
+
var Ht, Gt, Vt, Xt, Rt, le;
|
|
5959
5959
|
const i = this._resolveTextObject(t);
|
|
5960
5960
|
if (!i) return null;
|
|
5961
5961
|
const { text: a = "" } = i, { historyManager: r } = this.editor, { canvas: c } = this;
|
|
5962
5962
|
r.suspendHistory();
|
|
5963
|
-
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 = {
|
|
5964
5964
|
originY: d,
|
|
5965
5965
|
x: u.x,
|
|
5966
5966
|
y: u.y
|
|
5967
|
-
},
|
|
5967
|
+
}, Zt = e, {
|
|
5968
5968
|
text: p,
|
|
5969
5969
|
autoExpand: m,
|
|
5970
5970
|
fontFamily: g,
|
|
@@ -5974,11 +5974,11 @@ class rt {
|
|
|
5974
5974
|
underline: w,
|
|
5975
5975
|
uppercase: T,
|
|
5976
5976
|
strikethrough: E,
|
|
5977
|
-
align:
|
|
5977
|
+
align: I,
|
|
5978
5978
|
color: v,
|
|
5979
5979
|
strokeColor: S,
|
|
5980
5980
|
strokeWidth: M,
|
|
5981
|
-
opacity:
|
|
5981
|
+
opacity: C,
|
|
5982
5982
|
backgroundColor: O,
|
|
5983
5983
|
backgroundOpacity: L,
|
|
5984
5984
|
paddingTop: U,
|
|
@@ -5989,7 +5989,7 @@ class rt {
|
|
|
5989
5989
|
radiusTopRight: x,
|
|
5990
5990
|
radiusBottomRight: B,
|
|
5991
5991
|
radiusBottomLeft: _
|
|
5992
|
-
} =
|
|
5992
|
+
} = Zt, D = Mt(Zt, [
|
|
5993
5993
|
"text",
|
|
5994
5994
|
"autoExpand",
|
|
5995
5995
|
"fontFamily",
|
|
@@ -6017,9 +6017,9 @@ class rt {
|
|
|
6017
6017
|
]), P = F({}, D), k = o !== void 0 ? Ls({
|
|
6018
6018
|
text: a,
|
|
6019
6019
|
range: o
|
|
6020
|
-
}) :
|
|
6020
|
+
}) : Is({ textbox: i }), V = k ? Ds({ textbox: i, range: k }) : null, H = {}, q = {}, tt = {};
|
|
6021
6021
|
let at, gt;
|
|
6022
|
-
const
|
|
6022
|
+
const At = Ts({ textbox: i, range: k }), dt = !k || At, ht = !k;
|
|
6023
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) {
|
|
6024
6024
|
const Q = b ? "bold" : "normal";
|
|
6025
6025
|
k && (H.fontWeight = Q), dt && (P.fontWeight = Q, ht && (tt.fontWeight = Q));
|
|
@@ -6028,38 +6028,38 @@ class rt {
|
|
|
6028
6028
|
const Q = A ? "italic" : "normal";
|
|
6029
6029
|
k && (H.fontStyle = Q), dt && (P.fontStyle = Q, ht && (tt.fontStyle = Q));
|
|
6030
6030
|
}
|
|
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))),
|
|
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 = (
|
|
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;
|
|
6033
6033
|
gt = Be({ width: Ae });
|
|
6034
|
-
const
|
|
6034
|
+
const Bt = (Rt = (Xt = S != null ? S : st) != null ? Xt : i.stroke) != null ? Rt : void 0;
|
|
6035
6035
|
at = Re({
|
|
6036
|
-
strokeColor:
|
|
6036
|
+
strokeColor: Bt,
|
|
6037
6037
|
width: gt
|
|
6038
6038
|
}), k && (H.stroke = at, H.strokeWidth = gt), dt && (P.stroke = at, P.strokeWidth = gt, ht && (tt.stroke = at, tt.strokeWidth = gt));
|
|
6039
6039
|
}
|
|
6040
|
-
|
|
6041
|
-
const
|
|
6042
|
-
if (
|
|
6043
|
-
const Q =
|
|
6044
|
-
P.text = Q, i.textCaseRaw =
|
|
6045
|
-
} else i.textCaseRaw === void 0 && (i.textCaseRaw =
|
|
6046
|
-
i.uppercase =
|
|
6047
|
-
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;
|
|
6048
6048
|
if (k) {
|
|
6049
6049
|
const Q = je({ textbox: i, styles: H, range: k }), st = V ? je({ textbox: i, styles: q, range: V }) : !1;
|
|
6050
|
-
|
|
6050
|
+
pt = Q || st;
|
|
6051
6051
|
} else if (Object.keys(tt).length) {
|
|
6052
|
-
const Q =
|
|
6053
|
-
Q && (
|
|
6052
|
+
const Q = Cs({ textbox: i });
|
|
6053
|
+
Q && (pt = je({ textbox: i, styles: tt, range: Q }));
|
|
6054
6054
|
}
|
|
6055
|
-
const se =
|
|
6055
|
+
const se = pt && mn({
|
|
6056
6056
|
stylesList: [
|
|
6057
6057
|
H,
|
|
6058
6058
|
q,
|
|
6059
6059
|
tt
|
|
6060
6060
|
]
|
|
6061
6061
|
});
|
|
6062
|
-
if (
|
|
6062
|
+
if (pt && (i.dirty = !0), V && (g !== void 0 || y !== void 0)) {
|
|
6063
6063
|
const Q = xs({
|
|
6064
6064
|
textbox: i,
|
|
6065
6065
|
range: V
|
|
@@ -6082,20 +6082,20 @@ class rt {
|
|
|
6082
6082
|
});
|
|
6083
6083
|
}
|
|
6084
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);
|
|
6085
|
-
const
|
|
6085
|
+
const Et = mn({
|
|
6086
6086
|
stylesList: [
|
|
6087
6087
|
P,
|
|
6088
6088
|
H,
|
|
6089
6089
|
q,
|
|
6090
6090
|
tt
|
|
6091
6091
|
]
|
|
6092
|
-
}), { autoExpand:
|
|
6093
|
-
ie ? i.autoExpand = m !== !1 :
|
|
6094
|
-
const ae = Object.prototype.hasOwnProperty.call(P, "width"), re = oe && !ae && (
|
|
6095
|
-
let
|
|
6096
|
-
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, {
|
|
6097
6097
|
anchor: f
|
|
6098
|
-
}),
|
|
6098
|
+
}), kt && (i.dirty = !0)), (kt ? !1 : Ot({ textbox: i })) && (i.dirty = !0), i.setCoords(), s || c.requestRenderAll(), r.resumeHistory(), n || r.saveState();
|
|
6099
6099
|
const ce = rt._getSnapshot(i);
|
|
6100
6100
|
return c.fire("editor:text-updated", {
|
|
6101
6101
|
textbox: i,
|
|
@@ -6117,7 +6117,7 @@ class rt {
|
|
|
6117
6117
|
*/
|
|
6118
6118
|
// eslint-disable-next-line class-methods-use-this
|
|
6119
6119
|
stylesFromArray(t, e) {
|
|
6120
|
-
return
|
|
6120
|
+
return vt.stylesFromArray(t, e);
|
|
6121
6121
|
}
|
|
6122
6122
|
/**
|
|
6123
6123
|
* Уничтожает менеджер и снимает слушатели.
|
|
@@ -6218,15 +6218,15 @@ class rt {
|
|
|
6218
6218
|
b = D, A = !0, w = !0;
|
|
6219
6219
|
}
|
|
6220
6220
|
}
|
|
6221
|
-
let
|
|
6221
|
+
let I = null;
|
|
6222
6222
|
if (l && typeof c == "number") {
|
|
6223
6223
|
const j = t.get2DCursorLocation(c), { lineIndex: R } = j;
|
|
6224
|
-
Number.isFinite(R) && (
|
|
6224
|
+
Number.isFinite(R) && (I = R);
|
|
6225
6225
|
}
|
|
6226
|
-
let v = s, S = !1, M = !1,
|
|
6226
|
+
let v = s, S = !1, M = !1, C, O = null;
|
|
6227
6227
|
for (let j = 0; j < p.length; j += 1) {
|
|
6228
6228
|
const R = (z = p[j]) != null ? z : "", N = b ? b[j] : void 0;
|
|
6229
|
-
if (N && (
|
|
6229
|
+
if (N && (C = N), R.length !== 0) {
|
|
6230
6230
|
if (N) {
|
|
6231
6231
|
const k = Os({
|
|
6232
6232
|
lineText: R,
|
|
@@ -6237,8 +6237,8 @@ class rt {
|
|
|
6237
6237
|
}
|
|
6238
6238
|
continue;
|
|
6239
6239
|
}
|
|
6240
|
-
const B = N != null ? N :
|
|
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,
|
|
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 = _);
|
|
6242
6242
|
const D = {};
|
|
6243
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);
|
|
6244
6244
|
const P = Object.keys(D).length > 0;
|
|
@@ -6262,15 +6262,15 @@ class rt {
|
|
|
6262
6262
|
* но не шире монтажной области, и удерживает объект в её пределах.
|
|
6263
6263
|
*/
|
|
6264
6264
|
_autoExpandTextboxWidth(t, { anchor: e } = {}) {
|
|
6265
|
-
var
|
|
6265
|
+
var I, v, S, M, C, O, L, U, z, j, R, N, x;
|
|
6266
6266
|
const { montageArea: n } = this.editor;
|
|
6267
6267
|
if (!n) return !1;
|
|
6268
6268
|
const s = typeof t.text == "string" ? t.text : "";
|
|
6269
6269
|
if (!s.length) return !1;
|
|
6270
6270
|
n.setCoords();
|
|
6271
|
-
const o = n.getBoundingRect(!1, !0), i = (
|
|
6271
|
+
const o = n.getBoundingRect(!1, !0), i = (I = o.width) != null ? I : 0;
|
|
6272
6272
|
if (!Number.isFinite(i) || i <= 0) return !1;
|
|
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((
|
|
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(
|
|
6274
6274
|
1,
|
|
6275
6275
|
i / c - l - d - u
|
|
6276
6276
|
);
|
|
@@ -6286,7 +6286,7 @@ class rt {
|
|
|
6286
6286
|
f,
|
|
6287
6287
|
Math.max(b, A)
|
|
6288
6288
|
);
|
|
6289
|
-
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);
|
|
6290
6290
|
const E = zs({
|
|
6291
6291
|
textbox: t,
|
|
6292
6292
|
montageLeft: (N = o.left) != null ? N : 0,
|
|
@@ -6373,11 +6373,11 @@ class rt {
|
|
|
6373
6373
|
backgroundOpacity: w,
|
|
6374
6374
|
paddingTop: T,
|
|
6375
6375
|
paddingRight: E,
|
|
6376
|
-
paddingBottom:
|
|
6376
|
+
paddingBottom: I,
|
|
6377
6377
|
paddingLeft: v,
|
|
6378
6378
|
radiusTopLeft: S,
|
|
6379
6379
|
radiusTopRight: M,
|
|
6380
|
-
radiusBottomRight:
|
|
6380
|
+
radiusBottomRight: C,
|
|
6381
6381
|
radiusBottomLeft: O,
|
|
6382
6382
|
left: L,
|
|
6383
6383
|
top: U,
|
|
@@ -6411,11 +6411,11 @@ class rt {
|
|
|
6411
6411
|
backgroundOpacity: w,
|
|
6412
6412
|
paddingTop: T,
|
|
6413
6413
|
paddingRight: E,
|
|
6414
|
-
paddingBottom:
|
|
6414
|
+
paddingBottom: I,
|
|
6415
6415
|
paddingLeft: v,
|
|
6416
6416
|
radiusTopLeft: S,
|
|
6417
6417
|
radiusTopRight: M,
|
|
6418
|
-
radiusBottomRight:
|
|
6418
|
+
radiusBottomRight: C,
|
|
6419
6419
|
radiusBottomLeft: O,
|
|
6420
6420
|
left: L,
|
|
6421
6421
|
top: U,
|
|
@@ -6510,7 +6510,7 @@ const fe = ({
|
|
|
6510
6510
|
} catch (n) {
|
|
6511
6511
|
return null;
|
|
6512
6512
|
}
|
|
6513
|
-
},
|
|
6513
|
+
}, mt = ({
|
|
6514
6514
|
object: h
|
|
6515
6515
|
}) => {
|
|
6516
6516
|
if (!h) return null;
|
|
@@ -6574,7 +6574,7 @@ const fe = ({
|
|
|
6574
6574
|
};
|
|
6575
6575
|
}
|
|
6576
6576
|
return null;
|
|
6577
|
-
},
|
|
6577
|
+
}, Jt = "_templateCenterX", Ce = "_templateCenterY", pe = "_templateAnchorX", Te = "_templateAnchorY";
|
|
6578
6578
|
class G {
|
|
6579
6579
|
constructor({ editor: t }) {
|
|
6580
6580
|
this.editor = t;
|
|
@@ -6599,7 +6599,7 @@ class G {
|
|
|
6599
6599
|
return a.emitWarning({
|
|
6600
6600
|
origin: "TemplateManager",
|
|
6601
6601
|
method: "serializeSelection",
|
|
6602
|
-
code:
|
|
6602
|
+
code: _t.TEMPLATE_MANAGER.NO_OBJECTS_SELECTED,
|
|
6603
6603
|
message: "Нет объектов для сериализации шаблона"
|
|
6604
6604
|
}), null;
|
|
6605
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({
|
|
@@ -6640,7 +6640,7 @@ class G {
|
|
|
6640
6640
|
return i.emitWarning({
|
|
6641
6641
|
origin: "TemplateManager",
|
|
6642
6642
|
method: "applyTemplate",
|
|
6643
|
-
code:
|
|
6643
|
+
code: _t.TEMPLATE_MANAGER.INVALID_TEMPLATE,
|
|
6644
6644
|
message: "Шаблон не содержит объектов"
|
|
6645
6645
|
}), null;
|
|
6646
6646
|
const d = G._getBounds(s);
|
|
@@ -6648,7 +6648,7 @@ class G {
|
|
|
6648
6648
|
return i.emitWarning({
|
|
6649
6649
|
origin: "TemplateManager",
|
|
6650
6650
|
method: "applyTemplate",
|
|
6651
|
-
code:
|
|
6651
|
+
code: _t.TEMPLATE_MANAGER.INVALID_TARGET,
|
|
6652
6652
|
message: "Не удалось определить границы монтажной области"
|
|
6653
6653
|
}), null;
|
|
6654
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;
|
|
@@ -6660,7 +6660,7 @@ class G {
|
|
|
6660
6660
|
return i.emitWarning({
|
|
6661
6661
|
origin: "TemplateManager",
|
|
6662
6662
|
method: "applyTemplate",
|
|
6663
|
-
code:
|
|
6663
|
+
code: _t.TEMPLATE_MANAGER.INVALID_TEMPLATE,
|
|
6664
6664
|
message: "Не удалось создать объекты шаблона"
|
|
6665
6665
|
}), null;
|
|
6666
6666
|
const { backgroundObject: A, contentObjects: w } = G._extractBackgroundObject(b);
|
|
@@ -6694,7 +6694,7 @@ class G {
|
|
|
6694
6694
|
return i.emitError({
|
|
6695
6695
|
origin: "TemplateManager",
|
|
6696
6696
|
method: "applyTemplate",
|
|
6697
|
-
code:
|
|
6697
|
+
code: _t.TEMPLATE_MANAGER.APPLY_FAILED,
|
|
6698
6698
|
message: "Ошибка применения шаблона",
|
|
6699
6699
|
data: {
|
|
6700
6700
|
templateId: l,
|
|
@@ -6741,7 +6741,7 @@ class G {
|
|
|
6741
6741
|
if (i)
|
|
6742
6742
|
return G._restoreImageScale({ revived: i, serialized: n }), i;
|
|
6743
6743
|
}
|
|
6744
|
-
const s = yield
|
|
6744
|
+
const s = yield vt.enlivenObjects([n]), o = s == null ? void 0 : s[0];
|
|
6745
6745
|
return o ? (G._restoreImageScale({ revived: o, serialized: n }), o) : null;
|
|
6746
6746
|
})))).filter((n) => !!n);
|
|
6747
6747
|
});
|
|
@@ -6770,12 +6770,12 @@ class G {
|
|
|
6770
6770
|
naturalHeight: 0,
|
|
6771
6771
|
width: 0,
|
|
6772
6772
|
height: 0
|
|
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,
|
|
6774
|
-
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) {
|
|
6775
6775
|
c.set(O);
|
|
6776
6776
|
return;
|
|
6777
6777
|
}
|
|
6778
|
-
if (
|
|
6778
|
+
if (C === "stretch") {
|
|
6779
6779
|
const U = S ? T / m : null, z = M ? E / g : null;
|
|
6780
6780
|
U && U > 0 && (O.scaleX = U), z && z > 0 && (O.scaleY = z), c.set(O);
|
|
6781
6781
|
return;
|
|
@@ -6811,7 +6811,7 @@ class G {
|
|
|
6811
6811
|
const e = typeof t.svgMarkup == "string" ? t.svgMarkup : null;
|
|
6812
6812
|
if (!e) return null;
|
|
6813
6813
|
try {
|
|
6814
|
-
const n = yield Pn(e), s =
|
|
6814
|
+
const n = yield Pn(e), s = vt.groupSVGElements(n.objects, n.options), o = yield vt.enlivenObjectEnlivables(
|
|
6815
6815
|
G._prepareSerializableProps(t)
|
|
6816
6816
|
);
|
|
6817
6817
|
return s.set(o), s.setCoords(), s;
|
|
@@ -6876,8 +6876,8 @@ class G {
|
|
|
6876
6876
|
baseHeight: i,
|
|
6877
6877
|
useRelativePositions: r,
|
|
6878
6878
|
centerKeys: {
|
|
6879
|
-
x:
|
|
6880
|
-
y:
|
|
6879
|
+
x: Jt,
|
|
6880
|
+
y: Ce
|
|
6881
6881
|
}
|
|
6882
6882
|
}), { scaleX: u, scaleY: f } = t, p = nt({ value: u, fallback: 1 }), m = nt({ value: f, fallback: 1 }), g = G._getPositioningBounds({
|
|
6883
6883
|
bounds: n,
|
|
@@ -6897,7 +6897,7 @@ class G {
|
|
|
6897
6897
|
t.set({
|
|
6898
6898
|
scaleX: b,
|
|
6899
6899
|
scaleY: A
|
|
6900
|
-
}), 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];
|
|
6901
6901
|
}
|
|
6902
6902
|
/**
|
|
6903
6903
|
* Возвращает bounds, в которых должны позиционироваться нормализованные объекты.
|
|
@@ -6944,7 +6944,7 @@ class G {
|
|
|
6944
6944
|
meta: t,
|
|
6945
6945
|
fallback: e
|
|
6946
6946
|
}) {
|
|
6947
|
-
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"]);
|
|
6948
6948
|
return F({
|
|
6949
6949
|
baseWidth: o,
|
|
6950
6950
|
baseHeight: i
|
|
@@ -6996,16 +6996,16 @@ class G {
|
|
|
6996
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;
|
|
6997
6997
|
if (!s || !p || !r) return;
|
|
6998
6998
|
t.setCoords();
|
|
6999
|
-
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();
|
|
7000
7000
|
t.set("width", s), t.initDimensions();
|
|
7001
|
-
const
|
|
7001
|
+
const C = G._getLongestLineWidth({
|
|
7002
7002
|
textbox: t,
|
|
7003
7003
|
text: n
|
|
7004
|
-
}), O =
|
|
7004
|
+
}), O = C > p ? C + 1 : p;
|
|
7005
7005
|
t.set("width", O), t.initDimensions(), t.setPositionByOrigin(M, "center", "center"), t.setCoords();
|
|
7006
7006
|
const U = (O * u + g + y + f) / r;
|
|
7007
7007
|
let z = T;
|
|
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[
|
|
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);
|
|
7009
7009
|
}
|
|
7010
7010
|
/**
|
|
7011
7011
|
* Возвращает ширину самой длинной строки текстового объекта.
|
|
@@ -7057,7 +7057,7 @@ class G {
|
|
|
7057
7057
|
y: (w.y - r) / f
|
|
7058
7058
|
};
|
|
7059
7059
|
})(), g = (d.left - a) / u, y = (d.top - r) / f, b = g + d.width / u, A = y + d.height / f;
|
|
7060
|
-
return i[
|
|
7060
|
+
return i[Jt] = m.x, i[Ce] = m.y, i[pe] = G._detectAnchor({
|
|
7061
7061
|
center: m.x,
|
|
7062
7062
|
start: g,
|
|
7063
7063
|
end: b
|
|
@@ -7119,7 +7119,7 @@ class G {
|
|
|
7119
7119
|
n.emitWarning({
|
|
7120
7120
|
origin: "TemplateManager",
|
|
7121
7121
|
method: "applyTemplate",
|
|
7122
|
-
code:
|
|
7122
|
+
code: _t.TEMPLATE_MANAGER.APPLY_FAILED,
|
|
7123
7123
|
message: "Не удалось применить фон из шаблона",
|
|
7124
7124
|
data: o
|
|
7125
7125
|
});
|
|
@@ -7175,7 +7175,7 @@ class G {
|
|
|
7175
7175
|
*/
|
|
7176
7176
|
// eslint-disable-next-line class-methods-use-this
|
|
7177
7177
|
enlivenObjectEnlivables(t) {
|
|
7178
|
-
return
|
|
7178
|
+
return vt.enlivenObjectEnlivables(t);
|
|
7179
7179
|
}
|
|
7180
7180
|
}
|
|
7181
7181
|
const Ee = 5, An = "#3D8BF4", Ne = 1, ot = 2, jn = ({
|
|
@@ -7186,7 +7186,7 @@ const Ee = 5, An = "#3D8BF4", Ne = 1, ot = 2, jn = ({
|
|
|
7186
7186
|
}) => Math.min(t, n) - Math.max(h, e), Ze = ({
|
|
7187
7187
|
value: h,
|
|
7188
7188
|
step: t
|
|
7189
|
-
}) => Math.round(h / t) * t,
|
|
7189
|
+
}) => Math.round(h / t) * t, yt = ({
|
|
7190
7190
|
value: h,
|
|
7191
7191
|
step: t
|
|
7192
7192
|
}) => Ze({ value: h, step: t }) === h, ee = ({
|
|
@@ -7206,7 +7206,7 @@ const Ee = 5, An = "#3D8BF4", Ne = 1, ot = 2, jn = ({
|
|
|
7206
7206
|
start: e,
|
|
7207
7207
|
end: n
|
|
7208
7208
|
};
|
|
7209
|
-
},
|
|
7209
|
+
}, In = ({
|
|
7210
7210
|
items: h,
|
|
7211
7211
|
axis: t
|
|
7212
7212
|
}) => {
|
|
@@ -7254,7 +7254,7 @@ const Ee = 5, An = "#3D8BF4", Ne = 1, ot = 2, jn = ({
|
|
|
7254
7254
|
if (d - a >= 0) return r;
|
|
7255
7255
|
}
|
|
7256
7256
|
return null;
|
|
7257
|
-
},
|
|
7257
|
+
}, Cn = ({
|
|
7258
7258
|
items: h
|
|
7259
7259
|
}) => {
|
|
7260
7260
|
for (let t = 0; t < h.length; t += 1) {
|
|
@@ -7364,8 +7364,8 @@ const Ee = 5, An = "#3D8BF4", Ne = 1, ot = 2, jn = ({
|
|
|
7364
7364
|
const l = [];
|
|
7365
7365
|
for (const v of c)
|
|
7366
7366
|
l.push({ bounds: v, isActive: !1 });
|
|
7367
|
-
l.push({ bounds: h, isActive: !0 }),
|
|
7368
|
-
const d =
|
|
7367
|
+
l.push({ bounds: h, isActive: !0 }), In({ items: l, axis: "top" });
|
|
7368
|
+
const d = Cn({ items: l });
|
|
7369
7369
|
if (d === -1)
|
|
7370
7370
|
return { delta: 0, guide: null };
|
|
7371
7371
|
const u = [], f = i - o, p = Me({
|
|
@@ -7380,14 +7380,14 @@ const Ee = 5, An = "#3D8BF4", Ne = 1, ot = 2, jn = ({
|
|
|
7380
7380
|
direction: "next"
|
|
7381
7381
|
}), g = p === null ? null : l[p], y = m === null ? null : l[m];
|
|
7382
7382
|
if (g && y) {
|
|
7383
|
-
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;
|
|
7384
7384
|
if (L >= 0) {
|
|
7385
7385
|
const U = L / 2;
|
|
7386
|
-
if (
|
|
7387
|
-
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);
|
|
7388
7388
|
if (_ <= e) {
|
|
7389
7389
|
const D = j - R;
|
|
7390
|
-
if (
|
|
7390
|
+
if (yt({ value: D, step: ot })) {
|
|
7391
7391
|
const k = i + D, V = {
|
|
7392
7392
|
type: "vertical",
|
|
7393
7393
|
axis: s,
|
|
@@ -7419,20 +7419,20 @@ const Ee = 5, An = "#3D8BF4", Ne = 1, ot = 2, jn = ({
|
|
|
7419
7419
|
const {
|
|
7420
7420
|
beforeIndex: S,
|
|
7421
7421
|
afterIndex: M,
|
|
7422
|
-
start:
|
|
7422
|
+
start: C,
|
|
7423
7423
|
end: O,
|
|
7424
7424
|
distance: L
|
|
7425
7425
|
} = v;
|
|
7426
|
-
if (!(S === d || M === d || !
|
|
7426
|
+
if (!(S === d || M === d || !yt({ value: L, step: ot }))) {
|
|
7427
7427
|
if (A !== null && T) {
|
|
7428
7428
|
const z = Math.abs(A - L);
|
|
7429
7429
|
if (z <= e) {
|
|
7430
7430
|
const j = L - A;
|
|
7431
|
-
if (!
|
|
7431
|
+
if (!yt({ value: j, step: ot })) continue;
|
|
7432
7432
|
const N = o + j, { bottom: x } = T, B = {
|
|
7433
7433
|
type: "vertical",
|
|
7434
7434
|
axis: s,
|
|
7435
|
-
refStart:
|
|
7435
|
+
refStart: C,
|
|
7436
7436
|
refEnd: O,
|
|
7437
7437
|
activeStart: x,
|
|
7438
7438
|
activeEnd: N,
|
|
@@ -7445,11 +7445,11 @@ const Ee = 5, An = "#3D8BF4", Ne = 1, ot = 2, jn = ({
|
|
|
7445
7445
|
const z = Math.abs(w - L);
|
|
7446
7446
|
if (z <= e) {
|
|
7447
7447
|
const j = w - L;
|
|
7448
|
-
if (!
|
|
7448
|
+
if (!yt({ value: j, step: ot })) continue;
|
|
7449
7449
|
const N = i + j, { top: x } = E, B = {
|
|
7450
7450
|
type: "vertical",
|
|
7451
7451
|
axis: s,
|
|
7452
|
-
refStart:
|
|
7452
|
+
refStart: C,
|
|
7453
7453
|
refEnd: O,
|
|
7454
7454
|
activeStart: N,
|
|
7455
7455
|
activeEnd: x,
|
|
@@ -7462,14 +7462,14 @@ const Ee = 5, An = "#3D8BF4", Ne = 1, ot = 2, jn = ({
|
|
|
7462
7462
|
}
|
|
7463
7463
|
if (!u.length)
|
|
7464
7464
|
return { delta: 0, guide: null };
|
|
7465
|
-
let
|
|
7465
|
+
let I = u[0];
|
|
7466
7466
|
for (let v = 1; v < u.length; v += 1) {
|
|
7467
7467
|
const S = u[v];
|
|
7468
|
-
S.diff <
|
|
7468
|
+
S.diff < I.diff && (I = S);
|
|
7469
7469
|
}
|
|
7470
7470
|
return {
|
|
7471
|
-
delta:
|
|
7472
|
-
guide:
|
|
7471
|
+
delta: I.delta,
|
|
7472
|
+
guide: I.guide
|
|
7473
7473
|
};
|
|
7474
7474
|
}, Vs = ({
|
|
7475
7475
|
activeBounds: h,
|
|
@@ -7501,8 +7501,8 @@ const Ee = 5, An = "#3D8BF4", Ne = 1, ot = 2, jn = ({
|
|
|
7501
7501
|
const l = [];
|
|
7502
7502
|
for (const v of c)
|
|
7503
7503
|
l.push({ bounds: v, isActive: !1 });
|
|
7504
|
-
l.push({ bounds: h, isActive: !0 }),
|
|
7505
|
-
const d =
|
|
7504
|
+
l.push({ bounds: h, isActive: !0 }), In({ items: l, axis: "left" });
|
|
7505
|
+
const d = Cn({ items: l });
|
|
7506
7506
|
if (d === -1)
|
|
7507
7507
|
return { delta: 0, guide: null };
|
|
7508
7508
|
const u = [], f = i - o, p = Me({
|
|
@@ -7517,14 +7517,14 @@ const Ee = 5, An = "#3D8BF4", Ne = 1, ot = 2, jn = ({
|
|
|
7517
7517
|
direction: "next"
|
|
7518
7518
|
}), g = p === null ? null : l[p], y = m === null ? null : l[m];
|
|
7519
7519
|
if (g && y) {
|
|
7520
|
-
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;
|
|
7521
7521
|
if (L >= 0) {
|
|
7522
7522
|
const U = L / 2;
|
|
7523
|
-
if (
|
|
7524
|
-
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);
|
|
7525
7525
|
if (_ <= e) {
|
|
7526
7526
|
const D = j - R;
|
|
7527
|
-
if (
|
|
7527
|
+
if (yt({ value: D, step: ot })) {
|
|
7528
7528
|
const k = i + D, V = {
|
|
7529
7529
|
type: "horizontal",
|
|
7530
7530
|
axis: s,
|
|
@@ -7556,20 +7556,20 @@ const Ee = 5, An = "#3D8BF4", Ne = 1, ot = 2, jn = ({
|
|
|
7556
7556
|
const {
|
|
7557
7557
|
beforeIndex: S,
|
|
7558
7558
|
afterIndex: M,
|
|
7559
|
-
start:
|
|
7559
|
+
start: C,
|
|
7560
7560
|
end: O,
|
|
7561
7561
|
distance: L
|
|
7562
7562
|
} = v;
|
|
7563
|
-
if (!(S === d || M === d || !
|
|
7563
|
+
if (!(S === d || M === d || !yt({ value: L, step: ot }))) {
|
|
7564
7564
|
if (A !== null && T) {
|
|
7565
7565
|
const z = Math.abs(A - L);
|
|
7566
7566
|
if (z <= e) {
|
|
7567
7567
|
const j = L - A;
|
|
7568
|
-
if (!
|
|
7568
|
+
if (!yt({ value: j, step: ot })) continue;
|
|
7569
7569
|
const N = o + j, { right: x } = T, B = {
|
|
7570
7570
|
type: "horizontal",
|
|
7571
7571
|
axis: s,
|
|
7572
|
-
refStart:
|
|
7572
|
+
refStart: C,
|
|
7573
7573
|
refEnd: O,
|
|
7574
7574
|
activeStart: x,
|
|
7575
7575
|
activeEnd: N,
|
|
@@ -7582,11 +7582,11 @@ const Ee = 5, An = "#3D8BF4", Ne = 1, ot = 2, jn = ({
|
|
|
7582
7582
|
const z = Math.abs(w - L);
|
|
7583
7583
|
if (z <= e) {
|
|
7584
7584
|
const j = w - L;
|
|
7585
|
-
if (!
|
|
7585
|
+
if (!yt({ value: j, step: ot })) continue;
|
|
7586
7586
|
const N = i + j, { left: x } = E, B = {
|
|
7587
7587
|
type: "horizontal",
|
|
7588
7588
|
axis: s,
|
|
7589
|
-
refStart:
|
|
7589
|
+
refStart: C,
|
|
7590
7590
|
refEnd: O,
|
|
7591
7591
|
activeStart: N,
|
|
7592
7592
|
activeEnd: x,
|
|
@@ -7599,14 +7599,14 @@ const Ee = 5, An = "#3D8BF4", Ne = 1, ot = 2, jn = ({
|
|
|
7599
7599
|
}
|
|
7600
7600
|
if (!u.length)
|
|
7601
7601
|
return { delta: 0, guide: null };
|
|
7602
|
-
let
|
|
7602
|
+
let I = u[0];
|
|
7603
7603
|
for (let v = 1; v < u.length; v += 1) {
|
|
7604
7604
|
const S = u[v];
|
|
7605
|
-
S.diff <
|
|
7605
|
+
S.diff < I.diff && (I = S);
|
|
7606
7606
|
}
|
|
7607
7607
|
return {
|
|
7608
|
-
delta:
|
|
7609
|
-
guide:
|
|
7608
|
+
delta: I.delta,
|
|
7609
|
+
guide: I.guide
|
|
7610
7610
|
};
|
|
7611
7611
|
}, Xs = ({
|
|
7612
7612
|
activeBounds: h,
|
|
@@ -7659,12 +7659,12 @@ const Ee = 5, An = "#3D8BF4", Ne = 1, ot = 2, jn = ({
|
|
|
7659
7659
|
}) => {
|
|
7660
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;
|
|
7661
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";
|
|
7662
|
-
const
|
|
7662
|
+
const I = h.measureText(o).width + y * 2, v = g + y * 2, S = w - I / 2, M = T - v / 2;
|
|
7663
7663
|
h.beginPath(), Ks({
|
|
7664
7664
|
context: h,
|
|
7665
7665
|
x: S,
|
|
7666
7666
|
y: M,
|
|
7667
|
-
width:
|
|
7667
|
+
width: I,
|
|
7668
7668
|
height: v,
|
|
7669
7669
|
radius: b
|
|
7670
7670
|
}), h.fill(), h.fillStyle = r, h.fillText(o, w, T), h.restore();
|
|
@@ -7834,7 +7834,7 @@ class $ {
|
|
|
7834
7834
|
return;
|
|
7835
7835
|
}
|
|
7836
7836
|
$._applyMovementStep({ target: e }), !this.anchors.vertical.length && !this.anchors.horizontal.length && this._cacheAnchors({ activeObject: e });
|
|
7837
|
-
let o =
|
|
7837
|
+
let o = mt({ object: e });
|
|
7838
7838
|
if (!o) {
|
|
7839
7839
|
this._clearGuides();
|
|
7840
7840
|
return;
|
|
@@ -7849,9 +7849,9 @@ class $ {
|
|
|
7849
7849
|
e.set({
|
|
7850
7850
|
left: y + l,
|
|
7851
7851
|
top: b + d
|
|
7852
|
-
}), e.setCoords(), o = (m =
|
|
7852
|
+
}), e.setCoords(), o = (m = mt({ object: e })) != null ? m : o;
|
|
7853
7853
|
}
|
|
7854
|
-
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({
|
|
7855
7855
|
activeBounds: o,
|
|
7856
7856
|
candidates: f,
|
|
7857
7857
|
threshold: r,
|
|
@@ -7862,7 +7862,7 @@ class $ {
|
|
|
7862
7862
|
e.set({
|
|
7863
7863
|
left: y + p.deltaX,
|
|
7864
7864
|
top: b + p.deltaY
|
|
7865
|
-
}), e.setCoords(), o = (g =
|
|
7865
|
+
}), e.setCoords(), o = (g = mt({ object: e })) != null ? g : o;
|
|
7866
7866
|
}
|
|
7867
7867
|
this._applyGuides({
|
|
7868
7868
|
guides: u,
|
|
@@ -7896,7 +7896,7 @@ class $ {
|
|
|
7896
7896
|
horizontal: d
|
|
7897
7897
|
} = c;
|
|
7898
7898
|
!l.length && !d.length && this._cacheAnchors({ activeObject: e });
|
|
7899
|
-
const u =
|
|
7899
|
+
const u = mt({ object: e });
|
|
7900
7900
|
if (!u) {
|
|
7901
7901
|
this._clearGuides();
|
|
7902
7902
|
return;
|
|
@@ -7909,23 +7909,23 @@ class $ {
|
|
|
7909
7909
|
originY: A = "top",
|
|
7910
7910
|
scaleX: w = 1,
|
|
7911
7911
|
scaleY: T = 1
|
|
7912
|
-
} = e, E = g != null ? g : b,
|
|
7912
|
+
} = e, E = g != null ? g : b, I = y != null ? y : A, v = $._collectVerticalSnapCandidates({
|
|
7913
7913
|
bounds: u,
|
|
7914
7914
|
originX: E,
|
|
7915
7915
|
shouldSnapX: i
|
|
7916
7916
|
}), S = $._collectHorizontalSnapCandidates({
|
|
7917
7917
|
bounds: u,
|
|
7918
|
-
originY:
|
|
7918
|
+
originY: I,
|
|
7919
7919
|
shouldSnapY: a
|
|
7920
7920
|
}), M = $._findAxisSnapCandidate({
|
|
7921
7921
|
anchors: l,
|
|
7922
7922
|
candidates: v,
|
|
7923
7923
|
threshold: m
|
|
7924
|
-
}),
|
|
7924
|
+
}), C = $._findAxisSnapCandidate({
|
|
7925
7925
|
anchors: d,
|
|
7926
7926
|
candidates: S,
|
|
7927
7927
|
threshold: m
|
|
7928
|
-
}), { guidePosition: O } = M, { guidePosition: L } =
|
|
7928
|
+
}), { guidePosition: O } = M, { guidePosition: L } = C, U = O !== null, z = L !== null;
|
|
7929
7929
|
if (!U && !z) {
|
|
7930
7930
|
this._clearGuides();
|
|
7931
7931
|
return;
|
|
@@ -7936,9 +7936,9 @@ class $ {
|
|
|
7936
7936
|
const B = $._resolveUniformScale({
|
|
7937
7937
|
bounds: u,
|
|
7938
7938
|
originX: E,
|
|
7939
|
-
originY:
|
|
7939
|
+
originY: I,
|
|
7940
7940
|
verticalSnap: M,
|
|
7941
|
-
horizontalSnap:
|
|
7941
|
+
horizontalSnap: C
|
|
7942
7942
|
});
|
|
7943
7943
|
if (B) {
|
|
7944
7944
|
const { scaleFactor: _, guide: D } = B;
|
|
@@ -7973,8 +7973,8 @@ class $ {
|
|
|
7973
7973
|
if (z) {
|
|
7974
7974
|
const V = $._resolveDesiredHeight({
|
|
7975
7975
|
bounds: u,
|
|
7976
|
-
originY:
|
|
7977
|
-
snap:
|
|
7976
|
+
originY: I,
|
|
7977
|
+
snap: C
|
|
7978
7978
|
});
|
|
7979
7979
|
if (V !== null) {
|
|
7980
7980
|
const H = $._resolveScaleForHeight({
|
|
@@ -8000,8 +8000,8 @@ class $ {
|
|
|
8000
8000
|
return;
|
|
8001
8001
|
}
|
|
8002
8002
|
if (x) {
|
|
8003
|
-
const B = e.getRelativeCenterPoint(), _ = e.translateToOriginPoint(B, E,
|
|
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,
|
|
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());
|
|
8005
8005
|
}
|
|
8006
8006
|
this._applyGuides({
|
|
8007
8007
|
guides: j,
|
|
@@ -8035,7 +8035,7 @@ class $ {
|
|
|
8035
8035
|
horizontal: c
|
|
8036
8036
|
} = a;
|
|
8037
8037
|
!r.length && !c.length && this._cacheAnchors({ activeObject: t });
|
|
8038
|
-
const l =
|
|
8038
|
+
const l = mt({ object: t });
|
|
8039
8039
|
if (!l) {
|
|
8040
8040
|
this._clearGuides();
|
|
8041
8041
|
return;
|
|
@@ -8056,18 +8056,18 @@ class $ {
|
|
|
8056
8056
|
this._clearGuides();
|
|
8057
8057
|
return;
|
|
8058
8058
|
}
|
|
8059
|
-
const
|
|
8059
|
+
const I = $._resolveDesiredWidth({
|
|
8060
8060
|
bounds: l,
|
|
8061
8061
|
originX: b,
|
|
8062
8062
|
snap: T
|
|
8063
8063
|
});
|
|
8064
|
-
if (
|
|
8064
|
+
if (I === null) {
|
|
8065
8065
|
this._clearGuides();
|
|
8066
8066
|
return;
|
|
8067
8067
|
}
|
|
8068
8068
|
const v = $._resolveTextWidthForBounds({
|
|
8069
8069
|
target: t,
|
|
8070
|
-
boundsWidth:
|
|
8070
|
+
boundsWidth: I
|
|
8071
8071
|
});
|
|
8072
8072
|
if (v === null) {
|
|
8073
8073
|
this._clearGuides();
|
|
@@ -8075,8 +8075,8 @@ class $ {
|
|
|
8075
8075
|
}
|
|
8076
8076
|
const { width: S = 0 } = t;
|
|
8077
8077
|
if (v !== S) {
|
|
8078
|
-
const M = t.getRelativeCenterPoint(),
|
|
8079
|
-
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();
|
|
8080
8080
|
}
|
|
8081
8081
|
this._applyGuides({
|
|
8082
8082
|
guides: [
|
|
@@ -8410,10 +8410,10 @@ class $ {
|
|
|
8410
8410
|
_cacheAnchors({ activeObject: t }) {
|
|
8411
8411
|
const e = this._collectTargets({ activeObject: t }), n = { vertical: [], horizontal: [] }, s = [];
|
|
8412
8412
|
for (const a of e) {
|
|
8413
|
-
const r =
|
|
8413
|
+
const r = mt({ object: a });
|
|
8414
8414
|
r && (vn({ anchors: n, bounds: r }), s.push(r));
|
|
8415
8415
|
}
|
|
8416
|
-
const { montageArea: o } = this.editor, i =
|
|
8416
|
+
const { montageArea: o } = this.editor, i = mt({ object: o });
|
|
8417
8417
|
if (i) {
|
|
8418
8418
|
vn({ anchors: n, bounds: i });
|
|
8419
8419
|
const { left: a, right: r, top: c, bottom: l } = i;
|
|
@@ -8457,7 +8457,7 @@ class $ {
|
|
|
8457
8457
|
}
|
|
8458
8458
|
}
|
|
8459
8459
|
const Mn = "#3D8BF4", Sn = 1;
|
|
8460
|
-
class
|
|
8460
|
+
class Ut {
|
|
8461
8461
|
/**
|
|
8462
8462
|
* Создаёт менеджер измерений и инициализирует события.
|
|
8463
8463
|
*/
|
|
@@ -8562,15 +8562,15 @@ class Wt {
|
|
|
8562
8562
|
this._clearGuides();
|
|
8563
8563
|
return;
|
|
8564
8564
|
}
|
|
8565
|
-
const o =
|
|
8565
|
+
const o = mt({ object: s });
|
|
8566
8566
|
if (!o) {
|
|
8567
8567
|
this._clearGuides();
|
|
8568
8568
|
return;
|
|
8569
8569
|
}
|
|
8570
|
-
const i =
|
|
8570
|
+
const i = Ut._resolveTarget({
|
|
8571
8571
|
event: t,
|
|
8572
8572
|
activeObject: s
|
|
8573
|
-
}), { 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 });
|
|
8574
8574
|
if (!l) {
|
|
8575
8575
|
this._clearGuides();
|
|
8576
8576
|
return;
|
|
@@ -8579,7 +8579,7 @@ class Wt {
|
|
|
8579
8579
|
this._clearGuides();
|
|
8580
8580
|
return;
|
|
8581
8581
|
}
|
|
8582
|
-
const u =
|
|
8582
|
+
const u = Ut._buildGuides({
|
|
8583
8583
|
activeBounds: o,
|
|
8584
8584
|
targetBounds: l,
|
|
8585
8585
|
targetIsMontageArea: c
|
|
@@ -8608,11 +8608,11 @@ class Wt {
|
|
|
8608
8608
|
targetBounds: e,
|
|
8609
8609
|
targetIsMontageArea: n
|
|
8610
8610
|
}) {
|
|
8611
|
-
const s =
|
|
8611
|
+
const s = Ut._buildHorizontalGuides({
|
|
8612
8612
|
activeBounds: t,
|
|
8613
8613
|
targetBounds: e,
|
|
8614
8614
|
targetIsMontageArea: n
|
|
8615
|
-
}), o =
|
|
8615
|
+
}), o = Ut._buildVerticalGuides({
|
|
8616
8616
|
activeBounds: t,
|
|
8617
8617
|
targetBounds: e,
|
|
8618
8618
|
targetIsMontageArea: n
|
|
@@ -8642,34 +8642,34 @@ class Wt {
|
|
|
8642
8642
|
} = e, m = Math.max(a, u), g = Math.min(r, f), b = g >= m ? (m + g) / 2 : (c + p) / 2;
|
|
8643
8643
|
if (l >= i) {
|
|
8644
8644
|
if (n) return s;
|
|
8645
|
-
const
|
|
8646
|
-
return
|
|
8645
|
+
const C = l - i;
|
|
8646
|
+
return C > 0 && s.push({
|
|
8647
8647
|
type: "horizontal",
|
|
8648
8648
|
axis: b,
|
|
8649
8649
|
start: i,
|
|
8650
8650
|
end: l,
|
|
8651
|
-
distance:
|
|
8651
|
+
distance: C
|
|
8652
8652
|
}), s;
|
|
8653
8653
|
}
|
|
8654
8654
|
if (d <= o) {
|
|
8655
8655
|
if (n) return s;
|
|
8656
|
-
const
|
|
8657
|
-
return
|
|
8656
|
+
const C = o - d;
|
|
8657
|
+
return C > 0 && s.push({
|
|
8658
8658
|
type: "horizontal",
|
|
8659
8659
|
axis: b,
|
|
8660
8660
|
start: d,
|
|
8661
8661
|
end: o,
|
|
8662
|
-
distance:
|
|
8662
|
+
distance: C
|
|
8663
8663
|
}), s;
|
|
8664
8664
|
}
|
|
8665
8665
|
if (!n) return s;
|
|
8666
|
-
const A = o < l, w = i > d, T = Math.min(o, l), E = Math.max(o, l),
|
|
8667
|
-
|
|
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({
|
|
8668
8668
|
type: "horizontal",
|
|
8669
8669
|
axis: b,
|
|
8670
8670
|
start: T,
|
|
8671
8671
|
end: E,
|
|
8672
|
-
distance:
|
|
8672
|
+
distance: I
|
|
8673
8673
|
});
|
|
8674
8674
|
const v = Math.min(i, d), S = Math.max(i, d), M = S - v;
|
|
8675
8675
|
return M > 0 && !w && s.push({
|
|
@@ -8703,34 +8703,34 @@ class Wt {
|
|
|
8703
8703
|
} = e, m = Math.max(a, u), g = Math.min(r, f), b = g >= m ? (m + g) / 2 : (c + p) / 2;
|
|
8704
8704
|
if (l >= i) {
|
|
8705
8705
|
if (n) return s;
|
|
8706
|
-
const
|
|
8707
|
-
return
|
|
8706
|
+
const C = l - i;
|
|
8707
|
+
return C > 0 && s.push({
|
|
8708
8708
|
type: "vertical",
|
|
8709
8709
|
axis: b,
|
|
8710
8710
|
start: i,
|
|
8711
8711
|
end: l,
|
|
8712
|
-
distance:
|
|
8712
|
+
distance: C
|
|
8713
8713
|
}), s;
|
|
8714
8714
|
}
|
|
8715
8715
|
if (d <= o) {
|
|
8716
8716
|
if (n) return s;
|
|
8717
|
-
const
|
|
8718
|
-
return
|
|
8717
|
+
const C = o - d;
|
|
8718
|
+
return C > 0 && s.push({
|
|
8719
8719
|
type: "vertical",
|
|
8720
8720
|
axis: b,
|
|
8721
8721
|
start: d,
|
|
8722
8722
|
end: o,
|
|
8723
|
-
distance:
|
|
8723
|
+
distance: C
|
|
8724
8724
|
}), s;
|
|
8725
8725
|
}
|
|
8726
8726
|
if (!n) return s;
|
|
8727
|
-
const A = o < l, w = i > d, T = Math.min(o, l), E = Math.max(o, l),
|
|
8728
|
-
|
|
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({
|
|
8729
8729
|
type: "vertical",
|
|
8730
8730
|
axis: b,
|
|
8731
8731
|
start: T,
|
|
8732
8732
|
end: E,
|
|
8733
|
-
distance:
|
|
8733
|
+
distance: I
|
|
8734
8734
|
});
|
|
8735
8735
|
const v = Math.min(i, d), S = Math.max(i, d), M = S - v;
|
|
8736
8736
|
return M > 0 && !w && s.push({
|
|
@@ -8834,7 +8834,7 @@ class Ge {
|
|
|
8834
8834
|
showRotationAngle: l,
|
|
8835
8835
|
_onReadyCallback: d
|
|
8836
8836
|
} = this.options;
|
|
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
|
|
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) {
|
|
8838
8838
|
this.historyManager.suspendHistory();
|
|
8839
8839
|
try {
|
|
8840
8840
|
const m = yield this.imageManager.prepareInitialState({
|
|
@@ -8847,7 +8847,7 @@ class Ge {
|
|
|
8847
8847
|
source: g,
|
|
8848
8848
|
scale: y = `image-${c}`,
|
|
8849
8849
|
withoutSave: b = !0
|
|
8850
|
-
} = f, A =
|
|
8850
|
+
} = f, A = Mt(f, [
|
|
8851
8851
|
"source",
|
|
8852
8852
|
"scale",
|
|
8853
8853
|
"withoutSave"
|
|
@@ -8869,7 +8869,7 @@ class Ge {
|
|
|
8869
8869
|
source: m,
|
|
8870
8870
|
scale: g = `image-${c}`,
|
|
8871
8871
|
withoutSave: y = !0
|
|
8872
|
-
} = p, b =
|
|
8872
|
+
} = p, b = Mt(p, [
|
|
8873
8873
|
"source",
|
|
8874
8874
|
"scale",
|
|
8875
8875
|
"withoutSave"
|