@anu3ev/fabric-image-editor 0.5.6 → 0.5.7

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.
Files changed (2) hide show
  1. package/dist/main.js +125 -125
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -35,7 +35,7 @@ var N = (h, t, e) => new Promise((s, o) => {
35
35
  }, a = (r) => r.done ? s(r.value) : Promise.resolve(r.value).then(n, i);
36
36
  a((e = e.apply(h, t)).next());
37
37
  });
38
- import { ActiveSelection as x, Textbox as nt, util as dt, controlsUtils as xe, InteractiveFabricObject as Be, Point as tt, FitContentLayout as ke, loadSVGFromURL as us, FabricImage as zt, Gradient as ze, Rect as gs, Circle as fs, Triangle as ps, Group as Et, Color as ms, classRegistry as Pe, loadSVGFromString as ys, Canvas as vs, Pattern as bs } from "fabric";
38
+ import { ActiveSelection as k, Textbox as nt, util as dt, controlsUtils as xe, InteractiveFabricObject as Be, Point as tt, FitContentLayout as ke, loadSVGFromURL as us, FabricImage as zt, Gradient as ze, Rect as gs, Circle as fs, Triangle as ps, Group as Et, Color as ms, classRegistry as Pe, loadSVGFromString as ys, Canvas as vs, Pattern as bs } from "fabric";
39
39
  import { create as Ms } from "jsondiffpatch";
40
40
  import ws from "diff-match-patch";
41
41
  var Ss = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", G = function() {
@@ -98,7 +98,7 @@ class Ut {
98
98
  if (o.length === 1)
99
99
  this.canvas.setActiveObject(o[0]);
100
100
  else {
101
- const i = new x(o, {
101
+ const i = new k(o, {
102
102
  canvas: this.canvas
103
103
  });
104
104
  this.canvas.setActiveObject(i);
@@ -106,7 +106,7 @@ class Ut {
106
106
  this.canvas.requestRenderAll();
107
107
  return;
108
108
  }
109
- const n = new x(t, {
109
+ const n = new k(t, {
110
110
  canvas: this.canvas
111
111
  });
112
112
  this.editor.objectLockManager.lockObject({
@@ -220,7 +220,7 @@ class Ut {
220
220
  if (o || n) return;
221
221
  this.isSpacePressed = !0, t.preventDefault();
222
222
  const i = e.getActiveObject() || null;
223
- i instanceof x ? this.savedSelection = i.getObjects().slice() : i && (this.savedSelection = [i]), e.discardActiveObject(), e.set({
223
+ i instanceof k ? this.savedSelection = i.getObjects().slice() : i && (this.savedSelection = [i]), e.discardActiveObject(), e.set({
224
224
  selection: !1,
225
225
  defaultCursor: "grab"
226
226
  }), e.setCursor("grab"), s.canvasManager.getObjects().forEach((a) => {
@@ -259,7 +259,7 @@ class Ut {
259
259
  e.setActiveObject(t[0]);
260
260
  return;
261
261
  }
262
- const o = t.filter((i) => s.canvasManager.getObjects().includes(i)), n = new x(o, { canvas: e });
262
+ const o = t.filter((i) => s.canvasManager.getObjects().includes(i)), n = new k(o, { canvas: e });
263
263
  e.setActiveObject(n);
264
264
  }
265
265
  // --- Обработчики для событий canvas (Fabric) ---
@@ -589,7 +589,7 @@ class J {
589
589
  * Обновляет алгоритм расчёта границ ActiveSelection, чтобы учитывать фон и отступы текстовых объектов.
590
590
  */
591
591
  static patchActiveSelectionBounds() {
592
- const t = x.prototype, e = t._calcBoundsFromObjects;
592
+ const t = k.prototype, e = t._calcBoundsFromObjects;
593
593
  t._calcBoundsFromObjects = function(...n) {
594
594
  var g, f;
595
595
  const i = (f = (g = this.getObjects) == null ? void 0 : g.call(this)) != null ? f : [];
@@ -635,7 +635,7 @@ class J {
635
635
  const { target: a, type: r, overrides: c } = i;
636
636
  if (r === "imperative" && c)
637
637
  return c;
638
- if (!(a instanceof x))
638
+ if (!(a instanceof k))
639
639
  return o.call(this, n, i);
640
640
  J.applyTextSelectionScalingLock({
641
641
  selection: a,
@@ -677,16 +677,16 @@ class J {
677
677
  selection: t,
678
678
  objects: e
679
679
  }) {
680
- const s = e.some((i) => i instanceof nt), o = t instanceof x && e.length > 1, n = s && o;
680
+ const s = e.some((o) => o instanceof nt);
681
681
  t.setControlsVisibility({
682
682
  mt: !s,
683
683
  mb: !s,
684
- ml: !n,
685
- mr: !n
684
+ ml: !0,
685
+ mr: !0
686
686
  });
687
687
  }
688
688
  }
689
- const k = class k {
689
+ const B = class B {
690
690
  constructor(t = []) {
691
691
  this.fonts = t;
692
692
  }
@@ -700,7 +700,7 @@ const k = class k {
700
700
  if (!t.length) return;
701
701
  const e = typeof document != "undefined" ? document : void 0;
702
702
  if (!e) return;
703
- const s = t.map((n) => k.loadFont(n, e));
703
+ const s = t.map((n) => B.loadFont(n, e));
704
704
  yield Promise.allSettled(s);
705
705
  });
706
706
  }
@@ -709,21 +709,21 @@ const k = class k {
709
709
  var c, d;
710
710
  const s = typeof FontFace != "undefined", o = (c = t.family) == null ? void 0 : c.trim(), n = (d = t.source) == null ? void 0 : d.trim();
711
711
  if (!o || !n) return;
712
- const i = k.normalizeFontSource(n), a = k.getDescriptorSnapshot(t.descriptors), r = k.getFontRegistrationKey(o, i, a);
713
- if (!k.registeredFontKeys.has(r)) {
714
- if (k.isFontFaceAlreadyApplied(e, o, a)) {
715
- k.registeredFontKeys.add(r);
712
+ const i = B.normalizeFontSource(n), a = B.getDescriptorSnapshot(t.descriptors), r = B.getFontRegistrationKey(o, i, a);
713
+ if (!B.registeredFontKeys.has(r)) {
714
+ if (B.isFontFaceAlreadyApplied(e, o, a)) {
715
+ B.registeredFontKeys.add(r);
716
716
  return;
717
717
  }
718
718
  if (s && e.fonts && typeof e.fonts.add == "function")
719
719
  try {
720
720
  const u = yield new FontFace(o, i, t.descriptors).load();
721
- e.fonts.add(u), k.registeredFontKeys.add(r);
721
+ e.fonts.add(u), B.registeredFontKeys.add(r);
722
722
  return;
723
723
  } catch (l) {
724
724
  console.warn(`Не удалось загрузить шрифт "${o}" через FontFace API`, l);
725
725
  }
726
- k.injectFontFace({
726
+ B.injectFontFace({
727
727
  font: t,
728
728
  source: i,
729
729
  doc: e,
@@ -743,15 +743,15 @@ const k = class k {
743
743
  if (!i) return;
744
744
  const a = s.createElement("style");
745
745
  a.setAttribute("data-editor-font", i), a.setAttribute("data-editor-font-key", o);
746
- const r = k.descriptorsToCss(n), c = [
746
+ const r = B.descriptorsToCss(n), c = [
747
747
  "@font-face {",
748
- ` font-family: ${k.formatFontFamilyForCss(i)};`,
748
+ ` font-family: ${B.formatFontFamilyForCss(i)};`,
749
749
  ` src: ${e};`,
750
750
  ...r.map((l) => ` ${l}`),
751
751
  "}"
752
752
  ];
753
753
  a.textContent = c.join(`
754
- `), s.head.appendChild(a), k.registeredFontKeys.add(o);
754
+ `), s.head.appendChild(a), B.registeredFontKeys.add(o);
755
755
  }
756
756
  static normalizeFontSource(t) {
757
757
  const e = t.trim();
@@ -774,15 +774,15 @@ const k = class k {
774
774
  return t ? t.trim().replace(/^['"]+|['"]+$/g, "").toLowerCase() : "";
775
775
  }
776
776
  static getDescriptorSnapshot(t) {
777
- const e = k.descriptorDefaults;
777
+ const e = B.descriptorDefaults;
778
778
  return {
779
- style: k.normalizeDescriptorValue(t == null ? void 0 : t.style, e.style),
780
- weight: k.normalizeDescriptorValue(t == null ? void 0 : t.weight, e.weight),
781
- stretch: k.normalizeDescriptorValue(t == null ? void 0 : t.stretch, e.stretch),
782
- unicodeRange: k.normalizeDescriptorValue(t == null ? void 0 : t.unicodeRange, e.unicodeRange),
783
- variant: k.normalizeDescriptorValue(t == null ? void 0 : t.variant, e.variant),
784
- featureSettings: k.normalizeDescriptorValue(t == null ? void 0 : t.featureSettings, e.featureSettings),
785
- display: k.normalizeDescriptorValue(t == null ? void 0 : t.display, e.display)
779
+ style: B.normalizeDescriptorValue(t == null ? void 0 : t.style, e.style),
780
+ weight: B.normalizeDescriptorValue(t == null ? void 0 : t.weight, e.weight),
781
+ stretch: B.normalizeDescriptorValue(t == null ? void 0 : t.stretch, e.stretch),
782
+ unicodeRange: B.normalizeDescriptorValue(t == null ? void 0 : t.unicodeRange, e.unicodeRange),
783
+ variant: B.normalizeDescriptorValue(t == null ? void 0 : t.variant, e.variant),
784
+ featureSettings: B.normalizeDescriptorValue(t == null ? void 0 : t.featureSettings, e.featureSettings),
785
+ display: B.normalizeDescriptorValue(t == null ? void 0 : t.display, e.display)
786
786
  };
787
787
  }
788
788
  static areDescriptorSnapshotsEqual(t, e) {
@@ -790,7 +790,7 @@ const k = class k {
790
790
  }
791
791
  static getFontRegistrationKey(t, e, s) {
792
792
  return [
793
- k.normalizeFamilyName(t),
793
+ B.normalizeFamilyName(t),
794
794
  e,
795
795
  s.style,
796
796
  s.weight,
@@ -804,12 +804,12 @@ const k = class k {
804
804
  static isFontFaceAlreadyApplied(t, e, s) {
805
805
  const o = t.fonts;
806
806
  if (!o || typeof o.forEach != "function") return !1;
807
- const n = k.normalizeFamilyName(e);
807
+ const n = B.normalizeFamilyName(e);
808
808
  let i = !1;
809
809
  try {
810
810
  o.forEach((a) => {
811
- if (i || k.normalizeFamilyName(a.family) !== n) return;
812
- const c = k.getDescriptorSnapshot({
811
+ if (i || B.normalizeFamilyName(a.family) !== n) return;
812
+ const c = B.getDescriptorSnapshot({
813
813
  style: a.style,
814
814
  weight: a.weight,
815
815
  stretch: a.stretch,
@@ -818,7 +818,7 @@ const k = class k {
818
818
  featureSettings: a.featureSettings,
819
819
  display: a.display
820
820
  });
821
- k.areDescriptorSnapshotsEqual(s, c) && (i = !0);
821
+ B.areDescriptorSnapshotsEqual(s, c) && (i = !0);
822
822
  });
823
823
  } catch (a) {
824
824
  return console.warn("Не удалось проверить, загружен ли шрифт ранее через FontFaceSet", a), !1;
@@ -845,7 +845,7 @@ const k = class k {
845
845
  });
846
846
  }
847
847
  };
848
- k.registeredFontKeys = /* @__PURE__ */ new Set(), k.descriptorDefaults = {
848
+ B.registeredFontKeys = /* @__PURE__ */ new Set(), B.descriptorDefaults = {
849
849
  style: "normal",
850
850
  weight: "normal",
851
851
  stretch: "normal",
@@ -854,7 +854,7 @@ k.registeredFontKeys = /* @__PURE__ */ new Set(), k.descriptorDefaults = {
854
854
  featureSettings: "normal",
855
855
  display: "auto"
856
856
  };
857
- let fe = k;
857
+ let fe = B;
858
858
  const _s = "data:image/svg+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yAwbC0zLjk3LTIuMzE2TDMuNzQgMTBaIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=", Us = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI0VDNEU0MCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNOC4xMjUgMS4yNUExLjg3NSAxLjg3NSAwIDAgMCA2LjI1IDMuMTI1di42MjVIMy4xMjVhLjYyNS42MjUgMCAwIDAgMCAxLjI1aC42MjV2MTEuMjVBMS4yNSAxLjI1IDAgMCAwIDUgMTcuNWgxMGExLjI1IDEuMjUgMCAwIDAgMS4yNS0xLjI1VjVoLjYyNWEuNjI1LjYyNSAwIDAgMCAwLTEuMjVIMTMuNzV2LS42MjVhMS44NzUgMS44NzUgMCAwIDAtMS44NzUtMS44NzVoLTMuNzVabTQuMzc1IDIuNXYtLjYyNWEuNjI1LjYyNSAwIDAgMC0uNjI1LS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDAtLjYyNS42MjV2LjYyNWg1Wk01IDE2LjI1VjVoMTB2MTEuMjVINVpNOC4xMjUgNy41Yy4zNDUgMCAuNjI1LjI4LjYyNS42MjV2NWEuNjI1LjYyNSAwIDEgMS0xLjI1IDB2LTVjMC0uMzQ1LjI4LS42MjUuNjI1LS42MjVabTQuMzc1IDUuNjI1di01YS42MjUuNjI1IDAgMCAwLTEuMjUgMHY1YS42MjUuNjI1IDAgMSAwIDEuMjUgMFoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==", Pt = {
859
859
  style: {
860
860
  position: "absolute",
@@ -1100,7 +1100,7 @@ const Fs = {
1100
1100
  "pointer-events": "none",
1101
1101
  "white-space": "nowrap",
1102
1102
  "box-shadow": "0 2px 8px rgba(0, 0, 0, 0.2)"
1103
- }, Fe = 16, He = 16, Hs = "fabric-editor-angle-indicator";
1103
+ }, Fe = 16, We = 16, Ws = "fabric-editor-angle-indicator";
1104
1104
  class Me {
1105
1105
  constructor({ editor: t }) {
1106
1106
  this.isActive = !1, this.currentAngle = 0, this.editor = t, this.canvas = t.canvas, this.options = t.options, this._createDOM(), this._bindEvents();
@@ -1109,7 +1109,7 @@ class Me {
1109
1109
  * Создание DOM-элемента индикатора
1110
1110
  */
1111
1111
  _createDOM() {
1112
- this.el = document.createElement("div"), this.el.className = Hs, Object.entries(Fs).forEach(([t, e]) => {
1112
+ this.el = document.createElement("div"), this.el.className = Ws, Object.entries(Fs).forEach(([t, e]) => {
1113
1113
  this.el.style.setProperty(t, e);
1114
1114
  }), this.canvas.wrapperEl.appendChild(this.el);
1115
1115
  }
@@ -1160,9 +1160,9 @@ class Me {
1160
1160
  */
1161
1161
  _positionIndicator(t) {
1162
1162
  const e = this.canvas.wrapperEl.getBoundingClientRect();
1163
- let s = t.clientX - e.left + Fe, o = t.clientY - e.top + He;
1163
+ let s = t.clientX - e.left + Fe, o = t.clientY - e.top + We;
1164
1164
  const n = this.el.getBoundingClientRect(), i = n.width, a = n.height;
1165
- s + i > e.width && (s = t.clientX - e.left - i - Fe), o + a > e.height && (o = t.clientY - e.top - a - He), this.el.style.left = `${s}px`, this.el.style.top = `${o}px`;
1165
+ s + i > e.width && (s = t.clientX - e.left - i - Fe), o + a > e.height && (o = t.clientY - e.top - a - We), this.el.style.left = `${s}px`, this.el.style.top = `${o}px`;
1166
1166
  }
1167
1167
  /**
1168
1168
  * Показать индикатор
@@ -1496,7 +1496,7 @@ class Jt {
1496
1496
  }
1497
1497
  }
1498
1498
  }
1499
- const Ws = 0.1, Zs = 2, We = 0.1, Gs = 90, Rt = 16, _t = 16, Mt = 4096, wt = 4096, Ze = "application/image-editor:", Xt = [
1499
+ const Hs = 0.1, Zs = 2, He = 0.1, Gs = 90, Rt = 16, _t = 16, Mt = 4096, wt = 4096, Ze = "application/image-editor:", Xt = [
1500
1500
  "format",
1501
1501
  "uppercase",
1502
1502
  "textCaseRaw",
@@ -1702,7 +1702,7 @@ class ct {
1702
1702
  if (u === "svg" && I) {
1703
1703
  const S = v.toSVG();
1704
1704
  v.dispose();
1705
- const B = {
1705
+ const x = {
1706
1706
  image: ct._exportSVGStringAsFile(S, {
1707
1707
  exportAsBase64: o,
1708
1708
  exportAsBlob: n,
@@ -1712,11 +1712,11 @@ class ct {
1712
1712
  contentType: "image/svg+xml",
1713
1713
  fileName: e.replace(/\.[^/.]+$/, ".svg")
1714
1714
  };
1715
- return i.fire("editor:canvas-exported", B), B;
1715
+ return i.fire("editor:canvas-exported", x), x;
1716
1716
  }
1717
1717
  const y = yield new Promise((S, C) => {
1718
- v.getElement().toBlob((B) => {
1719
- B ? S(B) : C(new Error("Failed to create Blob from canvas"));
1718
+ v.getElement().toBlob((x) => {
1719
+ x ? S(x) : C(new Error("Failed to create Blob from canvas"));
1720
1720
  });
1721
1721
  });
1722
1722
  if (v.dispose(), n) {
@@ -1734,12 +1734,12 @@ class ct {
1734
1734
  [w]
1735
1735
  );
1736
1736
  if (d) {
1737
- const C = p * 0.264583, B = m * 0.264583, F = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, U = new F({
1738
- orientation: C > B ? "landscape" : "portrait",
1737
+ const C = p * 0.264583, x = m * 0.264583, F = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, U = new F({
1738
+ orientation: C > x ? "landscape" : "portrait",
1739
1739
  unit: "mm",
1740
- format: [C, B]
1740
+ format: [C, x]
1741
1741
  });
1742
- if (U.addImage(String(A), "JPG", 0, 0, C, B), o) {
1742
+ if (U.addImage(String(A), "JPG", 0, 0, C, x), o) {
1743
1743
  const z = {
1744
1744
  image: U.output("datauristring"),
1745
1745
  format: "pdf",
@@ -1748,8 +1748,8 @@ class ct {
1748
1748
  };
1749
1749
  return i.fire("editor:canvas-exported", z), z;
1750
1750
  }
1751
- const H = U.output("blob"), L = {
1752
- image: new File([H], e, { type: "application/pdf" }),
1751
+ const W = U.output("blob"), L = {
1752
+ image: new File([W], e, { type: "application/pdf" }),
1753
1753
  format: "pdf",
1754
1754
  contentType: "application/pdf",
1755
1755
  fileName: e
@@ -2168,7 +2168,7 @@ class Qs {
2168
2168
  if (d.length === 1)
2169
2169
  t.setActiveObject(d[0]);
2170
2170
  else {
2171
- const l = new x(d, {
2171
+ const l = new k(d, {
2172
2172
  canvas: t
2173
2173
  });
2174
2174
  t.setActiveObject(l);
@@ -2455,7 +2455,7 @@ class qs {
2455
2455
  withoutSave: s
2456
2456
  } = {}) {
2457
2457
  const { canvas: o, historyManager: n } = this.editor, i = t || o.getActiveObject();
2458
- i && (i instanceof x ? i.getObjects().forEach((a) => {
2458
+ i && (i instanceof k ? i.getObjects().forEach((a) => {
2459
2459
  a.set("opacity", e);
2460
2460
  }) : i.set("opacity", e), o.renderAll(), s || n.saveState(), o.fire("editor:object-opacity-changed", {
2461
2461
  object: i,
@@ -2482,12 +2482,12 @@ class qs {
2482
2482
  } = {}) {
2483
2483
  const { canvas: n, historyManager: i } = this.editor, a = t || n.getActiveObject();
2484
2484
  if (a) {
2485
- if (a instanceof x && !o) {
2485
+ if (a instanceof k && !o) {
2486
2486
  const r = a.getObjects();
2487
2487
  n.discardActiveObject(), r.forEach((d) => {
2488
2488
  this._fitSingleObject(d, e);
2489
2489
  });
2490
- const c = new x(r, { canvas: n });
2490
+ const c = new k(r, { canvas: n });
2491
2491
  n.setActiveObject(c);
2492
2492
  } else
2493
2493
  this._fitSingleObject(a, e);
@@ -2562,7 +2562,7 @@ class qs {
2562
2562
  }
2563
2563
  class Js {
2564
2564
  constructor({ editor: t }) {
2565
- this.editor = t, this.options = t.options, this.minZoom = this.options.minZoom || Ws, this.maxZoom = this.options.maxZoom || Zs, this.defaultZoom = this.options.defaultScale;
2565
+ this.editor = t, this.options = t.options, this.minZoom = this.options.minZoom || Hs, this.maxZoom = this.options.maxZoom || Zs, this.defaultZoom = this.options.defaultScale;
2566
2566
  }
2567
2567
  /**
2568
2568
  * Вспомогательный метод для вычисления размеров масштабированной монтажной области
@@ -2638,8 +2638,8 @@ class Js {
2638
2638
  const { canvas: i, montageArea: a } = this.editor, r = i.viewportTransform, c = i.getWidth(), d = i.getHeight(), l = t.x - r[4], u = t.y - r[5], g = Math.abs(o), f = e - s;
2639
2639
  if (Math.abs(f) / g <= 0.1)
2640
2640
  return { x: l, y: u };
2641
- const m = c / 2, v = d / 2, b = a.left, I = a.top, y = m - b * s, w = v - I * s, A = (y - r[4]) / (e - s), j = (w - r[5]) / (e - s), M = A * g, T = j * g, S = M * n, C = T * n, B = Math.abs(S) > Math.abs(l) ? l : S, F = Math.abs(C) > Math.abs(u) ? u : C;
2642
- return { x: B, y: F };
2641
+ const m = c / 2, v = d / 2, b = a.left, I = a.top, y = m - b * s, w = v - I * s, A = (y - r[4]) / (e - s), j = (w - r[5]) / (e - s), M = A * g, T = j * g, S = M * n, C = T * n, x = Math.abs(S) > Math.abs(l) ? l : S, F = Math.abs(C) > Math.abs(u) ? u : C;
2642
+ return { x, y: F };
2643
2643
  }
2644
2644
  /**
2645
2645
  * Применяет плавное центрирование viewport при приближении к defaultZoom.
@@ -2651,7 +2651,7 @@ class Js {
2651
2651
  * @returns true если центрирование было применено
2652
2652
  * @private
2653
2653
  */
2654
- _applyViewportCentering(t, e = !1, s = We) {
2654
+ _applyViewportCentering(t, e = !1, s = He) {
2655
2655
  const { canvas: o } = this.editor, n = this._getScaledMontageDimensions(t), i = o.getWidth(), a = o.getHeight(), r = n.width > i || n.height > a, c = this._calculateFitZoom(), d = t - c;
2656
2656
  if (!(!r || d) && !e)
2657
2657
  return !1;
@@ -2726,7 +2726,7 @@ class Js {
2726
2726
  * @param options.pointY - Координата Y точки зума
2727
2727
  * @fires editor:zoom-changed
2728
2728
  */
2729
- zoom(t = We, e = {}) {
2729
+ zoom(t = He, e = {}) {
2730
2730
  var g, f;
2731
2731
  if (!t) return;
2732
2732
  const { minZoom: s, maxZoom: o } = this, { canvas: n } = this.editor, i = t < 0, a = n.getZoom(), r = n.getCenterPoint(), c = (g = e.pointX) != null ? g : r.x, d = (f = e.pointY) != null ? f : r.y, l = new tt(c, d);
@@ -3171,7 +3171,7 @@ class $t {
3171
3171
  const { canvas: s, historyManager: o } = this.editor;
3172
3172
  o.suspendHistory();
3173
3173
  const n = t || s.getActiveObject();
3174
- n && (n instanceof x ? n.getObjects().forEach((i) => {
3174
+ n && (n instanceof k ? n.getObjects().forEach((i) => {
3175
3175
  s.bringObjectToFront(i);
3176
3176
  }) : s.bringObjectToFront(n), s.renderAll(), o.resumeHistory(), e || o.saveState(), s.fire("editor:object-bring-to-front", {
3177
3177
  object: n,
@@ -3189,7 +3189,7 @@ class $t {
3189
3189
  const { canvas: s, historyManager: o } = this.editor;
3190
3190
  o.suspendHistory();
3191
3191
  const n = t || s.getActiveObject();
3192
- n && (n instanceof x ? $t._moveSelectionForward(s, n) : s.bringObjectForward(n), s.renderAll(), o.resumeHistory(), e || o.saveState(), s.fire("editor:object-bring-forward", {
3192
+ n && (n instanceof k ? $t._moveSelectionForward(s, n) : s.bringObjectForward(n), s.renderAll(), o.resumeHistory(), e || o.saveState(), s.fire("editor:object-bring-forward", {
3193
3193
  object: n,
3194
3194
  withoutSave: e
3195
3195
  }));
@@ -3212,7 +3212,7 @@ class $t {
3212
3212
  n.suspendHistory();
3213
3213
  const r = t || s.getActiveObject();
3214
3214
  if (r) {
3215
- if (r instanceof x) {
3215
+ if (r instanceof k) {
3216
3216
  const c = r.getObjects();
3217
3217
  for (let d = c.length - 1; d >= 0; d -= 1)
3218
3218
  s.sendObjectToBack(c[d]);
@@ -3240,7 +3240,7 @@ class $t {
3240
3240
  } = this.editor;
3241
3241
  n.suspendHistory();
3242
3242
  const r = t || s.getActiveObject();
3243
- r && (r instanceof x ? $t._moveSelectionBackwards(s, r) : s.sendObjectBackwards(r), a && s.sendObjectToBack(a), s.sendObjectToBack(o), i && s.sendObjectToBack(i), s.renderAll(), n.resumeHistory(), e || n.saveState(), s.fire("editor:object-send-backwards", {
3243
+ r && (r instanceof k ? $t._moveSelectionBackwards(s, r) : s.sendObjectBackwards(r), a && s.sendObjectToBack(a), s.sendObjectToBack(o), i && s.sendObjectToBack(i), s.renderAll(), n.resumeHistory(), e || n.saveState(), s.fire("editor:object-send-backwards", {
3244
3244
  object: r,
3245
3245
  withoutSave: e
3246
3246
  }));
@@ -3536,7 +3536,7 @@ class eo {
3536
3536
  */
3537
3537
  _addClonedObjectToCanvas(t) {
3538
3538
  const { canvas: e, historyManager: s } = this.editor;
3539
- if (e.discardActiveObject(), t instanceof x) {
3539
+ if (e.discardActiveObject(), t instanceof k) {
3540
3540
  s.suspendHistory(), t.canvas = e, t.forEachObject((o) => {
3541
3541
  e.add(o);
3542
3542
  }), e.setActiveObject(t), e.requestRenderAll(), s.resumeHistory(), s.saveState();
@@ -3570,7 +3570,7 @@ class eo {
3570
3570
  if (!s || s.locked) return !1;
3571
3571
  try {
3572
3572
  const o = yield s.clone(Xt);
3573
- return o instanceof x && o.forEachObject((n) => {
3573
+ return o instanceof k && o.forEachObject((n) => {
3574
3574
  n.set({
3575
3575
  id: `${n.type}-${G()}`,
3576
3576
  evented: !0
@@ -3656,7 +3656,7 @@ class eo {
3656
3656
  if (!this.clipboard) return !1;
3657
3657
  try {
3658
3658
  const e = yield this.clipboard.clone(Xt);
3659
- return t.discardActiveObject(), e instanceof x && e.forEachObject((s) => {
3659
+ return t.discardActiveObject(), e instanceof k && e.forEachObject((s) => {
3660
3660
  s.set({
3661
3661
  id: `${s.type}-${G()}`,
3662
3662
  evented: !0
@@ -3743,7 +3743,7 @@ class te {
3743
3743
  });
3744
3744
  }
3745
3745
  static _isGroupOrSelection(t) {
3746
- return t instanceof x || t instanceof Et;
3746
+ return t instanceof k || t instanceof Et;
3747
3747
  }
3748
3748
  }
3749
3749
  class so {
@@ -3758,7 +3758,7 @@ class so {
3758
3758
  if (Array.isArray(t))
3759
3759
  return t.length > 0 ? t : null;
3760
3760
  const e = t || this.editor.canvas.getActiveObject();
3761
- return !e || !(e instanceof x) ? null : e.getObjects();
3761
+ return !e || !(e instanceof k) ? null : e.getObjects();
3762
3762
  }
3763
3763
  /**
3764
3764
  * Получить группы для разгруппировки
@@ -3769,13 +3769,13 @@ class so {
3769
3769
  const s = t.filter((o) => o instanceof Et);
3770
3770
  return s.length > 0 ? s : null;
3771
3771
  }
3772
- if (t instanceof x) {
3772
+ if (t instanceof k) {
3773
3773
  const s = t.getObjects().filter((o) => o instanceof Et);
3774
3774
  return s.length > 0 ? s : null;
3775
3775
  }
3776
3776
  const e = t || this.editor.canvas.getActiveObject();
3777
3777
  if (!e) return null;
3778
- if (e instanceof x) {
3778
+ if (e instanceof k) {
3779
3779
  const s = e.getObjects().filter((o) => o instanceof Et);
3780
3780
  return s.length > 0 ? s : null;
3781
3781
  }
@@ -3832,7 +3832,7 @@ class so {
3832
3832
  s.add(l), i.push(l);
3833
3833
  });
3834
3834
  });
3835
- const a = new x(i, {
3835
+ const a = new k(i, {
3836
3836
  canvas: s
3837
3837
  });
3838
3838
  s.setActiveObject(a), s.requestRenderAll();
@@ -3858,7 +3858,7 @@ class oo {
3858
3858
  selectAll() {
3859
3859
  const { canvas: t, canvasManager: e, objectLockManager: s } = this.editor;
3860
3860
  t.discardActiveObject();
3861
- const o = e.getObjects(), n = o.some((a) => a.locked), i = o.length > 1 ? new x(e.getObjects(), { canvas: t }) : o[0];
3861
+ const o = e.getObjects(), n = o.some((a) => a.locked), i = o.length > 1 ? new k(e.getObjects(), { canvas: t }) : o[0];
3862
3862
  n && s.lockObject({ object: i, skipInnerObjects: !0, withoutSave: !0 }), t.setActiveObject(i), t.requestRenderAll(), t.fire("editor:all-objects-selected", { selected: i });
3863
3863
  }
3864
3864
  }
@@ -4439,9 +4439,9 @@ class Z {
4439
4439
  this.isTextEditingActive = !1, this.editor.historyManager.saveState();
4440
4440
  }, Vs);
4441
4441
  }, this._handleObjectScaling = (s) => {
4442
- var X, It, Ht, mt, Wt, Ct, Ae, je, Ie, Ce, Te, Ee, Oe;
4442
+ var X, It, Wt, mt, Ht, Ct, Ae, je, Ie, Ce, Te, Ee, Oe;
4443
4443
  const { target: o, transform: n } = s;
4444
- if (o instanceof x || !Z._isTextbox(o) || !n) return;
4444
+ if (o instanceof k || !Z._isTextbox(o) || !n) return;
4445
4445
  o.isScaling = !0;
4446
4446
  const i = this._ensureScalingState(o), {
4447
4447
  baseWidth: a,
@@ -4450,18 +4450,18 @@ class Z {
4450
4450
  basePadding: d,
4451
4451
  baseRadii: l,
4452
4452
  baseStyles: u
4453
- } = i, g = typeof ((X = n.original) == null ? void 0 : X.width) == "number" ? n.original.width : void 0, f = typeof ((It = n.original) == null ? void 0 : It.left) == "number" ? n.original.left : void 0, p = g != null ? g : a, m = f != null ? f : r, v = (Ht = n.corner) != null ? Ht : "", b = (mt = n.action) != null ? mt : "", I = ["ml", "mr"].includes(v) || b === "scaleX", y = ["mt", "mb"].includes(v) || b === "scaleY", w = ["tl", "tr", "bl", "br"].includes(v) || b === "scale", A = w || y;
4453
+ } = i, g = typeof ((X = n.original) == null ? void 0 : X.width) == "number" ? n.original.width : void 0, f = typeof ((It = n.original) == null ? void 0 : It.left) == "number" ? n.original.left : void 0, p = g != null ? g : a, m = f != null ? f : r, v = (Wt = n.corner) != null ? Wt : "", b = (mt = n.action) != null ? mt : "", I = ["ml", "mr"].includes(v) || b === "scaleX", y = ["mt", "mb"].includes(v) || b === "scaleY", w = ["tl", "tr", "bl", "br"].includes(v) || b === "scale", A = w || y;
4454
4454
  if (!I && !y && !w) return;
4455
- const j = Math.abs((Ct = (Wt = o.scaleX) != null ? Wt : n.scaleX) != null ? Ct : 1) || 1, M = Math.abs((je = (Ae = o.scaleY) != null ? Ae : n.scaleY) != null ? je : 1) || 1, T = Math.max(1, p * j), S = Math.max(1, Math.round(T)), C = Math.max(1, c * M), {
4456
- paddingTop: B = 0,
4455
+ const j = Math.abs((Ct = (Ht = o.scaleX) != null ? Ht : n.scaleX) != null ? Ct : 1) || 1, M = Math.abs((je = (Ae = o.scaleY) != null ? Ae : n.scaleY) != null ? je : 1) || 1, T = Math.max(1, p * j), S = Math.max(1, Math.round(T)), C = Math.max(1, c * M), {
4456
+ paddingTop: x = 0,
4457
4457
  paddingRight: F = 0,
4458
4458
  paddingBottom: U = 0,
4459
- paddingLeft: H = 0,
4459
+ paddingLeft: W = 0,
4460
4460
  radiusTopLeft: V = 0,
4461
4461
  radiusTopRight: L = 0,
4462
4462
  radiusBottomRight: D = 0,
4463
4463
  radiusBottomLeft: z = 0,
4464
- fontSize: W,
4464
+ fontSize: H,
4465
4465
  width: P,
4466
4466
  originX: K = "left"
4467
4467
  } = o, $ = w || y, q = w || y, Y = $ ? {
@@ -4488,7 +4488,7 @@ class Z {
4488
4488
  }), Object.keys(oe).length && (se[rs] = oe);
4489
4489
  }), Object.keys(se).length && (et = se);
4490
4490
  }
4491
- const lt = (Ce = (Ie = n.originX) != null ? Ie : K) != null ? Ce : "left", pt = m + p, At = m + p / 2, ht = P != null ? P : p, jt = S !== ht, Ft = Math.abs(C - (W != null ? W : c)) > st, Nt = Math.abs(Y.top - B) > st || Math.abs(Y.right - F) > st || Math.abs(Y.bottom - U) > st || Math.abs(Y.left - H) > st, xt = Math.abs(Q.topLeft - V) > st || Math.abs(Q.topRight - L) > st || Math.abs(Q.bottomRight - D) > st || Math.abs(Q.bottomLeft - z) > st;
4491
+ const lt = (Ce = (Ie = n.originX) != null ? Ie : K) != null ? Ce : "left", pt = m + p, At = m + p / 2, ht = P != null ? P : p, jt = S !== ht, Ft = Math.abs(C - (H != null ? H : c)) > st, Nt = Math.abs(Y.top - x) > st || Math.abs(Y.right - F) > st || Math.abs(Y.bottom - U) > st || Math.abs(Y.left - W) > st, xt = Math.abs(Q.topLeft - V) > st || Math.abs(Q.topRight - L) > st || Math.abs(Q.bottomRight - D) > st || Math.abs(Q.bottomLeft - z) > st;
4492
4492
  if (!jt && !Ft && !Nt && !xt) {
4493
4493
  o.set({ scaleX: 1, scaleY: 1 }), n.scaleX = 1, n.scaleY = 1;
4494
4494
  return;
@@ -4527,16 +4527,16 @@ class Z {
4527
4527
  }, this._handleObjectModified = (s) => {
4528
4528
  var b, I, y;
4529
4529
  const { target: o } = s;
4530
- if (o instanceof x) {
4530
+ if (o instanceof k) {
4531
4531
  const w = o.getObjects();
4532
4532
  if (!w.some((S) => Z._isTextbox(S))) return;
4533
4533
  const { scaleX: j = 1, scaleY: M = 1 } = o;
4534
4534
  if (Math.abs(j - 1) < st && Math.abs(M - 1) < st) return;
4535
4535
  this.canvas.discardActiveObject(), w.forEach((S) => {
4536
- var C, B, F, U;
4536
+ var C, x, F, U;
4537
4537
  if (Z._isTextbox(S)) {
4538
- const H = (C = S.scaleX) != null ? C : 1, V = (B = S.scaleY) != null ? B : 1, L = ((F = S.fontSize) != null ? F : 16) * V, D = ((U = S.width) != null ? U : 0) * H, z = V, {
4539
- paddingTop: W = 0,
4538
+ const W = (C = S.scaleX) != null ? C : 1, V = (x = S.scaleY) != null ? x : 1, L = ((F = S.fontSize) != null ? F : 16) * V, D = ((U = S.width) != null ? U : 0) * W, z = V, {
4539
+ paddingTop: H = 0,
4540
4540
  paddingRight: P = 0,
4541
4541
  paddingBottom: K = 0,
4542
4542
  paddingLeft: $ = 0,
@@ -4546,7 +4546,7 @@ class Z {
4546
4546
  radiusBottomLeft: St = 0,
4547
4547
  styles: et
4548
4548
  } = S, lt = {
4549
- paddingTop: Math.max(0, W * z),
4549
+ paddingTop: Math.max(0, H * z),
4550
4550
  paddingRight: Math.max(0, P * z),
4551
4551
  paddingBottom: Math.max(0, K * z),
4552
4552
  paddingLeft: Math.max(0, $ * z)
@@ -4572,7 +4572,7 @@ class Z {
4572
4572
  }
4573
4573
  S.setCoords();
4574
4574
  });
4575
- const T = new x(w, {
4575
+ const T = new k(w, {
4576
4576
  canvas: this.canvas
4577
4577
  });
4578
4578
  this.canvas.setActiveObject(T), this.canvas.requestRenderAll();
@@ -4613,7 +4613,7 @@ class Z {
4613
4613
  * @param options — настройки текста
4614
4614
  * @param flags — флаги поведения
4615
4615
  */
4616
- addText(F = {}, { withoutSelection: S = !1, withoutSave: C = !1, withoutAdding: B = !1 } = {}) {
4616
+ addText(F = {}, { withoutSelection: S = !1, withoutSave: C = !1, withoutAdding: x = !1 } = {}) {
4617
4617
  var U = F, {
4618
4618
  id: t = `text-${G()}`,
4619
4619
  text: e = "Новый текст",
@@ -4666,12 +4666,12 @@ class Z {
4666
4666
  "radiusBottomLeft"
4667
4667
  ]);
4668
4668
  var $;
4669
- const { historyManager: H } = this.editor, { canvas: V } = this;
4670
- H.suspendHistory();
4669
+ const { historyManager: W } = this.editor, { canvas: V } = this;
4670
+ W.suspendHistory();
4671
4671
  const L = s != null ? s : this._getDefaultFontFamily(), D = Ke({ width: g }), z = Xe({
4672
4672
  strokeColor: u,
4673
4673
  width: D
4674
- }), W = _({
4674
+ }), H = _({
4675
4675
  id: t,
4676
4676
  fontFamily: L,
4677
4677
  fontSize: o,
@@ -4696,14 +4696,14 @@ class Z {
4696
4696
  radiusTopRight: A,
4697
4697
  radiusBottomRight: j,
4698
4698
  radiusBottomLeft: M
4699
- }, T), P = new ee(e, W);
4699
+ }, T), P = new ee(e, H);
4700
4700
  if (P.textCaseRaw = ($ = P.text) != null ? $ : "", r) {
4701
4701
  const q = ie({ value: P.textCaseRaw });
4702
4702
  q !== P.text && P.set({ text: q });
4703
4703
  }
4704
- return Z._roundTextboxDimensions({ textbox: P }) && (P.dirty = !0), T.left === void 0 && T.top === void 0 && V.centerObject(P), B || V.add(P), S || V.setActiveObject(P), V.requestRenderAll(), H.resumeHistory(), C || H.saveState(), V.fire("editor:text-added", {
4704
+ return Z._roundTextboxDimensions({ textbox: P }) && (P.dirty = !0), T.left === void 0 && T.top === void 0 && V.centerObject(P), x || V.add(P), S || V.setActiveObject(P), V.requestRenderAll(), W.resumeHistory(), C || W.saveState(), V.fire("editor:text-added", {
4705
4705
  textbox: P,
4706
- options: yt(_({}, W), {
4706
+ options: yt(_({}, H), {
4707
4707
  text: e,
4708
4708
  bold: n,
4709
4709
  italic: i,
@@ -4716,7 +4716,7 @@ class Z {
4716
4716
  flags: {
4717
4717
  withoutSelection: !!S,
4718
4718
  withoutSave: !!C,
4719
- withoutAdding: !!B
4719
+ withoutAdding: !!x
4720
4720
  }
4721
4721
  }), P;
4722
4722
  }
@@ -4754,10 +4754,10 @@ class Z {
4754
4754
  paddingRight: T,
4755
4755
  paddingBottom: S,
4756
4756
  paddingLeft: C,
4757
- radiusTopLeft: B,
4757
+ radiusTopLeft: x,
4758
4758
  radiusTopRight: F,
4759
4759
  radiusBottomRight: U,
4760
- radiusBottomLeft: H
4760
+ radiusBottomLeft: W
4761
4761
  } = Nt, V = vt(Nt, [
4762
4762
  "text",
4763
4763
  "fontFamily",
@@ -4782,23 +4782,23 @@ class Z {
4782
4782
  "radiusTopRight",
4783
4783
  "radiusBottomRight",
4784
4784
  "radiusBottomLeft"
4785
- ]), L = _({}, V), D = ao({ textbox: n }), z = D ? this._expandRangeToFullLines({ textbox: n, range: D }) : null, W = {}, P = {}, K = {}, $ = co({ textbox: n, range: D }), q = !D || $, Y = !D;
4785
+ ]), L = _({}, V), D = ao({ textbox: n }), z = D ? this._expandRangeToFullLines({ textbox: n, range: D }) : null, H = {}, P = {}, K = {}, $ = co({ textbox: n, range: D }), q = !D || $, Y = !D;
4786
4786
  if (d !== void 0 && (z && (P.fontFamily = d), q && (L.fontFamily = d, Y && (K.fontFamily = d))), l !== void 0 && (z && (P.fontSize = l), q && (L.fontSize = l, Y && (K.fontSize = l))), u !== void 0) {
4787
4787
  const X = u ? "bold" : "normal";
4788
- D && (W.fontWeight = X), q && (L.fontWeight = X, Y && (K.fontWeight = X));
4788
+ D && (H.fontWeight = X), q && (L.fontWeight = X, Y && (K.fontWeight = X));
4789
4789
  }
4790
4790
  if (g !== void 0) {
4791
4791
  const X = g ? "italic" : "normal";
4792
- D && (W.fontStyle = X), q && (L.fontStyle = X, Y && (K.fontStyle = X));
4792
+ D && (H.fontStyle = X), q && (L.fontStyle = X, Y && (K.fontStyle = X));
4793
4793
  }
4794
- if (f !== void 0 && (D && (W.underline = f), q && (L.underline = f, Y && (K.underline = f))), m !== void 0 && (D && (W.linethrough = m), q && (L.linethrough = m, Y && (K.linethrough = m))), v !== void 0 && (L.textAlign = v), b !== void 0 && (D && (W.fill = b), q && (L.fill = b, Y && (K.fill = b))), I !== void 0 || y !== void 0) {
4795
- const X = D ? Ve({ textbox: n, range: D, property: "strokeWidth" }) : void 0, It = D ? Ve({ textbox: n, range: D, property: "stroke" }) : void 0, Ht = (Bt = (xt = y != null ? y : X) != null ? xt : n.strokeWidth) != null ? Bt : 0, mt = Ke({ width: Ht }), Wt = (kt = (ut = I != null ? I : It) != null ? ut : n.stroke) != null ? kt : void 0, Ct = Xe({
4796
- strokeColor: Wt,
4794
+ if (f !== void 0 && (D && (H.underline = f), q && (L.underline = f, Y && (K.underline = f))), m !== void 0 && (D && (H.linethrough = m), q && (L.linethrough = m, Y && (K.linethrough = m))), v !== void 0 && (L.textAlign = v), b !== void 0 && (D && (H.fill = b), q && (L.fill = b, Y && (K.fill = b))), I !== void 0 || y !== void 0) {
4795
+ const X = D ? Ve({ textbox: n, range: D, property: "strokeWidth" }) : void 0, It = D ? Ve({ textbox: n, range: D, property: "stroke" }) : void 0, Wt = (Bt = (xt = y != null ? y : X) != null ? xt : n.strokeWidth) != null ? Bt : 0, mt = Ke({ width: Wt }), Ht = (kt = (ut = I != null ? I : It) != null ? ut : n.stroke) != null ? kt : void 0, Ct = Xe({
4796
+ strokeColor: Ht,
4797
4797
  width: mt
4798
4798
  });
4799
- D && (W.stroke = Ct, W.strokeWidth = mt), q && (L.stroke = Ct, L.strokeWidth = mt, Y && (K.stroke = Ct, K.strokeWidth = mt));
4799
+ D && (H.stroke = Ct, H.strokeWidth = mt), q && (L.stroke = Ct, L.strokeWidth = mt, Y && (K.stroke = Ct, K.strokeWidth = mt));
4800
4800
  }
4801
- w !== void 0 && (L.opacity = w), A !== void 0 && (L.backgroundColor = A), j !== void 0 && (L.backgroundOpacity = j), M !== void 0 && (L.paddingTop = M), T !== void 0 && (L.paddingRight = T), S !== void 0 && (L.paddingBottom = S), C !== void 0 && (L.paddingLeft = C), B !== void 0 && (L.radiusTopLeft = B), F !== void 0 && (L.radiusTopRight = F), U !== void 0 && (L.radiusBottomRight = U), H !== void 0 && (L.radiusBottomLeft = H);
4801
+ w !== void 0 && (L.opacity = w), A !== void 0 && (L.backgroundColor = A), j !== void 0 && (L.backgroundOpacity = j), M !== void 0 && (L.paddingTop = M), T !== void 0 && (L.paddingRight = T), S !== void 0 && (L.paddingBottom = S), C !== void 0 && (L.paddingLeft = C), x !== void 0 && (L.radiusTopLeft = x), F !== void 0 && (L.radiusTopRight = F), U !== void 0 && (L.radiusBottomRight = U), W !== void 0 && (L.radiusBottomLeft = W);
4802
4802
  const Q = (it = n.textCaseRaw) != null ? it : (gt = n.text) != null ? gt : "", St = !!n.uppercase, et = c !== void 0, lt = et ? c != null ? c : "" : Q, pt = p != null ? p : St;
4803
4803
  if (et || pt !== St) {
4804
4804
  const X = pt ? ie({ value: lt }) : lt;
@@ -4807,13 +4807,13 @@ class Z {
4807
4807
  n.uppercase = pt, n.set(L);
4808
4808
  let ht = !1;
4809
4809
  if (D) {
4810
- const X = ne({ textbox: n, styles: W, range: D }), It = z ? ne({ textbox: n, styles: P, range: z }) : !1;
4810
+ const X = ne({ textbox: n, styles: H, range: D }), It = z ? ne({ textbox: n, styles: P, range: z }) : !1;
4811
4811
  ht = X || It;
4812
4812
  } else if (Object.keys(K).length) {
4813
4813
  const X = ro({ textbox: n });
4814
4814
  X && (ht = ne({ textbox: n, styles: K, range: X }));
4815
4815
  }
4816
- ht && (n.dirty = !0), (A !== void 0 || j !== void 0 || M !== void 0 || T !== void 0 || S !== void 0 || C !== void 0 || B !== void 0 || F !== void 0 || U !== void 0 || H !== void 0) && (n.dirty = !0), Z._roundTextboxDimensions({ textbox: n }) && (n.dirty = !0), n.setCoords(), o || a.requestRenderAll(), i.resumeHistory(), s || i.saveState();
4816
+ ht && (n.dirty = !0), (A !== void 0 || j !== void 0 || M !== void 0 || T !== void 0 || S !== void 0 || C !== void 0 || x !== void 0 || F !== void 0 || U !== void 0 || W !== void 0) && (n.dirty = !0), Z._roundTextboxDimensions({ textbox: n }) && (n.dirty = !0), n.setCoords(), o || a.requestRenderAll(), i.resumeHistory(), s || i.saveState();
4817
4817
  const Ft = Z._getSnapshot(n);
4818
4818
  return a.fire("editor:text-updated", {
4819
4819
  textbox: n,
@@ -4827,7 +4827,7 @@ class Z {
4827
4827
  before: r,
4828
4828
  after: Ft,
4829
4829
  selectionRange: D != null ? D : void 0,
4830
- selectionStyles: D && Object.keys(W).length ? W : void 0
4830
+ selectionStyles: D && Object.keys(H).length ? H : void 0
4831
4831
  }), n;
4832
4832
  }
4833
4833
  /**
@@ -4964,11 +4964,11 @@ class Z {
4964
4964
  */
4965
4965
  static _getSnapshot(t) {
4966
4966
  const e = ({
4967
- snapshot: W,
4967
+ snapshot: H,
4968
4968
  entries: P
4969
4969
  }) => {
4970
4970
  Object.entries(P).forEach(([K, $]) => {
4971
- $ != null && (W[K] = $);
4971
+ $ != null && (H[K] = $);
4972
4972
  });
4973
4973
  }, {
4974
4974
  id: s,
@@ -4996,10 +4996,10 @@ class Z {
4996
4996
  radiusTopRight: T,
4997
4997
  radiusBottomRight: S,
4998
4998
  radiusBottomLeft: C,
4999
- left: B,
4999
+ left: x,
5000
5000
  top: F,
5001
5001
  width: U,
5002
- height: H,
5002
+ height: W,
5003
5003
  angle: V,
5004
5004
  scaleX: L,
5005
5005
  scaleY: D
@@ -5033,10 +5033,10 @@ class Z {
5033
5033
  radiusTopRight: T,
5034
5034
  radiusBottomRight: S,
5035
5035
  radiusBottomLeft: C,
5036
- left: B,
5036
+ left: x,
5037
5037
  top: F,
5038
5038
  width: U,
5039
- height: H,
5039
+ height: W,
5040
5040
  angle: V,
5041
5041
  scaleX: L,
5042
5042
  scaleY: D
@@ -5318,7 +5318,7 @@ class R {
5318
5318
  * Подготавливает объекты для сериализации.
5319
5319
  */
5320
5320
  static _collectObjects(t) {
5321
- return t ? t instanceof x ? t.getObjects() : [t] : [];
5321
+ return t ? t instanceof k ? t.getObjects() : [t] : [];
5322
5322
  }
5323
5323
  /**
5324
5324
  * Возвращает габариты объекта.
@@ -5558,7 +5558,7 @@ class R {
5558
5558
  t.setActiveObject(e[0]);
5559
5559
  return;
5560
5560
  }
5561
- const s = new x(e, { canvas: t });
5561
+ const s = new k(e, { canvas: t });
5562
5562
  t.setActiveObject(s);
5563
5563
  }
5564
5564
  /**
@@ -5891,15 +5891,15 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
5891
5891
  if (u && f) {
5892
5892
  const { bounds: y } = u, { bounds: w } = f, j = w.top - y.bottom - v;
5893
5893
  if (j >= 0) {
5894
- const M = j / 2, T = n - y.bottom, S = w.top - i, C = Math.abs(T - M), B = Math.abs(S - M), F = Math.max(C, B);
5894
+ const M = j / 2, T = n - y.bottom, S = w.top - i, C = Math.abs(T - M), x = Math.abs(S - M), F = Math.max(C, x);
5895
5895
  if (F <= e) {
5896
- const U = M - T, H = i + U, V = {
5896
+ const U = M - T, W = i + U, V = {
5897
5897
  type: "vertical",
5898
5898
  axis: o,
5899
5899
  refStart: y.bottom,
5900
5900
  refEnd: y.bottom + M,
5901
- activeStart: H,
5902
- activeEnd: H + M,
5901
+ activeStart: W,
5902
+ activeEnd: W + M,
5903
5903
  distance: M
5904
5904
  };
5905
5905
  m.push({ delta: U, guide: V, diff: F });
@@ -5977,15 +5977,15 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
5977
5977
  if (u && f) {
5978
5978
  const { bounds: y } = u, { bounds: w } = f, j = w.left - y.right - v;
5979
5979
  if (j >= 0) {
5980
- const M = j / 2, T = n - y.right, S = w.left - i, C = Math.abs(T - M), B = Math.abs(S - M), F = Math.max(C, B);
5980
+ const M = j / 2, T = n - y.right, S = w.left - i, C = Math.abs(T - M), x = Math.abs(S - M), F = Math.max(C, x);
5981
5981
  if (F <= e) {
5982
- const U = M - T, H = i + U, V = {
5982
+ const U = M - T, W = i + U, V = {
5983
5983
  type: "horizontal",
5984
5984
  axis: o,
5985
5985
  refStart: y.right,
5986
5986
  refEnd: y.right + M,
5987
- activeStart: H,
5988
- activeEnd: H + M,
5987
+ activeStart: W,
5988
+ activeEnd: W + M,
5989
5989
  distance: M
5990
5990
  };
5991
5991
  m.push({ delta: U, guide: V, diff: F });
@@ -6162,7 +6162,7 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
6162
6162
  activeObject: h
6163
6163
  }) => {
6164
6164
  const t = /* @__PURE__ */ new Set();
6165
- return h && (t.add(h), h instanceof x && h.getObjects().forEach((e) => t.add(e))), t;
6165
+ return h && (t.add(h), h instanceof k && h.getObjects().forEach((e) => t.add(e))), t;
6166
6166
  }, as = ({
6167
6167
  object: h,
6168
6168
  excluded: t,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anu3ev/fabric-image-editor",
3
- "version": "0.5.6",
3
+ "version": "0.5.7",
4
4
  "description": "JavaScript image editor built on FabricJS, allowing you to create instances with an integrated montage area and providing an API to modify and manage state.",
5
5
  "module": "dist/main.js",
6
6
  "files": [