@anu3ev/fabric-image-editor 0.7.12 → 0.7.13
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 +1142 -887
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -255,20 +255,20 @@ var M = class {
|
|
|
255
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 L(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 ee(e, t, n, r, i) {
|
|
262
262
|
e.save(), e.translate(t, n), e.rotate(C.degreesToRadians(i.angle)), e.fillStyle = F, e.strokeStyle = P, e.lineWidth = 1, e.beginPath(), e.roundRect(-20 / 2, -8 / 2, 20, 8, 100), e.fill(), e.stroke(), e.restore();
|
|
263
263
|
}
|
|
264
|
-
var
|
|
265
|
-
|
|
266
|
-
function
|
|
267
|
-
e.save(), e.translate(t, n), e.rotate(C.degreesToRadians(i.angle)), e.fillStyle = N, e.beginPath(), e.arc(0, 0, 16, 0, 2 * Math.PI), e.fill(), e.drawImage(
|
|
264
|
+
var R = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", te = new Image();
|
|
265
|
+
te.src = R;
|
|
266
|
+
function ne(e, t, n, r, i) {
|
|
267
|
+
e.save(), e.translate(t, n), e.rotate(C.degreesToRadians(i.angle)), e.fillStyle = N, e.beginPath(), e.arc(0, 0, 16, 0, 2 * Math.PI), e.fill(), e.drawImage(te, -16 / 2, -16 / 2, 16, 16), e.restore();
|
|
268
268
|
}
|
|
269
269
|
//#endregion
|
|
270
270
|
//#region src/editor/customized-controls/default-controls.ts
|
|
271
|
-
var
|
|
271
|
+
var z = {
|
|
272
272
|
tl: {
|
|
273
273
|
render: I,
|
|
274
274
|
sizeX: 12,
|
|
@@ -298,41 +298,41 @@ var R = {
|
|
|
298
298
|
offsetY: 0
|
|
299
299
|
},
|
|
300
300
|
ml: {
|
|
301
|
-
render:
|
|
301
|
+
render: L,
|
|
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: L,
|
|
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: ee,
|
|
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: ee,
|
|
323
323
|
sizeX: 20,
|
|
324
324
|
sizeY: 8,
|
|
325
325
|
offsetX: 0,
|
|
326
326
|
offsetY: 0
|
|
327
327
|
},
|
|
328
328
|
mtr: {
|
|
329
|
-
render:
|
|
329
|
+
render: ne,
|
|
330
330
|
sizeX: 32,
|
|
331
331
|
sizeY: 32,
|
|
332
332
|
offsetX: 0,
|
|
333
333
|
offsetY: -32
|
|
334
334
|
}
|
|
335
|
-
},
|
|
335
|
+
}, re = class t {
|
|
336
336
|
static wrapWidthControl(e) {
|
|
337
337
|
if (!e?.actionHandler) return;
|
|
338
338
|
let t = e.actionHandler;
|
|
@@ -342,7 +342,7 @@ var R = {
|
|
|
342
342
|
};
|
|
343
343
|
}
|
|
344
344
|
static applyControlOverrides(e) {
|
|
345
|
-
Object.entries(
|
|
345
|
+
Object.entries(z).forEach(([t, n]) => {
|
|
346
346
|
let r = e[t];
|
|
347
347
|
r && (Object.assign(r, n), t === "mtr" && (r.cursorStyle = "grab", r.mouseDownHandler = (e, t, n, r) => {
|
|
348
348
|
let i = t?.target;
|
|
@@ -432,7 +432,7 @@ var R = {
|
|
|
432
432
|
mr: !0
|
|
433
433
|
});
|
|
434
434
|
}
|
|
435
|
-
},
|
|
435
|
+
}, B = class e {
|
|
436
436
|
static {
|
|
437
437
|
this.registeredFontKeys = /* @__PURE__ */ new Set();
|
|
438
438
|
}
|
|
@@ -585,7 +585,7 @@ var R = {
|
|
|
585
585
|
};
|
|
586
586
|
return Object.entries(e).filter(([, e]) => e != null && `${e}`.length > 0).map(([e, n]) => `${t[e] ?? e}: ${n};`);
|
|
587
587
|
}
|
|
588
|
-
},
|
|
588
|
+
}, V = {
|
|
589
589
|
style: {
|
|
590
590
|
position: "absolute",
|
|
591
591
|
display: "none",
|
|
@@ -687,7 +687,7 @@ var R = {
|
|
|
687
687
|
e.layerManager.sendBackwards();
|
|
688
688
|
}
|
|
689
689
|
}
|
|
690
|
-
},
|
|
690
|
+
}, H = class {
|
|
691
691
|
constructor({ editor: e }) {
|
|
692
692
|
this.currentTarget = null, this.currentLocked = !1, this.isTransforming = !1, this.isTemporarilyHidden = !1, this.editor = e, this.canvas = e.canvas, this.options = e.options, this._initToolbar();
|
|
693
693
|
}
|
|
@@ -695,22 +695,22 @@ var R = {
|
|
|
695
695
|
if (!this.options.showToolbar) return;
|
|
696
696
|
let e = this.options.toolbar || {};
|
|
697
697
|
this.config = {
|
|
698
|
-
...
|
|
698
|
+
...V,
|
|
699
699
|
...e,
|
|
700
700
|
style: {
|
|
701
|
-
...
|
|
701
|
+
...V.style,
|
|
702
702
|
...e.style || {}
|
|
703
703
|
},
|
|
704
704
|
btnStyle: {
|
|
705
|
-
...
|
|
705
|
+
...V.btnStyle,
|
|
706
706
|
...e.btnStyle || {}
|
|
707
707
|
},
|
|
708
708
|
icons: {
|
|
709
|
-
...
|
|
709
|
+
...V.icons,
|
|
710
710
|
...e.icons || {}
|
|
711
711
|
},
|
|
712
712
|
handlers: {
|
|
713
|
-
...
|
|
713
|
+
...V.handlers,
|
|
714
714
|
...e.handlers || {}
|
|
715
715
|
}
|
|
716
716
|
}, this.currentTarget = null, this.currentLocked = !1, this.isTransforming = !1, this.isTemporarilyHidden = !1, this._onMouseDown = this._handleMouseDown.bind(this), this._onObjectMoving = this._startTransform.bind(this), this._onObjectScaling = this._startTransform.bind(this), this._onObjectRotating = this._startTransform.bind(this), this._onMouseUp = this._endTransform.bind(this), this._onObjectModified = this._endTransform.bind(this), this._onSelectionChange = this._updateToolbar.bind(this), this._onSelectionClear = () => {
|
|
@@ -788,7 +788,7 @@ var R = {
|
|
|
788
788
|
destroy() {
|
|
789
789
|
this.el.removeEventListener("mouseover", this._onBtnOver), this.el.removeEventListener("mouseout", this._onBtnOut), this.canvas.off("mouse:down", this._onMouseDown), this.canvas.off("object:moving", this._onObjectMoving), this.canvas.off("object:scaling", this._onObjectScaling), this.canvas.off("object:rotating", this._onObjectRotating), this.canvas.off("mouse:up", this._onMouseUp), this.canvas.off("object:modified", this._onObjectModified), this.canvas.off("selection:created", this._onSelectionChange), this.canvas.off("selection:updated", this._onSelectionChange), this.canvas.off("after:render", this._onSelectionChange), this.canvas.off("selection:cleared", this._onSelectionClear), this.el.remove();
|
|
790
790
|
}
|
|
791
|
-
},
|
|
791
|
+
}, ie = {
|
|
792
792
|
position: "absolute",
|
|
793
793
|
display: "none",
|
|
794
794
|
background: "#2B2D33",
|
|
@@ -807,7 +807,7 @@ var R = {
|
|
|
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 = U, Object.entries(
|
|
810
|
+
this.el = document.createElement("div"), this.el.className = U, Object.entries(ie).forEach(([e, t]) => {
|
|
811
811
|
this.el.style.setProperty(e, t);
|
|
812
812
|
}), this.canvas.wrapperEl.appendChild(this.el);
|
|
813
813
|
}
|
|
@@ -2807,10 +2807,10 @@ var Ze = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
2807
2807
|
width: W,
|
|
2808
2808
|
height: W,
|
|
2809
2809
|
internalTextInset: {
|
|
2810
|
-
top: .
|
|
2811
|
-
right: .
|
|
2812
|
-
bottom: .
|
|
2813
|
-
left: .
|
|
2810
|
+
top: .05,
|
|
2811
|
+
right: .05,
|
|
2812
|
+
bottom: .05,
|
|
2813
|
+
left: .05
|
|
2814
2814
|
}
|
|
2815
2815
|
},
|
|
2816
2816
|
{
|
|
@@ -2820,13 +2820,7 @@ var Ze = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
2820
2820
|
width: 34,
|
|
2821
2821
|
height: 34
|
|
2822
2822
|
}),
|
|
2823
|
-
path: "M34 17A17 17 0 1 1 17 0v17z"
|
|
2824
|
-
internalTextInset: {
|
|
2825
|
-
top: .22,
|
|
2826
|
-
right: .26,
|
|
2827
|
-
bottom: .14,
|
|
2828
|
-
left: .14
|
|
2829
|
-
}
|
|
2823
|
+
path: "M34 17A17 17 0 1 1 17 0v17z"
|
|
2830
2824
|
},
|
|
2831
2825
|
{
|
|
2832
2826
|
key: "triangle",
|
|
@@ -2837,9 +2831,9 @@ var Ze = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
2837
2831
|
}),
|
|
2838
2832
|
internalTextInset: {
|
|
2839
2833
|
top: .34,
|
|
2840
|
-
right: .
|
|
2834
|
+
right: .24,
|
|
2841
2835
|
bottom: .12,
|
|
2842
|
-
left: .
|
|
2836
|
+
left: .24
|
|
2843
2837
|
}
|
|
2844
2838
|
},
|
|
2845
2839
|
{
|
|
@@ -2873,9 +2867,9 @@ var Ze = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
2873
2867
|
],
|
|
2874
2868
|
internalTextInset: {
|
|
2875
2869
|
top: .3,
|
|
2876
|
-
right: .
|
|
2870
|
+
right: .24,
|
|
2877
2871
|
bottom: .3,
|
|
2878
|
-
left: .
|
|
2872
|
+
left: .24
|
|
2879
2873
|
}
|
|
2880
2874
|
},
|
|
2881
2875
|
{
|
|
@@ -2909,9 +2903,9 @@ var Ze = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
2909
2903
|
],
|
|
2910
2904
|
internalTextInset: {
|
|
2911
2905
|
top: .24,
|
|
2912
|
-
right: .
|
|
2913
|
-
bottom: .
|
|
2914
|
-
left: .
|
|
2906
|
+
right: .08,
|
|
2907
|
+
bottom: .08,
|
|
2908
|
+
left: .08
|
|
2915
2909
|
}
|
|
2916
2910
|
},
|
|
2917
2911
|
{
|
|
@@ -2949,9 +2943,7 @@ var Ze = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
2949
2943
|
],
|
|
2950
2944
|
internalTextInset: {
|
|
2951
2945
|
top: .22,
|
|
2952
|
-
|
|
2953
|
-
bottom: .22,
|
|
2954
|
-
left: .18
|
|
2946
|
+
bottom: .22
|
|
2955
2947
|
}
|
|
2956
2948
|
},
|
|
2957
2949
|
{
|
|
@@ -3004,9 +2996,9 @@ var Ze = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
3004
2996
|
}
|
|
3005
2997
|
],
|
|
3006
2998
|
internalTextInset: {
|
|
3007
|
-
top: .
|
|
2999
|
+
top: .38,
|
|
3008
3000
|
right: .3,
|
|
3009
|
-
bottom: .
|
|
3001
|
+
bottom: .22,
|
|
3010
3002
|
left: .3
|
|
3011
3003
|
}
|
|
3012
3004
|
},
|
|
@@ -3022,10 +3014,10 @@ var Ze = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
3022
3014
|
rotation: -Math.PI / 2
|
|
3023
3015
|
}),
|
|
3024
3016
|
internalTextInset: {
|
|
3025
|
-
top: .
|
|
3026
|
-
right: .
|
|
3027
|
-
bottom: .
|
|
3028
|
-
left: .
|
|
3017
|
+
top: .05,
|
|
3018
|
+
right: .05,
|
|
3019
|
+
bottom: .05,
|
|
3020
|
+
left: .05
|
|
3029
3021
|
}
|
|
3030
3022
|
},
|
|
3031
3023
|
{
|
|
@@ -3059,10 +3051,10 @@ var Ze = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
3059
3051
|
"C0 4.477 4.477 0 10 0a9.99 9.99 0 0 1 8 3.999A9.99 9.99 0 0 1 26 0"
|
|
3060
3052
|
].join(" "),
|
|
3061
3053
|
internalTextInset: {
|
|
3062
|
-
top: .
|
|
3063
|
-
right: .
|
|
3054
|
+
top: .1,
|
|
3055
|
+
right: .1,
|
|
3064
3056
|
bottom: .16,
|
|
3065
|
-
left: .
|
|
3057
|
+
left: .1
|
|
3066
3058
|
}
|
|
3067
3059
|
},
|
|
3068
3060
|
{
|
|
@@ -3143,10 +3135,9 @@ var Ze = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
3143
3135
|
}
|
|
3144
3136
|
],
|
|
3145
3137
|
internalTextInset: {
|
|
3146
|
-
top: .
|
|
3147
|
-
right: .
|
|
3148
|
-
|
|
3149
|
-
left: .24
|
|
3138
|
+
top: .1,
|
|
3139
|
+
right: .35,
|
|
3140
|
+
left: .35
|
|
3150
3141
|
}
|
|
3151
3142
|
},
|
|
3152
3143
|
{
|
|
@@ -3187,10 +3178,9 @@ var Ze = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
3187
3178
|
}
|
|
3188
3179
|
],
|
|
3189
3180
|
internalTextInset: {
|
|
3190
|
-
top: .
|
|
3191
|
-
right: .
|
|
3192
|
-
bottom: .
|
|
3193
|
-
left: .1
|
|
3181
|
+
top: .3,
|
|
3182
|
+
right: .1,
|
|
3183
|
+
bottom: .3
|
|
3194
3184
|
}
|
|
3195
3185
|
},
|
|
3196
3186
|
{
|
|
@@ -3231,10 +3221,9 @@ var Ze = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
3231
3221
|
}
|
|
3232
3222
|
],
|
|
3233
3223
|
internalTextInset: {
|
|
3234
|
-
top: .
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
left: .38
|
|
3224
|
+
top: .3,
|
|
3225
|
+
bottom: .3,
|
|
3226
|
+
left: .1
|
|
3238
3227
|
}
|
|
3239
3228
|
},
|
|
3240
3229
|
{
|
|
@@ -3275,10 +3264,9 @@ var Ze = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
3275
3264
|
}
|
|
3276
3265
|
],
|
|
3277
3266
|
internalTextInset: {
|
|
3278
|
-
top: .
|
|
3279
|
-
right: .
|
|
3280
|
-
|
|
3281
|
-
left: .2
|
|
3267
|
+
top: .12,
|
|
3268
|
+
right: .28,
|
|
3269
|
+
left: .28
|
|
3282
3270
|
}
|
|
3283
3271
|
},
|
|
3284
3272
|
{
|
|
@@ -3317,10 +3305,9 @@ var Ze = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
3317
3305
|
}
|
|
3318
3306
|
],
|
|
3319
3307
|
internalTextInset: {
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
left: .24
|
|
3308
|
+
right: .35,
|
|
3309
|
+
bottom: .1,
|
|
3310
|
+
left: .35
|
|
3324
3311
|
}
|
|
3325
3312
|
},
|
|
3326
3313
|
{
|
|
@@ -3361,10 +3348,9 @@ var Ze = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
3361
3348
|
}
|
|
3362
3349
|
],
|
|
3363
3350
|
internalTextInset: {
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
left: .2
|
|
3351
|
+
right: .28,
|
|
3352
|
+
bottom: .12,
|
|
3353
|
+
left: .28
|
|
3368
3354
|
}
|
|
3369
3355
|
},
|
|
3370
3356
|
{
|
|
@@ -3417,10 +3403,10 @@ var Ze = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
3417
3403
|
}
|
|
3418
3404
|
],
|
|
3419
3405
|
internalTextInset: {
|
|
3420
|
-
top: .
|
|
3421
|
-
right: .
|
|
3422
|
-
bottom: .
|
|
3423
|
-
left: .
|
|
3406
|
+
top: .1,
|
|
3407
|
+
right: .3,
|
|
3408
|
+
bottom: .1,
|
|
3409
|
+
left: .3
|
|
3424
3410
|
}
|
|
3425
3411
|
},
|
|
3426
3412
|
{
|
|
@@ -3473,10 +3459,10 @@ var Ze = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
3473
3459
|
}
|
|
3474
3460
|
],
|
|
3475
3461
|
internalTextInset: {
|
|
3476
|
-
top: .
|
|
3477
|
-
right: .
|
|
3478
|
-
bottom: .
|
|
3479
|
-
left: .
|
|
3462
|
+
top: .3,
|
|
3463
|
+
right: .08,
|
|
3464
|
+
bottom: .3,
|
|
3465
|
+
left: .08
|
|
3480
3466
|
}
|
|
3481
3467
|
},
|
|
3482
3468
|
{
|
|
@@ -3508,12 +3494,7 @@ var Ze = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
3508
3494
|
y: 100
|
|
3509
3495
|
}
|
|
3510
3496
|
],
|
|
3511
|
-
internalTextInset: {
|
|
3512
|
-
top: .14,
|
|
3513
|
-
right: .26,
|
|
3514
|
-
bottom: .14,
|
|
3515
|
-
left: .12
|
|
3516
|
-
}
|
|
3497
|
+
internalTextInset: { right: .2 }
|
|
3517
3498
|
},
|
|
3518
3499
|
{
|
|
3519
3500
|
key: "drop",
|
|
@@ -3524,10 +3505,10 @@ var Ze = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
3524
3505
|
}),
|
|
3525
3506
|
path: "M0 23C0 11 13 0 13 0s13 11 13 23c0 7.18-5.82 13-13 13S0 30.18 0 23",
|
|
3526
3507
|
internalTextInset: {
|
|
3527
|
-
top: .
|
|
3528
|
-
right: .
|
|
3529
|
-
bottom: .
|
|
3530
|
-
left: .
|
|
3508
|
+
top: .24,
|
|
3509
|
+
right: .1,
|
|
3510
|
+
bottom: .1,
|
|
3511
|
+
left: .1
|
|
3531
3512
|
}
|
|
3532
3513
|
},
|
|
3533
3514
|
{
|
|
@@ -3621,12 +3602,7 @@ var Ze = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
3621
3602
|
y: 100
|
|
3622
3603
|
}
|
|
3623
3604
|
],
|
|
3624
|
-
internalTextInset: {
|
|
3625
|
-
top: .16,
|
|
3626
|
-
right: .18,
|
|
3627
|
-
bottom: .28,
|
|
3628
|
-
left: .18
|
|
3629
|
-
}
|
|
3605
|
+
internalTextInset: { bottom: .22 }
|
|
3630
3606
|
},
|
|
3631
3607
|
{
|
|
3632
3608
|
key: "gear",
|
|
@@ -3640,10 +3616,10 @@ var Ze = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
3640
3616
|
rotation: -Math.PI / 2
|
|
3641
3617
|
}),
|
|
3642
3618
|
internalTextInset: {
|
|
3643
|
-
top: .
|
|
3644
|
-
right: .
|
|
3645
|
-
bottom: .
|
|
3646
|
-
left: .
|
|
3619
|
+
top: .1,
|
|
3620
|
+
right: .1,
|
|
3621
|
+
bottom: .1,
|
|
3622
|
+
left: .1
|
|
3647
3623
|
}
|
|
3648
3624
|
},
|
|
3649
3625
|
{
|
|
@@ -3653,10 +3629,8 @@ var Ze = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
3653
3629
|
height: W,
|
|
3654
3630
|
path: "M24 6 H76 L94 24 V76 L76 94 H24 L6 76 V24 Z",
|
|
3655
3631
|
internalTextInset: {
|
|
3656
|
-
top: .
|
|
3657
|
-
|
|
3658
|
-
bottom: .24,
|
|
3659
|
-
left: .24
|
|
3632
|
+
top: .1,
|
|
3633
|
+
bottom: .1
|
|
3660
3634
|
}
|
|
3661
3635
|
},
|
|
3662
3636
|
{
|
|
@@ -3686,12 +3660,7 @@ var Ze = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
3686
3660
|
y: 100
|
|
3687
3661
|
}
|
|
3688
3662
|
],
|
|
3689
|
-
internalTextInset: {
|
|
3690
|
-
top: .2,
|
|
3691
|
-
right: .22,
|
|
3692
|
-
bottom: .34,
|
|
3693
|
-
left: .22
|
|
3694
|
-
}
|
|
3663
|
+
internalTextInset: { bottom: .24 }
|
|
3695
3664
|
},
|
|
3696
3665
|
{
|
|
3697
3666
|
key: "tag",
|
|
@@ -3699,12 +3668,7 @@ var Ze = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
3699
3668
|
width: W,
|
|
3700
3669
|
height: 130,
|
|
3701
3670
|
path: "M4 20 L64 20 L96 50 L64 80 L4 80 Z",
|
|
3702
|
-
internalTextInset: {
|
|
3703
|
-
top: .24,
|
|
3704
|
-
right: .34,
|
|
3705
|
-
bottom: .24,
|
|
3706
|
-
left: .18
|
|
3707
|
-
}
|
|
3671
|
+
internalTextInset: { right: .28 }
|
|
3708
3672
|
},
|
|
3709
3673
|
{
|
|
3710
3674
|
key: "moon",
|
|
@@ -3719,9 +3683,8 @@ var Ze = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
3719
3683
|
].join(" "),
|
|
3720
3684
|
internalTextInset: {
|
|
3721
3685
|
top: .28,
|
|
3722
|
-
right: .
|
|
3723
|
-
bottom: .28
|
|
3724
|
-
left: .2
|
|
3686
|
+
right: .5,
|
|
3687
|
+
bottom: .28
|
|
3725
3688
|
}
|
|
3726
3689
|
}
|
|
3727
3690
|
], ot = "circle", st = "center", ct = "middle", lt = {};
|
|
@@ -4367,47 +4330,41 @@ function en({ text: e, width: t, height: n, padding: r, internalShapeTextInset:
|
|
|
4367
4330
|
}
|
|
4368
4331
|
//#endregion
|
|
4369
4332
|
//#region src/editor/shape-manager/layout/shape-layout.ts
|
|
4370
|
-
var q = 1, tn = .5, nn = 8, rn = ({ group: e, shape: t, text: n, width: r, height: i, alignH: a, alignV: o, padding: s, internalShapeTextInset: c,
|
|
4371
|
-
let
|
|
4333
|
+
var q = 1, tn = .5, nn = 8, rn = 20, an = 16, on = ({ group: e, shape: t, text: n, width: r, height: i, alignH: a, alignV: o, padding: s, internalShapeTextInset: c, resolveInternalShapeTextInset: l, preserveAspectRatio: u, shapeTextAutoExpandEnabled: d, montageAreaWidth: f, expandShapeHeightToFitText: p = !0, changedPadding: m }) => {
|
|
4334
|
+
let h = Math.max(q, e.shapeManualBaseWidth ?? r), g = Math.max(q, e.shapeManualBaseHeight ?? i), _ = d ?? e.shapeTextAutoExpand !== !1, { width: v, height: y, appliedPadding: b, appliedUserPadding: x } = u ? sn({
|
|
4372
4335
|
text: n,
|
|
4373
|
-
width:
|
|
4374
|
-
height:
|
|
4375
|
-
padding:
|
|
4376
|
-
internalShapeTextInset:
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4336
|
+
width: r,
|
|
4337
|
+
height: i,
|
|
4338
|
+
padding: s,
|
|
4339
|
+
internalShapeTextInset: c,
|
|
4340
|
+
resolveInternalShapeTextInset: l,
|
|
4341
|
+
shapeTextAutoExpandEnabled: _,
|
|
4342
|
+
montageAreaWidth: f,
|
|
4343
|
+
expandShapeHeightToFitText: p,
|
|
4344
|
+
changedPadding: m
|
|
4345
|
+
}) : gn({
|
|
4346
|
+
text: n,
|
|
4347
|
+
width: r,
|
|
4348
|
+
height: i,
|
|
4349
|
+
padding: s,
|
|
4350
|
+
internalShapeTextInset: c,
|
|
4351
|
+
resolveInternalShapeTextInset: l,
|
|
4352
|
+
expandShapeHeightToFitText: p,
|
|
4353
|
+
changedPadding: m
|
|
4381
4354
|
});
|
|
4382
|
-
for (let e = 0; e < nn; e += 1) {
|
|
4383
|
-
let e = Math.max(g, _.requiredWidth);
|
|
4384
|
-
if (e <= g + tn) break;
|
|
4385
|
-
g = e, _ = en({
|
|
4386
|
-
text: n,
|
|
4387
|
-
width: g,
|
|
4388
|
-
height: h,
|
|
4389
|
-
padding: d,
|
|
4390
|
-
internalShapeTextInset: f,
|
|
4391
|
-
expandShapeHeightToFitText: l,
|
|
4392
|
-
changedPadding: u,
|
|
4393
|
-
measureTextboxHeightForFrame: pn,
|
|
4394
|
-
resolveMinimumTextFrameWidth: mn
|
|
4395
|
-
});
|
|
4396
|
-
}
|
|
4397
|
-
let { appliedPadding: v, appliedUserPadding: y, requiredHeight: b } = _, x = Math.max(q, b);
|
|
4398
4355
|
xt({
|
|
4399
4356
|
shape: t,
|
|
4400
|
-
width:
|
|
4401
|
-
height:
|
|
4357
|
+
width: v,
|
|
4358
|
+
height: y,
|
|
4402
4359
|
rounding: e.shapeRounding,
|
|
4403
4360
|
strokeWidth: e.shapeStrokeWidth
|
|
4404
4361
|
});
|
|
4405
|
-
let { frame: S, splitByGrapheme: C, textTop: w } =
|
|
4362
|
+
let { frame: S, splitByGrapheme: C, textTop: w } = un({
|
|
4406
4363
|
text: n,
|
|
4407
|
-
width:
|
|
4408
|
-
height:
|
|
4364
|
+
width: v,
|
|
4365
|
+
height: y,
|
|
4409
4366
|
alignV: o,
|
|
4410
|
-
padding:
|
|
4367
|
+
padding: b
|
|
4411
4368
|
});
|
|
4412
4369
|
n.set({
|
|
4413
4370
|
autoExpand: !1,
|
|
@@ -4425,51 +4382,154 @@ var q = 1, tn = .5, nn = 8, rn = ({ group: e, shape: t, text: n, width: r, heigh
|
|
|
4425
4382
|
originX: "left",
|
|
4426
4383
|
originY: "top",
|
|
4427
4384
|
splitByGrapheme: C
|
|
4428
|
-
}), n.initDimensions(), n.setCoords(), t.setCoords(), e.shapeBaseWidth =
|
|
4429
|
-
width:
|
|
4430
|
-
height:
|
|
4385
|
+
}), n.initDimensions(), n.setCoords(), t.setCoords(), e.shapeBaseWidth = v, e.shapeBaseHeight = y, e.shapeManualBaseWidth = h, e.shapeManualBaseHeight = g, e.shapePaddingTop = x.top, e.shapePaddingRight = x.right, e.shapePaddingBottom = x.bottom, e.shapePaddingLeft = x.left, e.shapeAlignHorizontal = a, e.shapeAlignVertical = o, e.set({
|
|
4386
|
+
width: v,
|
|
4387
|
+
height: y,
|
|
4431
4388
|
scaleX: 1,
|
|
4432
4389
|
scaleY: 1
|
|
4433
4390
|
}), e.set("dirty", !0), e.setCoords();
|
|
4434
|
-
}
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
width: l,
|
|
4439
|
-
padding: c
|
|
4440
|
-
}), d = l, f = fn({
|
|
4391
|
+
};
|
|
4392
|
+
function sn({ text: e, width: t, height: n, padding: r, internalShapeTextInset: i, resolveInternalShapeTextInset: a, shapeTextAutoExpandEnabled: o = !0, montageAreaWidth: s, expandShapeHeightToFitText: c = !0, changedPadding: l }) {
|
|
4393
|
+
let u = Math.max(q, t), d = Math.max(q, n), f = Number.isFinite(s) && (s ?? 0) > 0 ? Math.max(q, s ?? q) : null;
|
|
4394
|
+
if (!fn({ text: e })) return gn({
|
|
4441
4395
|
text: e,
|
|
4442
|
-
|
|
4396
|
+
width: u,
|
|
4397
|
+
height: d,
|
|
4398
|
+
padding: r,
|
|
4399
|
+
internalShapeTextInset: i,
|
|
4400
|
+
resolveInternalShapeTextInset: a,
|
|
4401
|
+
expandShapeHeightToFitText: c,
|
|
4402
|
+
changedPadding: l
|
|
4443
4403
|
});
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
for (let t = 0; t < nn; t += 1) {
|
|
4447
|
-
let t = qt({
|
|
4448
|
-
width: h,
|
|
4449
|
-
padding: c
|
|
4450
|
-
}), n = fn({
|
|
4404
|
+
let p = d / u, m = ({ width: t }) => {
|
|
4405
|
+
let n = Math.max(q, t * p), o = gn({
|
|
4451
4406
|
text: e,
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4407
|
+
width: t,
|
|
4408
|
+
height: n,
|
|
4409
|
+
padding: r,
|
|
4410
|
+
internalShapeTextInset: i,
|
|
4411
|
+
resolveInternalShapeTextInset: a,
|
|
4412
|
+
expandShapeHeightToFitText: c,
|
|
4413
|
+
changedPadding: l
|
|
4414
|
+
});
|
|
4415
|
+
return {
|
|
4416
|
+
candidateHeight: n,
|
|
4417
|
+
frameWidth: qt({
|
|
4418
|
+
width: t,
|
|
4419
|
+
padding: o.appliedPadding
|
|
4420
|
+
}),
|
|
4421
|
+
layoutResolution: o
|
|
4422
|
+
};
|
|
4423
|
+
}, h = ({ candidateWidth: e, candidateHeight: t, layoutResolution: n }) => !(n.width > e + tn || n.height > t + tn);
|
|
4424
|
+
if (!o) {
|
|
4425
|
+
let e = ({ width: e }) => {
|
|
4426
|
+
let { candidateHeight: t, layoutResolution: n } = m({ width: e });
|
|
4427
|
+
return h({
|
|
4428
|
+
candidateWidth: e,
|
|
4429
|
+
candidateHeight: t,
|
|
4430
|
+
layoutResolution: n
|
|
4431
|
+
});
|
|
4432
|
+
}, t = f ? Math.max(u, f) : u;
|
|
4433
|
+
e({ width: t }) || (t = _n({
|
|
4434
|
+
minimumWidth: t,
|
|
4435
|
+
isWidthValid: e
|
|
4436
|
+
}));
|
|
4437
|
+
let { layoutResolution: n } = m({ width: vn({
|
|
4438
|
+
minimumWidth: u,
|
|
4439
|
+
maximumWidth: t,
|
|
4440
|
+
isWidthValid: e
|
|
4441
|
+
}) });
|
|
4442
|
+
return n;
|
|
4443
|
+
}
|
|
4444
|
+
let g = ({ width: t, requiredFrameWidth: n }) => {
|
|
4445
|
+
let { candidateHeight: r, frameWidth: i, layoutResolution: a } = m({ width: t });
|
|
4446
|
+
return !h({
|
|
4447
|
+
candidateWidth: t,
|
|
4448
|
+
candidateHeight: r,
|
|
4449
|
+
layoutResolution: a
|
|
4450
|
+
}) || n !== void 0 && i < n - tn ? !1 : !xn({
|
|
4451
|
+
text: e,
|
|
4452
|
+
frameWidth: i
|
|
4453
|
+
}).hasWrappedLines;
|
|
4454
|
+
}, _ = f ? Math.max(u, f) : _n({
|
|
4455
|
+
minimumWidth: u,
|
|
4456
|
+
isWidthValid: ({ width: e }) => g({ width: e })
|
|
4457
|
+
}), v = m({ width: _ }), y = xn({
|
|
4458
|
+
text: e,
|
|
4459
|
+
frameWidth: v.frameWidth
|
|
4460
|
+
});
|
|
4461
|
+
if (y.hasWrappedLines) return v.layoutResolution;
|
|
4462
|
+
let b = Math.max(q, y.longestLineWidth), { layoutResolution: x } = m({ width: vn({
|
|
4463
|
+
minimumWidth: u,
|
|
4464
|
+
maximumWidth: _,
|
|
4465
|
+
isWidthValid: ({ width: e }) => g({
|
|
4466
|
+
width: e,
|
|
4467
|
+
requiredFrameWidth: b
|
|
4468
|
+
})
|
|
4469
|
+
}) });
|
|
4470
|
+
return x;
|
|
4471
|
+
}
|
|
4472
|
+
var cn = ({ text: e, currentWidth: t, minimumWidth: n, padding: r, montageAreaWidth: i, resolvePaddingForWidth: a }) => {
|
|
4473
|
+
let o = Math.max(q, t), s = Math.max(q, n);
|
|
4474
|
+
if (!fn({ text: e })) return s;
|
|
4475
|
+
let c = Math.max(s, Number.isFinite(i) && i > 0 ? Math.max(q, i) : Math.max(o, s)), l = qt({
|
|
4476
|
+
width: c,
|
|
4477
|
+
padding: pn({
|
|
4478
|
+
width: c,
|
|
4479
|
+
padding: r,
|
|
4480
|
+
resolvePaddingForWidth: a
|
|
4481
|
+
})
|
|
4482
|
+
}), u = c, d = xn({
|
|
4483
|
+
text: e,
|
|
4484
|
+
frameWidth: l
|
|
4485
|
+
});
|
|
4486
|
+
if (d.hasWrappedLines) return u;
|
|
4487
|
+
let f = Math.max(q, d.longestLineWidth);
|
|
4488
|
+
return vn({
|
|
4489
|
+
minimumWidth: s,
|
|
4490
|
+
maximumWidth: u,
|
|
4491
|
+
isWidthValid: ({ width: t }) => {
|
|
4492
|
+
let n = qt({
|
|
4493
|
+
width: t,
|
|
4494
|
+
padding: pn({
|
|
4495
|
+
width: t,
|
|
4496
|
+
padding: r,
|
|
4497
|
+
resolvePaddingForWidth: a
|
|
4498
|
+
})
|
|
4499
|
+
});
|
|
4500
|
+
return n < f - tn ? !1 : !xn({
|
|
4501
|
+
text: e,
|
|
4502
|
+
frameWidth: n
|
|
4503
|
+
}).hasWrappedLines;
|
|
4504
|
+
}
|
|
4505
|
+
});
|
|
4506
|
+
}, ln = ({ text: e, padding: t, resolvePaddingForWidth: n }) => {
|
|
4507
|
+
if (!fn({ text: e })) return q;
|
|
4508
|
+
let r = Cn({ text: e }), i = Math.max(q, r), a = ({ width: e }) => qt({
|
|
4509
|
+
width: e,
|
|
4510
|
+
padding: pn({
|
|
4511
|
+
width: e,
|
|
4512
|
+
padding: t,
|
|
4513
|
+
resolvePaddingForWidth: n
|
|
4514
|
+
})
|
|
4515
|
+
}) >= r - tn;
|
|
4516
|
+
return vn({
|
|
4517
|
+
minimumWidth: i,
|
|
4518
|
+
maximumWidth: _n({
|
|
4519
|
+
minimumWidth: i,
|
|
4520
|
+
isWidthValid: a
|
|
4521
|
+
}),
|
|
4522
|
+
isWidthValid: a
|
|
4523
|
+
});
|
|
4524
|
+
}, un = ({ text: e, width: t, height: n, alignV: r, padding: i }) => {
|
|
4525
|
+
let a = yn({
|
|
4466
4526
|
width: Math.max(q, t),
|
|
4467
4527
|
height: Math.max(q, n),
|
|
4468
4528
|
padding: Rt({ padding: i })
|
|
4469
|
-
}), o =
|
|
4529
|
+
}), o = En({
|
|
4470
4530
|
text: e,
|
|
4471
4531
|
frameWidth: a.width
|
|
4472
|
-
}), s =
|
|
4532
|
+
}), s = Sn({
|
|
4473
4533
|
text: e,
|
|
4474
4534
|
frameWidth: a.width,
|
|
4475
4535
|
splitByGrapheme: o
|
|
@@ -4477,29 +4537,118 @@ var q = 1, tn = .5, nn = 8, rn = ({ group: e, shape: t, text: n, width: r, heigh
|
|
|
4477
4537
|
return {
|
|
4478
4538
|
frame: a,
|
|
4479
4539
|
splitByGrapheme: o,
|
|
4480
|
-
textTop:
|
|
4540
|
+
textTop: Tn({
|
|
4481
4541
|
alignV: r,
|
|
4482
4542
|
frameHeight: a.height,
|
|
4483
4543
|
frameTop: a.top,
|
|
4484
4544
|
textHeight: s
|
|
4485
4545
|
})
|
|
4486
4546
|
};
|
|
4487
|
-
},
|
|
4488
|
-
let
|
|
4489
|
-
if (!
|
|
4490
|
-
let
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
width:
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4547
|
+
}, dn = ({ text: e, width: t, height: n, padding: r, resolvePaddingForSize: i }) => {
|
|
4548
|
+
let a = Math.max(q, n);
|
|
4549
|
+
if (!fn({ text: e })) return a;
|
|
4550
|
+
let o = Math.max(q, t), s = a;
|
|
4551
|
+
for (let t = 0; t < nn; t += 1) {
|
|
4552
|
+
let t = mn({
|
|
4553
|
+
width: o,
|
|
4554
|
+
height: s,
|
|
4555
|
+
padding: r,
|
|
4556
|
+
resolvePaddingForSize: i
|
|
4557
|
+
}), n = Sn({
|
|
4558
|
+
text: e,
|
|
4559
|
+
frameWidth: qt({
|
|
4560
|
+
width: o,
|
|
4561
|
+
padding: t
|
|
4562
|
+
})
|
|
4563
|
+
}), c = Math.max(a, n + t.top + t.bottom);
|
|
4564
|
+
if (c <= s + tn) return c;
|
|
4565
|
+
s = c;
|
|
4566
|
+
}
|
|
4567
|
+
return s;
|
|
4498
4568
|
};
|
|
4499
|
-
function
|
|
4569
|
+
function fn({ text: e }) {
|
|
4500
4570
|
return (e.text ?? "").trim().length > 0;
|
|
4501
4571
|
}
|
|
4502
|
-
function
|
|
4572
|
+
function pn({ width: e, padding: t, resolvePaddingForWidth: n }) {
|
|
4573
|
+
return Rt(n ? { padding: n({ width: Math.max(q, e) }) } : { padding: t });
|
|
4574
|
+
}
|
|
4575
|
+
function mn({ width: e, height: t, padding: n, resolvePaddingForSize: r }) {
|
|
4576
|
+
return Rt(r ? { padding: r({
|
|
4577
|
+
width: Math.max(q, e),
|
|
4578
|
+
height: Math.max(q, t)
|
|
4579
|
+
}) } : { padding: n });
|
|
4580
|
+
}
|
|
4581
|
+
function hn({ width: e, height: t, internalShapeTextInset: n, resolveInternalShapeTextInset: r }) {
|
|
4582
|
+
return Rt(r ? { padding: r({
|
|
4583
|
+
width: Math.max(q, e),
|
|
4584
|
+
height: Math.max(q, t)
|
|
4585
|
+
}) } : { padding: n });
|
|
4586
|
+
}
|
|
4587
|
+
function gn({ text: e, width: t, height: n, padding: r, internalShapeTextInset: i, resolveInternalShapeTextInset: a, expandShapeHeightToFitText: o = !0, changedPadding: s }) {
|
|
4588
|
+
let c = zt({ padding: r }), l = Rt({ padding: i }), u = Math.max(q, t), d = Math.max(q, n), f = en({
|
|
4589
|
+
text: e,
|
|
4590
|
+
width: u,
|
|
4591
|
+
height: d,
|
|
4592
|
+
padding: c,
|
|
4593
|
+
internalShapeTextInset: hn({
|
|
4594
|
+
width: u,
|
|
4595
|
+
height: d,
|
|
4596
|
+
internalShapeTextInset: l,
|
|
4597
|
+
resolveInternalShapeTextInset: a
|
|
4598
|
+
}),
|
|
4599
|
+
expandShapeHeightToFitText: o,
|
|
4600
|
+
changedPadding: s,
|
|
4601
|
+
measureTextboxHeightForFrame: Sn,
|
|
4602
|
+
resolveMinimumTextFrameWidth: Cn
|
|
4603
|
+
});
|
|
4604
|
+
for (let t = 0; t < nn; t += 1) {
|
|
4605
|
+
let t = Math.max(u, f.requiredWidth), n = Math.max(d, f.requiredHeight);
|
|
4606
|
+
if (t <= u + tn && n <= d + tn) break;
|
|
4607
|
+
u = t, d = n, f = en({
|
|
4608
|
+
text: e,
|
|
4609
|
+
width: u,
|
|
4610
|
+
height: d,
|
|
4611
|
+
padding: c,
|
|
4612
|
+
internalShapeTextInset: hn({
|
|
4613
|
+
width: u,
|
|
4614
|
+
height: d,
|
|
4615
|
+
internalShapeTextInset: l,
|
|
4616
|
+
resolveInternalShapeTextInset: a
|
|
4617
|
+
}),
|
|
4618
|
+
expandShapeHeightToFitText: o,
|
|
4619
|
+
changedPadding: s,
|
|
4620
|
+
measureTextboxHeightForFrame: Sn,
|
|
4621
|
+
resolveMinimumTextFrameWidth: Cn
|
|
4622
|
+
});
|
|
4623
|
+
}
|
|
4624
|
+
return {
|
|
4625
|
+
width: u,
|
|
4626
|
+
height: d,
|
|
4627
|
+
appliedPadding: f.appliedPadding,
|
|
4628
|
+
appliedUserPadding: f.appliedUserPadding
|
|
4629
|
+
};
|
|
4630
|
+
}
|
|
4631
|
+
function _n({ minimumWidth: e, isWidthValid: t }) {
|
|
4632
|
+
let n = Math.max(q, e);
|
|
4633
|
+
if (t({ width: n })) return n;
|
|
4634
|
+
for (let e = 0; e < an; e += 1) if (n = Math.max(n + 1, n * 2), t({ width: n })) return n;
|
|
4635
|
+
return n;
|
|
4636
|
+
}
|
|
4637
|
+
function vn({ minimumWidth: e, maximumWidth: t, isWidthValid: n }) {
|
|
4638
|
+
let r = Math.max(q, e), i = Math.max(r, t);
|
|
4639
|
+
if (n({ width: r })) return r;
|
|
4640
|
+
if (!n({ width: i })) return i;
|
|
4641
|
+
for (let e = 0; e < rn && !(i - r <= tn); e += 1) {
|
|
4642
|
+
let e = r + (i - r) / 2;
|
|
4643
|
+
if (n({ width: e })) {
|
|
4644
|
+
i = e;
|
|
4645
|
+
continue;
|
|
4646
|
+
}
|
|
4647
|
+
r = e;
|
|
4648
|
+
}
|
|
4649
|
+
return i;
|
|
4650
|
+
}
|
|
4651
|
+
function yn({ width: e, height: t, padding: n }) {
|
|
4503
4652
|
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);
|
|
4504
4653
|
return {
|
|
4505
4654
|
left: -e / 2 + r,
|
|
@@ -4508,7 +4657,7 @@ function un({ width: e, height: t, padding: n }) {
|
|
|
4508
4657
|
height: Math.max(q, t - a - o)
|
|
4509
4658
|
};
|
|
4510
4659
|
}
|
|
4511
|
-
function
|
|
4660
|
+
function bn({ text: e }) {
|
|
4512
4661
|
let { height: t } = e;
|
|
4513
4662
|
if (typeof t == "number" && Number.isFinite(t)) return t;
|
|
4514
4663
|
if (typeof e.calcTextHeight == "function") {
|
|
@@ -4517,18 +4666,18 @@ function dn({ text: e }) {
|
|
|
4517
4666
|
}
|
|
4518
4667
|
return q;
|
|
4519
4668
|
}
|
|
4520
|
-
function
|
|
4521
|
-
let n =
|
|
4669
|
+
function xn({ text: e, frameWidth: t }) {
|
|
4670
|
+
let n = On({ text: e }), r = En({
|
|
4522
4671
|
text: e,
|
|
4523
4672
|
frameWidth: t
|
|
4524
|
-
}), i =
|
|
4673
|
+
}), i = jn({ text: e });
|
|
4525
4674
|
e.set({
|
|
4526
4675
|
autoExpand: !1,
|
|
4527
4676
|
width: Math.max(q, t),
|
|
4528
4677
|
splitByGrapheme: r
|
|
4529
4678
|
}), e.initDimensions();
|
|
4530
|
-
let a =
|
|
4531
|
-
return
|
|
4679
|
+
let a = kn({ text: e }) > n, o = Math.ceil(Dn({ text: e }));
|
|
4680
|
+
return Mn({
|
|
4532
4681
|
text: e,
|
|
4533
4682
|
state: i
|
|
4534
4683
|
}), {
|
|
@@ -4536,8 +4685,8 @@ function fn({ text: e, frameWidth: t }) {
|
|
|
4536
4685
|
longestLineWidth: o
|
|
4537
4686
|
};
|
|
4538
4687
|
}
|
|
4539
|
-
function
|
|
4540
|
-
let r =
|
|
4688
|
+
function Sn({ text: e, frameWidth: t, splitByGrapheme: n }) {
|
|
4689
|
+
let r = jn({ text: e }), i = n ?? En({
|
|
4541
4690
|
text: e,
|
|
4542
4691
|
frameWidth: t
|
|
4543
4692
|
});
|
|
@@ -4546,71 +4695,71 @@ function pn({ text: e, frameWidth: t, splitByGrapheme: n }) {
|
|
|
4546
4695
|
width: Math.max(q, t),
|
|
4547
4696
|
splitByGrapheme: i
|
|
4548
4697
|
}), e.initDimensions();
|
|
4549
|
-
let a =
|
|
4550
|
-
return
|
|
4698
|
+
let a = bn({ text: e });
|
|
4699
|
+
return Mn({
|
|
4551
4700
|
text: e,
|
|
4552
4701
|
state: r
|
|
4553
4702
|
}), a;
|
|
4554
4703
|
}
|
|
4555
|
-
function
|
|
4556
|
-
let t =
|
|
4704
|
+
function Cn({ text: e }) {
|
|
4705
|
+
let t = wn({
|
|
4557
4706
|
text: e,
|
|
4558
4707
|
frameWidth: q,
|
|
4559
4708
|
splitByGrapheme: !0
|
|
4560
4709
|
});
|
|
4561
4710
|
return Math.max(q, t);
|
|
4562
4711
|
}
|
|
4563
|
-
function
|
|
4564
|
-
let r =
|
|
4712
|
+
function wn({ text: e, frameWidth: t, splitByGrapheme: n }) {
|
|
4713
|
+
let r = jn({ text: e });
|
|
4565
4714
|
e.set({
|
|
4566
4715
|
autoExpand: !1,
|
|
4567
4716
|
width: Math.max(q, t),
|
|
4568
4717
|
splitByGrapheme: n
|
|
4569
4718
|
}), e.initDimensions();
|
|
4570
|
-
let i =
|
|
4571
|
-
return
|
|
4719
|
+
let i = Dn({ text: e });
|
|
4720
|
+
return Mn({
|
|
4572
4721
|
text: e,
|
|
4573
4722
|
state: r
|
|
4574
4723
|
}), i;
|
|
4575
4724
|
}
|
|
4576
|
-
function
|
|
4725
|
+
function Tn({ alignV: e, frameHeight: t, frameTop: n, textHeight: r }) {
|
|
4577
4726
|
let i = Math.max(0, t - r);
|
|
4578
4727
|
return e === "top" ? n : e === "bottom" ? n + i : n + i / 2;
|
|
4579
4728
|
}
|
|
4580
|
-
function
|
|
4581
|
-
let n = Math.max(q, t), r =
|
|
4729
|
+
function En({ text: e, frameWidth: t }) {
|
|
4730
|
+
let n = Math.max(q, t), r = jn({ text: e });
|
|
4582
4731
|
e.set({
|
|
4583
4732
|
autoExpand: !1,
|
|
4584
4733
|
width: n,
|
|
4585
4734
|
splitByGrapheme: !1
|
|
4586
4735
|
}), e.initDimensions();
|
|
4587
|
-
let i =
|
|
4588
|
-
return
|
|
4736
|
+
let i = Nn({ text: e }) > n + tn;
|
|
4737
|
+
return Mn({
|
|
4589
4738
|
text: e,
|
|
4590
4739
|
state: r
|
|
4591
4740
|
}), i;
|
|
4592
4741
|
}
|
|
4593
|
-
function
|
|
4594
|
-
let t =
|
|
4595
|
-
if (t > 0) return
|
|
4742
|
+
function Dn({ text: e }) {
|
|
4743
|
+
let t = kn({ text: e });
|
|
4744
|
+
if (t > 0) return An({
|
|
4596
4745
|
text: e,
|
|
4597
4746
|
lineCount: t
|
|
4598
4747
|
});
|
|
4599
4748
|
let n = e.text ?? "";
|
|
4600
|
-
return
|
|
4749
|
+
return An({
|
|
4601
4750
|
text: e,
|
|
4602
4751
|
lineCount: Math.max(n.split("\n").length, 1)
|
|
4603
4752
|
});
|
|
4604
4753
|
}
|
|
4605
|
-
function
|
|
4754
|
+
function On({ text: e }) {
|
|
4606
4755
|
let t = e.text ?? "";
|
|
4607
4756
|
return Math.max(t.split("\n").length, 1);
|
|
4608
4757
|
}
|
|
4609
|
-
function
|
|
4758
|
+
function kn({ text: e }) {
|
|
4610
4759
|
let t = e;
|
|
4611
4760
|
return Array.isArray(t.textLines) ? t.textLines.length : 0;
|
|
4612
4761
|
}
|
|
4613
|
-
function
|
|
4762
|
+
function An({ text: e, lineCount: t }) {
|
|
4614
4763
|
let n = q;
|
|
4615
4764
|
for (let r = 0; r < t; r += 1) {
|
|
4616
4765
|
let t = e.getLineWidth(r);
|
|
@@ -4618,7 +4767,7 @@ function xn({ text: e, lineCount: t }) {
|
|
|
4618
4767
|
}
|
|
4619
4768
|
return n;
|
|
4620
4769
|
}
|
|
4621
|
-
function
|
|
4770
|
+
function jn({ text: e }) {
|
|
4622
4771
|
let { autoExpand: t, splitByGrapheme: n, width: r } = e;
|
|
4623
4772
|
return {
|
|
4624
4773
|
autoExpand: t,
|
|
@@ -4626,23 +4775,23 @@ function Sn({ text: e }) {
|
|
|
4626
4775
|
width: typeof r == "number" ? r : void 0
|
|
4627
4776
|
};
|
|
4628
4777
|
}
|
|
4629
|
-
function
|
|
4778
|
+
function Mn({ text: e, state: t }) {
|
|
4630
4779
|
let { autoExpand: n, splitByGrapheme: r, width: i } = t, a = {};
|
|
4631
4780
|
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());
|
|
4632
4781
|
}
|
|
4633
|
-
function
|
|
4782
|
+
function Nn({ text: e }) {
|
|
4634
4783
|
let { dynamicMinWidth: t } = e;
|
|
4635
4784
|
return typeof t == "number" && Number.isFinite(t) ? t : 0;
|
|
4636
4785
|
}
|
|
4637
4786
|
//#endregion
|
|
4638
4787
|
//#region src/editor/shape-manager/shape-runtime.ts
|
|
4639
|
-
var
|
|
4788
|
+
var Pn = ({ group: e }) => {
|
|
4640
4789
|
let t = e;
|
|
4641
4790
|
typeof t.setInteractive == "function" && t.setInteractive(!0), t.set({
|
|
4642
4791
|
interactive: !0,
|
|
4643
4792
|
subTargetCheck: !0
|
|
4644
4793
|
});
|
|
4645
|
-
},
|
|
4794
|
+
}, Fn = ({ text: e }) => {
|
|
4646
4795
|
let t = !!(e.locked || e.group?.locked);
|
|
4647
4796
|
e.set({
|
|
4648
4797
|
hasBorders: !1,
|
|
@@ -4655,7 +4804,7 @@ var Tn = ({ group: e }) => {
|
|
|
4655
4804
|
autoExpand: !1,
|
|
4656
4805
|
shapeNodeType: "text"
|
|
4657
4806
|
}), e.setCoords();
|
|
4658
|
-
},
|
|
4807
|
+
}, In = ({ group: e }) => {
|
|
4659
4808
|
let { layoutManager: t } = e;
|
|
4660
4809
|
if (!t || typeof t.unsubscribeTargets != "function") return;
|
|
4661
4810
|
let n = e.getObjects();
|
|
@@ -4663,7 +4812,7 @@ var Tn = ({ group: e }) => {
|
|
|
4663
4812
|
target: e,
|
|
4664
4813
|
targets: n
|
|
4665
4814
|
});
|
|
4666
|
-
},
|
|
4815
|
+
}, Ln = ({ group: e }) => {
|
|
4667
4816
|
let t = e.getObjects();
|
|
4668
4817
|
for (let e = 0; e < t.length; e += 1) {
|
|
4669
4818
|
let n = t[e];
|
|
@@ -4674,23 +4823,23 @@ var Tn = ({ group: e }) => {
|
|
|
4674
4823
|
if (n instanceof _) return n;
|
|
4675
4824
|
}
|
|
4676
4825
|
return null;
|
|
4677
|
-
},
|
|
4826
|
+
}, Rn = [
|
|
4678
4827
|
"tl",
|
|
4679
4828
|
"tr",
|
|
4680
4829
|
"bl",
|
|
4681
4830
|
"br"
|
|
4682
|
-
],
|
|
4831
|
+
], zn = ({ transform: e }) => {
|
|
4683
4832
|
let { originX: t, originY: n } = e;
|
|
4684
4833
|
return (t === "center" || t === .5) && (n === "center" || n === .5);
|
|
4685
|
-
},
|
|
4834
|
+
}, Bn = ({ transform: e, x: t, y: n }) => {
|
|
4686
4835
|
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);
|
|
4687
4836
|
r.signX === void 0 && (r.signX = c), r.signY === void 0 && (r.signY = l);
|
|
4688
4837
|
let u = i._getTransformedDimensions(), d = Math.abs(s.x * a / u.x), f = Math.abs(s.y * o / u.y);
|
|
4689
|
-
|
|
4838
|
+
zn({ transform: r }) && (d *= 2, f *= 2);
|
|
4690
4839
|
let p = !i.lockScalingX && (!i.lockScalingFlip || r.signX === c), m = !i.lockScalingY && (!i.lockScalingFlip || r.signY === l);
|
|
4691
4840
|
return p && i.set("scaleX", d), m && i.set("scaleY", f), a !== i.scaleX || o !== i.scaleY;
|
|
4692
|
-
},
|
|
4693
|
-
let e = b.wrapWithFireEvent("scaling", b.wrapWithFixedAnchor((e, t, n, r) =>
|
|
4841
|
+
}, Vn = () => {
|
|
4842
|
+
let e = b.wrapWithFireEvent("scaling", b.wrapWithFixedAnchor((e, t, n, r) => Bn({
|
|
4694
4843
|
transform: t,
|
|
4695
4844
|
x: n,
|
|
4696
4845
|
y: r
|
|
@@ -4706,31 +4855,31 @@ var Tn = ({ group: e }) => {
|
|
|
4706
4855
|
a.uniformScaling = s;
|
|
4707
4856
|
}
|
|
4708
4857
|
};
|
|
4709
|
-
},
|
|
4858
|
+
}, Hn = ({ control: e }) => {
|
|
4710
4859
|
let t = new r({
|
|
4711
4860
|
...e,
|
|
4712
|
-
actionHandler:
|
|
4861
|
+
actionHandler: Vn()
|
|
4713
4862
|
});
|
|
4714
4863
|
return t.shapeFreeScaleCornerControl = !0, t;
|
|
4715
|
-
},
|
|
4864
|
+
}, Un = ({ group: e }) => {
|
|
4716
4865
|
let t = { ...e.controls };
|
|
4717
|
-
|
|
4866
|
+
Rn.forEach((n) => {
|
|
4718
4867
|
let r = e.controls[n];
|
|
4719
|
-
r && (r.shapeFreeScaleCornerControl || (t[n] =
|
|
4868
|
+
r && (r.shapeFreeScaleCornerControl || (t[n] = Hn({ control: r })));
|
|
4720
4869
|
}), e.controls = t;
|
|
4721
|
-
},
|
|
4722
|
-
function
|
|
4870
|
+
}, Wn = "shape-group";
|
|
4871
|
+
function Gn() {
|
|
4723
4872
|
return { performLayout() {} };
|
|
4724
4873
|
}
|
|
4725
|
-
function
|
|
4874
|
+
function Kn({ layoutManager: e }) {
|
|
4726
4875
|
let t = y.getClass("layoutManager");
|
|
4727
4876
|
if (!e) return new t();
|
|
4728
4877
|
let { strategy: n, type: r } = e, i = y.getClass(r);
|
|
4729
4878
|
return n ? new i(new (y.getClass(n))()) : new i();
|
|
4730
4879
|
}
|
|
4731
|
-
var
|
|
4880
|
+
var qn = class e extends l {
|
|
4732
4881
|
static {
|
|
4733
|
-
this.type =
|
|
4882
|
+
this.type = Wn;
|
|
4734
4883
|
}
|
|
4735
4884
|
constructor(e = [], t = {}) {
|
|
4736
4885
|
let { layoutManager: n, objectCaching: r, centeredScaling: i, lockScalingFlip: a, ...o } = t;
|
|
@@ -4753,17 +4902,17 @@ var Rn = class e extends l {
|
|
|
4753
4902
|
bottom: this.shapePaddingBottom,
|
|
4754
4903
|
left: this.shapePaddingLeft
|
|
4755
4904
|
} });
|
|
4756
|
-
this.shapePaddingTop = e.top, this.shapePaddingRight = e.right, this.shapePaddingBottom = e.bottom, this.shapePaddingLeft = e.left, this._syncRoundability(),
|
|
4757
|
-
let t =
|
|
4758
|
-
t &&
|
|
4905
|
+
this.shapePaddingTop = e.top, this.shapePaddingRight = e.right, this.shapePaddingBottom = e.bottom, this.shapePaddingLeft = e.left, this._syncRoundability(), Pn({ group: this }), Un({ group: this });
|
|
4906
|
+
let t = Ln({ group: this });
|
|
4907
|
+
t && Fn({ text: t }), In({ group: this }), this.setCoords();
|
|
4759
4908
|
}
|
|
4760
4909
|
static async fromObject({ type: t, objects: n = [], layoutManager: r, ...i }, a) {
|
|
4761
4910
|
let [o, s] = await Promise.all([C.enlivenObjects(n, a), C.enlivenObjectEnlivables(i, a)]), c = new e(o, {
|
|
4762
4911
|
...i,
|
|
4763
4912
|
...s,
|
|
4764
|
-
layoutManager:
|
|
4913
|
+
layoutManager: Gn()
|
|
4765
4914
|
});
|
|
4766
|
-
return c.layoutManager =
|
|
4915
|
+
return c.layoutManager = Kn({ layoutManager: r }), c.layoutManager.subscribeTargets({
|
|
4767
4916
|
type: "initialization",
|
|
4768
4917
|
target: c,
|
|
4769
4918
|
targets: c.getObjects()
|
|
@@ -4776,9 +4925,9 @@ var Rn = class e extends l {
|
|
|
4776
4925
|
let t = dt({ presetKey: e });
|
|
4777
4926
|
t && (this.shapeCanRound = gt({ preset: t }));
|
|
4778
4927
|
}
|
|
4779
|
-
},
|
|
4780
|
-
y?.setClass && y.setClass(
|
|
4781
|
-
}, J = (e) => e instanceof
|
|
4928
|
+
}, Jn = () => {
|
|
4929
|
+
y?.setClass && y.setClass(qn, Wn);
|
|
4930
|
+
}, J = (e) => e instanceof qn || e instanceof l && e.shapeComposite === !0, Yn = ({ target: e, subTargets: t = [] }) => {
|
|
4782
4931
|
if (J(e)) return e;
|
|
4783
4932
|
if (e?.group && J(e.group)) return e.group;
|
|
4784
4933
|
for (let e = 0; e < t.length; e += 1) {
|
|
@@ -4788,7 +4937,7 @@ var Rn = class e extends l {
|
|
|
4788
4937
|
if (r && J(r)) return r;
|
|
4789
4938
|
}
|
|
4790
4939
|
return null;
|
|
4791
|
-
},
|
|
4940
|
+
}, Xn = ({ group: e }) => {
|
|
4792
4941
|
let t = e.getObjects();
|
|
4793
4942
|
for (let e = 0; e < t.length; e += 1) {
|
|
4794
4943
|
let n = t[e];
|
|
@@ -4799,7 +4948,7 @@ var Rn = class e extends l {
|
|
|
4799
4948
|
if (!(n instanceof _)) return n;
|
|
4800
4949
|
}
|
|
4801
4950
|
return null;
|
|
4802
|
-
},
|
|
4951
|
+
}, Zn = ({ group: e }) => {
|
|
4803
4952
|
let t = e.getObjects();
|
|
4804
4953
|
for (let e = 0; e < t.length; e += 1) {
|
|
4805
4954
|
let n = t[e];
|
|
@@ -4811,16 +4960,16 @@ var Rn = class e extends l {
|
|
|
4811
4960
|
}
|
|
4812
4961
|
return null;
|
|
4813
4962
|
}, Y = ({ group: e }) => ({
|
|
4814
|
-
shape:
|
|
4815
|
-
text:
|
|
4816
|
-
}),
|
|
4817
|
-
|
|
4818
|
-
},
|
|
4963
|
+
shape: Xn({ group: e }),
|
|
4964
|
+
text: Zn({ group: e })
|
|
4965
|
+
}), Qn = ({ group: e }) => {
|
|
4966
|
+
Pn({ group: e });
|
|
4967
|
+
}, $n = ({ transform: e, key: t }) => {
|
|
4819
4968
|
let n = e?.original;
|
|
4820
4969
|
if (!n || typeof n != "object") return null;
|
|
4821
4970
|
let r = n[t];
|
|
4822
4971
|
return typeof r != "number" || !Number.isFinite(r) ? null : r;
|
|
4823
|
-
},
|
|
4972
|
+
}, er = ({ value: e }) => e === "left" || e === "center" || e === "right" || typeof e == "number" && Number.isFinite(e) ? e : null, tr = ({ value: e }) => e === "top" || e === "center" || e === "bottom" || typeof e == "number" && Number.isFinite(e) ? e : null, nr = ({ transform: e }) => {
|
|
4824
4973
|
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;
|
|
4825
4974
|
return {
|
|
4826
4975
|
canScaleWidth: o,
|
|
@@ -4828,37 +4977,37 @@ var Rn = class e extends l {
|
|
|
4828
4977
|
isCornerScaleAction: r,
|
|
4829
4978
|
isVerticalOnlyScale: s && !o
|
|
4830
4979
|
};
|
|
4831
|
-
},
|
|
4980
|
+
}, rr = ({ event: e, group: t, transform: n, canvas: r }) => {
|
|
4832
4981
|
if (!e) return null;
|
|
4833
4982
|
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;
|
|
4834
4983
|
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;
|
|
4835
|
-
},
|
|
4984
|
+
}, ir = ({ group: e, originX: t, originY: n }) => {
|
|
4836
4985
|
if (t === null || n === null) return null;
|
|
4837
4986
|
let r = e, i = typeof r.getRelativeCenterPoint == "function" ? r.getRelativeCenterPoint() : e.getCenterPoint();
|
|
4838
4987
|
return typeof r.translateToOriginPoint == "function" ? r.translateToOriginPoint(i, t, n) : i;
|
|
4839
|
-
},
|
|
4988
|
+
}, ar = ({ state: e, transform: t }) => {
|
|
4840
4989
|
if (!t || e.startTransformOriginX === null && e.startTransformOriginY === null) return !1;
|
|
4841
|
-
let n =
|
|
4990
|
+
let n = er({ value: t.originX }), r = tr({ value: t.originY });
|
|
4842
4991
|
return n !== e.startTransformOriginX || r !== e.startTransformOriginY;
|
|
4843
|
-
},
|
|
4992
|
+
}, or = ({ state: e, transform: t }) => !t || !e.startTransformCorner ? !1 : t.corner !== e.startTransformCorner;
|
|
4844
4993
|
//#endregion
|
|
4845
4994
|
//#region src/editor/shape-manager/scaling/shape-scaling-preview.ts
|
|
4846
|
-
function
|
|
4995
|
+
function sr({ size: e, scale: t, strokeWidth: n, minSize: r, scaleEpsilon: i }) {
|
|
4847
4996
|
let a = Math.max(i, Math.abs(t) || 1), o = Math.max(0, n);
|
|
4848
4997
|
return o <= 0 ? Math.max(r, e / a) : Math.max(r, e / a + o - o / a);
|
|
4849
4998
|
}
|
|
4850
|
-
function
|
|
4999
|
+
function cr({ group: e, shape: t, width: n, height: r, scaleX: i, scaleY: a, minSize: o, scaleEpsilon: s }) {
|
|
4851
5000
|
let c = Math.max(0, e.shapeStrokeWidth ?? 0);
|
|
4852
5001
|
xt({
|
|
4853
5002
|
shape: t,
|
|
4854
|
-
width:
|
|
5003
|
+
width: sr({
|
|
4855
5004
|
size: n,
|
|
4856
5005
|
scale: i,
|
|
4857
5006
|
strokeWidth: c,
|
|
4858
5007
|
minSize: o,
|
|
4859
5008
|
scaleEpsilon: s
|
|
4860
5009
|
}),
|
|
4861
|
-
height:
|
|
5010
|
+
height: sr({
|
|
4862
5011
|
size: r,
|
|
4863
5012
|
scale: a,
|
|
4864
5013
|
strokeWidth: c,
|
|
@@ -4869,8 +5018,8 @@ function $n({ group: e, shape: t, width: n, height: r, scaleX: i, scaleY: a, min
|
|
|
4869
5018
|
strokeWidth: c
|
|
4870
5019
|
});
|
|
4871
5020
|
}
|
|
4872
|
-
function
|
|
4873
|
-
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 } =
|
|
5021
|
+
function lr({ text: e, width: t, height: n, padding: r, alignH: i, alignV: a, scaleX: o, scaleY: s, scaleEpsilon: c }) {
|
|
5022
|
+
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 } = un({
|
|
4874
5023
|
text: e,
|
|
4875
5024
|
width: t,
|
|
4876
5025
|
height: n,
|
|
@@ -4890,13 +5039,13 @@ function er({ text: e, width: t, height: n, padding: r, alignH: i, alignV: a, sc
|
|
|
4890
5039
|
scaleY: 1 / u
|
|
4891
5040
|
}), e.initDimensions(), e.setCoords();
|
|
4892
5041
|
}
|
|
4893
|
-
var
|
|
5042
|
+
var ur = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH: o, alignV: s, scaleX: c, scaleY: l, minSize: u, scaleEpsilon: d }) => {
|
|
4894
5043
|
let f = Math.max(d, Math.abs(c) || 1), p = Math.max(d, Math.abs(l) || 1);
|
|
4895
5044
|
e.set({
|
|
4896
5045
|
width: r / f,
|
|
4897
5046
|
height: i / p,
|
|
4898
5047
|
dirty: !0
|
|
4899
|
-
}),
|
|
5048
|
+
}), cr({
|
|
4900
5049
|
group: e,
|
|
4901
5050
|
shape: t,
|
|
4902
5051
|
width: r,
|
|
@@ -4905,7 +5054,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
4905
5054
|
scaleY: l,
|
|
4906
5055
|
minSize: u,
|
|
4907
5056
|
scaleEpsilon: d
|
|
4908
|
-
}),
|
|
5057
|
+
}), lr({
|
|
4909
5058
|
text: n,
|
|
4910
5059
|
width: r,
|
|
4911
5060
|
height: i,
|
|
@@ -4916,7 +5065,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
4916
5065
|
scaleY: l,
|
|
4917
5066
|
scaleEpsilon: d
|
|
4918
5067
|
});
|
|
4919
|
-
}, X = 1, Z = 1e-4,
|
|
5068
|
+
}, X = 1, Z = 1e-4, dr = .5, fr = class e {
|
|
4920
5069
|
constructor({ canvas: t }) {
|
|
4921
5070
|
this.handleObjectScaling = (t) => {
|
|
4922
5071
|
let { target: n, transform: r } = t;
|
|
@@ -4927,117 +5076,132 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
4927
5076
|
lockScalingFlip: !0,
|
|
4928
5077
|
centeredScaling: !1
|
|
4929
5078
|
});
|
|
4930
|
-
let s = e.
|
|
5079
|
+
let s = e._resolveScalingConstraintPadding({ group: i }), c = this._ensureScalingState({
|
|
4931
5080
|
group: i,
|
|
4932
5081
|
text: o,
|
|
4933
|
-
constraintPadding:
|
|
5082
|
+
constraintPadding: s,
|
|
4934
5083
|
transform: r
|
|
4935
|
-
}), { isCornerScaleAction:
|
|
4936
|
-
|
|
4937
|
-
let
|
|
5084
|
+
}), { isCornerScaleAction: l } = nr({ transform: r }), u = !!(t.e && "shiftKey" in t.e && t.e.shiftKey);
|
|
5085
|
+
c.isProportionalScaling = l && u;
|
|
5086
|
+
let d = i.left ?? 0, f = i.top ?? 0, p = !!i.flipX, m = !!i.flipY, h = i.shapeAlignHorizontal ?? "center", g = i.shapeAlignVertical ?? "middle", _ = this._resolveScalingDecision({
|
|
4938
5087
|
group: i,
|
|
4939
5088
|
text: o,
|
|
4940
|
-
constraintPadding:
|
|
4941
|
-
state:
|
|
5089
|
+
constraintPadding: s,
|
|
5090
|
+
state: c,
|
|
4942
5091
|
transform: r
|
|
5092
|
+
}), v = e._resolveEffectivePadding({
|
|
5093
|
+
group: i,
|
|
5094
|
+
width: _.previewWidth,
|
|
5095
|
+
height: _.previewHeight
|
|
4943
5096
|
}), y = Math.abs(i.scaleX ?? 1) || 1, b = Math.abs(i.scaleY ?? 1) || 1;
|
|
4944
|
-
(
|
|
5097
|
+
(_.shouldHandleAsNoop || _.shouldRestoreLastAllowedTransform || Math.abs(_.appliedScaleX - y) > Z || Math.abs(_.appliedScaleY - b) > Z) && this._applyResolvedScalingState({
|
|
4945
5098
|
group: i,
|
|
4946
|
-
state:
|
|
4947
|
-
shouldHandleAsNoop:
|
|
4948
|
-
scaleX:
|
|
4949
|
-
scaleY:
|
|
4950
|
-
}),
|
|
5099
|
+
state: c,
|
|
5100
|
+
shouldHandleAsNoop: _.shouldHandleAsNoop,
|
|
5101
|
+
scaleX: _.appliedScaleX,
|
|
5102
|
+
scaleY: _.appliedScaleY
|
|
5103
|
+
}), ur({
|
|
4951
5104
|
group: i,
|
|
4952
5105
|
shape: a,
|
|
4953
5106
|
text: o,
|
|
4954
|
-
width:
|
|
4955
|
-
height:
|
|
4956
|
-
padding:
|
|
4957
|
-
alignH:
|
|
4958
|
-
alignV:
|
|
4959
|
-
scaleX:
|
|
4960
|
-
scaleY:
|
|
5107
|
+
width: _.previewWidth,
|
|
5108
|
+
height: _.previewHeight,
|
|
5109
|
+
padding: v,
|
|
5110
|
+
alignH: h,
|
|
5111
|
+
alignV: g,
|
|
5112
|
+
scaleX: _.appliedScaleX,
|
|
5113
|
+
scaleY: _.appliedScaleY,
|
|
4961
5114
|
minSize: X,
|
|
4962
5115
|
scaleEpsilon: Z
|
|
4963
5116
|
}), this._restoreScalingAnchorPosition({
|
|
4964
5117
|
group: i,
|
|
4965
|
-
state:
|
|
4966
|
-
}), !
|
|
5118
|
+
state: c
|
|
5119
|
+
}), !_.shouldHandleAsNoop && !_.shouldRestoreLastAllowedTransform && this._storeLastAllowedTransform({
|
|
4967
5120
|
group: i,
|
|
4968
|
-
state:
|
|
5121
|
+
state: c,
|
|
4969
5122
|
scaleX: i.scaleX ?? 1,
|
|
4970
5123
|
scaleY: i.scaleY ?? 1,
|
|
4971
|
-
currentLeft:
|
|
4972
|
-
currentTop:
|
|
4973
|
-
currentFlipX:
|
|
4974
|
-
currentFlipY:
|
|
5124
|
+
currentLeft: d,
|
|
5125
|
+
currentTop: f,
|
|
5126
|
+
currentFlipX: p,
|
|
5127
|
+
currentFlipY: m
|
|
4975
5128
|
}), this.canvas.requestRenderAll();
|
|
4976
5129
|
}, this.handleCanvasMouseMove = (t) => {
|
|
4977
5130
|
let n = this.canvas._currentTransform;
|
|
4978
5131
|
if (!n) return;
|
|
4979
5132
|
let { target: r } = n;
|
|
4980
5133
|
if (!J(r)) return;
|
|
4981
|
-
let { canScaleHeight: i, canScaleWidth: a } =
|
|
5134
|
+
let { canScaleHeight: i, canScaleWidth: a } = nr({ transform: n });
|
|
4982
5135
|
if (!a && !i) return;
|
|
4983
5136
|
let o = r, s = this.scalingState.get(o);
|
|
4984
5137
|
if (!s || s.isProportionalScaling) return;
|
|
4985
5138
|
let { shape: c, text: l } = Y({ group: o });
|
|
4986
5139
|
if (!c || !l) return;
|
|
4987
|
-
let u = e.
|
|
5140
|
+
let u = e._resolveScalingConstraintPadding({ group: o }), d = o.shapeAlignHorizontal ?? "center", f = o.shapeAlignVertical ?? "middle", p = Math.abs(o.scaleX ?? s.lastAllowedScaleX ?? 1) || 1, m = Math.abs(o.scaleY ?? s.lastAllowedScaleY ?? 1) || 1, h = {
|
|
4988
5141
|
...t,
|
|
4989
5142
|
transform: n
|
|
4990
|
-
},
|
|
5143
|
+
}, g = p, _ = m, v = null, y = !1, b = !1;
|
|
4991
5144
|
if (a && this._hasPointerReachedScaleOrigin({
|
|
4992
|
-
event:
|
|
5145
|
+
event: h,
|
|
4993
5146
|
group: o,
|
|
4994
5147
|
axis: "x"
|
|
4995
5148
|
})) {
|
|
4996
|
-
let
|
|
5149
|
+
let t = ln({
|
|
4997
5150
|
text: l,
|
|
4998
|
-
padding:
|
|
4999
|
-
|
|
5000
|
-
|
|
5151
|
+
padding: u,
|
|
5152
|
+
resolvePaddingForWidth: ({ width: t }) => e._resolveScalingConstraintPadding({
|
|
5153
|
+
group: o,
|
|
5154
|
+
width: t,
|
|
5155
|
+
height: Math.max(X, s.startHeight * _)
|
|
5156
|
+
})
|
|
5157
|
+
}), n = Math.max(X / s.startWidth, t / s.startWidth);
|
|
5158
|
+
s.lastAllowedScaleX > n + Z && (g = n, y = !0, b = !0);
|
|
5001
5159
|
}
|
|
5002
5160
|
if (i && this._hasPointerReachedScaleOrigin({
|
|
5003
|
-
event:
|
|
5161
|
+
event: h,
|
|
5004
5162
|
group: o,
|
|
5005
5163
|
axis: "y"
|
|
5006
5164
|
})) {
|
|
5007
|
-
|
|
5165
|
+
v = this._resolveMinimumTextFitHeight({
|
|
5166
|
+
group: o,
|
|
5008
5167
|
text: l,
|
|
5009
|
-
width: Math.max(X, s.startWidth *
|
|
5010
|
-
padding:
|
|
5168
|
+
width: Math.max(X, s.startWidth * g),
|
|
5169
|
+
padding: u
|
|
5011
5170
|
});
|
|
5012
|
-
let e = Math.max(X / s.startHeight,
|
|
5013
|
-
s.lastAllowedScaleY > e + Z && (
|
|
5171
|
+
let e = Math.max(X / s.startHeight, v / s.startHeight);
|
|
5172
|
+
s.lastAllowedScaleY > e + Z && (_ = e, b = !0);
|
|
5014
5173
|
}
|
|
5015
|
-
if (!
|
|
5016
|
-
let
|
|
5174
|
+
if (!b) return;
|
|
5175
|
+
let x = this._resolvePreviewDimensions({
|
|
5176
|
+
group: o,
|
|
5017
5177
|
text: l,
|
|
5018
|
-
constraintPadding:
|
|
5178
|
+
constraintPadding: u,
|
|
5019
5179
|
state: s,
|
|
5020
|
-
appliedScaleX:
|
|
5021
|
-
appliedScaleY:
|
|
5022
|
-
minimumHeight:
|
|
5180
|
+
appliedScaleX: g,
|
|
5181
|
+
appliedScaleY: _,
|
|
5182
|
+
minimumHeight: y ? null : v
|
|
5183
|
+
}), S = e._resolveEffectivePadding({
|
|
5184
|
+
group: o,
|
|
5185
|
+
width: x.previewWidth,
|
|
5186
|
+
height: x.previewHeight
|
|
5023
5187
|
});
|
|
5024
5188
|
this._applyResolvedScalingState({
|
|
5025
5189
|
group: o,
|
|
5026
5190
|
state: s,
|
|
5027
5191
|
shouldHandleAsNoop: !1,
|
|
5028
|
-
scaleX:
|
|
5029
|
-
scaleY:
|
|
5030
|
-
}),
|
|
5192
|
+
scaleX: g,
|
|
5193
|
+
scaleY: _
|
|
5194
|
+
}), ur({
|
|
5031
5195
|
group: o,
|
|
5032
5196
|
shape: c,
|
|
5033
5197
|
text: l,
|
|
5034
|
-
width:
|
|
5035
|
-
height:
|
|
5036
|
-
padding:
|
|
5037
|
-
alignH:
|
|
5038
|
-
alignV:
|
|
5039
|
-
scaleX:
|
|
5040
|
-
scaleY:
|
|
5198
|
+
width: x.previewWidth,
|
|
5199
|
+
height: x.previewHeight,
|
|
5200
|
+
padding: S,
|
|
5201
|
+
alignH: d,
|
|
5202
|
+
alignV: f,
|
|
5203
|
+
scaleX: g,
|
|
5204
|
+
scaleY: _,
|
|
5041
5205
|
minSize: X,
|
|
5042
5206
|
scaleEpsilon: Z
|
|
5043
5207
|
}), this._restoreScalingAnchorPosition({
|
|
@@ -5046,8 +5210,8 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5046
5210
|
}), this._storeLastAllowedTransform({
|
|
5047
5211
|
group: o,
|
|
5048
5212
|
state: s,
|
|
5049
|
-
scaleX:
|
|
5050
|
-
scaleY:
|
|
5213
|
+
scaleX: g,
|
|
5214
|
+
scaleY: _,
|
|
5051
5215
|
currentLeft: s.lastAllowedLeft,
|
|
5052
5216
|
currentTop: s.lastAllowedTop,
|
|
5053
5217
|
currentFlipX: s.lastAllowedFlipX,
|
|
@@ -5074,20 +5238,26 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5074
5238
|
this.scalingState.delete(r);
|
|
5075
5239
|
return;
|
|
5076
5240
|
}
|
|
5077
|
-
let p = r.shapeAlignHorizontal ?? "center", m = r.shapeAlignVertical ?? "middle", h = e._resolveScalingConstraintPadding({ group: r }), g = t.transform ?
|
|
5241
|
+
let p = r.shapeAlignHorizontal ?? "center", m = r.shapeAlignVertical ?? "middle", h = e._resolveScalingConstraintPadding({ group: r }), g = t.transform ? nr({ transform: t.transform }) : null, _ = i?.canScaleWidth ?? g?.canScaleWidth ?? Math.abs(a - 1) > Z, v = i?.canScaleHeight ?? g?.canScaleHeight ?? Math.abs(o - 1) > Z, y = i?.lastAllowedScaleX ?? a, b = i?.lastAllowedScaleY ?? o, x = ln({
|
|
5078
5242
|
text: f,
|
|
5079
|
-
padding: h
|
|
5080
|
-
|
|
5243
|
+
padding: h,
|
|
5244
|
+
resolvePaddingForWidth: ({ width: t }) => e._resolveScalingConstraintPadding({
|
|
5245
|
+
group: r,
|
|
5246
|
+
width: t,
|
|
5247
|
+
height: Math.max(X, c * b)
|
|
5248
|
+
})
|
|
5249
|
+
});
|
|
5081
5250
|
if (!i?.isProportionalScaling) {
|
|
5082
5251
|
this._shouldClampWidthToMinimum({
|
|
5083
5252
|
event: t,
|
|
5084
5253
|
group: r,
|
|
5085
|
-
minimumWidth:
|
|
5254
|
+
minimumWidth: x,
|
|
5086
5255
|
state: i
|
|
5087
|
-
}) && (
|
|
5256
|
+
}) && (y = Math.max(X / s, x / s));
|
|
5088
5257
|
let e = this._resolveMinimumTextFitHeight({
|
|
5258
|
+
group: r,
|
|
5089
5259
|
text: f,
|
|
5090
|
-
width: Math.max(X, s *
|
|
5260
|
+
width: Math.max(X, s * y),
|
|
5091
5261
|
padding: h
|
|
5092
5262
|
});
|
|
5093
5263
|
this._shouldClampHeightToMinimum({
|
|
@@ -5095,9 +5265,9 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5095
5265
|
group: r,
|
|
5096
5266
|
minimumHeight: e,
|
|
5097
5267
|
state: i
|
|
5098
|
-
}) && (
|
|
5268
|
+
}) && (b = Math.max(X / c, e / c));
|
|
5099
5269
|
}
|
|
5100
|
-
let S = _ ? Math.max(X, s *
|
|
5270
|
+
let S = _ ? Math.max(X, s * y) : s, C = v ? Math.max(X, c * b) : u, w = Math.abs(S - s) > dr, T = Math.abs(C - c) > dr, E = w || T, D = S, O = C;
|
|
5101
5271
|
if (!E && i) {
|
|
5102
5272
|
this._restoreShapeStateWithoutResize({
|
|
5103
5273
|
group: r,
|
|
@@ -5126,7 +5296,13 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5126
5296
|
});
|
|
5127
5297
|
r.shapeManualBaseWidth = k.width, r.shapeManualBaseHeight = k.height;
|
|
5128
5298
|
let A = i?.baseRounding ?? Math.max(0, r.shapeRounding ?? 0);
|
|
5129
|
-
r.shapeRounding = Math.max(0, A * Math.min(
|
|
5299
|
+
r.shapeRounding = Math.max(0, A * Math.min(y, b));
|
|
5300
|
+
let j = e._resolveUserPadding({ group: r }), M = e._resolveInternalShapeTextInset({
|
|
5301
|
+
group: r,
|
|
5302
|
+
width: D,
|
|
5303
|
+
height: O
|
|
5304
|
+
});
|
|
5305
|
+
on({
|
|
5130
5306
|
group: r,
|
|
5131
5307
|
shape: d,
|
|
5132
5308
|
text: f,
|
|
@@ -5134,11 +5310,13 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5134
5310
|
height: O,
|
|
5135
5311
|
alignH: p,
|
|
5136
5312
|
alignV: m,
|
|
5137
|
-
padding:
|
|
5138
|
-
|
|
5313
|
+
padding: j,
|
|
5314
|
+
shapeTextAutoExpandEnabled: r.shapeTextAutoExpand !== !1,
|
|
5315
|
+
internalShapeTextInset: M,
|
|
5316
|
+
resolveInternalShapeTextInset: ({ width: t, height: n }) => e._resolveInternalShapeTextInset({
|
|
5139
5317
|
group: r,
|
|
5140
|
-
width:
|
|
5141
|
-
height:
|
|
5318
|
+
width: t,
|
|
5319
|
+
height: n
|
|
5142
5320
|
})
|
|
5143
5321
|
}), r.shapeReplaceBoxWidth = Math.max(1, r.shapeBaseWidth ?? D), r.shapeReplaceBoxHeight = Math.max(1, r.shapeBaseHeight ?? O), f.set({
|
|
5144
5322
|
scaleX: 1,
|
|
@@ -5153,15 +5331,16 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5153
5331
|
}, this.canvas = t, this.scalingState = /* @__PURE__ */ new WeakMap();
|
|
5154
5332
|
}
|
|
5155
5333
|
_resolveScalingDecision({ group: e, text: t, constraintPadding: n, state: r, transform: i }) {
|
|
5156
|
-
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 =
|
|
5334
|
+
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 = ar({
|
|
5157
5335
|
state: r,
|
|
5158
5336
|
transform: i
|
|
5159
|
-
}), d =
|
|
5337
|
+
}), d = or({
|
|
5160
5338
|
state: r,
|
|
5161
5339
|
transform: i
|
|
5162
5340
|
});
|
|
5163
5341
|
(l || u || d) && (r.crossedOppositeCorner = !0);
|
|
5164
5342
|
let f = this._resolveScalingConstraintState({
|
|
5343
|
+
group: e,
|
|
5165
5344
|
text: t,
|
|
5166
5345
|
constraintPadding: n,
|
|
5167
5346
|
state: r,
|
|
@@ -5171,6 +5350,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5171
5350
|
}), p = Math.abs(e.scaleX ?? 1) || 1, m = Math.abs(e.scaleY ?? 1) || 1, h = f.clampedScaleX ?? p, g = f.clampedScaleY ?? m;
|
|
5172
5351
|
f.shouldRestoreLastAllowedTransform && (h = r.lastAllowedScaleX, g = r.lastAllowedScaleY), f.shouldHandleAsNoop && (h = r.startScaleX, g = r.startScaleY);
|
|
5173
5352
|
let _ = !f.shouldHandleAsNoop && !f.shouldRestoreLastAllowedTransform && f.clampedScaleX === null, v = this._resolvePreviewDimensions({
|
|
5353
|
+
group: e,
|
|
5174
5354
|
text: t,
|
|
5175
5355
|
constraintPadding: n,
|
|
5176
5356
|
state: r,
|
|
@@ -5187,35 +5367,46 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5187
5367
|
shouldRestoreLastAllowedTransform: f.shouldRestoreLastAllowedTransform
|
|
5188
5368
|
};
|
|
5189
5369
|
}
|
|
5190
|
-
_resolveScalingConstraintState({ text:
|
|
5191
|
-
let { startHeight:
|
|
5192
|
-
text:
|
|
5193
|
-
padding:
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5370
|
+
_resolveScalingConstraintState({ group: t, text: n, constraintPadding: r, state: i, transform: a, scaleX: o, scaleY: s }) {
|
|
5371
|
+
let { startHeight: c, startWidth: l, cannotScaleDownAtStart: u, crossedOppositeCorner: d, isProportionalScaling: f, lastAllowedScaleX: p, lastAllowedScaleY: m, startScaleY: h } = i, g = Math.max(X, l * o), _ = Math.max(X, c * s), v = o < p - Z, y = s < m - Z, b = s < h - Z, { canScaleHeight: x, canScaleWidth: S, isVerticalOnlyScale: C } = nr({ transform: a }), w = S && v ? ln({
|
|
5372
|
+
text: n,
|
|
5373
|
+
padding: r,
|
|
5374
|
+
resolvePaddingForWidth: ({ width: n }) => e._resolveScalingConstraintPadding({
|
|
5375
|
+
group: t,
|
|
5376
|
+
width: n,
|
|
5377
|
+
height: _
|
|
5378
|
+
})
|
|
5379
|
+
}) : null, T = x && y ? this._resolveMinimumTextFitHeight({
|
|
5380
|
+
group: t,
|
|
5381
|
+
text: n,
|
|
5382
|
+
width: g,
|
|
5383
|
+
padding: r
|
|
5384
|
+
}) : null, E = C && u && b, D = w !== null && g < w + Z, O = T !== null && _ < T + Z, k = d || f && (D || O), A = null;
|
|
5385
|
+
!f && w !== null && g < w + Z && (A = Math.max(X / l, w / l));
|
|
5386
|
+
let j = null;
|
|
5387
|
+
return !f && T !== null && _ < T + Z && (j = Math.max(X / c, T / c)), {
|
|
5388
|
+
shouldHandleAsNoop: E,
|
|
5389
|
+
shouldRestoreLastAllowedTransform: k,
|
|
5390
|
+
clampedScaleX: A,
|
|
5391
|
+
clampedScaleY: j,
|
|
5392
|
+
resolvedMinimumHeight: T
|
|
5207
5393
|
};
|
|
5208
5394
|
}
|
|
5209
|
-
_resolvePreviewDimensions({ text:
|
|
5210
|
-
let
|
|
5211
|
-
text:
|
|
5212
|
-
width:
|
|
5213
|
-
height:
|
|
5214
|
-
padding:
|
|
5395
|
+
_resolvePreviewDimensions({ group: t, text: n, constraintPadding: r, state: i, appliedScaleX: a, appliedScaleY: o, minimumHeight: s }) {
|
|
5396
|
+
let c = i.canScaleWidth ? Math.max(X, i.startWidth * a) : i.startWidth, l = i.canScaleHeight ? Math.max(X, i.startHeight * o) : i.startManualBaseHeight, u = s ?? dn({
|
|
5397
|
+
text: n,
|
|
5398
|
+
width: c,
|
|
5399
|
+
height: l,
|
|
5400
|
+
padding: r,
|
|
5401
|
+
resolvePaddingForSize: ({ width: n, height: r }) => e._resolveScalingConstraintPadding({
|
|
5402
|
+
group: t,
|
|
5403
|
+
width: n,
|
|
5404
|
+
height: r
|
|
5405
|
+
})
|
|
5215
5406
|
});
|
|
5216
5407
|
return {
|
|
5217
|
-
previewWidth:
|
|
5218
|
-
previewHeight: Math.max(
|
|
5408
|
+
previewWidth: c,
|
|
5409
|
+
previewHeight: Math.max(l, u)
|
|
5219
5410
|
};
|
|
5220
5411
|
}
|
|
5221
5412
|
_applyResolvedScalingState({ group: e, state: t, shouldHandleAsNoop: n, scaleX: r, scaleY: i }) {
|
|
@@ -5240,7 +5431,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5240
5431
|
if (!r) return !1;
|
|
5241
5432
|
let { transform: i } = e;
|
|
5242
5433
|
if (!i) return !1;
|
|
5243
|
-
let { canScaleWidth: a } =
|
|
5434
|
+
let { canScaleWidth: a } = nr({ transform: i });
|
|
5244
5435
|
if (!a || !this._hasPointerReachedScaleOrigin({
|
|
5245
5436
|
event: e,
|
|
5246
5437
|
group: t,
|
|
@@ -5253,7 +5444,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5253
5444
|
if (!r) return !1;
|
|
5254
5445
|
let { transform: i } = e;
|
|
5255
5446
|
if (!i) return !1;
|
|
5256
|
-
let { canScaleHeight: a } =
|
|
5447
|
+
let { canScaleHeight: a } = nr({ transform: i });
|
|
5257
5448
|
if (!a || !this._hasPointerReachedScaleOrigin({
|
|
5258
5449
|
event: e,
|
|
5259
5450
|
group: t,
|
|
@@ -5267,7 +5458,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5267
5458
|
if (!r) return !1;
|
|
5268
5459
|
let i = r, a = n === "x" ? i.signX : i.signY;
|
|
5269
5460
|
if (typeof a != "number" || !Number.isFinite(a)) return !1;
|
|
5270
|
-
let o =
|
|
5461
|
+
let o = rr({
|
|
5271
5462
|
event: e.e,
|
|
5272
5463
|
group: t,
|
|
5273
5464
|
transform: r,
|
|
@@ -5284,23 +5475,24 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5284
5475
|
let a = this._resolveScalingStartDimensions({
|
|
5285
5476
|
group: e,
|
|
5286
5477
|
transform: r
|
|
5287
|
-
}), o =
|
|
5478
|
+
}), o = $n({
|
|
5288
5479
|
transform: r,
|
|
5289
5480
|
key: "scaleX"
|
|
5290
|
-
}), s =
|
|
5481
|
+
}), s = $n({
|
|
5291
5482
|
transform: r,
|
|
5292
5483
|
key: "scaleY"
|
|
5293
|
-
}), c =
|
|
5484
|
+
}), c = $n({
|
|
5294
5485
|
transform: r,
|
|
5295
5486
|
key: "left"
|
|
5296
|
-
}), l =
|
|
5487
|
+
}), l = $n({
|
|
5297
5488
|
transform: r,
|
|
5298
5489
|
key: "top"
|
|
5299
|
-
}), 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 =
|
|
5490
|
+
}), 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 = er({ value: r?.original?.originX ?? r?.originX }), h = tr({ value: r?.original?.originY ?? r?.originY }), g = typeof r?.corner == "string" ? r.corner : null, _ = ir({
|
|
5300
5491
|
group: e,
|
|
5301
5492
|
originX: m,
|
|
5302
5493
|
originY: h
|
|
5303
5494
|
}), v = this._resolveMinimumTextFitHeight({
|
|
5495
|
+
group: e,
|
|
5304
5496
|
text: t,
|
|
5305
5497
|
width: a.startWidth,
|
|
5306
5498
|
padding: n
|
|
@@ -5338,12 +5530,17 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5338
5530
|
}
|
|
5339
5531
|
return i;
|
|
5340
5532
|
}
|
|
5341
|
-
_resolveMinimumTextFitHeight({ text:
|
|
5342
|
-
return
|
|
5343
|
-
text:
|
|
5344
|
-
width:
|
|
5533
|
+
_resolveMinimumTextFitHeight({ group: t, text: n, width: r, padding: i }) {
|
|
5534
|
+
return dn({
|
|
5535
|
+
text: n,
|
|
5536
|
+
width: r,
|
|
5345
5537
|
height: X,
|
|
5346
|
-
padding:
|
|
5538
|
+
padding: i,
|
|
5539
|
+
resolvePaddingForSize: ({ width: n, height: r }) => e._resolveScalingConstraintPadding({
|
|
5540
|
+
group: t,
|
|
5541
|
+
width: n,
|
|
5542
|
+
height: r
|
|
5543
|
+
})
|
|
5347
5544
|
});
|
|
5348
5545
|
}
|
|
5349
5546
|
static _resolveUserPadding({ group: e }) {
|
|
@@ -5366,23 +5563,23 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5366
5563
|
strokeWidth: e.shapeStrokeWidth
|
|
5367
5564
|
});
|
|
5368
5565
|
}
|
|
5369
|
-
static _resolveEffectivePadding({ group: t }) {
|
|
5370
|
-
let
|
|
5566
|
+
static _resolveEffectivePadding({ group: t, width: n, height: r }) {
|
|
5567
|
+
let i = Math.max(X, n ?? t.shapeBaseWidth ?? t.width ?? t.shapeManualBaseWidth ?? X), a = Math.max(X, r ?? t.shapeBaseHeight ?? t.height ?? t.shapeManualBaseHeight ?? X), o = e._resolveUserPadding({ group: t });
|
|
5371
5568
|
return Ht({
|
|
5372
5569
|
base: e._resolveInternalShapeTextInset({
|
|
5373
5570
|
group: t,
|
|
5374
|
-
width:
|
|
5375
|
-
height:
|
|
5571
|
+
width: i,
|
|
5572
|
+
height: a
|
|
5376
5573
|
}),
|
|
5377
|
-
addition:
|
|
5574
|
+
addition: o
|
|
5378
5575
|
});
|
|
5379
5576
|
}
|
|
5380
|
-
static _resolveScalingConstraintPadding({ group: t }) {
|
|
5381
|
-
let
|
|
5577
|
+
static _resolveScalingConstraintPadding({ group: t, width: n, height: r }) {
|
|
5578
|
+
let i = Math.max(X, n ?? t.shapeBaseWidth ?? t.width ?? t.shapeManualBaseWidth ?? X), a = Math.max(X, r ?? t.shapeBaseHeight ?? t.height ?? t.shapeManualBaseHeight ?? X);
|
|
5382
5579
|
return e._resolveInternalShapeTextInset({
|
|
5383
5580
|
group: t,
|
|
5384
|
-
width:
|
|
5385
|
-
height:
|
|
5581
|
+
width: i,
|
|
5582
|
+
height: a
|
|
5386
5583
|
});
|
|
5387
5584
|
}
|
|
5388
5585
|
_restoreScalingAnchorPosition({ group: e, state: t }) {
|
|
@@ -5395,7 +5592,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5395
5592
|
}
|
|
5396
5593
|
_restoreShapeStateWithoutResize({ group: t, shape: n, text: r, state: i, startWidth: a, startHeight: o, alignH: s, alignV: c, userPadding: l }) {
|
|
5397
5594
|
let u = Math.max(X, t.shapeBaseWidth ?? t.width ?? a), d = Math.max(X, t.shapeBaseHeight ?? t.height ?? o);
|
|
5398
|
-
|
|
5595
|
+
on({
|
|
5399
5596
|
group: t,
|
|
5400
5597
|
shape: n,
|
|
5401
5598
|
text: r,
|
|
@@ -5408,6 +5605,11 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5408
5605
|
group: t,
|
|
5409
5606
|
width: u,
|
|
5410
5607
|
height: d
|
|
5608
|
+
}),
|
|
5609
|
+
resolveInternalShapeTextInset: ({ width: n, height: r }) => e._resolveInternalShapeTextInset({
|
|
5610
|
+
group: t,
|
|
5611
|
+
width: n,
|
|
5612
|
+
height: r
|
|
5411
5613
|
})
|
|
5412
5614
|
}), t.shapeReplaceBoxWidth = Math.max(1, t.shapeBaseWidth ?? u), t.shapeReplaceBoxHeight = Math.max(1, t.shapeBaseHeight ?? d), t.set({
|
|
5413
5615
|
left: i.lastAllowedLeft,
|
|
@@ -5447,7 +5649,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5447
5649
|
});
|
|
5448
5650
|
}
|
|
5449
5651
|
_resolveScalingStartDimensions({ group: e, transform: t }) {
|
|
5450
|
-
let { canScaleWidth: n, canScaleHeight: r } =
|
|
5652
|
+
let { canScaleWidth: n, canScaleHeight: r } = nr({ transform: t }), i = Math.max(X, e.shapeBaseWidth ?? e.width ?? e.shapeManualBaseWidth ?? X), a = Math.max(X, e.shapeBaseHeight ?? e.height ?? e.shapeManualBaseHeight ?? X);
|
|
5451
5653
|
return {
|
|
5452
5654
|
startWidth: i,
|
|
5453
5655
|
startHeight: a,
|
|
@@ -5466,10 +5668,10 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5466
5668
|
height: s
|
|
5467
5669
|
};
|
|
5468
5670
|
}
|
|
5469
|
-
},
|
|
5671
|
+
}, pr = class {
|
|
5470
5672
|
constructor({ canvas: e }) {
|
|
5471
5673
|
this.handleMouseDown = (e) => {
|
|
5472
|
-
let { target: t, e: n, subTargets: r = [] } = e, i =
|
|
5674
|
+
let { target: t, e: n, subTargets: r = [] } = e, i = Yn({
|
|
5473
5675
|
target: t,
|
|
5474
5676
|
subTargets: r
|
|
5475
5677
|
});
|
|
@@ -5479,7 +5681,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5479
5681
|
let o = this.canvas.getActiveObject(), s = o === i;
|
|
5480
5682
|
if (!(o === a && a.isEditing)) {
|
|
5481
5683
|
if (!s) {
|
|
5482
|
-
a.isEditing ||
|
|
5684
|
+
a.isEditing || Fn({ text: a });
|
|
5483
5685
|
return;
|
|
5484
5686
|
}
|
|
5485
5687
|
n instanceof MouseEvent && (n.detail < 2 || this.enterTextEditing({ group: i }));
|
|
@@ -5499,14 +5701,14 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5499
5701
|
J(r) && (this._restoreTextEditingInteractionMode({
|
|
5500
5702
|
group: r,
|
|
5501
5703
|
text: n
|
|
5502
|
-
}),
|
|
5704
|
+
}), Fn({ text: n }), this.canvas.getActiveObject() === n && this.canvas.setActiveObject(r), this.canvas.requestRenderAll());
|
|
5503
5705
|
}, this.canvas = e, this.editingInteractionState = /* @__PURE__ */ new WeakMap();
|
|
5504
5706
|
}
|
|
5505
5707
|
enterTextEditing({ group: e }) {
|
|
5506
5708
|
let { text: t } = Y({ group: e });
|
|
5507
5709
|
if (t) {
|
|
5508
5710
|
if (e.locked || t.locked) {
|
|
5509
|
-
|
|
5711
|
+
Fn({ text: t }), this.canvas.requestRenderAll();
|
|
5510
5712
|
return;
|
|
5511
5713
|
}
|
|
5512
5714
|
this._enterTextEditingInteractionMode({
|
|
@@ -5556,7 +5758,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5556
5758
|
lockMovementY: n.textLockMovementY
|
|
5557
5759
|
}), this.editingInteractionState.delete(e), e.setCoords(), t.setCoords());
|
|
5558
5760
|
}
|
|
5559
|
-
},
|
|
5761
|
+
}, mr = class e {
|
|
5560
5762
|
constructor({ canvas: e }) {
|
|
5561
5763
|
this.canvas = e, this.textEditingSnapshots = /* @__PURE__ */ new WeakMap(), this.pendingTextUpdates = /* @__PURE__ */ new WeakMap(), this.resizeStartSnapshots = /* @__PURE__ */ new Map(), this.pendingResizeUpdates = /* @__PURE__ */ new WeakMap();
|
|
5562
5764
|
}
|
|
@@ -5752,7 +5954,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5752
5954
|
}
|
|
5753
5955
|
}), I;
|
|
5754
5956
|
}
|
|
5755
|
-
},
|
|
5957
|
+
}, hr = "#B4B7BD", gr = 0, _r = 1, vr = class {
|
|
5756
5958
|
constructor({ editor: e }) {
|
|
5757
5959
|
this._handleObjectScaling = (e) => {
|
|
5758
5960
|
let t = e.target && J(e.target) ? e.target : null;
|
|
@@ -5817,7 +6019,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5817
6019
|
if (!(t instanceof _)) return;
|
|
5818
6020
|
let n = t;
|
|
5819
6021
|
this.lifecycleController.finishTextUpdate({ textNode: n });
|
|
5820
|
-
}, this.editor = e,
|
|
6022
|
+
}, this.editor = e, Jn(), this.scalingController = new fr({ canvas: e.canvas }), this.editingController = new pr({ canvas: e.canvas }), this.editingPlacements = /* @__PURE__ */ new WeakMap(), this.lifecycleController = new mr({ canvas: e.canvas }), this.internalTextUpdates = /* @__PURE__ */ new WeakSet(), this._bindEvents();
|
|
5821
6023
|
}
|
|
5822
6024
|
async add({ presetKey: e = ot, options: t = {} } = {}) {
|
|
5823
6025
|
let n = dt({ presetKey: e });
|
|
@@ -5831,7 +6033,15 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5831
6033
|
}), T = p ?? "middle", E = this._resolveShapeStyle({
|
|
5832
6034
|
options: t,
|
|
5833
6035
|
fallback: null
|
|
5834
|
-
}), O = zt({ padding: m }), k = Ut({
|
|
6036
|
+
}), O = zt({ padding: m }), k = ({ width: e, height: t }) => Ut({
|
|
6037
|
+
baseInset: mt({
|
|
6038
|
+
preset: b,
|
|
6039
|
+
width: e,
|
|
6040
|
+
height: t
|
|
6041
|
+
}),
|
|
6042
|
+
stroke: E.stroke,
|
|
6043
|
+
strokeWidth: E.strokeWidth
|
|
6044
|
+
}), A = Ut({
|
|
5835
6045
|
baseInset: mt({
|
|
5836
6046
|
preset: b,
|
|
5837
6047
|
width: x,
|
|
@@ -5839,34 +6049,41 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5839
6049
|
}),
|
|
5840
6050
|
stroke: E.stroke,
|
|
5841
6051
|
strokeWidth: E.strokeWidth
|
|
5842
|
-
}),
|
|
5843
|
-
base:
|
|
6052
|
+
}), j = Ht({
|
|
6053
|
+
base: A,
|
|
5844
6054
|
addition: O
|
|
5845
|
-
}),
|
|
6055
|
+
}), M = Wt({ padding: m }), N = this._createTextNode({
|
|
5846
6056
|
text: u,
|
|
5847
6057
|
textStyle: d,
|
|
5848
6058
|
width: x,
|
|
5849
6059
|
align: w,
|
|
5850
6060
|
opacity: E.opacity
|
|
5851
|
-
}),
|
|
5852
|
-
text:
|
|
6061
|
+
}), P = this._resolveShapeLayoutWidth({
|
|
6062
|
+
text: N,
|
|
5853
6063
|
currentWidth: x,
|
|
5854
6064
|
manualWidth: x,
|
|
5855
6065
|
shapeTextAutoExpandEnabled: C,
|
|
5856
|
-
padding:
|
|
5857
|
-
|
|
6066
|
+
padding: j,
|
|
6067
|
+
resolvePaddingForWidth: ({ width: e }) => Ht({
|
|
6068
|
+
base: k({
|
|
6069
|
+
width: e,
|
|
6070
|
+
height: S
|
|
6071
|
+
}),
|
|
6072
|
+
addition: O
|
|
6073
|
+
})
|
|
6074
|
+
}), F = await Pt({
|
|
5858
6075
|
preset: b,
|
|
5859
|
-
width:
|
|
6076
|
+
width: P,
|
|
5860
6077
|
height: S,
|
|
5861
6078
|
style: E,
|
|
5862
6079
|
rounding: h
|
|
5863
|
-
}),
|
|
6080
|
+
}), I = this._createShapeGroup({
|
|
5864
6081
|
id: y ?? `shape-${D()}`,
|
|
5865
6082
|
presetKey: b.key,
|
|
5866
6083
|
presetCanRound: gt({ preset: b }),
|
|
5867
|
-
shape:
|
|
5868
|
-
text:
|
|
5869
|
-
width:
|
|
6084
|
+
shape: F,
|
|
6085
|
+
text: N,
|
|
6086
|
+
width: P,
|
|
5870
6087
|
height: S,
|
|
5871
6088
|
manualWidth: x,
|
|
5872
6089
|
manualHeight: S,
|
|
@@ -5874,19 +6091,19 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5874
6091
|
alignH: w,
|
|
5875
6092
|
alignV: T,
|
|
5876
6093
|
padding: O,
|
|
5877
|
-
internalShapeTextInset:
|
|
5878
|
-
changedPadding:
|
|
6094
|
+
internalShapeTextInset: A,
|
|
6095
|
+
changedPadding: M,
|
|
5879
6096
|
style: E,
|
|
5880
6097
|
rounding: h
|
|
5881
|
-
}),
|
|
5882
|
-
shape:
|
|
6098
|
+
}), L = {
|
|
6099
|
+
shape: I,
|
|
5883
6100
|
presetKey: b.key,
|
|
5884
6101
|
options: t
|
|
5885
6102
|
};
|
|
5886
|
-
if (o === void 0 && s === void 0) this.editor.canvasManager.centerObjectToMontageArea({ object:
|
|
6103
|
+
if (o === void 0 && s === void 0) this.editor.canvasManager.centerObjectToMontageArea({ object: I });
|
|
5887
6104
|
else {
|
|
5888
6105
|
let e = this.editor.canvasManager.resolveObjectPlacement({
|
|
5889
|
-
object:
|
|
6106
|
+
object: I,
|
|
5890
6107
|
left: o,
|
|
5891
6108
|
top: s,
|
|
5892
6109
|
originX: c,
|
|
@@ -5894,18 +6111,18 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5894
6111
|
fallbackPoint: this.editor.canvasManager.getMontageAreaSceneCenter()
|
|
5895
6112
|
});
|
|
5896
6113
|
this.editor.canvasManager.applyObjectPlacement({
|
|
5897
|
-
object:
|
|
6114
|
+
object: I,
|
|
5898
6115
|
placement: e
|
|
5899
6116
|
});
|
|
5900
6117
|
}
|
|
5901
|
-
if (g) return this.editor.canvas.fire("editor:shape-added",
|
|
6118
|
+
if (g) return this.editor.canvas.fire("editor:shape-added", L), I;
|
|
5902
6119
|
this._beginMutation();
|
|
5903
6120
|
try {
|
|
5904
|
-
this.editor.canvas.add(
|
|
6121
|
+
this.editor.canvas.add(I), _ || this.editor.canvas.setActiveObject(I), this.editor.canvas.requestRenderAll();
|
|
5905
6122
|
} finally {
|
|
5906
6123
|
this._endMutation({ withoutSave: v });
|
|
5907
6124
|
}
|
|
5908
|
-
return this.editor.canvas.fire("editor:shape-added",
|
|
6125
|
+
return this.editor.canvas.fire("editor:shape-added", L), I;
|
|
5909
6126
|
}
|
|
5910
6127
|
async update({ target: e, presetKey: t, options: n = {} } = {}) {
|
|
5911
6128
|
let r = this._resolveShapeGroup({ target: e });
|
|
@@ -5921,46 +6138,49 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5921
6138
|
}), S = this._resolveCurrentDimensions({ group: r }), C = this._resolveManualDimensions({ group: r }), w = this._resolveReplaceBoxDimensions({ group: r }), T = this._isShapeTextAutoExpandEnabled({ group: r }), E = f === void 0 ? T : f !== !1, D = v ?? r.shapeRounding ?? 0, O = dt({ presetKey: ft({
|
|
5922
6139
|
preset: i,
|
|
5923
6140
|
rounding: D
|
|
5924
|
-
}) }) ?? i, { width: k, height: A } = O, j = !!d, M = t !== void 0, N = M && !j ? {
|
|
6141
|
+
}) }) ?? i, { width: k, height: A } = O, j = !!d, M = t !== void 0, N = M && !j, P = N ? {
|
|
5925
6142
|
width: Math.max(1, l ?? w.width),
|
|
5926
6143
|
height: Math.max(1, u ?? w.height)
|
|
5927
|
-
} : null, { width:
|
|
5928
|
-
targetWidth:
|
|
5929
|
-
targetHeight:
|
|
6144
|
+
} : null, { width: F, height: I } = P ? this._resolveAspectRatioFittedDimensions({
|
|
6145
|
+
targetWidth: P.width,
|
|
6146
|
+
targetHeight: P.height,
|
|
5930
6147
|
aspectWidth: k,
|
|
5931
6148
|
aspectHeight: A
|
|
5932
6149
|
}) : {
|
|
5933
6150
|
width: Math.max(1, l ?? S.width),
|
|
5934
6151
|
height: Math.max(1, u ?? S.height)
|
|
5935
|
-
},
|
|
5936
|
-
base:
|
|
6152
|
+
}, L = h ?? r.shapeAlignHorizontal ?? "center", ee = g ?? r.shapeAlignVertical ?? "middle", R = this._resolveGroupUserPadding({ group: r }), te = Wt({ padding: _ }), ne = Vt({
|
|
6153
|
+
base: R,
|
|
5937
6154
|
override: _
|
|
5938
|
-
}),
|
|
6155
|
+
}), z = this._resolveShapeStyle({
|
|
5939
6156
|
options: n,
|
|
5940
6157
|
fallback: r
|
|
5941
|
-
}),
|
|
6158
|
+
}), re = ({ width: e, height: t }) => Ut({
|
|
5942
6159
|
baseInset: mt({
|
|
5943
6160
|
preset: O,
|
|
5944
|
-
width:
|
|
5945
|
-
height:
|
|
6161
|
+
width: e,
|
|
6162
|
+
height: t
|
|
6163
|
+
}),
|
|
6164
|
+
stroke: z.stroke,
|
|
6165
|
+
strokeWidth: z.strokeWidth
|
|
6166
|
+
}), B = Ht({
|
|
6167
|
+
base: re({
|
|
6168
|
+
width: F,
|
|
6169
|
+
height: I
|
|
5946
6170
|
}),
|
|
5947
|
-
stroke: re.stroke,
|
|
5948
|
-
strokeWidth: re.strokeWidth
|
|
5949
|
-
}), ie = Ht({
|
|
5950
|
-
base: R,
|
|
5951
6171
|
addition: ne
|
|
5952
|
-
}),
|
|
5953
|
-
M && (
|
|
5954
|
-
let { shape:
|
|
5955
|
-
if (!
|
|
5956
|
-
let
|
|
6172
|
+
}), V = C.width, H = C.height;
|
|
6173
|
+
M && (V = F, H = I), !M && l !== void 0 && (V = Math.max(1, l)), !M && u !== void 0 && (H = Math.max(1, u)), !M && l === void 0 && T && !E && (V = S.width);
|
|
6174
|
+
let { shape: ie, text: U } = Y({ group: r });
|
|
6175
|
+
if (!ie || !U) return null;
|
|
6176
|
+
let ae = this.lifecycleController.createContext({
|
|
5957
6177
|
group: r,
|
|
5958
6178
|
source: "update",
|
|
5959
6179
|
target: e,
|
|
5960
6180
|
presetKey: O.key,
|
|
5961
6181
|
options: n,
|
|
5962
6182
|
withoutSave: b
|
|
5963
|
-
}),
|
|
6183
|
+
}), oe = {
|
|
5964
6184
|
angle: 0,
|
|
5965
6185
|
skewX: 0,
|
|
5966
6186
|
skewY: 0,
|
|
@@ -5973,77 +6193,91 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
5973
6193
|
top: 0,
|
|
5974
6194
|
originX: "left",
|
|
5975
6195
|
originY: "top"
|
|
5976
|
-
},
|
|
5977
|
-
text:
|
|
5978
|
-
textStyle: this._resolveCurrentTextStyle({ textNode:
|
|
5979
|
-
width: Math.max(1,
|
|
5980
|
-
align:
|
|
6196
|
+
}, se = U, ce = this._createTextNode({
|
|
6197
|
+
text: se.textCaseRaw ?? U.text ?? "",
|
|
6198
|
+
textStyle: this._resolveCurrentTextStyle({ textNode: U }),
|
|
6199
|
+
width: Math.max(1, U.width ?? S.width),
|
|
6200
|
+
align: L
|
|
5981
6201
|
});
|
|
5982
|
-
|
|
5983
|
-
textNode:
|
|
6202
|
+
ce.set(oe), this._applyTextUpdates({
|
|
6203
|
+
textNode: ce,
|
|
5984
6204
|
text: p,
|
|
5985
6205
|
textStyle: m,
|
|
5986
|
-
align:
|
|
6206
|
+
align: L
|
|
5987
6207
|
});
|
|
5988
|
-
let
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
|
|
6208
|
+
let le = l === void 0 && u === void 0 && t === void 0 && f === void 0 && v === void 0 && p === void 0 && !this._hasShapeTextSizeAffectingStyleChanges({ textStyle: m }), ue = _ !== void 0 && le, de = F, fe = I;
|
|
6209
|
+
le ? (de = S.width, fe = S.height) : N || (de = this._resolveShapeLayoutWidth({
|
|
6210
|
+
text: ce,
|
|
6211
|
+
currentWidth: F,
|
|
6212
|
+
manualWidth: V,
|
|
5992
6213
|
shapeTextAutoExpandEnabled: E,
|
|
5993
|
-
padding:
|
|
5994
|
-
|
|
6214
|
+
padding: B,
|
|
6215
|
+
resolvePaddingForWidth: ({ width: e }) => Ht({
|
|
6216
|
+
base: re({
|
|
6217
|
+
width: e,
|
|
6218
|
+
height: I
|
|
6219
|
+
}),
|
|
6220
|
+
addition: ne
|
|
6221
|
+
})
|
|
6222
|
+
}));
|
|
6223
|
+
let pe = re({
|
|
6224
|
+
width: de,
|
|
6225
|
+
height: fe
|
|
6226
|
+
}), me = await Pt({
|
|
5995
6227
|
preset: O,
|
|
5996
|
-
width:
|
|
5997
|
-
height:
|
|
5998
|
-
style:
|
|
6228
|
+
width: de,
|
|
6229
|
+
height: fe,
|
|
6230
|
+
style: z,
|
|
5999
6231
|
rounding: D
|
|
6000
|
-
}),
|
|
6001
|
-
if (
|
|
6002
|
-
let
|
|
6003
|
-
this._detachShapeGroupAutoLayout({ group: r }),
|
|
6004
|
-
textNode:
|
|
6232
|
+
}), he = r.getObjects().indexOf(ie);
|
|
6233
|
+
if (he < 0) return null;
|
|
6234
|
+
let ge = () => {
|
|
6235
|
+
this._detachShapeGroupAutoLayout({ group: r }), U.set(oe), this._applyTextUpdates({
|
|
6236
|
+
textNode: U,
|
|
6005
6237
|
text: p,
|
|
6006
6238
|
textStyle: m,
|
|
6007
|
-
align:
|
|
6008
|
-
}), r.remove(
|
|
6239
|
+
align: L
|
|
6240
|
+
}), r.remove(ie), r.insertAt(he, me), this._applyShapeGroupMetadata({
|
|
6009
6241
|
group: r,
|
|
6010
6242
|
presetKey: O.key,
|
|
6011
6243
|
presetCanRound: gt({ preset: O }),
|
|
6012
|
-
width:
|
|
6013
|
-
height:
|
|
6014
|
-
manualWidth:
|
|
6015
|
-
manualHeight:
|
|
6016
|
-
replaceBoxWidth:
|
|
6017
|
-
replaceBoxHeight:
|
|
6244
|
+
width: de,
|
|
6245
|
+
height: fe,
|
|
6246
|
+
manualWidth: V,
|
|
6247
|
+
manualHeight: H,
|
|
6248
|
+
replaceBoxWidth: P?.width,
|
|
6249
|
+
replaceBoxHeight: P?.height,
|
|
6018
6250
|
shapeTextAutoExpand: E,
|
|
6019
|
-
alignH:
|
|
6251
|
+
alignH: L,
|
|
6020
6252
|
alignV: ee,
|
|
6021
6253
|
padding: ne,
|
|
6022
|
-
style:
|
|
6254
|
+
style: z,
|
|
6023
6255
|
rounding: D
|
|
6024
6256
|
}), this._applyCurrentLayout({
|
|
6025
6257
|
group: r,
|
|
6026
|
-
shape:
|
|
6027
|
-
text:
|
|
6258
|
+
shape: me,
|
|
6259
|
+
text: U,
|
|
6028
6260
|
placement: x,
|
|
6029
|
-
width:
|
|
6030
|
-
height:
|
|
6031
|
-
alignH:
|
|
6261
|
+
width: de,
|
|
6262
|
+
height: fe,
|
|
6263
|
+
alignH: L,
|
|
6032
6264
|
alignV: ee,
|
|
6033
|
-
internalShapeTextInset:
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
6265
|
+
internalShapeTextInset: pe,
|
|
6266
|
+
resolveInternalShapeTextInset: re,
|
|
6267
|
+
preserveAspectRatio: N,
|
|
6268
|
+
minimumReplaceBox: P ?? void 0,
|
|
6269
|
+
expandShapeHeightToFitText: !ue,
|
|
6270
|
+
changedPadding: te
|
|
6271
|
+
}), N && (r.shapeManualBaseWidth = Math.max(1, r.shapeBaseWidth ?? de), r.shapeManualBaseHeight = Math.max(1, r.shapeBaseHeight ?? fe)), U.isEditing && this.editingPlacements.set(r, x);
|
|
6038
6272
|
};
|
|
6039
|
-
if (!this._isOnCanvas({ object: r })) return
|
|
6273
|
+
if (!this._isOnCanvas({ object: r })) return ge(), this.lifecycleController.fireBefore({ lifecycle: ae }), this.lifecycleController.fireUpdated({ lifecycle: ae }), r;
|
|
6040
6274
|
this._beginMutation();
|
|
6041
6275
|
try {
|
|
6042
|
-
|
|
6276
|
+
ge(), !U.isEditing && !y && this.editor.canvas.setActiveObject(r), this.lifecycleController.fireBefore({ lifecycle: ae }), this.editor.canvas.requestRenderAll();
|
|
6043
6277
|
} finally {
|
|
6044
6278
|
this._endMutation({ withoutSave: b });
|
|
6045
6279
|
}
|
|
6046
|
-
return this.lifecycleController.fireUpdated({ lifecycle:
|
|
6280
|
+
return this.lifecycleController.fireUpdated({ lifecycle: ae }), r;
|
|
6047
6281
|
}
|
|
6048
6282
|
_resolveAspectRatioFittedDimensions({ targetWidth: e, targetHeight: t, aspectWidth: n, aspectHeight: r }) {
|
|
6049
6283
|
let i = Math.max(1, n), a = Math.max(1, r), o = e === void 0 ? void 0 : Math.max(1, e), s = t === void 0 ? void 0 : Math.max(1, t);
|
|
@@ -6249,8 +6483,8 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6249
6483
|
let { canvas: e } = this.editor;
|
|
6250
6484
|
e.on("object:scaling", this._handleObjectScaling), e.on("object:modified", this._handleObjectModified), e.on("mouse:move", this._handleMouseMove), e.on("mouse:down", this._handleMouseDown), e.on("mouse:up", this._handleMouseUp), e.on("text:editing:entered", this._handleTextEditingEntered), e.on("text:editing:exited", this._handleTextEditingExited), e.on("text:changed", this._handleTextChanged), e.on("editor:before:text-updated", this._handleBeforeTextUpdated), e.on("editor:text-updated", this._handleTextUpdated);
|
|
6251
6485
|
}
|
|
6252
|
-
_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,
|
|
6253
|
-
let
|
|
6486
|
+
_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, resolveInternalShapeTextInset: m, changedPadding: h, style: g, rounding: _ }) {
|
|
6487
|
+
let v = new qn([r, i], {
|
|
6254
6488
|
originX: "center",
|
|
6255
6489
|
originY: "center",
|
|
6256
6490
|
left: 0,
|
|
@@ -6258,9 +6492,9 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6258
6492
|
lockScalingFlip: !0,
|
|
6259
6493
|
centeredScaling: !1,
|
|
6260
6494
|
objectCaching: !1
|
|
6261
|
-
}),
|
|
6262
|
-
return
|
|
6263
|
-
group:
|
|
6495
|
+
}), y = v;
|
|
6496
|
+
return y.id = e, this._applyShapeGroupMetadata({
|
|
6497
|
+
group: v,
|
|
6264
6498
|
presetKey: t,
|
|
6265
6499
|
presetCanRound: n,
|
|
6266
6500
|
width: a,
|
|
@@ -6271,10 +6505,10 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6271
6505
|
alignH: u,
|
|
6272
6506
|
alignV: d,
|
|
6273
6507
|
padding: f,
|
|
6274
|
-
style:
|
|
6275
|
-
rounding:
|
|
6276
|
-
}),
|
|
6277
|
-
group:
|
|
6508
|
+
style: g,
|
|
6509
|
+
rounding: _
|
|
6510
|
+
}), v.rehydrateRuntimeState(), Qn({ group: v }), Fn({ text: i }), on({
|
|
6511
|
+
group: v,
|
|
6278
6512
|
shape: r,
|
|
6279
6513
|
text: i,
|
|
6280
6514
|
width: a,
|
|
@@ -6282,9 +6516,11 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6282
6516
|
alignH: u,
|
|
6283
6517
|
alignV: d,
|
|
6284
6518
|
padding: f,
|
|
6519
|
+
shapeTextAutoExpandEnabled: l,
|
|
6285
6520
|
internalShapeTextInset: p,
|
|
6286
|
-
|
|
6287
|
-
|
|
6521
|
+
resolveInternalShapeTextInset: m,
|
|
6522
|
+
changedPadding: h
|
|
6523
|
+
}), v.shapeReplaceBoxWidth = Math.max(1, v.shapeBaseWidth ?? a), v.shapeReplaceBoxHeight = Math.max(1, v.shapeBaseHeight ?? o), this._detachShapeGroupAutoLayout({ group: v }), v;
|
|
6288
6524
|
}
|
|
6289
6525
|
_applyShapeGroupMetadata({ group: e, presetKey: t, presetCanRound: n, width: r, height: i, manualWidth: a, manualHeight: o, replaceBoxWidth: s, replaceBoxHeight: c, shapeTextAutoExpand: l, alignH: u, alignV: d, padding: f, style: p, rounding: m }) {
|
|
6290
6526
|
let h = p.strokeDashArray ? p.strokeDashArray.slice() : p.strokeDashArray ?? null;
|
|
@@ -6334,7 +6570,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6334
6570
|
return s.set({
|
|
6335
6571
|
shapeNodeType: "text",
|
|
6336
6572
|
splitByGrapheme: !1
|
|
6337
|
-
}),
|
|
6573
|
+
}), Fn({ text: s }), s;
|
|
6338
6574
|
}
|
|
6339
6575
|
_applyTextUpdates({ textNode: e, text: t, textStyle: n, align: r }) {
|
|
6340
6576
|
let i = {};
|
|
@@ -6442,64 +6678,83 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6442
6678
|
let { width: n } = e.getMontageAreaSceneBounds();
|
|
6443
6679
|
return !Number.isFinite(n) || n <= 0 ? null : n;
|
|
6444
6680
|
}
|
|
6445
|
-
_resolveAutoExpandShapeWidth({ text: e, currentWidth: t, minimumWidth: n, padding: r }) {
|
|
6446
|
-
let
|
|
6447
|
-
return
|
|
6681
|
+
_resolveAutoExpandShapeWidth({ text: e, currentWidth: t, minimumWidth: n, padding: r, resolvePaddingForWidth: i }) {
|
|
6682
|
+
let a = this._resolveMontageAreaWidth();
|
|
6683
|
+
return a ? cn({
|
|
6448
6684
|
text: e,
|
|
6449
6685
|
currentWidth: t,
|
|
6450
6686
|
minimumWidth: n,
|
|
6451
6687
|
padding: r,
|
|
6452
|
-
montageAreaWidth:
|
|
6688
|
+
montageAreaWidth: a,
|
|
6689
|
+
resolvePaddingForWidth: i
|
|
6453
6690
|
}) : Math.max(1, t, n);
|
|
6454
6691
|
}
|
|
6455
|
-
_resolveShapeLayoutWidth({ text: e, currentWidth: t, manualWidth: n, shapeTextAutoExpandEnabled: r, padding: i }) {
|
|
6692
|
+
_resolveShapeLayoutWidth({ text: e, currentWidth: t, manualWidth: n, shapeTextAutoExpandEnabled: r, padding: i, resolvePaddingForWidth: a }) {
|
|
6456
6693
|
return r ? this._resolveAutoExpandShapeWidth({
|
|
6457
6694
|
text: e,
|
|
6458
6695
|
currentWidth: t,
|
|
6459
6696
|
minimumWidth: n,
|
|
6460
|
-
padding: i
|
|
6697
|
+
padding: i,
|
|
6698
|
+
resolvePaddingForWidth: a
|
|
6461
6699
|
}) : Math.max(1, n);
|
|
6462
6700
|
}
|
|
6463
6701
|
_resolveShapeTextHorizontalAlign({ group: e, textStyle: t }) {
|
|
6464
6702
|
let n = t?.align;
|
|
6465
6703
|
return n === "left" || n === "center" || n === "right" || n === "justify" ? n : e.shapeAlignHorizontal ?? "center";
|
|
6466
6704
|
}
|
|
6467
|
-
_applyCurrentLayout({ group: e, shape: t, text: n, placement: r, width: i, height: a, alignH: o, alignV: s, internalShapeTextInset: c,
|
|
6468
|
-
let
|
|
6469
|
-
h = i === void 0 ? this._resolveShapeLayoutWidth({
|
|
6470
|
-
text: n,
|
|
6471
|
-
currentWidth: f.width,
|
|
6472
|
-
manualWidth: p.width,
|
|
6473
|
-
shapeTextAutoExpandEnabled: this._isShapeTextAutoExpandEnabled({ group: e }),
|
|
6474
|
-
padding: Ht({
|
|
6475
|
-
base: c ?? this._resolveGroupInternalShapeTextInset({
|
|
6476
|
-
group: e,
|
|
6477
|
-
width: h,
|
|
6478
|
-
height: Math.max(1, a ?? f.height)
|
|
6479
|
-
}),
|
|
6480
|
-
addition: m
|
|
6481
|
-
})
|
|
6482
|
-
}) : Math.max(1, i);
|
|
6483
|
-
let g = Math.max(1, a ?? f.height), _ = c ?? this._resolveGroupInternalShapeTextInset({
|
|
6705
|
+
_applyCurrentLayout({ group: e, shape: t, text: n, placement: r, width: i, height: a, alignH: o, alignV: s, internalShapeTextInset: c, resolveInternalShapeTextInset: l, preserveAspectRatio: u, minimumReplaceBox: d, expandShapeHeightToFitText: f = !0, changedPadding: p }) {
|
|
6706
|
+
let m = this._resolveCurrentDimensions({ group: e }), h = this._resolveManualDimensions({ group: e }), g = this._resolveGroupUserPadding({ group: e }), _ = this._isShapeTextAutoExpandEnabled({ group: e }), v = l ?? (({ width: t, height: n }) => c ?? this._resolveGroupInternalShapeTextInset({
|
|
6484
6707
|
group: e,
|
|
6485
|
-
width:
|
|
6486
|
-
height:
|
|
6487
|
-
}),
|
|
6488
|
-
|
|
6708
|
+
width: t,
|
|
6709
|
+
height: n
|
|
6710
|
+
})), y = m.width;
|
|
6711
|
+
if (i !== void 0) y = Math.max(1, i);
|
|
6712
|
+
else {
|
|
6713
|
+
let e = Math.max(1, a ?? m.height);
|
|
6714
|
+
y = this._resolveShapeLayoutWidth({
|
|
6715
|
+
text: n,
|
|
6716
|
+
currentWidth: m.width,
|
|
6717
|
+
manualWidth: h.width,
|
|
6718
|
+
shapeTextAutoExpandEnabled: _,
|
|
6719
|
+
padding: Ht({
|
|
6720
|
+
base: v({
|
|
6721
|
+
width: y,
|
|
6722
|
+
height: e
|
|
6723
|
+
}),
|
|
6724
|
+
addition: g
|
|
6725
|
+
}),
|
|
6726
|
+
resolvePaddingForWidth: ({ width: t }) => Ht({
|
|
6727
|
+
base: v({
|
|
6728
|
+
width: t,
|
|
6729
|
+
height: e
|
|
6730
|
+
}),
|
|
6731
|
+
addition: g
|
|
6732
|
+
})
|
|
6733
|
+
});
|
|
6734
|
+
}
|
|
6735
|
+
let b = Math.max(1, a ?? m.height), x = v({
|
|
6736
|
+
width: y,
|
|
6737
|
+
height: b
|
|
6738
|
+
}), S = r ?? this.editor.canvasManager.getObjectPlacement({ object: e }), C = u ? this._resolveMontageAreaWidth() : void 0;
|
|
6739
|
+
on({
|
|
6489
6740
|
group: e,
|
|
6490
6741
|
shape: t,
|
|
6491
6742
|
text: n,
|
|
6492
|
-
width:
|
|
6493
|
-
height:
|
|
6743
|
+
width: y,
|
|
6744
|
+
height: b,
|
|
6494
6745
|
alignH: o ?? e.shapeAlignHorizontal ?? "center",
|
|
6495
6746
|
alignV: s ?? e.shapeAlignVertical ?? "middle",
|
|
6496
|
-
padding:
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6747
|
+
padding: g,
|
|
6748
|
+
shapeTextAutoExpandEnabled: _,
|
|
6749
|
+
internalShapeTextInset: x,
|
|
6750
|
+
resolveInternalShapeTextInset: v,
|
|
6751
|
+
preserveAspectRatio: u,
|
|
6752
|
+
montageAreaWidth: C,
|
|
6753
|
+
expandShapeHeightToFitText: f,
|
|
6754
|
+
changedPadding: p
|
|
6755
|
+
}), e.shapeReplaceBoxWidth = Math.max(1, d?.width ?? 0, e.shapeBaseWidth ?? y), e.shapeReplaceBoxHeight = Math.max(1, d?.height ?? 0, e.shapeBaseHeight ?? b), this.editor.canvasManager.applyObjectPlacement({
|
|
6501
6756
|
object: e,
|
|
6502
|
-
placement:
|
|
6757
|
+
placement: S
|
|
6503
6758
|
});
|
|
6504
6759
|
}
|
|
6505
6760
|
_syncShapeTextLayoutAfterTextMutation({ textNode: e, textStyle: t }) {
|
|
@@ -6525,7 +6780,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6525
6780
|
return this.editingPlacements.get(e) || this.editor.canvasManager.getObjectPlacement({ object: e });
|
|
6526
6781
|
}
|
|
6527
6782
|
_detachShapeGroupAutoLayout({ group: e }) {
|
|
6528
|
-
|
|
6783
|
+
In({ group: e });
|
|
6529
6784
|
}
|
|
6530
6785
|
_resolveHorizontalAlign({ explicitAlign: e, textStyle: t }) {
|
|
6531
6786
|
if (e) return e;
|
|
@@ -6544,11 +6799,11 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6544
6799
|
_resolveShapeStyle({ options: e, fallback: t }) {
|
|
6545
6800
|
let { fill: n, stroke: r, strokeWidth: i, strokeDashArray: a, opacity: o } = e, s = a === void 0 ? t?.shapeStrokeDashArray : a;
|
|
6546
6801
|
return {
|
|
6547
|
-
fill: n ?? t?.shapeFill ??
|
|
6802
|
+
fill: n ?? t?.shapeFill ?? hr,
|
|
6548
6803
|
stroke: r ?? t?.shapeStroke ?? null,
|
|
6549
|
-
strokeWidth: i ?? t?.shapeStrokeWidth ??
|
|
6804
|
+
strokeWidth: i ?? t?.shapeStrokeWidth ?? gr,
|
|
6550
6805
|
strokeDashArray: s ?? null,
|
|
6551
|
-
opacity: o ?? t?.shapeOpacity ??
|
|
6806
|
+
opacity: o ?? t?.shapeOpacity ?? _r
|
|
6552
6807
|
};
|
|
6553
6808
|
}
|
|
6554
6809
|
_collectShapeGroupsFromTarget({ target: t, subTargets: n = [] }) {
|
|
@@ -6604,7 +6859,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6604
6859
|
}
|
|
6605
6860
|
return null;
|
|
6606
6861
|
}
|
|
6607
|
-
},
|
|
6862
|
+
}, yr = class {
|
|
6608
6863
|
constructor({ editor: e }) {
|
|
6609
6864
|
this.editor = e, this.clipboard = null;
|
|
6610
6865
|
}
|
|
@@ -6860,12 +7115,12 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6860
7115
|
}), !1;
|
|
6861
7116
|
}
|
|
6862
7117
|
}
|
|
6863
|
-
},
|
|
7118
|
+
}, br = class t {
|
|
6864
7119
|
constructor({ editor: e }) {
|
|
6865
7120
|
this.editor = e;
|
|
6866
7121
|
}
|
|
6867
7122
|
lockObject({ object: e, skipInnerObjects: n, withoutSave: r } = {}) {
|
|
6868
|
-
let { canvas: i, historyManager: a } = this.editor, o = e || i.getActiveObject(), s =
|
|
7123
|
+
let { canvas: i, historyManager: a } = this.editor, o = e || i.getActiveObject(), s = Yn({ target: o }) ?? o;
|
|
6869
7124
|
if (!s || s.locked) return;
|
|
6870
7125
|
let c = {
|
|
6871
7126
|
lockMovementX: !0,
|
|
@@ -6887,7 +7142,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6887
7142
|
});
|
|
6888
7143
|
}
|
|
6889
7144
|
unlockObject({ object: e, withoutSave: n } = {}) {
|
|
6890
|
-
let { canvas: r, historyManager: i } = this.editor, a = e || r.getActiveObject(), o =
|
|
7145
|
+
let { canvas: r, historyManager: i } = this.editor, a = e || r.getActiveObject(), o = Yn({ target: a }) ?? a;
|
|
6891
7146
|
if (!o) return;
|
|
6892
7147
|
let s = {
|
|
6893
7148
|
lockMovementX: !1,
|
|
@@ -6925,7 +7180,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6925
7180
|
!(n instanceof _) || !n.isEditing || n.exitEditing();
|
|
6926
7181
|
}
|
|
6927
7182
|
}
|
|
6928
|
-
},
|
|
7183
|
+
}, xr = class {
|
|
6929
7184
|
constructor({ editor: e }) {
|
|
6930
7185
|
this.editor = e;
|
|
6931
7186
|
}
|
|
@@ -6991,7 +7246,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
6991
7246
|
i.resumeHistory(), n || i.saveState();
|
|
6992
7247
|
}
|
|
6993
7248
|
}
|
|
6994
|
-
},
|
|
7249
|
+
}, Sr = class t {
|
|
6995
7250
|
constructor({ editor: e }) {
|
|
6996
7251
|
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();
|
|
6997
7252
|
}
|
|
@@ -7185,7 +7440,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7185
7440
|
let { options: e } = this.editor, { selectionKey: t } = e;
|
|
7186
7441
|
return t === void 0 ? ["ctrlKey", "metaKey"] : t;
|
|
7187
7442
|
}
|
|
7188
|
-
},
|
|
7443
|
+
}, Cr = class e {
|
|
7189
7444
|
constructor({ editor: e }) {
|
|
7190
7445
|
this.editor = e;
|
|
7191
7446
|
}
|
|
@@ -7225,7 +7480,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7225
7480
|
};
|
|
7226
7481
|
return i.fire("editor:objects-deleted", l), l;
|
|
7227
7482
|
}
|
|
7228
|
-
},
|
|
7483
|
+
}, wr = {
|
|
7229
7484
|
IMAGE_MANAGER: {
|
|
7230
7485
|
INVALID_CONTENT_TYPE: "INVALID_CONTENT_TYPE",
|
|
7231
7486
|
INVALID_SOURCE_TYPE: "INVALID_SOURCE_TYPE",
|
|
@@ -7263,7 +7518,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7263
7518
|
INVALID_TARGET: "TEMPLATE_INVALID_TARGET",
|
|
7264
7519
|
APPLY_FAILED: "TEMPLATE_APPLY_FAILED"
|
|
7265
7520
|
}
|
|
7266
|
-
},
|
|
7521
|
+
}, Tr = class e {
|
|
7267
7522
|
constructor({ editor: e }) {
|
|
7268
7523
|
this._buffer = [], this.editor = e;
|
|
7269
7524
|
}
|
|
@@ -7321,9 +7576,9 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7321
7576
|
}), this.editor.canvas.fire("editor:warning", s);
|
|
7322
7577
|
}
|
|
7323
7578
|
static isValidErrorCode(e) {
|
|
7324
|
-
return e ? Object.values(
|
|
7579
|
+
return e ? Object.values(wr).some((t) => Object.values(t).includes(e)) : !1;
|
|
7325
7580
|
}
|
|
7326
|
-
},
|
|
7581
|
+
}, Er = class {
|
|
7327
7582
|
constructor({ editor: e }) {
|
|
7328
7583
|
this.currentBounds = null, this.editor = e;
|
|
7329
7584
|
}
|
|
@@ -7372,32 +7627,32 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7372
7627
|
updateBounds() {
|
|
7373
7628
|
this.currentBounds = this.calculatePanBounds();
|
|
7374
7629
|
}
|
|
7375
|
-
},
|
|
7630
|
+
}, Dr = ({ textbox: e }) => {
|
|
7376
7631
|
if (!e.isEditing) return null;
|
|
7377
7632
|
let t = e.selectionStart ?? 0, n = e.selectionEnd ?? t;
|
|
7378
7633
|
return t === n ? null : {
|
|
7379
7634
|
start: Math.min(t, n),
|
|
7380
7635
|
end: Math.max(t, n)
|
|
7381
7636
|
};
|
|
7382
|
-
},
|
|
7637
|
+
}, Or = ({ textbox: e }) => {
|
|
7383
7638
|
let t = e.text?.length ?? 0;
|
|
7384
7639
|
return t <= 0 ? null : {
|
|
7385
7640
|
start: 0,
|
|
7386
7641
|
end: t
|
|
7387
7642
|
};
|
|
7388
|
-
},
|
|
7643
|
+
}, kr = ({ textbox: e, range: t }) => {
|
|
7389
7644
|
if (!t) return !1;
|
|
7390
7645
|
let n = e.text?.length ?? 0;
|
|
7391
7646
|
return n <= 0 ? !1 : t.start <= 0 && t.end >= n;
|
|
7392
|
-
},
|
|
7647
|
+
}, Ar = ({ textbox: e, styles: t, range: n }) => {
|
|
7393
7648
|
if (!t || !Object.keys(t).length) return !1;
|
|
7394
7649
|
let { start: r, end: i } = n;
|
|
7395
7650
|
return i <= r ? !1 : (e.setSelectionStyles(t, r, i), !0);
|
|
7396
|
-
},
|
|
7651
|
+
}, jr = ({ textbox: e, range: t, property: n }) => {
|
|
7397
7652
|
if (!t) return;
|
|
7398
7653
|
let r = e.getSelectionStyles(t.start, t.end, !0);
|
|
7399
7654
|
if (r.length) return r[0]?.[n];
|
|
7400
|
-
},
|
|
7655
|
+
}, Mr = ({ strokeColor: e, width: t }) => t <= 0 ? null : e ?? "#000000", Nr = ({ width: e = 0 }) => e ? Math.max(0, e) : 0, Pr = ({ value: e }) => typeof e == "string" ? e.toLocaleUpperCase() : "", Fr = ({ value: e, min: t, max: n }) => Math.min(Math.max(e, t), n), Ir = class e extends _ {
|
|
7401
7656
|
static {
|
|
7402
7657
|
this.type = "background-textbox";
|
|
7403
7658
|
}
|
|
@@ -7531,7 +7786,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7531
7786
|
this._removeShadow(e);
|
|
7532
7787
|
}
|
|
7533
7788
|
_getDecorationColorAt(e, t) {
|
|
7534
|
-
let n = this.getValueOfPropertyAt(e, t, "strokeWidth"), r =
|
|
7789
|
+
let n = this.getValueOfPropertyAt(e, t, "strokeWidth"), r = Nr({ width: typeof n == "number" && Number.isFinite(n) ? n : 0 }), i = this.getValueOfPropertyAt(e, t, "stroke"), a = i == null ? null : Mr({
|
|
7535
7790
|
strokeColor: i,
|
|
7536
7791
|
width: r
|
|
7537
7792
|
});
|
|
@@ -7547,22 +7802,22 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7547
7802
|
_getCornerRadii({ width: e, height: t }) {
|
|
7548
7803
|
let n = e / 2, r = t / 2, i = Math.min(n, r);
|
|
7549
7804
|
return {
|
|
7550
|
-
bottomLeft:
|
|
7805
|
+
bottomLeft: Fr({
|
|
7551
7806
|
value: this.radiusBottomLeft ?? 0,
|
|
7552
7807
|
min: 0,
|
|
7553
7808
|
max: i
|
|
7554
7809
|
}),
|
|
7555
|
-
bottomRight:
|
|
7810
|
+
bottomRight: Fr({
|
|
7556
7811
|
value: this.radiusBottomRight ?? 0,
|
|
7557
7812
|
min: 0,
|
|
7558
7813
|
max: i
|
|
7559
7814
|
}),
|
|
7560
|
-
topLeft:
|
|
7815
|
+
topLeft: Fr({
|
|
7561
7816
|
value: this.radiusTopLeft ?? 0,
|
|
7562
7817
|
min: 0,
|
|
7563
7818
|
max: i
|
|
7564
7819
|
}),
|
|
7565
|
-
topRight:
|
|
7820
|
+
topRight: Fr({
|
|
7566
7821
|
value: this.radiusTopRight ?? 0,
|
|
7567
7822
|
min: 0,
|
|
7568
7823
|
max: i
|
|
@@ -7580,7 +7835,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7580
7835
|
_getEffectiveBackgroundFill() {
|
|
7581
7836
|
let e = this.backgroundColor;
|
|
7582
7837
|
if (!e) return null;
|
|
7583
|
-
let t =
|
|
7838
|
+
let t = Fr({
|
|
7584
7839
|
value: this.backgroundOpacity ?? 1,
|
|
7585
7840
|
min: 0,
|
|
7586
7841
|
max: 1
|
|
@@ -7588,7 +7843,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7588
7843
|
try {
|
|
7589
7844
|
r = new n(e);
|
|
7590
7845
|
} catch (t) {
|
|
7591
|
-
return
|
|
7846
|
+
return Tr.emitError({
|
|
7592
7847
|
origin: "BackgroundTextbox",
|
|
7593
7848
|
method: "_getEffectiveBackgroundFill",
|
|
7594
7849
|
code: "INVALID_COLOR_VALUE",
|
|
@@ -7602,19 +7857,19 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7602
7857
|
return r.setAlpha(t), r.toRgba();
|
|
7603
7858
|
}
|
|
7604
7859
|
static _renderRoundedRect({ ctx: e, height: t, left: n, radii: r, top: i, width: a }) {
|
|
7605
|
-
let o = n + a, s = i + t, { topLeft: c, topRight: l, bottomRight: u, bottomLeft: d } = r, f =
|
|
7860
|
+
let o = n + a, s = i + t, { topLeft: c, topRight: l, bottomRight: u, bottomLeft: d } = r, f = Fr({
|
|
7606
7861
|
value: c,
|
|
7607
7862
|
min: 0,
|
|
7608
7863
|
max: a
|
|
7609
|
-
}), p =
|
|
7864
|
+
}), p = Fr({
|
|
7610
7865
|
value: l,
|
|
7611
7866
|
min: 0,
|
|
7612
7867
|
max: a
|
|
7613
|
-
}), m =
|
|
7868
|
+
}), m = Fr({
|
|
7614
7869
|
value: u,
|
|
7615
7870
|
min: 0,
|
|
7616
7871
|
max: a
|
|
7617
|
-
}), h =
|
|
7872
|
+
}), h = Fr({
|
|
7618
7873
|
value: d,
|
|
7619
7874
|
min: 0,
|
|
7620
7875
|
max: a
|
|
@@ -7625,9 +7880,9 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7625
7880
|
let { width: e = 0, height: t = 0 } = this, n = Math.round(e), r = Math.round(t);
|
|
7626
7881
|
n !== e && (this.width = Math.max(0, n)), r !== t && (this.height = Math.max(0, r));
|
|
7627
7882
|
}
|
|
7628
|
-
},
|
|
7629
|
-
y?.setClass && y.setClass(
|
|
7630
|
-
},
|
|
7883
|
+
}, Lr = () => {
|
|
7884
|
+
y?.setClass && y.setClass(Ir, "background-textbox");
|
|
7885
|
+
}, Rr = .01, zr = ({ textbox: e, lineIndices: t, updates: n }) => {
|
|
7631
7886
|
if (!t.length) return !1;
|
|
7632
7887
|
let { fontFamily: r, fontSize: i, fill: a, stroke: o } = n;
|
|
7633
7888
|
if (!(r !== void 0 || i !== void 0 || a !== void 0 || o !== void 0)) return !1;
|
|
@@ -7639,7 +7894,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7639
7894
|
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);
|
|
7640
7895
|
}
|
|
7641
7896
|
return l && (e.lineFontDefaults = c), l;
|
|
7642
|
-
},
|
|
7897
|
+
}, Br = ({ lineText: e, lineStyles: t, lineDefaults: n }) => {
|
|
7643
7898
|
let r = e.length;
|
|
7644
7899
|
if (r === 0) return {
|
|
7645
7900
|
lineStyles: t,
|
|
@@ -7671,7 +7926,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7671
7926
|
lineStyles: l,
|
|
7672
7927
|
changed: u
|
|
7673
7928
|
};
|
|
7674
|
-
},
|
|
7929
|
+
}, Vr = ({ lineFontDefaults: e }) => {
|
|
7675
7930
|
if (!e) return;
|
|
7676
7931
|
let t = {};
|
|
7677
7932
|
for (let n in e) {
|
|
@@ -7682,7 +7937,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7682
7937
|
i && (t[r] = { ...i });
|
|
7683
7938
|
}
|
|
7684
7939
|
return t;
|
|
7685
|
-
},
|
|
7940
|
+
}, Hr = ({ lineFontDefaults: e, scale: t }) => {
|
|
7686
7941
|
if (!e || !Number.isFinite(t) || Math.abs(t - 1) < .01) return;
|
|
7687
7942
|
let n = {}, r = !1, i = !1;
|
|
7688
7943
|
for (let a in e) {
|
|
@@ -7699,18 +7954,18 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7699
7954
|
n[o] = c, r = !0;
|
|
7700
7955
|
}
|
|
7701
7956
|
if (!(!r || !i)) return n;
|
|
7702
|
-
},
|
|
7957
|
+
}, Ur = ({ textbox: e, text: t }) => {
|
|
7703
7958
|
let { textLines: n } = e, r = Array.isArray(n) && n.length > 0 ? n.length : Math.max(t.split("\n").length, 1), i = 0;
|
|
7704
7959
|
for (let t = 0; t < r; t += 1) {
|
|
7705
7960
|
let n = e.getLineWidth(t);
|
|
7706
7961
|
n > i && (i = n);
|
|
7707
7962
|
}
|
|
7708
7963
|
return i;
|
|
7709
|
-
},
|
|
7710
|
-
let r = e.width ?? e.calcTextWidth() ?? 0, i = e.height ?? e.calcTextHeight() ?? 0, a = e.paddingTop ?? 0, o = e.paddingRight ?? 0, s = e.paddingBottom ?? 0, c = e.paddingLeft ?? 0, l = -r / 2 + (c - o) / 2, u = -i / 2 + (a - s) / 2, d = new p(l +
|
|
7964
|
+
}, Wr = ({ origin: e, size: t }) => e === "left" || e === "top" || e === "start" || e === 0 ? 0 : e === "right" || e === "bottom" || e === "end" || e === 1 ? t : t / 2, Gr = ({ textbox: e, originX: t = e.originX ?? "center", originY: n = e.originY ?? "center" }) => {
|
|
7965
|
+
let r = e.width ?? e.calcTextWidth() ?? 0, i = e.height ?? e.calcTextHeight() ?? 0, a = e.paddingTop ?? 0, o = e.paddingRight ?? 0, s = e.paddingBottom ?? 0, c = e.paddingLeft ?? 0, l = -r / 2 + (c - o) / 2, u = -i / 2 + (a - s) / 2, d = new p(l + Wr({
|
|
7711
7966
|
origin: t,
|
|
7712
7967
|
size: r
|
|
7713
|
-
}), u +
|
|
7968
|
+
}), u + Wr({
|
|
7714
7969
|
origin: n,
|
|
7715
7970
|
size: i
|
|
7716
7971
|
})), f = e.getPointByOrigin("center", "center"), m = e, h = typeof m.calcTransformMatrix == "function" ? m.calcTransformMatrix() : null, g = Array.isArray(h) ? new p(d.x * h[0] + d.y * h[2] + f.x, d.x * h[1] + d.y * h[3] + f.y) : new p(f.x + d.x, f.y + d.y);
|
|
@@ -7720,13 +7975,13 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7720
7975
|
originX: t,
|
|
7721
7976
|
originY: n
|
|
7722
7977
|
};
|
|
7723
|
-
},
|
|
7978
|
+
}, Kr = ({ textbox: e, montageLeft: t, montageRight: n }) => {
|
|
7724
7979
|
e.setCoords();
|
|
7725
7980
|
let r = e.getBoundingRect(!1, !0), i = r.left ?? 0, a = i + (r.width ?? 0), o = n - t;
|
|
7726
7981
|
if (o > 0 && (r.width ?? 0) >= o - .01) return !1;
|
|
7727
7982
|
let s = 0;
|
|
7728
7983
|
return i < t ? s = t - i : a > n && (s = n - a), Math.abs(s) <= .01 ? !1 : (e.set({ left: (e.left ?? 0) + s }), !0);
|
|
7729
|
-
},
|
|
7984
|
+
}, qr = ({ rawValue: e, calculatedValue: t }) => typeof e == "number" ? e : typeof t == "number" ? t : 0, Jr = ({ stylesList: e }) => {
|
|
7730
7985
|
let t = e.length;
|
|
7731
7986
|
if (!t) return !1;
|
|
7732
7987
|
for (let n = 0; n < t; n += 1) {
|
|
@@ -7736,16 +7991,16 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7736
7991
|
if (r !== void 0 || i !== void 0 || a !== void 0 || o !== void 0 || s !== void 0 || c !== void 0) return !0;
|
|
7737
7992
|
}
|
|
7738
7993
|
return !1;
|
|
7739
|
-
},
|
|
7740
|
-
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 =
|
|
7994
|
+
}, Yr = ({ textbox: e }) => {
|
|
7995
|
+
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 = qr({
|
|
7741
7996
|
rawValue: t,
|
|
7742
7997
|
calculatedValue: a
|
|
7743
|
-
}), c =
|
|
7998
|
+
}), c = qr({
|
|
7744
7999
|
rawValue: n,
|
|
7745
8000
|
calculatedValue: o
|
|
7746
8001
|
}), l = Number.isFinite(s) ? Math.round(s) : null, u = Number.isFinite(c) ? Math.round(c) : null, d = {};
|
|
7747
8002
|
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;
|
|
7748
|
-
},
|
|
8003
|
+
}, Xr = ({ textbox: e }) => {
|
|
7749
8004
|
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;
|
|
7750
8005
|
return {
|
|
7751
8006
|
width: t,
|
|
@@ -7763,9 +8018,9 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7763
8018
|
bottomLeft: f
|
|
7764
8019
|
},
|
|
7765
8020
|
styles: JSON.parse(JSON.stringify(r)),
|
|
7766
|
-
lineFontDefaults:
|
|
8021
|
+
lineFontDefaults: Vr({ lineFontDefaults: i })
|
|
7767
8022
|
};
|
|
7768
|
-
},
|
|
8023
|
+
}, Zr = ({ base: e }) => {
|
|
7769
8024
|
let t = 1 / Math.max(1, e.width), n = [e.fontSize];
|
|
7770
8025
|
Object.values(e.styles).forEach((e) => {
|
|
7771
8026
|
Object.values(e).forEach((e) => {
|
|
@@ -7782,7 +8037,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7782
8037
|
fontScale: r,
|
|
7783
8038
|
proportionalScale: Math.max(t, r)
|
|
7784
8039
|
};
|
|
7785
|
-
},
|
|
8040
|
+
}, Qr = ({ textbox: e, canvasManager: t, base: n, widthScale: r, heightScale: i, placement: a, anchorPlacement: o, shouldScaleFontSize: s, shouldScalePadding: c, shouldScaleRadii: l, shouldDisableAutoExpandOnHorizontalChange: u = !1, shouldRoundDimensions: d = !0 }) => {
|
|
7786
8041
|
let { width: f, fontSize: m, padding: h, radii: g, styles: _, lineFontDefaults: v } = n, y = Math.max(1, f * r), b = d ? Math.max(1, Math.round(y)) : y, x = Math.max(Math.min(8, m), m * i), S = Object.keys(_).length > 0, C;
|
|
7787
8042
|
if (s && S) {
|
|
7788
8043
|
let e = {};
|
|
@@ -7801,7 +8056,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7801
8056
|
}), Object.keys(e).length && (C = e);
|
|
7802
8057
|
}
|
|
7803
8058
|
let w;
|
|
7804
|
-
s && (w =
|
|
8059
|
+
s && (w = Hr({
|
|
7805
8060
|
lineFontDefaults: v,
|
|
7806
8061
|
scale: i
|
|
7807
8062
|
}));
|
|
@@ -7815,7 +8070,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7815
8070
|
topRight: Math.max(0, g.topRight * i),
|
|
7816
8071
|
bottomRight: Math.max(0, g.bottomRight * i),
|
|
7817
8072
|
bottomLeft: Math.max(0, g.bottomLeft * i)
|
|
7818
|
-
} : g, D = e.width ?? f, O = Math.abs(b - D) >
|
|
8073
|
+
} : g, D = e.width ?? f, O = Math.abs(b - D) > Rr;
|
|
7819
8074
|
u && O && (e.autoExpand = !1), C && (e.styles = C), w && (e.lineFontDefaults = w), e.set({
|
|
7820
8075
|
width: b,
|
|
7821
8076
|
fontSize: s ? x : m,
|
|
@@ -7837,7 +8092,7 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7837
8092
|
} finally {
|
|
7838
8093
|
e.shouldRoundDimensionsOnInit = k;
|
|
7839
8094
|
}
|
|
7840
|
-
let A = d ?
|
|
8095
|
+
let A = d ? Yr({ textbox: e }) : !1;
|
|
7841
8096
|
return A && (e.dirty = !0), o ? (e.set({
|
|
7842
8097
|
originX: a.originX,
|
|
7843
8098
|
originY: a.originY
|
|
@@ -7851,18 +8106,18 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7851
8106
|
appliedWidth: e.width ?? b,
|
|
7852
8107
|
dimensionsRounded: A
|
|
7853
8108
|
});
|
|
7854
|
-
},
|
|
8109
|
+
}, $r = ({ transform: e }) => {
|
|
7855
8110
|
let { corner: t = "", action: n = "" } = e;
|
|
7856
8111
|
return {
|
|
7857
8112
|
isCornerHandle: t === "tl" || t === "tr" || t === "bl" || t === "br" || n === "scale",
|
|
7858
8113
|
isHorizontalHandle: t === "ml" || t === "mr" || n === "scaleX",
|
|
7859
8114
|
isVerticalHandle: t === "mt" || t === "mb" || n === "scaleY"
|
|
7860
8115
|
};
|
|
7861
|
-
},
|
|
8116
|
+
}, ei = ({ textbox: e, transform: t, appliedWidth: n }) => {
|
|
7862
8117
|
t.scaleX = 1, t.scaleY = 1;
|
|
7863
8118
|
let { original: r } = t;
|
|
7864
8119
|
r && (r.scaleX = 1, r.scaleY = 1, r.width = n, r.height = e.height, r.left = e.left, r.top = e.top);
|
|
7865
|
-
},
|
|
8120
|
+
}, ti = ({ textbox: e, transform: t, scenePoint: n }) => {
|
|
7866
8121
|
let { x: r, y: i } = e._getTransformedDimensions();
|
|
7867
8122
|
if (r <= 0 || i <= 0) return null;
|
|
7868
8123
|
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);
|
|
@@ -7872,27 +8127,27 @@ var tr = ({ group: e, shape: t, text: n, width: r, height: i, padding: a, alignH
|
|
|
7872
8127
|
stepScaleX: l,
|
|
7873
8128
|
stepScaleY: u
|
|
7874
8129
|
};
|
|
7875
|
-
},
|
|
7876
|
-
function
|
|
8130
|
+
}, ni = 1e-4;
|
|
8131
|
+
function ri(e) {
|
|
7877
8132
|
return !!e && e instanceof _;
|
|
7878
8133
|
}
|
|
7879
|
-
function
|
|
7880
|
-
if (!
|
|
8134
|
+
function ii(e) {
|
|
8135
|
+
if (!ri(e)) return !1;
|
|
7881
8136
|
let t = e.group;
|
|
7882
8137
|
return e.shapeNodeType === "text" && t?.shapeComposite === !0;
|
|
7883
8138
|
}
|
|
7884
|
-
var
|
|
8139
|
+
var ai = class {
|
|
7885
8140
|
constructor({ canvas: t, canvasManager: n, persistScaledTextbox: r }) {
|
|
7886
8141
|
this.handleMouseMove = (e) => {
|
|
7887
8142
|
let t = this.canvas._currentTransform;
|
|
7888
8143
|
if (!t) return;
|
|
7889
8144
|
let { target: n } = t;
|
|
7890
|
-
if (!
|
|
8145
|
+
if (!ri(n) || ii(n)) return;
|
|
7891
8146
|
let r = this.scalingState.get(n);
|
|
7892
8147
|
if (!r || !e.e) return;
|
|
7893
|
-
let { isCornerHandle: i, isHorizontalHandle: a, isVerticalHandle: o } =
|
|
8148
|
+
let { isCornerHandle: i, isHorizontalHandle: a, isVerticalHandle: o } = $r({ transform: t });
|
|
7894
8149
|
if (!a && !o && !i) return;
|
|
7895
|
-
let s =
|
|
8150
|
+
let s = ti({
|
|
7896
8151
|
textbox: n,
|
|
7897
8152
|
transform: t,
|
|
7898
8153
|
scenePoint: this.canvas.getScenePoint(e.e)
|
|
@@ -7915,20 +8170,20 @@ var Xr = class {
|
|
|
7915
8170
|
}, j = r.lastAllowedScaleX, M = r.lastAllowedScaleY;
|
|
7916
8171
|
if (i) {
|
|
7917
8172
|
let e = Math.max(r.minimumProportionalScale, r.lastAllowedScaleX * Math.sqrt(u * d)), t = c || l ? r.minimumProportionalScale : e;
|
|
7918
|
-
if (Math.abs(t - r.lastAllowedScaleX) <=
|
|
8173
|
+
if (Math.abs(t - r.lastAllowedScaleX) <= ni) return;
|
|
7919
8174
|
j = t, M = t;
|
|
7920
8175
|
} else {
|
|
7921
8176
|
if (a) {
|
|
7922
8177
|
let e = r.lastAllowedScaleX * u, t = c ? r.minimumWidthScale : Math.max(r.minimumWidthScale, e);
|
|
7923
|
-
Math.abs(t - r.lastAllowedScaleX) >
|
|
8178
|
+
Math.abs(t - r.lastAllowedScaleX) > ni && (j = t);
|
|
7924
8179
|
}
|
|
7925
8180
|
if (o) {
|
|
7926
8181
|
let e = r.lastAllowedScaleY * d, t = l ? r.minimumFontScale : Math.max(r.minimumFontScale, e);
|
|
7927
|
-
Math.abs(t - r.lastAllowedScaleY) >
|
|
8182
|
+
Math.abs(t - r.lastAllowedScaleY) > ni && (M = t);
|
|
7928
8183
|
}
|
|
7929
|
-
if (Math.abs(j - r.lastAllowedScaleX) <=
|
|
8184
|
+
if (Math.abs(j - r.lastAllowedScaleX) <= ni && Math.abs(M - r.lastAllowedScaleY) <= ni) return;
|
|
7930
8185
|
}
|
|
7931
|
-
let { appliedWidth: N, dimensionsRounded: P } =
|
|
8186
|
+
let { appliedWidth: N, dimensionsRounded: P } = Qr({
|
|
7932
8187
|
textbox: n,
|
|
7933
8188
|
canvasManager: this.canvasManager,
|
|
7934
8189
|
base: r.startBase,
|
|
@@ -7942,7 +8197,7 @@ var Xr = class {
|
|
|
7942
8197
|
shouldDisableAutoExpandOnHorizontalChange: a,
|
|
7943
8198
|
shouldRoundDimensions: !i
|
|
7944
8199
|
});
|
|
7945
|
-
|
|
8200
|
+
ei({
|
|
7946
8201
|
textbox: n,
|
|
7947
8202
|
transform: t,
|
|
7948
8203
|
appliedWidth: N
|
|
@@ -7963,12 +8218,12 @@ var Xr = class {
|
|
|
7963
8218
|
}), this.canvas.requestRenderAll();
|
|
7964
8219
|
}, this.handleObjectScaling = (t) => {
|
|
7965
8220
|
let { target: n, transform: r } = t;
|
|
7966
|
-
if (n instanceof e || !
|
|
8221
|
+
if (n instanceof e || !ri(n) || ii(n) || !r) return;
|
|
7967
8222
|
n.isScaling = !0;
|
|
7968
8223
|
let i = this._ensureScalingState({
|
|
7969
8224
|
textbox: n,
|
|
7970
8225
|
transform: r
|
|
7971
|
-
}), { startBase: a } = i, { width: o, fontSize: s } = a, { isCornerHandle: c, isHorizontalHandle: l, isVerticalHandle: u } =
|
|
8226
|
+
}), { startBase: a } = i, { width: o, fontSize: s } = a, { isCornerHandle: c, isHorizontalHandle: l, isVerticalHandle: u } = $r({ transform: r }), d = r.corner ?? "", f = c || u;
|
|
7972
8227
|
if (!l && !u && !c) return;
|
|
7973
8228
|
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({
|
|
7974
8229
|
object: n,
|
|
@@ -7983,7 +8238,7 @@ var Xr = class {
|
|
|
7983
8238
|
N = e, P = e;
|
|
7984
8239
|
}
|
|
7985
8240
|
} else l && (N = Math.max(i.minimumWidthScale, i.lastAllowedScaleX * h)), u && (P = Math.max(i.minimumFontScale, i.lastAllowedScaleY * g));
|
|
7986
|
-
let { appliedWidth:
|
|
8241
|
+
let { appliedWidth: L, dimensionsRounded: ee } = Qr({
|
|
7987
8242
|
textbox: n,
|
|
7988
8243
|
canvasManager: this.canvasManager,
|
|
7989
8244
|
base: a,
|
|
@@ -7997,14 +8252,14 @@ var Xr = class {
|
|
|
7997
8252
|
shouldDisableAutoExpandOnHorizontalChange: l,
|
|
7998
8253
|
shouldRoundDimensions: !c
|
|
7999
8254
|
});
|
|
8000
|
-
|
|
8255
|
+
ei({
|
|
8001
8256
|
textbox: n,
|
|
8002
8257
|
transform: r,
|
|
8003
|
-
appliedWidth:
|
|
8258
|
+
appliedWidth: L
|
|
8004
8259
|
}), this.canvas.requestRenderAll(), I && this._updateScalingStateAfterLiveCommit({
|
|
8005
8260
|
textbox: n,
|
|
8006
8261
|
state: i,
|
|
8007
|
-
appliedWidth:
|
|
8262
|
+
appliedWidth: L,
|
|
8008
8263
|
previousFontSize: O ?? s,
|
|
8009
8264
|
previousPadding: {
|
|
8010
8265
|
top: b,
|
|
@@ -8019,7 +8274,7 @@ var Xr = class {
|
|
|
8019
8274
|
bottomLeft: D
|
|
8020
8275
|
},
|
|
8021
8276
|
previousWidth: M,
|
|
8022
|
-
dimensionsRounded:
|
|
8277
|
+
dimensionsRounded: ee,
|
|
8023
8278
|
isCornerHandle: c,
|
|
8024
8279
|
isHorizontalHandle: l,
|
|
8025
8280
|
isVerticalHandle: u,
|
|
@@ -8030,7 +8285,7 @@ var Xr = class {
|
|
|
8030
8285
|
let { target: n } = t;
|
|
8031
8286
|
if (n instanceof e) {
|
|
8032
8287
|
let t = n.getObjects();
|
|
8033
|
-
if (!t.some((e) =>
|
|
8288
|
+
if (!t.some((e) => ri(e))) return;
|
|
8034
8289
|
let { scaleX: r = 1, scaleY: i = 1 } = n;
|
|
8035
8290
|
if (Math.abs(r - 1) < .01 && Math.abs(i - 1) < .01) return;
|
|
8036
8291
|
this.canvas.discardActiveObject(), t.forEach((e) => {
|
|
@@ -8040,7 +8295,7 @@ var Xr = class {
|
|
|
8040
8295
|
this.canvas.setActiveObject(a), this.canvas.requestRenderAll();
|
|
8041
8296
|
return;
|
|
8042
8297
|
}
|
|
8043
|
-
if (!
|
|
8298
|
+
if (!ri(n) || ii(n)) return;
|
|
8044
8299
|
n.isScaling = !1;
|
|
8045
8300
|
let r = this.scalingState.get(n);
|
|
8046
8301
|
if (this.scalingState.delete(n), !r?.hasScalingChange) return;
|
|
@@ -8065,11 +8320,11 @@ var Xr = class {
|
|
|
8065
8320
|
}, this.canvas = t, this.canvasManager = n, this.persistScaledTextbox = r, this.scalingState = /* @__PURE__ */ new WeakMap();
|
|
8066
8321
|
}
|
|
8067
8322
|
commitStandaloneTextScale({ target: e, shouldDisableAutoExpandOnHorizontalChange: t = !1 }) {
|
|
8068
|
-
if (!
|
|
8323
|
+
if (!ri(e) || ii(e)) return !1;
|
|
8069
8324
|
let n = Math.abs(e.scaleX ?? 1) || 1, r = Math.abs(e.scaleY ?? 1) || 1;
|
|
8070
8325
|
if (!(Math.abs(n - 1) > .01 || Math.abs(r - 1) > .01)) return !1;
|
|
8071
|
-
let i =
|
|
8072
|
-
return
|
|
8326
|
+
let i = Xr({ textbox: e }), a = this.canvasManager.getObjectPlacement({ object: e });
|
|
8327
|
+
return Qr({
|
|
8073
8328
|
textbox: e,
|
|
8074
8329
|
canvasManager: this.canvasManager,
|
|
8075
8330
|
base: i,
|
|
@@ -8085,7 +8340,7 @@ var Xr = class {
|
|
|
8085
8340
|
_ensureScalingState({ textbox: e, transform: t }) {
|
|
8086
8341
|
let n = this.scalingState.get(e);
|
|
8087
8342
|
if (!n) {
|
|
8088
|
-
let r =
|
|
8343
|
+
let r = Xr({ textbox: e }), i = this.canvasManager.getObjectPlacement({ object: e }), a = Zr({ base: r }), o = t.original?.originX ?? t.originX ?? e.originX ?? "center", s = t.original?.originY ?? t.originY ?? e.originY ?? "center";
|
|
8089
8344
|
n = {
|
|
8090
8345
|
startBase: r,
|
|
8091
8346
|
startObjectPlacement: i,
|
|
@@ -8118,7 +8373,7 @@ var Xr = class {
|
|
|
8118
8373
|
topRight: e.radiusTopRight ?? 0,
|
|
8119
8374
|
bottomRight: e.radiusBottomRight ?? 0,
|
|
8120
8375
|
bottomLeft: e.radiusBottomLeft ?? 0
|
|
8121
|
-
}, v = Math.abs(n - o) >
|
|
8376
|
+
}, v = Math.abs(n - o) > Rr, y = Math.abs(h - r) > Rr, 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;
|
|
8122
8377
|
if (c) {
|
|
8123
8378
|
let e = h / Math.max(1, m);
|
|
8124
8379
|
S = e, C = e;
|
|
@@ -8139,7 +8394,7 @@ var Xr = class {
|
|
|
8139
8394
|
originY: a
|
|
8140
8395
|
});
|
|
8141
8396
|
}
|
|
8142
|
-
},
|
|
8397
|
+
}, oi = ({ textbox: e }) => {
|
|
8143
8398
|
let t = e.text ?? "";
|
|
8144
8399
|
if (!t.length) return [];
|
|
8145
8400
|
let n = t.split("\n"), r = [], i = 0;
|
|
@@ -8151,7 +8406,7 @@ var Xr = class {
|
|
|
8151
8406
|
});
|
|
8152
8407
|
}
|
|
8153
8408
|
return r;
|
|
8154
|
-
},
|
|
8409
|
+
}, si = ({ range: e, text: t }) => {
|
|
8155
8410
|
if (!e) return null;
|
|
8156
8411
|
let n = t.length;
|
|
8157
8412
|
if (n <= 0) return null;
|
|
@@ -8160,8 +8415,8 @@ var Xr = class {
|
|
|
8160
8415
|
start: l,
|
|
8161
8416
|
end: u
|
|
8162
8417
|
};
|
|
8163
|
-
},
|
|
8164
|
-
let n =
|
|
8418
|
+
}, ci = ({ textbox: e, range: t }) => {
|
|
8419
|
+
let n = oi({ textbox: e });
|
|
8165
8420
|
if (!n.length) return t;
|
|
8166
8421
|
let { start: r } = t, { end: i } = t;
|
|
8167
8422
|
for (let e = 0; e < n.length; e += 1) {
|
|
@@ -8174,7 +8429,7 @@ var Xr = class {
|
|
|
8174
8429
|
start: r,
|
|
8175
8430
|
end: i
|
|
8176
8431
|
};
|
|
8177
|
-
},
|
|
8432
|
+
}, li = ({ textbox: e, range: t }) => {
|
|
8178
8433
|
let n = e.text ?? "";
|
|
8179
8434
|
if (!n.length) return [];
|
|
8180
8435
|
let { start: r, end: i } = t, a = n.split("\n"), o = [], s = 0;
|
|
@@ -8183,7 +8438,7 @@ var Xr = class {
|
|
|
8183
8438
|
i > n && r < c && o.push(e), s = c + 1;
|
|
8184
8439
|
}
|
|
8185
8440
|
return o;
|
|
8186
|
-
},
|
|
8441
|
+
}, ui = ({ textbox: e, range: t }) => {
|
|
8187
8442
|
let n = e.text ?? "";
|
|
8188
8443
|
if (!n.length) return [];
|
|
8189
8444
|
let { start: r, end: i } = t, a = n.split("\n"), o = [], s = 0;
|
|
@@ -8192,20 +8447,20 @@ var Xr = class {
|
|
|
8192
8447
|
r <= n && i >= c && o.push(e), s = c + 1;
|
|
8193
8448
|
}
|
|
8194
8449
|
return o;
|
|
8195
|
-
},
|
|
8450
|
+
}, di = ({ previous: e, next: t }) => {
|
|
8196
8451
|
let n = Math.min(e.length, t.length);
|
|
8197
8452
|
for (let r = 0; r < n; r += 1) if (e[r] !== t[r]) return r;
|
|
8198
8453
|
return n;
|
|
8199
|
-
},
|
|
8454
|
+
}, fi = ({ text: e, charIndex: t }) => {
|
|
8200
8455
|
let n = Math.max(0, Math.min(t, e.length)), r = 0;
|
|
8201
8456
|
for (let t = 0; t < n; t += 1) e[t] === "\n" && (r += 1);
|
|
8202
8457
|
return r;
|
|
8203
|
-
},
|
|
8458
|
+
}, pi = ({ text: e, lineIndex: t }) => {
|
|
8204
8459
|
if (t <= 0) return 0;
|
|
8205
8460
|
let n = 0;
|
|
8206
8461
|
for (let r = 0; r < e.length; r += 1) if (e[r] === "\n" && (n += 1, n === t)) return r + 1;
|
|
8207
8462
|
return e.length;
|
|
8208
|
-
},
|
|
8463
|
+
}, mi = class e {
|
|
8209
8464
|
constructor({ editor: t }) {
|
|
8210
8465
|
this._handleTextEditingEntered = (t) => {
|
|
8211
8466
|
this.isTextEditingActive = !0;
|
|
@@ -8218,7 +8473,7 @@ var Xr = class {
|
|
|
8218
8473
|
if (!e._isTextbox(n) || this.lineDefaultsSyncing.has(n)) return;
|
|
8219
8474
|
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 });
|
|
8220
8475
|
if (s) {
|
|
8221
|
-
let e =
|
|
8476
|
+
let e = Pr({ value: l });
|
|
8222
8477
|
e !== i && n.set({ text: e }), n.textCaseRaw = l;
|
|
8223
8478
|
} else n.textCaseRaw = i;
|
|
8224
8479
|
if (!r && o === void 0 && (n.autoExpand = !0), r) {
|
|
@@ -8236,7 +8491,7 @@ var Xr = class {
|
|
|
8236
8491
|
let r = e._isShapeOwnedTextbox(n);
|
|
8237
8492
|
this.editingPlacementState?.delete(n);
|
|
8238
8493
|
let i = n.text ?? "";
|
|
8239
|
-
n.uppercase ? n.textCaseRaw = n.textCaseRaw ?? i.toLocaleLowerCase() : n.textCaseRaw = i, r || (
|
|
8494
|
+
n.uppercase ? n.textCaseRaw = n.textCaseRaw ?? i.toLocaleLowerCase() : n.textCaseRaw = i, r || (Yr({ textbox: n }) && (n.setCoords(), n.dirty = !0, this.canvas.requestRenderAll()), n.locked || n.set({
|
|
8240
8495
|
lockMovementX: !1,
|
|
8241
8496
|
lockMovementY: !1
|
|
8242
8497
|
}));
|
|
@@ -8263,7 +8518,7 @@ var Xr = class {
|
|
|
8263
8518
|
transform: r,
|
|
8264
8519
|
event: i ?? null
|
|
8265
8520
|
});
|
|
8266
|
-
}, this.editor = t, this.canvas = t.canvas, this.fonts = t.options.fonts ?? [], this.scalingController = new
|
|
8521
|
+
}, this.editor = t, this.canvas = t.canvas, this.fonts = t.options.fonts ?? [], this.scalingController = new ai({
|
|
8267
8522
|
canvas: t.canvas,
|
|
8268
8523
|
canvasManager: t.canvasManager,
|
|
8269
8524
|
persistScaledTextbox: ({ target: e, style: t }) => {
|
|
@@ -8272,15 +8527,15 @@ var Xr = class {
|
|
|
8272
8527
|
style: t
|
|
8273
8528
|
});
|
|
8274
8529
|
}
|
|
8275
|
-
}), this.editingPlacementState = /* @__PURE__ */ new WeakMap(), this.lineDefaultsSyncing = /* @__PURE__ */ new WeakSet(), this.isTextEditingActive = !1, this._bindEvents(),
|
|
8530
|
+
}), this.editingPlacementState = /* @__PURE__ */ new WeakMap(), this.lineDefaultsSyncing = /* @__PURE__ */ new WeakSet(), this.isTextEditingActive = !1, this._bindEvents(), Lr();
|
|
8276
8531
|
}
|
|
8277
8532
|
addText({ id: t = `text-${D()}`, text: n = "Новый текст", autoExpand: r = !0, fontFamily: i, fontSize: a = 48, bold: o = !1, italic: s = !1, underline: c = !1, uppercase: l = !1, strikethrough: u = !1, align: d = "left", color: f = "#000000", strokeColor: p, strokeWidth: m = 0, opacity: h = 1, backgroundColor: g, backgroundOpacity: _ = 1, paddingTop: v = 0, paddingRight: y = 0, paddingBottom: b = 0, paddingLeft: x = 0, radiusTopLeft: S = 0, radiusTopRight: C = 0, radiusBottomRight: w = 0, radiusBottomLeft: T = 0, ...E } = {}, { withoutSelection: O = !1, withoutSave: k = !1, withoutAdding: A = !1, emitLifecycleEvents: j = !0 } = {}) {
|
|
8278
8533
|
let { canvasManager: M, historyManager: N } = this.editor, { canvas: P } = this;
|
|
8279
8534
|
N.suspendHistory();
|
|
8280
|
-
let F = i ?? this._getDefaultFontFamily(), I =
|
|
8535
|
+
let F = i ?? this._getDefaultFontFamily(), I = Nr({ width: m }), L = Mr({
|
|
8281
8536
|
strokeColor: p,
|
|
8282
8537
|
width: I
|
|
8283
|
-
}),
|
|
8538
|
+
}), ee = {
|
|
8284
8539
|
id: t,
|
|
8285
8540
|
fontFamily: F,
|
|
8286
8541
|
fontSize: a,
|
|
@@ -8291,7 +8546,7 @@ var Xr = class {
|
|
|
8291
8546
|
linethrough: u,
|
|
8292
8547
|
textAlign: d,
|
|
8293
8548
|
fill: f,
|
|
8294
|
-
stroke:
|
|
8549
|
+
stroke: L,
|
|
8295
8550
|
strokeWidth: I,
|
|
8296
8551
|
strokeUniform: !0,
|
|
8297
8552
|
opacity: h,
|
|
@@ -8306,40 +8561,40 @@ var Xr = class {
|
|
|
8306
8561
|
radiusBottomRight: w,
|
|
8307
8562
|
radiusBottomLeft: T,
|
|
8308
8563
|
...E
|
|
8309
|
-
},
|
|
8310
|
-
|
|
8311
|
-
let
|
|
8312
|
-
if (
|
|
8313
|
-
let e =
|
|
8314
|
-
e !==
|
|
8315
|
-
}
|
|
8316
|
-
|
|
8317
|
-
let
|
|
8318
|
-
|
|
8319
|
-
object:
|
|
8564
|
+
}, R = new Ir(n, ee), te = r !== !1;
|
|
8565
|
+
R.autoExpand = te;
|
|
8566
|
+
let ne = E.left !== void 0 || E.top !== void 0;
|
|
8567
|
+
if (R.textCaseRaw = R.text ?? "", l) {
|
|
8568
|
+
let e = Pr({ value: R.textCaseRaw });
|
|
8569
|
+
e !== R.text && R.set({ text: e });
|
|
8570
|
+
}
|
|
8571
|
+
Yr({ textbox: R }) && (R.dirty = !0);
|
|
8572
|
+
let z;
|
|
8573
|
+
ne && (z = M.resolveObjectPlacement({
|
|
8574
|
+
object: R,
|
|
8320
8575
|
left: E.left,
|
|
8321
8576
|
top: E.top,
|
|
8322
8577
|
originX: E.originX,
|
|
8323
8578
|
originY: E.originY,
|
|
8324
8579
|
fallbackPoint: M.getMontageAreaSceneCenter()
|
|
8325
8580
|
}));
|
|
8326
|
-
let
|
|
8327
|
-
return (
|
|
8328
|
-
textbox:
|
|
8329
|
-
placement:
|
|
8330
|
-
shouldAutoExpand:
|
|
8331
|
-
clampToMontage:
|
|
8332
|
-
}),
|
|
8333
|
-
textbox:
|
|
8581
|
+
let re = te && e._hasWrappedLinesBeyondExplicitBreaks(R);
|
|
8582
|
+
return (ne || re) && this._normalizeTextboxAfterContentChange({
|
|
8583
|
+
textbox: R,
|
|
8584
|
+
placement: z,
|
|
8585
|
+
shouldAutoExpand: re,
|
|
8586
|
+
clampToMontage: ne
|
|
8587
|
+
}), z || M.centerObjectToMontageArea({ object: R }), A || P.add(R), O || P.setActiveObject(R), P.requestRenderAll(), N.resumeHistory(), k || N.saveState(), j && P.fire("editor:text-added", {
|
|
8588
|
+
textbox: R,
|
|
8334
8589
|
options: {
|
|
8335
|
-
...
|
|
8590
|
+
...ee,
|
|
8336
8591
|
text: n,
|
|
8337
8592
|
bold: o,
|
|
8338
8593
|
italic: s,
|
|
8339
8594
|
strikethrough: u,
|
|
8340
8595
|
align: d,
|
|
8341
8596
|
color: f,
|
|
8342
|
-
strokeColor:
|
|
8597
|
+
strokeColor: L,
|
|
8343
8598
|
strokeWidth: I
|
|
8344
8599
|
},
|
|
8345
8600
|
flags: {
|
|
@@ -8347,118 +8602,118 @@ var Xr = class {
|
|
|
8347
8602
|
withoutSave: !!k,
|
|
8348
8603
|
withoutAdding: !!A
|
|
8349
8604
|
}
|
|
8350
|
-
}),
|
|
8605
|
+
}), R;
|
|
8351
8606
|
}
|
|
8352
8607
|
updateText({ target: t, style: n = {}, withoutSave: r, skipRender: i, selectionRange: a, emitLifecycleEvents: o = !0 } = {}) {
|
|
8353
8608
|
let s = this._resolveTextObject(t);
|
|
8354
8609
|
if (!s) return null;
|
|
8355
8610
|
let { text: c = "" } = s, { historyManager: l } = this.editor, { canvasManager: u } = this.editor, { canvas: d } = this;
|
|
8356
8611
|
l.suspendHistory();
|
|
8357
|
-
let f = e._getSnapshot(s), { text: p, autoExpand: m, fontFamily: h, fontSize: g, bold: _, italic: v, underline: y, uppercase: b, strikethrough: x, align: S, color: C, strokeColor: w, strokeWidth: T, opacity: E, backgroundColor: D, backgroundOpacity: O, paddingTop: k, paddingRight: A, paddingBottom: j, paddingLeft: M, radiusTopLeft: N, radiusTopRight: P, radiusBottomRight: F, radiusBottomLeft: I, left:
|
|
8612
|
+
let f = e._getSnapshot(s), { text: p, autoExpand: m, fontFamily: h, fontSize: g, bold: _, italic: v, underline: y, uppercase: b, strikethrough: x, align: S, color: C, strokeColor: w, strokeWidth: T, opacity: E, backgroundColor: D, backgroundOpacity: O, paddingTop: k, paddingRight: A, paddingBottom: j, paddingLeft: M, radiusTopLeft: N, radiusTopRight: P, radiusBottomRight: F, radiusBottomLeft: I, left: L, top: ee, originX: R, originY: te, ...ne } = n, z = { ...ne }, re = u.resolveObjectPlacement({
|
|
8358
8613
|
object: s,
|
|
8359
|
-
left:
|
|
8360
|
-
top:
|
|
8361
|
-
originX:
|
|
8362
|
-
originY:
|
|
8363
|
-
}),
|
|
8614
|
+
left: L,
|
|
8615
|
+
top: ee,
|
|
8616
|
+
originX: R,
|
|
8617
|
+
originY: te
|
|
8618
|
+
}), B = a === void 0 ? Dr({ textbox: s }) : si({
|
|
8364
8619
|
text: c,
|
|
8365
8620
|
range: a
|
|
8366
|
-
}),
|
|
8621
|
+
}), V = B ? ci({
|
|
8367
8622
|
textbox: s,
|
|
8368
|
-
range:
|
|
8369
|
-
}) : null,
|
|
8623
|
+
range: B
|
|
8624
|
+
}) : null, H = {}, ie = {}, U = {}, ae, oe, se = kr({
|
|
8370
8625
|
textbox: s,
|
|
8371
|
-
range:
|
|
8372
|
-
}), ce = !
|
|
8373
|
-
if (h !== void 0 && (
|
|
8626
|
+
range: B
|
|
8627
|
+
}), ce = !B || se, le = !B;
|
|
8628
|
+
if (h !== void 0 && (V && (ie.fontFamily = h), ce && (z.fontFamily = h, le && (U.fontFamily = h))), g !== void 0 && (V && (ie.fontSize = g), ce && (z.fontSize = g, le && (U.fontSize = g))), _ !== void 0) {
|
|
8374
8629
|
let e = _ ? "bold" : "normal";
|
|
8375
|
-
|
|
8630
|
+
B && (H.fontWeight = e), ce && (z.fontWeight = e, le && (U.fontWeight = e));
|
|
8376
8631
|
}
|
|
8377
8632
|
if (v !== void 0) {
|
|
8378
8633
|
let e = v ? "italic" : "normal";
|
|
8379
|
-
|
|
8634
|
+
B && (H.fontStyle = e), ce && (z.fontStyle = e, le && (U.fontStyle = e));
|
|
8380
8635
|
}
|
|
8381
|
-
if (y !== void 0 && (
|
|
8382
|
-
let e =
|
|
8636
|
+
if (y !== void 0 && (B && (H.underline = y), ce && (z.underline = y, le && (U.underline = y))), x !== void 0 && (B && (H.linethrough = x), ce && (z.linethrough = x, le && (U.linethrough = x))), S !== void 0 && (z.textAlign = S), C !== void 0 && (B && (H.fill = C), ce && (z.fill = C, le && (U.fill = C))), w !== void 0 || T !== void 0) {
|
|
8637
|
+
let e = B ? jr({
|
|
8383
8638
|
textbox: s,
|
|
8384
|
-
range:
|
|
8639
|
+
range: B,
|
|
8385
8640
|
property: "strokeWidth"
|
|
8386
|
-
}) : void 0, t =
|
|
8641
|
+
}) : void 0, t = B ? jr({
|
|
8387
8642
|
textbox: s,
|
|
8388
|
-
range:
|
|
8643
|
+
range: B,
|
|
8389
8644
|
property: "stroke"
|
|
8390
8645
|
}) : void 0;
|
|
8391
|
-
oe =
|
|
8646
|
+
oe = Nr({ width: T ?? e ?? s.strokeWidth ?? 0 }), ae = Mr({
|
|
8392
8647
|
strokeColor: w ?? t ?? s.stroke ?? void 0,
|
|
8393
8648
|
width: oe
|
|
8394
|
-
}),
|
|
8649
|
+
}), B && (H.stroke = ae, H.strokeWidth = oe), ce && (z.stroke = ae, z.strokeWidth = oe, le && (U.stroke = ae, U.strokeWidth = oe));
|
|
8395
8650
|
}
|
|
8396
|
-
E !== void 0 && (
|
|
8651
|
+
E !== void 0 && (z.opacity = E), D !== void 0 && (z.backgroundColor = D), O !== void 0 && (z.backgroundOpacity = O), k !== void 0 && (z.paddingTop = k), A !== void 0 && (z.paddingRight = A), j !== void 0 && (z.paddingBottom = j), M !== void 0 && (z.paddingLeft = M), N !== void 0 && (z.radiusTopLeft = N), P !== void 0 && (z.radiusTopRight = P), F !== void 0 && (z.radiusBottomRight = F), I !== void 0 && (z.radiusBottomLeft = I);
|
|
8397
8652
|
let ue = s.textCaseRaw ?? c, de = !!s.uppercase, fe = p !== void 0, pe = fe ? p ?? "" : ue, me = b ?? de, he = me !== de;
|
|
8398
|
-
fe || he ? (
|
|
8399
|
-
let ge =
|
|
8400
|
-
|
|
8401
|
-
V,
|
|
8653
|
+
fe || he ? (z.text = me ? Pr({ value: pe }) : pe, s.textCaseRaw = pe) : s.textCaseRaw === void 0 && (s.textCaseRaw = ue);
|
|
8654
|
+
let ge = Jr({ stylesList: [
|
|
8655
|
+
z,
|
|
8402
8656
|
H,
|
|
8657
|
+
ie,
|
|
8403
8658
|
U
|
|
8404
8659
|
] }), _e = [
|
|
8405
|
-
ee,
|
|
8406
|
-
te,
|
|
8407
8660
|
L,
|
|
8408
|
-
|
|
8661
|
+
ee,
|
|
8662
|
+
R,
|
|
8663
|
+
te
|
|
8409
8664
|
], ve = [
|
|
8410
8665
|
k,
|
|
8411
8666
|
A,
|
|
8412
8667
|
j,
|
|
8413
8668
|
M
|
|
8414
|
-
], ye = _e.some((e) => e !== void 0), be = ve.some((e) => e !== void 0), xe = Object.prototype.hasOwnProperty.call(
|
|
8415
|
-
Se && (Ce =
|
|
8669
|
+
], ye = _e.some((e) => e !== void 0), be = ve.some((e) => e !== void 0), xe = Object.prototype.hasOwnProperty.call(z, "width"), Se = be && !ye && !fe && !he && !ge && !xe, Ce = null;
|
|
8670
|
+
Se && (Ce = Gr({
|
|
8416
8671
|
textbox: s,
|
|
8417
|
-
originX:
|
|
8418
|
-
originY:
|
|
8419
|
-
})), s.uppercase = me, s.set(
|
|
8672
|
+
originX: re.originX,
|
|
8673
|
+
originY: re.originY
|
|
8674
|
+
})), s.uppercase = me, s.set(z);
|
|
8420
8675
|
let we = !1;
|
|
8421
|
-
if (
|
|
8422
|
-
let e =
|
|
8423
|
-
textbox: s,
|
|
8424
|
-
styles: V,
|
|
8425
|
-
range: z
|
|
8426
|
-
}), t = B ? xr({
|
|
8676
|
+
if (B) {
|
|
8677
|
+
let e = Ar({
|
|
8427
8678
|
textbox: s,
|
|
8428
8679
|
styles: H,
|
|
8429
8680
|
range: B
|
|
8681
|
+
}), t = V ? Ar({
|
|
8682
|
+
textbox: s,
|
|
8683
|
+
styles: ie,
|
|
8684
|
+
range: V
|
|
8430
8685
|
}) : !1;
|
|
8431
8686
|
we = e || t;
|
|
8432
8687
|
} else if (Object.keys(U).length) {
|
|
8433
|
-
let e =
|
|
8434
|
-
e && (we =
|
|
8688
|
+
let e = Or({ textbox: s });
|
|
8689
|
+
e && (we = Ar({
|
|
8435
8690
|
textbox: s,
|
|
8436
8691
|
styles: U,
|
|
8437
8692
|
range: e
|
|
8438
8693
|
}));
|
|
8439
8694
|
}
|
|
8440
|
-
let Te = we &&
|
|
8441
|
-
V,
|
|
8695
|
+
let Te = we && Jr({ stylesList: [
|
|
8442
8696
|
H,
|
|
8697
|
+
ie,
|
|
8443
8698
|
U
|
|
8444
8699
|
] });
|
|
8445
|
-
if (we && (s.dirty = !0),
|
|
8446
|
-
let e =
|
|
8700
|
+
if (we && (s.dirty = !0), V && (h !== void 0 || g !== void 0)) {
|
|
8701
|
+
let e = li({
|
|
8447
8702
|
textbox: s,
|
|
8448
|
-
range:
|
|
8703
|
+
range: V
|
|
8449
8704
|
}), t = {};
|
|
8450
|
-
h !== void 0 && (t.fontFamily = h), g !== void 0 && (t.fontSize = g),
|
|
8705
|
+
h !== void 0 && (t.fontFamily = h), g !== void 0 && (t.fontSize = g), zr({
|
|
8451
8706
|
textbox: s,
|
|
8452
8707
|
lineIndices: e,
|
|
8453
8708
|
updates: t
|
|
8454
8709
|
});
|
|
8455
8710
|
}
|
|
8456
|
-
if (
|
|
8457
|
-
let e =
|
|
8711
|
+
if (B && (C !== void 0 || w !== void 0 || T !== void 0)) {
|
|
8712
|
+
let e = ui({
|
|
8458
8713
|
textbox: s,
|
|
8459
|
-
range:
|
|
8714
|
+
range: B
|
|
8460
8715
|
}), t = {};
|
|
8461
|
-
C !== void 0 && (t.fill = C), (w !== void 0 || T !== void 0) && (ae === null && (t.stroke = null), ae != null && (t.stroke = ae)),
|
|
8716
|
+
C !== void 0 && (t.fill = C), (w !== void 0 || T !== void 0) && (ae === null && (t.stroke = null), ae != null && (t.stroke = ae)), zr({
|
|
8462
8717
|
textbox: s,
|
|
8463
8718
|
lineIndices: e,
|
|
8464
8719
|
updates: t
|
|
@@ -8478,7 +8733,7 @@ var Xr = class {
|
|
|
8478
8733
|
let ke = Oe && !xe && (fe || he || ge);
|
|
8479
8734
|
this._normalizeTextboxAfterContentChange({
|
|
8480
8735
|
textbox: s,
|
|
8481
|
-
placement:
|
|
8736
|
+
placement: re,
|
|
8482
8737
|
shouldAutoExpand: ke
|
|
8483
8738
|
}), Ce && this._restoreTextboxContentPlacement({
|
|
8484
8739
|
textbox: s,
|
|
@@ -8487,14 +8742,14 @@ var Xr = class {
|
|
|
8487
8742
|
let Ae = {
|
|
8488
8743
|
withoutSave: !!r,
|
|
8489
8744
|
skipRender: !!i
|
|
8490
|
-
}, je = !!
|
|
8745
|
+
}, je = !!B && Object.keys(H).length > 0, Me = {
|
|
8491
8746
|
textbox: s,
|
|
8492
8747
|
target: t,
|
|
8493
8748
|
style: n,
|
|
8494
8749
|
options: Ae,
|
|
8495
|
-
updates:
|
|
8496
|
-
selectionRange:
|
|
8497
|
-
selectionStyles: je ?
|
|
8750
|
+
updates: z,
|
|
8751
|
+
selectionRange: B ?? void 0,
|
|
8752
|
+
selectionStyles: je ? H : void 0
|
|
8498
8753
|
};
|
|
8499
8754
|
o && d.fire("editor:before:text-updated", Me), i || d.requestRenderAll();
|
|
8500
8755
|
let Ne = e._getSnapshot(s);
|
|
@@ -8553,7 +8808,7 @@ var Xr = class {
|
|
|
8553
8808
|
clampToMontage: r
|
|
8554
8809
|
}));
|
|
8555
8810
|
let a = !1;
|
|
8556
|
-
i || (a =
|
|
8811
|
+
i || (a = Yr({ textbox: e }));
|
|
8557
8812
|
let o = !1;
|
|
8558
8813
|
return !i && t && (this.editor.canvasManager.applyObjectPlacement({
|
|
8559
8814
|
object: e,
|
|
@@ -8561,7 +8816,7 @@ var Xr = class {
|
|
|
8561
8816
|
}), o = !0), (i || a) && (e.dirty = !0), (i || a || o) && e.setCoords(), i || a;
|
|
8562
8817
|
}
|
|
8563
8818
|
_restoreTextboxContentPlacement({ textbox: e, contentPlacement: t }) {
|
|
8564
|
-
let n =
|
|
8819
|
+
let n = Gr({
|
|
8565
8820
|
textbox: e,
|
|
8566
8821
|
originX: t.originX,
|
|
8567
8822
|
originY: t.originY
|
|
@@ -8581,15 +8836,15 @@ var Xr = class {
|
|
|
8581
8836
|
_syncLineFontDefaultsOnTextChanged({ textbox: e }) {
|
|
8582
8837
|
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;
|
|
8583
8838
|
if (h !== 0 && n && Object.keys(n).length) {
|
|
8584
|
-
let e =
|
|
8839
|
+
let e = di({
|
|
8585
8840
|
previous: d,
|
|
8586
8841
|
next: u
|
|
8587
|
-
}), t =
|
|
8842
|
+
}), t = fi({
|
|
8588
8843
|
text: d,
|
|
8589
8844
|
charIndex: e
|
|
8590
8845
|
});
|
|
8591
8846
|
if (h > 0) {
|
|
8592
|
-
let r =
|
|
8847
|
+
let r = pi({
|
|
8593
8848
|
text: d,
|
|
8594
8849
|
lineIndex: t
|
|
8595
8850
|
}), i = t + 1;
|
|
@@ -8630,7 +8885,7 @@ var Xr = class {
|
|
|
8630
8885
|
let t = p[e] ?? "", n = g ? g[e] : void 0;
|
|
8631
8886
|
if (n && (T = n), t.length !== 0) {
|
|
8632
8887
|
if (n) {
|
|
8633
|
-
let r =
|
|
8888
|
+
let r = Br({
|
|
8634
8889
|
lineText: t,
|
|
8635
8890
|
lineStyles: S ? S[e] : void 0,
|
|
8636
8891
|
lineDefaults: n
|
|
@@ -8670,16 +8925,16 @@ var Xr = class {
|
|
|
8670
8925
|
if (!Number.isFinite(f) || f <= 0) return !1;
|
|
8671
8926
|
let p = a.split("\n").length, m = !1;
|
|
8672
8927
|
Math.abs((e.width ?? 0) - f) > .01 && (e.set({ width: f }), m = !0), e.initDimensions();
|
|
8673
|
-
let { textLines: h } = e, g = Array.isArray(h) && h.length > p, _ = Math.ceil(
|
|
8928
|
+
let { textLines: h } = e, g = Array.isArray(h) && h.length > p, _ = Math.ceil(Ur({
|
|
8674
8929
|
textbox: e,
|
|
8675
8930
|
text: a
|
|
8676
8931
|
})), v = Math.min(e.minWidth ?? 1, f), y = Math.min(f, Math.max(_, v));
|
|
8677
|
-
g && (y = f), Math.abs((e.width ?? 0) - y) > .01 && (e.set({ width: y }), e.initDimensions(), m = !0),
|
|
8932
|
+
g && (y = f), Math.abs((e.width ?? 0) - y) > .01 && (e.set({ width: y }), e.initDimensions(), m = !0), Yr({ textbox: e }) && (m = !0), t && r.applyObjectPlacement({
|
|
8678
8933
|
object: e,
|
|
8679
8934
|
placement: t
|
|
8680
8935
|
});
|
|
8681
8936
|
let b = !1;
|
|
8682
|
-
return n && (b =
|
|
8937
|
+
return n && (b = Kr({
|
|
8683
8938
|
textbox: e,
|
|
8684
8939
|
montageLeft: o,
|
|
8685
8940
|
montageRight: o + s
|
|
@@ -8737,7 +8992,7 @@ var Xr = class {
|
|
|
8737
8992
|
_getDefaultFontFamily() {
|
|
8738
8993
|
return this.fonts[0]?.family ?? "Arial";
|
|
8739
8994
|
}
|
|
8740
|
-
},
|
|
8995
|
+
}, hi = ({ x1: e, y1: t, x2: n, y2: r }) => (Math.atan2(r - t, n - e) * 180 / Math.PI + 360) % 360, gi = (e) => {
|
|
8741
8996
|
if (!e || typeof e != "object") return null;
|
|
8742
8997
|
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) => ({
|
|
8743
8998
|
color: typeof e.color == "string" ? e.color : "#000000",
|
|
@@ -8748,7 +9003,7 @@ var Xr = class {
|
|
|
8748
9003
|
let { x1: e, y1: t, x2: r, y2: i } = n;
|
|
8749
9004
|
if (typeof e == "number" && typeof t == "number" && typeof r == "number" && typeof i == "number") return {
|
|
8750
9005
|
type: "linear",
|
|
8751
|
-
angle:
|
|
9006
|
+
angle: hi({
|
|
8752
9007
|
x1: e,
|
|
8753
9008
|
y1: t,
|
|
8754
9009
|
x2: r,
|
|
@@ -8776,7 +9031,7 @@ var Xr = class {
|
|
|
8776
9031
|
};
|
|
8777
9032
|
}
|
|
8778
9033
|
return null;
|
|
8779
|
-
},
|
|
9034
|
+
}, _i = "_templateAnchorX", vi = "_templateAnchorY", yi = class t {
|
|
8780
9035
|
constructor({ editor: e }) {
|
|
8781
9036
|
this.editor = e;
|
|
8782
9037
|
}
|
|
@@ -8785,7 +9040,7 @@ var Xr = class {
|
|
|
8785
9040
|
if (!p.length) return s.emitWarning({
|
|
8786
9041
|
origin: "TemplateManager",
|
|
8787
9042
|
method: "serializeSelection",
|
|
8788
|
-
code:
|
|
9043
|
+
code: wr.TEMPLATE_MANAGER.NO_OBJECTS_SELECTED,
|
|
8789
9044
|
message: "Нет объектов для сериализации шаблона"
|
|
8790
9045
|
}), null;
|
|
8791
9046
|
let m = t._getBounds(o), h = t._getMontageSize({
|
|
@@ -8814,14 +9069,14 @@ var Xr = class {
|
|
|
8814
9069
|
if (!s?.length) return a.emitWarning({
|
|
8815
9070
|
origin: "TemplateManager",
|
|
8816
9071
|
method: "applyTemplate",
|
|
8817
|
-
code:
|
|
9072
|
+
code: wr.TEMPLATE_MANAGER.INVALID_TEMPLATE,
|
|
8818
9073
|
message: "Шаблон не содержит объектов"
|
|
8819
9074
|
}), null;
|
|
8820
9075
|
let u = t._getBounds(r);
|
|
8821
9076
|
if (!u) return a.emitWarning({
|
|
8822
9077
|
origin: "TemplateManager",
|
|
8823
9078
|
method: "applyTemplate",
|
|
8824
|
-
code:
|
|
9079
|
+
code: wr.TEMPLATE_MANAGER.INVALID_TARGET,
|
|
8825
9080
|
message: "Не удалось определить границы монтажной области"
|
|
8826
9081
|
}), null;
|
|
8827
9082
|
let d = t._getMontageSize({
|
|
@@ -8840,7 +9095,7 @@ var Xr = class {
|
|
|
8840
9095
|
if (!r.length) return a.emitWarning({
|
|
8841
9096
|
origin: "TemplateManager",
|
|
8842
9097
|
method: "applyTemplate",
|
|
8843
|
-
code:
|
|
9098
|
+
code: wr.TEMPLATE_MANAGER.INVALID_TEMPLATE,
|
|
8844
9099
|
message: "Не удалось создать объекты шаблона"
|
|
8845
9100
|
}), null;
|
|
8846
9101
|
let { backgroundObject: i, contentObjects: c } = t._extractBackgroundObject(r);
|
|
@@ -8875,7 +9130,7 @@ var Xr = class {
|
|
|
8875
9130
|
return a.emitError({
|
|
8876
9131
|
origin: "TemplateManager",
|
|
8877
9132
|
method: "applyTemplate",
|
|
8878
|
-
code:
|
|
9133
|
+
code: wr.TEMPLATE_MANAGER.APPLY_FAILED,
|
|
8879
9134
|
message: "Ошибка применения шаблона",
|
|
8880
9135
|
data: {
|
|
8881
9136
|
templateId: l,
|
|
@@ -9029,8 +9284,8 @@ var Xr = class {
|
|
|
9029
9284
|
baseHeight: a,
|
|
9030
9285
|
scale: n,
|
|
9031
9286
|
useRelativePositions: o,
|
|
9032
|
-
anchorX: t._resolveAnchor(s,
|
|
9033
|
-
anchorY: t._resolveAnchor(s,
|
|
9287
|
+
anchorX: t._resolveAnchor(s, _i),
|
|
9288
|
+
anchorY: t._resolveAnchor(s, vi)
|
|
9034
9289
|
})
|
|
9035
9290
|
}), h = f * n, g = p * n, _ = e.originX ?? "center", v = e.originY ?? "center";
|
|
9036
9291
|
e.set({
|
|
@@ -9044,7 +9299,7 @@ var Xr = class {
|
|
|
9044
9299
|
originX: _,
|
|
9045
9300
|
originY: v
|
|
9046
9301
|
}
|
|
9047
|
-
}), delete s[
|
|
9302
|
+
}), delete s[_i], delete s[vi];
|
|
9048
9303
|
}
|
|
9049
9304
|
static _getPositioningBounds({ bounds: e, baseWidth: n, baseHeight: r, scale: i, useRelativePositions: a, anchorX: o, anchorY: s }) {
|
|
9050
9305
|
if (!a) return e;
|
|
@@ -9108,7 +9363,7 @@ var Xr = class {
|
|
|
9108
9363
|
});
|
|
9109
9364
|
if (!i || !s || !o) return;
|
|
9110
9365
|
e.setCoords();
|
|
9111
|
-
let c = e, l = t._resolveAnchor(c,
|
|
9366
|
+
let c = e, l = t._resolveAnchor(c, _i), 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;
|
|
9112
9367
|
e.set("width", i), e.initDimensions();
|
|
9113
9368
|
let g = t._getLongestLineWidth({
|
|
9114
9369
|
textbox: e,
|
|
@@ -9137,10 +9392,10 @@ var Xr = class {
|
|
|
9137
9392
|
x: (p.left - o) / d,
|
|
9138
9393
|
y: (p.top - s) / f
|
|
9139
9394
|
}, h = (u.left - o) / d, g = (u.top - s) / f, _ = h + u.width / d, v = g + u.height / f;
|
|
9140
|
-
return a[
|
|
9395
|
+
return a[_i] = t._detectAnchor({
|
|
9141
9396
|
start: h,
|
|
9142
9397
|
end: _
|
|
9143
|
-
}), a[
|
|
9398
|
+
}), a[vi] = t._detectAnchor({
|
|
9144
9399
|
start: g,
|
|
9145
9400
|
end: v
|
|
9146
9401
|
}), a.left = m.x, a.top = m.y, a;
|
|
@@ -9165,7 +9420,7 @@ var Xr = class {
|
|
|
9165
9420
|
withoutSave: !0
|
|
9166
9421
|
}), !0;
|
|
9167
9422
|
if (a === "gradient") {
|
|
9168
|
-
let e =
|
|
9423
|
+
let e = gi(r);
|
|
9169
9424
|
if (e) return n.setGradientBackground({
|
|
9170
9425
|
gradient: e,
|
|
9171
9426
|
customData: o,
|
|
@@ -9186,7 +9441,7 @@ var Xr = class {
|
|
|
9186
9441
|
r.emitWarning({
|
|
9187
9442
|
origin: "TemplateManager",
|
|
9188
9443
|
method: "applyTemplate",
|
|
9189
|
-
code:
|
|
9444
|
+
code: wr.TEMPLATE_MANAGER.APPLY_FAILED,
|
|
9190
9445
|
message: "Не удалось применить фон из шаблона",
|
|
9191
9446
|
data: e
|
|
9192
9447
|
});
|
|
@@ -9222,29 +9477,29 @@ var Xr = class {
|
|
|
9222
9477
|
enlivenObjectEnlivables(e) {
|
|
9223
9478
|
return C.enlivenObjectEnlivables(e);
|
|
9224
9479
|
}
|
|
9225
|
-
},
|
|
9226
|
-
let n =
|
|
9480
|
+
}, bi = "#3D8BF4", xi = .5, Si = ({ distance: e }) => Number.isFinite(e) ? Math.round(Math.max(0, e)) : 0, Ci = ({ firstDistance: e, secondDistance: t }) => {
|
|
9481
|
+
let n = Si({ distance: e }), r = Si({ distance: t });
|
|
9227
9482
|
return {
|
|
9228
9483
|
firstDisplayDistance: n,
|
|
9229
9484
|
secondDisplayDistance: r,
|
|
9230
9485
|
displayDistanceDiff: Math.abs(n - r),
|
|
9231
9486
|
commonDisplayDistance: Math.max(n, r)
|
|
9232
9487
|
};
|
|
9233
|
-
},
|
|
9488
|
+
}, wi = ({ firstStart: e, firstEnd: t, secondStart: n, secondEnd: r }) => Math.min(t, r) - Math.max(e, n), Ti = ({ step: e }) => {
|
|
9234
9489
|
let t = Math.abs(e).toString(), n = t.indexOf(".");
|
|
9235
9490
|
return n === -1 ? 0 : t.slice(n + 1).length;
|
|
9236
|
-
},
|
|
9491
|
+
}, Ei = ({ value: e, step: t }) => {
|
|
9237
9492
|
if (t === 0) return e;
|
|
9238
|
-
let n =
|
|
9493
|
+
let n = Ti({ step: t }), r = Math.round(e / t) * t;
|
|
9239
9494
|
return Number(r.toFixed(n));
|
|
9240
|
-
},
|
|
9495
|
+
}, Di = ({ value: e, step: t }) => {
|
|
9241
9496
|
if (t === 0) return !0;
|
|
9242
|
-
let n =
|
|
9497
|
+
let n = Ei({
|
|
9243
9498
|
value: e,
|
|
9244
9499
|
step: t
|
|
9245
|
-
}), r = 10 ** -(
|
|
9500
|
+
}), r = 10 ** -(Ti({ step: t }) + 4);
|
|
9246
9501
|
return Math.abs(n - e) <= r;
|
|
9247
|
-
},
|
|
9502
|
+
}, Oi = ({ bounds: e, axis: t }) => {
|
|
9248
9503
|
let { left: n = 0, right: r = 0, top: i = 0, bottom: a = 0 } = e;
|
|
9249
9504
|
return t === "vertical" ? {
|
|
9250
9505
|
start: i,
|
|
@@ -9253,7 +9508,7 @@ var Xr = class {
|
|
|
9253
9508
|
start: n,
|
|
9254
9509
|
end: r
|
|
9255
9510
|
};
|
|
9256
|
-
},
|
|
9511
|
+
}, ki = ({ items: e, axis: t }) => {
|
|
9257
9512
|
for (let n = 1; n < e.length; n += 1) {
|
|
9258
9513
|
let r = e[n], { bounds: i } = r, a = i[t], o = n - 1;
|
|
9259
9514
|
for (; o >= 0;) {
|
|
@@ -9263,10 +9518,10 @@ var Xr = class {
|
|
|
9263
9518
|
}
|
|
9264
9519
|
e[o + 1] = r;
|
|
9265
9520
|
}
|
|
9266
|
-
},
|
|
9521
|
+
}, Ai = ({ items: e, index: t, axis: n, direction: r }) => {
|
|
9267
9522
|
let i = e[t];
|
|
9268
9523
|
if (!i) return null;
|
|
9269
|
-
let { bounds: a } = i, { start: o, end: s } =
|
|
9524
|
+
let { bounds: a } = i, { start: o, end: s } = Oi({
|
|
9270
9525
|
bounds: a,
|
|
9271
9526
|
axis: n
|
|
9272
9527
|
});
|
|
@@ -9274,7 +9529,7 @@ var Xr = class {
|
|
|
9274
9529
|
for (let r = t - 1; r >= 0; --r) {
|
|
9275
9530
|
let t = e[r];
|
|
9276
9531
|
if (!t) continue;
|
|
9277
|
-
let { bounds: i } = t, { end: a } =
|
|
9532
|
+
let { bounds: i } = t, { end: a } = Oi({
|
|
9278
9533
|
bounds: i,
|
|
9279
9534
|
axis: n
|
|
9280
9535
|
});
|
|
@@ -9285,26 +9540,26 @@ var Xr = class {
|
|
|
9285
9540
|
for (let r = t + 1; r < e.length; r += 1) {
|
|
9286
9541
|
let t = e[r];
|
|
9287
9542
|
if (!t) continue;
|
|
9288
|
-
let { bounds: i } = t, { start: a } =
|
|
9543
|
+
let { bounds: i } = t, { start: a } = Oi({
|
|
9289
9544
|
bounds: i,
|
|
9290
9545
|
axis: n
|
|
9291
9546
|
});
|
|
9292
9547
|
if (a - s >= 0) return r;
|
|
9293
9548
|
}
|
|
9294
9549
|
return null;
|
|
9295
|
-
},
|
|
9550
|
+
}, ji = ({ items: e }) => {
|
|
9296
9551
|
for (let t = 0; t < e.length; t += 1) {
|
|
9297
9552
|
let { isActive: n } = e[t];
|
|
9298
9553
|
if (n) return t;
|
|
9299
9554
|
}
|
|
9300
9555
|
return -1;
|
|
9301
|
-
},
|
|
9556
|
+
}, Mi = ({ patternAxis: e, activeRangeStart: t, activeRangeEnd: n, tolerance: r = 0 }) => {
|
|
9302
9557
|
let i = Math.min(t, n), a = Math.max(t, n);
|
|
9303
9558
|
return e >= i - r && e <= a + r;
|
|
9304
|
-
},
|
|
9559
|
+
}, Ni = ({ patternStart: e, patternEnd: t, activeStart: n, activeEnd: r }) => t <= n ? "before" : e >= r ? "after" : null, Pi = ({ baseOption: e, candidateOption: t }) => {
|
|
9305
9560
|
let { delta: n, guide: { distance: r } } = e, { delta: i, guide: { distance: a } } = t;
|
|
9306
9561
|
return n === i && r === a;
|
|
9307
|
-
},
|
|
9562
|
+
}, Fi = ({ options: e }) => {
|
|
9308
9563
|
let t = e[0];
|
|
9309
9564
|
for (let n = 1; n < e.length; n += 1) {
|
|
9310
9565
|
let r = e[n];
|
|
@@ -9315,11 +9570,11 @@ var Xr = class {
|
|
|
9315
9570
|
r.diff === t.diff && Math.abs(r.delta) < Math.abs(t.delta) && (t = r);
|
|
9316
9571
|
}
|
|
9317
9572
|
return t;
|
|
9318
|
-
},
|
|
9573
|
+
}, Ii = ({ currentOption: e, nextOption: t }) => {
|
|
9319
9574
|
if (!e) return !0;
|
|
9320
9575
|
let { contextDistance: n, diff: r, delta: i } = e, { contextDistance: a, diff: o, delta: s } = t;
|
|
9321
9576
|
return a < n ? !0 : a > n ? !1 : o < r ? !0 : o > r ? !1 : Math.abs(s) < Math.abs(i);
|
|
9322
|
-
},
|
|
9577
|
+
}, Li = ({ options: e }) => {
|
|
9323
9578
|
let t = [], n = null, r = null;
|
|
9324
9579
|
for (let i of e) {
|
|
9325
9580
|
let { kind: e, side: a } = i;
|
|
@@ -9327,18 +9582,18 @@ var Xr = class {
|
|
|
9327
9582
|
t.push(i);
|
|
9328
9583
|
continue;
|
|
9329
9584
|
}
|
|
9330
|
-
a === "before" &&
|
|
9585
|
+
a === "before" && Ii({
|
|
9331
9586
|
currentOption: n,
|
|
9332
9587
|
nextOption: i
|
|
9333
|
-
}) && (n = i), a === "after" &&
|
|
9588
|
+
}) && (n = i), a === "after" && Ii({
|
|
9334
9589
|
currentOption: r,
|
|
9335
9590
|
nextOption: i
|
|
9336
9591
|
}) && (r = i);
|
|
9337
9592
|
}
|
|
9338
9593
|
return n && t.push(n), r && t.push(r), t;
|
|
9339
|
-
},
|
|
9594
|
+
}, Ri = ({ options: e, side: t, baseOption: n }) => {
|
|
9340
9595
|
let r = null;
|
|
9341
|
-
for (let i of e) if (i.side === t &&
|
|
9596
|
+
for (let i of e) if (i.side === t && Pi({
|
|
9342
9597
|
baseOption: n,
|
|
9343
9598
|
candidateOption: i
|
|
9344
9599
|
})) {
|
|
@@ -9349,63 +9604,63 @@ var Xr = class {
|
|
|
9349
9604
|
!r || i.diff !== r.diff || Math.abs(i.delta) < Math.abs(r.delta) && (r = i);
|
|
9350
9605
|
}
|
|
9351
9606
|
return r;
|
|
9352
|
-
},
|
|
9607
|
+
}, zi = ({ option: e }) => {
|
|
9353
9608
|
let { side: t, kind: n, guide: { distance: r } } = e;
|
|
9354
9609
|
return {
|
|
9355
9610
|
side: t,
|
|
9356
9611
|
kind: n,
|
|
9357
9612
|
distance: r
|
|
9358
9613
|
};
|
|
9359
|
-
},
|
|
9614
|
+
}, Bi = ({ option: e, context: t }) => {
|
|
9360
9615
|
let { side: n, kind: r, distance: i } = t, { side: a, kind: o, guide: { distance: s } } = e;
|
|
9361
9616
|
return n !== a || r !== o ? !1 : Math.abs(s - i) <= 1;
|
|
9362
|
-
},
|
|
9617
|
+
}, Vi = ({ options: e, context: t }) => {
|
|
9363
9618
|
if (!t) return null;
|
|
9364
|
-
for (let n of e) if (
|
|
9619
|
+
for (let n of e) if (Bi({
|
|
9365
9620
|
option: n,
|
|
9366
9621
|
context: t
|
|
9367
9622
|
})) return n;
|
|
9368
9623
|
return null;
|
|
9369
|
-
},
|
|
9370
|
-
let i =
|
|
9624
|
+
}, Hi = ({ options: e, bestOption: t, previousContext: n, switchDistance: r = 0 }) => {
|
|
9625
|
+
let i = Vi({
|
|
9371
9626
|
options: e,
|
|
9372
9627
|
context: n
|
|
9373
9628
|
});
|
|
9374
9629
|
if (!i) return t;
|
|
9375
9630
|
let a = Math.max(0, r);
|
|
9376
9631
|
return a === 0 || Math.abs(t.delta - i.delta) >= a ? t : i;
|
|
9377
|
-
},
|
|
9632
|
+
}, Ui = ({ guides: e, seenGuideKeys: t, guide: n }) => {
|
|
9378
9633
|
let { type: r, axis: i, refStart: a, refEnd: o, activeStart: s, activeEnd: c, distance: l } = n, u = `${r}:${i}:${a}:${o}:${s}:${c}:${l}`;
|
|
9379
9634
|
t.has(u) || (t.add(u), e.push(n));
|
|
9380
|
-
},
|
|
9635
|
+
}, Wi = ({ options: e, previousContext: t = null, switchDistance: n = 0 }) => {
|
|
9381
9636
|
if (!e.length) return {
|
|
9382
9637
|
delta: 0,
|
|
9383
9638
|
guides: [],
|
|
9384
9639
|
context: null
|
|
9385
9640
|
};
|
|
9386
|
-
let r =
|
|
9641
|
+
let r = Li({ options: e }), i = [];
|
|
9387
9642
|
for (let e of r) e.kind === "reference" && i.push(e);
|
|
9388
|
-
let a = i.length > 0, o = a ? i : r, s =
|
|
9643
|
+
let a = i.length > 0, o = a ? i : r, s = Hi({
|
|
9389
9644
|
options: o,
|
|
9390
|
-
bestOption:
|
|
9645
|
+
bestOption: Fi({ options: o }),
|
|
9391
9646
|
previousContext: t,
|
|
9392
9647
|
switchDistance: n
|
|
9393
|
-
}), c =
|
|
9648
|
+
}), c = Ri({
|
|
9394
9649
|
options: o,
|
|
9395
9650
|
side: "before",
|
|
9396
9651
|
baseOption: s
|
|
9397
|
-
}), l =
|
|
9652
|
+
}), l = Ri({
|
|
9398
9653
|
options: o,
|
|
9399
9654
|
side: "after",
|
|
9400
9655
|
baseOption: s
|
|
9401
|
-
}), u =
|
|
9656
|
+
}), u = Ri({
|
|
9402
9657
|
options: a ? r : o,
|
|
9403
9658
|
side: "center",
|
|
9404
9659
|
baseOption: s
|
|
9405
9660
|
}), d = [];
|
|
9406
9661
|
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);
|
|
9407
9662
|
let f = [], p = /* @__PURE__ */ new Set();
|
|
9408
|
-
for (let e of d)
|
|
9663
|
+
for (let e of d) Ui({
|
|
9409
9664
|
guides: f,
|
|
9410
9665
|
seenGuideKeys: p,
|
|
9411
9666
|
guide: e.guide
|
|
@@ -9413,15 +9668,15 @@ var Xr = class {
|
|
|
9413
9668
|
return {
|
|
9414
9669
|
delta: s.delta,
|
|
9415
9670
|
guides: f,
|
|
9416
|
-
context:
|
|
9671
|
+
context: zi({ option: s })
|
|
9417
9672
|
};
|
|
9418
|
-
},
|
|
9419
|
-
let s = n - (e - r), c =
|
|
9673
|
+
}, Gi = ({ activeStart: e, activeEnd: t, targetGap: n, beforeEdge: r, afterEdge: i, threshold: a, step: o }) => {
|
|
9674
|
+
let s = n - (e - r), c = Ei({
|
|
9420
9675
|
value: s,
|
|
9421
9676
|
step: o
|
|
9422
9677
|
}), l = Math.max(1, Math.ceil(a / Math.max(o, 1))), u = null;
|
|
9423
9678
|
for (let d = -l; d <= l; d += 1) {
|
|
9424
|
-
let l = c + d * o, f = e + l, p = t + l, m = f - r, h = i - p, { displayDistanceDiff: g, commonDisplayDistance: _ } =
|
|
9679
|
+
let l = c + d * o, f = e + l, p = t + l, m = f - r, h = i - p, { displayDistanceDiff: g, commonDisplayDistance: _ } = Ci({
|
|
9425
9680
|
firstDistance: m,
|
|
9426
9681
|
secondDistance: h
|
|
9427
9682
|
});
|
|
@@ -9436,13 +9691,13 @@ var Xr = class {
|
|
|
9436
9691
|
});
|
|
9437
9692
|
}
|
|
9438
9693
|
return u;
|
|
9439
|
-
},
|
|
9440
|
-
let { secondDisplayDistance: n, displayDistanceDiff: r } =
|
|
9694
|
+
}, Ki = ({ currentGap: e, referenceGap: t }) => {
|
|
9695
|
+
let { secondDisplayDistance: n, displayDistanceDiff: r } = Ci({
|
|
9441
9696
|
firstDistance: e,
|
|
9442
9697
|
secondDistance: t
|
|
9443
9698
|
});
|
|
9444
9699
|
return r > 1 ? null : n;
|
|
9445
|
-
},
|
|
9700
|
+
}, qi = ({ anchors: e, positions: t, threshold: n }) => {
|
|
9446
9701
|
let r = 0, i = n + 1, a = null;
|
|
9447
9702
|
for (let o of t) for (let t of e) {
|
|
9448
9703
|
let e = Math.abs(t - o);
|
|
@@ -9452,8 +9707,8 @@ var Xr = class {
|
|
|
9452
9707
|
delta: r,
|
|
9453
9708
|
guidePosition: a
|
|
9454
9709
|
};
|
|
9455
|
-
},
|
|
9456
|
-
let { left: r, right: i, centerX: a, top: o, bottom: s, centerY: c } = e, l =
|
|
9710
|
+
}, Ji = ({ activeBounds: e, threshold: t, anchors: n }) => {
|
|
9711
|
+
let { left: r, right: i, centerX: a, top: o, bottom: s, centerY: c } = e, l = qi({
|
|
9457
9712
|
anchors: n.vertical,
|
|
9458
9713
|
positions: [
|
|
9459
9714
|
r,
|
|
@@ -9461,7 +9716,7 @@ var Xr = class {
|
|
|
9461
9716
|
i
|
|
9462
9717
|
],
|
|
9463
9718
|
threshold: t
|
|
9464
|
-
}), u =
|
|
9719
|
+
}), u = qi({
|
|
9465
9720
|
anchors: n.horizontal,
|
|
9466
9721
|
positions: [
|
|
9467
9722
|
o,
|
|
@@ -9481,11 +9736,11 @@ var Xr = class {
|
|
|
9481
9736
|
deltaY: u.delta,
|
|
9482
9737
|
guides: d
|
|
9483
9738
|
};
|
|
9484
|
-
},
|
|
9739
|
+
}, Yi = ({ activeBounds: e, candidates: t, threshold: n, patterns: r, previousContext: i = null, switchDistance: a = 0 }) => {
|
|
9485
9740
|
let { centerX: o, top: s, bottom: c, left: l, right: u } = e, d = [];
|
|
9486
9741
|
for (let e of t) {
|
|
9487
9742
|
let { left: t, right: n } = e;
|
|
9488
|
-
|
|
9743
|
+
wi({
|
|
9489
9744
|
firstStart: t,
|
|
9490
9745
|
firstEnd: n,
|
|
9491
9746
|
secondStart: l,
|
|
@@ -9505,22 +9760,22 @@ var Xr = class {
|
|
|
9505
9760
|
f.push({
|
|
9506
9761
|
bounds: e,
|
|
9507
9762
|
isActive: !0
|
|
9508
|
-
}),
|
|
9763
|
+
}), ki({
|
|
9509
9764
|
items: f,
|
|
9510
9765
|
axis: "top"
|
|
9511
9766
|
});
|
|
9512
|
-
let p =
|
|
9767
|
+
let p = ji({ items: f });
|
|
9513
9768
|
if (p === -1) return {
|
|
9514
9769
|
delta: 0,
|
|
9515
9770
|
guides: [],
|
|
9516
9771
|
context: null
|
|
9517
9772
|
};
|
|
9518
|
-
let m = [], h = c - s, g =
|
|
9773
|
+
let m = [], h = c - s, g = Ai({
|
|
9519
9774
|
items: f,
|
|
9520
9775
|
index: p,
|
|
9521
9776
|
axis: "vertical",
|
|
9522
9777
|
direction: "prev"
|
|
9523
|
-
}), _ =
|
|
9778
|
+
}), _ = Ai({
|
|
9524
9779
|
items: f,
|
|
9525
9780
|
index: p,
|
|
9526
9781
|
axis: "vertical",
|
|
@@ -9529,19 +9784,19 @@ var Xr = class {
|
|
|
9529
9784
|
if (v && y) {
|
|
9530
9785
|
let { bounds: e } = v, { bounds: t } = y, { bottom: r } = e, { top: i } = t, a = i - r - h;
|
|
9531
9786
|
if (a >= 0) {
|
|
9532
|
-
let e =
|
|
9787
|
+
let e = Ei({
|
|
9533
9788
|
value: a / 2,
|
|
9534
9789
|
step: 1
|
|
9535
9790
|
}), t = s - r, l = i - c, u = Math.abs(t - e), d = Math.abs(l - e);
|
|
9536
9791
|
if (Math.max(u, d) <= n) {
|
|
9537
|
-
let t =
|
|
9792
|
+
let t = Gi({
|
|
9538
9793
|
activeStart: s,
|
|
9539
9794
|
activeEnd: c,
|
|
9540
9795
|
targetGap: e,
|
|
9541
9796
|
beforeEdge: r,
|
|
9542
9797
|
afterEdge: i,
|
|
9543
9798
|
threshold: n,
|
|
9544
|
-
step:
|
|
9799
|
+
step: xi
|
|
9545
9800
|
});
|
|
9546
9801
|
if (t) {
|
|
9547
9802
|
let { delta: e, distance: n, diff: i, activeStart: a, activeEnd: s } = t, c = {
|
|
@@ -9578,16 +9833,16 @@ var Xr = class {
|
|
|
9578
9833
|
}
|
|
9579
9834
|
for (let e of r) {
|
|
9580
9835
|
let { axis: t, start: r, end: i, distance: a } = e;
|
|
9581
|
-
if (!
|
|
9836
|
+
if (!Di({
|
|
9582
9837
|
value: a,
|
|
9583
9838
|
step: .5
|
|
9584
|
-
}) || !
|
|
9839
|
+
}) || !Mi({
|
|
9585
9840
|
patternAxis: t,
|
|
9586
9841
|
activeRangeStart: l,
|
|
9587
9842
|
activeRangeEnd: u,
|
|
9588
9843
|
tolerance: n
|
|
9589
9844
|
})) continue;
|
|
9590
|
-
let d =
|
|
9845
|
+
let d = Ni({
|
|
9591
9846
|
patternStart: r,
|
|
9592
9847
|
patternEnd: i,
|
|
9593
9848
|
activeStart: s,
|
|
@@ -9595,12 +9850,12 @@ var Xr = class {
|
|
|
9595
9850
|
});
|
|
9596
9851
|
if (d) {
|
|
9597
9852
|
if (b !== null && S && d === "before" && Math.abs(b - a) <= n) {
|
|
9598
|
-
let e =
|
|
9853
|
+
let e = Ei({
|
|
9599
9854
|
value: a - b,
|
|
9600
9855
|
step: 1
|
|
9601
9856
|
}), t = s + e, { bottom: c } = S, l = t - c, u = Math.abs(l - a);
|
|
9602
9857
|
if (u > n) continue;
|
|
9603
|
-
let d =
|
|
9858
|
+
let d = Ki({
|
|
9604
9859
|
currentGap: l,
|
|
9605
9860
|
referenceGap: a
|
|
9606
9861
|
});
|
|
@@ -9624,12 +9879,12 @@ var Xr = class {
|
|
|
9624
9879
|
});
|
|
9625
9880
|
}
|
|
9626
9881
|
if (x !== null && C && d === "after" && Math.abs(x - a) <= n) {
|
|
9627
|
-
let e =
|
|
9882
|
+
let e = Ei({
|
|
9628
9883
|
value: x - a,
|
|
9629
9884
|
step: 1
|
|
9630
9885
|
}), t = c + e, { top: s } = C, l = s - t, u = Math.abs(l - a);
|
|
9631
9886
|
if (u > n) continue;
|
|
9632
|
-
let d =
|
|
9887
|
+
let d = Ki({
|
|
9633
9888
|
currentGap: l,
|
|
9634
9889
|
referenceGap: a
|
|
9635
9890
|
});
|
|
@@ -9654,16 +9909,16 @@ var Xr = class {
|
|
|
9654
9909
|
}
|
|
9655
9910
|
}
|
|
9656
9911
|
}
|
|
9657
|
-
return
|
|
9912
|
+
return Wi({
|
|
9658
9913
|
options: m,
|
|
9659
9914
|
previousContext: i,
|
|
9660
9915
|
switchDistance: a
|
|
9661
9916
|
});
|
|
9662
|
-
},
|
|
9917
|
+
}, Xi = ({ activeBounds: e, candidates: t, threshold: n, patterns: r, previousContext: i = null, switchDistance: a = 0 }) => {
|
|
9663
9918
|
let { centerY: o, left: s, right: c, top: l, bottom: u } = e, d = [];
|
|
9664
9919
|
for (let e of t) {
|
|
9665
9920
|
let { top: t, bottom: n } = e;
|
|
9666
|
-
|
|
9921
|
+
wi({
|
|
9667
9922
|
firstStart: t,
|
|
9668
9923
|
firstEnd: n,
|
|
9669
9924
|
secondStart: l,
|
|
@@ -9683,22 +9938,22 @@ var Xr = class {
|
|
|
9683
9938
|
f.push({
|
|
9684
9939
|
bounds: e,
|
|
9685
9940
|
isActive: !0
|
|
9686
|
-
}),
|
|
9941
|
+
}), ki({
|
|
9687
9942
|
items: f,
|
|
9688
9943
|
axis: "left"
|
|
9689
9944
|
});
|
|
9690
|
-
let p =
|
|
9945
|
+
let p = ji({ items: f });
|
|
9691
9946
|
if (p === -1) return {
|
|
9692
9947
|
delta: 0,
|
|
9693
9948
|
guides: [],
|
|
9694
9949
|
context: null
|
|
9695
9950
|
};
|
|
9696
|
-
let m = [], h = c - s, g =
|
|
9951
|
+
let m = [], h = c - s, g = Ai({
|
|
9697
9952
|
items: f,
|
|
9698
9953
|
index: p,
|
|
9699
9954
|
axis: "horizontal",
|
|
9700
9955
|
direction: "prev"
|
|
9701
|
-
}), _ =
|
|
9956
|
+
}), _ = Ai({
|
|
9702
9957
|
items: f,
|
|
9703
9958
|
index: p,
|
|
9704
9959
|
axis: "horizontal",
|
|
@@ -9707,19 +9962,19 @@ var Xr = class {
|
|
|
9707
9962
|
if (v && y) {
|
|
9708
9963
|
let { bounds: e } = v, { bounds: t } = y, { right: r } = e, { left: i } = t, a = i - r - h;
|
|
9709
9964
|
if (a >= 0) {
|
|
9710
|
-
let e =
|
|
9965
|
+
let e = Ei({
|
|
9711
9966
|
value: a / 2,
|
|
9712
9967
|
step: 1
|
|
9713
9968
|
}), t = s - r, l = i - c, u = Math.abs(t - e), d = Math.abs(l - e);
|
|
9714
9969
|
if (Math.max(u, d) <= n) {
|
|
9715
|
-
let t =
|
|
9970
|
+
let t = Gi({
|
|
9716
9971
|
activeStart: s,
|
|
9717
9972
|
activeEnd: c,
|
|
9718
9973
|
targetGap: e,
|
|
9719
9974
|
beforeEdge: r,
|
|
9720
9975
|
afterEdge: i,
|
|
9721
9976
|
threshold: n,
|
|
9722
|
-
step:
|
|
9977
|
+
step: xi
|
|
9723
9978
|
});
|
|
9724
9979
|
if (t) {
|
|
9725
9980
|
let { delta: e, distance: n, diff: i, activeStart: a, activeEnd: s } = t, c = {
|
|
@@ -9756,16 +10011,16 @@ var Xr = class {
|
|
|
9756
10011
|
}
|
|
9757
10012
|
for (let e of r) {
|
|
9758
10013
|
let { axis: t, start: r, end: i, distance: a } = e;
|
|
9759
|
-
if (!
|
|
10014
|
+
if (!Di({
|
|
9760
10015
|
value: a,
|
|
9761
10016
|
step: .5
|
|
9762
|
-
}) || !
|
|
10017
|
+
}) || !Mi({
|
|
9763
10018
|
patternAxis: t,
|
|
9764
10019
|
activeRangeStart: l,
|
|
9765
10020
|
activeRangeEnd: u,
|
|
9766
10021
|
tolerance: n
|
|
9767
10022
|
})) continue;
|
|
9768
|
-
let d =
|
|
10023
|
+
let d = Ni({
|
|
9769
10024
|
patternStart: r,
|
|
9770
10025
|
patternEnd: i,
|
|
9771
10026
|
activeStart: s,
|
|
@@ -9773,12 +10028,12 @@ var Xr = class {
|
|
|
9773
10028
|
});
|
|
9774
10029
|
if (d) {
|
|
9775
10030
|
if (b !== null && S && d === "before" && Math.abs(b - a) <= n) {
|
|
9776
|
-
let e =
|
|
10031
|
+
let e = Ei({
|
|
9777
10032
|
value: a - b,
|
|
9778
10033
|
step: 1
|
|
9779
10034
|
}), t = s + e, { right: c } = S, l = t - c, u = Math.abs(l - a);
|
|
9780
10035
|
if (u > n) continue;
|
|
9781
|
-
let d =
|
|
10036
|
+
let d = Ki({
|
|
9782
10037
|
currentGap: l,
|
|
9783
10038
|
referenceGap: a
|
|
9784
10039
|
});
|
|
@@ -9802,12 +10057,12 @@ var Xr = class {
|
|
|
9802
10057
|
});
|
|
9803
10058
|
}
|
|
9804
10059
|
if (x !== null && C && d === "after" && Math.abs(x - a) <= n) {
|
|
9805
|
-
let e =
|
|
10060
|
+
let e = Ei({
|
|
9806
10061
|
value: x - a,
|
|
9807
10062
|
step: 1
|
|
9808
10063
|
}), t = c + e, { left: s } = C, l = s - t, u = Math.abs(l - a);
|
|
9809
10064
|
if (u > n) continue;
|
|
9810
|
-
let d =
|
|
10065
|
+
let d = Ki({
|
|
9811
10066
|
currentGap: l,
|
|
9812
10067
|
referenceGap: a
|
|
9813
10068
|
});
|
|
@@ -9832,20 +10087,20 @@ var Xr = class {
|
|
|
9832
10087
|
}
|
|
9833
10088
|
}
|
|
9834
10089
|
}
|
|
9835
|
-
return
|
|
10090
|
+
return Wi({
|
|
9836
10091
|
options: m,
|
|
9837
10092
|
previousContext: i,
|
|
9838
10093
|
switchDistance: a
|
|
9839
10094
|
});
|
|
9840
|
-
},
|
|
9841
|
-
let { vertical: o = null, horizontal: s = null } = i ?? {}, c =
|
|
10095
|
+
}, Zi = ({ activeBounds: e, candidates: t, threshold: n, spacingPatterns: r, previousContexts: i, switchDistance: a = 0 }) => {
|
|
10096
|
+
let { vertical: o = null, horizontal: s = null } = i ?? {}, c = Yi({
|
|
9842
10097
|
activeBounds: e,
|
|
9843
10098
|
candidates: t,
|
|
9844
10099
|
threshold: n,
|
|
9845
10100
|
patterns: r.vertical,
|
|
9846
10101
|
previousContext: o,
|
|
9847
10102
|
switchDistance: a
|
|
9848
|
-
}), l =
|
|
10103
|
+
}), l = Xi({
|
|
9849
10104
|
activeBounds: e,
|
|
9850
10105
|
candidates: t,
|
|
9851
10106
|
threshold: n,
|
|
@@ -9864,14 +10119,14 @@ var Xr = class {
|
|
|
9864
10119
|
horizontal: l.context
|
|
9865
10120
|
}
|
|
9866
10121
|
};
|
|
9867
|
-
},
|
|
10122
|
+
}, Qi = ({ context: e, x: t, y: n, width: r, height: i, radius: a }) => {
|
|
9868
10123
|
let o = Math.min(a, r / 2, i / 2);
|
|
9869
10124
|
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();
|
|
9870
|
-
},
|
|
10125
|
+
}, $i = ({ 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 }) => {
|
|
9871
10126
|
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;
|
|
9872
10127
|
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";
|
|
9873
10128
|
let S = e.measureText(a).width + _ * 2, C = g + _ * 2, w = b - S / 2, T = x - C / 2;
|
|
9874
|
-
e.beginPath(),
|
|
10129
|
+
e.beginPath(), Qi({
|
|
9875
10130
|
context: e,
|
|
9876
10131
|
x: w,
|
|
9877
10132
|
y: T,
|
|
@@ -9879,11 +10134,11 @@ var Xr = class {
|
|
|
9879
10134
|
height: C,
|
|
9880
10135
|
radius: v
|
|
9881
10136
|
}), e.fill(), e.fillStyle = c, e.fillText(a, b, x), e.restore();
|
|
9882
|
-
},
|
|
9883
|
-
let { type: r, axis: i, refStart: a, refEnd: o, activeStart: s, activeEnd: c, distance: l } = t, u =
|
|
10137
|
+
}, ea = ({ context: e, guide: t, zoom: n }) => {
|
|
10138
|
+
let { type: r, axis: i, refStart: a, refEnd: o, activeStart: s, activeEnd: c, distance: l } = t, u = Si({ distance: l }).toString();
|
|
9884
10139
|
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();
|
|
9885
|
-
let d =
|
|
9886
|
-
|
|
10140
|
+
let d = bi;
|
|
10141
|
+
$i({
|
|
9887
10142
|
context: e,
|
|
9888
10143
|
type: r,
|
|
9889
10144
|
axis: i,
|
|
@@ -9893,7 +10148,7 @@ var Xr = class {
|
|
|
9893
10148
|
zoom: n,
|
|
9894
10149
|
color: d,
|
|
9895
10150
|
lineWidth: 1
|
|
9896
|
-
}),
|
|
10151
|
+
}), $i({
|
|
9897
10152
|
context: e,
|
|
9898
10153
|
type: r,
|
|
9899
10154
|
axis: i,
|
|
@@ -9904,10 +10159,10 @@ var Xr = class {
|
|
|
9904
10159
|
color: d,
|
|
9905
10160
|
lineWidth: 1
|
|
9906
10161
|
});
|
|
9907
|
-
},
|
|
10162
|
+
}, ta = ({ anchors: e, bounds: t }) => {
|
|
9908
10163
|
let { left: n, right: r, centerX: i, top: a, bottom: o, centerY: s } = t;
|
|
9909
10164
|
e.vertical.push(n, i, r), e.horizontal.push(a, s, o);
|
|
9910
|
-
},
|
|
10165
|
+
}, na = ({ bounds: e, type: t, primaryStart: n, primaryEnd: r }) => {
|
|
9911
10166
|
let i = [], a = n === "top" ? "left" : "top", o = r === "bottom" ? "right" : "bottom", s = [...e].sort((e, t) => e[n] - t[n]);
|
|
9912
10167
|
for (let e = 0; e < s.length; e += 1) {
|
|
9913
10168
|
let c = s[e], l = null, u = Infinity;
|
|
@@ -9928,35 +10183,35 @@ var Xr = class {
|
|
|
9928
10183
|
});
|
|
9929
10184
|
}
|
|
9930
10185
|
return i;
|
|
9931
|
-
},
|
|
9932
|
-
vertical:
|
|
10186
|
+
}, ra = ({ bounds: e }) => ({
|
|
10187
|
+
vertical: na({
|
|
9933
10188
|
bounds: e,
|
|
9934
10189
|
axis: "centerX",
|
|
9935
10190
|
type: "vertical",
|
|
9936
10191
|
primaryStart: "top",
|
|
9937
10192
|
primaryEnd: "bottom"
|
|
9938
10193
|
}),
|
|
9939
|
-
horizontal:
|
|
10194
|
+
horizontal: na({
|
|
9940
10195
|
bounds: e,
|
|
9941
10196
|
axis: "centerY",
|
|
9942
10197
|
type: "horizontal",
|
|
9943
10198
|
primaryStart: "left",
|
|
9944
10199
|
primaryEnd: "right"
|
|
9945
10200
|
})
|
|
9946
|
-
}),
|
|
10201
|
+
}), ia = [
|
|
9947
10202
|
"montage-area",
|
|
9948
10203
|
"background",
|
|
9949
10204
|
"interaction-blocker"
|
|
9950
|
-
],
|
|
10205
|
+
], aa = ({ activeObject: t }) => {
|
|
9951
10206
|
let n = /* @__PURE__ */ new Set();
|
|
9952
10207
|
return t ? (n.add(t), t instanceof e && t.getObjects().forEach((e) => n.add(e)), n) : n;
|
|
9953
|
-
},
|
|
10208
|
+
}, oa = ({ object: e, excluded: t, ignoredIds: n = ia }) => {
|
|
9954
10209
|
if (t.has(e)) return !0;
|
|
9955
10210
|
let { visible: r = !0 } = e;
|
|
9956
10211
|
if (!r) return !0;
|
|
9957
10212
|
let { id: i } = e;
|
|
9958
10213
|
return !!(i && n.includes(i));
|
|
9959
|
-
},
|
|
10214
|
+
}, sa = class e {
|
|
9960
10215
|
constructor({ editor: e }) {
|
|
9961
10216
|
this.anchors = {
|
|
9962
10217
|
vertical: [],
|
|
@@ -10009,7 +10264,7 @@ var Xr = class {
|
|
|
10009
10264
|
this._clearSpacingContexts(), this._clearGuides();
|
|
10010
10265
|
return;
|
|
10011
10266
|
}
|
|
10012
|
-
let { canvas: o } = this, s = o.getZoom() || 1, c = 5 / s, { deltaX: l, deltaY: u } =
|
|
10267
|
+
let { canvas: o } = this, s = o.getZoom() || 1, c = 5 / s, { deltaX: l, deltaY: u } = Ji({
|
|
10013
10268
|
activeBounds: a,
|
|
10014
10269
|
threshold: c,
|
|
10015
10270
|
anchors: this.anchors
|
|
@@ -10021,7 +10276,7 @@ var Xr = class {
|
|
|
10021
10276
|
top: t + u
|
|
10022
10277
|
}), n.setCoords(), a = Ye({ object: n }) ?? a;
|
|
10023
10278
|
}
|
|
10024
|
-
let d = this._resolveCurrentTargetBounds({ activeObject: n }), f = this.spacingContexts.vertical || this.spacingContexts.horizontal ? 10 / s : c, p =
|
|
10279
|
+
let d = this._resolveCurrentTargetBounds({ activeObject: n }), f = this.spacingContexts.vertical || this.spacingContexts.horizontal ? 10 / s : c, p = Zi({
|
|
10025
10280
|
activeBounds: a,
|
|
10026
10281
|
candidates: d,
|
|
10027
10282
|
threshold: f,
|
|
@@ -10042,11 +10297,11 @@ var Xr = class {
|
|
|
10042
10297
|
target: n,
|
|
10043
10298
|
transform: i
|
|
10044
10299
|
});
|
|
10045
|
-
let h = Ye({ object: n }) ?? a, g =
|
|
10300
|
+
let h = Ye({ object: n }) ?? a, g = Ji({
|
|
10046
10301
|
activeBounds: h,
|
|
10047
10302
|
threshold: c,
|
|
10048
10303
|
anchors: this.anchors
|
|
10049
|
-
}), _ =
|
|
10304
|
+
}), _ = Zi({
|
|
10050
10305
|
activeBounds: h,
|
|
10051
10306
|
candidates: d,
|
|
10052
10307
|
threshold: c,
|
|
@@ -10277,9 +10532,9 @@ var Xr = class {
|
|
|
10277
10532
|
let { canvas: e, guideBounds: t } = this, n = e.getSelectionContext();
|
|
10278
10533
|
if (!n) return;
|
|
10279
10534
|
let { left: r, right: i, top: a, bottom: o } = t ?? this._calculateViewportBounds(), { viewportTransform: s } = e, c = e.getZoom() || 1;
|
|
10280
|
-
n.save(), Array.isArray(s) && n.transform(...s), n.lineWidth = 1 / c, n.strokeStyle =
|
|
10535
|
+
n.save(), Array.isArray(s) && n.transform(...s), n.lineWidth = 1 / c, n.strokeStyle = bi, n.setLineDash([4, 4]);
|
|
10281
10536
|
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();
|
|
10282
|
-
for (let e of this.activeSpacingGuides)
|
|
10537
|
+
for (let e of this.activeSpacingGuides) ea({
|
|
10283
10538
|
context: n,
|
|
10284
10539
|
guide: e,
|
|
10285
10540
|
zoom: c
|
|
@@ -10490,14 +10745,14 @@ var Xr = class {
|
|
|
10490
10745
|
}, r = [];
|
|
10491
10746
|
for (let e of t) {
|
|
10492
10747
|
let t = Ye({ object: e });
|
|
10493
|
-
t && (
|
|
10748
|
+
t && (ta({
|
|
10494
10749
|
anchors: n,
|
|
10495
10750
|
bounds: t
|
|
10496
10751
|
}), r.push(t));
|
|
10497
10752
|
}
|
|
10498
10753
|
let { montageArea: i } = this.editor, a = Ye({ object: i });
|
|
10499
10754
|
if (a) {
|
|
10500
|
-
|
|
10755
|
+
ta({
|
|
10501
10756
|
anchors: n,
|
|
10502
10757
|
bounds: a
|
|
10503
10758
|
});
|
|
@@ -10509,12 +10764,12 @@ var Xr = class {
|
|
|
10509
10764
|
bottom: i
|
|
10510
10765
|
};
|
|
10511
10766
|
} else this.guideBounds = this._calculateViewportBounds();
|
|
10512
|
-
this.anchors = n, this.spacingPatterns =
|
|
10767
|
+
this.anchors = n, this.spacingPatterns = ra({ bounds: r }), this.cachedTargetBounds = r;
|
|
10513
10768
|
}
|
|
10514
10769
|
_collectTargets({ activeObject: e }) {
|
|
10515
|
-
let t =
|
|
10770
|
+
let t = aa({ activeObject: e }), n = [];
|
|
10516
10771
|
return this.canvas.forEachObject((e) => {
|
|
10517
|
-
|
|
10772
|
+
oa({
|
|
10518
10773
|
object: e,
|
|
10519
10774
|
excluded: t
|
|
10520
10775
|
}) || n.push(e);
|
|
@@ -10537,7 +10792,7 @@ var Xr = class {
|
|
|
10537
10792
|
bottom: (r - s) / a
|
|
10538
10793
|
};
|
|
10539
10794
|
}
|
|
10540
|
-
},
|
|
10795
|
+
}, ca = "#3D8BF4", la = class e {
|
|
10541
10796
|
constructor({ editor: e }) {
|
|
10542
10797
|
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();
|
|
10543
10798
|
}
|
|
@@ -10630,8 +10885,8 @@ var Xr = class {
|
|
|
10630
10885
|
this.isTargetMontageArea = l, this.activeGuides = d, this._hideToolbar(), n.requestRenderAll();
|
|
10631
10886
|
}
|
|
10632
10887
|
static _resolveTarget({ event: e, activeObject: t }) {
|
|
10633
|
-
let { target: n } = e, r =
|
|
10634
|
-
return n && !
|
|
10888
|
+
let { target: n } = e, r = aa({ activeObject: t });
|
|
10889
|
+
return n && !oa({
|
|
10635
10890
|
object: n,
|
|
10636
10891
|
excluded: r
|
|
10637
10892
|
}) ? n : null;
|
|
@@ -10748,18 +11003,18 @@ var Xr = class {
|
|
|
10748
11003
|
let { canvas: e } = this, t = e.getSelectionContext();
|
|
10749
11004
|
if (!t) return;
|
|
10750
11005
|
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;
|
|
10751
|
-
t.save(), Array.isArray(n) && t.transform(...n), t.lineWidth = 1 / r, t.strokeStyle =
|
|
11006
|
+
t.save(), Array.isArray(n) && t.transform(...n), t.lineWidth = 1 / r, t.strokeStyle = ca, t.setLineDash([]);
|
|
10752
11007
|
for (let e of this.activeGuides) {
|
|
10753
11008
|
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;
|
|
10754
|
-
t.beginPath(), n === "vertical" ? (t.moveTo(i, a), t.lineTo(i, c)) : (t.moveTo(a, i), t.lineTo(c, i)), t.stroke(),
|
|
11009
|
+
t.beginPath(), n === "vertical" ? (t.moveTo(i, a), t.lineTo(i, c)) : (t.moveTo(a, i), t.lineTo(c, i)), t.stroke(), $i({
|
|
10755
11010
|
context: t,
|
|
10756
11011
|
type: n,
|
|
10757
11012
|
axis: i,
|
|
10758
11013
|
start: a,
|
|
10759
11014
|
end: c,
|
|
10760
|
-
text:
|
|
11015
|
+
text: Si({ distance: l }).toString(),
|
|
10761
11016
|
zoom: r,
|
|
10762
|
-
color:
|
|
11017
|
+
color: ca,
|
|
10763
11018
|
lineWidth: 1,
|
|
10764
11019
|
offsetAlongAxis: d,
|
|
10765
11020
|
offsetPerpendicular: 0
|
|
@@ -10777,13 +11032,13 @@ var Xr = class {
|
|
|
10777
11032
|
let { toolbar: e } = this.editor;
|
|
10778
11033
|
e?.showAfterTemporary?.(), this.isToolbarHidden = !1;
|
|
10779
11034
|
}
|
|
10780
|
-
},
|
|
11035
|
+
}, ua = class e {
|
|
10781
11036
|
constructor(e, t) {
|
|
10782
11037
|
this.options = t, this.containerId = e, this.editorId = `${e}-${D()}`, this.init();
|
|
10783
11038
|
}
|
|
10784
11039
|
async init() {
|
|
10785
11040
|
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;
|
|
10786
|
-
if (
|
|
11041
|
+
if (re.apply(), this.canvas = new t(this.containerId, this.options), this.moduleLoader = new A(), this.workerManager = new M(), this.errorManager = new Tr({ editor: this }), this.historyManager = new je({ editor: this }), this.toolbar = new H({ editor: this }), this.transformManager = new He({ editor: this }), this.zoomManager = new Ue({ editor: this }), this.canvasManager = new Ve({ editor: this }), this.imageManager = new Le({ editor: this }), this.layerManager = new et({ editor: this }), this.shapeManager = new vr({ editor: this }), this.interactionBlocker = new Qe({ editor: this }), this.backgroundManager = new $e({ editor: this }), this.clipboardManager = new yr({ editor: this }), this.objectLockManager = new br({ editor: this }), this.groupingManager = new xr({ editor: this }), this.selectionManager = new Sr({ editor: this }), this.deletionManager = new Cr({ editor: this }), this.panConstraintManager = new Er({ editor: this }), this.snappingManager = new sa({ editor: this }), this.measurementManager = new la({ editor: this }), this.fontManager = new B(this.options.fonts ?? []), this.textManager = new mi({ editor: this }), this.templateManager = new yi({ editor: this }), u && (this.angleIndicator = new ae({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.interactionBlocker.ensureOverlay(), this.listeners = new k({
|
|
10787
11042
|
editor: this,
|
|
10788
11043
|
options: this.options
|
|
10789
11044
|
}), 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) {
|
|
@@ -10891,7 +11146,7 @@ var Xr = class {
|
|
|
10891
11146
|
"U+A640-A69F",
|
|
10892
11147
|
"U+FE2E-FE2F",
|
|
10893
11148
|
"U+2116"
|
|
10894
|
-
].join(", "),
|
|
11149
|
+
].join(", "), da = {
|
|
10895
11150
|
preserveObjectStacking: !0,
|
|
10896
11151
|
controlsAboveOverlay: !0,
|
|
10897
11152
|
centeredRotation: !0,
|
|
@@ -11745,20 +12000,20 @@ var Xr = class {
|
|
|
11745
12000
|
};
|
|
11746
12001
|
//#endregion
|
|
11747
12002
|
//#region src/main.ts
|
|
11748
|
-
function
|
|
12003
|
+
function fa(e, t = {}) {
|
|
11749
12004
|
let n = {
|
|
11750
|
-
...
|
|
12005
|
+
...da,
|
|
11751
12006
|
...t
|
|
11752
12007
|
}, r = document.getElementById(e);
|
|
11753
12008
|
if (!r) return Promise.reject(/* @__PURE__ */ Error(`Контейнер с ID "${e}" не найден.`));
|
|
11754
12009
|
let i = document.createElement("canvas");
|
|
11755
12010
|
return i.id = `${e}-canvas`, r.appendChild(i), n.editorContainer = r, new Promise((t) => {
|
|
11756
12011
|
n._onReadyCallback = t;
|
|
11757
|
-
let r = new
|
|
12012
|
+
let r = new ua(i.id, n);
|
|
11758
12013
|
window[e] = r;
|
|
11759
12014
|
});
|
|
11760
12015
|
}
|
|
11761
12016
|
//#endregion
|
|
11762
|
-
export {
|
|
12017
|
+
export { fa as default };
|
|
11763
12018
|
|
|
11764
12019
|
//# sourceMappingURL=main.js.map
|