@anu3ev/fabric-image-editor 0.8.16 → 0.8.18
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 +909 -688
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -3575,9 +3575,184 @@ var Ut = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
3575
3575
|
centerPoint: n,
|
|
3576
3576
|
flags: r
|
|
3577
3577
|
});
|
|
3578
|
-
}, Wt =
|
|
3578
|
+
}, Wt = "ai-generation-overlay", Gt = 1080, Kt = Math.PI * 2, qt = 40, Jt = 8, Yt = Jt / 2, Xt = (Gt - qt * Jt) / (qt + 1), Zt = Jt + Xt, Qt = .18, $t = .58, en = "rgba(136, 136, 136, 0.5)", tn = "rgba(255, 255, 255, 0.92)", nn = [
|
|
3579
|
+
{
|
|
3580
|
+
rx: 540,
|
|
3581
|
+
ry: 430,
|
|
3582
|
+
weight: 1.3,
|
|
3583
|
+
speed: .62,
|
|
3584
|
+
pulseSpeed: 1.9,
|
|
3585
|
+
jitterX: 42,
|
|
3586
|
+
jitterY: 30,
|
|
3587
|
+
travelPadX: 360,
|
|
3588
|
+
travelPadY: 320,
|
|
3589
|
+
seed: .13
|
|
3590
|
+
},
|
|
3591
|
+
{
|
|
3592
|
+
rx: 430,
|
|
3593
|
+
ry: 340,
|
|
3594
|
+
weight: 1.16,
|
|
3595
|
+
speed: .72,
|
|
3596
|
+
pulseSpeed: 1.76,
|
|
3597
|
+
jitterX: 36,
|
|
3598
|
+
jitterY: 24,
|
|
3599
|
+
travelPadX: 300,
|
|
3600
|
+
travelPadY: 270,
|
|
3601
|
+
seed: 1.41
|
|
3602
|
+
},
|
|
3603
|
+
{
|
|
3604
|
+
rx: 380,
|
|
3605
|
+
ry: 300,
|
|
3606
|
+
weight: 1.08,
|
|
3607
|
+
speed: .82,
|
|
3608
|
+
pulseSpeed: 2.04,
|
|
3609
|
+
jitterX: 32,
|
|
3610
|
+
jitterY: 24,
|
|
3611
|
+
travelPadX: 280,
|
|
3612
|
+
travelPadY: 260,
|
|
3613
|
+
seed: 2.77
|
|
3614
|
+
},
|
|
3615
|
+
{
|
|
3616
|
+
rx: 300,
|
|
3617
|
+
ry: 235,
|
|
3618
|
+
weight: 1,
|
|
3619
|
+
speed: .92,
|
|
3620
|
+
pulseSpeed: 1.72,
|
|
3621
|
+
jitterX: 26,
|
|
3622
|
+
jitterY: 20,
|
|
3623
|
+
travelPadX: 240,
|
|
3624
|
+
travelPadY: 220,
|
|
3625
|
+
seed: 4.09
|
|
3626
|
+
},
|
|
3627
|
+
{
|
|
3628
|
+
rx: 210,
|
|
3629
|
+
ry: 165,
|
|
3630
|
+
weight: .92,
|
|
3631
|
+
speed: 1.08,
|
|
3632
|
+
pulseSpeed: 2.18,
|
|
3633
|
+
jitterX: 20,
|
|
3634
|
+
jitterY: 16,
|
|
3635
|
+
travelPadX: 210,
|
|
3636
|
+
travelPadY: 190,
|
|
3637
|
+
seed: 5.37
|
|
3638
|
+
}
|
|
3639
|
+
];
|
|
3640
|
+
function rn({ value: e, min: t = 0, max: n = 1 }) {
|
|
3641
|
+
return Math.max(t, Math.min(n, e));
|
|
3642
|
+
}
|
|
3643
|
+
function an({ from: e, to: t, progress: n }) {
|
|
3644
|
+
return e + (t - e) * n;
|
|
3645
|
+
}
|
|
3646
|
+
function on({ edgeStart: e, edgeEnd: t, value: n }) {
|
|
3647
|
+
let r = rn({ value: (n - e) / (t - e) });
|
|
3648
|
+
return r * r * (3 - 2 * r);
|
|
3649
|
+
}
|
|
3650
|
+
function sn({ time: e, seed: t }) {
|
|
3651
|
+
return rn({ 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)) });
|
|
3652
|
+
}
|
|
3653
|
+
function cn() {
|
|
3654
|
+
let e = [];
|
|
3655
|
+
for (let t = 0; t < qt; t += 1) for (let n = 0; n < qt; n += 1) e.push({
|
|
3656
|
+
x: Xt + Yt + n * Zt,
|
|
3657
|
+
y: Xt + Yt + t * Zt
|
|
3658
|
+
});
|
|
3659
|
+
return e;
|
|
3660
|
+
}
|
|
3661
|
+
var ln = cn();
|
|
3662
|
+
function un({ blob: e, time: t }) {
|
|
3663
|
+
let n = t * e.speed, r = t * e.pulseSpeed + e.seed * 3.1, i = -e.travelPadX, a = Gt + e.travelPadX, o = -e.travelPadY, s = Gt + e.travelPadY, c = sn({
|
|
3664
|
+
time: n,
|
|
3665
|
+
seed: e.seed + .11
|
|
3666
|
+
}), l = sn({
|
|
3667
|
+
time: n * .93 + 7.3,
|
|
3668
|
+
seed: e.seed + .67
|
|
3669
|
+
}), u = an({
|
|
3670
|
+
from: i,
|
|
3671
|
+
to: a,
|
|
3672
|
+
progress: c
|
|
3673
|
+
}), d = an({
|
|
3674
|
+
from: o,
|
|
3675
|
+
to: s,
|
|
3676
|
+
progress: l
|
|
3677
|
+
});
|
|
3678
|
+
return u += Math.sin(n * .57 + e.seed * 5.4) * e.jitterX * 1.8, u += Math.sin(n * 2.6 + e.seed * 9.1) * e.jitterX, d += Math.cos(n * .49 + e.seed * 6.2) * e.jitterY * 1.8, d += Math.cos(n * 2.1 + e.seed * 7.7) * e.jitterY, {
|
|
3679
|
+
x: u,
|
|
3680
|
+
y: d,
|
|
3681
|
+
rx: e.rx * (.88 + .24 * (.5 + .5 * Math.sin(r))),
|
|
3682
|
+
ry: e.ry * (.88 + .24 * (.5 + .5 * Math.cos(r * 1.07))),
|
|
3683
|
+
weight: e.weight
|
|
3684
|
+
};
|
|
3685
|
+
}
|
|
3686
|
+
function dn({ state: e, dot: t }) {
|
|
3687
|
+
let n = (t.x - e.x) / e.rx, r = (t.y - e.y) / e.ry;
|
|
3688
|
+
return Math.exp(-(n * n + r * r) * 1.6) * e.weight;
|
|
3689
|
+
}
|
|
3690
|
+
function fn({ dot: e, states: t, time: n }) {
|
|
3691
|
+
let r = 0;
|
|
3692
|
+
for (let n of t) r += dn({
|
|
3693
|
+
state: n,
|
|
3694
|
+
dot: e
|
|
3695
|
+
});
|
|
3696
|
+
let i = .98 + .02 * Math.sin(e.x * .012 + e.y * .01 + n * 3.1);
|
|
3697
|
+
return on({
|
|
3698
|
+
edgeStart: Qt,
|
|
3699
|
+
edgeEnd: $t,
|
|
3700
|
+
value: r
|
|
3701
|
+
}) * i;
|
|
3702
|
+
}
|
|
3703
|
+
function pn({ ctx: e, time: t }) {
|
|
3704
|
+
let n = nn.map((e) => un({
|
|
3705
|
+
blob: e,
|
|
3706
|
+
time: t
|
|
3707
|
+
}));
|
|
3708
|
+
e.fillStyle = tn;
|
|
3709
|
+
for (let r of ln) {
|
|
3710
|
+
let i = fn({
|
|
3711
|
+
dot: r,
|
|
3712
|
+
states: n,
|
|
3713
|
+
time: t
|
|
3714
|
+
});
|
|
3715
|
+
i <= .01 || (e.beginPath(), e.arc(r.x, r.y, Yt * Math.min(i, 1), 0, Kt), e.fill());
|
|
3716
|
+
}
|
|
3717
|
+
}
|
|
3718
|
+
var mn = class extends _ {
|
|
3719
|
+
static {
|
|
3720
|
+
this.type = Wt;
|
|
3721
|
+
}
|
|
3722
|
+
constructor(e = {}) {
|
|
3723
|
+
super({
|
|
3724
|
+
...e,
|
|
3725
|
+
fill: en,
|
|
3726
|
+
objectCaching: !1
|
|
3727
|
+
}), this._animationFrameId = null, this._renderTimeMs = 0;
|
|
3728
|
+
}
|
|
3729
|
+
startAnimation({ canvas: e }) {
|
|
3730
|
+
if (this._animationFrameId !== null) return;
|
|
3731
|
+
if (typeof window > "u" || typeof window.requestAnimationFrame != "function") {
|
|
3732
|
+
e.requestRenderAll();
|
|
3733
|
+
return;
|
|
3734
|
+
}
|
|
3735
|
+
let t = (n) => {
|
|
3736
|
+
this._animationFrameId !== null && (this._renderTimeMs = n, this.dirty = !0, e.requestRenderAll(), this._animationFrameId = window.requestAnimationFrame(t));
|
|
3737
|
+
};
|
|
3738
|
+
this._animationFrameId = window.requestAnimationFrame(t);
|
|
3739
|
+
}
|
|
3740
|
+
stopAnimation() {
|
|
3741
|
+
let e = this._animationFrameId;
|
|
3742
|
+
e !== null && (this._animationFrameId = null, typeof window < "u" && typeof window.cancelAnimationFrame == "function" && window.cancelAnimationFrame(e));
|
|
3743
|
+
}
|
|
3744
|
+
_render(e) {
|
|
3745
|
+
let t = this.width ?? 0, n = this.height ?? 0;
|
|
3746
|
+
t <= 0 || n <= 0 || (e.save(), e.beginPath(), e.rect(-t / 2, -n / 2, t, n), e.clip(), e.fillStyle = en, e.fillRect(-t / 2, -n / 2, t, n), e.translate(-t / 2, -n / 2), e.scale(t / Gt, n / Gt), pn({
|
|
3747
|
+
ctx: e,
|
|
3748
|
+
time: this._renderTimeMs / 1e3
|
|
3749
|
+
}), e.restore());
|
|
3750
|
+
}
|
|
3751
|
+
}, hn = () => {
|
|
3752
|
+
b?.setClass && b.setClass(mn, Wt);
|
|
3753
|
+
}, gn = "default", _n = "overlay-mask", vn = class {
|
|
3579
3754
|
constructor({ editor: e }) {
|
|
3580
|
-
this.editor = e, this.isBlocked = !1, this.overlayMask = null;
|
|
3755
|
+
hn(), this.editor = e, this.isBlocked = !1, this.overlayMask = null, this._overlayType = gn;
|
|
3581
3756
|
}
|
|
3582
3757
|
_getOverlayGeometry() {
|
|
3583
3758
|
let { canvasManager: e } = this.editor, t = e.getMontageAreaSceneBounds();
|
|
@@ -3595,47 +3770,93 @@ var Ut = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
3595
3770
|
flipY: !1
|
|
3596
3771
|
};
|
|
3597
3772
|
}
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3773
|
+
_getOverlayBaseOptions() {
|
|
3774
|
+
return {
|
|
3775
|
+
...this._getOverlayGeometry(),
|
|
3776
|
+
selectable: !1,
|
|
3777
|
+
evented: !0,
|
|
3778
|
+
hoverCursor: "not-allowed",
|
|
3779
|
+
hasBorders: !1,
|
|
3780
|
+
hasControls: !1,
|
|
3781
|
+
excludeFromExport: !0,
|
|
3782
|
+
visible: !1,
|
|
3783
|
+
id: _n
|
|
3784
|
+
};
|
|
3785
|
+
}
|
|
3786
|
+
_createDefaultOverlay() {
|
|
3787
|
+
let { options: { overlayMaskColor: e = "rgba(136, 136, 136, 0.5)" } } = this.editor;
|
|
3788
|
+
return Ut({
|
|
3601
3789
|
canvas: this.editor.canvas,
|
|
3602
3790
|
options: {
|
|
3603
|
-
...this.
|
|
3604
|
-
fill:
|
|
3605
|
-
selectable: !1,
|
|
3606
|
-
evented: !0,
|
|
3607
|
-
hoverCursor: "not-allowed",
|
|
3608
|
-
hasBorders: !1,
|
|
3609
|
-
hasControls: !1,
|
|
3610
|
-
excludeFromExport: !0,
|
|
3611
|
-
visible: !1,
|
|
3612
|
-
id: "overlay-mask"
|
|
3791
|
+
...this._getOverlayBaseOptions(),
|
|
3792
|
+
fill: e
|
|
3613
3793
|
},
|
|
3614
3794
|
flags: { withoutSelection: !0 }
|
|
3615
|
-
})
|
|
3795
|
+
});
|
|
3796
|
+
}
|
|
3797
|
+
_createAiGenerationOverlay() {
|
|
3798
|
+
let e = new mn(this._getOverlayBaseOptions());
|
|
3799
|
+
return this.editor.canvas.add(e), e;
|
|
3800
|
+
}
|
|
3801
|
+
_stopOverlayAnimation() {
|
|
3802
|
+
this.overlayMask instanceof mn && this.overlayMask.stopAnimation();
|
|
3803
|
+
}
|
|
3804
|
+
_createOverlay({ overlay: e }) {
|
|
3805
|
+
let { canvas: t, historyManager: n } = this.editor;
|
|
3806
|
+
n.suspendHistory();
|
|
3807
|
+
try {
|
|
3808
|
+
this._stopOverlayAnimation(), this.overlayMask && t.remove(this.overlayMask), this.overlayMask = e === "ai-generation" ? this._createAiGenerationOverlay() : this._createDefaultOverlay(), this._overlayType = e;
|
|
3809
|
+
} finally {
|
|
3810
|
+
n.resumeHistory();
|
|
3811
|
+
}
|
|
3812
|
+
}
|
|
3813
|
+
_startOverlayAnimation() {
|
|
3814
|
+
this.overlayMask instanceof mn && this.overlayMask.startAnimation({ canvas: this.editor.canvas });
|
|
3616
3815
|
}
|
|
3617
|
-
ensureOverlay() {
|
|
3618
|
-
this.overlayMask || this._createOverlay(), this.overlayMask && (this.overlayMask.set(this._getOverlayGeometry()), this.overlayMask.visible = this.isBlocked, this.overlayMask.setCoords());
|
|
3816
|
+
ensureOverlay({ overlay: e = this._overlayType } = {}) {
|
|
3817
|
+
(!this.overlayMask || this._overlayType !== e) && this._createOverlay({ overlay: e }), this.overlayMask && (this.overlayMask.set(this._getOverlayGeometry()), this.overlayMask.visible = this.isBlocked, this.overlayMask.setCoords());
|
|
3619
3818
|
}
|
|
3620
3819
|
refresh() {
|
|
3621
3820
|
let { canvas: e, historyManager: t } = this.editor;
|
|
3622
|
-
|
|
3821
|
+
if (this.overlayMask) {
|
|
3822
|
+
t.suspendHistory();
|
|
3823
|
+
try {
|
|
3824
|
+
this.overlayMask.set(this._getOverlayGeometry()), this.overlayMask.setCoords(), e.discardActiveObject(), this.editor.layerManager.bringToFront(this.overlayMask, { withoutSave: !0 }), this.isBlocked && this._startOverlayAnimation();
|
|
3825
|
+
} finally {
|
|
3826
|
+
t.resumeHistory();
|
|
3827
|
+
}
|
|
3828
|
+
}
|
|
3623
3829
|
}
|
|
3624
|
-
block() {
|
|
3625
|
-
if (this.
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3830
|
+
block({ overlay: e = gn } = {}) {
|
|
3831
|
+
if (this.isBlocked) {
|
|
3832
|
+
this.ensureOverlay();
|
|
3833
|
+
return;
|
|
3834
|
+
}
|
|
3835
|
+
if (this.ensureOverlay({ overlay: e }), !this.overlayMask) return;
|
|
3836
|
+
let { canvas: t, canvasManager: n, historyManager: r } = this.editor;
|
|
3837
|
+
r.suspendHistory();
|
|
3838
|
+
try {
|
|
3839
|
+
this.isBlocked = !0, t.discardActiveObject(), t.selection = !1, t.skipTargetFind = !0, n.getObjects().forEach((e) => {
|
|
3840
|
+
e.evented = !1, e.selectable = !1;
|
|
3841
|
+
}), t.upperCanvasEl.style.pointerEvents = "none", t.lowerCanvasEl.style.pointerEvents = "none", this.overlayMask.visible = !0, this.refresh(), t.fire("editor:disabled");
|
|
3842
|
+
} finally {
|
|
3843
|
+
r.resumeHistory();
|
|
3844
|
+
}
|
|
3630
3845
|
}
|
|
3631
3846
|
unblock() {
|
|
3632
3847
|
if (!this.isBlocked || !this.overlayMask) return;
|
|
3633
3848
|
let { canvas: e, canvasManager: t, historyManager: n } = this.editor;
|
|
3634
|
-
n.suspendHistory()
|
|
3635
|
-
|
|
3636
|
-
|
|
3849
|
+
n.suspendHistory();
|
|
3850
|
+
try {
|
|
3851
|
+
this.isBlocked = !1, e.selection = !0, e.skipTargetFind = !1, t.getObjects().forEach((e) => {
|
|
3852
|
+
e.evented = !0, e.selectable = !0;
|
|
3853
|
+
}), e.upperCanvasEl.style.pointerEvents = "", e.lowerCanvasEl.style.pointerEvents = "", this._stopOverlayAnimation(), this.overlayMask.visible = !1, e.requestRenderAll(), e.fire("editor:enabled");
|
|
3854
|
+
} finally {
|
|
3855
|
+
n.resumeHistory();
|
|
3856
|
+
}
|
|
3857
|
+
n.flushDeferredSaveAfterUnblock();
|
|
3637
3858
|
}
|
|
3638
|
-
},
|
|
3859
|
+
}, yn = class e {
|
|
3639
3860
|
constructor({ editor: e }) {
|
|
3640
3861
|
this.editor = e, this.backgroundObject = null;
|
|
3641
3862
|
}
|
|
@@ -3943,7 +4164,7 @@ var Ut = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
3943
4164
|
return e.color === n.color && Math.abs(e.offset - n.offset) < 1e-4;
|
|
3944
4165
|
}) ? !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;
|
|
3945
4166
|
}
|
|
3946
|
-
},
|
|
4167
|
+
}, bn = class t {
|
|
3947
4168
|
constructor({ editor: e }) {
|
|
3948
4169
|
this.editor = e;
|
|
3949
4170
|
}
|
|
@@ -4017,24 +4238,24 @@ var Ut = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
4017
4238
|
e.sendObjectBackwards(t.obj);
|
|
4018
4239
|
});
|
|
4019
4240
|
}
|
|
4020
|
-
},
|
|
4241
|
+
}, xn = 1, Sn = 1e-4;
|
|
4021
4242
|
function G({ value: e }) {
|
|
4022
4243
|
return Number(e.toFixed(4));
|
|
4023
4244
|
}
|
|
4024
|
-
function
|
|
4245
|
+
function Cn({ rounding: e }) {
|
|
4025
4246
|
return R({ rounding: e }) > 0;
|
|
4026
4247
|
}
|
|
4027
|
-
function
|
|
4248
|
+
function wn({ width: e, height: t, strokeWidth: n }) {
|
|
4028
4249
|
let r = Math.max(0, n ?? 0);
|
|
4029
4250
|
return {
|
|
4030
|
-
width: Math.max(
|
|
4031
|
-
height: Math.max(
|
|
4251
|
+
width: Math.max(xn, e - r),
|
|
4252
|
+
height: Math.max(xn, t - r)
|
|
4032
4253
|
};
|
|
4033
4254
|
}
|
|
4034
|
-
function
|
|
4035
|
-
let a =
|
|
4036
|
-
width: Math.max(
|
|
4037
|
-
height: Math.max(
|
|
4255
|
+
function Tn({ shape: e, width: t, height: n, rounding: r, strokeWidth: i }) {
|
|
4256
|
+
let a = wn({
|
|
4257
|
+
width: Math.max(xn, t),
|
|
4258
|
+
height: Math.max(xn, n),
|
|
4038
4259
|
strokeWidth: i
|
|
4039
4260
|
});
|
|
4040
4261
|
if (e instanceof _) {
|
|
@@ -4053,7 +4274,7 @@ function Zt({ shape: e, width: t, height: n, rounding: r, strokeWidth: i }) {
|
|
|
4053
4274
|
}), e.setCoords();
|
|
4054
4275
|
return;
|
|
4055
4276
|
}
|
|
4056
|
-
let { width: o =
|
|
4277
|
+
let { width: o = xn, height: s = xn } = e, c = Math.max(xn, o), l = Math.max(xn, s);
|
|
4057
4278
|
e.set({
|
|
4058
4279
|
scaleX: a.width / c,
|
|
4059
4280
|
scaleY: a.height / l,
|
|
@@ -4063,7 +4284,7 @@ function Zt({ shape: e, width: t, height: n, rounding: r, strokeWidth: i }) {
|
|
|
4063
4284
|
originY: "center"
|
|
4064
4285
|
}), e.setCoords();
|
|
4065
4286
|
}
|
|
4066
|
-
function
|
|
4287
|
+
function En({ shape: e, style: t }) {
|
|
4067
4288
|
let { fill: n, stroke: r, strokeWidth: i, strokeDashArray: a, opacity: o } = t, s = {
|
|
4068
4289
|
strokeUniform: !0,
|
|
4069
4290
|
strokeLineCap: "round",
|
|
@@ -4071,7 +4292,7 @@ function Qt({ shape: e, style: t }) {
|
|
|
4071
4292
|
};
|
|
4072
4293
|
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();
|
|
4073
4294
|
}
|
|
4074
|
-
function
|
|
4295
|
+
function Dn({ shape: e, style: t }) {
|
|
4075
4296
|
let n = [e];
|
|
4076
4297
|
for (let e = 0; e < n.length; e += 1) {
|
|
4077
4298
|
let r = n[e];
|
|
@@ -4081,13 +4302,13 @@ function $t({ shape: e, style: t }) {
|
|
|
4081
4302
|
t.opacity !== void 0 && r.set({ opacity: t.opacity }), r.setCoords();
|
|
4082
4303
|
continue;
|
|
4083
4304
|
}
|
|
4084
|
-
|
|
4305
|
+
En({
|
|
4085
4306
|
shape: r,
|
|
4086
4307
|
style: t
|
|
4087
4308
|
});
|
|
4088
4309
|
}
|
|
4089
4310
|
}
|
|
4090
|
-
function
|
|
4311
|
+
function On({ points: e, closed: t }) {
|
|
4091
4312
|
if (e.length === 0) return "";
|
|
4092
4313
|
let n = `M ${G({ value: e[0].x })} ${G({ value: e[0].y })}`;
|
|
4093
4314
|
for (let t = 1; t < e.length; t += 1) {
|
|
@@ -4096,7 +4317,7 @@ function en({ points: e, closed: t }) {
|
|
|
4096
4317
|
}
|
|
4097
4318
|
return t && (n += " Z"), n;
|
|
4098
4319
|
}
|
|
4099
|
-
function
|
|
4320
|
+
function kn({ previous: e, current: t, next: n, roundingRatio: r }) {
|
|
4100
4321
|
let i = {
|
|
4101
4322
|
x: e.x - t.x,
|
|
4102
4323
|
y: e.y - t.y
|
|
@@ -4104,7 +4325,7 @@ function tn({ previous: e, current: t, next: n, roundingRatio: r }) {
|
|
|
4104
4325
|
x: n.x - t.x,
|
|
4105
4326
|
y: n.y - t.y
|
|
4106
4327
|
}, o = Math.hypot(i.x, i.y), s = Math.hypot(a.x, a.y);
|
|
4107
|
-
if (o <=
|
|
4328
|
+
if (o <= Sn || s <= Sn) return {
|
|
4108
4329
|
start: {
|
|
4109
4330
|
x: G({ value: t.x }),
|
|
4110
4331
|
y: G({ value: t.y })
|
|
@@ -4126,14 +4347,14 @@ function tn({ previous: e, current: t, next: n, roundingRatio: r }) {
|
|
|
4126
4347
|
}
|
|
4127
4348
|
};
|
|
4128
4349
|
}
|
|
4129
|
-
function
|
|
4350
|
+
function An({ points: e, roundingRatio: t, closed: n }) {
|
|
4130
4351
|
let r = e.length;
|
|
4131
4352
|
if (r === 0) return "";
|
|
4132
4353
|
if (!n && r === 1) {
|
|
4133
4354
|
let t = e[0];
|
|
4134
4355
|
return `M ${G({ value: t.x })} ${G({ value: t.y })}`;
|
|
4135
4356
|
}
|
|
4136
|
-
if (t <= 0) return
|
|
4357
|
+
if (t <= 0) return On({
|
|
4137
4358
|
points: e,
|
|
4138
4359
|
closed: n
|
|
4139
4360
|
});
|
|
@@ -4141,7 +4362,7 @@ function nn({ points: e, roundingRatio: t, closed: n }) {
|
|
|
4141
4362
|
let n = [];
|
|
4142
4363
|
for (let i = 0; i < r; i += 1) {
|
|
4143
4364
|
let a = i === 0 ? r - 1 : i - 1, o = i === r - 1 ? 0 : i + 1;
|
|
4144
|
-
n.push(
|
|
4365
|
+
n.push(kn({
|
|
4145
4366
|
previous: e[a],
|
|
4146
4367
|
current: e[i],
|
|
4147
4368
|
next: e[o],
|
|
@@ -4155,13 +4376,13 @@ function nn({ points: e, roundingRatio: t, closed: n }) {
|
|
|
4155
4376
|
}
|
|
4156
4377
|
return a += " Z", a;
|
|
4157
4378
|
}
|
|
4158
|
-
if (r === 2) return
|
|
4379
|
+
if (r === 2) return On({
|
|
4159
4380
|
points: e,
|
|
4160
4381
|
closed: !1
|
|
4161
4382
|
});
|
|
4162
4383
|
let i = `M ${G({ value: e[0].x })} ${G({ value: e[0].y })}`;
|
|
4163
4384
|
for (let n = 1; n < r - 1; n += 1) {
|
|
4164
|
-
let r =
|
|
4385
|
+
let r = kn({
|
|
4165
4386
|
previous: e[n - 1],
|
|
4166
4387
|
current: e[n],
|
|
4167
4388
|
next: e[n + 1],
|
|
@@ -4172,8 +4393,8 @@ function nn({ points: e, roundingRatio: t, closed: n }) {
|
|
|
4172
4393
|
let a = e[r - 1];
|
|
4173
4394
|
return i += ` L ${G({ value: a.x })} ${G({ value: a.y })}`, i;
|
|
4174
4395
|
}
|
|
4175
|
-
function
|
|
4176
|
-
return new f(
|
|
4396
|
+
function jn({ points: e, rounding: t, closed: n }) {
|
|
4397
|
+
return new f(An({
|
|
4177
4398
|
points: e,
|
|
4178
4399
|
roundingRatio: pe({ rounding: t }),
|
|
4179
4400
|
closed: n
|
|
@@ -4184,8 +4405,8 @@ function rn({ points: e, rounding: t, closed: n }) {
|
|
|
4184
4405
|
top: 0
|
|
4185
4406
|
});
|
|
4186
4407
|
}
|
|
4187
|
-
function
|
|
4188
|
-
return
|
|
4408
|
+
function Mn({ rounding: e }) {
|
|
4409
|
+
return Cn({ rounding: e }) ? jn({
|
|
4189
4410
|
points: [
|
|
4190
4411
|
{
|
|
4191
4412
|
x: 50,
|
|
@@ -4211,7 +4432,7 @@ function an({ rounding: e }) {
|
|
|
4211
4432
|
top: 0
|
|
4212
4433
|
});
|
|
4213
4434
|
}
|
|
4214
|
-
function
|
|
4435
|
+
function Nn({ path: e }) {
|
|
4215
4436
|
return new f(e, {
|
|
4216
4437
|
originX: "center",
|
|
4217
4438
|
originY: "center",
|
|
@@ -4219,8 +4440,8 @@ function on({ path: e }) {
|
|
|
4219
4440
|
top: 0
|
|
4220
4441
|
});
|
|
4221
4442
|
}
|
|
4222
|
-
function
|
|
4223
|
-
let n =
|
|
4443
|
+
function Pn({ path: e, rounding: t }) {
|
|
4444
|
+
let n = Nn({ path: e }).path ?? [], r = w.makePathSimpler(n), i = [], a = !1;
|
|
4224
4445
|
for (let e = 0; e < r.length; e += 1) {
|
|
4225
4446
|
let t = r[e];
|
|
4226
4447
|
if (!t) return null;
|
|
@@ -4240,19 +4461,19 @@ function sn({ path: e, rounding: t }) {
|
|
|
4240
4461
|
}
|
|
4241
4462
|
return null;
|
|
4242
4463
|
}
|
|
4243
|
-
return i.length < 2 || a && i.length < 3 ? null :
|
|
4464
|
+
return i.length < 2 || a && i.length < 3 ? null : jn({
|
|
4244
4465
|
points: i,
|
|
4245
4466
|
rounding: t,
|
|
4246
4467
|
closed: a
|
|
4247
4468
|
});
|
|
4248
4469
|
}
|
|
4249
|
-
function
|
|
4250
|
-
return
|
|
4470
|
+
function Fn({ path: e, rounding: t }) {
|
|
4471
|
+
return Cn({ rounding: t }) && Pn({
|
|
4251
4472
|
path: e,
|
|
4252
4473
|
rounding: R({ rounding: t })
|
|
4253
|
-
}) ||
|
|
4474
|
+
}) || Nn({ path: e });
|
|
4254
4475
|
}
|
|
4255
|
-
function
|
|
4476
|
+
function In({ points: e, type: t, rounding: n }) {
|
|
4256
4477
|
let r = e.length > 0 ? e : [
|
|
4257
4478
|
{
|
|
4258
4479
|
x: 0,
|
|
@@ -4268,12 +4489,12 @@ function ln({ points: e, type: t, rounding: n }) {
|
|
|
4268
4489
|
}
|
|
4269
4490
|
], i = R({ rounding: n });
|
|
4270
4491
|
if (i > 0) {
|
|
4271
|
-
if (t === "polygon" && r.length >= 3) return
|
|
4492
|
+
if (t === "polygon" && r.length >= 3) return jn({
|
|
4272
4493
|
points: r,
|
|
4273
4494
|
rounding: i,
|
|
4274
4495
|
closed: !0
|
|
4275
4496
|
});
|
|
4276
|
-
if (t === "polyline" && r.length >= 2) return
|
|
4497
|
+
if (t === "polyline" && r.length >= 2) return jn({
|
|
4277
4498
|
points: r,
|
|
4278
4499
|
rounding: i,
|
|
4279
4500
|
closed: !1
|
|
@@ -4286,7 +4507,7 @@ function ln({ points: e, type: t, rounding: n }) {
|
|
|
4286
4507
|
top: 0
|
|
4287
4508
|
});
|
|
4288
4509
|
}
|
|
4289
|
-
async function
|
|
4510
|
+
async function Ln({ svg: e }) {
|
|
4290
4511
|
let t = await S(e), n = w.groupSVGElements(t.objects, t.options);
|
|
4291
4512
|
return n.set({
|
|
4292
4513
|
originX: "center",
|
|
@@ -4295,7 +4516,7 @@ async function un({ svg: e }) {
|
|
|
4295
4516
|
top: 0
|
|
4296
4517
|
}), n.setCoords(), n;
|
|
4297
4518
|
}
|
|
4298
|
-
async function
|
|
4519
|
+
async function Rn({ preset: e, rounding: t }) {
|
|
4299
4520
|
switch (e.type) {
|
|
4300
4521
|
case "rect": return new _({
|
|
4301
4522
|
width: 100,
|
|
@@ -4313,22 +4534,22 @@ async function dn({ preset: e, rounding: t }) {
|
|
|
4313
4534
|
left: 0,
|
|
4314
4535
|
top: 0
|
|
4315
4536
|
});
|
|
4316
|
-
case "triangle": return
|
|
4317
|
-
case "polygon": return
|
|
4537
|
+
case "triangle": return Mn({ rounding: t });
|
|
4538
|
+
case "polygon": return In({
|
|
4318
4539
|
points: e.points,
|
|
4319
4540
|
type: "polygon",
|
|
4320
4541
|
rounding: t
|
|
4321
4542
|
});
|
|
4322
|
-
case "polyline": return
|
|
4543
|
+
case "polyline": return In({
|
|
4323
4544
|
points: e.points,
|
|
4324
4545
|
type: "polyline",
|
|
4325
4546
|
rounding: t
|
|
4326
4547
|
});
|
|
4327
|
-
case "path": return
|
|
4548
|
+
case "path": return Fn({
|
|
4328
4549
|
path: e.path,
|
|
4329
4550
|
rounding: t
|
|
4330
4551
|
});
|
|
4331
|
-
case "svg": return
|
|
4552
|
+
case "svg": return Ln({ svg: e.svg });
|
|
4332
4553
|
default: return new _({
|
|
4333
4554
|
width: 100,
|
|
4334
4555
|
height: 100,
|
|
@@ -4339,15 +4560,15 @@ async function dn({ preset: e, rounding: t }) {
|
|
|
4339
4560
|
});
|
|
4340
4561
|
}
|
|
4341
4562
|
}
|
|
4342
|
-
async function
|
|
4343
|
-
let a = await
|
|
4563
|
+
async function zn({ preset: e, width: t, height: n, style: r, rounding: i }) {
|
|
4564
|
+
let a = await Rn({
|
|
4344
4565
|
preset: e,
|
|
4345
4566
|
rounding: i
|
|
4346
4567
|
});
|
|
4347
|
-
return
|
|
4568
|
+
return Dn({
|
|
4348
4569
|
shape: a,
|
|
4349
4570
|
style: r
|
|
4350
|
-
}),
|
|
4571
|
+
}), Tn({
|
|
4351
4572
|
shape: a,
|
|
4352
4573
|
width: t,
|
|
4353
4574
|
height: n,
|
|
@@ -4364,30 +4585,30 @@ async function fn({ preset: e, width: t, height: n, style: r, rounding: i }) {
|
|
|
4364
4585
|
}
|
|
4365
4586
|
//#endregion
|
|
4366
4587
|
//#region src/editor/shape-manager/domain/shape-style.ts
|
|
4367
|
-
var
|
|
4368
|
-
function
|
|
4588
|
+
var Bn = "#B4B7BD", Vn = 0, Hn = 1;
|
|
4589
|
+
function Un({ options: e, fallback: t }) {
|
|
4369
4590
|
let { fill: n, stroke: r, strokeWidth: i, strokeDashArray: a, opacity: o } = e, s = a === void 0 ? t?.shapeStrokeDashArray : a;
|
|
4370
4591
|
return {
|
|
4371
|
-
fill: n ?? t?.shapeFill ??
|
|
4592
|
+
fill: n ?? t?.shapeFill ?? Bn,
|
|
4372
4593
|
stroke: r ?? t?.shapeStroke ?? null,
|
|
4373
|
-
strokeWidth: i ?? t?.shapeStrokeWidth ??
|
|
4594
|
+
strokeWidth: i ?? t?.shapeStrokeWidth ?? Vn,
|
|
4374
4595
|
strokeDashArray: s ?? null,
|
|
4375
|
-
opacity: o ?? t?.shapeOpacity ??
|
|
4596
|
+
opacity: o ?? t?.shapeOpacity ?? Hn
|
|
4376
4597
|
};
|
|
4377
4598
|
}
|
|
4378
4599
|
//#endregion
|
|
4379
4600
|
//#region src/editor/shape-manager/layout/shape-layout-padding.ts
|
|
4380
|
-
var
|
|
4381
|
-
function
|
|
4601
|
+
var Wn = .5, Gn = 12;
|
|
4602
|
+
function Kn({ width: e, padding: t }) {
|
|
4382
4603
|
let n = Math.max(0, t.left), r = Math.max(0, t.right);
|
|
4383
4604
|
return Math.max(1, e - n - r);
|
|
4384
4605
|
}
|
|
4385
|
-
function
|
|
4606
|
+
function qn({ text: e }) {
|
|
4386
4607
|
return (e.text ?? "").trim().length > 0;
|
|
4387
4608
|
}
|
|
4388
|
-
function
|
|
4609
|
+
function Jn({ start: e, end: t, maxTotalPadding: n, startChanged: r, endChanged: i }) {
|
|
4389
4610
|
let a = Math.max(0, e), o = Math.max(0, t), s = Math.max(0, n);
|
|
4390
|
-
if (a + o <= s +
|
|
4611
|
+
if (a + o <= s + Wn) return {
|
|
4391
4612
|
start: a,
|
|
4392
4613
|
end: o
|
|
4393
4614
|
};
|
|
@@ -4416,8 +4637,8 @@ function xn({ start: e, end: t, maxTotalPadding: n, startChanged: r, endChanged:
|
|
|
4416
4637
|
end: o * l
|
|
4417
4638
|
};
|
|
4418
4639
|
}
|
|
4419
|
-
function
|
|
4420
|
-
let s = Math.max(0, n), c = Math.max(0, r), l = Math.max(0, i - s - c), u =
|
|
4640
|
+
function Yn({ start: e, end: t, insetStart: n, insetEnd: r, maxTotalPadding: i, startChanged: a, endChanged: o }) {
|
|
4641
|
+
let s = Math.max(0, n), c = Math.max(0, r), l = Math.max(0, i - s - c), u = Jn({
|
|
4421
4642
|
start: Math.max(0, e),
|
|
4422
4643
|
end: Math.max(0, t),
|
|
4423
4644
|
maxTotalPadding: l,
|
|
@@ -4431,23 +4652,23 @@ function Sn({ start: e, end: t, insetStart: n, insetEnd: r, maxTotalPadding: i,
|
|
|
4431
4652
|
appliedUserPaddingEnd: f
|
|
4432
4653
|
};
|
|
4433
4654
|
}
|
|
4434
|
-
function
|
|
4655
|
+
function Xn({ text: e, minFrameWidth: t, maxFrameWidth: n, frameHeight: r, measureTextboxHeightForFrame: i }) {
|
|
4435
4656
|
let a = Math.max(1, t), o = Math.max(a, n), s = Math.max(1, r);
|
|
4436
|
-
if (!
|
|
4657
|
+
if (!qn({ text: e }) || i({
|
|
4437
4658
|
text: e,
|
|
4438
4659
|
frameWidth: a
|
|
4439
|
-
}) <= s +
|
|
4660
|
+
}) <= s + Wn) return a;
|
|
4440
4661
|
if (i({
|
|
4441
4662
|
text: e,
|
|
4442
4663
|
frameWidth: o
|
|
4443
|
-
}) > s +
|
|
4664
|
+
}) > s + Wn) return o;
|
|
4444
4665
|
let c = a, l = o;
|
|
4445
|
-
for (let t = 0; t <
|
|
4666
|
+
for (let t = 0; t < Gn; t += 1) {
|
|
4446
4667
|
let t = (c + l) / 2;
|
|
4447
4668
|
if (i({
|
|
4448
4669
|
text: e,
|
|
4449
4670
|
frameWidth: t
|
|
4450
|
-
}) <= s +
|
|
4671
|
+
}) <= s + Wn) {
|
|
4451
4672
|
l = t;
|
|
4452
4673
|
continue;
|
|
4453
4674
|
}
|
|
@@ -4455,16 +4676,16 @@ function Cn({ text: e, minFrameWidth: t, maxFrameWidth: n, frameHeight: r, measu
|
|
|
4455
4676
|
}
|
|
4456
4677
|
return l;
|
|
4457
4678
|
}
|
|
4458
|
-
function
|
|
4459
|
-
let l = Math.max(1, t), u = Math.max(1, n), d =
|
|
4460
|
-
a || (f =
|
|
4679
|
+
function Zn({ text: e, width: t, availableTextFrameHeight: n, padding: r, internalShapeTextInset: i, expandShapeHeightToFitText: a, changedPadding: o, measureTextboxHeightForFrame: s, resolveMinimumTextFrameWidth: c }) {
|
|
4680
|
+
let l = Math.max(1, t), u = Math.max(1, n), d = qn({ text: e }) ? c({ text: e }) : 1, f = d;
|
|
4681
|
+
a || (f = Xn({
|
|
4461
4682
|
text: e,
|
|
4462
4683
|
minFrameWidth: d,
|
|
4463
4684
|
maxFrameWidth: l,
|
|
4464
4685
|
frameHeight: u,
|
|
4465
4686
|
measureTextboxHeightForFrame: s
|
|
4466
4687
|
}));
|
|
4467
|
-
let p = f + i.left + i.right, m = Math.max(0, l - f), h =
|
|
4688
|
+
let p = f + i.left + i.right, m = Math.max(0, l - f), h = Yn({
|
|
4468
4689
|
start: r.left,
|
|
4469
4690
|
end: r.right,
|
|
4470
4691
|
insetStart: i.left,
|
|
@@ -4485,8 +4706,8 @@ function wn({ text: e, width: t, availableTextFrameHeight: n, padding: r, intern
|
|
|
4485
4706
|
requiredWidth: p
|
|
4486
4707
|
};
|
|
4487
4708
|
}
|
|
4488
|
-
function
|
|
4489
|
-
let a = Math.max(0, Math.max(1, n) - Math.max(1, r)), o =
|
|
4709
|
+
function Qn({ padding: e, internalShapeTextInset: t, height: n, textHeight: r, changedPadding: i }) {
|
|
4710
|
+
let a = Math.max(0, Math.max(1, n) - Math.max(1, r)), o = Yn({
|
|
4490
4711
|
start: e.top,
|
|
4491
4712
|
end: e.bottom,
|
|
4492
4713
|
insetStart: t.top,
|
|
@@ -4506,8 +4727,8 @@ function Tn({ padding: e, internalShapeTextInset: t, height: n, textHeight: r, c
|
|
|
4506
4727
|
}
|
|
4507
4728
|
};
|
|
4508
4729
|
}
|
|
4509
|
-
function
|
|
4510
|
-
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 =
|
|
4730
|
+
function $n({ text: e, width: t, height: n, padding: r, internalShapeTextInset: i, expandShapeHeightToFitText: a, changedPadding: o, measureTextboxHeightForFrame: s, resolveMinimumTextFrameWidth: c }) {
|
|
4731
|
+
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 = Zn({
|
|
4511
4732
|
text: e,
|
|
4512
4733
|
width: l,
|
|
4513
4734
|
availableTextFrameHeight: Math.max(1, u - _),
|
|
@@ -4517,7 +4738,7 @@ function En({ text: e, width: t, height: n, padding: r, internalShapeTextInset:
|
|
|
4517
4738
|
changedPadding: o,
|
|
4518
4739
|
measureTextboxHeightForFrame: s,
|
|
4519
4740
|
resolveMinimumTextFrameWidth: c
|
|
4520
|
-
}), y =
|
|
4741
|
+
}), y = Kn({
|
|
4521
4742
|
width: l,
|
|
4522
4743
|
padding: {
|
|
4523
4744
|
top: 0,
|
|
@@ -4525,10 +4746,10 @@ function En({ text: e, width: t, height: n, padding: r, internalShapeTextInset:
|
|
|
4525
4746
|
bottom: 0,
|
|
4526
4747
|
left: v.appliedPadding.left
|
|
4527
4748
|
}
|
|
4528
|
-
}), b =
|
|
4749
|
+
}), b = qn({ text: e }) ? s({
|
|
4529
4750
|
text: e,
|
|
4530
4751
|
frameWidth: y
|
|
4531
|
-
}) : 1, x = d.top + d.bottom, S = a ? Math.max(u, b + g + x) : u, C =
|
|
4752
|
+
}) : 1, x = d.top + d.bottom, S = a ? Math.max(u, b + g + x) : u, C = Qn({
|
|
4532
4753
|
padding: d,
|
|
4533
4754
|
internalShapeTextInset: f,
|
|
4534
4755
|
height: S,
|
|
@@ -4554,14 +4775,14 @@ function En({ text: e, width: t, height: n, padding: r, internalShapeTextInset:
|
|
|
4554
4775
|
}
|
|
4555
4776
|
//#endregion
|
|
4556
4777
|
//#region src/editor/shape-manager/layout/shape-text-measurement.ts
|
|
4557
|
-
var
|
|
4558
|
-
function
|
|
4559
|
-
let a = Math.max(
|
|
4778
|
+
var er = 1, tr = .5, nr = 1e6;
|
|
4779
|
+
function rr({ text: e, frameWidth: t, splitByGrapheme: n, requiresGraphemeSplit: r, measurementCache: i }) {
|
|
4780
|
+
let a = Math.max(er, t), o = yr({
|
|
4560
4781
|
frameWidth: a,
|
|
4561
4782
|
splitByGrapheme: n
|
|
4562
4783
|
}), s = i?.measurementsByKey.get(o);
|
|
4563
4784
|
if (s) return s;
|
|
4564
|
-
let c =
|
|
4785
|
+
let c = hr({ text: e }), l = r ?? cr({
|
|
4565
4786
|
text: e,
|
|
4566
4787
|
frameWidth: a,
|
|
4567
4788
|
measurementCache: i
|
|
@@ -4573,24 +4794,24 @@ function kn({ text: e, frameWidth: t, splitByGrapheme: n, requiresGraphemeSplit:
|
|
|
4573
4794
|
scaleX: 1,
|
|
4574
4795
|
scaleY: 1
|
|
4575
4796
|
}), e.initDimensions();
|
|
4576
|
-
let u =
|
|
4577
|
-
measuredHeight:
|
|
4797
|
+
let u = pr({ text: e }), d = fr({ text: e }), f = {
|
|
4798
|
+
measuredHeight: ur({ text: e }),
|
|
4578
4799
|
renderedLineCount: u > 0 ? u : d,
|
|
4579
|
-
longestLineWidth: Math.ceil(
|
|
4800
|
+
longestLineWidth: Math.ceil(dr({ text: e })),
|
|
4580
4801
|
requiresGraphemeSplit: l
|
|
4581
4802
|
};
|
|
4582
|
-
return
|
|
4803
|
+
return gr({
|
|
4583
4804
|
text: e,
|
|
4584
4805
|
state: c
|
|
4585
4806
|
}), i?.measurementsByKey.set(o, f), f;
|
|
4586
4807
|
}
|
|
4587
|
-
function
|
|
4588
|
-
let i =
|
|
4808
|
+
function ir({ text: e, frameWidth: t, wrapPolicy: n, measurementCache: r }) {
|
|
4809
|
+
let i = fr({ text: e }), a = cr({
|
|
4589
4810
|
text: e,
|
|
4590
4811
|
frameWidth: t,
|
|
4591
4812
|
wrapPolicy: n,
|
|
4592
4813
|
measurementCache: r
|
|
4593
|
-
}), o =
|
|
4814
|
+
}), o = rr({
|
|
4594
4815
|
text: e,
|
|
4595
4816
|
frameWidth: t,
|
|
4596
4817
|
splitByGrapheme: a,
|
|
@@ -4602,14 +4823,14 @@ function An({ text: e, frameWidth: t, wrapPolicy: n, measurementCache: r }) {
|
|
|
4602
4823
|
longestLineWidth: o.longestLineWidth
|
|
4603
4824
|
};
|
|
4604
4825
|
}
|
|
4605
|
-
function
|
|
4606
|
-
let a = n ??
|
|
4826
|
+
function ar({ text: e, frameWidth: t, splitByGrapheme: n, wrapPolicy: r, measurementCache: i }) {
|
|
4827
|
+
let a = n ?? cr({
|
|
4607
4828
|
text: e,
|
|
4608
4829
|
frameWidth: t,
|
|
4609
4830
|
wrapPolicy: r,
|
|
4610
4831
|
measurementCache: i
|
|
4611
4832
|
});
|
|
4612
|
-
return
|
|
4833
|
+
return rr({
|
|
4613
4834
|
text: e,
|
|
4614
4835
|
frameWidth: t,
|
|
4615
4836
|
splitByGrapheme: a,
|
|
@@ -4617,25 +4838,25 @@ function jn({ text: e, frameWidth: t, splitByGrapheme: n, wrapPolicy: r, measure
|
|
|
4617
4838
|
measurementCache: i
|
|
4618
4839
|
}).measuredHeight;
|
|
4619
4840
|
}
|
|
4620
|
-
function
|
|
4841
|
+
function or({ text: e, measurementCache: t }) {
|
|
4621
4842
|
if (t?.minimumTextFrameWidth !== null && t?.minimumTextFrameWidth !== void 0) return t.minimumTextFrameWidth;
|
|
4622
|
-
let n =
|
|
4843
|
+
let n = lr({
|
|
4623
4844
|
text: e,
|
|
4624
|
-
frameWidth:
|
|
4845
|
+
frameWidth: er,
|
|
4625
4846
|
splitByGrapheme: !0,
|
|
4626
4847
|
measurementCache: t
|
|
4627
|
-
}), r = Math.max(
|
|
4848
|
+
}), r = Math.max(er, n);
|
|
4628
4849
|
return t && (t.minimumTextFrameWidth = r), r;
|
|
4629
4850
|
}
|
|
4630
|
-
function
|
|
4851
|
+
function sr({ alignV: e, frameHeight: t, frameTop: n, textHeight: r }) {
|
|
4631
4852
|
let i = Math.max(0, t - r);
|
|
4632
4853
|
return e === "top" ? n : e === "bottom" ? n + i : n + i / 2;
|
|
4633
4854
|
}
|
|
4634
|
-
function
|
|
4855
|
+
function cr({ text: e, frameWidth: t, wrapPolicy: n, measurementCache: r }) {
|
|
4635
4856
|
if (n === "words-only") return !1;
|
|
4636
|
-
let i = Math.max(
|
|
4857
|
+
let i = Math.max(er, t), a = vr({ frameWidth: i }), o = r?.splitByGraphemeByFrameWidth.get(a);
|
|
4637
4858
|
if (typeof o == "boolean") return o;
|
|
4638
|
-
let s =
|
|
4859
|
+
let s = hr({ text: e });
|
|
4639
4860
|
e.set({
|
|
4640
4861
|
autoExpand: !1,
|
|
4641
4862
|
width: i,
|
|
@@ -4643,70 +4864,70 @@ function Pn({ text: e, frameWidth: t, wrapPolicy: n, measurementCache: r }) {
|
|
|
4643
4864
|
scaleX: 1,
|
|
4644
4865
|
scaleY: 1
|
|
4645
4866
|
}), e.initDimensions();
|
|
4646
|
-
let c =
|
|
4647
|
-
return
|
|
4867
|
+
let c = _r({ text: e }) > i + tr;
|
|
4868
|
+
return gr({
|
|
4648
4869
|
text: e,
|
|
4649
4870
|
state: s
|
|
4650
4871
|
}), r?.splitByGraphemeByFrameWidth.set(a, c), c;
|
|
4651
4872
|
}
|
|
4652
|
-
function
|
|
4653
|
-
let i = r?.measurementsByKey.get(
|
|
4873
|
+
function lr({ text: e, frameWidth: t, splitByGrapheme: n, measurementCache: r }) {
|
|
4874
|
+
let i = r?.measurementsByKey.get(yr({
|
|
4654
4875
|
frameWidth: t,
|
|
4655
4876
|
splitByGrapheme: n
|
|
4656
4877
|
}));
|
|
4657
4878
|
if (i) return i.longestLineWidth;
|
|
4658
|
-
let a =
|
|
4879
|
+
let a = hr({ text: e });
|
|
4659
4880
|
e.set({
|
|
4660
4881
|
autoExpand: !1,
|
|
4661
|
-
width: Math.max(
|
|
4882
|
+
width: Math.max(er, t),
|
|
4662
4883
|
splitByGrapheme: n,
|
|
4663
4884
|
scaleX: 1,
|
|
4664
4885
|
scaleY: 1
|
|
4665
4886
|
}), e.initDimensions();
|
|
4666
|
-
let o =
|
|
4667
|
-
return
|
|
4887
|
+
let o = dr({ text: e });
|
|
4888
|
+
return gr({
|
|
4668
4889
|
text: e,
|
|
4669
4890
|
state: a
|
|
4670
4891
|
}), o;
|
|
4671
4892
|
}
|
|
4672
|
-
function
|
|
4893
|
+
function ur({ text: e }) {
|
|
4673
4894
|
let { height: t } = e;
|
|
4674
4895
|
if (typeof t == "number" && Number.isFinite(t)) return t;
|
|
4675
4896
|
if (typeof e.calcTextHeight == "function") {
|
|
4676
4897
|
let t = e.calcTextHeight();
|
|
4677
4898
|
if (typeof t == "number" && Number.isFinite(t)) return t;
|
|
4678
4899
|
}
|
|
4679
|
-
return
|
|
4900
|
+
return er;
|
|
4680
4901
|
}
|
|
4681
|
-
function
|
|
4682
|
-
let t =
|
|
4683
|
-
if (t > 0) return
|
|
4902
|
+
function dr({ text: e }) {
|
|
4903
|
+
let t = pr({ text: e });
|
|
4904
|
+
if (t > 0) return mr({
|
|
4684
4905
|
text: e,
|
|
4685
4906
|
lineCount: t
|
|
4686
4907
|
});
|
|
4687
4908
|
let n = e.text ?? "";
|
|
4688
|
-
return
|
|
4909
|
+
return mr({
|
|
4689
4910
|
text: e,
|
|
4690
4911
|
lineCount: Math.max(n.split("\n").length, 1)
|
|
4691
4912
|
});
|
|
4692
4913
|
}
|
|
4693
|
-
function
|
|
4914
|
+
function fr({ text: e }) {
|
|
4694
4915
|
let t = e.text ?? "";
|
|
4695
4916
|
return Math.max(t.split("\n").length, 1);
|
|
4696
4917
|
}
|
|
4697
|
-
function
|
|
4918
|
+
function pr({ text: e }) {
|
|
4698
4919
|
let t = e;
|
|
4699
4920
|
return Array.isArray(t.textLines) ? t.textLines.length : 0;
|
|
4700
4921
|
}
|
|
4701
|
-
function
|
|
4702
|
-
let n =
|
|
4922
|
+
function mr({ text: e, lineCount: t }) {
|
|
4923
|
+
let n = er;
|
|
4703
4924
|
for (let r = 0; r < t; r += 1) {
|
|
4704
4925
|
let t = e.getLineWidth(r);
|
|
4705
4926
|
t > n && (n = t);
|
|
4706
4927
|
}
|
|
4707
4928
|
return n;
|
|
4708
4929
|
}
|
|
4709
|
-
function
|
|
4930
|
+
function hr({ text: e }) {
|
|
4710
4931
|
let { autoExpand: t, splitByGrapheme: n, width: r, scaleX: i, scaleY: a } = e;
|
|
4711
4932
|
return {
|
|
4712
4933
|
autoExpand: t,
|
|
@@ -4716,25 +4937,25 @@ function Vn({ text: e }) {
|
|
|
4716
4937
|
scaleY: typeof a == "number" ? a : void 0
|
|
4717
4938
|
};
|
|
4718
4939
|
}
|
|
4719
|
-
function
|
|
4940
|
+
function gr({ text: e, state: t }) {
|
|
4720
4941
|
let { autoExpand: n, splitByGrapheme: r, width: i, scaleX: a, scaleY: o } = t, s = {};
|
|
4721
4942
|
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());
|
|
4722
4943
|
}
|
|
4723
|
-
function
|
|
4944
|
+
function _r({ text: e }) {
|
|
4724
4945
|
let { dynamicMinWidth: t } = e;
|
|
4725
4946
|
return typeof t == "number" && Number.isFinite(t) ? t : 0;
|
|
4726
4947
|
}
|
|
4727
|
-
function
|
|
4728
|
-
return String(Math.round(Math.max(
|
|
4948
|
+
function vr({ frameWidth: e }) {
|
|
4949
|
+
return String(Math.round(Math.max(er, e) * nr) / nr);
|
|
4729
4950
|
}
|
|
4730
|
-
function
|
|
4731
|
-
return `${
|
|
4951
|
+
function yr({ frameWidth: e, splitByGrapheme: t }) {
|
|
4952
|
+
return `${vr({ frameWidth: e })}:${t ? 1 : 0}`;
|
|
4732
4953
|
}
|
|
4733
4954
|
//#endregion
|
|
4734
4955
|
//#region src/editor/shape-manager/layout/shape-layout.ts
|
|
4735
|
-
var K = 1, q = .5,
|
|
4736
|
-
function
|
|
4737
|
-
let { frame: s, splitByGrapheme: c, textTop: l } =
|
|
4956
|
+
var K = 1, q = .5, br = 24, xr = 20, Sr = 16;
|
|
4957
|
+
function Cr({ text: e, alignV: t, width: n, height: r, appliedPadding: i, appliedUserPadding: a, wrapPolicy: o }) {
|
|
4958
|
+
let { frame: s, splitByGrapheme: c, textTop: l } = Mr({
|
|
4738
4959
|
text: e,
|
|
4739
4960
|
width: n,
|
|
4740
4961
|
height: r,
|
|
@@ -4753,8 +4974,8 @@ function Yn({ text: e, alignV: t, width: n, height: r, appliedPadding: i, applie
|
|
|
4753
4974
|
wrapPolicy: o
|
|
4754
4975
|
};
|
|
4755
4976
|
}
|
|
4756
|
-
var
|
|
4757
|
-
let { width: p, height: m, appliedPadding: h, appliedUserPadding: g } = c ?
|
|
4977
|
+
var wr = ({ 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 }) => {
|
|
4978
|
+
let { width: p, height: m, appliedPadding: h, appliedUserPadding: g } = c ? kr({
|
|
4758
4979
|
text: e,
|
|
4759
4980
|
width: t,
|
|
4760
4981
|
height: n,
|
|
@@ -4766,7 +4987,7 @@ var Xn = ({ text: e, width: t, height: n, alignV: r, padding: i, wrapPolicy: a,
|
|
|
4766
4987
|
montageAreaWidth: u,
|
|
4767
4988
|
expandShapeHeightToFitText: d,
|
|
4768
4989
|
changedPadding: f
|
|
4769
|
-
}) :
|
|
4990
|
+
}) : Rr({
|
|
4770
4991
|
text: e,
|
|
4771
4992
|
width: t,
|
|
4772
4993
|
height: n,
|
|
@@ -4777,7 +4998,7 @@ var Xn = ({ text: e, width: t, height: n, alignV: r, padding: i, wrapPolicy: a,
|
|
|
4777
4998
|
expandShapeHeightToFitText: d,
|
|
4778
4999
|
changedPadding: f
|
|
4779
5000
|
});
|
|
4780
|
-
return
|
|
5001
|
+
return Cr({
|
|
4781
5002
|
text: e,
|
|
4782
5003
|
alignV: r,
|
|
4783
5004
|
width: p,
|
|
@@ -4786,18 +5007,18 @@ var Xn = ({ text: e, width: t, height: n, alignV: r, padding: i, wrapPolicy: a,
|
|
|
4786
5007
|
appliedUserPadding: g,
|
|
4787
5008
|
wrapPolicy: a
|
|
4788
5009
|
});
|
|
4789
|
-
},
|
|
4790
|
-
let d = Ne({ padding: i }), f = V({ padding: o }), p = Math.max(K, t), m = Math.max(K, n), h = ({ text: e, frameWidth: t }) =>
|
|
5010
|
+
}, Tr = ({ text: e, width: t, height: n, alignV: r, padding: i, wrapPolicy: a, internalShapeTextInset: o, resolveInternalShapeTextInset: s, expandShapeHeightToFitText: c = !0, changedPadding: l, measurementCache: u }) => {
|
|
5011
|
+
let d = Ne({ padding: i }), f = V({ padding: o }), p = Math.max(K, t), m = Math.max(K, n), h = ({ text: e, frameWidth: t }) => ar({
|
|
4791
5012
|
text: e,
|
|
4792
5013
|
frameWidth: t,
|
|
4793
5014
|
wrapPolicy: a,
|
|
4794
5015
|
measurementCache: u
|
|
4795
|
-
}), g =
|
|
5016
|
+
}), g = $n({
|
|
4796
5017
|
text: e,
|
|
4797
5018
|
width: p,
|
|
4798
5019
|
height: m,
|
|
4799
5020
|
padding: d,
|
|
4800
|
-
internalShapeTextInset:
|
|
5021
|
+
internalShapeTextInset: Lr({
|
|
4801
5022
|
width: p,
|
|
4802
5023
|
height: m,
|
|
4803
5024
|
internalShapeTextInset: f,
|
|
@@ -4806,20 +5027,20 @@ var Xn = ({ text: e, width: t, height: n, alignV: r, padding: i, wrapPolicy: a,
|
|
|
4806
5027
|
expandShapeHeightToFitText: c,
|
|
4807
5028
|
changedPadding: l,
|
|
4808
5029
|
measureTextboxHeightForFrame: h,
|
|
4809
|
-
resolveMinimumTextFrameWidth: ({ text: e }) =>
|
|
5030
|
+
resolveMinimumTextFrameWidth: ({ text: e }) => or({
|
|
4810
5031
|
text: e,
|
|
4811
5032
|
measurementCache: u
|
|
4812
5033
|
})
|
|
4813
5034
|
});
|
|
4814
|
-
for (let t = 0; t <
|
|
5035
|
+
for (let t = 0; t < br; t += 1) {
|
|
4815
5036
|
let t = Math.max(m, g.requiredHeight);
|
|
4816
5037
|
if (t <= m + q) break;
|
|
4817
|
-
m = t, g =
|
|
5038
|
+
m = t, g = $n({
|
|
4818
5039
|
text: e,
|
|
4819
5040
|
width: p,
|
|
4820
5041
|
height: m,
|
|
4821
5042
|
padding: d,
|
|
4822
|
-
internalShapeTextInset:
|
|
5043
|
+
internalShapeTextInset: Lr({
|
|
4823
5044
|
width: p,
|
|
4824
5045
|
height: m,
|
|
4825
5046
|
internalShapeTextInset: f,
|
|
@@ -4828,13 +5049,13 @@ var Xn = ({ text: e, width: t, height: n, alignV: r, padding: i, wrapPolicy: a,
|
|
|
4828
5049
|
expandShapeHeightToFitText: c,
|
|
4829
5050
|
changedPadding: l,
|
|
4830
5051
|
measureTextboxHeightForFrame: h,
|
|
4831
|
-
resolveMinimumTextFrameWidth: ({ text: e }) =>
|
|
5052
|
+
resolveMinimumTextFrameWidth: ({ text: e }) => or({
|
|
4832
5053
|
text: e,
|
|
4833
5054
|
measurementCache: u
|
|
4834
5055
|
})
|
|
4835
5056
|
});
|
|
4836
5057
|
}
|
|
4837
|
-
return
|
|
5058
|
+
return Cr({
|
|
4838
5059
|
text: e,
|
|
4839
5060
|
alignV: r,
|
|
4840
5061
|
width: p,
|
|
@@ -4844,9 +5065,9 @@ var Xn = ({ text: e, width: t, height: n, alignV: r, padding: i, wrapPolicy: a,
|
|
|
4844
5065
|
wrapPolicy: a
|
|
4845
5066
|
});
|
|
4846
5067
|
};
|
|
4847
|
-
function
|
|
5068
|
+
function Er({ group: e, shape: t, text: n, alignH: r, alignV: i, resolvedLayout: a }) {
|
|
4848
5069
|
let o = Math.max(K, e.shapeManualBaseWidth ?? a.width), s = Math.max(K, e.shapeManualBaseHeight ?? a.height), { width: c, height: l, appliedUserPadding: u, frame: d, splitByGrapheme: f, textTop: p, wrapPolicy: m } = a;
|
|
4849
|
-
|
|
5070
|
+
Tn({
|
|
4850
5071
|
shape: t,
|
|
4851
5072
|
width: c,
|
|
4852
5073
|
height: l,
|
|
@@ -4875,14 +5096,14 @@ function Qn({ group: e, shape: t, text: n, alignH: r, alignV: i, resolvedLayout:
|
|
|
4875
5096
|
scaleY: 1
|
|
4876
5097
|
}), e.set("dirty", !0), e.setCoords();
|
|
4877
5098
|
}
|
|
4878
|
-
var
|
|
4879
|
-
|
|
5099
|
+
var Dr = ({ 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 }) => {
|
|
5100
|
+
Er({
|
|
4880
5101
|
group: e,
|
|
4881
5102
|
shape: t,
|
|
4882
5103
|
text: n,
|
|
4883
5104
|
alignH: a,
|
|
4884
5105
|
alignV: o,
|
|
4885
|
-
resolvedLayout:
|
|
5106
|
+
resolvedLayout: wr({
|
|
4886
5107
|
text: n,
|
|
4887
5108
|
width: r,
|
|
4888
5109
|
height: i,
|
|
@@ -4898,14 +5119,14 @@ var $n = ({ group: e, shape: t, text: n, width: r, height: i, alignH: a, alignV:
|
|
|
4898
5119
|
changedPadding: h
|
|
4899
5120
|
})
|
|
4900
5121
|
});
|
|
4901
|
-
},
|
|
4902
|
-
|
|
5122
|
+
}, Or = ({ 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 }) => {
|
|
5123
|
+
Er({
|
|
4903
5124
|
group: e,
|
|
4904
5125
|
shape: t,
|
|
4905
5126
|
text: n,
|
|
4906
5127
|
alignH: a,
|
|
4907
5128
|
alignV: o,
|
|
4908
|
-
resolvedLayout:
|
|
5129
|
+
resolvedLayout: Tr({
|
|
4909
5130
|
text: n,
|
|
4910
5131
|
width: r,
|
|
4911
5132
|
height: i,
|
|
@@ -4919,9 +5140,9 @@ var $n = ({ group: e, shape: t, text: n, width: r, height: i, alignH: a, alignV:
|
|
|
4919
5140
|
})
|
|
4920
5141
|
});
|
|
4921
5142
|
};
|
|
4922
|
-
function
|
|
5143
|
+
function kr({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalShapeTextInset: a, resolveInternalShapeTextInset: o, shapeTextAutoExpandEnabled: s = !0, montageAreaWidth: c, expandShapeHeightToFitText: l = !0, changedPadding: u }) {
|
|
4923
5144
|
let d = Math.max(K, t), f = Math.max(K, n), p = Number.isFinite(c) && (c ?? 0) > 0 ? Math.max(K, c ?? K) : null;
|
|
4924
|
-
if (!
|
|
5145
|
+
if (!Pr({ text: e })) return Rr({
|
|
4925
5146
|
text: e,
|
|
4926
5147
|
width: d,
|
|
4927
5148
|
height: f,
|
|
@@ -4933,7 +5154,7 @@ function tr({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalS
|
|
|
4933
5154
|
changedPadding: u
|
|
4934
5155
|
});
|
|
4935
5156
|
let m = f / d, h = ({ width: t }) => {
|
|
4936
|
-
let n = Math.max(K, t * m), s =
|
|
5157
|
+
let n = Math.max(K, t * m), s = Rr({
|
|
4937
5158
|
text: e,
|
|
4938
5159
|
width: t,
|
|
4939
5160
|
height: n,
|
|
@@ -4946,7 +5167,7 @@ function tr({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalS
|
|
|
4946
5167
|
});
|
|
4947
5168
|
return {
|
|
4948
5169
|
candidateHeight: n,
|
|
4949
|
-
frameWidth:
|
|
5170
|
+
frameWidth: Kn({
|
|
4950
5171
|
width: t,
|
|
4951
5172
|
padding: s.appliedPadding
|
|
4952
5173
|
}),
|
|
@@ -4962,11 +5183,11 @@ function tr({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalS
|
|
|
4962
5183
|
layoutResolution: n
|
|
4963
5184
|
});
|
|
4964
5185
|
}, t = p ? Math.max(d, p) : d;
|
|
4965
|
-
e({ width: t }) || (t =
|
|
5186
|
+
e({ width: t }) || (t = zr({
|
|
4966
5187
|
minimumWidth: t,
|
|
4967
5188
|
isWidthValid: e
|
|
4968
5189
|
}));
|
|
4969
|
-
let { layoutResolution: n } = h({ width:
|
|
5190
|
+
let { layoutResolution: n } = h({ width: Br({
|
|
4970
5191
|
minimumWidth: d,
|
|
4971
5192
|
maximumWidth: t,
|
|
4972
5193
|
isWidthValid: e
|
|
@@ -4979,21 +5200,21 @@ function tr({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalS
|
|
|
4979
5200
|
candidateWidth: t,
|
|
4980
5201
|
candidateHeight: r,
|
|
4981
5202
|
layoutResolution: o
|
|
4982
|
-
}) || n !== void 0 && a < n - q ? !1 : !
|
|
5203
|
+
}) || n !== void 0 && a < n - q ? !1 : !ir({
|
|
4983
5204
|
text: e,
|
|
4984
5205
|
frameWidth: a,
|
|
4985
5206
|
wrapPolicy: i
|
|
4986
5207
|
}).hasWrappedLines;
|
|
4987
|
-
}, v = p ? Math.max(d, p) :
|
|
5208
|
+
}, v = p ? Math.max(d, p) : zr({
|
|
4988
5209
|
minimumWidth: d,
|
|
4989
5210
|
isWidthValid: ({ width: e }) => _({ width: e })
|
|
4990
|
-
}), y = h({ width: v }), b =
|
|
5211
|
+
}), y = h({ width: v }), b = ir({
|
|
4991
5212
|
text: e,
|
|
4992
5213
|
frameWidth: y.frameWidth,
|
|
4993
5214
|
wrapPolicy: i
|
|
4994
5215
|
});
|
|
4995
5216
|
if (b.hasWrappedLines) return y.layoutResolution;
|
|
4996
|
-
let x = Math.max(K, b.longestLineWidth), { layoutResolution: S } = h({ width:
|
|
5217
|
+
let x = Math.max(K, b.longestLineWidth), { layoutResolution: S } = h({ width: Br({
|
|
4997
5218
|
minimumWidth: d,
|
|
4998
5219
|
maximumWidth: v,
|
|
4999
5220
|
isWidthValid: ({ width: e }) => _({
|
|
@@ -5003,73 +5224,73 @@ function tr({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalS
|
|
|
5003
5224
|
}) });
|
|
5004
5225
|
return S;
|
|
5005
5226
|
}
|
|
5006
|
-
var
|
|
5227
|
+
var Ar = ({ text: e, currentWidth: t, minimumWidth: n, padding: r, wrapPolicy: i, montageAreaWidth: a, resolvePaddingForWidth: o }) => {
|
|
5007
5228
|
let s = Math.max(K, t), c = Math.max(K, n);
|
|
5008
|
-
if (!
|
|
5009
|
-
let l = Math.max(c, Number.isFinite(a) && a > 0 ? Math.max(K, a) : Math.max(s, c)), u =
|
|
5229
|
+
if (!Pr({ text: e })) return c;
|
|
5230
|
+
let l = Math.max(c, Number.isFinite(a) && a > 0 ? Math.max(K, a) : Math.max(s, c)), u = Kn({
|
|
5010
5231
|
width: l,
|
|
5011
|
-
padding:
|
|
5232
|
+
padding: Fr({
|
|
5012
5233
|
width: l,
|
|
5013
5234
|
padding: r,
|
|
5014
5235
|
resolvePaddingForWidth: o
|
|
5015
5236
|
})
|
|
5016
|
-
}), d = l, f =
|
|
5237
|
+
}), d = l, f = ir({
|
|
5017
5238
|
text: e,
|
|
5018
5239
|
frameWidth: u,
|
|
5019
5240
|
wrapPolicy: i
|
|
5020
5241
|
});
|
|
5021
5242
|
if (f.hasWrappedLines) return d;
|
|
5022
5243
|
let p = Math.max(K, f.longestLineWidth);
|
|
5023
|
-
return
|
|
5244
|
+
return Br({
|
|
5024
5245
|
minimumWidth: c,
|
|
5025
5246
|
maximumWidth: d,
|
|
5026
5247
|
isWidthValid: ({ width: t }) => {
|
|
5027
|
-
let n =
|
|
5248
|
+
let n = Kn({
|
|
5028
5249
|
width: t,
|
|
5029
|
-
padding:
|
|
5250
|
+
padding: Fr({
|
|
5030
5251
|
width: t,
|
|
5031
5252
|
padding: r,
|
|
5032
5253
|
resolvePaddingForWidth: o
|
|
5033
5254
|
})
|
|
5034
5255
|
});
|
|
5035
|
-
return n < p - q ? !1 : !
|
|
5256
|
+
return n < p - q ? !1 : !ir({
|
|
5036
5257
|
text: e,
|
|
5037
5258
|
frameWidth: n,
|
|
5038
5259
|
wrapPolicy: i
|
|
5039
5260
|
}).hasWrappedLines;
|
|
5040
5261
|
}
|
|
5041
5262
|
});
|
|
5042
|
-
},
|
|
5043
|
-
if (!
|
|
5044
|
-
let i =
|
|
5263
|
+
}, jr = ({ text: e, padding: t, resolvePaddingForWidth: n, measurementCache: r }) => {
|
|
5264
|
+
if (!Pr({ text: e })) return K;
|
|
5265
|
+
let i = or({
|
|
5045
5266
|
text: e,
|
|
5046
5267
|
measurementCache: r
|
|
5047
|
-
}), a = Math.max(K, i), o = ({ width: e }) =>
|
|
5268
|
+
}), a = Math.max(K, i), o = ({ width: e }) => Kn({
|
|
5048
5269
|
width: e,
|
|
5049
|
-
padding:
|
|
5270
|
+
padding: Fr({
|
|
5050
5271
|
width: e,
|
|
5051
5272
|
padding: t,
|
|
5052
5273
|
resolvePaddingForWidth: n
|
|
5053
5274
|
})
|
|
5054
5275
|
}) >= i - q;
|
|
5055
|
-
return
|
|
5276
|
+
return Br({
|
|
5056
5277
|
minimumWidth: a,
|
|
5057
|
-
maximumWidth:
|
|
5278
|
+
maximumWidth: zr({
|
|
5058
5279
|
minimumWidth: a,
|
|
5059
5280
|
isWidthValid: o
|
|
5060
5281
|
}),
|
|
5061
5282
|
isWidthValid: o
|
|
5062
5283
|
});
|
|
5063
|
-
},
|
|
5064
|
-
let o =
|
|
5284
|
+
}, Mr = ({ text: e, width: t, height: n, alignV: r, wrapPolicy: i, padding: a }) => {
|
|
5285
|
+
let o = Vr({
|
|
5065
5286
|
width: Math.max(K, t),
|
|
5066
5287
|
height: Math.max(K, n),
|
|
5067
5288
|
padding: V({ padding: a })
|
|
5068
|
-
}), s =
|
|
5289
|
+
}), s = cr({
|
|
5069
5290
|
text: e,
|
|
5070
5291
|
frameWidth: o.width,
|
|
5071
5292
|
wrapPolicy: i
|
|
5072
|
-
}), c =
|
|
5293
|
+
}), c = ar({
|
|
5073
5294
|
text: e,
|
|
5074
5295
|
frameWidth: o.width,
|
|
5075
5296
|
splitByGrapheme: s,
|
|
@@ -5078,26 +5299,26 @@ var nr = ({ text: e, currentWidth: t, minimumWidth: n, padding: r, wrapPolicy: i
|
|
|
5078
5299
|
return {
|
|
5079
5300
|
frame: o,
|
|
5080
5301
|
splitByGrapheme: s,
|
|
5081
|
-
textTop:
|
|
5302
|
+
textTop: sr({
|
|
5082
5303
|
alignV: r,
|
|
5083
5304
|
frameHeight: o.height,
|
|
5084
5305
|
frameTop: o.top,
|
|
5085
5306
|
textHeight: c
|
|
5086
5307
|
})
|
|
5087
5308
|
};
|
|
5088
|
-
},
|
|
5309
|
+
}, Nr = ({ text: e, width: t, height: n, padding: r, wrapPolicy: i, resolvePaddingForSize: a, measurementCache: o }) => {
|
|
5089
5310
|
let s = Math.max(K, n);
|
|
5090
|
-
if (!
|
|
5311
|
+
if (!Pr({ text: e })) return s;
|
|
5091
5312
|
let c = Math.max(K, t), l = s;
|
|
5092
|
-
for (let t = 0; t <
|
|
5093
|
-
let t =
|
|
5313
|
+
for (let t = 0; t < br; t += 1) {
|
|
5314
|
+
let t = Ir({
|
|
5094
5315
|
width: c,
|
|
5095
5316
|
height: l,
|
|
5096
5317
|
padding: r,
|
|
5097
5318
|
resolvePaddingForSize: a
|
|
5098
|
-
}), n =
|
|
5319
|
+
}), n = ar({
|
|
5099
5320
|
text: e,
|
|
5100
|
-
frameWidth:
|
|
5321
|
+
frameWidth: Kn({
|
|
5101
5322
|
width: c,
|
|
5102
5323
|
padding: t
|
|
5103
5324
|
}),
|
|
@@ -5109,35 +5330,35 @@ var nr = ({ text: e, currentWidth: t, minimumWidth: n, padding: r, wrapPolicy: i
|
|
|
5109
5330
|
}
|
|
5110
5331
|
return l;
|
|
5111
5332
|
};
|
|
5112
|
-
function
|
|
5333
|
+
function Pr({ text: e }) {
|
|
5113
5334
|
return (e.text ?? "").trim().length > 0;
|
|
5114
5335
|
}
|
|
5115
|
-
function
|
|
5336
|
+
function Fr({ width: e, padding: t, resolvePaddingForWidth: n }) {
|
|
5116
5337
|
return V(n ? { padding: n({ width: Math.max(K, e) }) } : { padding: t });
|
|
5117
5338
|
}
|
|
5118
|
-
function
|
|
5339
|
+
function Ir({ width: e, height: t, padding: n, resolvePaddingForSize: r }) {
|
|
5119
5340
|
return V(r ? { padding: r({
|
|
5120
5341
|
width: Math.max(K, e),
|
|
5121
5342
|
height: Math.max(K, t)
|
|
5122
5343
|
}) } : { padding: n });
|
|
5123
5344
|
}
|
|
5124
|
-
function
|
|
5345
|
+
function Lr({ width: e, height: t, internalShapeTextInset: n, resolveInternalShapeTextInset: r }) {
|
|
5125
5346
|
return V(r ? { padding: r({
|
|
5126
5347
|
width: Math.max(K, e),
|
|
5127
5348
|
height: Math.max(K, t)
|
|
5128
5349
|
}) } : { padding: n });
|
|
5129
5350
|
}
|
|
5130
|
-
function
|
|
5131
|
-
let l = Ne({ padding: r }), u = V({ padding: a }), d = Math.max(K, t), f = Math.max(K, n), p = ({ text: e, frameWidth: t }) =>
|
|
5351
|
+
function Rr({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalShapeTextInset: a, resolveInternalShapeTextInset: o, expandShapeHeightToFitText: s = !0, changedPadding: c }) {
|
|
5352
|
+
let l = Ne({ padding: r }), u = V({ padding: a }), d = Math.max(K, t), f = Math.max(K, n), p = ({ text: e, frameWidth: t }) => ar({
|
|
5132
5353
|
text: e,
|
|
5133
5354
|
frameWidth: t,
|
|
5134
5355
|
wrapPolicy: i
|
|
5135
|
-
}), m =
|
|
5356
|
+
}), m = $n({
|
|
5136
5357
|
text: e,
|
|
5137
5358
|
width: d,
|
|
5138
5359
|
height: f,
|
|
5139
5360
|
padding: l,
|
|
5140
|
-
internalShapeTextInset:
|
|
5361
|
+
internalShapeTextInset: Lr({
|
|
5141
5362
|
width: d,
|
|
5142
5363
|
height: f,
|
|
5143
5364
|
internalShapeTextInset: u,
|
|
@@ -5146,17 +5367,17 @@ function ur({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalS
|
|
|
5146
5367
|
expandShapeHeightToFitText: s,
|
|
5147
5368
|
changedPadding: c,
|
|
5148
5369
|
measureTextboxHeightForFrame: p,
|
|
5149
|
-
resolveMinimumTextFrameWidth:
|
|
5370
|
+
resolveMinimumTextFrameWidth: or
|
|
5150
5371
|
});
|
|
5151
|
-
for (let t = 0; t <
|
|
5372
|
+
for (let t = 0; t < br; t += 1) {
|
|
5152
5373
|
let t = Math.max(d, m.requiredWidth), n = Math.max(f, m.requiredHeight);
|
|
5153
5374
|
if (t <= d + q && n <= f + q) break;
|
|
5154
|
-
d = t, f = n, m =
|
|
5375
|
+
d = t, f = n, m = $n({
|
|
5155
5376
|
text: e,
|
|
5156
5377
|
width: d,
|
|
5157
5378
|
height: f,
|
|
5158
5379
|
padding: l,
|
|
5159
|
-
internalShapeTextInset:
|
|
5380
|
+
internalShapeTextInset: Lr({
|
|
5160
5381
|
width: d,
|
|
5161
5382
|
height: f,
|
|
5162
5383
|
internalShapeTextInset: u,
|
|
@@ -5165,7 +5386,7 @@ function ur({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalS
|
|
|
5165
5386
|
expandShapeHeightToFitText: s,
|
|
5166
5387
|
changedPadding: c,
|
|
5167
5388
|
measureTextboxHeightForFrame: p,
|
|
5168
|
-
resolveMinimumTextFrameWidth:
|
|
5389
|
+
resolveMinimumTextFrameWidth: or
|
|
5169
5390
|
});
|
|
5170
5391
|
}
|
|
5171
5392
|
return {
|
|
@@ -5175,17 +5396,17 @@ function ur({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalS
|
|
|
5175
5396
|
appliedUserPadding: m.appliedUserPadding
|
|
5176
5397
|
};
|
|
5177
5398
|
}
|
|
5178
|
-
function
|
|
5399
|
+
function zr({ minimumWidth: e, isWidthValid: t }) {
|
|
5179
5400
|
let n = Math.max(K, e);
|
|
5180
5401
|
if (t({ width: n })) return n;
|
|
5181
|
-
for (let e = 0; e <
|
|
5402
|
+
for (let e = 0; e < Sr; e += 1) if (n = Math.max(n + 1, n * 2), t({ width: n })) return n;
|
|
5182
5403
|
return n;
|
|
5183
5404
|
}
|
|
5184
|
-
function
|
|
5405
|
+
function Br({ minimumWidth: e, maximumWidth: t, isWidthValid: n }) {
|
|
5185
5406
|
let r = Math.max(K, e), i = Math.max(r, t);
|
|
5186
5407
|
if (n({ width: r })) return r;
|
|
5187
5408
|
if (!n({ width: i })) return i;
|
|
5188
|
-
for (let e = 0; e <
|
|
5409
|
+
for (let e = 0; e < xr && !(i - r <= q); e += 1) {
|
|
5189
5410
|
let e = r + (i - r) / 2;
|
|
5190
5411
|
if (n({ width: e })) {
|
|
5191
5412
|
i = e;
|
|
@@ -5195,7 +5416,7 @@ function fr({ minimumWidth: e, maximumWidth: t, isWidthValid: n }) {
|
|
|
5195
5416
|
}
|
|
5196
5417
|
return i;
|
|
5197
5418
|
}
|
|
5198
|
-
function
|
|
5419
|
+
function Vr({ width: e, height: t, padding: n }) {
|
|
5199
5420
|
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);
|
|
5200
5421
|
return {
|
|
5201
5422
|
left: -e / 2 + r,
|
|
@@ -5206,7 +5427,7 @@ function pr({ width: e, height: t, padding: n }) {
|
|
|
5206
5427
|
}
|
|
5207
5428
|
//#endregion
|
|
5208
5429
|
//#region src/editor/shape-manager/domain/shape-nodes.ts
|
|
5209
|
-
var
|
|
5430
|
+
var Hr = ({ group: e }) => {
|
|
5210
5431
|
let t = e.getObjects();
|
|
5211
5432
|
for (let e = 0; e < t.length; e += 1) {
|
|
5212
5433
|
let n = t[e];
|
|
@@ -5217,7 +5438,7 @@ var mr = ({ group: e }) => {
|
|
|
5217
5438
|
if (!(n instanceof v)) return n;
|
|
5218
5439
|
}
|
|
5219
5440
|
return null;
|
|
5220
|
-
},
|
|
5441
|
+
}, Ur = ({ group: e }) => {
|
|
5221
5442
|
let t = e.getObjects();
|
|
5222
5443
|
for (let e = 0; e < t.length; e += 1) {
|
|
5223
5444
|
let n = t[e];
|
|
@@ -5229,14 +5450,14 @@ var mr = ({ group: e }) => {
|
|
|
5229
5450
|
}
|
|
5230
5451
|
return null;
|
|
5231
5452
|
}, J = ({ group: e }) => ({
|
|
5232
|
-
shape:
|
|
5233
|
-
text:
|
|
5234
|
-
}),
|
|
5453
|
+
shape: Hr({ group: e }),
|
|
5454
|
+
text: Ur({ group: e })
|
|
5455
|
+
}), Wr = ({ transform: e, key: t }) => {
|
|
5235
5456
|
let n = e?.original;
|
|
5236
5457
|
if (!n || typeof n != "object") return null;
|
|
5237
5458
|
let r = n[t];
|
|
5238
5459
|
return typeof r != "number" || !Number.isFinite(r) ? null : r;
|
|
5239
|
-
},
|
|
5460
|
+
}, Gr = ({ value: e }) => e === "left" || e === "center" || e === "right" || typeof e == "number" && Number.isFinite(e) ? e : null, Kr = ({ value: e }) => e === "top" || e === "center" || e === "bottom" || typeof e == "number" && Number.isFinite(e) ? e : null, Y = ({ transform: e }) => {
|
|
5240
5461
|
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;
|
|
5241
5462
|
return {
|
|
5242
5463
|
canScaleWidth: o,
|
|
@@ -5244,37 +5465,37 @@ var mr = ({ group: e }) => {
|
|
|
5244
5465
|
isCornerScaleAction: r,
|
|
5245
5466
|
isVerticalOnlyScale: s && !o
|
|
5246
5467
|
};
|
|
5247
|
-
},
|
|
5468
|
+
}, qr = ({ event: e, target: t, transform: n, canvas: r }) => {
|
|
5248
5469
|
if (!e) return null;
|
|
5249
5470
|
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;
|
|
5250
5471
|
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;
|
|
5251
|
-
},
|
|
5472
|
+
}, Jr = ({ group: e, originX: t, originY: n }) => {
|
|
5252
5473
|
if (t === null || n === null) return null;
|
|
5253
5474
|
let r = e, i = typeof r.getRelativeCenterPoint == "function" ? r.getRelativeCenterPoint() : e.getCenterPoint();
|
|
5254
5475
|
return typeof r.translateToOriginPoint == "function" ? r.translateToOriginPoint(i, t, n) : i;
|
|
5255
|
-
},
|
|
5476
|
+
}, Yr = ({ state: e, transform: t }) => {
|
|
5256
5477
|
if (!t || e.startTransformOriginX === null && e.startTransformOriginY === null) return !1;
|
|
5257
|
-
let n =
|
|
5478
|
+
let n = Gr({ value: t.originX }), r = Kr({ value: t.originY });
|
|
5258
5479
|
return n !== e.startTransformOriginX || r !== e.startTransformOriginY;
|
|
5259
|
-
},
|
|
5480
|
+
}, Xr = ({ state: e, transform: t }) => !t || !e.startTransformCorner ? !1 : t.corner !== e.startTransformCorner;
|
|
5260
5481
|
//#endregion
|
|
5261
5482
|
//#region src/editor/shape-manager/scaling/shape-scaling-preview.ts
|
|
5262
|
-
function
|
|
5483
|
+
function Zr({ size: e, scale: t, strokeWidth: n, minSize: r, scaleEpsilon: i }) {
|
|
5263
5484
|
let a = Math.max(i, Math.abs(t) || 1), o = Math.max(0, n);
|
|
5264
5485
|
return o <= 0 ? Math.max(r, e / a) : Math.max(r, e / a + o - o / a);
|
|
5265
5486
|
}
|
|
5266
|
-
function
|
|
5487
|
+
function Qr({ group: e, shape: t, width: n, height: r, scaleX: i, scaleY: a, minSize: o, scaleEpsilon: s }) {
|
|
5267
5488
|
let c = Math.max(0, e.shapeStrokeWidth ?? 0);
|
|
5268
|
-
|
|
5489
|
+
Tn({
|
|
5269
5490
|
shape: t,
|
|
5270
|
-
width:
|
|
5491
|
+
width: Zr({
|
|
5271
5492
|
size: n,
|
|
5272
5493
|
scale: i,
|
|
5273
5494
|
strokeWidth: c,
|
|
5274
5495
|
minSize: o,
|
|
5275
5496
|
scaleEpsilon: s
|
|
5276
5497
|
}),
|
|
5277
|
-
height:
|
|
5498
|
+
height: Zr({
|
|
5278
5499
|
size: r,
|
|
5279
5500
|
scale: a,
|
|
5280
5501
|
strokeWidth: c,
|
|
@@ -5285,7 +5506,7 @@ function wr({ group: e, shape: t, width: n, height: r, scaleX: i, scaleY: a, min
|
|
|
5285
5506
|
strokeWidth: c
|
|
5286
5507
|
});
|
|
5287
5508
|
}
|
|
5288
|
-
function
|
|
5509
|
+
function $r({ text: e, layout: t, alignH: n, scaleX: r, scaleY: i, scaleEpsilon: a }) {
|
|
5289
5510
|
let o = Math.max(a, Math.abs(r) || 1), s = Math.max(a, Math.abs(i) || 1), c = n ?? "center";
|
|
5290
5511
|
e.set({
|
|
5291
5512
|
autoExpand: !1,
|
|
@@ -5300,13 +5521,13 @@ function Tr({ text: e, layout: t, alignH: n, scaleX: r, scaleY: i, scaleEpsilon:
|
|
|
5300
5521
|
scaleY: 1 / s
|
|
5301
5522
|
}), e.initDimensions(), e.setCoords();
|
|
5302
5523
|
}
|
|
5303
|
-
var
|
|
5524
|
+
var ei = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY: o, minSize: s, scaleEpsilon: c }) => {
|
|
5304
5525
|
let l = Math.max(c, Math.abs(a) || 1), u = Math.max(c, Math.abs(o) || 1);
|
|
5305
5526
|
e.set({
|
|
5306
5527
|
width: r.width / l,
|
|
5307
5528
|
height: r.height / u,
|
|
5308
5529
|
dirty: !0
|
|
5309
|
-
}),
|
|
5530
|
+
}), Qr({
|
|
5310
5531
|
group: e,
|
|
5311
5532
|
shape: t,
|
|
5312
5533
|
width: r.width,
|
|
@@ -5315,7 +5536,7 @@ var Er = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
5315
5536
|
scaleY: o,
|
|
5316
5537
|
minSize: s,
|
|
5317
5538
|
scaleEpsilon: c
|
|
5318
|
-
}),
|
|
5539
|
+
}), $r({
|
|
5319
5540
|
text: n,
|
|
5320
5541
|
layout: r,
|
|
5321
5542
|
alignH: i,
|
|
@@ -5323,23 +5544,23 @@ var Er = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
5323
5544
|
scaleY: o,
|
|
5324
5545
|
scaleEpsilon: c
|
|
5325
5546
|
});
|
|
5326
|
-
}, X = 1e-4,
|
|
5327
|
-
function
|
|
5547
|
+
}, X = 1e-4, ti = .5;
|
|
5548
|
+
function ni({ isProportionalScaling: e }) {
|
|
5328
5549
|
if (e) return "words-only";
|
|
5329
5550
|
}
|
|
5330
|
-
function
|
|
5551
|
+
function ri({ width: e, height: t }) {
|
|
5331
5552
|
return `${Math.round(Math.max(1, e) * 1e6) / 1e6}:${Math.round(Math.max(1, t) * 1e6) / 1e6}`;
|
|
5332
5553
|
}
|
|
5333
|
-
function
|
|
5554
|
+
function ii({ width: e, padding: t }) {
|
|
5334
5555
|
return Math.max(1, e - Math.max(0, t.left) - Math.max(0, t.right));
|
|
5335
5556
|
}
|
|
5336
|
-
function
|
|
5557
|
+
function ai({ height: e, padding: t }) {
|
|
5337
5558
|
return Math.max(1, e - Math.max(0, t.top) - Math.max(0, t.bottom));
|
|
5338
5559
|
}
|
|
5339
|
-
function
|
|
5560
|
+
function oi({ text: e }) {
|
|
5340
5561
|
return (e.text ?? "").trim().length > 0;
|
|
5341
5562
|
}
|
|
5342
|
-
function
|
|
5563
|
+
function si({ height: e }) {
|
|
5343
5564
|
return {
|
|
5344
5565
|
measuredHeight: e,
|
|
5345
5566
|
renderedLineCount: 0,
|
|
@@ -5348,7 +5569,7 @@ function Nr({ height: e }) {
|
|
|
5348
5569
|
isValid: !0
|
|
5349
5570
|
};
|
|
5350
5571
|
}
|
|
5351
|
-
function
|
|
5572
|
+
function ci({ group: e }) {
|
|
5352
5573
|
return Ne({ padding: {
|
|
5353
5574
|
top: e.shapePaddingTop,
|
|
5354
5575
|
right: e.shapePaddingRight,
|
|
@@ -5356,7 +5577,7 @@ function Pr({ group: e }) {
|
|
|
5356
5577
|
left: e.shapePaddingLeft
|
|
5357
5578
|
} });
|
|
5358
5579
|
}
|
|
5359
|
-
function
|
|
5580
|
+
function li({ group: e, width: t, height: n }) {
|
|
5360
5581
|
let r = e.shapePresetKey ?? "", i = r ? we({ presetKey: r }) : null;
|
|
5361
5582
|
return Le({
|
|
5362
5583
|
baseInset: i ? De({
|
|
@@ -5369,33 +5590,33 @@ function Fr({ group: e, width: t, height: n }) {
|
|
|
5369
5590
|
});
|
|
5370
5591
|
}
|
|
5371
5592
|
function Z({ group: e, width: t, height: n }) {
|
|
5372
|
-
return
|
|
5593
|
+
return li({
|
|
5373
5594
|
group: e,
|
|
5374
5595
|
width: Math.max(1, t ?? e.shapeBaseWidth ?? e.width ?? e.shapeManualBaseWidth ?? 1),
|
|
5375
5596
|
height: Math.max(1, n ?? e.shapeBaseHeight ?? e.height ?? e.shapeManualBaseHeight ?? 1)
|
|
5376
5597
|
});
|
|
5377
5598
|
}
|
|
5378
|
-
function
|
|
5379
|
-
let o = Math.max(1, n), s = Math.max(1, r), c =
|
|
5599
|
+
function ui({ group: e, text: t, width: n, height: r, measurementCache: i, constraintCache: a }) {
|
|
5600
|
+
let o = Math.max(1, n), s = Math.max(1, r), c = ri({
|
|
5380
5601
|
width: o,
|
|
5381
5602
|
height: s
|
|
5382
5603
|
}), l = a?.get(c);
|
|
5383
5604
|
if (l) return l;
|
|
5384
|
-
if (!
|
|
5385
|
-
let e =
|
|
5605
|
+
if (!oi({ text: t })) {
|
|
5606
|
+
let e = si({ height: s });
|
|
5386
5607
|
return a?.set(c, e), e;
|
|
5387
5608
|
}
|
|
5388
5609
|
let u = Z({
|
|
5389
5610
|
group: e,
|
|
5390
5611
|
width: o,
|
|
5391
5612
|
height: s
|
|
5392
|
-
}), d =
|
|
5613
|
+
}), d = ii({
|
|
5393
5614
|
width: o,
|
|
5394
5615
|
padding: u
|
|
5395
|
-
}), f =
|
|
5616
|
+
}), f = ai({
|
|
5396
5617
|
height: s,
|
|
5397
5618
|
padding: u
|
|
5398
|
-
}), p =
|
|
5619
|
+
}), p = rr({
|
|
5399
5620
|
text: t,
|
|
5400
5621
|
frameWidth: d,
|
|
5401
5622
|
splitByGrapheme: !1,
|
|
@@ -5406,9 +5627,9 @@ function Ir({ group: e, text: t, width: n, height: r, measurementCache: i, const
|
|
|
5406
5627
|
};
|
|
5407
5628
|
return a?.set(c, m), m;
|
|
5408
5629
|
}
|
|
5409
|
-
function
|
|
5630
|
+
function di({ group: e, text: t, state: n }) {
|
|
5410
5631
|
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 }) => {
|
|
5411
|
-
let o =
|
|
5632
|
+
let o = ui({
|
|
5412
5633
|
group: e,
|
|
5413
5634
|
text: t,
|
|
5414
5635
|
width: Math.max(1, i * a),
|
|
@@ -5439,8 +5660,8 @@ function Lr({ group: e, text: t, state: n }) {
|
|
|
5439
5660
|
minimumHeight: g
|
|
5440
5661
|
};
|
|
5441
5662
|
}
|
|
5442
|
-
function
|
|
5443
|
-
return
|
|
5663
|
+
function fi({ group: e, text: t, width: n, padding: r, wrapPolicy: i, measurementCache: a }) {
|
|
5664
|
+
return Nr({
|
|
5444
5665
|
text: t,
|
|
5445
5666
|
width: n,
|
|
5446
5667
|
height: 1,
|
|
@@ -5454,8 +5675,8 @@ function Rr({ group: e, text: t, width: n, padding: r, wrapPolicy: i, measuremen
|
|
|
5454
5675
|
})
|
|
5455
5676
|
});
|
|
5456
5677
|
}
|
|
5457
|
-
function
|
|
5458
|
-
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 ??
|
|
5678
|
+
function pi({ group: e, text: t, constraintPadding: n, startDimensions: r, appliedScaleX: i, appliedScaleY: a, minimumHeight: o, wrapPolicy: s, measurementCache: c }) {
|
|
5679
|
+
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 ?? Nr({
|
|
5459
5680
|
text: t,
|
|
5460
5681
|
width: l,
|
|
5461
5682
|
height: u,
|
|
@@ -5473,25 +5694,25 @@ function zr({ group: e, text: t, constraintPadding: n, startDimensions: r, appli
|
|
|
5473
5694
|
previewHeight: Math.max(u, d)
|
|
5474
5695
|
};
|
|
5475
5696
|
}
|
|
5476
|
-
function
|
|
5477
|
-
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 =
|
|
5478
|
-
return
|
|
5697
|
+
function mi({ group: e, text: t, state: n, appliedScaleX: r, appliedScaleY: i, minimumHeight: a }) {
|
|
5698
|
+
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 = ni({ isProportionalScaling: n.isProportionalScaling });
|
|
5699
|
+
return Tr({
|
|
5479
5700
|
text: t,
|
|
5480
5701
|
width: o,
|
|
5481
5702
|
height: c,
|
|
5482
5703
|
alignV: e.shapeAlignVertical ?? "middle",
|
|
5483
|
-
padding:
|
|
5704
|
+
padding: ci({ group: e }),
|
|
5484
5705
|
wrapPolicy: u,
|
|
5485
5706
|
expandShapeHeightToFitText: l,
|
|
5486
5707
|
measurementCache: n.previewTextMeasurementCache ?? void 0,
|
|
5487
|
-
resolveInternalShapeTextInset: ({ width: t, height: n }) =>
|
|
5708
|
+
resolveInternalShapeTextInset: ({ width: t, height: n }) => li({
|
|
5488
5709
|
group: e,
|
|
5489
5710
|
width: t,
|
|
5490
5711
|
height: n
|
|
5491
5712
|
})
|
|
5492
5713
|
});
|
|
5493
5714
|
}
|
|
5494
|
-
function
|
|
5715
|
+
function hi({ group: e, transform: t }) {
|
|
5495
5716
|
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);
|
|
5496
5717
|
return {
|
|
5497
5718
|
startWidth: i,
|
|
@@ -5502,25 +5723,25 @@ function Vr({ group: e, transform: t }) {
|
|
|
5502
5723
|
canScaleHeight: r
|
|
5503
5724
|
};
|
|
5504
5725
|
}
|
|
5505
|
-
function
|
|
5726
|
+
function gi({ scalingState: e, group: t, text: n, constraintPadding: r, transform: i }) {
|
|
5506
5727
|
let a = e.get(t);
|
|
5507
5728
|
if (a) return a;
|
|
5508
|
-
let o =
|
|
5729
|
+
let o = hi({
|
|
5509
5730
|
group: t,
|
|
5510
5731
|
transform: i
|
|
5511
|
-
}), s =
|
|
5732
|
+
}), s = Wr({
|
|
5512
5733
|
transform: i,
|
|
5513
5734
|
key: "scaleX"
|
|
5514
|
-
}), c =
|
|
5735
|
+
}), c = Wr({
|
|
5515
5736
|
transform: i,
|
|
5516
5737
|
key: "scaleY"
|
|
5517
|
-
}), l =
|
|
5738
|
+
}), l = Wr({
|
|
5518
5739
|
transform: i,
|
|
5519
5740
|
key: "left"
|
|
5520
|
-
}), u =
|
|
5741
|
+
}), u = Wr({
|
|
5521
5742
|
transform: i,
|
|
5522
5743
|
key: "top"
|
|
5523
|
-
}), 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 =
|
|
5744
|
+
}), 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 = Gr({ value: i?.original?.originX ?? i?.originX }), g = Kr({ value: i?.original?.originY ?? i?.originY }), _ = typeof i?.corner == "string" ? i.corner : null, v = Jr({
|
|
5524
5745
|
group: t,
|
|
5525
5746
|
originX: h,
|
|
5526
5747
|
originY: g
|
|
@@ -5528,7 +5749,7 @@ function Hr({ scalingState: e, group: t, text: n, constraintPadding: r, transfor
|
|
|
5528
5749
|
measurementsByKey: /* @__PURE__ */ new Map(),
|
|
5529
5750
|
splitByGraphemeByFrameWidth: /* @__PURE__ */ new Map(),
|
|
5530
5751
|
minimumTextFrameWidth: null
|
|
5531
|
-
}, x = /* @__PURE__ */ new Map(), S =
|
|
5752
|
+
}, x = /* @__PURE__ */ new Map(), S = fi({
|
|
5532
5753
|
group: t,
|
|
5533
5754
|
text: n,
|
|
5534
5755
|
width: o.startWidth,
|
|
@@ -5570,8 +5791,8 @@ function Hr({ scalingState: e, group: t, text: n, constraintPadding: r, transfor
|
|
|
5570
5791
|
proportionalTextConstraintCache: x
|
|
5571
5792
|
}, e.set(t, a), a;
|
|
5572
5793
|
}
|
|
5573
|
-
function
|
|
5574
|
-
let { previewWidth: s, previewHeight: c } =
|
|
5794
|
+
function _i({ group: e, text: t, constraintPadding: n, startDimensions: r, scaleX: i, scaleY: a, wrapPolicy: o }) {
|
|
5795
|
+
let { previewWidth: s, previewHeight: c } = pi({
|
|
5575
5796
|
group: e,
|
|
5576
5797
|
text: t,
|
|
5577
5798
|
constraintPadding: n,
|
|
@@ -5579,7 +5800,7 @@ function Ur({ group: e, text: t, constraintPadding: n, startDimensions: r, scale
|
|
|
5579
5800
|
appliedScaleX: i,
|
|
5580
5801
|
appliedScaleY: a,
|
|
5581
5802
|
wrapPolicy: o
|
|
5582
|
-
}), { startWidth: l, startHeight: u } = r, d = Math.abs(s - l) >
|
|
5803
|
+
}), { startWidth: l, startHeight: u } = r, d = Math.abs(s - l) > ti, f = Math.abs(c - u) > ti;
|
|
5583
5804
|
return {
|
|
5584
5805
|
width: s,
|
|
5585
5806
|
height: c,
|
|
@@ -5587,7 +5808,7 @@ function Ur({ group: e, text: t, constraintPadding: n, startDimensions: r, scale
|
|
|
5587
5808
|
hasDimensionChange: d || f
|
|
5588
5809
|
};
|
|
5589
5810
|
}
|
|
5590
|
-
function
|
|
5811
|
+
function vi({ startManualBaseWidth: e, startManualBaseHeight: t, canScaleWidth: n, canScaleHeight: r, finalWidth: i, finalHeight: a }) {
|
|
5591
5812
|
let o = e;
|
|
5592
5813
|
n && (o = i);
|
|
5593
5814
|
let s = t;
|
|
@@ -5596,8 +5817,8 @@ function Wr({ startManualBaseWidth: e, startManualBaseHeight: t, canScaleWidth:
|
|
|
5596
5817
|
height: s
|
|
5597
5818
|
};
|
|
5598
5819
|
}
|
|
5599
|
-
function
|
|
5600
|
-
let p =
|
|
5820
|
+
function yi({ 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 }) {
|
|
5821
|
+
let p = vi({
|
|
5601
5822
|
startManualBaseWidth: s,
|
|
5602
5823
|
startManualBaseHeight: c,
|
|
5603
5824
|
canScaleWidth: l,
|
|
@@ -5606,16 +5827,16 @@ function Gr({ group: e, shape: t, text: n, width: r, height: i, alignH: a, align
|
|
|
5606
5827
|
finalHeight: i
|
|
5607
5828
|
});
|
|
5608
5829
|
e.shapeManualBaseWidth = p.width, e.shapeManualBaseHeight = p.height, l && d && (e.shapeTextAutoExpand = !1);
|
|
5609
|
-
let m =
|
|
5830
|
+
let m = ci({ group: e }), h = li({
|
|
5610
5831
|
group: e,
|
|
5611
5832
|
width: r,
|
|
5612
5833
|
height: i
|
|
5613
|
-
}), g = !u, _ = ({ width: t, height: n }) =>
|
|
5834
|
+
}), g = !u, _ = ({ width: t, height: n }) => li({
|
|
5614
5835
|
group: e,
|
|
5615
5836
|
width: t,
|
|
5616
5837
|
height: n
|
|
5617
5838
|
});
|
|
5618
|
-
!l && u ?
|
|
5839
|
+
!l && u ? Or({
|
|
5619
5840
|
group: e,
|
|
5620
5841
|
shape: t,
|
|
5621
5842
|
text: n,
|
|
@@ -5628,7 +5849,7 @@ function Gr({ group: e, shape: t, text: n, width: r, height: i, alignH: a, align
|
|
|
5628
5849
|
internalShapeTextInset: h,
|
|
5629
5850
|
expandShapeHeightToFitText: g,
|
|
5630
5851
|
resolveInternalShapeTextInset: _
|
|
5631
|
-
}) :
|
|
5852
|
+
}) : Dr({
|
|
5632
5853
|
group: e,
|
|
5633
5854
|
shape: t,
|
|
5634
5855
|
text: n,
|
|
@@ -5652,7 +5873,7 @@ function Gr({ group: e, shape: t, text: n, width: r, height: i, alignH: a, align
|
|
|
5652
5873
|
}
|
|
5653
5874
|
//#endregion
|
|
5654
5875
|
//#region src/editor/shape-manager/scaling/active-selection-scaling-controller.ts
|
|
5655
|
-
var
|
|
5876
|
+
var bi = class {
|
|
5656
5877
|
constructor({ canvas: e, shapeScalingState: t }) {
|
|
5657
5878
|
this.canvas = e, this.shapeScalingState = t, this.scalingState = /* @__PURE__ */ new WeakMap(), this.scalingSessions = /* @__PURE__ */ new WeakMap(), this.groupLayoutScales = /* @__PURE__ */ new WeakMap();
|
|
5658
5879
|
}
|
|
@@ -5704,21 +5925,21 @@ var Kr = class {
|
|
|
5704
5925
|
} else c = this._resolveShapeLayoutScale({
|
|
5705
5926
|
item: e,
|
|
5706
5927
|
selectionScale: p
|
|
5707
|
-
}), u =
|
|
5928
|
+
}), u = pi({
|
|
5708
5929
|
group: t,
|
|
5709
5930
|
text: r,
|
|
5710
5931
|
constraintPadding: i,
|
|
5711
5932
|
startDimensions: a,
|
|
5712
5933
|
appliedScaleX: c.scaleX,
|
|
5713
5934
|
appliedScaleY: c.scaleY,
|
|
5714
|
-
wrapPolicy:
|
|
5935
|
+
wrapPolicy: ni({ isProportionalScaling: a.isProportionalScaling }),
|
|
5715
5936
|
measurementCache: a.previewTextMeasurementCache
|
|
5716
5937
|
}).previewHeight;
|
|
5717
|
-
|
|
5938
|
+
ei({
|
|
5718
5939
|
group: t,
|
|
5719
5940
|
shape: n,
|
|
5720
5941
|
text: r,
|
|
5721
|
-
layout:
|
|
5942
|
+
layout: mi({
|
|
5722
5943
|
group: t,
|
|
5723
5944
|
text: r,
|
|
5724
5945
|
state: a,
|
|
@@ -5741,13 +5962,13 @@ var Kr = class {
|
|
|
5741
5962
|
commitGroupScaling({ group: e, scaleX: t, scaleY: n, transform: r }) {
|
|
5742
5963
|
let { shape: i, text: a } = J({ group: e });
|
|
5743
5964
|
if (!i || !a) return this.shapeScalingState.delete(e), !1;
|
|
5744
|
-
let o = this.shapeScalingState.get(e), s = o ??
|
|
5965
|
+
let o = this.shapeScalingState.get(e), s = o ?? hi({
|
|
5745
5966
|
group: e,
|
|
5746
5967
|
transform: r
|
|
5747
5968
|
}), 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) ?? {
|
|
5748
5969
|
scaleX: t,
|
|
5749
5970
|
scaleY: n
|
|
5750
|
-
}, { width: h, height: g, hasWidthChange: _, hasDimensionChange: v } =
|
|
5971
|
+
}, { width: h, height: g, hasWidthChange: _, hasDimensionChange: v } = _i({
|
|
5751
5972
|
group: e,
|
|
5752
5973
|
text: a,
|
|
5753
5974
|
constraintPadding: p,
|
|
@@ -5758,9 +5979,9 @@ var Kr = class {
|
|
|
5758
5979
|
},
|
|
5759
5980
|
scaleX: m.scaleX,
|
|
5760
5981
|
scaleY: m.scaleY,
|
|
5761
|
-
wrapPolicy:
|
|
5982
|
+
wrapPolicy: ni({ isProportionalScaling: o?.isProportionalScaling })
|
|
5762
5983
|
});
|
|
5763
|
-
return v ? (
|
|
5984
|
+
return v ? (yi({
|
|
5764
5985
|
group: e,
|
|
5765
5986
|
shape: i,
|
|
5766
5987
|
text: a,
|
|
@@ -5773,7 +5994,7 @@ var Kr = class {
|
|
|
5773
5994
|
canScaleWidth: l,
|
|
5774
5995
|
canScaleHeight: u,
|
|
5775
5996
|
hasWidthChange: _,
|
|
5776
|
-
wrapPolicy:
|
|
5997
|
+
wrapPolicy: ni({ isProportionalScaling: o?.isProportionalScaling })
|
|
5777
5998
|
}), this.shapeScalingState.delete(e), this.groupLayoutScales.delete(e), e.shapeScalingNoopTransform = !1, !0) : (this.shapeScalingState.delete(e), this.groupLayoutScales.delete(e), e.shapeScalingNoopTransform = !1, !1);
|
|
5778
5999
|
}
|
|
5779
6000
|
resolveCommittedScale({ selection: e }) {
|
|
@@ -5797,7 +6018,7 @@ var Kr = class {
|
|
|
5797
6018
|
if (!H(r)) continue;
|
|
5798
6019
|
let { shape: e, text: i } = J({ group: r });
|
|
5799
6020
|
if (!e || !i) continue;
|
|
5800
|
-
let a = Z({ group: r }), o =
|
|
6021
|
+
let a = Z({ group: r }), o = gi({
|
|
5801
6022
|
scalingState: this.shapeScalingState,
|
|
5802
6023
|
group: r,
|
|
5803
6024
|
text: i,
|
|
@@ -5817,7 +6038,7 @@ var Kr = class {
|
|
|
5817
6038
|
_ensureScalingSession({ selection: e, transform: t, items: n }) {
|
|
5818
6039
|
let r = this.scalingSessions.get(e);
|
|
5819
6040
|
if (r) return r;
|
|
5820
|
-
let i =
|
|
6041
|
+
let i = Gr({ value: t.originX }) ?? "center", a = Kr({ value: t.originY }) ?? "center", o = n[0], s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), l = this._resolveShapeLocalBounds({ group: o.group });
|
|
5821
6042
|
for (let { group: e } of n) {
|
|
5822
6043
|
let t = this._resolveShapeLocalBounds({ group: e });
|
|
5823
6044
|
s.set(e, t), l = this._mergeBounds({
|
|
@@ -6037,7 +6258,7 @@ var Kr = class {
|
|
|
6037
6258
|
_resolveProportionalLayoutResults({ items: e }) {
|
|
6038
6259
|
let t = /* @__PURE__ */ new Map();
|
|
6039
6260
|
for (let n of e) {
|
|
6040
|
-
let e =
|
|
6261
|
+
let e = di({
|
|
6041
6262
|
group: n.group,
|
|
6042
6263
|
text: n.text,
|
|
6043
6264
|
state: n.state
|
|
@@ -6051,7 +6272,7 @@ var Kr = class {
|
|
|
6051
6272
|
}
|
|
6052
6273
|
_resolveMinimumShapeWidth({ item: e, scaleY: t }) {
|
|
6053
6274
|
let { group: n, text: r, constraintPadding: i, state: a } = e, o = Math.max(1, a.startHeight * t);
|
|
6054
|
-
return
|
|
6275
|
+
return jr({
|
|
6055
6276
|
text: r,
|
|
6056
6277
|
padding: i,
|
|
6057
6278
|
measurementCache: a.previewTextMeasurementCache ?? void 0,
|
|
@@ -6068,7 +6289,7 @@ var Kr = class {
|
|
|
6068
6289
|
}
|
|
6069
6290
|
_resolveMinimumShapeHeight({ item: e, scaleX: t }) {
|
|
6070
6291
|
let { group: n, text: r, constraintPadding: i, state: a } = e;
|
|
6071
|
-
return
|
|
6292
|
+
return fi({
|
|
6072
6293
|
group: n,
|
|
6073
6294
|
text: r,
|
|
6074
6295
|
width: Math.max(1, a.startWidth * t),
|
|
@@ -6107,7 +6328,7 @@ var Kr = class {
|
|
|
6107
6328
|
};
|
|
6108
6329
|
}
|
|
6109
6330
|
_resolveVerticalAttachment({ selectionBounds: e, shapeBounds: t }) {
|
|
6110
|
-
let n = Math.max(0, t.top - e.top), r = Math.max(0, e.bottom - t.bottom), i = n <=
|
|
6331
|
+
let n = Math.max(0, t.top - e.top), r = Math.max(0, e.bottom - t.bottom), i = n <= ti, a = r <= ti;
|
|
6111
6332
|
return i && !a ? "top" : a && !i ? "bottom" : Math.abs(n - r) <= .5 ? "center" : n < r ? "top" : "bottom";
|
|
6112
6333
|
}
|
|
6113
6334
|
_resolveOriginOffset({ origin: e }) {
|
|
@@ -6128,7 +6349,7 @@ var Kr = class {
|
|
|
6128
6349
|
_hasPointerReachedSelectionScaleOrigin({ selection: e, transform: t, event: n, axis: r }) {
|
|
6129
6350
|
let i = t, a = r === "x" ? i.signX : i.signY;
|
|
6130
6351
|
if (typeof a != "number" || !Number.isFinite(a)) return !1;
|
|
6131
|
-
let o =
|
|
6352
|
+
let o = qr({
|
|
6132
6353
|
target: e,
|
|
6133
6354
|
transform: t,
|
|
6134
6355
|
event: n,
|
|
@@ -6139,7 +6360,7 @@ var Kr = class {
|
|
|
6139
6360
|
_applySelectionScale({ selection: e, transform: t, scaleX: n, scaleY: r }) {
|
|
6140
6361
|
let i = Math.abs(e.scaleX ?? 1) || 1, a = Math.abs(e.scaleY ?? 1) || 1;
|
|
6141
6362
|
if (!(Math.abs(i - n) > 1e-4 || Math.abs(a - r) > 1e-4)) return;
|
|
6142
|
-
let o =
|
|
6363
|
+
let o = Gr({ value: t.originX }), s = Kr({ value: t.originY }), c = o !== null && s !== null ? e.getPositionByOrigin(o, s) : null;
|
|
6143
6364
|
e.set({
|
|
6144
6365
|
flipX: !1,
|
|
6145
6366
|
flipY: !1,
|
|
@@ -6147,7 +6368,7 @@ var Kr = class {
|
|
|
6147
6368
|
scaleY: r
|
|
6148
6369
|
}), c && o !== null && s !== null && e.setPositionByOrigin(c, o, s), e.setCoords();
|
|
6149
6370
|
}
|
|
6150
|
-
},
|
|
6371
|
+
}, xi = class {
|
|
6151
6372
|
constructor({ canvas: t }) {
|
|
6152
6373
|
this.handleObjectScaling = (t) => {
|
|
6153
6374
|
let { target: n, transform: r } = t;
|
|
@@ -6166,7 +6387,7 @@ var Kr = class {
|
|
|
6166
6387
|
lockScalingFlip: !0,
|
|
6167
6388
|
centeredScaling: !1
|
|
6168
6389
|
});
|
|
6169
|
-
let s = Z({ group: i }), c =
|
|
6390
|
+
let s = Z({ group: i }), c = gi({
|
|
6170
6391
|
scalingState: this.scalingState,
|
|
6171
6392
|
group: i,
|
|
6172
6393
|
text: o,
|
|
@@ -6195,7 +6416,7 @@ var Kr = class {
|
|
|
6195
6416
|
});
|
|
6196
6417
|
return;
|
|
6197
6418
|
}
|
|
6198
|
-
let _ =
|
|
6419
|
+
let _ = mi({
|
|
6199
6420
|
group: i,
|
|
6200
6421
|
text: o,
|
|
6201
6422
|
state: c,
|
|
@@ -6209,7 +6430,7 @@ var Kr = class {
|
|
|
6209
6430
|
shouldHandleAsNoop: !1,
|
|
6210
6431
|
scaleX: g.appliedScaleX,
|
|
6211
6432
|
scaleY: g.appliedScaleY
|
|
6212
|
-
}),
|
|
6433
|
+
}), ei({
|
|
6213
6434
|
group: i,
|
|
6214
6435
|
shape: a,
|
|
6215
6436
|
text: o,
|
|
@@ -6271,7 +6492,7 @@ var Kr = class {
|
|
|
6271
6492
|
axis: "y"
|
|
6272
6493
|
});
|
|
6273
6494
|
if (!e && !t) return;
|
|
6274
|
-
let n =
|
|
6495
|
+
let n = di({
|
|
6275
6496
|
group: i,
|
|
6276
6497
|
text: s,
|
|
6277
6498
|
state: a
|
|
@@ -6285,7 +6506,7 @@ var Kr = class {
|
|
|
6285
6506
|
state: a,
|
|
6286
6507
|
axis: "x"
|
|
6287
6508
|
})) {
|
|
6288
|
-
let e =
|
|
6509
|
+
let e = jr({
|
|
6289
6510
|
text: s,
|
|
6290
6511
|
padding: c,
|
|
6291
6512
|
resolvePaddingForWidth: ({ width: e }) => Z({
|
|
@@ -6311,7 +6532,7 @@ var Kr = class {
|
|
|
6311
6532
|
});
|
|
6312
6533
|
return;
|
|
6313
6534
|
}
|
|
6314
|
-
y = C ??
|
|
6535
|
+
y = C ?? fi({
|
|
6315
6536
|
group: i,
|
|
6316
6537
|
text: s,
|
|
6317
6538
|
width: Math.max(1, a.startWidth * _),
|
|
@@ -6324,7 +6545,7 @@ var Kr = class {
|
|
|
6324
6545
|
}
|
|
6325
6546
|
if (!x && !S) return;
|
|
6326
6547
|
y ??= C;
|
|
6327
|
-
let w =
|
|
6548
|
+
let w = pi({
|
|
6328
6549
|
group: i,
|
|
6329
6550
|
text: s,
|
|
6330
6551
|
constraintPadding: c,
|
|
@@ -6333,7 +6554,7 @@ var Kr = class {
|
|
|
6333
6554
|
appliedScaleY: v,
|
|
6334
6555
|
minimumHeight: b ? null : y,
|
|
6335
6556
|
measurementCache: a.previewTextMeasurementCache
|
|
6336
|
-
}), T =
|
|
6557
|
+
}), T = mi({
|
|
6337
6558
|
group: i,
|
|
6338
6559
|
text: s,
|
|
6339
6560
|
state: a,
|
|
@@ -6347,7 +6568,7 @@ var Kr = class {
|
|
|
6347
6568
|
shouldHandleAsNoop: !1,
|
|
6348
6569
|
scaleX: _,
|
|
6349
6570
|
scaleY: v
|
|
6350
|
-
}),
|
|
6571
|
+
}), ei({
|
|
6351
6572
|
group: i,
|
|
6352
6573
|
shape: o,
|
|
6353
6574
|
text: s,
|
|
@@ -6391,7 +6612,7 @@ var Kr = class {
|
|
|
6391
6612
|
startHeight: s,
|
|
6392
6613
|
alignH: n.shapeAlignHorizontal,
|
|
6393
6614
|
alignV: n.shapeAlignVertical,
|
|
6394
|
-
userPadding:
|
|
6615
|
+
userPadding: ci({ group: n })
|
|
6395
6616
|
}), n.shapeScalingNoopTransform = !1, this.scalingState.delete(n), this.canvas.requestRenderAll();
|
|
6396
6617
|
return;
|
|
6397
6618
|
}
|
|
@@ -6414,7 +6635,7 @@ var Kr = class {
|
|
|
6414
6635
|
axis: "y"
|
|
6415
6636
|
});
|
|
6416
6637
|
if (t || o) {
|
|
6417
|
-
let e =
|
|
6638
|
+
let e = di({
|
|
6418
6639
|
group: n,
|
|
6419
6640
|
text: d,
|
|
6420
6641
|
state: r
|
|
@@ -6422,7 +6643,7 @@ var Kr = class {
|
|
|
6422
6643
|
(i < e.scale - 1e-4 || a < e.scale - 1e-4) && (v = e.scale, y = e.scale);
|
|
6423
6644
|
}
|
|
6424
6645
|
} else {
|
|
6425
|
-
let t =
|
|
6646
|
+
let t = jr({
|
|
6426
6647
|
text: d,
|
|
6427
6648
|
padding: m,
|
|
6428
6649
|
resolvePaddingForWidth: ({ width: e }) => Z({
|
|
@@ -6437,7 +6658,7 @@ var Kr = class {
|
|
|
6437
6658
|
minimumWidth: t,
|
|
6438
6659
|
state: r
|
|
6439
6660
|
}) && (v = Math.max(1 / o, t / o));
|
|
6440
|
-
let i =
|
|
6661
|
+
let i = fi({
|
|
6441
6662
|
group: n,
|
|
6442
6663
|
text: d,
|
|
6443
6664
|
width: Math.max(1, o * v),
|
|
@@ -6450,7 +6671,7 @@ var Kr = class {
|
|
|
6450
6671
|
state: r
|
|
6451
6672
|
}) && (y = Math.max(1 / s, i / s));
|
|
6452
6673
|
}
|
|
6453
|
-
let { width: b, height: x, hasWidthChange: S, hasDimensionChange: C } =
|
|
6674
|
+
let { width: b, height: x, hasWidthChange: S, hasDimensionChange: C } = _i({
|
|
6454
6675
|
group: n,
|
|
6455
6676
|
text: d,
|
|
6456
6677
|
constraintPadding: m,
|
|
@@ -6464,7 +6685,7 @@ var Kr = class {
|
|
|
6464
6685
|
},
|
|
6465
6686
|
scaleX: v,
|
|
6466
6687
|
scaleY: y,
|
|
6467
|
-
wrapPolicy:
|
|
6688
|
+
wrapPolicy: ni({ isProportionalScaling: r?.isProportionalScaling })
|
|
6468
6689
|
});
|
|
6469
6690
|
if (!C && r) {
|
|
6470
6691
|
this._restoreShapeStateWithoutResize({
|
|
@@ -6476,14 +6697,14 @@ var Kr = class {
|
|
|
6476
6697
|
startHeight: s,
|
|
6477
6698
|
alignH: f,
|
|
6478
6699
|
alignV: p,
|
|
6479
|
-
userPadding:
|
|
6700
|
+
userPadding: ci({ group: n })
|
|
6480
6701
|
}), this.scalingState.delete(n), this.canvas.requestRenderAll();
|
|
6481
6702
|
return;
|
|
6482
6703
|
}
|
|
6483
6704
|
r && n.set({
|
|
6484
6705
|
left: r.lastAllowedLeft,
|
|
6485
6706
|
top: r.lastAllowedTop
|
|
6486
|
-
}),
|
|
6707
|
+
}), yi({
|
|
6487
6708
|
group: n,
|
|
6488
6709
|
shape: u,
|
|
6489
6710
|
text: d,
|
|
@@ -6496,12 +6717,12 @@ var Kr = class {
|
|
|
6496
6717
|
canScaleWidth: g,
|
|
6497
6718
|
canScaleHeight: _,
|
|
6498
6719
|
hasWidthChange: S,
|
|
6499
|
-
wrapPolicy:
|
|
6720
|
+
wrapPolicy: ni({ isProportionalScaling: r?.isProportionalScaling })
|
|
6500
6721
|
}), r && this._restoreScalingAnchorPosition({
|
|
6501
6722
|
group: n,
|
|
6502
6723
|
state: r
|
|
6503
6724
|
}), n.setCoords(), d.setCoords(), u.setCoords(), this.scalingState.delete(n), n.shapeScalingNoopTransform = !1, this.canvas.requestRenderAll();
|
|
6504
|
-
}, this.canvas = t, this.scalingState = /* @__PURE__ */ new WeakMap(), this.activeSelectionScalingController = new
|
|
6725
|
+
}, this.canvas = t, this.scalingState = /* @__PURE__ */ new WeakMap(), this.activeSelectionScalingController = new bi({
|
|
6505
6726
|
canvas: t,
|
|
6506
6727
|
shapeScalingState: this.scalingState
|
|
6507
6728
|
});
|
|
@@ -6510,10 +6731,10 @@ var Kr = class {
|
|
|
6510
6731
|
let a = e.scaleX ?? 1, o = e.scaleY ?? 1, { scaleX: s, scaleY: c } = this._resolveCurrentDragScales({
|
|
6511
6732
|
group: e,
|
|
6512
6733
|
state: r
|
|
6513
|
-
}), l = r.canScaleWidth && a < 0 || r.canScaleHeight && o < 0, u =
|
|
6734
|
+
}), l = r.canScaleWidth && a < 0 || r.canScaleHeight && o < 0, u = Yr({
|
|
6514
6735
|
state: r,
|
|
6515
6736
|
transform: i
|
|
6516
|
-
}), d =
|
|
6737
|
+
}), d = Xr({
|
|
6517
6738
|
state: r,
|
|
6518
6739
|
transform: i
|
|
6519
6740
|
});
|
|
@@ -6529,7 +6750,7 @@ var Kr = class {
|
|
|
6529
6750
|
f.shouldRestoreLastAllowedTransform && (h = r.lastAllowedScaleX, g = r.lastAllowedScaleY), f.shouldHandleAsNoop && (h = r.startScaleX, g = r.startScaleY);
|
|
6530
6751
|
let _ = f.resolvedMinimumHeight, v = !r.canScaleWidth && r.canScaleHeight ? r.fixedWidthMinimumTextFitHeight : null;
|
|
6531
6752
|
f.shouldHandleAsNoop ? _ = r.startHeight : _ ??= v;
|
|
6532
|
-
let { previewHeight: y } =
|
|
6753
|
+
let { previewHeight: y } = pi({
|
|
6533
6754
|
group: e,
|
|
6534
6755
|
text: t,
|
|
6535
6756
|
constraintPadding: n,
|
|
@@ -6548,7 +6769,7 @@ var Kr = class {
|
|
|
6548
6769
|
};
|
|
6549
6770
|
}
|
|
6550
6771
|
_resolveScalingConstraintState({ group: e, text: t, constraintPadding: n, state: r, scaleX: i, scaleY: a }) {
|
|
6551
|
-
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 ?
|
|
6772
|
+
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 ? jr({
|
|
6552
6773
|
text: t,
|
|
6553
6774
|
padding: n,
|
|
6554
6775
|
measurementCache: r.previewTextMeasurementCache ?? void 0,
|
|
@@ -6557,7 +6778,7 @@ var Kr = class {
|
|
|
6557
6778
|
width: t,
|
|
6558
6779
|
height: v
|
|
6559
6780
|
})
|
|
6560
|
-
}) : null, w = o && b ? S ??
|
|
6781
|
+
}) : null, w = o && b ? S ?? fi({
|
|
6561
6782
|
group: e,
|
|
6562
6783
|
text: t,
|
|
6563
6784
|
width: _,
|
|
@@ -6565,7 +6786,7 @@ var Kr = class {
|
|
|
6565
6786
|
measurementCache: r.previewTextMeasurementCache
|
|
6566
6787
|
}) : null, T = g && u && x;
|
|
6567
6788
|
if (f && s && o && (y || b)) {
|
|
6568
|
-
if (!
|
|
6789
|
+
if (!ui({
|
|
6569
6790
|
group: e,
|
|
6570
6791
|
text: t,
|
|
6571
6792
|
width: _,
|
|
@@ -6573,7 +6794,7 @@ var Kr = class {
|
|
|
6573
6794
|
measurementCache: r.previewTextMeasurementCache,
|
|
6574
6795
|
constraintCache: r.proportionalTextConstraintCache
|
|
6575
6796
|
}).isValid) {
|
|
6576
|
-
let n =
|
|
6797
|
+
let n = di({
|
|
6577
6798
|
group: e,
|
|
6578
6799
|
text: t,
|
|
6579
6800
|
state: r
|
|
@@ -6596,7 +6817,7 @@ var Kr = class {
|
|
|
6596
6817
|
}
|
|
6597
6818
|
let E = C !== null && _ < C + 1e-4, D = w !== null && v < w + 1e-4, O = E || D, k = d, A = null, j = null;
|
|
6598
6819
|
if (f && O) {
|
|
6599
|
-
let n =
|
|
6820
|
+
let n = di({
|
|
6600
6821
|
group: e,
|
|
6601
6822
|
text: t,
|
|
6602
6823
|
state: r
|
|
@@ -6625,11 +6846,11 @@ var Kr = class {
|
|
|
6625
6846
|
shouldHandleAsNoop: !0,
|
|
6626
6847
|
scaleX: r.startScaleX,
|
|
6627
6848
|
scaleY: r.startScaleY
|
|
6628
|
-
}),
|
|
6849
|
+
}), ei({
|
|
6629
6850
|
group: e,
|
|
6630
6851
|
shape: t,
|
|
6631
6852
|
text: n,
|
|
6632
|
-
layout:
|
|
6853
|
+
layout: mi({
|
|
6633
6854
|
group: e,
|
|
6634
6855
|
text: n,
|
|
6635
6856
|
state: r,
|
|
@@ -6713,7 +6934,7 @@ var Kr = class {
|
|
|
6713
6934
|
if (!i) return !1;
|
|
6714
6935
|
let a = i, o = r === "x" ? n?.scaleDirectionX ?? null : n?.scaleDirectionY ?? null, s = this._resolveScaleDirection({ value: r === "x" ? a.signX : a.signY }) ?? o;
|
|
6715
6936
|
if (s === null) return !1;
|
|
6716
|
-
let c =
|
|
6937
|
+
let c = qr({
|
|
6717
6938
|
event: e.e,
|
|
6718
6939
|
target: t,
|
|
6719
6940
|
transform: i,
|
|
@@ -6731,7 +6952,7 @@ var Kr = class {
|
|
|
6731
6952
|
a && t.scaleDirectionX === null && (t.scaleDirectionX = this._resolveScaleDirection({ value: l.signX })), i && t.scaleDirectionY === null && (t.scaleDirectionY = this._resolveScaleDirection({ value: l.signY }));
|
|
6732
6953
|
let u = !a || t.scaleDirectionX !== null, d = !i || t.scaleDirectionY !== null;
|
|
6733
6954
|
if (u && d) return;
|
|
6734
|
-
let f =
|
|
6955
|
+
let f = qr({
|
|
6735
6956
|
event: n,
|
|
6736
6957
|
target: e,
|
|
6737
6958
|
transform: r,
|
|
@@ -6760,16 +6981,16 @@ var Kr = class {
|
|
|
6760
6981
|
e.setPositionByOrigin(new m(n, r), i, a), e.setCoords();
|
|
6761
6982
|
}
|
|
6762
6983
|
_restoreShapeStateWithoutResize({ group: e, shape: t, text: n, state: r, startWidth: i, startHeight: a, alignH: o, alignV: s, userPadding: c }) {
|
|
6763
|
-
let l = Math.max(1, e.shapeBaseWidth ?? e.width ?? i), u = Math.max(1, e.shapeBaseHeight ?? e.height ?? a), d =
|
|
6984
|
+
let l = Math.max(1, e.shapeBaseWidth ?? e.width ?? i), u = Math.max(1, e.shapeBaseHeight ?? e.height ?? a), d = li({
|
|
6764
6985
|
group: e,
|
|
6765
6986
|
width: l,
|
|
6766
6987
|
height: u
|
|
6767
|
-
}), f = o ?? "center", p = s ?? "middle", m =
|
|
6988
|
+
}), f = o ?? "center", p = s ?? "middle", m = ni({ isProportionalScaling: r.isProportionalScaling }), h = ({ width: t, height: n }) => li({
|
|
6768
6989
|
group: e,
|
|
6769
6990
|
width: t,
|
|
6770
6991
|
height: n
|
|
6771
6992
|
});
|
|
6772
|
-
!r.canScaleWidth && r.canScaleHeight ?
|
|
6993
|
+
!r.canScaleWidth && r.canScaleHeight ? Or({
|
|
6773
6994
|
group: e,
|
|
6774
6995
|
shape: t,
|
|
6775
6996
|
text: n,
|
|
@@ -6781,7 +7002,7 @@ var Kr = class {
|
|
|
6781
7002
|
wrapPolicy: m,
|
|
6782
7003
|
internalShapeTextInset: d,
|
|
6783
7004
|
resolveInternalShapeTextInset: h
|
|
6784
|
-
}) :
|
|
7005
|
+
}) : Dr({
|
|
6785
7006
|
group: e,
|
|
6786
7007
|
shape: t,
|
|
6787
7008
|
text: n,
|
|
@@ -6805,7 +7026,7 @@ var Kr = class {
|
|
|
6805
7026
|
state: r
|
|
6806
7027
|
});
|
|
6807
7028
|
}
|
|
6808
|
-
},
|
|
7029
|
+
}, Si = class {
|
|
6809
7030
|
constructor({ canvas: e }) {
|
|
6810
7031
|
this.handleMouseDown = (e) => {
|
|
6811
7032
|
let { target: t, e: n, subTargets: r = [] } = e, i = Je({
|
|
@@ -6929,7 +7150,7 @@ var Kr = class {
|
|
|
6929
7150
|
let t = this.canvas;
|
|
6930
7151
|
t.findTarget = e.findTarget, this.editingTargetResolverState = void 0;
|
|
6931
7152
|
}
|
|
6932
|
-
},
|
|
7153
|
+
}, Ci = 1e-4, wi = class {
|
|
6933
7154
|
constructor({ runtime: t }) {
|
|
6934
7155
|
this._handleObjectScaling = (e) => {
|
|
6935
7156
|
this.runtime.collectShapeGroupsFromTarget({
|
|
@@ -7014,7 +7235,7 @@ var Kr = class {
|
|
|
7014
7235
|
let r = t.getObjects(), i = r.filter((e) => H(e));
|
|
7015
7236
|
if (!i.length) return;
|
|
7016
7237
|
let { scaleX: a, scaleY: o } = this.runtime.scalingController.resolveActiveSelectionCommittedScale({ selection: t });
|
|
7017
|
-
if (!(Math.abs(a - 1) >
|
|
7238
|
+
if (!(Math.abs(a - 1) > Ci || Math.abs(o - 1) > Ci)) {
|
|
7018
7239
|
this.runtime.scalingController.clearActiveSelectionState({ selection: t });
|
|
7019
7240
|
return;
|
|
7020
7241
|
}
|
|
@@ -7032,7 +7253,7 @@ var Kr = class {
|
|
|
7032
7253
|
}), e.setCoords());
|
|
7033
7254
|
}), this.runtime.scalingController.clearActiveSelectionState({ selection: t }), s.setActiveObject(new e(r, { canvas: s })), s.requestRenderAll();
|
|
7034
7255
|
}
|
|
7035
|
-
},
|
|
7256
|
+
}, Ti = class {
|
|
7036
7257
|
constructor({ editor: e }) {
|
|
7037
7258
|
this.editor = e;
|
|
7038
7259
|
}
|
|
@@ -7151,7 +7372,7 @@ var Kr = class {
|
|
|
7151
7372
|
width: y,
|
|
7152
7373
|
height: b
|
|
7153
7374
|
}), S = u ?? e.shapeTextWrapPolicy, C = r ?? this.editor.canvasManager.getObjectPlacement({ object: e });
|
|
7154
|
-
|
|
7375
|
+
Dr({
|
|
7155
7376
|
group: e,
|
|
7156
7377
|
shape: t,
|
|
7157
7378
|
text: n,
|
|
@@ -7175,7 +7396,7 @@ var Kr = class {
|
|
|
7175
7396
|
}
|
|
7176
7397
|
_resolveAutoExpandShapeWidth({ text: e, currentWidth: t, minimumWidth: n, padding: r, resolvePaddingForWidth: i }) {
|
|
7177
7398
|
let a = this.resolveMontageAreaWidth();
|
|
7178
|
-
return a ?
|
|
7399
|
+
return a ? Ar({
|
|
7179
7400
|
text: e,
|
|
7180
7401
|
currentWidth: t,
|
|
7181
7402
|
minimumWidth: n,
|
|
@@ -7184,7 +7405,7 @@ var Kr = class {
|
|
|
7184
7405
|
resolvePaddingForWidth: i
|
|
7185
7406
|
}) : Math.max(1, t, n);
|
|
7186
7407
|
}
|
|
7187
|
-
},
|
|
7408
|
+
}, Ei = class e {
|
|
7188
7409
|
constructor({ canvas: e }) {
|
|
7189
7410
|
this.canvas = e, this.textEditingSnapshots = /* @__PURE__ */ new WeakMap(), this.pendingTextUpdates = /* @__PURE__ */ new WeakMap(), this.resizeStartSnapshots = /* @__PURE__ */ new Map(), this.pendingResizeUpdates = /* @__PURE__ */ new WeakMap();
|
|
7190
7411
|
}
|
|
@@ -7380,7 +7601,7 @@ var Kr = class {
|
|
|
7380
7601
|
}
|
|
7381
7602
|
}), I;
|
|
7382
7603
|
}
|
|
7383
|
-
},
|
|
7604
|
+
}, Di = .01, Oi = ({ textbox: e }) => {
|
|
7384
7605
|
let t = e.text ?? "";
|
|
7385
7606
|
if (!t.length) return [];
|
|
7386
7607
|
let n = t.split("\n"), r = [], i = 0;
|
|
@@ -7392,7 +7613,7 @@ var Kr = class {
|
|
|
7392
7613
|
});
|
|
7393
7614
|
}
|
|
7394
7615
|
return r;
|
|
7395
|
-
},
|
|
7616
|
+
}, ki = ({ range: e, text: t }) => {
|
|
7396
7617
|
if (!e) return null;
|
|
7397
7618
|
let n = t.length;
|
|
7398
7619
|
if (n <= 0) return null;
|
|
@@ -7401,8 +7622,8 @@ var Kr = class {
|
|
|
7401
7622
|
start: l,
|
|
7402
7623
|
end: u
|
|
7403
7624
|
};
|
|
7404
|
-
},
|
|
7405
|
-
let n =
|
|
7625
|
+
}, Ai = ({ textbox: e, range: t }) => {
|
|
7626
|
+
let n = Oi({ textbox: e });
|
|
7406
7627
|
if (!n.length) return t;
|
|
7407
7628
|
let { start: r } = t, { end: i } = t;
|
|
7408
7629
|
for (let e = 0; e < n.length; e += 1) {
|
|
@@ -7415,7 +7636,7 @@ var Kr = class {
|
|
|
7415
7636
|
start: r,
|
|
7416
7637
|
end: i
|
|
7417
7638
|
};
|
|
7418
|
-
},
|
|
7639
|
+
}, ji = ({ textbox: e, range: t }) => {
|
|
7419
7640
|
let n = e.text ?? "";
|
|
7420
7641
|
if (!n.length) return [];
|
|
7421
7642
|
let { start: r, end: i } = t, a = n.split("\n"), o = [], s = 0;
|
|
@@ -7424,7 +7645,7 @@ var Kr = class {
|
|
|
7424
7645
|
i > n && r < c && o.push(e), s = c + 1;
|
|
7425
7646
|
}
|
|
7426
7647
|
return o;
|
|
7427
|
-
},
|
|
7648
|
+
}, Mi = ({ textbox: e, range: t }) => {
|
|
7428
7649
|
let n = e.text ?? "";
|
|
7429
7650
|
if (!n.length) return [];
|
|
7430
7651
|
let { start: r, end: i } = t, a = n.split("\n"), o = [], s = 0;
|
|
@@ -7433,21 +7654,21 @@ var Kr = class {
|
|
|
7433
7654
|
r <= n && i >= c && o.push(e), s = c + 1;
|
|
7434
7655
|
}
|
|
7435
7656
|
return o;
|
|
7436
|
-
},
|
|
7657
|
+
}, Ni = ({ previous: e, next: t }) => {
|
|
7437
7658
|
let n = Math.min(e.length, t.length);
|
|
7438
7659
|
for (let r = 0; r < n; r += 1) if (e[r] !== t[r]) return r;
|
|
7439
7660
|
return n;
|
|
7440
|
-
},
|
|
7661
|
+
}, Pi = ({ text: e, charIndex: t }) => {
|
|
7441
7662
|
let n = Math.max(0, Math.min(t, e.length)), r = 0;
|
|
7442
7663
|
for (let t = 0; t < n; t += 1) e[t] === "\n" && (r += 1);
|
|
7443
7664
|
return r;
|
|
7444
|
-
},
|
|
7665
|
+
}, Fi = ({ text: e, lineIndex: t }) => {
|
|
7445
7666
|
if (t <= 0) return 0;
|
|
7446
7667
|
let n = 0;
|
|
7447
7668
|
for (let r = 0; r < e.length; r += 1) if (e[r] === "\n" && (n += 1, n === t)) return r + 1;
|
|
7448
7669
|
return e.length;
|
|
7449
|
-
},
|
|
7450
|
-
let a =
|
|
7670
|
+
}, Ii = ({ deltaLines: e, diffIndex: t, lineFontDefaults: n, lineIndexOld: r, previousText: i }) => {
|
|
7671
|
+
let a = Fi({
|
|
7451
7672
|
text: i,
|
|
7452
7673
|
lineIndex: r
|
|
7453
7674
|
}), o = r + 1;
|
|
@@ -7466,7 +7687,7 @@ var Kr = class {
|
|
|
7466
7687
|
lineFontDefaults: s,
|
|
7467
7688
|
changed: !0
|
|
7468
7689
|
};
|
|
7469
|
-
},
|
|
7690
|
+
}, Li = ({ deltaLines: e, diffIndex: t, lineFontDefaults: n, lineIndexOld: r, previousLines: i, previousText: a }) => {
|
|
7470
7691
|
let o = Math.abs(e), s = r;
|
|
7471
7692
|
a[t] === "\n" && (i[r] ?? "").length > 0 && (s = r + 1);
|
|
7472
7693
|
let c = s + o - 1, l = {}, u = [];
|
|
@@ -7489,7 +7710,7 @@ var Kr = class {
|
|
|
7489
7710
|
lineDefaults: u
|
|
7490
7711
|
}
|
|
7491
7712
|
};
|
|
7492
|
-
},
|
|
7713
|
+
}, Ri = ({ lineFontDefaults: e, previousText: t, currentText: n }) => {
|
|
7493
7714
|
if (!e || !Object.keys(e).length) return {
|
|
7494
7715
|
lineFontDefaults: e,
|
|
7495
7716
|
changed: !1
|
|
@@ -7499,20 +7720,20 @@ var Kr = class {
|
|
|
7499
7720
|
lineFontDefaults: e,
|
|
7500
7721
|
changed: !1
|
|
7501
7722
|
};
|
|
7502
|
-
let a =
|
|
7723
|
+
let a = Ni({
|
|
7503
7724
|
previous: t,
|
|
7504
7725
|
next: n
|
|
7505
|
-
}), o =
|
|
7726
|
+
}), o = Pi({
|
|
7506
7727
|
text: t,
|
|
7507
7728
|
charIndex: a
|
|
7508
7729
|
});
|
|
7509
|
-
return i > 0 ?
|
|
7730
|
+
return i > 0 ? Ii({
|
|
7510
7731
|
deltaLines: i,
|
|
7511
7732
|
diffIndex: a,
|
|
7512
7733
|
lineFontDefaults: e,
|
|
7513
7734
|
lineIndexOld: o,
|
|
7514
7735
|
previousText: t
|
|
7515
|
-
}) :
|
|
7736
|
+
}) : Li({
|
|
7516
7737
|
deltaLines: i,
|
|
7517
7738
|
diffIndex: a,
|
|
7518
7739
|
lineFontDefaults: e,
|
|
@@ -7520,10 +7741,10 @@ var Kr = class {
|
|
|
7520
7741
|
previousLines: r,
|
|
7521
7742
|
previousText: t
|
|
7522
7743
|
});
|
|
7523
|
-
},
|
|
7744
|
+
}, zi = ({ lineDefaults: e }) => {
|
|
7524
7745
|
let t = {};
|
|
7525
7746
|
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;
|
|
7526
|
-
},
|
|
7747
|
+
}, Bi = ({ textbox: e, lineIndices: t, updates: n }) => {
|
|
7527
7748
|
if (!t.length) return !1;
|
|
7528
7749
|
let { fill: r, fontFamily: i, fontSize: a, fontStyle: o, fontWeight: s, linethrough: c, stroke: l, strokeWidth: u, underline: d } = n;
|
|
7529
7750
|
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;
|
|
@@ -7535,12 +7756,12 @@ var Kr = class {
|
|
|
7535
7756
|
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);
|
|
7536
7757
|
}
|
|
7537
7758
|
return m && (e.lineFontDefaults = p), m;
|
|
7538
|
-
},
|
|
7759
|
+
}, Vi = ({ lineStyles: e, lineDefaults: t }) => {
|
|
7539
7760
|
if (!e) return {
|
|
7540
7761
|
lineStyles: e,
|
|
7541
7762
|
changed: !1
|
|
7542
7763
|
};
|
|
7543
|
-
let n =
|
|
7764
|
+
let n = zi({ lineDefaults: t }), r = Object.keys(n);
|
|
7544
7765
|
if (!r.length) return {
|
|
7545
7766
|
lineStyles: e,
|
|
7546
7767
|
changed: !1
|
|
@@ -7564,7 +7785,7 @@ var Kr = class {
|
|
|
7564
7785
|
lineStyles: e,
|
|
7565
7786
|
changed: !1
|
|
7566
7787
|
};
|
|
7567
|
-
},
|
|
7788
|
+
}, Hi = ({ cleanup: e, lineCount: t, styles: n }) => {
|
|
7568
7789
|
if (!e) return {
|
|
7569
7790
|
styles: n,
|
|
7570
7791
|
changed: !1
|
|
@@ -7584,7 +7805,7 @@ var Kr = class {
|
|
|
7584
7805
|
for (let t = 0; t < e.lineDefaults.length; t += 1) {
|
|
7585
7806
|
let n = e.lineDefaults[t];
|
|
7586
7807
|
if (!n) continue;
|
|
7587
|
-
let a =
|
|
7808
|
+
let a = Vi({
|
|
7588
7809
|
lineStyles: r,
|
|
7589
7810
|
lineDefaults: n
|
|
7590
7811
|
});
|
|
@@ -7599,19 +7820,19 @@ var Kr = class {
|
|
|
7599
7820
|
styles: a,
|
|
7600
7821
|
changed: !0
|
|
7601
7822
|
};
|
|
7602
|
-
},
|
|
7823
|
+
}, Ui = ({ textbox: e }) => {
|
|
7603
7824
|
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;
|
|
7604
7825
|
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;
|
|
7605
|
-
},
|
|
7826
|
+
}, Wi = ({ sourceDefaults: e, globalLineDefaults: t }) => {
|
|
7606
7827
|
let n = {};
|
|
7607
7828
|
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;
|
|
7608
|
-
},
|
|
7829
|
+
}, Gi = ({ lineText: e, lineStyles: t, lineDefaults: n }) => {
|
|
7609
7830
|
let r = e.length;
|
|
7610
7831
|
if (r === 0) return {
|
|
7611
7832
|
lineStyles: t,
|
|
7612
7833
|
changed: !1
|
|
7613
7834
|
};
|
|
7614
|
-
let i =
|
|
7835
|
+
let i = zi({ lineDefaults: n }), a = Object.keys(i);
|
|
7615
7836
|
if (!a.length) return {
|
|
7616
7837
|
lineStyles: t,
|
|
7617
7838
|
changed: !1
|
|
@@ -7637,8 +7858,8 @@ var Kr = class {
|
|
|
7637
7858
|
lineStyles: o,
|
|
7638
7859
|
changed: s
|
|
7639
7860
|
};
|
|
7640
|
-
},
|
|
7641
|
-
let a = n, o = !1, s = !1, c = i, l = !1, u = !1, d, f =
|
|
7861
|
+
}, Ki = ({ deletedLineDefaultsCleanup: e, globalLineDefaults: t, lineFontDefaults: n, lines: r, styles: i }) => {
|
|
7862
|
+
let a = n, o = !1, s = !1, c = i, l = !1, u = !1, d, f = Hi({
|
|
7642
7863
|
styles: c ?? {},
|
|
7643
7864
|
lineCount: r.length,
|
|
7644
7865
|
cleanup: e
|
|
@@ -7649,7 +7870,7 @@ var Kr = class {
|
|
|
7649
7870
|
if (i && (d = i), n.length !== 0) {
|
|
7650
7871
|
let t = i;
|
|
7651
7872
|
if (!t && d && (t = { ...d }, a || (a = {}, s = !0), s ||= (a = { ...a }, !0), a[e] = t, o = !0), t) {
|
|
7652
|
-
let r =
|
|
7873
|
+
let r = Gi({
|
|
7653
7874
|
lineText: n,
|
|
7654
7875
|
lineStyles: c ? c[e] : void 0,
|
|
7655
7876
|
lineDefaults: t
|
|
@@ -7658,12 +7879,12 @@ var Kr = class {
|
|
|
7658
7879
|
}
|
|
7659
7880
|
continue;
|
|
7660
7881
|
}
|
|
7661
|
-
let f =
|
|
7882
|
+
let f = Wi({
|
|
7662
7883
|
sourceDefaults: i ?? d,
|
|
7663
7884
|
globalLineDefaults: t
|
|
7664
7885
|
});
|
|
7665
7886
|
!i && Object.keys(f).length && (a || (a = {}, s = !0), s ||= (a = { ...a }, !0), a[e] = f, o = !0, d = f), i && (d = i);
|
|
7666
|
-
let p =
|
|
7887
|
+
let p = zi({ lineDefaults: f }), m = Object.keys(p).length > 0;
|
|
7667
7888
|
(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);
|
|
7668
7889
|
}
|
|
7669
7890
|
return {
|
|
@@ -7673,8 +7894,8 @@ var Kr = class {
|
|
|
7673
7894
|
stylesChanged: l
|
|
7674
7895
|
};
|
|
7675
7896
|
};
|
|
7676
|
-
function
|
|
7677
|
-
let t = (e.text ?? "").split("\n"), n =
|
|
7897
|
+
function qi({ textbox: e }) {
|
|
7898
|
+
let t = (e.text ?? "").split("\n"), n = Ui({ textbox: e }), r = Ki({
|
|
7678
7899
|
lines: t,
|
|
7679
7900
|
styles: e.styles,
|
|
7680
7901
|
lineFontDefaults: e.lineFontDefaults,
|
|
@@ -7686,7 +7907,7 @@ function yi({ textbox: e }) {
|
|
|
7686
7907
|
if (!Number.isInteger(t) || t < 0) continue;
|
|
7687
7908
|
let o = r.styles[e];
|
|
7688
7909
|
if (!o) continue;
|
|
7689
|
-
let s =
|
|
7910
|
+
let s = Vi({
|
|
7690
7911
|
lineStyles: o,
|
|
7691
7912
|
lineDefaults: i?.[t] ?? n
|
|
7692
7913
|
});
|
|
@@ -7697,31 +7918,31 @@ function yi({ textbox: e }) {
|
|
|
7697
7918
|
styles: a
|
|
7698
7919
|
};
|
|
7699
7920
|
}
|
|
7700
|
-
var
|
|
7701
|
-
let r =
|
|
7921
|
+
var Ji = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
7922
|
+
let r = Ri({
|
|
7702
7923
|
lineFontDefaults: n.lineFontDefaults,
|
|
7703
7924
|
previousText: t,
|
|
7704
7925
|
currentText: e
|
|
7705
|
-
}), i =
|
|
7926
|
+
}), i = Ki({
|
|
7706
7927
|
lines: e.split("\n"),
|
|
7707
7928
|
styles: n.styles,
|
|
7708
7929
|
lineFontDefaults: r.lineFontDefaults,
|
|
7709
7930
|
deletedLineDefaultsCleanup: r.deletedLineDefaultsCleanup,
|
|
7710
|
-
globalLineDefaults:
|
|
7931
|
+
globalLineDefaults: Ui({ textbox: n })
|
|
7711
7932
|
});
|
|
7712
7933
|
return {
|
|
7713
7934
|
...i,
|
|
7714
7935
|
lineFontDefaultsChanged: r.changed || i.lineFontDefaultsChanged
|
|
7715
7936
|
};
|
|
7716
|
-
},
|
|
7717
|
-
let t =
|
|
7937
|
+
}, Yi = ({ textbox: e }) => {
|
|
7938
|
+
let t = Ki({
|
|
7718
7939
|
lines: (e.text ?? "").split("\n"),
|
|
7719
7940
|
styles: e.styles,
|
|
7720
7941
|
lineFontDefaults: e.lineFontDefaults,
|
|
7721
|
-
globalLineDefaults:
|
|
7942
|
+
globalLineDefaults: Ui({ textbox: e })
|
|
7722
7943
|
}), n = !1;
|
|
7723
7944
|
return t.lineFontDefaultsChanged && (e.lineFontDefaults = t.lineFontDefaults, n = !0), t.stylesChanged && (e.styles = t.styles, e.dirty = !0, n = !0), n;
|
|
7724
|
-
},
|
|
7945
|
+
}, Xi = ({ lineFontDefaults: e }) => {
|
|
7725
7946
|
if (!e) return;
|
|
7726
7947
|
let t = {};
|
|
7727
7948
|
for (let n in e) {
|
|
@@ -7732,7 +7953,7 @@ var bi = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
7732
7953
|
i && (t[r] = { ...i });
|
|
7733
7954
|
}
|
|
7734
7955
|
return t;
|
|
7735
|
-
},
|
|
7956
|
+
}, Zi = ({ lineFontDefaults: e, scale: t }) => {
|
|
7736
7957
|
if (!e || !Number.isFinite(t) || Math.abs(t - 1) < .01) return;
|
|
7737
7958
|
let n = {}, r = !1, i = !1;
|
|
7738
7959
|
for (let a in e) {
|
|
@@ -7749,18 +7970,18 @@ var bi = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
7749
7970
|
n[o] = c, r = !0;
|
|
7750
7971
|
}
|
|
7751
7972
|
if (!(!r || !i)) return n;
|
|
7752
|
-
},
|
|
7973
|
+
}, Qi = ({ textbox: e, text: t }) => {
|
|
7753
7974
|
let { textLines: n } = e, r = Array.isArray(n) && n.length > 0 ? n.length : Math.max(t.split("\n").length, 1), i = 0;
|
|
7754
7975
|
for (let t = 0; t < r; t += 1) {
|
|
7755
7976
|
let n = e.getLineWidth(t);
|
|
7756
7977
|
n > i && (i = n);
|
|
7757
7978
|
}
|
|
7758
7979
|
return i;
|
|
7759
|
-
},
|
|
7760
|
-
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 +
|
|
7980
|
+
}, $i = ({ origin: e, size: t }) => e === "left" || e === "top" || e === 0 ? 0 : e === "right" || e === "bottom" || e === 1 ? t : t / 2, ea = ({ textbox: e, originX: t = e.originX ?? "center", originY: n = e.originY ?? "center" }) => {
|
|
7981
|
+
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 + $i({
|
|
7761
7982
|
origin: t,
|
|
7762
7983
|
size: r
|
|
7763
|
-
}), u +
|
|
7984
|
+
}), u + $i({
|
|
7764
7985
|
origin: n,
|
|
7765
7986
|
size: i
|
|
7766
7987
|
})), 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);
|
|
@@ -7770,13 +7991,13 @@ var bi = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
7770
7991
|
originX: t,
|
|
7771
7992
|
originY: n
|
|
7772
7993
|
};
|
|
7773
|
-
},
|
|
7994
|
+
}, ta = ({ textbox: e, montageLeft: t, montageRight: n }) => {
|
|
7774
7995
|
e.setCoords();
|
|
7775
7996
|
let r = e.getBoundingRect(), i = r.left ?? 0, a = i + (r.width ?? 0), o = n - t;
|
|
7776
7997
|
if (o > 0 && (r.width ?? 0) >= o - .01) return !1;
|
|
7777
7998
|
let s = 0;
|
|
7778
7999
|
return i < t ? s = t - i : a > n && (s = n - a), Math.abs(s) <= .01 ? !1 : (e.set({ left: (e.left ?? 0) + s }), !0);
|
|
7779
|
-
},
|
|
8000
|
+
}, na = ({ rawValue: e, calculatedValue: t }) => typeof e == "number" ? e : typeof t == "number" ? t : 0, ra = ({ stylesList: e }) => {
|
|
7780
8001
|
let t = e.length;
|
|
7781
8002
|
if (!t) return !1;
|
|
7782
8003
|
for (let n = 0; n < t; n += 1) {
|
|
@@ -7786,16 +8007,16 @@ var bi = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
7786
8007
|
if (r !== void 0 || i !== void 0 || a !== void 0 || o !== void 0 || s !== void 0 || c !== void 0) return !0;
|
|
7787
8008
|
}
|
|
7788
8009
|
return !1;
|
|
7789
|
-
},
|
|
7790
|
-
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 =
|
|
8010
|
+
}, ia = ({ textbox: e }) => {
|
|
8011
|
+
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 = na({
|
|
7791
8012
|
rawValue: t,
|
|
7792
8013
|
calculatedValue: a
|
|
7793
|
-
}), c =
|
|
8014
|
+
}), c = na({
|
|
7794
8015
|
rawValue: n,
|
|
7795
8016
|
calculatedValue: o
|
|
7796
8017
|
}), l = Number.isFinite(s) ? Math.round(s) : null, u = Number.isFinite(c) ? Math.round(c) : null, d = {};
|
|
7797
8018
|
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;
|
|
7798
|
-
},
|
|
8019
|
+
}, aa = ({ textbox: e }) => {
|
|
7799
8020
|
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;
|
|
7800
8021
|
return {
|
|
7801
8022
|
width: t,
|
|
@@ -7813,9 +8034,9 @@ var bi = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
7813
8034
|
bottomLeft: f
|
|
7814
8035
|
},
|
|
7815
8036
|
styles: JSON.parse(JSON.stringify(r)),
|
|
7816
|
-
lineFontDefaults:
|
|
8037
|
+
lineFontDefaults: Xi({ lineFontDefaults: i })
|
|
7817
8038
|
};
|
|
7818
|
-
},
|
|
8039
|
+
}, oa = ({ base: e }) => {
|
|
7819
8040
|
let t = 1 / Math.max(1, e.width), n = [e.fontSize];
|
|
7820
8041
|
Object.values(e.styles).forEach((e) => {
|
|
7821
8042
|
Object.values(e).forEach((e) => {
|
|
@@ -7832,7 +8053,7 @@ var bi = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
7832
8053
|
fontScale: r,
|
|
7833
8054
|
proportionalScale: Math.max(t, r)
|
|
7834
8055
|
};
|
|
7835
|
-
},
|
|
8056
|
+
}, sa = ({ textbox: e, base: t, scale: n, shouldScaleFontSize: r = !0, shouldScalePadding: i = !0, shouldScaleRadii: a = !0 }) => {
|
|
7836
8057
|
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;
|
|
7837
8058
|
if (r && f) {
|
|
7838
8059
|
let e = {};
|
|
@@ -7851,7 +8072,7 @@ var bi = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
7851
8072
|
}), Object.keys(e).length && (p = e);
|
|
7852
8073
|
}
|
|
7853
8074
|
let m;
|
|
7854
|
-
r && (m =
|
|
8075
|
+
r && (m = Zi({
|
|
7855
8076
|
lineFontDefaults: u,
|
|
7856
8077
|
scale: n
|
|
7857
8078
|
}));
|
|
@@ -7877,9 +8098,9 @@ var bi = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
7877
8098
|
radiusBottomRight: g.bottomRight,
|
|
7878
8099
|
radiusBottomLeft: g.bottomLeft
|
|
7879
8100
|
});
|
|
7880
|
-
},
|
|
7881
|
-
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) >
|
|
7882
|
-
u && _ && (e.autoExpand = !1),
|
|
8101
|
+
}, ca = ({ 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 }) => {
|
|
8102
|
+
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) > Di;
|
|
8103
|
+
u && _ && (e.autoExpand = !1), sa({
|
|
7883
8104
|
textbox: e,
|
|
7884
8105
|
base: n,
|
|
7885
8106
|
scale: i,
|
|
@@ -7898,7 +8119,7 @@ var bi = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
7898
8119
|
} finally {
|
|
7899
8120
|
e.shouldRoundDimensionsOnInit = v;
|
|
7900
8121
|
}
|
|
7901
|
-
let y = d ?
|
|
8122
|
+
let y = d ? ia({ textbox: e }) : !1;
|
|
7902
8123
|
return y && (e.dirty = !0), o ? (e.set({
|
|
7903
8124
|
originX: a.originX,
|
|
7904
8125
|
originY: a.originY
|
|
@@ -7915,7 +8136,7 @@ var bi = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
7915
8136
|
};
|
|
7916
8137
|
//#endregion
|
|
7917
8138
|
//#region src/editor/shape-manager/mutation/shape-rehydration.ts
|
|
7918
|
-
function
|
|
8139
|
+
function la({ group: e }) {
|
|
7919
8140
|
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);
|
|
7920
8141
|
return {
|
|
7921
8142
|
currentDimensions: {
|
|
@@ -7932,17 +8153,17 @@ function Fi({ group: e }) {
|
|
|
7932
8153
|
}
|
|
7933
8154
|
};
|
|
7934
8155
|
}
|
|
7935
|
-
function
|
|
8156
|
+
function ua({ group: e, text: t, textScale: n }) {
|
|
7936
8157
|
let r = Number.isFinite(n) && n > 0 ? n : 1;
|
|
7937
|
-
Math.abs(r - 1) <= 1e-4 || (
|
|
8158
|
+
Math.abs(r - 1) <= 1e-4 || (sa({
|
|
7938
8159
|
textbox: t,
|
|
7939
|
-
base:
|
|
8160
|
+
base: aa({ textbox: t }),
|
|
7940
8161
|
scale: r
|
|
7941
8162
|
}), 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));
|
|
7942
8163
|
}
|
|
7943
8164
|
//#endregion
|
|
7944
8165
|
//#region src/editor/shape-manager/mutation/shape-update-pipeline.ts
|
|
7945
|
-
var
|
|
8166
|
+
var da = {
|
|
7946
8167
|
angle: 0,
|
|
7947
8168
|
skewX: 0,
|
|
7948
8169
|
skewY: 0,
|
|
@@ -7955,7 +8176,7 @@ var Li = {
|
|
|
7955
8176
|
top: 0,
|
|
7956
8177
|
originX: "left",
|
|
7957
8178
|
originY: "top"
|
|
7958
|
-
},
|
|
8179
|
+
}, fa = class {
|
|
7959
8180
|
constructor({ runtime: e }) {
|
|
7960
8181
|
this.runtime = e;
|
|
7961
8182
|
}
|
|
@@ -8118,7 +8339,7 @@ var Li = {
|
|
|
8118
8339
|
options: n,
|
|
8119
8340
|
styleState: i,
|
|
8120
8341
|
dimensionState: a
|
|
8121
|
-
}), c = await
|
|
8342
|
+
}), c = await zn({
|
|
8122
8343
|
preset: r.effectivePreset,
|
|
8123
8344
|
width: s.width,
|
|
8124
8345
|
height: s.height,
|
|
@@ -8253,7 +8474,7 @@ var Li = {
|
|
|
8253
8474
|
width: Math.max(1, e.width ?? t),
|
|
8254
8475
|
align: n
|
|
8255
8476
|
});
|
|
8256
|
-
return s.set(
|
|
8477
|
+
return s.set(da), this.runtime.applyTextUpdates({
|
|
8257
8478
|
textNode: s,
|
|
8258
8479
|
text: r,
|
|
8259
8480
|
textStyle: i,
|
|
@@ -8315,9 +8536,9 @@ var Li = {
|
|
|
8315
8536
|
shouldPreserveCurrentWidth: r
|
|
8316
8537
|
};
|
|
8317
8538
|
}
|
|
8318
|
-
},
|
|
8539
|
+
}, pa = class {
|
|
8319
8540
|
constructor({ runtime: e }) {
|
|
8320
|
-
this.runtime = e, this.updatePipeline = new
|
|
8541
|
+
this.runtime = e, this.updatePipeline = new fa({ runtime: e });
|
|
8321
8542
|
}
|
|
8322
8543
|
async update({ target: e, presetKey: t, options: n = {} } = {}) {
|
|
8323
8544
|
let r = await this.updatePipeline.prepare({
|
|
@@ -8360,7 +8581,7 @@ var Li = {
|
|
|
8360
8581
|
});
|
|
8361
8582
|
this.runtime.beginMutation();
|
|
8362
8583
|
try {
|
|
8363
|
-
|
|
8584
|
+
Dn({
|
|
8364
8585
|
shape: i,
|
|
8365
8586
|
style: { fill: t }
|
|
8366
8587
|
}), r.shapeFill = t, r.setCoords(), this.runtime.lifecycleController.fireBefore({ lifecycle: a }), this.runtime.editor.canvas.requestRenderAll();
|
|
@@ -8408,7 +8629,7 @@ var Li = {
|
|
|
8408
8629
|
});
|
|
8409
8630
|
this.runtime.beginMutation();
|
|
8410
8631
|
try {
|
|
8411
|
-
|
|
8632
|
+
Dn({
|
|
8412
8633
|
shape: a,
|
|
8413
8634
|
style: { opacity: t }
|
|
8414
8635
|
}), n && o && (o.set({ opacity: t }), o.setCoords()), i.shapeOpacity = t, i.setCoords(), this.runtime.lifecycleController.fireBefore({ lifecycle: s }), this.runtime.editor.canvas.requestRenderAll();
|
|
@@ -8493,8 +8714,8 @@ var Li = {
|
|
|
8493
8714
|
if (!r) return !1;
|
|
8494
8715
|
let { shape: i, text: a } = J({ group: r });
|
|
8495
8716
|
if (!i || !a) return !1;
|
|
8496
|
-
let o = this.runtime.editor.canvasManager.getObjectPlacement({ object: r }), { currentDimensions: s, manualDimensions: c, replaceBoxDimensions: l } =
|
|
8497
|
-
return
|
|
8717
|
+
let o = this.runtime.editor.canvasManager.getObjectPlacement({ object: r }), { currentDimensions: s, manualDimensions: c, replaceBoxDimensions: l } = la({ group: r });
|
|
8718
|
+
return ua({
|
|
8498
8719
|
group: r,
|
|
8499
8720
|
text: a,
|
|
8500
8721
|
textScale: t
|
|
@@ -8513,7 +8734,7 @@ var Li = {
|
|
|
8513
8734
|
return !t || t.locked ? null : t;
|
|
8514
8735
|
}
|
|
8515
8736
|
_applyStrokeAndTextLayout({ group: e, shape: t, text: n, stroke: r, strokeWidth: i, dash: a }) {
|
|
8516
|
-
if (
|
|
8737
|
+
if (Dn({
|
|
8517
8738
|
shape: t,
|
|
8518
8739
|
style: {
|
|
8519
8740
|
stroke: r,
|
|
@@ -8563,7 +8784,7 @@ var Li = {
|
|
|
8563
8784
|
}
|
|
8564
8785
|
_applyPreparedTextState({ preparedUpdate: e }) {
|
|
8565
8786
|
let { current: t, text: n } = e;
|
|
8566
|
-
this.runtime.detachShapeGroupAutoLayout({ group: t.group }), t.text.set(
|
|
8787
|
+
this.runtime.detachShapeGroupAutoLayout({ group: t.group }), t.text.set(da), this.runtime.applyTextUpdates({
|
|
8567
8788
|
textNode: t.text,
|
|
8568
8789
|
text: n.value,
|
|
8569
8790
|
textStyle: n.style,
|
|
@@ -8617,9 +8838,9 @@ var Li = {
|
|
|
8617
8838
|
let { current: t, next: n, layout: r, placement: i } = e;
|
|
8618
8839
|
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);
|
|
8619
8840
|
}
|
|
8620
|
-
},
|
|
8841
|
+
}, ma = class {
|
|
8621
8842
|
constructor({ editor: e }) {
|
|
8622
|
-
this.editor = e, qe(), this.scalingController = new
|
|
8843
|
+
this.editor = e, qe(), this.scalingController = new xi({ canvas: e.canvas }), this.editingController = new Si({ canvas: e.canvas }), this.editingPlacements = /* @__PURE__ */ new WeakMap(), this.lifecycleController = new Ei({ canvas: e.canvas }), this.layoutController = new Ti({ editor: this.editor }), this.mutationController = new pa({ runtime: {
|
|
8623
8844
|
editor: this.editor,
|
|
8624
8845
|
lifecycleController: this.lifecycleController,
|
|
8625
8846
|
editingPlacements: this.editingPlacements,
|
|
@@ -8629,7 +8850,7 @@ var Li = {
|
|
|
8629
8850
|
resolveReplaceBoxDimensions: (e) => this._resolveReplaceBoxDimensions(e),
|
|
8630
8851
|
resolveGroupUserPadding: (e) => this._resolveGroupUserPadding(e),
|
|
8631
8852
|
isShapeTextAutoExpandEnabled: (e) => this._isShapeTextAutoExpandEnabled(e),
|
|
8632
|
-
resolveShapeStyle:
|
|
8853
|
+
resolveShapeStyle: Un,
|
|
8633
8854
|
resolveCurrentTextStyle: (e) => this._resolveCurrentTextStyle(e),
|
|
8634
8855
|
createTextNode: (e) => this._createTextNode(e),
|
|
8635
8856
|
applyTextUpdates: (e) => this._applyTextUpdates(e),
|
|
@@ -8643,7 +8864,7 @@ var Li = {
|
|
|
8643
8864
|
beginMutation: () => this._beginMutation(),
|
|
8644
8865
|
endMutation: (e) => this._endMutation(e),
|
|
8645
8866
|
isOnCanvas: (e) => this._isOnCanvas(e)
|
|
8646
|
-
} }), this.internalTextUpdates = /* @__PURE__ */ new WeakSet(), this.eventController = new
|
|
8867
|
+
} }), this.internalTextUpdates = /* @__PURE__ */ new WeakSet(), this.eventController = new wi({ runtime: {
|
|
8647
8868
|
editor: this.editor,
|
|
8648
8869
|
scalingController: this.scalingController,
|
|
8649
8870
|
editingController: this.editingController,
|
|
@@ -8707,7 +8928,7 @@ var Li = {
|
|
|
8707
8928
|
let w = a !== !1, T = this._resolveHorizontalAlign({
|
|
8708
8929
|
explicitAlign: c,
|
|
8709
8930
|
textStyle: s
|
|
8710
|
-
}), E = l ?? "middle", O =
|
|
8931
|
+
}), E = l ?? "middle", O = Un({
|
|
8711
8932
|
options: t,
|
|
8712
8933
|
fallback: null
|
|
8713
8934
|
}), k = Ne({ padding: u }), A = ({ width: e, height: t }) => Le({
|
|
@@ -8750,7 +8971,7 @@ var Li = {
|
|
|
8750
8971
|
addition: k
|
|
8751
8972
|
})
|
|
8752
8973
|
}));
|
|
8753
|
-
let I = await
|
|
8974
|
+
let I = await zn({
|
|
8754
8975
|
preset: m,
|
|
8755
8976
|
width: F,
|
|
8756
8977
|
height: x,
|
|
@@ -8890,7 +9111,7 @@ var Li = {
|
|
|
8890
9111
|
padding: h,
|
|
8891
9112
|
style: y,
|
|
8892
9113
|
rounding: b
|
|
8893
|
-
}), x.rehydrateRuntimeState(), ze({ group: x }), Be({ text: i }),
|
|
9114
|
+
}), x.rehydrateRuntimeState(), ze({ group: x }), Be({ text: i }), Dr({
|
|
8894
9115
|
group: x,
|
|
8895
9116
|
shape: r,
|
|
8896
9117
|
text: i,
|
|
@@ -9177,7 +9398,7 @@ var Li = {
|
|
|
9177
9398
|
}
|
|
9178
9399
|
return null;
|
|
9179
9400
|
}
|
|
9180
|
-
},
|
|
9401
|
+
}, ha = ({ rootObject: t, enableEvented: n = !0 }) => {
|
|
9181
9402
|
let r = [{
|
|
9182
9403
|
object: t,
|
|
9183
9404
|
enableEvented: n
|
|
@@ -9191,7 +9412,7 @@ var Li = {
|
|
|
9191
9412
|
enableEvented: o
|
|
9192
9413
|
});
|
|
9193
9414
|
}
|
|
9194
|
-
},
|
|
9415
|
+
}, ga = class {
|
|
9195
9416
|
constructor({ editor: e }) {
|
|
9196
9417
|
this.editor = e, this.clipboard = null;
|
|
9197
9418
|
}
|
|
@@ -9349,7 +9570,7 @@ var Li = {
|
|
|
9349
9570
|
if (!n || n.locked) return !1;
|
|
9350
9571
|
try {
|
|
9351
9572
|
let e = await n.clone(At);
|
|
9352
|
-
return
|
|
9573
|
+
return ha({ rootObject: e }), e.set({
|
|
9353
9574
|
left: e.left + 10,
|
|
9354
9575
|
top: e.top + 10
|
|
9355
9576
|
}), this._materializeCloneGeometry({ clonedObject: e }), this._addClonedObjectToCanvas(e), t.fire("editor:object-duplicated", {
|
|
@@ -9416,7 +9637,7 @@ var Li = {
|
|
|
9416
9637
|
if (!this.clipboard) return !1;
|
|
9417
9638
|
try {
|
|
9418
9639
|
let t = await this.clipboard.clone(At);
|
|
9419
|
-
return e.discardActiveObject(),
|
|
9640
|
+
return e.discardActiveObject(), ha({ rootObject: t }), t.set({
|
|
9420
9641
|
left: t.left + 10,
|
|
9421
9642
|
top: t.top + 10
|
|
9422
9643
|
}), this._materializeCloneGeometry({ clonedObject: t }), this._addClonedObjectToCanvas(t), e.fire("editor:object-pasted", {
|
|
@@ -9435,7 +9656,7 @@ var Li = {
|
|
|
9435
9656
|
}), !1;
|
|
9436
9657
|
}
|
|
9437
9658
|
}
|
|
9438
|
-
},
|
|
9659
|
+
}, _a = class t {
|
|
9439
9660
|
constructor({ editor: e }) {
|
|
9440
9661
|
this.editor = e;
|
|
9441
9662
|
}
|
|
@@ -9500,7 +9721,7 @@ var Li = {
|
|
|
9500
9721
|
!(n instanceof v) || !n.isEditing || n.exitEditing();
|
|
9501
9722
|
}
|
|
9502
9723
|
}
|
|
9503
|
-
},
|
|
9724
|
+
}, va = class {
|
|
9504
9725
|
constructor({ editor: e }) {
|
|
9505
9726
|
this.editor = e;
|
|
9506
9727
|
}
|
|
@@ -9566,7 +9787,7 @@ var Li = {
|
|
|
9566
9787
|
i.resumeHistory(), n || i.saveState();
|
|
9567
9788
|
}
|
|
9568
9789
|
}
|
|
9569
|
-
},
|
|
9790
|
+
}, ya = class t {
|
|
9570
9791
|
constructor({ editor: e }) {
|
|
9571
9792
|
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();
|
|
9572
9793
|
}
|
|
@@ -9760,7 +9981,7 @@ var Li = {
|
|
|
9760
9981
|
let { options: e } = this.editor, { selectionKey: t } = e;
|
|
9761
9982
|
return t === void 0 ? ["ctrlKey", "metaKey"] : t;
|
|
9762
9983
|
}
|
|
9763
|
-
},
|
|
9984
|
+
}, ba = class e {
|
|
9764
9985
|
constructor({ editor: e }) {
|
|
9765
9986
|
this.editor = e;
|
|
9766
9987
|
}
|
|
@@ -9800,7 +10021,7 @@ var Li = {
|
|
|
9800
10021
|
};
|
|
9801
10022
|
return i.fire("editor:objects-deleted", l), l;
|
|
9802
10023
|
}
|
|
9803
|
-
},
|
|
10024
|
+
}, xa = {
|
|
9804
10025
|
IMAGE_MANAGER: {
|
|
9805
10026
|
INVALID_CONTENT_TYPE: "INVALID_CONTENT_TYPE",
|
|
9806
10027
|
INVALID_SOURCE_TYPE: "INVALID_SOURCE_TYPE",
|
|
@@ -9838,7 +10059,7 @@ var Li = {
|
|
|
9838
10059
|
INVALID_TARGET: "TEMPLATE_INVALID_TARGET",
|
|
9839
10060
|
APPLY_FAILED: "TEMPLATE_APPLY_FAILED"
|
|
9840
10061
|
}
|
|
9841
|
-
},
|
|
10062
|
+
}, Sa = class e {
|
|
9842
10063
|
constructor({ editor: e }) {
|
|
9843
10064
|
this._buffer = [], this.editor = e;
|
|
9844
10065
|
}
|
|
@@ -9896,9 +10117,9 @@ var Li = {
|
|
|
9896
10117
|
}), this.editor.canvas.fire("editor:warning", s);
|
|
9897
10118
|
}
|
|
9898
10119
|
static isValidErrorCode(e) {
|
|
9899
|
-
return e ? Object.values(
|
|
10120
|
+
return e ? Object.values(xa).some((t) => Object.values(t).includes(e)) : !1;
|
|
9900
10121
|
}
|
|
9901
|
-
},
|
|
10122
|
+
}, Ca = class {
|
|
9902
10123
|
constructor({ editor: e }) {
|
|
9903
10124
|
this.currentBounds = null, this.editor = e;
|
|
9904
10125
|
}
|
|
@@ -9947,32 +10168,32 @@ var Li = {
|
|
|
9947
10168
|
updateBounds() {
|
|
9948
10169
|
this.currentBounds = this.calculatePanBounds();
|
|
9949
10170
|
}
|
|
9950
|
-
},
|
|
10171
|
+
}, wa = ({ textbox: e }) => {
|
|
9951
10172
|
if (!e.isEditing) return null;
|
|
9952
10173
|
let t = e.selectionStart ?? 0, n = e.selectionEnd ?? t;
|
|
9953
10174
|
return t === n ? null : {
|
|
9954
10175
|
start: Math.min(t, n),
|
|
9955
10176
|
end: Math.max(t, n)
|
|
9956
10177
|
};
|
|
9957
|
-
},
|
|
10178
|
+
}, Ta = ({ textbox: e }) => {
|
|
9958
10179
|
let t = e.text?.length ?? 0;
|
|
9959
10180
|
return t <= 0 ? null : {
|
|
9960
10181
|
start: 0,
|
|
9961
10182
|
end: t
|
|
9962
10183
|
};
|
|
9963
|
-
},
|
|
10184
|
+
}, Ea = ({ textbox: e, range: t }) => {
|
|
9964
10185
|
if (!t) return !1;
|
|
9965
10186
|
let n = e.text?.length ?? 0;
|
|
9966
10187
|
return n <= 0 ? !1 : t.start <= 0 && t.end >= n;
|
|
9967
|
-
},
|
|
10188
|
+
}, Da = ({ textbox: e, styles: t, range: n }) => {
|
|
9968
10189
|
if (!t || !Object.keys(t).length) return !1;
|
|
9969
10190
|
let { start: r, end: i } = n;
|
|
9970
10191
|
return i <= r ? !1 : (e.setSelectionStyles(t, r, i), !0);
|
|
9971
|
-
},
|
|
10192
|
+
}, Oa = ({ textbox: e, range: t, property: n }) => {
|
|
9972
10193
|
if (!t) return;
|
|
9973
10194
|
let r = e.getSelectionStyles(t.start, t.end, !0);
|
|
9974
10195
|
if (r.length) return r[0]?.[n];
|
|
9975
|
-
},
|
|
10196
|
+
}, ka = ({ strokeColor: e, width: t }) => t <= 0 ? null : e ?? "#000000", Aa = ({ width: e = 0 }) => e ? Math.max(0, e) : 0, ja = ({ value: e }) => typeof e == "string" ? e.toLocaleUpperCase() : "", Ma = ({ value: e, min: t, max: n }) => Math.min(Math.max(e, t), n), Na = class e extends v {
|
|
9976
10197
|
static {
|
|
9977
10198
|
this.type = "background-textbox";
|
|
9978
10199
|
}
|
|
@@ -10009,7 +10230,7 @@ var Li = {
|
|
|
10009
10230
|
];
|
|
10010
10231
|
}
|
|
10011
10232
|
constructor(e, t = {}) {
|
|
10012
|
-
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,
|
|
10233
|
+
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, Yi({ textbox: this })) {
|
|
10013
10234
|
this.initDimensions(), this.dirty = !0;
|
|
10014
10235
|
return;
|
|
10015
10236
|
}
|
|
@@ -10048,7 +10269,7 @@ var Li = {
|
|
|
10048
10269
|
});
|
|
10049
10270
|
}
|
|
10050
10271
|
toObject(e = []) {
|
|
10051
|
-
let t = super.toObject(e), { lineFontDefaults: n, styles: r } =
|
|
10272
|
+
let t = super.toObject(e), { lineFontDefaults: n, styles: r } = qi({ textbox: this });
|
|
10052
10273
|
return {
|
|
10053
10274
|
...t,
|
|
10054
10275
|
backgroundOpacity: this.backgroundOpacity,
|
|
@@ -10116,7 +10337,7 @@ var Li = {
|
|
|
10116
10337
|
this._removeShadow(e);
|
|
10117
10338
|
}
|
|
10118
10339
|
_getDecorationColorAt(e, t) {
|
|
10119
|
-
let n = this.getValueOfPropertyAt(e, t, "strokeWidth"), r =
|
|
10340
|
+
let n = this.getValueOfPropertyAt(e, t, "strokeWidth"), r = Aa({ width: typeof n == "number" && Number.isFinite(n) ? n : 0 }), i = this.getValueOfPropertyAt(e, t, "stroke"), a = i == null ? null : ka({
|
|
10120
10341
|
strokeColor: i,
|
|
10121
10342
|
width: r
|
|
10122
10343
|
});
|
|
@@ -10132,22 +10353,22 @@ var Li = {
|
|
|
10132
10353
|
_getCornerRadii({ width: e, height: t }) {
|
|
10133
10354
|
let n = e / 2, r = t / 2, i = Math.min(n, r);
|
|
10134
10355
|
return {
|
|
10135
|
-
bottomLeft:
|
|
10356
|
+
bottomLeft: Ma({
|
|
10136
10357
|
value: this.radiusBottomLeft ?? 0,
|
|
10137
10358
|
min: 0,
|
|
10138
10359
|
max: i
|
|
10139
10360
|
}),
|
|
10140
|
-
bottomRight:
|
|
10361
|
+
bottomRight: Ma({
|
|
10141
10362
|
value: this.radiusBottomRight ?? 0,
|
|
10142
10363
|
min: 0,
|
|
10143
10364
|
max: i
|
|
10144
10365
|
}),
|
|
10145
|
-
topLeft:
|
|
10366
|
+
topLeft: Ma({
|
|
10146
10367
|
value: this.radiusTopLeft ?? 0,
|
|
10147
10368
|
min: 0,
|
|
10148
10369
|
max: i
|
|
10149
10370
|
}),
|
|
10150
|
-
topRight:
|
|
10371
|
+
topRight: Ma({
|
|
10151
10372
|
value: this.radiusTopRight ?? 0,
|
|
10152
10373
|
min: 0,
|
|
10153
10374
|
max: i
|
|
@@ -10165,7 +10386,7 @@ var Li = {
|
|
|
10165
10386
|
_getEffectiveBackgroundFill() {
|
|
10166
10387
|
let e = this.backgroundColor;
|
|
10167
10388
|
if (!e) return null;
|
|
10168
|
-
let t =
|
|
10389
|
+
let t = Ma({
|
|
10169
10390
|
value: this.backgroundOpacity ?? 1,
|
|
10170
10391
|
min: 0,
|
|
10171
10392
|
max: 1
|
|
@@ -10178,19 +10399,19 @@ var Li = {
|
|
|
10178
10399
|
return r.setAlpha(t), r.toRgba();
|
|
10179
10400
|
}
|
|
10180
10401
|
static _renderRoundedRect({ ctx: e, height: t, left: n, radii: r, top: i, width: a }) {
|
|
10181
|
-
let o = n + a, s = i + t, { topLeft: c, topRight: l, bottomRight: u, bottomLeft: d } = r, f =
|
|
10402
|
+
let o = n + a, s = i + t, { topLeft: c, topRight: l, bottomRight: u, bottomLeft: d } = r, f = Ma({
|
|
10182
10403
|
value: c,
|
|
10183
10404
|
min: 0,
|
|
10184
10405
|
max: a
|
|
10185
|
-
}), p =
|
|
10406
|
+
}), p = Ma({
|
|
10186
10407
|
value: l,
|
|
10187
10408
|
min: 0,
|
|
10188
10409
|
max: a
|
|
10189
|
-
}), m =
|
|
10410
|
+
}), m = Ma({
|
|
10190
10411
|
value: u,
|
|
10191
10412
|
min: 0,
|
|
10192
10413
|
max: a
|
|
10193
|
-
}), h =
|
|
10414
|
+
}), h = Ma({
|
|
10194
10415
|
value: d,
|
|
10195
10416
|
min: 0,
|
|
10196
10417
|
max: a
|
|
@@ -10201,9 +10422,9 @@ var Li = {
|
|
|
10201
10422
|
let { width: e = 0, height: t = 0 } = this, n = Math.round(e), r = Math.round(t);
|
|
10202
10423
|
n !== e && (this.width = Math.max(0, n)), r !== t && (this.height = Math.max(0, r));
|
|
10203
10424
|
}
|
|
10204
|
-
},
|
|
10205
|
-
b?.setClass && b.setClass(
|
|
10206
|
-
},
|
|
10425
|
+
}, Pa = () => {
|
|
10426
|
+
b?.setClass && b.setClass(Na, "background-textbox");
|
|
10427
|
+
}, Fa = class {
|
|
10207
10428
|
constructor({ runtime: e }) {
|
|
10208
10429
|
this.runtime = e;
|
|
10209
10430
|
}
|
|
@@ -10267,16 +10488,16 @@ var Li = {
|
|
|
10267
10488
|
};
|
|
10268
10489
|
}
|
|
10269
10490
|
_createSelectionContext({ textbox: e, currentText: t, selectionRangeOverride: n }) {
|
|
10270
|
-
let r = n === void 0 ?
|
|
10491
|
+
let r = n === void 0 ? wa({ textbox: e }) : ki({
|
|
10271
10492
|
text: t,
|
|
10272
10493
|
range: n
|
|
10273
|
-
}), i = r ?
|
|
10494
|
+
}), i = r ? Ai({
|
|
10274
10495
|
textbox: e,
|
|
10275
10496
|
range: r
|
|
10276
|
-
}) : null, a =
|
|
10497
|
+
}) : null, a = Ea({
|
|
10277
10498
|
textbox: e,
|
|
10278
10499
|
range: r
|
|
10279
|
-
}), o =
|
|
10500
|
+
}), o = Ea({
|
|
10280
10501
|
textbox: e,
|
|
10281
10502
|
range: i
|
|
10282
10503
|
}), s = !r || a;
|
|
@@ -10364,17 +10585,17 @@ var Li = {
|
|
|
10364
10585
|
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));
|
|
10365
10586
|
}
|
|
10366
10587
|
_resolveStrokeUpdate({ textbox: e, selectionRange: t, strokeColor: n, strokeWidth: r }) {
|
|
10367
|
-
let i = t ?
|
|
10588
|
+
let i = t ? Oa({
|
|
10368
10589
|
textbox: e,
|
|
10369
10590
|
range: t,
|
|
10370
10591
|
property: "strokeWidth"
|
|
10371
|
-
}) : void 0, a = t ?
|
|
10592
|
+
}) : void 0, a = t ? Oa({
|
|
10372
10593
|
textbox: e,
|
|
10373
10594
|
range: t,
|
|
10374
10595
|
property: "stroke"
|
|
10375
|
-
}) : 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 =
|
|
10596
|
+
}) : 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 = Aa({ width: r ?? o ?? e.strokeWidth ?? 0 });
|
|
10376
10597
|
return {
|
|
10377
|
-
stroke:
|
|
10598
|
+
stroke: ka({
|
|
10378
10599
|
strokeColor: n ?? s ?? c,
|
|
10379
10600
|
width: l
|
|
10380
10601
|
}) ?? null,
|
|
@@ -10386,14 +10607,14 @@ var Li = {
|
|
|
10386
10607
|
}
|
|
10387
10608
|
_applyTextContentUpdate({ textbox: e, style: t, updates: n, currentText: r }) {
|
|
10388
10609
|
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 ?? "";
|
|
10389
|
-
return o || l ? (n.text = c ?
|
|
10610
|
+
return o || l ? (n.text = c ? ja({ value: s }) : s, e.textCaseRaw = s) : e.textCaseRaw === void 0 && (e.textCaseRaw = i), e.uppercase = c, {
|
|
10390
10611
|
hasTextUpdate: o,
|
|
10391
10612
|
uppercaseChanged: l,
|
|
10392
10613
|
previousRenderedText: u
|
|
10393
10614
|
};
|
|
10394
10615
|
}
|
|
10395
10616
|
_resolveContentPlacement({ textbox: e, style: t, updates: n, placement: r, styleMaps: i, contentUpdate: a }) {
|
|
10396
|
-
let o =
|
|
10617
|
+
let o = ra({ stylesList: [
|
|
10397
10618
|
n,
|
|
10398
10619
|
i.selectionStyles,
|
|
10399
10620
|
i.lineSelectionStyles,
|
|
@@ -10409,7 +10630,7 @@ var Li = {
|
|
|
10409
10630
|
t.paddingBottom,
|
|
10410
10631
|
t.paddingLeft
|
|
10411
10632
|
].some((e) => e !== void 0), l = Object.prototype.hasOwnProperty.call(n, "width");
|
|
10412
|
-
return c && !s && !a.hasTextUpdate && !a.uppercaseChanged && !o && !l ?
|
|
10633
|
+
return c && !s && !a.hasTextUpdate && !a.uppercaseChanged && !o && !l ? ea({
|
|
10413
10634
|
textbox: e,
|
|
10414
10635
|
originX: r.originX,
|
|
10415
10636
|
originY: r.originY
|
|
@@ -10442,24 +10663,24 @@ var Li = {
|
|
|
10442
10663
|
}
|
|
10443
10664
|
_applyWholeTextStyles({ textbox: e, selection: t, styleMaps: n }) {
|
|
10444
10665
|
if (t.selectionRange || Object.keys(n.wholeTextStyles).length === 0) return;
|
|
10445
|
-
let r =
|
|
10446
|
-
r &&
|
|
10666
|
+
let r = Ta({ textbox: e });
|
|
10667
|
+
r && Da({
|
|
10447
10668
|
textbox: e,
|
|
10448
10669
|
styles: n.wholeTextStyles,
|
|
10449
10670
|
range: r
|
|
10450
|
-
}) && (e.dirty = !0,
|
|
10671
|
+
}) && (e.dirty = !0, ra({ stylesList: [n.wholeTextStyles] }) && (e.initDimensions(), e.dirty = !0));
|
|
10451
10672
|
}
|
|
10452
10673
|
_applySelectionStyles({ textbox: e, selection: t, styleMaps: n }) {
|
|
10453
10674
|
if (!t.selectionRange) return;
|
|
10454
|
-
let r =
|
|
10675
|
+
let r = Da({
|
|
10455
10676
|
textbox: e,
|
|
10456
10677
|
styles: n.selectionStyles,
|
|
10457
10678
|
range: t.selectionRange
|
|
10458
|
-
}), i = t.fontSelectionRange ?
|
|
10679
|
+
}), i = t.fontSelectionRange ? Da({
|
|
10459
10680
|
textbox: e,
|
|
10460
10681
|
styles: n.lineSelectionStyles,
|
|
10461
10682
|
range: t.fontSelectionRange
|
|
10462
|
-
}) : !1, a =
|
|
10683
|
+
}) : !1, a = ra({ stylesList: [
|
|
10463
10684
|
n.selectionStyles,
|
|
10464
10685
|
n.lineSelectionStyles,
|
|
10465
10686
|
n.wholeTextStyles
|
|
@@ -10481,9 +10702,9 @@ var Li = {
|
|
|
10481
10702
|
_applyFontLineDefaultUpdates({ textbox: e, style: t, selection: n }) {
|
|
10482
10703
|
if (!n.fontSelectionRange || t.fontFamily === void 0 && t.fontSize === void 0) return;
|
|
10483
10704
|
let r = {};
|
|
10484
|
-
t.fontFamily !== void 0 && (r.fontFamily = t.fontFamily), t.fontSize !== void 0 && (r.fontSize = t.fontSize),
|
|
10705
|
+
t.fontFamily !== void 0 && (r.fontFamily = t.fontFamily), t.fontSize !== void 0 && (r.fontSize = t.fontSize), Bi({
|
|
10485
10706
|
textbox: e,
|
|
10486
|
-
lineIndices:
|
|
10707
|
+
lineIndices: ji({
|
|
10487
10708
|
textbox: e,
|
|
10488
10709
|
range: n.fontSelectionRange
|
|
10489
10710
|
}),
|
|
@@ -10493,9 +10714,9 @@ var Li = {
|
|
|
10493
10714
|
_applyDecorationLineDefaultUpdates({ textbox: e, style: t, selection: n, styleMaps: r }) {
|
|
10494
10715
|
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;
|
|
10495
10716
|
let i = {};
|
|
10496
|
-
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)),
|
|
10717
|
+
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)), Bi({
|
|
10497
10718
|
textbox: e,
|
|
10498
|
-
lineIndices:
|
|
10719
|
+
lineIndices: Mi({
|
|
10499
10720
|
textbox: e,
|
|
10500
10721
|
range: n.selectionRange
|
|
10501
10722
|
}),
|
|
@@ -10541,7 +10762,7 @@ var Li = {
|
|
|
10541
10762
|
].some((e) => e !== void 0);
|
|
10542
10763
|
}
|
|
10543
10764
|
_resolveShouldAutoExpand({ textbox: e, style: t, styleMaps: n, contentUpdate: r }) {
|
|
10544
|
-
let i = t.autoExpand ?? e.autoExpand, a =
|
|
10765
|
+
let i = t.autoExpand ?? e.autoExpand, a = ra({ stylesList: [
|
|
10545
10766
|
n.updates,
|
|
10546
10767
|
n.selectionStyles,
|
|
10547
10768
|
n.lineSelectionStyles,
|
|
@@ -10586,18 +10807,18 @@ var Li = {
|
|
|
10586
10807
|
};
|
|
10587
10808
|
this.runtime.canvas.fire("editor:text-updated", m);
|
|
10588
10809
|
}
|
|
10589
|
-
},
|
|
10810
|
+
}, Ia = ({ transform: e }) => {
|
|
10590
10811
|
let { corner: t = "", action: n = "" } = e;
|
|
10591
10812
|
return {
|
|
10592
10813
|
isCornerHandle: t === "tl" || t === "tr" || t === "bl" || t === "br" || n === "scale",
|
|
10593
10814
|
isHorizontalHandle: t === "ml" || t === "mr" || n === "scaleX",
|
|
10594
10815
|
isVerticalHandle: t === "mt" || t === "mb" || n === "scaleY"
|
|
10595
10816
|
};
|
|
10596
|
-
},
|
|
10817
|
+
}, La = ({ textbox: e, transform: t, appliedWidth: n }) => {
|
|
10597
10818
|
t.scaleX = 1, t.scaleY = 1;
|
|
10598
10819
|
let r = t.original;
|
|
10599
10820
|
r && (r.scaleX = 1, r.scaleY = 1, r.width = n, r.height = e.height, r.left = e.left, r.top = e.top);
|
|
10600
|
-
},
|
|
10821
|
+
}, Ra = ({ textbox: e, transform: t, scenePoint: n }) => {
|
|
10601
10822
|
let { x: r, y: i } = e._getTransformedDimensions();
|
|
10602
10823
|
if (r <= 0 || i <= 0) return null;
|
|
10603
10824
|
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);
|
|
@@ -10607,27 +10828,27 @@ var Li = {
|
|
|
10607
10828
|
stepScaleX: l,
|
|
10608
10829
|
stepScaleY: u
|
|
10609
10830
|
};
|
|
10610
|
-
},
|
|
10611
|
-
function
|
|
10831
|
+
}, za = 1e-4;
|
|
10832
|
+
function Ba(e) {
|
|
10612
10833
|
return !!e && e instanceof v;
|
|
10613
10834
|
}
|
|
10614
|
-
function
|
|
10615
|
-
if (!
|
|
10835
|
+
function Va(e) {
|
|
10836
|
+
if (!Ba(e)) return !1;
|
|
10616
10837
|
let t = e.group;
|
|
10617
10838
|
return e.shapeNodeType === "text" && t?.shapeComposite === !0;
|
|
10618
10839
|
}
|
|
10619
|
-
var
|
|
10840
|
+
var Ha = class {
|
|
10620
10841
|
constructor({ canvas: t, canvasManager: n, persistScaledTextbox: r }) {
|
|
10621
10842
|
this.handleMouseMove = (e) => {
|
|
10622
10843
|
let t = this.canvas._currentTransform;
|
|
10623
10844
|
if (!t) return;
|
|
10624
10845
|
let { target: n } = t;
|
|
10625
|
-
if (!
|
|
10846
|
+
if (!Ba(n) || Va(n)) return;
|
|
10626
10847
|
let r = this.scalingState.get(n);
|
|
10627
10848
|
if (!r || !e.e) return;
|
|
10628
|
-
let { isCornerHandle: i, isHorizontalHandle: a, isVerticalHandle: o } =
|
|
10849
|
+
let { isCornerHandle: i, isHorizontalHandle: a, isVerticalHandle: o } = Ia({ transform: t });
|
|
10629
10850
|
if (!a && !o && !i) return;
|
|
10630
|
-
let s =
|
|
10851
|
+
let s = Ra({
|
|
10631
10852
|
textbox: n,
|
|
10632
10853
|
transform: t,
|
|
10633
10854
|
scenePoint: this.canvas.getScenePoint(e.e)
|
|
@@ -10650,20 +10871,20 @@ var ma = class {
|
|
|
10650
10871
|
}, j = r.lastAllowedScaleX, M = r.lastAllowedScaleY;
|
|
10651
10872
|
if (i) {
|
|
10652
10873
|
let e = Math.max(r.minimumProportionalScale, r.lastAllowedScaleX * Math.sqrt(u * d)), t = c || l ? r.minimumProportionalScale : e;
|
|
10653
|
-
if (Math.abs(t - r.lastAllowedScaleX) <=
|
|
10874
|
+
if (Math.abs(t - r.lastAllowedScaleX) <= za) return;
|
|
10654
10875
|
j = t, M = t;
|
|
10655
10876
|
} else {
|
|
10656
10877
|
if (a) {
|
|
10657
10878
|
let e = r.lastAllowedScaleX * u, t = c ? r.minimumWidthScale : Math.max(r.minimumWidthScale, e);
|
|
10658
|
-
Math.abs(t - r.lastAllowedScaleX) >
|
|
10879
|
+
Math.abs(t - r.lastAllowedScaleX) > za && (j = t);
|
|
10659
10880
|
}
|
|
10660
10881
|
if (o) {
|
|
10661
10882
|
let e = r.lastAllowedScaleY * d, t = l ? r.minimumFontScale : Math.max(r.minimumFontScale, e);
|
|
10662
|
-
Math.abs(t - r.lastAllowedScaleY) >
|
|
10883
|
+
Math.abs(t - r.lastAllowedScaleY) > za && (M = t);
|
|
10663
10884
|
}
|
|
10664
|
-
if (Math.abs(j - r.lastAllowedScaleX) <=
|
|
10885
|
+
if (Math.abs(j - r.lastAllowedScaleX) <= za && Math.abs(M - r.lastAllowedScaleY) <= za) return;
|
|
10665
10886
|
}
|
|
10666
|
-
let { appliedWidth: N, dimensionsRounded: P } =
|
|
10887
|
+
let { appliedWidth: N, dimensionsRounded: P } = ca({
|
|
10667
10888
|
textbox: n,
|
|
10668
10889
|
canvasManager: this.canvasManager,
|
|
10669
10890
|
base: r.startBase,
|
|
@@ -10677,7 +10898,7 @@ var ma = class {
|
|
|
10677
10898
|
shouldDisableAutoExpandOnHorizontalChange: a,
|
|
10678
10899
|
shouldRoundDimensions: !i
|
|
10679
10900
|
});
|
|
10680
|
-
|
|
10901
|
+
La({
|
|
10681
10902
|
textbox: n,
|
|
10682
10903
|
transform: t,
|
|
10683
10904
|
appliedWidth: N
|
|
@@ -10698,12 +10919,12 @@ var ma = class {
|
|
|
10698
10919
|
}), this.canvas.requestRenderAll();
|
|
10699
10920
|
}, this.handleObjectScaling = (t) => {
|
|
10700
10921
|
let { target: n, transform: r } = t;
|
|
10701
|
-
if (n instanceof e || !
|
|
10922
|
+
if (n instanceof e || !Ba(n) || Va(n) || !r) return;
|
|
10702
10923
|
n.isScaling = !0;
|
|
10703
10924
|
let i = this._ensureScalingState({
|
|
10704
10925
|
textbox: n,
|
|
10705
10926
|
transform: r
|
|
10706
|
-
}), { startBase: a } = i, { width: o, fontSize: s } = a, { isCornerHandle: c, isHorizontalHandle: l, isVerticalHandle: u } =
|
|
10927
|
+
}), { startBase: a } = i, { width: o, fontSize: s } = a, { isCornerHandle: c, isHorizontalHandle: l, isVerticalHandle: u } = Ia({ transform: r }), d = r.corner ?? "", f = c || u;
|
|
10707
10928
|
if (!l && !u && !c) return;
|
|
10708
10929
|
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({
|
|
10709
10930
|
object: n,
|
|
@@ -10718,7 +10939,7 @@ var ma = class {
|
|
|
10718
10939
|
N = e, P = e;
|
|
10719
10940
|
}
|
|
10720
10941
|
} else l && (N = Math.max(i.minimumWidthScale, i.lastAllowedScaleX * h)), u && (P = Math.max(i.minimumFontScale, i.lastAllowedScaleY * g));
|
|
10721
|
-
let { appliedWidth: ee, dimensionsRounded: te } =
|
|
10942
|
+
let { appliedWidth: ee, dimensionsRounded: te } = ca({
|
|
10722
10943
|
textbox: n,
|
|
10723
10944
|
canvasManager: this.canvasManager,
|
|
10724
10945
|
base: a,
|
|
@@ -10732,7 +10953,7 @@ var ma = class {
|
|
|
10732
10953
|
shouldDisableAutoExpandOnHorizontalChange: l,
|
|
10733
10954
|
shouldRoundDimensions: !c
|
|
10734
10955
|
});
|
|
10735
|
-
|
|
10956
|
+
La({
|
|
10736
10957
|
textbox: n,
|
|
10737
10958
|
transform: r,
|
|
10738
10959
|
appliedWidth: ee
|
|
@@ -10765,7 +10986,7 @@ var ma = class {
|
|
|
10765
10986
|
let { target: n } = t;
|
|
10766
10987
|
if (n instanceof e) {
|
|
10767
10988
|
let t = n.getObjects();
|
|
10768
|
-
if (!t.some((e) =>
|
|
10989
|
+
if (!t.some((e) => Ba(e))) return;
|
|
10769
10990
|
let { scaleX: r = 1, scaleY: i = 1 } = n;
|
|
10770
10991
|
if (Math.abs(r - 1) < .01 && Math.abs(i - 1) < .01) return;
|
|
10771
10992
|
this.canvas.discardActiveObject(), t.forEach((e) => {
|
|
@@ -10775,7 +10996,7 @@ var ma = class {
|
|
|
10775
10996
|
this.canvas.setActiveObject(a), this.canvas.requestRenderAll();
|
|
10776
10997
|
return;
|
|
10777
10998
|
}
|
|
10778
|
-
if (!
|
|
10999
|
+
if (!Ba(n) || Va(n)) return;
|
|
10779
11000
|
n.isScaling = !1;
|
|
10780
11001
|
let r = this.scalingState.get(n);
|
|
10781
11002
|
if (this.scalingState.delete(n), !r?.hasScalingChange) return;
|
|
@@ -10800,11 +11021,11 @@ var ma = class {
|
|
|
10800
11021
|
}, this.canvas = t, this.canvasManager = n, this.persistScaledTextbox = r, this.scalingState = /* @__PURE__ */ new WeakMap();
|
|
10801
11022
|
}
|
|
10802
11023
|
commitStandaloneTextScale({ target: e, shouldDisableAutoExpandOnHorizontalChange: t = !1 }) {
|
|
10803
|
-
if (!
|
|
11024
|
+
if (!Ba(e) || Va(e)) return !1;
|
|
10804
11025
|
let n = Math.abs(e.scaleX ?? 1) || 1, r = Math.abs(e.scaleY ?? 1) || 1;
|
|
10805
11026
|
if (!(Math.abs(n - 1) > .01 || Math.abs(r - 1) > .01)) return !1;
|
|
10806
|
-
let i =
|
|
10807
|
-
return
|
|
11027
|
+
let i = aa({ textbox: e }), a = this.canvasManager.getObjectPlacement({ object: e });
|
|
11028
|
+
return ca({
|
|
10808
11029
|
textbox: e,
|
|
10809
11030
|
canvasManager: this.canvasManager,
|
|
10810
11031
|
base: i,
|
|
@@ -10820,7 +11041,7 @@ var ma = class {
|
|
|
10820
11041
|
_ensureScalingState({ textbox: e, transform: t }) {
|
|
10821
11042
|
let n = this.scalingState.get(e);
|
|
10822
11043
|
if (!n) {
|
|
10823
|
-
let r =
|
|
11044
|
+
let r = aa({ textbox: e }), i = this.canvasManager.getObjectPlacement({ object: e }), a = oa({ base: r }), o = t.original?.originX ?? t.originX ?? e.originX ?? "center", s = t.original?.originY ?? t.originY ?? e.originY ?? "center";
|
|
10824
11045
|
n = {
|
|
10825
11046
|
startBase: r,
|
|
10826
11047
|
startObjectPlacement: i,
|
|
@@ -10853,7 +11074,7 @@ var ma = class {
|
|
|
10853
11074
|
topRight: e.radiusTopRight ?? 0,
|
|
10854
11075
|
bottomRight: e.radiusBottomRight ?? 0,
|
|
10855
11076
|
bottomLeft: e.radiusBottomLeft ?? 0
|
|
10856
|
-
}, v = Math.abs(n - o) >
|
|
11077
|
+
}, v = Math.abs(n - o) > Di, y = Math.abs(h - r) > Di, 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;
|
|
10857
11078
|
if (c) {
|
|
10858
11079
|
let e = h / Math.max(1, m);
|
|
10859
11080
|
S = e, C = e;
|
|
@@ -10874,7 +11095,7 @@ var ma = class {
|
|
|
10874
11095
|
originY: a
|
|
10875
11096
|
});
|
|
10876
11097
|
}
|
|
10877
|
-
},
|
|
11098
|
+
}, Ua = class e {
|
|
10878
11099
|
constructor({ editor: t }) {
|
|
10879
11100
|
this._handleTextEditingEntered = (t) => {
|
|
10880
11101
|
this.isTextEditingActive = !0;
|
|
@@ -10887,7 +11108,7 @@ var ma = class {
|
|
|
10887
11108
|
if (!e._isTextbox(n)) return;
|
|
10888
11109
|
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 });
|
|
10889
11110
|
if (s) {
|
|
10890
|
-
let e =
|
|
11111
|
+
let e = ja({ value: l });
|
|
10891
11112
|
e !== i && n.set({ text: e }), n.textCaseRaw = l;
|
|
10892
11113
|
} else n.textCaseRaw = i;
|
|
10893
11114
|
if (!r && o === void 0 && (n.autoExpand = !0), r) {
|
|
@@ -10905,7 +11126,7 @@ var ma = class {
|
|
|
10905
11126
|
let r = e._isShapeOwnedTextbox(n);
|
|
10906
11127
|
this.editingPlacementState?.delete(n), delete n.__lineDefaultsPrevText;
|
|
10907
11128
|
let i = n.text ?? "";
|
|
10908
|
-
n.uppercase ? n.textCaseRaw = n.textCaseRaw ?? i.toLocaleLowerCase() : n.textCaseRaw = i, r || (
|
|
11129
|
+
n.uppercase ? n.textCaseRaw = n.textCaseRaw ?? i.toLocaleLowerCase() : n.textCaseRaw = i, r || (ia({ textbox: n }) && (n.setCoords(), n.dirty = !0, this.canvas.requestRenderAll()), n.locked || n.set({
|
|
10909
11130
|
lockMovementX: !1,
|
|
10910
11131
|
lockMovementY: !1
|
|
10911
11132
|
}));
|
|
@@ -10932,7 +11153,7 @@ var ma = class {
|
|
|
10932
11153
|
transform: r,
|
|
10933
11154
|
event: i ?? null
|
|
10934
11155
|
});
|
|
10935
|
-
}, this.editor = t, this.canvas = t.canvas, this.fonts = t.options.fonts ?? [], this.scalingController = new
|
|
11156
|
+
}, this.editor = t, this.canvas = t.canvas, this.fonts = t.options.fonts ?? [], this.scalingController = new Ha({
|
|
10936
11157
|
canvas: t.canvas,
|
|
10937
11158
|
canvasManager: t.canvasManager,
|
|
10938
11159
|
persistScaledTextbox: ({ target: e, style: t }) => {
|
|
@@ -10941,7 +11162,7 @@ var ma = class {
|
|
|
10941
11162
|
style: t
|
|
10942
11163
|
});
|
|
10943
11164
|
}
|
|
10944
|
-
}), this.updateController = new
|
|
11165
|
+
}), this.updateController = new Fa({ runtime: {
|
|
10945
11166
|
canvas: this.canvas,
|
|
10946
11167
|
canvasManager: t.canvasManager,
|
|
10947
11168
|
historyManager: t.historyManager,
|
|
@@ -10950,12 +11171,12 @@ var ma = class {
|
|
|
10950
11171
|
restoreTextboxContentPlacement: (e) => this._restoreTextboxContentPlacement(e),
|
|
10951
11172
|
syncLineStylesWithText: (e) => this._syncLineStylesWithText(e),
|
|
10952
11173
|
getSnapshot: (t) => e._getSnapshot(t)
|
|
10953
|
-
} }), this.editingPlacementState = /* @__PURE__ */ new WeakMap(), this.isTextEditingActive = !1, this._bindEvents(),
|
|
11174
|
+
} }), this.editingPlacementState = /* @__PURE__ */ new WeakMap(), this.isTextEditingActive = !1, this._bindEvents(), Pa();
|
|
10954
11175
|
}
|
|
10955
11176
|
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 } = {}) {
|
|
10956
11177
|
let { canvasManager: M, historyManager: N } = this.editor, { canvas: P } = this;
|
|
10957
11178
|
N.suspendHistory();
|
|
10958
|
-
let F = i ?? this._getDefaultFontFamily(), I =
|
|
11179
|
+
let F = i ?? this._getDefaultFontFamily(), I = Aa({ width: m }), ee = ka({
|
|
10959
11180
|
strokeColor: p,
|
|
10960
11181
|
width: I
|
|
10961
11182
|
}), te = {
|
|
@@ -10984,14 +11205,14 @@ var ma = class {
|
|
|
10984
11205
|
radiusBottomRight: w,
|
|
10985
11206
|
radiusBottomLeft: T,
|
|
10986
11207
|
...E
|
|
10987
|
-
}, L = new
|
|
11208
|
+
}, L = new Na(n, te), ne = r !== !1;
|
|
10988
11209
|
L.autoExpand = ne;
|
|
10989
11210
|
let re = E.left !== void 0 || E.top !== void 0;
|
|
10990
11211
|
if (L.textCaseRaw = L.text ?? "", l) {
|
|
10991
|
-
let e =
|
|
11212
|
+
let e = ja({ value: L.textCaseRaw });
|
|
10992
11213
|
e !== L.text && L.set({ text: e });
|
|
10993
11214
|
}
|
|
10994
|
-
|
|
11215
|
+
ia({ textbox: L }) && (L.dirty = !0);
|
|
10995
11216
|
let ie;
|
|
10996
11217
|
re && (ie = M.resolveObjectPlacement({
|
|
10997
11218
|
object: L,
|
|
@@ -11096,7 +11317,7 @@ var ma = class {
|
|
|
11096
11317
|
clampToMontage: r
|
|
11097
11318
|
}));
|
|
11098
11319
|
let a = !1;
|
|
11099
|
-
i || (a =
|
|
11320
|
+
i || (a = ia({ textbox: e }));
|
|
11100
11321
|
let o = !1;
|
|
11101
11322
|
return !i && t && (this.editor.canvasManager.applyObjectPlacement({
|
|
11102
11323
|
object: e,
|
|
@@ -11104,7 +11325,7 @@ var ma = class {
|
|
|
11104
11325
|
}), o = !0), (i || a) && (e.dirty = !0), (i || a || o) && e.setCoords(), i || a;
|
|
11105
11326
|
}
|
|
11106
11327
|
_restoreTextboxContentPlacement({ textbox: e, contentPlacement: t }) {
|
|
11107
|
-
let n =
|
|
11328
|
+
let n = ea({
|
|
11108
11329
|
textbox: e,
|
|
11109
11330
|
originX: t.originX,
|
|
11110
11331
|
originY: t.originY
|
|
@@ -11122,7 +11343,7 @@ var ma = class {
|
|
|
11122
11343
|
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);
|
|
11123
11344
|
}
|
|
11124
11345
|
_syncLineStylesWithText({ textbox: e, previousText: t, currentText: n }) {
|
|
11125
|
-
let r = n ?? e.text ?? "", i =
|
|
11346
|
+
let r = n ?? e.text ?? "", i = Ji({
|
|
11126
11347
|
textbox: e,
|
|
11127
11348
|
previousText: t ?? e.__lineDefaultsPrevText ?? r,
|
|
11128
11349
|
currentText: r
|
|
@@ -11140,16 +11361,16 @@ var ma = class {
|
|
|
11140
11361
|
if (!Number.isFinite(f) || f <= 0) return !1;
|
|
11141
11362
|
let p = a.split("\n").length, m = !1;
|
|
11142
11363
|
Math.abs((e.width ?? 0) - f) > .01 && (e.set({ width: f }), m = !0), e.initDimensions();
|
|
11143
|
-
let { textLines: h } = e, g = Array.isArray(h) && h.length > p, _ = Math.ceil(
|
|
11364
|
+
let { textLines: h } = e, g = Array.isArray(h) && h.length > p, _ = Math.ceil(Qi({
|
|
11144
11365
|
textbox: e,
|
|
11145
11366
|
text: a
|
|
11146
11367
|
})), v = Math.min(e.minWidth ?? 1, f), y = Math.min(f, Math.max(_, v));
|
|
11147
|
-
g && (y = f), Math.abs((e.width ?? 0) - y) > .01 && (e.set({ width: y }), e.initDimensions(), m = !0),
|
|
11368
|
+
g && (y = f), Math.abs((e.width ?? 0) - y) > .01 && (e.set({ width: y }), e.initDimensions(), m = !0), ia({ textbox: e }) && (m = !0), t && r.applyObjectPlacement({
|
|
11148
11369
|
object: e,
|
|
11149
11370
|
placement: t
|
|
11150
11371
|
});
|
|
11151
11372
|
let b = !1;
|
|
11152
|
-
return n && (b =
|
|
11373
|
+
return n && (b = ta({
|
|
11153
11374
|
textbox: e,
|
|
11154
11375
|
montageLeft: o,
|
|
11155
11376
|
montageRight: o + s
|
|
@@ -11207,7 +11428,7 @@ var ma = class {
|
|
|
11207
11428
|
_getDefaultFontFamily() {
|
|
11208
11429
|
return this.fonts[0]?.family ?? "Arial";
|
|
11209
11430
|
}
|
|
11210
|
-
},
|
|
11431
|
+
}, Wa = ({ x1: e, y1: t, x2: n, y2: r }) => (Math.atan2(r - t, n - e) * 180 / Math.PI + 360) % 360, Ga = (e) => {
|
|
11211
11432
|
if (!e || typeof e != "object") return null;
|
|
11212
11433
|
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) => ({
|
|
11213
11434
|
color: typeof e.color == "string" ? e.color : "#000000",
|
|
@@ -11218,7 +11439,7 @@ var ma = class {
|
|
|
11218
11439
|
let { x1: e, y1: t, x2: r, y2: i } = n;
|
|
11219
11440
|
if (typeof e == "number" && typeof t == "number" && typeof r == "number" && typeof i == "number") return {
|
|
11220
11441
|
type: "linear",
|
|
11221
|
-
angle:
|
|
11442
|
+
angle: Wa({
|
|
11222
11443
|
x1: e,
|
|
11223
11444
|
y1: t,
|
|
11224
11445
|
x2: r,
|
|
@@ -11246,7 +11467,7 @@ var ma = class {
|
|
|
11246
11467
|
};
|
|
11247
11468
|
}
|
|
11248
11469
|
return null;
|
|
11249
|
-
},
|
|
11470
|
+
}, Ka = "_templateAnchorX", qa = "_templateAnchorY", Ja = class t {
|
|
11250
11471
|
constructor({ editor: e }) {
|
|
11251
11472
|
this.editor = e;
|
|
11252
11473
|
}
|
|
@@ -11255,7 +11476,7 @@ var ma = class {
|
|
|
11255
11476
|
if (!p.length) return s.emitWarning({
|
|
11256
11477
|
origin: "TemplateManager",
|
|
11257
11478
|
method: "serializeSelection",
|
|
11258
|
-
code:
|
|
11479
|
+
code: xa.TEMPLATE_MANAGER.NO_OBJECTS_SELECTED,
|
|
11259
11480
|
message: "Нет объектов для сериализации шаблона"
|
|
11260
11481
|
}), null;
|
|
11261
11482
|
let m = t._getBounds(o), h = t._getMontageSize({
|
|
@@ -11284,14 +11505,14 @@ var ma = class {
|
|
|
11284
11505
|
if (!l?.length) return a.emitWarning({
|
|
11285
11506
|
origin: "TemplateManager",
|
|
11286
11507
|
method: "applyTemplate",
|
|
11287
|
-
code:
|
|
11508
|
+
code: xa.TEMPLATE_MANAGER.INVALID_TEMPLATE,
|
|
11288
11509
|
message: "Шаблон не содержит объектов"
|
|
11289
11510
|
}), null;
|
|
11290
11511
|
let f = t._getBounds(r);
|
|
11291
11512
|
if (!f) return a.emitWarning({
|
|
11292
11513
|
origin: "TemplateManager",
|
|
11293
11514
|
method: "applyTemplate",
|
|
11294
|
-
code:
|
|
11515
|
+
code: xa.TEMPLATE_MANAGER.INVALID_TARGET,
|
|
11295
11516
|
message: "Не удалось определить границы монтажной области"
|
|
11296
11517
|
}), null;
|
|
11297
11518
|
let p = t._getMontageSize({
|
|
@@ -11310,7 +11531,7 @@ var ma = class {
|
|
|
11310
11531
|
if (!r.length) return a.emitWarning({
|
|
11311
11532
|
origin: "TemplateManager",
|
|
11312
11533
|
method: "applyTemplate",
|
|
11313
|
-
code:
|
|
11534
|
+
code: xa.TEMPLATE_MANAGER.INVALID_TEMPLATE,
|
|
11314
11535
|
message: "Не удалось создать объекты шаблона"
|
|
11315
11536
|
}), null;
|
|
11316
11537
|
let { backgroundObject: i, contentObjects: u } = t._extractBackgroundObject(r);
|
|
@@ -11332,7 +11553,7 @@ var ma = class {
|
|
|
11332
11553
|
}), c.commitStandaloneTextScale({ target: e }), s.commitRehydratedShapeLayout({
|
|
11333
11554
|
target: e,
|
|
11334
11555
|
textScale: h
|
|
11335
|
-
}), Vt({ object: e }),
|
|
11556
|
+
}), Vt({ object: e }), ha({ rootObject: e }), n.add(e), e));
|
|
11336
11557
|
return !d.length && !v ? null : (_ = d.length > 0 || v, d.length && t._activateObjects({
|
|
11337
11558
|
canvas: n,
|
|
11338
11559
|
objects: d
|
|
@@ -11345,7 +11566,7 @@ var ma = class {
|
|
|
11345
11566
|
return a.emitError({
|
|
11346
11567
|
origin: "TemplateManager",
|
|
11347
11568
|
method: "applyTemplate",
|
|
11348
|
-
code:
|
|
11569
|
+
code: xa.TEMPLATE_MANAGER.APPLY_FAILED,
|
|
11349
11570
|
message: "Ошибка применения шаблона",
|
|
11350
11571
|
data: {
|
|
11351
11572
|
templateId: d,
|
|
@@ -11502,8 +11723,8 @@ var ma = class {
|
|
|
11502
11723
|
baseHeight: a,
|
|
11503
11724
|
scale: n,
|
|
11504
11725
|
useRelativePositions: o,
|
|
11505
|
-
anchorX: t._resolveAnchor(s,
|
|
11506
|
-
anchorY: t._resolveAnchor(s,
|
|
11726
|
+
anchorX: t._resolveAnchor(s, Ka),
|
|
11727
|
+
anchorY: t._resolveAnchor(s, qa)
|
|
11507
11728
|
})
|
|
11508
11729
|
}), h = f * n, g = p * n, _ = e.originX ?? "center", v = e.originY ?? "center";
|
|
11509
11730
|
e.set({
|
|
@@ -11578,7 +11799,7 @@ var ma = class {
|
|
|
11578
11799
|
});
|
|
11579
11800
|
if (!i || !a) return;
|
|
11580
11801
|
e.setCoords();
|
|
11581
|
-
let o = e, s = t._resolveAnchor(o,
|
|
11802
|
+
let o = e, s = t._resolveAnchor(o, Ka), 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;
|
|
11582
11803
|
e.set("width", i), e.initDimensions();
|
|
11583
11804
|
let h = t._getLongestLineWidth({
|
|
11584
11805
|
textbox: e,
|
|
@@ -11607,10 +11828,10 @@ var ma = class {
|
|
|
11607
11828
|
x: (p.left - o) / d,
|
|
11608
11829
|
y: (p.top - s) / f
|
|
11609
11830
|
}, h = (u.left - o) / d, g = (u.top - s) / f, _ = h + u.width / d, v = g + u.height / f;
|
|
11610
|
-
return a[
|
|
11831
|
+
return a[Ka] = t._detectAnchor({
|
|
11611
11832
|
start: h,
|
|
11612
11833
|
end: _
|
|
11613
|
-
}), a[
|
|
11834
|
+
}), a[qa] = t._detectAnchor({
|
|
11614
11835
|
start: g,
|
|
11615
11836
|
end: v
|
|
11616
11837
|
}), a.left = m.x, a.top = m.y, a;
|
|
@@ -11635,7 +11856,7 @@ var ma = class {
|
|
|
11635
11856
|
withoutSave: !0
|
|
11636
11857
|
}), !0;
|
|
11637
11858
|
if (a === "gradient") {
|
|
11638
|
-
let e =
|
|
11859
|
+
let e = Ga(r);
|
|
11639
11860
|
if (e) return n.setGradientBackground({
|
|
11640
11861
|
gradient: e,
|
|
11641
11862
|
customData: o,
|
|
@@ -11656,7 +11877,7 @@ var ma = class {
|
|
|
11656
11877
|
r.emitWarning({
|
|
11657
11878
|
origin: "TemplateManager",
|
|
11658
11879
|
method: "applyTemplate",
|
|
11659
|
-
code:
|
|
11880
|
+
code: xa.TEMPLATE_MANAGER.APPLY_FAILED,
|
|
11660
11881
|
message: "Не удалось применить фон из шаблона",
|
|
11661
11882
|
data: e
|
|
11662
11883
|
});
|
|
@@ -11692,29 +11913,29 @@ var ma = class {
|
|
|
11692
11913
|
enlivenObjectEnlivables(e) {
|
|
11693
11914
|
return w.enlivenObjectEnlivables(e);
|
|
11694
11915
|
}
|
|
11695
|
-
},
|
|
11696
|
-
let n =
|
|
11916
|
+
}, Ya = "#3D8BF4", Xa = .5, Za = ({ distance: e }) => Number.isFinite(e) ? Math.round(Math.max(0, e)) : 0, Qa = ({ firstDistance: e, secondDistance: t }) => {
|
|
11917
|
+
let n = Za({ distance: e }), r = Za({ distance: t });
|
|
11697
11918
|
return {
|
|
11698
11919
|
firstDisplayDistance: n,
|
|
11699
11920
|
secondDisplayDistance: r,
|
|
11700
11921
|
displayDistanceDiff: Math.abs(n - r),
|
|
11701
11922
|
commonDisplayDistance: Math.max(n, r)
|
|
11702
11923
|
};
|
|
11703
|
-
},
|
|
11924
|
+
}, $a = ({ firstStart: e, firstEnd: t, secondStart: n, secondEnd: r }) => Math.min(t, r) - Math.max(e, n), eo = ({ step: e }) => {
|
|
11704
11925
|
let t = Math.abs(e).toString(), n = t.indexOf(".");
|
|
11705
11926
|
return n === -1 ? 0 : t.slice(n + 1).length;
|
|
11706
|
-
},
|
|
11927
|
+
}, to = ({ value: e, step: t }) => {
|
|
11707
11928
|
if (t === 0) return e;
|
|
11708
|
-
let n =
|
|
11929
|
+
let n = eo({ step: t }), r = Math.round(e / t) * t;
|
|
11709
11930
|
return Number(r.toFixed(n));
|
|
11710
|
-
},
|
|
11931
|
+
}, no = ({ value: e, step: t }) => {
|
|
11711
11932
|
if (t === 0) return !0;
|
|
11712
|
-
let n =
|
|
11933
|
+
let n = to({
|
|
11713
11934
|
value: e,
|
|
11714
11935
|
step: t
|
|
11715
|
-
}), r = 10 ** -(
|
|
11936
|
+
}), r = 10 ** -(eo({ step: t }) + 4);
|
|
11716
11937
|
return Math.abs(n - e) <= r;
|
|
11717
|
-
},
|
|
11938
|
+
}, ro = ({ bounds: e, axis: t }) => {
|
|
11718
11939
|
let { left: n = 0, right: r = 0, top: i = 0, bottom: a = 0 } = e;
|
|
11719
11940
|
return t === "vertical" ? {
|
|
11720
11941
|
start: i,
|
|
@@ -11723,7 +11944,7 @@ var ma = class {
|
|
|
11723
11944
|
start: n,
|
|
11724
11945
|
end: r
|
|
11725
11946
|
};
|
|
11726
|
-
},
|
|
11947
|
+
}, io = ({ items: e, axis: t }) => {
|
|
11727
11948
|
for (let n = 1; n < e.length; n += 1) {
|
|
11728
11949
|
let r = e[n], { bounds: i } = r, a = i[t], o = n - 1;
|
|
11729
11950
|
for (; o >= 0;) {
|
|
@@ -11733,10 +11954,10 @@ var ma = class {
|
|
|
11733
11954
|
}
|
|
11734
11955
|
e[o + 1] = r;
|
|
11735
11956
|
}
|
|
11736
|
-
},
|
|
11957
|
+
}, ao = ({ items: e, index: t, axis: n, direction: r }) => {
|
|
11737
11958
|
let i = e[t];
|
|
11738
11959
|
if (!i) return null;
|
|
11739
|
-
let { bounds: a } = i, { start: o, end: s } =
|
|
11960
|
+
let { bounds: a } = i, { start: o, end: s } = ro({
|
|
11740
11961
|
bounds: a,
|
|
11741
11962
|
axis: n
|
|
11742
11963
|
});
|
|
@@ -11744,7 +11965,7 @@ var ma = class {
|
|
|
11744
11965
|
for (let r = t - 1; r >= 0; --r) {
|
|
11745
11966
|
let t = e[r];
|
|
11746
11967
|
if (!t) continue;
|
|
11747
|
-
let { bounds: i } = t, { end: a } =
|
|
11968
|
+
let { bounds: i } = t, { end: a } = ro({
|
|
11748
11969
|
bounds: i,
|
|
11749
11970
|
axis: n
|
|
11750
11971
|
});
|
|
@@ -11755,26 +11976,26 @@ var ma = class {
|
|
|
11755
11976
|
for (let r = t + 1; r < e.length; r += 1) {
|
|
11756
11977
|
let t = e[r];
|
|
11757
11978
|
if (!t) continue;
|
|
11758
|
-
let { bounds: i } = t, { start: a } =
|
|
11979
|
+
let { bounds: i } = t, { start: a } = ro({
|
|
11759
11980
|
bounds: i,
|
|
11760
11981
|
axis: n
|
|
11761
11982
|
});
|
|
11762
11983
|
if (a - s >= 0) return r;
|
|
11763
11984
|
}
|
|
11764
11985
|
return null;
|
|
11765
|
-
},
|
|
11986
|
+
}, oo = ({ items: e }) => {
|
|
11766
11987
|
for (let t = 0; t < e.length; t += 1) {
|
|
11767
11988
|
let { isActive: n } = e[t];
|
|
11768
11989
|
if (n) return t;
|
|
11769
11990
|
}
|
|
11770
11991
|
return -1;
|
|
11771
|
-
},
|
|
11992
|
+
}, so = ({ patternAxis: e, activeRangeStart: t, activeRangeEnd: n, tolerance: r = 0 }) => {
|
|
11772
11993
|
let i = Math.min(t, n), a = Math.max(t, n);
|
|
11773
11994
|
return e >= i - r && e <= a + r;
|
|
11774
|
-
},
|
|
11995
|
+
}, co = ({ patternStart: e, patternEnd: t, activeStart: n, activeEnd: r }) => t <= n ? "before" : e >= r ? "after" : null, lo = ({ baseOption: e, candidateOption: t }) => {
|
|
11775
11996
|
let { delta: n, guide: { distance: r } } = e, { delta: i, guide: { distance: a } } = t;
|
|
11776
11997
|
return n === i && r === a;
|
|
11777
|
-
},
|
|
11998
|
+
}, uo = ({ options: e }) => {
|
|
11778
11999
|
let t = e[0];
|
|
11779
12000
|
for (let n = 1; n < e.length; n += 1) {
|
|
11780
12001
|
let r = e[n];
|
|
@@ -11785,11 +12006,11 @@ var ma = class {
|
|
|
11785
12006
|
r.diff === t.diff && Math.abs(r.delta) < Math.abs(t.delta) && (t = r);
|
|
11786
12007
|
}
|
|
11787
12008
|
return t;
|
|
11788
|
-
},
|
|
12009
|
+
}, fo = ({ currentOption: e, nextOption: t }) => {
|
|
11789
12010
|
if (!e) return !0;
|
|
11790
12011
|
let { contextDistance: n, diff: r, delta: i } = e, { contextDistance: a, diff: o, delta: s } = t;
|
|
11791
12012
|
return a < n ? !0 : a > n ? !1 : o < r ? !0 : o > r ? !1 : Math.abs(s) < Math.abs(i);
|
|
11792
|
-
},
|
|
12013
|
+
}, po = ({ options: e }) => {
|
|
11793
12014
|
let t = [], n = null, r = null;
|
|
11794
12015
|
for (let i of e) {
|
|
11795
12016
|
let { kind: e, side: a } = i;
|
|
@@ -11797,18 +12018,18 @@ var ma = class {
|
|
|
11797
12018
|
t.push(i);
|
|
11798
12019
|
continue;
|
|
11799
12020
|
}
|
|
11800
|
-
a === "before" &&
|
|
12021
|
+
a === "before" && fo({
|
|
11801
12022
|
currentOption: n,
|
|
11802
12023
|
nextOption: i
|
|
11803
|
-
}) && (n = i), a === "after" &&
|
|
12024
|
+
}) && (n = i), a === "after" && fo({
|
|
11804
12025
|
currentOption: r,
|
|
11805
12026
|
nextOption: i
|
|
11806
12027
|
}) && (r = i);
|
|
11807
12028
|
}
|
|
11808
12029
|
return n && t.push(n), r && t.push(r), t;
|
|
11809
|
-
},
|
|
12030
|
+
}, mo = ({ options: e, side: t, baseOption: n }) => {
|
|
11810
12031
|
let r = null;
|
|
11811
|
-
for (let i of e) if (i.side === t &&
|
|
12032
|
+
for (let i of e) if (i.side === t && lo({
|
|
11812
12033
|
baseOption: n,
|
|
11813
12034
|
candidateOption: i
|
|
11814
12035
|
})) {
|
|
@@ -11819,63 +12040,63 @@ var ma = class {
|
|
|
11819
12040
|
!r || i.diff !== r.diff || Math.abs(i.delta) < Math.abs(r.delta) && (r = i);
|
|
11820
12041
|
}
|
|
11821
12042
|
return r;
|
|
11822
|
-
},
|
|
12043
|
+
}, ho = ({ option: e }) => {
|
|
11823
12044
|
let { side: t, kind: n, guide: { distance: r } } = e;
|
|
11824
12045
|
return {
|
|
11825
12046
|
side: t,
|
|
11826
12047
|
kind: n,
|
|
11827
12048
|
distance: r
|
|
11828
12049
|
};
|
|
11829
|
-
},
|
|
12050
|
+
}, go = ({ option: e, context: t }) => {
|
|
11830
12051
|
let { side: n, kind: r, distance: i } = t, { side: a, kind: o, guide: { distance: s } } = e;
|
|
11831
12052
|
return n !== a || r !== o ? !1 : Math.abs(s - i) <= 1;
|
|
11832
|
-
},
|
|
12053
|
+
}, _o = ({ options: e, context: t }) => {
|
|
11833
12054
|
if (!t) return null;
|
|
11834
|
-
for (let n of e) if (
|
|
12055
|
+
for (let n of e) if (go({
|
|
11835
12056
|
option: n,
|
|
11836
12057
|
context: t
|
|
11837
12058
|
})) return n;
|
|
11838
12059
|
return null;
|
|
11839
|
-
},
|
|
11840
|
-
let i =
|
|
12060
|
+
}, vo = ({ options: e, bestOption: t, previousContext: n, switchDistance: r = 0 }) => {
|
|
12061
|
+
let i = _o({
|
|
11841
12062
|
options: e,
|
|
11842
12063
|
context: n
|
|
11843
12064
|
});
|
|
11844
12065
|
if (!i) return t;
|
|
11845
12066
|
let a = Math.max(0, r);
|
|
11846
12067
|
return a === 0 || Math.abs(t.delta - i.delta) >= a ? t : i;
|
|
11847
|
-
},
|
|
12068
|
+
}, yo = ({ guides: e, seenGuideKeys: t, guide: n }) => {
|
|
11848
12069
|
let { type: r, axis: i, refStart: a, refEnd: o, activeStart: s, activeEnd: c, distance: l } = n, u = `${r}:${i}:${a}:${o}:${s}:${c}:${l}`;
|
|
11849
12070
|
t.has(u) || (t.add(u), e.push(n));
|
|
11850
|
-
},
|
|
12071
|
+
}, bo = ({ options: e, previousContext: t = null, switchDistance: n = 0 }) => {
|
|
11851
12072
|
if (!e.length) return {
|
|
11852
12073
|
delta: 0,
|
|
11853
12074
|
guides: [],
|
|
11854
12075
|
context: null
|
|
11855
12076
|
};
|
|
11856
|
-
let r =
|
|
12077
|
+
let r = po({ options: e }), i = [];
|
|
11857
12078
|
for (let e of r) e.kind === "reference" && i.push(e);
|
|
11858
|
-
let a = i.length > 0, o = a ? i : r, s =
|
|
12079
|
+
let a = i.length > 0, o = a ? i : r, s = vo({
|
|
11859
12080
|
options: o,
|
|
11860
|
-
bestOption:
|
|
12081
|
+
bestOption: uo({ options: o }),
|
|
11861
12082
|
previousContext: t,
|
|
11862
12083
|
switchDistance: n
|
|
11863
|
-
}), c =
|
|
12084
|
+
}), c = mo({
|
|
11864
12085
|
options: o,
|
|
11865
12086
|
side: "before",
|
|
11866
12087
|
baseOption: s
|
|
11867
|
-
}), l =
|
|
12088
|
+
}), l = mo({
|
|
11868
12089
|
options: o,
|
|
11869
12090
|
side: "after",
|
|
11870
12091
|
baseOption: s
|
|
11871
|
-
}), u =
|
|
12092
|
+
}), u = mo({
|
|
11872
12093
|
options: a ? r : o,
|
|
11873
12094
|
side: "center",
|
|
11874
12095
|
baseOption: s
|
|
11875
12096
|
}), d = [];
|
|
11876
12097
|
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);
|
|
11877
12098
|
let f = [], p = /* @__PURE__ */ new Set();
|
|
11878
|
-
for (let e of d)
|
|
12099
|
+
for (let e of d) yo({
|
|
11879
12100
|
guides: f,
|
|
11880
12101
|
seenGuideKeys: p,
|
|
11881
12102
|
guide: e.guide
|
|
@@ -11883,15 +12104,15 @@ var ma = class {
|
|
|
11883
12104
|
return {
|
|
11884
12105
|
delta: s.delta,
|
|
11885
12106
|
guides: f,
|
|
11886
|
-
context:
|
|
12107
|
+
context: ho({ option: s })
|
|
11887
12108
|
};
|
|
11888
|
-
},
|
|
11889
|
-
let s = n - (e - r), c =
|
|
12109
|
+
}, xo = ({ activeStart: e, activeEnd: t, targetGap: n, beforeEdge: r, afterEdge: i, threshold: a, step: o }) => {
|
|
12110
|
+
let s = n - (e - r), c = to({
|
|
11890
12111
|
value: s,
|
|
11891
12112
|
step: o
|
|
11892
12113
|
}), l = Math.max(1, Math.ceil(a / Math.max(o, 1))), u = null;
|
|
11893
12114
|
for (let d = -l; d <= l; d += 1) {
|
|
11894
|
-
let l = c + d * o, f = e + l, p = t + l, m = f - r, h = i - p, { displayDistanceDiff: g, commonDisplayDistance: _ } =
|
|
12115
|
+
let l = c + d * o, f = e + l, p = t + l, m = f - r, h = i - p, { displayDistanceDiff: g, commonDisplayDistance: _ } = Qa({
|
|
11895
12116
|
firstDistance: m,
|
|
11896
12117
|
secondDistance: h
|
|
11897
12118
|
});
|
|
@@ -11906,13 +12127,13 @@ var ma = class {
|
|
|
11906
12127
|
});
|
|
11907
12128
|
}
|
|
11908
12129
|
return u;
|
|
11909
|
-
},
|
|
11910
|
-
let { secondDisplayDistance: n, displayDistanceDiff: r } =
|
|
12130
|
+
}, So = ({ currentGap: e, referenceGap: t }) => {
|
|
12131
|
+
let { secondDisplayDistance: n, displayDistanceDiff: r } = Qa({
|
|
11911
12132
|
firstDistance: e,
|
|
11912
12133
|
secondDistance: t
|
|
11913
12134
|
});
|
|
11914
12135
|
return r > 1 ? null : n;
|
|
11915
|
-
},
|
|
12136
|
+
}, Co = ({ anchors: e, positions: t, threshold: n }) => {
|
|
11916
12137
|
let r = 0, i = n + 1, a = null;
|
|
11917
12138
|
for (let o of t) for (let t of e) {
|
|
11918
12139
|
let e = Math.abs(t - o);
|
|
@@ -11922,8 +12143,8 @@ var ma = class {
|
|
|
11922
12143
|
delta: r,
|
|
11923
12144
|
guidePosition: a
|
|
11924
12145
|
};
|
|
11925
|
-
},
|
|
11926
|
-
let { left: r, right: i, centerX: a, top: o, bottom: s, centerY: c } = e, l =
|
|
12146
|
+
}, wo = ({ activeBounds: e, threshold: t, anchors: n }) => {
|
|
12147
|
+
let { left: r, right: i, centerX: a, top: o, bottom: s, centerY: c } = e, l = Co({
|
|
11927
12148
|
anchors: n.vertical,
|
|
11928
12149
|
positions: [
|
|
11929
12150
|
r,
|
|
@@ -11931,7 +12152,7 @@ var ma = class {
|
|
|
11931
12152
|
i
|
|
11932
12153
|
],
|
|
11933
12154
|
threshold: t
|
|
11934
|
-
}), u =
|
|
12155
|
+
}), u = Co({
|
|
11935
12156
|
anchors: n.horizontal,
|
|
11936
12157
|
positions: [
|
|
11937
12158
|
o,
|
|
@@ -11951,11 +12172,11 @@ var ma = class {
|
|
|
11951
12172
|
deltaY: u.delta,
|
|
11952
12173
|
guides: d
|
|
11953
12174
|
};
|
|
11954
|
-
},
|
|
12175
|
+
}, To = ({ activeBounds: e, candidates: t, threshold: n, patterns: r, previousContext: i = null, switchDistance: a = 0 }) => {
|
|
11955
12176
|
let { centerX: o, top: s, bottom: c, left: l, right: u } = e, d = [];
|
|
11956
12177
|
for (let e of t) {
|
|
11957
12178
|
let { left: t, right: n } = e;
|
|
11958
|
-
|
|
12179
|
+
$a({
|
|
11959
12180
|
firstStart: t,
|
|
11960
12181
|
firstEnd: n,
|
|
11961
12182
|
secondStart: l,
|
|
@@ -11975,22 +12196,22 @@ var ma = class {
|
|
|
11975
12196
|
f.push({
|
|
11976
12197
|
bounds: e,
|
|
11977
12198
|
isActive: !0
|
|
11978
|
-
}),
|
|
12199
|
+
}), io({
|
|
11979
12200
|
items: f,
|
|
11980
12201
|
axis: "top"
|
|
11981
12202
|
});
|
|
11982
|
-
let p =
|
|
12203
|
+
let p = oo({ items: f });
|
|
11983
12204
|
if (p === -1) return {
|
|
11984
12205
|
delta: 0,
|
|
11985
12206
|
guides: [],
|
|
11986
12207
|
context: null
|
|
11987
12208
|
};
|
|
11988
|
-
let m = [], h = c - s, g =
|
|
12209
|
+
let m = [], h = c - s, g = ao({
|
|
11989
12210
|
items: f,
|
|
11990
12211
|
index: p,
|
|
11991
12212
|
axis: "vertical",
|
|
11992
12213
|
direction: "prev"
|
|
11993
|
-
}), _ =
|
|
12214
|
+
}), _ = ao({
|
|
11994
12215
|
items: f,
|
|
11995
12216
|
index: p,
|
|
11996
12217
|
axis: "vertical",
|
|
@@ -11999,19 +12220,19 @@ var ma = class {
|
|
|
11999
12220
|
if (v && y) {
|
|
12000
12221
|
let { bounds: e } = v, { bounds: t } = y, { bottom: r } = e, { top: i } = t, a = i - r - h;
|
|
12001
12222
|
if (a >= 0) {
|
|
12002
|
-
let e =
|
|
12223
|
+
let e = to({
|
|
12003
12224
|
value: a / 2,
|
|
12004
12225
|
step: 1
|
|
12005
12226
|
}), t = s - r, l = i - c, u = Math.abs(t - e), d = Math.abs(l - e);
|
|
12006
12227
|
if (Math.max(u, d) <= n) {
|
|
12007
|
-
let t =
|
|
12228
|
+
let t = xo({
|
|
12008
12229
|
activeStart: s,
|
|
12009
12230
|
activeEnd: c,
|
|
12010
12231
|
targetGap: e,
|
|
12011
12232
|
beforeEdge: r,
|
|
12012
12233
|
afterEdge: i,
|
|
12013
12234
|
threshold: n,
|
|
12014
|
-
step:
|
|
12235
|
+
step: Xa
|
|
12015
12236
|
});
|
|
12016
12237
|
if (t) {
|
|
12017
12238
|
let { delta: e, distance: n, diff: i, activeStart: a, activeEnd: s } = t, c = {
|
|
@@ -12048,16 +12269,16 @@ var ma = class {
|
|
|
12048
12269
|
}
|
|
12049
12270
|
for (let e of r) {
|
|
12050
12271
|
let { axis: t, start: r, end: i, distance: a } = e;
|
|
12051
|
-
if (!
|
|
12272
|
+
if (!no({
|
|
12052
12273
|
value: a,
|
|
12053
12274
|
step: .5
|
|
12054
|
-
}) || !
|
|
12275
|
+
}) || !so({
|
|
12055
12276
|
patternAxis: t,
|
|
12056
12277
|
activeRangeStart: l,
|
|
12057
12278
|
activeRangeEnd: u,
|
|
12058
12279
|
tolerance: n
|
|
12059
12280
|
})) continue;
|
|
12060
|
-
let d =
|
|
12281
|
+
let d = co({
|
|
12061
12282
|
patternStart: r,
|
|
12062
12283
|
patternEnd: i,
|
|
12063
12284
|
activeStart: s,
|
|
@@ -12065,12 +12286,12 @@ var ma = class {
|
|
|
12065
12286
|
});
|
|
12066
12287
|
if (d) {
|
|
12067
12288
|
if (b !== null && S && d === "before" && Math.abs(b - a) <= n) {
|
|
12068
|
-
let e =
|
|
12289
|
+
let e = to({
|
|
12069
12290
|
value: a - b,
|
|
12070
12291
|
step: 1
|
|
12071
12292
|
}), t = s + e, { bottom: c } = S, l = t - c, u = Math.abs(l - a);
|
|
12072
12293
|
if (u > n) continue;
|
|
12073
|
-
let d =
|
|
12294
|
+
let d = So({
|
|
12074
12295
|
currentGap: l,
|
|
12075
12296
|
referenceGap: a
|
|
12076
12297
|
});
|
|
@@ -12094,12 +12315,12 @@ var ma = class {
|
|
|
12094
12315
|
});
|
|
12095
12316
|
}
|
|
12096
12317
|
if (x !== null && C && d === "after" && Math.abs(x - a) <= n) {
|
|
12097
|
-
let e =
|
|
12318
|
+
let e = to({
|
|
12098
12319
|
value: x - a,
|
|
12099
12320
|
step: 1
|
|
12100
12321
|
}), t = c + e, { top: s } = C, l = s - t, u = Math.abs(l - a);
|
|
12101
12322
|
if (u > n) continue;
|
|
12102
|
-
let d =
|
|
12323
|
+
let d = So({
|
|
12103
12324
|
currentGap: l,
|
|
12104
12325
|
referenceGap: a
|
|
12105
12326
|
});
|
|
@@ -12124,16 +12345,16 @@ var ma = class {
|
|
|
12124
12345
|
}
|
|
12125
12346
|
}
|
|
12126
12347
|
}
|
|
12127
|
-
return
|
|
12348
|
+
return bo({
|
|
12128
12349
|
options: m,
|
|
12129
12350
|
previousContext: i,
|
|
12130
12351
|
switchDistance: a
|
|
12131
12352
|
});
|
|
12132
|
-
},
|
|
12353
|
+
}, Eo = ({ activeBounds: e, candidates: t, threshold: n, patterns: r, previousContext: i = null, switchDistance: a = 0 }) => {
|
|
12133
12354
|
let { centerY: o, left: s, right: c, top: l, bottom: u } = e, d = [];
|
|
12134
12355
|
for (let e of t) {
|
|
12135
12356
|
let { top: t, bottom: n } = e;
|
|
12136
|
-
|
|
12357
|
+
$a({
|
|
12137
12358
|
firstStart: t,
|
|
12138
12359
|
firstEnd: n,
|
|
12139
12360
|
secondStart: l,
|
|
@@ -12153,22 +12374,22 @@ var ma = class {
|
|
|
12153
12374
|
f.push({
|
|
12154
12375
|
bounds: e,
|
|
12155
12376
|
isActive: !0
|
|
12156
|
-
}),
|
|
12377
|
+
}), io({
|
|
12157
12378
|
items: f,
|
|
12158
12379
|
axis: "left"
|
|
12159
12380
|
});
|
|
12160
|
-
let p =
|
|
12381
|
+
let p = oo({ items: f });
|
|
12161
12382
|
if (p === -1) return {
|
|
12162
12383
|
delta: 0,
|
|
12163
12384
|
guides: [],
|
|
12164
12385
|
context: null
|
|
12165
12386
|
};
|
|
12166
|
-
let m = [], h = c - s, g =
|
|
12387
|
+
let m = [], h = c - s, g = ao({
|
|
12167
12388
|
items: f,
|
|
12168
12389
|
index: p,
|
|
12169
12390
|
axis: "horizontal",
|
|
12170
12391
|
direction: "prev"
|
|
12171
|
-
}), _ =
|
|
12392
|
+
}), _ = ao({
|
|
12172
12393
|
items: f,
|
|
12173
12394
|
index: p,
|
|
12174
12395
|
axis: "horizontal",
|
|
@@ -12177,19 +12398,19 @@ var ma = class {
|
|
|
12177
12398
|
if (v && y) {
|
|
12178
12399
|
let { bounds: e } = v, { bounds: t } = y, { right: r } = e, { left: i } = t, a = i - r - h;
|
|
12179
12400
|
if (a >= 0) {
|
|
12180
|
-
let e =
|
|
12401
|
+
let e = to({
|
|
12181
12402
|
value: a / 2,
|
|
12182
12403
|
step: 1
|
|
12183
12404
|
}), t = s - r, l = i - c, u = Math.abs(t - e), d = Math.abs(l - e);
|
|
12184
12405
|
if (Math.max(u, d) <= n) {
|
|
12185
|
-
let t =
|
|
12406
|
+
let t = xo({
|
|
12186
12407
|
activeStart: s,
|
|
12187
12408
|
activeEnd: c,
|
|
12188
12409
|
targetGap: e,
|
|
12189
12410
|
beforeEdge: r,
|
|
12190
12411
|
afterEdge: i,
|
|
12191
12412
|
threshold: n,
|
|
12192
|
-
step:
|
|
12413
|
+
step: Xa
|
|
12193
12414
|
});
|
|
12194
12415
|
if (t) {
|
|
12195
12416
|
let { delta: e, distance: n, diff: i, activeStart: a, activeEnd: s } = t, c = {
|
|
@@ -12226,16 +12447,16 @@ var ma = class {
|
|
|
12226
12447
|
}
|
|
12227
12448
|
for (let e of r) {
|
|
12228
12449
|
let { axis: t, start: r, end: i, distance: a } = e;
|
|
12229
|
-
if (!
|
|
12450
|
+
if (!no({
|
|
12230
12451
|
value: a,
|
|
12231
12452
|
step: .5
|
|
12232
|
-
}) || !
|
|
12453
|
+
}) || !so({
|
|
12233
12454
|
patternAxis: t,
|
|
12234
12455
|
activeRangeStart: l,
|
|
12235
12456
|
activeRangeEnd: u,
|
|
12236
12457
|
tolerance: n
|
|
12237
12458
|
})) continue;
|
|
12238
|
-
let d =
|
|
12459
|
+
let d = co({
|
|
12239
12460
|
patternStart: r,
|
|
12240
12461
|
patternEnd: i,
|
|
12241
12462
|
activeStart: s,
|
|
@@ -12243,12 +12464,12 @@ var ma = class {
|
|
|
12243
12464
|
});
|
|
12244
12465
|
if (d) {
|
|
12245
12466
|
if (b !== null && S && d === "before" && Math.abs(b - a) <= n) {
|
|
12246
|
-
let e =
|
|
12467
|
+
let e = to({
|
|
12247
12468
|
value: a - b,
|
|
12248
12469
|
step: 1
|
|
12249
12470
|
}), t = s + e, { right: c } = S, l = t - c, u = Math.abs(l - a);
|
|
12250
12471
|
if (u > n) continue;
|
|
12251
|
-
let d =
|
|
12472
|
+
let d = So({
|
|
12252
12473
|
currentGap: l,
|
|
12253
12474
|
referenceGap: a
|
|
12254
12475
|
});
|
|
@@ -12272,12 +12493,12 @@ var ma = class {
|
|
|
12272
12493
|
});
|
|
12273
12494
|
}
|
|
12274
12495
|
if (x !== null && C && d === "after" && Math.abs(x - a) <= n) {
|
|
12275
|
-
let e =
|
|
12496
|
+
let e = to({
|
|
12276
12497
|
value: x - a,
|
|
12277
12498
|
step: 1
|
|
12278
12499
|
}), t = c + e, { left: s } = C, l = s - t, u = Math.abs(l - a);
|
|
12279
12500
|
if (u > n) continue;
|
|
12280
|
-
let d =
|
|
12501
|
+
let d = So({
|
|
12281
12502
|
currentGap: l,
|
|
12282
12503
|
referenceGap: a
|
|
12283
12504
|
});
|
|
@@ -12302,20 +12523,20 @@ var ma = class {
|
|
|
12302
12523
|
}
|
|
12303
12524
|
}
|
|
12304
12525
|
}
|
|
12305
|
-
return
|
|
12526
|
+
return bo({
|
|
12306
12527
|
options: m,
|
|
12307
12528
|
previousContext: i,
|
|
12308
12529
|
switchDistance: a
|
|
12309
12530
|
});
|
|
12310
|
-
},
|
|
12311
|
-
let { vertical: o = null, horizontal: s = null } = i ?? {}, c =
|
|
12531
|
+
}, Do = ({ activeBounds: e, candidates: t, threshold: n, spacingPatterns: r, previousContexts: i, switchDistance: a = 0 }) => {
|
|
12532
|
+
let { vertical: o = null, horizontal: s = null } = i ?? {}, c = To({
|
|
12312
12533
|
activeBounds: e,
|
|
12313
12534
|
candidates: t,
|
|
12314
12535
|
threshold: n,
|
|
12315
12536
|
patterns: r.vertical,
|
|
12316
12537
|
previousContext: o,
|
|
12317
12538
|
switchDistance: a
|
|
12318
|
-
}), l =
|
|
12539
|
+
}), l = Eo({
|
|
12319
12540
|
activeBounds: e,
|
|
12320
12541
|
candidates: t,
|
|
12321
12542
|
threshold: n,
|
|
@@ -12334,14 +12555,14 @@ var ma = class {
|
|
|
12334
12555
|
horizontal: l.context
|
|
12335
12556
|
}
|
|
12336
12557
|
};
|
|
12337
|
-
},
|
|
12558
|
+
}, Oo = ({ context: e, x: t, y: n, width: r, height: i, radius: a }) => {
|
|
12338
12559
|
let o = Math.min(a, r / 2, i / 2);
|
|
12339
12560
|
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();
|
|
12340
|
-
},
|
|
12561
|
+
}, ko = ({ 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 }) => {
|
|
12341
12562
|
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;
|
|
12342
12563
|
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";
|
|
12343
12564
|
let S = e.measureText(a).width + _ * 2, C = g + _ * 2, w = b - S / 2, T = x - C / 2;
|
|
12344
|
-
e.beginPath(),
|
|
12565
|
+
e.beginPath(), Oo({
|
|
12345
12566
|
context: e,
|
|
12346
12567
|
x: w,
|
|
12347
12568
|
y: T,
|
|
@@ -12349,11 +12570,11 @@ var ma = class {
|
|
|
12349
12570
|
height: C,
|
|
12350
12571
|
radius: v
|
|
12351
12572
|
}), e.fill(), e.fillStyle = c, e.fillText(a, b, x), e.restore();
|
|
12352
|
-
},
|
|
12353
|
-
let { type: r, axis: i, refStart: a, refEnd: o, activeStart: s, activeEnd: c, distance: l } = t, u =
|
|
12573
|
+
}, Ao = ({ context: e, guide: t, zoom: n }) => {
|
|
12574
|
+
let { type: r, axis: i, refStart: a, refEnd: o, activeStart: s, activeEnd: c, distance: l } = t, u = Za({ distance: l }).toString();
|
|
12354
12575
|
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();
|
|
12355
|
-
let d =
|
|
12356
|
-
|
|
12576
|
+
let d = Ya;
|
|
12577
|
+
ko({
|
|
12357
12578
|
context: e,
|
|
12358
12579
|
type: r,
|
|
12359
12580
|
axis: i,
|
|
@@ -12363,7 +12584,7 @@ var ma = class {
|
|
|
12363
12584
|
zoom: n,
|
|
12364
12585
|
color: d,
|
|
12365
12586
|
lineWidth: 1
|
|
12366
|
-
}),
|
|
12587
|
+
}), ko({
|
|
12367
12588
|
context: e,
|
|
12368
12589
|
type: r,
|
|
12369
12590
|
axis: i,
|
|
@@ -12374,10 +12595,10 @@ var ma = class {
|
|
|
12374
12595
|
color: d,
|
|
12375
12596
|
lineWidth: 1
|
|
12376
12597
|
});
|
|
12377
|
-
},
|
|
12598
|
+
}, jo = ({ anchors: e, bounds: t }) => {
|
|
12378
12599
|
let { left: n, right: r, centerX: i, top: a, bottom: o, centerY: s } = t;
|
|
12379
12600
|
e.vertical.push(n, i, r), e.horizontal.push(a, s, o);
|
|
12380
|
-
},
|
|
12601
|
+
}, Mo = ({ bounds: e, type: t, primaryStart: n, primaryEnd: r }) => {
|
|
12381
12602
|
let i = [], a = n === "top" ? "left" : "top", o = r === "bottom" ? "right" : "bottom", s = [...e].sort((e, t) => e[n] - t[n]);
|
|
12382
12603
|
for (let e = 0; e < s.length; e += 1) {
|
|
12383
12604
|
let c = s[e], l = null, u = Infinity;
|
|
@@ -12398,35 +12619,35 @@ var ma = class {
|
|
|
12398
12619
|
});
|
|
12399
12620
|
}
|
|
12400
12621
|
return i;
|
|
12401
|
-
},
|
|
12402
|
-
vertical:
|
|
12622
|
+
}, No = ({ bounds: e }) => ({
|
|
12623
|
+
vertical: Mo({
|
|
12403
12624
|
bounds: e,
|
|
12404
12625
|
axis: "centerX",
|
|
12405
12626
|
type: "vertical",
|
|
12406
12627
|
primaryStart: "top",
|
|
12407
12628
|
primaryEnd: "bottom"
|
|
12408
12629
|
}),
|
|
12409
|
-
horizontal:
|
|
12630
|
+
horizontal: Mo({
|
|
12410
12631
|
bounds: e,
|
|
12411
12632
|
axis: "centerY",
|
|
12412
12633
|
type: "horizontal",
|
|
12413
12634
|
primaryStart: "left",
|
|
12414
12635
|
primaryEnd: "right"
|
|
12415
12636
|
})
|
|
12416
|
-
}),
|
|
12637
|
+
}), Po = [
|
|
12417
12638
|
"montage-area",
|
|
12418
12639
|
"background",
|
|
12419
12640
|
"interaction-blocker"
|
|
12420
|
-
],
|
|
12641
|
+
], Fo = ({ activeObject: t }) => {
|
|
12421
12642
|
let n = /* @__PURE__ */ new Set();
|
|
12422
12643
|
return t ? (n.add(t), t instanceof e && t.getObjects().forEach((e) => n.add(e)), n) : n;
|
|
12423
|
-
},
|
|
12644
|
+
}, Io = ({ object: e, excluded: t, ignoredIds: n = Po }) => {
|
|
12424
12645
|
if (t.has(e)) return !0;
|
|
12425
12646
|
let { visible: r = !0 } = e;
|
|
12426
12647
|
if (!r) return !0;
|
|
12427
12648
|
let { id: i } = e;
|
|
12428
12649
|
return !!(i && n.includes(i));
|
|
12429
|
-
},
|
|
12650
|
+
}, Lo = class e {
|
|
12430
12651
|
constructor({ editor: e }) {
|
|
12431
12652
|
this.anchors = {
|
|
12432
12653
|
vertical: [],
|
|
@@ -12479,7 +12700,7 @@ var ma = class {
|
|
|
12479
12700
|
this._clearSpacingContexts(), this._clearGuides();
|
|
12480
12701
|
return;
|
|
12481
12702
|
}
|
|
12482
|
-
let { canvas: o } = this, s = o.getZoom() || 1, c = 5 / s, { deltaX: l, deltaY: u } =
|
|
12703
|
+
let { canvas: o } = this, s = o.getZoom() || 1, c = 5 / s, { deltaX: l, deltaY: u } = wo({
|
|
12483
12704
|
activeBounds: a,
|
|
12484
12705
|
threshold: c,
|
|
12485
12706
|
anchors: this.anchors
|
|
@@ -12491,7 +12712,7 @@ var ma = class {
|
|
|
12491
12712
|
top: t + u
|
|
12492
12713
|
}), n.setCoords(), a = W({ object: n }) ?? a;
|
|
12493
12714
|
}
|
|
12494
|
-
let d = this._resolveCurrentTargetBounds({ activeObject: n }), f = this.spacingContexts.vertical || this.spacingContexts.horizontal ? 10 / s : c, p =
|
|
12715
|
+
let d = this._resolveCurrentTargetBounds({ activeObject: n }), f = this.spacingContexts.vertical || this.spacingContexts.horizontal ? 10 / s : c, p = Do({
|
|
12495
12716
|
activeBounds: a,
|
|
12496
12717
|
candidates: d,
|
|
12497
12718
|
threshold: f,
|
|
@@ -12512,11 +12733,11 @@ var ma = class {
|
|
|
12512
12733
|
target: n,
|
|
12513
12734
|
transform: i
|
|
12514
12735
|
});
|
|
12515
|
-
let h = W({ object: n }) ?? a, g =
|
|
12736
|
+
let h = W({ object: n }) ?? a, g = wo({
|
|
12516
12737
|
activeBounds: h,
|
|
12517
12738
|
threshold: c,
|
|
12518
12739
|
anchors: this.anchors
|
|
12519
|
-
}), _ =
|
|
12740
|
+
}), _ = Do({
|
|
12520
12741
|
activeBounds: h,
|
|
12521
12742
|
candidates: d,
|
|
12522
12743
|
threshold: c,
|
|
@@ -12747,9 +12968,9 @@ var ma = class {
|
|
|
12747
12968
|
let { canvas: e, guideBounds: t } = this, n = e.getSelectionContext();
|
|
12748
12969
|
if (!n) return;
|
|
12749
12970
|
let { left: r, right: i, top: a, bottom: o } = t ?? this._calculateViewportBounds(), { viewportTransform: s } = e, c = e.getZoom() || 1;
|
|
12750
|
-
n.save(), Array.isArray(s) && n.transform(...s), n.lineWidth = 1 / c, n.strokeStyle =
|
|
12971
|
+
n.save(), Array.isArray(s) && n.transform(...s), n.lineWidth = 1 / c, n.strokeStyle = Ya, n.setLineDash([4, 4]);
|
|
12751
12972
|
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();
|
|
12752
|
-
for (let e of this.activeSpacingGuides)
|
|
12973
|
+
for (let e of this.activeSpacingGuides) Ao({
|
|
12753
12974
|
context: n,
|
|
12754
12975
|
guide: e,
|
|
12755
12976
|
zoom: c
|
|
@@ -12960,14 +13181,14 @@ var ma = class {
|
|
|
12960
13181
|
}, r = [];
|
|
12961
13182
|
for (let e of t) {
|
|
12962
13183
|
let t = W({ object: e });
|
|
12963
|
-
t && (
|
|
13184
|
+
t && (jo({
|
|
12964
13185
|
anchors: n,
|
|
12965
13186
|
bounds: t
|
|
12966
13187
|
}), r.push(t));
|
|
12967
13188
|
}
|
|
12968
13189
|
let { montageArea: i } = this.editor, a = W({ object: i });
|
|
12969
13190
|
if (a) {
|
|
12970
|
-
|
|
13191
|
+
jo({
|
|
12971
13192
|
anchors: n,
|
|
12972
13193
|
bounds: a
|
|
12973
13194
|
});
|
|
@@ -12979,12 +13200,12 @@ var ma = class {
|
|
|
12979
13200
|
bottom: i
|
|
12980
13201
|
};
|
|
12981
13202
|
} else this.guideBounds = this._calculateViewportBounds();
|
|
12982
|
-
this.anchors = n, this.spacingPatterns =
|
|
13203
|
+
this.anchors = n, this.spacingPatterns = No({ bounds: r }), this.cachedTargetBounds = r;
|
|
12983
13204
|
}
|
|
12984
13205
|
_collectTargets({ activeObject: e }) {
|
|
12985
|
-
let t =
|
|
13206
|
+
let t = Fo({ activeObject: e }), n = [];
|
|
12986
13207
|
return this.canvas.forEachObject((e) => {
|
|
12987
|
-
|
|
13208
|
+
Io({
|
|
12988
13209
|
object: e,
|
|
12989
13210
|
excluded: t
|
|
12990
13211
|
}) || n.push(e);
|
|
@@ -13007,7 +13228,7 @@ var ma = class {
|
|
|
13007
13228
|
bottom: (r - s) / a
|
|
13008
13229
|
};
|
|
13009
13230
|
}
|
|
13010
|
-
},
|
|
13231
|
+
}, Ro = "#3D8BF4", zo = class e {
|
|
13011
13232
|
constructor({ editor: e }) {
|
|
13012
13233
|
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();
|
|
13013
13234
|
}
|
|
@@ -13100,8 +13321,8 @@ var ma = class {
|
|
|
13100
13321
|
this.isTargetMontageArea = l, this.activeGuides = d, this._hideToolbar(), n.requestRenderAll();
|
|
13101
13322
|
}
|
|
13102
13323
|
static _resolveTarget({ event: e, activeObject: t }) {
|
|
13103
|
-
let { target: n } = e, r =
|
|
13104
|
-
return n && !
|
|
13324
|
+
let { target: n } = e, r = Fo({ activeObject: t });
|
|
13325
|
+
return n && !Io({
|
|
13105
13326
|
object: n,
|
|
13106
13327
|
excluded: r
|
|
13107
13328
|
}) ? n : null;
|
|
@@ -13218,18 +13439,18 @@ var ma = class {
|
|
|
13218
13439
|
let { canvas: e } = this, t = e.getSelectionContext();
|
|
13219
13440
|
if (!t) return;
|
|
13220
13441
|
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;
|
|
13221
|
-
t.save(), Array.isArray(n) && t.transform(...n), t.lineWidth = 1 / r, t.strokeStyle =
|
|
13442
|
+
t.save(), Array.isArray(n) && t.transform(...n), t.lineWidth = 1 / r, t.strokeStyle = Ro, t.setLineDash([]);
|
|
13222
13443
|
for (let e of this.activeGuides) {
|
|
13223
13444
|
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;
|
|
13224
|
-
t.beginPath(), n === "vertical" ? (t.moveTo(i, a), t.lineTo(i, c)) : (t.moveTo(a, i), t.lineTo(c, i)), t.stroke(),
|
|
13445
|
+
t.beginPath(), n === "vertical" ? (t.moveTo(i, a), t.lineTo(i, c)) : (t.moveTo(a, i), t.lineTo(c, i)), t.stroke(), ko({
|
|
13225
13446
|
context: t,
|
|
13226
13447
|
type: n,
|
|
13227
13448
|
axis: i,
|
|
13228
13449
|
start: a,
|
|
13229
13450
|
end: c,
|
|
13230
|
-
text:
|
|
13451
|
+
text: Za({ distance: l }).toString(),
|
|
13231
13452
|
zoom: r,
|
|
13232
|
-
color:
|
|
13453
|
+
color: Ro,
|
|
13233
13454
|
lineWidth: 1,
|
|
13234
13455
|
offsetAlongAxis: d,
|
|
13235
13456
|
offsetPerpendicular: 0
|
|
@@ -13247,13 +13468,13 @@ var ma = class {
|
|
|
13247
13468
|
let { toolbar: e } = this.editor;
|
|
13248
13469
|
e?.showAfterTemporary?.(), this.isToolbarHidden = !1;
|
|
13249
13470
|
}
|
|
13250
|
-
},
|
|
13471
|
+
}, Bo = class e {
|
|
13251
13472
|
constructor(e, t) {
|
|
13252
13473
|
this.options = t, this.containerId = e, this.editorId = `${e}-${D()}`, this.init();
|
|
13253
13474
|
}
|
|
13254
13475
|
async init() {
|
|
13255
13476
|
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;
|
|
13256
|
-
if (de.apply(), this.canvas = new t(this.containerId, this.options), this.moduleLoader = new A(), this.workerManager = new M(), this.errorManager = new
|
|
13477
|
+
if (de.apply(), this.canvas = new t(this.containerId, this.options), this.moduleLoader = new A(), this.workerManager = new M(), this.errorManager = new Sa({ editor: this }), this.historyManager = new Tt({ editor: this }), this.toolbar = new Xe({ editor: this }), this.transformManager = new It({ editor: this }), this.zoomManager = new Lt({ editor: this }), this.canvasManager = new Ft({ editor: this }), this.imageManager = new jt({ editor: this }), this.layerManager = new bn({ editor: this }), this.shapeManager = new ma({ editor: this }), this.interactionBlocker = new vn({ editor: this }), this.backgroundManager = new yn({ editor: this }), this.clipboardManager = new ga({ editor: this }), this.objectLockManager = new _a({ editor: this }), this.groupingManager = new va({ editor: this }), this.selectionManager = new ya({ editor: this }), this.deletionManager = new ba({ editor: this }), this.panConstraintManager = new Ca({ editor: this }), this.snappingManager = new Lo({ editor: this }), this.measurementManager = new zo({ editor: this }), this.fontManager = new fe(this.options.fonts ?? []), this.textManager = new Ua({ editor: this }), this.templateManager = new Ja({ editor: this }), u && (this.angleIndicator = new $e({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.interactionBlocker.ensureOverlay(), this.listeners = new k({
|
|
13257
13478
|
editor: this,
|
|
13258
13479
|
options: this.options
|
|
13259
13480
|
}), 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) {
|
|
@@ -13361,7 +13582,7 @@ var ma = class {
|
|
|
13361
13582
|
"U+A640-A69F",
|
|
13362
13583
|
"U+FE2E-FE2F",
|
|
13363
13584
|
"U+2116"
|
|
13364
|
-
].join(", "),
|
|
13585
|
+
].join(", "), Vo = {
|
|
13365
13586
|
preserveObjectStacking: !0,
|
|
13366
13587
|
controlsAboveOverlay: !0,
|
|
13367
13588
|
centeredRotation: !0,
|
|
@@ -14215,20 +14436,20 @@ var ma = class {
|
|
|
14215
14436
|
};
|
|
14216
14437
|
//#endregion
|
|
14217
14438
|
//#region src/main.ts
|
|
14218
|
-
function
|
|
14439
|
+
function Ho(e, t = {}) {
|
|
14219
14440
|
let n = {
|
|
14220
|
-
...
|
|
14441
|
+
...Vo,
|
|
14221
14442
|
...t
|
|
14222
14443
|
}, r = document.getElementById(e);
|
|
14223
14444
|
if (!r) return Promise.reject(/* @__PURE__ */ Error(`Контейнер с ID "${e}" не найден.`));
|
|
14224
14445
|
let i = document.createElement("canvas");
|
|
14225
14446
|
return i.id = `${e}-canvas`, r.appendChild(i), n.editorContainer = r, new Promise((t) => {
|
|
14226
14447
|
n._onReadyCallback = t;
|
|
14227
|
-
let r = new
|
|
14448
|
+
let r = new Bo(i.id, n);
|
|
14228
14449
|
window[e] = r;
|
|
14229
14450
|
});
|
|
14230
14451
|
}
|
|
14231
14452
|
//#endregion
|
|
14232
|
-
export {
|
|
14453
|
+
export { Ho as default };
|
|
14233
14454
|
|
|
14234
14455
|
//# sourceMappingURL=main.js.map
|