@anu3ev/fabric-image-editor 0.8.20 → 0.8.22
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 +745 -721
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -3637,7 +3637,7 @@ var Gt = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
3637
3637
|
centerPoint: n,
|
|
3638
3638
|
flags: r
|
|
3639
3639
|
});
|
|
3640
|
-
}, Kt = "ai-generation-overlay", qt = 1080, Jt = Math.PI * 2, Yt = 40, Xt = 8, Zt = Xt / 2, Qt = (qt - Yt * Xt) / (Yt + 1), $t = Xt + Qt,
|
|
3640
|
+
}, Kt = "ai-generation-overlay", qt = 1080, Jt = Math.PI * 2, Yt = 40, Xt = 8, Zt = Xt / 2, Qt = (qt - Yt * Xt) / (Yt + 1), $t = Qt + Zt, en = Xt + Qt, tn = Yt * 16, nn = .18, rn = .58, an = "rgba(136, 136, 136, 0.5)", on = "#ffffff", sn = [
|
|
3641
3641
|
{
|
|
3642
3642
|
rx: 540,
|
|
3643
3643
|
ry: 430,
|
|
@@ -3699,50 +3699,41 @@ var Gt = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
3699
3699
|
seed: 5.37
|
|
3700
3700
|
}
|
|
3701
3701
|
];
|
|
3702
|
-
function
|
|
3702
|
+
function cn({ value: e, min: t = 0, max: n = 1 }) {
|
|
3703
3703
|
return Math.max(t, Math.min(n, e));
|
|
3704
3704
|
}
|
|
3705
|
-
function
|
|
3705
|
+
function ln({ from: e, to: t, progress: n }) {
|
|
3706
3706
|
return e + (t - e) * n;
|
|
3707
3707
|
}
|
|
3708
|
-
function
|
|
3709
|
-
let r =
|
|
3708
|
+
function un({ edgeStart: e, edgeEnd: t, value: n }) {
|
|
3709
|
+
let r = cn({ value: (n - e) / (t - e) });
|
|
3710
3710
|
return r * r * (3 - 2 * r);
|
|
3711
3711
|
}
|
|
3712
|
-
function
|
|
3713
|
-
return
|
|
3714
|
-
}
|
|
3715
|
-
function
|
|
3716
|
-
let e =
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
}
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
let n = t * e.speed, r = t * e.pulseSpeed + e.seed * 3.1, i = -e.travelPadX, a = qt + e.travelPadX, o = -e.travelPadY, s = qt + e.travelPadY, c = ln({
|
|
3726
|
-
time: n,
|
|
3727
|
-
seed: e.seed + .11
|
|
3728
|
-
}), l = ln({
|
|
3729
|
-
time: n * .93 + 7.3,
|
|
3730
|
-
seed: e.seed + .67
|
|
3731
|
-
}), u = sn({
|
|
3732
|
-
from: i,
|
|
3733
|
-
to: a,
|
|
3734
|
-
progress: c
|
|
3735
|
-
}), d = sn({
|
|
3736
|
-
from: o,
|
|
3737
|
-
to: s,
|
|
3712
|
+
function dn({ time: e, seed: t }) {
|
|
3713
|
+
return cn({ value: .5 + .5 * (.53 * Math.sin(e * .73 + t * 11.17) + .29 * Math.sin(e * 1.37 + t * 7.13 + 1.1) + .18 * Math.sin(e * 2.21 + t * 3.97 + 2.4)) });
|
|
3714
|
+
}
|
|
3715
|
+
function fn({ animationSize: e, blob: t, time: n }) {
|
|
3716
|
+
let r = n * t.speed, i = n * t.pulseSpeed + t.seed * 3.1, a = -t.travelPadX, o = e.width + t.travelPadX, s = -t.travelPadY, c = e.height + t.travelPadY, l = dn({
|
|
3717
|
+
time: r,
|
|
3718
|
+
seed: t.seed + .11
|
|
3719
|
+
}), u = dn({
|
|
3720
|
+
time: r * .93 + 7.3,
|
|
3721
|
+
seed: t.seed + .67
|
|
3722
|
+
}), d = ln({
|
|
3723
|
+
from: a,
|
|
3724
|
+
to: o,
|
|
3738
3725
|
progress: l
|
|
3726
|
+
}), f = ln({
|
|
3727
|
+
from: s,
|
|
3728
|
+
to: c,
|
|
3729
|
+
progress: u
|
|
3739
3730
|
});
|
|
3740
|
-
return
|
|
3741
|
-
x:
|
|
3742
|
-
y:
|
|
3743
|
-
rx:
|
|
3744
|
-
ry:
|
|
3745
|
-
weight:
|
|
3731
|
+
return d += Math.sin(r * .57 + t.seed * 5.4) * t.jitterX * 1.8, d += Math.sin(r * 2.6 + t.seed * 9.1) * t.jitterX, f += Math.cos(r * .49 + t.seed * 6.2) * t.jitterY * 1.8, f += Math.cos(r * 2.1 + t.seed * 7.7) * t.jitterY, {
|
|
3732
|
+
x: d,
|
|
3733
|
+
y: f,
|
|
3734
|
+
rx: t.rx * (.88 + .24 * (.5 + .5 * Math.sin(i))),
|
|
3735
|
+
ry: t.ry * (.88 + .24 * (.5 + .5 * Math.cos(i * 1.07))),
|
|
3736
|
+
weight: t.weight
|
|
3746
3737
|
};
|
|
3747
3738
|
}
|
|
3748
3739
|
function pn({ state: e, dot: t }) {
|
|
@@ -3756,35 +3747,58 @@ function mn({ dot: e, states: t, time: n }) {
|
|
|
3756
3747
|
dot: e
|
|
3757
3748
|
});
|
|
3758
3749
|
let i = .98 + .02 * Math.sin(e.x * .012 + e.y * .01 + n * 3.1);
|
|
3759
|
-
return
|
|
3760
|
-
edgeStart:
|
|
3761
|
-
edgeEnd:
|
|
3750
|
+
return un({
|
|
3751
|
+
edgeStart: nn,
|
|
3752
|
+
edgeEnd: rn,
|
|
3762
3753
|
value: r
|
|
3763
3754
|
}) * i;
|
|
3764
3755
|
}
|
|
3765
|
-
function hn({
|
|
3766
|
-
let
|
|
3756
|
+
function hn({ size: e }) {
|
|
3757
|
+
let t = Math.min(e.width, e.height) / qt;
|
|
3758
|
+
return {
|
|
3759
|
+
animationSize: {
|
|
3760
|
+
width: e.width / t,
|
|
3761
|
+
height: e.height / t
|
|
3762
|
+
},
|
|
3763
|
+
animationToOverlayScale: t
|
|
3764
|
+
};
|
|
3765
|
+
}
|
|
3766
|
+
function gn({ size: e }) {
|
|
3767
|
+
let t = Math.floor((e - 2 * $t) / en) + 1, n = Math.max(1, Math.min(tn, t));
|
|
3768
|
+
return {
|
|
3769
|
+
count: n,
|
|
3770
|
+
start: (e - (n - 1) * en) / 2
|
|
3771
|
+
};
|
|
3772
|
+
}
|
|
3773
|
+
function _n({ ctx: e, size: t, time: n }) {
|
|
3774
|
+
let { animationSize: r, animationToOverlayScale: i } = hn({ size: t }), a = gn({ size: r.width }), o = gn({ size: r.height }), s = t.width / 2, c = t.height / 2, l = sn.map((e) => fn({
|
|
3775
|
+
animationSize: r,
|
|
3767
3776
|
blob: e,
|
|
3768
|
-
time:
|
|
3777
|
+
time: n
|
|
3769
3778
|
}));
|
|
3770
|
-
e.fillStyle =
|
|
3771
|
-
for (let r
|
|
3772
|
-
let
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3779
|
+
e.fillStyle = on;
|
|
3780
|
+
for (let t = 0; t < o.count; t += 1) for (let r = 0; r < a.count; r += 1) {
|
|
3781
|
+
let u = {
|
|
3782
|
+
x: a.start + r * en,
|
|
3783
|
+
y: o.start + t * en
|
|
3784
|
+
}, d = mn({
|
|
3785
|
+
dot: u,
|
|
3786
|
+
states: l,
|
|
3787
|
+
time: n
|
|
3776
3788
|
});
|
|
3777
|
-
|
|
3789
|
+
if (d <= .01) continue;
|
|
3790
|
+
let f = u.x * i - s, p = u.y * i - c, m = Zt * Math.min(d, 1) * i;
|
|
3791
|
+
e.beginPath(), e.arc(f, p, m, 0, Jt), e.fill();
|
|
3778
3792
|
}
|
|
3779
3793
|
}
|
|
3780
|
-
var
|
|
3794
|
+
var vn = class extends _ {
|
|
3781
3795
|
static {
|
|
3782
3796
|
this.type = Kt;
|
|
3783
3797
|
}
|
|
3784
3798
|
constructor(e = {}) {
|
|
3785
3799
|
super({
|
|
3786
3800
|
...e,
|
|
3787
|
-
fill:
|
|
3801
|
+
fill: an,
|
|
3788
3802
|
objectCaching: !1
|
|
3789
3803
|
}), this._animationFrameId = null, this._renderTimeMs = 0;
|
|
3790
3804
|
}
|
|
@@ -3805,16 +3819,20 @@ var gn = class extends _ {
|
|
|
3805
3819
|
}
|
|
3806
3820
|
_render(e) {
|
|
3807
3821
|
let t = this.width ?? 0, n = this.height ?? 0;
|
|
3808
|
-
t <= 0 || n <= 0 || (e.save(), e.beginPath(), e.rect(-t / 2, -n / 2, t, n), e.clip(), e.fillStyle =
|
|
3822
|
+
t <= 0 || n <= 0 || (e.save(), e.beginPath(), e.rect(-t / 2, -n / 2, t, n), e.clip(), e.fillStyle = an, e.fillRect(-t / 2, -n / 2, t, n), _n({
|
|
3809
3823
|
ctx: e,
|
|
3824
|
+
size: {
|
|
3825
|
+
width: t,
|
|
3826
|
+
height: n
|
|
3827
|
+
},
|
|
3810
3828
|
time: this._renderTimeMs / 1e3
|
|
3811
3829
|
}), e.restore());
|
|
3812
3830
|
}
|
|
3813
|
-
},
|
|
3814
|
-
b?.setClass && b.setClass(
|
|
3815
|
-
},
|
|
3831
|
+
}, yn = () => {
|
|
3832
|
+
b?.setClass && b.setClass(vn, Kt);
|
|
3833
|
+
}, bn = "default", xn = "overlay-mask", Sn = class {
|
|
3816
3834
|
constructor({ editor: e }) {
|
|
3817
|
-
|
|
3835
|
+
yn(), this.editor = e, this.isBlocked = !1, this.overlayMask = null, this._overlayType = bn;
|
|
3818
3836
|
}
|
|
3819
3837
|
_getOverlayGeometry() {
|
|
3820
3838
|
let { canvasManager: e } = this.editor, t = e.getMontageAreaSceneBounds();
|
|
@@ -3842,7 +3860,7 @@ var gn = class extends _ {
|
|
|
3842
3860
|
hasControls: !1,
|
|
3843
3861
|
excludeFromExport: !0,
|
|
3844
3862
|
visible: !1,
|
|
3845
|
-
id:
|
|
3863
|
+
id: xn
|
|
3846
3864
|
};
|
|
3847
3865
|
}
|
|
3848
3866
|
_createDefaultOverlay() {
|
|
@@ -3857,11 +3875,11 @@ var gn = class extends _ {
|
|
|
3857
3875
|
});
|
|
3858
3876
|
}
|
|
3859
3877
|
_createAiGenerationOverlay() {
|
|
3860
|
-
let e = new
|
|
3878
|
+
let e = new vn(this._getOverlayBaseOptions());
|
|
3861
3879
|
return this.editor.canvas.add(e), e;
|
|
3862
3880
|
}
|
|
3863
3881
|
_stopOverlayAnimation() {
|
|
3864
|
-
this.overlayMask instanceof
|
|
3882
|
+
this.overlayMask instanceof vn && this.overlayMask.stopAnimation();
|
|
3865
3883
|
}
|
|
3866
3884
|
_createOverlay({ overlay: e }) {
|
|
3867
3885
|
let { canvas: t, historyManager: n } = this.editor;
|
|
@@ -3873,7 +3891,7 @@ var gn = class extends _ {
|
|
|
3873
3891
|
}
|
|
3874
3892
|
}
|
|
3875
3893
|
_startOverlayAnimation() {
|
|
3876
|
-
this.overlayMask instanceof
|
|
3894
|
+
this.overlayMask instanceof vn && this.overlayMask.startAnimation({ canvas: this.editor.canvas });
|
|
3877
3895
|
}
|
|
3878
3896
|
ensureOverlay({ overlay: e = this._overlayType } = {}) {
|
|
3879
3897
|
(!this.overlayMask || this._overlayType !== e) && this._createOverlay({ overlay: e }), this.overlayMask && (this.overlayMask.set(this._getOverlayGeometry()), this.overlayMask.visible = this.isBlocked, this.overlayMask.setCoords());
|
|
@@ -3889,7 +3907,7 @@ var gn = class extends _ {
|
|
|
3889
3907
|
}
|
|
3890
3908
|
}
|
|
3891
3909
|
}
|
|
3892
|
-
block({ overlay: e =
|
|
3910
|
+
block({ overlay: e = bn } = {}) {
|
|
3893
3911
|
if (this.isBlocked) {
|
|
3894
3912
|
this.ensureOverlay();
|
|
3895
3913
|
return;
|
|
@@ -3918,7 +3936,7 @@ var gn = class extends _ {
|
|
|
3918
3936
|
}
|
|
3919
3937
|
n.flushDeferredSaveAfterUnblock();
|
|
3920
3938
|
}
|
|
3921
|
-
},
|
|
3939
|
+
}, Cn = class e {
|
|
3922
3940
|
constructor({ editor: e }) {
|
|
3923
3941
|
this.editor = e, this.backgroundObject = null;
|
|
3924
3942
|
}
|
|
@@ -4226,7 +4244,7 @@ var gn = class extends _ {
|
|
|
4226
4244
|
return e.color === n.color && Math.abs(e.offset - n.offset) < 1e-4;
|
|
4227
4245
|
}) ? !1 : e.type === "linear" && t.type === "linear" ? Math.abs(e.coords.x1 - t.coords.x1) < 1e-4 && Math.abs(e.coords.y1 - t.coords.y1) < 1e-4 && Math.abs(e.coords.x2 - t.coords.x2) < 1e-4 && Math.abs(e.coords.y2 - t.coords.y2) < 1e-4 : e.type === "radial" && t.type === "radial" ? Math.abs(e.coords.x1 - t.coords.x1) < 1e-4 && Math.abs(e.coords.y1 - t.coords.y1) < 1e-4 && Math.abs(e.coords.x2 - t.coords.x2) < 1e-4 && Math.abs(e.coords.y2 - t.coords.y2) < 1e-4 && Math.abs(e.coords.r1 - t.coords.r1) < 1e-4 && Math.abs(e.coords.r2 - t.coords.r2) < 1e-4 : !1;
|
|
4228
4246
|
}
|
|
4229
|
-
},
|
|
4247
|
+
}, wn = class t {
|
|
4230
4248
|
constructor({ editor: e }) {
|
|
4231
4249
|
this.editor = e;
|
|
4232
4250
|
}
|
|
@@ -4300,24 +4318,24 @@ var gn = class extends _ {
|
|
|
4300
4318
|
e.sendObjectBackwards(t.obj);
|
|
4301
4319
|
});
|
|
4302
4320
|
}
|
|
4303
|
-
},
|
|
4321
|
+
}, Tn = 1, En = 1e-4;
|
|
4304
4322
|
function K({ value: e }) {
|
|
4305
4323
|
return Number(e.toFixed(4));
|
|
4306
4324
|
}
|
|
4307
|
-
function
|
|
4325
|
+
function Dn({ rounding: e }) {
|
|
4308
4326
|
return R({ rounding: e }) > 0;
|
|
4309
4327
|
}
|
|
4310
|
-
function
|
|
4328
|
+
function On({ width: e, height: t, strokeWidth: n }) {
|
|
4311
4329
|
let r = Math.max(0, n ?? 0);
|
|
4312
4330
|
return {
|
|
4313
|
-
width: Math.max(
|
|
4314
|
-
height: Math.max(
|
|
4331
|
+
width: Math.max(Tn, e - r),
|
|
4332
|
+
height: Math.max(Tn, t - r)
|
|
4315
4333
|
};
|
|
4316
4334
|
}
|
|
4317
|
-
function
|
|
4318
|
-
let a =
|
|
4319
|
-
width: Math.max(
|
|
4320
|
-
height: Math.max(
|
|
4335
|
+
function kn({ shape: e, width: t, height: n, rounding: r, strokeWidth: i }) {
|
|
4336
|
+
let a = On({
|
|
4337
|
+
width: Math.max(Tn, t),
|
|
4338
|
+
height: Math.max(Tn, n),
|
|
4321
4339
|
strokeWidth: i
|
|
4322
4340
|
});
|
|
4323
4341
|
if (e instanceof _) {
|
|
@@ -4336,7 +4354,7 @@ function Dn({ shape: e, width: t, height: n, rounding: r, strokeWidth: i }) {
|
|
|
4336
4354
|
}), e.setCoords();
|
|
4337
4355
|
return;
|
|
4338
4356
|
}
|
|
4339
|
-
let { width: o =
|
|
4357
|
+
let { width: o = Tn, height: s = Tn } = e, c = Math.max(Tn, o), l = Math.max(Tn, s);
|
|
4340
4358
|
e.set({
|
|
4341
4359
|
scaleX: a.width / c,
|
|
4342
4360
|
scaleY: a.height / l,
|
|
@@ -4346,7 +4364,7 @@ function Dn({ shape: e, width: t, height: n, rounding: r, strokeWidth: i }) {
|
|
|
4346
4364
|
originY: "center"
|
|
4347
4365
|
}), e.setCoords();
|
|
4348
4366
|
}
|
|
4349
|
-
function
|
|
4367
|
+
function An({ shape: e, style: t }) {
|
|
4350
4368
|
let { fill: n, stroke: r, strokeWidth: i, strokeDashArray: a, opacity: o } = t, s = {
|
|
4351
4369
|
strokeUniform: !0,
|
|
4352
4370
|
strokeLineCap: "round",
|
|
@@ -4354,7 +4372,7 @@ function On({ shape: e, style: t }) {
|
|
|
4354
4372
|
};
|
|
4355
4373
|
n !== void 0 && (s.fill = n), r !== void 0 && (s.stroke = r), i !== void 0 && (s.strokeWidth = i), a !== void 0 && (s.strokeDashArray = a), o !== void 0 && (s.opacity = o), e.set(s), e.setCoords();
|
|
4356
4374
|
}
|
|
4357
|
-
function
|
|
4375
|
+
function jn({ shape: e, style: t }) {
|
|
4358
4376
|
let n = [e];
|
|
4359
4377
|
for (let e = 0; e < n.length; e += 1) {
|
|
4360
4378
|
let r = n[e];
|
|
@@ -4364,13 +4382,13 @@ function kn({ shape: e, style: t }) {
|
|
|
4364
4382
|
t.opacity !== void 0 && r.set({ opacity: t.opacity }), r.setCoords();
|
|
4365
4383
|
continue;
|
|
4366
4384
|
}
|
|
4367
|
-
|
|
4385
|
+
An({
|
|
4368
4386
|
shape: r,
|
|
4369
4387
|
style: t
|
|
4370
4388
|
});
|
|
4371
4389
|
}
|
|
4372
4390
|
}
|
|
4373
|
-
function
|
|
4391
|
+
function Mn({ points: e, closed: t }) {
|
|
4374
4392
|
if (e.length === 0) return "";
|
|
4375
4393
|
let n = `M ${K({ value: e[0].x })} ${K({ value: e[0].y })}`;
|
|
4376
4394
|
for (let t = 1; t < e.length; t += 1) {
|
|
@@ -4379,7 +4397,7 @@ function An({ points: e, closed: t }) {
|
|
|
4379
4397
|
}
|
|
4380
4398
|
return t && (n += " Z"), n;
|
|
4381
4399
|
}
|
|
4382
|
-
function
|
|
4400
|
+
function Nn({ previous: e, current: t, next: n, roundingRatio: r }) {
|
|
4383
4401
|
let i = {
|
|
4384
4402
|
x: e.x - t.x,
|
|
4385
4403
|
y: e.y - t.y
|
|
@@ -4387,7 +4405,7 @@ function jn({ previous: e, current: t, next: n, roundingRatio: r }) {
|
|
|
4387
4405
|
x: n.x - t.x,
|
|
4388
4406
|
y: n.y - t.y
|
|
4389
4407
|
}, o = Math.hypot(i.x, i.y), s = Math.hypot(a.x, a.y);
|
|
4390
|
-
if (o <=
|
|
4408
|
+
if (o <= En || s <= En) return {
|
|
4391
4409
|
start: {
|
|
4392
4410
|
x: K({ value: t.x }),
|
|
4393
4411
|
y: K({ value: t.y })
|
|
@@ -4409,14 +4427,14 @@ function jn({ previous: e, current: t, next: n, roundingRatio: r }) {
|
|
|
4409
4427
|
}
|
|
4410
4428
|
};
|
|
4411
4429
|
}
|
|
4412
|
-
function
|
|
4430
|
+
function Pn({ points: e, roundingRatio: t, closed: n }) {
|
|
4413
4431
|
let r = e.length;
|
|
4414
4432
|
if (r === 0) return "";
|
|
4415
4433
|
if (!n && r === 1) {
|
|
4416
4434
|
let t = e[0];
|
|
4417
4435
|
return `M ${K({ value: t.x })} ${K({ value: t.y })}`;
|
|
4418
4436
|
}
|
|
4419
|
-
if (t <= 0) return
|
|
4437
|
+
if (t <= 0) return Mn({
|
|
4420
4438
|
points: e,
|
|
4421
4439
|
closed: n
|
|
4422
4440
|
});
|
|
@@ -4424,7 +4442,7 @@ function Mn({ points: e, roundingRatio: t, closed: n }) {
|
|
|
4424
4442
|
let n = [];
|
|
4425
4443
|
for (let i = 0; i < r; i += 1) {
|
|
4426
4444
|
let a = i === 0 ? r - 1 : i - 1, o = i === r - 1 ? 0 : i + 1;
|
|
4427
|
-
n.push(
|
|
4445
|
+
n.push(Nn({
|
|
4428
4446
|
previous: e[a],
|
|
4429
4447
|
current: e[i],
|
|
4430
4448
|
next: e[o],
|
|
@@ -4438,13 +4456,13 @@ function Mn({ points: e, roundingRatio: t, closed: n }) {
|
|
|
4438
4456
|
}
|
|
4439
4457
|
return a += " Z", a;
|
|
4440
4458
|
}
|
|
4441
|
-
if (r === 2) return
|
|
4459
|
+
if (r === 2) return Mn({
|
|
4442
4460
|
points: e,
|
|
4443
4461
|
closed: !1
|
|
4444
4462
|
});
|
|
4445
4463
|
let i = `M ${K({ value: e[0].x })} ${K({ value: e[0].y })}`;
|
|
4446
4464
|
for (let n = 1; n < r - 1; n += 1) {
|
|
4447
|
-
let r =
|
|
4465
|
+
let r = Nn({
|
|
4448
4466
|
previous: e[n - 1],
|
|
4449
4467
|
current: e[n],
|
|
4450
4468
|
next: e[n + 1],
|
|
@@ -4455,8 +4473,8 @@ function Mn({ points: e, roundingRatio: t, closed: n }) {
|
|
|
4455
4473
|
let a = e[r - 1];
|
|
4456
4474
|
return i += ` L ${K({ value: a.x })} ${K({ value: a.y })}`, i;
|
|
4457
4475
|
}
|
|
4458
|
-
function
|
|
4459
|
-
return new f(
|
|
4476
|
+
function Fn({ points: e, rounding: t, closed: n }) {
|
|
4477
|
+
return new f(Pn({
|
|
4460
4478
|
points: e,
|
|
4461
4479
|
roundingRatio: pe({ rounding: t }),
|
|
4462
4480
|
closed: n
|
|
@@ -4467,8 +4485,8 @@ function Nn({ points: e, rounding: t, closed: n }) {
|
|
|
4467
4485
|
top: 0
|
|
4468
4486
|
});
|
|
4469
4487
|
}
|
|
4470
|
-
function
|
|
4471
|
-
return
|
|
4488
|
+
function In({ rounding: e }) {
|
|
4489
|
+
return Dn({ rounding: e }) ? Fn({
|
|
4472
4490
|
points: [
|
|
4473
4491
|
{
|
|
4474
4492
|
x: 50,
|
|
@@ -4494,7 +4512,7 @@ function Pn({ rounding: e }) {
|
|
|
4494
4512
|
top: 0
|
|
4495
4513
|
});
|
|
4496
4514
|
}
|
|
4497
|
-
function
|
|
4515
|
+
function Ln({ path: e }) {
|
|
4498
4516
|
return new f(e, {
|
|
4499
4517
|
originX: "center",
|
|
4500
4518
|
originY: "center",
|
|
@@ -4502,8 +4520,8 @@ function Fn({ path: e }) {
|
|
|
4502
4520
|
top: 0
|
|
4503
4521
|
});
|
|
4504
4522
|
}
|
|
4505
|
-
function
|
|
4506
|
-
let n =
|
|
4523
|
+
function Rn({ path: e, rounding: t }) {
|
|
4524
|
+
let n = Ln({ path: e }).path ?? [], r = w.makePathSimpler(n), i = [], a = !1;
|
|
4507
4525
|
for (let e = 0; e < r.length; e += 1) {
|
|
4508
4526
|
let t = r[e];
|
|
4509
4527
|
if (!t) return null;
|
|
@@ -4523,19 +4541,19 @@ function In({ path: e, rounding: t }) {
|
|
|
4523
4541
|
}
|
|
4524
4542
|
return null;
|
|
4525
4543
|
}
|
|
4526
|
-
return i.length < 2 || a && i.length < 3 ? null :
|
|
4544
|
+
return i.length < 2 || a && i.length < 3 ? null : Fn({
|
|
4527
4545
|
points: i,
|
|
4528
4546
|
rounding: t,
|
|
4529
4547
|
closed: a
|
|
4530
4548
|
});
|
|
4531
4549
|
}
|
|
4532
|
-
function
|
|
4533
|
-
return
|
|
4550
|
+
function zn({ path: e, rounding: t }) {
|
|
4551
|
+
return Dn({ rounding: t }) && Rn({
|
|
4534
4552
|
path: e,
|
|
4535
4553
|
rounding: R({ rounding: t })
|
|
4536
|
-
}) ||
|
|
4554
|
+
}) || Ln({ path: e });
|
|
4537
4555
|
}
|
|
4538
|
-
function
|
|
4556
|
+
function Bn({ points: e, type: t, rounding: n }) {
|
|
4539
4557
|
let r = e.length > 0 ? e : [
|
|
4540
4558
|
{
|
|
4541
4559
|
x: 0,
|
|
@@ -4551,12 +4569,12 @@ function Rn({ points: e, type: t, rounding: n }) {
|
|
|
4551
4569
|
}
|
|
4552
4570
|
], i = R({ rounding: n });
|
|
4553
4571
|
if (i > 0) {
|
|
4554
|
-
if (t === "polygon" && r.length >= 3) return
|
|
4572
|
+
if (t === "polygon" && r.length >= 3) return Fn({
|
|
4555
4573
|
points: r,
|
|
4556
4574
|
rounding: i,
|
|
4557
4575
|
closed: !0
|
|
4558
4576
|
});
|
|
4559
|
-
if (t === "polyline" && r.length >= 2) return
|
|
4577
|
+
if (t === "polyline" && r.length >= 2) return Fn({
|
|
4560
4578
|
points: r,
|
|
4561
4579
|
rounding: i,
|
|
4562
4580
|
closed: !1
|
|
@@ -4569,7 +4587,7 @@ function Rn({ points: e, type: t, rounding: n }) {
|
|
|
4569
4587
|
top: 0
|
|
4570
4588
|
});
|
|
4571
4589
|
}
|
|
4572
|
-
async function
|
|
4590
|
+
async function Vn({ svg: e }) {
|
|
4573
4591
|
let t = await S(e), n = w.groupSVGElements(t.objects, t.options);
|
|
4574
4592
|
return n.set({
|
|
4575
4593
|
originX: "center",
|
|
@@ -4578,7 +4596,7 @@ async function zn({ svg: e }) {
|
|
|
4578
4596
|
top: 0
|
|
4579
4597
|
}), n.setCoords(), n;
|
|
4580
4598
|
}
|
|
4581
|
-
async function
|
|
4599
|
+
async function Hn({ preset: e, rounding: t }) {
|
|
4582
4600
|
switch (e.type) {
|
|
4583
4601
|
case "rect": return new _({
|
|
4584
4602
|
width: 100,
|
|
@@ -4596,22 +4614,22 @@ async function Bn({ preset: e, rounding: t }) {
|
|
|
4596
4614
|
left: 0,
|
|
4597
4615
|
top: 0
|
|
4598
4616
|
});
|
|
4599
|
-
case "triangle": return
|
|
4600
|
-
case "polygon": return
|
|
4617
|
+
case "triangle": return In({ rounding: t });
|
|
4618
|
+
case "polygon": return Bn({
|
|
4601
4619
|
points: e.points,
|
|
4602
4620
|
type: "polygon",
|
|
4603
4621
|
rounding: t
|
|
4604
4622
|
});
|
|
4605
|
-
case "polyline": return
|
|
4623
|
+
case "polyline": return Bn({
|
|
4606
4624
|
points: e.points,
|
|
4607
4625
|
type: "polyline",
|
|
4608
4626
|
rounding: t
|
|
4609
4627
|
});
|
|
4610
|
-
case "path": return
|
|
4628
|
+
case "path": return zn({
|
|
4611
4629
|
path: e.path,
|
|
4612
4630
|
rounding: t
|
|
4613
4631
|
});
|
|
4614
|
-
case "svg": return
|
|
4632
|
+
case "svg": return Vn({ svg: e.svg });
|
|
4615
4633
|
default: return new _({
|
|
4616
4634
|
width: 100,
|
|
4617
4635
|
height: 100,
|
|
@@ -4622,15 +4640,15 @@ async function Bn({ preset: e, rounding: t }) {
|
|
|
4622
4640
|
});
|
|
4623
4641
|
}
|
|
4624
4642
|
}
|
|
4625
|
-
async function
|
|
4626
|
-
let a = await
|
|
4643
|
+
async function Un({ preset: e, width: t, height: n, style: r, rounding: i }) {
|
|
4644
|
+
let a = await Hn({
|
|
4627
4645
|
preset: e,
|
|
4628
4646
|
rounding: i
|
|
4629
4647
|
});
|
|
4630
|
-
return
|
|
4648
|
+
return jn({
|
|
4631
4649
|
shape: a,
|
|
4632
4650
|
style: r
|
|
4633
|
-
}),
|
|
4651
|
+
}), kn({
|
|
4634
4652
|
shape: a,
|
|
4635
4653
|
width: t,
|
|
4636
4654
|
height: n,
|
|
@@ -4647,30 +4665,30 @@ async function Vn({ preset: e, width: t, height: n, style: r, rounding: i }) {
|
|
|
4647
4665
|
}
|
|
4648
4666
|
//#endregion
|
|
4649
4667
|
//#region src/editor/shape-manager/domain/shape-style.ts
|
|
4650
|
-
var
|
|
4651
|
-
function
|
|
4668
|
+
var Wn = "#B4B7BD", Gn = 0, Kn = 1;
|
|
4669
|
+
function qn({ options: e, fallback: t }) {
|
|
4652
4670
|
let { fill: n, stroke: r, strokeWidth: i, strokeDashArray: a, opacity: o } = e, s = a === void 0 ? t?.shapeStrokeDashArray : a;
|
|
4653
4671
|
return {
|
|
4654
|
-
fill: n ?? t?.shapeFill ??
|
|
4672
|
+
fill: n ?? t?.shapeFill ?? Wn,
|
|
4655
4673
|
stroke: r ?? t?.shapeStroke ?? null,
|
|
4656
|
-
strokeWidth: i ?? t?.shapeStrokeWidth ??
|
|
4674
|
+
strokeWidth: i ?? t?.shapeStrokeWidth ?? Gn,
|
|
4657
4675
|
strokeDashArray: s ?? null,
|
|
4658
|
-
opacity: o ?? t?.shapeOpacity ??
|
|
4676
|
+
opacity: o ?? t?.shapeOpacity ?? Kn
|
|
4659
4677
|
};
|
|
4660
4678
|
}
|
|
4661
4679
|
//#endregion
|
|
4662
4680
|
//#region src/editor/shape-manager/layout/shape-layout-padding.ts
|
|
4663
|
-
var
|
|
4664
|
-
function
|
|
4681
|
+
var Jn = .5, Yn = 12;
|
|
4682
|
+
function Xn({ width: e, padding: t }) {
|
|
4665
4683
|
let n = Math.max(0, t.left), r = Math.max(0, t.right);
|
|
4666
4684
|
return Math.max(1, e - n - r);
|
|
4667
4685
|
}
|
|
4668
|
-
function
|
|
4686
|
+
function Zn({ text: e }) {
|
|
4669
4687
|
return (e.text ?? "").trim().length > 0;
|
|
4670
4688
|
}
|
|
4671
|
-
function
|
|
4689
|
+
function Qn({ start: e, end: t, maxTotalPadding: n, startChanged: r, endChanged: i }) {
|
|
4672
4690
|
let a = Math.max(0, e), o = Math.max(0, t), s = Math.max(0, n);
|
|
4673
|
-
if (a + o <= s +
|
|
4691
|
+
if (a + o <= s + Jn) return {
|
|
4674
4692
|
start: a,
|
|
4675
4693
|
end: o
|
|
4676
4694
|
};
|
|
@@ -4699,8 +4717,8 @@ function Xn({ start: e, end: t, maxTotalPadding: n, startChanged: r, endChanged:
|
|
|
4699
4717
|
end: o * l
|
|
4700
4718
|
};
|
|
4701
4719
|
}
|
|
4702
|
-
function
|
|
4703
|
-
let s = Math.max(0, n), c = Math.max(0, r), l = Math.max(0, i - s - c), u =
|
|
4720
|
+
function $n({ start: e, end: t, insetStart: n, insetEnd: r, maxTotalPadding: i, startChanged: a, endChanged: o }) {
|
|
4721
|
+
let s = Math.max(0, n), c = Math.max(0, r), l = Math.max(0, i - s - c), u = Qn({
|
|
4704
4722
|
start: Math.max(0, e),
|
|
4705
4723
|
end: Math.max(0, t),
|
|
4706
4724
|
maxTotalPadding: l,
|
|
@@ -4714,23 +4732,23 @@ function Zn({ start: e, end: t, insetStart: n, insetEnd: r, maxTotalPadding: i,
|
|
|
4714
4732
|
appliedUserPaddingEnd: f
|
|
4715
4733
|
};
|
|
4716
4734
|
}
|
|
4717
|
-
function
|
|
4735
|
+
function er({ text: e, minFrameWidth: t, maxFrameWidth: n, frameHeight: r, measureTextboxHeightForFrame: i }) {
|
|
4718
4736
|
let a = Math.max(1, t), o = Math.max(a, n), s = Math.max(1, r);
|
|
4719
|
-
if (!
|
|
4737
|
+
if (!Zn({ text: e }) || i({
|
|
4720
4738
|
text: e,
|
|
4721
4739
|
frameWidth: a
|
|
4722
|
-
}) <= s +
|
|
4740
|
+
}) <= s + Jn) return a;
|
|
4723
4741
|
if (i({
|
|
4724
4742
|
text: e,
|
|
4725
4743
|
frameWidth: o
|
|
4726
|
-
}) > s +
|
|
4744
|
+
}) > s + Jn) return o;
|
|
4727
4745
|
let c = a, l = o;
|
|
4728
|
-
for (let t = 0; t <
|
|
4746
|
+
for (let t = 0; t < Yn; t += 1) {
|
|
4729
4747
|
let t = (c + l) / 2;
|
|
4730
4748
|
if (i({
|
|
4731
4749
|
text: e,
|
|
4732
4750
|
frameWidth: t
|
|
4733
|
-
}) <= s +
|
|
4751
|
+
}) <= s + Jn) {
|
|
4734
4752
|
l = t;
|
|
4735
4753
|
continue;
|
|
4736
4754
|
}
|
|
@@ -4738,16 +4756,16 @@ function Qn({ text: e, minFrameWidth: t, maxFrameWidth: n, frameHeight: r, measu
|
|
|
4738
4756
|
}
|
|
4739
4757
|
return l;
|
|
4740
4758
|
}
|
|
4741
|
-
function
|
|
4742
|
-
let l = Math.max(1, t), u = Math.max(1, n), d =
|
|
4743
|
-
a || (f =
|
|
4759
|
+
function tr({ text: e, width: t, availableTextFrameHeight: n, padding: r, internalShapeTextInset: i, expandShapeHeightToFitText: a, changedPadding: o, measureTextboxHeightForFrame: s, resolveMinimumTextFrameWidth: c }) {
|
|
4760
|
+
let l = Math.max(1, t), u = Math.max(1, n), d = Zn({ text: e }) ? c({ text: e }) : 1, f = d;
|
|
4761
|
+
a || (f = er({
|
|
4744
4762
|
text: e,
|
|
4745
4763
|
minFrameWidth: d,
|
|
4746
4764
|
maxFrameWidth: l,
|
|
4747
4765
|
frameHeight: u,
|
|
4748
4766
|
measureTextboxHeightForFrame: s
|
|
4749
4767
|
}));
|
|
4750
|
-
let p = f + i.left + i.right, m = Math.max(0, l - f), h =
|
|
4768
|
+
let p = f + i.left + i.right, m = Math.max(0, l - f), h = $n({
|
|
4751
4769
|
start: r.left,
|
|
4752
4770
|
end: r.right,
|
|
4753
4771
|
insetStart: i.left,
|
|
@@ -4768,8 +4786,8 @@ function $n({ text: e, width: t, availableTextFrameHeight: n, padding: r, intern
|
|
|
4768
4786
|
requiredWidth: p
|
|
4769
4787
|
};
|
|
4770
4788
|
}
|
|
4771
|
-
function
|
|
4772
|
-
let a = Math.max(0, Math.max(1, n) - Math.max(1, r)), o =
|
|
4789
|
+
function nr({ padding: e, internalShapeTextInset: t, height: n, textHeight: r, changedPadding: i }) {
|
|
4790
|
+
let a = Math.max(0, Math.max(1, n) - Math.max(1, r)), o = $n({
|
|
4773
4791
|
start: e.top,
|
|
4774
4792
|
end: e.bottom,
|
|
4775
4793
|
insetStart: t.top,
|
|
@@ -4789,8 +4807,8 @@ function er({ padding: e, internalShapeTextInset: t, height: n, textHeight: r, c
|
|
|
4789
4807
|
}
|
|
4790
4808
|
};
|
|
4791
4809
|
}
|
|
4792
|
-
function
|
|
4793
|
-
let l = Math.max(1, t), u = Math.max(1, n), d = V({ padding: r }), f = V({ padding: i }), p = !!o?.left || !!o?.right, m = !!o?.top || !!o?.bottom, h = !a && p && !m, g = f.top + f.bottom, _ = g + (h ? d.top + d.bottom : 0), v =
|
|
4810
|
+
function rr({ text: e, width: t, height: n, padding: r, internalShapeTextInset: i, expandShapeHeightToFitText: a, changedPadding: o, measureTextboxHeightForFrame: s, resolveMinimumTextFrameWidth: c }) {
|
|
4811
|
+
let l = Math.max(1, t), u = Math.max(1, n), d = V({ padding: r }), f = V({ padding: i }), p = !!o?.left || !!o?.right, m = !!o?.top || !!o?.bottom, h = !a && p && !m, g = f.top + f.bottom, _ = g + (h ? d.top + d.bottom : 0), v = tr({
|
|
4794
4812
|
text: e,
|
|
4795
4813
|
width: l,
|
|
4796
4814
|
availableTextFrameHeight: Math.max(1, u - _),
|
|
@@ -4800,7 +4818,7 @@ function tr({ text: e, width: t, height: n, padding: r, internalShapeTextInset:
|
|
|
4800
4818
|
changedPadding: o,
|
|
4801
4819
|
measureTextboxHeightForFrame: s,
|
|
4802
4820
|
resolveMinimumTextFrameWidth: c
|
|
4803
|
-
}), y =
|
|
4821
|
+
}), y = Xn({
|
|
4804
4822
|
width: l,
|
|
4805
4823
|
padding: {
|
|
4806
4824
|
top: 0,
|
|
@@ -4808,10 +4826,10 @@ function tr({ text: e, width: t, height: n, padding: r, internalShapeTextInset:
|
|
|
4808
4826
|
bottom: 0,
|
|
4809
4827
|
left: v.appliedPadding.left
|
|
4810
4828
|
}
|
|
4811
|
-
}), b =
|
|
4829
|
+
}), b = Zn({ text: e }) ? s({
|
|
4812
4830
|
text: e,
|
|
4813
4831
|
frameWidth: y
|
|
4814
|
-
}) : 1, x = d.top + d.bottom, S = a ? Math.max(u, b + g + x) : u, C =
|
|
4832
|
+
}) : 1, x = d.top + d.bottom, S = a ? Math.max(u, b + g + x) : u, C = nr({
|
|
4815
4833
|
padding: d,
|
|
4816
4834
|
internalShapeTextInset: f,
|
|
4817
4835
|
height: S,
|
|
@@ -4837,14 +4855,14 @@ function tr({ text: e, width: t, height: n, padding: r, internalShapeTextInset:
|
|
|
4837
4855
|
}
|
|
4838
4856
|
//#endregion
|
|
4839
4857
|
//#region src/editor/shape-manager/layout/shape-text-measurement.ts
|
|
4840
|
-
var
|
|
4841
|
-
function
|
|
4842
|
-
let a = Math.max(
|
|
4858
|
+
var ir = 1, ar = .5, or = 1e6;
|
|
4859
|
+
function sr({ text: e, frameWidth: t, splitByGrapheme: n, requiresGraphemeSplit: r, measurementCache: i }) {
|
|
4860
|
+
let a = Math.max(ir, t), o = Cr({
|
|
4843
4861
|
frameWidth: a,
|
|
4844
4862
|
splitByGrapheme: n
|
|
4845
4863
|
}), s = i?.measurementsByKey.get(o);
|
|
4846
4864
|
if (s) return s;
|
|
4847
|
-
let c =
|
|
4865
|
+
let c = yr({ text: e }), l = r ?? fr({
|
|
4848
4866
|
text: e,
|
|
4849
4867
|
frameWidth: a,
|
|
4850
4868
|
measurementCache: i
|
|
@@ -4856,24 +4874,24 @@ function ar({ text: e, frameWidth: t, splitByGrapheme: n, requiresGraphemeSplit:
|
|
|
4856
4874
|
scaleX: 1,
|
|
4857
4875
|
scaleY: 1
|
|
4858
4876
|
}), e.initDimensions();
|
|
4859
|
-
let u =
|
|
4860
|
-
measuredHeight:
|
|
4877
|
+
let u = _r({ text: e }), d = gr({ text: e }), f = {
|
|
4878
|
+
measuredHeight: mr({ text: e }),
|
|
4861
4879
|
renderedLineCount: u > 0 ? u : d,
|
|
4862
|
-
longestLineWidth: Math.ceil(
|
|
4880
|
+
longestLineWidth: Math.ceil(hr({ text: e })),
|
|
4863
4881
|
requiresGraphemeSplit: l
|
|
4864
4882
|
};
|
|
4865
|
-
return
|
|
4883
|
+
return br({
|
|
4866
4884
|
text: e,
|
|
4867
4885
|
state: c
|
|
4868
4886
|
}), i?.measurementsByKey.set(o, f), f;
|
|
4869
4887
|
}
|
|
4870
|
-
function
|
|
4871
|
-
let i =
|
|
4888
|
+
function cr({ text: e, frameWidth: t, wrapPolicy: n, measurementCache: r }) {
|
|
4889
|
+
let i = gr({ text: e }), a = fr({
|
|
4872
4890
|
text: e,
|
|
4873
4891
|
frameWidth: t,
|
|
4874
4892
|
wrapPolicy: n,
|
|
4875
4893
|
measurementCache: r
|
|
4876
|
-
}), o =
|
|
4894
|
+
}), o = sr({
|
|
4877
4895
|
text: e,
|
|
4878
4896
|
frameWidth: t,
|
|
4879
4897
|
splitByGrapheme: a,
|
|
@@ -4885,14 +4903,14 @@ function or({ text: e, frameWidth: t, wrapPolicy: n, measurementCache: r }) {
|
|
|
4885
4903
|
longestLineWidth: o.longestLineWidth
|
|
4886
4904
|
};
|
|
4887
4905
|
}
|
|
4888
|
-
function
|
|
4889
|
-
let a = n ??
|
|
4906
|
+
function lr({ text: e, frameWidth: t, splitByGrapheme: n, wrapPolicy: r, measurementCache: i }) {
|
|
4907
|
+
let a = n ?? fr({
|
|
4890
4908
|
text: e,
|
|
4891
4909
|
frameWidth: t,
|
|
4892
4910
|
wrapPolicy: r,
|
|
4893
4911
|
measurementCache: i
|
|
4894
4912
|
});
|
|
4895
|
-
return
|
|
4913
|
+
return sr({
|
|
4896
4914
|
text: e,
|
|
4897
4915
|
frameWidth: t,
|
|
4898
4916
|
splitByGrapheme: a,
|
|
@@ -4900,25 +4918,25 @@ function sr({ text: e, frameWidth: t, splitByGrapheme: n, wrapPolicy: r, measure
|
|
|
4900
4918
|
measurementCache: i
|
|
4901
4919
|
}).measuredHeight;
|
|
4902
4920
|
}
|
|
4903
|
-
function
|
|
4921
|
+
function ur({ text: e, measurementCache: t }) {
|
|
4904
4922
|
if (t?.minimumTextFrameWidth !== null && t?.minimumTextFrameWidth !== void 0) return t.minimumTextFrameWidth;
|
|
4905
|
-
let n =
|
|
4923
|
+
let n = pr({
|
|
4906
4924
|
text: e,
|
|
4907
|
-
frameWidth:
|
|
4925
|
+
frameWidth: ir,
|
|
4908
4926
|
splitByGrapheme: !0,
|
|
4909
4927
|
measurementCache: t
|
|
4910
|
-
}), r = Math.max(
|
|
4928
|
+
}), r = Math.max(ir, n);
|
|
4911
4929
|
return t && (t.minimumTextFrameWidth = r), r;
|
|
4912
4930
|
}
|
|
4913
|
-
function
|
|
4931
|
+
function dr({ alignV: e, frameHeight: t, frameTop: n, textHeight: r }) {
|
|
4914
4932
|
let i = Math.max(0, t - r);
|
|
4915
4933
|
return e === "top" ? n : e === "bottom" ? n + i : n + i / 2;
|
|
4916
4934
|
}
|
|
4917
|
-
function
|
|
4935
|
+
function fr({ text: e, frameWidth: t, wrapPolicy: n, measurementCache: r }) {
|
|
4918
4936
|
if (n === "words-only") return !1;
|
|
4919
|
-
let i = Math.max(
|
|
4937
|
+
let i = Math.max(ir, t), a = Sr({ frameWidth: i }), o = r?.splitByGraphemeByFrameWidth.get(a);
|
|
4920
4938
|
if (typeof o == "boolean") return o;
|
|
4921
|
-
let s =
|
|
4939
|
+
let s = yr({ text: e });
|
|
4922
4940
|
e.set({
|
|
4923
4941
|
autoExpand: !1,
|
|
4924
4942
|
width: i,
|
|
@@ -4926,70 +4944,70 @@ function ur({ text: e, frameWidth: t, wrapPolicy: n, measurementCache: r }) {
|
|
|
4926
4944
|
scaleX: 1,
|
|
4927
4945
|
scaleY: 1
|
|
4928
4946
|
}), e.initDimensions();
|
|
4929
|
-
let c =
|
|
4930
|
-
return
|
|
4947
|
+
let c = xr({ text: e }) > i + ar;
|
|
4948
|
+
return br({
|
|
4931
4949
|
text: e,
|
|
4932
4950
|
state: s
|
|
4933
4951
|
}), r?.splitByGraphemeByFrameWidth.set(a, c), c;
|
|
4934
4952
|
}
|
|
4935
|
-
function
|
|
4936
|
-
let i = r?.measurementsByKey.get(
|
|
4953
|
+
function pr({ text: e, frameWidth: t, splitByGrapheme: n, measurementCache: r }) {
|
|
4954
|
+
let i = r?.measurementsByKey.get(Cr({
|
|
4937
4955
|
frameWidth: t,
|
|
4938
4956
|
splitByGrapheme: n
|
|
4939
4957
|
}));
|
|
4940
4958
|
if (i) return i.longestLineWidth;
|
|
4941
|
-
let a =
|
|
4959
|
+
let a = yr({ text: e });
|
|
4942
4960
|
e.set({
|
|
4943
4961
|
autoExpand: !1,
|
|
4944
|
-
width: Math.max(
|
|
4962
|
+
width: Math.max(ir, t),
|
|
4945
4963
|
splitByGrapheme: n,
|
|
4946
4964
|
scaleX: 1,
|
|
4947
4965
|
scaleY: 1
|
|
4948
4966
|
}), e.initDimensions();
|
|
4949
|
-
let o =
|
|
4950
|
-
return
|
|
4967
|
+
let o = hr({ text: e });
|
|
4968
|
+
return br({
|
|
4951
4969
|
text: e,
|
|
4952
4970
|
state: a
|
|
4953
4971
|
}), o;
|
|
4954
4972
|
}
|
|
4955
|
-
function
|
|
4973
|
+
function mr({ text: e }) {
|
|
4956
4974
|
let { height: t } = e;
|
|
4957
4975
|
if (typeof t == "number" && Number.isFinite(t)) return t;
|
|
4958
4976
|
if (typeof e.calcTextHeight == "function") {
|
|
4959
4977
|
let t = e.calcTextHeight();
|
|
4960
4978
|
if (typeof t == "number" && Number.isFinite(t)) return t;
|
|
4961
4979
|
}
|
|
4962
|
-
return
|
|
4980
|
+
return ir;
|
|
4963
4981
|
}
|
|
4964
|
-
function
|
|
4965
|
-
let t =
|
|
4966
|
-
if (t > 0) return
|
|
4982
|
+
function hr({ text: e }) {
|
|
4983
|
+
let t = _r({ text: e });
|
|
4984
|
+
if (t > 0) return vr({
|
|
4967
4985
|
text: e,
|
|
4968
4986
|
lineCount: t
|
|
4969
4987
|
});
|
|
4970
4988
|
let n = e.text ?? "";
|
|
4971
|
-
return
|
|
4989
|
+
return vr({
|
|
4972
4990
|
text: e,
|
|
4973
4991
|
lineCount: Math.max(n.split("\n").length, 1)
|
|
4974
4992
|
});
|
|
4975
4993
|
}
|
|
4976
|
-
function
|
|
4994
|
+
function gr({ text: e }) {
|
|
4977
4995
|
let t = e.text ?? "";
|
|
4978
4996
|
return Math.max(t.split("\n").length, 1);
|
|
4979
4997
|
}
|
|
4980
|
-
function
|
|
4998
|
+
function _r({ text: e }) {
|
|
4981
4999
|
let t = e;
|
|
4982
5000
|
return Array.isArray(t.textLines) ? t.textLines.length : 0;
|
|
4983
5001
|
}
|
|
4984
|
-
function
|
|
4985
|
-
let n =
|
|
5002
|
+
function vr({ text: e, lineCount: t }) {
|
|
5003
|
+
let n = ir;
|
|
4986
5004
|
for (let r = 0; r < t; r += 1) {
|
|
4987
5005
|
let t = e.getLineWidth(r);
|
|
4988
5006
|
t > n && (n = t);
|
|
4989
5007
|
}
|
|
4990
5008
|
return n;
|
|
4991
5009
|
}
|
|
4992
|
-
function
|
|
5010
|
+
function yr({ text: e }) {
|
|
4993
5011
|
let { autoExpand: t, splitByGrapheme: n, width: r, scaleX: i, scaleY: a } = e;
|
|
4994
5012
|
return {
|
|
4995
5013
|
autoExpand: t,
|
|
@@ -4999,25 +5017,25 @@ function _r({ text: e }) {
|
|
|
4999
5017
|
scaleY: typeof a == "number" ? a : void 0
|
|
5000
5018
|
};
|
|
5001
5019
|
}
|
|
5002
|
-
function
|
|
5020
|
+
function br({ text: e, state: t }) {
|
|
5003
5021
|
let { autoExpand: n, splitByGrapheme: r, width: i, scaleX: a, scaleY: o } = t, s = {};
|
|
5004
5022
|
n !== void 0 && (s.autoExpand = n), r !== void 0 && (s.splitByGrapheme = r), typeof i == "number" && (s.width = i), typeof a == "number" && (s.scaleX = a), typeof o == "number" && (s.scaleY = o), Object.keys(s).length > 0 && (e.set(s), e.initDimensions());
|
|
5005
5023
|
}
|
|
5006
|
-
function
|
|
5024
|
+
function xr({ text: e }) {
|
|
5007
5025
|
let { dynamicMinWidth: t } = e;
|
|
5008
5026
|
return typeof t == "number" && Number.isFinite(t) ? t : 0;
|
|
5009
5027
|
}
|
|
5010
|
-
function
|
|
5011
|
-
return String(Math.round(Math.max(
|
|
5028
|
+
function Sr({ frameWidth: e }) {
|
|
5029
|
+
return String(Math.round(Math.max(ir, e) * or) / or);
|
|
5012
5030
|
}
|
|
5013
|
-
function
|
|
5014
|
-
return `${
|
|
5031
|
+
function Cr({ frameWidth: e, splitByGrapheme: t }) {
|
|
5032
|
+
return `${Sr({ frameWidth: e })}:${t ? 1 : 0}`;
|
|
5015
5033
|
}
|
|
5016
5034
|
//#endregion
|
|
5017
5035
|
//#region src/editor/shape-manager/layout/shape-layout.ts
|
|
5018
|
-
var q = 1, J = .5,
|
|
5019
|
-
function
|
|
5020
|
-
let { frame: s, splitByGrapheme: c, textTop: l } =
|
|
5036
|
+
var q = 1, J = .5, wr = 24, Tr = 20, Er = 16;
|
|
5037
|
+
function Dr({ text: e, alignV: t, width: n, height: r, appliedPadding: i, appliedUserPadding: a, wrapPolicy: o }) {
|
|
5038
|
+
let { frame: s, splitByGrapheme: c, textTop: l } = Ir({
|
|
5021
5039
|
text: e,
|
|
5022
5040
|
width: n,
|
|
5023
5041
|
height: r,
|
|
@@ -5036,8 +5054,8 @@ function Tr({ text: e, alignV: t, width: n, height: r, appliedPadding: i, applie
|
|
|
5036
5054
|
wrapPolicy: o
|
|
5037
5055
|
};
|
|
5038
5056
|
}
|
|
5039
|
-
var
|
|
5040
|
-
let { width: p, height: m, appliedPadding: h, appliedUserPadding: g } = c ?
|
|
5057
|
+
var Or = ({ text: e, width: t, height: n, alignV: r, padding: i, wrapPolicy: a, internalShapeTextInset: o, resolveInternalShapeTextInset: s, preserveAspectRatio: c, shapeTextAutoExpandEnabled: l, montageAreaWidth: u, expandShapeHeightToFitText: d = !0, changedPadding: f }) => {
|
|
5058
|
+
let { width: p, height: m, appliedPadding: h, appliedUserPadding: g } = c ? Nr({
|
|
5041
5059
|
text: e,
|
|
5042
5060
|
width: t,
|
|
5043
5061
|
height: n,
|
|
@@ -5049,7 +5067,7 @@ var Er = ({ text: e, width: t, height: n, alignV: r, padding: i, wrapPolicy: a,
|
|
|
5049
5067
|
montageAreaWidth: u,
|
|
5050
5068
|
expandShapeHeightToFitText: d,
|
|
5051
5069
|
changedPadding: f
|
|
5052
|
-
}) :
|
|
5070
|
+
}) : Hr({
|
|
5053
5071
|
text: e,
|
|
5054
5072
|
width: t,
|
|
5055
5073
|
height: n,
|
|
@@ -5060,7 +5078,7 @@ var Er = ({ text: e, width: t, height: n, alignV: r, padding: i, wrapPolicy: a,
|
|
|
5060
5078
|
expandShapeHeightToFitText: d,
|
|
5061
5079
|
changedPadding: f
|
|
5062
5080
|
});
|
|
5063
|
-
return
|
|
5081
|
+
return Dr({
|
|
5064
5082
|
text: e,
|
|
5065
5083
|
alignV: r,
|
|
5066
5084
|
width: p,
|
|
@@ -5069,18 +5087,18 @@ var Er = ({ text: e, width: t, height: n, alignV: r, padding: i, wrapPolicy: a,
|
|
|
5069
5087
|
appliedUserPadding: g,
|
|
5070
5088
|
wrapPolicy: a
|
|
5071
5089
|
});
|
|
5072
|
-
},
|
|
5073
|
-
let d = Ne({ padding: i }), f = V({ padding: o }), p = Math.max(q, t), m = Math.max(q, n), h = ({ text: e, frameWidth: t }) =>
|
|
5090
|
+
}, kr = ({ text: e, width: t, height: n, alignV: r, padding: i, wrapPolicy: a, internalShapeTextInset: o, resolveInternalShapeTextInset: s, expandShapeHeightToFitText: c = !0, changedPadding: l, measurementCache: u }) => {
|
|
5091
|
+
let d = Ne({ padding: i }), f = V({ padding: o }), p = Math.max(q, t), m = Math.max(q, n), h = ({ text: e, frameWidth: t }) => lr({
|
|
5074
5092
|
text: e,
|
|
5075
5093
|
frameWidth: t,
|
|
5076
5094
|
wrapPolicy: a,
|
|
5077
5095
|
measurementCache: u
|
|
5078
|
-
}), g =
|
|
5096
|
+
}), g = rr({
|
|
5079
5097
|
text: e,
|
|
5080
5098
|
width: p,
|
|
5081
5099
|
height: m,
|
|
5082
5100
|
padding: d,
|
|
5083
|
-
internalShapeTextInset:
|
|
5101
|
+
internalShapeTextInset: Vr({
|
|
5084
5102
|
width: p,
|
|
5085
5103
|
height: m,
|
|
5086
5104
|
internalShapeTextInset: f,
|
|
@@ -5089,20 +5107,20 @@ var Er = ({ text: e, width: t, height: n, alignV: r, padding: i, wrapPolicy: a,
|
|
|
5089
5107
|
expandShapeHeightToFitText: c,
|
|
5090
5108
|
changedPadding: l,
|
|
5091
5109
|
measureTextboxHeightForFrame: h,
|
|
5092
|
-
resolveMinimumTextFrameWidth: ({ text: e }) =>
|
|
5110
|
+
resolveMinimumTextFrameWidth: ({ text: e }) => ur({
|
|
5093
5111
|
text: e,
|
|
5094
5112
|
measurementCache: u
|
|
5095
5113
|
})
|
|
5096
5114
|
});
|
|
5097
|
-
for (let t = 0; t <
|
|
5115
|
+
for (let t = 0; t < wr; t += 1) {
|
|
5098
5116
|
let t = Math.max(m, g.requiredHeight);
|
|
5099
5117
|
if (t <= m + J) break;
|
|
5100
|
-
m = t, g =
|
|
5118
|
+
m = t, g = rr({
|
|
5101
5119
|
text: e,
|
|
5102
5120
|
width: p,
|
|
5103
5121
|
height: m,
|
|
5104
5122
|
padding: d,
|
|
5105
|
-
internalShapeTextInset:
|
|
5123
|
+
internalShapeTextInset: Vr({
|
|
5106
5124
|
width: p,
|
|
5107
5125
|
height: m,
|
|
5108
5126
|
internalShapeTextInset: f,
|
|
@@ -5111,13 +5129,13 @@ var Er = ({ text: e, width: t, height: n, alignV: r, padding: i, wrapPolicy: a,
|
|
|
5111
5129
|
expandShapeHeightToFitText: c,
|
|
5112
5130
|
changedPadding: l,
|
|
5113
5131
|
measureTextboxHeightForFrame: h,
|
|
5114
|
-
resolveMinimumTextFrameWidth: ({ text: e }) =>
|
|
5132
|
+
resolveMinimumTextFrameWidth: ({ text: e }) => ur({
|
|
5115
5133
|
text: e,
|
|
5116
5134
|
measurementCache: u
|
|
5117
5135
|
})
|
|
5118
5136
|
});
|
|
5119
5137
|
}
|
|
5120
|
-
return
|
|
5138
|
+
return Dr({
|
|
5121
5139
|
text: e,
|
|
5122
5140
|
alignV: r,
|
|
5123
5141
|
width: p,
|
|
@@ -5127,9 +5145,9 @@ var Er = ({ text: e, width: t, height: n, alignV: r, padding: i, wrapPolicy: a,
|
|
|
5127
5145
|
wrapPolicy: a
|
|
5128
5146
|
});
|
|
5129
5147
|
};
|
|
5130
|
-
function
|
|
5148
|
+
function Ar({ group: e, shape: t, text: n, alignH: r, alignV: i, resolvedLayout: a }) {
|
|
5131
5149
|
let o = Math.max(q, e.shapeManualBaseWidth ?? a.width), s = Math.max(q, e.shapeManualBaseHeight ?? a.height), { width: c, height: l, appliedUserPadding: u, frame: d, splitByGrapheme: f, textTop: p, wrapPolicy: m } = a;
|
|
5132
|
-
|
|
5150
|
+
kn({
|
|
5133
5151
|
shape: t,
|
|
5134
5152
|
width: c,
|
|
5135
5153
|
height: l,
|
|
@@ -5158,14 +5176,14 @@ function Or({ group: e, shape: t, text: n, alignH: r, alignV: i, resolvedLayout:
|
|
|
5158
5176
|
scaleY: 1
|
|
5159
5177
|
}), e.set("dirty", !0), e.setCoords();
|
|
5160
5178
|
}
|
|
5161
|
-
var
|
|
5162
|
-
|
|
5179
|
+
var jr = ({ group: e, shape: t, text: n, width: r, height: i, alignH: a, alignV: o, padding: s, wrapPolicy: c, internalShapeTextInset: l, resolveInternalShapeTextInset: u, preserveAspectRatio: d, shapeTextAutoExpandEnabled: f, montageAreaWidth: p, expandShapeHeightToFitText: m = !0, changedPadding: h }) => {
|
|
5180
|
+
Ar({
|
|
5163
5181
|
group: e,
|
|
5164
5182
|
shape: t,
|
|
5165
5183
|
text: n,
|
|
5166
5184
|
alignH: a,
|
|
5167
5185
|
alignV: o,
|
|
5168
|
-
resolvedLayout:
|
|
5186
|
+
resolvedLayout: Or({
|
|
5169
5187
|
text: n,
|
|
5170
5188
|
width: r,
|
|
5171
5189
|
height: i,
|
|
@@ -5181,14 +5199,14 @@ var kr = ({ group: e, shape: t, text: n, width: r, height: i, alignH: a, alignV:
|
|
|
5181
5199
|
changedPadding: h
|
|
5182
5200
|
})
|
|
5183
5201
|
});
|
|
5184
|
-
},
|
|
5185
|
-
|
|
5202
|
+
}, Mr = ({ group: e, shape: t, text: n, width: r, height: i, alignH: a, alignV: o, padding: s, wrapPolicy: c, internalShapeTextInset: l, resolveInternalShapeTextInset: u, expandShapeHeightToFitText: d = !0, changedPadding: f }) => {
|
|
5203
|
+
Ar({
|
|
5186
5204
|
group: e,
|
|
5187
5205
|
shape: t,
|
|
5188
5206
|
text: n,
|
|
5189
5207
|
alignH: a,
|
|
5190
5208
|
alignV: o,
|
|
5191
|
-
resolvedLayout:
|
|
5209
|
+
resolvedLayout: kr({
|
|
5192
5210
|
text: n,
|
|
5193
5211
|
width: r,
|
|
5194
5212
|
height: i,
|
|
@@ -5202,9 +5220,9 @@ var kr = ({ group: e, shape: t, text: n, width: r, height: i, alignH: a, alignV:
|
|
|
5202
5220
|
})
|
|
5203
5221
|
});
|
|
5204
5222
|
};
|
|
5205
|
-
function
|
|
5223
|
+
function Nr({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalShapeTextInset: a, resolveInternalShapeTextInset: o, shapeTextAutoExpandEnabled: s = !0, montageAreaWidth: c, expandShapeHeightToFitText: l = !0, changedPadding: u }) {
|
|
5206
5224
|
let d = Math.max(q, t), f = Math.max(q, n), p = Number.isFinite(c) && (c ?? 0) > 0 ? Math.max(q, c ?? q) : null;
|
|
5207
|
-
if (!
|
|
5225
|
+
if (!Rr({ text: e })) return Hr({
|
|
5208
5226
|
text: e,
|
|
5209
5227
|
width: d,
|
|
5210
5228
|
height: f,
|
|
@@ -5216,7 +5234,7 @@ function jr({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalS
|
|
|
5216
5234
|
changedPadding: u
|
|
5217
5235
|
});
|
|
5218
5236
|
let m = f / d, h = ({ width: t }) => {
|
|
5219
|
-
let n = Math.max(q, t * m), s =
|
|
5237
|
+
let n = Math.max(q, t * m), s = Hr({
|
|
5220
5238
|
text: e,
|
|
5221
5239
|
width: t,
|
|
5222
5240
|
height: n,
|
|
@@ -5229,7 +5247,7 @@ function jr({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalS
|
|
|
5229
5247
|
});
|
|
5230
5248
|
return {
|
|
5231
5249
|
candidateHeight: n,
|
|
5232
|
-
frameWidth:
|
|
5250
|
+
frameWidth: Xn({
|
|
5233
5251
|
width: t,
|
|
5234
5252
|
padding: s.appliedPadding
|
|
5235
5253
|
}),
|
|
@@ -5245,11 +5263,11 @@ function jr({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalS
|
|
|
5245
5263
|
layoutResolution: n
|
|
5246
5264
|
});
|
|
5247
5265
|
}, t = p ? Math.max(d, p) : d;
|
|
5248
|
-
e({ width: t }) || (t =
|
|
5266
|
+
e({ width: t }) || (t = Ur({
|
|
5249
5267
|
minimumWidth: t,
|
|
5250
5268
|
isWidthValid: e
|
|
5251
5269
|
}));
|
|
5252
|
-
let { layoutResolution: n } = h({ width:
|
|
5270
|
+
let { layoutResolution: n } = h({ width: Wr({
|
|
5253
5271
|
minimumWidth: d,
|
|
5254
5272
|
maximumWidth: t,
|
|
5255
5273
|
isWidthValid: e
|
|
@@ -5262,21 +5280,21 @@ function jr({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalS
|
|
|
5262
5280
|
candidateWidth: t,
|
|
5263
5281
|
candidateHeight: r,
|
|
5264
5282
|
layoutResolution: o
|
|
5265
|
-
}) || n !== void 0 && a < n - J ? !1 : !
|
|
5283
|
+
}) || n !== void 0 && a < n - J ? !1 : !cr({
|
|
5266
5284
|
text: e,
|
|
5267
5285
|
frameWidth: a,
|
|
5268
5286
|
wrapPolicy: i
|
|
5269
5287
|
}).hasWrappedLines;
|
|
5270
|
-
}, v = p ? Math.max(d, p) :
|
|
5288
|
+
}, v = p ? Math.max(d, p) : Ur({
|
|
5271
5289
|
minimumWidth: d,
|
|
5272
5290
|
isWidthValid: ({ width: e }) => _({ width: e })
|
|
5273
|
-
}), y = h({ width: v }), b =
|
|
5291
|
+
}), y = h({ width: v }), b = cr({
|
|
5274
5292
|
text: e,
|
|
5275
5293
|
frameWidth: y.frameWidth,
|
|
5276
5294
|
wrapPolicy: i
|
|
5277
5295
|
});
|
|
5278
5296
|
if (b.hasWrappedLines) return y.layoutResolution;
|
|
5279
|
-
let x = Math.max(q, b.longestLineWidth), { layoutResolution: S } = h({ width:
|
|
5297
|
+
let x = Math.max(q, b.longestLineWidth), { layoutResolution: S } = h({ width: Wr({
|
|
5280
5298
|
minimumWidth: d,
|
|
5281
5299
|
maximumWidth: v,
|
|
5282
5300
|
isWidthValid: ({ width: e }) => _({
|
|
@@ -5286,73 +5304,73 @@ function jr({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalS
|
|
|
5286
5304
|
}) });
|
|
5287
5305
|
return S;
|
|
5288
5306
|
}
|
|
5289
|
-
var
|
|
5307
|
+
var Pr = ({ text: e, currentWidth: t, minimumWidth: n, padding: r, wrapPolicy: i, montageAreaWidth: a, resolvePaddingForWidth: o }) => {
|
|
5290
5308
|
let s = Math.max(q, t), c = Math.max(q, n);
|
|
5291
|
-
if (!
|
|
5292
|
-
let l = Math.max(c, Number.isFinite(a) && a > 0 ? Math.max(q, a) : Math.max(s, c)), u =
|
|
5309
|
+
if (!Rr({ text: e })) return c;
|
|
5310
|
+
let l = Math.max(c, Number.isFinite(a) && a > 0 ? Math.max(q, a) : Math.max(s, c)), u = Xn({
|
|
5293
5311
|
width: l,
|
|
5294
|
-
padding:
|
|
5312
|
+
padding: zr({
|
|
5295
5313
|
width: l,
|
|
5296
5314
|
padding: r,
|
|
5297
5315
|
resolvePaddingForWidth: o
|
|
5298
5316
|
})
|
|
5299
|
-
}), d = l, f =
|
|
5317
|
+
}), d = l, f = cr({
|
|
5300
5318
|
text: e,
|
|
5301
5319
|
frameWidth: u,
|
|
5302
5320
|
wrapPolicy: i
|
|
5303
5321
|
});
|
|
5304
5322
|
if (f.hasWrappedLines) return d;
|
|
5305
5323
|
let p = Math.max(q, f.longestLineWidth);
|
|
5306
|
-
return
|
|
5324
|
+
return Wr({
|
|
5307
5325
|
minimumWidth: c,
|
|
5308
5326
|
maximumWidth: d,
|
|
5309
5327
|
isWidthValid: ({ width: t }) => {
|
|
5310
|
-
let n =
|
|
5328
|
+
let n = Xn({
|
|
5311
5329
|
width: t,
|
|
5312
|
-
padding:
|
|
5330
|
+
padding: zr({
|
|
5313
5331
|
width: t,
|
|
5314
5332
|
padding: r,
|
|
5315
5333
|
resolvePaddingForWidth: o
|
|
5316
5334
|
})
|
|
5317
5335
|
});
|
|
5318
|
-
return n < p - J ? !1 : !
|
|
5336
|
+
return n < p - J ? !1 : !cr({
|
|
5319
5337
|
text: e,
|
|
5320
5338
|
frameWidth: n,
|
|
5321
5339
|
wrapPolicy: i
|
|
5322
5340
|
}).hasWrappedLines;
|
|
5323
5341
|
}
|
|
5324
5342
|
});
|
|
5325
|
-
},
|
|
5326
|
-
if (!
|
|
5327
|
-
let i =
|
|
5343
|
+
}, Fr = ({ text: e, padding: t, resolvePaddingForWidth: n, measurementCache: r }) => {
|
|
5344
|
+
if (!Rr({ text: e })) return q;
|
|
5345
|
+
let i = ur({
|
|
5328
5346
|
text: e,
|
|
5329
5347
|
measurementCache: r
|
|
5330
|
-
}), a = Math.max(q, i), o = ({ width: e }) =>
|
|
5348
|
+
}), a = Math.max(q, i), o = ({ width: e }) => Xn({
|
|
5331
5349
|
width: e,
|
|
5332
|
-
padding:
|
|
5350
|
+
padding: zr({
|
|
5333
5351
|
width: e,
|
|
5334
5352
|
padding: t,
|
|
5335
5353
|
resolvePaddingForWidth: n
|
|
5336
5354
|
})
|
|
5337
5355
|
}) >= i - J;
|
|
5338
|
-
return
|
|
5356
|
+
return Wr({
|
|
5339
5357
|
minimumWidth: a,
|
|
5340
|
-
maximumWidth:
|
|
5358
|
+
maximumWidth: Ur({
|
|
5341
5359
|
minimumWidth: a,
|
|
5342
5360
|
isWidthValid: o
|
|
5343
5361
|
}),
|
|
5344
5362
|
isWidthValid: o
|
|
5345
5363
|
});
|
|
5346
|
-
},
|
|
5347
|
-
let o =
|
|
5364
|
+
}, Ir = ({ text: e, width: t, height: n, alignV: r, wrapPolicy: i, padding: a }) => {
|
|
5365
|
+
let o = Gr({
|
|
5348
5366
|
width: Math.max(q, t),
|
|
5349
5367
|
height: Math.max(q, n),
|
|
5350
5368
|
padding: V({ padding: a })
|
|
5351
|
-
}), s =
|
|
5369
|
+
}), s = fr({
|
|
5352
5370
|
text: e,
|
|
5353
5371
|
frameWidth: o.width,
|
|
5354
5372
|
wrapPolicy: i
|
|
5355
|
-
}), c =
|
|
5373
|
+
}), c = lr({
|
|
5356
5374
|
text: e,
|
|
5357
5375
|
frameWidth: o.width,
|
|
5358
5376
|
splitByGrapheme: s,
|
|
@@ -5361,26 +5379,26 @@ var Mr = ({ text: e, currentWidth: t, minimumWidth: n, padding: r, wrapPolicy: i
|
|
|
5361
5379
|
return {
|
|
5362
5380
|
frame: o,
|
|
5363
5381
|
splitByGrapheme: s,
|
|
5364
|
-
textTop:
|
|
5382
|
+
textTop: dr({
|
|
5365
5383
|
alignV: r,
|
|
5366
5384
|
frameHeight: o.height,
|
|
5367
5385
|
frameTop: o.top,
|
|
5368
5386
|
textHeight: c
|
|
5369
5387
|
})
|
|
5370
5388
|
};
|
|
5371
|
-
},
|
|
5389
|
+
}, Lr = ({ text: e, width: t, height: n, padding: r, wrapPolicy: i, resolvePaddingForSize: a, measurementCache: o }) => {
|
|
5372
5390
|
let s = Math.max(q, n);
|
|
5373
|
-
if (!
|
|
5391
|
+
if (!Rr({ text: e })) return s;
|
|
5374
5392
|
let c = Math.max(q, t), l = s;
|
|
5375
|
-
for (let t = 0; t <
|
|
5376
|
-
let t =
|
|
5393
|
+
for (let t = 0; t < wr; t += 1) {
|
|
5394
|
+
let t = Br({
|
|
5377
5395
|
width: c,
|
|
5378
5396
|
height: l,
|
|
5379
5397
|
padding: r,
|
|
5380
5398
|
resolvePaddingForSize: a
|
|
5381
|
-
}), n =
|
|
5399
|
+
}), n = lr({
|
|
5382
5400
|
text: e,
|
|
5383
|
-
frameWidth:
|
|
5401
|
+
frameWidth: Xn({
|
|
5384
5402
|
width: c,
|
|
5385
5403
|
padding: t
|
|
5386
5404
|
}),
|
|
@@ -5392,35 +5410,35 @@ var Mr = ({ text: e, currentWidth: t, minimumWidth: n, padding: r, wrapPolicy: i
|
|
|
5392
5410
|
}
|
|
5393
5411
|
return l;
|
|
5394
5412
|
};
|
|
5395
|
-
function
|
|
5413
|
+
function Rr({ text: e }) {
|
|
5396
5414
|
return (e.text ?? "").trim().length > 0;
|
|
5397
5415
|
}
|
|
5398
|
-
function
|
|
5416
|
+
function zr({ width: e, padding: t, resolvePaddingForWidth: n }) {
|
|
5399
5417
|
return V(n ? { padding: n({ width: Math.max(q, e) }) } : { padding: t });
|
|
5400
5418
|
}
|
|
5401
|
-
function
|
|
5419
|
+
function Br({ width: e, height: t, padding: n, resolvePaddingForSize: r }) {
|
|
5402
5420
|
return V(r ? { padding: r({
|
|
5403
5421
|
width: Math.max(q, e),
|
|
5404
5422
|
height: Math.max(q, t)
|
|
5405
5423
|
}) } : { padding: n });
|
|
5406
5424
|
}
|
|
5407
|
-
function
|
|
5425
|
+
function Vr({ width: e, height: t, internalShapeTextInset: n, resolveInternalShapeTextInset: r }) {
|
|
5408
5426
|
return V(r ? { padding: r({
|
|
5409
5427
|
width: Math.max(q, e),
|
|
5410
5428
|
height: Math.max(q, t)
|
|
5411
5429
|
}) } : { padding: n });
|
|
5412
5430
|
}
|
|
5413
|
-
function
|
|
5414
|
-
let l = Ne({ padding: r }), u = V({ padding: a }), d = Math.max(q, t), f = Math.max(q, n), p = ({ text: e, frameWidth: t }) =>
|
|
5431
|
+
function Hr({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalShapeTextInset: a, resolveInternalShapeTextInset: o, expandShapeHeightToFitText: s = !0, changedPadding: c }) {
|
|
5432
|
+
let l = Ne({ padding: r }), u = V({ padding: a }), d = Math.max(q, t), f = Math.max(q, n), p = ({ text: e, frameWidth: t }) => lr({
|
|
5415
5433
|
text: e,
|
|
5416
5434
|
frameWidth: t,
|
|
5417
5435
|
wrapPolicy: i
|
|
5418
|
-
}), m =
|
|
5436
|
+
}), m = rr({
|
|
5419
5437
|
text: e,
|
|
5420
5438
|
width: d,
|
|
5421
5439
|
height: f,
|
|
5422
5440
|
padding: l,
|
|
5423
|
-
internalShapeTextInset:
|
|
5441
|
+
internalShapeTextInset: Vr({
|
|
5424
5442
|
width: d,
|
|
5425
5443
|
height: f,
|
|
5426
5444
|
internalShapeTextInset: u,
|
|
@@ -5429,17 +5447,17 @@ function Br({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalS
|
|
|
5429
5447
|
expandShapeHeightToFitText: s,
|
|
5430
5448
|
changedPadding: c,
|
|
5431
5449
|
measureTextboxHeightForFrame: p,
|
|
5432
|
-
resolveMinimumTextFrameWidth:
|
|
5450
|
+
resolveMinimumTextFrameWidth: ur
|
|
5433
5451
|
});
|
|
5434
|
-
for (let t = 0; t <
|
|
5452
|
+
for (let t = 0; t < wr; t += 1) {
|
|
5435
5453
|
let t = Math.max(d, m.requiredWidth), n = Math.max(f, m.requiredHeight);
|
|
5436
5454
|
if (t <= d + J && n <= f + J) break;
|
|
5437
|
-
d = t, f = n, m =
|
|
5455
|
+
d = t, f = n, m = rr({
|
|
5438
5456
|
text: e,
|
|
5439
5457
|
width: d,
|
|
5440
5458
|
height: f,
|
|
5441
5459
|
padding: l,
|
|
5442
|
-
internalShapeTextInset:
|
|
5460
|
+
internalShapeTextInset: Vr({
|
|
5443
5461
|
width: d,
|
|
5444
5462
|
height: f,
|
|
5445
5463
|
internalShapeTextInset: u,
|
|
@@ -5448,7 +5466,7 @@ function Br({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalS
|
|
|
5448
5466
|
expandShapeHeightToFitText: s,
|
|
5449
5467
|
changedPadding: c,
|
|
5450
5468
|
measureTextboxHeightForFrame: p,
|
|
5451
|
-
resolveMinimumTextFrameWidth:
|
|
5469
|
+
resolveMinimumTextFrameWidth: ur
|
|
5452
5470
|
});
|
|
5453
5471
|
}
|
|
5454
5472
|
return {
|
|
@@ -5458,17 +5476,17 @@ function Br({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalS
|
|
|
5458
5476
|
appliedUserPadding: m.appliedUserPadding
|
|
5459
5477
|
};
|
|
5460
5478
|
}
|
|
5461
|
-
function
|
|
5479
|
+
function Ur({ minimumWidth: e, isWidthValid: t }) {
|
|
5462
5480
|
let n = Math.max(q, e);
|
|
5463
5481
|
if (t({ width: n })) return n;
|
|
5464
|
-
for (let e = 0; e <
|
|
5482
|
+
for (let e = 0; e < Er; e += 1) if (n = Math.max(n + 1, n * 2), t({ width: n })) return n;
|
|
5465
5483
|
return n;
|
|
5466
5484
|
}
|
|
5467
|
-
function
|
|
5485
|
+
function Wr({ minimumWidth: e, maximumWidth: t, isWidthValid: n }) {
|
|
5468
5486
|
let r = Math.max(q, e), i = Math.max(r, t);
|
|
5469
5487
|
if (n({ width: r })) return r;
|
|
5470
5488
|
if (!n({ width: i })) return i;
|
|
5471
|
-
for (let e = 0; e <
|
|
5489
|
+
for (let e = 0; e < Tr && !(i - r <= J); e += 1) {
|
|
5472
5490
|
let e = r + (i - r) / 2;
|
|
5473
5491
|
if (n({ width: e })) {
|
|
5474
5492
|
i = e;
|
|
@@ -5478,7 +5496,7 @@ function Hr({ minimumWidth: e, maximumWidth: t, isWidthValid: n }) {
|
|
|
5478
5496
|
}
|
|
5479
5497
|
return i;
|
|
5480
5498
|
}
|
|
5481
|
-
function
|
|
5499
|
+
function Gr({ width: e, height: t, padding: n }) {
|
|
5482
5500
|
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);
|
|
5483
5501
|
return {
|
|
5484
5502
|
left: -e / 2 + r,
|
|
@@ -5489,12 +5507,12 @@ function Ur({ width: e, height: t, padding: n }) {
|
|
|
5489
5507
|
}
|
|
5490
5508
|
//#endregion
|
|
5491
5509
|
//#region src/editor/shape-manager/scaling/shape-scaling-transform.ts
|
|
5492
|
-
var
|
|
5510
|
+
var Kr = ({ transform: e, key: t }) => {
|
|
5493
5511
|
let n = e?.original;
|
|
5494
5512
|
if (!n || typeof n != "object") return null;
|
|
5495
5513
|
let r = n[t];
|
|
5496
5514
|
return typeof r != "number" || !Number.isFinite(r) ? null : r;
|
|
5497
|
-
},
|
|
5515
|
+
}, qr = ({ value: e }) => e === "left" || e === "center" || e === "right" || typeof e == "number" && Number.isFinite(e) ? e : null, Jr = ({ value: e }) => e === "top" || e === "center" || e === "bottom" || typeof e == "number" && Number.isFinite(e) ? e : null, Y = ({ transform: e }) => {
|
|
5498
5516
|
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;
|
|
5499
5517
|
return {
|
|
5500
5518
|
canScaleWidth: o,
|
|
@@ -5502,37 +5520,37 @@ var Wr = ({ transform: e, key: t }) => {
|
|
|
5502
5520
|
isCornerScaleAction: r,
|
|
5503
5521
|
isVerticalOnlyScale: s && !o
|
|
5504
5522
|
};
|
|
5505
|
-
},
|
|
5523
|
+
}, Yr = ({ event: e, target: t, transform: n, canvas: r }) => {
|
|
5506
5524
|
if (!e) return null;
|
|
5507
5525
|
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;
|
|
5508
5526
|
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;
|
|
5509
|
-
},
|
|
5527
|
+
}, Xr = ({ group: e, originX: t, originY: n }) => {
|
|
5510
5528
|
if (t === null || n === null) return null;
|
|
5511
5529
|
let r = e, i = typeof r.getRelativeCenterPoint == "function" ? r.getRelativeCenterPoint() : e.getCenterPoint();
|
|
5512
5530
|
return typeof r.translateToOriginPoint == "function" ? r.translateToOriginPoint(i, t, n) : i;
|
|
5513
|
-
},
|
|
5531
|
+
}, Zr = ({ state: e, transform: t }) => {
|
|
5514
5532
|
if (!t || e.startTransformOriginX === null && e.startTransformOriginY === null) return !1;
|
|
5515
|
-
let n =
|
|
5533
|
+
let n = qr({ value: t.originX }), r = Jr({ value: t.originY });
|
|
5516
5534
|
return n !== e.startTransformOriginX || r !== e.startTransformOriginY;
|
|
5517
|
-
},
|
|
5535
|
+
}, Qr = ({ state: e, transform: t }) => !t || !e.startTransformCorner ? !1 : t.corner !== e.startTransformCorner;
|
|
5518
5536
|
//#endregion
|
|
5519
5537
|
//#region src/editor/shape-manager/scaling/shape-scaling-preview.ts
|
|
5520
|
-
function
|
|
5538
|
+
function $r({ size: e, scale: t, strokeWidth: n, minSize: r, scaleEpsilon: i }) {
|
|
5521
5539
|
let a = Math.max(i, Math.abs(t) || 1), o = Math.max(0, n);
|
|
5522
5540
|
return o <= 0 ? Math.max(r, e / a) : Math.max(r, e / a + o - o / a);
|
|
5523
5541
|
}
|
|
5524
|
-
function
|
|
5542
|
+
function ei({ group: e, shape: t, width: n, height: r, scaleX: i, scaleY: a, minSize: o, scaleEpsilon: s }) {
|
|
5525
5543
|
let c = Math.max(0, e.shapeStrokeWidth ?? 0);
|
|
5526
|
-
|
|
5544
|
+
kn({
|
|
5527
5545
|
shape: t,
|
|
5528
|
-
width:
|
|
5546
|
+
width: $r({
|
|
5529
5547
|
size: n,
|
|
5530
5548
|
scale: i,
|
|
5531
5549
|
strokeWidth: c,
|
|
5532
5550
|
minSize: o,
|
|
5533
5551
|
scaleEpsilon: s
|
|
5534
5552
|
}),
|
|
5535
|
-
height:
|
|
5553
|
+
height: $r({
|
|
5536
5554
|
size: r,
|
|
5537
5555
|
scale: a,
|
|
5538
5556
|
strokeWidth: c,
|
|
@@ -5543,7 +5561,7 @@ function Qr({ group: e, shape: t, width: n, height: r, scaleX: i, scaleY: a, min
|
|
|
5543
5561
|
strokeWidth: c
|
|
5544
5562
|
});
|
|
5545
5563
|
}
|
|
5546
|
-
function
|
|
5564
|
+
function ti({ text: e, layout: t, alignH: n, scaleX: r, scaleY: i, scaleEpsilon: a }) {
|
|
5547
5565
|
let o = Math.max(a, Math.abs(r) || 1), s = Math.max(a, Math.abs(i) || 1), c = n ?? "center";
|
|
5548
5566
|
e.set({
|
|
5549
5567
|
autoExpand: !1,
|
|
@@ -5558,13 +5576,13 @@ function $r({ text: e, layout: t, alignH: n, scaleX: r, scaleY: i, scaleEpsilon:
|
|
|
5558
5576
|
scaleY: 1 / s
|
|
5559
5577
|
}), e.initDimensions(), e.setCoords();
|
|
5560
5578
|
}
|
|
5561
|
-
var
|
|
5579
|
+
var ni = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY: o, minSize: s, scaleEpsilon: c }) => {
|
|
5562
5580
|
let l = Math.max(c, Math.abs(a) || 1), u = Math.max(c, Math.abs(o) || 1);
|
|
5563
5581
|
e.set({
|
|
5564
5582
|
width: r.width / l,
|
|
5565
5583
|
height: r.height / u,
|
|
5566
5584
|
dirty: !0
|
|
5567
|
-
}),
|
|
5585
|
+
}), ei({
|
|
5568
5586
|
group: e,
|
|
5569
5587
|
shape: t,
|
|
5570
5588
|
width: r.width,
|
|
@@ -5573,7 +5591,7 @@ var ei = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
5573
5591
|
scaleY: o,
|
|
5574
5592
|
minSize: s,
|
|
5575
5593
|
scaleEpsilon: c
|
|
5576
|
-
}),
|
|
5594
|
+
}), ti({
|
|
5577
5595
|
text: n,
|
|
5578
5596
|
layout: r,
|
|
5579
5597
|
alignH: i,
|
|
@@ -5581,23 +5599,23 @@ var ei = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
5581
5599
|
scaleY: o,
|
|
5582
5600
|
scaleEpsilon: c
|
|
5583
5601
|
});
|
|
5584
|
-
}, X = 1e-4,
|
|
5585
|
-
function
|
|
5602
|
+
}, X = 1e-4, ri = .5;
|
|
5603
|
+
function ii({ isProportionalScaling: e }) {
|
|
5586
5604
|
if (e) return "words-only";
|
|
5587
5605
|
}
|
|
5588
|
-
function
|
|
5606
|
+
function ai({ width: e, height: t }) {
|
|
5589
5607
|
return `${Math.round(Math.max(1, e) * 1e6) / 1e6}:${Math.round(Math.max(1, t) * 1e6) / 1e6}`;
|
|
5590
5608
|
}
|
|
5591
|
-
function
|
|
5609
|
+
function oi({ width: e, padding: t }) {
|
|
5592
5610
|
return Math.max(1, e - Math.max(0, t.left) - Math.max(0, t.right));
|
|
5593
5611
|
}
|
|
5594
|
-
function
|
|
5612
|
+
function si({ height: e, padding: t }) {
|
|
5595
5613
|
return Math.max(1, e - Math.max(0, t.top) - Math.max(0, t.bottom));
|
|
5596
5614
|
}
|
|
5597
|
-
function
|
|
5615
|
+
function ci({ text: e }) {
|
|
5598
5616
|
return (e.text ?? "").trim().length > 0;
|
|
5599
5617
|
}
|
|
5600
|
-
function
|
|
5618
|
+
function li({ height: e }) {
|
|
5601
5619
|
return {
|
|
5602
5620
|
measuredHeight: e,
|
|
5603
5621
|
renderedLineCount: 0,
|
|
@@ -5606,7 +5624,7 @@ function si({ height: e }) {
|
|
|
5606
5624
|
isValid: !0
|
|
5607
5625
|
};
|
|
5608
5626
|
}
|
|
5609
|
-
function
|
|
5627
|
+
function ui({ group: e }) {
|
|
5610
5628
|
return Ne({ padding: {
|
|
5611
5629
|
top: e.shapePaddingTop,
|
|
5612
5630
|
right: e.shapePaddingRight,
|
|
@@ -5614,7 +5632,7 @@ function ci({ group: e }) {
|
|
|
5614
5632
|
left: e.shapePaddingLeft
|
|
5615
5633
|
} });
|
|
5616
5634
|
}
|
|
5617
|
-
function
|
|
5635
|
+
function di({ group: e, width: t, height: n }) {
|
|
5618
5636
|
let r = e.shapePresetKey ?? "", i = r ? we({ presetKey: r }) : null;
|
|
5619
5637
|
return Le({
|
|
5620
5638
|
baseInset: i ? De({
|
|
@@ -5627,33 +5645,33 @@ function li({ group: e, width: t, height: n }) {
|
|
|
5627
5645
|
});
|
|
5628
5646
|
}
|
|
5629
5647
|
function Z({ group: e, width: t, height: n }) {
|
|
5630
|
-
return
|
|
5648
|
+
return di({
|
|
5631
5649
|
group: e,
|
|
5632
5650
|
width: Math.max(1, t ?? e.shapeBaseWidth ?? e.width ?? e.shapeManualBaseWidth ?? 1),
|
|
5633
5651
|
height: Math.max(1, n ?? e.shapeBaseHeight ?? e.height ?? e.shapeManualBaseHeight ?? 1)
|
|
5634
5652
|
});
|
|
5635
5653
|
}
|
|
5636
|
-
function
|
|
5637
|
-
let o = Math.max(1, n), s = Math.max(1, r), c =
|
|
5654
|
+
function fi({ group: e, text: t, width: n, height: r, measurementCache: i, constraintCache: a }) {
|
|
5655
|
+
let o = Math.max(1, n), s = Math.max(1, r), c = ai({
|
|
5638
5656
|
width: o,
|
|
5639
5657
|
height: s
|
|
5640
5658
|
}), l = a?.get(c);
|
|
5641
5659
|
if (l) return l;
|
|
5642
|
-
if (!
|
|
5643
|
-
let e =
|
|
5660
|
+
if (!ci({ text: t })) {
|
|
5661
|
+
let e = li({ height: s });
|
|
5644
5662
|
return a?.set(c, e), e;
|
|
5645
5663
|
}
|
|
5646
5664
|
let u = Z({
|
|
5647
5665
|
group: e,
|
|
5648
5666
|
width: o,
|
|
5649
5667
|
height: s
|
|
5650
|
-
}), d =
|
|
5668
|
+
}), d = oi({
|
|
5651
5669
|
width: o,
|
|
5652
5670
|
padding: u
|
|
5653
|
-
}), f =
|
|
5671
|
+
}), f = si({
|
|
5654
5672
|
height: s,
|
|
5655
5673
|
padding: u
|
|
5656
|
-
}), p =
|
|
5674
|
+
}), p = sr({
|
|
5657
5675
|
text: t,
|
|
5658
5676
|
frameWidth: d,
|
|
5659
5677
|
splitByGrapheme: !1,
|
|
@@ -5664,9 +5682,9 @@ function ui({ group: e, text: t, width: n, height: r, measurementCache: i, const
|
|
|
5664
5682
|
};
|
|
5665
5683
|
return a?.set(c, m), m;
|
|
5666
5684
|
}
|
|
5667
|
-
function
|
|
5685
|
+
function pi({ group: e, text: t, state: n }) {
|
|
5668
5686
|
let { startHeight: r, startWidth: i, startScaleX: a, startScaleY: o, lastAllowedScaleX: s, lastAllowedScaleY: c } = n, l = Math.max(1 / i, 1 / r), u = Math.max(l, a, o, s, c), d = ({ scale: a }) => {
|
|
5669
|
-
let o =
|
|
5687
|
+
let o = fi({
|
|
5670
5688
|
group: e,
|
|
5671
5689
|
text: t,
|
|
5672
5690
|
width: Math.max(1, i * a),
|
|
@@ -5697,8 +5715,8 @@ function di({ group: e, text: t, state: n }) {
|
|
|
5697
5715
|
minimumHeight: g
|
|
5698
5716
|
};
|
|
5699
5717
|
}
|
|
5700
|
-
function
|
|
5701
|
-
return
|
|
5718
|
+
function mi({ group: e, text: t, width: n, padding: r, wrapPolicy: i, measurementCache: a }) {
|
|
5719
|
+
return Lr({
|
|
5702
5720
|
text: t,
|
|
5703
5721
|
width: n,
|
|
5704
5722
|
height: 1,
|
|
@@ -5712,8 +5730,8 @@ function fi({ group: e, text: t, width: n, padding: r, wrapPolicy: i, measuremen
|
|
|
5712
5730
|
})
|
|
5713
5731
|
});
|
|
5714
5732
|
}
|
|
5715
|
-
function
|
|
5716
|
-
let l = r.canScaleWidth ? Math.max(1, r.startWidth * i) : r.startWidth, u = r.canScaleHeight ? Math.max(1, r.startHeight * a) : r.startManualBaseHeight, d = o ??
|
|
5733
|
+
function hi({ group: e, text: t, constraintPadding: n, startDimensions: r, appliedScaleX: i, appliedScaleY: a, minimumHeight: o, wrapPolicy: s, measurementCache: c }) {
|
|
5734
|
+
let l = r.canScaleWidth ? Math.max(1, r.startWidth * i) : r.startWidth, u = r.canScaleHeight ? Math.max(1, r.startHeight * a) : r.startManualBaseHeight, d = o ?? Lr({
|
|
5717
5735
|
text: t,
|
|
5718
5736
|
width: l,
|
|
5719
5737
|
height: u,
|
|
@@ -5731,25 +5749,25 @@ function pi({ group: e, text: t, constraintPadding: n, startDimensions: r, appli
|
|
|
5731
5749
|
previewHeight: Math.max(u, d)
|
|
5732
5750
|
};
|
|
5733
5751
|
}
|
|
5734
|
-
function
|
|
5735
|
-
let o = n.canScaleWidth ? Math.max(1, n.startWidth * r) : n.startWidth, s = n.canScaleHeight ? Math.max(1, n.startHeight * i) : n.startManualBaseHeight, c = a == null ? s : Math.max(s, a), l = !n.canScaleHeight, u =
|
|
5736
|
-
return
|
|
5752
|
+
function gi({ group: e, text: t, state: n, appliedScaleX: r, appliedScaleY: i, minimumHeight: a }) {
|
|
5753
|
+
let o = n.canScaleWidth ? Math.max(1, n.startWidth * r) : n.startWidth, s = n.canScaleHeight ? Math.max(1, n.startHeight * i) : n.startManualBaseHeight, c = a == null ? s : Math.max(s, a), l = !n.canScaleHeight, u = ii({ isProportionalScaling: n.isProportionalScaling });
|
|
5754
|
+
return kr({
|
|
5737
5755
|
text: t,
|
|
5738
5756
|
width: o,
|
|
5739
5757
|
height: c,
|
|
5740
5758
|
alignV: e.shapeAlignVertical ?? "middle",
|
|
5741
|
-
padding:
|
|
5759
|
+
padding: ui({ group: e }),
|
|
5742
5760
|
wrapPolicy: u,
|
|
5743
5761
|
expandShapeHeightToFitText: l,
|
|
5744
5762
|
measurementCache: n.previewTextMeasurementCache ?? void 0,
|
|
5745
|
-
resolveInternalShapeTextInset: ({ width: t, height: n }) =>
|
|
5763
|
+
resolveInternalShapeTextInset: ({ width: t, height: n }) => di({
|
|
5746
5764
|
group: e,
|
|
5747
5765
|
width: t,
|
|
5748
5766
|
height: n
|
|
5749
5767
|
})
|
|
5750
5768
|
});
|
|
5751
5769
|
}
|
|
5752
|
-
function
|
|
5770
|
+
function _i({ group: e, transform: t }) {
|
|
5753
5771
|
let { canScaleWidth: n, canScaleHeight: r } = Y({ transform: t }), i = Math.max(1, e.shapeBaseWidth ?? e.width ?? e.shapeManualBaseWidth ?? 1), a = Math.max(1, e.shapeBaseHeight ?? e.height ?? e.shapeManualBaseHeight ?? 1);
|
|
5754
5772
|
return {
|
|
5755
5773
|
startWidth: i,
|
|
@@ -5760,25 +5778,25 @@ function hi({ group: e, transform: t }) {
|
|
|
5760
5778
|
canScaleHeight: r
|
|
5761
5779
|
};
|
|
5762
5780
|
}
|
|
5763
|
-
function
|
|
5781
|
+
function vi({ scalingState: e, group: t, text: n, constraintPadding: r, transform: i }) {
|
|
5764
5782
|
let a = e.get(t);
|
|
5765
5783
|
if (a) return a;
|
|
5766
|
-
let o =
|
|
5784
|
+
let o = _i({
|
|
5767
5785
|
group: t,
|
|
5768
5786
|
transform: i
|
|
5769
|
-
}), s =
|
|
5787
|
+
}), s = Kr({
|
|
5770
5788
|
transform: i,
|
|
5771
5789
|
key: "scaleX"
|
|
5772
|
-
}), c =
|
|
5790
|
+
}), c = Kr({
|
|
5773
5791
|
transform: i,
|
|
5774
5792
|
key: "scaleY"
|
|
5775
|
-
}), l =
|
|
5793
|
+
}), l = Kr({
|
|
5776
5794
|
transform: i,
|
|
5777
5795
|
key: "left"
|
|
5778
|
-
}), u =
|
|
5796
|
+
}), u = Kr({
|
|
5779
5797
|
transform: i,
|
|
5780
5798
|
key: "top"
|
|
5781
|
-
}), d = Math.abs(s ?? t.scaleX ?? 1) || 1, f = Math.abs(c ?? t.scaleY ?? 1) || 1, p = l ?? t.left ?? 0, m = u ?? t.top ?? 0, h =
|
|
5799
|
+
}), d = Math.abs(s ?? t.scaleX ?? 1) || 1, f = Math.abs(c ?? t.scaleY ?? 1) || 1, p = l ?? t.left ?? 0, m = u ?? t.top ?? 0, h = qr({ value: i?.original?.originX ?? i?.originX }), g = Jr({ value: i?.original?.originY ?? i?.originY }), _ = typeof i?.corner == "string" ? i.corner : null, v = Xr({
|
|
5782
5800
|
group: t,
|
|
5783
5801
|
originX: h,
|
|
5784
5802
|
originY: g
|
|
@@ -5786,7 +5804,7 @@ function gi({ scalingState: e, group: t, text: n, constraintPadding: r, transfor
|
|
|
5786
5804
|
measurementsByKey: /* @__PURE__ */ new Map(),
|
|
5787
5805
|
splitByGraphemeByFrameWidth: /* @__PURE__ */ new Map(),
|
|
5788
5806
|
minimumTextFrameWidth: null
|
|
5789
|
-
}, x = /* @__PURE__ */ new Map(), S =
|
|
5807
|
+
}, x = /* @__PURE__ */ new Map(), S = mi({
|
|
5790
5808
|
group: t,
|
|
5791
5809
|
text: n,
|
|
5792
5810
|
width: o.startWidth,
|
|
@@ -5828,8 +5846,8 @@ function gi({ scalingState: e, group: t, text: n, constraintPadding: r, transfor
|
|
|
5828
5846
|
proportionalTextConstraintCache: x
|
|
5829
5847
|
}, e.set(t, a), a;
|
|
5830
5848
|
}
|
|
5831
|
-
function
|
|
5832
|
-
let { previewWidth: s, previewHeight: c } =
|
|
5849
|
+
function yi({ group: e, text: t, constraintPadding: n, startDimensions: r, scaleX: i, scaleY: a, wrapPolicy: o }) {
|
|
5850
|
+
let { previewWidth: s, previewHeight: c } = hi({
|
|
5833
5851
|
group: e,
|
|
5834
5852
|
text: t,
|
|
5835
5853
|
constraintPadding: n,
|
|
@@ -5837,7 +5855,7 @@ function _i({ group: e, text: t, constraintPadding: n, startDimensions: r, scale
|
|
|
5837
5855
|
appliedScaleX: i,
|
|
5838
5856
|
appliedScaleY: a,
|
|
5839
5857
|
wrapPolicy: o
|
|
5840
|
-
}), { startWidth: l, startHeight: u } = r, d = Math.abs(s - l) >
|
|
5858
|
+
}), { startWidth: l, startHeight: u } = r, d = Math.abs(s - l) > ri, f = Math.abs(c - u) > ri;
|
|
5841
5859
|
return {
|
|
5842
5860
|
width: s,
|
|
5843
5861
|
height: c,
|
|
@@ -5845,7 +5863,7 @@ function _i({ group: e, text: t, constraintPadding: n, startDimensions: r, scale
|
|
|
5845
5863
|
hasDimensionChange: d || f
|
|
5846
5864
|
};
|
|
5847
5865
|
}
|
|
5848
|
-
function
|
|
5866
|
+
function bi({ startManualBaseWidth: e, startManualBaseHeight: t, canScaleWidth: n, canScaleHeight: r, finalWidth: i, finalHeight: a }) {
|
|
5849
5867
|
let o = e;
|
|
5850
5868
|
n && (o = i);
|
|
5851
5869
|
let s = t;
|
|
@@ -5854,8 +5872,8 @@ function vi({ startManualBaseWidth: e, startManualBaseHeight: t, canScaleWidth:
|
|
|
5854
5872
|
height: s
|
|
5855
5873
|
};
|
|
5856
5874
|
}
|
|
5857
|
-
function
|
|
5858
|
-
let p =
|
|
5875
|
+
function xi({ group: e, shape: t, text: n, width: r, height: i, alignH: a, alignV: o, startManualBaseWidth: s, startManualBaseHeight: c, canScaleWidth: l, canScaleHeight: u, hasWidthChange: d, wrapPolicy: f }) {
|
|
5876
|
+
let p = bi({
|
|
5859
5877
|
startManualBaseWidth: s,
|
|
5860
5878
|
startManualBaseHeight: c,
|
|
5861
5879
|
canScaleWidth: l,
|
|
@@ -5864,16 +5882,16 @@ function yi({ group: e, shape: t, text: n, width: r, height: i, alignH: a, align
|
|
|
5864
5882
|
finalHeight: i
|
|
5865
5883
|
});
|
|
5866
5884
|
e.shapeManualBaseWidth = p.width, e.shapeManualBaseHeight = p.height, l && d && (e.shapeTextAutoExpand = !1);
|
|
5867
|
-
let m =
|
|
5885
|
+
let m = ui({ group: e }), h = di({
|
|
5868
5886
|
group: e,
|
|
5869
5887
|
width: r,
|
|
5870
5888
|
height: i
|
|
5871
|
-
}), g = !u, _ = ({ width: t, height: n }) =>
|
|
5889
|
+
}), g = !u, _ = ({ width: t, height: n }) => di({
|
|
5872
5890
|
group: e,
|
|
5873
5891
|
width: t,
|
|
5874
5892
|
height: n
|
|
5875
5893
|
});
|
|
5876
|
-
!l && u ?
|
|
5894
|
+
!l && u ? Mr({
|
|
5877
5895
|
group: e,
|
|
5878
5896
|
shape: t,
|
|
5879
5897
|
text: n,
|
|
@@ -5886,7 +5904,7 @@ function yi({ group: e, shape: t, text: n, width: r, height: i, alignH: a, align
|
|
|
5886
5904
|
internalShapeTextInset: h,
|
|
5887
5905
|
expandShapeHeightToFitText: g,
|
|
5888
5906
|
resolveInternalShapeTextInset: _
|
|
5889
|
-
}) :
|
|
5907
|
+
}) : jr({
|
|
5890
5908
|
group: e,
|
|
5891
5909
|
shape: t,
|
|
5892
5910
|
text: n,
|
|
@@ -5910,7 +5928,7 @@ function yi({ group: e, shape: t, text: n, width: r, height: i, alignH: a, align
|
|
|
5910
5928
|
}
|
|
5911
5929
|
//#endregion
|
|
5912
5930
|
//#region src/editor/shape-manager/scaling/active-selection-scaling-controller.ts
|
|
5913
|
-
var
|
|
5931
|
+
var Si = class {
|
|
5914
5932
|
constructor({ canvas: e, shapeScalingState: t }) {
|
|
5915
5933
|
this.canvas = e, this.shapeScalingState = t, this.scalingState = /* @__PURE__ */ new WeakMap(), this.scalingSessions = /* @__PURE__ */ new WeakMap(), this.groupLayoutScales = /* @__PURE__ */ new WeakMap();
|
|
5916
5934
|
}
|
|
@@ -5962,21 +5980,21 @@ var bi = class {
|
|
|
5962
5980
|
} else c = this._resolveShapeLayoutScale({
|
|
5963
5981
|
item: e,
|
|
5964
5982
|
selectionScale: p
|
|
5965
|
-
}), u =
|
|
5983
|
+
}), u = hi({
|
|
5966
5984
|
group: t,
|
|
5967
5985
|
text: r,
|
|
5968
5986
|
constraintPadding: i,
|
|
5969
5987
|
startDimensions: a,
|
|
5970
5988
|
appliedScaleX: c.scaleX,
|
|
5971
5989
|
appliedScaleY: c.scaleY,
|
|
5972
|
-
wrapPolicy:
|
|
5990
|
+
wrapPolicy: ii({ isProportionalScaling: a.isProportionalScaling }),
|
|
5973
5991
|
measurementCache: a.previewTextMeasurementCache
|
|
5974
5992
|
}).previewHeight;
|
|
5975
|
-
|
|
5993
|
+
ni({
|
|
5976
5994
|
group: t,
|
|
5977
5995
|
shape: n,
|
|
5978
5996
|
text: r,
|
|
5979
|
-
layout:
|
|
5997
|
+
layout: gi({
|
|
5980
5998
|
group: t,
|
|
5981
5999
|
text: r,
|
|
5982
6000
|
state: a,
|
|
@@ -5999,13 +6017,13 @@ var bi = class {
|
|
|
5999
6017
|
commitGroupScaling({ group: e, scaleX: t, scaleY: n, transform: r }) {
|
|
6000
6018
|
let { shape: i, text: a } = H({ group: e });
|
|
6001
6019
|
if (!i || !a) return this.shapeScalingState.delete(e), !1;
|
|
6002
|
-
let o = this.shapeScalingState.get(e), s = o ??
|
|
6020
|
+
let o = this.shapeScalingState.get(e), s = o ?? _i({
|
|
6003
6021
|
group: e,
|
|
6004
6022
|
transform: r
|
|
6005
6023
|
}), c = r ? Y({ transform: r }) : null, l = o?.canScaleWidth ?? c?.canScaleWidth ?? Math.abs(t - 1) > 1e-4, u = o?.canScaleHeight ?? c?.canScaleHeight ?? Math.abs(n - 1) > 1e-4, d = e.shapeAlignHorizontal ?? "center", f = e.shapeAlignVertical ?? "middle", p = Z({ group: e }), m = this.groupLayoutScales.get(e) ?? {
|
|
6006
6024
|
scaleX: t,
|
|
6007
6025
|
scaleY: n
|
|
6008
|
-
}, { width: h, height: g, hasWidthChange: _, hasDimensionChange: v } =
|
|
6026
|
+
}, { width: h, height: g, hasWidthChange: _, hasDimensionChange: v } = yi({
|
|
6009
6027
|
group: e,
|
|
6010
6028
|
text: a,
|
|
6011
6029
|
constraintPadding: p,
|
|
@@ -6016,9 +6034,9 @@ var bi = class {
|
|
|
6016
6034
|
},
|
|
6017
6035
|
scaleX: m.scaleX,
|
|
6018
6036
|
scaleY: m.scaleY,
|
|
6019
|
-
wrapPolicy:
|
|
6037
|
+
wrapPolicy: ii({ isProportionalScaling: o?.isProportionalScaling })
|
|
6020
6038
|
});
|
|
6021
|
-
return v ? (
|
|
6039
|
+
return v ? (xi({
|
|
6022
6040
|
group: e,
|
|
6023
6041
|
shape: i,
|
|
6024
6042
|
text: a,
|
|
@@ -6031,7 +6049,7 @@ var bi = class {
|
|
|
6031
6049
|
canScaleWidth: l,
|
|
6032
6050
|
canScaleHeight: u,
|
|
6033
6051
|
hasWidthChange: _,
|
|
6034
|
-
wrapPolicy:
|
|
6052
|
+
wrapPolicy: ii({ isProportionalScaling: o?.isProportionalScaling })
|
|
6035
6053
|
}), this.shapeScalingState.delete(e), this.groupLayoutScales.delete(e), e.shapeScalingNoopTransform = !1, !0) : (this.shapeScalingState.delete(e), this.groupLayoutScales.delete(e), e.shapeScalingNoopTransform = !1, !1);
|
|
6036
6054
|
}
|
|
6037
6055
|
resolveCommittedScale({ selection: e }) {
|
|
@@ -6055,7 +6073,7 @@ var bi = class {
|
|
|
6055
6073
|
if (!U(r)) continue;
|
|
6056
6074
|
let { shape: e, text: i } = H({ group: r });
|
|
6057
6075
|
if (!e || !i) continue;
|
|
6058
|
-
let a = Z({ group: r }), o =
|
|
6076
|
+
let a = Z({ group: r }), o = vi({
|
|
6059
6077
|
scalingState: this.shapeScalingState,
|
|
6060
6078
|
group: r,
|
|
6061
6079
|
text: i,
|
|
@@ -6075,7 +6093,7 @@ var bi = class {
|
|
|
6075
6093
|
_ensureScalingSession({ selection: e, transform: t, items: n }) {
|
|
6076
6094
|
let r = this.scalingSessions.get(e);
|
|
6077
6095
|
if (r) return r;
|
|
6078
|
-
let i =
|
|
6096
|
+
let i = qr({ value: t.originX }) ?? "center", a = Jr({ value: t.originY }) ?? "center", o = n[0], s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), l = this._resolveShapeLocalBounds({ group: o.group });
|
|
6079
6097
|
for (let { group: e } of n) {
|
|
6080
6098
|
let t = this._resolveShapeLocalBounds({ group: e });
|
|
6081
6099
|
s.set(e, t), l = this._mergeBounds({
|
|
@@ -6295,7 +6313,7 @@ var bi = class {
|
|
|
6295
6313
|
_resolveProportionalLayoutResults({ items: e }) {
|
|
6296
6314
|
let t = /* @__PURE__ */ new Map();
|
|
6297
6315
|
for (let n of e) {
|
|
6298
|
-
let e =
|
|
6316
|
+
let e = pi({
|
|
6299
6317
|
group: n.group,
|
|
6300
6318
|
text: n.text,
|
|
6301
6319
|
state: n.state
|
|
@@ -6309,7 +6327,7 @@ var bi = class {
|
|
|
6309
6327
|
}
|
|
6310
6328
|
_resolveMinimumShapeWidth({ item: e, scaleY: t }) {
|
|
6311
6329
|
let { group: n, text: r, constraintPadding: i, state: a } = e, o = Math.max(1, a.startHeight * t);
|
|
6312
|
-
return
|
|
6330
|
+
return Fr({
|
|
6313
6331
|
text: r,
|
|
6314
6332
|
padding: i,
|
|
6315
6333
|
measurementCache: a.previewTextMeasurementCache ?? void 0,
|
|
@@ -6326,7 +6344,7 @@ var bi = class {
|
|
|
6326
6344
|
}
|
|
6327
6345
|
_resolveMinimumShapeHeight({ item: e, scaleX: t }) {
|
|
6328
6346
|
let { group: n, text: r, constraintPadding: i, state: a } = e;
|
|
6329
|
-
return
|
|
6347
|
+
return mi({
|
|
6330
6348
|
group: n,
|
|
6331
6349
|
text: r,
|
|
6332
6350
|
width: Math.max(1, a.startWidth * t),
|
|
@@ -6365,7 +6383,7 @@ var bi = class {
|
|
|
6365
6383
|
};
|
|
6366
6384
|
}
|
|
6367
6385
|
_resolveVerticalAttachment({ selectionBounds: e, shapeBounds: t }) {
|
|
6368
|
-
let n = Math.max(0, t.top - e.top), r = Math.max(0, e.bottom - t.bottom), i = n <=
|
|
6386
|
+
let n = Math.max(0, t.top - e.top), r = Math.max(0, e.bottom - t.bottom), i = n <= ri, a = r <= ri;
|
|
6369
6387
|
return i && !a ? "top" : a && !i ? "bottom" : Math.abs(n - r) <= .5 ? "center" : n < r ? "top" : "bottom";
|
|
6370
6388
|
}
|
|
6371
6389
|
_resolveOriginOffset({ origin: e }) {
|
|
@@ -6386,7 +6404,7 @@ var bi = class {
|
|
|
6386
6404
|
_hasPointerReachedSelectionScaleOrigin({ selection: e, transform: t, event: n, axis: r }) {
|
|
6387
6405
|
let i = t, a = r === "x" ? i.signX : i.signY;
|
|
6388
6406
|
if (typeof a != "number" || !Number.isFinite(a)) return !1;
|
|
6389
|
-
let o =
|
|
6407
|
+
let o = Yr({
|
|
6390
6408
|
target: e,
|
|
6391
6409
|
transform: t,
|
|
6392
6410
|
event: n,
|
|
@@ -6397,7 +6415,7 @@ var bi = class {
|
|
|
6397
6415
|
_applySelectionScale({ selection: e, transform: t, scaleX: n, scaleY: r }) {
|
|
6398
6416
|
let i = Math.abs(e.scaleX ?? 1) || 1, a = Math.abs(e.scaleY ?? 1) || 1;
|
|
6399
6417
|
if (!(Math.abs(i - n) > 1e-4 || Math.abs(a - r) > 1e-4)) return;
|
|
6400
|
-
let o =
|
|
6418
|
+
let o = qr({ value: t.originX }), s = Jr({ value: t.originY }), c = o !== null && s !== null ? e.getPositionByOrigin(o, s) : null;
|
|
6401
6419
|
e.set({
|
|
6402
6420
|
flipX: !1,
|
|
6403
6421
|
flipY: !1,
|
|
@@ -6405,7 +6423,7 @@ var bi = class {
|
|
|
6405
6423
|
scaleY: r
|
|
6406
6424
|
}), c && o !== null && s !== null && e.setPositionByOrigin(c, o, s), e.setCoords();
|
|
6407
6425
|
}
|
|
6408
|
-
},
|
|
6426
|
+
}, Ci = class {
|
|
6409
6427
|
constructor({ canvas: t }) {
|
|
6410
6428
|
this.handleObjectScaling = (t) => {
|
|
6411
6429
|
let { target: n, transform: r } = t;
|
|
@@ -6424,7 +6442,7 @@ var bi = class {
|
|
|
6424
6442
|
lockScalingFlip: !0,
|
|
6425
6443
|
centeredScaling: !1
|
|
6426
6444
|
});
|
|
6427
|
-
let s = Z({ group: i }), c =
|
|
6445
|
+
let s = Z({ group: i }), c = vi({
|
|
6428
6446
|
scalingState: this.scalingState,
|
|
6429
6447
|
group: i,
|
|
6430
6448
|
text: o,
|
|
@@ -6453,7 +6471,7 @@ var bi = class {
|
|
|
6453
6471
|
});
|
|
6454
6472
|
return;
|
|
6455
6473
|
}
|
|
6456
|
-
let _ =
|
|
6474
|
+
let _ = gi({
|
|
6457
6475
|
group: i,
|
|
6458
6476
|
text: o,
|
|
6459
6477
|
state: c,
|
|
@@ -6467,7 +6485,7 @@ var bi = class {
|
|
|
6467
6485
|
shouldHandleAsNoop: !1,
|
|
6468
6486
|
scaleX: g.appliedScaleX,
|
|
6469
6487
|
scaleY: g.appliedScaleY
|
|
6470
|
-
}),
|
|
6488
|
+
}), ni({
|
|
6471
6489
|
group: i,
|
|
6472
6490
|
shape: a,
|
|
6473
6491
|
text: o,
|
|
@@ -6529,7 +6547,7 @@ var bi = class {
|
|
|
6529
6547
|
axis: "y"
|
|
6530
6548
|
});
|
|
6531
6549
|
if (!e && !t) return;
|
|
6532
|
-
let n =
|
|
6550
|
+
let n = pi({
|
|
6533
6551
|
group: i,
|
|
6534
6552
|
text: s,
|
|
6535
6553
|
state: a
|
|
@@ -6543,7 +6561,7 @@ var bi = class {
|
|
|
6543
6561
|
state: a,
|
|
6544
6562
|
axis: "x"
|
|
6545
6563
|
})) {
|
|
6546
|
-
let e =
|
|
6564
|
+
let e = Fr({
|
|
6547
6565
|
text: s,
|
|
6548
6566
|
padding: c,
|
|
6549
6567
|
resolvePaddingForWidth: ({ width: e }) => Z({
|
|
@@ -6569,7 +6587,7 @@ var bi = class {
|
|
|
6569
6587
|
});
|
|
6570
6588
|
return;
|
|
6571
6589
|
}
|
|
6572
|
-
y = C ??
|
|
6590
|
+
y = C ?? mi({
|
|
6573
6591
|
group: i,
|
|
6574
6592
|
text: s,
|
|
6575
6593
|
width: Math.max(1, a.startWidth * _),
|
|
@@ -6582,7 +6600,7 @@ var bi = class {
|
|
|
6582
6600
|
}
|
|
6583
6601
|
if (!x && !S) return;
|
|
6584
6602
|
y ??= C;
|
|
6585
|
-
let w =
|
|
6603
|
+
let w = hi({
|
|
6586
6604
|
group: i,
|
|
6587
6605
|
text: s,
|
|
6588
6606
|
constraintPadding: c,
|
|
@@ -6591,7 +6609,7 @@ var bi = class {
|
|
|
6591
6609
|
appliedScaleY: v,
|
|
6592
6610
|
minimumHeight: b ? null : y,
|
|
6593
6611
|
measurementCache: a.previewTextMeasurementCache
|
|
6594
|
-
}), T =
|
|
6612
|
+
}), T = gi({
|
|
6595
6613
|
group: i,
|
|
6596
6614
|
text: s,
|
|
6597
6615
|
state: a,
|
|
@@ -6605,7 +6623,7 @@ var bi = class {
|
|
|
6605
6623
|
shouldHandleAsNoop: !1,
|
|
6606
6624
|
scaleX: _,
|
|
6607
6625
|
scaleY: v
|
|
6608
|
-
}),
|
|
6626
|
+
}), ni({
|
|
6609
6627
|
group: i,
|
|
6610
6628
|
shape: o,
|
|
6611
6629
|
text: s,
|
|
@@ -6649,7 +6667,7 @@ var bi = class {
|
|
|
6649
6667
|
startHeight: s,
|
|
6650
6668
|
alignH: n.shapeAlignHorizontal,
|
|
6651
6669
|
alignV: n.shapeAlignVertical,
|
|
6652
|
-
userPadding:
|
|
6670
|
+
userPadding: ui({ group: n })
|
|
6653
6671
|
}), n.shapeScalingNoopTransform = !1, this.scalingState.delete(n), this.canvas.requestRenderAll();
|
|
6654
6672
|
return;
|
|
6655
6673
|
}
|
|
@@ -6672,7 +6690,7 @@ var bi = class {
|
|
|
6672
6690
|
axis: "y"
|
|
6673
6691
|
});
|
|
6674
6692
|
if (t || o) {
|
|
6675
|
-
let e =
|
|
6693
|
+
let e = pi({
|
|
6676
6694
|
group: n,
|
|
6677
6695
|
text: d,
|
|
6678
6696
|
state: r
|
|
@@ -6680,7 +6698,7 @@ var bi = class {
|
|
|
6680
6698
|
(i < e.scale - 1e-4 || a < e.scale - 1e-4) && (v = e.scale, y = e.scale);
|
|
6681
6699
|
}
|
|
6682
6700
|
} else {
|
|
6683
|
-
let t =
|
|
6701
|
+
let t = Fr({
|
|
6684
6702
|
text: d,
|
|
6685
6703
|
padding: m,
|
|
6686
6704
|
resolvePaddingForWidth: ({ width: e }) => Z({
|
|
@@ -6695,7 +6713,7 @@ var bi = class {
|
|
|
6695
6713
|
minimumWidth: t,
|
|
6696
6714
|
state: r
|
|
6697
6715
|
}) && (v = Math.max(1 / o, t / o));
|
|
6698
|
-
let i =
|
|
6716
|
+
let i = mi({
|
|
6699
6717
|
group: n,
|
|
6700
6718
|
text: d,
|
|
6701
6719
|
width: Math.max(1, o * v),
|
|
@@ -6708,7 +6726,7 @@ var bi = class {
|
|
|
6708
6726
|
state: r
|
|
6709
6727
|
}) && (y = Math.max(1 / s, i / s));
|
|
6710
6728
|
}
|
|
6711
|
-
let { width: b, height: x, hasWidthChange: S, hasDimensionChange: C } =
|
|
6729
|
+
let { width: b, height: x, hasWidthChange: S, hasDimensionChange: C } = yi({
|
|
6712
6730
|
group: n,
|
|
6713
6731
|
text: d,
|
|
6714
6732
|
constraintPadding: m,
|
|
@@ -6722,7 +6740,7 @@ var bi = class {
|
|
|
6722
6740
|
},
|
|
6723
6741
|
scaleX: v,
|
|
6724
6742
|
scaleY: y,
|
|
6725
|
-
wrapPolicy:
|
|
6743
|
+
wrapPolicy: ii({ isProportionalScaling: r?.isProportionalScaling })
|
|
6726
6744
|
});
|
|
6727
6745
|
if (!C && r) {
|
|
6728
6746
|
this._restoreShapeStateWithoutResize({
|
|
@@ -6734,14 +6752,14 @@ var bi = class {
|
|
|
6734
6752
|
startHeight: s,
|
|
6735
6753
|
alignH: f,
|
|
6736
6754
|
alignV: p,
|
|
6737
|
-
userPadding:
|
|
6755
|
+
userPadding: ui({ group: n })
|
|
6738
6756
|
}), this.scalingState.delete(n), this.canvas.requestRenderAll();
|
|
6739
6757
|
return;
|
|
6740
6758
|
}
|
|
6741
6759
|
r && n.set({
|
|
6742
6760
|
left: r.lastAllowedLeft,
|
|
6743
6761
|
top: r.lastAllowedTop
|
|
6744
|
-
}),
|
|
6762
|
+
}), xi({
|
|
6745
6763
|
group: n,
|
|
6746
6764
|
shape: u,
|
|
6747
6765
|
text: d,
|
|
@@ -6754,12 +6772,12 @@ var bi = class {
|
|
|
6754
6772
|
canScaleWidth: g,
|
|
6755
6773
|
canScaleHeight: _,
|
|
6756
6774
|
hasWidthChange: S,
|
|
6757
|
-
wrapPolicy:
|
|
6775
|
+
wrapPolicy: ii({ isProportionalScaling: r?.isProportionalScaling })
|
|
6758
6776
|
}), r && this._restoreScalingAnchorPosition({
|
|
6759
6777
|
group: n,
|
|
6760
6778
|
state: r
|
|
6761
6779
|
}), n.setCoords(), d.setCoords(), u.setCoords(), this.scalingState.delete(n), n.shapeScalingNoopTransform = !1, this.canvas.requestRenderAll();
|
|
6762
|
-
}, this.canvas = t, this.scalingState = /* @__PURE__ */ new WeakMap(), this.activeSelectionScalingController = new
|
|
6780
|
+
}, this.canvas = t, this.scalingState = /* @__PURE__ */ new WeakMap(), this.activeSelectionScalingController = new Si({
|
|
6763
6781
|
canvas: t,
|
|
6764
6782
|
shapeScalingState: this.scalingState
|
|
6765
6783
|
});
|
|
@@ -6768,10 +6786,10 @@ var bi = class {
|
|
|
6768
6786
|
let a = e.scaleX ?? 1, o = e.scaleY ?? 1, { scaleX: s, scaleY: c } = this._resolveCurrentDragScales({
|
|
6769
6787
|
group: e,
|
|
6770
6788
|
state: r
|
|
6771
|
-
}), l = r.canScaleWidth && a < 0 || r.canScaleHeight && o < 0, u =
|
|
6789
|
+
}), l = r.canScaleWidth && a < 0 || r.canScaleHeight && o < 0, u = Zr({
|
|
6772
6790
|
state: r,
|
|
6773
6791
|
transform: i
|
|
6774
|
-
}), d =
|
|
6792
|
+
}), d = Qr({
|
|
6775
6793
|
state: r,
|
|
6776
6794
|
transform: i
|
|
6777
6795
|
});
|
|
@@ -6787,7 +6805,7 @@ var bi = class {
|
|
|
6787
6805
|
f.shouldRestoreLastAllowedTransform && (h = r.lastAllowedScaleX, g = r.lastAllowedScaleY), f.shouldHandleAsNoop && (h = r.startScaleX, g = r.startScaleY);
|
|
6788
6806
|
let _ = f.resolvedMinimumHeight, v = !r.canScaleWidth && r.canScaleHeight ? r.fixedWidthMinimumTextFitHeight : null;
|
|
6789
6807
|
f.shouldHandleAsNoop ? _ = r.startHeight : _ ??= v;
|
|
6790
|
-
let { previewHeight: y } =
|
|
6808
|
+
let { previewHeight: y } = hi({
|
|
6791
6809
|
group: e,
|
|
6792
6810
|
text: t,
|
|
6793
6811
|
constraintPadding: n,
|
|
@@ -6806,7 +6824,7 @@ var bi = class {
|
|
|
6806
6824
|
};
|
|
6807
6825
|
}
|
|
6808
6826
|
_resolveScalingConstraintState({ group: e, text: t, constraintPadding: n, state: r, scaleX: i, scaleY: a }) {
|
|
6809
|
-
let { canScaleHeight: o, canScaleWidth: s, startHeight: c, startWidth: l, cannotScaleDownAtStart: u, crossedOppositeCorner: d, isProportionalScaling: f, lastAllowedScaleX: p, lastAllowedScaleY: m, startScaleY: h } = r, g = o && !s, _ = s ? Math.max(1, l * i) : l, v = o ? Math.max(1, c * a) : c, y = i < p - X, b = a < m - X, x = a < h - X, S = g ? r.fixedWidthMinimumTextFitHeight : null, C = s && y ?
|
|
6827
|
+
let { canScaleHeight: o, canScaleWidth: s, startHeight: c, startWidth: l, cannotScaleDownAtStart: u, crossedOppositeCorner: d, isProportionalScaling: f, lastAllowedScaleX: p, lastAllowedScaleY: m, startScaleY: h } = r, g = o && !s, _ = s ? Math.max(1, l * i) : l, v = o ? Math.max(1, c * a) : c, y = i < p - X, b = a < m - X, x = a < h - X, S = g ? r.fixedWidthMinimumTextFitHeight : null, C = s && y ? Fr({
|
|
6810
6828
|
text: t,
|
|
6811
6829
|
padding: n,
|
|
6812
6830
|
measurementCache: r.previewTextMeasurementCache ?? void 0,
|
|
@@ -6815,7 +6833,7 @@ var bi = class {
|
|
|
6815
6833
|
width: t,
|
|
6816
6834
|
height: v
|
|
6817
6835
|
})
|
|
6818
|
-
}) : null, w = o && b ? S ??
|
|
6836
|
+
}) : null, w = o && b ? S ?? mi({
|
|
6819
6837
|
group: e,
|
|
6820
6838
|
text: t,
|
|
6821
6839
|
width: _,
|
|
@@ -6823,7 +6841,7 @@ var bi = class {
|
|
|
6823
6841
|
measurementCache: r.previewTextMeasurementCache
|
|
6824
6842
|
}) : null, T = g && u && x;
|
|
6825
6843
|
if (f && s && o && (y || b)) {
|
|
6826
|
-
if (!
|
|
6844
|
+
if (!fi({
|
|
6827
6845
|
group: e,
|
|
6828
6846
|
text: t,
|
|
6829
6847
|
width: _,
|
|
@@ -6831,7 +6849,7 @@ var bi = class {
|
|
|
6831
6849
|
measurementCache: r.previewTextMeasurementCache,
|
|
6832
6850
|
constraintCache: r.proportionalTextConstraintCache
|
|
6833
6851
|
}).isValid) {
|
|
6834
|
-
let n =
|
|
6852
|
+
let n = pi({
|
|
6835
6853
|
group: e,
|
|
6836
6854
|
text: t,
|
|
6837
6855
|
state: r
|
|
@@ -6854,7 +6872,7 @@ var bi = class {
|
|
|
6854
6872
|
}
|
|
6855
6873
|
let E = C !== null && _ < C + 1e-4, D = w !== null && v < w + 1e-4, O = E || D, k = d, A = null, j = null;
|
|
6856
6874
|
if (f && O) {
|
|
6857
|
-
let n =
|
|
6875
|
+
let n = pi({
|
|
6858
6876
|
group: e,
|
|
6859
6877
|
text: t,
|
|
6860
6878
|
state: r
|
|
@@ -6883,11 +6901,11 @@ var bi = class {
|
|
|
6883
6901
|
shouldHandleAsNoop: !0,
|
|
6884
6902
|
scaleX: r.startScaleX,
|
|
6885
6903
|
scaleY: r.startScaleY
|
|
6886
|
-
}),
|
|
6904
|
+
}), ni({
|
|
6887
6905
|
group: e,
|
|
6888
6906
|
shape: t,
|
|
6889
6907
|
text: n,
|
|
6890
|
-
layout:
|
|
6908
|
+
layout: gi({
|
|
6891
6909
|
group: e,
|
|
6892
6910
|
text: n,
|
|
6893
6911
|
state: r,
|
|
@@ -6971,7 +6989,7 @@ var bi = class {
|
|
|
6971
6989
|
if (!i) return !1;
|
|
6972
6990
|
let a = i, o = r === "x" ? n?.scaleDirectionX ?? null : n?.scaleDirectionY ?? null, s = this._resolveScaleDirection({ value: r === "x" ? a.signX : a.signY }) ?? o;
|
|
6973
6991
|
if (s === null) return !1;
|
|
6974
|
-
let c =
|
|
6992
|
+
let c = Yr({
|
|
6975
6993
|
event: e.e,
|
|
6976
6994
|
target: t,
|
|
6977
6995
|
transform: i,
|
|
@@ -6989,7 +7007,7 @@ var bi = class {
|
|
|
6989
7007
|
a && t.scaleDirectionX === null && (t.scaleDirectionX = this._resolveScaleDirection({ value: l.signX })), i && t.scaleDirectionY === null && (t.scaleDirectionY = this._resolveScaleDirection({ value: l.signY }));
|
|
6990
7008
|
let u = !a || t.scaleDirectionX !== null, d = !i || t.scaleDirectionY !== null;
|
|
6991
7009
|
if (u && d) return;
|
|
6992
|
-
let f =
|
|
7010
|
+
let f = Yr({
|
|
6993
7011
|
event: n,
|
|
6994
7012
|
target: e,
|
|
6995
7013
|
transform: r,
|
|
@@ -7018,16 +7036,16 @@ var bi = class {
|
|
|
7018
7036
|
e.setPositionByOrigin(new m(n, r), i, a), e.setCoords();
|
|
7019
7037
|
}
|
|
7020
7038
|
_restoreShapeStateWithoutResize({ group: e, shape: t, text: n, state: r, startWidth: i, startHeight: a, alignH: o, alignV: s, userPadding: c }) {
|
|
7021
|
-
let l = Math.max(1, e.shapeBaseWidth ?? e.width ?? i), u = Math.max(1, e.shapeBaseHeight ?? e.height ?? a), d =
|
|
7039
|
+
let l = Math.max(1, e.shapeBaseWidth ?? e.width ?? i), u = Math.max(1, e.shapeBaseHeight ?? e.height ?? a), d = di({
|
|
7022
7040
|
group: e,
|
|
7023
7041
|
width: l,
|
|
7024
7042
|
height: u
|
|
7025
|
-
}), f = o ?? "center", p = s ?? "middle", m =
|
|
7043
|
+
}), f = o ?? "center", p = s ?? "middle", m = ii({ isProportionalScaling: r.isProportionalScaling }), h = ({ width: t, height: n }) => di({
|
|
7026
7044
|
group: e,
|
|
7027
7045
|
width: t,
|
|
7028
7046
|
height: n
|
|
7029
7047
|
});
|
|
7030
|
-
!r.canScaleWidth && r.canScaleHeight ?
|
|
7048
|
+
!r.canScaleWidth && r.canScaleHeight ? Mr({
|
|
7031
7049
|
group: e,
|
|
7032
7050
|
shape: t,
|
|
7033
7051
|
text: n,
|
|
@@ -7039,7 +7057,7 @@ var bi = class {
|
|
|
7039
7057
|
wrapPolicy: m,
|
|
7040
7058
|
internalShapeTextInset: d,
|
|
7041
7059
|
resolveInternalShapeTextInset: h
|
|
7042
|
-
}) :
|
|
7060
|
+
}) : jr({
|
|
7043
7061
|
group: e,
|
|
7044
7062
|
shape: t,
|
|
7045
7063
|
text: n,
|
|
@@ -7063,7 +7081,7 @@ var bi = class {
|
|
|
7063
7081
|
state: r
|
|
7064
7082
|
});
|
|
7065
7083
|
}
|
|
7066
|
-
},
|
|
7084
|
+
}, wi = class {
|
|
7067
7085
|
constructor({ canvas: e }) {
|
|
7068
7086
|
this.handleMouseDown = (e) => {
|
|
7069
7087
|
let { target: t, e: n, subTargets: r = [] } = e, i = Xe({
|
|
@@ -7187,7 +7205,7 @@ var bi = class {
|
|
|
7187
7205
|
let t = this.canvas;
|
|
7188
7206
|
t.findTarget = e.findTarget, this.editingTargetResolverState = void 0;
|
|
7189
7207
|
}
|
|
7190
|
-
},
|
|
7208
|
+
}, Ti = 1e-4, Ei = class {
|
|
7191
7209
|
constructor({ runtime: t }) {
|
|
7192
7210
|
this._handleObjectScaling = (e) => {
|
|
7193
7211
|
this.runtime.collectShapeGroupsFromTarget({
|
|
@@ -7272,7 +7290,7 @@ var bi = class {
|
|
|
7272
7290
|
let r = t.getObjects(), i = r.filter((e) => U(e));
|
|
7273
7291
|
if (!i.length) return;
|
|
7274
7292
|
let { scaleX: a, scaleY: o } = this.runtime.scalingController.resolveActiveSelectionCommittedScale({ selection: t });
|
|
7275
|
-
if (!(Math.abs(a - 1) >
|
|
7293
|
+
if (!(Math.abs(a - 1) > Ti || Math.abs(o - 1) > Ti)) {
|
|
7276
7294
|
this.runtime.scalingController.clearActiveSelectionState({ selection: t });
|
|
7277
7295
|
return;
|
|
7278
7296
|
}
|
|
@@ -7290,7 +7308,7 @@ var bi = class {
|
|
|
7290
7308
|
}), e.setCoords());
|
|
7291
7309
|
}), this.runtime.scalingController.clearActiveSelectionState({ selection: t }), s.setActiveObject(new e(r, { canvas: s })), s.requestRenderAll();
|
|
7292
7310
|
}
|
|
7293
|
-
},
|
|
7311
|
+
}, Di = class {
|
|
7294
7312
|
constructor({ editor: e }) {
|
|
7295
7313
|
this.editor = e;
|
|
7296
7314
|
}
|
|
@@ -7409,7 +7427,7 @@ var bi = class {
|
|
|
7409
7427
|
width: y,
|
|
7410
7428
|
height: b
|
|
7411
7429
|
}), S = u ?? e.shapeTextWrapPolicy, C = r ?? this.editor.canvasManager.getObjectPlacement({ object: e });
|
|
7412
|
-
|
|
7430
|
+
jr({
|
|
7413
7431
|
group: e,
|
|
7414
7432
|
shape: t,
|
|
7415
7433
|
text: n,
|
|
@@ -7433,7 +7451,7 @@ var bi = class {
|
|
|
7433
7451
|
}
|
|
7434
7452
|
_resolveAutoExpandShapeWidth({ text: e, currentWidth: t, minimumWidth: n, padding: r, resolvePaddingForWidth: i }) {
|
|
7435
7453
|
let a = this.resolveMontageAreaWidth();
|
|
7436
|
-
return a ?
|
|
7454
|
+
return a ? Pr({
|
|
7437
7455
|
text: e,
|
|
7438
7456
|
currentWidth: t,
|
|
7439
7457
|
minimumWidth: n,
|
|
@@ -7442,7 +7460,7 @@ var bi = class {
|
|
|
7442
7460
|
resolvePaddingForWidth: i
|
|
7443
7461
|
}) : Math.max(1, t, n);
|
|
7444
7462
|
}
|
|
7445
|
-
},
|
|
7463
|
+
}, Oi = class e {
|
|
7446
7464
|
constructor({ canvas: e }) {
|
|
7447
7465
|
this.canvas = e, this.textEditingSnapshots = /* @__PURE__ */ new WeakMap(), this.pendingTextUpdates = /* @__PURE__ */ new WeakMap(), this.resizeStartSnapshots = /* @__PURE__ */ new Map(), this.pendingResizeUpdates = /* @__PURE__ */ new WeakMap();
|
|
7448
7466
|
}
|
|
@@ -7638,7 +7656,7 @@ var bi = class {
|
|
|
7638
7656
|
}
|
|
7639
7657
|
}), I;
|
|
7640
7658
|
}
|
|
7641
|
-
},
|
|
7659
|
+
}, ki = .01, Ai = ({ textbox: e }) => {
|
|
7642
7660
|
let t = e.text ?? "";
|
|
7643
7661
|
if (!t.length) return [];
|
|
7644
7662
|
let n = t.split("\n"), r = [], i = 0;
|
|
@@ -7650,7 +7668,7 @@ var bi = class {
|
|
|
7650
7668
|
});
|
|
7651
7669
|
}
|
|
7652
7670
|
return r;
|
|
7653
|
-
},
|
|
7671
|
+
}, ji = ({ range: e, text: t }) => {
|
|
7654
7672
|
if (!e) return null;
|
|
7655
7673
|
let n = t.length;
|
|
7656
7674
|
if (n <= 0) return null;
|
|
@@ -7659,8 +7677,8 @@ var bi = class {
|
|
|
7659
7677
|
start: l,
|
|
7660
7678
|
end: u
|
|
7661
7679
|
};
|
|
7662
|
-
},
|
|
7663
|
-
let n =
|
|
7680
|
+
}, Mi = ({ textbox: e, range: t }) => {
|
|
7681
|
+
let n = Ai({ textbox: e });
|
|
7664
7682
|
if (!n.length) return t;
|
|
7665
7683
|
let { start: r } = t, { end: i } = t;
|
|
7666
7684
|
for (let e = 0; e < n.length; e += 1) {
|
|
@@ -7673,7 +7691,7 @@ var bi = class {
|
|
|
7673
7691
|
start: r,
|
|
7674
7692
|
end: i
|
|
7675
7693
|
};
|
|
7676
|
-
},
|
|
7694
|
+
}, Ni = ({ textbox: e, range: t }) => {
|
|
7677
7695
|
let n = e.text ?? "";
|
|
7678
7696
|
if (!n.length) return [];
|
|
7679
7697
|
let { start: r, end: i } = t, a = n.split("\n"), o = [], s = 0;
|
|
@@ -7682,7 +7700,7 @@ var bi = class {
|
|
|
7682
7700
|
i > n && r < c && o.push(e), s = c + 1;
|
|
7683
7701
|
}
|
|
7684
7702
|
return o;
|
|
7685
|
-
},
|
|
7703
|
+
}, Pi = ({ textbox: e, range: t }) => {
|
|
7686
7704
|
let n = e.text ?? "";
|
|
7687
7705
|
if (!n.length) return [];
|
|
7688
7706
|
let { start: r, end: i } = t, a = n.split("\n"), o = [], s = 0;
|
|
@@ -7691,21 +7709,21 @@ var bi = class {
|
|
|
7691
7709
|
r <= n && i >= c && o.push(e), s = c + 1;
|
|
7692
7710
|
}
|
|
7693
7711
|
return o;
|
|
7694
|
-
},
|
|
7712
|
+
}, Fi = ({ previous: e, next: t }) => {
|
|
7695
7713
|
let n = Math.min(e.length, t.length);
|
|
7696
7714
|
for (let r = 0; r < n; r += 1) if (e[r] !== t[r]) return r;
|
|
7697
7715
|
return n;
|
|
7698
|
-
},
|
|
7716
|
+
}, Ii = ({ text: e, charIndex: t }) => {
|
|
7699
7717
|
let n = Math.max(0, Math.min(t, e.length)), r = 0;
|
|
7700
7718
|
for (let t = 0; t < n; t += 1) e[t] === "\n" && (r += 1);
|
|
7701
7719
|
return r;
|
|
7702
|
-
},
|
|
7720
|
+
}, Li = ({ text: e, lineIndex: t }) => {
|
|
7703
7721
|
if (t <= 0) return 0;
|
|
7704
7722
|
let n = 0;
|
|
7705
7723
|
for (let r = 0; r < e.length; r += 1) if (e[r] === "\n" && (n += 1, n === t)) return r + 1;
|
|
7706
7724
|
return e.length;
|
|
7707
|
-
},
|
|
7708
|
-
let a =
|
|
7725
|
+
}, Ri = ({ deltaLines: e, diffIndex: t, lineFontDefaults: n, lineIndexOld: r, previousText: i }) => {
|
|
7726
|
+
let a = Li({
|
|
7709
7727
|
text: i,
|
|
7710
7728
|
lineIndex: r
|
|
7711
7729
|
}), o = r + 1;
|
|
@@ -7724,7 +7742,7 @@ var bi = class {
|
|
|
7724
7742
|
lineFontDefaults: s,
|
|
7725
7743
|
changed: !0
|
|
7726
7744
|
};
|
|
7727
|
-
},
|
|
7745
|
+
}, zi = ({ deltaLines: e, diffIndex: t, lineFontDefaults: n, lineIndexOld: r, previousLines: i, previousText: a }) => {
|
|
7728
7746
|
let o = Math.abs(e), s = r;
|
|
7729
7747
|
a[t] === "\n" && (i[r] ?? "").length > 0 && (s = r + 1);
|
|
7730
7748
|
let c = s + o - 1, l = {}, u = [];
|
|
@@ -7747,7 +7765,7 @@ var bi = class {
|
|
|
7747
7765
|
lineDefaults: u
|
|
7748
7766
|
}
|
|
7749
7767
|
};
|
|
7750
|
-
},
|
|
7768
|
+
}, Bi = ({ lineFontDefaults: e, previousText: t, currentText: n }) => {
|
|
7751
7769
|
if (!e || !Object.keys(e).length) return {
|
|
7752
7770
|
lineFontDefaults: e,
|
|
7753
7771
|
changed: !1
|
|
@@ -7757,20 +7775,20 @@ var bi = class {
|
|
|
7757
7775
|
lineFontDefaults: e,
|
|
7758
7776
|
changed: !1
|
|
7759
7777
|
};
|
|
7760
|
-
let a =
|
|
7778
|
+
let a = Fi({
|
|
7761
7779
|
previous: t,
|
|
7762
7780
|
next: n
|
|
7763
|
-
}), o =
|
|
7781
|
+
}), o = Ii({
|
|
7764
7782
|
text: t,
|
|
7765
7783
|
charIndex: a
|
|
7766
7784
|
});
|
|
7767
|
-
return i > 0 ?
|
|
7785
|
+
return i > 0 ? Ri({
|
|
7768
7786
|
deltaLines: i,
|
|
7769
7787
|
diffIndex: a,
|
|
7770
7788
|
lineFontDefaults: e,
|
|
7771
7789
|
lineIndexOld: o,
|
|
7772
7790
|
previousText: t
|
|
7773
|
-
}) :
|
|
7791
|
+
}) : zi({
|
|
7774
7792
|
deltaLines: i,
|
|
7775
7793
|
diffIndex: a,
|
|
7776
7794
|
lineFontDefaults: e,
|
|
@@ -7778,10 +7796,10 @@ var bi = class {
|
|
|
7778
7796
|
previousLines: r,
|
|
7779
7797
|
previousText: t
|
|
7780
7798
|
});
|
|
7781
|
-
},
|
|
7799
|
+
}, Vi = ({ lineDefaults: e }) => {
|
|
7782
7800
|
let t = {};
|
|
7783
7801
|
return e.fontFamily !== void 0 && (t.fontFamily = e.fontFamily), e.fontSize !== void 0 && (t.fontSize = e.fontSize), e.fontWeight !== void 0 && (t.fontWeight = e.fontWeight), e.fontStyle !== void 0 && (t.fontStyle = e.fontStyle), e.underline !== void 0 && (t.underline = e.underline), e.linethrough !== void 0 && (t.linethrough = e.linethrough), e.fill !== void 0 && (t.fill = e.fill), e.stroke !== void 0 && (t.stroke = e.stroke), e.strokeWidth !== void 0 && (t.strokeWidth = e.strokeWidth), t;
|
|
7784
|
-
},
|
|
7802
|
+
}, Hi = ({ textbox: e, lineIndices: t, updates: n }) => {
|
|
7785
7803
|
if (!t.length) return !1;
|
|
7786
7804
|
let { fill: r, fontFamily: i, fontSize: a, fontStyle: o, fontWeight: s, linethrough: c, stroke: l, strokeWidth: u, underline: d } = n;
|
|
7787
7805
|
if (!(r !== void 0 || i !== void 0 || a !== void 0 || o !== void 0 || s !== void 0 || c !== void 0 || l !== void 0 || u !== void 0 || d !== void 0)) return !1;
|
|
@@ -7793,12 +7811,12 @@ var bi = class {
|
|
|
7793
7811
|
i !== void 0 && g?.fontFamily !== i && (_.fontFamily = i, v = !0), a !== void 0 && g?.fontSize !== a && (_.fontSize = a, v = !0), s !== void 0 && g?.fontWeight !== s && (_.fontWeight = s, v = !0), o !== void 0 && g?.fontStyle !== o && (_.fontStyle = o, v = !0), d !== void 0 && g?.underline !== d && (_.underline = d, v = !0), c !== void 0 && g?.linethrough !== c && (_.linethrough = c, v = !0), r !== void 0 && g?.fill !== r && (_.fill = r, v = !0), l !== void 0 && (l === null && g?.stroke !== void 0 && (delete _.stroke, v = !0), l !== null && g?.stroke !== l && (_.stroke = l, v = !0)), u !== void 0 && g?.strokeWidth !== u && (_.strokeWidth = u, v = !0), v && (h ||= (p = { ...p }, !0), p[n] = _, m = !0);
|
|
7794
7812
|
}
|
|
7795
7813
|
return m && (e.lineFontDefaults = p), m;
|
|
7796
|
-
},
|
|
7814
|
+
}, Ui = ({ lineStyles: e, lineDefaults: t }) => {
|
|
7797
7815
|
if (!e) return {
|
|
7798
7816
|
lineStyles: e,
|
|
7799
7817
|
changed: !1
|
|
7800
7818
|
};
|
|
7801
|
-
let n =
|
|
7819
|
+
let n = Vi({ lineDefaults: t }), r = Object.keys(n);
|
|
7802
7820
|
if (!r.length) return {
|
|
7803
7821
|
lineStyles: e,
|
|
7804
7822
|
changed: !1
|
|
@@ -7822,7 +7840,7 @@ var bi = class {
|
|
|
7822
7840
|
lineStyles: e,
|
|
7823
7841
|
changed: !1
|
|
7824
7842
|
};
|
|
7825
|
-
},
|
|
7843
|
+
}, Wi = ({ cleanup: e, lineCount: t, styles: n }) => {
|
|
7826
7844
|
if (!e) return {
|
|
7827
7845
|
styles: n,
|
|
7828
7846
|
changed: !1
|
|
@@ -7842,7 +7860,7 @@ var bi = class {
|
|
|
7842
7860
|
for (let t = 0; t < e.lineDefaults.length; t += 1) {
|
|
7843
7861
|
let n = e.lineDefaults[t];
|
|
7844
7862
|
if (!n) continue;
|
|
7845
|
-
let a =
|
|
7863
|
+
let a = Ui({
|
|
7846
7864
|
lineStyles: r,
|
|
7847
7865
|
lineDefaults: n
|
|
7848
7866
|
});
|
|
@@ -7857,19 +7875,19 @@ var bi = class {
|
|
|
7857
7875
|
styles: a,
|
|
7858
7876
|
changed: !0
|
|
7859
7877
|
};
|
|
7860
|
-
},
|
|
7878
|
+
}, Gi = ({ textbox: e }) => {
|
|
7861
7879
|
let { fontFamily: t, fontSize: n, fontStyle: r, fontWeight: i, fill: a, stroke: o, strokeWidth: s, linethrough: c, underline: l } = e, u = {}, d = typeof a == "string" ? a : void 0, f = typeof o == "string" ? o : void 0;
|
|
7862
7880
|
return t !== void 0 && (u.fontFamily = t), n !== void 0 && (u.fontSize = n), i !== void 0 && (u.fontWeight = i), r !== void 0 && (u.fontStyle = r), l !== void 0 && (u.underline = l), c !== void 0 && (u.linethrough = c), d !== void 0 && (u.fill = d), f !== void 0 && (u.stroke = f), s !== void 0 && (u.strokeWidth = s), u;
|
|
7863
|
-
},
|
|
7881
|
+
}, Ki = ({ sourceDefaults: e, globalLineDefaults: t }) => {
|
|
7864
7882
|
let n = {};
|
|
7865
7883
|
return e?.fontFamily === void 0 ? t.fontFamily !== void 0 && (n.fontFamily = t.fontFamily) : n.fontFamily = e.fontFamily, e?.fontSize === void 0 ? t.fontSize !== void 0 && (n.fontSize = t.fontSize) : n.fontSize = e.fontSize, e?.fontWeight === void 0 ? t.fontWeight !== void 0 && (n.fontWeight = t.fontWeight) : n.fontWeight = e.fontWeight, e?.fontStyle === void 0 ? t.fontStyle !== void 0 && (n.fontStyle = t.fontStyle) : n.fontStyle = e.fontStyle, e?.underline === void 0 ? t.underline !== void 0 && (n.underline = t.underline) : n.underline = e.underline, e?.linethrough === void 0 ? t.linethrough !== void 0 && (n.linethrough = t.linethrough) : n.linethrough = e.linethrough, e?.fill === void 0 ? t.fill !== void 0 && (n.fill = t.fill) : n.fill = e.fill, e?.stroke === void 0 ? t.stroke !== void 0 && (n.stroke = t.stroke) : n.stroke = e.stroke, e?.strokeWidth === void 0 ? n.stroke !== void 0 && t.strokeWidth !== void 0 && (n.strokeWidth = t.strokeWidth) : n.strokeWidth = e.strokeWidth, n;
|
|
7866
|
-
},
|
|
7884
|
+
}, qi = ({ lineText: e, lineStyles: t, lineDefaults: n }) => {
|
|
7867
7885
|
let r = e.length;
|
|
7868
7886
|
if (r === 0) return {
|
|
7869
7887
|
lineStyles: t,
|
|
7870
7888
|
changed: !1
|
|
7871
7889
|
};
|
|
7872
|
-
let i =
|
|
7890
|
+
let i = Vi({ lineDefaults: n }), a = Object.keys(i);
|
|
7873
7891
|
if (!a.length) return {
|
|
7874
7892
|
lineStyles: t,
|
|
7875
7893
|
changed: !1
|
|
@@ -7895,8 +7913,8 @@ var bi = class {
|
|
|
7895
7913
|
lineStyles: o,
|
|
7896
7914
|
changed: s
|
|
7897
7915
|
};
|
|
7898
|
-
},
|
|
7899
|
-
let a = n, o = !1, s = !1, c = i, l = !1, u = !1, d, f =
|
|
7916
|
+
}, Ji = ({ deletedLineDefaultsCleanup: e, globalLineDefaults: t, lineFontDefaults: n, lines: r, styles: i }) => {
|
|
7917
|
+
let a = n, o = !1, s = !1, c = i, l = !1, u = !1, d, f = Wi({
|
|
7900
7918
|
styles: c ?? {},
|
|
7901
7919
|
lineCount: r.length,
|
|
7902
7920
|
cleanup: e
|
|
@@ -7907,7 +7925,7 @@ var bi = class {
|
|
|
7907
7925
|
if (i && (d = i), n.length !== 0) {
|
|
7908
7926
|
let t = i;
|
|
7909
7927
|
if (!t && d && (t = { ...d }, a || (a = {}, s = !0), s ||= (a = { ...a }, !0), a[e] = t, o = !0), t) {
|
|
7910
|
-
let r =
|
|
7928
|
+
let r = qi({
|
|
7911
7929
|
lineText: n,
|
|
7912
7930
|
lineStyles: c ? c[e] : void 0,
|
|
7913
7931
|
lineDefaults: t
|
|
@@ -7916,12 +7934,12 @@ var bi = class {
|
|
|
7916
7934
|
}
|
|
7917
7935
|
continue;
|
|
7918
7936
|
}
|
|
7919
|
-
let f =
|
|
7937
|
+
let f = Ki({
|
|
7920
7938
|
sourceDefaults: i ?? d,
|
|
7921
7939
|
globalLineDefaults: t
|
|
7922
7940
|
});
|
|
7923
7941
|
!i && Object.keys(f).length && (a || (a = {}, s = !0), s ||= (a = { ...a }, !0), a[e] = f, o = !0, d = f), i && (d = i);
|
|
7924
|
-
let p =
|
|
7942
|
+
let p = Vi({ lineDefaults: f }), m = Object.keys(p).length > 0;
|
|
7925
7943
|
(m || c && c[e]) && (c || (c = {}, u = !0), u ||= (c = { ...c }, !0), m && (c[e] = { 0: p }), !m && c[e] && delete c[e], l = !0);
|
|
7926
7944
|
}
|
|
7927
7945
|
return {
|
|
@@ -7931,8 +7949,8 @@ var bi = class {
|
|
|
7931
7949
|
stylesChanged: l
|
|
7932
7950
|
};
|
|
7933
7951
|
};
|
|
7934
|
-
function
|
|
7935
|
-
let t = (e.text ?? "").split("\n"), n =
|
|
7952
|
+
function Yi({ textbox: e }) {
|
|
7953
|
+
let t = (e.text ?? "").split("\n"), n = Gi({ textbox: e }), r = Ji({
|
|
7936
7954
|
lines: t,
|
|
7937
7955
|
styles: e.styles,
|
|
7938
7956
|
lineFontDefaults: e.lineFontDefaults,
|
|
@@ -7944,7 +7962,7 @@ function qi({ textbox: e }) {
|
|
|
7944
7962
|
if (!Number.isInteger(t) || t < 0) continue;
|
|
7945
7963
|
let o = r.styles[e];
|
|
7946
7964
|
if (!o) continue;
|
|
7947
|
-
let s =
|
|
7965
|
+
let s = Ui({
|
|
7948
7966
|
lineStyles: o,
|
|
7949
7967
|
lineDefaults: i?.[t] ?? n
|
|
7950
7968
|
});
|
|
@@ -7955,31 +7973,31 @@ function qi({ textbox: e }) {
|
|
|
7955
7973
|
styles: a
|
|
7956
7974
|
};
|
|
7957
7975
|
}
|
|
7958
|
-
var
|
|
7959
|
-
let r =
|
|
7976
|
+
var Xi = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
7977
|
+
let r = Bi({
|
|
7960
7978
|
lineFontDefaults: n.lineFontDefaults,
|
|
7961
7979
|
previousText: t,
|
|
7962
7980
|
currentText: e
|
|
7963
|
-
}), i =
|
|
7981
|
+
}), i = Ji({
|
|
7964
7982
|
lines: e.split("\n"),
|
|
7965
7983
|
styles: n.styles,
|
|
7966
7984
|
lineFontDefaults: r.lineFontDefaults,
|
|
7967
7985
|
deletedLineDefaultsCleanup: r.deletedLineDefaultsCleanup,
|
|
7968
|
-
globalLineDefaults:
|
|
7986
|
+
globalLineDefaults: Gi({ textbox: n })
|
|
7969
7987
|
});
|
|
7970
7988
|
return {
|
|
7971
7989
|
...i,
|
|
7972
7990
|
lineFontDefaultsChanged: r.changed || i.lineFontDefaultsChanged
|
|
7973
7991
|
};
|
|
7974
|
-
},
|
|
7975
|
-
let t =
|
|
7992
|
+
}, Zi = ({ textbox: e }) => {
|
|
7993
|
+
let t = Ji({
|
|
7976
7994
|
lines: (e.text ?? "").split("\n"),
|
|
7977
7995
|
styles: e.styles,
|
|
7978
7996
|
lineFontDefaults: e.lineFontDefaults,
|
|
7979
|
-
globalLineDefaults:
|
|
7997
|
+
globalLineDefaults: Gi({ textbox: e })
|
|
7980
7998
|
}), n = !1;
|
|
7981
7999
|
return t.lineFontDefaultsChanged && (e.lineFontDefaults = t.lineFontDefaults, n = !0), t.stylesChanged && (e.styles = t.styles, e.dirty = !0, n = !0), n;
|
|
7982
|
-
},
|
|
8000
|
+
}, Qi = ({ lineFontDefaults: e }) => {
|
|
7983
8001
|
if (!e) return;
|
|
7984
8002
|
let t = {};
|
|
7985
8003
|
for (let n in e) {
|
|
@@ -7990,7 +8008,7 @@ var Ji = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
7990
8008
|
i && (t[r] = { ...i });
|
|
7991
8009
|
}
|
|
7992
8010
|
return t;
|
|
7993
|
-
},
|
|
8011
|
+
}, $i = ({ lineFontDefaults: e, scale: t }) => {
|
|
7994
8012
|
if (!e || !Number.isFinite(t) || Math.abs(t - 1) < .01) return;
|
|
7995
8013
|
let n = {}, r = !1, i = !1;
|
|
7996
8014
|
for (let a in e) {
|
|
@@ -8007,18 +8025,18 @@ var Ji = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
8007
8025
|
n[o] = c, r = !0;
|
|
8008
8026
|
}
|
|
8009
8027
|
if (!(!r || !i)) return n;
|
|
8010
|
-
},
|
|
8028
|
+
}, ea = ({ textbox: e, text: t }) => {
|
|
8011
8029
|
let { textLines: n } = e, r = Array.isArray(n) && n.length > 0 ? n.length : Math.max(t.split("\n").length, 1), i = 0;
|
|
8012
8030
|
for (let t = 0; t < r; t += 1) {
|
|
8013
8031
|
let n = e.getLineWidth(t);
|
|
8014
8032
|
n > i && (i = n);
|
|
8015
8033
|
}
|
|
8016
8034
|
return i;
|
|
8017
|
-
},
|
|
8018
|
-
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 m(l +
|
|
8035
|
+
}, ta = ({ origin: e, size: t }) => e === "left" || e === "top" || e === 0 ? 0 : e === "right" || e === "bottom" || e === 1 ? t : t / 2, na = ({ textbox: e, originX: t = e.originX ?? "center", originY: n = e.originY ?? "center" }) => {
|
|
8036
|
+
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 m(l + ta({
|
|
8019
8037
|
origin: t,
|
|
8020
8038
|
size: r
|
|
8021
|
-
}), u +
|
|
8039
|
+
}), u + ta({
|
|
8022
8040
|
origin: n,
|
|
8023
8041
|
size: i
|
|
8024
8042
|
})), f = e.getPointByOrigin("center", "center"), p = e, h = typeof p.calcTransformMatrix == "function" ? p.calcTransformMatrix() : null, g = Array.isArray(h) ? new m(d.x * h[0] + d.y * h[2] + f.x, d.x * h[1] + d.y * h[3] + f.y) : new m(f.x + d.x, f.y + d.y);
|
|
@@ -8028,13 +8046,13 @@ var Ji = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
8028
8046
|
originX: t,
|
|
8029
8047
|
originY: n
|
|
8030
8048
|
};
|
|
8031
|
-
},
|
|
8049
|
+
}, ra = ({ textbox: e, montageLeft: t, montageRight: n }) => {
|
|
8032
8050
|
e.setCoords();
|
|
8033
8051
|
let r = e.getBoundingRect(), i = r.left ?? 0, a = i + (r.width ?? 0), o = n - t;
|
|
8034
8052
|
if (o > 0 && (r.width ?? 0) >= o - .01) return !1;
|
|
8035
8053
|
let s = 0;
|
|
8036
8054
|
return i < t ? s = t - i : a > n && (s = n - a), Math.abs(s) <= .01 ? !1 : (e.set({ left: (e.left ?? 0) + s }), !0);
|
|
8037
|
-
},
|
|
8055
|
+
}, ia = ({ rawValue: e, calculatedValue: t }) => typeof e == "number" ? e : typeof t == "number" ? t : 0, aa = ({ stylesList: e }) => {
|
|
8038
8056
|
let t = e.length;
|
|
8039
8057
|
if (!t) return !1;
|
|
8040
8058
|
for (let n = 0; n < t; n += 1) {
|
|
@@ -8044,16 +8062,16 @@ var Ji = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
8044
8062
|
if (r !== void 0 || i !== void 0 || a !== void 0 || o !== void 0 || s !== void 0 || c !== void 0) return !0;
|
|
8045
8063
|
}
|
|
8046
8064
|
return !1;
|
|
8047
|
-
},
|
|
8048
|
-
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 =
|
|
8065
|
+
}, oa = ({ textbox: e }) => {
|
|
8066
|
+
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 = ia({
|
|
8049
8067
|
rawValue: t,
|
|
8050
8068
|
calculatedValue: a
|
|
8051
|
-
}), c =
|
|
8069
|
+
}), c = ia({
|
|
8052
8070
|
rawValue: n,
|
|
8053
8071
|
calculatedValue: o
|
|
8054
8072
|
}), l = Number.isFinite(s) ? Math.round(s) : null, u = Number.isFinite(c) ? Math.round(c) : null, d = {};
|
|
8055
8073
|
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;
|
|
8056
|
-
},
|
|
8074
|
+
}, sa = ({ textbox: e }) => {
|
|
8057
8075
|
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;
|
|
8058
8076
|
return {
|
|
8059
8077
|
width: t,
|
|
@@ -8071,9 +8089,9 @@ var Ji = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
8071
8089
|
bottomLeft: f
|
|
8072
8090
|
},
|
|
8073
8091
|
styles: JSON.parse(JSON.stringify(r)),
|
|
8074
|
-
lineFontDefaults:
|
|
8092
|
+
lineFontDefaults: Qi({ lineFontDefaults: i })
|
|
8075
8093
|
};
|
|
8076
|
-
},
|
|
8094
|
+
}, ca = ({ base: e }) => {
|
|
8077
8095
|
let t = 1 / Math.max(1, e.width), n = [e.fontSize];
|
|
8078
8096
|
Object.values(e.styles).forEach((e) => {
|
|
8079
8097
|
Object.values(e).forEach((e) => {
|
|
@@ -8090,7 +8108,7 @@ var Ji = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
8090
8108
|
fontScale: r,
|
|
8091
8109
|
proportionalScale: Math.max(t, r)
|
|
8092
8110
|
};
|
|
8093
|
-
},
|
|
8111
|
+
}, la = ({ textbox: e, base: t, scale: n, shouldScaleFontSize: r = !0, shouldScalePadding: i = !0, shouldScaleRadii: a = !0 }) => {
|
|
8094
8112
|
let { fontSize: o, padding: s, radii: c, styles: l, lineFontDefaults: u } = t, d = Math.max(Math.min(8, o), o * n), f = Object.keys(l).length > 0, p;
|
|
8095
8113
|
if (r && f) {
|
|
8096
8114
|
let e = {};
|
|
@@ -8109,7 +8127,7 @@ var Ji = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
8109
8127
|
}), Object.keys(e).length && (p = e);
|
|
8110
8128
|
}
|
|
8111
8129
|
let m;
|
|
8112
|
-
r && (m =
|
|
8130
|
+
r && (m = $i({
|
|
8113
8131
|
lineFontDefaults: u,
|
|
8114
8132
|
scale: n
|
|
8115
8133
|
}));
|
|
@@ -8135,9 +8153,9 @@ var Ji = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
8135
8153
|
radiusBottomRight: g.bottomRight,
|
|
8136
8154
|
radiusBottomLeft: g.bottomLeft
|
|
8137
8155
|
});
|
|
8138
|
-
},
|
|
8139
|
-
let { width: f } = n, p = Math.max(1, f * r), h = d ? Math.max(1, Math.round(p)) : p, g = e.width ?? f, _ = Math.abs(h - g) >
|
|
8140
|
-
u && _ && (e.autoExpand = !1),
|
|
8156
|
+
}, ua = ({ 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 }) => {
|
|
8157
|
+
let { width: f } = n, p = Math.max(1, f * r), h = d ? Math.max(1, Math.round(p)) : p, g = e.width ?? f, _ = Math.abs(h - g) > ki;
|
|
8158
|
+
u && _ && (e.autoExpand = !1), la({
|
|
8141
8159
|
textbox: e,
|
|
8142
8160
|
base: n,
|
|
8143
8161
|
scale: i,
|
|
@@ -8156,7 +8174,7 @@ var Ji = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
8156
8174
|
} finally {
|
|
8157
8175
|
e.shouldRoundDimensionsOnInit = v;
|
|
8158
8176
|
}
|
|
8159
|
-
let y = d ?
|
|
8177
|
+
let y = d ? oa({ textbox: e }) : !1;
|
|
8160
8178
|
return y && (e.dirty = !0), o ? (e.set({
|
|
8161
8179
|
originX: a.originX,
|
|
8162
8180
|
originY: a.originY
|
|
@@ -8173,7 +8191,7 @@ var Ji = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
8173
8191
|
};
|
|
8174
8192
|
//#endregion
|
|
8175
8193
|
//#region src/editor/shape-manager/mutation/shape-rehydration.ts
|
|
8176
|
-
function
|
|
8194
|
+
function da({ group: e }) {
|
|
8177
8195
|
let t = Math.abs(e.scaleX ?? 1) || 1, n = Math.abs(e.scaleY ?? 1) || 1, r = Math.max(1, e.shapeBaseWidth ?? e.width ?? 1), i = Math.max(1, e.shapeBaseHeight ?? e.height ?? 1);
|
|
8178
8196
|
return {
|
|
8179
8197
|
currentDimensions: {
|
|
@@ -8190,17 +8208,17 @@ function la({ group: e }) {
|
|
|
8190
8208
|
}
|
|
8191
8209
|
};
|
|
8192
8210
|
}
|
|
8193
|
-
function
|
|
8211
|
+
function fa({ group: e, text: t, textScale: n }) {
|
|
8194
8212
|
let r = Number.isFinite(n) && n > 0 ? n : 1;
|
|
8195
|
-
Math.abs(r - 1) <= 1e-4 || (
|
|
8213
|
+
Math.abs(r - 1) <= 1e-4 || (la({
|
|
8196
8214
|
textbox: t,
|
|
8197
|
-
base:
|
|
8215
|
+
base: sa({ textbox: t }),
|
|
8198
8216
|
scale: r
|
|
8199
8217
|
}), e.shapePaddingTop = Math.max(0, (e.shapePaddingTop ?? 0) * r), e.shapePaddingRight = Math.max(0, (e.shapePaddingRight ?? 0) * r), e.shapePaddingBottom = Math.max(0, (e.shapePaddingBottom ?? 0) * r), e.shapePaddingLeft = Math.max(0, (e.shapePaddingLeft ?? 0) * r));
|
|
8200
8218
|
}
|
|
8201
8219
|
//#endregion
|
|
8202
8220
|
//#region src/editor/shape-manager/mutation/shape-update-pipeline.ts
|
|
8203
|
-
var
|
|
8221
|
+
var pa = {
|
|
8204
8222
|
angle: 0,
|
|
8205
8223
|
skewX: 0,
|
|
8206
8224
|
skewY: 0,
|
|
@@ -8213,7 +8231,7 @@ var da = {
|
|
|
8213
8231
|
top: 0,
|
|
8214
8232
|
originX: "left",
|
|
8215
8233
|
originY: "top"
|
|
8216
|
-
},
|
|
8234
|
+
}, ma = class {
|
|
8217
8235
|
constructor({ runtime: e }) {
|
|
8218
8236
|
this.runtime = e;
|
|
8219
8237
|
}
|
|
@@ -8376,7 +8394,7 @@ var da = {
|
|
|
8376
8394
|
options: n,
|
|
8377
8395
|
styleState: i,
|
|
8378
8396
|
dimensionState: a
|
|
8379
|
-
}), c = await
|
|
8397
|
+
}), c = await Un({
|
|
8380
8398
|
preset: r.effectivePreset,
|
|
8381
8399
|
width: s.width,
|
|
8382
8400
|
height: s.height,
|
|
@@ -8511,7 +8529,7 @@ var da = {
|
|
|
8511
8529
|
width: Math.max(1, e.width ?? t),
|
|
8512
8530
|
align: n
|
|
8513
8531
|
});
|
|
8514
|
-
return s.set(
|
|
8532
|
+
return s.set(pa), this.runtime.applyTextUpdates({
|
|
8515
8533
|
textNode: s,
|
|
8516
8534
|
text: r,
|
|
8517
8535
|
textStyle: i,
|
|
@@ -8573,9 +8591,9 @@ var da = {
|
|
|
8573
8591
|
shouldPreserveCurrentWidth: r
|
|
8574
8592
|
};
|
|
8575
8593
|
}
|
|
8576
|
-
},
|
|
8594
|
+
}, ha = class {
|
|
8577
8595
|
constructor({ runtime: e }) {
|
|
8578
|
-
this.runtime = e, this.updatePipeline = new
|
|
8596
|
+
this.runtime = e, this.updatePipeline = new ma({ runtime: e });
|
|
8579
8597
|
}
|
|
8580
8598
|
async update({ target: e, presetKey: t, options: n = {} } = {}) {
|
|
8581
8599
|
let r = await this.updatePipeline.prepare({
|
|
@@ -8618,7 +8636,7 @@ var da = {
|
|
|
8618
8636
|
});
|
|
8619
8637
|
this.runtime.beginMutation();
|
|
8620
8638
|
try {
|
|
8621
|
-
|
|
8639
|
+
jn({
|
|
8622
8640
|
shape: i,
|
|
8623
8641
|
style: { fill: t }
|
|
8624
8642
|
}), r.shapeFill = t, r.setCoords(), this.runtime.lifecycleController.fireBefore({ lifecycle: a }), this.runtime.editor.canvas.requestRenderAll();
|
|
@@ -8666,7 +8684,7 @@ var da = {
|
|
|
8666
8684
|
});
|
|
8667
8685
|
this.runtime.beginMutation();
|
|
8668
8686
|
try {
|
|
8669
|
-
|
|
8687
|
+
jn({
|
|
8670
8688
|
shape: a,
|
|
8671
8689
|
style: { opacity: t }
|
|
8672
8690
|
}), n && o && (o.set({ opacity: t }), o.setCoords()), i.shapeOpacity = t, i.set({ opacity: 1 }), i.setCoords(), this.runtime.lifecycleController.fireBefore({ lifecycle: s }), this.runtime.editor.canvas.requestRenderAll();
|
|
@@ -8751,8 +8769,8 @@ var da = {
|
|
|
8751
8769
|
if (!r) return !1;
|
|
8752
8770
|
let { shape: i, text: a } = H({ group: r });
|
|
8753
8771
|
if (!i || !a) return !1;
|
|
8754
|
-
let o = this.runtime.editor.canvasManager.getObjectPlacement({ object: r }), { currentDimensions: s, manualDimensions: c, replaceBoxDimensions: l } =
|
|
8755
|
-
return
|
|
8772
|
+
let o = this.runtime.editor.canvasManager.getObjectPlacement({ object: r }), { currentDimensions: s, manualDimensions: c, replaceBoxDimensions: l } = da({ group: r });
|
|
8773
|
+
return fa({
|
|
8756
8774
|
group: r,
|
|
8757
8775
|
text: a,
|
|
8758
8776
|
textScale: t
|
|
@@ -8771,7 +8789,7 @@ var da = {
|
|
|
8771
8789
|
return !t || t.locked ? null : t;
|
|
8772
8790
|
}
|
|
8773
8791
|
_applyStrokeAndTextLayout({ group: e, shape: t, text: n, stroke: r, strokeWidth: i, dash: a }) {
|
|
8774
|
-
if (
|
|
8792
|
+
if (jn({
|
|
8775
8793
|
shape: t,
|
|
8776
8794
|
style: {
|
|
8777
8795
|
stroke: r,
|
|
@@ -8821,7 +8839,7 @@ var da = {
|
|
|
8821
8839
|
}
|
|
8822
8840
|
_applyPreparedTextState({ preparedUpdate: e }) {
|
|
8823
8841
|
let { current: t, text: n } = e;
|
|
8824
|
-
this.runtime.detachShapeGroupAutoLayout({ group: t.group }), t.text.set(
|
|
8842
|
+
this.runtime.detachShapeGroupAutoLayout({ group: t.group }), t.text.set(pa), this.runtime.applyTextUpdates({
|
|
8825
8843
|
textNode: t.text,
|
|
8826
8844
|
text: n.value,
|
|
8827
8845
|
textStyle: n.style,
|
|
@@ -8875,9 +8893,9 @@ var da = {
|
|
|
8875
8893
|
let { current: t, next: n, layout: r, placement: i } = e;
|
|
8876
8894
|
n.shouldFitReplacementToPreset && (t.group.shapeManualBaseWidth = Math.max(1, t.group.shapeBaseWidth ?? r.width), t.group.shapeManualBaseHeight = Math.max(1, t.group.shapeBaseHeight ?? r.height)), t.text.isEditing && this.runtime.editingPlacements.set(t.group, i);
|
|
8877
8895
|
}
|
|
8878
|
-
},
|
|
8896
|
+
}, ga = class {
|
|
8879
8897
|
constructor({ editor: e }) {
|
|
8880
|
-
this.editor = e, Ye(), this.scalingController = new
|
|
8898
|
+
this.editor = e, Ye(), this.scalingController = new Ci({ canvas: e.canvas }), this.editingController = new wi({ canvas: e.canvas }), this.editingPlacements = /* @__PURE__ */ new WeakMap(), this.lifecycleController = new Oi({ canvas: e.canvas }), this.layoutController = new Di({ editor: this.editor }), this.mutationController = new ha({ runtime: {
|
|
8881
8899
|
editor: this.editor,
|
|
8882
8900
|
lifecycleController: this.lifecycleController,
|
|
8883
8901
|
editingPlacements: this.editingPlacements,
|
|
@@ -8887,7 +8905,7 @@ var da = {
|
|
|
8887
8905
|
resolveReplaceBoxDimensions: (e) => this._resolveReplaceBoxDimensions(e),
|
|
8888
8906
|
resolveGroupUserPadding: (e) => this._resolveGroupUserPadding(e),
|
|
8889
8907
|
isShapeTextAutoExpandEnabled: (e) => this._isShapeTextAutoExpandEnabled(e),
|
|
8890
|
-
resolveShapeStyle:
|
|
8908
|
+
resolveShapeStyle: qn,
|
|
8891
8909
|
resolveCurrentTextStyle: (e) => this._resolveCurrentTextStyle(e),
|
|
8892
8910
|
createTextNode: (e) => this._createTextNode(e),
|
|
8893
8911
|
applyTextUpdates: (e) => this._applyTextUpdates(e),
|
|
@@ -8901,7 +8919,7 @@ var da = {
|
|
|
8901
8919
|
beginMutation: () => this._beginMutation(),
|
|
8902
8920
|
endMutation: (e) => this._endMutation(e),
|
|
8903
8921
|
isOnCanvas: (e) => this._isOnCanvas(e)
|
|
8904
|
-
} }), this.internalTextUpdates = /* @__PURE__ */ new WeakSet(), this.eventController = new
|
|
8922
|
+
} }), this.internalTextUpdates = /* @__PURE__ */ new WeakSet(), this.eventController = new Ei({ runtime: {
|
|
8905
8923
|
editor: this.editor,
|
|
8906
8924
|
scalingController: this.scalingController,
|
|
8907
8925
|
editingController: this.editingController,
|
|
@@ -8965,7 +8983,7 @@ var da = {
|
|
|
8965
8983
|
let w = a !== !1, T = this._resolveHorizontalAlign({
|
|
8966
8984
|
explicitAlign: c,
|
|
8967
8985
|
textStyle: s
|
|
8968
|
-
}), E = l ?? "middle", O =
|
|
8986
|
+
}), E = l ?? "middle", O = qn({
|
|
8969
8987
|
options: t,
|
|
8970
8988
|
fallback: null
|
|
8971
8989
|
}), k = Ne({ padding: u }), A = ({ width: e, height: t }) => Le({
|
|
@@ -9008,7 +9026,7 @@ var da = {
|
|
|
9008
9026
|
addition: k
|
|
9009
9027
|
})
|
|
9010
9028
|
}));
|
|
9011
|
-
let I = await
|
|
9029
|
+
let I = await Un({
|
|
9012
9030
|
preset: m,
|
|
9013
9031
|
width: F,
|
|
9014
9032
|
height: x,
|
|
@@ -9148,7 +9166,7 @@ var da = {
|
|
|
9148
9166
|
padding: h,
|
|
9149
9167
|
style: y,
|
|
9150
9168
|
rounding: b
|
|
9151
|
-
}), x.rehydrateRuntimeState(), Ve({ group: x }), He({ text: i }),
|
|
9169
|
+
}), x.rehydrateRuntimeState(), Ve({ group: x }), He({ text: i }), jr({
|
|
9152
9170
|
group: x,
|
|
9153
9171
|
shape: r,
|
|
9154
9172
|
text: i,
|
|
@@ -9435,7 +9453,7 @@ var da = {
|
|
|
9435
9453
|
}
|
|
9436
9454
|
return null;
|
|
9437
9455
|
}
|
|
9438
|
-
},
|
|
9456
|
+
}, _a = ({ rootObject: t, enableEvented: n = !0 }) => {
|
|
9439
9457
|
let r = [{
|
|
9440
9458
|
object: t,
|
|
9441
9459
|
enableEvented: n
|
|
@@ -9449,7 +9467,7 @@ var da = {
|
|
|
9449
9467
|
enableEvented: o
|
|
9450
9468
|
});
|
|
9451
9469
|
}
|
|
9452
|
-
},
|
|
9470
|
+
}, va = class {
|
|
9453
9471
|
constructor({ editor: e }) {
|
|
9454
9472
|
this.editor = e, this.clipboard = null;
|
|
9455
9473
|
}
|
|
@@ -9607,7 +9625,7 @@ var da = {
|
|
|
9607
9625
|
if (!n || n.locked) return !1;
|
|
9608
9626
|
try {
|
|
9609
9627
|
let e = await n.clone(Mt);
|
|
9610
|
-
return
|
|
9628
|
+
return _a({ rootObject: e }), e.set({
|
|
9611
9629
|
left: e.left + 10,
|
|
9612
9630
|
top: e.top + 10
|
|
9613
9631
|
}), this._materializeCloneGeometry({ clonedObject: e }), this._addClonedObjectToCanvas(e), t.fire("editor:object-duplicated", {
|
|
@@ -9674,7 +9692,7 @@ var da = {
|
|
|
9674
9692
|
if (!this.clipboard) return !1;
|
|
9675
9693
|
try {
|
|
9676
9694
|
let t = await this.clipboard.clone(Mt);
|
|
9677
|
-
return e.discardActiveObject(),
|
|
9695
|
+
return e.discardActiveObject(), _a({ rootObject: t }), t.set({
|
|
9678
9696
|
left: t.left + 10,
|
|
9679
9697
|
top: t.top + 10
|
|
9680
9698
|
}), this._materializeCloneGeometry({ clonedObject: t }), this._addClonedObjectToCanvas(t), e.fire("editor:object-pasted", {
|
|
@@ -9693,7 +9711,7 @@ var da = {
|
|
|
9693
9711
|
}), !1;
|
|
9694
9712
|
}
|
|
9695
9713
|
}
|
|
9696
|
-
},
|
|
9714
|
+
}, ya = class t {
|
|
9697
9715
|
constructor({ editor: e }) {
|
|
9698
9716
|
this.editor = e;
|
|
9699
9717
|
}
|
|
@@ -9758,7 +9776,7 @@ var da = {
|
|
|
9758
9776
|
!(n instanceof v) || !n.isEditing || n.exitEditing();
|
|
9759
9777
|
}
|
|
9760
9778
|
}
|
|
9761
|
-
},
|
|
9779
|
+
}, ba = class {
|
|
9762
9780
|
constructor({ editor: e }) {
|
|
9763
9781
|
this.editor = e;
|
|
9764
9782
|
}
|
|
@@ -9784,6 +9802,12 @@ var da = {
|
|
|
9784
9802
|
}
|
|
9785
9803
|
return n instanceof l ? [n] : null;
|
|
9786
9804
|
}
|
|
9805
|
+
_materializeUngroupedObject({ object: e }) {
|
|
9806
|
+
let { shapeManager: t, textManager: n } = this.editor, r = { target: e };
|
|
9807
|
+
e.shapeComposite === !0 && (r.textScale = Math.abs(e.scaleX ?? 1) || 1);
|
|
9808
|
+
let i = n.commitStandaloneTextScale({ target: e }), a = t.commitRehydratedShapeLayout(r);
|
|
9809
|
+
!i && !a && e.setCoords();
|
|
9810
|
+
}
|
|
9787
9811
|
group({ target: e, withoutSave: t = !1 } = {}) {
|
|
9788
9812
|
let { canvas: n, historyManager: r } = this.editor, i = this._getObjectsToGroup(e);
|
|
9789
9813
|
if (!i) return null;
|
|
@@ -9809,7 +9833,7 @@ var da = {
|
|
|
9809
9833
|
a.forEach((e) => {
|
|
9810
9834
|
let n = e.removeAll();
|
|
9811
9835
|
r.remove(e), n.forEach((e) => {
|
|
9812
|
-
r.add(e), t.push(e);
|
|
9836
|
+
this._materializeUngroupedObject({ object: e }), r.add(e), t.push(e);
|
|
9813
9837
|
});
|
|
9814
9838
|
});
|
|
9815
9839
|
let o = new e(t, { canvas: r });
|
|
@@ -9824,7 +9848,7 @@ var da = {
|
|
|
9824
9848
|
i.resumeHistory(), n || i.saveState();
|
|
9825
9849
|
}
|
|
9826
9850
|
}
|
|
9827
|
-
},
|
|
9851
|
+
}, xa = class t {
|
|
9828
9852
|
constructor({ editor: e }) {
|
|
9829
9853
|
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();
|
|
9830
9854
|
}
|
|
@@ -10018,16 +10042,16 @@ var da = {
|
|
|
10018
10042
|
let { options: e } = this.editor, { selectionKey: t } = e;
|
|
10019
10043
|
return t === void 0 ? ["ctrlKey", "metaKey"] : t;
|
|
10020
10044
|
}
|
|
10021
|
-
},
|
|
10045
|
+
}, Sa = class e {
|
|
10022
10046
|
constructor({ editor: e }) {
|
|
10023
10047
|
this.editor = e;
|
|
10024
10048
|
}
|
|
10025
10049
|
static _isUngroupableGroup(e) {
|
|
10026
|
-
return e
|
|
10050
|
+
return e instanceof l && e.format !== "svg";
|
|
10027
10051
|
}
|
|
10028
10052
|
_handleGroupDeletion(e) {
|
|
10029
10053
|
let { groupingManager: t } = this.editor, { ungroupedObjects: n = [] } = t.ungroup({
|
|
10030
|
-
|
|
10054
|
+
target: e,
|
|
10031
10055
|
withoutSave: !0
|
|
10032
10056
|
}) ?? {};
|
|
10033
10057
|
return this.deleteSelectedObjects({
|
|
@@ -10058,7 +10082,7 @@ var da = {
|
|
|
10058
10082
|
};
|
|
10059
10083
|
return i.fire("editor:objects-deleted", l), l;
|
|
10060
10084
|
}
|
|
10061
|
-
},
|
|
10085
|
+
}, Ca = {
|
|
10062
10086
|
IMAGE_MANAGER: {
|
|
10063
10087
|
INVALID_CONTENT_TYPE: "INVALID_CONTENT_TYPE",
|
|
10064
10088
|
INVALID_SOURCE_TYPE: "INVALID_SOURCE_TYPE",
|
|
@@ -10096,7 +10120,7 @@ var da = {
|
|
|
10096
10120
|
INVALID_TARGET: "TEMPLATE_INVALID_TARGET",
|
|
10097
10121
|
APPLY_FAILED: "TEMPLATE_APPLY_FAILED"
|
|
10098
10122
|
}
|
|
10099
|
-
},
|
|
10123
|
+
}, wa = class e {
|
|
10100
10124
|
constructor({ editor: e }) {
|
|
10101
10125
|
this._buffer = [], this.editor = e;
|
|
10102
10126
|
}
|
|
@@ -10154,9 +10178,9 @@ var da = {
|
|
|
10154
10178
|
}), this.editor.canvas.fire("editor:warning", s);
|
|
10155
10179
|
}
|
|
10156
10180
|
static isValidErrorCode(e) {
|
|
10157
|
-
return e ? Object.values(
|
|
10181
|
+
return e ? Object.values(Ca).some((t) => Object.values(t).includes(e)) : !1;
|
|
10158
10182
|
}
|
|
10159
|
-
},
|
|
10183
|
+
}, Ta = class {
|
|
10160
10184
|
constructor({ editor: e }) {
|
|
10161
10185
|
this.currentBounds = null, this.editor = e;
|
|
10162
10186
|
}
|
|
@@ -10205,32 +10229,32 @@ var da = {
|
|
|
10205
10229
|
updateBounds() {
|
|
10206
10230
|
this.currentBounds = this.calculatePanBounds();
|
|
10207
10231
|
}
|
|
10208
|
-
},
|
|
10232
|
+
}, Ea = ({ textbox: e }) => {
|
|
10209
10233
|
if (!e.isEditing) return null;
|
|
10210
10234
|
let t = e.selectionStart ?? 0, n = e.selectionEnd ?? t;
|
|
10211
10235
|
return t === n ? null : {
|
|
10212
10236
|
start: Math.min(t, n),
|
|
10213
10237
|
end: Math.max(t, n)
|
|
10214
10238
|
};
|
|
10215
|
-
},
|
|
10239
|
+
}, Da = ({ textbox: e }) => {
|
|
10216
10240
|
let t = e.text?.length ?? 0;
|
|
10217
10241
|
return t <= 0 ? null : {
|
|
10218
10242
|
start: 0,
|
|
10219
10243
|
end: t
|
|
10220
10244
|
};
|
|
10221
|
-
},
|
|
10245
|
+
}, Oa = ({ textbox: e, range: t }) => {
|
|
10222
10246
|
if (!t) return !1;
|
|
10223
10247
|
let n = e.text?.length ?? 0;
|
|
10224
10248
|
return n <= 0 ? !1 : t.start <= 0 && t.end >= n;
|
|
10225
|
-
},
|
|
10249
|
+
}, ka = ({ textbox: e, styles: t, range: n }) => {
|
|
10226
10250
|
if (!t || !Object.keys(t).length) return !1;
|
|
10227
10251
|
let { start: r, end: i } = n;
|
|
10228
10252
|
return i <= r ? !1 : (e.setSelectionStyles(t, r, i), !0);
|
|
10229
|
-
},
|
|
10253
|
+
}, Aa = ({ textbox: e, range: t, property: n }) => {
|
|
10230
10254
|
if (!t) return;
|
|
10231
10255
|
let r = e.getSelectionStyles(t.start, t.end, !0);
|
|
10232
10256
|
if (r.length) return r[0]?.[n];
|
|
10233
|
-
},
|
|
10257
|
+
}, ja = ({ strokeColor: e, width: t }) => t <= 0 ? null : e ?? "#000000", Ma = ({ width: e = 0 }) => e ? Math.max(0, e) : 0, Na = ({ value: e }) => typeof e == "string" ? e.toLocaleUpperCase() : "", Pa = ({ value: e, min: t, max: n }) => Math.min(Math.max(e, t), n), Fa = class e extends v {
|
|
10234
10258
|
static {
|
|
10235
10259
|
this.type = "background-textbox";
|
|
10236
10260
|
}
|
|
@@ -10267,7 +10291,7 @@ var da = {
|
|
|
10267
10291
|
];
|
|
10268
10292
|
}
|
|
10269
10293
|
constructor(e, t = {}) {
|
|
10270
|
-
if (super(e, t), this.backgroundOpacity = t.backgroundOpacity ?? 1, this.lineFontDefaults = t.lineFontDefaults ?? void 0, this.paddingTop = t.paddingTop ?? 0, this.paddingRight = t.paddingRight ?? 0, this.paddingBottom = t.paddingBottom ?? 0, this.paddingLeft = t.paddingLeft ?? 0, this.radiusTopLeft = t.radiusTopLeft ?? 0, this.radiusTopRight = t.radiusTopRight ?? 0, this.radiusBottomRight = t.radiusBottomRight ?? 0, this.radiusBottomLeft = t.radiusBottomLeft ?? 0,
|
|
10294
|
+
if (super(e, t), this.backgroundOpacity = t.backgroundOpacity ?? 1, this.lineFontDefaults = t.lineFontDefaults ?? void 0, this.paddingTop = t.paddingTop ?? 0, this.paddingRight = t.paddingRight ?? 0, this.paddingBottom = t.paddingBottom ?? 0, this.paddingLeft = t.paddingLeft ?? 0, this.radiusTopLeft = t.radiusTopLeft ?? 0, this.radiusTopRight = t.radiusTopRight ?? 0, this.radiusBottomRight = t.radiusBottomRight ?? 0, this.radiusBottomLeft = t.radiusBottomLeft ?? 0, Zi({ textbox: this })) {
|
|
10271
10295
|
this.initDimensions(), this.dirty = !0;
|
|
10272
10296
|
return;
|
|
10273
10297
|
}
|
|
@@ -10306,7 +10330,7 @@ var da = {
|
|
|
10306
10330
|
});
|
|
10307
10331
|
}
|
|
10308
10332
|
toObject(e = []) {
|
|
10309
|
-
let t = super.toObject(e), { lineFontDefaults: n, styles: r } =
|
|
10333
|
+
let t = super.toObject(e), { lineFontDefaults: n, styles: r } = Yi({ textbox: this });
|
|
10310
10334
|
return {
|
|
10311
10335
|
...t,
|
|
10312
10336
|
backgroundOpacity: this.backgroundOpacity,
|
|
@@ -10374,7 +10398,7 @@ var da = {
|
|
|
10374
10398
|
this._removeShadow(e);
|
|
10375
10399
|
}
|
|
10376
10400
|
_getDecorationColorAt(e, t) {
|
|
10377
|
-
let n = this.getValueOfPropertyAt(e, t, "strokeWidth"), r =
|
|
10401
|
+
let n = this.getValueOfPropertyAt(e, t, "strokeWidth"), r = Ma({ width: typeof n == "number" && Number.isFinite(n) ? n : 0 }), i = this.getValueOfPropertyAt(e, t, "stroke"), a = i == null ? null : ja({
|
|
10378
10402
|
strokeColor: i,
|
|
10379
10403
|
width: r
|
|
10380
10404
|
});
|
|
@@ -10390,22 +10414,22 @@ var da = {
|
|
|
10390
10414
|
_getCornerRadii({ width: e, height: t }) {
|
|
10391
10415
|
let n = e / 2, r = t / 2, i = Math.min(n, r);
|
|
10392
10416
|
return {
|
|
10393
|
-
bottomLeft:
|
|
10417
|
+
bottomLeft: Pa({
|
|
10394
10418
|
value: this.radiusBottomLeft ?? 0,
|
|
10395
10419
|
min: 0,
|
|
10396
10420
|
max: i
|
|
10397
10421
|
}),
|
|
10398
|
-
bottomRight:
|
|
10422
|
+
bottomRight: Pa({
|
|
10399
10423
|
value: this.radiusBottomRight ?? 0,
|
|
10400
10424
|
min: 0,
|
|
10401
10425
|
max: i
|
|
10402
10426
|
}),
|
|
10403
|
-
topLeft:
|
|
10427
|
+
topLeft: Pa({
|
|
10404
10428
|
value: this.radiusTopLeft ?? 0,
|
|
10405
10429
|
min: 0,
|
|
10406
10430
|
max: i
|
|
10407
10431
|
}),
|
|
10408
|
-
topRight:
|
|
10432
|
+
topRight: Pa({
|
|
10409
10433
|
value: this.radiusTopRight ?? 0,
|
|
10410
10434
|
min: 0,
|
|
10411
10435
|
max: i
|
|
@@ -10423,7 +10447,7 @@ var da = {
|
|
|
10423
10447
|
_getEffectiveBackgroundFill() {
|
|
10424
10448
|
let e = this.backgroundColor;
|
|
10425
10449
|
if (!e) return null;
|
|
10426
|
-
let t =
|
|
10450
|
+
let t = Pa({
|
|
10427
10451
|
value: this.backgroundOpacity ?? 1,
|
|
10428
10452
|
min: 0,
|
|
10429
10453
|
max: 1
|
|
@@ -10436,19 +10460,19 @@ var da = {
|
|
|
10436
10460
|
return r.setAlpha(t), r.toRgba();
|
|
10437
10461
|
}
|
|
10438
10462
|
static _renderRoundedRect({ ctx: e, height: t, left: n, radii: r, top: i, width: a }) {
|
|
10439
|
-
let o = n + a, s = i + t, { topLeft: c, topRight: l, bottomRight: u, bottomLeft: d } = r, f =
|
|
10463
|
+
let o = n + a, s = i + t, { topLeft: c, topRight: l, bottomRight: u, bottomLeft: d } = r, f = Pa({
|
|
10440
10464
|
value: c,
|
|
10441
10465
|
min: 0,
|
|
10442
10466
|
max: a
|
|
10443
|
-
}), p =
|
|
10467
|
+
}), p = Pa({
|
|
10444
10468
|
value: l,
|
|
10445
10469
|
min: 0,
|
|
10446
10470
|
max: a
|
|
10447
|
-
}), m =
|
|
10471
|
+
}), m = Pa({
|
|
10448
10472
|
value: u,
|
|
10449
10473
|
min: 0,
|
|
10450
10474
|
max: a
|
|
10451
|
-
}), h =
|
|
10475
|
+
}), h = Pa({
|
|
10452
10476
|
value: d,
|
|
10453
10477
|
min: 0,
|
|
10454
10478
|
max: a
|
|
@@ -10459,9 +10483,9 @@ var da = {
|
|
|
10459
10483
|
let { width: e = 0, height: t = 0 } = this, n = Math.round(e), r = Math.round(t);
|
|
10460
10484
|
n !== e && (this.width = Math.max(0, n)), r !== t && (this.height = Math.max(0, r));
|
|
10461
10485
|
}
|
|
10462
|
-
},
|
|
10463
|
-
b?.setClass && b.setClass(
|
|
10464
|
-
},
|
|
10486
|
+
}, Ia = () => {
|
|
10487
|
+
b?.setClass && b.setClass(Fa, "background-textbox");
|
|
10488
|
+
}, La = class {
|
|
10465
10489
|
constructor({ runtime: e }) {
|
|
10466
10490
|
this.runtime = e;
|
|
10467
10491
|
}
|
|
@@ -10525,16 +10549,16 @@ var da = {
|
|
|
10525
10549
|
};
|
|
10526
10550
|
}
|
|
10527
10551
|
_createSelectionContext({ textbox: e, currentText: t, selectionRangeOverride: n }) {
|
|
10528
|
-
let r = n === void 0 ?
|
|
10552
|
+
let r = n === void 0 ? Ea({ textbox: e }) : ji({
|
|
10529
10553
|
text: t,
|
|
10530
10554
|
range: n
|
|
10531
|
-
}), i = r ?
|
|
10555
|
+
}), i = r ? Mi({
|
|
10532
10556
|
textbox: e,
|
|
10533
10557
|
range: r
|
|
10534
|
-
}) : null, a =
|
|
10558
|
+
}) : null, a = Oa({
|
|
10535
10559
|
textbox: e,
|
|
10536
10560
|
range: r
|
|
10537
|
-
}), o =
|
|
10561
|
+
}), o = Oa({
|
|
10538
10562
|
textbox: e,
|
|
10539
10563
|
range: i
|
|
10540
10564
|
}), s = !r || a;
|
|
@@ -10622,17 +10646,17 @@ var da = {
|
|
|
10622
10646
|
t.resolvedStrokeColor = i.stroke, t.resolvedStrokeWidth = i.strokeWidth, r.selectionRange && (t.selectionStyles.stroke = i.stroke, t.selectionStyles.strokeWidth = i.strokeWidth), r.shouldUpdateWholeObject && (t.updates.stroke = i.stroke, t.updates.strokeWidth = i.strokeWidth, r.shouldApplyWholeTextStyles && (t.wholeTextStyles.stroke = i.stroke, t.wholeTextStyles.strokeWidth = i.strokeWidth));
|
|
10623
10647
|
}
|
|
10624
10648
|
_resolveStrokeUpdate({ textbox: e, selectionRange: t, strokeColor: n, strokeWidth: r }) {
|
|
10625
|
-
let i = t ?
|
|
10649
|
+
let i = t ? Aa({
|
|
10626
10650
|
textbox: e,
|
|
10627
10651
|
range: t,
|
|
10628
10652
|
property: "strokeWidth"
|
|
10629
|
-
}) : void 0, a = t ?
|
|
10653
|
+
}) : void 0, a = t ? Aa({
|
|
10630
10654
|
textbox: e,
|
|
10631
10655
|
range: t,
|
|
10632
10656
|
property: "stroke"
|
|
10633
|
-
}) : void 0, o = typeof i == "number" ? i : void 0, s = typeof a == "string" ? a : void 0, c = typeof e.stroke == "string" ? e.stroke : void 0, l =
|
|
10657
|
+
}) : void 0, o = typeof i == "number" ? i : void 0, s = typeof a == "string" ? a : void 0, c = typeof e.stroke == "string" ? e.stroke : void 0, l = Ma({ width: r ?? o ?? e.strokeWidth ?? 0 });
|
|
10634
10658
|
return {
|
|
10635
|
-
stroke:
|
|
10659
|
+
stroke: ja({
|
|
10636
10660
|
strokeColor: n ?? s ?? c,
|
|
10637
10661
|
width: l
|
|
10638
10662
|
}) ?? null,
|
|
@@ -10644,14 +10668,14 @@ var da = {
|
|
|
10644
10668
|
}
|
|
10645
10669
|
_applyTextContentUpdate({ textbox: e, style: t, updates: n, currentText: r }) {
|
|
10646
10670
|
let i = e.textCaseRaw ?? r, a = !!e.uppercase, o = t.text !== void 0, s = o ? t.text ?? "" : i, c = t.uppercase ?? a, l = c !== a, u = e.text ?? "";
|
|
10647
|
-
return o || l ? (n.text = c ?
|
|
10671
|
+
return o || l ? (n.text = c ? Na({ value: s }) : s, e.textCaseRaw = s) : e.textCaseRaw === void 0 && (e.textCaseRaw = i), e.uppercase = c, {
|
|
10648
10672
|
hasTextUpdate: o,
|
|
10649
10673
|
uppercaseChanged: l,
|
|
10650
10674
|
previousRenderedText: u
|
|
10651
10675
|
};
|
|
10652
10676
|
}
|
|
10653
10677
|
_resolveContentPlacement({ textbox: e, style: t, updates: n, placement: r, styleMaps: i, contentUpdate: a }) {
|
|
10654
|
-
let o =
|
|
10678
|
+
let o = aa({ stylesList: [
|
|
10655
10679
|
n,
|
|
10656
10680
|
i.selectionStyles,
|
|
10657
10681
|
i.lineSelectionStyles,
|
|
@@ -10667,7 +10691,7 @@ var da = {
|
|
|
10667
10691
|
t.paddingBottom,
|
|
10668
10692
|
t.paddingLeft
|
|
10669
10693
|
].some((e) => e !== void 0), l = Object.prototype.hasOwnProperty.call(n, "width");
|
|
10670
|
-
return c && !s && !a.hasTextUpdate && !a.uppercaseChanged && !o && !l ?
|
|
10694
|
+
return c && !s && !a.hasTextUpdate && !a.uppercaseChanged && !o && !l ? na({
|
|
10671
10695
|
textbox: e,
|
|
10672
10696
|
originX: r.originX,
|
|
10673
10697
|
originY: r.originY
|
|
@@ -10700,24 +10724,24 @@ var da = {
|
|
|
10700
10724
|
}
|
|
10701
10725
|
_applyWholeTextStyles({ textbox: e, selection: t, styleMaps: n }) {
|
|
10702
10726
|
if (t.selectionRange || Object.keys(n.wholeTextStyles).length === 0) return;
|
|
10703
|
-
let r =
|
|
10704
|
-
r &&
|
|
10727
|
+
let r = Da({ textbox: e });
|
|
10728
|
+
r && ka({
|
|
10705
10729
|
textbox: e,
|
|
10706
10730
|
styles: n.wholeTextStyles,
|
|
10707
10731
|
range: r
|
|
10708
|
-
}) && (e.dirty = !0,
|
|
10732
|
+
}) && (e.dirty = !0, aa({ stylesList: [n.wholeTextStyles] }) && (e.initDimensions(), e.dirty = !0));
|
|
10709
10733
|
}
|
|
10710
10734
|
_applySelectionStyles({ textbox: e, selection: t, styleMaps: n }) {
|
|
10711
10735
|
if (!t.selectionRange) return;
|
|
10712
|
-
let r =
|
|
10736
|
+
let r = ka({
|
|
10713
10737
|
textbox: e,
|
|
10714
10738
|
styles: n.selectionStyles,
|
|
10715
10739
|
range: t.selectionRange
|
|
10716
|
-
}), i = t.fontSelectionRange ?
|
|
10740
|
+
}), i = t.fontSelectionRange ? ka({
|
|
10717
10741
|
textbox: e,
|
|
10718
10742
|
styles: n.lineSelectionStyles,
|
|
10719
10743
|
range: t.fontSelectionRange
|
|
10720
|
-
}) : !1, a =
|
|
10744
|
+
}) : !1, a = aa({ stylesList: [
|
|
10721
10745
|
n.selectionStyles,
|
|
10722
10746
|
n.lineSelectionStyles,
|
|
10723
10747
|
n.wholeTextStyles
|
|
@@ -10739,9 +10763,9 @@ var da = {
|
|
|
10739
10763
|
_applyFontLineDefaultUpdates({ textbox: e, style: t, selection: n }) {
|
|
10740
10764
|
if (!n.fontSelectionRange || t.fontFamily === void 0 && t.fontSize === void 0) return;
|
|
10741
10765
|
let r = {};
|
|
10742
|
-
t.fontFamily !== void 0 && (r.fontFamily = t.fontFamily), t.fontSize !== void 0 && (r.fontSize = t.fontSize),
|
|
10766
|
+
t.fontFamily !== void 0 && (r.fontFamily = t.fontFamily), t.fontSize !== void 0 && (r.fontSize = t.fontSize), Hi({
|
|
10743
10767
|
textbox: e,
|
|
10744
|
-
lineIndices:
|
|
10768
|
+
lineIndices: Ni({
|
|
10745
10769
|
textbox: e,
|
|
10746
10770
|
range: n.fontSelectionRange
|
|
10747
10771
|
}),
|
|
@@ -10751,9 +10775,9 @@ var da = {
|
|
|
10751
10775
|
_applyDecorationLineDefaultUpdates({ textbox: e, style: t, selection: n, styleMaps: r }) {
|
|
10752
10776
|
if (!n.selectionRange || !(t.bold !== void 0 || t.italic !== void 0 || t.underline !== void 0 || t.strikethrough !== void 0 || t.color !== void 0 || t.strokeColor !== void 0 || t.strokeWidth !== void 0)) return;
|
|
10753
10777
|
let i = {};
|
|
10754
|
-
r.resolvedFontWeight !== void 0 && (i.fontWeight = r.resolvedFontWeight), r.resolvedFontStyle !== void 0 && (i.fontStyle = r.resolvedFontStyle), t.underline !== void 0 && (i.underline = t.underline), t.strikethrough !== void 0 && (i.linethrough = t.strikethrough), t.color !== void 0 && (i.fill = t.color), (t.strokeColor !== void 0 || t.strokeWidth !== void 0) && (r.resolvedStrokeColor === null && (i.stroke = null), r.resolvedStrokeColor !== null && r.resolvedStrokeColor !== void 0 && (i.stroke = r.resolvedStrokeColor), r.resolvedStrokeWidth !== void 0 && (i.strokeWidth = r.resolvedStrokeWidth)),
|
|
10778
|
+
r.resolvedFontWeight !== void 0 && (i.fontWeight = r.resolvedFontWeight), r.resolvedFontStyle !== void 0 && (i.fontStyle = r.resolvedFontStyle), t.underline !== void 0 && (i.underline = t.underline), t.strikethrough !== void 0 && (i.linethrough = t.strikethrough), t.color !== void 0 && (i.fill = t.color), (t.strokeColor !== void 0 || t.strokeWidth !== void 0) && (r.resolvedStrokeColor === null && (i.stroke = null), r.resolvedStrokeColor !== null && r.resolvedStrokeColor !== void 0 && (i.stroke = r.resolvedStrokeColor), r.resolvedStrokeWidth !== void 0 && (i.strokeWidth = r.resolvedStrokeWidth)), Hi({
|
|
10755
10779
|
textbox: e,
|
|
10756
|
-
lineIndices:
|
|
10780
|
+
lineIndices: Pi({
|
|
10757
10781
|
textbox: e,
|
|
10758
10782
|
range: n.selectionRange
|
|
10759
10783
|
}),
|
|
@@ -10799,7 +10823,7 @@ var da = {
|
|
|
10799
10823
|
].some((e) => e !== void 0);
|
|
10800
10824
|
}
|
|
10801
10825
|
_resolveShouldAutoExpand({ textbox: e, style: t, styleMaps: n, contentUpdate: r }) {
|
|
10802
|
-
let i = t.autoExpand ?? e.autoExpand, a =
|
|
10826
|
+
let i = t.autoExpand ?? e.autoExpand, a = aa({ stylesList: [
|
|
10803
10827
|
n.updates,
|
|
10804
10828
|
n.selectionStyles,
|
|
10805
10829
|
n.lineSelectionStyles,
|
|
@@ -10844,18 +10868,18 @@ var da = {
|
|
|
10844
10868
|
};
|
|
10845
10869
|
this.runtime.canvas.fire("editor:text-updated", m);
|
|
10846
10870
|
}
|
|
10847
|
-
},
|
|
10871
|
+
}, Ra = ({ transform: e }) => {
|
|
10848
10872
|
let { corner: t = "", action: n = "" } = e;
|
|
10849
10873
|
return {
|
|
10850
10874
|
isCornerHandle: t === "tl" || t === "tr" || t === "bl" || t === "br" || n === "scale",
|
|
10851
10875
|
isHorizontalHandle: t === "ml" || t === "mr" || n === "scaleX",
|
|
10852
10876
|
isVerticalHandle: t === "mt" || t === "mb" || n === "scaleY"
|
|
10853
10877
|
};
|
|
10854
|
-
},
|
|
10878
|
+
}, za = ({ textbox: e, transform: t, appliedWidth: n }) => {
|
|
10855
10879
|
t.scaleX = 1, t.scaleY = 1;
|
|
10856
10880
|
let r = t.original;
|
|
10857
10881
|
r && (r.scaleX = 1, r.scaleY = 1, r.width = n, r.height = e.height, r.left = e.left, r.top = e.top);
|
|
10858
|
-
},
|
|
10882
|
+
}, Ba = ({ textbox: e, transform: t, scenePoint: n }) => {
|
|
10859
10883
|
let { x: r, y: i } = e._getTransformedDimensions();
|
|
10860
10884
|
if (r <= 0 || i <= 0) return null;
|
|
10861
10885
|
let a = x.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);
|
|
@@ -10865,27 +10889,27 @@ var da = {
|
|
|
10865
10889
|
stepScaleX: l,
|
|
10866
10890
|
stepScaleY: u
|
|
10867
10891
|
};
|
|
10868
|
-
},
|
|
10869
|
-
function
|
|
10892
|
+
}, Va = 1e-4;
|
|
10893
|
+
function Ha(e) {
|
|
10870
10894
|
return !!e && e instanceof v;
|
|
10871
10895
|
}
|
|
10872
|
-
function
|
|
10873
|
-
if (!
|
|
10896
|
+
function Ua(e) {
|
|
10897
|
+
if (!Ha(e)) return !1;
|
|
10874
10898
|
let t = e.group;
|
|
10875
10899
|
return e.shapeNodeType === "text" && t?.shapeComposite === !0;
|
|
10876
10900
|
}
|
|
10877
|
-
var
|
|
10901
|
+
var Wa = class {
|
|
10878
10902
|
constructor({ canvas: t, canvasManager: n, persistScaledTextbox: r }) {
|
|
10879
10903
|
this.handleMouseMove = (e) => {
|
|
10880
10904
|
let t = this.canvas._currentTransform;
|
|
10881
10905
|
if (!t) return;
|
|
10882
10906
|
let { target: n } = t;
|
|
10883
|
-
if (!
|
|
10907
|
+
if (!Ha(n) || Ua(n)) return;
|
|
10884
10908
|
let r = this.scalingState.get(n);
|
|
10885
10909
|
if (!r || !e.e) return;
|
|
10886
|
-
let { isCornerHandle: i, isHorizontalHandle: a, isVerticalHandle: o } =
|
|
10910
|
+
let { isCornerHandle: i, isHorizontalHandle: a, isVerticalHandle: o } = Ra({ transform: t });
|
|
10887
10911
|
if (!a && !o && !i) return;
|
|
10888
|
-
let s =
|
|
10912
|
+
let s = Ba({
|
|
10889
10913
|
textbox: n,
|
|
10890
10914
|
transform: t,
|
|
10891
10915
|
scenePoint: this.canvas.getScenePoint(e.e)
|
|
@@ -10908,20 +10932,20 @@ var Ha = class {
|
|
|
10908
10932
|
}, j = r.lastAllowedScaleX, M = r.lastAllowedScaleY;
|
|
10909
10933
|
if (i) {
|
|
10910
10934
|
let e = Math.max(r.minimumProportionalScale, r.lastAllowedScaleX * Math.sqrt(u * d)), t = c || l ? r.minimumProportionalScale : e;
|
|
10911
|
-
if (Math.abs(t - r.lastAllowedScaleX) <=
|
|
10935
|
+
if (Math.abs(t - r.lastAllowedScaleX) <= Va) return;
|
|
10912
10936
|
j = t, M = t;
|
|
10913
10937
|
} else {
|
|
10914
10938
|
if (a) {
|
|
10915
10939
|
let e = r.lastAllowedScaleX * u, t = c ? r.minimumWidthScale : Math.max(r.minimumWidthScale, e);
|
|
10916
|
-
Math.abs(t - r.lastAllowedScaleX) >
|
|
10940
|
+
Math.abs(t - r.lastAllowedScaleX) > Va && (j = t);
|
|
10917
10941
|
}
|
|
10918
10942
|
if (o) {
|
|
10919
10943
|
let e = r.lastAllowedScaleY * d, t = l ? r.minimumFontScale : Math.max(r.minimumFontScale, e);
|
|
10920
|
-
Math.abs(t - r.lastAllowedScaleY) >
|
|
10944
|
+
Math.abs(t - r.lastAllowedScaleY) > Va && (M = t);
|
|
10921
10945
|
}
|
|
10922
|
-
if (Math.abs(j - r.lastAllowedScaleX) <=
|
|
10946
|
+
if (Math.abs(j - r.lastAllowedScaleX) <= Va && Math.abs(M - r.lastAllowedScaleY) <= Va) return;
|
|
10923
10947
|
}
|
|
10924
|
-
let { appliedWidth: N, dimensionsRounded: P } =
|
|
10948
|
+
let { appliedWidth: N, dimensionsRounded: P } = ua({
|
|
10925
10949
|
textbox: n,
|
|
10926
10950
|
canvasManager: this.canvasManager,
|
|
10927
10951
|
base: r.startBase,
|
|
@@ -10935,7 +10959,7 @@ var Ha = class {
|
|
|
10935
10959
|
shouldDisableAutoExpandOnHorizontalChange: a,
|
|
10936
10960
|
shouldRoundDimensions: !i
|
|
10937
10961
|
});
|
|
10938
|
-
|
|
10962
|
+
za({
|
|
10939
10963
|
textbox: n,
|
|
10940
10964
|
transform: t,
|
|
10941
10965
|
appliedWidth: N
|
|
@@ -10956,12 +10980,12 @@ var Ha = class {
|
|
|
10956
10980
|
}), this.canvas.requestRenderAll();
|
|
10957
10981
|
}, this.handleObjectScaling = (t) => {
|
|
10958
10982
|
let { target: n, transform: r } = t;
|
|
10959
|
-
if (n instanceof e || !
|
|
10983
|
+
if (n instanceof e || !Ha(n) || Ua(n) || !r) return;
|
|
10960
10984
|
n.isScaling = !0;
|
|
10961
10985
|
let i = this._ensureScalingState({
|
|
10962
10986
|
textbox: n,
|
|
10963
10987
|
transform: r
|
|
10964
|
-
}), { startBase: a } = i, { width: o, fontSize: s } = a, { isCornerHandle: c, isHorizontalHandle: l, isVerticalHandle: u } =
|
|
10988
|
+
}), { startBase: a } = i, { width: o, fontSize: s } = a, { isCornerHandle: c, isHorizontalHandle: l, isVerticalHandle: u } = Ra({ transform: r }), d = r.corner ?? "", f = c || u;
|
|
10965
10989
|
if (!l && !u && !c) return;
|
|
10966
10990
|
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({
|
|
10967
10991
|
object: n,
|
|
@@ -10976,7 +11000,7 @@ var Ha = class {
|
|
|
10976
11000
|
N = e, P = e;
|
|
10977
11001
|
}
|
|
10978
11002
|
} else l && (N = Math.max(i.minimumWidthScale, i.lastAllowedScaleX * h)), u && (P = Math.max(i.minimumFontScale, i.lastAllowedScaleY * g));
|
|
10979
|
-
let { appliedWidth: ee, dimensionsRounded: te } =
|
|
11003
|
+
let { appliedWidth: ee, dimensionsRounded: te } = ua({
|
|
10980
11004
|
textbox: n,
|
|
10981
11005
|
canvasManager: this.canvasManager,
|
|
10982
11006
|
base: a,
|
|
@@ -10990,7 +11014,7 @@ var Ha = class {
|
|
|
10990
11014
|
shouldDisableAutoExpandOnHorizontalChange: l,
|
|
10991
11015
|
shouldRoundDimensions: !c
|
|
10992
11016
|
});
|
|
10993
|
-
|
|
11017
|
+
za({
|
|
10994
11018
|
textbox: n,
|
|
10995
11019
|
transform: r,
|
|
10996
11020
|
appliedWidth: ee
|
|
@@ -11023,7 +11047,7 @@ var Ha = class {
|
|
|
11023
11047
|
let { target: n } = t;
|
|
11024
11048
|
if (n instanceof e) {
|
|
11025
11049
|
let t = n.getObjects();
|
|
11026
|
-
if (!t.some((e) =>
|
|
11050
|
+
if (!t.some((e) => Ha(e))) return;
|
|
11027
11051
|
let { scaleX: r = 1, scaleY: i = 1 } = n;
|
|
11028
11052
|
if (Math.abs(r - 1) < .01 && Math.abs(i - 1) < .01) return;
|
|
11029
11053
|
this.canvas.discardActiveObject(), t.forEach((e) => {
|
|
@@ -11033,7 +11057,7 @@ var Ha = class {
|
|
|
11033
11057
|
this.canvas.setActiveObject(a), this.canvas.requestRenderAll();
|
|
11034
11058
|
return;
|
|
11035
11059
|
}
|
|
11036
|
-
if (!
|
|
11060
|
+
if (!Ha(n) || Ua(n)) return;
|
|
11037
11061
|
n.isScaling = !1;
|
|
11038
11062
|
let r = this.scalingState.get(n);
|
|
11039
11063
|
if (this.scalingState.delete(n), !r?.hasScalingChange) return;
|
|
@@ -11058,11 +11082,11 @@ var Ha = class {
|
|
|
11058
11082
|
}, this.canvas = t, this.canvasManager = n, this.persistScaledTextbox = r, this.scalingState = /* @__PURE__ */ new WeakMap();
|
|
11059
11083
|
}
|
|
11060
11084
|
commitStandaloneTextScale({ target: e, shouldDisableAutoExpandOnHorizontalChange: t = !1 }) {
|
|
11061
|
-
if (!
|
|
11085
|
+
if (!Ha(e) || Ua(e)) return !1;
|
|
11062
11086
|
let n = Math.abs(e.scaleX ?? 1) || 1, r = Math.abs(e.scaleY ?? 1) || 1;
|
|
11063
11087
|
if (!(Math.abs(n - 1) > .01 || Math.abs(r - 1) > .01)) return !1;
|
|
11064
|
-
let i =
|
|
11065
|
-
return
|
|
11088
|
+
let i = sa({ textbox: e }), a = this.canvasManager.getObjectPlacement({ object: e });
|
|
11089
|
+
return ua({
|
|
11066
11090
|
textbox: e,
|
|
11067
11091
|
canvasManager: this.canvasManager,
|
|
11068
11092
|
base: i,
|
|
@@ -11078,7 +11102,7 @@ var Ha = class {
|
|
|
11078
11102
|
_ensureScalingState({ textbox: e, transform: t }) {
|
|
11079
11103
|
let n = this.scalingState.get(e);
|
|
11080
11104
|
if (!n) {
|
|
11081
|
-
let r =
|
|
11105
|
+
let r = sa({ textbox: e }), i = this.canvasManager.getObjectPlacement({ object: e }), a = ca({ base: r }), o = t.original?.originX ?? t.originX ?? e.originX ?? "center", s = t.original?.originY ?? t.originY ?? e.originY ?? "center";
|
|
11082
11106
|
n = {
|
|
11083
11107
|
startBase: r,
|
|
11084
11108
|
startObjectPlacement: i,
|
|
@@ -11111,7 +11135,7 @@ var Ha = class {
|
|
|
11111
11135
|
topRight: e.radiusTopRight ?? 0,
|
|
11112
11136
|
bottomRight: e.radiusBottomRight ?? 0,
|
|
11113
11137
|
bottomLeft: e.radiusBottomLeft ?? 0
|
|
11114
|
-
}, v = Math.abs(n - o) >
|
|
11138
|
+
}, v = Math.abs(n - o) > ki, y = Math.abs(h - r) > ki, 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;
|
|
11115
11139
|
if (c) {
|
|
11116
11140
|
let e = h / Math.max(1, m);
|
|
11117
11141
|
S = e, C = e;
|
|
@@ -11132,7 +11156,7 @@ var Ha = class {
|
|
|
11132
11156
|
originY: a
|
|
11133
11157
|
});
|
|
11134
11158
|
}
|
|
11135
|
-
},
|
|
11159
|
+
}, Ga = class e {
|
|
11136
11160
|
constructor({ editor: t }) {
|
|
11137
11161
|
this._handleTextEditingEntered = (t) => {
|
|
11138
11162
|
this.isTextEditingActive = !0;
|
|
@@ -11145,7 +11169,7 @@ var Ha = class {
|
|
|
11145
11169
|
if (!e._isTextbox(n)) return;
|
|
11146
11170
|
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 });
|
|
11147
11171
|
if (s) {
|
|
11148
|
-
let e =
|
|
11172
|
+
let e = Na({ value: l });
|
|
11149
11173
|
e !== i && n.set({ text: e }), n.textCaseRaw = l;
|
|
11150
11174
|
} else n.textCaseRaw = i;
|
|
11151
11175
|
if (!r && o === void 0 && (n.autoExpand = !0), r) {
|
|
@@ -11163,7 +11187,7 @@ var Ha = class {
|
|
|
11163
11187
|
let r = e._isShapeOwnedTextbox(n);
|
|
11164
11188
|
this.editingPlacementState?.delete(n), delete n.__lineDefaultsPrevText;
|
|
11165
11189
|
let i = n.text ?? "";
|
|
11166
|
-
n.uppercase ? n.textCaseRaw = n.textCaseRaw ?? i.toLocaleLowerCase() : n.textCaseRaw = i, r || (
|
|
11190
|
+
n.uppercase ? n.textCaseRaw = n.textCaseRaw ?? i.toLocaleLowerCase() : n.textCaseRaw = i, r || (oa({ textbox: n }) && (n.setCoords(), n.dirty = !0, this.canvas.requestRenderAll()), n.locked || n.set({
|
|
11167
11191
|
lockMovementX: !1,
|
|
11168
11192
|
lockMovementY: !1
|
|
11169
11193
|
}));
|
|
@@ -11190,7 +11214,7 @@ var Ha = class {
|
|
|
11190
11214
|
transform: r,
|
|
11191
11215
|
event: i ?? null
|
|
11192
11216
|
});
|
|
11193
|
-
}, this.editor = t, this.canvas = t.canvas, this.fonts = t.options.fonts ?? [], this.scalingController = new
|
|
11217
|
+
}, this.editor = t, this.canvas = t.canvas, this.fonts = t.options.fonts ?? [], this.scalingController = new Wa({
|
|
11194
11218
|
canvas: t.canvas,
|
|
11195
11219
|
canvasManager: t.canvasManager,
|
|
11196
11220
|
persistScaledTextbox: ({ target: e, style: t }) => {
|
|
@@ -11199,7 +11223,7 @@ var Ha = class {
|
|
|
11199
11223
|
style: t
|
|
11200
11224
|
});
|
|
11201
11225
|
}
|
|
11202
|
-
}), this.updateController = new
|
|
11226
|
+
}), this.updateController = new La({ runtime: {
|
|
11203
11227
|
canvas: this.canvas,
|
|
11204
11228
|
canvasManager: t.canvasManager,
|
|
11205
11229
|
historyManager: t.historyManager,
|
|
@@ -11208,12 +11232,12 @@ var Ha = class {
|
|
|
11208
11232
|
restoreTextboxContentPlacement: (e) => this._restoreTextboxContentPlacement(e),
|
|
11209
11233
|
syncLineStylesWithText: (e) => this._syncLineStylesWithText(e),
|
|
11210
11234
|
getSnapshot: (t) => e._getSnapshot(t)
|
|
11211
|
-
} }), this.editingPlacementState = /* @__PURE__ */ new WeakMap(), this.isTextEditingActive = !1, this._bindEvents(),
|
|
11235
|
+
} }), this.editingPlacementState = /* @__PURE__ */ new WeakMap(), this.isTextEditingActive = !1, this._bindEvents(), Ia();
|
|
11212
11236
|
}
|
|
11213
11237
|
addText({ id: t = `background-textbox-${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 } = {}) {
|
|
11214
11238
|
let { canvasManager: M, historyManager: N } = this.editor, { canvas: P } = this;
|
|
11215
11239
|
N.suspendHistory();
|
|
11216
|
-
let F = i ?? this._getDefaultFontFamily(), I =
|
|
11240
|
+
let F = i ?? this._getDefaultFontFamily(), I = Ma({ width: m }), ee = ja({
|
|
11217
11241
|
strokeColor: p,
|
|
11218
11242
|
width: I
|
|
11219
11243
|
}), te = {
|
|
@@ -11242,14 +11266,14 @@ var Ha = class {
|
|
|
11242
11266
|
radiusBottomRight: w,
|
|
11243
11267
|
radiusBottomLeft: T,
|
|
11244
11268
|
...E
|
|
11245
|
-
}, L = new
|
|
11269
|
+
}, L = new Fa(n, te), ne = r !== !1;
|
|
11246
11270
|
L.autoExpand = ne;
|
|
11247
11271
|
let re = E.left !== void 0 || E.top !== void 0;
|
|
11248
11272
|
if (L.textCaseRaw = L.text ?? "", l) {
|
|
11249
|
-
let e =
|
|
11273
|
+
let e = Na({ value: L.textCaseRaw });
|
|
11250
11274
|
e !== L.text && L.set({ text: e });
|
|
11251
11275
|
}
|
|
11252
|
-
|
|
11276
|
+
oa({ textbox: L }) && (L.dirty = !0);
|
|
11253
11277
|
let ie;
|
|
11254
11278
|
re && (ie = M.resolveObjectPlacement({
|
|
11255
11279
|
object: L,
|
|
@@ -11354,7 +11378,7 @@ var Ha = class {
|
|
|
11354
11378
|
clampToMontage: r
|
|
11355
11379
|
}));
|
|
11356
11380
|
let a = !1;
|
|
11357
|
-
i || (a =
|
|
11381
|
+
i || (a = oa({ textbox: e }));
|
|
11358
11382
|
let o = !1;
|
|
11359
11383
|
return !i && t && (this.editor.canvasManager.applyObjectPlacement({
|
|
11360
11384
|
object: e,
|
|
@@ -11362,7 +11386,7 @@ var Ha = class {
|
|
|
11362
11386
|
}), o = !0), (i || a) && (e.dirty = !0), (i || a || o) && e.setCoords(), i || a;
|
|
11363
11387
|
}
|
|
11364
11388
|
_restoreTextboxContentPlacement({ textbox: e, contentPlacement: t }) {
|
|
11365
|
-
let n =
|
|
11389
|
+
let n = na({
|
|
11366
11390
|
textbox: e,
|
|
11367
11391
|
originX: t.originX,
|
|
11368
11392
|
originY: t.originY
|
|
@@ -11380,7 +11404,7 @@ var Ha = class {
|
|
|
11380
11404
|
e.on("object:scaling", this.scalingController.handleObjectScaling), e.on("object:resizing", this._handleObjectResizing), e.on("object:modified", this.scalingController.handleObjectModified), e.on("mouse:move", this.scalingController.handleMouseMove), e.on("text:editing:entered", this._handleTextEditingEntered), e.on("text:editing:exited", this._handleTextEditingExited), e.on("text:changed", this._handleTextChanged);
|
|
11381
11405
|
}
|
|
11382
11406
|
_syncLineStylesWithText({ textbox: e, previousText: t, currentText: n }) {
|
|
11383
|
-
let r = n ?? e.text ?? "", i =
|
|
11407
|
+
let r = n ?? e.text ?? "", i = Xi({
|
|
11384
11408
|
textbox: e,
|
|
11385
11409
|
previousText: t ?? e.__lineDefaultsPrevText ?? r,
|
|
11386
11410
|
currentText: r
|
|
@@ -11398,16 +11422,16 @@ var Ha = class {
|
|
|
11398
11422
|
if (!Number.isFinite(f) || f <= 0) return !1;
|
|
11399
11423
|
let p = a.split("\n").length, m = !1;
|
|
11400
11424
|
Math.abs((e.width ?? 0) - f) > .01 && (e.set({ width: f }), m = !0), e.initDimensions();
|
|
11401
|
-
let { textLines: h } = e, g = Array.isArray(h) && h.length > p, _ = Math.ceil(
|
|
11425
|
+
let { textLines: h } = e, g = Array.isArray(h) && h.length > p, _ = Math.ceil(ea({
|
|
11402
11426
|
textbox: e,
|
|
11403
11427
|
text: a
|
|
11404
11428
|
})), v = Math.min(e.minWidth ?? 1, f), y = Math.min(f, Math.max(_, v));
|
|
11405
|
-
g && (y = f), Math.abs((e.width ?? 0) - y) > .01 && (e.set({ width: y }), e.initDimensions(), m = !0),
|
|
11429
|
+
g && (y = f), Math.abs((e.width ?? 0) - y) > .01 && (e.set({ width: y }), e.initDimensions(), m = !0), oa({ textbox: e }) && (m = !0), t && r.applyObjectPlacement({
|
|
11406
11430
|
object: e,
|
|
11407
11431
|
placement: t
|
|
11408
11432
|
});
|
|
11409
11433
|
let b = !1;
|
|
11410
|
-
return n && (b =
|
|
11434
|
+
return n && (b = ra({
|
|
11411
11435
|
textbox: e,
|
|
11412
11436
|
montageLeft: o,
|
|
11413
11437
|
montageRight: o + s
|
|
@@ -11465,7 +11489,7 @@ var Ha = class {
|
|
|
11465
11489
|
_getDefaultFontFamily() {
|
|
11466
11490
|
return this.fonts[0]?.family ?? "Arial";
|
|
11467
11491
|
}
|
|
11468
|
-
},
|
|
11492
|
+
}, Ka = ({ x1: e, y1: t, x2: n, y2: r }) => (Math.atan2(r - t, n - e) * 180 / Math.PI + 360) % 360, qa = (e) => {
|
|
11469
11493
|
if (!e || typeof e != "object") return null;
|
|
11470
11494
|
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) => ({
|
|
11471
11495
|
color: typeof e.color == "string" ? e.color : "#000000",
|
|
@@ -11476,7 +11500,7 @@ var Ha = class {
|
|
|
11476
11500
|
let { x1: e, y1: t, x2: r, y2: i } = n;
|
|
11477
11501
|
if (typeof e == "number" && typeof t == "number" && typeof r == "number" && typeof i == "number") return {
|
|
11478
11502
|
type: "linear",
|
|
11479
|
-
angle:
|
|
11503
|
+
angle: Ka({
|
|
11480
11504
|
x1: e,
|
|
11481
11505
|
y1: t,
|
|
11482
11506
|
x2: r,
|
|
@@ -11504,7 +11528,7 @@ var Ha = class {
|
|
|
11504
11528
|
};
|
|
11505
11529
|
}
|
|
11506
11530
|
return null;
|
|
11507
|
-
},
|
|
11531
|
+
}, Ja = "_templateAnchorX", Ya = "_templateAnchorY", Xa = class t {
|
|
11508
11532
|
constructor({ editor: e }) {
|
|
11509
11533
|
this.editor = e;
|
|
11510
11534
|
}
|
|
@@ -11513,7 +11537,7 @@ var Ha = class {
|
|
|
11513
11537
|
if (!p.length) return s.emitWarning({
|
|
11514
11538
|
origin: "TemplateManager",
|
|
11515
11539
|
method: "serializeSelection",
|
|
11516
|
-
code:
|
|
11540
|
+
code: Ca.TEMPLATE_MANAGER.NO_OBJECTS_SELECTED,
|
|
11517
11541
|
message: "Нет объектов для сериализации шаблона"
|
|
11518
11542
|
}), null;
|
|
11519
11543
|
let m = t._getBounds(o), h = t._getMontageSize({
|
|
@@ -11542,14 +11566,14 @@ var Ha = class {
|
|
|
11542
11566
|
if (!l?.length) return a.emitWarning({
|
|
11543
11567
|
origin: "TemplateManager",
|
|
11544
11568
|
method: "applyTemplate",
|
|
11545
|
-
code:
|
|
11569
|
+
code: Ca.TEMPLATE_MANAGER.INVALID_TEMPLATE,
|
|
11546
11570
|
message: "Шаблон не содержит объектов"
|
|
11547
11571
|
}), null;
|
|
11548
11572
|
let f = t._getBounds(r);
|
|
11549
11573
|
if (!f) return a.emitWarning({
|
|
11550
11574
|
origin: "TemplateManager",
|
|
11551
11575
|
method: "applyTemplate",
|
|
11552
|
-
code:
|
|
11576
|
+
code: Ca.TEMPLATE_MANAGER.INVALID_TARGET,
|
|
11553
11577
|
message: "Не удалось определить границы монтажной области"
|
|
11554
11578
|
}), null;
|
|
11555
11579
|
let p = t._getMontageSize({
|
|
@@ -11568,7 +11592,7 @@ var Ha = class {
|
|
|
11568
11592
|
if (!r.length) return a.emitWarning({
|
|
11569
11593
|
origin: "TemplateManager",
|
|
11570
11594
|
method: "applyTemplate",
|
|
11571
|
-
code:
|
|
11595
|
+
code: Ca.TEMPLATE_MANAGER.INVALID_TEMPLATE,
|
|
11572
11596
|
message: "Не удалось создать объекты шаблона"
|
|
11573
11597
|
}), null;
|
|
11574
11598
|
let { backgroundObject: i, contentObjects: u } = t._extractBackgroundObject(r);
|
|
@@ -11590,7 +11614,7 @@ var Ha = class {
|
|
|
11590
11614
|
}), c.commitStandaloneTextScale({ target: e }), s.commitRehydratedShapeLayout({
|
|
11591
11615
|
target: e,
|
|
11592
11616
|
textScale: h
|
|
11593
|
-
}), Ut({ object: e }),
|
|
11617
|
+
}), Ut({ object: e }), _a({ rootObject: e }), n.add(e), e));
|
|
11594
11618
|
return !d.length && !v ? null : (_ = d.length > 0 || v, d.length && t._activateObjects({
|
|
11595
11619
|
canvas: n,
|
|
11596
11620
|
objects: d
|
|
@@ -11603,7 +11627,7 @@ var Ha = class {
|
|
|
11603
11627
|
return a.emitError({
|
|
11604
11628
|
origin: "TemplateManager",
|
|
11605
11629
|
method: "applyTemplate",
|
|
11606
|
-
code:
|
|
11630
|
+
code: Ca.TEMPLATE_MANAGER.APPLY_FAILED,
|
|
11607
11631
|
message: "Ошибка применения шаблона",
|
|
11608
11632
|
data: {
|
|
11609
11633
|
templateId: d,
|
|
@@ -11760,8 +11784,8 @@ var Ha = class {
|
|
|
11760
11784
|
baseHeight: a,
|
|
11761
11785
|
scale: n,
|
|
11762
11786
|
useRelativePositions: o,
|
|
11763
|
-
anchorX: t._resolveAnchor(s,
|
|
11764
|
-
anchorY: t._resolveAnchor(s,
|
|
11787
|
+
anchorX: t._resolveAnchor(s, Ja),
|
|
11788
|
+
anchorY: t._resolveAnchor(s, Ya)
|
|
11765
11789
|
})
|
|
11766
11790
|
}), h = f * n, g = p * n, _ = e.originX ?? "center", v = e.originY ?? "center";
|
|
11767
11791
|
e.set({
|
|
@@ -11836,7 +11860,7 @@ var Ha = class {
|
|
|
11836
11860
|
});
|
|
11837
11861
|
if (!i || !a) return;
|
|
11838
11862
|
e.setCoords();
|
|
11839
|
-
let o = e, s = t._resolveAnchor(o,
|
|
11863
|
+
let o = e, s = t._resolveAnchor(o, Ja), c = typeof e.left == "number" ? e.left : null, l = e.originX ?? "center", u = e.originY ?? "center", d = e.getPointByOrigin(l, u), f = t._getBoundingRect(e), p = f.left + f.width / 2, m = f.left + f.width;
|
|
11840
11864
|
e.set("width", i), e.initDimensions();
|
|
11841
11865
|
let h = t._getLongestLineWidth({
|
|
11842
11866
|
textbox: e,
|
|
@@ -11865,10 +11889,10 @@ var Ha = class {
|
|
|
11865
11889
|
x: (p.left - o) / d,
|
|
11866
11890
|
y: (p.top - s) / f
|
|
11867
11891
|
}, h = (u.left - o) / d, g = (u.top - s) / f, _ = h + u.width / d, v = g + u.height / f;
|
|
11868
|
-
return a[
|
|
11892
|
+
return a[Ja] = t._detectAnchor({
|
|
11869
11893
|
start: h,
|
|
11870
11894
|
end: _
|
|
11871
|
-
}), a[
|
|
11895
|
+
}), a[Ya] = t._detectAnchor({
|
|
11872
11896
|
start: g,
|
|
11873
11897
|
end: v
|
|
11874
11898
|
}), a.left = m.x, a.top = m.y, a;
|
|
@@ -11893,7 +11917,7 @@ var Ha = class {
|
|
|
11893
11917
|
withoutSave: !0
|
|
11894
11918
|
}), !0;
|
|
11895
11919
|
if (a === "gradient") {
|
|
11896
|
-
let e =
|
|
11920
|
+
let e = qa(r);
|
|
11897
11921
|
if (e) return n.setGradientBackground({
|
|
11898
11922
|
gradient: e,
|
|
11899
11923
|
customData: o,
|
|
@@ -11914,7 +11938,7 @@ var Ha = class {
|
|
|
11914
11938
|
r.emitWarning({
|
|
11915
11939
|
origin: "TemplateManager",
|
|
11916
11940
|
method: "applyTemplate",
|
|
11917
|
-
code:
|
|
11941
|
+
code: Ca.TEMPLATE_MANAGER.APPLY_FAILED,
|
|
11918
11942
|
message: "Не удалось применить фон из шаблона",
|
|
11919
11943
|
data: e
|
|
11920
11944
|
});
|
|
@@ -11950,29 +11974,29 @@ var Ha = class {
|
|
|
11950
11974
|
enlivenObjectEnlivables(e) {
|
|
11951
11975
|
return w.enlivenObjectEnlivables(e);
|
|
11952
11976
|
}
|
|
11953
|
-
},
|
|
11954
|
-
let n =
|
|
11977
|
+
}, Za = "#3D8BF4", Qa = .5, $a = ({ distance: e }) => Number.isFinite(e) ? Math.round(Math.max(0, e)) : 0, eo = ({ firstDistance: e, secondDistance: t }) => {
|
|
11978
|
+
let n = $a({ distance: e }), r = $a({ distance: t });
|
|
11955
11979
|
return {
|
|
11956
11980
|
firstDisplayDistance: n,
|
|
11957
11981
|
secondDisplayDistance: r,
|
|
11958
11982
|
displayDistanceDiff: Math.abs(n - r),
|
|
11959
11983
|
commonDisplayDistance: Math.max(n, r)
|
|
11960
11984
|
};
|
|
11961
|
-
},
|
|
11985
|
+
}, to = ({ firstStart: e, firstEnd: t, secondStart: n, secondEnd: r }) => Math.min(t, r) - Math.max(e, n), no = ({ step: e }) => {
|
|
11962
11986
|
let t = Math.abs(e).toString(), n = t.indexOf(".");
|
|
11963
11987
|
return n === -1 ? 0 : t.slice(n + 1).length;
|
|
11964
|
-
},
|
|
11988
|
+
}, ro = ({ value: e, step: t }) => {
|
|
11965
11989
|
if (t === 0) return e;
|
|
11966
|
-
let n =
|
|
11990
|
+
let n = no({ step: t }), r = Math.round(e / t) * t;
|
|
11967
11991
|
return Number(r.toFixed(n));
|
|
11968
|
-
},
|
|
11992
|
+
}, io = ({ value: e, step: t }) => {
|
|
11969
11993
|
if (t === 0) return !0;
|
|
11970
|
-
let n =
|
|
11994
|
+
let n = ro({
|
|
11971
11995
|
value: e,
|
|
11972
11996
|
step: t
|
|
11973
|
-
}), r = 10 ** -(
|
|
11997
|
+
}), r = 10 ** -(no({ step: t }) + 4);
|
|
11974
11998
|
return Math.abs(n - e) <= r;
|
|
11975
|
-
},
|
|
11999
|
+
}, ao = ({ bounds: e, axis: t }) => {
|
|
11976
12000
|
let { left: n = 0, right: r = 0, top: i = 0, bottom: a = 0 } = e;
|
|
11977
12001
|
return t === "vertical" ? {
|
|
11978
12002
|
start: i,
|
|
@@ -11981,7 +12005,7 @@ var Ha = class {
|
|
|
11981
12005
|
start: n,
|
|
11982
12006
|
end: r
|
|
11983
12007
|
};
|
|
11984
|
-
},
|
|
12008
|
+
}, oo = ({ items: e, axis: t }) => {
|
|
11985
12009
|
for (let n = 1; n < e.length; n += 1) {
|
|
11986
12010
|
let r = e[n], { bounds: i } = r, a = i[t], o = n - 1;
|
|
11987
12011
|
for (; o >= 0;) {
|
|
@@ -11991,10 +12015,10 @@ var Ha = class {
|
|
|
11991
12015
|
}
|
|
11992
12016
|
e[o + 1] = r;
|
|
11993
12017
|
}
|
|
11994
|
-
},
|
|
12018
|
+
}, so = ({ items: e, index: t, axis: n, direction: r }) => {
|
|
11995
12019
|
let i = e[t];
|
|
11996
12020
|
if (!i) return null;
|
|
11997
|
-
let { bounds: a } = i, { start: o, end: s } =
|
|
12021
|
+
let { bounds: a } = i, { start: o, end: s } = ao({
|
|
11998
12022
|
bounds: a,
|
|
11999
12023
|
axis: n
|
|
12000
12024
|
});
|
|
@@ -12002,7 +12026,7 @@ var Ha = class {
|
|
|
12002
12026
|
for (let r = t - 1; r >= 0; --r) {
|
|
12003
12027
|
let t = e[r];
|
|
12004
12028
|
if (!t) continue;
|
|
12005
|
-
let { bounds: i } = t, { end: a } =
|
|
12029
|
+
let { bounds: i } = t, { end: a } = ao({
|
|
12006
12030
|
bounds: i,
|
|
12007
12031
|
axis: n
|
|
12008
12032
|
});
|
|
@@ -12013,26 +12037,26 @@ var Ha = class {
|
|
|
12013
12037
|
for (let r = t + 1; r < e.length; r += 1) {
|
|
12014
12038
|
let t = e[r];
|
|
12015
12039
|
if (!t) continue;
|
|
12016
|
-
let { bounds: i } = t, { start: a } =
|
|
12040
|
+
let { bounds: i } = t, { start: a } = ao({
|
|
12017
12041
|
bounds: i,
|
|
12018
12042
|
axis: n
|
|
12019
12043
|
});
|
|
12020
12044
|
if (a - s >= 0) return r;
|
|
12021
12045
|
}
|
|
12022
12046
|
return null;
|
|
12023
|
-
},
|
|
12047
|
+
}, co = ({ items: e }) => {
|
|
12024
12048
|
for (let t = 0; t < e.length; t += 1) {
|
|
12025
12049
|
let { isActive: n } = e[t];
|
|
12026
12050
|
if (n) return t;
|
|
12027
12051
|
}
|
|
12028
12052
|
return -1;
|
|
12029
|
-
},
|
|
12053
|
+
}, lo = ({ patternAxis: e, activeRangeStart: t, activeRangeEnd: n, tolerance: r = 0 }) => {
|
|
12030
12054
|
let i = Math.min(t, n), a = Math.max(t, n);
|
|
12031
12055
|
return e >= i - r && e <= a + r;
|
|
12032
|
-
},
|
|
12056
|
+
}, uo = ({ patternStart: e, patternEnd: t, activeStart: n, activeEnd: r }) => t <= n ? "before" : e >= r ? "after" : null, fo = ({ baseOption: e, candidateOption: t }) => {
|
|
12033
12057
|
let { delta: n, guide: { distance: r } } = e, { delta: i, guide: { distance: a } } = t;
|
|
12034
12058
|
return n === i && r === a;
|
|
12035
|
-
},
|
|
12059
|
+
}, po = ({ options: e }) => {
|
|
12036
12060
|
let t = e[0];
|
|
12037
12061
|
for (let n = 1; n < e.length; n += 1) {
|
|
12038
12062
|
let r = e[n];
|
|
@@ -12043,11 +12067,11 @@ var Ha = class {
|
|
|
12043
12067
|
r.diff === t.diff && Math.abs(r.delta) < Math.abs(t.delta) && (t = r);
|
|
12044
12068
|
}
|
|
12045
12069
|
return t;
|
|
12046
|
-
},
|
|
12070
|
+
}, mo = ({ currentOption: e, nextOption: t }) => {
|
|
12047
12071
|
if (!e) return !0;
|
|
12048
12072
|
let { contextDistance: n, diff: r, delta: i } = e, { contextDistance: a, diff: o, delta: s } = t;
|
|
12049
12073
|
return a < n ? !0 : a > n ? !1 : o < r ? !0 : o > r ? !1 : Math.abs(s) < Math.abs(i);
|
|
12050
|
-
},
|
|
12074
|
+
}, ho = ({ options: e }) => {
|
|
12051
12075
|
let t = [], n = null, r = null;
|
|
12052
12076
|
for (let i of e) {
|
|
12053
12077
|
let { kind: e, side: a } = i;
|
|
@@ -12055,18 +12079,18 @@ var Ha = class {
|
|
|
12055
12079
|
t.push(i);
|
|
12056
12080
|
continue;
|
|
12057
12081
|
}
|
|
12058
|
-
a === "before" &&
|
|
12082
|
+
a === "before" && mo({
|
|
12059
12083
|
currentOption: n,
|
|
12060
12084
|
nextOption: i
|
|
12061
|
-
}) && (n = i), a === "after" &&
|
|
12085
|
+
}) && (n = i), a === "after" && mo({
|
|
12062
12086
|
currentOption: r,
|
|
12063
12087
|
nextOption: i
|
|
12064
12088
|
}) && (r = i);
|
|
12065
12089
|
}
|
|
12066
12090
|
return n && t.push(n), r && t.push(r), t;
|
|
12067
|
-
},
|
|
12091
|
+
}, go = ({ options: e, side: t, baseOption: n }) => {
|
|
12068
12092
|
let r = null;
|
|
12069
|
-
for (let i of e) if (i.side === t &&
|
|
12093
|
+
for (let i of e) if (i.side === t && fo({
|
|
12070
12094
|
baseOption: n,
|
|
12071
12095
|
candidateOption: i
|
|
12072
12096
|
})) {
|
|
@@ -12077,63 +12101,63 @@ var Ha = class {
|
|
|
12077
12101
|
!r || i.diff !== r.diff || Math.abs(i.delta) < Math.abs(r.delta) && (r = i);
|
|
12078
12102
|
}
|
|
12079
12103
|
return r;
|
|
12080
|
-
},
|
|
12104
|
+
}, _o = ({ option: e }) => {
|
|
12081
12105
|
let { side: t, kind: n, guide: { distance: r } } = e;
|
|
12082
12106
|
return {
|
|
12083
12107
|
side: t,
|
|
12084
12108
|
kind: n,
|
|
12085
12109
|
distance: r
|
|
12086
12110
|
};
|
|
12087
|
-
},
|
|
12111
|
+
}, vo = ({ option: e, context: t }) => {
|
|
12088
12112
|
let { side: n, kind: r, distance: i } = t, { side: a, kind: o, guide: { distance: s } } = e;
|
|
12089
12113
|
return n !== a || r !== o ? !1 : Math.abs(s - i) <= 1;
|
|
12090
|
-
},
|
|
12114
|
+
}, yo = ({ options: e, context: t }) => {
|
|
12091
12115
|
if (!t) return null;
|
|
12092
|
-
for (let n of e) if (
|
|
12116
|
+
for (let n of e) if (vo({
|
|
12093
12117
|
option: n,
|
|
12094
12118
|
context: t
|
|
12095
12119
|
})) return n;
|
|
12096
12120
|
return null;
|
|
12097
|
-
},
|
|
12098
|
-
let i =
|
|
12121
|
+
}, bo = ({ options: e, bestOption: t, previousContext: n, switchDistance: r = 0 }) => {
|
|
12122
|
+
let i = yo({
|
|
12099
12123
|
options: e,
|
|
12100
12124
|
context: n
|
|
12101
12125
|
});
|
|
12102
12126
|
if (!i) return t;
|
|
12103
12127
|
let a = Math.max(0, r);
|
|
12104
12128
|
return a === 0 || Math.abs(t.delta - i.delta) >= a ? t : i;
|
|
12105
|
-
},
|
|
12129
|
+
}, xo = ({ guides: e, seenGuideKeys: t, guide: n }) => {
|
|
12106
12130
|
let { type: r, axis: i, refStart: a, refEnd: o, activeStart: s, activeEnd: c, distance: l } = n, u = `${r}:${i}:${a}:${o}:${s}:${c}:${l}`;
|
|
12107
12131
|
t.has(u) || (t.add(u), e.push(n));
|
|
12108
|
-
},
|
|
12132
|
+
}, So = ({ options: e, previousContext: t = null, switchDistance: n = 0 }) => {
|
|
12109
12133
|
if (!e.length) return {
|
|
12110
12134
|
delta: 0,
|
|
12111
12135
|
guides: [],
|
|
12112
12136
|
context: null
|
|
12113
12137
|
};
|
|
12114
|
-
let r =
|
|
12138
|
+
let r = ho({ options: e }), i = [];
|
|
12115
12139
|
for (let e of r) e.kind === "reference" && i.push(e);
|
|
12116
|
-
let a = i.length > 0, o = a ? i : r, s =
|
|
12140
|
+
let a = i.length > 0, o = a ? i : r, s = bo({
|
|
12117
12141
|
options: o,
|
|
12118
|
-
bestOption:
|
|
12142
|
+
bestOption: po({ options: o }),
|
|
12119
12143
|
previousContext: t,
|
|
12120
12144
|
switchDistance: n
|
|
12121
|
-
}), c =
|
|
12145
|
+
}), c = go({
|
|
12122
12146
|
options: o,
|
|
12123
12147
|
side: "before",
|
|
12124
12148
|
baseOption: s
|
|
12125
|
-
}), l =
|
|
12149
|
+
}), l = go({
|
|
12126
12150
|
options: o,
|
|
12127
12151
|
side: "after",
|
|
12128
12152
|
baseOption: s
|
|
12129
|
-
}), u =
|
|
12153
|
+
}), u = go({
|
|
12130
12154
|
options: a ? r : o,
|
|
12131
12155
|
side: "center",
|
|
12132
12156
|
baseOption: s
|
|
12133
12157
|
}), d = [];
|
|
12134
12158
|
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);
|
|
12135
12159
|
let f = [], p = /* @__PURE__ */ new Set();
|
|
12136
|
-
for (let e of d)
|
|
12160
|
+
for (let e of d) xo({
|
|
12137
12161
|
guides: f,
|
|
12138
12162
|
seenGuideKeys: p,
|
|
12139
12163
|
guide: e.guide
|
|
@@ -12141,15 +12165,15 @@ var Ha = class {
|
|
|
12141
12165
|
return {
|
|
12142
12166
|
delta: s.delta,
|
|
12143
12167
|
guides: f,
|
|
12144
|
-
context:
|
|
12168
|
+
context: _o({ option: s })
|
|
12145
12169
|
};
|
|
12146
|
-
},
|
|
12147
|
-
let s = n - (e - r), c =
|
|
12170
|
+
}, Co = ({ activeStart: e, activeEnd: t, targetGap: n, beforeEdge: r, afterEdge: i, threshold: a, step: o }) => {
|
|
12171
|
+
let s = n - (e - r), c = ro({
|
|
12148
12172
|
value: s,
|
|
12149
12173
|
step: o
|
|
12150
12174
|
}), l = Math.max(1, Math.ceil(a / Math.max(o, 1))), u = null;
|
|
12151
12175
|
for (let d = -l; d <= l; d += 1) {
|
|
12152
|
-
let l = c + d * o, f = e + l, p = t + l, m = f - r, h = i - p, { displayDistanceDiff: g, commonDisplayDistance: _ } =
|
|
12176
|
+
let l = c + d * o, f = e + l, p = t + l, m = f - r, h = i - p, { displayDistanceDiff: g, commonDisplayDistance: _ } = eo({
|
|
12153
12177
|
firstDistance: m,
|
|
12154
12178
|
secondDistance: h
|
|
12155
12179
|
});
|
|
@@ -12164,13 +12188,13 @@ var Ha = class {
|
|
|
12164
12188
|
});
|
|
12165
12189
|
}
|
|
12166
12190
|
return u;
|
|
12167
|
-
},
|
|
12168
|
-
let { secondDisplayDistance: n, displayDistanceDiff: r } =
|
|
12191
|
+
}, wo = ({ currentGap: e, referenceGap: t }) => {
|
|
12192
|
+
let { secondDisplayDistance: n, displayDistanceDiff: r } = eo({
|
|
12169
12193
|
firstDistance: e,
|
|
12170
12194
|
secondDistance: t
|
|
12171
12195
|
});
|
|
12172
12196
|
return r > 1 ? null : n;
|
|
12173
|
-
},
|
|
12197
|
+
}, To = ({ anchors: e, positions: t, threshold: n }) => {
|
|
12174
12198
|
let r = 0, i = n + 1, a = null;
|
|
12175
12199
|
for (let o of t) for (let t of e) {
|
|
12176
12200
|
let e = Math.abs(t - o);
|
|
@@ -12180,8 +12204,8 @@ var Ha = class {
|
|
|
12180
12204
|
delta: r,
|
|
12181
12205
|
guidePosition: a
|
|
12182
12206
|
};
|
|
12183
|
-
},
|
|
12184
|
-
let { left: r, right: i, centerX: a, top: o, bottom: s, centerY: c } = e, l =
|
|
12207
|
+
}, Eo = ({ activeBounds: e, threshold: t, anchors: n }) => {
|
|
12208
|
+
let { left: r, right: i, centerX: a, top: o, bottom: s, centerY: c } = e, l = To({
|
|
12185
12209
|
anchors: n.vertical,
|
|
12186
12210
|
positions: [
|
|
12187
12211
|
r,
|
|
@@ -12189,7 +12213,7 @@ var Ha = class {
|
|
|
12189
12213
|
i
|
|
12190
12214
|
],
|
|
12191
12215
|
threshold: t
|
|
12192
|
-
}), u =
|
|
12216
|
+
}), u = To({
|
|
12193
12217
|
anchors: n.horizontal,
|
|
12194
12218
|
positions: [
|
|
12195
12219
|
o,
|
|
@@ -12209,11 +12233,11 @@ var Ha = class {
|
|
|
12209
12233
|
deltaY: u.delta,
|
|
12210
12234
|
guides: d
|
|
12211
12235
|
};
|
|
12212
|
-
},
|
|
12236
|
+
}, Do = ({ activeBounds: e, candidates: t, threshold: n, patterns: r, previousContext: i = null, switchDistance: a = 0 }) => {
|
|
12213
12237
|
let { centerX: o, top: s, bottom: c, left: l, right: u } = e, d = [];
|
|
12214
12238
|
for (let e of t) {
|
|
12215
12239
|
let { left: t, right: n } = e;
|
|
12216
|
-
|
|
12240
|
+
to({
|
|
12217
12241
|
firstStart: t,
|
|
12218
12242
|
firstEnd: n,
|
|
12219
12243
|
secondStart: l,
|
|
@@ -12233,22 +12257,22 @@ var Ha = class {
|
|
|
12233
12257
|
f.push({
|
|
12234
12258
|
bounds: e,
|
|
12235
12259
|
isActive: !0
|
|
12236
|
-
}),
|
|
12260
|
+
}), oo({
|
|
12237
12261
|
items: f,
|
|
12238
12262
|
axis: "top"
|
|
12239
12263
|
});
|
|
12240
|
-
let p =
|
|
12264
|
+
let p = co({ items: f });
|
|
12241
12265
|
if (p === -1) return {
|
|
12242
12266
|
delta: 0,
|
|
12243
12267
|
guides: [],
|
|
12244
12268
|
context: null
|
|
12245
12269
|
};
|
|
12246
|
-
let m = [], h = c - s, g =
|
|
12270
|
+
let m = [], h = c - s, g = so({
|
|
12247
12271
|
items: f,
|
|
12248
12272
|
index: p,
|
|
12249
12273
|
axis: "vertical",
|
|
12250
12274
|
direction: "prev"
|
|
12251
|
-
}), _ =
|
|
12275
|
+
}), _ = so({
|
|
12252
12276
|
items: f,
|
|
12253
12277
|
index: p,
|
|
12254
12278
|
axis: "vertical",
|
|
@@ -12257,19 +12281,19 @@ var Ha = class {
|
|
|
12257
12281
|
if (v && y) {
|
|
12258
12282
|
let { bounds: e } = v, { bounds: t } = y, { bottom: r } = e, { top: i } = t, a = i - r - h;
|
|
12259
12283
|
if (a >= 0) {
|
|
12260
|
-
let e =
|
|
12284
|
+
let e = ro({
|
|
12261
12285
|
value: a / 2,
|
|
12262
12286
|
step: 1
|
|
12263
12287
|
}), t = s - r, l = i - c, u = Math.abs(t - e), d = Math.abs(l - e);
|
|
12264
12288
|
if (Math.max(u, d) <= n) {
|
|
12265
|
-
let t =
|
|
12289
|
+
let t = Co({
|
|
12266
12290
|
activeStart: s,
|
|
12267
12291
|
activeEnd: c,
|
|
12268
12292
|
targetGap: e,
|
|
12269
12293
|
beforeEdge: r,
|
|
12270
12294
|
afterEdge: i,
|
|
12271
12295
|
threshold: n,
|
|
12272
|
-
step:
|
|
12296
|
+
step: Qa
|
|
12273
12297
|
});
|
|
12274
12298
|
if (t) {
|
|
12275
12299
|
let { delta: e, distance: n, diff: i, activeStart: a, activeEnd: s } = t, c = {
|
|
@@ -12306,16 +12330,16 @@ var Ha = class {
|
|
|
12306
12330
|
}
|
|
12307
12331
|
for (let e of r) {
|
|
12308
12332
|
let { axis: t, start: r, end: i, distance: a } = e;
|
|
12309
|
-
if (!
|
|
12333
|
+
if (!io({
|
|
12310
12334
|
value: a,
|
|
12311
12335
|
step: .5
|
|
12312
|
-
}) || !
|
|
12336
|
+
}) || !lo({
|
|
12313
12337
|
patternAxis: t,
|
|
12314
12338
|
activeRangeStart: l,
|
|
12315
12339
|
activeRangeEnd: u,
|
|
12316
12340
|
tolerance: n
|
|
12317
12341
|
})) continue;
|
|
12318
|
-
let d =
|
|
12342
|
+
let d = uo({
|
|
12319
12343
|
patternStart: r,
|
|
12320
12344
|
patternEnd: i,
|
|
12321
12345
|
activeStart: s,
|
|
@@ -12323,12 +12347,12 @@ var Ha = class {
|
|
|
12323
12347
|
});
|
|
12324
12348
|
if (d) {
|
|
12325
12349
|
if (b !== null && S && d === "before" && Math.abs(b - a) <= n) {
|
|
12326
|
-
let e =
|
|
12350
|
+
let e = ro({
|
|
12327
12351
|
value: a - b,
|
|
12328
12352
|
step: 1
|
|
12329
12353
|
}), t = s + e, { bottom: c } = S, l = t - c, u = Math.abs(l - a);
|
|
12330
12354
|
if (u > n) continue;
|
|
12331
|
-
let d =
|
|
12355
|
+
let d = wo({
|
|
12332
12356
|
currentGap: l,
|
|
12333
12357
|
referenceGap: a
|
|
12334
12358
|
});
|
|
@@ -12352,12 +12376,12 @@ var Ha = class {
|
|
|
12352
12376
|
});
|
|
12353
12377
|
}
|
|
12354
12378
|
if (x !== null && C && d === "after" && Math.abs(x - a) <= n) {
|
|
12355
|
-
let e =
|
|
12379
|
+
let e = ro({
|
|
12356
12380
|
value: x - a,
|
|
12357
12381
|
step: 1
|
|
12358
12382
|
}), t = c + e, { top: s } = C, l = s - t, u = Math.abs(l - a);
|
|
12359
12383
|
if (u > n) continue;
|
|
12360
|
-
let d =
|
|
12384
|
+
let d = wo({
|
|
12361
12385
|
currentGap: l,
|
|
12362
12386
|
referenceGap: a
|
|
12363
12387
|
});
|
|
@@ -12382,16 +12406,16 @@ var Ha = class {
|
|
|
12382
12406
|
}
|
|
12383
12407
|
}
|
|
12384
12408
|
}
|
|
12385
|
-
return
|
|
12409
|
+
return So({
|
|
12386
12410
|
options: m,
|
|
12387
12411
|
previousContext: i,
|
|
12388
12412
|
switchDistance: a
|
|
12389
12413
|
});
|
|
12390
|
-
},
|
|
12414
|
+
}, Oo = ({ activeBounds: e, candidates: t, threshold: n, patterns: r, previousContext: i = null, switchDistance: a = 0 }) => {
|
|
12391
12415
|
let { centerY: o, left: s, right: c, top: l, bottom: u } = e, d = [];
|
|
12392
12416
|
for (let e of t) {
|
|
12393
12417
|
let { top: t, bottom: n } = e;
|
|
12394
|
-
|
|
12418
|
+
to({
|
|
12395
12419
|
firstStart: t,
|
|
12396
12420
|
firstEnd: n,
|
|
12397
12421
|
secondStart: l,
|
|
@@ -12411,22 +12435,22 @@ var Ha = class {
|
|
|
12411
12435
|
f.push({
|
|
12412
12436
|
bounds: e,
|
|
12413
12437
|
isActive: !0
|
|
12414
|
-
}),
|
|
12438
|
+
}), oo({
|
|
12415
12439
|
items: f,
|
|
12416
12440
|
axis: "left"
|
|
12417
12441
|
});
|
|
12418
|
-
let p =
|
|
12442
|
+
let p = co({ items: f });
|
|
12419
12443
|
if (p === -1) return {
|
|
12420
12444
|
delta: 0,
|
|
12421
12445
|
guides: [],
|
|
12422
12446
|
context: null
|
|
12423
12447
|
};
|
|
12424
|
-
let m = [], h = c - s, g =
|
|
12448
|
+
let m = [], h = c - s, g = so({
|
|
12425
12449
|
items: f,
|
|
12426
12450
|
index: p,
|
|
12427
12451
|
axis: "horizontal",
|
|
12428
12452
|
direction: "prev"
|
|
12429
|
-
}), _ =
|
|
12453
|
+
}), _ = so({
|
|
12430
12454
|
items: f,
|
|
12431
12455
|
index: p,
|
|
12432
12456
|
axis: "horizontal",
|
|
@@ -12435,19 +12459,19 @@ var Ha = class {
|
|
|
12435
12459
|
if (v && y) {
|
|
12436
12460
|
let { bounds: e } = v, { bounds: t } = y, { right: r } = e, { left: i } = t, a = i - r - h;
|
|
12437
12461
|
if (a >= 0) {
|
|
12438
|
-
let e =
|
|
12462
|
+
let e = ro({
|
|
12439
12463
|
value: a / 2,
|
|
12440
12464
|
step: 1
|
|
12441
12465
|
}), t = s - r, l = i - c, u = Math.abs(t - e), d = Math.abs(l - e);
|
|
12442
12466
|
if (Math.max(u, d) <= n) {
|
|
12443
|
-
let t =
|
|
12467
|
+
let t = Co({
|
|
12444
12468
|
activeStart: s,
|
|
12445
12469
|
activeEnd: c,
|
|
12446
12470
|
targetGap: e,
|
|
12447
12471
|
beforeEdge: r,
|
|
12448
12472
|
afterEdge: i,
|
|
12449
12473
|
threshold: n,
|
|
12450
|
-
step:
|
|
12474
|
+
step: Qa
|
|
12451
12475
|
});
|
|
12452
12476
|
if (t) {
|
|
12453
12477
|
let { delta: e, distance: n, diff: i, activeStart: a, activeEnd: s } = t, c = {
|
|
@@ -12484,16 +12508,16 @@ var Ha = class {
|
|
|
12484
12508
|
}
|
|
12485
12509
|
for (let e of r) {
|
|
12486
12510
|
let { axis: t, start: r, end: i, distance: a } = e;
|
|
12487
|
-
if (!
|
|
12511
|
+
if (!io({
|
|
12488
12512
|
value: a,
|
|
12489
12513
|
step: .5
|
|
12490
|
-
}) || !
|
|
12514
|
+
}) || !lo({
|
|
12491
12515
|
patternAxis: t,
|
|
12492
12516
|
activeRangeStart: l,
|
|
12493
12517
|
activeRangeEnd: u,
|
|
12494
12518
|
tolerance: n
|
|
12495
12519
|
})) continue;
|
|
12496
|
-
let d =
|
|
12520
|
+
let d = uo({
|
|
12497
12521
|
patternStart: r,
|
|
12498
12522
|
patternEnd: i,
|
|
12499
12523
|
activeStart: s,
|
|
@@ -12501,12 +12525,12 @@ var Ha = class {
|
|
|
12501
12525
|
});
|
|
12502
12526
|
if (d) {
|
|
12503
12527
|
if (b !== null && S && d === "before" && Math.abs(b - a) <= n) {
|
|
12504
|
-
let e =
|
|
12528
|
+
let e = ro({
|
|
12505
12529
|
value: a - b,
|
|
12506
12530
|
step: 1
|
|
12507
12531
|
}), t = s + e, { right: c } = S, l = t - c, u = Math.abs(l - a);
|
|
12508
12532
|
if (u > n) continue;
|
|
12509
|
-
let d =
|
|
12533
|
+
let d = wo({
|
|
12510
12534
|
currentGap: l,
|
|
12511
12535
|
referenceGap: a
|
|
12512
12536
|
});
|
|
@@ -12530,12 +12554,12 @@ var Ha = class {
|
|
|
12530
12554
|
});
|
|
12531
12555
|
}
|
|
12532
12556
|
if (x !== null && C && d === "after" && Math.abs(x - a) <= n) {
|
|
12533
|
-
let e =
|
|
12557
|
+
let e = ro({
|
|
12534
12558
|
value: x - a,
|
|
12535
12559
|
step: 1
|
|
12536
12560
|
}), t = c + e, { left: s } = C, l = s - t, u = Math.abs(l - a);
|
|
12537
12561
|
if (u > n) continue;
|
|
12538
|
-
let d =
|
|
12562
|
+
let d = wo({
|
|
12539
12563
|
currentGap: l,
|
|
12540
12564
|
referenceGap: a
|
|
12541
12565
|
});
|
|
@@ -12560,20 +12584,20 @@ var Ha = class {
|
|
|
12560
12584
|
}
|
|
12561
12585
|
}
|
|
12562
12586
|
}
|
|
12563
|
-
return
|
|
12587
|
+
return So({
|
|
12564
12588
|
options: m,
|
|
12565
12589
|
previousContext: i,
|
|
12566
12590
|
switchDistance: a
|
|
12567
12591
|
});
|
|
12568
|
-
},
|
|
12569
|
-
let { vertical: o = null, horizontal: s = null } = i ?? {}, c =
|
|
12592
|
+
}, ko = ({ activeBounds: e, candidates: t, threshold: n, spacingPatterns: r, previousContexts: i, switchDistance: a = 0 }) => {
|
|
12593
|
+
let { vertical: o = null, horizontal: s = null } = i ?? {}, c = Do({
|
|
12570
12594
|
activeBounds: e,
|
|
12571
12595
|
candidates: t,
|
|
12572
12596
|
threshold: n,
|
|
12573
12597
|
patterns: r.vertical,
|
|
12574
12598
|
previousContext: o,
|
|
12575
12599
|
switchDistance: a
|
|
12576
|
-
}), l =
|
|
12600
|
+
}), l = Oo({
|
|
12577
12601
|
activeBounds: e,
|
|
12578
12602
|
candidates: t,
|
|
12579
12603
|
threshold: n,
|
|
@@ -12592,14 +12616,14 @@ var Ha = class {
|
|
|
12592
12616
|
horizontal: l.context
|
|
12593
12617
|
}
|
|
12594
12618
|
};
|
|
12595
|
-
},
|
|
12619
|
+
}, Ao = ({ context: e, x: t, y: n, width: r, height: i, radius: a }) => {
|
|
12596
12620
|
let o = Math.min(a, r / 2, i / 2);
|
|
12597
12621
|
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();
|
|
12598
|
-
},
|
|
12622
|
+
}, jo = ({ 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 }) => {
|
|
12599
12623
|
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;
|
|
12600
12624
|
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";
|
|
12601
12625
|
let S = e.measureText(a).width + _ * 2, C = g + _ * 2, w = b - S / 2, T = x - C / 2;
|
|
12602
|
-
e.beginPath(),
|
|
12626
|
+
e.beginPath(), Ao({
|
|
12603
12627
|
context: e,
|
|
12604
12628
|
x: w,
|
|
12605
12629
|
y: T,
|
|
@@ -12607,11 +12631,11 @@ var Ha = class {
|
|
|
12607
12631
|
height: C,
|
|
12608
12632
|
radius: v
|
|
12609
12633
|
}), e.fill(), e.fillStyle = c, e.fillText(a, b, x), e.restore();
|
|
12610
|
-
},
|
|
12611
|
-
let { type: r, axis: i, refStart: a, refEnd: o, activeStart: s, activeEnd: c, distance: l } = t, u =
|
|
12634
|
+
}, Mo = ({ context: e, guide: t, zoom: n }) => {
|
|
12635
|
+
let { type: r, axis: i, refStart: a, refEnd: o, activeStart: s, activeEnd: c, distance: l } = t, u = $a({ distance: l }).toString();
|
|
12612
12636
|
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();
|
|
12613
|
-
let d =
|
|
12614
|
-
|
|
12637
|
+
let d = Za;
|
|
12638
|
+
jo({
|
|
12615
12639
|
context: e,
|
|
12616
12640
|
type: r,
|
|
12617
12641
|
axis: i,
|
|
@@ -12621,7 +12645,7 @@ var Ha = class {
|
|
|
12621
12645
|
zoom: n,
|
|
12622
12646
|
color: d,
|
|
12623
12647
|
lineWidth: 1
|
|
12624
|
-
}),
|
|
12648
|
+
}), jo({
|
|
12625
12649
|
context: e,
|
|
12626
12650
|
type: r,
|
|
12627
12651
|
axis: i,
|
|
@@ -12632,10 +12656,10 @@ var Ha = class {
|
|
|
12632
12656
|
color: d,
|
|
12633
12657
|
lineWidth: 1
|
|
12634
12658
|
});
|
|
12635
|
-
},
|
|
12659
|
+
}, No = ({ anchors: e, bounds: t }) => {
|
|
12636
12660
|
let { left: n, right: r, centerX: i, top: a, bottom: o, centerY: s } = t;
|
|
12637
12661
|
e.vertical.push(n, i, r), e.horizontal.push(a, s, o);
|
|
12638
|
-
},
|
|
12662
|
+
}, Po = ({ bounds: e, type: t, primaryStart: n, primaryEnd: r }) => {
|
|
12639
12663
|
let i = [], a = n === "top" ? "left" : "top", o = r === "bottom" ? "right" : "bottom", s = [...e].sort((e, t) => e[n] - t[n]);
|
|
12640
12664
|
for (let e = 0; e < s.length; e += 1) {
|
|
12641
12665
|
let c = s[e], l = null, u = Infinity;
|
|
@@ -12656,35 +12680,35 @@ var Ha = class {
|
|
|
12656
12680
|
});
|
|
12657
12681
|
}
|
|
12658
12682
|
return i;
|
|
12659
|
-
},
|
|
12660
|
-
vertical:
|
|
12683
|
+
}, Fo = ({ bounds: e }) => ({
|
|
12684
|
+
vertical: Po({
|
|
12661
12685
|
bounds: e,
|
|
12662
12686
|
axis: "centerX",
|
|
12663
12687
|
type: "vertical",
|
|
12664
12688
|
primaryStart: "top",
|
|
12665
12689
|
primaryEnd: "bottom"
|
|
12666
12690
|
}),
|
|
12667
|
-
horizontal:
|
|
12691
|
+
horizontal: Po({
|
|
12668
12692
|
bounds: e,
|
|
12669
12693
|
axis: "centerY",
|
|
12670
12694
|
type: "horizontal",
|
|
12671
12695
|
primaryStart: "left",
|
|
12672
12696
|
primaryEnd: "right"
|
|
12673
12697
|
})
|
|
12674
|
-
}),
|
|
12698
|
+
}), Io = [
|
|
12675
12699
|
"montage-area",
|
|
12676
12700
|
"background",
|
|
12677
12701
|
"interaction-blocker"
|
|
12678
|
-
],
|
|
12702
|
+
], Lo = ({ activeObject: t }) => {
|
|
12679
12703
|
let n = /* @__PURE__ */ new Set();
|
|
12680
12704
|
return t ? (n.add(t), t instanceof e && t.getObjects().forEach((e) => n.add(e)), n) : n;
|
|
12681
|
-
},
|
|
12705
|
+
}, Ro = ({ object: e, excluded: t, ignoredIds: n = Io }) => {
|
|
12682
12706
|
if (t.has(e)) return !0;
|
|
12683
12707
|
let { visible: r = !0 } = e;
|
|
12684
12708
|
if (!r) return !0;
|
|
12685
12709
|
let { id: i } = e;
|
|
12686
12710
|
return !!(i && n.includes(i));
|
|
12687
|
-
},
|
|
12711
|
+
}, zo = class e {
|
|
12688
12712
|
constructor({ editor: e }) {
|
|
12689
12713
|
this.anchors = {
|
|
12690
12714
|
vertical: [],
|
|
@@ -12737,7 +12761,7 @@ var Ha = class {
|
|
|
12737
12761
|
this._clearSpacingContexts(), this._clearGuides();
|
|
12738
12762
|
return;
|
|
12739
12763
|
}
|
|
12740
|
-
let { canvas: o } = this, s = o.getZoom() || 1, c = 5 / s, { deltaX: l, deltaY: u } =
|
|
12764
|
+
let { canvas: o } = this, s = o.getZoom() || 1, c = 5 / s, { deltaX: l, deltaY: u } = Eo({
|
|
12741
12765
|
activeBounds: a,
|
|
12742
12766
|
threshold: c,
|
|
12743
12767
|
anchors: this.anchors
|
|
@@ -12749,7 +12773,7 @@ var Ha = class {
|
|
|
12749
12773
|
top: t + u
|
|
12750
12774
|
}), n.setCoords(), a = G({ object: n }) ?? a;
|
|
12751
12775
|
}
|
|
12752
|
-
let d = this._resolveCurrentTargetBounds({ activeObject: n }), f = this.spacingContexts.vertical || this.spacingContexts.horizontal ? 10 / s : c, p =
|
|
12776
|
+
let d = this._resolveCurrentTargetBounds({ activeObject: n }), f = this.spacingContexts.vertical || this.spacingContexts.horizontal ? 10 / s : c, p = ko({
|
|
12753
12777
|
activeBounds: a,
|
|
12754
12778
|
candidates: d,
|
|
12755
12779
|
threshold: f,
|
|
@@ -12770,11 +12794,11 @@ var Ha = class {
|
|
|
12770
12794
|
target: n,
|
|
12771
12795
|
transform: i
|
|
12772
12796
|
});
|
|
12773
|
-
let h = G({ object: n }) ?? a, g =
|
|
12797
|
+
let h = G({ object: n }) ?? a, g = Eo({
|
|
12774
12798
|
activeBounds: h,
|
|
12775
12799
|
threshold: c,
|
|
12776
12800
|
anchors: this.anchors
|
|
12777
|
-
}), _ =
|
|
12801
|
+
}), _ = ko({
|
|
12778
12802
|
activeBounds: h,
|
|
12779
12803
|
candidates: d,
|
|
12780
12804
|
threshold: c,
|
|
@@ -13005,9 +13029,9 @@ var Ha = class {
|
|
|
13005
13029
|
let { canvas: e, guideBounds: t } = this, n = e.getSelectionContext();
|
|
13006
13030
|
if (!n) return;
|
|
13007
13031
|
let { left: r, right: i, top: a, bottom: o } = t ?? this._calculateViewportBounds(), { viewportTransform: s } = e, c = e.getZoom() || 1;
|
|
13008
|
-
n.save(), Array.isArray(s) && n.transform(...s), n.lineWidth = 1 / c, n.strokeStyle =
|
|
13032
|
+
n.save(), Array.isArray(s) && n.transform(...s), n.lineWidth = 1 / c, n.strokeStyle = Za, n.setLineDash([4, 4]);
|
|
13009
13033
|
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();
|
|
13010
|
-
for (let e of this.activeSpacingGuides)
|
|
13034
|
+
for (let e of this.activeSpacingGuides) Mo({
|
|
13011
13035
|
context: n,
|
|
13012
13036
|
guide: e,
|
|
13013
13037
|
zoom: c
|
|
@@ -13218,14 +13242,14 @@ var Ha = class {
|
|
|
13218
13242
|
}, r = [];
|
|
13219
13243
|
for (let e of t) {
|
|
13220
13244
|
let t = G({ object: e });
|
|
13221
|
-
t && (
|
|
13245
|
+
t && (No({
|
|
13222
13246
|
anchors: n,
|
|
13223
13247
|
bounds: t
|
|
13224
13248
|
}), r.push(t));
|
|
13225
13249
|
}
|
|
13226
13250
|
let { montageArea: i } = this.editor, a = G({ object: i });
|
|
13227
13251
|
if (a) {
|
|
13228
|
-
|
|
13252
|
+
No({
|
|
13229
13253
|
anchors: n,
|
|
13230
13254
|
bounds: a
|
|
13231
13255
|
});
|
|
@@ -13237,12 +13261,12 @@ var Ha = class {
|
|
|
13237
13261
|
bottom: i
|
|
13238
13262
|
};
|
|
13239
13263
|
} else this.guideBounds = this._calculateViewportBounds();
|
|
13240
|
-
this.anchors = n, this.spacingPatterns =
|
|
13264
|
+
this.anchors = n, this.spacingPatterns = Fo({ bounds: r }), this.cachedTargetBounds = r;
|
|
13241
13265
|
}
|
|
13242
13266
|
_collectTargets({ activeObject: e }) {
|
|
13243
|
-
let t =
|
|
13267
|
+
let t = Lo({ activeObject: e }), n = [];
|
|
13244
13268
|
return this.canvas.forEachObject((e) => {
|
|
13245
|
-
|
|
13269
|
+
Ro({
|
|
13246
13270
|
object: e,
|
|
13247
13271
|
excluded: t
|
|
13248
13272
|
}) || n.push(e);
|
|
@@ -13265,7 +13289,7 @@ var Ha = class {
|
|
|
13265
13289
|
bottom: (r - s) / a
|
|
13266
13290
|
};
|
|
13267
13291
|
}
|
|
13268
|
-
},
|
|
13292
|
+
}, Bo = "#3D8BF4", Vo = class e {
|
|
13269
13293
|
constructor({ editor: e }) {
|
|
13270
13294
|
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();
|
|
13271
13295
|
}
|
|
@@ -13358,8 +13382,8 @@ var Ha = class {
|
|
|
13358
13382
|
this.isTargetMontageArea = l, this.activeGuides = d, this._hideToolbar(), n.requestRenderAll();
|
|
13359
13383
|
}
|
|
13360
13384
|
static _resolveTarget({ event: e, activeObject: t }) {
|
|
13361
|
-
let { target: n } = e, r =
|
|
13362
|
-
return n && !
|
|
13385
|
+
let { target: n } = e, r = Lo({ activeObject: t });
|
|
13386
|
+
return n && !Ro({
|
|
13363
13387
|
object: n,
|
|
13364
13388
|
excluded: r
|
|
13365
13389
|
}) ? n : null;
|
|
@@ -13476,18 +13500,18 @@ var Ha = class {
|
|
|
13476
13500
|
let { canvas: e } = this, t = e.getSelectionContext();
|
|
13477
13501
|
if (!t) return;
|
|
13478
13502
|
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;
|
|
13479
|
-
t.save(), Array.isArray(n) && t.transform(...n), t.lineWidth = 1 / r, t.strokeStyle =
|
|
13503
|
+
t.save(), Array.isArray(n) && t.transform(...n), t.lineWidth = 1 / r, t.strokeStyle = Bo, t.setLineDash([]);
|
|
13480
13504
|
for (let e of this.activeGuides) {
|
|
13481
13505
|
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;
|
|
13482
|
-
t.beginPath(), n === "vertical" ? (t.moveTo(i, a), t.lineTo(i, c)) : (t.moveTo(a, i), t.lineTo(c, i)), t.stroke(),
|
|
13506
|
+
t.beginPath(), n === "vertical" ? (t.moveTo(i, a), t.lineTo(i, c)) : (t.moveTo(a, i), t.lineTo(c, i)), t.stroke(), jo({
|
|
13483
13507
|
context: t,
|
|
13484
13508
|
type: n,
|
|
13485
13509
|
axis: i,
|
|
13486
13510
|
start: a,
|
|
13487
13511
|
end: c,
|
|
13488
|
-
text:
|
|
13512
|
+
text: $a({ distance: l }).toString(),
|
|
13489
13513
|
zoom: r,
|
|
13490
|
-
color:
|
|
13514
|
+
color: Bo,
|
|
13491
13515
|
lineWidth: 1,
|
|
13492
13516
|
offsetAlongAxis: d,
|
|
13493
13517
|
offsetPerpendicular: 0
|
|
@@ -13505,13 +13529,13 @@ var Ha = class {
|
|
|
13505
13529
|
let { toolbar: e } = this.editor;
|
|
13506
13530
|
e?.showAfterTemporary?.(), this.isToolbarHidden = !1;
|
|
13507
13531
|
}
|
|
13508
|
-
},
|
|
13532
|
+
}, Ho = class e {
|
|
13509
13533
|
constructor(e, t) {
|
|
13510
13534
|
this.options = t, this.containerId = e, this.editorId = `${e}-${D()}`, this.init();
|
|
13511
13535
|
}
|
|
13512
13536
|
async init() {
|
|
13513
13537
|
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;
|
|
13514
|
-
if (de.apply(), this.canvas = new t(this.containerId, this.options), this.moduleLoader = new A(), this.workerManager = new M(), this.errorManager = new
|
|
13538
|
+
if (de.apply(), this.canvas = new t(this.containerId, this.options), this.moduleLoader = new A(), this.workerManager = new M(), this.errorManager = new wa({ editor: this }), this.historyManager = new Dt({ editor: this }), this.toolbar = new Qe({ editor: this }), this.transformManager = new Rt({ editor: this }), this.zoomManager = new zt({ editor: this }), this.canvasManager = new Lt({ editor: this }), this.imageManager = new Nt({ editor: this }), this.layerManager = new wn({ editor: this }), this.shapeManager = new ga({ editor: this }), this.interactionBlocker = new Sn({ editor: this }), this.backgroundManager = new Cn({ editor: this }), this.clipboardManager = new va({ editor: this }), this.objectLockManager = new ya({ editor: this }), this.groupingManager = new ba({ editor: this }), this.selectionManager = new xa({ editor: this }), this.deletionManager = new Sa({ editor: this }), this.panConstraintManager = new Ta({ editor: this }), this.snappingManager = new zo({ editor: this }), this.measurementManager = new Vo({ editor: this }), this.fontManager = new fe(this.options.fonts ?? []), this.textManager = new Ga({ editor: this }), this.templateManager = new Xa({ editor: this }), u && (this.angleIndicator = new tt({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.interactionBlocker.ensureOverlay(), this.listeners = new k({
|
|
13515
13539
|
editor: this,
|
|
13516
13540
|
options: this.options
|
|
13517
13541
|
}), 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) {
|
|
@@ -13619,7 +13643,7 @@ var Ha = class {
|
|
|
13619
13643
|
"U+A640-A69F",
|
|
13620
13644
|
"U+FE2E-FE2F",
|
|
13621
13645
|
"U+2116"
|
|
13622
|
-
].join(", "),
|
|
13646
|
+
].join(", "), Uo = {
|
|
13623
13647
|
preserveObjectStacking: !0,
|
|
13624
13648
|
controlsAboveOverlay: !0,
|
|
13625
13649
|
centeredRotation: !0,
|
|
@@ -14473,20 +14497,20 @@ var Ha = class {
|
|
|
14473
14497
|
};
|
|
14474
14498
|
//#endregion
|
|
14475
14499
|
//#region src/main.ts
|
|
14476
|
-
function
|
|
14500
|
+
function Wo(e, t = {}) {
|
|
14477
14501
|
let n = {
|
|
14478
|
-
...
|
|
14502
|
+
...Uo,
|
|
14479
14503
|
...t
|
|
14480
14504
|
}, r = document.getElementById(e);
|
|
14481
14505
|
if (!r) return Promise.reject(/* @__PURE__ */ Error(`Контейнер с ID "${e}" не найден.`));
|
|
14482
14506
|
let i = document.createElement("canvas");
|
|
14483
14507
|
return i.id = `${e}-canvas`, r.appendChild(i), n.editorContainer = r, new Promise((t) => {
|
|
14484
14508
|
n._onReadyCallback = t;
|
|
14485
|
-
let r = new
|
|
14509
|
+
let r = new Ho(i.id, n);
|
|
14486
14510
|
window[e] = r;
|
|
14487
14511
|
});
|
|
14488
14512
|
}
|
|
14489
14513
|
//#endregion
|
|
14490
|
-
export {
|
|
14514
|
+
export { Wo as default };
|
|
14491
14515
|
|
|
14492
14516
|
//# sourceMappingURL=main.js.map
|