@anu3ev/fabric-image-editor 0.7.5 → 0.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +750 -705
- package/package.json +1 -1
- package/readme.md +3 -0
- package/dist/stats.html +0 -4
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 te = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", ne = new Image();
|
|
265
|
+
ne.src = te;
|
|
266
|
+
function R(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(ne, -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 re = {
|
|
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: R,
|
|
330
330
|
sizeX: 32,
|
|
331
331
|
sizeY: 32,
|
|
332
332
|
offsetX: 0,
|
|
333
333
|
offsetY: -32
|
|
334
334
|
}
|
|
335
|
-
},
|
|
335
|
+
}, z = 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(re).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
|
+
}, ie = 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
|
+
}, B = {
|
|
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
|
+
}, ae = 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
|
+
...B,
|
|
699
699
|
...e,
|
|
700
700
|
style: {
|
|
701
|
-
...
|
|
701
|
+
...B.style,
|
|
702
702
|
...e.style || {}
|
|
703
703
|
},
|
|
704
704
|
btnStyle: {
|
|
705
|
-
...
|
|
705
|
+
...B.btnStyle,
|
|
706
706
|
...e.btnStyle || {}
|
|
707
707
|
},
|
|
708
708
|
icons: {
|
|
709
|
-
...
|
|
709
|
+
...B.icons,
|
|
710
710
|
...e.icons || {}
|
|
711
711
|
},
|
|
712
712
|
handlers: {
|
|
713
|
-
...
|
|
713
|
+
...B.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
|
+
}, V = {
|
|
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
|
+
}, oe = "fabric-editor-angle-indicator", se = 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 = oe, Object.entries(V).forEach(([e, t]) => {
|
|
811
811
|
this.el.style.setProperty(e, t);
|
|
812
812
|
}), this.canvas.wrapperEl.appendChild(this.el);
|
|
813
813
|
}
|
|
@@ -852,10 +852,10 @@ 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
|
+
}, ce = /* @__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 le({ state: e }) {
|
|
859
859
|
return JSON.parse(JSON.stringify(e));
|
|
860
860
|
}
|
|
861
861
|
function H({ value: e }) {
|
|
@@ -925,7 +925,7 @@ function ge({ prevState: e, nextState: t }) {
|
|
|
925
925
|
o !== c || s !== l || (t.width = n, t.height = r);
|
|
926
926
|
}
|
|
927
927
|
function _e({ prevState: e, nextState: t }) {
|
|
928
|
-
let n =
|
|
928
|
+
let n = le({ state: e }), r = le({ state: t });
|
|
929
929
|
return he({ objects: n.objects }), he({ objects: r.objects }), ge({
|
|
930
930
|
prevState: n,
|
|
931
931
|
nextState: r
|
|
@@ -1122,7 +1122,7 @@ var Me = class {
|
|
|
1122
1122
|
}
|
|
1123
1123
|
_serializeCanvasState() {
|
|
1124
1124
|
let { canvas: e } = this;
|
|
1125
|
-
return e.toDatalessObject([...
|
|
1125
|
+
return e.toDatalessObject([...ce]);
|
|
1126
1126
|
}
|
|
1127
1127
|
_handlePendingSaveTimeout() {
|
|
1128
1128
|
this._pendingSaveTimeoutId !== null && (this._pendingSaveTimeoutId = null, this._pendingSaveReason = null, this.saveState());
|
|
@@ -1197,7 +1197,7 @@ var Me = class {
|
|
|
1197
1197
|
e && (this._pendingSaveTimeoutId !== null && this._pendingSaveReason === e.reason && this._clearPendingSave(), e.reason === "text-edit" && this._deactivateTextEditing(), this._saveSerializedState({ currentStateObj: e.state }));
|
|
1198
1198
|
let t = je({
|
|
1199
1199
|
canvas: this.canvas,
|
|
1200
|
-
callback: () => this.canvas.toDatalessObject([...
|
|
1200
|
+
callback: () => this.canvas.toDatalessObject([...ce])
|
|
1201
1201
|
});
|
|
1202
1202
|
console.timeEnd("saveState"), this._saveSerializedState({ currentStateObj: t });
|
|
1203
1203
|
} finally {
|
|
@@ -3792,7 +3792,10 @@ function Pt({ value: e }) {
|
|
|
3792
3792
|
function Ft({ value: e }) {
|
|
3793
3793
|
return Number.isFinite(e) ? Math.max(0, Math.floor(e ?? 0)) : 0;
|
|
3794
3794
|
}
|
|
3795
|
-
function It({
|
|
3795
|
+
function It({ stroke: e, strokeWidth: t }) {
|
|
3796
|
+
return e == null ? !1 : Math.max(0, t ?? 0) > 0;
|
|
3797
|
+
}
|
|
3798
|
+
function Lt({ padding: e }) {
|
|
3796
3799
|
return {
|
|
3797
3800
|
top: Pt({ value: e?.top }),
|
|
3798
3801
|
right: Pt({ value: e?.right }),
|
|
@@ -3800,7 +3803,7 @@ function It({ padding: e }) {
|
|
|
3800
3803
|
left: Pt({ value: e?.left })
|
|
3801
3804
|
};
|
|
3802
3805
|
}
|
|
3803
|
-
function
|
|
3806
|
+
function Rt({ padding: e }) {
|
|
3804
3807
|
return {
|
|
3805
3808
|
top: Ft({ value: e?.top }),
|
|
3806
3809
|
right: Ft({ value: e?.right }),
|
|
@@ -3808,16 +3811,34 @@ function Lt({ padding: e }) {
|
|
|
3808
3811
|
left: Ft({ value: e?.left })
|
|
3809
3812
|
};
|
|
3810
3813
|
}
|
|
3811
|
-
function
|
|
3812
|
-
|
|
3814
|
+
function zt({ stroke: e, strokeWidth: t }) {
|
|
3815
|
+
if (!It({
|
|
3816
|
+
stroke: e,
|
|
3817
|
+
strokeWidth: t
|
|
3818
|
+
})) return {
|
|
3819
|
+
top: 0,
|
|
3820
|
+
right: 0,
|
|
3821
|
+
bottom: 0,
|
|
3822
|
+
left: 0
|
|
3823
|
+
};
|
|
3824
|
+
let n = Math.max(0, t ?? 0);
|
|
3825
|
+
return {
|
|
3826
|
+
top: n,
|
|
3827
|
+
right: n,
|
|
3828
|
+
bottom: n,
|
|
3829
|
+
left: n
|
|
3830
|
+
};
|
|
3831
|
+
}
|
|
3832
|
+
function Bt({ base: e, override: t }) {
|
|
3833
|
+
return t ? Rt({ padding: {
|
|
3813
3834
|
top: t.top ?? e.top,
|
|
3814
3835
|
right: t.right ?? e.right,
|
|
3815
3836
|
bottom: t.bottom ?? e.bottom,
|
|
3816
3837
|
left: t.left ?? e.left
|
|
3817
3838
|
} }) : e;
|
|
3818
3839
|
}
|
|
3819
|
-
function
|
|
3820
|
-
let n =
|
|
3840
|
+
function Vt({ base: e, addition: t }) {
|
|
3841
|
+
let n = Lt({ padding: e }), r = Lt({ padding: t });
|
|
3821
3842
|
return {
|
|
3822
3843
|
top: n.top + r.top,
|
|
3823
3844
|
right: n.right + r.right,
|
|
@@ -3825,7 +3846,16 @@ function zt({ base: e, addition: t }) {
|
|
|
3825
3846
|
left: n.left + r.left
|
|
3826
3847
|
};
|
|
3827
3848
|
}
|
|
3828
|
-
function
|
|
3849
|
+
function Ht({ baseInset: e, stroke: t, strokeWidth: n }) {
|
|
3850
|
+
return Vt({
|
|
3851
|
+
base: e,
|
|
3852
|
+
addition: zt({
|
|
3853
|
+
stroke: t,
|
|
3854
|
+
strokeWidth: n
|
|
3855
|
+
})
|
|
3856
|
+
});
|
|
3857
|
+
}
|
|
3858
|
+
function Ut({ padding: e }) {
|
|
3829
3859
|
if (!e) return {};
|
|
3830
3860
|
let t = {}, n = Object.keys(e);
|
|
3831
3861
|
for (let r = 0; r < n.length; r += 1) {
|
|
@@ -3836,17 +3866,17 @@ function Bt({ padding: e }) {
|
|
|
3836
3866
|
}
|
|
3837
3867
|
//#endregion
|
|
3838
3868
|
//#region src/editor/shape-manager/layout/shape-layout-padding.ts
|
|
3839
|
-
var
|
|
3840
|
-
function
|
|
3869
|
+
var Wt = .5, Gt = 12;
|
|
3870
|
+
function Kt({ width: e, padding: t }) {
|
|
3841
3871
|
let n = Math.max(0, t.left), r = Math.max(0, t.right);
|
|
3842
3872
|
return Math.max(1, e - n - r);
|
|
3843
3873
|
}
|
|
3844
|
-
function
|
|
3874
|
+
function qt({ text: e }) {
|
|
3845
3875
|
return (e.text ?? "").trim().length > 0;
|
|
3846
3876
|
}
|
|
3847
|
-
function
|
|
3877
|
+
function Jt({ start: e, end: t, maxTotalPadding: n, startChanged: r, endChanged: i }) {
|
|
3848
3878
|
let a = Math.max(0, e), o = Math.max(0, t), s = Math.max(0, n);
|
|
3849
|
-
if (a + o <= s +
|
|
3879
|
+
if (a + o <= s + Wt) return {
|
|
3850
3880
|
start: a,
|
|
3851
3881
|
end: o
|
|
3852
3882
|
};
|
|
@@ -3875,38 +3905,38 @@ function Gt({ start: e, end: t, maxTotalPadding: n, startChanged: r, endChanged:
|
|
|
3875
3905
|
end: o * l
|
|
3876
3906
|
};
|
|
3877
3907
|
}
|
|
3878
|
-
function
|
|
3879
|
-
let s =
|
|
3880
|
-
start:
|
|
3881
|
-
end:
|
|
3882
|
-
maxTotalPadding:
|
|
3908
|
+
function Yt({ start: e, end: t, insetStart: n, insetEnd: r, maxTotalPadding: i, startChanged: a, endChanged: o }) {
|
|
3909
|
+
let s = Math.max(0, n), c = Math.max(0, r), l = Math.max(0, i - s - c), u = Jt({
|
|
3910
|
+
start: Math.max(0, e),
|
|
3911
|
+
end: Math.max(0, t),
|
|
3912
|
+
maxTotalPadding: l,
|
|
3883
3913
|
startChanged: a,
|
|
3884
3914
|
endChanged: o
|
|
3885
|
-
}),
|
|
3915
|
+
}), d = Math.max(0, Math.floor(u.start)), f = Math.max(0, Math.floor(u.end));
|
|
3886
3916
|
return {
|
|
3887
|
-
appliedPaddingStart:
|
|
3888
|
-
appliedPaddingEnd:
|
|
3889
|
-
appliedUserPaddingStart:
|
|
3890
|
-
appliedUserPaddingEnd:
|
|
3917
|
+
appliedPaddingStart: s + d,
|
|
3918
|
+
appliedPaddingEnd: c + f,
|
|
3919
|
+
appliedUserPaddingStart: d,
|
|
3920
|
+
appliedUserPaddingEnd: f
|
|
3891
3921
|
};
|
|
3892
3922
|
}
|
|
3893
|
-
function
|
|
3923
|
+
function Xt({ text: e, minFrameWidth: t, maxFrameWidth: n, frameHeight: r, measureTextboxHeightForFrame: i }) {
|
|
3894
3924
|
let a = Math.max(1, t), o = Math.max(a, n), s = Math.max(1, r);
|
|
3895
|
-
if (!
|
|
3925
|
+
if (!qt({ text: e }) || i({
|
|
3896
3926
|
text: e,
|
|
3897
3927
|
frameWidth: a
|
|
3898
|
-
}) <= s +
|
|
3928
|
+
}) <= s + Wt) return a;
|
|
3899
3929
|
if (i({
|
|
3900
3930
|
text: e,
|
|
3901
3931
|
frameWidth: o
|
|
3902
|
-
}) > s +
|
|
3932
|
+
}) > s + Wt) return o;
|
|
3903
3933
|
let c = a, l = o;
|
|
3904
|
-
for (let t = 0; t <
|
|
3934
|
+
for (let t = 0; t < Gt; t += 1) {
|
|
3905
3935
|
let t = (c + l) / 2;
|
|
3906
3936
|
if (i({
|
|
3907
3937
|
text: e,
|
|
3908
3938
|
frameWidth: t
|
|
3909
|
-
}) <= s +
|
|
3939
|
+
}) <= s + Wt) {
|
|
3910
3940
|
l = t;
|
|
3911
3941
|
continue;
|
|
3912
3942
|
}
|
|
@@ -3914,37 +3944,38 @@ function qt({ text: e, minFrameWidth: t, maxFrameWidth: n, frameHeight: r, measu
|
|
|
3914
3944
|
}
|
|
3915
3945
|
return l;
|
|
3916
3946
|
}
|
|
3917
|
-
function
|
|
3918
|
-
let l = Math.max(1, t), u = Math.max(1, n), d =
|
|
3919
|
-
a || (m =
|
|
3947
|
+
function Zt({ text: e, width: t, height: n, padding: r, internalShapeTextInset: i, expandShapeHeightToFitText: a, changedPadding: o, measureTextboxHeightForFrame: s, resolveMinimumTextFrameWidth: c }) {
|
|
3948
|
+
let l = Math.max(1, t), u = Math.max(1, n), d = qt({ text: e }) ? c({ text: e }) : 1, f = i.top + i.bottom, p = Math.max(1, u - f), m = d;
|
|
3949
|
+
a || (m = Xt({
|
|
3920
3950
|
text: e,
|
|
3921
3951
|
minFrameWidth: d,
|
|
3922
3952
|
maxFrameWidth: l,
|
|
3923
3953
|
frameHeight: p,
|
|
3924
3954
|
measureTextboxHeightForFrame: s
|
|
3925
3955
|
}));
|
|
3926
|
-
let h = Math.max(0, l - m),
|
|
3956
|
+
let h = m + i.left + i.right, g = Math.max(0, l - m), _ = Yt({
|
|
3927
3957
|
start: r.left,
|
|
3928
3958
|
end: r.right,
|
|
3929
3959
|
insetStart: i.left,
|
|
3930
3960
|
insetEnd: i.right,
|
|
3931
|
-
maxTotalPadding:
|
|
3961
|
+
maxTotalPadding: g,
|
|
3932
3962
|
startChanged: !!o?.left,
|
|
3933
3963
|
endChanged: !!o?.right
|
|
3934
3964
|
});
|
|
3935
3965
|
return {
|
|
3936
3966
|
appliedPadding: {
|
|
3937
|
-
left:
|
|
3938
|
-
right:
|
|
3967
|
+
left: _.appliedPaddingStart,
|
|
3968
|
+
right: _.appliedPaddingEnd
|
|
3939
3969
|
},
|
|
3940
3970
|
appliedUserPadding: {
|
|
3941
|
-
left:
|
|
3942
|
-
right:
|
|
3943
|
-
}
|
|
3971
|
+
left: _.appliedUserPaddingStart,
|
|
3972
|
+
right: _.appliedUserPaddingEnd
|
|
3973
|
+
},
|
|
3974
|
+
requiredWidth: h
|
|
3944
3975
|
};
|
|
3945
3976
|
}
|
|
3946
|
-
function
|
|
3947
|
-
let a = Math.max(0, Math.max(1, n) - Math.max(1, r)), o =
|
|
3977
|
+
function Qt({ padding: e, internalShapeTextInset: t, height: n, textHeight: r, changedPadding: i }) {
|
|
3978
|
+
let a = Math.max(0, Math.max(1, n) - Math.max(1, r)), o = Yt({
|
|
3948
3979
|
start: e.top,
|
|
3949
3980
|
end: e.bottom,
|
|
3950
3981
|
insetStart: t.top,
|
|
@@ -3964,8 +3995,8 @@ function Yt({ padding: e, internalShapeTextInset: t, height: n, textHeight: r, c
|
|
|
3964
3995
|
}
|
|
3965
3996
|
};
|
|
3966
3997
|
}
|
|
3967
|
-
function
|
|
3968
|
-
let l = Math.max(1, t), u = Math.max(1, n), d =
|
|
3998
|
+
function $t({ text: e, width: t, height: n, padding: r, internalShapeTextInset: i, expandShapeHeightToFitText: a, changedPadding: o, measureTextboxHeightForFrame: s, resolveMinimumTextFrameWidth: c }) {
|
|
3999
|
+
let l = Math.max(1, t), u = Math.max(1, n), d = Lt({ padding: r }), f = Lt({ padding: i }), p = Zt({
|
|
3969
4000
|
text: e,
|
|
3970
4001
|
width: l,
|
|
3971
4002
|
height: u,
|
|
@@ -3975,7 +4006,7 @@ function Xt({ text: e, width: t, height: n, padding: r, internalShapeTextInset:
|
|
|
3975
4006
|
changedPadding: o,
|
|
3976
4007
|
measureTextboxHeightForFrame: s,
|
|
3977
4008
|
resolveMinimumTextFrameWidth: c
|
|
3978
|
-
}), m =
|
|
4009
|
+
}), m = Kt({
|
|
3979
4010
|
width: l,
|
|
3980
4011
|
padding: {
|
|
3981
4012
|
top: 0,
|
|
@@ -3983,10 +4014,10 @@ function Xt({ text: e, width: t, height: n, padding: r, internalShapeTextInset:
|
|
|
3983
4014
|
bottom: 0,
|
|
3984
4015
|
left: p.appliedPadding.left
|
|
3985
4016
|
}
|
|
3986
|
-
}), h =
|
|
4017
|
+
}), h = qt({ text: e }) ? s({
|
|
3987
4018
|
text: e,
|
|
3988
4019
|
frameWidth: m
|
|
3989
|
-
}) : 1, g = f.top + f.bottom, _ = a ? Math.max(u, h + g) : u, v =
|
|
4020
|
+
}) : 1, g = f.top + f.bottom, _ = a ? Math.max(u, h + g) : u, v = Qt({
|
|
3990
4021
|
padding: d,
|
|
3991
4022
|
internalShapeTextInset: f,
|
|
3992
4023
|
height: _,
|
|
@@ -4006,40 +4037,57 @@ function Xt({ text: e, width: t, height: n, padding: r, internalShapeTextInset:
|
|
|
4006
4037
|
bottom: v.appliedUserPadding.bottom,
|
|
4007
4038
|
left: p.appliedUserPadding.left
|
|
4008
4039
|
},
|
|
4040
|
+
requiredWidth: p.requiredWidth,
|
|
4009
4041
|
requiredHeight: _
|
|
4010
4042
|
};
|
|
4011
4043
|
}
|
|
4012
4044
|
//#endregion
|
|
4013
4045
|
//#region src/editor/shape-manager/layout/shape-layout.ts
|
|
4014
|
-
var q = 1,
|
|
4015
|
-
let d =
|
|
4046
|
+
var q = 1, en = .5, tn = 8, nn = ({ group: e, shape: t, text: n, width: r, height: i, alignH: a, alignV: o, padding: s, internalShapeTextInset: c, expandShapeHeightToFitText: l = !0, changedPadding: u }) => {
|
|
4047
|
+
let d = Rt({ padding: s }), f = Lt({ padding: c }), p = Math.max(q, e.shapeManualBaseWidth ?? r), m = Math.max(q, e.shapeManualBaseHeight ?? i), h = Math.max(q, i), g = Math.max(q, r), _ = $t({
|
|
4016
4048
|
text: n,
|
|
4017
4049
|
width: g,
|
|
4018
|
-
height:
|
|
4050
|
+
height: h,
|
|
4019
4051
|
padding: d,
|
|
4020
4052
|
internalShapeTextInset: f,
|
|
4021
4053
|
expandShapeHeightToFitText: l,
|
|
4022
4054
|
changedPadding: u,
|
|
4023
|
-
measureTextboxHeightForFrame:
|
|
4024
|
-
resolveMinimumTextFrameWidth:
|
|
4025
|
-
})
|
|
4055
|
+
measureTextboxHeightForFrame: fn,
|
|
4056
|
+
resolveMinimumTextFrameWidth: pn
|
|
4057
|
+
});
|
|
4058
|
+
for (let e = 0; e < tn; e += 1) {
|
|
4059
|
+
let e = Math.max(g, _.requiredWidth);
|
|
4060
|
+
if (e <= g + en) break;
|
|
4061
|
+
g = e, _ = $t({
|
|
4062
|
+
text: n,
|
|
4063
|
+
width: g,
|
|
4064
|
+
height: h,
|
|
4065
|
+
padding: d,
|
|
4066
|
+
internalShapeTextInset: f,
|
|
4067
|
+
expandShapeHeightToFitText: l,
|
|
4068
|
+
changedPadding: u,
|
|
4069
|
+
measureTextboxHeightForFrame: fn,
|
|
4070
|
+
resolveMinimumTextFrameWidth: pn
|
|
4071
|
+
});
|
|
4072
|
+
}
|
|
4073
|
+
let { appliedPadding: v, appliedUserPadding: y, requiredHeight: b } = _, x = Math.max(q, b);
|
|
4026
4074
|
bt({
|
|
4027
4075
|
shape: t,
|
|
4028
4076
|
width: g,
|
|
4029
|
-
height:
|
|
4077
|
+
height: x,
|
|
4030
4078
|
rounding: e.shapeRounding,
|
|
4031
4079
|
strokeWidth: e.shapeStrokeWidth
|
|
4032
4080
|
});
|
|
4033
|
-
let { frame:
|
|
4081
|
+
let { frame: S, splitByGrapheme: C, textTop: w } = on({
|
|
4034
4082
|
text: n,
|
|
4035
4083
|
width: g,
|
|
4036
|
-
height:
|
|
4084
|
+
height: x,
|
|
4037
4085
|
alignV: o,
|
|
4038
|
-
padding:
|
|
4086
|
+
padding: v
|
|
4039
4087
|
});
|
|
4040
4088
|
n.set({
|
|
4041
4089
|
autoExpand: !1,
|
|
4042
|
-
width:
|
|
4090
|
+
width: S.width,
|
|
4043
4091
|
textAlign: a,
|
|
4044
4092
|
scaleX: 1,
|
|
4045
4093
|
scaleY: 1,
|
|
@@ -4048,96 +4096,86 @@ var q = 1, Zt = .5, Qt = 8, $t = ({ group: e, shape: t, text: n, width: r, heigh
|
|
|
4048
4096
|
skewY: 0,
|
|
4049
4097
|
flipX: !1,
|
|
4050
4098
|
flipY: !1,
|
|
4051
|
-
left:
|
|
4052
|
-
top:
|
|
4099
|
+
left: S.left,
|
|
4100
|
+
top: w,
|
|
4053
4101
|
originX: "left",
|
|
4054
4102
|
originY: "top",
|
|
4055
|
-
splitByGrapheme:
|
|
4056
|
-
}), n.initDimensions(), n.setCoords(), t.setCoords(), e.shapeBaseWidth = g, e.shapeBaseHeight =
|
|
4103
|
+
splitByGrapheme: C
|
|
4104
|
+
}), n.initDimensions(), n.setCoords(), t.setCoords(), e.shapeBaseWidth = g, e.shapeBaseHeight = x, e.shapeManualBaseWidth = p, e.shapeManualBaseHeight = m, e.shapePaddingTop = y.top, e.shapePaddingRight = y.right, e.shapePaddingBottom = y.bottom, e.shapePaddingLeft = y.left, e.shapeAlignHorizontal = a, e.shapeAlignVertical = o, e.set({
|
|
4057
4105
|
width: g,
|
|
4058
|
-
height:
|
|
4106
|
+
height: x,
|
|
4059
4107
|
scaleX: 1,
|
|
4060
4108
|
scaleY: 1
|
|
4061
4109
|
}), e.set("dirty", !0), e.setCoords();
|
|
4062
|
-
},
|
|
4063
|
-
let
|
|
4064
|
-
if (!
|
|
4065
|
-
let
|
|
4066
|
-
width:
|
|
4067
|
-
padding:
|
|
4068
|
-
})
|
|
4069
|
-
if (l >= d) return Math.max(o, s);
|
|
4070
|
-
let p = d, m = cn({
|
|
4110
|
+
}, rn = ({ text: e, currentWidth: t, minimumWidth: n, padding: r, montageAreaWidth: i }) => {
|
|
4111
|
+
let a = Math.max(q, t), o = Math.max(q, n);
|
|
4112
|
+
if (!cn({ text: e })) return o;
|
|
4113
|
+
let s = Number.isFinite(i) && i > 0 ? Math.max(q, i) : Math.max(a, o), c = Lt({ padding: r }), l = Math.max(o, s), u = Kt({
|
|
4114
|
+
width: l,
|
|
4115
|
+
padding: c
|
|
4116
|
+
}), d = l, f = dn({
|
|
4071
4117
|
text: e,
|
|
4072
|
-
frameWidth:
|
|
4118
|
+
frameWidth: u
|
|
4073
4119
|
});
|
|
4074
|
-
if (
|
|
4075
|
-
let
|
|
4076
|
-
for (let t = 0; t <
|
|
4077
|
-
let t =
|
|
4078
|
-
width:
|
|
4079
|
-
padding:
|
|
4080
|
-
}), n =
|
|
4120
|
+
if (f.hasWrappedLines) return d;
|
|
4121
|
+
let p = Math.max(q, f.longestLineWidth), m = Math.max(q, p + c.left + c.right), h = Math.min(d, Math.max(o, m));
|
|
4122
|
+
for (let t = 0; t < tn; t += 1) {
|
|
4123
|
+
let t = Kt({
|
|
4124
|
+
width: h,
|
|
4125
|
+
padding: c
|
|
4126
|
+
}), n = dn({
|
|
4081
4127
|
text: e,
|
|
4082
4128
|
frameWidth: t
|
|
4083
|
-
}), r = t >=
|
|
4084
|
-
if (!n.hasWrappedLines && r) return
|
|
4085
|
-
if (
|
|
4086
|
-
let i = n.hasWrappedLines ? Math.max(
|
|
4087
|
-
|
|
4088
|
-
}
|
|
4089
|
-
return
|
|
4090
|
-
},
|
|
4091
|
-
if (!
|
|
4092
|
-
let n =
|
|
4093
|
-
return
|
|
4094
|
-
},
|
|
4095
|
-
let a =
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
expandShapeHeightToFitText: !1,
|
|
4101
|
-
measureTextboxHeightForFrame: ln,
|
|
4102
|
-
resolveMinimumTextFrameWidth: un
|
|
4103
|
-
}), c = on({
|
|
4104
|
-
width: a,
|
|
4105
|
-
height: o,
|
|
4106
|
-
padding: s
|
|
4107
|
-
}), l = pn({
|
|
4129
|
+
}), r = t >= p - en;
|
|
4130
|
+
if (!n.hasWrappedLines && r) return h;
|
|
4131
|
+
if (h >= d - en) return d;
|
|
4132
|
+
let i = n.hasWrappedLines ? Math.max(m + 1, h + 1) : p;
|
|
4133
|
+
h = Math.min(d, Math.max(h + 1, n.hasWrappedLines ? i : m));
|
|
4134
|
+
}
|
|
4135
|
+
return h;
|
|
4136
|
+
}, an = ({ text: e, padding: t }) => {
|
|
4137
|
+
if (!cn({ text: e })) return q;
|
|
4138
|
+
let n = Lt({ padding: t });
|
|
4139
|
+
return pn({ text: e }) + n.left + n.right;
|
|
4140
|
+
}, on = ({ text: e, width: t, height: n, alignV: r, padding: i }) => {
|
|
4141
|
+
let a = ln({
|
|
4142
|
+
width: Math.max(q, t),
|
|
4143
|
+
height: Math.max(q, n),
|
|
4144
|
+
padding: Lt({ padding: i })
|
|
4145
|
+
}), o = gn({
|
|
4108
4146
|
text: e,
|
|
4109
|
-
frameWidth:
|
|
4110
|
-
}),
|
|
4147
|
+
frameWidth: a.width
|
|
4148
|
+
}), s = fn({
|
|
4111
4149
|
text: e,
|
|
4112
|
-
frameWidth:
|
|
4113
|
-
splitByGrapheme:
|
|
4150
|
+
frameWidth: a.width,
|
|
4151
|
+
splitByGrapheme: o
|
|
4114
4152
|
});
|
|
4115
4153
|
return {
|
|
4116
|
-
frame:
|
|
4117
|
-
splitByGrapheme:
|
|
4118
|
-
textTop:
|
|
4154
|
+
frame: a,
|
|
4155
|
+
splitByGrapheme: o,
|
|
4156
|
+
textTop: hn({
|
|
4119
4157
|
alignV: r,
|
|
4120
|
-
frameHeight:
|
|
4121
|
-
frameTop:
|
|
4122
|
-
textHeight:
|
|
4158
|
+
frameHeight: a.height,
|
|
4159
|
+
frameTop: a.top,
|
|
4160
|
+
textHeight: s
|
|
4123
4161
|
})
|
|
4124
4162
|
};
|
|
4125
|
-
},
|
|
4163
|
+
}, sn = ({ text: e, width: t, height: n, padding: r }) => {
|
|
4126
4164
|
let i = Math.max(q, n);
|
|
4127
|
-
if (!
|
|
4128
|
-
let a = Math.max(q, t), o =
|
|
4165
|
+
if (!cn({ text: e })) return i;
|
|
4166
|
+
let a = Math.max(q, t), o = Lt({ padding: r }), s = fn({
|
|
4129
4167
|
text: e,
|
|
4130
|
-
frameWidth:
|
|
4168
|
+
frameWidth: Kt({
|
|
4131
4169
|
width: a,
|
|
4132
4170
|
padding: o
|
|
4133
4171
|
})
|
|
4134
4172
|
});
|
|
4135
4173
|
return Math.max(i, s + o.top + o.bottom);
|
|
4136
4174
|
};
|
|
4137
|
-
function
|
|
4175
|
+
function cn({ text: e }) {
|
|
4138
4176
|
return (e.text ?? "").trim().length > 0;
|
|
4139
4177
|
}
|
|
4140
|
-
function
|
|
4178
|
+
function ln({ width: e, height: t, padding: n }) {
|
|
4141
4179
|
let r = Math.max(0, n.left), i = Math.max(0, n.right), a = Math.max(0, n.top), o = Math.max(0, n.bottom);
|
|
4142
4180
|
return {
|
|
4143
4181
|
left: -e / 2 + r,
|
|
@@ -4146,7 +4184,7 @@ function on({ width: e, height: t, padding: n }) {
|
|
|
4146
4184
|
height: Math.max(q, t - a - o)
|
|
4147
4185
|
};
|
|
4148
4186
|
}
|
|
4149
|
-
function
|
|
4187
|
+
function un({ text: e }) {
|
|
4150
4188
|
let { height: t } = e;
|
|
4151
4189
|
if (typeof t == "number" && Number.isFinite(t)) return t;
|
|
4152
4190
|
if (typeof e.calcTextHeight == "function") {
|
|
@@ -4155,18 +4193,18 @@ function sn({ text: e }) {
|
|
|
4155
4193
|
}
|
|
4156
4194
|
return q;
|
|
4157
4195
|
}
|
|
4158
|
-
function
|
|
4159
|
-
let n =
|
|
4196
|
+
function dn({ text: e, frameWidth: t }) {
|
|
4197
|
+
let n = vn({ text: e }), r = gn({
|
|
4160
4198
|
text: e,
|
|
4161
4199
|
frameWidth: t
|
|
4162
|
-
}), i =
|
|
4200
|
+
}), i = xn({ text: e });
|
|
4163
4201
|
e.set({
|
|
4164
4202
|
autoExpand: !1,
|
|
4165
4203
|
width: Math.max(q, t),
|
|
4166
4204
|
splitByGrapheme: r
|
|
4167
4205
|
}), e.initDimensions();
|
|
4168
|
-
let a =
|
|
4169
|
-
return
|
|
4206
|
+
let a = yn({ text: e }) > n, o = Math.ceil(_n({ text: e }));
|
|
4207
|
+
return Sn({
|
|
4170
4208
|
text: e,
|
|
4171
4209
|
state: i
|
|
4172
4210
|
}), {
|
|
@@ -4174,8 +4212,8 @@ function cn({ text: e, frameWidth: t }) {
|
|
|
4174
4212
|
longestLineWidth: o
|
|
4175
4213
|
};
|
|
4176
4214
|
}
|
|
4177
|
-
function
|
|
4178
|
-
let r =
|
|
4215
|
+
function fn({ text: e, frameWidth: t, splitByGrapheme: n }) {
|
|
4216
|
+
let r = xn({ text: e }), i = n ?? gn({
|
|
4179
4217
|
text: e,
|
|
4180
4218
|
frameWidth: t
|
|
4181
4219
|
});
|
|
@@ -4184,71 +4222,71 @@ function ln({ text: e, frameWidth: t, splitByGrapheme: n }) {
|
|
|
4184
4222
|
width: Math.max(q, t),
|
|
4185
4223
|
splitByGrapheme: i
|
|
4186
4224
|
}), e.initDimensions();
|
|
4187
|
-
let a =
|
|
4188
|
-
return
|
|
4225
|
+
let a = un({ text: e });
|
|
4226
|
+
return Sn({
|
|
4189
4227
|
text: e,
|
|
4190
4228
|
state: r
|
|
4191
4229
|
}), a;
|
|
4192
4230
|
}
|
|
4193
|
-
function
|
|
4194
|
-
let t =
|
|
4231
|
+
function pn({ text: e }) {
|
|
4232
|
+
let t = mn({
|
|
4195
4233
|
text: e,
|
|
4196
4234
|
frameWidth: q,
|
|
4197
4235
|
splitByGrapheme: !0
|
|
4198
4236
|
});
|
|
4199
4237
|
return Math.max(q, t);
|
|
4200
4238
|
}
|
|
4201
|
-
function
|
|
4202
|
-
let r =
|
|
4239
|
+
function mn({ text: e, frameWidth: t, splitByGrapheme: n }) {
|
|
4240
|
+
let r = xn({ text: e });
|
|
4203
4241
|
e.set({
|
|
4204
4242
|
autoExpand: !1,
|
|
4205
4243
|
width: Math.max(q, t),
|
|
4206
4244
|
splitByGrapheme: n
|
|
4207
4245
|
}), e.initDimensions();
|
|
4208
|
-
let i =
|
|
4209
|
-
return
|
|
4246
|
+
let i = _n({ text: e });
|
|
4247
|
+
return Sn({
|
|
4210
4248
|
text: e,
|
|
4211
4249
|
state: r
|
|
4212
4250
|
}), i;
|
|
4213
4251
|
}
|
|
4214
|
-
function
|
|
4252
|
+
function hn({ alignV: e, frameHeight: t, frameTop: n, textHeight: r }) {
|
|
4215
4253
|
let i = Math.max(0, t - r);
|
|
4216
4254
|
return e === "top" ? n : e === "bottom" ? n + i : n + i / 2;
|
|
4217
4255
|
}
|
|
4218
|
-
function
|
|
4219
|
-
let n = Math.max(q, t), r =
|
|
4256
|
+
function gn({ text: e, frameWidth: t }) {
|
|
4257
|
+
let n = Math.max(q, t), r = xn({ text: e });
|
|
4220
4258
|
e.set({
|
|
4221
4259
|
autoExpand: !1,
|
|
4222
4260
|
width: n,
|
|
4223
4261
|
splitByGrapheme: !1
|
|
4224
4262
|
}), e.initDimensions();
|
|
4225
|
-
let i =
|
|
4226
|
-
return
|
|
4263
|
+
let i = Cn({ text: e }) > n + en;
|
|
4264
|
+
return Sn({
|
|
4227
4265
|
text: e,
|
|
4228
4266
|
state: r
|
|
4229
4267
|
}), i;
|
|
4230
4268
|
}
|
|
4231
|
-
function
|
|
4232
|
-
let t =
|
|
4233
|
-
if (t > 0) return
|
|
4269
|
+
function _n({ text: e }) {
|
|
4270
|
+
let t = yn({ text: e });
|
|
4271
|
+
if (t > 0) return bn({
|
|
4234
4272
|
text: e,
|
|
4235
4273
|
lineCount: t
|
|
4236
4274
|
});
|
|
4237
4275
|
let n = e.text ?? "";
|
|
4238
|
-
return
|
|
4276
|
+
return bn({
|
|
4239
4277
|
text: e,
|
|
4240
4278
|
lineCount: Math.max(n.split("\n").length, 1)
|
|
4241
4279
|
});
|
|
4242
4280
|
}
|
|
4243
|
-
function
|
|
4281
|
+
function vn({ text: e }) {
|
|
4244
4282
|
let t = e.text ?? "";
|
|
4245
4283
|
return Math.max(t.split("\n").length, 1);
|
|
4246
4284
|
}
|
|
4247
|
-
function
|
|
4285
|
+
function yn({ text: e }) {
|
|
4248
4286
|
let t = e;
|
|
4249
4287
|
return Array.isArray(t.textLines) ? t.textLines.length : 0;
|
|
4250
4288
|
}
|
|
4251
|
-
function
|
|
4289
|
+
function bn({ text: e, lineCount: t }) {
|
|
4252
4290
|
let n = q;
|
|
4253
4291
|
for (let r = 0; r < t; r += 1) {
|
|
4254
4292
|
let t = e.getLineWidth(r);
|
|
@@ -4256,7 +4294,7 @@ function _n({ text: e, lineCount: t }) {
|
|
|
4256
4294
|
}
|
|
4257
4295
|
return n;
|
|
4258
4296
|
}
|
|
4259
|
-
function
|
|
4297
|
+
function xn({ text: e }) {
|
|
4260
4298
|
let { autoExpand: t, splitByGrapheme: n, width: r } = e;
|
|
4261
4299
|
return {
|
|
4262
4300
|
autoExpand: t,
|
|
@@ -4264,23 +4302,23 @@ function vn({ text: e }) {
|
|
|
4264
4302
|
width: typeof r == "number" ? r : void 0
|
|
4265
4303
|
};
|
|
4266
4304
|
}
|
|
4267
|
-
function
|
|
4305
|
+
function Sn({ text: e, state: t }) {
|
|
4268
4306
|
let { autoExpand: n, splitByGrapheme: r, width: i } = t, a = {};
|
|
4269
4307
|
n !== void 0 && (a.autoExpand = n), r !== void 0 && (a.splitByGrapheme = r), typeof i == "number" && (a.width = i), Object.keys(a).length > 0 && (e.set(a), e.initDimensions());
|
|
4270
4308
|
}
|
|
4271
|
-
function
|
|
4309
|
+
function Cn({ text: e }) {
|
|
4272
4310
|
let { dynamicMinWidth: t } = e;
|
|
4273
4311
|
return typeof t == "number" && Number.isFinite(t) ? t : 0;
|
|
4274
4312
|
}
|
|
4275
4313
|
//#endregion
|
|
4276
4314
|
//#region src/editor/shape-manager/shape-runtime.ts
|
|
4277
|
-
var
|
|
4315
|
+
var wn = ({ group: e }) => {
|
|
4278
4316
|
let t = e;
|
|
4279
4317
|
typeof t.setInteractive == "function" && t.setInteractive(!0), t.set({
|
|
4280
4318
|
interactive: !0,
|
|
4281
4319
|
subTargetCheck: !0
|
|
4282
4320
|
});
|
|
4283
|
-
},
|
|
4321
|
+
}, Tn = ({ text: e }) => {
|
|
4284
4322
|
let t = !!(e.locked || e.group?.locked);
|
|
4285
4323
|
e.set({
|
|
4286
4324
|
hasBorders: !1,
|
|
@@ -4293,7 +4331,7 @@ var xn = ({ group: e }) => {
|
|
|
4293
4331
|
autoExpand: !1,
|
|
4294
4332
|
shapeNodeType: "text"
|
|
4295
4333
|
}), e.setCoords();
|
|
4296
|
-
},
|
|
4334
|
+
}, En = ({ group: e }) => {
|
|
4297
4335
|
let { layoutManager: t } = e;
|
|
4298
4336
|
if (!t || typeof t.unsubscribeTargets != "function") return;
|
|
4299
4337
|
let n = e.getObjects();
|
|
@@ -4301,7 +4339,7 @@ var xn = ({ group: e }) => {
|
|
|
4301
4339
|
target: e,
|
|
4302
4340
|
targets: n
|
|
4303
4341
|
});
|
|
4304
|
-
},
|
|
4342
|
+
}, Dn = ({ group: e }) => {
|
|
4305
4343
|
let t = e.getObjects();
|
|
4306
4344
|
for (let e = 0; e < t.length; e += 1) {
|
|
4307
4345
|
let n = t[e];
|
|
@@ -4312,23 +4350,23 @@ var xn = ({ group: e }) => {
|
|
|
4312
4350
|
if (n instanceof _) return n;
|
|
4313
4351
|
}
|
|
4314
4352
|
return null;
|
|
4315
|
-
},
|
|
4353
|
+
}, On = [
|
|
4316
4354
|
"tl",
|
|
4317
4355
|
"tr",
|
|
4318
4356
|
"bl",
|
|
4319
4357
|
"br"
|
|
4320
|
-
],
|
|
4358
|
+
], kn = ({ transform: e }) => {
|
|
4321
4359
|
let { originX: t, originY: n } = e;
|
|
4322
4360
|
return (t === "center" || t === .5) && (n === "center" || n === .5);
|
|
4323
|
-
},
|
|
4361
|
+
}, An = ({ transform: e, x: t, y: n }) => {
|
|
4324
4362
|
let r = e, { target: i } = r, { scaleX: a = 1, scaleY: o = 1 } = i, s = b.getLocalPoint(r, r.originX, r.originY, t, n), c = Math.sign(s.x || r.signX || 1), l = Math.sign(s.y || r.signY || 1);
|
|
4325
4363
|
r.signX === void 0 && (r.signX = c), r.signY === void 0 && (r.signY = l);
|
|
4326
4364
|
let u = i._getTransformedDimensions(), d = Math.abs(s.x * a / u.x), f = Math.abs(s.y * o / u.y);
|
|
4327
|
-
|
|
4365
|
+
kn({ transform: r }) && (d *= 2, f *= 2);
|
|
4328
4366
|
let p = !i.lockScalingX && (!i.lockScalingFlip || r.signX === c), m = !i.lockScalingY && (!i.lockScalingFlip || r.signY === l);
|
|
4329
4367
|
return p && i.set("scaleX", d), m && i.set("scaleY", f), a !== i.scaleX || o !== i.scaleY;
|
|
4330
|
-
},
|
|
4331
|
-
let e = b.wrapWithFireEvent("scaling", b.wrapWithFixedAnchor((e, t, n, r) =>
|
|
4368
|
+
}, jn = () => {
|
|
4369
|
+
let e = b.wrapWithFireEvent("scaling", b.wrapWithFixedAnchor((e, t, n, r) => An({
|
|
4332
4370
|
transform: t,
|
|
4333
4371
|
x: n,
|
|
4334
4372
|
y: r
|
|
@@ -4344,31 +4382,31 @@ var xn = ({ group: e }) => {
|
|
|
4344
4382
|
a.uniformScaling = s;
|
|
4345
4383
|
}
|
|
4346
4384
|
};
|
|
4347
|
-
},
|
|
4385
|
+
}, Mn = ({ control: e }) => {
|
|
4348
4386
|
let t = new r({
|
|
4349
4387
|
...e,
|
|
4350
|
-
actionHandler:
|
|
4388
|
+
actionHandler: jn()
|
|
4351
4389
|
});
|
|
4352
4390
|
return t.shapeFreeScaleCornerControl = !0, t;
|
|
4353
|
-
},
|
|
4391
|
+
}, Nn = ({ group: e }) => {
|
|
4354
4392
|
let t = { ...e.controls };
|
|
4355
|
-
|
|
4393
|
+
On.forEach((n) => {
|
|
4356
4394
|
let r = e.controls[n];
|
|
4357
|
-
r && (r.shapeFreeScaleCornerControl || (t[n] =
|
|
4395
|
+
r && (r.shapeFreeScaleCornerControl || (t[n] = Mn({ control: r })));
|
|
4358
4396
|
}), e.controls = t;
|
|
4359
|
-
},
|
|
4360
|
-
function
|
|
4397
|
+
}, Pn = "shape-group";
|
|
4398
|
+
function Fn() {
|
|
4361
4399
|
return { performLayout() {} };
|
|
4362
4400
|
}
|
|
4363
|
-
function
|
|
4401
|
+
function In({ layoutManager: e }) {
|
|
4364
4402
|
let t = y.getClass("layoutManager");
|
|
4365
4403
|
if (!e) return new t();
|
|
4366
4404
|
let { strategy: n, type: r } = e, i = y.getClass(r);
|
|
4367
4405
|
return n ? new i(new (y.getClass(n))()) : new i();
|
|
4368
4406
|
}
|
|
4369
|
-
var
|
|
4407
|
+
var Ln = class e extends l {
|
|
4370
4408
|
static {
|
|
4371
|
-
this.type =
|
|
4409
|
+
this.type = Pn;
|
|
4372
4410
|
}
|
|
4373
4411
|
constructor(e = [], t = {}) {
|
|
4374
4412
|
let { layoutManager: n, objectCaching: r, centeredScaling: i, lockScalingFlip: a, ...o } = t;
|
|
@@ -4385,23 +4423,23 @@ var Pn = class e extends l {
|
|
|
4385
4423
|
objectCaching: !1,
|
|
4386
4424
|
shapeComposite: !0
|
|
4387
4425
|
}), this.shapeTextAutoExpand === void 0 && (this.shapeTextAutoExpand = !0);
|
|
4388
|
-
let e =
|
|
4426
|
+
let e = Rt({ padding: {
|
|
4389
4427
|
top: this.shapePaddingTop,
|
|
4390
4428
|
right: this.shapePaddingRight,
|
|
4391
4429
|
bottom: this.shapePaddingBottom,
|
|
4392
4430
|
left: this.shapePaddingLeft
|
|
4393
4431
|
} });
|
|
4394
|
-
this.shapePaddingTop = e.top, this.shapePaddingRight = e.right, this.shapePaddingBottom = e.bottom, this.shapePaddingLeft = e.left, this._syncRoundability(),
|
|
4395
|
-
let t =
|
|
4396
|
-
t &&
|
|
4432
|
+
this.shapePaddingTop = e.top, this.shapePaddingRight = e.right, this.shapePaddingBottom = e.bottom, this.shapePaddingLeft = e.left, this._syncRoundability(), wn({ group: this }), Nn({ group: this });
|
|
4433
|
+
let t = Dn({ group: this });
|
|
4434
|
+
t && Tn({ text: t }), En({ group: this }), this.setCoords();
|
|
4397
4435
|
}
|
|
4398
4436
|
static async fromObject({ type: t, objects: n = [], layoutManager: r, ...i }, a) {
|
|
4399
4437
|
let [o, s] = await Promise.all([C.enlivenObjects(n, a), C.enlivenObjectEnlivables(i, a)]), c = new e(o, {
|
|
4400
4438
|
...i,
|
|
4401
4439
|
...s,
|
|
4402
|
-
layoutManager:
|
|
4440
|
+
layoutManager: Fn()
|
|
4403
4441
|
});
|
|
4404
|
-
return c.layoutManager =
|
|
4442
|
+
return c.layoutManager = In({ layoutManager: r }), c.layoutManager.subscribeTargets({
|
|
4405
4443
|
type: "initialization",
|
|
4406
4444
|
target: c,
|
|
4407
4445
|
targets: c.getObjects()
|
|
@@ -4414,9 +4452,9 @@ var Pn = class e extends l {
|
|
|
4414
4452
|
let t = ut({ presetKey: e });
|
|
4415
4453
|
t && (this.shapeCanRound = ht({ preset: t }));
|
|
4416
4454
|
}
|
|
4417
|
-
},
|
|
4418
|
-
y?.setClass && y.setClass(
|
|
4419
|
-
}, J = (e) => e instanceof
|
|
4455
|
+
}, Rn = () => {
|
|
4456
|
+
y?.setClass && y.setClass(Ln, Pn);
|
|
4457
|
+
}, J = (e) => e instanceof Ln || e instanceof l && e.shapeComposite === !0, zn = ({ target: e, subTargets: t = [] }) => {
|
|
4420
4458
|
if (J(e)) return e;
|
|
4421
4459
|
if (e?.group && J(e.group)) return e.group;
|
|
4422
4460
|
for (let e = 0; e < t.length; e += 1) {
|
|
@@ -4426,7 +4464,7 @@ var Pn = class e extends l {
|
|
|
4426
4464
|
if (r && J(r)) return r;
|
|
4427
4465
|
}
|
|
4428
4466
|
return null;
|
|
4429
|
-
},
|
|
4467
|
+
}, Bn = ({ group: e }) => {
|
|
4430
4468
|
let t = e.getObjects();
|
|
4431
4469
|
for (let e = 0; e < t.length; e += 1) {
|
|
4432
4470
|
let n = t[e];
|
|
@@ -4437,7 +4475,7 @@ var Pn = class e extends l {
|
|
|
4437
4475
|
if (!(n instanceof _)) return n;
|
|
4438
4476
|
}
|
|
4439
4477
|
return null;
|
|
4440
|
-
},
|
|
4478
|
+
}, Vn = ({ group: e }) => {
|
|
4441
4479
|
let t = e.getObjects();
|
|
4442
4480
|
for (let e = 0; e < t.length; e += 1) {
|
|
4443
4481
|
let n = t[e];
|
|
@@ -4449,16 +4487,16 @@ var Pn = class e extends l {
|
|
|
4449
4487
|
}
|
|
4450
4488
|
return null;
|
|
4451
4489
|
}, Y = ({ group: e }) => ({
|
|
4452
|
-
shape:
|
|
4453
|
-
text:
|
|
4454
|
-
}),
|
|
4455
|
-
|
|
4456
|
-
},
|
|
4490
|
+
shape: Bn({ group: e }),
|
|
4491
|
+
text: Vn({ group: e })
|
|
4492
|
+
}), Hn = ({ group: e }) => {
|
|
4493
|
+
wn({ group: e });
|
|
4494
|
+
}, Un = ({ transform: e, key: t }) => {
|
|
4457
4495
|
let n = e?.original;
|
|
4458
4496
|
if (!n || typeof n != "object") return null;
|
|
4459
4497
|
let r = n[t];
|
|
4460
4498
|
return typeof r != "number" || !Number.isFinite(r) ? null : r;
|
|
4461
|
-
},
|
|
4499
|
+
}, Wn = ({ value: e }) => e === "left" || e === "center" || e === "right" || typeof e == "number" && Number.isFinite(e) ? e : null, Gn = ({ value: e }) => e === "top" || e === "center" || e === "bottom" || typeof e == "number" && Number.isFinite(e) ? e : null, Kn = ({ transform: e }) => {
|
|
4462
4500
|
let t = e?.action ?? "", n = typeof e?.corner == "string" ? e.corner : "", r = n === "tl" || n === "tr" || n === "bl" || n === "br", i = t === "scaleX" || n === "ml" || n === "mr", a = t === "scaleY" || n === "mt" || n === "mb", o = i || r, s = a || r;
|
|
4463
4501
|
return {
|
|
4464
4502
|
canScaleWidth: o,
|
|
@@ -4466,37 +4504,37 @@ var Pn = class e extends l {
|
|
|
4466
4504
|
isCornerScaleAction: r,
|
|
4467
4505
|
isVerticalOnlyScale: s && !o
|
|
4468
4506
|
};
|
|
4469
|
-
},
|
|
4507
|
+
}, qn = ({ event: e, group: t, transform: n, canvas: r }) => {
|
|
4470
4508
|
if (!e) return null;
|
|
4471
4509
|
let i = t.canvas ?? r, a = i.getScenePoint(e), o = t.getRelativeCenterPoint(), s = t.translateToGivenOrigin(o, "center", "center", n.originX, n.originY), c = t.angle ?? 0, l = (c === 0 ? a : a.rotate(-c * Math.PI / 180, o)).subtract(s), u = t.controls[n.corner], d = i.getZoom() || 1, f = (t.padding ?? 0) / d;
|
|
4472
4510
|
return l.x >= f && (l.x -= f), l.x <= -f && (l.x += f), l.y >= f && (l.y -= f), l.y <= -f && (l.y += f), l.x -= u?.offsetX ?? 0, l.y -= u?.offsetY ?? 0, l;
|
|
4473
|
-
},
|
|
4511
|
+
}, Jn = ({ group: e, originX: t, originY: n }) => {
|
|
4474
4512
|
if (t === null || n === null) return null;
|
|
4475
4513
|
let r = e, i = typeof r.getRelativeCenterPoint == "function" ? r.getRelativeCenterPoint() : e.getCenterPoint();
|
|
4476
4514
|
return typeof r.translateToOriginPoint == "function" ? r.translateToOriginPoint(i, t, n) : i;
|
|
4477
|
-
},
|
|
4515
|
+
}, Yn = ({ state: e, transform: t }) => {
|
|
4478
4516
|
if (!t || e.startTransformOriginX === null && e.startTransformOriginY === null) return !1;
|
|
4479
|
-
let n =
|
|
4517
|
+
let n = Wn({ value: t.originX }), r = Gn({ value: t.originY });
|
|
4480
4518
|
return n !== e.startTransformOriginX || r !== e.startTransformOriginY;
|
|
4481
|
-
},
|
|
4519
|
+
}, Xn = ({ state: e, transform: t }) => !t || !e.startTransformCorner ? !1 : t.corner !== e.startTransformCorner;
|
|
4482
4520
|
//#endregion
|
|
4483
4521
|
//#region src/editor/shape-manager/scaling/shape-scaling-preview.ts
|
|
4484
|
-
function
|
|
4522
|
+
function Zn({ size: e, scale: t, strokeWidth: n, minSize: r, scaleEpsilon: i }) {
|
|
4485
4523
|
let a = Math.max(i, Math.abs(t) || 1), o = Math.max(0, n);
|
|
4486
4524
|
return o <= 0 ? Math.max(r, e / a) : Math.max(r, e / a + o - o / a);
|
|
4487
4525
|
}
|
|
4488
|
-
function
|
|
4526
|
+
function Qn({ group: e, shape: t, width: n, height: r, scaleX: i, scaleY: a, minSize: o, scaleEpsilon: s }) {
|
|
4489
4527
|
let c = Math.max(0, e.shapeStrokeWidth ?? 0);
|
|
4490
4528
|
bt({
|
|
4491
4529
|
shape: t,
|
|
4492
|
-
width:
|
|
4530
|
+
width: Zn({
|
|
4493
4531
|
size: n,
|
|
4494
4532
|
scale: i,
|
|
4495
4533
|
strokeWidth: c,
|
|
4496
4534
|
minSize: o,
|
|
4497
4535
|
scaleEpsilon: s
|
|
4498
4536
|
}),
|
|
4499
|
-
height:
|
|
4537
|
+
height: Zn({
|
|
4500
4538
|
size: r,
|
|
4501
4539
|
scale: a,
|
|
4502
4540
|
strokeWidth: c,
|
|
@@ -4507,8 +4545,8 @@ function Yn({ group: e, shape: t, width: n, height: r, scaleX: i, scaleY: a, min
|
|
|
4507
4545
|
strokeWidth: c
|
|
4508
4546
|
});
|
|
4509
4547
|
}
|
|
4510
|
-
function
|
|
4511
|
-
let l = Math.max(c, Math.abs(o) || 1), u = Math.max(c, Math.abs(s) || 1), d = i ?? "center", { frame: f, splitByGrapheme: p, textTop: m } =
|
|
4548
|
+
function $n({ text: e, width: t, height: n, padding: r, alignH: i, alignV: a, scaleX: o, scaleY: s, scaleEpsilon: c }) {
|
|
4549
|
+
let l = Math.max(c, Math.abs(o) || 1), u = Math.max(c, Math.abs(s) || 1), d = i ?? "center", { frame: f, splitByGrapheme: p, textTop: m } = on({
|
|
4512
4550
|
text: e,
|
|
4513
4551
|
width: t,
|
|
4514
4552
|
height: n,
|
|
@@ -4528,13 +4566,13 @@ function Xn({ text: e, width: t, height: n, padding: r, alignH: i, alignV: a, sc
|
|
|
4528
4566
|
scaleY: 1 / u
|
|
4529
4567
|
}), e.initDimensions(), e.setCoords();
|
|
4530
4568
|
}
|
|
4531
|
-
var
|
|
4569
|
+
var er = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH: o, alignV: s, scaleX: c, scaleY: l, minSize: u, scaleEpsilon: d }) => {
|
|
4532
4570
|
let f = Math.max(d, Math.abs(c) || 1), p = Math.max(d, Math.abs(l) || 1);
|
|
4533
4571
|
e.set({
|
|
4534
4572
|
width: r / f,
|
|
4535
4573
|
height: i / p,
|
|
4536
4574
|
dirty: !0
|
|
4537
|
-
}),
|
|
4575
|
+
}), Qn({
|
|
4538
4576
|
group: e,
|
|
4539
4577
|
shape: t,
|
|
4540
4578
|
width: r,
|
|
@@ -4543,7 +4581,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
4543
4581
|
scaleY: l,
|
|
4544
4582
|
minSize: u,
|
|
4545
4583
|
scaleEpsilon: d
|
|
4546
|
-
}),
|
|
4584
|
+
}), $n({
|
|
4547
4585
|
text: n,
|
|
4548
4586
|
width: r,
|
|
4549
4587
|
height: i,
|
|
@@ -4554,7 +4592,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
4554
4592
|
scaleY: l,
|
|
4555
4593
|
scaleEpsilon: d
|
|
4556
4594
|
});
|
|
4557
|
-
}, X = 1, Z = 1e-4,
|
|
4595
|
+
}, X = 1, Z = 1e-4, tr = .5, nr = class e {
|
|
4558
4596
|
constructor({ canvas: t }) {
|
|
4559
4597
|
this.handleObjectScaling = (t) => {
|
|
4560
4598
|
let { target: n, transform: r } = t;
|
|
@@ -4570,7 +4608,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
4570
4608
|
text: o,
|
|
4571
4609
|
constraintPadding: c,
|
|
4572
4610
|
transform: r
|
|
4573
|
-
}), { isCornerScaleAction: u } =
|
|
4611
|
+
}), { isCornerScaleAction: u } = Kn({ transform: r }), d = !!(t.e && "shiftKey" in t.e && t.e.shiftKey);
|
|
4574
4612
|
l.isProportionalScaling = u && d;
|
|
4575
4613
|
let f = i.left ?? 0, p = i.top ?? 0, m = !!i.flipX, h = !!i.flipY, g = i.shapeAlignHorizontal ?? "center", _ = i.shapeAlignVertical ?? "middle", v = this._resolveScalingDecision({
|
|
4576
4614
|
group: i,
|
|
@@ -4585,7 +4623,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
4585
4623
|
shouldHandleAsNoop: v.shouldHandleAsNoop,
|
|
4586
4624
|
scaleX: v.appliedScaleX,
|
|
4587
4625
|
scaleY: v.appliedScaleY
|
|
4588
|
-
}),
|
|
4626
|
+
}), er({
|
|
4589
4627
|
group: i,
|
|
4590
4628
|
shape: a,
|
|
4591
4629
|
text: o,
|
|
@@ -4616,7 +4654,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
4616
4654
|
if (!n) return;
|
|
4617
4655
|
let { target: r } = n;
|
|
4618
4656
|
if (!J(r)) return;
|
|
4619
|
-
let { canScaleHeight: i, canScaleWidth: a } =
|
|
4657
|
+
let { canScaleHeight: i, canScaleWidth: a } = Kn({ transform: n });
|
|
4620
4658
|
if (!a && !i) return;
|
|
4621
4659
|
let o = r, s = this.scalingState.get(o);
|
|
4622
4660
|
if (!s || s.isProportionalScaling) return;
|
|
@@ -4631,7 +4669,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
4631
4669
|
group: o,
|
|
4632
4670
|
axis: "x"
|
|
4633
4671
|
})) {
|
|
4634
|
-
let e =
|
|
4672
|
+
let e = an({
|
|
4635
4673
|
text: l,
|
|
4636
4674
|
padding: d
|
|
4637
4675
|
}), t = Math.max(X / s.startWidth, e / s.startWidth);
|
|
@@ -4665,7 +4703,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
4665
4703
|
shouldHandleAsNoop: !1,
|
|
4666
4704
|
scaleX: _,
|
|
4667
4705
|
scaleY: v
|
|
4668
|
-
}),
|
|
4706
|
+
}), er({
|
|
4669
4707
|
group: o,
|
|
4670
4708
|
shape: c,
|
|
4671
4709
|
text: l,
|
|
@@ -4712,7 +4750,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
4712
4750
|
this.scalingState.delete(r);
|
|
4713
4751
|
return;
|
|
4714
4752
|
}
|
|
4715
|
-
let p = r.shapeAlignHorizontal ?? "center", m = r.shapeAlignVertical ?? "middle", h = e._resolveScalingConstraintPadding({ group: r }), g = t.transform ?
|
|
4753
|
+
let p = r.shapeAlignHorizontal ?? "center", m = r.shapeAlignVertical ?? "middle", h = e._resolveScalingConstraintPadding({ group: r }), g = t.transform ? Kn({ transform: t.transform }) : null, _ = i?.canScaleWidth ?? g?.canScaleWidth ?? Math.abs(a - 1) > Z, v = i?.canScaleHeight ?? g?.canScaleHeight ?? Math.abs(o - 1) > Z, y = an({
|
|
4716
4754
|
text: f,
|
|
4717
4755
|
padding: h
|
|
4718
4756
|
}), b = i?.lastAllowedScaleX ?? a, x = i?.lastAllowedScaleY ?? o;
|
|
@@ -4735,7 +4773,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
4735
4773
|
state: i
|
|
4736
4774
|
}) && (x = Math.max(X / c, e / c));
|
|
4737
4775
|
}
|
|
4738
|
-
let S = _ ? Math.max(X, s * b) : s, C = v ? Math.max(X, c * x) : u, w = Math.abs(S - s) >
|
|
4776
|
+
let S = _ ? Math.max(X, s * b) : s, C = v ? Math.max(X, c * x) : u, w = Math.abs(S - s) > tr, T = Math.abs(C - c) > tr, E = w || T, D = S, O = C;
|
|
4739
4777
|
if (!E && i) {
|
|
4740
4778
|
this._restoreShapeStateWithoutResize({
|
|
4741
4779
|
group: r,
|
|
@@ -4764,7 +4802,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
4764
4802
|
});
|
|
4765
4803
|
r.shapeManualBaseWidth = k.width, r.shapeManualBaseHeight = k.height;
|
|
4766
4804
|
let A = i?.baseRounding ?? Math.max(0, r.shapeRounding ?? 0);
|
|
4767
|
-
r.shapeRounding = Math.max(0, A * Math.min(b, x)),
|
|
4805
|
+
r.shapeRounding = Math.max(0, A * Math.min(b, x)), nn({
|
|
4768
4806
|
group: r,
|
|
4769
4807
|
shape: d,
|
|
4770
4808
|
text: f,
|
|
@@ -4791,10 +4829,10 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
4791
4829
|
}, this.canvas = t, this.scalingState = /* @__PURE__ */ new WeakMap();
|
|
4792
4830
|
}
|
|
4793
4831
|
_resolveScalingDecision({ group: e, text: t, constraintPadding: n, state: r, transform: i }) {
|
|
4794
|
-
let a = e.scaleX ?? 1, o = e.scaleY ?? 1, s = Math.abs(a) || 1, c = Math.abs(o) || 1, l = a < 0 || o < 0, u =
|
|
4832
|
+
let a = e.scaleX ?? 1, o = e.scaleY ?? 1, s = Math.abs(a) || 1, c = Math.abs(o) || 1, l = a < 0 || o < 0, u = Yn({
|
|
4795
4833
|
state: r,
|
|
4796
4834
|
transform: i
|
|
4797
|
-
}), d =
|
|
4835
|
+
}), d = Xn({
|
|
4798
4836
|
state: r,
|
|
4799
4837
|
transform: i
|
|
4800
4838
|
});
|
|
@@ -4826,7 +4864,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
4826
4864
|
};
|
|
4827
4865
|
}
|
|
4828
4866
|
_resolveScalingConstraintState({ text: e, constraintPadding: t, state: n, transform: r, scaleX: i, scaleY: a }) {
|
|
4829
|
-
let { startHeight: o, startWidth: s, cannotScaleDownAtStart: c, crossedOppositeCorner: l, isProportionalScaling: u, lastAllowedScaleX: d, lastAllowedScaleY: f, startScaleY: p } = n, m = Math.max(X, s * i), h = Math.max(X, o * a), g = i < d - Z, _ = a < f - Z, v = a < p - Z, { canScaleHeight: y, canScaleWidth: b, isVerticalOnlyScale: x } =
|
|
4867
|
+
let { startHeight: o, startWidth: s, cannotScaleDownAtStart: c, crossedOppositeCorner: l, isProportionalScaling: u, lastAllowedScaleX: d, lastAllowedScaleY: f, startScaleY: p } = n, m = Math.max(X, s * i), h = Math.max(X, o * a), g = i < d - Z, _ = a < f - Z, v = a < p - Z, { canScaleHeight: y, canScaleWidth: b, isVerticalOnlyScale: x } = Kn({ transform: r }), S = b && g ? an({
|
|
4830
4868
|
text: e,
|
|
4831
4869
|
padding: t
|
|
4832
4870
|
}) : null, C = y && _ ? this._resolveMinimumTextFitHeight({
|
|
@@ -4845,7 +4883,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
4845
4883
|
};
|
|
4846
4884
|
}
|
|
4847
4885
|
_resolvePreviewDimensions({ text: e, constraintPadding: t, state: n, appliedScaleX: r, appliedScaleY: i, minimumHeight: a }) {
|
|
4848
|
-
let o = n.canScaleWidth ? Math.max(X, n.startWidth * r) : n.startWidth, s = n.canScaleHeight ? Math.max(X, n.startHeight * i) : n.startManualBaseHeight, c = a ??
|
|
4886
|
+
let o = n.canScaleWidth ? Math.max(X, n.startWidth * r) : n.startWidth, s = n.canScaleHeight ? Math.max(X, n.startHeight * i) : n.startManualBaseHeight, c = a ?? sn({
|
|
4849
4887
|
text: e,
|
|
4850
4888
|
width: o,
|
|
4851
4889
|
height: s,
|
|
@@ -4878,7 +4916,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
4878
4916
|
if (!r) return !1;
|
|
4879
4917
|
let { transform: i } = e;
|
|
4880
4918
|
if (!i) return !1;
|
|
4881
|
-
let { canScaleWidth: a } =
|
|
4919
|
+
let { canScaleWidth: a } = Kn({ transform: i });
|
|
4882
4920
|
if (!a || !this._hasPointerReachedScaleOrigin({
|
|
4883
4921
|
event: e,
|
|
4884
4922
|
group: t,
|
|
@@ -4891,7 +4929,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
4891
4929
|
if (!r) return !1;
|
|
4892
4930
|
let { transform: i } = e;
|
|
4893
4931
|
if (!i) return !1;
|
|
4894
|
-
let { canScaleHeight: a } =
|
|
4932
|
+
let { canScaleHeight: a } = Kn({ transform: i });
|
|
4895
4933
|
if (!a || !this._hasPointerReachedScaleOrigin({
|
|
4896
4934
|
event: e,
|
|
4897
4935
|
group: t,
|
|
@@ -4905,7 +4943,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
4905
4943
|
if (!r) return !1;
|
|
4906
4944
|
let i = r, a = n === "x" ? i.signX : i.signY;
|
|
4907
4945
|
if (typeof a != "number" || !Number.isFinite(a)) return !1;
|
|
4908
|
-
let o =
|
|
4946
|
+
let o = qn({
|
|
4909
4947
|
event: e.e,
|
|
4910
4948
|
group: t,
|
|
4911
4949
|
transform: r,
|
|
@@ -4922,19 +4960,19 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
4922
4960
|
let a = this._resolveScalingStartDimensions({
|
|
4923
4961
|
group: e,
|
|
4924
4962
|
transform: r
|
|
4925
|
-
}), o =
|
|
4963
|
+
}), o = Un({
|
|
4926
4964
|
transform: r,
|
|
4927
4965
|
key: "scaleX"
|
|
4928
|
-
}), s =
|
|
4966
|
+
}), s = Un({
|
|
4929
4967
|
transform: r,
|
|
4930
4968
|
key: "scaleY"
|
|
4931
|
-
}), c =
|
|
4969
|
+
}), c = Un({
|
|
4932
4970
|
transform: r,
|
|
4933
4971
|
key: "left"
|
|
4934
|
-
}), l =
|
|
4972
|
+
}), l = Un({
|
|
4935
4973
|
transform: r,
|
|
4936
4974
|
key: "top"
|
|
4937
|
-
}), u = Math.abs(o ?? e.scaleX ?? 1) || 1, d = Math.abs(s ?? e.scaleY ?? 1) || 1, f = c ?? e.left ?? 0, p = l ?? e.top ?? 0, m =
|
|
4975
|
+
}), u = Math.abs(o ?? e.scaleX ?? 1) || 1, d = Math.abs(s ?? e.scaleY ?? 1) || 1, f = c ?? e.left ?? 0, p = l ?? e.top ?? 0, m = Wn({ value: r?.original?.originX ?? r?.originX }), h = Gn({ value: r?.original?.originY ?? r?.originY }), g = typeof r?.corner == "string" ? r.corner : null, _ = Jn({
|
|
4938
4976
|
group: e,
|
|
4939
4977
|
originX: m,
|
|
4940
4978
|
originY: h
|
|
@@ -4977,7 +5015,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
4977
5015
|
return i;
|
|
4978
5016
|
}
|
|
4979
5017
|
_resolveMinimumTextFitHeight({ text: e, width: t, padding: n }) {
|
|
4980
|
-
return
|
|
5018
|
+
return sn({
|
|
4981
5019
|
text: e,
|
|
4982
5020
|
width: t,
|
|
4983
5021
|
height: X,
|
|
@@ -4985,7 +5023,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
4985
5023
|
});
|
|
4986
5024
|
}
|
|
4987
5025
|
static _resolveUserPadding({ group: e }) {
|
|
4988
|
-
return
|
|
5026
|
+
return Rt({ padding: {
|
|
4989
5027
|
top: e.shapePaddingTop,
|
|
4990
5028
|
right: e.shapePaddingRight,
|
|
4991
5029
|
bottom: e.shapePaddingBottom,
|
|
@@ -4994,20 +5032,19 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
4994
5032
|
}
|
|
4995
5033
|
static _resolveInternalShapeTextInset({ group: e, width: t, height: n }) {
|
|
4996
5034
|
let r = e.shapePresetKey ?? "", i = r ? ut({ presetKey: r }) : null;
|
|
4997
|
-
return
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
};
|
|
5035
|
+
return Ht({
|
|
5036
|
+
baseInset: i ? pt({
|
|
5037
|
+
preset: i,
|
|
5038
|
+
width: t,
|
|
5039
|
+
height: n
|
|
5040
|
+
}) : void 0,
|
|
5041
|
+
stroke: e.shapeStroke,
|
|
5042
|
+
strokeWidth: e.shapeStrokeWidth
|
|
5043
|
+
});
|
|
5007
5044
|
}
|
|
5008
5045
|
static _resolveEffectivePadding({ group: t }) {
|
|
5009
5046
|
let n = Math.max(X, t.shapeBaseWidth ?? t.width ?? t.shapeManualBaseWidth ?? X), r = Math.max(X, t.shapeBaseHeight ?? t.height ?? t.shapeManualBaseHeight ?? X), i = e._resolveUserPadding({ group: t });
|
|
5010
|
-
return
|
|
5047
|
+
return Vt({
|
|
5011
5048
|
base: e._resolveInternalShapeTextInset({
|
|
5012
5049
|
group: t,
|
|
5013
5050
|
width: n,
|
|
@@ -5034,7 +5071,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5034
5071
|
}
|
|
5035
5072
|
_restoreShapeStateWithoutResize({ group: t, shape: n, text: r, state: i, startWidth: a, startHeight: o, alignH: s, alignV: c, userPadding: l }) {
|
|
5036
5073
|
let u = Math.max(X, t.shapeBaseWidth ?? t.width ?? a), d = Math.max(X, t.shapeBaseHeight ?? t.height ?? o);
|
|
5037
|
-
|
|
5074
|
+
nn({
|
|
5038
5075
|
group: t,
|
|
5039
5076
|
shape: n,
|
|
5040
5077
|
text: r,
|
|
@@ -5086,7 +5123,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5086
5123
|
});
|
|
5087
5124
|
}
|
|
5088
5125
|
_resolveScalingStartDimensions({ group: e, transform: t }) {
|
|
5089
|
-
let { canScaleWidth: n, canScaleHeight: r } =
|
|
5126
|
+
let { canScaleWidth: n, canScaleHeight: r } = Kn({ transform: t }), i = Math.max(X, e.shapeBaseWidth ?? e.width ?? e.shapeManualBaseWidth ?? X), a = Math.max(X, e.shapeBaseHeight ?? e.height ?? e.shapeManualBaseHeight ?? X);
|
|
5090
5127
|
return {
|
|
5091
5128
|
startWidth: i,
|
|
5092
5129
|
startHeight: a,
|
|
@@ -5105,10 +5142,10 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5105
5142
|
height: s
|
|
5106
5143
|
};
|
|
5107
5144
|
}
|
|
5108
|
-
},
|
|
5145
|
+
}, rr = class {
|
|
5109
5146
|
constructor({ canvas: e }) {
|
|
5110
5147
|
this.handleMouseDown = (e) => {
|
|
5111
|
-
let { target: t, e: n, subTargets: r = [] } = e, i =
|
|
5148
|
+
let { target: t, e: n, subTargets: r = [] } = e, i = zn({
|
|
5112
5149
|
target: t,
|
|
5113
5150
|
subTargets: r
|
|
5114
5151
|
});
|
|
@@ -5118,7 +5155,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5118
5155
|
let o = this.canvas.getActiveObject(), s = o === i;
|
|
5119
5156
|
if (!(o === a && a.isEditing)) {
|
|
5120
5157
|
if (!s) {
|
|
5121
|
-
a.isEditing ||
|
|
5158
|
+
a.isEditing || Tn({ text: a });
|
|
5122
5159
|
return;
|
|
5123
5160
|
}
|
|
5124
5161
|
n instanceof MouseEvent && (n.detail < 2 || this.enterTextEditing({ group: i }));
|
|
@@ -5138,14 +5175,14 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5138
5175
|
J(r) && (this._restoreTextEditingInteractionMode({
|
|
5139
5176
|
group: r,
|
|
5140
5177
|
text: n
|
|
5141
|
-
}),
|
|
5178
|
+
}), Tn({ text: n }), this.canvas.getActiveObject() === n && this.canvas.setActiveObject(r), this.canvas.requestRenderAll());
|
|
5142
5179
|
}, this.canvas = e, this.editingInteractionState = /* @__PURE__ */ new WeakMap();
|
|
5143
5180
|
}
|
|
5144
5181
|
enterTextEditing({ group: e }) {
|
|
5145
5182
|
let { text: t } = Y({ group: e });
|
|
5146
5183
|
if (t) {
|
|
5147
5184
|
if (e.locked || t.locked) {
|
|
5148
|
-
|
|
5185
|
+
Tn({ text: t }), this.canvas.requestRenderAll();
|
|
5149
5186
|
return;
|
|
5150
5187
|
}
|
|
5151
5188
|
this._enterTextEditingInteractionMode({
|
|
@@ -5195,7 +5232,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5195
5232
|
lockMovementY: n.textLockMovementY
|
|
5196
5233
|
}), this.editingInteractionState.delete(e), e.setCoords(), t.setCoords());
|
|
5197
5234
|
}
|
|
5198
|
-
},
|
|
5235
|
+
}, ir = "#B0B5BF", ar = 0, or = 1, sr = class {
|
|
5199
5236
|
constructor({ editor: e }) {
|
|
5200
5237
|
this._handleObjectScaling = (e) => {
|
|
5201
5238
|
this.scalingController.handleObjectScaling(e);
|
|
@@ -5232,7 +5269,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5232
5269
|
textNode: r,
|
|
5233
5270
|
textStyle: n
|
|
5234
5271
|
});
|
|
5235
|
-
}, this.editor = e,
|
|
5272
|
+
}, this.editor = e, Rn(), this.scalingController = new nr({ canvas: e.canvas }), this.editingController = new rr({ canvas: e.canvas }), this.editingPlacements = /* @__PURE__ */ new WeakMap(), this.internalTextUpdates = /* @__PURE__ */ new WeakSet(), this._bindEvents();
|
|
5236
5273
|
}
|
|
5237
5274
|
async add({ presetKey: e = ot, options: t = {} } = {}) {
|
|
5238
5275
|
let n = ut({ presetKey: e });
|
|
@@ -5243,34 +5280,37 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5243
5280
|
}) }) ?? n, x = Math.max(1, r ?? b.width), S = Math.max(1, i ?? b.height), C = a !== !1, w = this._resolveHorizontalAlign({
|
|
5244
5281
|
explicitAlign: f,
|
|
5245
5282
|
textStyle: d
|
|
5246
|
-
}), T = p ?? "middle", E =
|
|
5247
|
-
preset: b,
|
|
5248
|
-
width: x,
|
|
5249
|
-
height: S
|
|
5250
|
-
}), k = zt({
|
|
5251
|
-
base: O,
|
|
5252
|
-
addition: E
|
|
5253
|
-
}), A = Bt({ padding: m }), j = this._resolveShapeStyle({
|
|
5283
|
+
}), T = p ?? "middle", E = this._resolveShapeStyle({
|
|
5254
5284
|
options: t,
|
|
5255
5285
|
fallback: null
|
|
5256
|
-
}),
|
|
5286
|
+
}), O = Rt({ padding: m }), k = Ht({
|
|
5287
|
+
baseInset: pt({
|
|
5288
|
+
preset: b,
|
|
5289
|
+
width: x,
|
|
5290
|
+
height: S
|
|
5291
|
+
}),
|
|
5292
|
+
stroke: E.stroke,
|
|
5293
|
+
strokeWidth: E.strokeWidth
|
|
5294
|
+
}), A = Vt({
|
|
5295
|
+
base: k,
|
|
5296
|
+
addition: O
|
|
5297
|
+
}), j = Ut({ padding: m }), M = this._createTextNode({
|
|
5257
5298
|
text: u,
|
|
5258
5299
|
textStyle: d,
|
|
5259
5300
|
width: x,
|
|
5260
5301
|
align: w,
|
|
5261
|
-
opacity:
|
|
5302
|
+
opacity: E.opacity
|
|
5262
5303
|
}), N = this._resolveShapeLayoutWidth({
|
|
5263
5304
|
text: M,
|
|
5264
5305
|
currentWidth: x,
|
|
5265
5306
|
manualWidth: x,
|
|
5266
5307
|
shapeTextAutoExpandEnabled: C,
|
|
5267
|
-
padding:
|
|
5268
|
-
strokeWidth: j.strokeWidth
|
|
5308
|
+
padding: A
|
|
5269
5309
|
}), P = await Nt({
|
|
5270
5310
|
preset: b,
|
|
5271
5311
|
width: N,
|
|
5272
5312
|
height: S,
|
|
5273
|
-
style:
|
|
5313
|
+
style: E,
|
|
5274
5314
|
rounding: h
|
|
5275
5315
|
}), F = this._createShapeGroup({
|
|
5276
5316
|
id: y ?? `shape-${D()}`,
|
|
@@ -5285,10 +5325,10 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5285
5325
|
shapeTextAutoExpand: C,
|
|
5286
5326
|
alignH: w,
|
|
5287
5327
|
alignV: T,
|
|
5288
|
-
padding:
|
|
5289
|
-
internalShapeTextInset:
|
|
5290
|
-
changedPadding:
|
|
5291
|
-
style:
|
|
5328
|
+
padding: O,
|
|
5329
|
+
internalShapeTextInset: k,
|
|
5330
|
+
changedPadding: j,
|
|
5331
|
+
style: E,
|
|
5292
5332
|
rounding: h
|
|
5293
5333
|
});
|
|
5294
5334
|
if (o === void 0 && s === void 0) this.editor.canvasManager.centerObjectToMontageArea({ object: F });
|
|
@@ -5329,24 +5369,28 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5329
5369
|
}), x = this._resolveCurrentDimensions({ group: r }), S = Math.max(1, u ?? x.height), C = this._isShapeTextAutoExpandEnabled({ group: r }), w = d === void 0 ? C : d !== !1, T = _ ?? r.shapeRounding ?? 0, E = ut({ presetKey: dt({
|
|
5330
5370
|
preset: i,
|
|
5331
5371
|
rounding: T
|
|
5332
|
-
}) }) ?? i, D = m ?? r.shapeAlignHorizontal ?? "center", O = h ?? r.shapeAlignVertical ?? "middle", k = this._resolveGroupUserPadding({ group: r }), A =
|
|
5372
|
+
}) }) ?? i, D = m ?? r.shapeAlignHorizontal ?? "center", O = h ?? r.shapeAlignVertical ?? "middle", k = this._resolveGroupUserPadding({ group: r }), A = Ut({ padding: g }), j = Bt({
|
|
5333
5373
|
base: k,
|
|
5334
5374
|
override: g
|
|
5335
|
-
}), M =
|
|
5336
|
-
preset: E,
|
|
5337
|
-
width: x.width,
|
|
5338
|
-
height: S
|
|
5339
|
-
}), N = zt({
|
|
5340
|
-
base: M,
|
|
5341
|
-
addition: j
|
|
5342
|
-
}), P = this._resolveShapeStyle({
|
|
5375
|
+
}), M = this._resolveShapeStyle({
|
|
5343
5376
|
options: n,
|
|
5344
5377
|
fallback: r
|
|
5378
|
+
}), N = Ht({
|
|
5379
|
+
baseInset: pt({
|
|
5380
|
+
preset: E,
|
|
5381
|
+
width: x.width,
|
|
5382
|
+
height: S
|
|
5383
|
+
}),
|
|
5384
|
+
stroke: M.stroke,
|
|
5385
|
+
strokeWidth: M.strokeWidth
|
|
5386
|
+
}), P = Vt({
|
|
5387
|
+
base: N,
|
|
5388
|
+
addition: j
|
|
5345
5389
|
}), F = Math.max(1, r.shapeManualBaseWidth ?? x.width);
|
|
5346
5390
|
l !== void 0 && (F = Math.max(1, l)), l === void 0 && C && !w && (F = Math.max(1, x.width));
|
|
5347
|
-
let
|
|
5348
|
-
if (!
|
|
5349
|
-
let
|
|
5391
|
+
let I = Math.max(1, u ?? r.shapeManualBaseHeight ?? S), { shape: ee, text: L } = Y({ group: r });
|
|
5392
|
+
if (!ee || !L) return null;
|
|
5393
|
+
let te = {
|
|
5350
5394
|
angle: 0,
|
|
5351
5395
|
skewX: 0,
|
|
5352
5396
|
skewY: 0,
|
|
@@ -5359,71 +5403,70 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5359
5403
|
top: 0,
|
|
5360
5404
|
originX: "left",
|
|
5361
5405
|
originY: "top"
|
|
5362
|
-
},
|
|
5363
|
-
text:
|
|
5364
|
-
textStyle: this._resolveCurrentTextStyle({ textNode:
|
|
5365
|
-
width: Math.max(1,
|
|
5406
|
+
}, ne = this._createTextNode({
|
|
5407
|
+
text: L.textCaseRaw ?? L.text ?? "",
|
|
5408
|
+
textStyle: this._resolveCurrentTextStyle({ textNode: L }),
|
|
5409
|
+
width: Math.max(1, L.width ?? x.width),
|
|
5366
5410
|
align: D
|
|
5367
5411
|
});
|
|
5368
|
-
|
|
5369
|
-
textNode:
|
|
5412
|
+
ne.set(te), this._applyTextUpdates({
|
|
5413
|
+
textNode: ne,
|
|
5370
5414
|
text: f,
|
|
5371
5415
|
textStyle: p,
|
|
5372
5416
|
align: D
|
|
5373
5417
|
});
|
|
5374
|
-
let
|
|
5375
|
-
text:
|
|
5418
|
+
let R = l === void 0 && u === void 0 && t === void 0 && d === void 0 && _ === void 0 && f === void 0 && !this._hasShapeTextSizeAffectingStyleChanges({ textStyle: p }), re = g !== void 0 && R, z = R ? x.width : this._resolveShapeLayoutWidth({
|
|
5419
|
+
text: ne,
|
|
5376
5420
|
currentWidth: x.width,
|
|
5377
5421
|
manualWidth: F,
|
|
5378
5422
|
shapeTextAutoExpandEnabled: w,
|
|
5379
|
-
padding:
|
|
5380
|
-
|
|
5381
|
-
}), R = await Nt({
|
|
5423
|
+
padding: P
|
|
5424
|
+
}), ie = await Nt({
|
|
5382
5425
|
preset: E,
|
|
5383
|
-
width:
|
|
5426
|
+
width: z,
|
|
5384
5427
|
height: S,
|
|
5385
|
-
style:
|
|
5428
|
+
style: M,
|
|
5386
5429
|
rounding: T
|
|
5387
|
-
}),
|
|
5388
|
-
if (
|
|
5389
|
-
let
|
|
5390
|
-
this._detachShapeGroupAutoLayout({ group: r }),
|
|
5391
|
-
textNode:
|
|
5430
|
+
}), B = r.getObjects().indexOf(ee);
|
|
5431
|
+
if (B < 0) return null;
|
|
5432
|
+
let ae = () => {
|
|
5433
|
+
this._detachShapeGroupAutoLayout({ group: r }), L.set(te), this._applyTextUpdates({
|
|
5434
|
+
textNode: L,
|
|
5392
5435
|
text: f,
|
|
5393
5436
|
textStyle: p,
|
|
5394
5437
|
align: D
|
|
5395
|
-
}), r.remove(
|
|
5438
|
+
}), r.remove(ee), r.insertAt(B, ie), this._applyShapeGroupMetadata({
|
|
5396
5439
|
group: r,
|
|
5397
5440
|
presetKey: E.key,
|
|
5398
5441
|
presetCanRound: ht({ preset: E }),
|
|
5399
|
-
width:
|
|
5442
|
+
width: z,
|
|
5400
5443
|
height: S,
|
|
5401
5444
|
manualWidth: F,
|
|
5402
|
-
manualHeight:
|
|
5445
|
+
manualHeight: I,
|
|
5403
5446
|
shapeTextAutoExpand: w,
|
|
5404
5447
|
alignH: D,
|
|
5405
5448
|
alignV: O,
|
|
5406
5449
|
padding: j,
|
|
5407
|
-
style:
|
|
5450
|
+
style: M,
|
|
5408
5451
|
rounding: T
|
|
5409
5452
|
}), this._applyCurrentLayout({
|
|
5410
5453
|
group: r,
|
|
5411
|
-
shape:
|
|
5412
|
-
text:
|
|
5454
|
+
shape: ie,
|
|
5455
|
+
text: L,
|
|
5413
5456
|
placement: b,
|
|
5414
|
-
width:
|
|
5457
|
+
width: z,
|
|
5415
5458
|
height: S,
|
|
5416
5459
|
alignH: D,
|
|
5417
5460
|
alignV: O,
|
|
5418
|
-
internalShapeTextInset:
|
|
5419
|
-
expandShapeHeightToFitText: !
|
|
5461
|
+
internalShapeTextInset: N,
|
|
5462
|
+
expandShapeHeightToFitText: !re,
|
|
5420
5463
|
changedPadding: A
|
|
5421
|
-
}),
|
|
5464
|
+
}), L.isEditing && this.editingPlacements.set(r, b);
|
|
5422
5465
|
};
|
|
5423
|
-
if (!this._isOnCanvas({ object: r })) return
|
|
5466
|
+
if (!this._isOnCanvas({ object: r })) return ae(), r;
|
|
5424
5467
|
this._beginMutation();
|
|
5425
5468
|
try {
|
|
5426
|
-
|
|
5469
|
+
ae(), !L.isEditing && !v && this.editor.canvas.setActiveObject(r), this.editor.canvas.requestRenderAll();
|
|
5427
5470
|
} finally {
|
|
5428
5471
|
this._endMutation({ withoutSave: y });
|
|
5429
5472
|
}
|
|
@@ -5463,18 +5506,24 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5463
5506
|
if (!o) return null;
|
|
5464
5507
|
this._beginMutation();
|
|
5465
5508
|
try {
|
|
5466
|
-
xt({
|
|
5509
|
+
if (xt({
|
|
5467
5510
|
shape: o,
|
|
5468
5511
|
style: {
|
|
5469
5512
|
stroke: t,
|
|
5470
5513
|
strokeWidth: n,
|
|
5471
5514
|
strokeDashArray: r
|
|
5472
5515
|
}
|
|
5473
|
-
}), t !== void 0 && (a.shapeStroke = t), n !== void 0 && (a.shapeStrokeWidth = n), r !== void 0 && (a.shapeStrokeDashArray = r), s
|
|
5474
|
-
group: a
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5516
|
+
}), t !== void 0 && (a.shapeStroke = t), n !== void 0 && (a.shapeStrokeWidth = n), r !== void 0 && (a.shapeStrokeDashArray = r), s) {
|
|
5517
|
+
let e = this._resolveCurrentDimensions({ group: a });
|
|
5518
|
+
this._applyCurrentLayout({
|
|
5519
|
+
group: a,
|
|
5520
|
+
shape: o,
|
|
5521
|
+
text: s,
|
|
5522
|
+
width: e.width,
|
|
5523
|
+
height: e.height
|
|
5524
|
+
});
|
|
5525
|
+
}
|
|
5526
|
+
a.setCoords(), this.editor.canvas.requestRenderAll();
|
|
5478
5527
|
} finally {
|
|
5479
5528
|
this._endMutation({ withoutSave: i });
|
|
5480
5529
|
}
|
|
@@ -5580,7 +5629,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5580
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);
|
|
5581
5630
|
}
|
|
5582
5631
|
_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 }) {
|
|
5583
|
-
let _ = new
|
|
5632
|
+
let _ = new Ln([r, i], {
|
|
5584
5633
|
id: e,
|
|
5585
5634
|
originX: "center",
|
|
5586
5635
|
originY: "center",
|
|
@@ -5604,7 +5653,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5604
5653
|
padding: f,
|
|
5605
5654
|
style: h,
|
|
5606
5655
|
rounding: g
|
|
5607
|
-
}), _.rehydrateRuntimeState(),
|
|
5656
|
+
}), _.rehydrateRuntimeState(), Hn({ group: _ }), Tn({ text: i }), nn({
|
|
5608
5657
|
group: _,
|
|
5609
5658
|
shape: r,
|
|
5610
5659
|
text: i,
|
|
@@ -5662,7 +5711,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5662
5711
|
return s.set({
|
|
5663
5712
|
shapeNodeType: "text",
|
|
5664
5713
|
splitByGrapheme: !1
|
|
5665
|
-
}),
|
|
5714
|
+
}), Tn({ text: s }), s;
|
|
5666
5715
|
}
|
|
5667
5716
|
_applyTextUpdates({ textNode: e, text: t, textStyle: n, align: r }) {
|
|
5668
5717
|
let i = {};
|
|
@@ -5734,7 +5783,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5734
5783
|
};
|
|
5735
5784
|
}
|
|
5736
5785
|
_resolveGroupUserPadding({ group: e }) {
|
|
5737
|
-
return
|
|
5786
|
+
return Rt({ padding: {
|
|
5738
5787
|
top: e.shapePaddingTop,
|
|
5739
5788
|
right: e.shapePaddingRight,
|
|
5740
5789
|
bottom: e.shapePaddingBottom,
|
|
@@ -5743,16 +5792,15 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5743
5792
|
}
|
|
5744
5793
|
_resolveGroupInternalShapeTextInset({ group: e, width: t, height: n }) {
|
|
5745
5794
|
let r = ut({ presetKey: e.shapePresetKey ?? "circle" });
|
|
5746
|
-
return
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
};
|
|
5795
|
+
return Ht({
|
|
5796
|
+
baseInset: r ? pt({
|
|
5797
|
+
preset: r,
|
|
5798
|
+
width: t,
|
|
5799
|
+
height: n
|
|
5800
|
+
}) : void 0,
|
|
5801
|
+
stroke: e.shapeStroke,
|
|
5802
|
+
strokeWidth: e.shapeStrokeWidth
|
|
5803
|
+
});
|
|
5756
5804
|
}
|
|
5757
5805
|
_isShapeTextAutoExpandEnabled({ group: e }) {
|
|
5758
5806
|
return e.shapeTextAutoExpand !== !1;
|
|
@@ -5763,24 +5811,22 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5763
5811
|
let { width: n } = e.getMontageAreaSceneBounds();
|
|
5764
5812
|
return !Number.isFinite(n) || n <= 0 ? null : n;
|
|
5765
5813
|
}
|
|
5766
|
-
_resolveAutoExpandShapeWidth({ text: e, currentWidth: t, minimumWidth: n, padding: r
|
|
5767
|
-
let
|
|
5768
|
-
return
|
|
5814
|
+
_resolveAutoExpandShapeWidth({ text: e, currentWidth: t, minimumWidth: n, padding: r }) {
|
|
5815
|
+
let i = this._resolveMontageAreaWidth();
|
|
5816
|
+
return i ? rn({
|
|
5769
5817
|
text: e,
|
|
5770
5818
|
currentWidth: t,
|
|
5771
5819
|
minimumWidth: n,
|
|
5772
5820
|
padding: r,
|
|
5773
|
-
|
|
5774
|
-
montageAreaWidth: a
|
|
5821
|
+
montageAreaWidth: i
|
|
5775
5822
|
}) : Math.max(1, t, n);
|
|
5776
5823
|
}
|
|
5777
|
-
_resolveShapeLayoutWidth({ text: e, currentWidth: t, manualWidth: n, shapeTextAutoExpandEnabled: r, padding: i
|
|
5824
|
+
_resolveShapeLayoutWidth({ text: e, currentWidth: t, manualWidth: n, shapeTextAutoExpandEnabled: r, padding: i }) {
|
|
5778
5825
|
return r ? this._resolveAutoExpandShapeWidth({
|
|
5779
5826
|
text: e,
|
|
5780
5827
|
currentWidth: t,
|
|
5781
5828
|
minimumWidth: n,
|
|
5782
|
-
padding: i
|
|
5783
|
-
strokeWidth: a
|
|
5829
|
+
padding: i
|
|
5784
5830
|
}) : Math.max(1, n);
|
|
5785
5831
|
}
|
|
5786
5832
|
_resolveShapeTextHorizontalAlign({ group: e, textStyle: t }) {
|
|
@@ -5794,22 +5840,21 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5794
5840
|
currentWidth: d.width,
|
|
5795
5841
|
manualWidth: f.width,
|
|
5796
5842
|
shapeTextAutoExpandEnabled: this._isShapeTextAutoExpandEnabled({ group: e }),
|
|
5797
|
-
padding:
|
|
5843
|
+
padding: Vt({
|
|
5798
5844
|
base: c ?? this._resolveGroupInternalShapeTextInset({
|
|
5799
5845
|
group: e,
|
|
5800
5846
|
width: m,
|
|
5801
5847
|
height: Math.max(1, a ?? d.height)
|
|
5802
5848
|
}),
|
|
5803
5849
|
addition: p
|
|
5804
|
-
})
|
|
5805
|
-
strokeWidth: e.shapeStrokeWidth
|
|
5850
|
+
})
|
|
5806
5851
|
}) : Math.max(1, i);
|
|
5807
5852
|
let h = Math.max(1, a ?? d.height), g = c ?? this._resolveGroupInternalShapeTextInset({
|
|
5808
5853
|
group: e,
|
|
5809
5854
|
width: m,
|
|
5810
5855
|
height: h
|
|
5811
5856
|
}), _ = r ?? this.editor.canvasManager.getObjectPlacement({ object: e });
|
|
5812
|
-
|
|
5857
|
+
nn({
|
|
5813
5858
|
group: e,
|
|
5814
5859
|
shape: t,
|
|
5815
5860
|
text: n,
|
|
@@ -5849,7 +5894,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5849
5894
|
return this.editingPlacements.get(e) || this.editor.canvasManager.getObjectPlacement({ object: e });
|
|
5850
5895
|
}
|
|
5851
5896
|
_detachShapeGroupAutoLayout({ group: e }) {
|
|
5852
|
-
|
|
5897
|
+
En({ group: e });
|
|
5853
5898
|
}
|
|
5854
5899
|
_resolveHorizontalAlign({ explicitAlign: e, textStyle: t }) {
|
|
5855
5900
|
if (e) return e;
|
|
@@ -5868,11 +5913,11 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5868
5913
|
_resolveShapeStyle({ options: e, fallback: t }) {
|
|
5869
5914
|
let { fill: n, stroke: r, strokeWidth: i, strokeDashArray: a, opacity: o } = e, s = a === void 0 ? t?.shapeStrokeDashArray : a;
|
|
5870
5915
|
return {
|
|
5871
|
-
fill: n ?? t?.shapeFill ??
|
|
5916
|
+
fill: n ?? t?.shapeFill ?? ir,
|
|
5872
5917
|
stroke: r ?? t?.shapeStroke ?? null,
|
|
5873
|
-
strokeWidth: i ?? t?.shapeStrokeWidth ??
|
|
5918
|
+
strokeWidth: i ?? t?.shapeStrokeWidth ?? ar,
|
|
5874
5919
|
strokeDashArray: s ?? null,
|
|
5875
|
-
opacity: o ?? t?.shapeOpacity ??
|
|
5920
|
+
opacity: o ?? t?.shapeOpacity ?? or
|
|
5876
5921
|
};
|
|
5877
5922
|
}
|
|
5878
5923
|
_beginMutation() {
|
|
@@ -5908,7 +5953,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5908
5953
|
}
|
|
5909
5954
|
return null;
|
|
5910
5955
|
}
|
|
5911
|
-
},
|
|
5956
|
+
}, cr = class {
|
|
5912
5957
|
constructor({ editor: e }) {
|
|
5913
5958
|
this.editor = e, this.clipboard = null;
|
|
5914
5959
|
}
|
|
@@ -6164,12 +6209,12 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6164
6209
|
}), !1;
|
|
6165
6210
|
}
|
|
6166
6211
|
}
|
|
6167
|
-
},
|
|
6212
|
+
}, lr = class t {
|
|
6168
6213
|
constructor({ editor: e }) {
|
|
6169
6214
|
this.editor = e;
|
|
6170
6215
|
}
|
|
6171
6216
|
lockObject({ object: e, skipInnerObjects: n, withoutSave: r } = {}) {
|
|
6172
|
-
let { canvas: i, historyManager: a } = this.editor, o = e || i.getActiveObject(), s =
|
|
6217
|
+
let { canvas: i, historyManager: a } = this.editor, o = e || i.getActiveObject(), s = zn({ target: o }) ?? o;
|
|
6173
6218
|
if (!s || s.locked) return;
|
|
6174
6219
|
let c = {
|
|
6175
6220
|
lockMovementX: !0,
|
|
@@ -6191,7 +6236,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6191
6236
|
});
|
|
6192
6237
|
}
|
|
6193
6238
|
unlockObject({ object: e, withoutSave: n } = {}) {
|
|
6194
|
-
let { canvas: r, historyManager: i } = this.editor, a = e || r.getActiveObject(), o =
|
|
6239
|
+
let { canvas: r, historyManager: i } = this.editor, a = e || r.getActiveObject(), o = zn({ target: a }) ?? a;
|
|
6195
6240
|
if (!o) return;
|
|
6196
6241
|
let s = {
|
|
6197
6242
|
lockMovementX: !1,
|
|
@@ -6229,7 +6274,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6229
6274
|
!(n instanceof _) || !n.isEditing || n.exitEditing();
|
|
6230
6275
|
}
|
|
6231
6276
|
}
|
|
6232
|
-
},
|
|
6277
|
+
}, ur = class {
|
|
6233
6278
|
constructor({ editor: e }) {
|
|
6234
6279
|
this.editor = e;
|
|
6235
6280
|
}
|
|
@@ -6295,7 +6340,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6295
6340
|
i.resumeHistory(), n || i.saveState();
|
|
6296
6341
|
}
|
|
6297
6342
|
}
|
|
6298
|
-
},
|
|
6343
|
+
}, dr = class t {
|
|
6299
6344
|
constructor({ editor: e }) {
|
|
6300
6345
|
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();
|
|
6301
6346
|
}
|
|
@@ -6489,7 +6534,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6489
6534
|
let { options: e } = this.editor, { selectionKey: t } = e;
|
|
6490
6535
|
return t === void 0 ? ["ctrlKey", "metaKey"] : t;
|
|
6491
6536
|
}
|
|
6492
|
-
},
|
|
6537
|
+
}, fr = class e {
|
|
6493
6538
|
constructor({ editor: e }) {
|
|
6494
6539
|
this.editor = e;
|
|
6495
6540
|
}
|
|
@@ -6529,7 +6574,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6529
6574
|
};
|
|
6530
6575
|
return i.fire("editor:objects-deleted", l), l;
|
|
6531
6576
|
}
|
|
6532
|
-
},
|
|
6577
|
+
}, pr = {
|
|
6533
6578
|
IMAGE_MANAGER: {
|
|
6534
6579
|
INVALID_CONTENT_TYPE: "INVALID_CONTENT_TYPE",
|
|
6535
6580
|
INVALID_SOURCE_TYPE: "INVALID_SOURCE_TYPE",
|
|
@@ -6567,7 +6612,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6567
6612
|
INVALID_TARGET: "TEMPLATE_INVALID_TARGET",
|
|
6568
6613
|
APPLY_FAILED: "TEMPLATE_APPLY_FAILED"
|
|
6569
6614
|
}
|
|
6570
|
-
},
|
|
6615
|
+
}, mr = class e {
|
|
6571
6616
|
constructor({ editor: e }) {
|
|
6572
6617
|
this._buffer = [], this.editor = e;
|
|
6573
6618
|
}
|
|
@@ -6625,9 +6670,9 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6625
6670
|
}), this.editor.canvas.fire("editor:warning", s);
|
|
6626
6671
|
}
|
|
6627
6672
|
static isValidErrorCode(e) {
|
|
6628
|
-
return e ? Object.values(
|
|
6673
|
+
return e ? Object.values(pr).some((t) => Object.values(t).includes(e)) : !1;
|
|
6629
6674
|
}
|
|
6630
|
-
},
|
|
6675
|
+
}, hr = class {
|
|
6631
6676
|
constructor({ editor: e }) {
|
|
6632
6677
|
this.currentBounds = null, this.editor = e;
|
|
6633
6678
|
}
|
|
@@ -6676,32 +6721,32 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6676
6721
|
updateBounds() {
|
|
6677
6722
|
this.currentBounds = this.calculatePanBounds();
|
|
6678
6723
|
}
|
|
6679
|
-
},
|
|
6724
|
+
}, gr = ({ textbox: e }) => {
|
|
6680
6725
|
if (!e.isEditing) return null;
|
|
6681
6726
|
let t = e.selectionStart ?? 0, n = e.selectionEnd ?? t;
|
|
6682
6727
|
return t === n ? null : {
|
|
6683
6728
|
start: Math.min(t, n),
|
|
6684
6729
|
end: Math.max(t, n)
|
|
6685
6730
|
};
|
|
6686
|
-
},
|
|
6731
|
+
}, _r = ({ textbox: e }) => {
|
|
6687
6732
|
let t = e.text?.length ?? 0;
|
|
6688
6733
|
return t <= 0 ? null : {
|
|
6689
6734
|
start: 0,
|
|
6690
6735
|
end: t
|
|
6691
6736
|
};
|
|
6692
|
-
},
|
|
6737
|
+
}, vr = ({ textbox: e, range: t }) => {
|
|
6693
6738
|
if (!t) return !1;
|
|
6694
6739
|
let n = e.text?.length ?? 0;
|
|
6695
6740
|
return n <= 0 ? !1 : t.start <= 0 && t.end >= n;
|
|
6696
|
-
},
|
|
6741
|
+
}, yr = ({ textbox: e, styles: t, range: n }) => {
|
|
6697
6742
|
if (!t || !Object.keys(t).length) return !1;
|
|
6698
6743
|
let { start: r, end: i } = n;
|
|
6699
6744
|
return i <= r ? !1 : (e.setSelectionStyles(t, r, i), !0);
|
|
6700
|
-
},
|
|
6745
|
+
}, br = ({ textbox: e, range: t, property: n }) => {
|
|
6701
6746
|
if (!t) return;
|
|
6702
6747
|
let r = e.getSelectionStyles(t.start, t.end, !0);
|
|
6703
6748
|
if (r.length) return r[0]?.[n];
|
|
6704
|
-
},
|
|
6749
|
+
}, xr = ({ strokeColor: e, width: t }) => t <= 0 ? null : e ?? "#000000", Sr = ({ width: e = 0 }) => e ? Math.max(0, e) : 0, Cr = ({ value: e }) => typeof e == "string" ? e.toLocaleUpperCase() : "", wr = ({ value: e, min: t, max: n }) => Math.min(Math.max(e, t), n), Tr = class e extends _ {
|
|
6705
6750
|
static {
|
|
6706
6751
|
this.type = "background-textbox";
|
|
6707
6752
|
}
|
|
@@ -6826,7 +6871,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6826
6871
|
this._removeShadow(e);
|
|
6827
6872
|
}
|
|
6828
6873
|
_getDecorationColorAt(e, t) {
|
|
6829
|
-
let n = this.getValueOfPropertyAt(e, t, "strokeWidth"), r =
|
|
6874
|
+
let n = this.getValueOfPropertyAt(e, t, "strokeWidth"), r = Sr({ width: typeof n == "number" && Number.isFinite(n) ? n : 0 }), i = this.getValueOfPropertyAt(e, t, "stroke"), a = i == null ? null : xr({
|
|
6830
6875
|
strokeColor: i,
|
|
6831
6876
|
width: r
|
|
6832
6877
|
});
|
|
@@ -6842,22 +6887,22 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6842
6887
|
_getCornerRadii({ width: e, height: t }) {
|
|
6843
6888
|
let n = e / 2, r = t / 2, i = Math.min(n, r);
|
|
6844
6889
|
return {
|
|
6845
|
-
bottomLeft:
|
|
6890
|
+
bottomLeft: wr({
|
|
6846
6891
|
value: this.radiusBottomLeft ?? 0,
|
|
6847
6892
|
min: 0,
|
|
6848
6893
|
max: i
|
|
6849
6894
|
}),
|
|
6850
|
-
bottomRight:
|
|
6895
|
+
bottomRight: wr({
|
|
6851
6896
|
value: this.radiusBottomRight ?? 0,
|
|
6852
6897
|
min: 0,
|
|
6853
6898
|
max: i
|
|
6854
6899
|
}),
|
|
6855
|
-
topLeft:
|
|
6900
|
+
topLeft: wr({
|
|
6856
6901
|
value: this.radiusTopLeft ?? 0,
|
|
6857
6902
|
min: 0,
|
|
6858
6903
|
max: i
|
|
6859
6904
|
}),
|
|
6860
|
-
topRight:
|
|
6905
|
+
topRight: wr({
|
|
6861
6906
|
value: this.radiusTopRight ?? 0,
|
|
6862
6907
|
min: 0,
|
|
6863
6908
|
max: i
|
|
@@ -6875,7 +6920,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6875
6920
|
_getEffectiveBackgroundFill() {
|
|
6876
6921
|
let e = this.backgroundColor;
|
|
6877
6922
|
if (!e) return null;
|
|
6878
|
-
let t =
|
|
6923
|
+
let t = wr({
|
|
6879
6924
|
value: this.backgroundOpacity ?? 1,
|
|
6880
6925
|
min: 0,
|
|
6881
6926
|
max: 1
|
|
@@ -6883,7 +6928,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6883
6928
|
try {
|
|
6884
6929
|
r = new n(e);
|
|
6885
6930
|
} catch (t) {
|
|
6886
|
-
return
|
|
6931
|
+
return mr.emitError({
|
|
6887
6932
|
origin: "BackgroundTextbox",
|
|
6888
6933
|
method: "_getEffectiveBackgroundFill",
|
|
6889
6934
|
code: "INVALID_COLOR_VALUE",
|
|
@@ -6897,19 +6942,19 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6897
6942
|
return r.setAlpha(t), r.toRgba();
|
|
6898
6943
|
}
|
|
6899
6944
|
static _renderRoundedRect({ ctx: e, height: t, left: n, radii: r, top: i, width: a }) {
|
|
6900
|
-
let o = n + a, s = i + t, { topLeft: c, topRight: l, bottomRight: u, bottomLeft: d } = r, f =
|
|
6945
|
+
let o = n + a, s = i + t, { topLeft: c, topRight: l, bottomRight: u, bottomLeft: d } = r, f = wr({
|
|
6901
6946
|
value: c,
|
|
6902
6947
|
min: 0,
|
|
6903
6948
|
max: a
|
|
6904
|
-
}), p =
|
|
6949
|
+
}), p = wr({
|
|
6905
6950
|
value: l,
|
|
6906
6951
|
min: 0,
|
|
6907
6952
|
max: a
|
|
6908
|
-
}), m =
|
|
6953
|
+
}), m = wr({
|
|
6909
6954
|
value: u,
|
|
6910
6955
|
min: 0,
|
|
6911
6956
|
max: a
|
|
6912
|
-
}), h =
|
|
6957
|
+
}), h = wr({
|
|
6913
6958
|
value: d,
|
|
6914
6959
|
min: 0,
|
|
6915
6960
|
max: a
|
|
@@ -6920,9 +6965,9 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6920
6965
|
let { width: e = 0, height: t = 0 } = this, n = Math.round(e), r = Math.round(t);
|
|
6921
6966
|
n !== e && (this.width = Math.max(0, n)), r !== t && (this.height = Math.max(0, r));
|
|
6922
6967
|
}
|
|
6923
|
-
},
|
|
6924
|
-
y?.setClass && y.setClass(
|
|
6925
|
-
},
|
|
6968
|
+
}, Er = () => {
|
|
6969
|
+
y?.setClass && y.setClass(Tr, "background-textbox");
|
|
6970
|
+
}, Dr = .01, Or = ({ textbox: e, lineIndices: t, updates: n }) => {
|
|
6926
6971
|
if (!t.length) return !1;
|
|
6927
6972
|
let { fontFamily: r, fontSize: i, fill: a, stroke: o } = n;
|
|
6928
6973
|
if (!(r !== void 0 || i !== void 0 || a !== void 0 || o !== void 0)) return !1;
|
|
@@ -6934,7 +6979,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6934
6979
|
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);
|
|
6935
6980
|
}
|
|
6936
6981
|
return l && (e.lineFontDefaults = c), l;
|
|
6937
|
-
},
|
|
6982
|
+
}, kr = ({ lineText: e, lineStyles: t, lineDefaults: n }) => {
|
|
6938
6983
|
let r = e.length;
|
|
6939
6984
|
if (r === 0) return {
|
|
6940
6985
|
lineStyles: t,
|
|
@@ -6966,7 +7011,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6966
7011
|
lineStyles: l,
|
|
6967
7012
|
changed: u
|
|
6968
7013
|
};
|
|
6969
|
-
},
|
|
7014
|
+
}, Ar = ({ lineFontDefaults: e }) => {
|
|
6970
7015
|
if (!e) return;
|
|
6971
7016
|
let t = {};
|
|
6972
7017
|
for (let n in e) {
|
|
@@ -6977,7 +7022,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6977
7022
|
i && (t[r] = { ...i });
|
|
6978
7023
|
}
|
|
6979
7024
|
return t;
|
|
6980
|
-
},
|
|
7025
|
+
}, jr = ({ lineFontDefaults: e, scale: t }) => {
|
|
6981
7026
|
if (!e || !Number.isFinite(t) || Math.abs(t - 1) < .01) return;
|
|
6982
7027
|
let n = {}, r = !1, i = !1;
|
|
6983
7028
|
for (let a in e) {
|
|
@@ -6994,20 +7039,20 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6994
7039
|
n[o] = c, r = !0;
|
|
6995
7040
|
}
|
|
6996
7041
|
if (!(!r || !i)) return n;
|
|
6997
|
-
},
|
|
7042
|
+
}, Mr = ({ textbox: e, text: t }) => {
|
|
6998
7043
|
let { textLines: n } = e, r = Array.isArray(n) && n.length > 0 ? n.length : Math.max(t.split("\n").length, 1), i = 0;
|
|
6999
7044
|
for (let t = 0; t < r; t += 1) {
|
|
7000
7045
|
let n = e.getLineWidth(t);
|
|
7001
7046
|
n > i && (i = n);
|
|
7002
7047
|
}
|
|
7003
7048
|
return i;
|
|
7004
|
-
},
|
|
7049
|
+
}, Nr = ({ textbox: e, montageLeft: t, montageRight: n }) => {
|
|
7005
7050
|
e.setCoords();
|
|
7006
7051
|
let r = e.getBoundingRect(!1, !0), i = r.left ?? 0, a = i + (r.width ?? 0), o = n - t;
|
|
7007
7052
|
if (o > 0 && (r.width ?? 0) >= o - .01) return !1;
|
|
7008
7053
|
let s = 0;
|
|
7009
7054
|
return i < t ? s = t - i : a > n && (s = n - a), Math.abs(s) <= .01 ? !1 : (e.set({ left: (e.left ?? 0) + s }), !0);
|
|
7010
|
-
},
|
|
7055
|
+
}, Pr = ({ rawValue: e, calculatedValue: t }) => typeof e == "number" ? e : typeof t == "number" ? t : 0, Fr = ({ stylesList: e }) => {
|
|
7011
7056
|
let t = e.length;
|
|
7012
7057
|
if (!t) return !1;
|
|
7013
7058
|
for (let n = 0; n < t; n += 1) {
|
|
@@ -7017,16 +7062,16 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7017
7062
|
if (r !== void 0 || i !== void 0 || a !== void 0 || o !== void 0 || s !== void 0 || c !== void 0) return !0;
|
|
7018
7063
|
}
|
|
7019
7064
|
return !1;
|
|
7020
|
-
},
|
|
7021
|
-
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 =
|
|
7065
|
+
}, Ir = ({ textbox: e }) => {
|
|
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 = Pr({
|
|
7022
7067
|
rawValue: t,
|
|
7023
7068
|
calculatedValue: a
|
|
7024
|
-
}), c =
|
|
7069
|
+
}), c = Pr({
|
|
7025
7070
|
rawValue: n,
|
|
7026
7071
|
calculatedValue: o
|
|
7027
7072
|
}), l = Number.isFinite(s) ? Math.round(s) : null, u = Number.isFinite(c) ? Math.round(c) : null, d = {};
|
|
7028
7073
|
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;
|
|
7029
|
-
},
|
|
7074
|
+
}, Lr = ({ textbox: e }) => {
|
|
7030
7075
|
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;
|
|
7031
7076
|
return {
|
|
7032
7077
|
width: t,
|
|
@@ -7044,9 +7089,9 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7044
7089
|
bottomLeft: f
|
|
7045
7090
|
},
|
|
7046
7091
|
styles: JSON.parse(JSON.stringify(r)),
|
|
7047
|
-
lineFontDefaults:
|
|
7092
|
+
lineFontDefaults: Ar({ lineFontDefaults: i })
|
|
7048
7093
|
};
|
|
7049
|
-
},
|
|
7094
|
+
}, Rr = ({ base: e }) => {
|
|
7050
7095
|
let t = 1 / Math.max(1, e.width), n = [e.fontSize];
|
|
7051
7096
|
Object.values(e.styles).forEach((e) => {
|
|
7052
7097
|
Object.values(e).forEach((e) => {
|
|
@@ -7063,7 +7108,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7063
7108
|
fontScale: r,
|
|
7064
7109
|
proportionalScale: Math.max(t, r)
|
|
7065
7110
|
};
|
|
7066
|
-
},
|
|
7111
|
+
}, zr = ({ textbox: e, canvasManager: t, base: n, widthScale: r, heightScale: i, placement: a, shouldScaleFontSize: o, shouldScalePadding: s, shouldScaleRadii: c, shouldDisableAutoExpandOnHorizontalChange: l = !1, shouldRoundDimensions: u = !0 }) => {
|
|
7067
7112
|
let { width: d, fontSize: f, padding: p, radii: m, styles: h, lineFontDefaults: g } = n, _ = Math.max(1, d * r), v = u ? Math.max(1, Math.round(_)) : _, y = Math.max(Math.min(8, f), f * i), b = Object.keys(h).length > 0, x;
|
|
7068
7113
|
if (o && b) {
|
|
7069
7114
|
let e = {};
|
|
@@ -7082,7 +7127,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7082
7127
|
}), Object.keys(e).length && (x = e);
|
|
7083
7128
|
}
|
|
7084
7129
|
let S;
|
|
7085
|
-
o && (S =
|
|
7130
|
+
o && (S = jr({
|
|
7086
7131
|
lineFontDefaults: g,
|
|
7087
7132
|
scale: i
|
|
7088
7133
|
}));
|
|
@@ -7096,7 +7141,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7096
7141
|
topRight: Math.max(0, m.topRight * i),
|
|
7097
7142
|
bottomRight: Math.max(0, m.bottomRight * i),
|
|
7098
7143
|
bottomLeft: Math.max(0, m.bottomLeft * i)
|
|
7099
|
-
} : m, T = e.width ?? d, E = Math.abs(v - T) >
|
|
7144
|
+
} : m, T = e.width ?? d, E = Math.abs(v - T) > Dr;
|
|
7100
7145
|
l && E && (e.autoExpand = !1), x && (e.styles = x), S && (e.lineFontDefaults = S), e.set({
|
|
7101
7146
|
width: v,
|
|
7102
7147
|
fontSize: o ? y : f,
|
|
@@ -7118,7 +7163,7 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7118
7163
|
} finally {
|
|
7119
7164
|
e.shouldRoundDimensionsOnInit = D;
|
|
7120
7165
|
}
|
|
7121
|
-
let O = u ?
|
|
7166
|
+
let O = u ? Ir({ textbox: e }) : !1;
|
|
7122
7167
|
return O && (e.dirty = !0), t.applyObjectPlacement({
|
|
7123
7168
|
object: e,
|
|
7124
7169
|
placement: a
|
|
@@ -7126,18 +7171,18 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7126
7171
|
appliedWidth: e.width ?? v,
|
|
7127
7172
|
dimensionsRounded: O
|
|
7128
7173
|
};
|
|
7129
|
-
},
|
|
7174
|
+
}, Br = ({ transform: e }) => {
|
|
7130
7175
|
let { corner: t = "", action: n = "" } = e;
|
|
7131
7176
|
return {
|
|
7132
7177
|
isCornerHandle: t === "tl" || t === "tr" || t === "bl" || t === "br" || n === "scale",
|
|
7133
7178
|
isHorizontalHandle: t === "ml" || t === "mr" || n === "scaleX",
|
|
7134
7179
|
isVerticalHandle: t === "mt" || t === "mb" || n === "scaleY"
|
|
7135
7180
|
};
|
|
7136
|
-
},
|
|
7181
|
+
}, Vr = ({ textbox: e, transform: t, appliedWidth: n }) => {
|
|
7137
7182
|
t.scaleX = 1, t.scaleY = 1;
|
|
7138
7183
|
let { original: r } = t;
|
|
7139
7184
|
r && (r.scaleX = 1, r.scaleY = 1, r.width = n, r.height = e.height, r.left = e.left, r.top = e.top);
|
|
7140
|
-
},
|
|
7185
|
+
}, Hr = ({ textbox: e, transform: t, scenePoint: n }) => {
|
|
7141
7186
|
let { x: r, y: i } = e._getTransformedDimensions();
|
|
7142
7187
|
if (r <= 0 || i <= 0) return null;
|
|
7143
7188
|
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);
|
|
@@ -7147,27 +7192,27 @@ var Zn = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7147
7192
|
stepScaleX: l,
|
|
7148
7193
|
stepScaleY: u
|
|
7149
7194
|
};
|
|
7150
|
-
},
|
|
7151
|
-
function
|
|
7195
|
+
}, Ur = 1e-4;
|
|
7196
|
+
function Wr(e) {
|
|
7152
7197
|
return !!e && e instanceof _;
|
|
7153
7198
|
}
|
|
7154
|
-
function
|
|
7155
|
-
if (!
|
|
7199
|
+
function Gr(e) {
|
|
7200
|
+
if (!Wr(e)) return !1;
|
|
7156
7201
|
let t = e.group;
|
|
7157
7202
|
return e.shapeNodeType === "text" && t?.shapeComposite === !0;
|
|
7158
7203
|
}
|
|
7159
|
-
var
|
|
7204
|
+
var Kr = class {
|
|
7160
7205
|
constructor({ canvas: t, canvasManager: n, persistScaledTextbox: r }) {
|
|
7161
7206
|
this.handleMouseMove = (e) => {
|
|
7162
7207
|
let t = this.canvas._currentTransform;
|
|
7163
7208
|
if (!t) return;
|
|
7164
7209
|
let { target: n } = t;
|
|
7165
|
-
if (!
|
|
7210
|
+
if (!Wr(n) || Gr(n)) return;
|
|
7166
7211
|
let r = this.scalingState.get(n);
|
|
7167
7212
|
if (!r || !e.e) return;
|
|
7168
|
-
let { isCornerHandle: i, isHorizontalHandle: a, isVerticalHandle: o } =
|
|
7213
|
+
let { isCornerHandle: i, isHorizontalHandle: a, isVerticalHandle: o } = Br({ transform: t });
|
|
7169
7214
|
if (!a && !o && !i) return;
|
|
7170
|
-
let s =
|
|
7215
|
+
let s = Hr({
|
|
7171
7216
|
textbox: n,
|
|
7172
7217
|
transform: t,
|
|
7173
7218
|
scenePoint: this.canvas.getScenePoint(e.e)
|
|
@@ -7190,20 +7235,20 @@ var Ur = class {
|
|
|
7190
7235
|
}, j = r.lastAllowedScaleX, M = r.lastAllowedScaleY;
|
|
7191
7236
|
if (i) {
|
|
7192
7237
|
let e = Math.max(r.minimumProportionalScale, r.lastAllowedScaleX * Math.sqrt(u * d)), t = c || l ? r.minimumProportionalScale : e;
|
|
7193
|
-
if (Math.abs(t - r.lastAllowedScaleX) <=
|
|
7238
|
+
if (Math.abs(t - r.lastAllowedScaleX) <= Ur) return;
|
|
7194
7239
|
j = t, M = t;
|
|
7195
7240
|
} else {
|
|
7196
7241
|
if (a) {
|
|
7197
7242
|
let e = r.lastAllowedScaleX * u, t = c ? r.minimumWidthScale : Math.max(r.minimumWidthScale, e);
|
|
7198
|
-
Math.abs(t - r.lastAllowedScaleX) >
|
|
7243
|
+
Math.abs(t - r.lastAllowedScaleX) > Ur && (j = t);
|
|
7199
7244
|
}
|
|
7200
7245
|
if (o) {
|
|
7201
7246
|
let e = r.lastAllowedScaleY * d, t = l ? r.minimumFontScale : Math.max(r.minimumFontScale, e);
|
|
7202
|
-
Math.abs(t - r.lastAllowedScaleY) >
|
|
7247
|
+
Math.abs(t - r.lastAllowedScaleY) > Ur && (M = t);
|
|
7203
7248
|
}
|
|
7204
|
-
if (Math.abs(j - r.lastAllowedScaleX) <=
|
|
7249
|
+
if (Math.abs(j - r.lastAllowedScaleX) <= Ur && Math.abs(M - r.lastAllowedScaleY) <= Ur) return;
|
|
7205
7250
|
}
|
|
7206
|
-
let { appliedWidth: N, dimensionsRounded: P } =
|
|
7251
|
+
let { appliedWidth: N, dimensionsRounded: P } = zr({
|
|
7207
7252
|
textbox: n,
|
|
7208
7253
|
canvasManager: this.canvasManager,
|
|
7209
7254
|
base: r.startBase,
|
|
@@ -7216,7 +7261,7 @@ var Ur = class {
|
|
|
7216
7261
|
shouldDisableAutoExpandOnHorizontalChange: a,
|
|
7217
7262
|
shouldRoundDimensions: !i
|
|
7218
7263
|
});
|
|
7219
|
-
|
|
7264
|
+
Vr({
|
|
7220
7265
|
textbox: n,
|
|
7221
7266
|
transform: t,
|
|
7222
7267
|
appliedWidth: N
|
|
@@ -7237,27 +7282,27 @@ var Ur = class {
|
|
|
7237
7282
|
}), this.canvas.requestRenderAll();
|
|
7238
7283
|
}, this.handleObjectScaling = (t) => {
|
|
7239
7284
|
let { target: n, transform: r } = t;
|
|
7240
|
-
if (n instanceof e || !
|
|
7285
|
+
if (n instanceof e || !Wr(n) || Gr(n) || !r) return;
|
|
7241
7286
|
n.isScaling = !0;
|
|
7242
7287
|
let i = this._ensureScalingState({
|
|
7243
7288
|
textbox: n,
|
|
7244
7289
|
transform: r
|
|
7245
|
-
}), { startBase: a } = i, { width: o, fontSize: s } = a, { isCornerHandle: c, isHorizontalHandle: l, isVerticalHandle: u } =
|
|
7290
|
+
}), { startBase: a } = i, { width: o, fontSize: s } = a, { isCornerHandle: c, isHorizontalHandle: l, isVerticalHandle: u } = Br({ transform: r }), d = r.corner ?? "", f = c || u;
|
|
7246
7291
|
if (!l && !u && !c) return;
|
|
7247
7292
|
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({
|
|
7248
7293
|
object: n,
|
|
7249
7294
|
originX: _,
|
|
7250
7295
|
originY: v
|
|
7251
|
-
}), { 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,
|
|
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, I = !0;
|
|
7252
7297
|
if (c) {
|
|
7253
7298
|
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;
|
|
7254
|
-
if (n || r || a) N = i.lastAllowedScaleX, P = i.lastAllowedScaleY, F = i.lastAllowedPlacement,
|
|
7299
|
+
if (n || r || a) N = i.lastAllowedScaleX, P = i.lastAllowedScaleY, F = i.lastAllowedPlacement, I = !1;
|
|
7255
7300
|
else {
|
|
7256
7301
|
let e = Math.max(i.minimumProportionalScale, t);
|
|
7257
7302
|
N = e, P = e;
|
|
7258
7303
|
}
|
|
7259
7304
|
} else l && (N = Math.max(i.minimumWidthScale, i.lastAllowedScaleX * h)), u && (P = Math.max(i.minimumFontScale, i.lastAllowedScaleY * g));
|
|
7260
|
-
let { appliedWidth:
|
|
7305
|
+
let { appliedWidth: ee, dimensionsRounded: L } = zr({
|
|
7261
7306
|
textbox: n,
|
|
7262
7307
|
canvasManager: this.canvasManager,
|
|
7263
7308
|
base: a,
|
|
@@ -7270,14 +7315,14 @@ var Ur = class {
|
|
|
7270
7315
|
shouldDisableAutoExpandOnHorizontalChange: l,
|
|
7271
7316
|
shouldRoundDimensions: !c
|
|
7272
7317
|
});
|
|
7273
|
-
|
|
7318
|
+
Vr({
|
|
7274
7319
|
textbox: n,
|
|
7275
7320
|
transform: r,
|
|
7276
|
-
appliedWidth:
|
|
7277
|
-
}), this.canvas.requestRenderAll(),
|
|
7321
|
+
appliedWidth: ee
|
|
7322
|
+
}), this.canvas.requestRenderAll(), I && this._updateScalingStateAfterLiveCommit({
|
|
7278
7323
|
textbox: n,
|
|
7279
7324
|
state: i,
|
|
7280
|
-
appliedWidth:
|
|
7325
|
+
appliedWidth: ee,
|
|
7281
7326
|
previousFontSize: O ?? s,
|
|
7282
7327
|
previousPadding: {
|
|
7283
7328
|
top: b,
|
|
@@ -7292,7 +7337,7 @@ var Ur = class {
|
|
|
7292
7337
|
bottomLeft: D
|
|
7293
7338
|
},
|
|
7294
7339
|
previousWidth: M,
|
|
7295
|
-
dimensionsRounded:
|
|
7340
|
+
dimensionsRounded: L,
|
|
7296
7341
|
isCornerHandle: c,
|
|
7297
7342
|
isHorizontalHandle: l,
|
|
7298
7343
|
isVerticalHandle: u,
|
|
@@ -7303,7 +7348,7 @@ var Ur = class {
|
|
|
7303
7348
|
let { target: n } = t;
|
|
7304
7349
|
if (n instanceof e) {
|
|
7305
7350
|
let t = n.getObjects();
|
|
7306
|
-
if (!t.some((e) =>
|
|
7351
|
+
if (!t.some((e) => Wr(e))) return;
|
|
7307
7352
|
let { scaleX: r = 1, scaleY: i = 1 } = n;
|
|
7308
7353
|
if (Math.abs(r - 1) < .01 && Math.abs(i - 1) < .01) return;
|
|
7309
7354
|
this.canvas.discardActiveObject(), t.forEach((e) => {
|
|
@@ -7313,7 +7358,7 @@ var Ur = class {
|
|
|
7313
7358
|
this.canvas.setActiveObject(a), this.canvas.requestRenderAll();
|
|
7314
7359
|
return;
|
|
7315
7360
|
}
|
|
7316
|
-
if (!
|
|
7361
|
+
if (!Wr(n) || Gr(n)) return;
|
|
7317
7362
|
n.isScaling = !1;
|
|
7318
7363
|
let r = this.scalingState.get(n);
|
|
7319
7364
|
if (this.scalingState.delete(n), !r?.hasScalingChange) return;
|
|
@@ -7338,11 +7383,11 @@ var Ur = class {
|
|
|
7338
7383
|
}, this.canvas = t, this.canvasManager = n, this.persistScaledTextbox = r, this.scalingState = /* @__PURE__ */ new WeakMap();
|
|
7339
7384
|
}
|
|
7340
7385
|
commitStandaloneTextScale({ target: e, shouldDisableAutoExpandOnHorizontalChange: t = !1 }) {
|
|
7341
|
-
if (!
|
|
7386
|
+
if (!Wr(e) || Gr(e)) return !1;
|
|
7342
7387
|
let n = Math.abs(e.scaleX ?? 1) || 1, r = Math.abs(e.scaleY ?? 1) || 1;
|
|
7343
7388
|
if (!(Math.abs(n - 1) > .01 || Math.abs(r - 1) > .01)) return !1;
|
|
7344
|
-
let i =
|
|
7345
|
-
return
|
|
7389
|
+
let i = Lr({ textbox: e }), a = this.canvasManager.getObjectPlacement({ object: e });
|
|
7390
|
+
return zr({
|
|
7346
7391
|
textbox: e,
|
|
7347
7392
|
canvasManager: this.canvasManager,
|
|
7348
7393
|
base: i,
|
|
@@ -7358,7 +7403,7 @@ var Ur = class {
|
|
|
7358
7403
|
_ensureScalingState({ textbox: e, transform: t }) {
|
|
7359
7404
|
let n = this.scalingState.get(e);
|
|
7360
7405
|
if (!n) {
|
|
7361
|
-
let r =
|
|
7406
|
+
let r = Lr({ textbox: e }), i = Rr({ base: r }), a = t.original?.originX ?? t.originX ?? e.originX ?? "center", o = t.original?.originY ?? t.originY ?? e.originY ?? "center";
|
|
7362
7407
|
n = {
|
|
7363
7408
|
startBase: r,
|
|
7364
7409
|
startTransformCorner: typeof t.corner == "string" ? t.corner : null,
|
|
@@ -7390,7 +7435,7 @@ var Ur = class {
|
|
|
7390
7435
|
topRight: e.radiusTopRight ?? 0,
|
|
7391
7436
|
bottomRight: e.radiusBottomRight ?? 0,
|
|
7392
7437
|
bottomLeft: e.radiusBottomLeft ?? 0
|
|
7393
|
-
}, v = Math.abs(n - o) >
|
|
7438
|
+
}, v = Math.abs(n - o) > Dr, y = Math.abs(h - r) > Dr, 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;
|
|
7394
7439
|
if (c) {
|
|
7395
7440
|
let e = h / Math.max(1, m);
|
|
7396
7441
|
S = e, C = e;
|
|
@@ -7411,7 +7456,7 @@ var Ur = class {
|
|
|
7411
7456
|
originY: a
|
|
7412
7457
|
});
|
|
7413
7458
|
}
|
|
7414
|
-
},
|
|
7459
|
+
}, qr = ({ textbox: e }) => {
|
|
7415
7460
|
let t = e.text ?? "";
|
|
7416
7461
|
if (!t.length) return [];
|
|
7417
7462
|
let n = t.split("\n"), r = [], i = 0;
|
|
@@ -7423,7 +7468,7 @@ var Ur = class {
|
|
|
7423
7468
|
});
|
|
7424
7469
|
}
|
|
7425
7470
|
return r;
|
|
7426
|
-
},
|
|
7471
|
+
}, Jr = ({ range: e, text: t }) => {
|
|
7427
7472
|
if (!e) return null;
|
|
7428
7473
|
let n = t.length;
|
|
7429
7474
|
if (n <= 0) return null;
|
|
@@ -7432,8 +7477,8 @@ var Ur = class {
|
|
|
7432
7477
|
start: l,
|
|
7433
7478
|
end: u
|
|
7434
7479
|
};
|
|
7435
|
-
},
|
|
7436
|
-
let n =
|
|
7480
|
+
}, Yr = ({ textbox: e, range: t }) => {
|
|
7481
|
+
let n = qr({ textbox: e });
|
|
7437
7482
|
if (!n.length) return t;
|
|
7438
7483
|
let { start: r } = t, { end: i } = t;
|
|
7439
7484
|
for (let e = 0; e < n.length; e += 1) {
|
|
@@ -7446,7 +7491,7 @@ var Ur = class {
|
|
|
7446
7491
|
start: r,
|
|
7447
7492
|
end: i
|
|
7448
7493
|
};
|
|
7449
|
-
},
|
|
7494
|
+
}, Xr = ({ textbox: e, range: t }) => {
|
|
7450
7495
|
let n = e.text ?? "";
|
|
7451
7496
|
if (!n.length) return [];
|
|
7452
7497
|
let { start: r, end: i } = t, a = n.split("\n"), o = [], s = 0;
|
|
@@ -7455,7 +7500,7 @@ var Ur = class {
|
|
|
7455
7500
|
i > n && r < c && o.push(e), s = c + 1;
|
|
7456
7501
|
}
|
|
7457
7502
|
return o;
|
|
7458
|
-
},
|
|
7503
|
+
}, Zr = ({ textbox: e, range: t }) => {
|
|
7459
7504
|
let n = e.text ?? "";
|
|
7460
7505
|
if (!n.length) return [];
|
|
7461
7506
|
let { start: r, end: i } = t, a = n.split("\n"), o = [], s = 0;
|
|
@@ -7464,20 +7509,20 @@ var Ur = class {
|
|
|
7464
7509
|
r <= n && i >= c && o.push(e), s = c + 1;
|
|
7465
7510
|
}
|
|
7466
7511
|
return o;
|
|
7467
|
-
},
|
|
7512
|
+
}, Qr = ({ previous: e, next: t }) => {
|
|
7468
7513
|
let n = Math.min(e.length, t.length);
|
|
7469
7514
|
for (let r = 0; r < n; r += 1) if (e[r] !== t[r]) return r;
|
|
7470
7515
|
return n;
|
|
7471
|
-
},
|
|
7516
|
+
}, $r = ({ text: e, charIndex: t }) => {
|
|
7472
7517
|
let n = Math.max(0, Math.min(t, e.length)), r = 0;
|
|
7473
7518
|
for (let t = 0; t < n; t += 1) e[t] === "\n" && (r += 1);
|
|
7474
7519
|
return r;
|
|
7475
|
-
},
|
|
7520
|
+
}, ei = ({ text: e, lineIndex: t }) => {
|
|
7476
7521
|
if (t <= 0) return 0;
|
|
7477
7522
|
let n = 0;
|
|
7478
7523
|
for (let r = 0; r < e.length; r += 1) if (e[r] === "\n" && (n += 1, n === t)) return r + 1;
|
|
7479
7524
|
return e.length;
|
|
7480
|
-
},
|
|
7525
|
+
}, ti = class e {
|
|
7481
7526
|
constructor({ editor: t }) {
|
|
7482
7527
|
this._handleTextEditingEntered = (t) => {
|
|
7483
7528
|
this.isTextEditingActive = !0;
|
|
@@ -7490,7 +7535,7 @@ var Ur = class {
|
|
|
7490
7535
|
if (!e._isTextbox(n) || this.lineDefaultsSyncing.has(n)) return;
|
|
7491
7536
|
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 });
|
|
7492
7537
|
if (s) {
|
|
7493
|
-
let e =
|
|
7538
|
+
let e = Cr({ value: l });
|
|
7494
7539
|
e !== i && n.set({ text: e }), n.textCaseRaw = l;
|
|
7495
7540
|
} else n.textCaseRaw = i;
|
|
7496
7541
|
if (!r && o === void 0 && (n.autoExpand = !0), r) {
|
|
@@ -7508,7 +7553,7 @@ var Ur = class {
|
|
|
7508
7553
|
let r = e._isShapeOwnedTextbox(n);
|
|
7509
7554
|
this.editingPlacementState?.delete(n);
|
|
7510
7555
|
let i = n.text ?? "";
|
|
7511
|
-
n.uppercase ? n.textCaseRaw = n.textCaseRaw ?? i.toLocaleLowerCase() : n.textCaseRaw = i, r || (
|
|
7556
|
+
n.uppercase ? n.textCaseRaw = n.textCaseRaw ?? i.toLocaleLowerCase() : n.textCaseRaw = i, r || (Ir({ textbox: n }) && (n.setCoords(), n.dirty = !0, this.canvas.requestRenderAll()), n.locked || n.set({
|
|
7512
7557
|
lockMovementX: !1,
|
|
7513
7558
|
lockMovementY: !1
|
|
7514
7559
|
}));
|
|
@@ -7535,7 +7580,7 @@ var Ur = class {
|
|
|
7535
7580
|
transform: r,
|
|
7536
7581
|
event: i ?? null
|
|
7537
7582
|
});
|
|
7538
|
-
}, this.editor = t, this.canvas = t.canvas, this.fonts = t.options.fonts ?? [], this.scalingController = new
|
|
7583
|
+
}, this.editor = t, this.canvas = t.canvas, this.fonts = t.options.fonts ?? [], this.scalingController = new Kr({
|
|
7539
7584
|
canvas: t.canvas,
|
|
7540
7585
|
canvasManager: t.canvasManager,
|
|
7541
7586
|
persistScaledTextbox: ({ target: e, style: t }) => {
|
|
@@ -7544,15 +7589,15 @@ var Ur = class {
|
|
|
7544
7589
|
style: t
|
|
7545
7590
|
});
|
|
7546
7591
|
}
|
|
7547
|
-
}), this.editingPlacementState = /* @__PURE__ */ new WeakMap(), this.lineDefaultsSyncing = /* @__PURE__ */ new WeakSet(), this.isTextEditingActive = !1, this._bindEvents(),
|
|
7592
|
+
}), this.editingPlacementState = /* @__PURE__ */ new WeakMap(), this.lineDefaultsSyncing = /* @__PURE__ */ new WeakSet(), this.isTextEditingActive = !1, this._bindEvents(), Er();
|
|
7548
7593
|
}
|
|
7549
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 } = {}) {
|
|
7550
7595
|
let { canvasManager: j, historyManager: M } = this.editor, { canvas: N } = this;
|
|
7551
7596
|
M.suspendHistory();
|
|
7552
|
-
let P = i ?? this._getDefaultFontFamily(), F =
|
|
7597
|
+
let P = i ?? this._getDefaultFontFamily(), F = Sr({ width: m }), I = xr({
|
|
7553
7598
|
strokeColor: p,
|
|
7554
7599
|
width: F
|
|
7555
|
-
}),
|
|
7600
|
+
}), ee = {
|
|
7556
7601
|
id: t,
|
|
7557
7602
|
fontFamily: P,
|
|
7558
7603
|
fontSize: a,
|
|
@@ -7563,7 +7608,7 @@ var Ur = class {
|
|
|
7563
7608
|
linethrough: u,
|
|
7564
7609
|
textAlign: d,
|
|
7565
7610
|
fill: f,
|
|
7566
|
-
stroke:
|
|
7611
|
+
stroke: I,
|
|
7567
7612
|
strokeWidth: F,
|
|
7568
7613
|
strokeUniform: !0,
|
|
7569
7614
|
opacity: h,
|
|
@@ -7578,40 +7623,40 @@ var Ur = class {
|
|
|
7578
7623
|
radiusBottomRight: w,
|
|
7579
7624
|
radiusBottomLeft: T,
|
|
7580
7625
|
...E
|
|
7581
|
-
},
|
|
7582
|
-
|
|
7583
|
-
let
|
|
7584
|
-
if (
|
|
7585
|
-
let e =
|
|
7586
|
-
e !==
|
|
7587
|
-
}
|
|
7588
|
-
|
|
7589
|
-
let
|
|
7590
|
-
|
|
7591
|
-
object:
|
|
7626
|
+
}, L = new Tr(n, ee), te = r !== !1;
|
|
7627
|
+
L.autoExpand = te;
|
|
7628
|
+
let ne = E.left !== void 0 || E.top !== void 0;
|
|
7629
|
+
if (L.textCaseRaw = L.text ?? "", l) {
|
|
7630
|
+
let e = Cr({ value: L.textCaseRaw });
|
|
7631
|
+
e !== L.text && L.set({ text: e });
|
|
7632
|
+
}
|
|
7633
|
+
Ir({ textbox: L }) && (L.dirty = !0);
|
|
7634
|
+
let R;
|
|
7635
|
+
ne && (R = j.resolveObjectPlacement({
|
|
7636
|
+
object: L,
|
|
7592
7637
|
left: E.left,
|
|
7593
7638
|
top: E.top,
|
|
7594
7639
|
originX: E.originX,
|
|
7595
7640
|
originY: E.originY,
|
|
7596
7641
|
fallbackPoint: j.getMontageAreaSceneCenter()
|
|
7597
7642
|
}));
|
|
7598
|
-
let
|
|
7599
|
-
return (
|
|
7600
|
-
textbox:
|
|
7601
|
-
placement:
|
|
7602
|
-
shouldAutoExpand:
|
|
7603
|
-
clampToMontage:
|
|
7604
|
-
}),
|
|
7605
|
-
textbox:
|
|
7643
|
+
let re = te && e._hasWrappedLinesBeyondExplicitBreaks(L);
|
|
7644
|
+
return (ne || re) && this._normalizeTextboxAfterContentChange({
|
|
7645
|
+
textbox: L,
|
|
7646
|
+
placement: R,
|
|
7647
|
+
shouldAutoExpand: re,
|
|
7648
|
+
clampToMontage: ne
|
|
7649
|
+
}), R || j.centerObjectToMontageArea({ object: L }), A || N.add(L), O || N.setActiveObject(L), N.requestRenderAll(), M.resumeHistory(), k || M.saveState(), N.fire("editor:text-added", {
|
|
7650
|
+
textbox: L,
|
|
7606
7651
|
options: {
|
|
7607
|
-
...
|
|
7652
|
+
...ee,
|
|
7608
7653
|
text: n,
|
|
7609
7654
|
bold: o,
|
|
7610
7655
|
italic: s,
|
|
7611
7656
|
strikethrough: u,
|
|
7612
7657
|
align: d,
|
|
7613
7658
|
color: f,
|
|
7614
|
-
strokeColor:
|
|
7659
|
+
strokeColor: I,
|
|
7615
7660
|
strokeWidth: F
|
|
7616
7661
|
},
|
|
7617
7662
|
flags: {
|
|
@@ -7619,127 +7664,127 @@ var Ur = class {
|
|
|
7619
7664
|
withoutSave: !!k,
|
|
7620
7665
|
withoutAdding: !!A
|
|
7621
7666
|
}
|
|
7622
|
-
}),
|
|
7667
|
+
}), L;
|
|
7623
7668
|
}
|
|
7624
7669
|
updateText({ target: t, style: n = {}, withoutSave: r, skipRender: i, selectionRange: a } = {}) {
|
|
7625
7670
|
let o = this._resolveTextObject(t);
|
|
7626
7671
|
if (!o) return null;
|
|
7627
7672
|
let { text: s = "" } = o, { historyManager: c } = this.editor, { canvasManager: l } = this.editor, { canvas: u } = this;
|
|
7628
7673
|
c.suspendHistory();
|
|
7629
|
-
let d = e._getSnapshot(o), { text: f, autoExpand: p, fontFamily: m, fontSize: h, bold: g, italic: _, underline: v, uppercase: y, strikethrough: b, align: x, color: S, strokeColor: C, strokeWidth: w, opacity: T, backgroundColor: E, backgroundOpacity: D, paddingTop: O, paddingRight: k, paddingBottom: A, paddingLeft: j, radiusTopLeft: M, radiusTopRight: N, radiusBottomRight: P, radiusBottomLeft: F, left:
|
|
7674
|
+
let d = e._getSnapshot(o), { text: f, autoExpand: p, fontFamily: m, fontSize: h, bold: g, italic: _, underline: v, uppercase: y, strikethrough: b, align: x, color: S, strokeColor: C, strokeWidth: w, opacity: T, backgroundColor: E, backgroundOpacity: D, paddingTop: O, paddingRight: k, paddingBottom: A, paddingLeft: j, radiusTopLeft: M, radiusTopRight: N, radiusBottomRight: P, radiusBottomLeft: F, left: I, top: ee, originX: L, originY: te, ...ne } = n, R = { ...ne }, re = l.resolveObjectPlacement({
|
|
7630
7675
|
object: o,
|
|
7631
|
-
left:
|
|
7632
|
-
top:
|
|
7633
|
-
originX:
|
|
7634
|
-
originY:
|
|
7635
|
-
}),
|
|
7676
|
+
left: I,
|
|
7677
|
+
top: ee,
|
|
7678
|
+
originX: L,
|
|
7679
|
+
originY: te
|
|
7680
|
+
}), z = a === void 0 ? gr({ textbox: o }) : Jr({
|
|
7636
7681
|
text: s,
|
|
7637
7682
|
range: a
|
|
7638
|
-
}),
|
|
7683
|
+
}), ie = z ? Yr({
|
|
7639
7684
|
textbox: o,
|
|
7640
|
-
range:
|
|
7641
|
-
}) : null,
|
|
7685
|
+
range: z
|
|
7686
|
+
}) : null, B = {}, ae = {}, V = {}, oe, se, ce = vr({
|
|
7642
7687
|
textbox: o,
|
|
7643
|
-
range:
|
|
7644
|
-
}),
|
|
7645
|
-
if (m !== void 0 && (
|
|
7688
|
+
range: z
|
|
7689
|
+
}), le = !z || ce, H = !z;
|
|
7690
|
+
if (m !== void 0 && (ie && (ae.fontFamily = m), le && (R.fontFamily = m, H && (V.fontFamily = m))), h !== void 0 && (ie && (ae.fontSize = h), le && (R.fontSize = h, H && (V.fontSize = h))), g !== void 0) {
|
|
7646
7691
|
let e = g ? "bold" : "normal";
|
|
7647
|
-
|
|
7692
|
+
z && (B.fontWeight = e), le && (R.fontWeight = e, H && (V.fontWeight = e));
|
|
7648
7693
|
}
|
|
7649
7694
|
if (_ !== void 0) {
|
|
7650
7695
|
let e = _ ? "italic" : "normal";
|
|
7651
|
-
|
|
7696
|
+
z && (B.fontStyle = e), le && (R.fontStyle = e, H && (V.fontStyle = e));
|
|
7652
7697
|
}
|
|
7653
|
-
if (v !== void 0 && (
|
|
7654
|
-
let e =
|
|
7698
|
+
if (v !== void 0 && (z && (B.underline = v), le && (R.underline = v, H && (V.underline = v))), b !== void 0 && (z && (B.linethrough = b), le && (R.linethrough = b, H && (V.linethrough = b))), x !== void 0 && (R.textAlign = x), S !== void 0 && (z && (B.fill = S), le && (R.fill = S, H && (V.fill = S))), C !== void 0 || w !== void 0) {
|
|
7699
|
+
let e = z ? br({
|
|
7655
7700
|
textbox: o,
|
|
7656
|
-
range:
|
|
7701
|
+
range: z,
|
|
7657
7702
|
property: "strokeWidth"
|
|
7658
|
-
}) : void 0, t =
|
|
7703
|
+
}) : void 0, t = z ? br({
|
|
7659
7704
|
textbox: o,
|
|
7660
|
-
range:
|
|
7705
|
+
range: z,
|
|
7661
7706
|
property: "stroke"
|
|
7662
7707
|
}) : void 0;
|
|
7663
|
-
|
|
7708
|
+
se = Sr({ width: w ?? e ?? o.strokeWidth ?? 0 }), oe = xr({
|
|
7664
7709
|
strokeColor: C ?? t ?? o.stroke ?? void 0,
|
|
7665
|
-
width:
|
|
7666
|
-
}),
|
|
7710
|
+
width: se
|
|
7711
|
+
}), z && (B.stroke = oe, B.strokeWidth = se), le && (R.stroke = oe, R.strokeWidth = se, H && (V.stroke = oe, V.strokeWidth = se));
|
|
7667
7712
|
}
|
|
7668
|
-
T !== void 0 && (
|
|
7713
|
+
T !== void 0 && (R.opacity = T), E !== void 0 && (R.backgroundColor = E), D !== void 0 && (R.backgroundOpacity = D), O !== void 0 && (R.paddingTop = O), k !== void 0 && (R.paddingRight = k), A !== void 0 && (R.paddingBottom = A), j !== void 0 && (R.paddingLeft = j), M !== void 0 && (R.radiusTopLeft = M), N !== void 0 && (R.radiusTopRight = N), P !== void 0 && (R.radiusBottomRight = P), F !== void 0 && (R.radiusBottomLeft = F);
|
|
7669
7714
|
let ue = o.textCaseRaw ?? s, de = !!o.uppercase, fe = f !== void 0, pe = fe ? f ?? "" : ue, me = y ?? de, he = me !== de;
|
|
7670
|
-
fe || he ? (
|
|
7715
|
+
fe || he ? (R.text = me ? Cr({ value: pe }) : pe, o.textCaseRaw = pe) : o.textCaseRaw === void 0 && (o.textCaseRaw = ue), o.uppercase = me, o.set(R);
|
|
7671
7716
|
let ge = !1;
|
|
7672
|
-
if (
|
|
7673
|
-
let e =
|
|
7717
|
+
if (z) {
|
|
7718
|
+
let e = yr({
|
|
7674
7719
|
textbox: o,
|
|
7675
|
-
styles:
|
|
7676
|
-
range:
|
|
7677
|
-
}), t =
|
|
7720
|
+
styles: B,
|
|
7721
|
+
range: z
|
|
7722
|
+
}), t = ie ? yr({
|
|
7678
7723
|
textbox: o,
|
|
7679
|
-
styles:
|
|
7680
|
-
range:
|
|
7724
|
+
styles: ae,
|
|
7725
|
+
range: ie
|
|
7681
7726
|
}) : !1;
|
|
7682
7727
|
ge = e || t;
|
|
7683
|
-
} else if (Object.keys(
|
|
7684
|
-
let e =
|
|
7685
|
-
e && (ge =
|
|
7728
|
+
} else if (Object.keys(V).length) {
|
|
7729
|
+
let e = _r({ textbox: o });
|
|
7730
|
+
e && (ge = yr({
|
|
7686
7731
|
textbox: o,
|
|
7687
|
-
styles:
|
|
7732
|
+
styles: V,
|
|
7688
7733
|
range: e
|
|
7689
7734
|
}));
|
|
7690
7735
|
}
|
|
7691
|
-
let _e = ge &&
|
|
7692
|
-
|
|
7693
|
-
|
|
7694
|
-
|
|
7736
|
+
let _e = ge && Fr({ stylesList: [
|
|
7737
|
+
B,
|
|
7738
|
+
ae,
|
|
7739
|
+
V
|
|
7695
7740
|
] });
|
|
7696
|
-
if (ge && (o.dirty = !0),
|
|
7697
|
-
let e =
|
|
7741
|
+
if (ge && (o.dirty = !0), ie && (m !== void 0 || h !== void 0)) {
|
|
7742
|
+
let e = Xr({
|
|
7698
7743
|
textbox: o,
|
|
7699
|
-
range:
|
|
7744
|
+
range: ie
|
|
7700
7745
|
}), t = {};
|
|
7701
|
-
m !== void 0 && (t.fontFamily = m), h !== void 0 && (t.fontSize = h),
|
|
7746
|
+
m !== void 0 && (t.fontFamily = m), h !== void 0 && (t.fontSize = h), Or({
|
|
7702
7747
|
textbox: o,
|
|
7703
7748
|
lineIndices: e,
|
|
7704
7749
|
updates: t
|
|
7705
7750
|
});
|
|
7706
7751
|
}
|
|
7707
|
-
if (
|
|
7708
|
-
let e =
|
|
7752
|
+
if (z && (S !== void 0 || C !== void 0 || w !== void 0)) {
|
|
7753
|
+
let e = Zr({
|
|
7709
7754
|
textbox: o,
|
|
7710
|
-
range:
|
|
7755
|
+
range: z
|
|
7711
7756
|
}), t = {};
|
|
7712
|
-
S !== void 0 && (t.fill = S), (C !== void 0 || w !== void 0) && (
|
|
7757
|
+
S !== void 0 && (t.fill = S), (C !== void 0 || w !== void 0) && (oe === null && (t.stroke = null), oe != null && (t.stroke = oe)), Or({
|
|
7713
7758
|
textbox: o,
|
|
7714
7759
|
lineIndices: e,
|
|
7715
7760
|
updates: t
|
|
7716
7761
|
});
|
|
7717
7762
|
}
|
|
7718
7763
|
_e && (o.initDimensions(), o.dirty = !0), (E !== void 0 || D !== void 0 || O !== void 0 || k !== void 0 || A !== void 0 || j !== void 0 || M !== void 0 || N !== void 0 || P !== void 0 || F !== void 0) && (o.dirty = !0);
|
|
7719
|
-
let ve =
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
] }), { autoExpand: ye } = o, be = p !== void 0, xe = Object.prototype.hasOwnProperty.call(
|
|
7764
|
+
let ve = Fr({ stylesList: [
|
|
7765
|
+
R,
|
|
7766
|
+
B,
|
|
7767
|
+
ae,
|
|
7768
|
+
V
|
|
7769
|
+
] }), { autoExpand: ye } = o, be = p !== void 0, xe = Object.prototype.hasOwnProperty.call(R, "width"), Se = (p ?? ye) !== !1;
|
|
7725
7770
|
be ? o.autoExpand = p !== !1 : ye === void 0 && (o.autoExpand = !0);
|
|
7726
7771
|
let Ce = Se && !xe && (fe || he || ve);
|
|
7727
7772
|
this._normalizeTextboxAfterContentChange({
|
|
7728
7773
|
textbox: o,
|
|
7729
|
-
placement:
|
|
7774
|
+
placement: re,
|
|
7730
7775
|
shouldAutoExpand: Ce
|
|
7731
7776
|
}), o.setCoords();
|
|
7732
7777
|
let we = {
|
|
7733
7778
|
withoutSave: !!r,
|
|
7734
7779
|
skipRender: !!i
|
|
7735
|
-
}, Te = !!
|
|
7780
|
+
}, Te = !!z && Object.keys(B).length > 0, Ee = {
|
|
7736
7781
|
textbox: o,
|
|
7737
7782
|
target: t,
|
|
7738
7783
|
style: n,
|
|
7739
7784
|
options: we,
|
|
7740
|
-
updates:
|
|
7741
|
-
selectionRange:
|
|
7742
|
-
selectionStyles: Te ?
|
|
7785
|
+
updates: R,
|
|
7786
|
+
selectionRange: z ?? void 0,
|
|
7787
|
+
selectionStyles: Te ? B : void 0
|
|
7743
7788
|
};
|
|
7744
7789
|
u.fire("editor:before:text-updated", Ee), i || u.requestRenderAll();
|
|
7745
7790
|
let De = e._getSnapshot(o);
|
|
@@ -7798,7 +7843,7 @@ var Ur = class {
|
|
|
7798
7843
|
clampToMontage: r
|
|
7799
7844
|
}));
|
|
7800
7845
|
let a = !1;
|
|
7801
|
-
i || (a =
|
|
7846
|
+
i || (a = Ir({ textbox: e }));
|
|
7802
7847
|
let o = !1;
|
|
7803
7848
|
return !i && t && (this.editor.canvasManager.applyObjectPlacement({
|
|
7804
7849
|
object: e,
|
|
@@ -7812,15 +7857,15 @@ var Ur = class {
|
|
|
7812
7857
|
_syncLineFontDefaultsOnTextChanged({ textbox: e }) {
|
|
7813
7858
|
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;
|
|
7814
7859
|
if (h !== 0 && n && Object.keys(n).length) {
|
|
7815
|
-
let e =
|
|
7860
|
+
let e = Qr({
|
|
7816
7861
|
previous: d,
|
|
7817
7862
|
next: u
|
|
7818
|
-
}), t =
|
|
7863
|
+
}), t = $r({
|
|
7819
7864
|
text: d,
|
|
7820
7865
|
charIndex: e
|
|
7821
7866
|
});
|
|
7822
7867
|
if (h > 0) {
|
|
7823
|
-
let r =
|
|
7868
|
+
let r = ei({
|
|
7824
7869
|
text: d,
|
|
7825
7870
|
lineIndex: t
|
|
7826
7871
|
}), i = t + 1;
|
|
@@ -7861,7 +7906,7 @@ var Ur = class {
|
|
|
7861
7906
|
let t = p[e] ?? "", n = g ? g[e] : void 0;
|
|
7862
7907
|
if (n && (T = n), t.length !== 0) {
|
|
7863
7908
|
if (n) {
|
|
7864
|
-
let r =
|
|
7909
|
+
let r = kr({
|
|
7865
7910
|
lineText: t,
|
|
7866
7911
|
lineStyles: S ? S[e] : void 0,
|
|
7867
7912
|
lineDefaults: n
|
|
@@ -7901,16 +7946,16 @@ var Ur = class {
|
|
|
7901
7946
|
if (!Number.isFinite(f) || f <= 0) return !1;
|
|
7902
7947
|
let p = a.split("\n").length, m = !1;
|
|
7903
7948
|
Math.abs((e.width ?? 0) - f) > .01 && (e.set({ width: f }), m = !0), e.initDimensions();
|
|
7904
|
-
let { textLines: h } = e, g = Array.isArray(h) && h.length > p, _ = Math.ceil(
|
|
7949
|
+
let { textLines: h } = e, g = Array.isArray(h) && h.length > p, _ = Math.ceil(Mr({
|
|
7905
7950
|
textbox: e,
|
|
7906
7951
|
text: a
|
|
7907
7952
|
})), v = Math.min(e.minWidth ?? 1, f), y = Math.min(f, Math.max(_, v));
|
|
7908
|
-
g && (y = f), Math.abs((e.width ?? 0) - y) > .01 && (e.set({ width: y }), e.initDimensions(), m = !0),
|
|
7953
|
+
g && (y = f), Math.abs((e.width ?? 0) - y) > .01 && (e.set({ width: y }), e.initDimensions(), m = !0), Ir({ textbox: e }) && (m = !0), t && r.applyObjectPlacement({
|
|
7909
7954
|
object: e,
|
|
7910
7955
|
placement: t
|
|
7911
7956
|
});
|
|
7912
7957
|
let b = !1;
|
|
7913
|
-
return n && (b =
|
|
7958
|
+
return n && (b = Nr({
|
|
7914
7959
|
textbox: e,
|
|
7915
7960
|
montageLeft: o,
|
|
7916
7961
|
montageRight: o + s
|
|
@@ -7968,7 +8013,7 @@ var Ur = class {
|
|
|
7968
8013
|
_getDefaultFontFamily() {
|
|
7969
8014
|
return this.fonts[0]?.family ?? "Arial";
|
|
7970
8015
|
}
|
|
7971
|
-
},
|
|
8016
|
+
}, ni = ({ x1: e, y1: t, x2: n, y2: r }) => (Math.atan2(r - t, n - e) * 180 / Math.PI + 360) % 360, ri = (e) => {
|
|
7972
8017
|
if (!e || typeof e != "object") return null;
|
|
7973
8018
|
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) => ({
|
|
7974
8019
|
color: typeof e.color == "string" ? e.color : "#000000",
|
|
@@ -7979,7 +8024,7 @@ var Ur = class {
|
|
|
7979
8024
|
let { x1: e, y1: t, x2: r, y2: i } = n;
|
|
7980
8025
|
if (typeof e == "number" && typeof t == "number" && typeof r == "number" && typeof i == "number") return {
|
|
7981
8026
|
type: "linear",
|
|
7982
|
-
angle:
|
|
8027
|
+
angle: ni({
|
|
7983
8028
|
x1: e,
|
|
7984
8029
|
y1: t,
|
|
7985
8030
|
x2: r,
|
|
@@ -8007,7 +8052,7 @@ var Ur = class {
|
|
|
8007
8052
|
};
|
|
8008
8053
|
}
|
|
8009
8054
|
return null;
|
|
8010
|
-
},
|
|
8055
|
+
}, ii = "_templateAnchorX", ai = "_templateAnchorY", oi = class t {
|
|
8011
8056
|
constructor({ editor: e }) {
|
|
8012
8057
|
this.editor = e;
|
|
8013
8058
|
}
|
|
@@ -8016,7 +8061,7 @@ var Ur = class {
|
|
|
8016
8061
|
if (!p.length) return s.emitWarning({
|
|
8017
8062
|
origin: "TemplateManager",
|
|
8018
8063
|
method: "serializeSelection",
|
|
8019
|
-
code:
|
|
8064
|
+
code: pr.TEMPLATE_MANAGER.NO_OBJECTS_SELECTED,
|
|
8020
8065
|
message: "Нет объектов для сериализации шаблона"
|
|
8021
8066
|
}), null;
|
|
8022
8067
|
let m = t._getBounds(o), h = t._getMontageSize({
|
|
@@ -8045,14 +8090,14 @@ var Ur = class {
|
|
|
8045
8090
|
if (!s?.length) return a.emitWarning({
|
|
8046
8091
|
origin: "TemplateManager",
|
|
8047
8092
|
method: "applyTemplate",
|
|
8048
|
-
code:
|
|
8093
|
+
code: pr.TEMPLATE_MANAGER.INVALID_TEMPLATE,
|
|
8049
8094
|
message: "Шаблон не содержит объектов"
|
|
8050
8095
|
}), null;
|
|
8051
8096
|
let u = t._getBounds(r);
|
|
8052
8097
|
if (!u) return a.emitWarning({
|
|
8053
8098
|
origin: "TemplateManager",
|
|
8054
8099
|
method: "applyTemplate",
|
|
8055
|
-
code:
|
|
8100
|
+
code: pr.TEMPLATE_MANAGER.INVALID_TARGET,
|
|
8056
8101
|
message: "Не удалось определить границы монтажной области"
|
|
8057
8102
|
}), null;
|
|
8058
8103
|
let d = t._getMontageSize({
|
|
@@ -8071,7 +8116,7 @@ var Ur = class {
|
|
|
8071
8116
|
if (!r.length) return a.emitWarning({
|
|
8072
8117
|
origin: "TemplateManager",
|
|
8073
8118
|
method: "applyTemplate",
|
|
8074
|
-
code:
|
|
8119
|
+
code: pr.TEMPLATE_MANAGER.INVALID_TEMPLATE,
|
|
8075
8120
|
message: "Не удалось создать объекты шаблона"
|
|
8076
8121
|
}), null;
|
|
8077
8122
|
let { backgroundObject: i, contentObjects: c } = t._extractBackgroundObject(r);
|
|
@@ -8106,7 +8151,7 @@ var Ur = class {
|
|
|
8106
8151
|
return a.emitError({
|
|
8107
8152
|
origin: "TemplateManager",
|
|
8108
8153
|
method: "applyTemplate",
|
|
8109
|
-
code:
|
|
8154
|
+
code: pr.TEMPLATE_MANAGER.APPLY_FAILED,
|
|
8110
8155
|
message: "Ошибка применения шаблона",
|
|
8111
8156
|
data: {
|
|
8112
8157
|
templateId: l,
|
|
@@ -8260,8 +8305,8 @@ var Ur = class {
|
|
|
8260
8305
|
baseHeight: a,
|
|
8261
8306
|
scale: n,
|
|
8262
8307
|
useRelativePositions: o,
|
|
8263
|
-
anchorX: t._resolveAnchor(s,
|
|
8264
|
-
anchorY: t._resolveAnchor(s,
|
|
8308
|
+
anchorX: t._resolveAnchor(s, ii),
|
|
8309
|
+
anchorY: t._resolveAnchor(s, ai)
|
|
8265
8310
|
})
|
|
8266
8311
|
}), h = f * n, g = p * n, _ = e.originX ?? "center", v = e.originY ?? "center";
|
|
8267
8312
|
e.set({
|
|
@@ -8275,7 +8320,7 @@ var Ur = class {
|
|
|
8275
8320
|
originX: _,
|
|
8276
8321
|
originY: v
|
|
8277
8322
|
}
|
|
8278
|
-
}), delete s[
|
|
8323
|
+
}), delete s[ii], delete s[ai];
|
|
8279
8324
|
}
|
|
8280
8325
|
static _getPositioningBounds({ bounds: e, baseWidth: n, baseHeight: r, scale: i, useRelativePositions: a, anchorX: o, anchorY: s }) {
|
|
8281
8326
|
if (!a) return e;
|
|
@@ -8339,7 +8384,7 @@ var Ur = class {
|
|
|
8339
8384
|
});
|
|
8340
8385
|
if (!i || !s || !o) return;
|
|
8341
8386
|
e.setCoords();
|
|
8342
|
-
let c = e, l = t._resolveAnchor(c,
|
|
8387
|
+
let c = e, l = t._resolveAnchor(c, ii), 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;
|
|
8343
8388
|
e.set("width", i), e.initDimensions();
|
|
8344
8389
|
let g = t._getLongestLineWidth({
|
|
8345
8390
|
textbox: e,
|
|
@@ -8358,7 +8403,7 @@ var Ur = class {
|
|
|
8358
8403
|
return i;
|
|
8359
8404
|
}
|
|
8360
8405
|
_serializeObject({ object: e, bounds: n, baseWidth: r, baseHeight: i }) {
|
|
8361
|
-
let a = e.toDatalessObject([...
|
|
8406
|
+
let a = e.toDatalessObject([...ce]);
|
|
8362
8407
|
if (t._isSvgObject(e)) {
|
|
8363
8408
|
let n = t._extractSvgMarkup(e);
|
|
8364
8409
|
n && (a.svgMarkup = n, delete a.objects, delete a.path);
|
|
@@ -8368,10 +8413,10 @@ var Ur = class {
|
|
|
8368
8413
|
x: (p.left - o) / d,
|
|
8369
8414
|
y: (p.top - s) / f
|
|
8370
8415
|
}, h = (u.left - o) / d, g = (u.top - s) / f, _ = h + u.width / d, v = g + u.height / f;
|
|
8371
|
-
return a[
|
|
8416
|
+
return a[ii] = t._detectAnchor({
|
|
8372
8417
|
start: h,
|
|
8373
8418
|
end: _
|
|
8374
|
-
}), a[
|
|
8419
|
+
}), a[ai] = t._detectAnchor({
|
|
8375
8420
|
start: g,
|
|
8376
8421
|
end: v
|
|
8377
8422
|
}), a.left = m.x, a.top = m.y, a;
|
|
@@ -8396,7 +8441,7 @@ var Ur = class {
|
|
|
8396
8441
|
withoutSave: !0
|
|
8397
8442
|
}), !0;
|
|
8398
8443
|
if (a === "gradient") {
|
|
8399
|
-
let e =
|
|
8444
|
+
let e = ri(r);
|
|
8400
8445
|
if (e) return n.setGradientBackground({
|
|
8401
8446
|
gradient: e,
|
|
8402
8447
|
customData: o,
|
|
@@ -8417,7 +8462,7 @@ var Ur = class {
|
|
|
8417
8462
|
r.emitWarning({
|
|
8418
8463
|
origin: "TemplateManager",
|
|
8419
8464
|
method: "applyTemplate",
|
|
8420
|
-
code:
|
|
8465
|
+
code: pr.TEMPLATE_MANAGER.APPLY_FAILED,
|
|
8421
8466
|
message: "Не удалось применить фон из шаблона",
|
|
8422
8467
|
data: e
|
|
8423
8468
|
});
|
|
@@ -8453,29 +8498,29 @@ var Ur = class {
|
|
|
8453
8498
|
enlivenObjectEnlivables(e) {
|
|
8454
8499
|
return C.enlivenObjectEnlivables(e);
|
|
8455
8500
|
}
|
|
8456
|
-
},
|
|
8457
|
-
let n =
|
|
8501
|
+
}, si = "#3D8BF4", ci = .5, li = ({ distance: e }) => Number.isFinite(e) ? Math.round(Math.max(0, e)) : 0, ui = ({ firstDistance: e, secondDistance: t }) => {
|
|
8502
|
+
let n = li({ distance: e }), r = li({ distance: t });
|
|
8458
8503
|
return {
|
|
8459
8504
|
firstDisplayDistance: n,
|
|
8460
8505
|
secondDisplayDistance: r,
|
|
8461
8506
|
displayDistanceDiff: Math.abs(n - r),
|
|
8462
8507
|
commonDisplayDistance: Math.max(n, r)
|
|
8463
8508
|
};
|
|
8464
|
-
},
|
|
8509
|
+
}, di = ({ firstStart: e, firstEnd: t, secondStart: n, secondEnd: r }) => Math.min(t, r) - Math.max(e, n), fi = ({ step: e }) => {
|
|
8465
8510
|
let t = Math.abs(e).toString(), n = t.indexOf(".");
|
|
8466
8511
|
return n === -1 ? 0 : t.slice(n + 1).length;
|
|
8467
|
-
},
|
|
8512
|
+
}, pi = ({ value: e, step: t }) => {
|
|
8468
8513
|
if (t === 0) return e;
|
|
8469
|
-
let n =
|
|
8514
|
+
let n = fi({ step: t }), r = Math.round(e / t) * t;
|
|
8470
8515
|
return Number(r.toFixed(n));
|
|
8471
|
-
},
|
|
8516
|
+
}, mi = ({ value: e, step: t }) => {
|
|
8472
8517
|
if (t === 0) return !0;
|
|
8473
|
-
let n =
|
|
8518
|
+
let n = pi({
|
|
8474
8519
|
value: e,
|
|
8475
8520
|
step: t
|
|
8476
|
-
}), r = 10 ** -(
|
|
8521
|
+
}), r = 10 ** -(fi({ step: t }) + 4);
|
|
8477
8522
|
return Math.abs(n - e) <= r;
|
|
8478
|
-
},
|
|
8523
|
+
}, hi = ({ bounds: e, axis: t }) => {
|
|
8479
8524
|
let { left: n = 0, right: r = 0, top: i = 0, bottom: a = 0 } = e;
|
|
8480
8525
|
return t === "vertical" ? {
|
|
8481
8526
|
start: i,
|
|
@@ -8484,7 +8529,7 @@ var Ur = class {
|
|
|
8484
8529
|
start: n,
|
|
8485
8530
|
end: r
|
|
8486
8531
|
};
|
|
8487
|
-
},
|
|
8532
|
+
}, gi = ({ items: e, axis: t }) => {
|
|
8488
8533
|
for (let n = 1; n < e.length; n += 1) {
|
|
8489
8534
|
let r = e[n], { bounds: i } = r, a = i[t], o = n - 1;
|
|
8490
8535
|
for (; o >= 0;) {
|
|
@@ -8494,10 +8539,10 @@ var Ur = class {
|
|
|
8494
8539
|
}
|
|
8495
8540
|
e[o + 1] = r;
|
|
8496
8541
|
}
|
|
8497
|
-
},
|
|
8542
|
+
}, _i = ({ items: e, index: t, axis: n, direction: r }) => {
|
|
8498
8543
|
let i = e[t];
|
|
8499
8544
|
if (!i) return null;
|
|
8500
|
-
let { bounds: a } = i, { start: o, end: s } =
|
|
8545
|
+
let { bounds: a } = i, { start: o, end: s } = hi({
|
|
8501
8546
|
bounds: a,
|
|
8502
8547
|
axis: n
|
|
8503
8548
|
});
|
|
@@ -8505,7 +8550,7 @@ var Ur = class {
|
|
|
8505
8550
|
for (let r = t - 1; r >= 0; --r) {
|
|
8506
8551
|
let t = e[r];
|
|
8507
8552
|
if (!t) continue;
|
|
8508
|
-
let { bounds: i } = t, { end: a } =
|
|
8553
|
+
let { bounds: i } = t, { end: a } = hi({
|
|
8509
8554
|
bounds: i,
|
|
8510
8555
|
axis: n
|
|
8511
8556
|
});
|
|
@@ -8516,26 +8561,26 @@ var Ur = class {
|
|
|
8516
8561
|
for (let r = t + 1; r < e.length; r += 1) {
|
|
8517
8562
|
let t = e[r];
|
|
8518
8563
|
if (!t) continue;
|
|
8519
|
-
let { bounds: i } = t, { start: a } =
|
|
8564
|
+
let { bounds: i } = t, { start: a } = hi({
|
|
8520
8565
|
bounds: i,
|
|
8521
8566
|
axis: n
|
|
8522
8567
|
});
|
|
8523
8568
|
if (a - s >= 0) return r;
|
|
8524
8569
|
}
|
|
8525
8570
|
return null;
|
|
8526
|
-
},
|
|
8571
|
+
}, vi = ({ items: e }) => {
|
|
8527
8572
|
for (let t = 0; t < e.length; t += 1) {
|
|
8528
8573
|
let { isActive: n } = e[t];
|
|
8529
8574
|
if (n) return t;
|
|
8530
8575
|
}
|
|
8531
8576
|
return -1;
|
|
8532
|
-
},
|
|
8577
|
+
}, yi = ({ patternAxis: e, activeRangeStart: t, activeRangeEnd: n, tolerance: r = 0 }) => {
|
|
8533
8578
|
let i = Math.min(t, n), a = Math.max(t, n);
|
|
8534
8579
|
return e >= i - r && e <= a + r;
|
|
8535
|
-
},
|
|
8580
|
+
}, bi = ({ patternStart: e, patternEnd: t, activeStart: n, activeEnd: r }) => t <= n ? "before" : e >= r ? "after" : null, xi = ({ baseOption: e, candidateOption: t }) => {
|
|
8536
8581
|
let { delta: n, guide: { distance: r } } = e, { delta: i, guide: { distance: a } } = t;
|
|
8537
8582
|
return n === i && r === a;
|
|
8538
|
-
},
|
|
8583
|
+
}, Si = ({ options: e }) => {
|
|
8539
8584
|
let t = e[0];
|
|
8540
8585
|
for (let n = 1; n < e.length; n += 1) {
|
|
8541
8586
|
let r = e[n];
|
|
@@ -8546,11 +8591,11 @@ var Ur = class {
|
|
|
8546
8591
|
r.diff === t.diff && Math.abs(r.delta) < Math.abs(t.delta) && (t = r);
|
|
8547
8592
|
}
|
|
8548
8593
|
return t;
|
|
8549
|
-
},
|
|
8594
|
+
}, Ci = ({ currentOption: e, nextOption: t }) => {
|
|
8550
8595
|
if (!e) return !0;
|
|
8551
8596
|
let { contextDistance: n, diff: r, delta: i } = e, { contextDistance: a, diff: o, delta: s } = t;
|
|
8552
8597
|
return a < n ? !0 : a > n ? !1 : o < r ? !0 : o > r ? !1 : Math.abs(s) < Math.abs(i);
|
|
8553
|
-
},
|
|
8598
|
+
}, wi = ({ options: e }) => {
|
|
8554
8599
|
let t = [], n = null, r = null;
|
|
8555
8600
|
for (let i of e) {
|
|
8556
8601
|
let { kind: e, side: a } = i;
|
|
@@ -8558,18 +8603,18 @@ var Ur = class {
|
|
|
8558
8603
|
t.push(i);
|
|
8559
8604
|
continue;
|
|
8560
8605
|
}
|
|
8561
|
-
a === "before" &&
|
|
8606
|
+
a === "before" && Ci({
|
|
8562
8607
|
currentOption: n,
|
|
8563
8608
|
nextOption: i
|
|
8564
|
-
}) && (n = i), a === "after" &&
|
|
8609
|
+
}) && (n = i), a === "after" && Ci({
|
|
8565
8610
|
currentOption: r,
|
|
8566
8611
|
nextOption: i
|
|
8567
8612
|
}) && (r = i);
|
|
8568
8613
|
}
|
|
8569
8614
|
return n && t.push(n), r && t.push(r), t;
|
|
8570
|
-
},
|
|
8615
|
+
}, Ti = ({ options: e, side: t, baseOption: n }) => {
|
|
8571
8616
|
let r = null;
|
|
8572
|
-
for (let i of e) if (i.side === t &&
|
|
8617
|
+
for (let i of e) if (i.side === t && xi({
|
|
8573
8618
|
baseOption: n,
|
|
8574
8619
|
candidateOption: i
|
|
8575
8620
|
})) {
|
|
@@ -8580,63 +8625,63 @@ var Ur = class {
|
|
|
8580
8625
|
!r || i.diff !== r.diff || Math.abs(i.delta) < Math.abs(r.delta) && (r = i);
|
|
8581
8626
|
}
|
|
8582
8627
|
return r;
|
|
8583
|
-
},
|
|
8628
|
+
}, Ei = ({ option: e }) => {
|
|
8584
8629
|
let { side: t, kind: n, guide: { distance: r } } = e;
|
|
8585
8630
|
return {
|
|
8586
8631
|
side: t,
|
|
8587
8632
|
kind: n,
|
|
8588
8633
|
distance: r
|
|
8589
8634
|
};
|
|
8590
|
-
},
|
|
8635
|
+
}, Di = ({ option: e, context: t }) => {
|
|
8591
8636
|
let { side: n, kind: r, distance: i } = t, { side: a, kind: o, guide: { distance: s } } = e;
|
|
8592
8637
|
return n !== a || r !== o ? !1 : Math.abs(s - i) <= 1;
|
|
8593
|
-
},
|
|
8638
|
+
}, Oi = ({ options: e, context: t }) => {
|
|
8594
8639
|
if (!t) return null;
|
|
8595
|
-
for (let n of e) if (
|
|
8640
|
+
for (let n of e) if (Di({
|
|
8596
8641
|
option: n,
|
|
8597
8642
|
context: t
|
|
8598
8643
|
})) return n;
|
|
8599
8644
|
return null;
|
|
8600
|
-
},
|
|
8601
|
-
let i =
|
|
8645
|
+
}, ki = ({ options: e, bestOption: t, previousContext: n, switchDistance: r = 0 }) => {
|
|
8646
|
+
let i = Oi({
|
|
8602
8647
|
options: e,
|
|
8603
8648
|
context: n
|
|
8604
8649
|
});
|
|
8605
8650
|
if (!i) return t;
|
|
8606
8651
|
let a = Math.max(0, r);
|
|
8607
8652
|
return a === 0 || Math.abs(t.delta - i.delta) >= a ? t : i;
|
|
8608
|
-
},
|
|
8653
|
+
}, Ai = ({ guides: e, seenGuideKeys: t, guide: n }) => {
|
|
8609
8654
|
let { type: r, axis: i, refStart: a, refEnd: o, activeStart: s, activeEnd: c, distance: l } = n, u = `${r}:${i}:${a}:${o}:${s}:${c}:${l}`;
|
|
8610
8655
|
t.has(u) || (t.add(u), e.push(n));
|
|
8611
|
-
},
|
|
8656
|
+
}, ji = ({ options: e, previousContext: t = null, switchDistance: n = 0 }) => {
|
|
8612
8657
|
if (!e.length) return {
|
|
8613
8658
|
delta: 0,
|
|
8614
8659
|
guides: [],
|
|
8615
8660
|
context: null
|
|
8616
8661
|
};
|
|
8617
|
-
let r =
|
|
8662
|
+
let r = wi({ options: e }), i = [];
|
|
8618
8663
|
for (let e of r) e.kind === "reference" && i.push(e);
|
|
8619
|
-
let a = i.length > 0, o = a ? i : r, s =
|
|
8664
|
+
let a = i.length > 0, o = a ? i : r, s = ki({
|
|
8620
8665
|
options: o,
|
|
8621
|
-
bestOption:
|
|
8666
|
+
bestOption: Si({ options: o }),
|
|
8622
8667
|
previousContext: t,
|
|
8623
8668
|
switchDistance: n
|
|
8624
|
-
}), c =
|
|
8669
|
+
}), c = Ti({
|
|
8625
8670
|
options: o,
|
|
8626
8671
|
side: "before",
|
|
8627
8672
|
baseOption: s
|
|
8628
|
-
}), l =
|
|
8673
|
+
}), l = Ti({
|
|
8629
8674
|
options: o,
|
|
8630
8675
|
side: "after",
|
|
8631
8676
|
baseOption: s
|
|
8632
|
-
}), u =
|
|
8677
|
+
}), u = Ti({
|
|
8633
8678
|
options: a ? r : o,
|
|
8634
8679
|
side: "center",
|
|
8635
8680
|
baseOption: s
|
|
8636
8681
|
}), d = [];
|
|
8637
8682
|
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);
|
|
8638
8683
|
let f = [], p = /* @__PURE__ */ new Set();
|
|
8639
|
-
for (let e of d)
|
|
8684
|
+
for (let e of d) Ai({
|
|
8640
8685
|
guides: f,
|
|
8641
8686
|
seenGuideKeys: p,
|
|
8642
8687
|
guide: e.guide
|
|
@@ -8644,15 +8689,15 @@ var Ur = class {
|
|
|
8644
8689
|
return {
|
|
8645
8690
|
delta: s.delta,
|
|
8646
8691
|
guides: f,
|
|
8647
|
-
context:
|
|
8692
|
+
context: Ei({ option: s })
|
|
8648
8693
|
};
|
|
8649
|
-
},
|
|
8650
|
-
let s = n - (e - r), c =
|
|
8694
|
+
}, Mi = ({ activeStart: e, activeEnd: t, targetGap: n, beforeEdge: r, afterEdge: i, threshold: a, step: o }) => {
|
|
8695
|
+
let s = n - (e - r), c = pi({
|
|
8651
8696
|
value: s,
|
|
8652
8697
|
step: o
|
|
8653
8698
|
}), l = Math.max(1, Math.ceil(a / Math.max(o, 1))), u = null;
|
|
8654
8699
|
for (let d = -l; d <= l; d += 1) {
|
|
8655
|
-
let l = c + d * o, f = e + l, p = t + l, m = f - r, h = i - p, { displayDistanceDiff: g, commonDisplayDistance: _ } =
|
|
8700
|
+
let l = c + d * o, f = e + l, p = t + l, m = f - r, h = i - p, { displayDistanceDiff: g, commonDisplayDistance: _ } = ui({
|
|
8656
8701
|
firstDistance: m,
|
|
8657
8702
|
secondDistance: h
|
|
8658
8703
|
});
|
|
@@ -8667,13 +8712,13 @@ var Ur = class {
|
|
|
8667
8712
|
});
|
|
8668
8713
|
}
|
|
8669
8714
|
return u;
|
|
8670
|
-
},
|
|
8671
|
-
let { secondDisplayDistance: n, displayDistanceDiff: r } =
|
|
8715
|
+
}, Ni = ({ currentGap: e, referenceGap: t }) => {
|
|
8716
|
+
let { secondDisplayDistance: n, displayDistanceDiff: r } = ui({
|
|
8672
8717
|
firstDistance: e,
|
|
8673
8718
|
secondDistance: t
|
|
8674
8719
|
});
|
|
8675
8720
|
return r > 1 ? null : n;
|
|
8676
|
-
},
|
|
8721
|
+
}, Pi = ({ anchors: e, positions: t, threshold: n }) => {
|
|
8677
8722
|
let r = 0, i = n + 1, a = null;
|
|
8678
8723
|
for (let o of t) for (let t of e) {
|
|
8679
8724
|
let e = Math.abs(t - o);
|
|
@@ -8683,8 +8728,8 @@ var Ur = class {
|
|
|
8683
8728
|
delta: r,
|
|
8684
8729
|
guidePosition: a
|
|
8685
8730
|
};
|
|
8686
|
-
},
|
|
8687
|
-
let { left: r, right: i, centerX: a, top: o, bottom: s, centerY: c } = e, l =
|
|
8731
|
+
}, Fi = ({ activeBounds: e, threshold: t, anchors: n }) => {
|
|
8732
|
+
let { left: r, right: i, centerX: a, top: o, bottom: s, centerY: c } = e, l = Pi({
|
|
8688
8733
|
anchors: n.vertical,
|
|
8689
8734
|
positions: [
|
|
8690
8735
|
r,
|
|
@@ -8692,7 +8737,7 @@ var Ur = class {
|
|
|
8692
8737
|
i
|
|
8693
8738
|
],
|
|
8694
8739
|
threshold: t
|
|
8695
|
-
}), u =
|
|
8740
|
+
}), u = Pi({
|
|
8696
8741
|
anchors: n.horizontal,
|
|
8697
8742
|
positions: [
|
|
8698
8743
|
o,
|
|
@@ -8712,11 +8757,11 @@ var Ur = class {
|
|
|
8712
8757
|
deltaY: u.delta,
|
|
8713
8758
|
guides: d
|
|
8714
8759
|
};
|
|
8715
|
-
},
|
|
8760
|
+
}, Ii = ({ activeBounds: e, candidates: t, threshold: n, patterns: r, previousContext: i = null, switchDistance: a = 0 }) => {
|
|
8716
8761
|
let { centerX: o, top: s, bottom: c, left: l, right: u } = e, d = [];
|
|
8717
8762
|
for (let e of t) {
|
|
8718
8763
|
let { left: t, right: n } = e;
|
|
8719
|
-
|
|
8764
|
+
di({
|
|
8720
8765
|
firstStart: t,
|
|
8721
8766
|
firstEnd: n,
|
|
8722
8767
|
secondStart: l,
|
|
@@ -8736,22 +8781,22 @@ var Ur = class {
|
|
|
8736
8781
|
f.push({
|
|
8737
8782
|
bounds: e,
|
|
8738
8783
|
isActive: !0
|
|
8739
|
-
}),
|
|
8784
|
+
}), gi({
|
|
8740
8785
|
items: f,
|
|
8741
8786
|
axis: "top"
|
|
8742
8787
|
});
|
|
8743
|
-
let p =
|
|
8788
|
+
let p = vi({ items: f });
|
|
8744
8789
|
if (p === -1) return {
|
|
8745
8790
|
delta: 0,
|
|
8746
8791
|
guides: [],
|
|
8747
8792
|
context: null
|
|
8748
8793
|
};
|
|
8749
|
-
let m = [], h = c - s, g =
|
|
8794
|
+
let m = [], h = c - s, g = _i({
|
|
8750
8795
|
items: f,
|
|
8751
8796
|
index: p,
|
|
8752
8797
|
axis: "vertical",
|
|
8753
8798
|
direction: "prev"
|
|
8754
|
-
}), _ =
|
|
8799
|
+
}), _ = _i({
|
|
8755
8800
|
items: f,
|
|
8756
8801
|
index: p,
|
|
8757
8802
|
axis: "vertical",
|
|
@@ -8760,19 +8805,19 @@ var Ur = class {
|
|
|
8760
8805
|
if (v && y) {
|
|
8761
8806
|
let { bounds: e } = v, { bounds: t } = y, { bottom: r } = e, { top: i } = t, a = i - r - h;
|
|
8762
8807
|
if (a >= 0) {
|
|
8763
|
-
let e =
|
|
8808
|
+
let e = pi({
|
|
8764
8809
|
value: a / 2,
|
|
8765
8810
|
step: 1
|
|
8766
8811
|
}), t = s - r, l = i - c, u = Math.abs(t - e), d = Math.abs(l - e);
|
|
8767
8812
|
if (Math.max(u, d) <= n) {
|
|
8768
|
-
let t =
|
|
8813
|
+
let t = Mi({
|
|
8769
8814
|
activeStart: s,
|
|
8770
8815
|
activeEnd: c,
|
|
8771
8816
|
targetGap: e,
|
|
8772
8817
|
beforeEdge: r,
|
|
8773
8818
|
afterEdge: i,
|
|
8774
8819
|
threshold: n,
|
|
8775
|
-
step:
|
|
8820
|
+
step: ci
|
|
8776
8821
|
});
|
|
8777
8822
|
if (t) {
|
|
8778
8823
|
let { delta: e, distance: n, diff: i, activeStart: a, activeEnd: s } = t, c = {
|
|
@@ -8809,16 +8854,16 @@ var Ur = class {
|
|
|
8809
8854
|
}
|
|
8810
8855
|
for (let e of r) {
|
|
8811
8856
|
let { axis: t, start: r, end: i, distance: a } = e;
|
|
8812
|
-
if (!
|
|
8857
|
+
if (!mi({
|
|
8813
8858
|
value: a,
|
|
8814
8859
|
step: .5
|
|
8815
|
-
}) || !
|
|
8860
|
+
}) || !yi({
|
|
8816
8861
|
patternAxis: t,
|
|
8817
8862
|
activeRangeStart: l,
|
|
8818
8863
|
activeRangeEnd: u,
|
|
8819
8864
|
tolerance: n
|
|
8820
8865
|
})) continue;
|
|
8821
|
-
let d =
|
|
8866
|
+
let d = bi({
|
|
8822
8867
|
patternStart: r,
|
|
8823
8868
|
patternEnd: i,
|
|
8824
8869
|
activeStart: s,
|
|
@@ -8826,12 +8871,12 @@ var Ur = class {
|
|
|
8826
8871
|
});
|
|
8827
8872
|
if (d) {
|
|
8828
8873
|
if (b !== null && S && d === "before" && Math.abs(b - a) <= n) {
|
|
8829
|
-
let e =
|
|
8874
|
+
let e = pi({
|
|
8830
8875
|
value: a - b,
|
|
8831
8876
|
step: 1
|
|
8832
8877
|
}), t = s + e, { bottom: c } = S, l = t - c, u = Math.abs(l - a);
|
|
8833
8878
|
if (u > n) continue;
|
|
8834
|
-
let d =
|
|
8879
|
+
let d = Ni({
|
|
8835
8880
|
currentGap: l,
|
|
8836
8881
|
referenceGap: a
|
|
8837
8882
|
});
|
|
@@ -8855,12 +8900,12 @@ var Ur = class {
|
|
|
8855
8900
|
});
|
|
8856
8901
|
}
|
|
8857
8902
|
if (x !== null && C && d === "after" && Math.abs(x - a) <= n) {
|
|
8858
|
-
let e =
|
|
8903
|
+
let e = pi({
|
|
8859
8904
|
value: x - a,
|
|
8860
8905
|
step: 1
|
|
8861
8906
|
}), t = c + e, { top: s } = C, l = s - t, u = Math.abs(l - a);
|
|
8862
8907
|
if (u > n) continue;
|
|
8863
|
-
let d =
|
|
8908
|
+
let d = Ni({
|
|
8864
8909
|
currentGap: l,
|
|
8865
8910
|
referenceGap: a
|
|
8866
8911
|
});
|
|
@@ -8885,16 +8930,16 @@ var Ur = class {
|
|
|
8885
8930
|
}
|
|
8886
8931
|
}
|
|
8887
8932
|
}
|
|
8888
|
-
return
|
|
8933
|
+
return ji({
|
|
8889
8934
|
options: m,
|
|
8890
8935
|
previousContext: i,
|
|
8891
8936
|
switchDistance: a
|
|
8892
8937
|
});
|
|
8893
|
-
},
|
|
8938
|
+
}, Li = ({ activeBounds: e, candidates: t, threshold: n, patterns: r, previousContext: i = null, switchDistance: a = 0 }) => {
|
|
8894
8939
|
let { centerY: o, left: s, right: c, top: l, bottom: u } = e, d = [];
|
|
8895
8940
|
for (let e of t) {
|
|
8896
8941
|
let { top: t, bottom: n } = e;
|
|
8897
|
-
|
|
8942
|
+
di({
|
|
8898
8943
|
firstStart: t,
|
|
8899
8944
|
firstEnd: n,
|
|
8900
8945
|
secondStart: l,
|
|
@@ -8914,22 +8959,22 @@ var Ur = class {
|
|
|
8914
8959
|
f.push({
|
|
8915
8960
|
bounds: e,
|
|
8916
8961
|
isActive: !0
|
|
8917
|
-
}),
|
|
8962
|
+
}), gi({
|
|
8918
8963
|
items: f,
|
|
8919
8964
|
axis: "left"
|
|
8920
8965
|
});
|
|
8921
|
-
let p =
|
|
8966
|
+
let p = vi({ items: f });
|
|
8922
8967
|
if (p === -1) return {
|
|
8923
8968
|
delta: 0,
|
|
8924
8969
|
guides: [],
|
|
8925
8970
|
context: null
|
|
8926
8971
|
};
|
|
8927
|
-
let m = [], h = c - s, g =
|
|
8972
|
+
let m = [], h = c - s, g = _i({
|
|
8928
8973
|
items: f,
|
|
8929
8974
|
index: p,
|
|
8930
8975
|
axis: "horizontal",
|
|
8931
8976
|
direction: "prev"
|
|
8932
|
-
}), _ =
|
|
8977
|
+
}), _ = _i({
|
|
8933
8978
|
items: f,
|
|
8934
8979
|
index: p,
|
|
8935
8980
|
axis: "horizontal",
|
|
@@ -8938,19 +8983,19 @@ var Ur = class {
|
|
|
8938
8983
|
if (v && y) {
|
|
8939
8984
|
let { bounds: e } = v, { bounds: t } = y, { right: r } = e, { left: i } = t, a = i - r - h;
|
|
8940
8985
|
if (a >= 0) {
|
|
8941
|
-
let e =
|
|
8986
|
+
let e = pi({
|
|
8942
8987
|
value: a / 2,
|
|
8943
8988
|
step: 1
|
|
8944
8989
|
}), t = s - r, l = i - c, u = Math.abs(t - e), d = Math.abs(l - e);
|
|
8945
8990
|
if (Math.max(u, d) <= n) {
|
|
8946
|
-
let t =
|
|
8991
|
+
let t = Mi({
|
|
8947
8992
|
activeStart: s,
|
|
8948
8993
|
activeEnd: c,
|
|
8949
8994
|
targetGap: e,
|
|
8950
8995
|
beforeEdge: r,
|
|
8951
8996
|
afterEdge: i,
|
|
8952
8997
|
threshold: n,
|
|
8953
|
-
step:
|
|
8998
|
+
step: ci
|
|
8954
8999
|
});
|
|
8955
9000
|
if (t) {
|
|
8956
9001
|
let { delta: e, distance: n, diff: i, activeStart: a, activeEnd: s } = t, c = {
|
|
@@ -8987,16 +9032,16 @@ var Ur = class {
|
|
|
8987
9032
|
}
|
|
8988
9033
|
for (let e of r) {
|
|
8989
9034
|
let { axis: t, start: r, end: i, distance: a } = e;
|
|
8990
|
-
if (!
|
|
9035
|
+
if (!mi({
|
|
8991
9036
|
value: a,
|
|
8992
9037
|
step: .5
|
|
8993
|
-
}) || !
|
|
9038
|
+
}) || !yi({
|
|
8994
9039
|
patternAxis: t,
|
|
8995
9040
|
activeRangeStart: l,
|
|
8996
9041
|
activeRangeEnd: u,
|
|
8997
9042
|
tolerance: n
|
|
8998
9043
|
})) continue;
|
|
8999
|
-
let d =
|
|
9044
|
+
let d = bi({
|
|
9000
9045
|
patternStart: r,
|
|
9001
9046
|
patternEnd: i,
|
|
9002
9047
|
activeStart: s,
|
|
@@ -9004,12 +9049,12 @@ var Ur = class {
|
|
|
9004
9049
|
});
|
|
9005
9050
|
if (d) {
|
|
9006
9051
|
if (b !== null && S && d === "before" && Math.abs(b - a) <= n) {
|
|
9007
|
-
let e =
|
|
9052
|
+
let e = pi({
|
|
9008
9053
|
value: a - b,
|
|
9009
9054
|
step: 1
|
|
9010
9055
|
}), t = s + e, { right: c } = S, l = t - c, u = Math.abs(l - a);
|
|
9011
9056
|
if (u > n) continue;
|
|
9012
|
-
let d =
|
|
9057
|
+
let d = Ni({
|
|
9013
9058
|
currentGap: l,
|
|
9014
9059
|
referenceGap: a
|
|
9015
9060
|
});
|
|
@@ -9033,12 +9078,12 @@ var Ur = class {
|
|
|
9033
9078
|
});
|
|
9034
9079
|
}
|
|
9035
9080
|
if (x !== null && C && d === "after" && Math.abs(x - a) <= n) {
|
|
9036
|
-
let e =
|
|
9081
|
+
let e = pi({
|
|
9037
9082
|
value: x - a,
|
|
9038
9083
|
step: 1
|
|
9039
9084
|
}), t = c + e, { left: s } = C, l = s - t, u = Math.abs(l - a);
|
|
9040
9085
|
if (u > n) continue;
|
|
9041
|
-
let d =
|
|
9086
|
+
let d = Ni({
|
|
9042
9087
|
currentGap: l,
|
|
9043
9088
|
referenceGap: a
|
|
9044
9089
|
});
|
|
@@ -9063,20 +9108,20 @@ var Ur = class {
|
|
|
9063
9108
|
}
|
|
9064
9109
|
}
|
|
9065
9110
|
}
|
|
9066
|
-
return
|
|
9111
|
+
return ji({
|
|
9067
9112
|
options: m,
|
|
9068
9113
|
previousContext: i,
|
|
9069
9114
|
switchDistance: a
|
|
9070
9115
|
});
|
|
9071
|
-
},
|
|
9072
|
-
let { vertical: o = null, horizontal: s = null } = i ?? {}, c =
|
|
9116
|
+
}, Ri = ({ activeBounds: e, candidates: t, threshold: n, spacingPatterns: r, previousContexts: i, switchDistance: a = 0 }) => {
|
|
9117
|
+
let { vertical: o = null, horizontal: s = null } = i ?? {}, c = Ii({
|
|
9073
9118
|
activeBounds: e,
|
|
9074
9119
|
candidates: t,
|
|
9075
9120
|
threshold: n,
|
|
9076
9121
|
patterns: r.vertical,
|
|
9077
9122
|
previousContext: o,
|
|
9078
9123
|
switchDistance: a
|
|
9079
|
-
}), l =
|
|
9124
|
+
}), l = Li({
|
|
9080
9125
|
activeBounds: e,
|
|
9081
9126
|
candidates: t,
|
|
9082
9127
|
threshold: n,
|
|
@@ -9095,14 +9140,14 @@ var Ur = class {
|
|
|
9095
9140
|
horizontal: l.context
|
|
9096
9141
|
}
|
|
9097
9142
|
};
|
|
9098
|
-
},
|
|
9143
|
+
}, zi = ({ context: e, x: t, y: n, width: r, height: i, radius: a }) => {
|
|
9099
9144
|
let o = Math.min(a, r / 2, i / 2);
|
|
9100
9145
|
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();
|
|
9101
|
-
},
|
|
9146
|
+
}, Bi = ({ 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 }) => {
|
|
9102
9147
|
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;
|
|
9103
9148
|
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";
|
|
9104
9149
|
let S = e.measureText(a).width + _ * 2, C = g + _ * 2, w = b - S / 2, T = x - C / 2;
|
|
9105
|
-
e.beginPath(),
|
|
9150
|
+
e.beginPath(), zi({
|
|
9106
9151
|
context: e,
|
|
9107
9152
|
x: w,
|
|
9108
9153
|
y: T,
|
|
@@ -9110,11 +9155,11 @@ var Ur = class {
|
|
|
9110
9155
|
height: C,
|
|
9111
9156
|
radius: v
|
|
9112
9157
|
}), e.fill(), e.fillStyle = c, e.fillText(a, b, x), e.restore();
|
|
9113
|
-
},
|
|
9114
|
-
let { type: r, axis: i, refStart: a, refEnd: o, activeStart: s, activeEnd: c, distance: l } = t, u =
|
|
9158
|
+
}, Vi = ({ context: e, guide: t, zoom: n }) => {
|
|
9159
|
+
let { type: r, axis: i, refStart: a, refEnd: o, activeStart: s, activeEnd: c, distance: l } = t, u = li({ distance: l }).toString();
|
|
9115
9160
|
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();
|
|
9116
|
-
let d =
|
|
9117
|
-
|
|
9161
|
+
let d = si;
|
|
9162
|
+
Bi({
|
|
9118
9163
|
context: e,
|
|
9119
9164
|
type: r,
|
|
9120
9165
|
axis: i,
|
|
@@ -9124,7 +9169,7 @@ var Ur = class {
|
|
|
9124
9169
|
zoom: n,
|
|
9125
9170
|
color: d,
|
|
9126
9171
|
lineWidth: 1
|
|
9127
|
-
}),
|
|
9172
|
+
}), Bi({
|
|
9128
9173
|
context: e,
|
|
9129
9174
|
type: r,
|
|
9130
9175
|
axis: i,
|
|
@@ -9135,10 +9180,10 @@ var Ur = class {
|
|
|
9135
9180
|
color: d,
|
|
9136
9181
|
lineWidth: 1
|
|
9137
9182
|
});
|
|
9138
|
-
},
|
|
9183
|
+
}, Hi = ({ anchors: e, bounds: t }) => {
|
|
9139
9184
|
let { left: n, right: r, centerX: i, top: a, bottom: o, centerY: s } = t;
|
|
9140
9185
|
e.vertical.push(n, i, r), e.horizontal.push(a, s, o);
|
|
9141
|
-
},
|
|
9186
|
+
}, Ui = ({ bounds: e, type: t, primaryStart: n, primaryEnd: r }) => {
|
|
9142
9187
|
let i = [], a = n === "top" ? "left" : "top", o = r === "bottom" ? "right" : "bottom", s = [...e].sort((e, t) => e[n] - t[n]);
|
|
9143
9188
|
for (let e = 0; e < s.length; e += 1) {
|
|
9144
9189
|
let c = s[e], l = null, u = Infinity;
|
|
@@ -9159,35 +9204,35 @@ var Ur = class {
|
|
|
9159
9204
|
});
|
|
9160
9205
|
}
|
|
9161
9206
|
return i;
|
|
9162
|
-
},
|
|
9163
|
-
vertical:
|
|
9207
|
+
}, Wi = ({ bounds: e }) => ({
|
|
9208
|
+
vertical: Ui({
|
|
9164
9209
|
bounds: e,
|
|
9165
9210
|
axis: "centerX",
|
|
9166
9211
|
type: "vertical",
|
|
9167
9212
|
primaryStart: "top",
|
|
9168
9213
|
primaryEnd: "bottom"
|
|
9169
9214
|
}),
|
|
9170
|
-
horizontal:
|
|
9215
|
+
horizontal: Ui({
|
|
9171
9216
|
bounds: e,
|
|
9172
9217
|
axis: "centerY",
|
|
9173
9218
|
type: "horizontal",
|
|
9174
9219
|
primaryStart: "left",
|
|
9175
9220
|
primaryEnd: "right"
|
|
9176
9221
|
})
|
|
9177
|
-
}),
|
|
9222
|
+
}), Gi = [
|
|
9178
9223
|
"montage-area",
|
|
9179
9224
|
"background",
|
|
9180
9225
|
"interaction-blocker"
|
|
9181
|
-
],
|
|
9226
|
+
], Ki = ({ activeObject: t }) => {
|
|
9182
9227
|
let n = /* @__PURE__ */ new Set();
|
|
9183
9228
|
return t ? (n.add(t), t instanceof e && t.getObjects().forEach((e) => n.add(e)), n) : n;
|
|
9184
|
-
},
|
|
9229
|
+
}, qi = ({ object: e, excluded: t, ignoredIds: n = Gi }) => {
|
|
9185
9230
|
if (t.has(e)) return !0;
|
|
9186
9231
|
let { visible: r = !0 } = e;
|
|
9187
9232
|
if (!r) return !0;
|
|
9188
9233
|
let { id: i } = e;
|
|
9189
9234
|
return !!(i && n.includes(i));
|
|
9190
|
-
},
|
|
9235
|
+
}, Ji = class e {
|
|
9191
9236
|
constructor({ editor: e }) {
|
|
9192
9237
|
this.anchors = {
|
|
9193
9238
|
vertical: [],
|
|
@@ -9240,7 +9285,7 @@ var Ur = class {
|
|
|
9240
9285
|
this._clearSpacingContexts(), this._clearGuides();
|
|
9241
9286
|
return;
|
|
9242
9287
|
}
|
|
9243
|
-
let { canvas: o } = this, s = o.getZoom() || 1, c = 5 / s, { deltaX: l, deltaY: u } =
|
|
9288
|
+
let { canvas: o } = this, s = o.getZoom() || 1, c = 5 / s, { deltaX: l, deltaY: u } = Fi({
|
|
9244
9289
|
activeBounds: a,
|
|
9245
9290
|
threshold: c,
|
|
9246
9291
|
anchors: this.anchors
|
|
@@ -9252,7 +9297,7 @@ var Ur = class {
|
|
|
9252
9297
|
top: t + u
|
|
9253
9298
|
}), n.setCoords(), a = W({ object: n }) ?? a;
|
|
9254
9299
|
}
|
|
9255
|
-
let d = this._resolveCurrentTargetBounds({ activeObject: n }), f = this.spacingContexts.vertical || this.spacingContexts.horizontal ? 10 / s : c, p =
|
|
9300
|
+
let d = this._resolveCurrentTargetBounds({ activeObject: n }), f = this.spacingContexts.vertical || this.spacingContexts.horizontal ? 10 / s : c, p = Ri({
|
|
9256
9301
|
activeBounds: a,
|
|
9257
9302
|
candidates: d,
|
|
9258
9303
|
threshold: f,
|
|
@@ -9273,11 +9318,11 @@ var Ur = class {
|
|
|
9273
9318
|
target: n,
|
|
9274
9319
|
transform: i
|
|
9275
9320
|
});
|
|
9276
|
-
let h = W({ object: n }) ?? a, g =
|
|
9321
|
+
let h = W({ object: n }) ?? a, g = Fi({
|
|
9277
9322
|
activeBounds: h,
|
|
9278
9323
|
threshold: c,
|
|
9279
9324
|
anchors: this.anchors
|
|
9280
|
-
}), _ =
|
|
9325
|
+
}), _ = Ri({
|
|
9281
9326
|
activeBounds: h,
|
|
9282
9327
|
candidates: d,
|
|
9283
9328
|
threshold: c,
|
|
@@ -9508,9 +9553,9 @@ var Ur = class {
|
|
|
9508
9553
|
let { canvas: e, guideBounds: t } = this, n = e.getSelectionContext();
|
|
9509
9554
|
if (!n) return;
|
|
9510
9555
|
let { left: r, right: i, top: a, bottom: o } = t ?? this._calculateViewportBounds(), { viewportTransform: s } = e, c = e.getZoom() || 1;
|
|
9511
|
-
n.save(), Array.isArray(s) && n.transform(...s), n.lineWidth = 1 / c, n.strokeStyle =
|
|
9556
|
+
n.save(), Array.isArray(s) && n.transform(...s), n.lineWidth = 1 / c, n.strokeStyle = si, n.setLineDash([4, 4]);
|
|
9512
9557
|
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();
|
|
9513
|
-
for (let e of this.activeSpacingGuides)
|
|
9558
|
+
for (let e of this.activeSpacingGuides) Vi({
|
|
9514
9559
|
context: n,
|
|
9515
9560
|
guide: e,
|
|
9516
9561
|
zoom: c
|
|
@@ -9721,14 +9766,14 @@ var Ur = class {
|
|
|
9721
9766
|
}, r = [];
|
|
9722
9767
|
for (let e of t) {
|
|
9723
9768
|
let t = W({ object: e });
|
|
9724
|
-
t && (
|
|
9769
|
+
t && (Hi({
|
|
9725
9770
|
anchors: n,
|
|
9726
9771
|
bounds: t
|
|
9727
9772
|
}), r.push(t));
|
|
9728
9773
|
}
|
|
9729
9774
|
let { montageArea: i } = this.editor, a = W({ object: i });
|
|
9730
9775
|
if (a) {
|
|
9731
|
-
|
|
9776
|
+
Hi({
|
|
9732
9777
|
anchors: n,
|
|
9733
9778
|
bounds: a
|
|
9734
9779
|
});
|
|
@@ -9740,12 +9785,12 @@ var Ur = class {
|
|
|
9740
9785
|
bottom: i
|
|
9741
9786
|
};
|
|
9742
9787
|
} else this.guideBounds = this._calculateViewportBounds();
|
|
9743
|
-
this.anchors = n, this.spacingPatterns =
|
|
9788
|
+
this.anchors = n, this.spacingPatterns = Wi({ bounds: r }), this.cachedTargetBounds = r;
|
|
9744
9789
|
}
|
|
9745
9790
|
_collectTargets({ activeObject: e }) {
|
|
9746
|
-
let t =
|
|
9791
|
+
let t = Ki({ activeObject: e }), n = [];
|
|
9747
9792
|
return this.canvas.forEachObject((e) => {
|
|
9748
|
-
|
|
9793
|
+
qi({
|
|
9749
9794
|
object: e,
|
|
9750
9795
|
excluded: t
|
|
9751
9796
|
}) || n.push(e);
|
|
@@ -9768,7 +9813,7 @@ var Ur = class {
|
|
|
9768
9813
|
bottom: (r - s) / a
|
|
9769
9814
|
};
|
|
9770
9815
|
}
|
|
9771
|
-
},
|
|
9816
|
+
}, Yi = "#3D8BF4", Xi = class e {
|
|
9772
9817
|
constructor({ editor: e }) {
|
|
9773
9818
|
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();
|
|
9774
9819
|
}
|
|
@@ -9861,8 +9906,8 @@ var Ur = class {
|
|
|
9861
9906
|
this.isTargetMontageArea = l, this.activeGuides = d, this._hideToolbar(), n.requestRenderAll();
|
|
9862
9907
|
}
|
|
9863
9908
|
static _resolveTarget({ event: e, activeObject: t }) {
|
|
9864
|
-
let { target: n } = e, r =
|
|
9865
|
-
return n && !
|
|
9909
|
+
let { target: n } = e, r = Ki({ activeObject: t });
|
|
9910
|
+
return n && !qi({
|
|
9866
9911
|
object: n,
|
|
9867
9912
|
excluded: r
|
|
9868
9913
|
}) ? n : null;
|
|
@@ -9979,18 +10024,18 @@ var Ur = class {
|
|
|
9979
10024
|
let { canvas: e } = this, t = e.getSelectionContext();
|
|
9980
10025
|
if (!t) return;
|
|
9981
10026
|
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;
|
|
9982
|
-
t.save(), Array.isArray(n) && t.transform(...n), t.lineWidth = 1 / r, t.strokeStyle =
|
|
10027
|
+
t.save(), Array.isArray(n) && t.transform(...n), t.lineWidth = 1 / r, t.strokeStyle = Yi, t.setLineDash([]);
|
|
9983
10028
|
for (let e of this.activeGuides) {
|
|
9984
10029
|
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;
|
|
9985
|
-
t.beginPath(), n === "vertical" ? (t.moveTo(i, a), t.lineTo(i, c)) : (t.moveTo(a, i), t.lineTo(c, i)), t.stroke(),
|
|
10030
|
+
t.beginPath(), n === "vertical" ? (t.moveTo(i, a), t.lineTo(i, c)) : (t.moveTo(a, i), t.lineTo(c, i)), t.stroke(), Bi({
|
|
9986
10031
|
context: t,
|
|
9987
10032
|
type: n,
|
|
9988
10033
|
axis: i,
|
|
9989
10034
|
start: a,
|
|
9990
10035
|
end: c,
|
|
9991
|
-
text:
|
|
10036
|
+
text: li({ distance: l }).toString(),
|
|
9992
10037
|
zoom: r,
|
|
9993
|
-
color:
|
|
10038
|
+
color: Yi,
|
|
9994
10039
|
lineWidth: 1,
|
|
9995
10040
|
offsetAlongAxis: d,
|
|
9996
10041
|
offsetPerpendicular: 0
|
|
@@ -10008,13 +10053,13 @@ var Ur = class {
|
|
|
10008
10053
|
let { toolbar: e } = this.editor;
|
|
10009
10054
|
e?.showAfterTemporary?.(), this.isToolbarHidden = !1;
|
|
10010
10055
|
}
|
|
10011
|
-
},
|
|
10056
|
+
}, Zi = class e {
|
|
10012
10057
|
constructor(e, t) {
|
|
10013
10058
|
this.options = t, this.containerId = e, this.editorId = `${e}-${D()}`, this.init();
|
|
10014
10059
|
}
|
|
10015
10060
|
async init() {
|
|
10016
10061
|
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;
|
|
10017
|
-
if (
|
|
10062
|
+
if (z.apply(), this.canvas = new t(this.containerId, this.options), this.moduleLoader = new A(), this.workerManager = new M(), this.errorManager = new mr({ editor: this }), this.historyManager = new Me({ editor: this }), this.toolbar = new ae({ editor: this }), this.transformManager = new Ue({ editor: this }), this.zoomManager = new We({ editor: this }), this.canvasManager = new He({ editor: this }), this.imageManager = new Re({ editor: this }), this.layerManager = new $e({ editor: this }), this.shapeManager = new sr({ editor: this }), this.interactionBlocker = new Ze({ editor: this }), this.backgroundManager = new Qe({ editor: this }), this.clipboardManager = new cr({ editor: this }), this.objectLockManager = new lr({ editor: this }), this.groupingManager = new ur({ editor: this }), this.selectionManager = new dr({ editor: this }), this.deletionManager = new fr({ editor: this }), this.panConstraintManager = new hr({ editor: this }), this.snappingManager = new Ji({ editor: this }), this.measurementManager = new Xi({ editor: this }), this.fontManager = new ie(this.options.fonts ?? []), this.textManager = new ti({ editor: this }), this.templateManager = new oi({ editor: this }), u && (this.angleIndicator = new se({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.interactionBlocker.ensureOverlay(), this.listeners = new k({
|
|
10018
10063
|
editor: this,
|
|
10019
10064
|
options: this.options
|
|
10020
10065
|
}), 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) {
|
|
@@ -10122,7 +10167,7 @@ var Ur = class {
|
|
|
10122
10167
|
"U+A640-A69F",
|
|
10123
10168
|
"U+FE2E-FE2F",
|
|
10124
10169
|
"U+2116"
|
|
10125
|
-
].join(", "),
|
|
10170
|
+
].join(", "), Qi = {
|
|
10126
10171
|
preserveObjectStacking: !0,
|
|
10127
10172
|
controlsAboveOverlay: !0,
|
|
10128
10173
|
centeredRotation: !0,
|
|
@@ -10976,20 +11021,20 @@ var Ur = class {
|
|
|
10976
11021
|
};
|
|
10977
11022
|
//#endregion
|
|
10978
11023
|
//#region src/main.ts
|
|
10979
|
-
function
|
|
11024
|
+
function $i(e, t = {}) {
|
|
10980
11025
|
let n = {
|
|
10981
|
-
...
|
|
11026
|
+
...Qi,
|
|
10982
11027
|
...t
|
|
10983
11028
|
}, r = document.getElementById(e);
|
|
10984
11029
|
if (!r) return Promise.reject(/* @__PURE__ */ Error(`Контейнер с ID "${e}" не найден.`));
|
|
10985
11030
|
let i = document.createElement("canvas");
|
|
10986
11031
|
return i.id = `${e}-canvas`, r.appendChild(i), n.editorContainer = r, new Promise((t) => {
|
|
10987
11032
|
n._onReadyCallback = t;
|
|
10988
|
-
let r = new
|
|
11033
|
+
let r = new Zi(i.id, n);
|
|
10989
11034
|
window[e] = r;
|
|
10990
11035
|
});
|
|
10991
11036
|
}
|
|
10992
11037
|
//#endregion
|
|
10993
|
-
export {
|
|
11038
|
+
export { $i as default };
|
|
10994
11039
|
|
|
10995
11040
|
//# sourceMappingURL=main.js.map
|