@anu3ev/fabric-image-editor 0.7.10 → 0.7.11
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 +994 -637
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -252,87 +252,87 @@ var M = class {
|
|
|
252
252
|
}, N = "#2B2D33", P = "#3D8BF4", F = "#FFFFFF";
|
|
253
253
|
//#endregion
|
|
254
254
|
//#region src/editor/customized-controls/renderers.ts
|
|
255
|
-
function
|
|
255
|
+
function I(e, t, n, r, i) {
|
|
256
256
|
e.save(), e.translate(t, n), e.rotate(C.degreesToRadians(i.angle)), e.fillStyle = F, e.strokeStyle = P, e.lineWidth = 1, e.beginPath(), e.roundRect(-12 / 2, -12 / 2, 12, 12, 2), e.fill(), e.stroke(), e.restore();
|
|
257
257
|
}
|
|
258
|
-
function
|
|
258
|
+
function ee(e, t, n, r, i) {
|
|
259
259
|
e.save(), e.translate(t, n), e.rotate(C.degreesToRadians(i.angle)), e.fillStyle = F, e.strokeStyle = P, e.lineWidth = 1, e.beginPath(), e.roundRect(-8 / 2, -20 / 2, 8, 20, 100), e.fill(), e.stroke(), e.restore();
|
|
260
260
|
}
|
|
261
|
-
function
|
|
261
|
+
function L(e, t, n, r, i) {
|
|
262
262
|
e.save(), e.translate(t, n), e.rotate(C.degreesToRadians(i.angle)), e.fillStyle = F, e.strokeStyle = P, e.lineWidth = 1, e.beginPath(), e.roundRect(-20 / 2, -8 / 2, 20, 8, 100), e.fill(), e.stroke(), e.restore();
|
|
263
263
|
}
|
|
264
|
-
var
|
|
265
|
-
|
|
266
|
-
function
|
|
267
|
-
e.save(), e.translate(t, n), e.rotate(C.degreesToRadians(i.angle)), e.fillStyle = N, e.beginPath(), e.arc(0, 0, 16, 0, 2 * Math.PI), e.fill(), e.drawImage(
|
|
264
|
+
var R = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", te = new Image();
|
|
265
|
+
te.src = R;
|
|
266
|
+
function ne(e, t, n, r, i) {
|
|
267
|
+
e.save(), e.translate(t, n), e.rotate(C.degreesToRadians(i.angle)), e.fillStyle = N, e.beginPath(), e.arc(0, 0, 16, 0, 2 * Math.PI), e.fill(), e.drawImage(te, -16 / 2, -16 / 2, 16, 16), e.restore();
|
|
268
268
|
}
|
|
269
269
|
//#endregion
|
|
270
270
|
//#region src/editor/customized-controls/default-controls.ts
|
|
271
|
-
var
|
|
271
|
+
var z = {
|
|
272
272
|
tl: {
|
|
273
|
-
render:
|
|
273
|
+
render: I,
|
|
274
274
|
sizeX: 12,
|
|
275
275
|
sizeY: 12,
|
|
276
276
|
offsetX: 0,
|
|
277
277
|
offsetY: 0
|
|
278
278
|
},
|
|
279
279
|
tr: {
|
|
280
|
-
render:
|
|
280
|
+
render: I,
|
|
281
281
|
sizeX: 12,
|
|
282
282
|
sizeY: 12,
|
|
283
283
|
offsetX: 0,
|
|
284
284
|
offsetY: 0
|
|
285
285
|
},
|
|
286
286
|
bl: {
|
|
287
|
-
render:
|
|
287
|
+
render: I,
|
|
288
288
|
sizeX: 12,
|
|
289
289
|
sizeY: 12,
|
|
290
290
|
offsetX: 0,
|
|
291
291
|
offsetY: 0
|
|
292
292
|
},
|
|
293
293
|
br: {
|
|
294
|
-
render:
|
|
294
|
+
render: I,
|
|
295
295
|
sizeX: 12,
|
|
296
296
|
sizeY: 12,
|
|
297
297
|
offsetX: 0,
|
|
298
298
|
offsetY: 0
|
|
299
299
|
},
|
|
300
300
|
ml: {
|
|
301
|
-
render:
|
|
301
|
+
render: ee,
|
|
302
302
|
sizeX: 8,
|
|
303
303
|
sizeY: 20,
|
|
304
304
|
offsetX: 0,
|
|
305
305
|
offsetY: 0
|
|
306
306
|
},
|
|
307
307
|
mr: {
|
|
308
|
-
render:
|
|
308
|
+
render: ee,
|
|
309
309
|
sizeX: 8,
|
|
310
310
|
sizeY: 20,
|
|
311
311
|
offsetX: 0,
|
|
312
312
|
offsetY: 0
|
|
313
313
|
},
|
|
314
314
|
mt: {
|
|
315
|
-
render:
|
|
315
|
+
render: L,
|
|
316
316
|
sizeX: 20,
|
|
317
317
|
sizeY: 8,
|
|
318
318
|
offsetX: 0,
|
|
319
319
|
offsetY: 0
|
|
320
320
|
},
|
|
321
321
|
mb: {
|
|
322
|
-
render:
|
|
322
|
+
render: L,
|
|
323
323
|
sizeX: 20,
|
|
324
324
|
sizeY: 8,
|
|
325
325
|
offsetX: 0,
|
|
326
326
|
offsetY: 0
|
|
327
327
|
},
|
|
328
328
|
mtr: {
|
|
329
|
-
render:
|
|
329
|
+
render: ne,
|
|
330
330
|
sizeX: 32,
|
|
331
331
|
sizeY: 32,
|
|
332
332
|
offsetX: 0,
|
|
333
333
|
offsetY: -32
|
|
334
334
|
}
|
|
335
|
-
},
|
|
335
|
+
}, re = class t {
|
|
336
336
|
static wrapWidthControl(e) {
|
|
337
337
|
if (!e?.actionHandler) return;
|
|
338
338
|
let t = e.actionHandler;
|
|
@@ -342,7 +342,7 @@ var ie = {
|
|
|
342
342
|
};
|
|
343
343
|
}
|
|
344
344
|
static applyControlOverrides(e) {
|
|
345
|
-
Object.entries(
|
|
345
|
+
Object.entries(z).forEach(([t, n]) => {
|
|
346
346
|
let r = e[t];
|
|
347
347
|
r && (Object.assign(r, n), t === "mtr" && (r.cursorStyle = "grab", r.mouseDownHandler = (e, t, n, r) => {
|
|
348
348
|
let i = t?.target;
|
|
@@ -432,7 +432,7 @@ var ie = {
|
|
|
432
432
|
mr: !0
|
|
433
433
|
});
|
|
434
434
|
}
|
|
435
|
-
},
|
|
435
|
+
}, B = class e {
|
|
436
436
|
static {
|
|
437
437
|
this.registeredFontKeys = /* @__PURE__ */ new Set();
|
|
438
438
|
}
|
|
@@ -585,7 +585,7 @@ var ie = {
|
|
|
585
585
|
};
|
|
586
586
|
return Object.entries(e).filter(([, e]) => e != null && `${e}`.length > 0).map(([e, n]) => `${t[e] ?? e}: ${n};`);
|
|
587
587
|
}
|
|
588
|
-
},
|
|
588
|
+
}, V = {
|
|
589
589
|
style: {
|
|
590
590
|
position: "absolute",
|
|
591
591
|
display: "none",
|
|
@@ -687,7 +687,7 @@ var ie = {
|
|
|
687
687
|
e.layerManager.sendBackwards();
|
|
688
688
|
}
|
|
689
689
|
}
|
|
690
|
-
},
|
|
690
|
+
}, H = class {
|
|
691
691
|
constructor({ editor: e }) {
|
|
692
692
|
this.currentTarget = null, this.currentLocked = !1, this.isTransforming = !1, this.isTemporarilyHidden = !1, this.editor = e, this.canvas = e.canvas, this.options = e.options, this._initToolbar();
|
|
693
693
|
}
|
|
@@ -695,22 +695,22 @@ var ie = {
|
|
|
695
695
|
if (!this.options.showToolbar) return;
|
|
696
696
|
let e = this.options.toolbar || {};
|
|
697
697
|
this.config = {
|
|
698
|
-
...
|
|
698
|
+
...V,
|
|
699
699
|
...e,
|
|
700
700
|
style: {
|
|
701
|
-
...
|
|
701
|
+
...V.style,
|
|
702
702
|
...e.style || {}
|
|
703
703
|
},
|
|
704
704
|
btnStyle: {
|
|
705
|
-
...
|
|
705
|
+
...V.btnStyle,
|
|
706
706
|
...e.btnStyle || {}
|
|
707
707
|
},
|
|
708
708
|
icons: {
|
|
709
|
-
...
|
|
709
|
+
...V.icons,
|
|
710
710
|
...e.icons || {}
|
|
711
711
|
},
|
|
712
712
|
handlers: {
|
|
713
|
-
...
|
|
713
|
+
...V.handlers,
|
|
714
714
|
...e.handlers || {}
|
|
715
715
|
}
|
|
716
716
|
}, 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 = () => {
|
|
@@ -788,7 +788,7 @@ var ie = {
|
|
|
788
788
|
destroy() {
|
|
789
789
|
this.el.removeEventListener("mouseover", this._onBtnOver), this.el.removeEventListener("mouseout", this._onBtnOut), this.canvas.off("mouse:down", this._onMouseDown), this.canvas.off("object:moving", this._onObjectMoving), this.canvas.off("object:scaling", this._onObjectScaling), this.canvas.off("object:rotating", this._onObjectRotating), this.canvas.off("mouse:up", this._onMouseUp), this.canvas.off("object:modified", this._onObjectModified), this.canvas.off("selection:created", this._onSelectionChange), this.canvas.off("selection:updated", this._onSelectionChange), this.canvas.off("after:render", this._onSelectionChange), this.canvas.off("selection:cleared", this._onSelectionClear), this.el.remove();
|
|
790
790
|
}
|
|
791
|
-
},
|
|
791
|
+
}, ie = {
|
|
792
792
|
position: "absolute",
|
|
793
793
|
display: "none",
|
|
794
794
|
background: "#2B2D33",
|
|
@@ -802,12 +802,12 @@ var ie = {
|
|
|
802
802
|
"pointer-events": "none",
|
|
803
803
|
"white-space": "nowrap",
|
|
804
804
|
"box-shadow": "0 2px 8px rgba(0, 0, 0, 0.2)"
|
|
805
|
-
},
|
|
805
|
+
}, U = "fabric-editor-angle-indicator", ae = class e {
|
|
806
806
|
constructor({ editor: e }) {
|
|
807
807
|
this.isActive = !1, this.currentAngle = 0, this.editor = e, this.canvas = e.canvas, this.options = e.options, this._createDOM(), this._bindEvents();
|
|
808
808
|
}
|
|
809
809
|
_createDOM() {
|
|
810
|
-
this.el = document.createElement("div"), this.el.className =
|
|
810
|
+
this.el = document.createElement("div"), this.el.className = U, Object.entries(ie).forEach(([e, t]) => {
|
|
811
811
|
this.el.style.setProperty(e, t);
|
|
812
812
|
}), this.canvas.wrapperEl.appendChild(this.el);
|
|
813
813
|
}
|
|
@@ -852,44 +852,44 @@ var ie = {
|
|
|
852
852
|
destroy() {
|
|
853
853
|
this.canvas && (this.canvas.off("object:rotating", this._onObjectRotating), this.canvas.off("mouse:up", this._onMouseUp), this.canvas.off("object:modified", this._onObjectModified), this.canvas.off("selection:cleared", this._onSelectionCleared)), this.el?.parentNode && this.el.parentNode.removeChild(this.el), this.el = null, this.editor = null, this.canvas = null, this.options = null;
|
|
854
854
|
}
|
|
855
|
-
},
|
|
855
|
+
}, oe = /* @__PURE__ */ "id.backgroundId.customData.backgroundType.format.contentType.width.height.originX.originY.locked.editable.evented.selectable.lockMovementX.lockMovementY.lockRotation.lockScalingX.lockScalingY.lockSkewingX.lockSkewingY.styles.lineFontDefaults.textCaseRaw.uppercase.autoExpand.linethrough.underline.fontStyle.fontWeight.backgroundOpacity.paddingTop.paddingRight.paddingBottom.paddingLeft.radiusTopLeft.radiusTopRight.radiusBottomRight.radiusBottomLeft.shapeComposite.shapePresetKey.shapeBaseWidth.shapeBaseHeight.shapeManualBaseWidth.shapeManualBaseHeight.shapeTextAutoExpand.shapeAlignHorizontal.shapeAlignVertical.shapePaddingTop.shapePaddingRight.shapePaddingBottom.shapePaddingLeft.shapeFill.shapeStroke.shapeStrokeWidth.shapeStrokeDashArray.shapeOpacity.shapeRounding.shapeNodeType".split(".");
|
|
856
856
|
//#endregion
|
|
857
857
|
//#region src/editor/history-manager/diff-normalization.ts
|
|
858
|
-
function
|
|
858
|
+
function se({ state: e }) {
|
|
859
859
|
return JSON.parse(JSON.stringify(e));
|
|
860
860
|
}
|
|
861
|
-
function
|
|
861
|
+
function ce({ value: e }) {
|
|
862
862
|
if (Array.isArray(e)) {
|
|
863
863
|
let t = [];
|
|
864
|
-
for (let n = 0; n < e.length; n += 1) t.push(
|
|
864
|
+
for (let n = 0; n < e.length; n += 1) t.push(ce({ value: e[n] }));
|
|
865
865
|
return t;
|
|
866
866
|
}
|
|
867
867
|
if (e && typeof e == "object") {
|
|
868
868
|
let t = {}, n = Object.keys(e).sort();
|
|
869
869
|
for (let r = 0; r < n.length; r += 1) {
|
|
870
870
|
let i = n[r];
|
|
871
|
-
t[i] =
|
|
871
|
+
t[i] = ce({ value: e[i] });
|
|
872
872
|
}
|
|
873
873
|
return t;
|
|
874
874
|
}
|
|
875
875
|
return e;
|
|
876
876
|
}
|
|
877
|
-
function
|
|
878
|
-
let t =
|
|
877
|
+
function le({ value: e }) {
|
|
878
|
+
let t = ce({ value: e });
|
|
879
879
|
return JSON.stringify(t);
|
|
880
880
|
}
|
|
881
|
-
function
|
|
882
|
-
return
|
|
881
|
+
function ue({ prevState: e, nextState: t }) {
|
|
882
|
+
return le({ value: e }) === le({ value: t });
|
|
883
883
|
}
|
|
884
|
-
function
|
|
884
|
+
function de({ objects: e, id: t }) {
|
|
885
885
|
for (let n = 0; n < e.length; n += 1) {
|
|
886
886
|
let r = e[n];
|
|
887
887
|
if (r.id === t) return r;
|
|
888
888
|
}
|
|
889
889
|
return null;
|
|
890
890
|
}
|
|
891
|
-
function
|
|
892
|
-
let t =
|
|
891
|
+
function fe({ objects: e }) {
|
|
892
|
+
let t = de({
|
|
893
893
|
objects: e,
|
|
894
894
|
id: "montage-area"
|
|
895
895
|
});
|
|
@@ -903,7 +903,7 @@ function pe({ objects: e }) {
|
|
|
903
903
|
height: r
|
|
904
904
|
};
|
|
905
905
|
}
|
|
906
|
-
function
|
|
906
|
+
function pe({ objects: e }) {
|
|
907
907
|
let t = [], n = [...e];
|
|
908
908
|
for (let e = 0; e < n.length; e += 1) {
|
|
909
909
|
let r = n[e];
|
|
@@ -913,20 +913,20 @@ function me({ objects: e }) {
|
|
|
913
913
|
}
|
|
914
914
|
return t;
|
|
915
915
|
}
|
|
916
|
-
function
|
|
917
|
-
let t =
|
|
916
|
+
function me({ objects: e }) {
|
|
917
|
+
let t = pe({ objects: e });
|
|
918
918
|
for (let e = 0; e < t.length; e += 1) {
|
|
919
919
|
let n = t[e], { type: r, backgroundOpacity: i, backgroundColor: a, textBackgroundColor: o } = n, s = typeof i == "number" ? i : 0, c = typeof a == "string" ? a : "", l = typeof o == "string" ? o : "", u = r === "textbox" || r === "background-textbox", d = c.length > 0 || l.length > 0;
|
|
920
920
|
u && (s > 0 && d || (n.backgroundColor = null, n.textBackgroundColor = null));
|
|
921
921
|
}
|
|
922
922
|
}
|
|
923
|
-
function
|
|
924
|
-
let { width: n, height: r, objects: i } = e, { objects: a } = t, { width: o, height: s } =
|
|
923
|
+
function he({ prevState: e, nextState: t }) {
|
|
924
|
+
let { width: n, height: r, objects: i } = e, { objects: a } = t, { width: o, height: s } = fe({ objects: i }), { width: c, height: l } = fe({ objects: a });
|
|
925
925
|
o !== c || s !== l || (t.width = n, t.height = r);
|
|
926
926
|
}
|
|
927
|
-
function
|
|
928
|
-
let n =
|
|
929
|
-
return
|
|
927
|
+
function ge({ prevState: e, nextState: t }) {
|
|
928
|
+
let n = se({ state: e }), r = se({ state: t });
|
|
929
|
+
return me({ objects: n.objects }), me({ objects: r.objects }), he({
|
|
930
930
|
prevState: n,
|
|
931
931
|
nextState: r
|
|
932
932
|
}), {
|
|
@@ -936,10 +936,10 @@ function _e({ prevState: e, nextState: t }) {
|
|
|
936
936
|
}
|
|
937
937
|
//#endregion
|
|
938
938
|
//#region src/editor/history-manager/load-state.ts
|
|
939
|
-
function
|
|
939
|
+
function _e({ customData: e }) {
|
|
940
940
|
return JSON.parse(JSON.stringify(e));
|
|
941
941
|
}
|
|
942
|
-
function
|
|
942
|
+
function ve({ state: e }) {
|
|
943
943
|
let t = JSON.parse(JSON.stringify(e)), n = (t.objects ?? []).filter((e) => e.id !== "overlay-mask");
|
|
944
944
|
t.objects = n;
|
|
945
945
|
for (let e = 0; e < n.length; e += 1) {
|
|
@@ -948,7 +948,7 @@ function ye({ state: e }) {
|
|
|
948
948
|
}
|
|
949
949
|
return t;
|
|
950
950
|
}
|
|
951
|
-
function
|
|
951
|
+
function ye({ state: e, canvas: t }) {
|
|
952
952
|
let { objects: n = [] } = e, r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
953
953
|
for (let e = 0; e < n.length; e += 1) {
|
|
954
954
|
let { customData: t, id: a } = n[e];
|
|
@@ -963,23 +963,23 @@ function be({ state: e, canvas: t }) {
|
|
|
963
963
|
let a = t.getObjects?.() ?? [];
|
|
964
964
|
for (let e = 0; e < a.length; e += 1) {
|
|
965
965
|
let t = a[e], { id: n } = t, o;
|
|
966
|
-
typeof n == "string" && (o = r.get(n)), o ||= i.get(e), o && (t.customData =
|
|
966
|
+
typeof n == "string" && (o = r.get(n)), o ||= i.get(e), o && (t.customData = _e({ customData: o }));
|
|
967
967
|
}
|
|
968
968
|
}
|
|
969
969
|
//#endregion
|
|
970
970
|
//#region src/editor/history-manager/snapshot-interactivity.ts
|
|
971
|
-
function
|
|
971
|
+
function be({ object: e }) {
|
|
972
972
|
return typeof e.getObjects == "function" ? e.getObjects() : [];
|
|
973
973
|
}
|
|
974
|
-
function
|
|
974
|
+
function xe({ objects: e }) {
|
|
975
975
|
for (let t = 0; t < e.length; t += 1) if (e[t].isEditing) return !0;
|
|
976
976
|
return !1;
|
|
977
977
|
}
|
|
978
|
-
function
|
|
978
|
+
function Se({ object: e }) {
|
|
979
979
|
let t = typeof e.type == "string" ? e.type.toLowerCase() : "";
|
|
980
980
|
return t === "textbox" || t === "background-textbox" || typeof e.isEditing == "boolean";
|
|
981
981
|
}
|
|
982
|
-
function
|
|
982
|
+
function Ce({ object: e, withEvented: t = !1 }) {
|
|
983
983
|
let n = {
|
|
984
984
|
object: e,
|
|
985
985
|
lockMovementX: e.lockMovementX,
|
|
@@ -988,66 +988,66 @@ function we({ object: e, withEvented: t = !1 }) {
|
|
|
988
988
|
};
|
|
989
989
|
return t && (n.evented = e.evented), n;
|
|
990
990
|
}
|
|
991
|
-
function
|
|
992
|
-
return e.shapeComposite !== !0 || !
|
|
991
|
+
function we({ object: e, snapshotStates: t }) {
|
|
992
|
+
return e.shapeComposite !== !0 || !xe({ objects: be({ object: e }) }) ? !1 : (t.push(Ce({ object: e })), e.lockMovementX = !1, e.lockMovementY = !1, e.selectable = !0, !0);
|
|
993
993
|
}
|
|
994
|
-
function
|
|
995
|
-
if (!
|
|
994
|
+
function Te({ object: e, snapshotStates: t }) {
|
|
995
|
+
if (!Se({ object: e })) return !1;
|
|
996
996
|
let n = e.group, { isEditing: r } = e, i = n?.shapeComposite === !0, a = !!n?.locked;
|
|
997
|
-
return !i || a || !r ? !1 : (t.push(
|
|
997
|
+
return !i || a || !r ? !1 : (t.push(Ce({
|
|
998
998
|
object: e,
|
|
999
999
|
withEvented: !0
|
|
1000
1000
|
})), e.lockMovementX = !1, e.lockMovementY = !1, e.selectable = !1, e.evented = !1, !0);
|
|
1001
1001
|
}
|
|
1002
|
-
function
|
|
1003
|
-
if (!
|
|
1002
|
+
function Ee({ object: e, snapshotStates: t }) {
|
|
1003
|
+
if (!Se({ object: e })) return !1;
|
|
1004
1004
|
let n = !!e.lockMovementX, r = !!e.lockMovementY;
|
|
1005
|
-
return !n && !r ? !1 : (t.push(
|
|
1005
|
+
return !n && !r ? !1 : (t.push(Ce({ object: e })), e.lockMovementX = !1, e.lockMovementY = !1, e.selectable = !0, !0);
|
|
1006
1006
|
}
|
|
1007
|
-
function
|
|
1007
|
+
function De({ objects: e }) {
|
|
1008
1008
|
let t = [];
|
|
1009
1009
|
for (let n = 0; n < e.length; n += 1) {
|
|
1010
1010
|
let r = e[n];
|
|
1011
|
-
r.locked ||
|
|
1011
|
+
r.locked || we({
|
|
1012
1012
|
object: r,
|
|
1013
1013
|
snapshotStates: t
|
|
1014
|
-
}) ||
|
|
1014
|
+
}) || Te({
|
|
1015
1015
|
object: r,
|
|
1016
1016
|
snapshotStates: t
|
|
1017
|
-
}) ||
|
|
1017
|
+
}) || Ee({
|
|
1018
1018
|
object: r,
|
|
1019
1019
|
snapshotStates: t
|
|
1020
1020
|
});
|
|
1021
1021
|
}
|
|
1022
1022
|
return t;
|
|
1023
1023
|
}
|
|
1024
|
-
function
|
|
1024
|
+
function Oe({ canvas: e }) {
|
|
1025
1025
|
let t = [...e.getObjects?.() ?? []], n = [];
|
|
1026
1026
|
for (let e = 0; e < t.length; e += 1) {
|
|
1027
1027
|
let r = t[e];
|
|
1028
1028
|
n.push(r);
|
|
1029
|
-
let i =
|
|
1029
|
+
let i = be({ object: r });
|
|
1030
1030
|
for (let e = 0; e < i.length; e += 1) t.push(i[e]);
|
|
1031
1031
|
}
|
|
1032
1032
|
return n;
|
|
1033
1033
|
}
|
|
1034
|
-
function
|
|
1034
|
+
function ke({ snapshotStates: e }) {
|
|
1035
1035
|
for (let t = 0; t < e.length; t += 1) {
|
|
1036
1036
|
let { object: n, lockMovementX: r, lockMovementY: i, selectable: a, evented: o } = e[t];
|
|
1037
1037
|
n.lockMovementX = r, n.lockMovementY = i, n.selectable = a, o !== void 0 && (n.evented = o);
|
|
1038
1038
|
}
|
|
1039
1039
|
}
|
|
1040
|
-
function
|
|
1041
|
-
let n =
|
|
1040
|
+
function Ae({ canvas: e, callback: t }) {
|
|
1041
|
+
let n = De({ objects: Oe({ canvas: e }) });
|
|
1042
1042
|
try {
|
|
1043
1043
|
return t();
|
|
1044
1044
|
} finally {
|
|
1045
|
-
|
|
1045
|
+
ke({ snapshotStates: n });
|
|
1046
1046
|
}
|
|
1047
1047
|
}
|
|
1048
1048
|
//#endregion
|
|
1049
1049
|
//#region src/editor/history-manager/index.ts
|
|
1050
|
-
var
|
|
1050
|
+
var je = class {
|
|
1051
1051
|
constructor({ editor: e }) {
|
|
1052
1052
|
this.editor = e, this.canvas = e.canvas, this._isSavingState = !1, this._historySuspendCount = 0, this._isActionInProgress = !1, this._actionSnapshot = null, this._actionReason = null, this._pendingSaveTimeoutId = null, this._pendingSaveReason = null, this._pendingCommittedState = null, this._pendingCommittedStateReason = null, this._hasDeferredSaveAfterUnblock = !1, this.baseState = null, this.patches = [], this.currentIndex = 0, this.maxHistoryLength = e.options.maxHistoryLength, this.totalChangesCount = 0, this.baseStateChangesCount = 0, this._createDiffPatcher();
|
|
1053
1053
|
}
|
|
@@ -1115,14 +1115,14 @@ var Me = class {
|
|
|
1115
1115
|
return console.log("getFullState state", r), r;
|
|
1116
1116
|
}
|
|
1117
1117
|
_captureCurrentState() {
|
|
1118
|
-
return
|
|
1118
|
+
return Ae({
|
|
1119
1119
|
canvas: this.canvas,
|
|
1120
1120
|
callback: () => this._serializeCanvasState()
|
|
1121
1121
|
});
|
|
1122
1122
|
}
|
|
1123
1123
|
_serializeCanvasState() {
|
|
1124
1124
|
let { canvas: e } = this;
|
|
1125
|
-
return e.toDatalessObject([...
|
|
1125
|
+
return e.toDatalessObject([...oe]);
|
|
1126
1126
|
}
|
|
1127
1127
|
_handlePendingSaveTimeout() {
|
|
1128
1128
|
this._pendingSaveTimeoutId !== null && (this._pendingSaveTimeoutId = null, this._pendingSaveReason = null, this.saveState());
|
|
@@ -1165,7 +1165,7 @@ var Me = class {
|
|
|
1165
1165
|
this.baseState = e, this.patches = [], this.currentIndex = 0, console.log("Базовое состояние сохранено.");
|
|
1166
1166
|
return;
|
|
1167
1167
|
}
|
|
1168
|
-
let { prevState: t, nextState: n } =
|
|
1168
|
+
let { prevState: t, nextState: n } = ge({
|
|
1169
1169
|
prevState: this.getFullState(),
|
|
1170
1170
|
nextState: e
|
|
1171
1171
|
}), r = this.diffPatcher.diff(t, n);
|
|
@@ -1173,7 +1173,7 @@ var Me = class {
|
|
|
1173
1173
|
console.log("Нет изменений для сохранения.");
|
|
1174
1174
|
return;
|
|
1175
1175
|
}
|
|
1176
|
-
if (
|
|
1176
|
+
if (ue({
|
|
1177
1177
|
prevState: t,
|
|
1178
1178
|
nextState: n
|
|
1179
1179
|
})) {
|
|
@@ -1195,9 +1195,9 @@ var Me = class {
|
|
|
1195
1195
|
try {
|
|
1196
1196
|
let e = this._consumePendingCommittedState();
|
|
1197
1197
|
e && (this._pendingSaveTimeoutId !== null && this._pendingSaveReason === e.reason && this._clearPendingSave(), e.reason === "text-edit" && this._deactivateTextEditing(), this._saveSerializedState({ currentStateObj: e.state }));
|
|
1198
|
-
let t =
|
|
1198
|
+
let t = Ae({
|
|
1199
1199
|
canvas: this.canvas,
|
|
1200
|
-
callback: () => this.canvas.toDatalessObject([...
|
|
1200
|
+
callback: () => this.canvas.toDatalessObject([...oe])
|
|
1201
1201
|
});
|
|
1202
1202
|
console.timeEnd("saveState"), this._saveSerializedState({ currentStateObj: t });
|
|
1203
1203
|
} finally {
|
|
@@ -1210,8 +1210,8 @@ var Me = class {
|
|
|
1210
1210
|
console.log("loadStateFromFullState fullState", e);
|
|
1211
1211
|
let { canvas: t, canvasManager: n, interactionBlocker: r, backgroundManager: i, zoomManager: a, panConstraintManager: o } = this.editor, { width: s, height: c } = t, { width: l, height: u } = this.editor.montageArea;
|
|
1212
1212
|
r.overlayMask = null;
|
|
1213
|
-
let d =
|
|
1214
|
-
await t.loadFromJSON(d),
|
|
1213
|
+
let d = ve({ state: e });
|
|
1214
|
+
await t.loadFromJSON(d), ye({
|
|
1215
1215
|
state: e,
|
|
1216
1216
|
canvas: t
|
|
1217
1217
|
});
|
|
@@ -1293,7 +1293,7 @@ var Me = class {
|
|
|
1293
1293
|
}
|
|
1294
1294
|
}
|
|
1295
1295
|
}
|
|
1296
|
-
},
|
|
1296
|
+
}, Me = .1, Ne = 4096, Pe = 4096, Fe = "application/image-editor:", Ie = /* @__PURE__ */ "customData.backgroundType.format.contentType.width.height.originX.originY.locked.editable.evented.selectable.lockMovementX.lockMovementY.lockRotation.lockScalingX.lockScalingY.lockSkewingX.lockSkewingY.styles.lineFontDefaults.textCaseRaw.uppercase.autoExpand.linethrough.underline.fontStyle.fontWeight.backgroundOpacity.paddingTop.paddingRight.paddingBottom.paddingLeft.radiusTopLeft.radiusTopRight.radiusBottomRight.radiusBottomLeft.shapeComposite.shapePresetKey.shapeBaseWidth.shapeBaseHeight.shapeManualBaseWidth.shapeManualBaseHeight.shapeTextAutoExpand.shapeAlignHorizontal.shapeAlignVertical.shapePaddingTop.shapePaddingRight.shapePaddingBottom.shapePaddingLeft.shapeFill.shapeStroke.shapeStrokeWidth.shapeStrokeDashArray.shapeOpacity.shapeRounding.shapeNodeType".split("."), Le = class e {
|
|
1297
1297
|
constructor({ editor: e }) {
|
|
1298
1298
|
this.editor = e, this.options = e.options, this._createdBlobUrls = [], this.acceptContentTypes = this.editor.options.acceptContentTypes, this.acceptFormats = this.getAllowedFormatsFromContentTypes();
|
|
1299
1299
|
}
|
|
@@ -1490,7 +1490,7 @@ var Me = class {
|
|
|
1490
1490
|
}
|
|
1491
1491
|
}
|
|
1492
1492
|
async resizeImageToBoundaries(e) {
|
|
1493
|
-
let { dataURL: t, sizeType: n = "max", contentType: r = "image/png", quality: i = 1, maxWidth: a =
|
|
1493
|
+
let { dataURL: t, sizeType: n = "max", contentType: r = "image/png", quality: i = 1, maxWidth: a = Ne, maxHeight: o = Pe, minWidth: s = 16, minHeight: c = 16, asBase64: l = !1, emitMessage: u = !0 } = e, { errorManager: d, workerManager: f } = this.editor, p = {
|
|
1494
1494
|
dataURL: t,
|
|
1495
1495
|
sizeType: n,
|
|
1496
1496
|
contentType: r,
|
|
@@ -1766,11 +1766,11 @@ var Me = class {
|
|
|
1766
1766
|
let t = e.match(/^[^/]+\/([^+;]+)/);
|
|
1767
1767
|
return t ? t[1] : "";
|
|
1768
1768
|
}
|
|
1769
|
-
},
|
|
1770
|
-
function
|
|
1769
|
+
}, Re = (e, t, n) => Math.max(Math.min(e, n), t), ze = (e, t) => e * t;
|
|
1770
|
+
function Be(e) {
|
|
1771
1771
|
return (e?.type === "image" || e?.format === "svg") && typeof e?.width == "number" && typeof e?.height == "number";
|
|
1772
1772
|
}
|
|
1773
|
-
var
|
|
1773
|
+
var Ve = class {
|
|
1774
1774
|
constructor({ editor: e }) {
|
|
1775
1775
|
this.editor = e;
|
|
1776
1776
|
}
|
|
@@ -1780,7 +1780,7 @@ var He = class {
|
|
|
1780
1780
|
}
|
|
1781
1781
|
getVisibleCenterPoint() {
|
|
1782
1782
|
let { canvas: e } = this.editor, t = e.getZoom(), n = e.viewportTransform, r = e.getWidth(), i = e.getHeight(), a = this.getMontageAreaSceneBounds(), o = (r / 2 - n[4]) / t, s = (i / 2 - n[5]) / t;
|
|
1783
|
-
return new p(
|
|
1783
|
+
return new p(Re(o, a.left, a.right), Re(s, a.top, a.bottom));
|
|
1784
1784
|
}
|
|
1785
1785
|
getMontageAreaSceneCenter() {
|
|
1786
1786
|
let { montageArea: e } = this.editor;
|
|
@@ -1859,9 +1859,9 @@ var He = class {
|
|
|
1859
1859
|
}
|
|
1860
1860
|
setResolutionWidth(e, { preserveProportional: t, withoutSave: n, adaptCanvasToContainer: r } = {}) {
|
|
1861
1861
|
if (!e) return;
|
|
1862
|
-
let { canvas: i, montageArea: a, options: { canvasBackstoreWidth: o } } = this.editor, { width: s, height: c } = a, l =
|
|
1862
|
+
let { canvas: i, montageArea: a, options: { canvasBackstoreWidth: o } } = this.editor, { width: s, height: c } = a, l = Re(Number(e), 16, Ne);
|
|
1863
1863
|
if (!o || o === "auto" || r ? this.adaptCanvasToContainer() : o ? this.setCanvasBackstoreWidth(Number(o)) : this.setCanvasBackstoreWidth(l), a.set({ width: l }), this.placeMontageAreaAtCanonicalScenePosition(), t) {
|
|
1864
|
-
let e =
|
|
1864
|
+
let e = ze(c, l / s);
|
|
1865
1865
|
this.setResolutionHeight(e, {
|
|
1866
1866
|
withoutSave: n,
|
|
1867
1867
|
adaptCanvasToContainer: r
|
|
@@ -1877,9 +1877,9 @@ var He = class {
|
|
|
1877
1877
|
}
|
|
1878
1878
|
setResolutionHeight(e, { preserveProportional: t, withoutSave: n, adaptCanvasToContainer: r } = {}) {
|
|
1879
1879
|
if (!e) return;
|
|
1880
|
-
let { canvas: i, montageArea: a, options: { canvasBackstoreHeight: o } } = this.editor, { width: s, height: c } = a, l =
|
|
1880
|
+
let { canvas: i, montageArea: a, options: { canvasBackstoreHeight: o } } = this.editor, { width: s, height: c } = a, l = Re(Number(e), 16, Pe);
|
|
1881
1881
|
if (!o || o === "auto" || r ? this.adaptCanvasToContainer() : o ? this.setCanvasBackstoreHeight(Number(o)) : this.setCanvasBackstoreHeight(l), a.set({ height: l }), this.placeMontageAreaAtCanonicalScenePosition(), t) {
|
|
1882
|
-
let e =
|
|
1882
|
+
let e = ze(s, l / c);
|
|
1883
1883
|
this.setResolutionWidth(e, {
|
|
1884
1884
|
withoutSave: n,
|
|
1885
1885
|
adaptCanvasToContainer: r
|
|
@@ -1906,16 +1906,16 @@ var He = class {
|
|
|
1906
1906
|
}
|
|
1907
1907
|
setCanvasBackstoreWidth(e) {
|
|
1908
1908
|
if (!e || typeof e != "number") return;
|
|
1909
|
-
let t =
|
|
1909
|
+
let t = Re(e, 16, Ne);
|
|
1910
1910
|
this.editor.canvas.setDimensions({ width: t }, { backstoreOnly: !0 });
|
|
1911
1911
|
}
|
|
1912
1912
|
setCanvasBackstoreHeight(e) {
|
|
1913
1913
|
if (!e || typeof e != "number") return;
|
|
1914
|
-
let t =
|
|
1914
|
+
let t = Re(e, 16, Pe);
|
|
1915
1915
|
this.editor.canvas.setDimensions({ height: t }, { backstoreOnly: !0 });
|
|
1916
1916
|
}
|
|
1917
1917
|
adaptCanvasToContainer() {
|
|
1918
|
-
let { canvas: e } = this.editor, t = this.getEditorContainer(), n = t.clientWidth, r = t.clientHeight, i =
|
|
1918
|
+
let { canvas: e } = this.editor, t = this.getEditorContainer(), n = t.clientWidth, r = t.clientHeight, i = Re(n, 16, Ne), a = Re(r, 16, Pe);
|
|
1919
1919
|
e.setDimensions({
|
|
1920
1920
|
width: i,
|
|
1921
1921
|
height: a
|
|
@@ -2003,8 +2003,8 @@ var He = class {
|
|
|
2003
2003
|
}
|
|
2004
2004
|
scaleMontageAreaToImage({ object: e, preserveAspectRatio: t, withoutSave: n } = {}) {
|
|
2005
2005
|
let { canvas: r, montageArea: i, transformManager: a } = this.editor, o = e || r.getActiveObject();
|
|
2006
|
-
if (!
|
|
2007
|
-
let { width: s, height: c } = o, l = Math.min(s,
|
|
2006
|
+
if (!Be(o)) return;
|
|
2007
|
+
let { width: s, height: c } = o, l = Math.min(s, Ne), u = Math.min(c, Pe);
|
|
2008
2008
|
if (t) {
|
|
2009
2009
|
let { width: e, height: t } = i, n = s / e, r = c / t, a = Math.max(n, r);
|
|
2010
2010
|
l = e * a, u = t * a;
|
|
@@ -2032,7 +2032,7 @@ var He = class {
|
|
|
2032
2032
|
let { canvas: e, montageArea: t, interactionBlocker: { overlayMask: n }, backgroundManager: { backgroundObject: r } } = this.editor;
|
|
2033
2033
|
return e.getObjects().filter((e) => e.id !== t.id && e.id !== n?.id && e.id !== r?.id);
|
|
2034
2034
|
}
|
|
2035
|
-
},
|
|
2035
|
+
}, He = class {
|
|
2036
2036
|
constructor({ editor: e }) {
|
|
2037
2037
|
this.editor = e, this.options = e.options;
|
|
2038
2038
|
}
|
|
@@ -2140,7 +2140,7 @@ var He = class {
|
|
|
2140
2140
|
});
|
|
2141
2141
|
}
|
|
2142
2142
|
}
|
|
2143
|
-
},
|
|
2143
|
+
}, Ue = class {
|
|
2144
2144
|
constructor({ editor: e }) {
|
|
2145
2145
|
this.editor = e, this.options = e.options, this.minZoom = this.options.minZoom || .1, this.maxZoom = this.options.maxZoom || 2, this.defaultZoom = this._normalizeDefaultZoom(this.options.defaultScale);
|
|
2146
2146
|
}
|
|
@@ -2194,7 +2194,7 @@ var He = class {
|
|
|
2194
2194
|
y: Math.abs(T) > Math.abs(d) ? d : T
|
|
2195
2195
|
};
|
|
2196
2196
|
}
|
|
2197
|
-
_applyViewportCentering(e, t = !1, n =
|
|
2197
|
+
_applyViewportCentering(e, t = !1, n = Me) {
|
|
2198
2198
|
let { canvas: r } = this.editor, i = this._getScaledMontageDimensions(e), a = r.getWidth(), o = r.getHeight(), s = i.width > a || i.height > o, c = this._calculateFitZoom(), l = e - c;
|
|
2199
2199
|
if (!(!s || l) && !t) return !1;
|
|
2200
2200
|
let u = r.viewportTransform, d = this._calculateTargetViewportPosition(e);
|
|
@@ -2243,7 +2243,7 @@ var He = class {
|
|
|
2243
2243
|
pointY: u.y
|
|
2244
2244
|
});
|
|
2245
2245
|
}
|
|
2246
|
-
zoom(e =
|
|
2246
|
+
zoom(e = Me, t = {}) {
|
|
2247
2247
|
if (!e) return;
|
|
2248
2248
|
let { minZoom: n, maxZoom: r } = this, { canvas: i } = this.editor, a = e < 0, o = i.getZoom(), s = i.getCenterPoint(), c = new p(t.pointX ?? s.x, t.pointY ?? s.y);
|
|
2249
2249
|
this.editor.montageArea.setCoords(), this.editor.canvas.requestRenderAll();
|
|
@@ -2269,30 +2269,30 @@ var He = class {
|
|
|
2269
2269
|
point: r
|
|
2270
2270
|
}), this.editor.panConstraintManager.updateBounds();
|
|
2271
2271
|
}
|
|
2272
|
-
},
|
|
2273
|
-
let r =
|
|
2272
|
+
}, W = ({ value: e, fallback: t = 0 }) => typeof e == "number" && Number.isFinite(e) ? e : typeof t == "number" && Number.isFinite(t) ? t : 0, We = ({ value: e, dimension: t, useRelativePositions: n }) => {
|
|
2273
|
+
let r = W({ value: e });
|
|
2274
2274
|
return n ? r : r / (t || 1);
|
|
2275
|
-
},
|
|
2276
|
-
x:
|
|
2275
|
+
}, Ge = ({ object: e, baseWidth: t, baseHeight: n, useRelativePositions: r }) => ({
|
|
2276
|
+
x: We({
|
|
2277
2277
|
value: e.left,
|
|
2278
2278
|
dimension: t,
|
|
2279
2279
|
useRelativePositions: r
|
|
2280
2280
|
}),
|
|
2281
|
-
y:
|
|
2281
|
+
y: We({
|
|
2282
2282
|
value: e.top,
|
|
2283
2283
|
dimension: n,
|
|
2284
2284
|
useRelativePositions: r
|
|
2285
2285
|
})
|
|
2286
|
-
}),
|
|
2286
|
+
}), Ke = ({ normalizedX: e, normalizedY: t, bounds: n }) => {
|
|
2287
2287
|
let { left: r, top: i, width: a, height: o } = n;
|
|
2288
2288
|
return new p(r + e * a, i + t * o);
|
|
2289
|
-
},
|
|
2289
|
+
}, qe = ({ object: e }) => {
|
|
2290
2290
|
let { left: t = 0, top: n = 0, width: r = 0, height: i = 0, scaleX: a = 1, scaleY: o = 1, strokeWidth: s = 0, strokeUniform: c = !1 } = e, l = typeof e.type == "string" ? e.type.toLowerCase() : "", u = e instanceof _ || l === "textbox" || l === "background-textbox", d = c ? 0 : s, f = r + d, p = i + d, m = {
|
|
2291
2291
|
left: Math.round(t),
|
|
2292
2292
|
top: Math.round(n)
|
|
2293
2293
|
};
|
|
2294
2294
|
u || (f > 0 && (m.scaleX = Math.max(1, Math.round(f * a)) / f), p > 0 && (m.scaleY = Math.max(1, Math.round(p * o)) / p)), e.set(m), e.setCoords();
|
|
2295
|
-
},
|
|
2295
|
+
}, Je = ({ object: e }) => {
|
|
2296
2296
|
if (!e) return null;
|
|
2297
2297
|
try {
|
|
2298
2298
|
e.setCoords();
|
|
@@ -2317,7 +2317,7 @@ function Ye({ canvas: e, object: t, left: n, top: r, centerPoint: i, flags: a })
|
|
|
2317
2317
|
let n = i ?? e.getCenterPoint();
|
|
2318
2318
|
t.setPositionByOrigin(n, "center", "center"), t.setCoords();
|
|
2319
2319
|
}
|
|
2320
|
-
return
|
|
2320
|
+
return qe({ object: t }), s ? t : (e.add(t), o || e.setActiveObject(t), e.renderAll(), t);
|
|
2321
2321
|
}
|
|
2322
2322
|
var Xe = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
2323
2323
|
let { id: i = `rect-${D()}`, left: a, top: o, width: s = 100, height: c = 100, fill: l = "blue", ...u } = t;
|
|
@@ -5232,44 +5232,268 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5232
5232
|
lockMovementY: n.textLockMovementY
|
|
5233
5233
|
}), this.editingInteractionState.delete(e), e.setCoords(), t.setCoords());
|
|
5234
5234
|
}
|
|
5235
|
-
}, ar =
|
|
5235
|
+
}, ar = class e {
|
|
5236
|
+
constructor({ canvas: e }) {
|
|
5237
|
+
this.canvas = e, this.textEditingSnapshots = /* @__PURE__ */ new WeakMap(), this.pendingTextUpdates = /* @__PURE__ */ new WeakMap(), this.resizeStartSnapshots = /* @__PURE__ */ new Map(), this.pendingResizeUpdates = /* @__PURE__ */ new WeakMap();
|
|
5238
|
+
}
|
|
5239
|
+
createContext({ group: t, source: n, target: r, presetKey: i, options: a, withoutSave: o }) {
|
|
5240
|
+
return this._createContextFromBefore({
|
|
5241
|
+
group: t,
|
|
5242
|
+
before: e.getSnapshot({ group: t }),
|
|
5243
|
+
source: n,
|
|
5244
|
+
target: r,
|
|
5245
|
+
presetKey: i,
|
|
5246
|
+
options: a,
|
|
5247
|
+
withoutSave: o
|
|
5248
|
+
});
|
|
5249
|
+
}
|
|
5250
|
+
fireBefore({ lifecycle: e }) {
|
|
5251
|
+
this.canvas.fire("editor:before:shape-updated", e.payload);
|
|
5252
|
+
}
|
|
5253
|
+
fireUpdated({ lifecycle: t, after: n }) {
|
|
5254
|
+
let r = n ?? e.getSnapshot({ group: t.payload.shape }), i = {
|
|
5255
|
+
...t.payload,
|
|
5256
|
+
before: t.before,
|
|
5257
|
+
after: r
|
|
5258
|
+
};
|
|
5259
|
+
return this.canvas.fire("editor:shape-updated", i), r;
|
|
5260
|
+
}
|
|
5261
|
+
beginTextEditing({ group: t }) {
|
|
5262
|
+
this.textEditingSnapshots.set(t, e.getSnapshot({ group: t }));
|
|
5263
|
+
}
|
|
5264
|
+
finishTextEditing({ group: t, textNode: n }) {
|
|
5265
|
+
let r = this.textEditingSnapshots.get(t);
|
|
5266
|
+
if (this.textEditingSnapshots.delete(t), !r) return null;
|
|
5267
|
+
let i = e.getSnapshot({ group: t });
|
|
5268
|
+
if (e.areSnapshotsEqual({
|
|
5269
|
+
before: r,
|
|
5270
|
+
after: i
|
|
5271
|
+
})) return null;
|
|
5272
|
+
let a = this._createContextFromBefore({
|
|
5273
|
+
group: t,
|
|
5274
|
+
before: r,
|
|
5275
|
+
source: "text-edit",
|
|
5276
|
+
target: n
|
|
5277
|
+
});
|
|
5278
|
+
return this.fireBefore({ lifecycle: a }), this.fireUpdated({
|
|
5279
|
+
lifecycle: a,
|
|
5280
|
+
after: i
|
|
5281
|
+
});
|
|
5282
|
+
}
|
|
5283
|
+
beginTextUpdate({ group: e, textNode: t, withoutSave: n }) {
|
|
5284
|
+
let r = this.createContext({
|
|
5285
|
+
group: e,
|
|
5286
|
+
source: "text-update",
|
|
5287
|
+
target: t,
|
|
5288
|
+
withoutSave: n
|
|
5289
|
+
});
|
|
5290
|
+
return this.pendingTextUpdates.set(t, r), r;
|
|
5291
|
+
}
|
|
5292
|
+
cancelTextUpdate({ textNode: e }) {
|
|
5293
|
+
this.pendingTextUpdates.delete(e);
|
|
5294
|
+
}
|
|
5295
|
+
finishTextUpdate({ textNode: e }) {
|
|
5296
|
+
let t = this.pendingTextUpdates.get(e);
|
|
5297
|
+
if (!t) return null;
|
|
5298
|
+
this.pendingTextUpdates.delete(e);
|
|
5299
|
+
let n = this.fireUpdated({ lifecycle: t }), { group: r } = e;
|
|
5300
|
+
return J(r) && this.textEditingSnapshots.has(r) && this.textEditingSnapshots.set(r, n), n;
|
|
5301
|
+
}
|
|
5302
|
+
captureResizeStart({ group: t }) {
|
|
5303
|
+
this.resizeStartSnapshots.has(t) || this.resizeStartSnapshots.set(t, e.getSnapshot({ group: t }));
|
|
5304
|
+
}
|
|
5305
|
+
beginResize({ group: t }) {
|
|
5306
|
+
if (this.pendingResizeUpdates.has(t)) return;
|
|
5307
|
+
let n = this.resizeStartSnapshots.get(t) ?? e.getSnapshot({ group: t });
|
|
5308
|
+
this.resizeStartSnapshots.delete(t), this.pendingResizeUpdates.set(t, this._createContextFromBefore({
|
|
5309
|
+
group: t,
|
|
5310
|
+
before: n,
|
|
5311
|
+
source: "resize",
|
|
5312
|
+
target: t
|
|
5313
|
+
}));
|
|
5314
|
+
}
|
|
5315
|
+
clearResizeStarts() {
|
|
5316
|
+
this.resizeStartSnapshots.clear();
|
|
5317
|
+
}
|
|
5318
|
+
finishResize({ group: t }) {
|
|
5319
|
+
let n = this.pendingResizeUpdates.get(t);
|
|
5320
|
+
if (!n) return null;
|
|
5321
|
+
this.pendingResizeUpdates.delete(t);
|
|
5322
|
+
let r = e.getSnapshot({ group: t });
|
|
5323
|
+
return e.areSnapshotsEqual({
|
|
5324
|
+
before: n.before,
|
|
5325
|
+
after: r
|
|
5326
|
+
}) ? null : (this.fireBefore({ lifecycle: n }), this.fireUpdated({
|
|
5327
|
+
lifecycle: n,
|
|
5328
|
+
after: r
|
|
5329
|
+
}));
|
|
5330
|
+
}
|
|
5331
|
+
static getSnapshot({ group: t }) {
|
|
5332
|
+
let { id: n, shapePresetKey: r, shapeBaseWidth: i, shapeBaseHeight: a, shapeManualBaseWidth: o, shapeManualBaseHeight: s, shapeTextAutoExpand: c, shapeAlignHorizontal: l, shapeAlignVertical: u, shapePaddingTop: d, shapePaddingRight: f, shapePaddingBottom: p, shapePaddingLeft: m, shapeFill: h, shapeStroke: g, shapeStrokeWidth: _, shapeStrokeDashArray: v, shapeOpacity: y, shapeRounding: b, left: x, top: S, originX: C, originY: w, angle: T, flipX: E, flipY: D, scaleX: O, scaleY: k } = t, { text: A } = Y({ group: t });
|
|
5333
|
+
return {
|
|
5334
|
+
id: n,
|
|
5335
|
+
presetKey: r,
|
|
5336
|
+
baseWidth: i,
|
|
5337
|
+
baseHeight: a,
|
|
5338
|
+
manualBaseWidth: o,
|
|
5339
|
+
manualBaseHeight: s,
|
|
5340
|
+
currentWidth: Math.max(1, (i ?? t.width ?? 1) * (Math.abs(O ?? 1) || 1)),
|
|
5341
|
+
currentHeight: Math.max(1, (a ?? t.height ?? 1) * (Math.abs(k ?? 1) || 1)),
|
|
5342
|
+
shapeTextAutoExpand: c !== !1,
|
|
5343
|
+
alignH: l ?? "center",
|
|
5344
|
+
alignV: u ?? "middle",
|
|
5345
|
+
padding: {
|
|
5346
|
+
top: d ?? 0,
|
|
5347
|
+
right: f ?? 0,
|
|
5348
|
+
bottom: p ?? 0,
|
|
5349
|
+
left: m ?? 0
|
|
5350
|
+
},
|
|
5351
|
+
fill: h,
|
|
5352
|
+
stroke: g,
|
|
5353
|
+
strokeWidth: _,
|
|
5354
|
+
strokeDashArray: v ? v.slice() : v ?? null,
|
|
5355
|
+
opacity: y,
|
|
5356
|
+
rounding: b,
|
|
5357
|
+
left: x,
|
|
5358
|
+
top: S,
|
|
5359
|
+
originX: C,
|
|
5360
|
+
originY: w,
|
|
5361
|
+
angle: T,
|
|
5362
|
+
flipX: !!E,
|
|
5363
|
+
flipY: !!D,
|
|
5364
|
+
scaleX: O,
|
|
5365
|
+
scaleY: k,
|
|
5366
|
+
text: A ? e._getTextNodeSnapshot({ textNode: A }) : void 0
|
|
5367
|
+
};
|
|
5368
|
+
}
|
|
5369
|
+
static areSnapshotsEqual({ before: e, after: t }) {
|
|
5370
|
+
return JSON.stringify(e) === JSON.stringify(t);
|
|
5371
|
+
}
|
|
5372
|
+
_createContextFromBefore({ group: e, before: t, source: n, target: r, presetKey: i, options: a, withoutSave: o }) {
|
|
5373
|
+
return {
|
|
5374
|
+
before: t,
|
|
5375
|
+
payload: {
|
|
5376
|
+
shape: e,
|
|
5377
|
+
source: n,
|
|
5378
|
+
target: r,
|
|
5379
|
+
presetKey: i,
|
|
5380
|
+
options: a,
|
|
5381
|
+
withoutSave: o
|
|
5382
|
+
}
|
|
5383
|
+
};
|
|
5384
|
+
}
|
|
5385
|
+
static _getTextNodeSnapshot({ textNode: e }) {
|
|
5386
|
+
let t = e, n = ({ snapshot: e, entries: t }) => {
|
|
5387
|
+
Object.entries(t).forEach(([t, n]) => {
|
|
5388
|
+
n != null && (e[t] = n);
|
|
5389
|
+
});
|
|
5390
|
+
}, { id: r, text: i, textCaseRaw: a, uppercase: o, autoExpand: s, fontFamily: c, fontSize: l, fontWeight: u, fontStyle: d, underline: f, linethrough: p, textAlign: m, fill: h, stroke: g, strokeWidth: _, opacity: v, backgroundColor: y, backgroundOpacity: b, paddingTop: x, paddingRight: S, paddingBottom: C, paddingLeft: w, radiusTopLeft: T, radiusTopRight: E, radiusBottomRight: D, radiusBottomLeft: O, left: k, top: A, width: j, height: M, angle: N, scaleX: P, scaleY: F } = t, I = {
|
|
5391
|
+
id: r,
|
|
5392
|
+
uppercase: !!o,
|
|
5393
|
+
textAlign: m
|
|
5394
|
+
};
|
|
5395
|
+
return n({
|
|
5396
|
+
snapshot: I,
|
|
5397
|
+
entries: {
|
|
5398
|
+
text: i,
|
|
5399
|
+
textCaseRaw: a,
|
|
5400
|
+
autoExpand: s,
|
|
5401
|
+
fontFamily: c,
|
|
5402
|
+
fontSize: l,
|
|
5403
|
+
fontWeight: u,
|
|
5404
|
+
fontStyle: d,
|
|
5405
|
+
underline: f,
|
|
5406
|
+
linethrough: p,
|
|
5407
|
+
fill: h,
|
|
5408
|
+
stroke: g,
|
|
5409
|
+
strokeWidth: _,
|
|
5410
|
+
opacity: v,
|
|
5411
|
+
backgroundColor: y,
|
|
5412
|
+
backgroundOpacity: b,
|
|
5413
|
+
paddingTop: x,
|
|
5414
|
+
paddingRight: S,
|
|
5415
|
+
paddingBottom: C,
|
|
5416
|
+
paddingLeft: w,
|
|
5417
|
+
radiusTopLeft: T,
|
|
5418
|
+
radiusTopRight: E,
|
|
5419
|
+
radiusBottomRight: D,
|
|
5420
|
+
radiusBottomLeft: O,
|
|
5421
|
+
left: k,
|
|
5422
|
+
top: A,
|
|
5423
|
+
width: j,
|
|
5424
|
+
height: M,
|
|
5425
|
+
angle: N,
|
|
5426
|
+
scaleX: P,
|
|
5427
|
+
scaleY: F
|
|
5428
|
+
}
|
|
5429
|
+
}), I;
|
|
5430
|
+
}
|
|
5431
|
+
}, or = "#B0B5BF", sr = 0, cr = 1, lr = class {
|
|
5236
5432
|
constructor({ editor: e }) {
|
|
5237
5433
|
this._handleObjectScaling = (e) => {
|
|
5238
|
-
|
|
5434
|
+
let t = e.target && J(e.target) ? e.target : null;
|
|
5435
|
+
t && this.lifecycleController.beginResize({ group: t }), this.scalingController.handleObjectScaling(e);
|
|
5239
5436
|
}, this._handleObjectModified = (e) => {
|
|
5240
5437
|
this.scalingController.handleObjectModified(e);
|
|
5438
|
+
let t = e.target && J(e.target) ? e.target : null;
|
|
5439
|
+
t && this.lifecycleController.finishResize({ group: t });
|
|
5241
5440
|
}, this._handleMouseMove = (e) => {
|
|
5242
5441
|
this.scalingController.handleCanvasMouseMove(e);
|
|
5243
5442
|
}, this._handleMouseDown = (e) => {
|
|
5244
|
-
this.
|
|
5443
|
+
this._collectShapeGroupsFromTarget({
|
|
5444
|
+
target: e.target,
|
|
5445
|
+
subTargets: e.subTargets
|
|
5446
|
+
}).forEach((e) => {
|
|
5447
|
+
this.lifecycleController.captureResizeStart({ group: e });
|
|
5448
|
+
}), this.editingController.handleMouseDown(e);
|
|
5449
|
+
}, this._handleMouseUp = () => {
|
|
5450
|
+
this.lifecycleController.clearResizeStarts();
|
|
5245
5451
|
}, this._handleTextEditingExited = (e) => {
|
|
5246
|
-
let { target:
|
|
5247
|
-
if (
|
|
5248
|
-
let { group:
|
|
5249
|
-
J(
|
|
5452
|
+
let t = null, { target: n } = e;
|
|
5453
|
+
if (n instanceof _) {
|
|
5454
|
+
let e = n, { group: r } = e;
|
|
5455
|
+
J(r) && (this.editingPlacements.delete(r), t = {
|
|
5456
|
+
group: r,
|
|
5457
|
+
textNode: e
|
|
5458
|
+
});
|
|
5250
5459
|
}
|
|
5251
|
-
this.editingController.handleTextEditingExited(e);
|
|
5460
|
+
this.editingController.handleTextEditingExited(e), t && this.lifecycleController.finishTextEditing(t);
|
|
5252
5461
|
}, this._handleTextEditingEntered = (e) => {
|
|
5253
5462
|
let { target: t } = e;
|
|
5254
5463
|
if (t instanceof _) {
|
|
5255
5464
|
let { group: e } = t;
|
|
5256
|
-
J(e) && (this._detachShapeGroupAutoLayout({ group: e }), this.editingPlacements.set(e, this.editor.canvasManager.getObjectPlacement({ object: e })));
|
|
5465
|
+
J(e) && (this._detachShapeGroupAutoLayout({ group: e }), this.lifecycleController.beginTextEditing({ group: e }), this.editingPlacements.set(e, this.editor.canvasManager.getObjectPlacement({ object: e })));
|
|
5257
5466
|
}
|
|
5258
5467
|
this.editingController.handleTextEditingEntered(e);
|
|
5259
5468
|
}, this._handleTextChanged = (e) => {
|
|
5260
5469
|
let { target: t } = e;
|
|
5261
5470
|
if (!(t instanceof _)) return;
|
|
5262
|
-
let n = t;
|
|
5263
|
-
this._syncShapeTextLayoutAfterTextMutation({ textNode: n }) && this.editor.canvas.requestRenderAll();
|
|
5471
|
+
let n = t, { group: r } = n;
|
|
5472
|
+
J(r) && this._syncShapeTextLayoutAfterTextMutation({ textNode: n }) && this.editor.canvas.requestRenderAll();
|
|
5264
5473
|
}, this._handleBeforeTextUpdated = (e) => {
|
|
5265
5474
|
let { textbox: t, style: n } = e;
|
|
5266
5475
|
if (!(t instanceof _)) return;
|
|
5267
|
-
let r = t;
|
|
5268
|
-
this.internalTextUpdates.has(r)
|
|
5476
|
+
let r = t, { group: i } = r;
|
|
5477
|
+
if (!J(i) || this.internalTextUpdates.has(r)) return;
|
|
5478
|
+
let a = this.lifecycleController.beginTextUpdate({
|
|
5479
|
+
group: i,
|
|
5269
5480
|
textNode: r,
|
|
5270
|
-
|
|
5481
|
+
withoutSave: e.options.withoutSave
|
|
5271
5482
|
});
|
|
5272
|
-
|
|
5483
|
+
if (!this._syncShapeTextLayoutAfterTextMutation({
|
|
5484
|
+
textNode: r,
|
|
5485
|
+
textStyle: n
|
|
5486
|
+
})) {
|
|
5487
|
+
this.lifecycleController.cancelTextUpdate({ textNode: r });
|
|
5488
|
+
return;
|
|
5489
|
+
}
|
|
5490
|
+
this.lifecycleController.fireBefore({ lifecycle: a });
|
|
5491
|
+
}, this._handleTextUpdated = (e) => {
|
|
5492
|
+
let { textbox: t } = e;
|
|
5493
|
+
if (!(t instanceof _)) return;
|
|
5494
|
+
let n = t;
|
|
5495
|
+
this.lifecycleController.finishTextUpdate({ textNode: n });
|
|
5496
|
+
}, this.editor = e, zn(), this.scalingController = new rr({ canvas: e.canvas }), this.editingController = new ir({ canvas: e.canvas }), this.editingPlacements = /* @__PURE__ */ new WeakMap(), this.lifecycleController = new ar({ canvas: e.canvas }), this.internalTextUpdates = /* @__PURE__ */ new WeakSet(), this._bindEvents();
|
|
5273
5497
|
}
|
|
5274
5498
|
async add({ presetKey: e = ot, options: t = {} } = {}) {
|
|
5275
5499
|
let n = dt({ presetKey: e });
|
|
@@ -5330,7 +5554,11 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5330
5554
|
changedPadding: j,
|
|
5331
5555
|
style: E,
|
|
5332
5556
|
rounding: h
|
|
5333
|
-
})
|
|
5557
|
+
}), I = {
|
|
5558
|
+
shape: F,
|
|
5559
|
+
presetKey: b.key,
|
|
5560
|
+
options: t
|
|
5561
|
+
};
|
|
5334
5562
|
if (o === void 0 && s === void 0) this.editor.canvasManager.centerObjectToMontageArea({ object: F });
|
|
5335
5563
|
else {
|
|
5336
5564
|
let e = this.editor.canvasManager.resolveObjectPlacement({
|
|
@@ -5346,14 +5574,14 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5346
5574
|
placement: e
|
|
5347
5575
|
});
|
|
5348
5576
|
}
|
|
5349
|
-
if (g) return F;
|
|
5577
|
+
if (g) return this.editor.canvas.fire("editor:shape-added", I), F;
|
|
5350
5578
|
this._beginMutation();
|
|
5351
5579
|
try {
|
|
5352
5580
|
this.editor.canvas.add(F), _ || this.editor.canvas.setActiveObject(F), this.editor.canvas.requestRenderAll();
|
|
5353
5581
|
} finally {
|
|
5354
5582
|
this._endMutation({ withoutSave: v });
|
|
5355
5583
|
}
|
|
5356
|
-
return F;
|
|
5584
|
+
return this.editor.canvas.fire("editor:shape-added", I), F;
|
|
5357
5585
|
}
|
|
5358
5586
|
async update({ target: e, presetKey: t, options: n = {} } = {}) {
|
|
5359
5587
|
let r = this._resolveShapeGroup({ target: e });
|
|
@@ -5388,9 +5616,16 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5388
5616
|
addition: j
|
|
5389
5617
|
}), F = Math.max(1, r.shapeManualBaseWidth ?? x.width);
|
|
5390
5618
|
l !== void 0 && (F = Math.max(1, l)), l === void 0 && C && !w && (F = Math.max(1, x.width));
|
|
5391
|
-
let
|
|
5392
|
-
if (!
|
|
5393
|
-
let
|
|
5619
|
+
let I = Math.max(1, u ?? r.shapeManualBaseHeight ?? S), { shape: ee, text: L } = Y({ group: r });
|
|
5620
|
+
if (!ee || !L) return null;
|
|
5621
|
+
let R = this.lifecycleController.createContext({
|
|
5622
|
+
group: r,
|
|
5623
|
+
source: "update",
|
|
5624
|
+
target: e,
|
|
5625
|
+
presetKey: E.key,
|
|
5626
|
+
options: n,
|
|
5627
|
+
withoutSave: y
|
|
5628
|
+
}), te = {
|
|
5394
5629
|
angle: 0,
|
|
5395
5630
|
skewX: 0,
|
|
5396
5631
|
skewY: 0,
|
|
@@ -5403,46 +5638,46 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5403
5638
|
top: 0,
|
|
5404
5639
|
originX: "left",
|
|
5405
5640
|
originY: "top"
|
|
5406
|
-
},
|
|
5407
|
-
text:
|
|
5408
|
-
textStyle: this._resolveCurrentTextStyle({ textNode:
|
|
5409
|
-
width: Math.max(1,
|
|
5641
|
+
}, ne = L, z = this._createTextNode({
|
|
5642
|
+
text: ne.textCaseRaw ?? L.text ?? "",
|
|
5643
|
+
textStyle: this._resolveCurrentTextStyle({ textNode: L }),
|
|
5644
|
+
width: Math.max(1, L.width ?? x.width),
|
|
5410
5645
|
align: D
|
|
5411
5646
|
});
|
|
5412
|
-
|
|
5413
|
-
textNode:
|
|
5647
|
+
z.set(te), this._applyTextUpdates({
|
|
5648
|
+
textNode: z,
|
|
5414
5649
|
text: f,
|
|
5415
5650
|
textStyle: p,
|
|
5416
5651
|
align: D
|
|
5417
5652
|
});
|
|
5418
|
-
let
|
|
5419
|
-
text:
|
|
5653
|
+
let re = l === void 0 && u === void 0 && t === void 0 && d === void 0 && _ === void 0 && f === void 0 && !this._hasShapeTextSizeAffectingStyleChanges({ textStyle: p }), B = g !== void 0 && re, V = re ? x.width : this._resolveShapeLayoutWidth({
|
|
5654
|
+
text: z,
|
|
5420
5655
|
currentWidth: x.width,
|
|
5421
5656
|
manualWidth: F,
|
|
5422
5657
|
shapeTextAutoExpandEnabled: w,
|
|
5423
5658
|
padding: P
|
|
5424
|
-
}),
|
|
5659
|
+
}), H = await Pt({
|
|
5425
5660
|
preset: E,
|
|
5426
|
-
width:
|
|
5661
|
+
width: V,
|
|
5427
5662
|
height: S,
|
|
5428
5663
|
style: M,
|
|
5429
5664
|
rounding: T
|
|
5430
|
-
}),
|
|
5431
|
-
if (
|
|
5432
|
-
let
|
|
5433
|
-
this._detachShapeGroupAutoLayout({ group: r }),
|
|
5434
|
-
textNode:
|
|
5665
|
+
}), ie = r.getObjects().indexOf(ee);
|
|
5666
|
+
if (ie < 0) return null;
|
|
5667
|
+
let U = () => {
|
|
5668
|
+
this._detachShapeGroupAutoLayout({ group: r }), L.set(te), this._applyTextUpdates({
|
|
5669
|
+
textNode: L,
|
|
5435
5670
|
text: f,
|
|
5436
5671
|
textStyle: p,
|
|
5437
5672
|
align: D
|
|
5438
|
-
}), r.remove(
|
|
5673
|
+
}), r.remove(ee), r.insertAt(ie, H), this._applyShapeGroupMetadata({
|
|
5439
5674
|
group: r,
|
|
5440
5675
|
presetKey: E.key,
|
|
5441
5676
|
presetCanRound: gt({ preset: E }),
|
|
5442
|
-
width:
|
|
5677
|
+
width: V,
|
|
5443
5678
|
height: S,
|
|
5444
5679
|
manualWidth: F,
|
|
5445
|
-
manualHeight:
|
|
5680
|
+
manualHeight: I,
|
|
5446
5681
|
shapeTextAutoExpand: w,
|
|
5447
5682
|
alignH: D,
|
|
5448
5683
|
alignV: O,
|
|
@@ -5451,26 +5686,26 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5451
5686
|
rounding: T
|
|
5452
5687
|
}), this._applyCurrentLayout({
|
|
5453
5688
|
group: r,
|
|
5454
|
-
shape:
|
|
5455
|
-
text:
|
|
5689
|
+
shape: H,
|
|
5690
|
+
text: L,
|
|
5456
5691
|
placement: b,
|
|
5457
|
-
width:
|
|
5692
|
+
width: V,
|
|
5458
5693
|
height: S,
|
|
5459
5694
|
alignH: D,
|
|
5460
5695
|
alignV: O,
|
|
5461
5696
|
internalShapeTextInset: N,
|
|
5462
|
-
expandShapeHeightToFitText: !
|
|
5697
|
+
expandShapeHeightToFitText: !B,
|
|
5463
5698
|
changedPadding: A
|
|
5464
|
-
}),
|
|
5699
|
+
}), L.isEditing && this.editingPlacements.set(r, b);
|
|
5465
5700
|
};
|
|
5466
|
-
if (!this._isOnCanvas({ object: r })) return
|
|
5701
|
+
if (!this._isOnCanvas({ object: r })) return U(), this.lifecycleController.fireBefore({ lifecycle: R }), this.lifecycleController.fireUpdated({ lifecycle: R }), r;
|
|
5467
5702
|
this._beginMutation();
|
|
5468
5703
|
try {
|
|
5469
|
-
|
|
5704
|
+
U(), !L.isEditing && !v && this.editor.canvas.setActiveObject(r), this.lifecycleController.fireBefore({ lifecycle: R }), this.editor.canvas.requestRenderAll();
|
|
5470
5705
|
} finally {
|
|
5471
5706
|
this._endMutation({ withoutSave: y });
|
|
5472
5707
|
}
|
|
5473
|
-
return r;
|
|
5708
|
+
return this.lifecycleController.fireUpdated({ lifecycle: R }), r;
|
|
5474
5709
|
}
|
|
5475
5710
|
remove({ target: e, withoutSave: t } = {}) {
|
|
5476
5711
|
let n = this._resolveShapeGroup({ target: e });
|
|
@@ -5488,22 +5723,34 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5488
5723
|
if (!r) return null;
|
|
5489
5724
|
let { shape: i } = Y({ group: r });
|
|
5490
5725
|
if (!i) return null;
|
|
5726
|
+
let a = this.lifecycleController.createContext({
|
|
5727
|
+
group: r,
|
|
5728
|
+
source: "fill",
|
|
5729
|
+
target: e,
|
|
5730
|
+
withoutSave: n
|
|
5731
|
+
});
|
|
5491
5732
|
this._beginMutation();
|
|
5492
5733
|
try {
|
|
5493
5734
|
St({
|
|
5494
5735
|
shape: i,
|
|
5495
5736
|
style: { fill: t }
|
|
5496
|
-
}), r.shapeFill = t, r.setCoords(), this.editor.canvas.requestRenderAll();
|
|
5737
|
+
}), r.shapeFill = t, r.setCoords(), this.lifecycleController.fireBefore({ lifecycle: a }), this.editor.canvas.requestRenderAll();
|
|
5497
5738
|
} finally {
|
|
5498
5739
|
this._endMutation({ withoutSave: n });
|
|
5499
5740
|
}
|
|
5500
|
-
return r;
|
|
5741
|
+
return this.lifecycleController.fireUpdated({ lifecycle: a }), r;
|
|
5501
5742
|
}
|
|
5502
5743
|
setStroke({ target: e, stroke: t, strokeWidth: n, dash: r, withoutSave: i }) {
|
|
5503
5744
|
let a = this._resolveShapeGroup({ target: e });
|
|
5504
5745
|
if (!a) return null;
|
|
5505
5746
|
let { shape: o, text: s } = Y({ group: a });
|
|
5506
5747
|
if (!o) return null;
|
|
5748
|
+
let c = this.lifecycleController.createContext({
|
|
5749
|
+
group: a,
|
|
5750
|
+
source: "stroke",
|
|
5751
|
+
target: e,
|
|
5752
|
+
withoutSave: i
|
|
5753
|
+
});
|
|
5507
5754
|
this._beginMutation();
|
|
5508
5755
|
try {
|
|
5509
5756
|
if (St({
|
|
@@ -5523,27 +5770,33 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5523
5770
|
height: e.height
|
|
5524
5771
|
});
|
|
5525
5772
|
}
|
|
5526
|
-
a.setCoords(), this.editor.canvas.requestRenderAll();
|
|
5773
|
+
a.setCoords(), this.lifecycleController.fireBefore({ lifecycle: c }), this.editor.canvas.requestRenderAll();
|
|
5527
5774
|
} finally {
|
|
5528
5775
|
this._endMutation({ withoutSave: i });
|
|
5529
5776
|
}
|
|
5530
|
-
return a;
|
|
5777
|
+
return this.lifecycleController.fireUpdated({ lifecycle: c }), a;
|
|
5531
5778
|
}
|
|
5532
5779
|
setOpacity({ target: e, opacity: t, withoutSave: n }) {
|
|
5533
5780
|
let r = this._resolveShapeGroup({ target: e });
|
|
5534
5781
|
if (!r) return null;
|
|
5535
5782
|
let { shape: i, text: a } = Y({ group: r });
|
|
5536
5783
|
if (!i) return null;
|
|
5784
|
+
let o = this.lifecycleController.createContext({
|
|
5785
|
+
group: r,
|
|
5786
|
+
source: "opacity",
|
|
5787
|
+
target: e,
|
|
5788
|
+
withoutSave: n
|
|
5789
|
+
});
|
|
5537
5790
|
this._beginMutation();
|
|
5538
5791
|
try {
|
|
5539
5792
|
St({
|
|
5540
5793
|
shape: i,
|
|
5541
5794
|
style: { opacity: t }
|
|
5542
|
-
}), a && (a.set({ opacity: t }), a.setCoords()), r.shapeOpacity = t, r.setCoords(), this.editor.canvas.requestRenderAll();
|
|
5795
|
+
}), a && (a.set({ opacity: t }), a.setCoords()), r.shapeOpacity = t, r.setCoords(), this.lifecycleController.fireBefore({ lifecycle: o }), this.editor.canvas.requestRenderAll();
|
|
5543
5796
|
} finally {
|
|
5544
5797
|
this._endMutation({ withoutSave: n });
|
|
5545
5798
|
}
|
|
5546
|
-
return r;
|
|
5799
|
+
return this.lifecycleController.fireUpdated({ lifecycle: o }), r;
|
|
5547
5800
|
}
|
|
5548
5801
|
getTextNode({ target: e } = {}) {
|
|
5549
5802
|
let t = this._resolveShapeGroup({ target: e });
|
|
@@ -5560,6 +5813,11 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5560
5813
|
let o = this._resolveManualDimensions({ group: r }), s = this.editor.canvasManager.getObjectPlacement({ object: r }), c = this._resolveShapeTextHorizontalAlign({
|
|
5561
5814
|
group: r,
|
|
5562
5815
|
textStyle: t
|
|
5816
|
+
}), l = this.lifecycleController.createContext({
|
|
5817
|
+
group: r,
|
|
5818
|
+
source: "text-style",
|
|
5819
|
+
target: e,
|
|
5820
|
+
withoutSave: n
|
|
5563
5821
|
});
|
|
5564
5822
|
this._beginMutation();
|
|
5565
5823
|
try {
|
|
@@ -5574,18 +5832,23 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5574
5832
|
placement: s,
|
|
5575
5833
|
height: o.height,
|
|
5576
5834
|
alignH: c
|
|
5577
|
-
}), this.editor.canvas.requestRenderAll();
|
|
5835
|
+
}), this.lifecycleController.fireBefore({ lifecycle: l }), this.editor.canvas.requestRenderAll();
|
|
5578
5836
|
} finally {
|
|
5579
5837
|
this._endMutation({ withoutSave: n });
|
|
5580
5838
|
}
|
|
5581
|
-
return r;
|
|
5839
|
+
return this.lifecycleController.fireUpdated({ lifecycle: l }), r;
|
|
5582
5840
|
}
|
|
5583
5841
|
setTextAlign({ target: e, horizontal: t, vertical: n, withoutSave: r }) {
|
|
5584
5842
|
let i = this._resolveShapeGroup({ target: e });
|
|
5585
5843
|
if (!i) return null;
|
|
5586
5844
|
let { shape: a, text: o } = Y({ group: i });
|
|
5587
5845
|
if (!a || !o) return null;
|
|
5588
|
-
let s = this._resolveCurrentDimensions({ group: i }), c = t ?? i.shapeAlignHorizontal ?? "center", l = n ?? i.shapeAlignVertical ?? "middle"
|
|
5846
|
+
let s = this._resolveCurrentDimensions({ group: i }), c = t ?? i.shapeAlignHorizontal ?? "center", l = n ?? i.shapeAlignVertical ?? "middle", u = this.lifecycleController.createContext({
|
|
5847
|
+
group: i,
|
|
5848
|
+
source: "text-align",
|
|
5849
|
+
target: e,
|
|
5850
|
+
withoutSave: r
|
|
5851
|
+
});
|
|
5589
5852
|
this._beginMutation();
|
|
5590
5853
|
try {
|
|
5591
5854
|
this._applyTextUpdates({
|
|
@@ -5599,11 +5862,11 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5599
5862
|
width: s.width,
|
|
5600
5863
|
alignH: c,
|
|
5601
5864
|
alignV: l
|
|
5602
|
-
}), this.editor.canvas.requestRenderAll();
|
|
5865
|
+
}), this.lifecycleController.fireBefore({ lifecycle: u }), this.editor.canvas.requestRenderAll();
|
|
5603
5866
|
} finally {
|
|
5604
5867
|
this._endMutation({ withoutSave: r });
|
|
5605
5868
|
}
|
|
5606
|
-
return i;
|
|
5869
|
+
return this.lifecycleController.fireUpdated({ lifecycle: u }), i;
|
|
5607
5870
|
}
|
|
5608
5871
|
async setRounding({ target: e, rounding: t, withoutSave: n }) {
|
|
5609
5872
|
let r = this._resolveShapeGroup({ target: e });
|
|
@@ -5622,15 +5885,14 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5622
5885
|
}
|
|
5623
5886
|
destroy() {
|
|
5624
5887
|
let { canvas: e } = this.editor;
|
|
5625
|
-
e.off("object:scaling", this._handleObjectScaling), e.off("object:modified", this._handleObjectModified), e.off("mouse:move", this._handleMouseMove), e.off("mouse:down", this._handleMouseDown), e.off("text:editing:entered", this._handleTextEditingEntered), e.off("text:editing:exited", this._handleTextEditingExited), e.off("text:changed", this._handleTextChanged), e.off("editor:before:text-updated", this._handleBeforeTextUpdated);
|
|
5888
|
+
e.off("object:scaling", this._handleObjectScaling), e.off("object:modified", this._handleObjectModified), e.off("mouse:move", this._handleMouseMove), e.off("mouse:down", this._handleMouseDown), e.off("mouse:up", this._handleMouseUp), e.off("text:editing:entered", this._handleTextEditingEntered), e.off("text:editing:exited", this._handleTextEditingExited), e.off("text:changed", this._handleTextChanged), e.off("editor:before:text-updated", this._handleBeforeTextUpdated), e.off("editor:text-updated", this._handleTextUpdated);
|
|
5626
5889
|
}
|
|
5627
5890
|
_bindEvents() {
|
|
5628
5891
|
let { canvas: e } = this.editor;
|
|
5629
|
-
e.on("object:scaling", this._handleObjectScaling), e.on("object:modified", this._handleObjectModified), e.on("mouse:move", this._handleMouseMove), e.on("mouse:down", this._handleMouseDown), e.on("text:editing:entered", this._handleTextEditingEntered), e.on("text:editing:exited", this._handleTextEditingExited), e.on("text:changed", this._handleTextChanged), e.on("editor:before:text-updated", this._handleBeforeTextUpdated);
|
|
5892
|
+
e.on("object:scaling", this._handleObjectScaling), e.on("object:modified", this._handleObjectModified), e.on("mouse:move", this._handleMouseMove), e.on("mouse:down", this._handleMouseDown), e.on("mouse:up", this._handleMouseUp), e.on("text:editing:entered", this._handleTextEditingEntered), e.on("text:editing:exited", this._handleTextEditingExited), e.on("text:changed", this._handleTextChanged), e.on("editor:before:text-updated", this._handleBeforeTextUpdated), e.on("editor:text-updated", this._handleTextUpdated);
|
|
5630
5893
|
}
|
|
5631
5894
|
_createShapeGroup({ id: e, presetKey: t, presetCanRound: n, shape: r, text: i, width: a, height: o, manualWidth: s, manualHeight: c, shapeTextAutoExpand: l, alignH: u, alignV: d, padding: f, internalShapeTextInset: p, changedPadding: m, style: h, rounding: g }) {
|
|
5632
5895
|
let _ = new Rn([r, i], {
|
|
5633
|
-
id: e,
|
|
5634
5896
|
originX: "center",
|
|
5635
5897
|
originY: "center",
|
|
5636
5898
|
left: 0,
|
|
@@ -5638,8 +5900,8 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5638
5900
|
lockScalingFlip: !0,
|
|
5639
5901
|
centeredScaling: !1,
|
|
5640
5902
|
objectCaching: !1
|
|
5641
|
-
});
|
|
5642
|
-
return this._applyShapeGroupMetadata({
|
|
5903
|
+
}), v = _;
|
|
5904
|
+
return v.id = e, this._applyShapeGroupMetadata({
|
|
5643
5905
|
group: _,
|
|
5644
5906
|
presetKey: t,
|
|
5645
5907
|
presetCanRound: n,
|
|
@@ -5706,7 +5968,8 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5706
5968
|
let s = this.editor.textManager.addText(o, {
|
|
5707
5969
|
withoutAdding: !0,
|
|
5708
5970
|
withoutSave: !0,
|
|
5709
|
-
withoutSelection: !0
|
|
5971
|
+
withoutSelection: !0,
|
|
5972
|
+
emitLifecycleEvents: !1
|
|
5710
5973
|
});
|
|
5711
5974
|
return s.set({
|
|
5712
5975
|
shapeNodeType: "text",
|
|
@@ -5729,7 +5992,8 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5729
5992
|
target: e,
|
|
5730
5993
|
style: i,
|
|
5731
5994
|
skipRender: !0,
|
|
5732
|
-
withoutSave: !0
|
|
5995
|
+
withoutSave: !0,
|
|
5996
|
+
emitLifecycleEvents: !1
|
|
5733
5997
|
});
|
|
5734
5998
|
} finally {
|
|
5735
5999
|
this.internalTextUpdates.delete(e);
|
|
@@ -5738,11 +6002,11 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5738
6002
|
}
|
|
5739
6003
|
}
|
|
5740
6004
|
_resolveCurrentTextStyle({ textNode: e }) {
|
|
5741
|
-
let { backgroundColor: t, backgroundOpacity: n, fill: r, fontFamily: i, fontSize: a, fontStyle: o, fontWeight: s, lineFontDefaults: c, linethrough: l, opacity: u, paddingBottom: d, paddingLeft: f, paddingRight: p, paddingTop: m, radiusBottomLeft: h, radiusBottomRight: g, radiusTopLeft: _, radiusTopRight: v, stroke: y, strokeWidth: b, styles: x, textAlign: S, underline: C, uppercase: w } = e;
|
|
6005
|
+
let { backgroundColor: t, backgroundOpacity: n, fill: r, fontFamily: i, fontSize: a, fontStyle: o, fontWeight: s, lineFontDefaults: c, linethrough: l, opacity: u, paddingBottom: d, paddingLeft: f, paddingRight: p, paddingTop: m, radiusBottomLeft: h, radiusBottomRight: g, radiusTopLeft: _, radiusTopRight: v, stroke: y, strokeWidth: b, styles: x, textAlign: S, underline: C, uppercase: w } = e, T = S === "left" || S === "center" || S === "right" || S === "justify" ? { align: S } : void 0;
|
|
5742
6006
|
return {
|
|
5743
6007
|
align: this._resolveShapeTextHorizontalAlign({
|
|
5744
6008
|
group: e.group,
|
|
5745
|
-
textStyle:
|
|
6009
|
+
textStyle: T
|
|
5746
6010
|
}),
|
|
5747
6011
|
backgroundColor: typeof t == "string" ? t : void 0,
|
|
5748
6012
|
backgroundOpacity: n,
|
|
@@ -5913,12 +6177,32 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5913
6177
|
_resolveShapeStyle({ options: e, fallback: t }) {
|
|
5914
6178
|
let { fill: n, stroke: r, strokeWidth: i, strokeDashArray: a, opacity: o } = e, s = a === void 0 ? t?.shapeStrokeDashArray : a;
|
|
5915
6179
|
return {
|
|
5916
|
-
fill: n ?? t?.shapeFill ??
|
|
6180
|
+
fill: n ?? t?.shapeFill ?? or,
|
|
5917
6181
|
stroke: r ?? t?.shapeStroke ?? null,
|
|
5918
|
-
strokeWidth: i ?? t?.shapeStrokeWidth ??
|
|
6182
|
+
strokeWidth: i ?? t?.shapeStrokeWidth ?? sr,
|
|
5919
6183
|
strokeDashArray: s ?? null,
|
|
5920
|
-
opacity: o ?? t?.shapeOpacity ??
|
|
6184
|
+
opacity: o ?? t?.shapeOpacity ?? cr
|
|
6185
|
+
};
|
|
6186
|
+
}
|
|
6187
|
+
_collectShapeGroupsFromTarget({ target: t, subTargets: n = [] }) {
|
|
6188
|
+
let r = [], i = (t) => {
|
|
6189
|
+
if (!t) return;
|
|
6190
|
+
if (t instanceof e) {
|
|
6191
|
+
t.getObjects().forEach((e) => {
|
|
6192
|
+
i(e);
|
|
6193
|
+
});
|
|
6194
|
+
return;
|
|
6195
|
+
}
|
|
6196
|
+
if (J(t)) {
|
|
6197
|
+
r.includes(t) || r.push(t);
|
|
6198
|
+
return;
|
|
6199
|
+
}
|
|
6200
|
+
let { group: n } = t;
|
|
6201
|
+
!n || !J(n) || r.includes(n) || r.push(n);
|
|
5921
6202
|
};
|
|
6203
|
+
return i(t), n.forEach((e) => {
|
|
6204
|
+
i(e);
|
|
6205
|
+
}), r;
|
|
5922
6206
|
}
|
|
5923
6207
|
_beginMutation() {
|
|
5924
6208
|
this.editor.historyManager.suspendHistory();
|
|
@@ -5953,7 +6237,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5953
6237
|
}
|
|
5954
6238
|
return null;
|
|
5955
6239
|
}
|
|
5956
|
-
},
|
|
6240
|
+
}, ur = class {
|
|
5957
6241
|
constructor({ editor: e }) {
|
|
5958
6242
|
this.editor = e, this.clipboard = null;
|
|
5959
6243
|
}
|
|
@@ -5972,7 +6256,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5972
6256
|
async _cloneToInternalClipboard(e) {
|
|
5973
6257
|
let { canvas: t, errorManager: n } = this.editor;
|
|
5974
6258
|
try {
|
|
5975
|
-
let n = await e.clone(
|
|
6259
|
+
let n = await e.clone(Ie);
|
|
5976
6260
|
this.clipboard = n, t.fire("editor:object-copied", { object: n });
|
|
5977
6261
|
} catch (e) {
|
|
5978
6262
|
n.emitError({
|
|
@@ -5993,7 +6277,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5993
6277
|
message: "navigator.clipboard не поддерживается в этом браузере или отсутствует HTTPS-соединение."
|
|
5994
6278
|
}), !1;
|
|
5995
6279
|
try {
|
|
5996
|
-
let t = e.toObject(
|
|
6280
|
+
let t = e.toObject(Ie), n = JSON.stringify(t);
|
|
5997
6281
|
return e.type === "image" ? this._copyImageToClipboard(e, n) : this._copyTextToClipboard(n);
|
|
5998
6282
|
} catch (e) {
|
|
5999
6283
|
return t.emitError({
|
|
@@ -6023,7 +6307,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6023
6307
|
}
|
|
6024
6308
|
async _copyTextToClipboard(e) {
|
|
6025
6309
|
try {
|
|
6026
|
-
let t = `${
|
|
6310
|
+
let t = `${Fe}${e}`;
|
|
6027
6311
|
return await navigator.clipboard.writeText(t), console.info("Text copied to clipboard successfully"), !0;
|
|
6028
6312
|
} catch (e) {
|
|
6029
6313
|
let { errorManager: t } = this.editor;
|
|
@@ -6108,7 +6392,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6108
6392
|
let { canvas: n } = this.editor, r = t || n.getActiveObject();
|
|
6109
6393
|
if (!r || r.locked) return !1;
|
|
6110
6394
|
try {
|
|
6111
|
-
let t = await r.clone(
|
|
6395
|
+
let t = await r.clone(Ie);
|
|
6112
6396
|
return t instanceof e && t.forEachObject((e) => {
|
|
6113
6397
|
e.set({
|
|
6114
6398
|
id: `${e.type}-${D()}`,
|
|
@@ -6182,7 +6466,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6182
6466
|
let { canvas: t } = this.editor;
|
|
6183
6467
|
if (!this.clipboard) return !1;
|
|
6184
6468
|
try {
|
|
6185
|
-
let n = await this.clipboard.clone(
|
|
6469
|
+
let n = await this.clipboard.clone(Ie);
|
|
6186
6470
|
return t.discardActiveObject(), n instanceof e && n.forEachObject((e) => {
|
|
6187
6471
|
e.set({
|
|
6188
6472
|
id: `${e.type}-${D()}`,
|
|
@@ -6209,7 +6493,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6209
6493
|
}), !1;
|
|
6210
6494
|
}
|
|
6211
6495
|
}
|
|
6212
|
-
},
|
|
6496
|
+
}, dr = class t {
|
|
6213
6497
|
constructor({ editor: e }) {
|
|
6214
6498
|
this.editor = e;
|
|
6215
6499
|
}
|
|
@@ -6274,7 +6558,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6274
6558
|
!(n instanceof _) || !n.isEditing || n.exitEditing();
|
|
6275
6559
|
}
|
|
6276
6560
|
}
|
|
6277
|
-
},
|
|
6561
|
+
}, fr = class {
|
|
6278
6562
|
constructor({ editor: e }) {
|
|
6279
6563
|
this.editor = e;
|
|
6280
6564
|
}
|
|
@@ -6340,7 +6624,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6340
6624
|
i.resumeHistory(), n || i.saveState();
|
|
6341
6625
|
}
|
|
6342
6626
|
}
|
|
6343
|
-
},
|
|
6627
|
+
}, pr = class t {
|
|
6344
6628
|
constructor({ editor: e }) {
|
|
6345
6629
|
this.lastSelection = [], this.isCtrlSelectionBoxActive = !1, this.isSelectionMergeInProgress = !1, this.editor = e, this.selectionKey = this._resolveSelectionKey(), this.handleTextEditingEnteredBound = this._handleTextEditingEntered.bind(this), this.handleTextEditingExitedBound = this._handleTextEditingExited.bind(this), this.handleLockedSelectionBound = this._filterLockedSelection.bind(this), this.handleSelectionMergeBound = this._handleSelectionMerge.bind(this), this.handleSelectionChangeBound = this._handleSelectionChange.bind(this), this.handleSelectionClearedBound = this._handleSelectionCleared.bind(this), this.handleSelectionBoxStartBound = this._handleSelectionBoxStart.bind(this), this.handleSelectionBoxEndBound = this._handleSelectionBoxEnd.bind(this), this._applySelectionKey({ selectionKey: this.selectionKey }), this._bindEvents();
|
|
6346
6630
|
}
|
|
@@ -6534,7 +6818,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6534
6818
|
let { options: e } = this.editor, { selectionKey: t } = e;
|
|
6535
6819
|
return t === void 0 ? ["ctrlKey", "metaKey"] : t;
|
|
6536
6820
|
}
|
|
6537
|
-
},
|
|
6821
|
+
}, mr = class e {
|
|
6538
6822
|
constructor({ editor: e }) {
|
|
6539
6823
|
this.editor = e;
|
|
6540
6824
|
}
|
|
@@ -6574,7 +6858,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6574
6858
|
};
|
|
6575
6859
|
return i.fire("editor:objects-deleted", l), l;
|
|
6576
6860
|
}
|
|
6577
|
-
},
|
|
6861
|
+
}, hr = {
|
|
6578
6862
|
IMAGE_MANAGER: {
|
|
6579
6863
|
INVALID_CONTENT_TYPE: "INVALID_CONTENT_TYPE",
|
|
6580
6864
|
INVALID_SOURCE_TYPE: "INVALID_SOURCE_TYPE",
|
|
@@ -6612,7 +6896,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6612
6896
|
INVALID_TARGET: "TEMPLATE_INVALID_TARGET",
|
|
6613
6897
|
APPLY_FAILED: "TEMPLATE_APPLY_FAILED"
|
|
6614
6898
|
}
|
|
6615
|
-
},
|
|
6899
|
+
}, gr = class e {
|
|
6616
6900
|
constructor({ editor: e }) {
|
|
6617
6901
|
this._buffer = [], this.editor = e;
|
|
6618
6902
|
}
|
|
@@ -6670,9 +6954,9 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6670
6954
|
}), this.editor.canvas.fire("editor:warning", s);
|
|
6671
6955
|
}
|
|
6672
6956
|
static isValidErrorCode(e) {
|
|
6673
|
-
return e ? Object.values(
|
|
6957
|
+
return e ? Object.values(hr).some((t) => Object.values(t).includes(e)) : !1;
|
|
6674
6958
|
}
|
|
6675
|
-
},
|
|
6959
|
+
}, _r = class {
|
|
6676
6960
|
constructor({ editor: e }) {
|
|
6677
6961
|
this.currentBounds = null, this.editor = e;
|
|
6678
6962
|
}
|
|
@@ -6721,32 +7005,32 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6721
7005
|
updateBounds() {
|
|
6722
7006
|
this.currentBounds = this.calculatePanBounds();
|
|
6723
7007
|
}
|
|
6724
|
-
},
|
|
7008
|
+
}, vr = ({ textbox: e }) => {
|
|
6725
7009
|
if (!e.isEditing) return null;
|
|
6726
7010
|
let t = e.selectionStart ?? 0, n = e.selectionEnd ?? t;
|
|
6727
7011
|
return t === n ? null : {
|
|
6728
7012
|
start: Math.min(t, n),
|
|
6729
7013
|
end: Math.max(t, n)
|
|
6730
7014
|
};
|
|
6731
|
-
},
|
|
7015
|
+
}, yr = ({ textbox: e }) => {
|
|
6732
7016
|
let t = e.text?.length ?? 0;
|
|
6733
7017
|
return t <= 0 ? null : {
|
|
6734
7018
|
start: 0,
|
|
6735
7019
|
end: t
|
|
6736
7020
|
};
|
|
6737
|
-
},
|
|
7021
|
+
}, br = ({ textbox: e, range: t }) => {
|
|
6738
7022
|
if (!t) return !1;
|
|
6739
7023
|
let n = e.text?.length ?? 0;
|
|
6740
7024
|
return n <= 0 ? !1 : t.start <= 0 && t.end >= n;
|
|
6741
|
-
},
|
|
7025
|
+
}, xr = ({ textbox: e, styles: t, range: n }) => {
|
|
6742
7026
|
if (!t || !Object.keys(t).length) return !1;
|
|
6743
7027
|
let { start: r, end: i } = n;
|
|
6744
7028
|
return i <= r ? !1 : (e.setSelectionStyles(t, r, i), !0);
|
|
6745
|
-
},
|
|
7029
|
+
}, Sr = ({ textbox: e, range: t, property: n }) => {
|
|
6746
7030
|
if (!t) return;
|
|
6747
7031
|
let r = e.getSelectionStyles(t.start, t.end, !0);
|
|
6748
7032
|
if (r.length) return r[0]?.[n];
|
|
6749
|
-
},
|
|
7033
|
+
}, Cr = ({ strokeColor: e, width: t }) => t <= 0 ? null : e ?? "#000000", wr = ({ width: e = 0 }) => e ? Math.max(0, e) : 0, Tr = ({ value: e }) => typeof e == "string" ? e.toLocaleUpperCase() : "", Er = ({ value: e, min: t, max: n }) => Math.min(Math.max(e, t), n), Dr = class e extends _ {
|
|
6750
7034
|
static {
|
|
6751
7035
|
this.type = "background-textbox";
|
|
6752
7036
|
}
|
|
@@ -6788,6 +7072,15 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6788
7072
|
initDimensions() {
|
|
6789
7073
|
super.initDimensions(), this.shouldRoundDimensionsOnInit !== !1 && this._roundDimensions();
|
|
6790
7074
|
}
|
|
7075
|
+
transformMatrixKey(e = !1) {
|
|
7076
|
+
return [
|
|
7077
|
+
...super.transformMatrixKey(e),
|
|
7078
|
+
this.paddingTop ?? 0,
|
|
7079
|
+
this.paddingRight ?? 0,
|
|
7080
|
+
this.paddingBottom ?? 0,
|
|
7081
|
+
this.paddingLeft ?? 0
|
|
7082
|
+
];
|
|
7083
|
+
}
|
|
6791
7084
|
_getLeftOffset() {
|
|
6792
7085
|
let { width: e } = this._getBackgroundDimensions(), { left: t } = this._getPadding();
|
|
6793
7086
|
return -e / 2 + t;
|
|
@@ -6871,7 +7164,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6871
7164
|
this._removeShadow(e);
|
|
6872
7165
|
}
|
|
6873
7166
|
_getDecorationColorAt(e, t) {
|
|
6874
|
-
let n = this.getValueOfPropertyAt(e, t, "strokeWidth"), r =
|
|
7167
|
+
let n = this.getValueOfPropertyAt(e, t, "strokeWidth"), r = wr({ width: typeof n == "number" && Number.isFinite(n) ? n : 0 }), i = this.getValueOfPropertyAt(e, t, "stroke"), a = i == null ? null : Cr({
|
|
6875
7168
|
strokeColor: i,
|
|
6876
7169
|
width: r
|
|
6877
7170
|
});
|
|
@@ -6887,22 +7180,22 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6887
7180
|
_getCornerRadii({ width: e, height: t }) {
|
|
6888
7181
|
let n = e / 2, r = t / 2, i = Math.min(n, r);
|
|
6889
7182
|
return {
|
|
6890
|
-
bottomLeft:
|
|
7183
|
+
bottomLeft: Er({
|
|
6891
7184
|
value: this.radiusBottomLeft ?? 0,
|
|
6892
7185
|
min: 0,
|
|
6893
7186
|
max: i
|
|
6894
7187
|
}),
|
|
6895
|
-
bottomRight:
|
|
7188
|
+
bottomRight: Er({
|
|
6896
7189
|
value: this.radiusBottomRight ?? 0,
|
|
6897
7190
|
min: 0,
|
|
6898
7191
|
max: i
|
|
6899
7192
|
}),
|
|
6900
|
-
topLeft:
|
|
7193
|
+
topLeft: Er({
|
|
6901
7194
|
value: this.radiusTopLeft ?? 0,
|
|
6902
7195
|
min: 0,
|
|
6903
7196
|
max: i
|
|
6904
7197
|
}),
|
|
6905
|
-
topRight:
|
|
7198
|
+
topRight: Er({
|
|
6906
7199
|
value: this.radiusTopRight ?? 0,
|
|
6907
7200
|
min: 0,
|
|
6908
7201
|
max: i
|
|
@@ -6920,7 +7213,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6920
7213
|
_getEffectiveBackgroundFill() {
|
|
6921
7214
|
let e = this.backgroundColor;
|
|
6922
7215
|
if (!e) return null;
|
|
6923
|
-
let t =
|
|
7216
|
+
let t = Er({
|
|
6924
7217
|
value: this.backgroundOpacity ?? 1,
|
|
6925
7218
|
min: 0,
|
|
6926
7219
|
max: 1
|
|
@@ -6928,7 +7221,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6928
7221
|
try {
|
|
6929
7222
|
r = new n(e);
|
|
6930
7223
|
} catch (t) {
|
|
6931
|
-
return
|
|
7224
|
+
return gr.emitError({
|
|
6932
7225
|
origin: "BackgroundTextbox",
|
|
6933
7226
|
method: "_getEffectiveBackgroundFill",
|
|
6934
7227
|
code: "INVALID_COLOR_VALUE",
|
|
@@ -6942,19 +7235,19 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6942
7235
|
return r.setAlpha(t), r.toRgba();
|
|
6943
7236
|
}
|
|
6944
7237
|
static _renderRoundedRect({ ctx: e, height: t, left: n, radii: r, top: i, width: a }) {
|
|
6945
|
-
let o = n + a, s = i + t, { topLeft: c, topRight: l, bottomRight: u, bottomLeft: d } = r, f =
|
|
7238
|
+
let o = n + a, s = i + t, { topLeft: c, topRight: l, bottomRight: u, bottomLeft: d } = r, f = Er({
|
|
6946
7239
|
value: c,
|
|
6947
7240
|
min: 0,
|
|
6948
7241
|
max: a
|
|
6949
|
-
}), p =
|
|
7242
|
+
}), p = Er({
|
|
6950
7243
|
value: l,
|
|
6951
7244
|
min: 0,
|
|
6952
7245
|
max: a
|
|
6953
|
-
}), m =
|
|
7246
|
+
}), m = Er({
|
|
6954
7247
|
value: u,
|
|
6955
7248
|
min: 0,
|
|
6956
7249
|
max: a
|
|
6957
|
-
}), h =
|
|
7250
|
+
}), h = Er({
|
|
6958
7251
|
value: d,
|
|
6959
7252
|
min: 0,
|
|
6960
7253
|
max: a
|
|
@@ -6965,9 +7258,9 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6965
7258
|
let { width: e = 0, height: t = 0 } = this, n = Math.round(e), r = Math.round(t);
|
|
6966
7259
|
n !== e && (this.width = Math.max(0, n)), r !== t && (this.height = Math.max(0, r));
|
|
6967
7260
|
}
|
|
6968
|
-
},
|
|
6969
|
-
y?.setClass && y.setClass(
|
|
6970
|
-
},
|
|
7261
|
+
}, Or = () => {
|
|
7262
|
+
y?.setClass && y.setClass(Dr, "background-textbox");
|
|
7263
|
+
}, kr = .01, Ar = ({ textbox: e, lineIndices: t, updates: n }) => {
|
|
6971
7264
|
if (!t.length) return !1;
|
|
6972
7265
|
let { fontFamily: r, fontSize: i, fill: a, stroke: o } = n;
|
|
6973
7266
|
if (!(r !== void 0 || i !== void 0 || a !== void 0 || o !== void 0)) return !1;
|
|
@@ -6979,7 +7272,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6979
7272
|
r !== void 0 && d?.fontFamily !== r && (f.fontFamily = r, p = !0), i !== void 0 && d?.fontSize !== i && (f.fontSize = i, p = !0), a !== void 0 && d?.fill !== a && (f.fill = a, p = !0), o !== void 0 && (o === null && d?.stroke !== void 0 && (delete f.stroke, p = !0), o !== null && d?.stroke !== o && (f.stroke = o, p = !0)), p && (u ||= (c = { ...c }, !0), c[n] = f, l = !0);
|
|
6980
7273
|
}
|
|
6981
7274
|
return l && (e.lineFontDefaults = c), l;
|
|
6982
|
-
},
|
|
7275
|
+
}, jr = ({ lineText: e, lineStyles: t, lineDefaults: n }) => {
|
|
6983
7276
|
let r = e.length;
|
|
6984
7277
|
if (r === 0) return {
|
|
6985
7278
|
lineStyles: t,
|
|
@@ -7011,7 +7304,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7011
7304
|
lineStyles: l,
|
|
7012
7305
|
changed: u
|
|
7013
7306
|
};
|
|
7014
|
-
},
|
|
7307
|
+
}, Mr = ({ lineFontDefaults: e }) => {
|
|
7015
7308
|
if (!e) return;
|
|
7016
7309
|
let t = {};
|
|
7017
7310
|
for (let n in e) {
|
|
@@ -7022,7 +7315,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7022
7315
|
i && (t[r] = { ...i });
|
|
7023
7316
|
}
|
|
7024
7317
|
return t;
|
|
7025
|
-
},
|
|
7318
|
+
}, Nr = ({ lineFontDefaults: e, scale: t }) => {
|
|
7026
7319
|
if (!e || !Number.isFinite(t) || Math.abs(t - 1) < .01) return;
|
|
7027
7320
|
let n = {}, r = !1, i = !1;
|
|
7028
7321
|
for (let a in e) {
|
|
@@ -7039,20 +7332,34 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7039
7332
|
n[o] = c, r = !0;
|
|
7040
7333
|
}
|
|
7041
7334
|
if (!(!r || !i)) return n;
|
|
7042
|
-
},
|
|
7335
|
+
}, Pr = ({ textbox: e, text: t }) => {
|
|
7043
7336
|
let { textLines: n } = e, r = Array.isArray(n) && n.length > 0 ? n.length : Math.max(t.split("\n").length, 1), i = 0;
|
|
7044
7337
|
for (let t = 0; t < r; t += 1) {
|
|
7045
7338
|
let n = e.getLineWidth(t);
|
|
7046
7339
|
n > i && (i = n);
|
|
7047
7340
|
}
|
|
7048
7341
|
return i;
|
|
7049
|
-
},
|
|
7342
|
+
}, Fr = ({ origin: e, size: t }) => e === "left" || e === "top" || e === "start" || e === 0 ? 0 : e === "right" || e === "bottom" || e === "end" || e === 1 ? t : t / 2, Ir = ({ textbox: e, originX: t = e.originX ?? "center", originY: n = e.originY ?? "center" }) => {
|
|
7343
|
+
let r = e.width ?? e.calcTextWidth() ?? 0, i = e.height ?? e.calcTextHeight() ?? 0, a = e.paddingTop ?? 0, o = e.paddingRight ?? 0, s = e.paddingBottom ?? 0, c = e.paddingLeft ?? 0, l = -r / 2 + (c - o) / 2, u = -i / 2 + (a - s) / 2, d = new p(l + Fr({
|
|
7344
|
+
origin: t,
|
|
7345
|
+
size: r
|
|
7346
|
+
}), u + Fr({
|
|
7347
|
+
origin: n,
|
|
7348
|
+
size: i
|
|
7349
|
+
})), f = e.getPointByOrigin("center", "center"), m = e, h = typeof m.calcTransformMatrix == "function" ? m.calcTransformMatrix() : null, g = Array.isArray(h) ? new p(d.x * h[0] + d.y * h[2] + f.x, d.x * h[1] + d.y * h[3] + f.y) : new p(f.x + d.x, f.y + d.y);
|
|
7350
|
+
return {
|
|
7351
|
+
left: g.x,
|
|
7352
|
+
top: g.y,
|
|
7353
|
+
originX: t,
|
|
7354
|
+
originY: n
|
|
7355
|
+
};
|
|
7356
|
+
}, Lr = ({ textbox: e, montageLeft: t, montageRight: n }) => {
|
|
7050
7357
|
e.setCoords();
|
|
7051
7358
|
let r = e.getBoundingRect(!1, !0), i = r.left ?? 0, a = i + (r.width ?? 0), o = n - t;
|
|
7052
7359
|
if (o > 0 && (r.width ?? 0) >= o - .01) return !1;
|
|
7053
7360
|
let s = 0;
|
|
7054
7361
|
return i < t ? s = t - i : a > n && (s = n - a), Math.abs(s) <= .01 ? !1 : (e.set({ left: (e.left ?? 0) + s }), !0);
|
|
7055
|
-
},
|
|
7362
|
+
}, Rr = ({ rawValue: e, calculatedValue: t }) => typeof e == "number" ? e : typeof t == "number" ? t : 0, zr = ({ stylesList: e }) => {
|
|
7056
7363
|
let t = e.length;
|
|
7057
7364
|
if (!t) return !1;
|
|
7058
7365
|
for (let n = 0; n < t; n += 1) {
|
|
@@ -7062,16 +7369,16 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7062
7369
|
if (r !== void 0 || i !== void 0 || a !== void 0 || o !== void 0 || s !== void 0 || c !== void 0) return !0;
|
|
7063
7370
|
}
|
|
7064
7371
|
return !1;
|
|
7065
|
-
},
|
|
7066
|
-
let { width: t, height: n, calcTextWidth: r, calcTextHeight: i } = e, a = typeof r == "function" ? r.call(e) : void 0, o = typeof i == "function" ? i.call(e) : void 0, s =
|
|
7372
|
+
}, Br = ({ textbox: e }) => {
|
|
7373
|
+
let { width: t, height: n, calcTextWidth: r, calcTextHeight: i } = e, a = typeof r == "function" ? r.call(e) : void 0, o = typeof i == "function" ? i.call(e) : void 0, s = Rr({
|
|
7067
7374
|
rawValue: t,
|
|
7068
7375
|
calculatedValue: a
|
|
7069
|
-
}), c =
|
|
7376
|
+
}), c = Rr({
|
|
7070
7377
|
rawValue: n,
|
|
7071
7378
|
calculatedValue: o
|
|
7072
7379
|
}), l = Number.isFinite(s) ? Math.round(s) : null, u = Number.isFinite(c) ? Math.round(c) : null, d = {};
|
|
7073
7380
|
return l !== null && l !== s && (d.width = Math.max(0, l)), u !== null && u !== c && (d.height = Math.max(0, u)), Object.keys(d).length ? (e.set(d), !0) : !1;
|
|
7074
|
-
},
|
|
7381
|
+
}, Vr = ({ textbox: e }) => {
|
|
7075
7382
|
let t = e.width ?? e.calcTextWidth(), n = e.fontSize ?? 16, { styles: r = {} } = e, { lineFontDefaults: i } = e, { paddingTop: a = 0, paddingRight: o = 0, paddingBottom: s = 0, paddingLeft: c = 0 } = e, { radiusTopLeft: l = 0, radiusTopRight: u = 0, radiusBottomRight: d = 0, radiusBottomLeft: f = 0 } = e;
|
|
7076
7383
|
return {
|
|
7077
7384
|
width: t,
|
|
@@ -7089,9 +7396,9 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7089
7396
|
bottomLeft: f
|
|
7090
7397
|
},
|
|
7091
7398
|
styles: JSON.parse(JSON.stringify(r)),
|
|
7092
|
-
lineFontDefaults:
|
|
7399
|
+
lineFontDefaults: Mr({ lineFontDefaults: i })
|
|
7093
7400
|
};
|
|
7094
|
-
},
|
|
7401
|
+
}, Hr = ({ base: e }) => {
|
|
7095
7402
|
let t = 1 / Math.max(1, e.width), n = [e.fontSize];
|
|
7096
7403
|
Object.values(e.styles).forEach((e) => {
|
|
7097
7404
|
Object.values(e).forEach((e) => {
|
|
@@ -7108,11 +7415,11 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7108
7415
|
fontScale: r,
|
|
7109
7416
|
proportionalScale: Math.max(t, r)
|
|
7110
7417
|
};
|
|
7111
|
-
},
|
|
7112
|
-
let { width:
|
|
7113
|
-
if (
|
|
7418
|
+
}, Ur = ({ textbox: e, canvasManager: t, base: n, widthScale: r, heightScale: i, placement: a, anchorPlacement: o, shouldScaleFontSize: s, shouldScalePadding: c, shouldScaleRadii: l, shouldDisableAutoExpandOnHorizontalChange: u = !1, shouldRoundDimensions: d = !0 }) => {
|
|
7419
|
+
let { width: f, fontSize: m, padding: h, radii: g, styles: _, lineFontDefaults: v } = n, y = Math.max(1, f * r), b = d ? Math.max(1, Math.round(y)) : y, x = Math.max(Math.min(8, m), m * i), S = Object.keys(_).length > 0, C;
|
|
7420
|
+
if (s && S) {
|
|
7114
7421
|
let e = {};
|
|
7115
|
-
Object.entries(
|
|
7422
|
+
Object.entries(_).forEach(([t, n]) => {
|
|
7116
7423
|
if (!n) return;
|
|
7117
7424
|
let r = {};
|
|
7118
7425
|
Object.entries(n).forEach(([e, t]) => {
|
|
@@ -7124,65 +7431,71 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7124
7431
|
}
|
|
7125
7432
|
r[e] = n;
|
|
7126
7433
|
}), Object.keys(r).length && (e[t] = r);
|
|
7127
|
-
}), Object.keys(e).length && (
|
|
7434
|
+
}), Object.keys(e).length && (C = e);
|
|
7128
7435
|
}
|
|
7129
|
-
let
|
|
7130
|
-
|
|
7131
|
-
lineFontDefaults:
|
|
7436
|
+
let w;
|
|
7437
|
+
s && (w = Nr({
|
|
7438
|
+
lineFontDefaults: v,
|
|
7132
7439
|
scale: i
|
|
7133
7440
|
}));
|
|
7134
|
-
let
|
|
7135
|
-
top: Math.max(0,
|
|
7136
|
-
right: Math.max(0,
|
|
7137
|
-
bottom: Math.max(0,
|
|
7138
|
-
left: Math.max(0,
|
|
7139
|
-
} :
|
|
7140
|
-
topLeft: Math.max(0,
|
|
7141
|
-
topRight: Math.max(0,
|
|
7142
|
-
bottomRight: Math.max(0,
|
|
7143
|
-
bottomLeft: Math.max(0,
|
|
7144
|
-
} :
|
|
7145
|
-
|
|
7146
|
-
width:
|
|
7147
|
-
fontSize:
|
|
7148
|
-
paddingTop:
|
|
7149
|
-
paddingRight:
|
|
7150
|
-
paddingBottom:
|
|
7151
|
-
paddingLeft:
|
|
7152
|
-
radiusTopLeft:
|
|
7153
|
-
radiusTopRight:
|
|
7154
|
-
radiusBottomRight:
|
|
7155
|
-
radiusBottomLeft:
|
|
7441
|
+
let T = c ? {
|
|
7442
|
+
top: Math.max(0, h.top * i),
|
|
7443
|
+
right: Math.max(0, h.right * i),
|
|
7444
|
+
bottom: Math.max(0, h.bottom * i),
|
|
7445
|
+
left: Math.max(0, h.left * i)
|
|
7446
|
+
} : h, E = l ? {
|
|
7447
|
+
topLeft: Math.max(0, g.topLeft * i),
|
|
7448
|
+
topRight: Math.max(0, g.topRight * i),
|
|
7449
|
+
bottomRight: Math.max(0, g.bottomRight * i),
|
|
7450
|
+
bottomLeft: Math.max(0, g.bottomLeft * i)
|
|
7451
|
+
} : g, D = e.width ?? f, O = Math.abs(b - D) > kr;
|
|
7452
|
+
u && O && (e.autoExpand = !1), C && (e.styles = C), w && (e.lineFontDefaults = w), e.set({
|
|
7453
|
+
width: b,
|
|
7454
|
+
fontSize: s ? x : m,
|
|
7455
|
+
paddingTop: T.top,
|
|
7456
|
+
paddingRight: T.right,
|
|
7457
|
+
paddingBottom: T.bottom,
|
|
7458
|
+
paddingLeft: T.left,
|
|
7459
|
+
radiusTopLeft: E.topLeft,
|
|
7460
|
+
radiusTopRight: E.topRight,
|
|
7461
|
+
radiusBottomRight: E.bottomRight,
|
|
7462
|
+
radiusBottomLeft: E.bottomLeft,
|
|
7156
7463
|
scaleX: 1,
|
|
7157
7464
|
scaleY: 1
|
|
7158
7465
|
});
|
|
7159
|
-
let
|
|
7160
|
-
e.shouldRoundDimensionsOnInit =
|
|
7466
|
+
let k = e.shouldRoundDimensionsOnInit;
|
|
7467
|
+
e.shouldRoundDimensionsOnInit = d;
|
|
7161
7468
|
try {
|
|
7162
7469
|
e.initDimensions();
|
|
7163
7470
|
} finally {
|
|
7164
|
-
e.shouldRoundDimensionsOnInit =
|
|
7165
|
-
}
|
|
7166
|
-
let
|
|
7167
|
-
return
|
|
7471
|
+
e.shouldRoundDimensionsOnInit = k;
|
|
7472
|
+
}
|
|
7473
|
+
let A = d ? Br({ textbox: e }) : !1;
|
|
7474
|
+
return A && (e.dirty = !0), o ? (e.set({
|
|
7475
|
+
originX: a.originX,
|
|
7476
|
+
originY: a.originY
|
|
7477
|
+
}), e.setPositionByOrigin(new p(o.left, o.top), o.originX, o.originY), e.setCoords(), {
|
|
7478
|
+
appliedWidth: e.width ?? b,
|
|
7479
|
+
dimensionsRounded: A
|
|
7480
|
+
}) : (t.applyObjectPlacement({
|
|
7168
7481
|
object: e,
|
|
7169
7482
|
placement: a
|
|
7170
7483
|
}), e.setCoords(), {
|
|
7171
|
-
appliedWidth: e.width ??
|
|
7172
|
-
dimensionsRounded:
|
|
7173
|
-
};
|
|
7174
|
-
},
|
|
7484
|
+
appliedWidth: e.width ?? b,
|
|
7485
|
+
dimensionsRounded: A
|
|
7486
|
+
});
|
|
7487
|
+
}, Wr = ({ transform: e }) => {
|
|
7175
7488
|
let { corner: t = "", action: n = "" } = e;
|
|
7176
7489
|
return {
|
|
7177
7490
|
isCornerHandle: t === "tl" || t === "tr" || t === "bl" || t === "br" || n === "scale",
|
|
7178
7491
|
isHorizontalHandle: t === "ml" || t === "mr" || n === "scaleX",
|
|
7179
7492
|
isVerticalHandle: t === "mt" || t === "mb" || n === "scaleY"
|
|
7180
7493
|
};
|
|
7181
|
-
},
|
|
7494
|
+
}, Gr = ({ textbox: e, transform: t, appliedWidth: n }) => {
|
|
7182
7495
|
t.scaleX = 1, t.scaleY = 1;
|
|
7183
7496
|
let { original: r } = t;
|
|
7184
7497
|
r && (r.scaleX = 1, r.scaleY = 1, r.width = n, r.height = e.height, r.left = e.left, r.top = e.top);
|
|
7185
|
-
},
|
|
7498
|
+
}, Kr = ({ textbox: e, transform: t, scenePoint: n }) => {
|
|
7186
7499
|
let { x: r, y: i } = e._getTransformedDimensions();
|
|
7187
7500
|
if (r <= 0 || i <= 0) return null;
|
|
7188
7501
|
let a = b.getLocalPoint(t, t.originX, t.originY, n.x, n.y), o = t, s = typeof o.signX == "number" && a.x * o.signX <= 0, c = typeof o.signY == "number" && a.y * o.signY <= 0, l = Math.abs(a.x / r), u = Math.abs(a.y / i);
|
|
@@ -7192,27 +7505,27 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7192
7505
|
stepScaleX: l,
|
|
7193
7506
|
stepScaleY: u
|
|
7194
7507
|
};
|
|
7195
|
-
},
|
|
7196
|
-
function
|
|
7508
|
+
}, qr = 1e-4;
|
|
7509
|
+
function Jr(e) {
|
|
7197
7510
|
return !!e && e instanceof _;
|
|
7198
7511
|
}
|
|
7199
|
-
function
|
|
7200
|
-
if (!
|
|
7512
|
+
function Yr(e) {
|
|
7513
|
+
if (!Jr(e)) return !1;
|
|
7201
7514
|
let t = e.group;
|
|
7202
7515
|
return e.shapeNodeType === "text" && t?.shapeComposite === !0;
|
|
7203
7516
|
}
|
|
7204
|
-
var
|
|
7517
|
+
var Xr = class {
|
|
7205
7518
|
constructor({ canvas: t, canvasManager: n, persistScaledTextbox: r }) {
|
|
7206
7519
|
this.handleMouseMove = (e) => {
|
|
7207
7520
|
let t = this.canvas._currentTransform;
|
|
7208
7521
|
if (!t) return;
|
|
7209
7522
|
let { target: n } = t;
|
|
7210
|
-
if (!
|
|
7523
|
+
if (!Jr(n) || Yr(n)) return;
|
|
7211
7524
|
let r = this.scalingState.get(n);
|
|
7212
7525
|
if (!r || !e.e) return;
|
|
7213
|
-
let { isCornerHandle: i, isHorizontalHandle: a, isVerticalHandle: o } =
|
|
7526
|
+
let { isCornerHandle: i, isHorizontalHandle: a, isVerticalHandle: o } = Wr({ transform: t });
|
|
7214
7527
|
if (!a && !o && !i) return;
|
|
7215
|
-
let s =
|
|
7528
|
+
let s = Kr({
|
|
7216
7529
|
textbox: n,
|
|
7217
7530
|
transform: t,
|
|
7218
7531
|
scenePoint: this.canvas.getScenePoint(e.e)
|
|
@@ -7235,33 +7548,34 @@ var qr = class {
|
|
|
7235
7548
|
}, j = r.lastAllowedScaleX, M = r.lastAllowedScaleY;
|
|
7236
7549
|
if (i) {
|
|
7237
7550
|
let e = Math.max(r.minimumProportionalScale, r.lastAllowedScaleX * Math.sqrt(u * d)), t = c || l ? r.minimumProportionalScale : e;
|
|
7238
|
-
if (Math.abs(t - r.lastAllowedScaleX) <=
|
|
7551
|
+
if (Math.abs(t - r.lastAllowedScaleX) <= qr) return;
|
|
7239
7552
|
j = t, M = t;
|
|
7240
7553
|
} else {
|
|
7241
7554
|
if (a) {
|
|
7242
7555
|
let e = r.lastAllowedScaleX * u, t = c ? r.minimumWidthScale : Math.max(r.minimumWidthScale, e);
|
|
7243
|
-
Math.abs(t - r.lastAllowedScaleX) >
|
|
7556
|
+
Math.abs(t - r.lastAllowedScaleX) > qr && (j = t);
|
|
7244
7557
|
}
|
|
7245
7558
|
if (o) {
|
|
7246
7559
|
let e = r.lastAllowedScaleY * d, t = l ? r.minimumFontScale : Math.max(r.minimumFontScale, e);
|
|
7247
|
-
Math.abs(t - r.lastAllowedScaleY) >
|
|
7560
|
+
Math.abs(t - r.lastAllowedScaleY) > qr && (M = t);
|
|
7248
7561
|
}
|
|
7249
|
-
if (Math.abs(j - r.lastAllowedScaleX) <=
|
|
7562
|
+
if (Math.abs(j - r.lastAllowedScaleX) <= qr && Math.abs(M - r.lastAllowedScaleY) <= qr) return;
|
|
7250
7563
|
}
|
|
7251
|
-
let { appliedWidth: N, dimensionsRounded: P } =
|
|
7564
|
+
let { appliedWidth: N, dimensionsRounded: P } = Ur({
|
|
7252
7565
|
textbox: n,
|
|
7253
7566
|
canvasManager: this.canvasManager,
|
|
7254
7567
|
base: r.startBase,
|
|
7568
|
+
placement: r.startObjectPlacement,
|
|
7569
|
+
anchorPlacement: m,
|
|
7255
7570
|
widthScale: j,
|
|
7256
7571
|
heightScale: M,
|
|
7257
|
-
placement: m,
|
|
7258
7572
|
shouldScaleFontSize: i || o,
|
|
7259
7573
|
shouldScalePadding: i || o,
|
|
7260
7574
|
shouldScaleRadii: i || o,
|
|
7261
7575
|
shouldDisableAutoExpandOnHorizontalChange: a,
|
|
7262
7576
|
shouldRoundDimensions: !i
|
|
7263
7577
|
});
|
|
7264
|
-
|
|
7578
|
+
Gr({
|
|
7265
7579
|
textbox: n,
|
|
7266
7580
|
transform: t,
|
|
7267
7581
|
appliedWidth: N
|
|
@@ -7282,47 +7596,48 @@ var qr = class {
|
|
|
7282
7596
|
}), this.canvas.requestRenderAll();
|
|
7283
7597
|
}, this.handleObjectScaling = (t) => {
|
|
7284
7598
|
let { target: n, transform: r } = t;
|
|
7285
|
-
if (n instanceof e || !
|
|
7599
|
+
if (n instanceof e || !Jr(n) || Yr(n) || !r) return;
|
|
7286
7600
|
n.isScaling = !0;
|
|
7287
7601
|
let i = this._ensureScalingState({
|
|
7288
7602
|
textbox: n,
|
|
7289
7603
|
transform: r
|
|
7290
|
-
}), { startBase: a } = i, { width: o, fontSize: s } = a, { isCornerHandle: c, isHorizontalHandle: l, isVerticalHandle: u } =
|
|
7604
|
+
}), { startBase: a } = i, { width: o, fontSize: s } = a, { isCornerHandle: c, isHorizontalHandle: l, isVerticalHandle: u } = Wr({ transform: r }), d = r.corner ?? "", f = c || u;
|
|
7291
7605
|
if (!l && !u && !c) return;
|
|
7292
7606
|
let p = n.scaleX ?? r.scaleX ?? 1, m = n.scaleY ?? r.scaleY ?? 1, h = Math.abs(p) || 1, g = Math.abs(m) || 1, _ = r.originX ?? n.originX ?? "center", v = r.originY ?? n.originY ?? "center", y = this.canvasManager.getObjectPlacement({
|
|
7293
7607
|
object: n,
|
|
7294
7608
|
originX: _,
|
|
7295
7609
|
originY: v
|
|
7296
|
-
}), { paddingTop: b = 0, paddingRight: x = 0, paddingBottom: S = 0, paddingLeft: C = 0, radiusTopLeft: w = 0, radiusTopRight: T = 0, radiusBottomRight: E = 0, radiusBottomLeft: D = 0, fontSize: O, width: k } = n, A = c || u, j = c || u, M = k ?? o, N = i.lastAllowedScaleX, P = i.lastAllowedScaleY, F = y,
|
|
7610
|
+
}), { paddingTop: b = 0, paddingRight: x = 0, paddingBottom: S = 0, paddingLeft: C = 0, radiusTopLeft: w = 0, radiusTopRight: T = 0, radiusBottomRight: E = 0, radiusBottomLeft: D = 0, fontSize: O, width: k } = n, A = c || u, j = c || u, M = k ?? o, N = i.lastAllowedScaleX, P = i.lastAllowedScaleY, F = y, I = !0;
|
|
7297
7611
|
if (c) {
|
|
7298
7612
|
let e = Math.sqrt(h * g), t = i.lastAllowedScaleX * e, n = p < 0 || m < 0, r = _ !== i.startTransformOriginX || v !== i.startTransformOriginY, a = d !== i.startTransformCorner;
|
|
7299
|
-
if (n || r || a) N = i.lastAllowedScaleX, P = i.lastAllowedScaleY, F = i.
|
|
7613
|
+
if (n || r || a) N = i.lastAllowedScaleX, P = i.lastAllowedScaleY, F = i.lastAllowedAnchorPlacement, I = !1;
|
|
7300
7614
|
else {
|
|
7301
7615
|
let e = Math.max(i.minimumProportionalScale, t);
|
|
7302
7616
|
N = e, P = e;
|
|
7303
7617
|
}
|
|
7304
7618
|
} else l && (N = Math.max(i.minimumWidthScale, i.lastAllowedScaleX * h)), u && (P = Math.max(i.minimumFontScale, i.lastAllowedScaleY * g));
|
|
7305
|
-
let { appliedWidth:
|
|
7619
|
+
let { appliedWidth: ee, dimensionsRounded: L } = Ur({
|
|
7306
7620
|
textbox: n,
|
|
7307
7621
|
canvasManager: this.canvasManager,
|
|
7308
7622
|
base: a,
|
|
7623
|
+
placement: i.startObjectPlacement,
|
|
7624
|
+
anchorPlacement: F,
|
|
7309
7625
|
widthScale: N,
|
|
7310
7626
|
heightScale: P,
|
|
7311
|
-
placement: F,
|
|
7312
7627
|
shouldScaleFontSize: f,
|
|
7313
7628
|
shouldScalePadding: A,
|
|
7314
7629
|
shouldScaleRadii: j,
|
|
7315
7630
|
shouldDisableAutoExpandOnHorizontalChange: l,
|
|
7316
7631
|
shouldRoundDimensions: !c
|
|
7317
7632
|
});
|
|
7318
|
-
|
|
7633
|
+
Gr({
|
|
7319
7634
|
textbox: n,
|
|
7320
7635
|
transform: r,
|
|
7321
|
-
appliedWidth:
|
|
7322
|
-
}), this.canvas.requestRenderAll(),
|
|
7636
|
+
appliedWidth: ee
|
|
7637
|
+
}), this.canvas.requestRenderAll(), I && this._updateScalingStateAfterLiveCommit({
|
|
7323
7638
|
textbox: n,
|
|
7324
7639
|
state: i,
|
|
7325
|
-
appliedWidth:
|
|
7640
|
+
appliedWidth: ee,
|
|
7326
7641
|
previousFontSize: O ?? s,
|
|
7327
7642
|
previousPadding: {
|
|
7328
7643
|
top: b,
|
|
@@ -7337,7 +7652,7 @@ var qr = class {
|
|
|
7337
7652
|
bottomLeft: D
|
|
7338
7653
|
},
|
|
7339
7654
|
previousWidth: M,
|
|
7340
|
-
dimensionsRounded:
|
|
7655
|
+
dimensionsRounded: L,
|
|
7341
7656
|
isCornerHandle: c,
|
|
7342
7657
|
isHorizontalHandle: l,
|
|
7343
7658
|
isVerticalHandle: u,
|
|
@@ -7348,7 +7663,7 @@ var qr = class {
|
|
|
7348
7663
|
let { target: n } = t;
|
|
7349
7664
|
if (n instanceof e) {
|
|
7350
7665
|
let t = n.getObjects();
|
|
7351
|
-
if (!t.some((e) =>
|
|
7666
|
+
if (!t.some((e) => Jr(e))) return;
|
|
7352
7667
|
let { scaleX: r = 1, scaleY: i = 1 } = n;
|
|
7353
7668
|
if (Math.abs(r - 1) < .01 && Math.abs(i - 1) < .01) return;
|
|
7354
7669
|
this.canvas.discardActiveObject(), t.forEach((e) => {
|
|
@@ -7358,7 +7673,7 @@ var qr = class {
|
|
|
7358
7673
|
this.canvas.setActiveObject(a), this.canvas.requestRenderAll();
|
|
7359
7674
|
return;
|
|
7360
7675
|
}
|
|
7361
|
-
if (!
|
|
7676
|
+
if (!Jr(n) || Yr(n)) return;
|
|
7362
7677
|
n.isScaling = !1;
|
|
7363
7678
|
let r = this.scalingState.get(n);
|
|
7364
7679
|
if (this.scalingState.delete(n), !r?.hasScalingChange) return;
|
|
@@ -7383,11 +7698,11 @@ var qr = class {
|
|
|
7383
7698
|
}, this.canvas = t, this.canvasManager = n, this.persistScaledTextbox = r, this.scalingState = /* @__PURE__ */ new WeakMap();
|
|
7384
7699
|
}
|
|
7385
7700
|
commitStandaloneTextScale({ target: e, shouldDisableAutoExpandOnHorizontalChange: t = !1 }) {
|
|
7386
|
-
if (!
|
|
7701
|
+
if (!Jr(e) || Yr(e)) return !1;
|
|
7387
7702
|
let n = Math.abs(e.scaleX ?? 1) || 1, r = Math.abs(e.scaleY ?? 1) || 1;
|
|
7388
7703
|
if (!(Math.abs(n - 1) > .01 || Math.abs(r - 1) > .01)) return !1;
|
|
7389
|
-
let i =
|
|
7390
|
-
return
|
|
7704
|
+
let i = Vr({ textbox: e }), a = this.canvasManager.getObjectPlacement({ object: e });
|
|
7705
|
+
return Ur({
|
|
7391
7706
|
textbox: e,
|
|
7392
7707
|
canvasManager: this.canvasManager,
|
|
7393
7708
|
base: i,
|
|
@@ -7403,22 +7718,23 @@ var qr = class {
|
|
|
7403
7718
|
_ensureScalingState({ textbox: e, transform: t }) {
|
|
7404
7719
|
let n = this.scalingState.get(e);
|
|
7405
7720
|
if (!n) {
|
|
7406
|
-
let r =
|
|
7721
|
+
let r = Vr({ textbox: e }), i = this.canvasManager.getObjectPlacement({ object: e }), a = Hr({ base: r }), o = t.original?.originX ?? t.originX ?? e.originX ?? "center", s = t.original?.originY ?? t.originY ?? e.originY ?? "center";
|
|
7407
7722
|
n = {
|
|
7408
7723
|
startBase: r,
|
|
7724
|
+
startObjectPlacement: i,
|
|
7409
7725
|
startTransformCorner: typeof t.corner == "string" ? t.corner : null,
|
|
7410
|
-
startTransformOriginX:
|
|
7411
|
-
startTransformOriginY:
|
|
7726
|
+
startTransformOriginX: o,
|
|
7727
|
+
startTransformOriginY: s,
|
|
7412
7728
|
lastAllowedScaleX: 1,
|
|
7413
7729
|
lastAllowedScaleY: 1,
|
|
7414
|
-
|
|
7730
|
+
lastAllowedAnchorPlacement: this.canvasManager.getObjectPlacement({
|
|
7415
7731
|
object: e,
|
|
7416
|
-
originX:
|
|
7417
|
-
originY:
|
|
7732
|
+
originX: o,
|
|
7733
|
+
originY: s
|
|
7418
7734
|
}),
|
|
7419
|
-
minimumWidthScale:
|
|
7420
|
-
minimumFontScale:
|
|
7421
|
-
minimumProportionalScale:
|
|
7735
|
+
minimumWidthScale: a.widthScale,
|
|
7736
|
+
minimumFontScale: a.fontScale,
|
|
7737
|
+
minimumProportionalScale: a.proportionalScale,
|
|
7422
7738
|
hasScalingChange: !1
|
|
7423
7739
|
}, this.scalingState.set(e, n);
|
|
7424
7740
|
}
|
|
@@ -7435,7 +7751,7 @@ var qr = class {
|
|
|
7435
7751
|
topRight: e.radiusTopRight ?? 0,
|
|
7436
7752
|
bottomRight: e.radiusBottomRight ?? 0,
|
|
7437
7753
|
bottomLeft: e.radiusBottomLeft ?? 0
|
|
7438
|
-
}, v = Math.abs(n - o) >
|
|
7754
|
+
}, v = Math.abs(n - o) > kr, y = Math.abs(h - r) > kr, b = Math.abs(g.top - i.top) > .01 || Math.abs(g.right - i.right) > .01 || Math.abs(g.bottom - i.bottom) > .01 || Math.abs(g.left - i.left) > .01, x = Math.abs(_.topLeft - a.topLeft) > .01 || Math.abs(_.topRight - a.topRight) > .01 || Math.abs(_.bottomRight - a.bottomRight) > .01 || Math.abs(_.bottomLeft - a.bottomLeft) > .01, S = t.lastAllowedScaleX, C = t.lastAllowedScaleY;
|
|
7439
7755
|
if (c) {
|
|
7440
7756
|
let e = h / Math.max(1, m);
|
|
7441
7757
|
S = e, C = e;
|
|
@@ -7450,13 +7766,13 @@ var qr = class {
|
|
|
7450
7766
|
}), t.hasScalingChange = t.hasScalingChange || v || y || b || x || s;
|
|
7451
7767
|
}
|
|
7452
7768
|
_storeLastAllowedScalingState({ textbox: e, state: t, widthScale: n, heightScale: r, originX: i, originY: a }) {
|
|
7453
|
-
t.lastAllowedScaleX = n, t.lastAllowedScaleY = r, t.
|
|
7769
|
+
t.lastAllowedScaleX = n, t.lastAllowedScaleY = r, t.lastAllowedAnchorPlacement = this.canvasManager.getObjectPlacement({
|
|
7454
7770
|
object: e,
|
|
7455
7771
|
originX: i,
|
|
7456
7772
|
originY: a
|
|
7457
7773
|
});
|
|
7458
7774
|
}
|
|
7459
|
-
},
|
|
7775
|
+
}, Zr = ({ textbox: e }) => {
|
|
7460
7776
|
let t = e.text ?? "";
|
|
7461
7777
|
if (!t.length) return [];
|
|
7462
7778
|
let n = t.split("\n"), r = [], i = 0;
|
|
@@ -7468,7 +7784,7 @@ var qr = class {
|
|
|
7468
7784
|
});
|
|
7469
7785
|
}
|
|
7470
7786
|
return r;
|
|
7471
|
-
},
|
|
7787
|
+
}, Qr = ({ range: e, text: t }) => {
|
|
7472
7788
|
if (!e) return null;
|
|
7473
7789
|
let n = t.length;
|
|
7474
7790
|
if (n <= 0) return null;
|
|
@@ -7477,8 +7793,8 @@ var qr = class {
|
|
|
7477
7793
|
start: l,
|
|
7478
7794
|
end: u
|
|
7479
7795
|
};
|
|
7480
|
-
},
|
|
7481
|
-
let n =
|
|
7796
|
+
}, $r = ({ textbox: e, range: t }) => {
|
|
7797
|
+
let n = Zr({ textbox: e });
|
|
7482
7798
|
if (!n.length) return t;
|
|
7483
7799
|
let { start: r } = t, { end: i } = t;
|
|
7484
7800
|
for (let e = 0; e < n.length; e += 1) {
|
|
@@ -7491,7 +7807,7 @@ var qr = class {
|
|
|
7491
7807
|
start: r,
|
|
7492
7808
|
end: i
|
|
7493
7809
|
};
|
|
7494
|
-
},
|
|
7810
|
+
}, ei = ({ textbox: e, range: t }) => {
|
|
7495
7811
|
let n = e.text ?? "";
|
|
7496
7812
|
if (!n.length) return [];
|
|
7497
7813
|
let { start: r, end: i } = t, a = n.split("\n"), o = [], s = 0;
|
|
@@ -7500,7 +7816,7 @@ var qr = class {
|
|
|
7500
7816
|
i > n && r < c && o.push(e), s = c + 1;
|
|
7501
7817
|
}
|
|
7502
7818
|
return o;
|
|
7503
|
-
},
|
|
7819
|
+
}, ti = ({ textbox: e, range: t }) => {
|
|
7504
7820
|
let n = e.text ?? "";
|
|
7505
7821
|
if (!n.length) return [];
|
|
7506
7822
|
let { start: r, end: i } = t, a = n.split("\n"), o = [], s = 0;
|
|
@@ -7509,20 +7825,20 @@ var qr = class {
|
|
|
7509
7825
|
r <= n && i >= c && o.push(e), s = c + 1;
|
|
7510
7826
|
}
|
|
7511
7827
|
return o;
|
|
7512
|
-
},
|
|
7828
|
+
}, ni = ({ previous: e, next: t }) => {
|
|
7513
7829
|
let n = Math.min(e.length, t.length);
|
|
7514
7830
|
for (let r = 0; r < n; r += 1) if (e[r] !== t[r]) return r;
|
|
7515
7831
|
return n;
|
|
7516
|
-
},
|
|
7832
|
+
}, ri = ({ text: e, charIndex: t }) => {
|
|
7517
7833
|
let n = Math.max(0, Math.min(t, e.length)), r = 0;
|
|
7518
7834
|
for (let t = 0; t < n; t += 1) e[t] === "\n" && (r += 1);
|
|
7519
7835
|
return r;
|
|
7520
|
-
},
|
|
7836
|
+
}, ii = ({ text: e, lineIndex: t }) => {
|
|
7521
7837
|
if (t <= 0) return 0;
|
|
7522
7838
|
let n = 0;
|
|
7523
7839
|
for (let r = 0; r < e.length; r += 1) if (e[r] === "\n" && (n += 1, n === t)) return r + 1;
|
|
7524
7840
|
return e.length;
|
|
7525
|
-
},
|
|
7841
|
+
}, ai = class e {
|
|
7526
7842
|
constructor({ editor: t }) {
|
|
7527
7843
|
this._handleTextEditingEntered = (t) => {
|
|
7528
7844
|
this.isTextEditingActive = !0;
|
|
@@ -7535,7 +7851,7 @@ var qr = class {
|
|
|
7535
7851
|
if (!e._isTextbox(n) || this.lineDefaultsSyncing.has(n)) return;
|
|
7536
7852
|
let r = e._isShapeOwnedTextbox(n), { text: i = "", uppercase: a, autoExpand: o } = n, s = !!a, c = o !== !1, l = i.toLocaleLowerCase(), u = r ? null : this.editingPlacementState?.get(n) ?? this.editor.canvasManager.getObjectPlacement({ object: n });
|
|
7537
7853
|
if (s) {
|
|
7538
|
-
let e =
|
|
7854
|
+
let e = Tr({ value: l });
|
|
7539
7855
|
e !== i && n.set({ text: e }), n.textCaseRaw = l;
|
|
7540
7856
|
} else n.textCaseRaw = i;
|
|
7541
7857
|
if (!r && o === void 0 && (n.autoExpand = !0), r) {
|
|
@@ -7553,7 +7869,7 @@ var qr = class {
|
|
|
7553
7869
|
let r = e._isShapeOwnedTextbox(n);
|
|
7554
7870
|
this.editingPlacementState?.delete(n);
|
|
7555
7871
|
let i = n.text ?? "";
|
|
7556
|
-
n.uppercase ? n.textCaseRaw = n.textCaseRaw ?? i.toLocaleLowerCase() : n.textCaseRaw = i, r || (
|
|
7872
|
+
n.uppercase ? n.textCaseRaw = n.textCaseRaw ?? i.toLocaleLowerCase() : n.textCaseRaw = i, r || (Br({ textbox: n }) && (n.setCoords(), n.dirty = !0, this.canvas.requestRenderAll()), n.locked || n.set({
|
|
7557
7873
|
lockMovementX: !1,
|
|
7558
7874
|
lockMovementY: !1
|
|
7559
7875
|
}));
|
|
@@ -7580,7 +7896,7 @@ var qr = class {
|
|
|
7580
7896
|
transform: r,
|
|
7581
7897
|
event: i ?? null
|
|
7582
7898
|
});
|
|
7583
|
-
}, this.editor = t, this.canvas = t.canvas, this.fonts = t.options.fonts ?? [], this.scalingController = new
|
|
7899
|
+
}, this.editor = t, this.canvas = t.canvas, this.fonts = t.options.fonts ?? [], this.scalingController = new Xr({
|
|
7584
7900
|
canvas: t.canvas,
|
|
7585
7901
|
canvasManager: t.canvasManager,
|
|
7586
7902
|
persistScaledTextbox: ({ target: e, style: t }) => {
|
|
@@ -7589,17 +7905,17 @@ var qr = class {
|
|
|
7589
7905
|
style: t
|
|
7590
7906
|
});
|
|
7591
7907
|
}
|
|
7592
|
-
}), this.editingPlacementState = /* @__PURE__ */ new WeakMap(), this.lineDefaultsSyncing = /* @__PURE__ */ new WeakSet(), this.isTextEditingActive = !1, this._bindEvents(),
|
|
7908
|
+
}), this.editingPlacementState = /* @__PURE__ */ new WeakMap(), this.lineDefaultsSyncing = /* @__PURE__ */ new WeakSet(), this.isTextEditingActive = !1, this._bindEvents(), Or();
|
|
7593
7909
|
}
|
|
7594
|
-
addText({ id: t = `text-${D()}`, text: n = "Новый текст", autoExpand: r = !0, fontFamily: i, fontSize: a = 48, bold: o = !1, italic: s = !1, underline: c = !1, uppercase: l = !1, strikethrough: u = !1, align: d = "left", color: f = "#000000", strokeColor: p, strokeWidth: m = 0, opacity: h = 1, backgroundColor: g, backgroundOpacity: _ = 1, paddingTop: v = 0, paddingRight: y = 0, paddingBottom: b = 0, paddingLeft: x = 0, radiusTopLeft: S = 0, radiusTopRight: C = 0, radiusBottomRight: w = 0, radiusBottomLeft: T = 0, ...E } = {}, { withoutSelection: O = !1, withoutSave: k = !1, withoutAdding: A = !1 } = {}) {
|
|
7595
|
-
let { canvasManager:
|
|
7596
|
-
|
|
7597
|
-
let
|
|
7910
|
+
addText({ id: t = `text-${D()}`, text: n = "Новый текст", autoExpand: r = !0, fontFamily: i, fontSize: a = 48, bold: o = !1, italic: s = !1, underline: c = !1, uppercase: l = !1, strikethrough: u = !1, align: d = "left", color: f = "#000000", strokeColor: p, strokeWidth: m = 0, opacity: h = 1, backgroundColor: g, backgroundOpacity: _ = 1, paddingTop: v = 0, paddingRight: y = 0, paddingBottom: b = 0, paddingLeft: x = 0, radiusTopLeft: S = 0, radiusTopRight: C = 0, radiusBottomRight: w = 0, radiusBottomLeft: T = 0, ...E } = {}, { withoutSelection: O = !1, withoutSave: k = !1, withoutAdding: A = !1, emitLifecycleEvents: j = !0 } = {}) {
|
|
7911
|
+
let { canvasManager: M, historyManager: N } = this.editor, { canvas: P } = this;
|
|
7912
|
+
N.suspendHistory();
|
|
7913
|
+
let F = i ?? this._getDefaultFontFamily(), I = wr({ width: m }), ee = Cr({
|
|
7598
7914
|
strokeColor: p,
|
|
7599
|
-
width:
|
|
7600
|
-
}),
|
|
7915
|
+
width: I
|
|
7916
|
+
}), L = {
|
|
7601
7917
|
id: t,
|
|
7602
|
-
fontFamily:
|
|
7918
|
+
fontFamily: F,
|
|
7603
7919
|
fontSize: a,
|
|
7604
7920
|
fontWeight: o ? "bold" : "normal",
|
|
7605
7921
|
fontStyle: s ? "italic" : "normal",
|
|
@@ -7609,7 +7925,7 @@ var qr = class {
|
|
|
7609
7925
|
textAlign: d,
|
|
7610
7926
|
fill: f,
|
|
7611
7927
|
stroke: ee,
|
|
7612
|
-
strokeWidth:
|
|
7928
|
+
strokeWidth: I,
|
|
7613
7929
|
strokeUniform: !0,
|
|
7614
7930
|
opacity: h,
|
|
7615
7931
|
backgroundColor: g,
|
|
@@ -7623,33 +7939,33 @@ var qr = class {
|
|
|
7623
7939
|
radiusBottomRight: w,
|
|
7624
7940
|
radiusBottomLeft: T,
|
|
7625
7941
|
...E
|
|
7626
|
-
},
|
|
7627
|
-
|
|
7628
|
-
let
|
|
7629
|
-
if (
|
|
7630
|
-
let e =
|
|
7631
|
-
e !==
|
|
7632
|
-
}
|
|
7633
|
-
|
|
7634
|
-
let
|
|
7635
|
-
|
|
7636
|
-
object:
|
|
7942
|
+
}, R = new Dr(n, L), te = r !== !1;
|
|
7943
|
+
R.autoExpand = te;
|
|
7944
|
+
let ne = E.left !== void 0 || E.top !== void 0;
|
|
7945
|
+
if (R.textCaseRaw = R.text ?? "", l) {
|
|
7946
|
+
let e = Tr({ value: R.textCaseRaw });
|
|
7947
|
+
e !== R.text && R.set({ text: e });
|
|
7948
|
+
}
|
|
7949
|
+
Br({ textbox: R }) && (R.dirty = !0);
|
|
7950
|
+
let z;
|
|
7951
|
+
ne && (z = M.resolveObjectPlacement({
|
|
7952
|
+
object: R,
|
|
7637
7953
|
left: E.left,
|
|
7638
7954
|
top: E.top,
|
|
7639
7955
|
originX: E.originX,
|
|
7640
7956
|
originY: E.originY,
|
|
7641
|
-
fallbackPoint:
|
|
7957
|
+
fallbackPoint: M.getMontageAreaSceneCenter()
|
|
7642
7958
|
}));
|
|
7643
|
-
let
|
|
7644
|
-
return (
|
|
7645
|
-
textbox:
|
|
7646
|
-
placement:
|
|
7647
|
-
shouldAutoExpand:
|
|
7648
|
-
clampToMontage:
|
|
7649
|
-
}),
|
|
7650
|
-
textbox:
|
|
7959
|
+
let re = te && e._hasWrappedLinesBeyondExplicitBreaks(R);
|
|
7960
|
+
return (ne || re) && this._normalizeTextboxAfterContentChange({
|
|
7961
|
+
textbox: R,
|
|
7962
|
+
placement: z,
|
|
7963
|
+
shouldAutoExpand: re,
|
|
7964
|
+
clampToMontage: ne
|
|
7965
|
+
}), z || M.centerObjectToMontageArea({ object: R }), A || P.add(R), O || P.setActiveObject(R), P.requestRenderAll(), N.resumeHistory(), k || N.saveState(), j && P.fire("editor:text-added", {
|
|
7966
|
+
textbox: R,
|
|
7651
7967
|
options: {
|
|
7652
|
-
...
|
|
7968
|
+
...L,
|
|
7653
7969
|
text: n,
|
|
7654
7970
|
bold: o,
|
|
7655
7971
|
italic: s,
|
|
@@ -7657,144 +7973,171 @@ var qr = class {
|
|
|
7657
7973
|
align: d,
|
|
7658
7974
|
color: f,
|
|
7659
7975
|
strokeColor: ee,
|
|
7660
|
-
strokeWidth:
|
|
7976
|
+
strokeWidth: I
|
|
7661
7977
|
},
|
|
7662
7978
|
flags: {
|
|
7663
7979
|
withoutSelection: !!O,
|
|
7664
7980
|
withoutSave: !!k,
|
|
7665
7981
|
withoutAdding: !!A
|
|
7666
7982
|
}
|
|
7667
|
-
}),
|
|
7983
|
+
}), R;
|
|
7668
7984
|
}
|
|
7669
|
-
updateText({ target: t, style: n = {}, withoutSave: r, skipRender: i, selectionRange: a } = {}) {
|
|
7670
|
-
let
|
|
7671
|
-
if (!
|
|
7672
|
-
let { text:
|
|
7673
|
-
|
|
7674
|
-
let
|
|
7675
|
-
object:
|
|
7985
|
+
updateText({ target: t, style: n = {}, withoutSave: r, skipRender: i, selectionRange: a, emitLifecycleEvents: o = !0 } = {}) {
|
|
7986
|
+
let s = this._resolveTextObject(t);
|
|
7987
|
+
if (!s) return null;
|
|
7988
|
+
let { text: c = "" } = s, { historyManager: l } = this.editor, { canvasManager: u } = this.editor, { canvas: d } = this;
|
|
7989
|
+
l.suspendHistory();
|
|
7990
|
+
let f = e._getSnapshot(s), { text: p, autoExpand: m, fontFamily: h, fontSize: g, bold: _, italic: v, underline: y, uppercase: b, strikethrough: x, align: S, color: C, strokeColor: w, strokeWidth: T, opacity: E, backgroundColor: D, backgroundOpacity: O, paddingTop: k, paddingRight: A, paddingBottom: j, paddingLeft: M, radiusTopLeft: N, radiusTopRight: P, radiusBottomRight: F, radiusBottomLeft: I, left: ee, top: L, originX: R, originY: te, ...ne } = n, z = { ...ne }, re = u.resolveObjectPlacement({
|
|
7991
|
+
object: s,
|
|
7676
7992
|
left: ee,
|
|
7677
|
-
top:
|
|
7678
|
-
originX:
|
|
7679
|
-
originY:
|
|
7680
|
-
}),
|
|
7681
|
-
text:
|
|
7993
|
+
top: L,
|
|
7994
|
+
originX: R,
|
|
7995
|
+
originY: te
|
|
7996
|
+
}), B = a === void 0 ? vr({ textbox: s }) : Qr({
|
|
7997
|
+
text: c,
|
|
7682
7998
|
range: a
|
|
7683
|
-
}),
|
|
7684
|
-
textbox:
|
|
7685
|
-
range:
|
|
7686
|
-
}) : null,
|
|
7687
|
-
textbox:
|
|
7688
|
-
range:
|
|
7689
|
-
}),
|
|
7690
|
-
if (
|
|
7691
|
-
let e =
|
|
7692
|
-
|
|
7693
|
-
}
|
|
7694
|
-
if (
|
|
7695
|
-
let e =
|
|
7696
|
-
|
|
7697
|
-
}
|
|
7698
|
-
if (
|
|
7699
|
-
let e =
|
|
7700
|
-
textbox:
|
|
7701
|
-
range:
|
|
7999
|
+
}), V = B ? $r({
|
|
8000
|
+
textbox: s,
|
|
8001
|
+
range: B
|
|
8002
|
+
}) : null, H = {}, ie = {}, U = {}, ae, oe, se = br({
|
|
8003
|
+
textbox: s,
|
|
8004
|
+
range: B
|
|
8005
|
+
}), ce = !B || se, le = !B;
|
|
8006
|
+
if (h !== void 0 && (V && (ie.fontFamily = h), ce && (z.fontFamily = h, le && (U.fontFamily = h))), g !== void 0 && (V && (ie.fontSize = g), ce && (z.fontSize = g, le && (U.fontSize = g))), _ !== void 0) {
|
|
8007
|
+
let e = _ ? "bold" : "normal";
|
|
8008
|
+
B && (H.fontWeight = e), ce && (z.fontWeight = e, le && (U.fontWeight = e));
|
|
8009
|
+
}
|
|
8010
|
+
if (v !== void 0) {
|
|
8011
|
+
let e = v ? "italic" : "normal";
|
|
8012
|
+
B && (H.fontStyle = e), ce && (z.fontStyle = e, le && (U.fontStyle = e));
|
|
8013
|
+
}
|
|
8014
|
+
if (y !== void 0 && (B && (H.underline = y), ce && (z.underline = y, le && (U.underline = y))), x !== void 0 && (B && (H.linethrough = x), ce && (z.linethrough = x, le && (U.linethrough = x))), S !== void 0 && (z.textAlign = S), C !== void 0 && (B && (H.fill = C), ce && (z.fill = C, le && (U.fill = C))), w !== void 0 || T !== void 0) {
|
|
8015
|
+
let e = B ? Sr({
|
|
8016
|
+
textbox: s,
|
|
8017
|
+
range: B,
|
|
7702
8018
|
property: "strokeWidth"
|
|
7703
|
-
}) : void 0, t =
|
|
7704
|
-
textbox:
|
|
7705
|
-
range:
|
|
8019
|
+
}) : void 0, t = B ? Sr({
|
|
8020
|
+
textbox: s,
|
|
8021
|
+
range: B,
|
|
7706
8022
|
property: "stroke"
|
|
7707
8023
|
}) : void 0;
|
|
7708
|
-
|
|
7709
|
-
strokeColor:
|
|
7710
|
-
width:
|
|
7711
|
-
}),
|
|
7712
|
-
}
|
|
7713
|
-
|
|
7714
|
-
let ue =
|
|
7715
|
-
fe || he ? (
|
|
7716
|
-
let ge =
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
|
|
8024
|
+
oe = wr({ width: T ?? e ?? s.strokeWidth ?? 0 }), ae = Cr({
|
|
8025
|
+
strokeColor: w ?? t ?? s.stroke ?? void 0,
|
|
8026
|
+
width: oe
|
|
8027
|
+
}), B && (H.stroke = ae, H.strokeWidth = oe), ce && (z.stroke = ae, z.strokeWidth = oe, le && (U.stroke = ae, U.strokeWidth = oe));
|
|
8028
|
+
}
|
|
8029
|
+
E !== void 0 && (z.opacity = E), D !== void 0 && (z.backgroundColor = D), O !== void 0 && (z.backgroundOpacity = O), k !== void 0 && (z.paddingTop = k), A !== void 0 && (z.paddingRight = A), j !== void 0 && (z.paddingBottom = j), M !== void 0 && (z.paddingLeft = M), N !== void 0 && (z.radiusTopLeft = N), P !== void 0 && (z.radiusTopRight = P), F !== void 0 && (z.radiusBottomRight = F), I !== void 0 && (z.radiusBottomLeft = I);
|
|
8030
|
+
let ue = s.textCaseRaw ?? c, de = !!s.uppercase, fe = p !== void 0, pe = fe ? p ?? "" : ue, me = b ?? de, he = me !== de;
|
|
8031
|
+
fe || he ? (z.text = me ? Tr({ value: pe }) : pe, s.textCaseRaw = pe) : s.textCaseRaw === void 0 && (s.textCaseRaw = ue);
|
|
8032
|
+
let ge = zr({ stylesList: [
|
|
8033
|
+
z,
|
|
8034
|
+
H,
|
|
8035
|
+
ie,
|
|
8036
|
+
U
|
|
8037
|
+
] }), _e = [
|
|
8038
|
+
ee,
|
|
8039
|
+
L,
|
|
8040
|
+
R,
|
|
8041
|
+
te
|
|
8042
|
+
], ve = [
|
|
8043
|
+
k,
|
|
8044
|
+
A,
|
|
8045
|
+
j,
|
|
8046
|
+
M
|
|
8047
|
+
], ye = _e.some((e) => e !== void 0), be = ve.some((e) => e !== void 0), xe = Object.prototype.hasOwnProperty.call(z, "width"), Se = be && !ye && !fe && !he && !ge && !xe, Ce = null;
|
|
8048
|
+
Se && (Ce = Ir({
|
|
8049
|
+
textbox: s,
|
|
8050
|
+
originX: re.originX,
|
|
8051
|
+
originY: re.originY
|
|
8052
|
+
})), s.uppercase = me, s.set(z);
|
|
8053
|
+
let we = !1;
|
|
8054
|
+
if (B) {
|
|
8055
|
+
let e = xr({
|
|
8056
|
+
textbox: s,
|
|
8057
|
+
styles: H,
|
|
8058
|
+
range: B
|
|
8059
|
+
}), t = V ? xr({
|
|
8060
|
+
textbox: s,
|
|
8061
|
+
styles: ie,
|
|
8062
|
+
range: V
|
|
7726
8063
|
}) : !1;
|
|
7727
|
-
|
|
7728
|
-
} else if (Object.keys(
|
|
7729
|
-
let e =
|
|
7730
|
-
e && (
|
|
7731
|
-
textbox:
|
|
7732
|
-
styles:
|
|
8064
|
+
we = e || t;
|
|
8065
|
+
} else if (Object.keys(U).length) {
|
|
8066
|
+
let e = yr({ textbox: s });
|
|
8067
|
+
e && (we = xr({
|
|
8068
|
+
textbox: s,
|
|
8069
|
+
styles: U,
|
|
7733
8070
|
range: e
|
|
7734
8071
|
}));
|
|
7735
8072
|
}
|
|
7736
|
-
let
|
|
7737
|
-
|
|
7738
|
-
|
|
7739
|
-
|
|
8073
|
+
let Te = we && zr({ stylesList: [
|
|
8074
|
+
H,
|
|
8075
|
+
ie,
|
|
8076
|
+
U
|
|
7740
8077
|
] });
|
|
7741
|
-
if (
|
|
7742
|
-
let e =
|
|
7743
|
-
textbox:
|
|
7744
|
-
range:
|
|
8078
|
+
if (we && (s.dirty = !0), V && (h !== void 0 || g !== void 0)) {
|
|
8079
|
+
let e = ei({
|
|
8080
|
+
textbox: s,
|
|
8081
|
+
range: V
|
|
7745
8082
|
}), t = {};
|
|
7746
|
-
|
|
7747
|
-
textbox:
|
|
8083
|
+
h !== void 0 && (t.fontFamily = h), g !== void 0 && (t.fontSize = g), Ar({
|
|
8084
|
+
textbox: s,
|
|
7748
8085
|
lineIndices: e,
|
|
7749
8086
|
updates: t
|
|
7750
8087
|
});
|
|
7751
8088
|
}
|
|
7752
|
-
if (
|
|
7753
|
-
let e =
|
|
7754
|
-
textbox:
|
|
7755
|
-
range:
|
|
8089
|
+
if (B && (C !== void 0 || w !== void 0 || T !== void 0)) {
|
|
8090
|
+
let e = ti({
|
|
8091
|
+
textbox: s,
|
|
8092
|
+
range: B
|
|
7756
8093
|
}), t = {};
|
|
7757
|
-
|
|
7758
|
-
textbox:
|
|
8094
|
+
C !== void 0 && (t.fill = C), (w !== void 0 || T !== void 0) && (ae === null && (t.stroke = null), ae != null && (t.stroke = ae)), Ar({
|
|
8095
|
+
textbox: s,
|
|
7759
8096
|
lineIndices: e,
|
|
7760
8097
|
updates: t
|
|
7761
8098
|
});
|
|
7762
8099
|
}
|
|
7763
|
-
|
|
7764
|
-
|
|
7765
|
-
|
|
7766
|
-
|
|
7767
|
-
|
|
7768
|
-
|
|
7769
|
-
|
|
7770
|
-
|
|
7771
|
-
|
|
8100
|
+
Te && (s.initDimensions(), s.dirty = !0), [
|
|
8101
|
+
D,
|
|
8102
|
+
O,
|
|
8103
|
+
...ve,
|
|
8104
|
+
N,
|
|
8105
|
+
P,
|
|
8106
|
+
F,
|
|
8107
|
+
I
|
|
8108
|
+
].some((e) => e !== void 0) && (s.dirty = !0);
|
|
8109
|
+
let { autoExpand: Ee } = s, De = m !== void 0, Oe = (m ?? Ee) !== !1;
|
|
8110
|
+
De ? s.autoExpand = m !== !1 : Ee === void 0 && (s.autoExpand = !0);
|
|
8111
|
+
let ke = Oe && !xe && (fe || he || ge);
|
|
7772
8112
|
this._normalizeTextboxAfterContentChange({
|
|
7773
|
-
textbox:
|
|
7774
|
-
placement:
|
|
7775
|
-
shouldAutoExpand:
|
|
7776
|
-
}),
|
|
7777
|
-
|
|
8113
|
+
textbox: s,
|
|
8114
|
+
placement: re,
|
|
8115
|
+
shouldAutoExpand: ke
|
|
8116
|
+
}), Ce && this._restoreTextboxContentPlacement({
|
|
8117
|
+
textbox: s,
|
|
8118
|
+
contentPlacement: Ce
|
|
8119
|
+
}), s.setCoords();
|
|
8120
|
+
let Ae = {
|
|
7778
8121
|
withoutSave: !!r,
|
|
7779
8122
|
skipRender: !!i
|
|
7780
|
-
},
|
|
7781
|
-
textbox:
|
|
8123
|
+
}, je = !!B && Object.keys(H).length > 0, Me = {
|
|
8124
|
+
textbox: s,
|
|
7782
8125
|
target: t,
|
|
7783
8126
|
style: n,
|
|
7784
|
-
options:
|
|
7785
|
-
updates:
|
|
7786
|
-
selectionRange:
|
|
7787
|
-
selectionStyles:
|
|
8127
|
+
options: Ae,
|
|
8128
|
+
updates: z,
|
|
8129
|
+
selectionRange: B ?? void 0,
|
|
8130
|
+
selectionStyles: je ? H : void 0
|
|
7788
8131
|
};
|
|
7789
|
-
|
|
7790
|
-
let
|
|
7791
|
-
|
|
7792
|
-
let
|
|
7793
|
-
...
|
|
7794
|
-
before:
|
|
7795
|
-
after:
|
|
8132
|
+
o && d.fire("editor:before:text-updated", Me), i || d.requestRenderAll();
|
|
8133
|
+
let Ne = e._getSnapshot(s);
|
|
8134
|
+
l.resumeHistory(), r || l.saveState();
|
|
8135
|
+
let Pe = {
|
|
8136
|
+
...Me,
|
|
8137
|
+
before: f,
|
|
8138
|
+
after: Ne
|
|
7796
8139
|
};
|
|
7797
|
-
return
|
|
8140
|
+
return o && d.fire("editor:text-updated", Pe), s;
|
|
7798
8141
|
}
|
|
7799
8142
|
stylesFromArray(e, t) {
|
|
7800
8143
|
return C.stylesFromArray(e, t);
|
|
@@ -7843,13 +8186,27 @@ var qr = class {
|
|
|
7843
8186
|
clampToMontage: r
|
|
7844
8187
|
}));
|
|
7845
8188
|
let a = !1;
|
|
7846
|
-
i || (a =
|
|
8189
|
+
i || (a = Br({ textbox: e }));
|
|
7847
8190
|
let o = !1;
|
|
7848
8191
|
return !i && t && (this.editor.canvasManager.applyObjectPlacement({
|
|
7849
8192
|
object: e,
|
|
7850
8193
|
placement: t
|
|
7851
8194
|
}), o = !0), (i || a) && (e.dirty = !0), (i || a || o) && e.setCoords(), i || a;
|
|
7852
8195
|
}
|
|
8196
|
+
_restoreTextboxContentPlacement({ textbox: e, contentPlacement: t }) {
|
|
8197
|
+
let n = Ir({
|
|
8198
|
+
textbox: e,
|
|
8199
|
+
originX: t.originX,
|
|
8200
|
+
originY: t.originY
|
|
8201
|
+
}), r = this.editor.canvasManager.getObjectPlacement({
|
|
8202
|
+
object: e,
|
|
8203
|
+
originX: "center",
|
|
8204
|
+
originY: "center"
|
|
8205
|
+
}), i = t.left - n.left, a = t.top - n.top;
|
|
8206
|
+
if (Math.abs(i) <= .01 && Math.abs(a) <= .01) return !1;
|
|
8207
|
+
let o = new p(r.left + i, r.top + a), s = e;
|
|
8208
|
+
return typeof s.setXY == "function" ? s.setXY(o, "center", "center") : e.setPositionByOrigin(o, "center", "center"), e.setCoords(), !0;
|
|
8209
|
+
}
|
|
7853
8210
|
_bindEvents() {
|
|
7854
8211
|
let { canvas: e } = this;
|
|
7855
8212
|
e.on("object:scaling", this.scalingController.handleObjectScaling), e.on("object:resizing", this._handleObjectResizing), e.on("object:modified", this.scalingController.handleObjectModified), e.on("mouse:move", this.scalingController.handleMouseMove), e.on("text:editing:entered", this._handleTextEditingEntered), e.on("text:editing:exited", this._handleTextEditingExited), e.on("text:changed", this._handleTextChanged);
|
|
@@ -7857,15 +8214,15 @@ var qr = class {
|
|
|
7857
8214
|
_syncLineFontDefaultsOnTextChanged({ textbox: e }) {
|
|
7858
8215
|
let { text: t = "", lineFontDefaults: n, styles: r, fontFamily: i, fontSize: a, fill: o, stroke: s, selectionStart: c, isEditing: l } = e, u = t, d = e.__lineDefaultsPrevText ?? u, f = d.split("\n"), p = u.split("\n"), m = f.length, h = p.length - m, g = n, _ = !1, v = !1, y = typeof o == "string" ? o : void 0, b = typeof s == "string" ? s : void 0;
|
|
7859
8216
|
if (h !== 0 && n && Object.keys(n).length) {
|
|
7860
|
-
let e =
|
|
8217
|
+
let e = ni({
|
|
7861
8218
|
previous: d,
|
|
7862
8219
|
next: u
|
|
7863
|
-
}), t =
|
|
8220
|
+
}), t = ri({
|
|
7864
8221
|
text: d,
|
|
7865
8222
|
charIndex: e
|
|
7866
8223
|
});
|
|
7867
8224
|
if (h > 0) {
|
|
7868
|
-
let r =
|
|
8225
|
+
let r = ii({
|
|
7869
8226
|
text: d,
|
|
7870
8227
|
lineIndex: t
|
|
7871
8228
|
}), i = t + 1;
|
|
@@ -7906,7 +8263,7 @@ var qr = class {
|
|
|
7906
8263
|
let t = p[e] ?? "", n = g ? g[e] : void 0;
|
|
7907
8264
|
if (n && (T = n), t.length !== 0) {
|
|
7908
8265
|
if (n) {
|
|
7909
|
-
let r =
|
|
8266
|
+
let r = jr({
|
|
7910
8267
|
lineText: t,
|
|
7911
8268
|
lineStyles: S ? S[e] : void 0,
|
|
7912
8269
|
lineDefaults: n
|
|
@@ -7946,16 +8303,16 @@ var qr = class {
|
|
|
7946
8303
|
if (!Number.isFinite(f) || f <= 0) return !1;
|
|
7947
8304
|
let p = a.split("\n").length, m = !1;
|
|
7948
8305
|
Math.abs((e.width ?? 0) - f) > .01 && (e.set({ width: f }), m = !0), e.initDimensions();
|
|
7949
|
-
let { textLines: h } = e, g = Array.isArray(h) && h.length > p, _ = Math.ceil(
|
|
8306
|
+
let { textLines: h } = e, g = Array.isArray(h) && h.length > p, _ = Math.ceil(Pr({
|
|
7950
8307
|
textbox: e,
|
|
7951
8308
|
text: a
|
|
7952
8309
|
})), v = Math.min(e.minWidth ?? 1, f), y = Math.min(f, Math.max(_, v));
|
|
7953
|
-
g && (y = f), Math.abs((e.width ?? 0) - y) > .01 && (e.set({ width: y }), e.initDimensions(), m = !0),
|
|
8310
|
+
g && (y = f), Math.abs((e.width ?? 0) - y) > .01 && (e.set({ width: y }), e.initDimensions(), m = !0), Br({ textbox: e }) && (m = !0), t && r.applyObjectPlacement({
|
|
7954
8311
|
object: e,
|
|
7955
8312
|
placement: t
|
|
7956
8313
|
});
|
|
7957
8314
|
let b = !1;
|
|
7958
|
-
return n && (b =
|
|
8315
|
+
return n && (b = Lr({
|
|
7959
8316
|
textbox: e,
|
|
7960
8317
|
montageLeft: o,
|
|
7961
8318
|
montageRight: o + s
|
|
@@ -8013,7 +8370,7 @@ var qr = class {
|
|
|
8013
8370
|
_getDefaultFontFamily() {
|
|
8014
8371
|
return this.fonts[0]?.family ?? "Arial";
|
|
8015
8372
|
}
|
|
8016
|
-
},
|
|
8373
|
+
}, oi = ({ x1: e, y1: t, x2: n, y2: r }) => (Math.atan2(r - t, n - e) * 180 / Math.PI + 360) % 360, si = (e) => {
|
|
8017
8374
|
if (!e || typeof e != "object") return null;
|
|
8018
8375
|
let { type: t, coords: n, colorStops: r } = e, i = Array.isArray(r) ? r : [], a = i[0], o = i[i.length - 1], s = typeof a?.color == "string" ? a.color : void 0, c = typeof o?.color == "string" ? o.color : s, l = typeof a?.offset == "number" ? a.offset * 100 : void 0, u = typeof o?.offset == "number" ? o.offset * 100 : void 0, d = i.map((e) => ({
|
|
8019
8376
|
color: typeof e.color == "string" ? e.color : "#000000",
|
|
@@ -8024,7 +8381,7 @@ var qr = class {
|
|
|
8024
8381
|
let { x1: e, y1: t, x2: r, y2: i } = n;
|
|
8025
8382
|
if (typeof e == "number" && typeof t == "number" && typeof r == "number" && typeof i == "number") return {
|
|
8026
8383
|
type: "linear",
|
|
8027
|
-
angle:
|
|
8384
|
+
angle: oi({
|
|
8028
8385
|
x1: e,
|
|
8029
8386
|
y1: t,
|
|
8030
8387
|
x2: r,
|
|
@@ -8052,7 +8409,7 @@ var qr = class {
|
|
|
8052
8409
|
};
|
|
8053
8410
|
}
|
|
8054
8411
|
return null;
|
|
8055
|
-
},
|
|
8412
|
+
}, ci = "_templateAnchorX", li = "_templateAnchorY", ui = class t {
|
|
8056
8413
|
constructor({ editor: e }) {
|
|
8057
8414
|
this.editor = e;
|
|
8058
8415
|
}
|
|
@@ -8061,7 +8418,7 @@ var qr = class {
|
|
|
8061
8418
|
if (!p.length) return s.emitWarning({
|
|
8062
8419
|
origin: "TemplateManager",
|
|
8063
8420
|
method: "serializeSelection",
|
|
8064
|
-
code:
|
|
8421
|
+
code: hr.TEMPLATE_MANAGER.NO_OBJECTS_SELECTED,
|
|
8065
8422
|
message: "Нет объектов для сериализации шаблона"
|
|
8066
8423
|
}), null;
|
|
8067
8424
|
let m = t._getBounds(o), h = t._getMontageSize({
|
|
@@ -8090,14 +8447,14 @@ var qr = class {
|
|
|
8090
8447
|
if (!s?.length) return a.emitWarning({
|
|
8091
8448
|
origin: "TemplateManager",
|
|
8092
8449
|
method: "applyTemplate",
|
|
8093
|
-
code:
|
|
8450
|
+
code: hr.TEMPLATE_MANAGER.INVALID_TEMPLATE,
|
|
8094
8451
|
message: "Шаблон не содержит объектов"
|
|
8095
8452
|
}), null;
|
|
8096
8453
|
let u = t._getBounds(r);
|
|
8097
8454
|
if (!u) return a.emitWarning({
|
|
8098
8455
|
origin: "TemplateManager",
|
|
8099
8456
|
method: "applyTemplate",
|
|
8100
|
-
code:
|
|
8457
|
+
code: hr.TEMPLATE_MANAGER.INVALID_TARGET,
|
|
8101
8458
|
message: "Не удалось определить границы монтажной области"
|
|
8102
8459
|
}), null;
|
|
8103
8460
|
let d = t._getMontageSize({
|
|
@@ -8116,7 +8473,7 @@ var qr = class {
|
|
|
8116
8473
|
if (!r.length) return a.emitWarning({
|
|
8117
8474
|
origin: "TemplateManager",
|
|
8118
8475
|
method: "applyTemplate",
|
|
8119
|
-
code:
|
|
8476
|
+
code: hr.TEMPLATE_MANAGER.INVALID_TEMPLATE,
|
|
8120
8477
|
message: "Не удалось создать объекты шаблона"
|
|
8121
8478
|
}), null;
|
|
8122
8479
|
let { backgroundObject: i, contentObjects: c } = t._extractBackgroundObject(r);
|
|
@@ -8135,7 +8492,7 @@ var qr = class {
|
|
|
8135
8492
|
baseWidth: f.baseWidth,
|
|
8136
8493
|
baseHeight: f.baseHeight,
|
|
8137
8494
|
useRelativePositions: m
|
|
8138
|
-
}), this.editor.textManager?.commitStandaloneTextScale({ target: e }),
|
|
8495
|
+
}), this.editor.textManager?.commitStandaloneTextScale({ target: e }), qe({ object: e }), e.set({
|
|
8139
8496
|
id: `${e.type}-${D()}`,
|
|
8140
8497
|
evented: !0
|
|
8141
8498
|
}), n.add(e), e));
|
|
@@ -8151,7 +8508,7 @@ var qr = class {
|
|
|
8151
8508
|
return a.emitError({
|
|
8152
8509
|
origin: "TemplateManager",
|
|
8153
8510
|
method: "applyTemplate",
|
|
8154
|
-
code:
|
|
8511
|
+
code: hr.TEMPLATE_MANAGER.APPLY_FAILED,
|
|
8155
8512
|
message: "Ошибка применения шаблона",
|
|
8156
8513
|
data: {
|
|
8157
8514
|
templateId: l,
|
|
@@ -8203,22 +8560,22 @@ var qr = class {
|
|
|
8203
8560
|
naturalHeight: 0,
|
|
8204
8561
|
width: 0,
|
|
8205
8562
|
height: 0
|
|
8206
|
-
}, m =
|
|
8563
|
+
}, m = W({
|
|
8207
8564
|
value: u || f || c.width,
|
|
8208
8565
|
fallback: 0
|
|
8209
|
-
}), h =
|
|
8566
|
+
}), h = W({
|
|
8210
8567
|
value: d || p || c.height,
|
|
8211
8568
|
fallback: 0
|
|
8212
|
-
}), g =
|
|
8569
|
+
}), g = W({
|
|
8213
8570
|
value: r,
|
|
8214
8571
|
fallback: m
|
|
8215
|
-
}), _ =
|
|
8572
|
+
}), _ = W({
|
|
8216
8573
|
value: i,
|
|
8217
8574
|
fallback: h
|
|
8218
|
-
}), v =
|
|
8575
|
+
}), v = W({
|
|
8219
8576
|
value: a,
|
|
8220
8577
|
fallback: c.scaleX || 1
|
|
8221
|
-
}), y =
|
|
8578
|
+
}), y = W({
|
|
8222
8579
|
value: o,
|
|
8223
8580
|
fallback: c.scaleY || 1
|
|
8224
8581
|
}), b = g * v, x = _ * y, S = m > 0, C = h > 0, w = b > 0, T = x > 0, E = t._resolveImageFit({ customData: s }), D = {};
|
|
@@ -8285,18 +8642,18 @@ var qr = class {
|
|
|
8285
8642
|
}
|
|
8286
8643
|
}
|
|
8287
8644
|
_transformObject({ object: e, scale: n, bounds: r, baseWidth: i, baseHeight: a, useRelativePositions: o }) {
|
|
8288
|
-
let s = e, { x: c, y: l } =
|
|
8645
|
+
let s = e, { x: c, y: l } = Ge({
|
|
8289
8646
|
object: e,
|
|
8290
8647
|
baseWidth: i,
|
|
8291
8648
|
baseHeight: a,
|
|
8292
8649
|
useRelativePositions: o
|
|
8293
|
-
}), { scaleX: u, scaleY: d } = e, f =
|
|
8650
|
+
}), { scaleX: u, scaleY: d } = e, f = W({
|
|
8294
8651
|
value: u,
|
|
8295
8652
|
fallback: 1
|
|
8296
|
-
}), p =
|
|
8653
|
+
}), p = W({
|
|
8297
8654
|
value: d,
|
|
8298
8655
|
fallback: 1
|
|
8299
|
-
}), m =
|
|
8656
|
+
}), m = Ke({
|
|
8300
8657
|
normalizedX: c,
|
|
8301
8658
|
normalizedY: l,
|
|
8302
8659
|
bounds: t._getPositioningBounds({
|
|
@@ -8305,8 +8662,8 @@ var qr = class {
|
|
|
8305
8662
|
baseHeight: a,
|
|
8306
8663
|
scale: n,
|
|
8307
8664
|
useRelativePositions: o,
|
|
8308
|
-
anchorX: t._resolveAnchor(s,
|
|
8309
|
-
anchorY: t._resolveAnchor(s,
|
|
8665
|
+
anchorX: t._resolveAnchor(s, ci),
|
|
8666
|
+
anchorY: t._resolveAnchor(s, li)
|
|
8310
8667
|
})
|
|
8311
8668
|
}), h = f * n, g = p * n, _ = e.originX ?? "center", v = e.originY ?? "center";
|
|
8312
8669
|
e.set({
|
|
@@ -8320,7 +8677,7 @@ var qr = class {
|
|
|
8320
8677
|
originX: _,
|
|
8321
8678
|
originY: v
|
|
8322
8679
|
}
|
|
8323
|
-
}), delete s[
|
|
8680
|
+
}), delete s[ci], delete s[li];
|
|
8324
8681
|
}
|
|
8325
8682
|
static _getPositioningBounds({ bounds: e, baseWidth: n, baseHeight: r, scale: i, useRelativePositions: a, anchorX: o, anchorY: s }) {
|
|
8326
8683
|
if (!a) return e;
|
|
@@ -8372,19 +8729,19 @@ var qr = class {
|
|
|
8372
8729
|
if (!(e instanceof _)) return;
|
|
8373
8730
|
let r = typeof e.text == "string" ? e.text : "";
|
|
8374
8731
|
if (!r) return;
|
|
8375
|
-
let i =
|
|
8732
|
+
let i = W({
|
|
8376
8733
|
value: this.editor?.montageArea?.width,
|
|
8377
8734
|
fallback: 0
|
|
8378
|
-
}), { width: a = 0 } = e, o =
|
|
8735
|
+
}), { width: a = 0 } = e, o = W({
|
|
8379
8736
|
value: n,
|
|
8380
8737
|
fallback: 0
|
|
8381
|
-
}), s =
|
|
8738
|
+
}), s = W({
|
|
8382
8739
|
value: a,
|
|
8383
8740
|
fallback: 0
|
|
8384
8741
|
});
|
|
8385
8742
|
if (!i || !s || !o) return;
|
|
8386
8743
|
e.setCoords();
|
|
8387
|
-
let c = e, l = t._resolveAnchor(c,
|
|
8744
|
+
let c = e, l = t._resolveAnchor(c, ci), u = typeof c.left == "number" ? c.left : null, d = e.originX ?? "center", f = e.originY ?? "center", p = e.getPointByOrigin(d, f), m = e.getBoundingRect(!1, !0), h = m.left + m.width;
|
|
8388
8745
|
e.set("width", i), e.initDimensions();
|
|
8389
8746
|
let g = t._getLongestLineWidth({
|
|
8390
8747
|
textbox: e,
|
|
@@ -8403,7 +8760,7 @@ var qr = class {
|
|
|
8403
8760
|
return i;
|
|
8404
8761
|
}
|
|
8405
8762
|
_serializeObject({ object: e, bounds: n, baseWidth: r, baseHeight: i }) {
|
|
8406
|
-
let a = e.toDatalessObject([...
|
|
8763
|
+
let a = e.toDatalessObject([...oe]);
|
|
8407
8764
|
if (t._isSvgObject(e)) {
|
|
8408
8765
|
let n = t._extractSvgMarkup(e);
|
|
8409
8766
|
n && (a.svgMarkup = n, delete a.objects, delete a.path);
|
|
@@ -8413,10 +8770,10 @@ var qr = class {
|
|
|
8413
8770
|
x: (p.left - o) / d,
|
|
8414
8771
|
y: (p.top - s) / f
|
|
8415
8772
|
}, h = (u.left - o) / d, g = (u.top - s) / f, _ = h + u.width / d, v = g + u.height / f;
|
|
8416
|
-
return a[
|
|
8773
|
+
return a[ci] = t._detectAnchor({
|
|
8417
8774
|
start: h,
|
|
8418
8775
|
end: _
|
|
8419
|
-
}), a[
|
|
8776
|
+
}), a[li] = t._detectAnchor({
|
|
8420
8777
|
start: g,
|
|
8421
8778
|
end: v
|
|
8422
8779
|
}), a.left = m.x, a.top = m.y, a;
|
|
@@ -8441,7 +8798,7 @@ var qr = class {
|
|
|
8441
8798
|
withoutSave: !0
|
|
8442
8799
|
}), !0;
|
|
8443
8800
|
if (a === "gradient") {
|
|
8444
|
-
let e =
|
|
8801
|
+
let e = si(r);
|
|
8445
8802
|
if (e) return n.setGradientBackground({
|
|
8446
8803
|
gradient: e,
|
|
8447
8804
|
customData: o,
|
|
@@ -8462,7 +8819,7 @@ var qr = class {
|
|
|
8462
8819
|
r.emitWarning({
|
|
8463
8820
|
origin: "TemplateManager",
|
|
8464
8821
|
method: "applyTemplate",
|
|
8465
|
-
code:
|
|
8822
|
+
code: hr.TEMPLATE_MANAGER.APPLY_FAILED,
|
|
8466
8823
|
message: "Не удалось применить фон из шаблона",
|
|
8467
8824
|
data: e
|
|
8468
8825
|
});
|
|
@@ -8498,29 +8855,29 @@ var qr = class {
|
|
|
8498
8855
|
enlivenObjectEnlivables(e) {
|
|
8499
8856
|
return C.enlivenObjectEnlivables(e);
|
|
8500
8857
|
}
|
|
8501
|
-
},
|
|
8502
|
-
let n =
|
|
8858
|
+
}, di = "#3D8BF4", fi = .5, pi = ({ distance: e }) => Number.isFinite(e) ? Math.round(Math.max(0, e)) : 0, mi = ({ firstDistance: e, secondDistance: t }) => {
|
|
8859
|
+
let n = pi({ distance: e }), r = pi({ distance: t });
|
|
8503
8860
|
return {
|
|
8504
8861
|
firstDisplayDistance: n,
|
|
8505
8862
|
secondDisplayDistance: r,
|
|
8506
8863
|
displayDistanceDiff: Math.abs(n - r),
|
|
8507
8864
|
commonDisplayDistance: Math.max(n, r)
|
|
8508
8865
|
};
|
|
8509
|
-
},
|
|
8866
|
+
}, hi = ({ firstStart: e, firstEnd: t, secondStart: n, secondEnd: r }) => Math.min(t, r) - Math.max(e, n), gi = ({ step: e }) => {
|
|
8510
8867
|
let t = Math.abs(e).toString(), n = t.indexOf(".");
|
|
8511
8868
|
return n === -1 ? 0 : t.slice(n + 1).length;
|
|
8512
|
-
},
|
|
8869
|
+
}, _i = ({ value: e, step: t }) => {
|
|
8513
8870
|
if (t === 0) return e;
|
|
8514
|
-
let n =
|
|
8871
|
+
let n = gi({ step: t }), r = Math.round(e / t) * t;
|
|
8515
8872
|
return Number(r.toFixed(n));
|
|
8516
|
-
},
|
|
8873
|
+
}, vi = ({ value: e, step: t }) => {
|
|
8517
8874
|
if (t === 0) return !0;
|
|
8518
|
-
let n =
|
|
8875
|
+
let n = _i({
|
|
8519
8876
|
value: e,
|
|
8520
8877
|
step: t
|
|
8521
|
-
}), r = 10 ** -(
|
|
8878
|
+
}), r = 10 ** -(gi({ step: t }) + 4);
|
|
8522
8879
|
return Math.abs(n - e) <= r;
|
|
8523
|
-
},
|
|
8880
|
+
}, yi = ({ bounds: e, axis: t }) => {
|
|
8524
8881
|
let { left: n = 0, right: r = 0, top: i = 0, bottom: a = 0 } = e;
|
|
8525
8882
|
return t === "vertical" ? {
|
|
8526
8883
|
start: i,
|
|
@@ -8529,7 +8886,7 @@ var qr = class {
|
|
|
8529
8886
|
start: n,
|
|
8530
8887
|
end: r
|
|
8531
8888
|
};
|
|
8532
|
-
},
|
|
8889
|
+
}, bi = ({ items: e, axis: t }) => {
|
|
8533
8890
|
for (let n = 1; n < e.length; n += 1) {
|
|
8534
8891
|
let r = e[n], { bounds: i } = r, a = i[t], o = n - 1;
|
|
8535
8892
|
for (; o >= 0;) {
|
|
@@ -8539,10 +8896,10 @@ var qr = class {
|
|
|
8539
8896
|
}
|
|
8540
8897
|
e[o + 1] = r;
|
|
8541
8898
|
}
|
|
8542
|
-
},
|
|
8899
|
+
}, xi = ({ items: e, index: t, axis: n, direction: r }) => {
|
|
8543
8900
|
let i = e[t];
|
|
8544
8901
|
if (!i) return null;
|
|
8545
|
-
let { bounds: a } = i, { start: o, end: s } =
|
|
8902
|
+
let { bounds: a } = i, { start: o, end: s } = yi({
|
|
8546
8903
|
bounds: a,
|
|
8547
8904
|
axis: n
|
|
8548
8905
|
});
|
|
@@ -8550,7 +8907,7 @@ var qr = class {
|
|
|
8550
8907
|
for (let r = t - 1; r >= 0; --r) {
|
|
8551
8908
|
let t = e[r];
|
|
8552
8909
|
if (!t) continue;
|
|
8553
|
-
let { bounds: i } = t, { end: a } =
|
|
8910
|
+
let { bounds: i } = t, { end: a } = yi({
|
|
8554
8911
|
bounds: i,
|
|
8555
8912
|
axis: n
|
|
8556
8913
|
});
|
|
@@ -8561,26 +8918,26 @@ var qr = class {
|
|
|
8561
8918
|
for (let r = t + 1; r < e.length; r += 1) {
|
|
8562
8919
|
let t = e[r];
|
|
8563
8920
|
if (!t) continue;
|
|
8564
|
-
let { bounds: i } = t, { start: a } =
|
|
8921
|
+
let { bounds: i } = t, { start: a } = yi({
|
|
8565
8922
|
bounds: i,
|
|
8566
8923
|
axis: n
|
|
8567
8924
|
});
|
|
8568
8925
|
if (a - s >= 0) return r;
|
|
8569
8926
|
}
|
|
8570
8927
|
return null;
|
|
8571
|
-
},
|
|
8928
|
+
}, Si = ({ items: e }) => {
|
|
8572
8929
|
for (let t = 0; t < e.length; t += 1) {
|
|
8573
8930
|
let { isActive: n } = e[t];
|
|
8574
8931
|
if (n) return t;
|
|
8575
8932
|
}
|
|
8576
8933
|
return -1;
|
|
8577
|
-
},
|
|
8934
|
+
}, Ci = ({ patternAxis: e, activeRangeStart: t, activeRangeEnd: n, tolerance: r = 0 }) => {
|
|
8578
8935
|
let i = Math.min(t, n), a = Math.max(t, n);
|
|
8579
8936
|
return e >= i - r && e <= a + r;
|
|
8580
|
-
},
|
|
8937
|
+
}, wi = ({ patternStart: e, patternEnd: t, activeStart: n, activeEnd: r }) => t <= n ? "before" : e >= r ? "after" : null, Ti = ({ baseOption: e, candidateOption: t }) => {
|
|
8581
8938
|
let { delta: n, guide: { distance: r } } = e, { delta: i, guide: { distance: a } } = t;
|
|
8582
8939
|
return n === i && r === a;
|
|
8583
|
-
},
|
|
8940
|
+
}, Ei = ({ options: e }) => {
|
|
8584
8941
|
let t = e[0];
|
|
8585
8942
|
for (let n = 1; n < e.length; n += 1) {
|
|
8586
8943
|
let r = e[n];
|
|
@@ -8591,11 +8948,11 @@ var qr = class {
|
|
|
8591
8948
|
r.diff === t.diff && Math.abs(r.delta) < Math.abs(t.delta) && (t = r);
|
|
8592
8949
|
}
|
|
8593
8950
|
return t;
|
|
8594
|
-
},
|
|
8951
|
+
}, Di = ({ currentOption: e, nextOption: t }) => {
|
|
8595
8952
|
if (!e) return !0;
|
|
8596
8953
|
let { contextDistance: n, diff: r, delta: i } = e, { contextDistance: a, diff: o, delta: s } = t;
|
|
8597
8954
|
return a < n ? !0 : a > n ? !1 : o < r ? !0 : o > r ? !1 : Math.abs(s) < Math.abs(i);
|
|
8598
|
-
},
|
|
8955
|
+
}, Oi = ({ options: e }) => {
|
|
8599
8956
|
let t = [], n = null, r = null;
|
|
8600
8957
|
for (let i of e) {
|
|
8601
8958
|
let { kind: e, side: a } = i;
|
|
@@ -8603,18 +8960,18 @@ var qr = class {
|
|
|
8603
8960
|
t.push(i);
|
|
8604
8961
|
continue;
|
|
8605
8962
|
}
|
|
8606
|
-
a === "before" &&
|
|
8963
|
+
a === "before" && Di({
|
|
8607
8964
|
currentOption: n,
|
|
8608
8965
|
nextOption: i
|
|
8609
|
-
}) && (n = i), a === "after" &&
|
|
8966
|
+
}) && (n = i), a === "after" && Di({
|
|
8610
8967
|
currentOption: r,
|
|
8611
8968
|
nextOption: i
|
|
8612
8969
|
}) && (r = i);
|
|
8613
8970
|
}
|
|
8614
8971
|
return n && t.push(n), r && t.push(r), t;
|
|
8615
|
-
},
|
|
8972
|
+
}, ki = ({ options: e, side: t, baseOption: n }) => {
|
|
8616
8973
|
let r = null;
|
|
8617
|
-
for (let i of e) if (i.side === t &&
|
|
8974
|
+
for (let i of e) if (i.side === t && Ti({
|
|
8618
8975
|
baseOption: n,
|
|
8619
8976
|
candidateOption: i
|
|
8620
8977
|
})) {
|
|
@@ -8625,63 +8982,63 @@ var qr = class {
|
|
|
8625
8982
|
!r || i.diff !== r.diff || Math.abs(i.delta) < Math.abs(r.delta) && (r = i);
|
|
8626
8983
|
}
|
|
8627
8984
|
return r;
|
|
8628
|
-
},
|
|
8985
|
+
}, Ai = ({ option: e }) => {
|
|
8629
8986
|
let { side: t, kind: n, guide: { distance: r } } = e;
|
|
8630
8987
|
return {
|
|
8631
8988
|
side: t,
|
|
8632
8989
|
kind: n,
|
|
8633
8990
|
distance: r
|
|
8634
8991
|
};
|
|
8635
|
-
},
|
|
8992
|
+
}, ji = ({ option: e, context: t }) => {
|
|
8636
8993
|
let { side: n, kind: r, distance: i } = t, { side: a, kind: o, guide: { distance: s } } = e;
|
|
8637
8994
|
return n !== a || r !== o ? !1 : Math.abs(s - i) <= 1;
|
|
8638
|
-
},
|
|
8995
|
+
}, Mi = ({ options: e, context: t }) => {
|
|
8639
8996
|
if (!t) return null;
|
|
8640
|
-
for (let n of e) if (
|
|
8997
|
+
for (let n of e) if (ji({
|
|
8641
8998
|
option: n,
|
|
8642
8999
|
context: t
|
|
8643
9000
|
})) return n;
|
|
8644
9001
|
return null;
|
|
8645
|
-
},
|
|
8646
|
-
let i =
|
|
9002
|
+
}, Ni = ({ options: e, bestOption: t, previousContext: n, switchDistance: r = 0 }) => {
|
|
9003
|
+
let i = Mi({
|
|
8647
9004
|
options: e,
|
|
8648
9005
|
context: n
|
|
8649
9006
|
});
|
|
8650
9007
|
if (!i) return t;
|
|
8651
9008
|
let a = Math.max(0, r);
|
|
8652
9009
|
return a === 0 || Math.abs(t.delta - i.delta) >= a ? t : i;
|
|
8653
|
-
},
|
|
9010
|
+
}, Pi = ({ guides: e, seenGuideKeys: t, guide: n }) => {
|
|
8654
9011
|
let { type: r, axis: i, refStart: a, refEnd: o, activeStart: s, activeEnd: c, distance: l } = n, u = `${r}:${i}:${a}:${o}:${s}:${c}:${l}`;
|
|
8655
9012
|
t.has(u) || (t.add(u), e.push(n));
|
|
8656
|
-
},
|
|
9013
|
+
}, Fi = ({ options: e, previousContext: t = null, switchDistance: n = 0 }) => {
|
|
8657
9014
|
if (!e.length) return {
|
|
8658
9015
|
delta: 0,
|
|
8659
9016
|
guides: [],
|
|
8660
9017
|
context: null
|
|
8661
9018
|
};
|
|
8662
|
-
let r =
|
|
9019
|
+
let r = Oi({ options: e }), i = [];
|
|
8663
9020
|
for (let e of r) e.kind === "reference" && i.push(e);
|
|
8664
|
-
let a = i.length > 0, o = a ? i : r, s =
|
|
9021
|
+
let a = i.length > 0, o = a ? i : r, s = Ni({
|
|
8665
9022
|
options: o,
|
|
8666
|
-
bestOption:
|
|
9023
|
+
bestOption: Ei({ options: o }),
|
|
8667
9024
|
previousContext: t,
|
|
8668
9025
|
switchDistance: n
|
|
8669
|
-
}), c =
|
|
9026
|
+
}), c = ki({
|
|
8670
9027
|
options: o,
|
|
8671
9028
|
side: "before",
|
|
8672
9029
|
baseOption: s
|
|
8673
|
-
}), l =
|
|
9030
|
+
}), l = ki({
|
|
8674
9031
|
options: o,
|
|
8675
9032
|
side: "after",
|
|
8676
9033
|
baseOption: s
|
|
8677
|
-
}), u =
|
|
9034
|
+
}), u = ki({
|
|
8678
9035
|
options: a ? r : o,
|
|
8679
9036
|
side: "center",
|
|
8680
9037
|
baseOption: s
|
|
8681
9038
|
}), d = [];
|
|
8682
9039
|
c && l ? d.push(c, l) : (d.push(s), s.side === "before" && l && d.push(l), s.side === "after" && c && d.push(c), s.side === "center" && (c && !l && d.push(c), l && !c && d.push(l)), a && s.side === "before" && !l && u && d.push(u), a && s.side === "after" && !c && u && d.push(u)), !d.length && u && d.push(u);
|
|
8683
9040
|
let f = [], p = /* @__PURE__ */ new Set();
|
|
8684
|
-
for (let e of d)
|
|
9041
|
+
for (let e of d) Pi({
|
|
8685
9042
|
guides: f,
|
|
8686
9043
|
seenGuideKeys: p,
|
|
8687
9044
|
guide: e.guide
|
|
@@ -8689,15 +9046,15 @@ var qr = class {
|
|
|
8689
9046
|
return {
|
|
8690
9047
|
delta: s.delta,
|
|
8691
9048
|
guides: f,
|
|
8692
|
-
context:
|
|
9049
|
+
context: Ai({ option: s })
|
|
8693
9050
|
};
|
|
8694
|
-
},
|
|
8695
|
-
let s = n - (e - r), c =
|
|
9051
|
+
}, Ii = ({ activeStart: e, activeEnd: t, targetGap: n, beforeEdge: r, afterEdge: i, threshold: a, step: o }) => {
|
|
9052
|
+
let s = n - (e - r), c = _i({
|
|
8696
9053
|
value: s,
|
|
8697
9054
|
step: o
|
|
8698
9055
|
}), l = Math.max(1, Math.ceil(a / Math.max(o, 1))), u = null;
|
|
8699
9056
|
for (let d = -l; d <= l; d += 1) {
|
|
8700
|
-
let l = c + d * o, f = e + l, p = t + l, m = f - r, h = i - p, { displayDistanceDiff: g, commonDisplayDistance: _ } =
|
|
9057
|
+
let l = c + d * o, f = e + l, p = t + l, m = f - r, h = i - p, { displayDistanceDiff: g, commonDisplayDistance: _ } = mi({
|
|
8701
9058
|
firstDistance: m,
|
|
8702
9059
|
secondDistance: h
|
|
8703
9060
|
});
|
|
@@ -8712,13 +9069,13 @@ var qr = class {
|
|
|
8712
9069
|
});
|
|
8713
9070
|
}
|
|
8714
9071
|
return u;
|
|
8715
|
-
},
|
|
8716
|
-
let { secondDisplayDistance: n, displayDistanceDiff: r } =
|
|
9072
|
+
}, Li = ({ currentGap: e, referenceGap: t }) => {
|
|
9073
|
+
let { secondDisplayDistance: n, displayDistanceDiff: r } = mi({
|
|
8717
9074
|
firstDistance: e,
|
|
8718
9075
|
secondDistance: t
|
|
8719
9076
|
});
|
|
8720
9077
|
return r > 1 ? null : n;
|
|
8721
|
-
},
|
|
9078
|
+
}, Ri = ({ anchors: e, positions: t, threshold: n }) => {
|
|
8722
9079
|
let r = 0, i = n + 1, a = null;
|
|
8723
9080
|
for (let o of t) for (let t of e) {
|
|
8724
9081
|
let e = Math.abs(t - o);
|
|
@@ -8728,8 +9085,8 @@ var qr = class {
|
|
|
8728
9085
|
delta: r,
|
|
8729
9086
|
guidePosition: a
|
|
8730
9087
|
};
|
|
8731
|
-
},
|
|
8732
|
-
let { left: r, right: i, centerX: a, top: o, bottom: s, centerY: c } = e, l =
|
|
9088
|
+
}, zi = ({ activeBounds: e, threshold: t, anchors: n }) => {
|
|
9089
|
+
let { left: r, right: i, centerX: a, top: o, bottom: s, centerY: c } = e, l = Ri({
|
|
8733
9090
|
anchors: n.vertical,
|
|
8734
9091
|
positions: [
|
|
8735
9092
|
r,
|
|
@@ -8737,7 +9094,7 @@ var qr = class {
|
|
|
8737
9094
|
i
|
|
8738
9095
|
],
|
|
8739
9096
|
threshold: t
|
|
8740
|
-
}), u =
|
|
9097
|
+
}), u = Ri({
|
|
8741
9098
|
anchors: n.horizontal,
|
|
8742
9099
|
positions: [
|
|
8743
9100
|
o,
|
|
@@ -8757,11 +9114,11 @@ var qr = class {
|
|
|
8757
9114
|
deltaY: u.delta,
|
|
8758
9115
|
guides: d
|
|
8759
9116
|
};
|
|
8760
|
-
},
|
|
9117
|
+
}, Bi = ({ activeBounds: e, candidates: t, threshold: n, patterns: r, previousContext: i = null, switchDistance: a = 0 }) => {
|
|
8761
9118
|
let { centerX: o, top: s, bottom: c, left: l, right: u } = e, d = [];
|
|
8762
9119
|
for (let e of t) {
|
|
8763
9120
|
let { left: t, right: n } = e;
|
|
8764
|
-
|
|
9121
|
+
hi({
|
|
8765
9122
|
firstStart: t,
|
|
8766
9123
|
firstEnd: n,
|
|
8767
9124
|
secondStart: l,
|
|
@@ -8781,22 +9138,22 @@ var qr = class {
|
|
|
8781
9138
|
f.push({
|
|
8782
9139
|
bounds: e,
|
|
8783
9140
|
isActive: !0
|
|
8784
|
-
}),
|
|
9141
|
+
}), bi({
|
|
8785
9142
|
items: f,
|
|
8786
9143
|
axis: "top"
|
|
8787
9144
|
});
|
|
8788
|
-
let p =
|
|
9145
|
+
let p = Si({ items: f });
|
|
8789
9146
|
if (p === -1) return {
|
|
8790
9147
|
delta: 0,
|
|
8791
9148
|
guides: [],
|
|
8792
9149
|
context: null
|
|
8793
9150
|
};
|
|
8794
|
-
let m = [], h = c - s, g =
|
|
9151
|
+
let m = [], h = c - s, g = xi({
|
|
8795
9152
|
items: f,
|
|
8796
9153
|
index: p,
|
|
8797
9154
|
axis: "vertical",
|
|
8798
9155
|
direction: "prev"
|
|
8799
|
-
}), _ =
|
|
9156
|
+
}), _ = xi({
|
|
8800
9157
|
items: f,
|
|
8801
9158
|
index: p,
|
|
8802
9159
|
axis: "vertical",
|
|
@@ -8805,19 +9162,19 @@ var qr = class {
|
|
|
8805
9162
|
if (v && y) {
|
|
8806
9163
|
let { bounds: e } = v, { bounds: t } = y, { bottom: r } = e, { top: i } = t, a = i - r - h;
|
|
8807
9164
|
if (a >= 0) {
|
|
8808
|
-
let e =
|
|
9165
|
+
let e = _i({
|
|
8809
9166
|
value: a / 2,
|
|
8810
9167
|
step: 1
|
|
8811
9168
|
}), t = s - r, l = i - c, u = Math.abs(t - e), d = Math.abs(l - e);
|
|
8812
9169
|
if (Math.max(u, d) <= n) {
|
|
8813
|
-
let t =
|
|
9170
|
+
let t = Ii({
|
|
8814
9171
|
activeStart: s,
|
|
8815
9172
|
activeEnd: c,
|
|
8816
9173
|
targetGap: e,
|
|
8817
9174
|
beforeEdge: r,
|
|
8818
9175
|
afterEdge: i,
|
|
8819
9176
|
threshold: n,
|
|
8820
|
-
step:
|
|
9177
|
+
step: fi
|
|
8821
9178
|
});
|
|
8822
9179
|
if (t) {
|
|
8823
9180
|
let { delta: e, distance: n, diff: i, activeStart: a, activeEnd: s } = t, c = {
|
|
@@ -8854,16 +9211,16 @@ var qr = class {
|
|
|
8854
9211
|
}
|
|
8855
9212
|
for (let e of r) {
|
|
8856
9213
|
let { axis: t, start: r, end: i, distance: a } = e;
|
|
8857
|
-
if (!
|
|
9214
|
+
if (!vi({
|
|
8858
9215
|
value: a,
|
|
8859
9216
|
step: .5
|
|
8860
|
-
}) || !
|
|
9217
|
+
}) || !Ci({
|
|
8861
9218
|
patternAxis: t,
|
|
8862
9219
|
activeRangeStart: l,
|
|
8863
9220
|
activeRangeEnd: u,
|
|
8864
9221
|
tolerance: n
|
|
8865
9222
|
})) continue;
|
|
8866
|
-
let d =
|
|
9223
|
+
let d = wi({
|
|
8867
9224
|
patternStart: r,
|
|
8868
9225
|
patternEnd: i,
|
|
8869
9226
|
activeStart: s,
|
|
@@ -8871,12 +9228,12 @@ var qr = class {
|
|
|
8871
9228
|
});
|
|
8872
9229
|
if (d) {
|
|
8873
9230
|
if (b !== null && S && d === "before" && Math.abs(b - a) <= n) {
|
|
8874
|
-
let e =
|
|
9231
|
+
let e = _i({
|
|
8875
9232
|
value: a - b,
|
|
8876
9233
|
step: 1
|
|
8877
9234
|
}), t = s + e, { bottom: c } = S, l = t - c, u = Math.abs(l - a);
|
|
8878
9235
|
if (u > n) continue;
|
|
8879
|
-
let d =
|
|
9236
|
+
let d = Li({
|
|
8880
9237
|
currentGap: l,
|
|
8881
9238
|
referenceGap: a
|
|
8882
9239
|
});
|
|
@@ -8900,12 +9257,12 @@ var qr = class {
|
|
|
8900
9257
|
});
|
|
8901
9258
|
}
|
|
8902
9259
|
if (x !== null && C && d === "after" && Math.abs(x - a) <= n) {
|
|
8903
|
-
let e =
|
|
9260
|
+
let e = _i({
|
|
8904
9261
|
value: x - a,
|
|
8905
9262
|
step: 1
|
|
8906
9263
|
}), t = c + e, { top: s } = C, l = s - t, u = Math.abs(l - a);
|
|
8907
9264
|
if (u > n) continue;
|
|
8908
|
-
let d =
|
|
9265
|
+
let d = Li({
|
|
8909
9266
|
currentGap: l,
|
|
8910
9267
|
referenceGap: a
|
|
8911
9268
|
});
|
|
@@ -8930,16 +9287,16 @@ var qr = class {
|
|
|
8930
9287
|
}
|
|
8931
9288
|
}
|
|
8932
9289
|
}
|
|
8933
|
-
return
|
|
9290
|
+
return Fi({
|
|
8934
9291
|
options: m,
|
|
8935
9292
|
previousContext: i,
|
|
8936
9293
|
switchDistance: a
|
|
8937
9294
|
});
|
|
8938
|
-
},
|
|
9295
|
+
}, Vi = ({ activeBounds: e, candidates: t, threshold: n, patterns: r, previousContext: i = null, switchDistance: a = 0 }) => {
|
|
8939
9296
|
let { centerY: o, left: s, right: c, top: l, bottom: u } = e, d = [];
|
|
8940
9297
|
for (let e of t) {
|
|
8941
9298
|
let { top: t, bottom: n } = e;
|
|
8942
|
-
|
|
9299
|
+
hi({
|
|
8943
9300
|
firstStart: t,
|
|
8944
9301
|
firstEnd: n,
|
|
8945
9302
|
secondStart: l,
|
|
@@ -8959,22 +9316,22 @@ var qr = class {
|
|
|
8959
9316
|
f.push({
|
|
8960
9317
|
bounds: e,
|
|
8961
9318
|
isActive: !0
|
|
8962
|
-
}),
|
|
9319
|
+
}), bi({
|
|
8963
9320
|
items: f,
|
|
8964
9321
|
axis: "left"
|
|
8965
9322
|
});
|
|
8966
|
-
let p =
|
|
9323
|
+
let p = Si({ items: f });
|
|
8967
9324
|
if (p === -1) return {
|
|
8968
9325
|
delta: 0,
|
|
8969
9326
|
guides: [],
|
|
8970
9327
|
context: null
|
|
8971
9328
|
};
|
|
8972
|
-
let m = [], h = c - s, g =
|
|
9329
|
+
let m = [], h = c - s, g = xi({
|
|
8973
9330
|
items: f,
|
|
8974
9331
|
index: p,
|
|
8975
9332
|
axis: "horizontal",
|
|
8976
9333
|
direction: "prev"
|
|
8977
|
-
}), _ =
|
|
9334
|
+
}), _ = xi({
|
|
8978
9335
|
items: f,
|
|
8979
9336
|
index: p,
|
|
8980
9337
|
axis: "horizontal",
|
|
@@ -8983,19 +9340,19 @@ var qr = class {
|
|
|
8983
9340
|
if (v && y) {
|
|
8984
9341
|
let { bounds: e } = v, { bounds: t } = y, { right: r } = e, { left: i } = t, a = i - r - h;
|
|
8985
9342
|
if (a >= 0) {
|
|
8986
|
-
let e =
|
|
9343
|
+
let e = _i({
|
|
8987
9344
|
value: a / 2,
|
|
8988
9345
|
step: 1
|
|
8989
9346
|
}), t = s - r, l = i - c, u = Math.abs(t - e), d = Math.abs(l - e);
|
|
8990
9347
|
if (Math.max(u, d) <= n) {
|
|
8991
|
-
let t =
|
|
9348
|
+
let t = Ii({
|
|
8992
9349
|
activeStart: s,
|
|
8993
9350
|
activeEnd: c,
|
|
8994
9351
|
targetGap: e,
|
|
8995
9352
|
beforeEdge: r,
|
|
8996
9353
|
afterEdge: i,
|
|
8997
9354
|
threshold: n,
|
|
8998
|
-
step:
|
|
9355
|
+
step: fi
|
|
8999
9356
|
});
|
|
9000
9357
|
if (t) {
|
|
9001
9358
|
let { delta: e, distance: n, diff: i, activeStart: a, activeEnd: s } = t, c = {
|
|
@@ -9032,16 +9389,16 @@ var qr = class {
|
|
|
9032
9389
|
}
|
|
9033
9390
|
for (let e of r) {
|
|
9034
9391
|
let { axis: t, start: r, end: i, distance: a } = e;
|
|
9035
|
-
if (!
|
|
9392
|
+
if (!vi({
|
|
9036
9393
|
value: a,
|
|
9037
9394
|
step: .5
|
|
9038
|
-
}) || !
|
|
9395
|
+
}) || !Ci({
|
|
9039
9396
|
patternAxis: t,
|
|
9040
9397
|
activeRangeStart: l,
|
|
9041
9398
|
activeRangeEnd: u,
|
|
9042
9399
|
tolerance: n
|
|
9043
9400
|
})) continue;
|
|
9044
|
-
let d =
|
|
9401
|
+
let d = wi({
|
|
9045
9402
|
patternStart: r,
|
|
9046
9403
|
patternEnd: i,
|
|
9047
9404
|
activeStart: s,
|
|
@@ -9049,12 +9406,12 @@ var qr = class {
|
|
|
9049
9406
|
});
|
|
9050
9407
|
if (d) {
|
|
9051
9408
|
if (b !== null && S && d === "before" && Math.abs(b - a) <= n) {
|
|
9052
|
-
let e =
|
|
9409
|
+
let e = _i({
|
|
9053
9410
|
value: a - b,
|
|
9054
9411
|
step: 1
|
|
9055
9412
|
}), t = s + e, { right: c } = S, l = t - c, u = Math.abs(l - a);
|
|
9056
9413
|
if (u > n) continue;
|
|
9057
|
-
let d =
|
|
9414
|
+
let d = Li({
|
|
9058
9415
|
currentGap: l,
|
|
9059
9416
|
referenceGap: a
|
|
9060
9417
|
});
|
|
@@ -9078,12 +9435,12 @@ var qr = class {
|
|
|
9078
9435
|
});
|
|
9079
9436
|
}
|
|
9080
9437
|
if (x !== null && C && d === "after" && Math.abs(x - a) <= n) {
|
|
9081
|
-
let e =
|
|
9438
|
+
let e = _i({
|
|
9082
9439
|
value: x - a,
|
|
9083
9440
|
step: 1
|
|
9084
9441
|
}), t = c + e, { left: s } = C, l = s - t, u = Math.abs(l - a);
|
|
9085
9442
|
if (u > n) continue;
|
|
9086
|
-
let d =
|
|
9443
|
+
let d = Li({
|
|
9087
9444
|
currentGap: l,
|
|
9088
9445
|
referenceGap: a
|
|
9089
9446
|
});
|
|
@@ -9108,20 +9465,20 @@ var qr = class {
|
|
|
9108
9465
|
}
|
|
9109
9466
|
}
|
|
9110
9467
|
}
|
|
9111
|
-
return
|
|
9468
|
+
return Fi({
|
|
9112
9469
|
options: m,
|
|
9113
9470
|
previousContext: i,
|
|
9114
9471
|
switchDistance: a
|
|
9115
9472
|
});
|
|
9116
|
-
},
|
|
9117
|
-
let { vertical: o = null, horizontal: s = null } = i ?? {}, c =
|
|
9473
|
+
}, Hi = ({ activeBounds: e, candidates: t, threshold: n, spacingPatterns: r, previousContexts: i, switchDistance: a = 0 }) => {
|
|
9474
|
+
let { vertical: o = null, horizontal: s = null } = i ?? {}, c = Bi({
|
|
9118
9475
|
activeBounds: e,
|
|
9119
9476
|
candidates: t,
|
|
9120
9477
|
threshold: n,
|
|
9121
9478
|
patterns: r.vertical,
|
|
9122
9479
|
previousContext: o,
|
|
9123
9480
|
switchDistance: a
|
|
9124
|
-
}), l =
|
|
9481
|
+
}), l = Vi({
|
|
9125
9482
|
activeBounds: e,
|
|
9126
9483
|
candidates: t,
|
|
9127
9484
|
threshold: n,
|
|
@@ -9140,14 +9497,14 @@ var qr = class {
|
|
|
9140
9497
|
horizontal: l.context
|
|
9141
9498
|
}
|
|
9142
9499
|
};
|
|
9143
|
-
},
|
|
9500
|
+
}, Ui = ({ context: e, x: t, y: n, width: r, height: i, radius: a }) => {
|
|
9144
9501
|
let o = Math.min(a, r / 2, i / 2);
|
|
9145
9502
|
e.moveTo(t + o, n), e.lineTo(t + r - o, n), e.quadraticCurveTo(t + r, n, t + r, n + o), e.lineTo(t + r, n + i - o), e.quadraticCurveTo(t + r, n + i, t + r - o, n + i), e.lineTo(t + o, n + i), e.quadraticCurveTo(t, n + i, t, n + i - o), e.lineTo(t, n + o), e.quadraticCurveTo(t, n, t + o, n), e.closePath();
|
|
9146
|
-
},
|
|
9503
|
+
}, Wi = ({ context: e, type: t, axis: n, start: r, end: i, text: a, zoom: o, color: s, textColor: c = "#ffffff", fontFamily: l = "sans-serif", lineWidth: u = 1, padding: d = 4, radius: f = 4, offsetAlongAxis: p = 0, offsetPerpendicular: m = 0 }) => {
|
|
9147
9504
|
let h = o || 1, g = 12 / h, _ = d / h, v = f / h, y = (r + i) / 2 + p, b = t === "vertical" ? n + m : y, x = t === "vertical" ? y : n + m;
|
|
9148
9505
|
e.save(), e.setLineDash([]), e.fillStyle = s, e.strokeStyle = s, e.lineWidth = u / h, e.font = `${g}px ${l}`, e.textAlign = "center", e.textBaseline = "middle";
|
|
9149
9506
|
let S = e.measureText(a).width + _ * 2, C = g + _ * 2, w = b - S / 2, T = x - C / 2;
|
|
9150
|
-
e.beginPath(),
|
|
9507
|
+
e.beginPath(), Ui({
|
|
9151
9508
|
context: e,
|
|
9152
9509
|
x: w,
|
|
9153
9510
|
y: T,
|
|
@@ -9155,11 +9512,11 @@ var qr = class {
|
|
|
9155
9512
|
height: C,
|
|
9156
9513
|
radius: v
|
|
9157
9514
|
}), e.fill(), e.fillStyle = c, e.fillText(a, b, x), e.restore();
|
|
9158
|
-
},
|
|
9159
|
-
let { type: r, axis: i, refStart: a, refEnd: o, activeStart: s, activeEnd: c, distance: l } = t, u =
|
|
9515
|
+
}, Gi = ({ context: e, guide: t, zoom: n }) => {
|
|
9516
|
+
let { type: r, axis: i, refStart: a, refEnd: o, activeStart: s, activeEnd: c, distance: l } = t, u = pi({ distance: l }).toString();
|
|
9160
9517
|
e.beginPath(), r === "vertical" ? (e.moveTo(i, a), e.lineTo(i, o), e.moveTo(i, s), e.lineTo(i, c)) : (e.moveTo(a, i), e.lineTo(o, i), e.moveTo(s, i), e.lineTo(c, i)), e.stroke();
|
|
9161
|
-
let d =
|
|
9162
|
-
|
|
9518
|
+
let d = di;
|
|
9519
|
+
Wi({
|
|
9163
9520
|
context: e,
|
|
9164
9521
|
type: r,
|
|
9165
9522
|
axis: i,
|
|
@@ -9169,7 +9526,7 @@ var qr = class {
|
|
|
9169
9526
|
zoom: n,
|
|
9170
9527
|
color: d,
|
|
9171
9528
|
lineWidth: 1
|
|
9172
|
-
}),
|
|
9529
|
+
}), Wi({
|
|
9173
9530
|
context: e,
|
|
9174
9531
|
type: r,
|
|
9175
9532
|
axis: i,
|
|
@@ -9180,10 +9537,10 @@ var qr = class {
|
|
|
9180
9537
|
color: d,
|
|
9181
9538
|
lineWidth: 1
|
|
9182
9539
|
});
|
|
9183
|
-
},
|
|
9540
|
+
}, Ki = ({ anchors: e, bounds: t }) => {
|
|
9184
9541
|
let { left: n, right: r, centerX: i, top: a, bottom: o, centerY: s } = t;
|
|
9185
9542
|
e.vertical.push(n, i, r), e.horizontal.push(a, s, o);
|
|
9186
|
-
},
|
|
9543
|
+
}, qi = ({ bounds: e, type: t, primaryStart: n, primaryEnd: r }) => {
|
|
9187
9544
|
let i = [], a = n === "top" ? "left" : "top", o = r === "bottom" ? "right" : "bottom", s = [...e].sort((e, t) => e[n] - t[n]);
|
|
9188
9545
|
for (let e = 0; e < s.length; e += 1) {
|
|
9189
9546
|
let c = s[e], l = null, u = Infinity;
|
|
@@ -9204,35 +9561,35 @@ var qr = class {
|
|
|
9204
9561
|
});
|
|
9205
9562
|
}
|
|
9206
9563
|
return i;
|
|
9207
|
-
},
|
|
9208
|
-
vertical:
|
|
9564
|
+
}, Ji = ({ bounds: e }) => ({
|
|
9565
|
+
vertical: qi({
|
|
9209
9566
|
bounds: e,
|
|
9210
9567
|
axis: "centerX",
|
|
9211
9568
|
type: "vertical",
|
|
9212
9569
|
primaryStart: "top",
|
|
9213
9570
|
primaryEnd: "bottom"
|
|
9214
9571
|
}),
|
|
9215
|
-
horizontal:
|
|
9572
|
+
horizontal: qi({
|
|
9216
9573
|
bounds: e,
|
|
9217
9574
|
axis: "centerY",
|
|
9218
9575
|
type: "horizontal",
|
|
9219
9576
|
primaryStart: "left",
|
|
9220
9577
|
primaryEnd: "right"
|
|
9221
9578
|
})
|
|
9222
|
-
}),
|
|
9579
|
+
}), Yi = [
|
|
9223
9580
|
"montage-area",
|
|
9224
9581
|
"background",
|
|
9225
9582
|
"interaction-blocker"
|
|
9226
|
-
],
|
|
9583
|
+
], Xi = ({ activeObject: t }) => {
|
|
9227
9584
|
let n = /* @__PURE__ */ new Set();
|
|
9228
9585
|
return t ? (n.add(t), t instanceof e && t.getObjects().forEach((e) => n.add(e)), n) : n;
|
|
9229
|
-
},
|
|
9586
|
+
}, Zi = ({ object: e, excluded: t, ignoredIds: n = Yi }) => {
|
|
9230
9587
|
if (t.has(e)) return !0;
|
|
9231
9588
|
let { visible: r = !0 } = e;
|
|
9232
9589
|
if (!r) return !0;
|
|
9233
9590
|
let { id: i } = e;
|
|
9234
9591
|
return !!(i && n.includes(i));
|
|
9235
|
-
},
|
|
9592
|
+
}, Qi = class e {
|
|
9236
9593
|
constructor({ editor: e }) {
|
|
9237
9594
|
this.anchors = {
|
|
9238
9595
|
vertical: [],
|
|
@@ -9280,12 +9637,12 @@ var qr = class {
|
|
|
9280
9637
|
target: n,
|
|
9281
9638
|
transform: i
|
|
9282
9639
|
}), !this.anchors.vertical.length && !this.anchors.horizontal.length && this._cacheAnchors({ activeObject: n });
|
|
9283
|
-
let a =
|
|
9640
|
+
let a = Je({ object: n });
|
|
9284
9641
|
if (!a) {
|
|
9285
9642
|
this._clearSpacingContexts(), this._clearGuides();
|
|
9286
9643
|
return;
|
|
9287
9644
|
}
|
|
9288
|
-
let { canvas: o } = this, s = o.getZoom() || 1, c = 5 / s, { deltaX: l, deltaY: u } =
|
|
9645
|
+
let { canvas: o } = this, s = o.getZoom() || 1, c = 5 / s, { deltaX: l, deltaY: u } = zi({
|
|
9289
9646
|
activeBounds: a,
|
|
9290
9647
|
threshold: c,
|
|
9291
9648
|
anchors: this.anchors
|
|
@@ -9295,9 +9652,9 @@ var qr = class {
|
|
|
9295
9652
|
n.set({
|
|
9296
9653
|
left: e + l,
|
|
9297
9654
|
top: t + u
|
|
9298
|
-
}), n.setCoords(), a =
|
|
9655
|
+
}), n.setCoords(), a = Je({ object: n }) ?? a;
|
|
9299
9656
|
}
|
|
9300
|
-
let d = this._resolveCurrentTargetBounds({ activeObject: n }), f = this.spacingContexts.vertical || this.spacingContexts.horizontal ? 10 / s : c, p =
|
|
9657
|
+
let d = this._resolveCurrentTargetBounds({ activeObject: n }), f = this.spacingContexts.vertical || this.spacingContexts.horizontal ? 10 / s : c, p = Hi({
|
|
9301
9658
|
activeBounds: a,
|
|
9302
9659
|
candidates: d,
|
|
9303
9660
|
threshold: f,
|
|
@@ -9312,17 +9669,17 @@ var qr = class {
|
|
|
9312
9669
|
n.set({
|
|
9313
9670
|
left: e + p.deltaX,
|
|
9314
9671
|
top: t + p.deltaY
|
|
9315
|
-
}), n.setCoords(), a =
|
|
9672
|
+
}), n.setCoords(), a = Je({ object: n }) ?? a;
|
|
9316
9673
|
}
|
|
9317
9674
|
m || e._applyMovementStep({
|
|
9318
9675
|
target: n,
|
|
9319
9676
|
transform: i
|
|
9320
9677
|
});
|
|
9321
|
-
let h =
|
|
9678
|
+
let h = Je({ object: n }) ?? a, g = zi({
|
|
9322
9679
|
activeBounds: h,
|
|
9323
9680
|
threshold: c,
|
|
9324
9681
|
anchors: this.anchors
|
|
9325
|
-
}), _ =
|
|
9682
|
+
}), _ = Hi({
|
|
9326
9683
|
activeBounds: h,
|
|
9327
9684
|
candidates: d,
|
|
9328
9685
|
threshold: c,
|
|
@@ -9362,7 +9719,7 @@ var qr = class {
|
|
|
9362
9719
|
}
|
|
9363
9720
|
let { anchors: l } = this, { vertical: u, horizontal: d } = l;
|
|
9364
9721
|
!u.length && !d.length && this._cacheAnchors({ activeObject: n });
|
|
9365
|
-
let f =
|
|
9722
|
+
let f = Je({ object: n });
|
|
9366
9723
|
if (!f) {
|
|
9367
9724
|
this._clearGuides();
|
|
9368
9725
|
return;
|
|
@@ -9486,7 +9843,7 @@ var qr = class {
|
|
|
9486
9843
|
}
|
|
9487
9844
|
let { anchors: a } = this, { vertical: o, horizontal: s } = a;
|
|
9488
9845
|
!o.length && !s.length && this._cacheAnchors({ activeObject: t });
|
|
9489
|
-
let c =
|
|
9846
|
+
let c = Je({ object: t });
|
|
9490
9847
|
if (!c) {
|
|
9491
9848
|
this._clearGuides();
|
|
9492
9849
|
return;
|
|
@@ -9553,9 +9910,9 @@ var qr = class {
|
|
|
9553
9910
|
let { canvas: e, guideBounds: t } = this, n = e.getSelectionContext();
|
|
9554
9911
|
if (!n) return;
|
|
9555
9912
|
let { left: r, right: i, top: a, bottom: o } = t ?? this._calculateViewportBounds(), { viewportTransform: s } = e, c = e.getZoom() || 1;
|
|
9556
|
-
n.save(), Array.isArray(s) && n.transform(...s), n.lineWidth = 1 / c, n.strokeStyle =
|
|
9913
|
+
n.save(), Array.isArray(s) && n.transform(...s), n.lineWidth = 1 / c, n.strokeStyle = di, n.setLineDash([4, 4]);
|
|
9557
9914
|
for (let e of this.activeGuides) n.beginPath(), e.type === "vertical" ? (n.moveTo(e.position, a), n.lineTo(e.position, o)) : (n.moveTo(r, e.position), n.lineTo(i, e.position)), n.stroke();
|
|
9558
|
-
for (let e of this.activeSpacingGuides)
|
|
9915
|
+
for (let e of this.activeSpacingGuides) Gi({
|
|
9559
9916
|
context: n,
|
|
9560
9917
|
guide: e,
|
|
9561
9918
|
zoom: c
|
|
@@ -9765,15 +10122,15 @@ var qr = class {
|
|
|
9765
10122
|
horizontal: []
|
|
9766
10123
|
}, r = [];
|
|
9767
10124
|
for (let e of t) {
|
|
9768
|
-
let t =
|
|
9769
|
-
t && (
|
|
10125
|
+
let t = Je({ object: e });
|
|
10126
|
+
t && (Ki({
|
|
9770
10127
|
anchors: n,
|
|
9771
10128
|
bounds: t
|
|
9772
10129
|
}), r.push(t));
|
|
9773
10130
|
}
|
|
9774
|
-
let { montageArea: i } = this.editor, a =
|
|
10131
|
+
let { montageArea: i } = this.editor, a = Je({ object: i });
|
|
9775
10132
|
if (a) {
|
|
9776
|
-
|
|
10133
|
+
Ki({
|
|
9777
10134
|
anchors: n,
|
|
9778
10135
|
bounds: a
|
|
9779
10136
|
});
|
|
@@ -9785,12 +10142,12 @@ var qr = class {
|
|
|
9785
10142
|
bottom: i
|
|
9786
10143
|
};
|
|
9787
10144
|
} else this.guideBounds = this._calculateViewportBounds();
|
|
9788
|
-
this.anchors = n, this.spacingPatterns =
|
|
10145
|
+
this.anchors = n, this.spacingPatterns = Ji({ bounds: r }), this.cachedTargetBounds = r;
|
|
9789
10146
|
}
|
|
9790
10147
|
_collectTargets({ activeObject: e }) {
|
|
9791
|
-
let t =
|
|
10148
|
+
let t = Xi({ activeObject: e }), n = [];
|
|
9792
10149
|
return this.canvas.forEachObject((e) => {
|
|
9793
|
-
|
|
10150
|
+
Zi({
|
|
9794
10151
|
object: e,
|
|
9795
10152
|
excluded: t
|
|
9796
10153
|
}) || n.push(e);
|
|
@@ -9799,7 +10156,7 @@ var qr = class {
|
|
|
9799
10156
|
_resolveCurrentTargetBounds({ activeObject: e }) {
|
|
9800
10157
|
let t = this._collectTargets({ activeObject: e }), n = [];
|
|
9801
10158
|
for (let e of t) {
|
|
9802
|
-
let t =
|
|
10159
|
+
let t = Je({ object: e });
|
|
9803
10160
|
t && n.push(t);
|
|
9804
10161
|
}
|
|
9805
10162
|
return n;
|
|
@@ -9813,7 +10170,7 @@ var qr = class {
|
|
|
9813
10170
|
bottom: (r - s) / a
|
|
9814
10171
|
};
|
|
9815
10172
|
}
|
|
9816
|
-
},
|
|
10173
|
+
}, $i = "#3D8BF4", ea = class e {
|
|
9817
10174
|
constructor({ editor: e }) {
|
|
9818
10175
|
this.activeGuides = [], this.isAltPressed = !1, this.pendingEvent = null, this.frameRequest = null, this.isToolbarHidden = !1, this.isTargetMontageArea = !1, this.lastMouseEvent = null, this.editor = e, this.canvas = e.canvas, this._onMouseMove = this._handleMouseMove.bind(this), this._onBeforeRender = this._handleBeforeRender.bind(this), this._onAfterRender = this._handleAfterRender.bind(this), this._onSelectionCleared = this._handleSelectionCleared.bind(this), this._onKeyDown = this._handleKeyDown.bind(this), this._onKeyUp = this._handleKeyUp.bind(this), this._onWindowBlur = this._handleWindowBlur.bind(this), this._bindEvents();
|
|
9819
10176
|
}
|
|
@@ -9877,7 +10234,7 @@ var qr = class {
|
|
|
9877
10234
|
this._clearGuides();
|
|
9878
10235
|
return;
|
|
9879
10236
|
}
|
|
9880
|
-
let a =
|
|
10237
|
+
let a = Je({ object: i });
|
|
9881
10238
|
if (!a) {
|
|
9882
10239
|
this._clearGuides();
|
|
9883
10240
|
return;
|
|
@@ -9885,7 +10242,7 @@ var qr = class {
|
|
|
9885
10242
|
let o = e._resolveTarget({
|
|
9886
10243
|
event: t,
|
|
9887
10244
|
activeObject: i
|
|
9888
|
-
}), { montageArea: s } = r, c = o ?? s, l = c === s, u =
|
|
10245
|
+
}), { montageArea: s } = r, c = o ?? s, l = c === s, u = Je({ object: c });
|
|
9889
10246
|
if (!u) {
|
|
9890
10247
|
this._clearGuides();
|
|
9891
10248
|
return;
|
|
@@ -9906,8 +10263,8 @@ var qr = class {
|
|
|
9906
10263
|
this.isTargetMontageArea = l, this.activeGuides = d, this._hideToolbar(), n.requestRenderAll();
|
|
9907
10264
|
}
|
|
9908
10265
|
static _resolveTarget({ event: e, activeObject: t }) {
|
|
9909
|
-
let { target: n } = e, r =
|
|
9910
|
-
return n && !
|
|
10266
|
+
let { target: n } = e, r = Xi({ activeObject: t });
|
|
10267
|
+
return n && !Zi({
|
|
9911
10268
|
object: n,
|
|
9912
10269
|
excluded: r
|
|
9913
10270
|
}) ? n : null;
|
|
@@ -10024,18 +10381,18 @@ var qr = class {
|
|
|
10024
10381
|
let { canvas: e } = this, t = e.getSelectionContext();
|
|
10025
10382
|
if (!t) return;
|
|
10026
10383
|
let { viewportTransform: n } = e, r = e.getZoom() || 1, i = this.activeGuides.some((e) => e.type === "vertical"), a = this.activeGuides.some((e) => e.type === "horizontal"), o = i && a && !this.isTargetMontageArea, s = o ? 12 / r : 0;
|
|
10027
|
-
t.save(), Array.isArray(n) && t.transform(...n), t.lineWidth = 1 / r, t.strokeStyle =
|
|
10384
|
+
t.save(), Array.isArray(n) && t.transform(...n), t.lineWidth = 1 / r, t.strokeStyle = $i, t.setLineDash([]);
|
|
10028
10385
|
for (let e of this.activeGuides) {
|
|
10029
10386
|
let { type: n, axis: i, start: a, end: c, distance: l } = e, u = Math.abs(c - a), d = o ? (a <= c ? -1 : 1) * (u / 2 + s) : 0;
|
|
10030
|
-
t.beginPath(), n === "vertical" ? (t.moveTo(i, a), t.lineTo(i, c)) : (t.moveTo(a, i), t.lineTo(c, i)), t.stroke(),
|
|
10387
|
+
t.beginPath(), n === "vertical" ? (t.moveTo(i, a), t.lineTo(i, c)) : (t.moveTo(a, i), t.lineTo(c, i)), t.stroke(), Wi({
|
|
10031
10388
|
context: t,
|
|
10032
10389
|
type: n,
|
|
10033
10390
|
axis: i,
|
|
10034
10391
|
start: a,
|
|
10035
10392
|
end: c,
|
|
10036
|
-
text:
|
|
10393
|
+
text: pi({ distance: l }).toString(),
|
|
10037
10394
|
zoom: r,
|
|
10038
|
-
color:
|
|
10395
|
+
color: $i,
|
|
10039
10396
|
lineWidth: 1,
|
|
10040
10397
|
offsetAlongAxis: d,
|
|
10041
10398
|
offsetPerpendicular: 0
|
|
@@ -10053,13 +10410,13 @@ var qr = class {
|
|
|
10053
10410
|
let { toolbar: e } = this.editor;
|
|
10054
10411
|
e?.showAfterTemporary?.(), this.isToolbarHidden = !1;
|
|
10055
10412
|
}
|
|
10056
|
-
},
|
|
10413
|
+
}, ta = class e {
|
|
10057
10414
|
constructor(e, t) {
|
|
10058
10415
|
this.options = t, this.containerId = e, this.editorId = `${e}-${D()}`, this.init();
|
|
10059
10416
|
}
|
|
10060
10417
|
async init() {
|
|
10061
10418
|
let { editorContainerWidth: e, editorContainerHeight: n, canvasWrapperWidth: r, canvasWrapperHeight: i, canvasCSSWidth: a, canvasCSSHeight: o, initialImage: s, initialState: c, scaleType: l, showRotationAngle: u, _onReadyCallback: d } = this.options;
|
|
10062
|
-
if (
|
|
10419
|
+
if (re.apply(), this.canvas = new t(this.containerId, this.options), this.moduleLoader = new A(), this.workerManager = new M(), this.errorManager = new gr({ editor: this }), this.historyManager = new je({ editor: this }), this.toolbar = new H({ editor: this }), this.transformManager = new He({ editor: this }), this.zoomManager = new Ue({ editor: this }), this.canvasManager = new Ve({ editor: this }), this.imageManager = new Le({ editor: this }), this.layerManager = new $e({ editor: this }), this.shapeManager = new lr({ editor: this }), this.interactionBlocker = new Ze({ editor: this }), this.backgroundManager = new Qe({ editor: this }), this.clipboardManager = new ur({ editor: this }), this.objectLockManager = new dr({ editor: this }), this.groupingManager = new fr({ editor: this }), this.selectionManager = new pr({ editor: this }), this.deletionManager = new mr({ editor: this }), this.panConstraintManager = new _r({ editor: this }), this.snappingManager = new Qi({ editor: this }), this.measurementManager = new ea({ editor: this }), this.fontManager = new B(this.options.fonts ?? []), this.textManager = new ai({ editor: this }), this.templateManager = new ui({ editor: this }), u && (this.angleIndicator = new ae({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.interactionBlocker.ensureOverlay(), this.listeners = new k({
|
|
10063
10420
|
editor: this,
|
|
10064
10421
|
options: this.options
|
|
10065
10422
|
}), this.canvasManager.setEditorContainerWidth(e), this.canvasManager.setEditorContainerHeight(n), this.canvasManager.setCanvasWrapperWidth(r), this.canvasManager.setCanvasWrapperHeight(i), this.canvasManager.setCanvasCSSWidth(a), this.canvasManager.setCanvasCSSHeight(o), this.canvasManager.updateCanvas(), this.zoomManager.calculateAndApplyDefaultZoom(), await this.fontManager.loadFonts(), c) {
|
|
@@ -10167,7 +10524,7 @@ var qr = class {
|
|
|
10167
10524
|
"U+A640-A69F",
|
|
10168
10525
|
"U+FE2E-FE2F",
|
|
10169
10526
|
"U+2116"
|
|
10170
|
-
].join(", "),
|
|
10527
|
+
].join(", "), na = {
|
|
10171
10528
|
preserveObjectStacking: !0,
|
|
10172
10529
|
controlsAboveOverlay: !0,
|
|
10173
10530
|
centeredRotation: !0,
|
|
@@ -11021,20 +11378,20 @@ var qr = class {
|
|
|
11021
11378
|
};
|
|
11022
11379
|
//#endregion
|
|
11023
11380
|
//#region src/main.ts
|
|
11024
|
-
function
|
|
11381
|
+
function ra(e, t = {}) {
|
|
11025
11382
|
let n = {
|
|
11026
|
-
|
|
11383
|
+
...na,
|
|
11027
11384
|
...t
|
|
11028
11385
|
}, r = document.getElementById(e);
|
|
11029
11386
|
if (!r) return Promise.reject(/* @__PURE__ */ Error(`Контейнер с ID "${e}" не найден.`));
|
|
11030
11387
|
let i = document.createElement("canvas");
|
|
11031
11388
|
return i.id = `${e}-canvas`, r.appendChild(i), n.editorContainer = r, new Promise((t) => {
|
|
11032
11389
|
n._onReadyCallback = t;
|
|
11033
|
-
let r = new
|
|
11390
|
+
let r = new ta(i.id, n);
|
|
11034
11391
|
window[e] = r;
|
|
11035
11392
|
});
|
|
11036
11393
|
}
|
|
11037
11394
|
//#endregion
|
|
11038
|
-
export {
|
|
11395
|
+
export { ra as default };
|
|
11039
11396
|
|
|
11040
11397
|
//# sourceMappingURL=main.js.map
|