@anu3ev/fabric-image-editor 0.8.16 → 0.8.17
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 +560 -560
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -4554,14 +4554,14 @@ function En({ text: e, width: t, height: n, padding: r, internalShapeTextInset:
|
|
|
4554
4554
|
}
|
|
4555
4555
|
//#endregion
|
|
4556
4556
|
//#region src/editor/shape-manager/layout/shape-text-measurement.ts
|
|
4557
|
-
var Dn = 1, On = .5;
|
|
4558
|
-
function
|
|
4559
|
-
let a = Math.max(Dn, t), o =
|
|
4557
|
+
var Dn = 1, On = .5, kn = 1e6;
|
|
4558
|
+
function An({ text: e, frameWidth: t, splitByGrapheme: n, requiresGraphemeSplit: r, measurementCache: i }) {
|
|
4559
|
+
let a = Math.max(Dn, t), o = Kn({
|
|
4560
4560
|
frameWidth: a,
|
|
4561
4561
|
splitByGrapheme: n
|
|
4562
4562
|
}), s = i?.measurementsByKey.get(o);
|
|
4563
4563
|
if (s) return s;
|
|
4564
|
-
let c =
|
|
4564
|
+
let c = Hn({ text: e }), l = r ?? Fn({
|
|
4565
4565
|
text: e,
|
|
4566
4566
|
frameWidth: a,
|
|
4567
4567
|
measurementCache: i
|
|
@@ -4573,24 +4573,24 @@ function kn({ text: e, frameWidth: t, splitByGrapheme: n, requiresGraphemeSplit:
|
|
|
4573
4573
|
scaleX: 1,
|
|
4574
4574
|
scaleY: 1
|
|
4575
4575
|
}), e.initDimensions();
|
|
4576
|
-
let u =
|
|
4577
|
-
measuredHeight:
|
|
4576
|
+
let u = Bn({ text: e }), d = zn({ text: e }), f = {
|
|
4577
|
+
measuredHeight: Ln({ text: e }),
|
|
4578
4578
|
renderedLineCount: u > 0 ? u : d,
|
|
4579
|
-
longestLineWidth: Math.ceil(
|
|
4579
|
+
longestLineWidth: Math.ceil(Rn({ text: e })),
|
|
4580
4580
|
requiresGraphemeSplit: l
|
|
4581
4581
|
};
|
|
4582
|
-
return
|
|
4582
|
+
return Un({
|
|
4583
4583
|
text: e,
|
|
4584
4584
|
state: c
|
|
4585
4585
|
}), i?.measurementsByKey.set(o, f), f;
|
|
4586
4586
|
}
|
|
4587
|
-
function
|
|
4588
|
-
let i =
|
|
4587
|
+
function jn({ text: e, frameWidth: t, wrapPolicy: n, measurementCache: r }) {
|
|
4588
|
+
let i = zn({ text: e }), a = Fn({
|
|
4589
4589
|
text: e,
|
|
4590
4590
|
frameWidth: t,
|
|
4591
4591
|
wrapPolicy: n,
|
|
4592
4592
|
measurementCache: r
|
|
4593
|
-
}), o =
|
|
4593
|
+
}), o = An({
|
|
4594
4594
|
text: e,
|
|
4595
4595
|
frameWidth: t,
|
|
4596
4596
|
splitByGrapheme: a,
|
|
@@ -4602,14 +4602,14 @@ function An({ text: e, frameWidth: t, wrapPolicy: n, measurementCache: r }) {
|
|
|
4602
4602
|
longestLineWidth: o.longestLineWidth
|
|
4603
4603
|
};
|
|
4604
4604
|
}
|
|
4605
|
-
function
|
|
4606
|
-
let a = n ??
|
|
4605
|
+
function Mn({ text: e, frameWidth: t, splitByGrapheme: n, wrapPolicy: r, measurementCache: i }) {
|
|
4606
|
+
let a = n ?? Fn({
|
|
4607
4607
|
text: e,
|
|
4608
4608
|
frameWidth: t,
|
|
4609
4609
|
wrapPolicy: r,
|
|
4610
4610
|
measurementCache: i
|
|
4611
4611
|
});
|
|
4612
|
-
return
|
|
4612
|
+
return An({
|
|
4613
4613
|
text: e,
|
|
4614
4614
|
frameWidth: t,
|
|
4615
4615
|
splitByGrapheme: a,
|
|
@@ -4617,9 +4617,9 @@ function jn({ text: e, frameWidth: t, splitByGrapheme: n, wrapPolicy: r, measure
|
|
|
4617
4617
|
measurementCache: i
|
|
4618
4618
|
}).measuredHeight;
|
|
4619
4619
|
}
|
|
4620
|
-
function
|
|
4620
|
+
function Nn({ text: e, measurementCache: t }) {
|
|
4621
4621
|
if (t?.minimumTextFrameWidth !== null && t?.minimumTextFrameWidth !== void 0) return t.minimumTextFrameWidth;
|
|
4622
|
-
let n =
|
|
4622
|
+
let n = In({
|
|
4623
4623
|
text: e,
|
|
4624
4624
|
frameWidth: Dn,
|
|
4625
4625
|
splitByGrapheme: !0,
|
|
@@ -4627,15 +4627,15 @@ function Mn({ text: e, measurementCache: t }) {
|
|
|
4627
4627
|
}), r = Math.max(Dn, n);
|
|
4628
4628
|
return t && (t.minimumTextFrameWidth = r), r;
|
|
4629
4629
|
}
|
|
4630
|
-
function
|
|
4630
|
+
function Pn({ alignV: e, frameHeight: t, frameTop: n, textHeight: r }) {
|
|
4631
4631
|
let i = Math.max(0, t - r);
|
|
4632
4632
|
return e === "top" ? n : e === "bottom" ? n + i : n + i / 2;
|
|
4633
4633
|
}
|
|
4634
|
-
function
|
|
4634
|
+
function Fn({ text: e, frameWidth: t, wrapPolicy: n, measurementCache: r }) {
|
|
4635
4635
|
if (n === "words-only") return !1;
|
|
4636
|
-
let i = Math.max(Dn, t), a =
|
|
4636
|
+
let i = Math.max(Dn, t), a = Gn({ frameWidth: i }), o = r?.splitByGraphemeByFrameWidth.get(a);
|
|
4637
4637
|
if (typeof o == "boolean") return o;
|
|
4638
|
-
let s =
|
|
4638
|
+
let s = Hn({ text: e });
|
|
4639
4639
|
e.set({
|
|
4640
4640
|
autoExpand: !1,
|
|
4641
4641
|
width: i,
|
|
@@ -4643,19 +4643,19 @@ function Pn({ text: e, frameWidth: t, wrapPolicy: n, measurementCache: r }) {
|
|
|
4643
4643
|
scaleX: 1,
|
|
4644
4644
|
scaleY: 1
|
|
4645
4645
|
}), e.initDimensions();
|
|
4646
|
-
let c =
|
|
4647
|
-
return
|
|
4646
|
+
let c = Wn({ text: e }) > i + On;
|
|
4647
|
+
return Un({
|
|
4648
4648
|
text: e,
|
|
4649
4649
|
state: s
|
|
4650
4650
|
}), r?.splitByGraphemeByFrameWidth.set(a, c), c;
|
|
4651
4651
|
}
|
|
4652
|
-
function
|
|
4653
|
-
let i = r?.measurementsByKey.get(
|
|
4652
|
+
function In({ text: e, frameWidth: t, splitByGrapheme: n, measurementCache: r }) {
|
|
4653
|
+
let i = r?.measurementsByKey.get(Kn({
|
|
4654
4654
|
frameWidth: t,
|
|
4655
4655
|
splitByGrapheme: n
|
|
4656
4656
|
}));
|
|
4657
4657
|
if (i) return i.longestLineWidth;
|
|
4658
|
-
let a =
|
|
4658
|
+
let a = Hn({ text: e });
|
|
4659
4659
|
e.set({
|
|
4660
4660
|
autoExpand: !1,
|
|
4661
4661
|
width: Math.max(Dn, t),
|
|
@@ -4663,13 +4663,13 @@ function Fn({ text: e, frameWidth: t, splitByGrapheme: n, measurementCache: r })
|
|
|
4663
4663
|
scaleX: 1,
|
|
4664
4664
|
scaleY: 1
|
|
4665
4665
|
}), e.initDimensions();
|
|
4666
|
-
let o =
|
|
4667
|
-
return
|
|
4666
|
+
let o = Rn({ text: e });
|
|
4667
|
+
return Un({
|
|
4668
4668
|
text: e,
|
|
4669
4669
|
state: a
|
|
4670
4670
|
}), o;
|
|
4671
4671
|
}
|
|
4672
|
-
function
|
|
4672
|
+
function Ln({ text: e }) {
|
|
4673
4673
|
let { height: t } = e;
|
|
4674
4674
|
if (typeof t == "number" && Number.isFinite(t)) return t;
|
|
4675
4675
|
if (typeof e.calcTextHeight == "function") {
|
|
@@ -4678,27 +4678,27 @@ function In({ text: e }) {
|
|
|
4678
4678
|
}
|
|
4679
4679
|
return Dn;
|
|
4680
4680
|
}
|
|
4681
|
-
function
|
|
4682
|
-
let t =
|
|
4683
|
-
if (t > 0) return
|
|
4681
|
+
function Rn({ text: e }) {
|
|
4682
|
+
let t = Bn({ text: e });
|
|
4683
|
+
if (t > 0) return Vn({
|
|
4684
4684
|
text: e,
|
|
4685
4685
|
lineCount: t
|
|
4686
4686
|
});
|
|
4687
4687
|
let n = e.text ?? "";
|
|
4688
|
-
return
|
|
4688
|
+
return Vn({
|
|
4689
4689
|
text: e,
|
|
4690
4690
|
lineCount: Math.max(n.split("\n").length, 1)
|
|
4691
4691
|
});
|
|
4692
4692
|
}
|
|
4693
|
-
function
|
|
4693
|
+
function zn({ text: e }) {
|
|
4694
4694
|
let t = e.text ?? "";
|
|
4695
4695
|
return Math.max(t.split("\n").length, 1);
|
|
4696
4696
|
}
|
|
4697
|
-
function
|
|
4697
|
+
function Bn({ text: e }) {
|
|
4698
4698
|
let t = e;
|
|
4699
4699
|
return Array.isArray(t.textLines) ? t.textLines.length : 0;
|
|
4700
4700
|
}
|
|
4701
|
-
function
|
|
4701
|
+
function Vn({ text: e, lineCount: t }) {
|
|
4702
4702
|
let n = Dn;
|
|
4703
4703
|
for (let r = 0; r < t; r += 1) {
|
|
4704
4704
|
let t = e.getLineWidth(r);
|
|
@@ -4706,7 +4706,7 @@ function Bn({ text: e, lineCount: t }) {
|
|
|
4706
4706
|
}
|
|
4707
4707
|
return n;
|
|
4708
4708
|
}
|
|
4709
|
-
function
|
|
4709
|
+
function Hn({ text: e }) {
|
|
4710
4710
|
let { autoExpand: t, splitByGrapheme: n, width: r, scaleX: i, scaleY: a } = e;
|
|
4711
4711
|
return {
|
|
4712
4712
|
autoExpand: t,
|
|
@@ -4716,25 +4716,25 @@ function Vn({ text: e }) {
|
|
|
4716
4716
|
scaleY: typeof a == "number" ? a : void 0
|
|
4717
4717
|
};
|
|
4718
4718
|
}
|
|
4719
|
-
function
|
|
4719
|
+
function Un({ text: e, state: t }) {
|
|
4720
4720
|
let { autoExpand: n, splitByGrapheme: r, width: i, scaleX: a, scaleY: o } = t, s = {};
|
|
4721
4721
|
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
4722
|
}
|
|
4723
|
-
function
|
|
4723
|
+
function Wn({ text: e }) {
|
|
4724
4724
|
let { dynamicMinWidth: t } = e;
|
|
4725
4725
|
return typeof t == "number" && Number.isFinite(t) ? t : 0;
|
|
4726
4726
|
}
|
|
4727
|
-
function
|
|
4728
|
-
return String(Math.round(Math.max(Dn, e) *
|
|
4727
|
+
function Gn({ frameWidth: e }) {
|
|
4728
|
+
return String(Math.round(Math.max(Dn, e) * kn) / kn);
|
|
4729
4729
|
}
|
|
4730
|
-
function
|
|
4731
|
-
return `${
|
|
4730
|
+
function Kn({ frameWidth: e, splitByGrapheme: t }) {
|
|
4731
|
+
return `${Gn({ frameWidth: e })}:${t ? 1 : 0}`;
|
|
4732
4732
|
}
|
|
4733
4733
|
//#endregion
|
|
4734
4734
|
//#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 } =
|
|
4735
|
+
var K = 1, q = .5, qn = 24, Jn = 20, Yn = 16;
|
|
4736
|
+
function Xn({ text: e, alignV: t, width: n, height: r, appliedPadding: i, appliedUserPadding: a, wrapPolicy: o }) {
|
|
4737
|
+
let { frame: s, splitByGrapheme: c, textTop: l } = ar({
|
|
4738
4738
|
text: e,
|
|
4739
4739
|
width: n,
|
|
4740
4740
|
height: r,
|
|
@@ -4753,8 +4753,8 @@ function Yn({ text: e, alignV: t, width: n, height: r, appliedPadding: i, applie
|
|
|
4753
4753
|
wrapPolicy: o
|
|
4754
4754
|
};
|
|
4755
4755
|
}
|
|
4756
|
-
var
|
|
4757
|
-
let { width: p, height: m, appliedPadding: h, appliedUserPadding: g } = c ?
|
|
4756
|
+
var Zn = ({ 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 }) => {
|
|
4757
|
+
let { width: p, height: m, appliedPadding: h, appliedUserPadding: g } = c ? nr({
|
|
4758
4758
|
text: e,
|
|
4759
4759
|
width: t,
|
|
4760
4760
|
height: n,
|
|
@@ -4766,7 +4766,7 @@ var Xn = ({ text: e, width: t, height: n, alignV: r, padding: i, wrapPolicy: a,
|
|
|
4766
4766
|
montageAreaWidth: u,
|
|
4767
4767
|
expandShapeHeightToFitText: d,
|
|
4768
4768
|
changedPadding: f
|
|
4769
|
-
}) :
|
|
4769
|
+
}) : dr({
|
|
4770
4770
|
text: e,
|
|
4771
4771
|
width: t,
|
|
4772
4772
|
height: n,
|
|
@@ -4777,7 +4777,7 @@ var Xn = ({ text: e, width: t, height: n, alignV: r, padding: i, wrapPolicy: a,
|
|
|
4777
4777
|
expandShapeHeightToFitText: d,
|
|
4778
4778
|
changedPadding: f
|
|
4779
4779
|
});
|
|
4780
|
-
return
|
|
4780
|
+
return Xn({
|
|
4781
4781
|
text: e,
|
|
4782
4782
|
alignV: r,
|
|
4783
4783
|
width: p,
|
|
@@ -4786,8 +4786,8 @@ var Xn = ({ text: e, width: t, height: n, alignV: r, padding: i, wrapPolicy: a,
|
|
|
4786
4786
|
appliedUserPadding: g,
|
|
4787
4787
|
wrapPolicy: a
|
|
4788
4788
|
});
|
|
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 }) =>
|
|
4789
|
+
}, Qn = ({ text: e, width: t, height: n, alignV: r, padding: i, wrapPolicy: a, internalShapeTextInset: o, resolveInternalShapeTextInset: s, expandShapeHeightToFitText: c = !0, changedPadding: l, measurementCache: u }) => {
|
|
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 }) => Mn({
|
|
4791
4791
|
text: e,
|
|
4792
4792
|
frameWidth: t,
|
|
4793
4793
|
wrapPolicy: a,
|
|
@@ -4797,7 +4797,7 @@ var Xn = ({ text: e, width: t, height: n, alignV: r, padding: i, wrapPolicy: a,
|
|
|
4797
4797
|
width: p,
|
|
4798
4798
|
height: m,
|
|
4799
4799
|
padding: d,
|
|
4800
|
-
internalShapeTextInset:
|
|
4800
|
+
internalShapeTextInset: ur({
|
|
4801
4801
|
width: p,
|
|
4802
4802
|
height: m,
|
|
4803
4803
|
internalShapeTextInset: f,
|
|
@@ -4806,12 +4806,12 @@ var Xn = ({ text: e, width: t, height: n, alignV: r, padding: i, wrapPolicy: a,
|
|
|
4806
4806
|
expandShapeHeightToFitText: c,
|
|
4807
4807
|
changedPadding: l,
|
|
4808
4808
|
measureTextboxHeightForFrame: h,
|
|
4809
|
-
resolveMinimumTextFrameWidth: ({ text: e }) =>
|
|
4809
|
+
resolveMinimumTextFrameWidth: ({ text: e }) => Nn({
|
|
4810
4810
|
text: e,
|
|
4811
4811
|
measurementCache: u
|
|
4812
4812
|
})
|
|
4813
4813
|
});
|
|
4814
|
-
for (let t = 0; t <
|
|
4814
|
+
for (let t = 0; t < qn; t += 1) {
|
|
4815
4815
|
let t = Math.max(m, g.requiredHeight);
|
|
4816
4816
|
if (t <= m + q) break;
|
|
4817
4817
|
m = t, g = En({
|
|
@@ -4819,7 +4819,7 @@ var Xn = ({ text: e, width: t, height: n, alignV: r, padding: i, wrapPolicy: a,
|
|
|
4819
4819
|
width: p,
|
|
4820
4820
|
height: m,
|
|
4821
4821
|
padding: d,
|
|
4822
|
-
internalShapeTextInset:
|
|
4822
|
+
internalShapeTextInset: ur({
|
|
4823
4823
|
width: p,
|
|
4824
4824
|
height: m,
|
|
4825
4825
|
internalShapeTextInset: f,
|
|
@@ -4828,13 +4828,13 @@ var Xn = ({ text: e, width: t, height: n, alignV: r, padding: i, wrapPolicy: a,
|
|
|
4828
4828
|
expandShapeHeightToFitText: c,
|
|
4829
4829
|
changedPadding: l,
|
|
4830
4830
|
measureTextboxHeightForFrame: h,
|
|
4831
|
-
resolveMinimumTextFrameWidth: ({ text: e }) =>
|
|
4831
|
+
resolveMinimumTextFrameWidth: ({ text: e }) => Nn({
|
|
4832
4832
|
text: e,
|
|
4833
4833
|
measurementCache: u
|
|
4834
4834
|
})
|
|
4835
4835
|
});
|
|
4836
4836
|
}
|
|
4837
|
-
return
|
|
4837
|
+
return Xn({
|
|
4838
4838
|
text: e,
|
|
4839
4839
|
alignV: r,
|
|
4840
4840
|
width: p,
|
|
@@ -4844,7 +4844,7 @@ var Xn = ({ text: e, width: t, height: n, alignV: r, padding: i, wrapPolicy: a,
|
|
|
4844
4844
|
wrapPolicy: a
|
|
4845
4845
|
});
|
|
4846
4846
|
};
|
|
4847
|
-
function
|
|
4847
|
+
function $n({ group: e, shape: t, text: n, alignH: r, alignV: i, resolvedLayout: a }) {
|
|
4848
4848
|
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
4849
|
Zt({
|
|
4850
4850
|
shape: t,
|
|
@@ -4875,14 +4875,14 @@ function Qn({ group: e, shape: t, text: n, alignH: r, alignV: i, resolvedLayout:
|
|
|
4875
4875
|
scaleY: 1
|
|
4876
4876
|
}), e.set("dirty", !0), e.setCoords();
|
|
4877
4877
|
}
|
|
4878
|
-
var
|
|
4879
|
-
|
|
4878
|
+
var er = ({ 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 }) => {
|
|
4879
|
+
$n({
|
|
4880
4880
|
group: e,
|
|
4881
4881
|
shape: t,
|
|
4882
4882
|
text: n,
|
|
4883
4883
|
alignH: a,
|
|
4884
4884
|
alignV: o,
|
|
4885
|
-
resolvedLayout:
|
|
4885
|
+
resolvedLayout: Zn({
|
|
4886
4886
|
text: n,
|
|
4887
4887
|
width: r,
|
|
4888
4888
|
height: i,
|
|
@@ -4898,14 +4898,14 @@ var $n = ({ group: e, shape: t, text: n, width: r, height: i, alignH: a, alignV:
|
|
|
4898
4898
|
changedPadding: h
|
|
4899
4899
|
})
|
|
4900
4900
|
});
|
|
4901
|
-
},
|
|
4902
|
-
|
|
4901
|
+
}, tr = ({ 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 }) => {
|
|
4902
|
+
$n({
|
|
4903
4903
|
group: e,
|
|
4904
4904
|
shape: t,
|
|
4905
4905
|
text: n,
|
|
4906
4906
|
alignH: a,
|
|
4907
4907
|
alignV: o,
|
|
4908
|
-
resolvedLayout:
|
|
4908
|
+
resolvedLayout: Qn({
|
|
4909
4909
|
text: n,
|
|
4910
4910
|
width: r,
|
|
4911
4911
|
height: i,
|
|
@@ -4919,9 +4919,9 @@ var $n = ({ group: e, shape: t, text: n, width: r, height: i, alignH: a, alignV:
|
|
|
4919
4919
|
})
|
|
4920
4920
|
});
|
|
4921
4921
|
};
|
|
4922
|
-
function
|
|
4922
|
+
function nr({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalShapeTextInset: a, resolveInternalShapeTextInset: o, shapeTextAutoExpandEnabled: s = !0, montageAreaWidth: c, expandShapeHeightToFitText: l = !0, changedPadding: u }) {
|
|
4923
4923
|
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 (!
|
|
4924
|
+
if (!sr({ text: e })) return dr({
|
|
4925
4925
|
text: e,
|
|
4926
4926
|
width: d,
|
|
4927
4927
|
height: f,
|
|
@@ -4933,7 +4933,7 @@ function tr({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalS
|
|
|
4933
4933
|
changedPadding: u
|
|
4934
4934
|
});
|
|
4935
4935
|
let m = f / d, h = ({ width: t }) => {
|
|
4936
|
-
let n = Math.max(K, t * m), s =
|
|
4936
|
+
let n = Math.max(K, t * m), s = dr({
|
|
4937
4937
|
text: e,
|
|
4938
4938
|
width: t,
|
|
4939
4939
|
height: n,
|
|
@@ -4962,11 +4962,11 @@ function tr({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalS
|
|
|
4962
4962
|
layoutResolution: n
|
|
4963
4963
|
});
|
|
4964
4964
|
}, t = p ? Math.max(d, p) : d;
|
|
4965
|
-
e({ width: t }) || (t =
|
|
4965
|
+
e({ width: t }) || (t = fr({
|
|
4966
4966
|
minimumWidth: t,
|
|
4967
4967
|
isWidthValid: e
|
|
4968
4968
|
}));
|
|
4969
|
-
let { layoutResolution: n } = h({ width:
|
|
4969
|
+
let { layoutResolution: n } = h({ width: pr({
|
|
4970
4970
|
minimumWidth: d,
|
|
4971
4971
|
maximumWidth: t,
|
|
4972
4972
|
isWidthValid: e
|
|
@@ -4979,21 +4979,21 @@ function tr({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalS
|
|
|
4979
4979
|
candidateWidth: t,
|
|
4980
4980
|
candidateHeight: r,
|
|
4981
4981
|
layoutResolution: o
|
|
4982
|
-
}) || n !== void 0 && a < n - q ? !1 : !
|
|
4982
|
+
}) || n !== void 0 && a < n - q ? !1 : !jn({
|
|
4983
4983
|
text: e,
|
|
4984
4984
|
frameWidth: a,
|
|
4985
4985
|
wrapPolicy: i
|
|
4986
4986
|
}).hasWrappedLines;
|
|
4987
|
-
}, v = p ? Math.max(d, p) :
|
|
4987
|
+
}, v = p ? Math.max(d, p) : fr({
|
|
4988
4988
|
minimumWidth: d,
|
|
4989
4989
|
isWidthValid: ({ width: e }) => _({ width: e })
|
|
4990
|
-
}), y = h({ width: v }), b =
|
|
4990
|
+
}), y = h({ width: v }), b = jn({
|
|
4991
4991
|
text: e,
|
|
4992
4992
|
frameWidth: y.frameWidth,
|
|
4993
4993
|
wrapPolicy: i
|
|
4994
4994
|
});
|
|
4995
4995
|
if (b.hasWrappedLines) return y.layoutResolution;
|
|
4996
|
-
let x = Math.max(K, b.longestLineWidth), { layoutResolution: S } = h({ width:
|
|
4996
|
+
let x = Math.max(K, b.longestLineWidth), { layoutResolution: S } = h({ width: pr({
|
|
4997
4997
|
minimumWidth: d,
|
|
4998
4998
|
maximumWidth: v,
|
|
4999
4999
|
isWidthValid: ({ width: e }) => _({
|
|
@@ -5003,73 +5003,73 @@ function tr({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalS
|
|
|
5003
5003
|
}) });
|
|
5004
5004
|
return S;
|
|
5005
5005
|
}
|
|
5006
|
-
var
|
|
5006
|
+
var rr = ({ text: e, currentWidth: t, minimumWidth: n, padding: r, wrapPolicy: i, montageAreaWidth: a, resolvePaddingForWidth: o }) => {
|
|
5007
5007
|
let s = Math.max(K, t), c = Math.max(K, n);
|
|
5008
|
-
if (!
|
|
5008
|
+
if (!sr({ text: e })) return c;
|
|
5009
5009
|
let l = Math.max(c, Number.isFinite(a) && a > 0 ? Math.max(K, a) : Math.max(s, c)), u = yn({
|
|
5010
5010
|
width: l,
|
|
5011
|
-
padding:
|
|
5011
|
+
padding: cr({
|
|
5012
5012
|
width: l,
|
|
5013
5013
|
padding: r,
|
|
5014
5014
|
resolvePaddingForWidth: o
|
|
5015
5015
|
})
|
|
5016
|
-
}), d = l, f =
|
|
5016
|
+
}), d = l, f = jn({
|
|
5017
5017
|
text: e,
|
|
5018
5018
|
frameWidth: u,
|
|
5019
5019
|
wrapPolicy: i
|
|
5020
5020
|
});
|
|
5021
5021
|
if (f.hasWrappedLines) return d;
|
|
5022
5022
|
let p = Math.max(K, f.longestLineWidth);
|
|
5023
|
-
return
|
|
5023
|
+
return pr({
|
|
5024
5024
|
minimumWidth: c,
|
|
5025
5025
|
maximumWidth: d,
|
|
5026
5026
|
isWidthValid: ({ width: t }) => {
|
|
5027
5027
|
let n = yn({
|
|
5028
5028
|
width: t,
|
|
5029
|
-
padding:
|
|
5029
|
+
padding: cr({
|
|
5030
5030
|
width: t,
|
|
5031
5031
|
padding: r,
|
|
5032
5032
|
resolvePaddingForWidth: o
|
|
5033
5033
|
})
|
|
5034
5034
|
});
|
|
5035
|
-
return n < p - q ? !1 : !
|
|
5035
|
+
return n < p - q ? !1 : !jn({
|
|
5036
5036
|
text: e,
|
|
5037
5037
|
frameWidth: n,
|
|
5038
5038
|
wrapPolicy: i
|
|
5039
5039
|
}).hasWrappedLines;
|
|
5040
5040
|
}
|
|
5041
5041
|
});
|
|
5042
|
-
},
|
|
5043
|
-
if (!
|
|
5044
|
-
let i =
|
|
5042
|
+
}, ir = ({ text: e, padding: t, resolvePaddingForWidth: n, measurementCache: r }) => {
|
|
5043
|
+
if (!sr({ text: e })) return K;
|
|
5044
|
+
let i = Nn({
|
|
5045
5045
|
text: e,
|
|
5046
5046
|
measurementCache: r
|
|
5047
5047
|
}), a = Math.max(K, i), o = ({ width: e }) => yn({
|
|
5048
5048
|
width: e,
|
|
5049
|
-
padding:
|
|
5049
|
+
padding: cr({
|
|
5050
5050
|
width: e,
|
|
5051
5051
|
padding: t,
|
|
5052
5052
|
resolvePaddingForWidth: n
|
|
5053
5053
|
})
|
|
5054
5054
|
}) >= i - q;
|
|
5055
|
-
return
|
|
5055
|
+
return pr({
|
|
5056
5056
|
minimumWidth: a,
|
|
5057
|
-
maximumWidth:
|
|
5057
|
+
maximumWidth: fr({
|
|
5058
5058
|
minimumWidth: a,
|
|
5059
5059
|
isWidthValid: o
|
|
5060
5060
|
}),
|
|
5061
5061
|
isWidthValid: o
|
|
5062
5062
|
});
|
|
5063
|
-
},
|
|
5064
|
-
let o =
|
|
5063
|
+
}, ar = ({ text: e, width: t, height: n, alignV: r, wrapPolicy: i, padding: a }) => {
|
|
5064
|
+
let o = mr({
|
|
5065
5065
|
width: Math.max(K, t),
|
|
5066
5066
|
height: Math.max(K, n),
|
|
5067
5067
|
padding: V({ padding: a })
|
|
5068
|
-
}), s =
|
|
5068
|
+
}), s = Fn({
|
|
5069
5069
|
text: e,
|
|
5070
5070
|
frameWidth: o.width,
|
|
5071
5071
|
wrapPolicy: i
|
|
5072
|
-
}), c =
|
|
5072
|
+
}), c = Mn({
|
|
5073
5073
|
text: e,
|
|
5074
5074
|
frameWidth: o.width,
|
|
5075
5075
|
splitByGrapheme: s,
|
|
@@ -5078,24 +5078,24 @@ var nr = ({ text: e, currentWidth: t, minimumWidth: n, padding: r, wrapPolicy: i
|
|
|
5078
5078
|
return {
|
|
5079
5079
|
frame: o,
|
|
5080
5080
|
splitByGrapheme: s,
|
|
5081
|
-
textTop:
|
|
5081
|
+
textTop: Pn({
|
|
5082
5082
|
alignV: r,
|
|
5083
5083
|
frameHeight: o.height,
|
|
5084
5084
|
frameTop: o.top,
|
|
5085
5085
|
textHeight: c
|
|
5086
5086
|
})
|
|
5087
5087
|
};
|
|
5088
|
-
},
|
|
5088
|
+
}, or = ({ text: e, width: t, height: n, padding: r, wrapPolicy: i, resolvePaddingForSize: a, measurementCache: o }) => {
|
|
5089
5089
|
let s = Math.max(K, n);
|
|
5090
|
-
if (!
|
|
5090
|
+
if (!sr({ text: e })) return s;
|
|
5091
5091
|
let c = Math.max(K, t), l = s;
|
|
5092
|
-
for (let t = 0; t <
|
|
5093
|
-
let t =
|
|
5092
|
+
for (let t = 0; t < qn; t += 1) {
|
|
5093
|
+
let t = lr({
|
|
5094
5094
|
width: c,
|
|
5095
5095
|
height: l,
|
|
5096
5096
|
padding: r,
|
|
5097
5097
|
resolvePaddingForSize: a
|
|
5098
|
-
}), n =
|
|
5098
|
+
}), n = Mn({
|
|
5099
5099
|
text: e,
|
|
5100
5100
|
frameWidth: yn({
|
|
5101
5101
|
width: c,
|
|
@@ -5109,26 +5109,26 @@ var nr = ({ text: e, currentWidth: t, minimumWidth: n, padding: r, wrapPolicy: i
|
|
|
5109
5109
|
}
|
|
5110
5110
|
return l;
|
|
5111
5111
|
};
|
|
5112
|
-
function
|
|
5112
|
+
function sr({ text: e }) {
|
|
5113
5113
|
return (e.text ?? "").trim().length > 0;
|
|
5114
5114
|
}
|
|
5115
|
-
function
|
|
5115
|
+
function cr({ width: e, padding: t, resolvePaddingForWidth: n }) {
|
|
5116
5116
|
return V(n ? { padding: n({ width: Math.max(K, e) }) } : { padding: t });
|
|
5117
5117
|
}
|
|
5118
|
-
function
|
|
5118
|
+
function lr({ width: e, height: t, padding: n, resolvePaddingForSize: r }) {
|
|
5119
5119
|
return V(r ? { padding: r({
|
|
5120
5120
|
width: Math.max(K, e),
|
|
5121
5121
|
height: Math.max(K, t)
|
|
5122
5122
|
}) } : { padding: n });
|
|
5123
5123
|
}
|
|
5124
|
-
function
|
|
5124
|
+
function ur({ width: e, height: t, internalShapeTextInset: n, resolveInternalShapeTextInset: r }) {
|
|
5125
5125
|
return V(r ? { padding: r({
|
|
5126
5126
|
width: Math.max(K, e),
|
|
5127
5127
|
height: Math.max(K, t)
|
|
5128
5128
|
}) } : { padding: n });
|
|
5129
5129
|
}
|
|
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 }) =>
|
|
5130
|
+
function dr({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalShapeTextInset: a, resolveInternalShapeTextInset: o, expandShapeHeightToFitText: s = !0, changedPadding: c }) {
|
|
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 }) => Mn({
|
|
5132
5132
|
text: e,
|
|
5133
5133
|
frameWidth: t,
|
|
5134
5134
|
wrapPolicy: i
|
|
@@ -5137,7 +5137,7 @@ function ur({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalS
|
|
|
5137
5137
|
width: d,
|
|
5138
5138
|
height: f,
|
|
5139
5139
|
padding: l,
|
|
5140
|
-
internalShapeTextInset:
|
|
5140
|
+
internalShapeTextInset: ur({
|
|
5141
5141
|
width: d,
|
|
5142
5142
|
height: f,
|
|
5143
5143
|
internalShapeTextInset: u,
|
|
@@ -5146,9 +5146,9 @@ function ur({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalS
|
|
|
5146
5146
|
expandShapeHeightToFitText: s,
|
|
5147
5147
|
changedPadding: c,
|
|
5148
5148
|
measureTextboxHeightForFrame: p,
|
|
5149
|
-
resolveMinimumTextFrameWidth:
|
|
5149
|
+
resolveMinimumTextFrameWidth: Nn
|
|
5150
5150
|
});
|
|
5151
|
-
for (let t = 0; t <
|
|
5151
|
+
for (let t = 0; t < qn; t += 1) {
|
|
5152
5152
|
let t = Math.max(d, m.requiredWidth), n = Math.max(f, m.requiredHeight);
|
|
5153
5153
|
if (t <= d + q && n <= f + q) break;
|
|
5154
5154
|
d = t, f = n, m = En({
|
|
@@ -5156,7 +5156,7 @@ function ur({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalS
|
|
|
5156
5156
|
width: d,
|
|
5157
5157
|
height: f,
|
|
5158
5158
|
padding: l,
|
|
5159
|
-
internalShapeTextInset:
|
|
5159
|
+
internalShapeTextInset: ur({
|
|
5160
5160
|
width: d,
|
|
5161
5161
|
height: f,
|
|
5162
5162
|
internalShapeTextInset: u,
|
|
@@ -5165,7 +5165,7 @@ function ur({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalS
|
|
|
5165
5165
|
expandShapeHeightToFitText: s,
|
|
5166
5166
|
changedPadding: c,
|
|
5167
5167
|
measureTextboxHeightForFrame: p,
|
|
5168
|
-
resolveMinimumTextFrameWidth:
|
|
5168
|
+
resolveMinimumTextFrameWidth: Nn
|
|
5169
5169
|
});
|
|
5170
5170
|
}
|
|
5171
5171
|
return {
|
|
@@ -5175,17 +5175,17 @@ function ur({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalS
|
|
|
5175
5175
|
appliedUserPadding: m.appliedUserPadding
|
|
5176
5176
|
};
|
|
5177
5177
|
}
|
|
5178
|
-
function
|
|
5178
|
+
function fr({ minimumWidth: e, isWidthValid: t }) {
|
|
5179
5179
|
let n = Math.max(K, e);
|
|
5180
5180
|
if (t({ width: n })) return n;
|
|
5181
|
-
for (let e = 0; e <
|
|
5181
|
+
for (let e = 0; e < Yn; e += 1) if (n = Math.max(n + 1, n * 2), t({ width: n })) return n;
|
|
5182
5182
|
return n;
|
|
5183
5183
|
}
|
|
5184
|
-
function
|
|
5184
|
+
function pr({ minimumWidth: e, maximumWidth: t, isWidthValid: n }) {
|
|
5185
5185
|
let r = Math.max(K, e), i = Math.max(r, t);
|
|
5186
5186
|
if (n({ width: r })) return r;
|
|
5187
5187
|
if (!n({ width: i })) return i;
|
|
5188
|
-
for (let e = 0; e <
|
|
5188
|
+
for (let e = 0; e < Jn && !(i - r <= q); e += 1) {
|
|
5189
5189
|
let e = r + (i - r) / 2;
|
|
5190
5190
|
if (n({ width: e })) {
|
|
5191
5191
|
i = e;
|
|
@@ -5195,7 +5195,7 @@ function fr({ minimumWidth: e, maximumWidth: t, isWidthValid: n }) {
|
|
|
5195
5195
|
}
|
|
5196
5196
|
return i;
|
|
5197
5197
|
}
|
|
5198
|
-
function
|
|
5198
|
+
function mr({ width: e, height: t, padding: n }) {
|
|
5199
5199
|
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
5200
|
return {
|
|
5201
5201
|
left: -e / 2 + r,
|
|
@@ -5206,7 +5206,7 @@ function pr({ width: e, height: t, padding: n }) {
|
|
|
5206
5206
|
}
|
|
5207
5207
|
//#endregion
|
|
5208
5208
|
//#region src/editor/shape-manager/domain/shape-nodes.ts
|
|
5209
|
-
var
|
|
5209
|
+
var hr = ({ group: e }) => {
|
|
5210
5210
|
let t = e.getObjects();
|
|
5211
5211
|
for (let e = 0; e < t.length; e += 1) {
|
|
5212
5212
|
let n = t[e];
|
|
@@ -5217,7 +5217,7 @@ var mr = ({ group: e }) => {
|
|
|
5217
5217
|
if (!(n instanceof v)) return n;
|
|
5218
5218
|
}
|
|
5219
5219
|
return null;
|
|
5220
|
-
},
|
|
5220
|
+
}, gr = ({ group: e }) => {
|
|
5221
5221
|
let t = e.getObjects();
|
|
5222
5222
|
for (let e = 0; e < t.length; e += 1) {
|
|
5223
5223
|
let n = t[e];
|
|
@@ -5229,14 +5229,14 @@ var mr = ({ group: e }) => {
|
|
|
5229
5229
|
}
|
|
5230
5230
|
return null;
|
|
5231
5231
|
}, J = ({ group: e }) => ({
|
|
5232
|
-
shape:
|
|
5233
|
-
text:
|
|
5234
|
-
}),
|
|
5232
|
+
shape: hr({ group: e }),
|
|
5233
|
+
text: gr({ group: e })
|
|
5234
|
+
}), _r = ({ transform: e, key: t }) => {
|
|
5235
5235
|
let n = e?.original;
|
|
5236
5236
|
if (!n || typeof n != "object") return null;
|
|
5237
5237
|
let r = n[t];
|
|
5238
5238
|
return typeof r != "number" || !Number.isFinite(r) ? null : r;
|
|
5239
|
-
},
|
|
5239
|
+
}, vr = ({ value: e }) => e === "left" || e === "center" || e === "right" || typeof e == "number" && Number.isFinite(e) ? e : null, yr = ({ value: e }) => e === "top" || e === "center" || e === "bottom" || typeof e == "number" && Number.isFinite(e) ? e : null, Y = ({ transform: e }) => {
|
|
5240
5240
|
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
5241
|
return {
|
|
5242
5242
|
canScaleWidth: o,
|
|
@@ -5244,37 +5244,37 @@ var mr = ({ group: e }) => {
|
|
|
5244
5244
|
isCornerScaleAction: r,
|
|
5245
5245
|
isVerticalOnlyScale: s && !o
|
|
5246
5246
|
};
|
|
5247
|
-
},
|
|
5247
|
+
}, br = ({ event: e, target: t, transform: n, canvas: r }) => {
|
|
5248
5248
|
if (!e) return null;
|
|
5249
5249
|
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
5250
|
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
|
-
},
|
|
5251
|
+
}, xr = ({ group: e, originX: t, originY: n }) => {
|
|
5252
5252
|
if (t === null || n === null) return null;
|
|
5253
5253
|
let r = e, i = typeof r.getRelativeCenterPoint == "function" ? r.getRelativeCenterPoint() : e.getCenterPoint();
|
|
5254
5254
|
return typeof r.translateToOriginPoint == "function" ? r.translateToOriginPoint(i, t, n) : i;
|
|
5255
|
-
},
|
|
5255
|
+
}, Sr = ({ state: e, transform: t }) => {
|
|
5256
5256
|
if (!t || e.startTransformOriginX === null && e.startTransformOriginY === null) return !1;
|
|
5257
|
-
let n =
|
|
5257
|
+
let n = vr({ value: t.originX }), r = yr({ value: t.originY });
|
|
5258
5258
|
return n !== e.startTransformOriginX || r !== e.startTransformOriginY;
|
|
5259
|
-
},
|
|
5259
|
+
}, Cr = ({ state: e, transform: t }) => !t || !e.startTransformCorner ? !1 : t.corner !== e.startTransformCorner;
|
|
5260
5260
|
//#endregion
|
|
5261
5261
|
//#region src/editor/shape-manager/scaling/shape-scaling-preview.ts
|
|
5262
|
-
function
|
|
5262
|
+
function wr({ size: e, scale: t, strokeWidth: n, minSize: r, scaleEpsilon: i }) {
|
|
5263
5263
|
let a = Math.max(i, Math.abs(t) || 1), o = Math.max(0, n);
|
|
5264
5264
|
return o <= 0 ? Math.max(r, e / a) : Math.max(r, e / a + o - o / a);
|
|
5265
5265
|
}
|
|
5266
|
-
function
|
|
5266
|
+
function Tr({ group: e, shape: t, width: n, height: r, scaleX: i, scaleY: a, minSize: o, scaleEpsilon: s }) {
|
|
5267
5267
|
let c = Math.max(0, e.shapeStrokeWidth ?? 0);
|
|
5268
5268
|
Zt({
|
|
5269
5269
|
shape: t,
|
|
5270
|
-
width:
|
|
5270
|
+
width: wr({
|
|
5271
5271
|
size: n,
|
|
5272
5272
|
scale: i,
|
|
5273
5273
|
strokeWidth: c,
|
|
5274
5274
|
minSize: o,
|
|
5275
5275
|
scaleEpsilon: s
|
|
5276
5276
|
}),
|
|
5277
|
-
height:
|
|
5277
|
+
height: wr({
|
|
5278
5278
|
size: r,
|
|
5279
5279
|
scale: a,
|
|
5280
5280
|
strokeWidth: c,
|
|
@@ -5285,7 +5285,7 @@ function wr({ group: e, shape: t, width: n, height: r, scaleX: i, scaleY: a, min
|
|
|
5285
5285
|
strokeWidth: c
|
|
5286
5286
|
});
|
|
5287
5287
|
}
|
|
5288
|
-
function
|
|
5288
|
+
function Er({ text: e, layout: t, alignH: n, scaleX: r, scaleY: i, scaleEpsilon: a }) {
|
|
5289
5289
|
let o = Math.max(a, Math.abs(r) || 1), s = Math.max(a, Math.abs(i) || 1), c = n ?? "center";
|
|
5290
5290
|
e.set({
|
|
5291
5291
|
autoExpand: !1,
|
|
@@ -5300,13 +5300,13 @@ function Tr({ text: e, layout: t, alignH: n, scaleX: r, scaleY: i, scaleEpsilon:
|
|
|
5300
5300
|
scaleY: 1 / s
|
|
5301
5301
|
}), e.initDimensions(), e.setCoords();
|
|
5302
5302
|
}
|
|
5303
|
-
var
|
|
5303
|
+
var Dr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY: o, minSize: s, scaleEpsilon: c }) => {
|
|
5304
5304
|
let l = Math.max(c, Math.abs(a) || 1), u = Math.max(c, Math.abs(o) || 1);
|
|
5305
5305
|
e.set({
|
|
5306
5306
|
width: r.width / l,
|
|
5307
5307
|
height: r.height / u,
|
|
5308
5308
|
dirty: !0
|
|
5309
|
-
}),
|
|
5309
|
+
}), Tr({
|
|
5310
5310
|
group: e,
|
|
5311
5311
|
shape: t,
|
|
5312
5312
|
width: r.width,
|
|
@@ -5315,7 +5315,7 @@ var Er = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
5315
5315
|
scaleY: o,
|
|
5316
5316
|
minSize: s,
|
|
5317
5317
|
scaleEpsilon: c
|
|
5318
|
-
}),
|
|
5318
|
+
}), Er({
|
|
5319
5319
|
text: n,
|
|
5320
5320
|
layout: r,
|
|
5321
5321
|
alignH: i,
|
|
@@ -5323,23 +5323,23 @@ var Er = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
5323
5323
|
scaleY: o,
|
|
5324
5324
|
scaleEpsilon: c
|
|
5325
5325
|
});
|
|
5326
|
-
}, X = 1e-4,
|
|
5327
|
-
function
|
|
5326
|
+
}, X = 1e-4, Or = .5;
|
|
5327
|
+
function kr({ isProportionalScaling: e }) {
|
|
5328
5328
|
if (e) return "words-only";
|
|
5329
5329
|
}
|
|
5330
|
-
function
|
|
5330
|
+
function Ar({ width: e, height: t }) {
|
|
5331
5331
|
return `${Math.round(Math.max(1, e) * 1e6) / 1e6}:${Math.round(Math.max(1, t) * 1e6) / 1e6}`;
|
|
5332
5332
|
}
|
|
5333
|
-
function
|
|
5333
|
+
function jr({ width: e, padding: t }) {
|
|
5334
5334
|
return Math.max(1, e - Math.max(0, t.left) - Math.max(0, t.right));
|
|
5335
5335
|
}
|
|
5336
|
-
function
|
|
5336
|
+
function Mr({ height: e, padding: t }) {
|
|
5337
5337
|
return Math.max(1, e - Math.max(0, t.top) - Math.max(0, t.bottom));
|
|
5338
5338
|
}
|
|
5339
|
-
function
|
|
5339
|
+
function Nr({ text: e }) {
|
|
5340
5340
|
return (e.text ?? "").trim().length > 0;
|
|
5341
5341
|
}
|
|
5342
|
-
function
|
|
5342
|
+
function Pr({ height: e }) {
|
|
5343
5343
|
return {
|
|
5344
5344
|
measuredHeight: e,
|
|
5345
5345
|
renderedLineCount: 0,
|
|
@@ -5348,7 +5348,7 @@ function Nr({ height: e }) {
|
|
|
5348
5348
|
isValid: !0
|
|
5349
5349
|
};
|
|
5350
5350
|
}
|
|
5351
|
-
function
|
|
5351
|
+
function Fr({ group: e }) {
|
|
5352
5352
|
return Ne({ padding: {
|
|
5353
5353
|
top: e.shapePaddingTop,
|
|
5354
5354
|
right: e.shapePaddingRight,
|
|
@@ -5356,7 +5356,7 @@ function Pr({ group: e }) {
|
|
|
5356
5356
|
left: e.shapePaddingLeft
|
|
5357
5357
|
} });
|
|
5358
5358
|
}
|
|
5359
|
-
function
|
|
5359
|
+
function Ir({ group: e, width: t, height: n }) {
|
|
5360
5360
|
let r = e.shapePresetKey ?? "", i = r ? we({ presetKey: r }) : null;
|
|
5361
5361
|
return Le({
|
|
5362
5362
|
baseInset: i ? De({
|
|
@@ -5369,33 +5369,33 @@ function Fr({ group: e, width: t, height: n }) {
|
|
|
5369
5369
|
});
|
|
5370
5370
|
}
|
|
5371
5371
|
function Z({ group: e, width: t, height: n }) {
|
|
5372
|
-
return
|
|
5372
|
+
return Ir({
|
|
5373
5373
|
group: e,
|
|
5374
5374
|
width: Math.max(1, t ?? e.shapeBaseWidth ?? e.width ?? e.shapeManualBaseWidth ?? 1),
|
|
5375
5375
|
height: Math.max(1, n ?? e.shapeBaseHeight ?? e.height ?? e.shapeManualBaseHeight ?? 1)
|
|
5376
5376
|
});
|
|
5377
5377
|
}
|
|
5378
|
-
function
|
|
5379
|
-
let o = Math.max(1, n), s = Math.max(1, r), c =
|
|
5378
|
+
function Lr({ group: e, text: t, width: n, height: r, measurementCache: i, constraintCache: a }) {
|
|
5379
|
+
let o = Math.max(1, n), s = Math.max(1, r), c = Ar({
|
|
5380
5380
|
width: o,
|
|
5381
5381
|
height: s
|
|
5382
5382
|
}), l = a?.get(c);
|
|
5383
5383
|
if (l) return l;
|
|
5384
|
-
if (!
|
|
5385
|
-
let e =
|
|
5384
|
+
if (!Nr({ text: t })) {
|
|
5385
|
+
let e = Pr({ height: s });
|
|
5386
5386
|
return a?.set(c, e), e;
|
|
5387
5387
|
}
|
|
5388
5388
|
let u = Z({
|
|
5389
5389
|
group: e,
|
|
5390
5390
|
width: o,
|
|
5391
5391
|
height: s
|
|
5392
|
-
}), d =
|
|
5392
|
+
}), d = jr({
|
|
5393
5393
|
width: o,
|
|
5394
5394
|
padding: u
|
|
5395
|
-
}), f =
|
|
5395
|
+
}), f = Mr({
|
|
5396
5396
|
height: s,
|
|
5397
5397
|
padding: u
|
|
5398
|
-
}), p =
|
|
5398
|
+
}), p = An({
|
|
5399
5399
|
text: t,
|
|
5400
5400
|
frameWidth: d,
|
|
5401
5401
|
splitByGrapheme: !1,
|
|
@@ -5406,9 +5406,9 @@ function Ir({ group: e, text: t, width: n, height: r, measurementCache: i, const
|
|
|
5406
5406
|
};
|
|
5407
5407
|
return a?.set(c, m), m;
|
|
5408
5408
|
}
|
|
5409
|
-
function
|
|
5409
|
+
function Rr({ group: e, text: t, state: n }) {
|
|
5410
5410
|
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 =
|
|
5411
|
+
let o = Lr({
|
|
5412
5412
|
group: e,
|
|
5413
5413
|
text: t,
|
|
5414
5414
|
width: Math.max(1, i * a),
|
|
@@ -5439,8 +5439,8 @@ function Lr({ group: e, text: t, state: n }) {
|
|
|
5439
5439
|
minimumHeight: g
|
|
5440
5440
|
};
|
|
5441
5441
|
}
|
|
5442
|
-
function
|
|
5443
|
-
return
|
|
5442
|
+
function zr({ group: e, text: t, width: n, padding: r, wrapPolicy: i, measurementCache: a }) {
|
|
5443
|
+
return or({
|
|
5444
5444
|
text: t,
|
|
5445
5445
|
width: n,
|
|
5446
5446
|
height: 1,
|
|
@@ -5454,8 +5454,8 @@ function Rr({ group: e, text: t, width: n, padding: r, wrapPolicy: i, measuremen
|
|
|
5454
5454
|
})
|
|
5455
5455
|
});
|
|
5456
5456
|
}
|
|
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 ??
|
|
5457
|
+
function Br({ group: e, text: t, constraintPadding: n, startDimensions: r, appliedScaleX: i, appliedScaleY: a, minimumHeight: o, wrapPolicy: s, measurementCache: c }) {
|
|
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 ?? or({
|
|
5459
5459
|
text: t,
|
|
5460
5460
|
width: l,
|
|
5461
5461
|
height: u,
|
|
@@ -5473,25 +5473,25 @@ function zr({ group: e, text: t, constraintPadding: n, startDimensions: r, appli
|
|
|
5473
5473
|
previewHeight: Math.max(u, d)
|
|
5474
5474
|
};
|
|
5475
5475
|
}
|
|
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
|
|
5476
|
+
function Vr({ group: e, text: t, state: n, appliedScaleX: r, appliedScaleY: i, minimumHeight: a }) {
|
|
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 = kr({ isProportionalScaling: n.isProportionalScaling });
|
|
5478
|
+
return Qn({
|
|
5479
5479
|
text: t,
|
|
5480
5480
|
width: o,
|
|
5481
5481
|
height: c,
|
|
5482
5482
|
alignV: e.shapeAlignVertical ?? "middle",
|
|
5483
|
-
padding:
|
|
5483
|
+
padding: Fr({ group: e }),
|
|
5484
5484
|
wrapPolicy: u,
|
|
5485
5485
|
expandShapeHeightToFitText: l,
|
|
5486
5486
|
measurementCache: n.previewTextMeasurementCache ?? void 0,
|
|
5487
|
-
resolveInternalShapeTextInset: ({ width: t, height: n }) =>
|
|
5487
|
+
resolveInternalShapeTextInset: ({ width: t, height: n }) => Ir({
|
|
5488
5488
|
group: e,
|
|
5489
5489
|
width: t,
|
|
5490
5490
|
height: n
|
|
5491
5491
|
})
|
|
5492
5492
|
});
|
|
5493
5493
|
}
|
|
5494
|
-
function
|
|
5494
|
+
function Hr({ group: e, transform: t }) {
|
|
5495
5495
|
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
5496
|
return {
|
|
5497
5497
|
startWidth: i,
|
|
@@ -5502,25 +5502,25 @@ function Vr({ group: e, transform: t }) {
|
|
|
5502
5502
|
canScaleHeight: r
|
|
5503
5503
|
};
|
|
5504
5504
|
}
|
|
5505
|
-
function
|
|
5505
|
+
function Ur({ scalingState: e, group: t, text: n, constraintPadding: r, transform: i }) {
|
|
5506
5506
|
let a = e.get(t);
|
|
5507
5507
|
if (a) return a;
|
|
5508
|
-
let o =
|
|
5508
|
+
let o = Hr({
|
|
5509
5509
|
group: t,
|
|
5510
5510
|
transform: i
|
|
5511
|
-
}), s =
|
|
5511
|
+
}), s = _r({
|
|
5512
5512
|
transform: i,
|
|
5513
5513
|
key: "scaleX"
|
|
5514
|
-
}), c =
|
|
5514
|
+
}), c = _r({
|
|
5515
5515
|
transform: i,
|
|
5516
5516
|
key: "scaleY"
|
|
5517
|
-
}), l =
|
|
5517
|
+
}), l = _r({
|
|
5518
5518
|
transform: i,
|
|
5519
5519
|
key: "left"
|
|
5520
|
-
}), u =
|
|
5520
|
+
}), u = _r({
|
|
5521
5521
|
transform: i,
|
|
5522
5522
|
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 =
|
|
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 = vr({ value: i?.original?.originX ?? i?.originX }), g = yr({ value: i?.original?.originY ?? i?.originY }), _ = typeof i?.corner == "string" ? i.corner : null, v = xr({
|
|
5524
5524
|
group: t,
|
|
5525
5525
|
originX: h,
|
|
5526
5526
|
originY: g
|
|
@@ -5528,7 +5528,7 @@ function Hr({ scalingState: e, group: t, text: n, constraintPadding: r, transfor
|
|
|
5528
5528
|
measurementsByKey: /* @__PURE__ */ new Map(),
|
|
5529
5529
|
splitByGraphemeByFrameWidth: /* @__PURE__ */ new Map(),
|
|
5530
5530
|
minimumTextFrameWidth: null
|
|
5531
|
-
}, x = /* @__PURE__ */ new Map(), S =
|
|
5531
|
+
}, x = /* @__PURE__ */ new Map(), S = zr({
|
|
5532
5532
|
group: t,
|
|
5533
5533
|
text: n,
|
|
5534
5534
|
width: o.startWidth,
|
|
@@ -5570,8 +5570,8 @@ function Hr({ scalingState: e, group: t, text: n, constraintPadding: r, transfor
|
|
|
5570
5570
|
proportionalTextConstraintCache: x
|
|
5571
5571
|
}, e.set(t, a), a;
|
|
5572
5572
|
}
|
|
5573
|
-
function
|
|
5574
|
-
let { previewWidth: s, previewHeight: c } =
|
|
5573
|
+
function Wr({ group: e, text: t, constraintPadding: n, startDimensions: r, scaleX: i, scaleY: a, wrapPolicy: o }) {
|
|
5574
|
+
let { previewWidth: s, previewHeight: c } = Br({
|
|
5575
5575
|
group: e,
|
|
5576
5576
|
text: t,
|
|
5577
5577
|
constraintPadding: n,
|
|
@@ -5579,7 +5579,7 @@ function Ur({ group: e, text: t, constraintPadding: n, startDimensions: r, scale
|
|
|
5579
5579
|
appliedScaleX: i,
|
|
5580
5580
|
appliedScaleY: a,
|
|
5581
5581
|
wrapPolicy: o
|
|
5582
|
-
}), { startWidth: l, startHeight: u } = r, d = Math.abs(s - l) >
|
|
5582
|
+
}), { startWidth: l, startHeight: u } = r, d = Math.abs(s - l) > Or, f = Math.abs(c - u) > Or;
|
|
5583
5583
|
return {
|
|
5584
5584
|
width: s,
|
|
5585
5585
|
height: c,
|
|
@@ -5587,7 +5587,7 @@ function Ur({ group: e, text: t, constraintPadding: n, startDimensions: r, scale
|
|
|
5587
5587
|
hasDimensionChange: d || f
|
|
5588
5588
|
};
|
|
5589
5589
|
}
|
|
5590
|
-
function
|
|
5590
|
+
function Gr({ startManualBaseWidth: e, startManualBaseHeight: t, canScaleWidth: n, canScaleHeight: r, finalWidth: i, finalHeight: a }) {
|
|
5591
5591
|
let o = e;
|
|
5592
5592
|
n && (o = i);
|
|
5593
5593
|
let s = t;
|
|
@@ -5596,8 +5596,8 @@ function Wr({ startManualBaseWidth: e, startManualBaseHeight: t, canScaleWidth:
|
|
|
5596
5596
|
height: s
|
|
5597
5597
|
};
|
|
5598
5598
|
}
|
|
5599
|
-
function
|
|
5600
|
-
let p =
|
|
5599
|
+
function Kr({ 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 }) {
|
|
5600
|
+
let p = Gr({
|
|
5601
5601
|
startManualBaseWidth: s,
|
|
5602
5602
|
startManualBaseHeight: c,
|
|
5603
5603
|
canScaleWidth: l,
|
|
@@ -5606,16 +5606,16 @@ function Gr({ group: e, shape: t, text: n, width: r, height: i, alignH: a, align
|
|
|
5606
5606
|
finalHeight: i
|
|
5607
5607
|
});
|
|
5608
5608
|
e.shapeManualBaseWidth = p.width, e.shapeManualBaseHeight = p.height, l && d && (e.shapeTextAutoExpand = !1);
|
|
5609
|
-
let m =
|
|
5609
|
+
let m = Fr({ group: e }), h = Ir({
|
|
5610
5610
|
group: e,
|
|
5611
5611
|
width: r,
|
|
5612
5612
|
height: i
|
|
5613
|
-
}), g = !u, _ = ({ width: t, height: n }) =>
|
|
5613
|
+
}), g = !u, _ = ({ width: t, height: n }) => Ir({
|
|
5614
5614
|
group: e,
|
|
5615
5615
|
width: t,
|
|
5616
5616
|
height: n
|
|
5617
5617
|
});
|
|
5618
|
-
!l && u ?
|
|
5618
|
+
!l && u ? tr({
|
|
5619
5619
|
group: e,
|
|
5620
5620
|
shape: t,
|
|
5621
5621
|
text: n,
|
|
@@ -5628,7 +5628,7 @@ function Gr({ group: e, shape: t, text: n, width: r, height: i, alignH: a, align
|
|
|
5628
5628
|
internalShapeTextInset: h,
|
|
5629
5629
|
expandShapeHeightToFitText: g,
|
|
5630
5630
|
resolveInternalShapeTextInset: _
|
|
5631
|
-
}) :
|
|
5631
|
+
}) : er({
|
|
5632
5632
|
group: e,
|
|
5633
5633
|
shape: t,
|
|
5634
5634
|
text: n,
|
|
@@ -5652,7 +5652,7 @@ function Gr({ group: e, shape: t, text: n, width: r, height: i, alignH: a, align
|
|
|
5652
5652
|
}
|
|
5653
5653
|
//#endregion
|
|
5654
5654
|
//#region src/editor/shape-manager/scaling/active-selection-scaling-controller.ts
|
|
5655
|
-
var
|
|
5655
|
+
var qr = class {
|
|
5656
5656
|
constructor({ canvas: e, shapeScalingState: t }) {
|
|
5657
5657
|
this.canvas = e, this.shapeScalingState = t, this.scalingState = /* @__PURE__ */ new WeakMap(), this.scalingSessions = /* @__PURE__ */ new WeakMap(), this.groupLayoutScales = /* @__PURE__ */ new WeakMap();
|
|
5658
5658
|
}
|
|
@@ -5704,21 +5704,21 @@ var Kr = class {
|
|
|
5704
5704
|
} else c = this._resolveShapeLayoutScale({
|
|
5705
5705
|
item: e,
|
|
5706
5706
|
selectionScale: p
|
|
5707
|
-
}), u =
|
|
5707
|
+
}), u = Br({
|
|
5708
5708
|
group: t,
|
|
5709
5709
|
text: r,
|
|
5710
5710
|
constraintPadding: i,
|
|
5711
5711
|
startDimensions: a,
|
|
5712
5712
|
appliedScaleX: c.scaleX,
|
|
5713
5713
|
appliedScaleY: c.scaleY,
|
|
5714
|
-
wrapPolicy:
|
|
5714
|
+
wrapPolicy: kr({ isProportionalScaling: a.isProportionalScaling }),
|
|
5715
5715
|
measurementCache: a.previewTextMeasurementCache
|
|
5716
5716
|
}).previewHeight;
|
|
5717
|
-
|
|
5717
|
+
Dr({
|
|
5718
5718
|
group: t,
|
|
5719
5719
|
shape: n,
|
|
5720
5720
|
text: r,
|
|
5721
|
-
layout:
|
|
5721
|
+
layout: Vr({
|
|
5722
5722
|
group: t,
|
|
5723
5723
|
text: r,
|
|
5724
5724
|
state: a,
|
|
@@ -5741,13 +5741,13 @@ var Kr = class {
|
|
|
5741
5741
|
commitGroupScaling({ group: e, scaleX: t, scaleY: n, transform: r }) {
|
|
5742
5742
|
let { shape: i, text: a } = J({ group: e });
|
|
5743
5743
|
if (!i || !a) return this.shapeScalingState.delete(e), !1;
|
|
5744
|
-
let o = this.shapeScalingState.get(e), s = o ??
|
|
5744
|
+
let o = this.shapeScalingState.get(e), s = o ?? Hr({
|
|
5745
5745
|
group: e,
|
|
5746
5746
|
transform: r
|
|
5747
5747
|
}), 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
5748
|
scaleX: t,
|
|
5749
5749
|
scaleY: n
|
|
5750
|
-
}, { width: h, height: g, hasWidthChange: _, hasDimensionChange: v } =
|
|
5750
|
+
}, { width: h, height: g, hasWidthChange: _, hasDimensionChange: v } = Wr({
|
|
5751
5751
|
group: e,
|
|
5752
5752
|
text: a,
|
|
5753
5753
|
constraintPadding: p,
|
|
@@ -5758,9 +5758,9 @@ var Kr = class {
|
|
|
5758
5758
|
},
|
|
5759
5759
|
scaleX: m.scaleX,
|
|
5760
5760
|
scaleY: m.scaleY,
|
|
5761
|
-
wrapPolicy:
|
|
5761
|
+
wrapPolicy: kr({ isProportionalScaling: o?.isProportionalScaling })
|
|
5762
5762
|
});
|
|
5763
|
-
return v ? (
|
|
5763
|
+
return v ? (Kr({
|
|
5764
5764
|
group: e,
|
|
5765
5765
|
shape: i,
|
|
5766
5766
|
text: a,
|
|
@@ -5773,7 +5773,7 @@ var Kr = class {
|
|
|
5773
5773
|
canScaleWidth: l,
|
|
5774
5774
|
canScaleHeight: u,
|
|
5775
5775
|
hasWidthChange: _,
|
|
5776
|
-
wrapPolicy:
|
|
5776
|
+
wrapPolicy: kr({ isProportionalScaling: o?.isProportionalScaling })
|
|
5777
5777
|
}), 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
5778
|
}
|
|
5779
5779
|
resolveCommittedScale({ selection: e }) {
|
|
@@ -5797,7 +5797,7 @@ var Kr = class {
|
|
|
5797
5797
|
if (!H(r)) continue;
|
|
5798
5798
|
let { shape: e, text: i } = J({ group: r });
|
|
5799
5799
|
if (!e || !i) continue;
|
|
5800
|
-
let a = Z({ group: r }), o =
|
|
5800
|
+
let a = Z({ group: r }), o = Ur({
|
|
5801
5801
|
scalingState: this.shapeScalingState,
|
|
5802
5802
|
group: r,
|
|
5803
5803
|
text: i,
|
|
@@ -5817,7 +5817,7 @@ var Kr = class {
|
|
|
5817
5817
|
_ensureScalingSession({ selection: e, transform: t, items: n }) {
|
|
5818
5818
|
let r = this.scalingSessions.get(e);
|
|
5819
5819
|
if (r) return r;
|
|
5820
|
-
let i =
|
|
5820
|
+
let i = vr({ value: t.originX }) ?? "center", a = yr({ value: t.originY }) ?? "center", o = n[0], s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), l = this._resolveShapeLocalBounds({ group: o.group });
|
|
5821
5821
|
for (let { group: e } of n) {
|
|
5822
5822
|
let t = this._resolveShapeLocalBounds({ group: e });
|
|
5823
5823
|
s.set(e, t), l = this._mergeBounds({
|
|
@@ -6037,7 +6037,7 @@ var Kr = class {
|
|
|
6037
6037
|
_resolveProportionalLayoutResults({ items: e }) {
|
|
6038
6038
|
let t = /* @__PURE__ */ new Map();
|
|
6039
6039
|
for (let n of e) {
|
|
6040
|
-
let e =
|
|
6040
|
+
let e = Rr({
|
|
6041
6041
|
group: n.group,
|
|
6042
6042
|
text: n.text,
|
|
6043
6043
|
state: n.state
|
|
@@ -6051,7 +6051,7 @@ var Kr = class {
|
|
|
6051
6051
|
}
|
|
6052
6052
|
_resolveMinimumShapeWidth({ item: e, scaleY: t }) {
|
|
6053
6053
|
let { group: n, text: r, constraintPadding: i, state: a } = e, o = Math.max(1, a.startHeight * t);
|
|
6054
|
-
return
|
|
6054
|
+
return ir({
|
|
6055
6055
|
text: r,
|
|
6056
6056
|
padding: i,
|
|
6057
6057
|
measurementCache: a.previewTextMeasurementCache ?? void 0,
|
|
@@ -6068,7 +6068,7 @@ var Kr = class {
|
|
|
6068
6068
|
}
|
|
6069
6069
|
_resolveMinimumShapeHeight({ item: e, scaleX: t }) {
|
|
6070
6070
|
let { group: n, text: r, constraintPadding: i, state: a } = e;
|
|
6071
|
-
return
|
|
6071
|
+
return zr({
|
|
6072
6072
|
group: n,
|
|
6073
6073
|
text: r,
|
|
6074
6074
|
width: Math.max(1, a.startWidth * t),
|
|
@@ -6107,7 +6107,7 @@ var Kr = class {
|
|
|
6107
6107
|
};
|
|
6108
6108
|
}
|
|
6109
6109
|
_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 <=
|
|
6110
|
+
let n = Math.max(0, t.top - e.top), r = Math.max(0, e.bottom - t.bottom), i = n <= Or, a = r <= Or;
|
|
6111
6111
|
return i && !a ? "top" : a && !i ? "bottom" : Math.abs(n - r) <= .5 ? "center" : n < r ? "top" : "bottom";
|
|
6112
6112
|
}
|
|
6113
6113
|
_resolveOriginOffset({ origin: e }) {
|
|
@@ -6128,7 +6128,7 @@ var Kr = class {
|
|
|
6128
6128
|
_hasPointerReachedSelectionScaleOrigin({ selection: e, transform: t, event: n, axis: r }) {
|
|
6129
6129
|
let i = t, a = r === "x" ? i.signX : i.signY;
|
|
6130
6130
|
if (typeof a != "number" || !Number.isFinite(a)) return !1;
|
|
6131
|
-
let o =
|
|
6131
|
+
let o = br({
|
|
6132
6132
|
target: e,
|
|
6133
6133
|
transform: t,
|
|
6134
6134
|
event: n,
|
|
@@ -6139,7 +6139,7 @@ var Kr = class {
|
|
|
6139
6139
|
_applySelectionScale({ selection: e, transform: t, scaleX: n, scaleY: r }) {
|
|
6140
6140
|
let i = Math.abs(e.scaleX ?? 1) || 1, a = Math.abs(e.scaleY ?? 1) || 1;
|
|
6141
6141
|
if (!(Math.abs(i - n) > 1e-4 || Math.abs(a - r) > 1e-4)) return;
|
|
6142
|
-
let o =
|
|
6142
|
+
let o = vr({ value: t.originX }), s = yr({ value: t.originY }), c = o !== null && s !== null ? e.getPositionByOrigin(o, s) : null;
|
|
6143
6143
|
e.set({
|
|
6144
6144
|
flipX: !1,
|
|
6145
6145
|
flipY: !1,
|
|
@@ -6147,7 +6147,7 @@ var Kr = class {
|
|
|
6147
6147
|
scaleY: r
|
|
6148
6148
|
}), c && o !== null && s !== null && e.setPositionByOrigin(c, o, s), e.setCoords();
|
|
6149
6149
|
}
|
|
6150
|
-
},
|
|
6150
|
+
}, Jr = class {
|
|
6151
6151
|
constructor({ canvas: t }) {
|
|
6152
6152
|
this.handleObjectScaling = (t) => {
|
|
6153
6153
|
let { target: n, transform: r } = t;
|
|
@@ -6166,7 +6166,7 @@ var Kr = class {
|
|
|
6166
6166
|
lockScalingFlip: !0,
|
|
6167
6167
|
centeredScaling: !1
|
|
6168
6168
|
});
|
|
6169
|
-
let s = Z({ group: i }), c =
|
|
6169
|
+
let s = Z({ group: i }), c = Ur({
|
|
6170
6170
|
scalingState: this.scalingState,
|
|
6171
6171
|
group: i,
|
|
6172
6172
|
text: o,
|
|
@@ -6195,7 +6195,7 @@ var Kr = class {
|
|
|
6195
6195
|
});
|
|
6196
6196
|
return;
|
|
6197
6197
|
}
|
|
6198
|
-
let _ =
|
|
6198
|
+
let _ = Vr({
|
|
6199
6199
|
group: i,
|
|
6200
6200
|
text: o,
|
|
6201
6201
|
state: c,
|
|
@@ -6209,7 +6209,7 @@ var Kr = class {
|
|
|
6209
6209
|
shouldHandleAsNoop: !1,
|
|
6210
6210
|
scaleX: g.appliedScaleX,
|
|
6211
6211
|
scaleY: g.appliedScaleY
|
|
6212
|
-
}),
|
|
6212
|
+
}), Dr({
|
|
6213
6213
|
group: i,
|
|
6214
6214
|
shape: a,
|
|
6215
6215
|
text: o,
|
|
@@ -6271,7 +6271,7 @@ var Kr = class {
|
|
|
6271
6271
|
axis: "y"
|
|
6272
6272
|
});
|
|
6273
6273
|
if (!e && !t) return;
|
|
6274
|
-
let n =
|
|
6274
|
+
let n = Rr({
|
|
6275
6275
|
group: i,
|
|
6276
6276
|
text: s,
|
|
6277
6277
|
state: a
|
|
@@ -6285,7 +6285,7 @@ var Kr = class {
|
|
|
6285
6285
|
state: a,
|
|
6286
6286
|
axis: "x"
|
|
6287
6287
|
})) {
|
|
6288
|
-
let e =
|
|
6288
|
+
let e = ir({
|
|
6289
6289
|
text: s,
|
|
6290
6290
|
padding: c,
|
|
6291
6291
|
resolvePaddingForWidth: ({ width: e }) => Z({
|
|
@@ -6311,7 +6311,7 @@ var Kr = class {
|
|
|
6311
6311
|
});
|
|
6312
6312
|
return;
|
|
6313
6313
|
}
|
|
6314
|
-
y = C ??
|
|
6314
|
+
y = C ?? zr({
|
|
6315
6315
|
group: i,
|
|
6316
6316
|
text: s,
|
|
6317
6317
|
width: Math.max(1, a.startWidth * _),
|
|
@@ -6324,7 +6324,7 @@ var Kr = class {
|
|
|
6324
6324
|
}
|
|
6325
6325
|
if (!x && !S) return;
|
|
6326
6326
|
y ??= C;
|
|
6327
|
-
let w =
|
|
6327
|
+
let w = Br({
|
|
6328
6328
|
group: i,
|
|
6329
6329
|
text: s,
|
|
6330
6330
|
constraintPadding: c,
|
|
@@ -6333,7 +6333,7 @@ var Kr = class {
|
|
|
6333
6333
|
appliedScaleY: v,
|
|
6334
6334
|
minimumHeight: b ? null : y,
|
|
6335
6335
|
measurementCache: a.previewTextMeasurementCache
|
|
6336
|
-
}), T =
|
|
6336
|
+
}), T = Vr({
|
|
6337
6337
|
group: i,
|
|
6338
6338
|
text: s,
|
|
6339
6339
|
state: a,
|
|
@@ -6347,7 +6347,7 @@ var Kr = class {
|
|
|
6347
6347
|
shouldHandleAsNoop: !1,
|
|
6348
6348
|
scaleX: _,
|
|
6349
6349
|
scaleY: v
|
|
6350
|
-
}),
|
|
6350
|
+
}), Dr({
|
|
6351
6351
|
group: i,
|
|
6352
6352
|
shape: o,
|
|
6353
6353
|
text: s,
|
|
@@ -6391,7 +6391,7 @@ var Kr = class {
|
|
|
6391
6391
|
startHeight: s,
|
|
6392
6392
|
alignH: n.shapeAlignHorizontal,
|
|
6393
6393
|
alignV: n.shapeAlignVertical,
|
|
6394
|
-
userPadding:
|
|
6394
|
+
userPadding: Fr({ group: n })
|
|
6395
6395
|
}), n.shapeScalingNoopTransform = !1, this.scalingState.delete(n), this.canvas.requestRenderAll();
|
|
6396
6396
|
return;
|
|
6397
6397
|
}
|
|
@@ -6414,7 +6414,7 @@ var Kr = class {
|
|
|
6414
6414
|
axis: "y"
|
|
6415
6415
|
});
|
|
6416
6416
|
if (t || o) {
|
|
6417
|
-
let e =
|
|
6417
|
+
let e = Rr({
|
|
6418
6418
|
group: n,
|
|
6419
6419
|
text: d,
|
|
6420
6420
|
state: r
|
|
@@ -6422,7 +6422,7 @@ var Kr = class {
|
|
|
6422
6422
|
(i < e.scale - 1e-4 || a < e.scale - 1e-4) && (v = e.scale, y = e.scale);
|
|
6423
6423
|
}
|
|
6424
6424
|
} else {
|
|
6425
|
-
let t =
|
|
6425
|
+
let t = ir({
|
|
6426
6426
|
text: d,
|
|
6427
6427
|
padding: m,
|
|
6428
6428
|
resolvePaddingForWidth: ({ width: e }) => Z({
|
|
@@ -6437,7 +6437,7 @@ var Kr = class {
|
|
|
6437
6437
|
minimumWidth: t,
|
|
6438
6438
|
state: r
|
|
6439
6439
|
}) && (v = Math.max(1 / o, t / o));
|
|
6440
|
-
let i =
|
|
6440
|
+
let i = zr({
|
|
6441
6441
|
group: n,
|
|
6442
6442
|
text: d,
|
|
6443
6443
|
width: Math.max(1, o * v),
|
|
@@ -6450,7 +6450,7 @@ var Kr = class {
|
|
|
6450
6450
|
state: r
|
|
6451
6451
|
}) && (y = Math.max(1 / s, i / s));
|
|
6452
6452
|
}
|
|
6453
|
-
let { width: b, height: x, hasWidthChange: S, hasDimensionChange: C } =
|
|
6453
|
+
let { width: b, height: x, hasWidthChange: S, hasDimensionChange: C } = Wr({
|
|
6454
6454
|
group: n,
|
|
6455
6455
|
text: d,
|
|
6456
6456
|
constraintPadding: m,
|
|
@@ -6464,7 +6464,7 @@ var Kr = class {
|
|
|
6464
6464
|
},
|
|
6465
6465
|
scaleX: v,
|
|
6466
6466
|
scaleY: y,
|
|
6467
|
-
wrapPolicy:
|
|
6467
|
+
wrapPolicy: kr({ isProportionalScaling: r?.isProportionalScaling })
|
|
6468
6468
|
});
|
|
6469
6469
|
if (!C && r) {
|
|
6470
6470
|
this._restoreShapeStateWithoutResize({
|
|
@@ -6476,14 +6476,14 @@ var Kr = class {
|
|
|
6476
6476
|
startHeight: s,
|
|
6477
6477
|
alignH: f,
|
|
6478
6478
|
alignV: p,
|
|
6479
|
-
userPadding:
|
|
6479
|
+
userPadding: Fr({ group: n })
|
|
6480
6480
|
}), this.scalingState.delete(n), this.canvas.requestRenderAll();
|
|
6481
6481
|
return;
|
|
6482
6482
|
}
|
|
6483
6483
|
r && n.set({
|
|
6484
6484
|
left: r.lastAllowedLeft,
|
|
6485
6485
|
top: r.lastAllowedTop
|
|
6486
|
-
}),
|
|
6486
|
+
}), Kr({
|
|
6487
6487
|
group: n,
|
|
6488
6488
|
shape: u,
|
|
6489
6489
|
text: d,
|
|
@@ -6496,12 +6496,12 @@ var Kr = class {
|
|
|
6496
6496
|
canScaleWidth: g,
|
|
6497
6497
|
canScaleHeight: _,
|
|
6498
6498
|
hasWidthChange: S,
|
|
6499
|
-
wrapPolicy:
|
|
6499
|
+
wrapPolicy: kr({ isProportionalScaling: r?.isProportionalScaling })
|
|
6500
6500
|
}), r && this._restoreScalingAnchorPosition({
|
|
6501
6501
|
group: n,
|
|
6502
6502
|
state: r
|
|
6503
6503
|
}), 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
|
|
6504
|
+
}, this.canvas = t, this.scalingState = /* @__PURE__ */ new WeakMap(), this.activeSelectionScalingController = new qr({
|
|
6505
6505
|
canvas: t,
|
|
6506
6506
|
shapeScalingState: this.scalingState
|
|
6507
6507
|
});
|
|
@@ -6510,10 +6510,10 @@ var Kr = class {
|
|
|
6510
6510
|
let a = e.scaleX ?? 1, o = e.scaleY ?? 1, { scaleX: s, scaleY: c } = this._resolveCurrentDragScales({
|
|
6511
6511
|
group: e,
|
|
6512
6512
|
state: r
|
|
6513
|
-
}), l = r.canScaleWidth && a < 0 || r.canScaleHeight && o < 0, u =
|
|
6513
|
+
}), l = r.canScaleWidth && a < 0 || r.canScaleHeight && o < 0, u = Sr({
|
|
6514
6514
|
state: r,
|
|
6515
6515
|
transform: i
|
|
6516
|
-
}), d =
|
|
6516
|
+
}), d = Cr({
|
|
6517
6517
|
state: r,
|
|
6518
6518
|
transform: i
|
|
6519
6519
|
});
|
|
@@ -6529,7 +6529,7 @@ var Kr = class {
|
|
|
6529
6529
|
f.shouldRestoreLastAllowedTransform && (h = r.lastAllowedScaleX, g = r.lastAllowedScaleY), f.shouldHandleAsNoop && (h = r.startScaleX, g = r.startScaleY);
|
|
6530
6530
|
let _ = f.resolvedMinimumHeight, v = !r.canScaleWidth && r.canScaleHeight ? r.fixedWidthMinimumTextFitHeight : null;
|
|
6531
6531
|
f.shouldHandleAsNoop ? _ = r.startHeight : _ ??= v;
|
|
6532
|
-
let { previewHeight: y } =
|
|
6532
|
+
let { previewHeight: y } = Br({
|
|
6533
6533
|
group: e,
|
|
6534
6534
|
text: t,
|
|
6535
6535
|
constraintPadding: n,
|
|
@@ -6548,7 +6548,7 @@ var Kr = class {
|
|
|
6548
6548
|
};
|
|
6549
6549
|
}
|
|
6550
6550
|
_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 ?
|
|
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 ? ir({
|
|
6552
6552
|
text: t,
|
|
6553
6553
|
padding: n,
|
|
6554
6554
|
measurementCache: r.previewTextMeasurementCache ?? void 0,
|
|
@@ -6557,7 +6557,7 @@ var Kr = class {
|
|
|
6557
6557
|
width: t,
|
|
6558
6558
|
height: v
|
|
6559
6559
|
})
|
|
6560
|
-
}) : null, w = o && b ? S ??
|
|
6560
|
+
}) : null, w = o && b ? S ?? zr({
|
|
6561
6561
|
group: e,
|
|
6562
6562
|
text: t,
|
|
6563
6563
|
width: _,
|
|
@@ -6565,7 +6565,7 @@ var Kr = class {
|
|
|
6565
6565
|
measurementCache: r.previewTextMeasurementCache
|
|
6566
6566
|
}) : null, T = g && u && x;
|
|
6567
6567
|
if (f && s && o && (y || b)) {
|
|
6568
|
-
if (!
|
|
6568
|
+
if (!Lr({
|
|
6569
6569
|
group: e,
|
|
6570
6570
|
text: t,
|
|
6571
6571
|
width: _,
|
|
@@ -6573,7 +6573,7 @@ var Kr = class {
|
|
|
6573
6573
|
measurementCache: r.previewTextMeasurementCache,
|
|
6574
6574
|
constraintCache: r.proportionalTextConstraintCache
|
|
6575
6575
|
}).isValid) {
|
|
6576
|
-
let n =
|
|
6576
|
+
let n = Rr({
|
|
6577
6577
|
group: e,
|
|
6578
6578
|
text: t,
|
|
6579
6579
|
state: r
|
|
@@ -6596,7 +6596,7 @@ var Kr = class {
|
|
|
6596
6596
|
}
|
|
6597
6597
|
let E = C !== null && _ < C + 1e-4, D = w !== null && v < w + 1e-4, O = E || D, k = d, A = null, j = null;
|
|
6598
6598
|
if (f && O) {
|
|
6599
|
-
let n =
|
|
6599
|
+
let n = Rr({
|
|
6600
6600
|
group: e,
|
|
6601
6601
|
text: t,
|
|
6602
6602
|
state: r
|
|
@@ -6625,11 +6625,11 @@ var Kr = class {
|
|
|
6625
6625
|
shouldHandleAsNoop: !0,
|
|
6626
6626
|
scaleX: r.startScaleX,
|
|
6627
6627
|
scaleY: r.startScaleY
|
|
6628
|
-
}),
|
|
6628
|
+
}), Dr({
|
|
6629
6629
|
group: e,
|
|
6630
6630
|
shape: t,
|
|
6631
6631
|
text: n,
|
|
6632
|
-
layout:
|
|
6632
|
+
layout: Vr({
|
|
6633
6633
|
group: e,
|
|
6634
6634
|
text: n,
|
|
6635
6635
|
state: r,
|
|
@@ -6713,7 +6713,7 @@ var Kr = class {
|
|
|
6713
6713
|
if (!i) return !1;
|
|
6714
6714
|
let a = i, o = r === "x" ? n?.scaleDirectionX ?? null : n?.scaleDirectionY ?? null, s = this._resolveScaleDirection({ value: r === "x" ? a.signX : a.signY }) ?? o;
|
|
6715
6715
|
if (s === null) return !1;
|
|
6716
|
-
let c =
|
|
6716
|
+
let c = br({
|
|
6717
6717
|
event: e.e,
|
|
6718
6718
|
target: t,
|
|
6719
6719
|
transform: i,
|
|
@@ -6731,7 +6731,7 @@ var Kr = class {
|
|
|
6731
6731
|
a && t.scaleDirectionX === null && (t.scaleDirectionX = this._resolveScaleDirection({ value: l.signX })), i && t.scaleDirectionY === null && (t.scaleDirectionY = this._resolveScaleDirection({ value: l.signY }));
|
|
6732
6732
|
let u = !a || t.scaleDirectionX !== null, d = !i || t.scaleDirectionY !== null;
|
|
6733
6733
|
if (u && d) return;
|
|
6734
|
-
let f =
|
|
6734
|
+
let f = br({
|
|
6735
6735
|
event: n,
|
|
6736
6736
|
target: e,
|
|
6737
6737
|
transform: r,
|
|
@@ -6760,16 +6760,16 @@ var Kr = class {
|
|
|
6760
6760
|
e.setPositionByOrigin(new m(n, r), i, a), e.setCoords();
|
|
6761
6761
|
}
|
|
6762
6762
|
_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 =
|
|
6763
|
+
let l = Math.max(1, e.shapeBaseWidth ?? e.width ?? i), u = Math.max(1, e.shapeBaseHeight ?? e.height ?? a), d = Ir({
|
|
6764
6764
|
group: e,
|
|
6765
6765
|
width: l,
|
|
6766
6766
|
height: u
|
|
6767
|
-
}), f = o ?? "center", p = s ?? "middle", m =
|
|
6767
|
+
}), f = o ?? "center", p = s ?? "middle", m = kr({ isProportionalScaling: r.isProportionalScaling }), h = ({ width: t, height: n }) => Ir({
|
|
6768
6768
|
group: e,
|
|
6769
6769
|
width: t,
|
|
6770
6770
|
height: n
|
|
6771
6771
|
});
|
|
6772
|
-
!r.canScaleWidth && r.canScaleHeight ?
|
|
6772
|
+
!r.canScaleWidth && r.canScaleHeight ? tr({
|
|
6773
6773
|
group: e,
|
|
6774
6774
|
shape: t,
|
|
6775
6775
|
text: n,
|
|
@@ -6781,7 +6781,7 @@ var Kr = class {
|
|
|
6781
6781
|
wrapPolicy: m,
|
|
6782
6782
|
internalShapeTextInset: d,
|
|
6783
6783
|
resolveInternalShapeTextInset: h
|
|
6784
|
-
}) :
|
|
6784
|
+
}) : er({
|
|
6785
6785
|
group: e,
|
|
6786
6786
|
shape: t,
|
|
6787
6787
|
text: n,
|
|
@@ -6805,7 +6805,7 @@ var Kr = class {
|
|
|
6805
6805
|
state: r
|
|
6806
6806
|
});
|
|
6807
6807
|
}
|
|
6808
|
-
},
|
|
6808
|
+
}, Yr = class {
|
|
6809
6809
|
constructor({ canvas: e }) {
|
|
6810
6810
|
this.handleMouseDown = (e) => {
|
|
6811
6811
|
let { target: t, e: n, subTargets: r = [] } = e, i = Je({
|
|
@@ -6929,7 +6929,7 @@ var Kr = class {
|
|
|
6929
6929
|
let t = this.canvas;
|
|
6930
6930
|
t.findTarget = e.findTarget, this.editingTargetResolverState = void 0;
|
|
6931
6931
|
}
|
|
6932
|
-
},
|
|
6932
|
+
}, Xr = 1e-4, Zr = class {
|
|
6933
6933
|
constructor({ runtime: t }) {
|
|
6934
6934
|
this._handleObjectScaling = (e) => {
|
|
6935
6935
|
this.runtime.collectShapeGroupsFromTarget({
|
|
@@ -7014,7 +7014,7 @@ var Kr = class {
|
|
|
7014
7014
|
let r = t.getObjects(), i = r.filter((e) => H(e));
|
|
7015
7015
|
if (!i.length) return;
|
|
7016
7016
|
let { scaleX: a, scaleY: o } = this.runtime.scalingController.resolveActiveSelectionCommittedScale({ selection: t });
|
|
7017
|
-
if (!(Math.abs(a - 1) >
|
|
7017
|
+
if (!(Math.abs(a - 1) > Xr || Math.abs(o - 1) > Xr)) {
|
|
7018
7018
|
this.runtime.scalingController.clearActiveSelectionState({ selection: t });
|
|
7019
7019
|
return;
|
|
7020
7020
|
}
|
|
@@ -7032,7 +7032,7 @@ var Kr = class {
|
|
|
7032
7032
|
}), e.setCoords());
|
|
7033
7033
|
}), this.runtime.scalingController.clearActiveSelectionState({ selection: t }), s.setActiveObject(new e(r, { canvas: s })), s.requestRenderAll();
|
|
7034
7034
|
}
|
|
7035
|
-
},
|
|
7035
|
+
}, Qr = class {
|
|
7036
7036
|
constructor({ editor: e }) {
|
|
7037
7037
|
this.editor = e;
|
|
7038
7038
|
}
|
|
@@ -7151,7 +7151,7 @@ var Kr = class {
|
|
|
7151
7151
|
width: y,
|
|
7152
7152
|
height: b
|
|
7153
7153
|
}), S = u ?? e.shapeTextWrapPolicy, C = r ?? this.editor.canvasManager.getObjectPlacement({ object: e });
|
|
7154
|
-
|
|
7154
|
+
er({
|
|
7155
7155
|
group: e,
|
|
7156
7156
|
shape: t,
|
|
7157
7157
|
text: n,
|
|
@@ -7175,7 +7175,7 @@ var Kr = class {
|
|
|
7175
7175
|
}
|
|
7176
7176
|
_resolveAutoExpandShapeWidth({ text: e, currentWidth: t, minimumWidth: n, padding: r, resolvePaddingForWidth: i }) {
|
|
7177
7177
|
let a = this.resolveMontageAreaWidth();
|
|
7178
|
-
return a ?
|
|
7178
|
+
return a ? rr({
|
|
7179
7179
|
text: e,
|
|
7180
7180
|
currentWidth: t,
|
|
7181
7181
|
minimumWidth: n,
|
|
@@ -7184,7 +7184,7 @@ var Kr = class {
|
|
|
7184
7184
|
resolvePaddingForWidth: i
|
|
7185
7185
|
}) : Math.max(1, t, n);
|
|
7186
7186
|
}
|
|
7187
|
-
},
|
|
7187
|
+
}, $r = class e {
|
|
7188
7188
|
constructor({ canvas: e }) {
|
|
7189
7189
|
this.canvas = e, this.textEditingSnapshots = /* @__PURE__ */ new WeakMap(), this.pendingTextUpdates = /* @__PURE__ */ new WeakMap(), this.resizeStartSnapshots = /* @__PURE__ */ new Map(), this.pendingResizeUpdates = /* @__PURE__ */ new WeakMap();
|
|
7190
7190
|
}
|
|
@@ -7380,7 +7380,7 @@ var Kr = class {
|
|
|
7380
7380
|
}
|
|
7381
7381
|
}), I;
|
|
7382
7382
|
}
|
|
7383
|
-
},
|
|
7383
|
+
}, ei = .01, ti = ({ textbox: e }) => {
|
|
7384
7384
|
let t = e.text ?? "";
|
|
7385
7385
|
if (!t.length) return [];
|
|
7386
7386
|
let n = t.split("\n"), r = [], i = 0;
|
|
@@ -7392,7 +7392,7 @@ var Kr = class {
|
|
|
7392
7392
|
});
|
|
7393
7393
|
}
|
|
7394
7394
|
return r;
|
|
7395
|
-
},
|
|
7395
|
+
}, ni = ({ range: e, text: t }) => {
|
|
7396
7396
|
if (!e) return null;
|
|
7397
7397
|
let n = t.length;
|
|
7398
7398
|
if (n <= 0) return null;
|
|
@@ -7401,8 +7401,8 @@ var Kr = class {
|
|
|
7401
7401
|
start: l,
|
|
7402
7402
|
end: u
|
|
7403
7403
|
};
|
|
7404
|
-
},
|
|
7405
|
-
let n =
|
|
7404
|
+
}, ri = ({ textbox: e, range: t }) => {
|
|
7405
|
+
let n = ti({ textbox: e });
|
|
7406
7406
|
if (!n.length) return t;
|
|
7407
7407
|
let { start: r } = t, { end: i } = t;
|
|
7408
7408
|
for (let e = 0; e < n.length; e += 1) {
|
|
@@ -7415,7 +7415,7 @@ var Kr = class {
|
|
|
7415
7415
|
start: r,
|
|
7416
7416
|
end: i
|
|
7417
7417
|
};
|
|
7418
|
-
},
|
|
7418
|
+
}, ii = ({ textbox: e, range: t }) => {
|
|
7419
7419
|
let n = e.text ?? "";
|
|
7420
7420
|
if (!n.length) return [];
|
|
7421
7421
|
let { start: r, end: i } = t, a = n.split("\n"), o = [], s = 0;
|
|
@@ -7424,7 +7424,7 @@ var Kr = class {
|
|
|
7424
7424
|
i > n && r < c && o.push(e), s = c + 1;
|
|
7425
7425
|
}
|
|
7426
7426
|
return o;
|
|
7427
|
-
},
|
|
7427
|
+
}, ai = ({ textbox: e, range: t }) => {
|
|
7428
7428
|
let n = e.text ?? "";
|
|
7429
7429
|
if (!n.length) return [];
|
|
7430
7430
|
let { start: r, end: i } = t, a = n.split("\n"), o = [], s = 0;
|
|
@@ -7433,21 +7433,21 @@ var Kr = class {
|
|
|
7433
7433
|
r <= n && i >= c && o.push(e), s = c + 1;
|
|
7434
7434
|
}
|
|
7435
7435
|
return o;
|
|
7436
|
-
},
|
|
7436
|
+
}, oi = ({ previous: e, next: t }) => {
|
|
7437
7437
|
let n = Math.min(e.length, t.length);
|
|
7438
7438
|
for (let r = 0; r < n; r += 1) if (e[r] !== t[r]) return r;
|
|
7439
7439
|
return n;
|
|
7440
|
-
},
|
|
7440
|
+
}, si = ({ text: e, charIndex: t }) => {
|
|
7441
7441
|
let n = Math.max(0, Math.min(t, e.length)), r = 0;
|
|
7442
7442
|
for (let t = 0; t < n; t += 1) e[t] === "\n" && (r += 1);
|
|
7443
7443
|
return r;
|
|
7444
|
-
},
|
|
7444
|
+
}, ci = ({ text: e, lineIndex: t }) => {
|
|
7445
7445
|
if (t <= 0) return 0;
|
|
7446
7446
|
let n = 0;
|
|
7447
7447
|
for (let r = 0; r < e.length; r += 1) if (e[r] === "\n" && (n += 1, n === t)) return r + 1;
|
|
7448
7448
|
return e.length;
|
|
7449
|
-
},
|
|
7450
|
-
let a =
|
|
7449
|
+
}, li = ({ deltaLines: e, diffIndex: t, lineFontDefaults: n, lineIndexOld: r, previousText: i }) => {
|
|
7450
|
+
let a = ci({
|
|
7451
7451
|
text: i,
|
|
7452
7452
|
lineIndex: r
|
|
7453
7453
|
}), o = r + 1;
|
|
@@ -7466,7 +7466,7 @@ var Kr = class {
|
|
|
7466
7466
|
lineFontDefaults: s,
|
|
7467
7467
|
changed: !0
|
|
7468
7468
|
};
|
|
7469
|
-
},
|
|
7469
|
+
}, ui = ({ deltaLines: e, diffIndex: t, lineFontDefaults: n, lineIndexOld: r, previousLines: i, previousText: a }) => {
|
|
7470
7470
|
let o = Math.abs(e), s = r;
|
|
7471
7471
|
a[t] === "\n" && (i[r] ?? "").length > 0 && (s = r + 1);
|
|
7472
7472
|
let c = s + o - 1, l = {}, u = [];
|
|
@@ -7489,7 +7489,7 @@ var Kr = class {
|
|
|
7489
7489
|
lineDefaults: u
|
|
7490
7490
|
}
|
|
7491
7491
|
};
|
|
7492
|
-
},
|
|
7492
|
+
}, di = ({ lineFontDefaults: e, previousText: t, currentText: n }) => {
|
|
7493
7493
|
if (!e || !Object.keys(e).length) return {
|
|
7494
7494
|
lineFontDefaults: e,
|
|
7495
7495
|
changed: !1
|
|
@@ -7499,20 +7499,20 @@ var Kr = class {
|
|
|
7499
7499
|
lineFontDefaults: e,
|
|
7500
7500
|
changed: !1
|
|
7501
7501
|
};
|
|
7502
|
-
let a =
|
|
7502
|
+
let a = oi({
|
|
7503
7503
|
previous: t,
|
|
7504
7504
|
next: n
|
|
7505
|
-
}), o =
|
|
7505
|
+
}), o = si({
|
|
7506
7506
|
text: t,
|
|
7507
7507
|
charIndex: a
|
|
7508
7508
|
});
|
|
7509
|
-
return i > 0 ?
|
|
7509
|
+
return i > 0 ? li({
|
|
7510
7510
|
deltaLines: i,
|
|
7511
7511
|
diffIndex: a,
|
|
7512
7512
|
lineFontDefaults: e,
|
|
7513
7513
|
lineIndexOld: o,
|
|
7514
7514
|
previousText: t
|
|
7515
|
-
}) :
|
|
7515
|
+
}) : ui({
|
|
7516
7516
|
deltaLines: i,
|
|
7517
7517
|
diffIndex: a,
|
|
7518
7518
|
lineFontDefaults: e,
|
|
@@ -7520,10 +7520,10 @@ var Kr = class {
|
|
|
7520
7520
|
previousLines: r,
|
|
7521
7521
|
previousText: t
|
|
7522
7522
|
});
|
|
7523
|
-
},
|
|
7523
|
+
}, fi = ({ lineDefaults: e }) => {
|
|
7524
7524
|
let t = {};
|
|
7525
7525
|
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
|
-
},
|
|
7526
|
+
}, pi = ({ textbox: e, lineIndices: t, updates: n }) => {
|
|
7527
7527
|
if (!t.length) return !1;
|
|
7528
7528
|
let { fill: r, fontFamily: i, fontSize: a, fontStyle: o, fontWeight: s, linethrough: c, stroke: l, strokeWidth: u, underline: d } = n;
|
|
7529
7529
|
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 +7535,12 @@ var Kr = class {
|
|
|
7535
7535
|
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
7536
|
}
|
|
7537
7537
|
return m && (e.lineFontDefaults = p), m;
|
|
7538
|
-
},
|
|
7538
|
+
}, mi = ({ lineStyles: e, lineDefaults: t }) => {
|
|
7539
7539
|
if (!e) return {
|
|
7540
7540
|
lineStyles: e,
|
|
7541
7541
|
changed: !1
|
|
7542
7542
|
};
|
|
7543
|
-
let n =
|
|
7543
|
+
let n = fi({ lineDefaults: t }), r = Object.keys(n);
|
|
7544
7544
|
if (!r.length) return {
|
|
7545
7545
|
lineStyles: e,
|
|
7546
7546
|
changed: !1
|
|
@@ -7564,7 +7564,7 @@ var Kr = class {
|
|
|
7564
7564
|
lineStyles: e,
|
|
7565
7565
|
changed: !1
|
|
7566
7566
|
};
|
|
7567
|
-
},
|
|
7567
|
+
}, hi = ({ cleanup: e, lineCount: t, styles: n }) => {
|
|
7568
7568
|
if (!e) return {
|
|
7569
7569
|
styles: n,
|
|
7570
7570
|
changed: !1
|
|
@@ -7584,7 +7584,7 @@ var Kr = class {
|
|
|
7584
7584
|
for (let t = 0; t < e.lineDefaults.length; t += 1) {
|
|
7585
7585
|
let n = e.lineDefaults[t];
|
|
7586
7586
|
if (!n) continue;
|
|
7587
|
-
let a =
|
|
7587
|
+
let a = mi({
|
|
7588
7588
|
lineStyles: r,
|
|
7589
7589
|
lineDefaults: n
|
|
7590
7590
|
});
|
|
@@ -7599,19 +7599,19 @@ var Kr = class {
|
|
|
7599
7599
|
styles: a,
|
|
7600
7600
|
changed: !0
|
|
7601
7601
|
};
|
|
7602
|
-
},
|
|
7602
|
+
}, gi = ({ textbox: e }) => {
|
|
7603
7603
|
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
7604
|
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
|
-
},
|
|
7605
|
+
}, _i = ({ sourceDefaults: e, globalLineDefaults: t }) => {
|
|
7606
7606
|
let n = {};
|
|
7607
7607
|
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
|
-
},
|
|
7608
|
+
}, vi = ({ lineText: e, lineStyles: t, lineDefaults: n }) => {
|
|
7609
7609
|
let r = e.length;
|
|
7610
7610
|
if (r === 0) return {
|
|
7611
7611
|
lineStyles: t,
|
|
7612
7612
|
changed: !1
|
|
7613
7613
|
};
|
|
7614
|
-
let i =
|
|
7614
|
+
let i = fi({ lineDefaults: n }), a = Object.keys(i);
|
|
7615
7615
|
if (!a.length) return {
|
|
7616
7616
|
lineStyles: t,
|
|
7617
7617
|
changed: !1
|
|
@@ -7637,8 +7637,8 @@ var Kr = class {
|
|
|
7637
7637
|
lineStyles: o,
|
|
7638
7638
|
changed: s
|
|
7639
7639
|
};
|
|
7640
|
-
},
|
|
7641
|
-
let a = n, o = !1, s = !1, c = i, l = !1, u = !1, d, f =
|
|
7640
|
+
}, yi = ({ deletedLineDefaultsCleanup: e, globalLineDefaults: t, lineFontDefaults: n, lines: r, styles: i }) => {
|
|
7641
|
+
let a = n, o = !1, s = !1, c = i, l = !1, u = !1, d, f = hi({
|
|
7642
7642
|
styles: c ?? {},
|
|
7643
7643
|
lineCount: r.length,
|
|
7644
7644
|
cleanup: e
|
|
@@ -7649,7 +7649,7 @@ var Kr = class {
|
|
|
7649
7649
|
if (i && (d = i), n.length !== 0) {
|
|
7650
7650
|
let t = i;
|
|
7651
7651
|
if (!t && d && (t = { ...d }, a || (a = {}, s = !0), s ||= (a = { ...a }, !0), a[e] = t, o = !0), t) {
|
|
7652
|
-
let r =
|
|
7652
|
+
let r = vi({
|
|
7653
7653
|
lineText: n,
|
|
7654
7654
|
lineStyles: c ? c[e] : void 0,
|
|
7655
7655
|
lineDefaults: t
|
|
@@ -7658,12 +7658,12 @@ var Kr = class {
|
|
|
7658
7658
|
}
|
|
7659
7659
|
continue;
|
|
7660
7660
|
}
|
|
7661
|
-
let f =
|
|
7661
|
+
let f = _i({
|
|
7662
7662
|
sourceDefaults: i ?? d,
|
|
7663
7663
|
globalLineDefaults: t
|
|
7664
7664
|
});
|
|
7665
7665
|
!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 =
|
|
7666
|
+
let p = fi({ lineDefaults: f }), m = Object.keys(p).length > 0;
|
|
7667
7667
|
(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
7668
|
}
|
|
7669
7669
|
return {
|
|
@@ -7673,8 +7673,8 @@ var Kr = class {
|
|
|
7673
7673
|
stylesChanged: l
|
|
7674
7674
|
};
|
|
7675
7675
|
};
|
|
7676
|
-
function
|
|
7677
|
-
let t = (e.text ?? "").split("\n"), n =
|
|
7676
|
+
function bi({ textbox: e }) {
|
|
7677
|
+
let t = (e.text ?? "").split("\n"), n = gi({ textbox: e }), r = yi({
|
|
7678
7678
|
lines: t,
|
|
7679
7679
|
styles: e.styles,
|
|
7680
7680
|
lineFontDefaults: e.lineFontDefaults,
|
|
@@ -7686,7 +7686,7 @@ function yi({ textbox: e }) {
|
|
|
7686
7686
|
if (!Number.isInteger(t) || t < 0) continue;
|
|
7687
7687
|
let o = r.styles[e];
|
|
7688
7688
|
if (!o) continue;
|
|
7689
|
-
let s =
|
|
7689
|
+
let s = mi({
|
|
7690
7690
|
lineStyles: o,
|
|
7691
7691
|
lineDefaults: i?.[t] ?? n
|
|
7692
7692
|
});
|
|
@@ -7697,31 +7697,31 @@ function yi({ textbox: e }) {
|
|
|
7697
7697
|
styles: a
|
|
7698
7698
|
};
|
|
7699
7699
|
}
|
|
7700
|
-
var
|
|
7701
|
-
let r =
|
|
7700
|
+
var xi = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
7701
|
+
let r = di({
|
|
7702
7702
|
lineFontDefaults: n.lineFontDefaults,
|
|
7703
7703
|
previousText: t,
|
|
7704
7704
|
currentText: e
|
|
7705
|
-
}), i =
|
|
7705
|
+
}), i = yi({
|
|
7706
7706
|
lines: e.split("\n"),
|
|
7707
7707
|
styles: n.styles,
|
|
7708
7708
|
lineFontDefaults: r.lineFontDefaults,
|
|
7709
7709
|
deletedLineDefaultsCleanup: r.deletedLineDefaultsCleanup,
|
|
7710
|
-
globalLineDefaults:
|
|
7710
|
+
globalLineDefaults: gi({ textbox: n })
|
|
7711
7711
|
});
|
|
7712
7712
|
return {
|
|
7713
7713
|
...i,
|
|
7714
7714
|
lineFontDefaultsChanged: r.changed || i.lineFontDefaultsChanged
|
|
7715
7715
|
};
|
|
7716
|
-
},
|
|
7717
|
-
let t =
|
|
7716
|
+
}, Si = ({ textbox: e }) => {
|
|
7717
|
+
let t = yi({
|
|
7718
7718
|
lines: (e.text ?? "").split("\n"),
|
|
7719
7719
|
styles: e.styles,
|
|
7720
7720
|
lineFontDefaults: e.lineFontDefaults,
|
|
7721
|
-
globalLineDefaults:
|
|
7721
|
+
globalLineDefaults: gi({ textbox: e })
|
|
7722
7722
|
}), n = !1;
|
|
7723
7723
|
return t.lineFontDefaultsChanged && (e.lineFontDefaults = t.lineFontDefaults, n = !0), t.stylesChanged && (e.styles = t.styles, e.dirty = !0, n = !0), n;
|
|
7724
|
-
},
|
|
7724
|
+
}, Ci = ({ lineFontDefaults: e }) => {
|
|
7725
7725
|
if (!e) return;
|
|
7726
7726
|
let t = {};
|
|
7727
7727
|
for (let n in e) {
|
|
@@ -7732,7 +7732,7 @@ var bi = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
7732
7732
|
i && (t[r] = { ...i });
|
|
7733
7733
|
}
|
|
7734
7734
|
return t;
|
|
7735
|
-
},
|
|
7735
|
+
}, wi = ({ lineFontDefaults: e, scale: t }) => {
|
|
7736
7736
|
if (!e || !Number.isFinite(t) || Math.abs(t - 1) < .01) return;
|
|
7737
7737
|
let n = {}, r = !1, i = !1;
|
|
7738
7738
|
for (let a in e) {
|
|
@@ -7749,18 +7749,18 @@ var bi = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
7749
7749
|
n[o] = c, r = !0;
|
|
7750
7750
|
}
|
|
7751
7751
|
if (!(!r || !i)) return n;
|
|
7752
|
-
},
|
|
7752
|
+
}, Ti = ({ textbox: e, text: t }) => {
|
|
7753
7753
|
let { textLines: n } = e, r = Array.isArray(n) && n.length > 0 ? n.length : Math.max(t.split("\n").length, 1), i = 0;
|
|
7754
7754
|
for (let t = 0; t < r; t += 1) {
|
|
7755
7755
|
let n = e.getLineWidth(t);
|
|
7756
7756
|
n > i && (i = n);
|
|
7757
7757
|
}
|
|
7758
7758
|
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 +
|
|
7759
|
+
}, Ei = ({ origin: e, size: t }) => e === "left" || e === "top" || e === 0 ? 0 : e === "right" || e === "bottom" || e === 1 ? t : t / 2, Di = ({ textbox: e, originX: t = e.originX ?? "center", originY: n = e.originY ?? "center" }) => {
|
|
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 + Ei({
|
|
7761
7761
|
origin: t,
|
|
7762
7762
|
size: r
|
|
7763
|
-
}), u +
|
|
7763
|
+
}), u + Ei({
|
|
7764
7764
|
origin: n,
|
|
7765
7765
|
size: i
|
|
7766
7766
|
})), 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 +7770,13 @@ var bi = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
7770
7770
|
originX: t,
|
|
7771
7771
|
originY: n
|
|
7772
7772
|
};
|
|
7773
|
-
},
|
|
7773
|
+
}, Oi = ({ textbox: e, montageLeft: t, montageRight: n }) => {
|
|
7774
7774
|
e.setCoords();
|
|
7775
7775
|
let r = e.getBoundingRect(), i = r.left ?? 0, a = i + (r.width ?? 0), o = n - t;
|
|
7776
7776
|
if (o > 0 && (r.width ?? 0) >= o - .01) return !1;
|
|
7777
7777
|
let s = 0;
|
|
7778
7778
|
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
|
-
},
|
|
7779
|
+
}, ki = ({ rawValue: e, calculatedValue: t }) => typeof e == "number" ? e : typeof t == "number" ? t : 0, Ai = ({ stylesList: e }) => {
|
|
7780
7780
|
let t = e.length;
|
|
7781
7781
|
if (!t) return !1;
|
|
7782
7782
|
for (let n = 0; n < t; n += 1) {
|
|
@@ -7786,16 +7786,16 @@ var bi = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
7786
7786
|
if (r !== void 0 || i !== void 0 || a !== void 0 || o !== void 0 || s !== void 0 || c !== void 0) return !0;
|
|
7787
7787
|
}
|
|
7788
7788
|
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 =
|
|
7789
|
+
}, ji = ({ textbox: e }) => {
|
|
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 = ki({
|
|
7791
7791
|
rawValue: t,
|
|
7792
7792
|
calculatedValue: a
|
|
7793
|
-
}), c =
|
|
7793
|
+
}), c = ki({
|
|
7794
7794
|
rawValue: n,
|
|
7795
7795
|
calculatedValue: o
|
|
7796
7796
|
}), l = Number.isFinite(s) ? Math.round(s) : null, u = Number.isFinite(c) ? Math.round(c) : null, d = {};
|
|
7797
7797
|
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
|
-
},
|
|
7798
|
+
}, Mi = ({ textbox: e }) => {
|
|
7799
7799
|
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
7800
|
return {
|
|
7801
7801
|
width: t,
|
|
@@ -7813,9 +7813,9 @@ var bi = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
7813
7813
|
bottomLeft: f
|
|
7814
7814
|
},
|
|
7815
7815
|
styles: JSON.parse(JSON.stringify(r)),
|
|
7816
|
-
lineFontDefaults:
|
|
7816
|
+
lineFontDefaults: Ci({ lineFontDefaults: i })
|
|
7817
7817
|
};
|
|
7818
|
-
},
|
|
7818
|
+
}, Ni = ({ base: e }) => {
|
|
7819
7819
|
let t = 1 / Math.max(1, e.width), n = [e.fontSize];
|
|
7820
7820
|
Object.values(e.styles).forEach((e) => {
|
|
7821
7821
|
Object.values(e).forEach((e) => {
|
|
@@ -7832,7 +7832,7 @@ var bi = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
7832
7832
|
fontScale: r,
|
|
7833
7833
|
proportionalScale: Math.max(t, r)
|
|
7834
7834
|
};
|
|
7835
|
-
},
|
|
7835
|
+
}, Pi = ({ textbox: e, base: t, scale: n, shouldScaleFontSize: r = !0, shouldScalePadding: i = !0, shouldScaleRadii: a = !0 }) => {
|
|
7836
7836
|
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
7837
|
if (r && f) {
|
|
7838
7838
|
let e = {};
|
|
@@ -7851,7 +7851,7 @@ var bi = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
7851
7851
|
}), Object.keys(e).length && (p = e);
|
|
7852
7852
|
}
|
|
7853
7853
|
let m;
|
|
7854
|
-
r && (m =
|
|
7854
|
+
r && (m = wi({
|
|
7855
7855
|
lineFontDefaults: u,
|
|
7856
7856
|
scale: n
|
|
7857
7857
|
}));
|
|
@@ -7877,9 +7877,9 @@ var bi = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
7877
7877
|
radiusBottomRight: g.bottomRight,
|
|
7878
7878
|
radiusBottomLeft: g.bottomLeft
|
|
7879
7879
|
});
|
|
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),
|
|
7880
|
+
}, Fi = ({ 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 }) => {
|
|
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) > ei;
|
|
7882
|
+
u && _ && (e.autoExpand = !1), Pi({
|
|
7883
7883
|
textbox: e,
|
|
7884
7884
|
base: n,
|
|
7885
7885
|
scale: i,
|
|
@@ -7898,7 +7898,7 @@ var bi = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
7898
7898
|
} finally {
|
|
7899
7899
|
e.shouldRoundDimensionsOnInit = v;
|
|
7900
7900
|
}
|
|
7901
|
-
let y = d ?
|
|
7901
|
+
let y = d ? ji({ textbox: e }) : !1;
|
|
7902
7902
|
return y && (e.dirty = !0), o ? (e.set({
|
|
7903
7903
|
originX: a.originX,
|
|
7904
7904
|
originY: a.originY
|
|
@@ -7915,7 +7915,7 @@ var bi = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
7915
7915
|
};
|
|
7916
7916
|
//#endregion
|
|
7917
7917
|
//#region src/editor/shape-manager/mutation/shape-rehydration.ts
|
|
7918
|
-
function
|
|
7918
|
+
function Ii({ group: e }) {
|
|
7919
7919
|
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
7920
|
return {
|
|
7921
7921
|
currentDimensions: {
|
|
@@ -7932,17 +7932,17 @@ function Fi({ group: e }) {
|
|
|
7932
7932
|
}
|
|
7933
7933
|
};
|
|
7934
7934
|
}
|
|
7935
|
-
function
|
|
7935
|
+
function Li({ group: e, text: t, textScale: n }) {
|
|
7936
7936
|
let r = Number.isFinite(n) && n > 0 ? n : 1;
|
|
7937
|
-
Math.abs(r - 1) <= 1e-4 || (
|
|
7937
|
+
Math.abs(r - 1) <= 1e-4 || (Pi({
|
|
7938
7938
|
textbox: t,
|
|
7939
|
-
base:
|
|
7939
|
+
base: Mi({ textbox: t }),
|
|
7940
7940
|
scale: r
|
|
7941
7941
|
}), 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
7942
|
}
|
|
7943
7943
|
//#endregion
|
|
7944
7944
|
//#region src/editor/shape-manager/mutation/shape-update-pipeline.ts
|
|
7945
|
-
var
|
|
7945
|
+
var Ri = {
|
|
7946
7946
|
angle: 0,
|
|
7947
7947
|
skewX: 0,
|
|
7948
7948
|
skewY: 0,
|
|
@@ -7955,7 +7955,7 @@ var Li = {
|
|
|
7955
7955
|
top: 0,
|
|
7956
7956
|
originX: "left",
|
|
7957
7957
|
originY: "top"
|
|
7958
|
-
},
|
|
7958
|
+
}, zi = class {
|
|
7959
7959
|
constructor({ runtime: e }) {
|
|
7960
7960
|
this.runtime = e;
|
|
7961
7961
|
}
|
|
@@ -8253,7 +8253,7 @@ var Li = {
|
|
|
8253
8253
|
width: Math.max(1, e.width ?? t),
|
|
8254
8254
|
align: n
|
|
8255
8255
|
});
|
|
8256
|
-
return s.set(
|
|
8256
|
+
return s.set(Ri), this.runtime.applyTextUpdates({
|
|
8257
8257
|
textNode: s,
|
|
8258
8258
|
text: r,
|
|
8259
8259
|
textStyle: i,
|
|
@@ -8315,9 +8315,9 @@ var Li = {
|
|
|
8315
8315
|
shouldPreserveCurrentWidth: r
|
|
8316
8316
|
};
|
|
8317
8317
|
}
|
|
8318
|
-
},
|
|
8318
|
+
}, Bi = class {
|
|
8319
8319
|
constructor({ runtime: e }) {
|
|
8320
|
-
this.runtime = e, this.updatePipeline = new
|
|
8320
|
+
this.runtime = e, this.updatePipeline = new zi({ runtime: e });
|
|
8321
8321
|
}
|
|
8322
8322
|
async update({ target: e, presetKey: t, options: n = {} } = {}) {
|
|
8323
8323
|
let r = await this.updatePipeline.prepare({
|
|
@@ -8493,8 +8493,8 @@ var Li = {
|
|
|
8493
8493
|
if (!r) return !1;
|
|
8494
8494
|
let { shape: i, text: a } = J({ group: r });
|
|
8495
8495
|
if (!i || !a) return !1;
|
|
8496
|
-
let o = this.runtime.editor.canvasManager.getObjectPlacement({ object: r }), { currentDimensions: s, manualDimensions: c, replaceBoxDimensions: l } =
|
|
8497
|
-
return
|
|
8496
|
+
let o = this.runtime.editor.canvasManager.getObjectPlacement({ object: r }), { currentDimensions: s, manualDimensions: c, replaceBoxDimensions: l } = Ii({ group: r });
|
|
8497
|
+
return Li({
|
|
8498
8498
|
group: r,
|
|
8499
8499
|
text: a,
|
|
8500
8500
|
textScale: t
|
|
@@ -8563,7 +8563,7 @@ var Li = {
|
|
|
8563
8563
|
}
|
|
8564
8564
|
_applyPreparedTextState({ preparedUpdate: e }) {
|
|
8565
8565
|
let { current: t, text: n } = e;
|
|
8566
|
-
this.runtime.detachShapeGroupAutoLayout({ group: t.group }), t.text.set(
|
|
8566
|
+
this.runtime.detachShapeGroupAutoLayout({ group: t.group }), t.text.set(Ri), this.runtime.applyTextUpdates({
|
|
8567
8567
|
textNode: t.text,
|
|
8568
8568
|
text: n.value,
|
|
8569
8569
|
textStyle: n.style,
|
|
@@ -8617,9 +8617,9 @@ var Li = {
|
|
|
8617
8617
|
let { current: t, next: n, layout: r, placement: i } = e;
|
|
8618
8618
|
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
8619
|
}
|
|
8620
|
-
},
|
|
8620
|
+
}, Vi = class {
|
|
8621
8621
|
constructor({ editor: e }) {
|
|
8622
|
-
this.editor = e, qe(), this.scalingController = new
|
|
8622
|
+
this.editor = e, qe(), this.scalingController = new Jr({ canvas: e.canvas }), this.editingController = new Yr({ canvas: e.canvas }), this.editingPlacements = /* @__PURE__ */ new WeakMap(), this.lifecycleController = new $r({ canvas: e.canvas }), this.layoutController = new Qr({ editor: this.editor }), this.mutationController = new Bi({ runtime: {
|
|
8623
8623
|
editor: this.editor,
|
|
8624
8624
|
lifecycleController: this.lifecycleController,
|
|
8625
8625
|
editingPlacements: this.editingPlacements,
|
|
@@ -8643,7 +8643,7 @@ var Li = {
|
|
|
8643
8643
|
beginMutation: () => this._beginMutation(),
|
|
8644
8644
|
endMutation: (e) => this._endMutation(e),
|
|
8645
8645
|
isOnCanvas: (e) => this._isOnCanvas(e)
|
|
8646
|
-
} }), this.internalTextUpdates = /* @__PURE__ */ new WeakSet(), this.eventController = new
|
|
8646
|
+
} }), this.internalTextUpdates = /* @__PURE__ */ new WeakSet(), this.eventController = new Zr({ runtime: {
|
|
8647
8647
|
editor: this.editor,
|
|
8648
8648
|
scalingController: this.scalingController,
|
|
8649
8649
|
editingController: this.editingController,
|
|
@@ -8890,7 +8890,7 @@ var Li = {
|
|
|
8890
8890
|
padding: h,
|
|
8891
8891
|
style: y,
|
|
8892
8892
|
rounding: b
|
|
8893
|
-
}), x.rehydrateRuntimeState(), ze({ group: x }), Be({ text: i }),
|
|
8893
|
+
}), x.rehydrateRuntimeState(), ze({ group: x }), Be({ text: i }), er({
|
|
8894
8894
|
group: x,
|
|
8895
8895
|
shape: r,
|
|
8896
8896
|
text: i,
|
|
@@ -9177,7 +9177,7 @@ var Li = {
|
|
|
9177
9177
|
}
|
|
9178
9178
|
return null;
|
|
9179
9179
|
}
|
|
9180
|
-
},
|
|
9180
|
+
}, Hi = ({ rootObject: t, enableEvented: n = !0 }) => {
|
|
9181
9181
|
let r = [{
|
|
9182
9182
|
object: t,
|
|
9183
9183
|
enableEvented: n
|
|
@@ -9191,7 +9191,7 @@ var Li = {
|
|
|
9191
9191
|
enableEvented: o
|
|
9192
9192
|
});
|
|
9193
9193
|
}
|
|
9194
|
-
},
|
|
9194
|
+
}, Ui = class {
|
|
9195
9195
|
constructor({ editor: e }) {
|
|
9196
9196
|
this.editor = e, this.clipboard = null;
|
|
9197
9197
|
}
|
|
@@ -9349,7 +9349,7 @@ var Li = {
|
|
|
9349
9349
|
if (!n || n.locked) return !1;
|
|
9350
9350
|
try {
|
|
9351
9351
|
let e = await n.clone(At);
|
|
9352
|
-
return
|
|
9352
|
+
return Hi({ rootObject: e }), e.set({
|
|
9353
9353
|
left: e.left + 10,
|
|
9354
9354
|
top: e.top + 10
|
|
9355
9355
|
}), this._materializeCloneGeometry({ clonedObject: e }), this._addClonedObjectToCanvas(e), t.fire("editor:object-duplicated", {
|
|
@@ -9416,7 +9416,7 @@ var Li = {
|
|
|
9416
9416
|
if (!this.clipboard) return !1;
|
|
9417
9417
|
try {
|
|
9418
9418
|
let t = await this.clipboard.clone(At);
|
|
9419
|
-
return e.discardActiveObject(),
|
|
9419
|
+
return e.discardActiveObject(), Hi({ rootObject: t }), t.set({
|
|
9420
9420
|
left: t.left + 10,
|
|
9421
9421
|
top: t.top + 10
|
|
9422
9422
|
}), this._materializeCloneGeometry({ clonedObject: t }), this._addClonedObjectToCanvas(t), e.fire("editor:object-pasted", {
|
|
@@ -9435,7 +9435,7 @@ var Li = {
|
|
|
9435
9435
|
}), !1;
|
|
9436
9436
|
}
|
|
9437
9437
|
}
|
|
9438
|
-
},
|
|
9438
|
+
}, Wi = class t {
|
|
9439
9439
|
constructor({ editor: e }) {
|
|
9440
9440
|
this.editor = e;
|
|
9441
9441
|
}
|
|
@@ -9500,7 +9500,7 @@ var Li = {
|
|
|
9500
9500
|
!(n instanceof v) || !n.isEditing || n.exitEditing();
|
|
9501
9501
|
}
|
|
9502
9502
|
}
|
|
9503
|
-
},
|
|
9503
|
+
}, Gi = class {
|
|
9504
9504
|
constructor({ editor: e }) {
|
|
9505
9505
|
this.editor = e;
|
|
9506
9506
|
}
|
|
@@ -9566,7 +9566,7 @@ var Li = {
|
|
|
9566
9566
|
i.resumeHistory(), n || i.saveState();
|
|
9567
9567
|
}
|
|
9568
9568
|
}
|
|
9569
|
-
},
|
|
9569
|
+
}, Ki = class t {
|
|
9570
9570
|
constructor({ editor: e }) {
|
|
9571
9571
|
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
9572
|
}
|
|
@@ -9760,7 +9760,7 @@ var Li = {
|
|
|
9760
9760
|
let { options: e } = this.editor, { selectionKey: t } = e;
|
|
9761
9761
|
return t === void 0 ? ["ctrlKey", "metaKey"] : t;
|
|
9762
9762
|
}
|
|
9763
|
-
},
|
|
9763
|
+
}, qi = class e {
|
|
9764
9764
|
constructor({ editor: e }) {
|
|
9765
9765
|
this.editor = e;
|
|
9766
9766
|
}
|
|
@@ -9800,7 +9800,7 @@ var Li = {
|
|
|
9800
9800
|
};
|
|
9801
9801
|
return i.fire("editor:objects-deleted", l), l;
|
|
9802
9802
|
}
|
|
9803
|
-
},
|
|
9803
|
+
}, Ji = {
|
|
9804
9804
|
IMAGE_MANAGER: {
|
|
9805
9805
|
INVALID_CONTENT_TYPE: "INVALID_CONTENT_TYPE",
|
|
9806
9806
|
INVALID_SOURCE_TYPE: "INVALID_SOURCE_TYPE",
|
|
@@ -9838,7 +9838,7 @@ var Li = {
|
|
|
9838
9838
|
INVALID_TARGET: "TEMPLATE_INVALID_TARGET",
|
|
9839
9839
|
APPLY_FAILED: "TEMPLATE_APPLY_FAILED"
|
|
9840
9840
|
}
|
|
9841
|
-
},
|
|
9841
|
+
}, Yi = class e {
|
|
9842
9842
|
constructor({ editor: e }) {
|
|
9843
9843
|
this._buffer = [], this.editor = e;
|
|
9844
9844
|
}
|
|
@@ -9896,9 +9896,9 @@ var Li = {
|
|
|
9896
9896
|
}), this.editor.canvas.fire("editor:warning", s);
|
|
9897
9897
|
}
|
|
9898
9898
|
static isValidErrorCode(e) {
|
|
9899
|
-
return e ? Object.values(
|
|
9899
|
+
return e ? Object.values(Ji).some((t) => Object.values(t).includes(e)) : !1;
|
|
9900
9900
|
}
|
|
9901
|
-
},
|
|
9901
|
+
}, Xi = class {
|
|
9902
9902
|
constructor({ editor: e }) {
|
|
9903
9903
|
this.currentBounds = null, this.editor = e;
|
|
9904
9904
|
}
|
|
@@ -9947,32 +9947,32 @@ var Li = {
|
|
|
9947
9947
|
updateBounds() {
|
|
9948
9948
|
this.currentBounds = this.calculatePanBounds();
|
|
9949
9949
|
}
|
|
9950
|
-
},
|
|
9950
|
+
}, Zi = ({ textbox: e }) => {
|
|
9951
9951
|
if (!e.isEditing) return null;
|
|
9952
9952
|
let t = e.selectionStart ?? 0, n = e.selectionEnd ?? t;
|
|
9953
9953
|
return t === n ? null : {
|
|
9954
9954
|
start: Math.min(t, n),
|
|
9955
9955
|
end: Math.max(t, n)
|
|
9956
9956
|
};
|
|
9957
|
-
},
|
|
9957
|
+
}, Qi = ({ textbox: e }) => {
|
|
9958
9958
|
let t = e.text?.length ?? 0;
|
|
9959
9959
|
return t <= 0 ? null : {
|
|
9960
9960
|
start: 0,
|
|
9961
9961
|
end: t
|
|
9962
9962
|
};
|
|
9963
|
-
},
|
|
9963
|
+
}, $i = ({ textbox: e, range: t }) => {
|
|
9964
9964
|
if (!t) return !1;
|
|
9965
9965
|
let n = e.text?.length ?? 0;
|
|
9966
9966
|
return n <= 0 ? !1 : t.start <= 0 && t.end >= n;
|
|
9967
|
-
},
|
|
9967
|
+
}, ea = ({ textbox: e, styles: t, range: n }) => {
|
|
9968
9968
|
if (!t || !Object.keys(t).length) return !1;
|
|
9969
9969
|
let { start: r, end: i } = n;
|
|
9970
9970
|
return i <= r ? !1 : (e.setSelectionStyles(t, r, i), !0);
|
|
9971
|
-
},
|
|
9971
|
+
}, ta = ({ textbox: e, range: t, property: n }) => {
|
|
9972
9972
|
if (!t) return;
|
|
9973
9973
|
let r = e.getSelectionStyles(t.start, t.end, !0);
|
|
9974
9974
|
if (r.length) return r[0]?.[n];
|
|
9975
|
-
},
|
|
9975
|
+
}, na = ({ strokeColor: e, width: t }) => t <= 0 ? null : e ?? "#000000", ra = ({ width: e = 0 }) => e ? Math.max(0, e) : 0, ia = ({ value: e }) => typeof e == "string" ? e.toLocaleUpperCase() : "", aa = ({ value: e, min: t, max: n }) => Math.min(Math.max(e, t), n), oa = class e extends v {
|
|
9976
9976
|
static {
|
|
9977
9977
|
this.type = "background-textbox";
|
|
9978
9978
|
}
|
|
@@ -10009,7 +10009,7 @@ var Li = {
|
|
|
10009
10009
|
];
|
|
10010
10010
|
}
|
|
10011
10011
|
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,
|
|
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, Si({ textbox: this })) {
|
|
10013
10013
|
this.initDimensions(), this.dirty = !0;
|
|
10014
10014
|
return;
|
|
10015
10015
|
}
|
|
@@ -10048,7 +10048,7 @@ var Li = {
|
|
|
10048
10048
|
});
|
|
10049
10049
|
}
|
|
10050
10050
|
toObject(e = []) {
|
|
10051
|
-
let t = super.toObject(e), { lineFontDefaults: n, styles: r } =
|
|
10051
|
+
let t = super.toObject(e), { lineFontDefaults: n, styles: r } = bi({ textbox: this });
|
|
10052
10052
|
return {
|
|
10053
10053
|
...t,
|
|
10054
10054
|
backgroundOpacity: this.backgroundOpacity,
|
|
@@ -10116,7 +10116,7 @@ var Li = {
|
|
|
10116
10116
|
this._removeShadow(e);
|
|
10117
10117
|
}
|
|
10118
10118
|
_getDecorationColorAt(e, t) {
|
|
10119
|
-
let n = this.getValueOfPropertyAt(e, t, "strokeWidth"), r =
|
|
10119
|
+
let n = this.getValueOfPropertyAt(e, t, "strokeWidth"), r = ra({ width: typeof n == "number" && Number.isFinite(n) ? n : 0 }), i = this.getValueOfPropertyAt(e, t, "stroke"), a = i == null ? null : na({
|
|
10120
10120
|
strokeColor: i,
|
|
10121
10121
|
width: r
|
|
10122
10122
|
});
|
|
@@ -10132,22 +10132,22 @@ var Li = {
|
|
|
10132
10132
|
_getCornerRadii({ width: e, height: t }) {
|
|
10133
10133
|
let n = e / 2, r = t / 2, i = Math.min(n, r);
|
|
10134
10134
|
return {
|
|
10135
|
-
bottomLeft:
|
|
10135
|
+
bottomLeft: aa({
|
|
10136
10136
|
value: this.radiusBottomLeft ?? 0,
|
|
10137
10137
|
min: 0,
|
|
10138
10138
|
max: i
|
|
10139
10139
|
}),
|
|
10140
|
-
bottomRight:
|
|
10140
|
+
bottomRight: aa({
|
|
10141
10141
|
value: this.radiusBottomRight ?? 0,
|
|
10142
10142
|
min: 0,
|
|
10143
10143
|
max: i
|
|
10144
10144
|
}),
|
|
10145
|
-
topLeft:
|
|
10145
|
+
topLeft: aa({
|
|
10146
10146
|
value: this.radiusTopLeft ?? 0,
|
|
10147
10147
|
min: 0,
|
|
10148
10148
|
max: i
|
|
10149
10149
|
}),
|
|
10150
|
-
topRight:
|
|
10150
|
+
topRight: aa({
|
|
10151
10151
|
value: this.radiusTopRight ?? 0,
|
|
10152
10152
|
min: 0,
|
|
10153
10153
|
max: i
|
|
@@ -10165,7 +10165,7 @@ var Li = {
|
|
|
10165
10165
|
_getEffectiveBackgroundFill() {
|
|
10166
10166
|
let e = this.backgroundColor;
|
|
10167
10167
|
if (!e) return null;
|
|
10168
|
-
let t =
|
|
10168
|
+
let t = aa({
|
|
10169
10169
|
value: this.backgroundOpacity ?? 1,
|
|
10170
10170
|
min: 0,
|
|
10171
10171
|
max: 1
|
|
@@ -10178,19 +10178,19 @@ var Li = {
|
|
|
10178
10178
|
return r.setAlpha(t), r.toRgba();
|
|
10179
10179
|
}
|
|
10180
10180
|
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 =
|
|
10181
|
+
let o = n + a, s = i + t, { topLeft: c, topRight: l, bottomRight: u, bottomLeft: d } = r, f = aa({
|
|
10182
10182
|
value: c,
|
|
10183
10183
|
min: 0,
|
|
10184
10184
|
max: a
|
|
10185
|
-
}), p =
|
|
10185
|
+
}), p = aa({
|
|
10186
10186
|
value: l,
|
|
10187
10187
|
min: 0,
|
|
10188
10188
|
max: a
|
|
10189
|
-
}), m =
|
|
10189
|
+
}), m = aa({
|
|
10190
10190
|
value: u,
|
|
10191
10191
|
min: 0,
|
|
10192
10192
|
max: a
|
|
10193
|
-
}), h =
|
|
10193
|
+
}), h = aa({
|
|
10194
10194
|
value: d,
|
|
10195
10195
|
min: 0,
|
|
10196
10196
|
max: a
|
|
@@ -10201,9 +10201,9 @@ var Li = {
|
|
|
10201
10201
|
let { width: e = 0, height: t = 0 } = this, n = Math.round(e), r = Math.round(t);
|
|
10202
10202
|
n !== e && (this.width = Math.max(0, n)), r !== t && (this.height = Math.max(0, r));
|
|
10203
10203
|
}
|
|
10204
|
-
},
|
|
10205
|
-
b?.setClass && b.setClass(
|
|
10206
|
-
},
|
|
10204
|
+
}, sa = () => {
|
|
10205
|
+
b?.setClass && b.setClass(oa, "background-textbox");
|
|
10206
|
+
}, ca = class {
|
|
10207
10207
|
constructor({ runtime: e }) {
|
|
10208
10208
|
this.runtime = e;
|
|
10209
10209
|
}
|
|
@@ -10267,16 +10267,16 @@ var Li = {
|
|
|
10267
10267
|
};
|
|
10268
10268
|
}
|
|
10269
10269
|
_createSelectionContext({ textbox: e, currentText: t, selectionRangeOverride: n }) {
|
|
10270
|
-
let r = n === void 0 ?
|
|
10270
|
+
let r = n === void 0 ? Zi({ textbox: e }) : ni({
|
|
10271
10271
|
text: t,
|
|
10272
10272
|
range: n
|
|
10273
|
-
}), i = r ?
|
|
10273
|
+
}), i = r ? ri({
|
|
10274
10274
|
textbox: e,
|
|
10275
10275
|
range: r
|
|
10276
|
-
}) : null, a =
|
|
10276
|
+
}) : null, a = $i({
|
|
10277
10277
|
textbox: e,
|
|
10278
10278
|
range: r
|
|
10279
|
-
}), o =
|
|
10279
|
+
}), o = $i({
|
|
10280
10280
|
textbox: e,
|
|
10281
10281
|
range: i
|
|
10282
10282
|
}), s = !r || a;
|
|
@@ -10364,17 +10364,17 @@ var Li = {
|
|
|
10364
10364
|
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
10365
|
}
|
|
10366
10366
|
_resolveStrokeUpdate({ textbox: e, selectionRange: t, strokeColor: n, strokeWidth: r }) {
|
|
10367
|
-
let i = t ?
|
|
10367
|
+
let i = t ? ta({
|
|
10368
10368
|
textbox: e,
|
|
10369
10369
|
range: t,
|
|
10370
10370
|
property: "strokeWidth"
|
|
10371
|
-
}) : void 0, a = t ?
|
|
10371
|
+
}) : void 0, a = t ? ta({
|
|
10372
10372
|
textbox: e,
|
|
10373
10373
|
range: t,
|
|
10374
10374
|
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 =
|
|
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 = ra({ width: r ?? o ?? e.strokeWidth ?? 0 });
|
|
10376
10376
|
return {
|
|
10377
|
-
stroke:
|
|
10377
|
+
stroke: na({
|
|
10378
10378
|
strokeColor: n ?? s ?? c,
|
|
10379
10379
|
width: l
|
|
10380
10380
|
}) ?? null,
|
|
@@ -10386,14 +10386,14 @@ var Li = {
|
|
|
10386
10386
|
}
|
|
10387
10387
|
_applyTextContentUpdate({ textbox: e, style: t, updates: n, currentText: r }) {
|
|
10388
10388
|
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 ?
|
|
10389
|
+
return o || l ? (n.text = c ? ia({ value: s }) : s, e.textCaseRaw = s) : e.textCaseRaw === void 0 && (e.textCaseRaw = i), e.uppercase = c, {
|
|
10390
10390
|
hasTextUpdate: o,
|
|
10391
10391
|
uppercaseChanged: l,
|
|
10392
10392
|
previousRenderedText: u
|
|
10393
10393
|
};
|
|
10394
10394
|
}
|
|
10395
10395
|
_resolveContentPlacement({ textbox: e, style: t, updates: n, placement: r, styleMaps: i, contentUpdate: a }) {
|
|
10396
|
-
let o =
|
|
10396
|
+
let o = Ai({ stylesList: [
|
|
10397
10397
|
n,
|
|
10398
10398
|
i.selectionStyles,
|
|
10399
10399
|
i.lineSelectionStyles,
|
|
@@ -10409,7 +10409,7 @@ var Li = {
|
|
|
10409
10409
|
t.paddingBottom,
|
|
10410
10410
|
t.paddingLeft
|
|
10411
10411
|
].some((e) => e !== void 0), l = Object.prototype.hasOwnProperty.call(n, "width");
|
|
10412
|
-
return c && !s && !a.hasTextUpdate && !a.uppercaseChanged && !o && !l ?
|
|
10412
|
+
return c && !s && !a.hasTextUpdate && !a.uppercaseChanged && !o && !l ? Di({
|
|
10413
10413
|
textbox: e,
|
|
10414
10414
|
originX: r.originX,
|
|
10415
10415
|
originY: r.originY
|
|
@@ -10442,24 +10442,24 @@ var Li = {
|
|
|
10442
10442
|
}
|
|
10443
10443
|
_applyWholeTextStyles({ textbox: e, selection: t, styleMaps: n }) {
|
|
10444
10444
|
if (t.selectionRange || Object.keys(n.wholeTextStyles).length === 0) return;
|
|
10445
|
-
let r =
|
|
10446
|
-
r &&
|
|
10445
|
+
let r = Qi({ textbox: e });
|
|
10446
|
+
r && ea({
|
|
10447
10447
|
textbox: e,
|
|
10448
10448
|
styles: n.wholeTextStyles,
|
|
10449
10449
|
range: r
|
|
10450
|
-
}) && (e.dirty = !0,
|
|
10450
|
+
}) && (e.dirty = !0, Ai({ stylesList: [n.wholeTextStyles] }) && (e.initDimensions(), e.dirty = !0));
|
|
10451
10451
|
}
|
|
10452
10452
|
_applySelectionStyles({ textbox: e, selection: t, styleMaps: n }) {
|
|
10453
10453
|
if (!t.selectionRange) return;
|
|
10454
|
-
let r =
|
|
10454
|
+
let r = ea({
|
|
10455
10455
|
textbox: e,
|
|
10456
10456
|
styles: n.selectionStyles,
|
|
10457
10457
|
range: t.selectionRange
|
|
10458
|
-
}), i = t.fontSelectionRange ?
|
|
10458
|
+
}), i = t.fontSelectionRange ? ea({
|
|
10459
10459
|
textbox: e,
|
|
10460
10460
|
styles: n.lineSelectionStyles,
|
|
10461
10461
|
range: t.fontSelectionRange
|
|
10462
|
-
}) : !1, a =
|
|
10462
|
+
}) : !1, a = Ai({ stylesList: [
|
|
10463
10463
|
n.selectionStyles,
|
|
10464
10464
|
n.lineSelectionStyles,
|
|
10465
10465
|
n.wholeTextStyles
|
|
@@ -10481,9 +10481,9 @@ var Li = {
|
|
|
10481
10481
|
_applyFontLineDefaultUpdates({ textbox: e, style: t, selection: n }) {
|
|
10482
10482
|
if (!n.fontSelectionRange || t.fontFamily === void 0 && t.fontSize === void 0) return;
|
|
10483
10483
|
let r = {};
|
|
10484
|
-
t.fontFamily !== void 0 && (r.fontFamily = t.fontFamily), t.fontSize !== void 0 && (r.fontSize = t.fontSize),
|
|
10484
|
+
t.fontFamily !== void 0 && (r.fontFamily = t.fontFamily), t.fontSize !== void 0 && (r.fontSize = t.fontSize), pi({
|
|
10485
10485
|
textbox: e,
|
|
10486
|
-
lineIndices:
|
|
10486
|
+
lineIndices: ii({
|
|
10487
10487
|
textbox: e,
|
|
10488
10488
|
range: n.fontSelectionRange
|
|
10489
10489
|
}),
|
|
@@ -10493,9 +10493,9 @@ var Li = {
|
|
|
10493
10493
|
_applyDecorationLineDefaultUpdates({ textbox: e, style: t, selection: n, styleMaps: r }) {
|
|
10494
10494
|
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
10495
|
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)),
|
|
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)), pi({
|
|
10497
10497
|
textbox: e,
|
|
10498
|
-
lineIndices:
|
|
10498
|
+
lineIndices: ai({
|
|
10499
10499
|
textbox: e,
|
|
10500
10500
|
range: n.selectionRange
|
|
10501
10501
|
}),
|
|
@@ -10541,7 +10541,7 @@ var Li = {
|
|
|
10541
10541
|
].some((e) => e !== void 0);
|
|
10542
10542
|
}
|
|
10543
10543
|
_resolveShouldAutoExpand({ textbox: e, style: t, styleMaps: n, contentUpdate: r }) {
|
|
10544
|
-
let i = t.autoExpand ?? e.autoExpand, a =
|
|
10544
|
+
let i = t.autoExpand ?? e.autoExpand, a = Ai({ stylesList: [
|
|
10545
10545
|
n.updates,
|
|
10546
10546
|
n.selectionStyles,
|
|
10547
10547
|
n.lineSelectionStyles,
|
|
@@ -10586,18 +10586,18 @@ var Li = {
|
|
|
10586
10586
|
};
|
|
10587
10587
|
this.runtime.canvas.fire("editor:text-updated", m);
|
|
10588
10588
|
}
|
|
10589
|
-
},
|
|
10589
|
+
}, la = ({ transform: e }) => {
|
|
10590
10590
|
let { corner: t = "", action: n = "" } = e;
|
|
10591
10591
|
return {
|
|
10592
10592
|
isCornerHandle: t === "tl" || t === "tr" || t === "bl" || t === "br" || n === "scale",
|
|
10593
10593
|
isHorizontalHandle: t === "ml" || t === "mr" || n === "scaleX",
|
|
10594
10594
|
isVerticalHandle: t === "mt" || t === "mb" || n === "scaleY"
|
|
10595
10595
|
};
|
|
10596
|
-
},
|
|
10596
|
+
}, ua = ({ textbox: e, transform: t, appliedWidth: n }) => {
|
|
10597
10597
|
t.scaleX = 1, t.scaleY = 1;
|
|
10598
10598
|
let r = t.original;
|
|
10599
10599
|
r && (r.scaleX = 1, r.scaleY = 1, r.width = n, r.height = e.height, r.left = e.left, r.top = e.top);
|
|
10600
|
-
},
|
|
10600
|
+
}, da = ({ textbox: e, transform: t, scenePoint: n }) => {
|
|
10601
10601
|
let { x: r, y: i } = e._getTransformedDimensions();
|
|
10602
10602
|
if (r <= 0 || i <= 0) return null;
|
|
10603
10603
|
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 +10607,27 @@ var Li = {
|
|
|
10607
10607
|
stepScaleX: l,
|
|
10608
10608
|
stepScaleY: u
|
|
10609
10609
|
};
|
|
10610
|
-
},
|
|
10611
|
-
function
|
|
10610
|
+
}, fa = 1e-4;
|
|
10611
|
+
function pa(e) {
|
|
10612
10612
|
return !!e && e instanceof v;
|
|
10613
10613
|
}
|
|
10614
|
-
function
|
|
10615
|
-
if (!
|
|
10614
|
+
function ma(e) {
|
|
10615
|
+
if (!pa(e)) return !1;
|
|
10616
10616
|
let t = e.group;
|
|
10617
10617
|
return e.shapeNodeType === "text" && t?.shapeComposite === !0;
|
|
10618
10618
|
}
|
|
10619
|
-
var
|
|
10619
|
+
var ha = class {
|
|
10620
10620
|
constructor({ canvas: t, canvasManager: n, persistScaledTextbox: r }) {
|
|
10621
10621
|
this.handleMouseMove = (e) => {
|
|
10622
10622
|
let t = this.canvas._currentTransform;
|
|
10623
10623
|
if (!t) return;
|
|
10624
10624
|
let { target: n } = t;
|
|
10625
|
-
if (!
|
|
10625
|
+
if (!pa(n) || ma(n)) return;
|
|
10626
10626
|
let r = this.scalingState.get(n);
|
|
10627
10627
|
if (!r || !e.e) return;
|
|
10628
|
-
let { isCornerHandle: i, isHorizontalHandle: a, isVerticalHandle: o } =
|
|
10628
|
+
let { isCornerHandle: i, isHorizontalHandle: a, isVerticalHandle: o } = la({ transform: t });
|
|
10629
10629
|
if (!a && !o && !i) return;
|
|
10630
|
-
let s =
|
|
10630
|
+
let s = da({
|
|
10631
10631
|
textbox: n,
|
|
10632
10632
|
transform: t,
|
|
10633
10633
|
scenePoint: this.canvas.getScenePoint(e.e)
|
|
@@ -10650,20 +10650,20 @@ var ma = class {
|
|
|
10650
10650
|
}, j = r.lastAllowedScaleX, M = r.lastAllowedScaleY;
|
|
10651
10651
|
if (i) {
|
|
10652
10652
|
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) <=
|
|
10653
|
+
if (Math.abs(t - r.lastAllowedScaleX) <= fa) return;
|
|
10654
10654
|
j = t, M = t;
|
|
10655
10655
|
} else {
|
|
10656
10656
|
if (a) {
|
|
10657
10657
|
let e = r.lastAllowedScaleX * u, t = c ? r.minimumWidthScale : Math.max(r.minimumWidthScale, e);
|
|
10658
|
-
Math.abs(t - r.lastAllowedScaleX) >
|
|
10658
|
+
Math.abs(t - r.lastAllowedScaleX) > fa && (j = t);
|
|
10659
10659
|
}
|
|
10660
10660
|
if (o) {
|
|
10661
10661
|
let e = r.lastAllowedScaleY * d, t = l ? r.minimumFontScale : Math.max(r.minimumFontScale, e);
|
|
10662
|
-
Math.abs(t - r.lastAllowedScaleY) >
|
|
10662
|
+
Math.abs(t - r.lastAllowedScaleY) > fa && (M = t);
|
|
10663
10663
|
}
|
|
10664
|
-
if (Math.abs(j - r.lastAllowedScaleX) <=
|
|
10664
|
+
if (Math.abs(j - r.lastAllowedScaleX) <= fa && Math.abs(M - r.lastAllowedScaleY) <= fa) return;
|
|
10665
10665
|
}
|
|
10666
|
-
let { appliedWidth: N, dimensionsRounded: P } =
|
|
10666
|
+
let { appliedWidth: N, dimensionsRounded: P } = Fi({
|
|
10667
10667
|
textbox: n,
|
|
10668
10668
|
canvasManager: this.canvasManager,
|
|
10669
10669
|
base: r.startBase,
|
|
@@ -10677,7 +10677,7 @@ var ma = class {
|
|
|
10677
10677
|
shouldDisableAutoExpandOnHorizontalChange: a,
|
|
10678
10678
|
shouldRoundDimensions: !i
|
|
10679
10679
|
});
|
|
10680
|
-
|
|
10680
|
+
ua({
|
|
10681
10681
|
textbox: n,
|
|
10682
10682
|
transform: t,
|
|
10683
10683
|
appliedWidth: N
|
|
@@ -10698,12 +10698,12 @@ var ma = class {
|
|
|
10698
10698
|
}), this.canvas.requestRenderAll();
|
|
10699
10699
|
}, this.handleObjectScaling = (t) => {
|
|
10700
10700
|
let { target: n, transform: r } = t;
|
|
10701
|
-
if (n instanceof e || !
|
|
10701
|
+
if (n instanceof e || !pa(n) || ma(n) || !r) return;
|
|
10702
10702
|
n.isScaling = !0;
|
|
10703
10703
|
let i = this._ensureScalingState({
|
|
10704
10704
|
textbox: n,
|
|
10705
10705
|
transform: r
|
|
10706
|
-
}), { startBase: a } = i, { width: o, fontSize: s } = a, { isCornerHandle: c, isHorizontalHandle: l, isVerticalHandle: u } =
|
|
10706
|
+
}), { startBase: a } = i, { width: o, fontSize: s } = a, { isCornerHandle: c, isHorizontalHandle: l, isVerticalHandle: u } = la({ transform: r }), d = r.corner ?? "", f = c || u;
|
|
10707
10707
|
if (!l && !u && !c) return;
|
|
10708
10708
|
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
10709
|
object: n,
|
|
@@ -10718,7 +10718,7 @@ var ma = class {
|
|
|
10718
10718
|
N = e, P = e;
|
|
10719
10719
|
}
|
|
10720
10720
|
} 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 } =
|
|
10721
|
+
let { appliedWidth: ee, dimensionsRounded: te } = Fi({
|
|
10722
10722
|
textbox: n,
|
|
10723
10723
|
canvasManager: this.canvasManager,
|
|
10724
10724
|
base: a,
|
|
@@ -10732,7 +10732,7 @@ var ma = class {
|
|
|
10732
10732
|
shouldDisableAutoExpandOnHorizontalChange: l,
|
|
10733
10733
|
shouldRoundDimensions: !c
|
|
10734
10734
|
});
|
|
10735
|
-
|
|
10735
|
+
ua({
|
|
10736
10736
|
textbox: n,
|
|
10737
10737
|
transform: r,
|
|
10738
10738
|
appliedWidth: ee
|
|
@@ -10765,7 +10765,7 @@ var ma = class {
|
|
|
10765
10765
|
let { target: n } = t;
|
|
10766
10766
|
if (n instanceof e) {
|
|
10767
10767
|
let t = n.getObjects();
|
|
10768
|
-
if (!t.some((e) =>
|
|
10768
|
+
if (!t.some((e) => pa(e))) return;
|
|
10769
10769
|
let { scaleX: r = 1, scaleY: i = 1 } = n;
|
|
10770
10770
|
if (Math.abs(r - 1) < .01 && Math.abs(i - 1) < .01) return;
|
|
10771
10771
|
this.canvas.discardActiveObject(), t.forEach((e) => {
|
|
@@ -10775,7 +10775,7 @@ var ma = class {
|
|
|
10775
10775
|
this.canvas.setActiveObject(a), this.canvas.requestRenderAll();
|
|
10776
10776
|
return;
|
|
10777
10777
|
}
|
|
10778
|
-
if (!
|
|
10778
|
+
if (!pa(n) || ma(n)) return;
|
|
10779
10779
|
n.isScaling = !1;
|
|
10780
10780
|
let r = this.scalingState.get(n);
|
|
10781
10781
|
if (this.scalingState.delete(n), !r?.hasScalingChange) return;
|
|
@@ -10800,11 +10800,11 @@ var ma = class {
|
|
|
10800
10800
|
}, this.canvas = t, this.canvasManager = n, this.persistScaledTextbox = r, this.scalingState = /* @__PURE__ */ new WeakMap();
|
|
10801
10801
|
}
|
|
10802
10802
|
commitStandaloneTextScale({ target: e, shouldDisableAutoExpandOnHorizontalChange: t = !1 }) {
|
|
10803
|
-
if (!
|
|
10803
|
+
if (!pa(e) || ma(e)) return !1;
|
|
10804
10804
|
let n = Math.abs(e.scaleX ?? 1) || 1, r = Math.abs(e.scaleY ?? 1) || 1;
|
|
10805
10805
|
if (!(Math.abs(n - 1) > .01 || Math.abs(r - 1) > .01)) return !1;
|
|
10806
|
-
let i =
|
|
10807
|
-
return
|
|
10806
|
+
let i = Mi({ textbox: e }), a = this.canvasManager.getObjectPlacement({ object: e });
|
|
10807
|
+
return Fi({
|
|
10808
10808
|
textbox: e,
|
|
10809
10809
|
canvasManager: this.canvasManager,
|
|
10810
10810
|
base: i,
|
|
@@ -10820,7 +10820,7 @@ var ma = class {
|
|
|
10820
10820
|
_ensureScalingState({ textbox: e, transform: t }) {
|
|
10821
10821
|
let n = this.scalingState.get(e);
|
|
10822
10822
|
if (!n) {
|
|
10823
|
-
let r =
|
|
10823
|
+
let r = Mi({ textbox: e }), i = this.canvasManager.getObjectPlacement({ object: e }), a = Ni({ base: r }), o = t.original?.originX ?? t.originX ?? e.originX ?? "center", s = t.original?.originY ?? t.originY ?? e.originY ?? "center";
|
|
10824
10824
|
n = {
|
|
10825
10825
|
startBase: r,
|
|
10826
10826
|
startObjectPlacement: i,
|
|
@@ -10853,7 +10853,7 @@ var ma = class {
|
|
|
10853
10853
|
topRight: e.radiusTopRight ?? 0,
|
|
10854
10854
|
bottomRight: e.radiusBottomRight ?? 0,
|
|
10855
10855
|
bottomLeft: e.radiusBottomLeft ?? 0
|
|
10856
|
-
}, v = Math.abs(n - o) >
|
|
10856
|
+
}, v = Math.abs(n - o) > ei, y = Math.abs(h - r) > ei, 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
10857
|
if (c) {
|
|
10858
10858
|
let e = h / Math.max(1, m);
|
|
10859
10859
|
S = e, C = e;
|
|
@@ -10874,7 +10874,7 @@ var ma = class {
|
|
|
10874
10874
|
originY: a
|
|
10875
10875
|
});
|
|
10876
10876
|
}
|
|
10877
|
-
},
|
|
10877
|
+
}, ga = class e {
|
|
10878
10878
|
constructor({ editor: t }) {
|
|
10879
10879
|
this._handleTextEditingEntered = (t) => {
|
|
10880
10880
|
this.isTextEditingActive = !0;
|
|
@@ -10887,7 +10887,7 @@ var ma = class {
|
|
|
10887
10887
|
if (!e._isTextbox(n)) return;
|
|
10888
10888
|
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
10889
|
if (s) {
|
|
10890
|
-
let e =
|
|
10890
|
+
let e = ia({ value: l });
|
|
10891
10891
|
e !== i && n.set({ text: e }), n.textCaseRaw = l;
|
|
10892
10892
|
} else n.textCaseRaw = i;
|
|
10893
10893
|
if (!r && o === void 0 && (n.autoExpand = !0), r) {
|
|
@@ -10905,7 +10905,7 @@ var ma = class {
|
|
|
10905
10905
|
let r = e._isShapeOwnedTextbox(n);
|
|
10906
10906
|
this.editingPlacementState?.delete(n), delete n.__lineDefaultsPrevText;
|
|
10907
10907
|
let i = n.text ?? "";
|
|
10908
|
-
n.uppercase ? n.textCaseRaw = n.textCaseRaw ?? i.toLocaleLowerCase() : n.textCaseRaw = i, r || (
|
|
10908
|
+
n.uppercase ? n.textCaseRaw = n.textCaseRaw ?? i.toLocaleLowerCase() : n.textCaseRaw = i, r || (ji({ textbox: n }) && (n.setCoords(), n.dirty = !0, this.canvas.requestRenderAll()), n.locked || n.set({
|
|
10909
10909
|
lockMovementX: !1,
|
|
10910
10910
|
lockMovementY: !1
|
|
10911
10911
|
}));
|
|
@@ -10932,7 +10932,7 @@ var ma = class {
|
|
|
10932
10932
|
transform: r,
|
|
10933
10933
|
event: i ?? null
|
|
10934
10934
|
});
|
|
10935
|
-
}, this.editor = t, this.canvas = t.canvas, this.fonts = t.options.fonts ?? [], this.scalingController = new
|
|
10935
|
+
}, this.editor = t, this.canvas = t.canvas, this.fonts = t.options.fonts ?? [], this.scalingController = new ha({
|
|
10936
10936
|
canvas: t.canvas,
|
|
10937
10937
|
canvasManager: t.canvasManager,
|
|
10938
10938
|
persistScaledTextbox: ({ target: e, style: t }) => {
|
|
@@ -10941,7 +10941,7 @@ var ma = class {
|
|
|
10941
10941
|
style: t
|
|
10942
10942
|
});
|
|
10943
10943
|
}
|
|
10944
|
-
}), this.updateController = new
|
|
10944
|
+
}), this.updateController = new ca({ runtime: {
|
|
10945
10945
|
canvas: this.canvas,
|
|
10946
10946
|
canvasManager: t.canvasManager,
|
|
10947
10947
|
historyManager: t.historyManager,
|
|
@@ -10950,12 +10950,12 @@ var ma = class {
|
|
|
10950
10950
|
restoreTextboxContentPlacement: (e) => this._restoreTextboxContentPlacement(e),
|
|
10951
10951
|
syncLineStylesWithText: (e) => this._syncLineStylesWithText(e),
|
|
10952
10952
|
getSnapshot: (t) => e._getSnapshot(t)
|
|
10953
|
-
} }), this.editingPlacementState = /* @__PURE__ */ new WeakMap(), this.isTextEditingActive = !1, this._bindEvents(),
|
|
10953
|
+
} }), this.editingPlacementState = /* @__PURE__ */ new WeakMap(), this.isTextEditingActive = !1, this._bindEvents(), sa();
|
|
10954
10954
|
}
|
|
10955
10955
|
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
10956
|
let { canvasManager: M, historyManager: N } = this.editor, { canvas: P } = this;
|
|
10957
10957
|
N.suspendHistory();
|
|
10958
|
-
let F = i ?? this._getDefaultFontFamily(), I =
|
|
10958
|
+
let F = i ?? this._getDefaultFontFamily(), I = ra({ width: m }), ee = na({
|
|
10959
10959
|
strokeColor: p,
|
|
10960
10960
|
width: I
|
|
10961
10961
|
}), te = {
|
|
@@ -10984,14 +10984,14 @@ var ma = class {
|
|
|
10984
10984
|
radiusBottomRight: w,
|
|
10985
10985
|
radiusBottomLeft: T,
|
|
10986
10986
|
...E
|
|
10987
|
-
}, L = new
|
|
10987
|
+
}, L = new oa(n, te), ne = r !== !1;
|
|
10988
10988
|
L.autoExpand = ne;
|
|
10989
10989
|
let re = E.left !== void 0 || E.top !== void 0;
|
|
10990
10990
|
if (L.textCaseRaw = L.text ?? "", l) {
|
|
10991
|
-
let e =
|
|
10991
|
+
let e = ia({ value: L.textCaseRaw });
|
|
10992
10992
|
e !== L.text && L.set({ text: e });
|
|
10993
10993
|
}
|
|
10994
|
-
|
|
10994
|
+
ji({ textbox: L }) && (L.dirty = !0);
|
|
10995
10995
|
let ie;
|
|
10996
10996
|
re && (ie = M.resolveObjectPlacement({
|
|
10997
10997
|
object: L,
|
|
@@ -11096,7 +11096,7 @@ var ma = class {
|
|
|
11096
11096
|
clampToMontage: r
|
|
11097
11097
|
}));
|
|
11098
11098
|
let a = !1;
|
|
11099
|
-
i || (a =
|
|
11099
|
+
i || (a = ji({ textbox: e }));
|
|
11100
11100
|
let o = !1;
|
|
11101
11101
|
return !i && t && (this.editor.canvasManager.applyObjectPlacement({
|
|
11102
11102
|
object: e,
|
|
@@ -11104,7 +11104,7 @@ var ma = class {
|
|
|
11104
11104
|
}), o = !0), (i || a) && (e.dirty = !0), (i || a || o) && e.setCoords(), i || a;
|
|
11105
11105
|
}
|
|
11106
11106
|
_restoreTextboxContentPlacement({ textbox: e, contentPlacement: t }) {
|
|
11107
|
-
let n =
|
|
11107
|
+
let n = Di({
|
|
11108
11108
|
textbox: e,
|
|
11109
11109
|
originX: t.originX,
|
|
11110
11110
|
originY: t.originY
|
|
@@ -11122,7 +11122,7 @@ var ma = class {
|
|
|
11122
11122
|
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
11123
|
}
|
|
11124
11124
|
_syncLineStylesWithText({ textbox: e, previousText: t, currentText: n }) {
|
|
11125
|
-
let r = n ?? e.text ?? "", i =
|
|
11125
|
+
let r = n ?? e.text ?? "", i = xi({
|
|
11126
11126
|
textbox: e,
|
|
11127
11127
|
previousText: t ?? e.__lineDefaultsPrevText ?? r,
|
|
11128
11128
|
currentText: r
|
|
@@ -11140,16 +11140,16 @@ var ma = class {
|
|
|
11140
11140
|
if (!Number.isFinite(f) || f <= 0) return !1;
|
|
11141
11141
|
let p = a.split("\n").length, m = !1;
|
|
11142
11142
|
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(
|
|
11143
|
+
let { textLines: h } = e, g = Array.isArray(h) && h.length > p, _ = Math.ceil(Ti({
|
|
11144
11144
|
textbox: e,
|
|
11145
11145
|
text: a
|
|
11146
11146
|
})), 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),
|
|
11147
|
+
g && (y = f), Math.abs((e.width ?? 0) - y) > .01 && (e.set({ width: y }), e.initDimensions(), m = !0), ji({ textbox: e }) && (m = !0), t && r.applyObjectPlacement({
|
|
11148
11148
|
object: e,
|
|
11149
11149
|
placement: t
|
|
11150
11150
|
});
|
|
11151
11151
|
let b = !1;
|
|
11152
|
-
return n && (b =
|
|
11152
|
+
return n && (b = Oi({
|
|
11153
11153
|
textbox: e,
|
|
11154
11154
|
montageLeft: o,
|
|
11155
11155
|
montageRight: o + s
|
|
@@ -11207,7 +11207,7 @@ var ma = class {
|
|
|
11207
11207
|
_getDefaultFontFamily() {
|
|
11208
11208
|
return this.fonts[0]?.family ?? "Arial";
|
|
11209
11209
|
}
|
|
11210
|
-
},
|
|
11210
|
+
}, _a = ({ x1: e, y1: t, x2: n, y2: r }) => (Math.atan2(r - t, n - e) * 180 / Math.PI + 360) % 360, va = (e) => {
|
|
11211
11211
|
if (!e || typeof e != "object") return null;
|
|
11212
11212
|
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
11213
|
color: typeof e.color == "string" ? e.color : "#000000",
|
|
@@ -11218,7 +11218,7 @@ var ma = class {
|
|
|
11218
11218
|
let { x1: e, y1: t, x2: r, y2: i } = n;
|
|
11219
11219
|
if (typeof e == "number" && typeof t == "number" && typeof r == "number" && typeof i == "number") return {
|
|
11220
11220
|
type: "linear",
|
|
11221
|
-
angle:
|
|
11221
|
+
angle: _a({
|
|
11222
11222
|
x1: e,
|
|
11223
11223
|
y1: t,
|
|
11224
11224
|
x2: r,
|
|
@@ -11246,7 +11246,7 @@ var ma = class {
|
|
|
11246
11246
|
};
|
|
11247
11247
|
}
|
|
11248
11248
|
return null;
|
|
11249
|
-
},
|
|
11249
|
+
}, ya = "_templateAnchorX", ba = "_templateAnchorY", xa = class t {
|
|
11250
11250
|
constructor({ editor: e }) {
|
|
11251
11251
|
this.editor = e;
|
|
11252
11252
|
}
|
|
@@ -11255,7 +11255,7 @@ var ma = class {
|
|
|
11255
11255
|
if (!p.length) return s.emitWarning({
|
|
11256
11256
|
origin: "TemplateManager",
|
|
11257
11257
|
method: "serializeSelection",
|
|
11258
|
-
code:
|
|
11258
|
+
code: Ji.TEMPLATE_MANAGER.NO_OBJECTS_SELECTED,
|
|
11259
11259
|
message: "Нет объектов для сериализации шаблона"
|
|
11260
11260
|
}), null;
|
|
11261
11261
|
let m = t._getBounds(o), h = t._getMontageSize({
|
|
@@ -11284,14 +11284,14 @@ var ma = class {
|
|
|
11284
11284
|
if (!l?.length) return a.emitWarning({
|
|
11285
11285
|
origin: "TemplateManager",
|
|
11286
11286
|
method: "applyTemplate",
|
|
11287
|
-
code:
|
|
11287
|
+
code: Ji.TEMPLATE_MANAGER.INVALID_TEMPLATE,
|
|
11288
11288
|
message: "Шаблон не содержит объектов"
|
|
11289
11289
|
}), null;
|
|
11290
11290
|
let f = t._getBounds(r);
|
|
11291
11291
|
if (!f) return a.emitWarning({
|
|
11292
11292
|
origin: "TemplateManager",
|
|
11293
11293
|
method: "applyTemplate",
|
|
11294
|
-
code:
|
|
11294
|
+
code: Ji.TEMPLATE_MANAGER.INVALID_TARGET,
|
|
11295
11295
|
message: "Не удалось определить границы монтажной области"
|
|
11296
11296
|
}), null;
|
|
11297
11297
|
let p = t._getMontageSize({
|
|
@@ -11310,7 +11310,7 @@ var ma = class {
|
|
|
11310
11310
|
if (!r.length) return a.emitWarning({
|
|
11311
11311
|
origin: "TemplateManager",
|
|
11312
11312
|
method: "applyTemplate",
|
|
11313
|
-
code:
|
|
11313
|
+
code: Ji.TEMPLATE_MANAGER.INVALID_TEMPLATE,
|
|
11314
11314
|
message: "Не удалось создать объекты шаблона"
|
|
11315
11315
|
}), null;
|
|
11316
11316
|
let { backgroundObject: i, contentObjects: u } = t._extractBackgroundObject(r);
|
|
@@ -11332,7 +11332,7 @@ var ma = class {
|
|
|
11332
11332
|
}), c.commitStandaloneTextScale({ target: e }), s.commitRehydratedShapeLayout({
|
|
11333
11333
|
target: e,
|
|
11334
11334
|
textScale: h
|
|
11335
|
-
}), Vt({ object: e }),
|
|
11335
|
+
}), Vt({ object: e }), Hi({ rootObject: e }), n.add(e), e));
|
|
11336
11336
|
return !d.length && !v ? null : (_ = d.length > 0 || v, d.length && t._activateObjects({
|
|
11337
11337
|
canvas: n,
|
|
11338
11338
|
objects: d
|
|
@@ -11345,7 +11345,7 @@ var ma = class {
|
|
|
11345
11345
|
return a.emitError({
|
|
11346
11346
|
origin: "TemplateManager",
|
|
11347
11347
|
method: "applyTemplate",
|
|
11348
|
-
code:
|
|
11348
|
+
code: Ji.TEMPLATE_MANAGER.APPLY_FAILED,
|
|
11349
11349
|
message: "Ошибка применения шаблона",
|
|
11350
11350
|
data: {
|
|
11351
11351
|
templateId: d,
|
|
@@ -11502,8 +11502,8 @@ var ma = class {
|
|
|
11502
11502
|
baseHeight: a,
|
|
11503
11503
|
scale: n,
|
|
11504
11504
|
useRelativePositions: o,
|
|
11505
|
-
anchorX: t._resolveAnchor(s,
|
|
11506
|
-
anchorY: t._resolveAnchor(s,
|
|
11505
|
+
anchorX: t._resolveAnchor(s, ya),
|
|
11506
|
+
anchorY: t._resolveAnchor(s, ba)
|
|
11507
11507
|
})
|
|
11508
11508
|
}), h = f * n, g = p * n, _ = e.originX ?? "center", v = e.originY ?? "center";
|
|
11509
11509
|
e.set({
|
|
@@ -11578,7 +11578,7 @@ var ma = class {
|
|
|
11578
11578
|
});
|
|
11579
11579
|
if (!i || !a) return;
|
|
11580
11580
|
e.setCoords();
|
|
11581
|
-
let o = e, s = t._resolveAnchor(o,
|
|
11581
|
+
let o = e, s = t._resolveAnchor(o, ya), 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
11582
|
e.set("width", i), e.initDimensions();
|
|
11583
11583
|
let h = t._getLongestLineWidth({
|
|
11584
11584
|
textbox: e,
|
|
@@ -11607,10 +11607,10 @@ var ma = class {
|
|
|
11607
11607
|
x: (p.left - o) / d,
|
|
11608
11608
|
y: (p.top - s) / f
|
|
11609
11609
|
}, h = (u.left - o) / d, g = (u.top - s) / f, _ = h + u.width / d, v = g + u.height / f;
|
|
11610
|
-
return a[
|
|
11610
|
+
return a[ya] = t._detectAnchor({
|
|
11611
11611
|
start: h,
|
|
11612
11612
|
end: _
|
|
11613
|
-
}), a[
|
|
11613
|
+
}), a[ba] = t._detectAnchor({
|
|
11614
11614
|
start: g,
|
|
11615
11615
|
end: v
|
|
11616
11616
|
}), a.left = m.x, a.top = m.y, a;
|
|
@@ -11635,7 +11635,7 @@ var ma = class {
|
|
|
11635
11635
|
withoutSave: !0
|
|
11636
11636
|
}), !0;
|
|
11637
11637
|
if (a === "gradient") {
|
|
11638
|
-
let e =
|
|
11638
|
+
let e = va(r);
|
|
11639
11639
|
if (e) return n.setGradientBackground({
|
|
11640
11640
|
gradient: e,
|
|
11641
11641
|
customData: o,
|
|
@@ -11656,7 +11656,7 @@ var ma = class {
|
|
|
11656
11656
|
r.emitWarning({
|
|
11657
11657
|
origin: "TemplateManager",
|
|
11658
11658
|
method: "applyTemplate",
|
|
11659
|
-
code:
|
|
11659
|
+
code: Ji.TEMPLATE_MANAGER.APPLY_FAILED,
|
|
11660
11660
|
message: "Не удалось применить фон из шаблона",
|
|
11661
11661
|
data: e
|
|
11662
11662
|
});
|
|
@@ -11692,29 +11692,29 @@ var ma = class {
|
|
|
11692
11692
|
enlivenObjectEnlivables(e) {
|
|
11693
11693
|
return w.enlivenObjectEnlivables(e);
|
|
11694
11694
|
}
|
|
11695
|
-
},
|
|
11696
|
-
let n =
|
|
11695
|
+
}, Sa = "#3D8BF4", Ca = .5, wa = ({ distance: e }) => Number.isFinite(e) ? Math.round(Math.max(0, e)) : 0, Ta = ({ firstDistance: e, secondDistance: t }) => {
|
|
11696
|
+
let n = wa({ distance: e }), r = wa({ distance: t });
|
|
11697
11697
|
return {
|
|
11698
11698
|
firstDisplayDistance: n,
|
|
11699
11699
|
secondDisplayDistance: r,
|
|
11700
11700
|
displayDistanceDiff: Math.abs(n - r),
|
|
11701
11701
|
commonDisplayDistance: Math.max(n, r)
|
|
11702
11702
|
};
|
|
11703
|
-
},
|
|
11703
|
+
}, Ea = ({ firstStart: e, firstEnd: t, secondStart: n, secondEnd: r }) => Math.min(t, r) - Math.max(e, n), Da = ({ step: e }) => {
|
|
11704
11704
|
let t = Math.abs(e).toString(), n = t.indexOf(".");
|
|
11705
11705
|
return n === -1 ? 0 : t.slice(n + 1).length;
|
|
11706
|
-
},
|
|
11706
|
+
}, Oa = ({ value: e, step: t }) => {
|
|
11707
11707
|
if (t === 0) return e;
|
|
11708
|
-
let n =
|
|
11708
|
+
let n = Da({ step: t }), r = Math.round(e / t) * t;
|
|
11709
11709
|
return Number(r.toFixed(n));
|
|
11710
|
-
},
|
|
11710
|
+
}, ka = ({ value: e, step: t }) => {
|
|
11711
11711
|
if (t === 0) return !0;
|
|
11712
|
-
let n =
|
|
11712
|
+
let n = Oa({
|
|
11713
11713
|
value: e,
|
|
11714
11714
|
step: t
|
|
11715
|
-
}), r = 10 ** -(
|
|
11715
|
+
}), r = 10 ** -(Da({ step: t }) + 4);
|
|
11716
11716
|
return Math.abs(n - e) <= r;
|
|
11717
|
-
},
|
|
11717
|
+
}, Aa = ({ bounds: e, axis: t }) => {
|
|
11718
11718
|
let { left: n = 0, right: r = 0, top: i = 0, bottom: a = 0 } = e;
|
|
11719
11719
|
return t === "vertical" ? {
|
|
11720
11720
|
start: i,
|
|
@@ -11723,7 +11723,7 @@ var ma = class {
|
|
|
11723
11723
|
start: n,
|
|
11724
11724
|
end: r
|
|
11725
11725
|
};
|
|
11726
|
-
},
|
|
11726
|
+
}, ja = ({ items: e, axis: t }) => {
|
|
11727
11727
|
for (let n = 1; n < e.length; n += 1) {
|
|
11728
11728
|
let r = e[n], { bounds: i } = r, a = i[t], o = n - 1;
|
|
11729
11729
|
for (; o >= 0;) {
|
|
@@ -11733,10 +11733,10 @@ var ma = class {
|
|
|
11733
11733
|
}
|
|
11734
11734
|
e[o + 1] = r;
|
|
11735
11735
|
}
|
|
11736
|
-
},
|
|
11736
|
+
}, Ma = ({ items: e, index: t, axis: n, direction: r }) => {
|
|
11737
11737
|
let i = e[t];
|
|
11738
11738
|
if (!i) return null;
|
|
11739
|
-
let { bounds: a } = i, { start: o, end: s } =
|
|
11739
|
+
let { bounds: a } = i, { start: o, end: s } = Aa({
|
|
11740
11740
|
bounds: a,
|
|
11741
11741
|
axis: n
|
|
11742
11742
|
});
|
|
@@ -11744,7 +11744,7 @@ var ma = class {
|
|
|
11744
11744
|
for (let r = t - 1; r >= 0; --r) {
|
|
11745
11745
|
let t = e[r];
|
|
11746
11746
|
if (!t) continue;
|
|
11747
|
-
let { bounds: i } = t, { end: a } =
|
|
11747
|
+
let { bounds: i } = t, { end: a } = Aa({
|
|
11748
11748
|
bounds: i,
|
|
11749
11749
|
axis: n
|
|
11750
11750
|
});
|
|
@@ -11755,26 +11755,26 @@ var ma = class {
|
|
|
11755
11755
|
for (let r = t + 1; r < e.length; r += 1) {
|
|
11756
11756
|
let t = e[r];
|
|
11757
11757
|
if (!t) continue;
|
|
11758
|
-
let { bounds: i } = t, { start: a } =
|
|
11758
|
+
let { bounds: i } = t, { start: a } = Aa({
|
|
11759
11759
|
bounds: i,
|
|
11760
11760
|
axis: n
|
|
11761
11761
|
});
|
|
11762
11762
|
if (a - s >= 0) return r;
|
|
11763
11763
|
}
|
|
11764
11764
|
return null;
|
|
11765
|
-
},
|
|
11765
|
+
}, Na = ({ items: e }) => {
|
|
11766
11766
|
for (let t = 0; t < e.length; t += 1) {
|
|
11767
11767
|
let { isActive: n } = e[t];
|
|
11768
11768
|
if (n) return t;
|
|
11769
11769
|
}
|
|
11770
11770
|
return -1;
|
|
11771
|
-
},
|
|
11771
|
+
}, Pa = ({ patternAxis: e, activeRangeStart: t, activeRangeEnd: n, tolerance: r = 0 }) => {
|
|
11772
11772
|
let i = Math.min(t, n), a = Math.max(t, n);
|
|
11773
11773
|
return e >= i - r && e <= a + r;
|
|
11774
|
-
},
|
|
11774
|
+
}, Fa = ({ patternStart: e, patternEnd: t, activeStart: n, activeEnd: r }) => t <= n ? "before" : e >= r ? "after" : null, Ia = ({ baseOption: e, candidateOption: t }) => {
|
|
11775
11775
|
let { delta: n, guide: { distance: r } } = e, { delta: i, guide: { distance: a } } = t;
|
|
11776
11776
|
return n === i && r === a;
|
|
11777
|
-
},
|
|
11777
|
+
}, La = ({ options: e }) => {
|
|
11778
11778
|
let t = e[0];
|
|
11779
11779
|
for (let n = 1; n < e.length; n += 1) {
|
|
11780
11780
|
let r = e[n];
|
|
@@ -11785,11 +11785,11 @@ var ma = class {
|
|
|
11785
11785
|
r.diff === t.diff && Math.abs(r.delta) < Math.abs(t.delta) && (t = r);
|
|
11786
11786
|
}
|
|
11787
11787
|
return t;
|
|
11788
|
-
},
|
|
11788
|
+
}, Ra = ({ currentOption: e, nextOption: t }) => {
|
|
11789
11789
|
if (!e) return !0;
|
|
11790
11790
|
let { contextDistance: n, diff: r, delta: i } = e, { contextDistance: a, diff: o, delta: s } = t;
|
|
11791
11791
|
return a < n ? !0 : a > n ? !1 : o < r ? !0 : o > r ? !1 : Math.abs(s) < Math.abs(i);
|
|
11792
|
-
},
|
|
11792
|
+
}, za = ({ options: e }) => {
|
|
11793
11793
|
let t = [], n = null, r = null;
|
|
11794
11794
|
for (let i of e) {
|
|
11795
11795
|
let { kind: e, side: a } = i;
|
|
@@ -11797,18 +11797,18 @@ var ma = class {
|
|
|
11797
11797
|
t.push(i);
|
|
11798
11798
|
continue;
|
|
11799
11799
|
}
|
|
11800
|
-
a === "before" &&
|
|
11800
|
+
a === "before" && Ra({
|
|
11801
11801
|
currentOption: n,
|
|
11802
11802
|
nextOption: i
|
|
11803
|
-
}) && (n = i), a === "after" &&
|
|
11803
|
+
}) && (n = i), a === "after" && Ra({
|
|
11804
11804
|
currentOption: r,
|
|
11805
11805
|
nextOption: i
|
|
11806
11806
|
}) && (r = i);
|
|
11807
11807
|
}
|
|
11808
11808
|
return n && t.push(n), r && t.push(r), t;
|
|
11809
|
-
},
|
|
11809
|
+
}, Ba = ({ options: e, side: t, baseOption: n }) => {
|
|
11810
11810
|
let r = null;
|
|
11811
|
-
for (let i of e) if (i.side === t &&
|
|
11811
|
+
for (let i of e) if (i.side === t && Ia({
|
|
11812
11812
|
baseOption: n,
|
|
11813
11813
|
candidateOption: i
|
|
11814
11814
|
})) {
|
|
@@ -11819,63 +11819,63 @@ var ma = class {
|
|
|
11819
11819
|
!r || i.diff !== r.diff || Math.abs(i.delta) < Math.abs(r.delta) && (r = i);
|
|
11820
11820
|
}
|
|
11821
11821
|
return r;
|
|
11822
|
-
},
|
|
11822
|
+
}, Va = ({ option: e }) => {
|
|
11823
11823
|
let { side: t, kind: n, guide: { distance: r } } = e;
|
|
11824
11824
|
return {
|
|
11825
11825
|
side: t,
|
|
11826
11826
|
kind: n,
|
|
11827
11827
|
distance: r
|
|
11828
11828
|
};
|
|
11829
|
-
},
|
|
11829
|
+
}, Ha = ({ option: e, context: t }) => {
|
|
11830
11830
|
let { side: n, kind: r, distance: i } = t, { side: a, kind: o, guide: { distance: s } } = e;
|
|
11831
11831
|
return n !== a || r !== o ? !1 : Math.abs(s - i) <= 1;
|
|
11832
|
-
},
|
|
11832
|
+
}, Ua = ({ options: e, context: t }) => {
|
|
11833
11833
|
if (!t) return null;
|
|
11834
|
-
for (let n of e) if (
|
|
11834
|
+
for (let n of e) if (Ha({
|
|
11835
11835
|
option: n,
|
|
11836
11836
|
context: t
|
|
11837
11837
|
})) return n;
|
|
11838
11838
|
return null;
|
|
11839
|
-
},
|
|
11840
|
-
let i =
|
|
11839
|
+
}, Wa = ({ options: e, bestOption: t, previousContext: n, switchDistance: r = 0 }) => {
|
|
11840
|
+
let i = Ua({
|
|
11841
11841
|
options: e,
|
|
11842
11842
|
context: n
|
|
11843
11843
|
});
|
|
11844
11844
|
if (!i) return t;
|
|
11845
11845
|
let a = Math.max(0, r);
|
|
11846
11846
|
return a === 0 || Math.abs(t.delta - i.delta) >= a ? t : i;
|
|
11847
|
-
},
|
|
11847
|
+
}, Ga = ({ guides: e, seenGuideKeys: t, guide: n }) => {
|
|
11848
11848
|
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
11849
|
t.has(u) || (t.add(u), e.push(n));
|
|
11850
|
-
},
|
|
11850
|
+
}, Ka = ({ options: e, previousContext: t = null, switchDistance: n = 0 }) => {
|
|
11851
11851
|
if (!e.length) return {
|
|
11852
11852
|
delta: 0,
|
|
11853
11853
|
guides: [],
|
|
11854
11854
|
context: null
|
|
11855
11855
|
};
|
|
11856
|
-
let r =
|
|
11856
|
+
let r = za({ options: e }), i = [];
|
|
11857
11857
|
for (let e of r) e.kind === "reference" && i.push(e);
|
|
11858
|
-
let a = i.length > 0, o = a ? i : r, s =
|
|
11858
|
+
let a = i.length > 0, o = a ? i : r, s = Wa({
|
|
11859
11859
|
options: o,
|
|
11860
|
-
bestOption:
|
|
11860
|
+
bestOption: La({ options: o }),
|
|
11861
11861
|
previousContext: t,
|
|
11862
11862
|
switchDistance: n
|
|
11863
|
-
}), c =
|
|
11863
|
+
}), c = Ba({
|
|
11864
11864
|
options: o,
|
|
11865
11865
|
side: "before",
|
|
11866
11866
|
baseOption: s
|
|
11867
|
-
}), l =
|
|
11867
|
+
}), l = Ba({
|
|
11868
11868
|
options: o,
|
|
11869
11869
|
side: "after",
|
|
11870
11870
|
baseOption: s
|
|
11871
|
-
}), u =
|
|
11871
|
+
}), u = Ba({
|
|
11872
11872
|
options: a ? r : o,
|
|
11873
11873
|
side: "center",
|
|
11874
11874
|
baseOption: s
|
|
11875
11875
|
}), d = [];
|
|
11876
11876
|
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
11877
|
let f = [], p = /* @__PURE__ */ new Set();
|
|
11878
|
-
for (let e of d)
|
|
11878
|
+
for (let e of d) Ga({
|
|
11879
11879
|
guides: f,
|
|
11880
11880
|
seenGuideKeys: p,
|
|
11881
11881
|
guide: e.guide
|
|
@@ -11883,15 +11883,15 @@ var ma = class {
|
|
|
11883
11883
|
return {
|
|
11884
11884
|
delta: s.delta,
|
|
11885
11885
|
guides: f,
|
|
11886
|
-
context:
|
|
11886
|
+
context: Va({ option: s })
|
|
11887
11887
|
};
|
|
11888
|
-
},
|
|
11889
|
-
let s = n - (e - r), c =
|
|
11888
|
+
}, qa = ({ activeStart: e, activeEnd: t, targetGap: n, beforeEdge: r, afterEdge: i, threshold: a, step: o }) => {
|
|
11889
|
+
let s = n - (e - r), c = Oa({
|
|
11890
11890
|
value: s,
|
|
11891
11891
|
step: o
|
|
11892
11892
|
}), l = Math.max(1, Math.ceil(a / Math.max(o, 1))), u = null;
|
|
11893
11893
|
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: _ } =
|
|
11894
|
+
let l = c + d * o, f = e + l, p = t + l, m = f - r, h = i - p, { displayDistanceDiff: g, commonDisplayDistance: _ } = Ta({
|
|
11895
11895
|
firstDistance: m,
|
|
11896
11896
|
secondDistance: h
|
|
11897
11897
|
});
|
|
@@ -11906,13 +11906,13 @@ var ma = class {
|
|
|
11906
11906
|
});
|
|
11907
11907
|
}
|
|
11908
11908
|
return u;
|
|
11909
|
-
},
|
|
11910
|
-
let { secondDisplayDistance: n, displayDistanceDiff: r } =
|
|
11909
|
+
}, Ja = ({ currentGap: e, referenceGap: t }) => {
|
|
11910
|
+
let { secondDisplayDistance: n, displayDistanceDiff: r } = Ta({
|
|
11911
11911
|
firstDistance: e,
|
|
11912
11912
|
secondDistance: t
|
|
11913
11913
|
});
|
|
11914
11914
|
return r > 1 ? null : n;
|
|
11915
|
-
},
|
|
11915
|
+
}, Ya = ({ anchors: e, positions: t, threshold: n }) => {
|
|
11916
11916
|
let r = 0, i = n + 1, a = null;
|
|
11917
11917
|
for (let o of t) for (let t of e) {
|
|
11918
11918
|
let e = Math.abs(t - o);
|
|
@@ -11922,8 +11922,8 @@ var ma = class {
|
|
|
11922
11922
|
delta: r,
|
|
11923
11923
|
guidePosition: a
|
|
11924
11924
|
};
|
|
11925
|
-
},
|
|
11926
|
-
let { left: r, right: i, centerX: a, top: o, bottom: s, centerY: c } = e, l =
|
|
11925
|
+
}, Xa = ({ activeBounds: e, threshold: t, anchors: n }) => {
|
|
11926
|
+
let { left: r, right: i, centerX: a, top: o, bottom: s, centerY: c } = e, l = Ya({
|
|
11927
11927
|
anchors: n.vertical,
|
|
11928
11928
|
positions: [
|
|
11929
11929
|
r,
|
|
@@ -11931,7 +11931,7 @@ var ma = class {
|
|
|
11931
11931
|
i
|
|
11932
11932
|
],
|
|
11933
11933
|
threshold: t
|
|
11934
|
-
}), u =
|
|
11934
|
+
}), u = Ya({
|
|
11935
11935
|
anchors: n.horizontal,
|
|
11936
11936
|
positions: [
|
|
11937
11937
|
o,
|
|
@@ -11951,11 +11951,11 @@ var ma = class {
|
|
|
11951
11951
|
deltaY: u.delta,
|
|
11952
11952
|
guides: d
|
|
11953
11953
|
};
|
|
11954
|
-
},
|
|
11954
|
+
}, Za = ({ activeBounds: e, candidates: t, threshold: n, patterns: r, previousContext: i = null, switchDistance: a = 0 }) => {
|
|
11955
11955
|
let { centerX: o, top: s, bottom: c, left: l, right: u } = e, d = [];
|
|
11956
11956
|
for (let e of t) {
|
|
11957
11957
|
let { left: t, right: n } = e;
|
|
11958
|
-
|
|
11958
|
+
Ea({
|
|
11959
11959
|
firstStart: t,
|
|
11960
11960
|
firstEnd: n,
|
|
11961
11961
|
secondStart: l,
|
|
@@ -11975,22 +11975,22 @@ var ma = class {
|
|
|
11975
11975
|
f.push({
|
|
11976
11976
|
bounds: e,
|
|
11977
11977
|
isActive: !0
|
|
11978
|
-
}),
|
|
11978
|
+
}), ja({
|
|
11979
11979
|
items: f,
|
|
11980
11980
|
axis: "top"
|
|
11981
11981
|
});
|
|
11982
|
-
let p =
|
|
11982
|
+
let p = Na({ items: f });
|
|
11983
11983
|
if (p === -1) return {
|
|
11984
11984
|
delta: 0,
|
|
11985
11985
|
guides: [],
|
|
11986
11986
|
context: null
|
|
11987
11987
|
};
|
|
11988
|
-
let m = [], h = c - s, g =
|
|
11988
|
+
let m = [], h = c - s, g = Ma({
|
|
11989
11989
|
items: f,
|
|
11990
11990
|
index: p,
|
|
11991
11991
|
axis: "vertical",
|
|
11992
11992
|
direction: "prev"
|
|
11993
|
-
}), _ =
|
|
11993
|
+
}), _ = Ma({
|
|
11994
11994
|
items: f,
|
|
11995
11995
|
index: p,
|
|
11996
11996
|
axis: "vertical",
|
|
@@ -11999,19 +11999,19 @@ var ma = class {
|
|
|
11999
11999
|
if (v && y) {
|
|
12000
12000
|
let { bounds: e } = v, { bounds: t } = y, { bottom: r } = e, { top: i } = t, a = i - r - h;
|
|
12001
12001
|
if (a >= 0) {
|
|
12002
|
-
let e =
|
|
12002
|
+
let e = Oa({
|
|
12003
12003
|
value: a / 2,
|
|
12004
12004
|
step: 1
|
|
12005
12005
|
}), t = s - r, l = i - c, u = Math.abs(t - e), d = Math.abs(l - e);
|
|
12006
12006
|
if (Math.max(u, d) <= n) {
|
|
12007
|
-
let t =
|
|
12007
|
+
let t = qa({
|
|
12008
12008
|
activeStart: s,
|
|
12009
12009
|
activeEnd: c,
|
|
12010
12010
|
targetGap: e,
|
|
12011
12011
|
beforeEdge: r,
|
|
12012
12012
|
afterEdge: i,
|
|
12013
12013
|
threshold: n,
|
|
12014
|
-
step:
|
|
12014
|
+
step: Ca
|
|
12015
12015
|
});
|
|
12016
12016
|
if (t) {
|
|
12017
12017
|
let { delta: e, distance: n, diff: i, activeStart: a, activeEnd: s } = t, c = {
|
|
@@ -12048,16 +12048,16 @@ var ma = class {
|
|
|
12048
12048
|
}
|
|
12049
12049
|
for (let e of r) {
|
|
12050
12050
|
let { axis: t, start: r, end: i, distance: a } = e;
|
|
12051
|
-
if (!
|
|
12051
|
+
if (!ka({
|
|
12052
12052
|
value: a,
|
|
12053
12053
|
step: .5
|
|
12054
|
-
}) || !
|
|
12054
|
+
}) || !Pa({
|
|
12055
12055
|
patternAxis: t,
|
|
12056
12056
|
activeRangeStart: l,
|
|
12057
12057
|
activeRangeEnd: u,
|
|
12058
12058
|
tolerance: n
|
|
12059
12059
|
})) continue;
|
|
12060
|
-
let d =
|
|
12060
|
+
let d = Fa({
|
|
12061
12061
|
patternStart: r,
|
|
12062
12062
|
patternEnd: i,
|
|
12063
12063
|
activeStart: s,
|
|
@@ -12065,12 +12065,12 @@ var ma = class {
|
|
|
12065
12065
|
});
|
|
12066
12066
|
if (d) {
|
|
12067
12067
|
if (b !== null && S && d === "before" && Math.abs(b - a) <= n) {
|
|
12068
|
-
let e =
|
|
12068
|
+
let e = Oa({
|
|
12069
12069
|
value: a - b,
|
|
12070
12070
|
step: 1
|
|
12071
12071
|
}), t = s + e, { bottom: c } = S, l = t - c, u = Math.abs(l - a);
|
|
12072
12072
|
if (u > n) continue;
|
|
12073
|
-
let d =
|
|
12073
|
+
let d = Ja({
|
|
12074
12074
|
currentGap: l,
|
|
12075
12075
|
referenceGap: a
|
|
12076
12076
|
});
|
|
@@ -12094,12 +12094,12 @@ var ma = class {
|
|
|
12094
12094
|
});
|
|
12095
12095
|
}
|
|
12096
12096
|
if (x !== null && C && d === "after" && Math.abs(x - a) <= n) {
|
|
12097
|
-
let e =
|
|
12097
|
+
let e = Oa({
|
|
12098
12098
|
value: x - a,
|
|
12099
12099
|
step: 1
|
|
12100
12100
|
}), t = c + e, { top: s } = C, l = s - t, u = Math.abs(l - a);
|
|
12101
12101
|
if (u > n) continue;
|
|
12102
|
-
let d =
|
|
12102
|
+
let d = Ja({
|
|
12103
12103
|
currentGap: l,
|
|
12104
12104
|
referenceGap: a
|
|
12105
12105
|
});
|
|
@@ -12124,16 +12124,16 @@ var ma = class {
|
|
|
12124
12124
|
}
|
|
12125
12125
|
}
|
|
12126
12126
|
}
|
|
12127
|
-
return
|
|
12127
|
+
return Ka({
|
|
12128
12128
|
options: m,
|
|
12129
12129
|
previousContext: i,
|
|
12130
12130
|
switchDistance: a
|
|
12131
12131
|
});
|
|
12132
|
-
},
|
|
12132
|
+
}, Qa = ({ activeBounds: e, candidates: t, threshold: n, patterns: r, previousContext: i = null, switchDistance: a = 0 }) => {
|
|
12133
12133
|
let { centerY: o, left: s, right: c, top: l, bottom: u } = e, d = [];
|
|
12134
12134
|
for (let e of t) {
|
|
12135
12135
|
let { top: t, bottom: n } = e;
|
|
12136
|
-
|
|
12136
|
+
Ea({
|
|
12137
12137
|
firstStart: t,
|
|
12138
12138
|
firstEnd: n,
|
|
12139
12139
|
secondStart: l,
|
|
@@ -12153,22 +12153,22 @@ var ma = class {
|
|
|
12153
12153
|
f.push({
|
|
12154
12154
|
bounds: e,
|
|
12155
12155
|
isActive: !0
|
|
12156
|
-
}),
|
|
12156
|
+
}), ja({
|
|
12157
12157
|
items: f,
|
|
12158
12158
|
axis: "left"
|
|
12159
12159
|
});
|
|
12160
|
-
let p =
|
|
12160
|
+
let p = Na({ items: f });
|
|
12161
12161
|
if (p === -1) return {
|
|
12162
12162
|
delta: 0,
|
|
12163
12163
|
guides: [],
|
|
12164
12164
|
context: null
|
|
12165
12165
|
};
|
|
12166
|
-
let m = [], h = c - s, g =
|
|
12166
|
+
let m = [], h = c - s, g = Ma({
|
|
12167
12167
|
items: f,
|
|
12168
12168
|
index: p,
|
|
12169
12169
|
axis: "horizontal",
|
|
12170
12170
|
direction: "prev"
|
|
12171
|
-
}), _ =
|
|
12171
|
+
}), _ = Ma({
|
|
12172
12172
|
items: f,
|
|
12173
12173
|
index: p,
|
|
12174
12174
|
axis: "horizontal",
|
|
@@ -12177,19 +12177,19 @@ var ma = class {
|
|
|
12177
12177
|
if (v && y) {
|
|
12178
12178
|
let { bounds: e } = v, { bounds: t } = y, { right: r } = e, { left: i } = t, a = i - r - h;
|
|
12179
12179
|
if (a >= 0) {
|
|
12180
|
-
let e =
|
|
12180
|
+
let e = Oa({
|
|
12181
12181
|
value: a / 2,
|
|
12182
12182
|
step: 1
|
|
12183
12183
|
}), t = s - r, l = i - c, u = Math.abs(t - e), d = Math.abs(l - e);
|
|
12184
12184
|
if (Math.max(u, d) <= n) {
|
|
12185
|
-
let t =
|
|
12185
|
+
let t = qa({
|
|
12186
12186
|
activeStart: s,
|
|
12187
12187
|
activeEnd: c,
|
|
12188
12188
|
targetGap: e,
|
|
12189
12189
|
beforeEdge: r,
|
|
12190
12190
|
afterEdge: i,
|
|
12191
12191
|
threshold: n,
|
|
12192
|
-
step:
|
|
12192
|
+
step: Ca
|
|
12193
12193
|
});
|
|
12194
12194
|
if (t) {
|
|
12195
12195
|
let { delta: e, distance: n, diff: i, activeStart: a, activeEnd: s } = t, c = {
|
|
@@ -12226,16 +12226,16 @@ var ma = class {
|
|
|
12226
12226
|
}
|
|
12227
12227
|
for (let e of r) {
|
|
12228
12228
|
let { axis: t, start: r, end: i, distance: a } = e;
|
|
12229
|
-
if (!
|
|
12229
|
+
if (!ka({
|
|
12230
12230
|
value: a,
|
|
12231
12231
|
step: .5
|
|
12232
|
-
}) || !
|
|
12232
|
+
}) || !Pa({
|
|
12233
12233
|
patternAxis: t,
|
|
12234
12234
|
activeRangeStart: l,
|
|
12235
12235
|
activeRangeEnd: u,
|
|
12236
12236
|
tolerance: n
|
|
12237
12237
|
})) continue;
|
|
12238
|
-
let d =
|
|
12238
|
+
let d = Fa({
|
|
12239
12239
|
patternStart: r,
|
|
12240
12240
|
patternEnd: i,
|
|
12241
12241
|
activeStart: s,
|
|
@@ -12243,12 +12243,12 @@ var ma = class {
|
|
|
12243
12243
|
});
|
|
12244
12244
|
if (d) {
|
|
12245
12245
|
if (b !== null && S && d === "before" && Math.abs(b - a) <= n) {
|
|
12246
|
-
let e =
|
|
12246
|
+
let e = Oa({
|
|
12247
12247
|
value: a - b,
|
|
12248
12248
|
step: 1
|
|
12249
12249
|
}), t = s + e, { right: c } = S, l = t - c, u = Math.abs(l - a);
|
|
12250
12250
|
if (u > n) continue;
|
|
12251
|
-
let d =
|
|
12251
|
+
let d = Ja({
|
|
12252
12252
|
currentGap: l,
|
|
12253
12253
|
referenceGap: a
|
|
12254
12254
|
});
|
|
@@ -12272,12 +12272,12 @@ var ma = class {
|
|
|
12272
12272
|
});
|
|
12273
12273
|
}
|
|
12274
12274
|
if (x !== null && C && d === "after" && Math.abs(x - a) <= n) {
|
|
12275
|
-
let e =
|
|
12275
|
+
let e = Oa({
|
|
12276
12276
|
value: x - a,
|
|
12277
12277
|
step: 1
|
|
12278
12278
|
}), t = c + e, { left: s } = C, l = s - t, u = Math.abs(l - a);
|
|
12279
12279
|
if (u > n) continue;
|
|
12280
|
-
let d =
|
|
12280
|
+
let d = Ja({
|
|
12281
12281
|
currentGap: l,
|
|
12282
12282
|
referenceGap: a
|
|
12283
12283
|
});
|
|
@@ -12302,20 +12302,20 @@ var ma = class {
|
|
|
12302
12302
|
}
|
|
12303
12303
|
}
|
|
12304
12304
|
}
|
|
12305
|
-
return
|
|
12305
|
+
return Ka({
|
|
12306
12306
|
options: m,
|
|
12307
12307
|
previousContext: i,
|
|
12308
12308
|
switchDistance: a
|
|
12309
12309
|
});
|
|
12310
|
-
},
|
|
12311
|
-
let { vertical: o = null, horizontal: s = null } = i ?? {}, c =
|
|
12310
|
+
}, $a = ({ activeBounds: e, candidates: t, threshold: n, spacingPatterns: r, previousContexts: i, switchDistance: a = 0 }) => {
|
|
12311
|
+
let { vertical: o = null, horizontal: s = null } = i ?? {}, c = Za({
|
|
12312
12312
|
activeBounds: e,
|
|
12313
12313
|
candidates: t,
|
|
12314
12314
|
threshold: n,
|
|
12315
12315
|
patterns: r.vertical,
|
|
12316
12316
|
previousContext: o,
|
|
12317
12317
|
switchDistance: a
|
|
12318
|
-
}), l =
|
|
12318
|
+
}), l = Qa({
|
|
12319
12319
|
activeBounds: e,
|
|
12320
12320
|
candidates: t,
|
|
12321
12321
|
threshold: n,
|
|
@@ -12334,14 +12334,14 @@ var ma = class {
|
|
|
12334
12334
|
horizontal: l.context
|
|
12335
12335
|
}
|
|
12336
12336
|
};
|
|
12337
|
-
},
|
|
12337
|
+
}, eo = ({ context: e, x: t, y: n, width: r, height: i, radius: a }) => {
|
|
12338
12338
|
let o = Math.min(a, r / 2, i / 2);
|
|
12339
12339
|
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
|
-
},
|
|
12340
|
+
}, to = ({ 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
12341
|
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
12342
|
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
12343
|
let S = e.measureText(a).width + _ * 2, C = g + _ * 2, w = b - S / 2, T = x - C / 2;
|
|
12344
|
-
e.beginPath(),
|
|
12344
|
+
e.beginPath(), eo({
|
|
12345
12345
|
context: e,
|
|
12346
12346
|
x: w,
|
|
12347
12347
|
y: T,
|
|
@@ -12349,11 +12349,11 @@ var ma = class {
|
|
|
12349
12349
|
height: C,
|
|
12350
12350
|
radius: v
|
|
12351
12351
|
}), 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 =
|
|
12352
|
+
}, no = ({ context: e, guide: t, zoom: n }) => {
|
|
12353
|
+
let { type: r, axis: i, refStart: a, refEnd: o, activeStart: s, activeEnd: c, distance: l } = t, u = wa({ distance: l }).toString();
|
|
12354
12354
|
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
|
-
|
|
12355
|
+
let d = Sa;
|
|
12356
|
+
to({
|
|
12357
12357
|
context: e,
|
|
12358
12358
|
type: r,
|
|
12359
12359
|
axis: i,
|
|
@@ -12363,7 +12363,7 @@ var ma = class {
|
|
|
12363
12363
|
zoom: n,
|
|
12364
12364
|
color: d,
|
|
12365
12365
|
lineWidth: 1
|
|
12366
|
-
}),
|
|
12366
|
+
}), to({
|
|
12367
12367
|
context: e,
|
|
12368
12368
|
type: r,
|
|
12369
12369
|
axis: i,
|
|
@@ -12374,10 +12374,10 @@ var ma = class {
|
|
|
12374
12374
|
color: d,
|
|
12375
12375
|
lineWidth: 1
|
|
12376
12376
|
});
|
|
12377
|
-
},
|
|
12377
|
+
}, ro = ({ anchors: e, bounds: t }) => {
|
|
12378
12378
|
let { left: n, right: r, centerX: i, top: a, bottom: o, centerY: s } = t;
|
|
12379
12379
|
e.vertical.push(n, i, r), e.horizontal.push(a, s, o);
|
|
12380
|
-
},
|
|
12380
|
+
}, io = ({ bounds: e, type: t, primaryStart: n, primaryEnd: r }) => {
|
|
12381
12381
|
let i = [], a = n === "top" ? "left" : "top", o = r === "bottom" ? "right" : "bottom", s = [...e].sort((e, t) => e[n] - t[n]);
|
|
12382
12382
|
for (let e = 0; e < s.length; e += 1) {
|
|
12383
12383
|
let c = s[e], l = null, u = Infinity;
|
|
@@ -12398,35 +12398,35 @@ var ma = class {
|
|
|
12398
12398
|
});
|
|
12399
12399
|
}
|
|
12400
12400
|
return i;
|
|
12401
|
-
},
|
|
12402
|
-
vertical:
|
|
12401
|
+
}, ao = ({ bounds: e }) => ({
|
|
12402
|
+
vertical: io({
|
|
12403
12403
|
bounds: e,
|
|
12404
12404
|
axis: "centerX",
|
|
12405
12405
|
type: "vertical",
|
|
12406
12406
|
primaryStart: "top",
|
|
12407
12407
|
primaryEnd: "bottom"
|
|
12408
12408
|
}),
|
|
12409
|
-
horizontal:
|
|
12409
|
+
horizontal: io({
|
|
12410
12410
|
bounds: e,
|
|
12411
12411
|
axis: "centerY",
|
|
12412
12412
|
type: "horizontal",
|
|
12413
12413
|
primaryStart: "left",
|
|
12414
12414
|
primaryEnd: "right"
|
|
12415
12415
|
})
|
|
12416
|
-
}),
|
|
12416
|
+
}), oo = [
|
|
12417
12417
|
"montage-area",
|
|
12418
12418
|
"background",
|
|
12419
12419
|
"interaction-blocker"
|
|
12420
|
-
],
|
|
12420
|
+
], so = ({ activeObject: t }) => {
|
|
12421
12421
|
let n = /* @__PURE__ */ new Set();
|
|
12422
12422
|
return t ? (n.add(t), t instanceof e && t.getObjects().forEach((e) => n.add(e)), n) : n;
|
|
12423
|
-
},
|
|
12423
|
+
}, co = ({ object: e, excluded: t, ignoredIds: n = oo }) => {
|
|
12424
12424
|
if (t.has(e)) return !0;
|
|
12425
12425
|
let { visible: r = !0 } = e;
|
|
12426
12426
|
if (!r) return !0;
|
|
12427
12427
|
let { id: i } = e;
|
|
12428
12428
|
return !!(i && n.includes(i));
|
|
12429
|
-
},
|
|
12429
|
+
}, lo = class e {
|
|
12430
12430
|
constructor({ editor: e }) {
|
|
12431
12431
|
this.anchors = {
|
|
12432
12432
|
vertical: [],
|
|
@@ -12479,7 +12479,7 @@ var ma = class {
|
|
|
12479
12479
|
this._clearSpacingContexts(), this._clearGuides();
|
|
12480
12480
|
return;
|
|
12481
12481
|
}
|
|
12482
|
-
let { canvas: o } = this, s = o.getZoom() || 1, c = 5 / s, { deltaX: l, deltaY: u } =
|
|
12482
|
+
let { canvas: o } = this, s = o.getZoom() || 1, c = 5 / s, { deltaX: l, deltaY: u } = Xa({
|
|
12483
12483
|
activeBounds: a,
|
|
12484
12484
|
threshold: c,
|
|
12485
12485
|
anchors: this.anchors
|
|
@@ -12491,7 +12491,7 @@ var ma = class {
|
|
|
12491
12491
|
top: t + u
|
|
12492
12492
|
}), n.setCoords(), a = W({ object: n }) ?? a;
|
|
12493
12493
|
}
|
|
12494
|
-
let d = this._resolveCurrentTargetBounds({ activeObject: n }), f = this.spacingContexts.vertical || this.spacingContexts.horizontal ? 10 / s : c, p =
|
|
12494
|
+
let d = this._resolveCurrentTargetBounds({ activeObject: n }), f = this.spacingContexts.vertical || this.spacingContexts.horizontal ? 10 / s : c, p = $a({
|
|
12495
12495
|
activeBounds: a,
|
|
12496
12496
|
candidates: d,
|
|
12497
12497
|
threshold: f,
|
|
@@ -12512,11 +12512,11 @@ var ma = class {
|
|
|
12512
12512
|
target: n,
|
|
12513
12513
|
transform: i
|
|
12514
12514
|
});
|
|
12515
|
-
let h = W({ object: n }) ?? a, g =
|
|
12515
|
+
let h = W({ object: n }) ?? a, g = Xa({
|
|
12516
12516
|
activeBounds: h,
|
|
12517
12517
|
threshold: c,
|
|
12518
12518
|
anchors: this.anchors
|
|
12519
|
-
}), _ =
|
|
12519
|
+
}), _ = $a({
|
|
12520
12520
|
activeBounds: h,
|
|
12521
12521
|
candidates: d,
|
|
12522
12522
|
threshold: c,
|
|
@@ -12747,9 +12747,9 @@ var ma = class {
|
|
|
12747
12747
|
let { canvas: e, guideBounds: t } = this, n = e.getSelectionContext();
|
|
12748
12748
|
if (!n) return;
|
|
12749
12749
|
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 =
|
|
12750
|
+
n.save(), Array.isArray(s) && n.transform(...s), n.lineWidth = 1 / c, n.strokeStyle = Sa, n.setLineDash([4, 4]);
|
|
12751
12751
|
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)
|
|
12752
|
+
for (let e of this.activeSpacingGuides) no({
|
|
12753
12753
|
context: n,
|
|
12754
12754
|
guide: e,
|
|
12755
12755
|
zoom: c
|
|
@@ -12960,14 +12960,14 @@ var ma = class {
|
|
|
12960
12960
|
}, r = [];
|
|
12961
12961
|
for (let e of t) {
|
|
12962
12962
|
let t = W({ object: e });
|
|
12963
|
-
t && (
|
|
12963
|
+
t && (ro({
|
|
12964
12964
|
anchors: n,
|
|
12965
12965
|
bounds: t
|
|
12966
12966
|
}), r.push(t));
|
|
12967
12967
|
}
|
|
12968
12968
|
let { montageArea: i } = this.editor, a = W({ object: i });
|
|
12969
12969
|
if (a) {
|
|
12970
|
-
|
|
12970
|
+
ro({
|
|
12971
12971
|
anchors: n,
|
|
12972
12972
|
bounds: a
|
|
12973
12973
|
});
|
|
@@ -12979,12 +12979,12 @@ var ma = class {
|
|
|
12979
12979
|
bottom: i
|
|
12980
12980
|
};
|
|
12981
12981
|
} else this.guideBounds = this._calculateViewportBounds();
|
|
12982
|
-
this.anchors = n, this.spacingPatterns =
|
|
12982
|
+
this.anchors = n, this.spacingPatterns = ao({ bounds: r }), this.cachedTargetBounds = r;
|
|
12983
12983
|
}
|
|
12984
12984
|
_collectTargets({ activeObject: e }) {
|
|
12985
|
-
let t =
|
|
12985
|
+
let t = so({ activeObject: e }), n = [];
|
|
12986
12986
|
return this.canvas.forEachObject((e) => {
|
|
12987
|
-
|
|
12987
|
+
co({
|
|
12988
12988
|
object: e,
|
|
12989
12989
|
excluded: t
|
|
12990
12990
|
}) || n.push(e);
|
|
@@ -13007,7 +13007,7 @@ var ma = class {
|
|
|
13007
13007
|
bottom: (r - s) / a
|
|
13008
13008
|
};
|
|
13009
13009
|
}
|
|
13010
|
-
},
|
|
13010
|
+
}, uo = "#3D8BF4", fo = class e {
|
|
13011
13011
|
constructor({ editor: e }) {
|
|
13012
13012
|
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
13013
|
}
|
|
@@ -13100,8 +13100,8 @@ var ma = class {
|
|
|
13100
13100
|
this.isTargetMontageArea = l, this.activeGuides = d, this._hideToolbar(), n.requestRenderAll();
|
|
13101
13101
|
}
|
|
13102
13102
|
static _resolveTarget({ event: e, activeObject: t }) {
|
|
13103
|
-
let { target: n } = e, r =
|
|
13104
|
-
return n && !
|
|
13103
|
+
let { target: n } = e, r = so({ activeObject: t });
|
|
13104
|
+
return n && !co({
|
|
13105
13105
|
object: n,
|
|
13106
13106
|
excluded: r
|
|
13107
13107
|
}) ? n : null;
|
|
@@ -13218,18 +13218,18 @@ var ma = class {
|
|
|
13218
13218
|
let { canvas: e } = this, t = e.getSelectionContext();
|
|
13219
13219
|
if (!t) return;
|
|
13220
13220
|
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 =
|
|
13221
|
+
t.save(), Array.isArray(n) && t.transform(...n), t.lineWidth = 1 / r, t.strokeStyle = uo, t.setLineDash([]);
|
|
13222
13222
|
for (let e of this.activeGuides) {
|
|
13223
13223
|
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(),
|
|
13224
|
+
t.beginPath(), n === "vertical" ? (t.moveTo(i, a), t.lineTo(i, c)) : (t.moveTo(a, i), t.lineTo(c, i)), t.stroke(), to({
|
|
13225
13225
|
context: t,
|
|
13226
13226
|
type: n,
|
|
13227
13227
|
axis: i,
|
|
13228
13228
|
start: a,
|
|
13229
13229
|
end: c,
|
|
13230
|
-
text:
|
|
13230
|
+
text: wa({ distance: l }).toString(),
|
|
13231
13231
|
zoom: r,
|
|
13232
|
-
color:
|
|
13232
|
+
color: uo,
|
|
13233
13233
|
lineWidth: 1,
|
|
13234
13234
|
offsetAlongAxis: d,
|
|
13235
13235
|
offsetPerpendicular: 0
|
|
@@ -13247,13 +13247,13 @@ var ma = class {
|
|
|
13247
13247
|
let { toolbar: e } = this.editor;
|
|
13248
13248
|
e?.showAfterTemporary?.(), this.isToolbarHidden = !1;
|
|
13249
13249
|
}
|
|
13250
|
-
},
|
|
13250
|
+
}, po = class e {
|
|
13251
13251
|
constructor(e, t) {
|
|
13252
13252
|
this.options = t, this.containerId = e, this.editorId = `${e}-${D()}`, this.init();
|
|
13253
13253
|
}
|
|
13254
13254
|
async init() {
|
|
13255
13255
|
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
|
|
13256
|
+
if (de.apply(), this.canvas = new t(this.containerId, this.options), this.moduleLoader = new A(), this.workerManager = new M(), this.errorManager = new Yi({ 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 Kt({ editor: this }), this.shapeManager = new Vi({ editor: this }), this.interactionBlocker = new Wt({ editor: this }), this.backgroundManager = new Gt({ editor: this }), this.clipboardManager = new Ui({ editor: this }), this.objectLockManager = new Wi({ editor: this }), this.groupingManager = new Gi({ editor: this }), this.selectionManager = new Ki({ editor: this }), this.deletionManager = new qi({ editor: this }), this.panConstraintManager = new Xi({ editor: this }), this.snappingManager = new lo({ editor: this }), this.measurementManager = new fo({ editor: this }), this.fontManager = new fe(this.options.fonts ?? []), this.textManager = new ga({ editor: this }), this.templateManager = new xa({ editor: this }), u && (this.angleIndicator = new $e({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.interactionBlocker.ensureOverlay(), this.listeners = new k({
|
|
13257
13257
|
editor: this,
|
|
13258
13258
|
options: this.options
|
|
13259
13259
|
}), 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 +13361,7 @@ var ma = class {
|
|
|
13361
13361
|
"U+A640-A69F",
|
|
13362
13362
|
"U+FE2E-FE2F",
|
|
13363
13363
|
"U+2116"
|
|
13364
|
-
].join(", "),
|
|
13364
|
+
].join(", "), mo = {
|
|
13365
13365
|
preserveObjectStacking: !0,
|
|
13366
13366
|
controlsAboveOverlay: !0,
|
|
13367
13367
|
centeredRotation: !0,
|
|
@@ -14215,20 +14215,20 @@ var ma = class {
|
|
|
14215
14215
|
};
|
|
14216
14216
|
//#endregion
|
|
14217
14217
|
//#region src/main.ts
|
|
14218
|
-
function
|
|
14218
|
+
function ho(e, t = {}) {
|
|
14219
14219
|
let n = {
|
|
14220
|
-
...
|
|
14220
|
+
...mo,
|
|
14221
14221
|
...t
|
|
14222
14222
|
}, r = document.getElementById(e);
|
|
14223
14223
|
if (!r) return Promise.reject(/* @__PURE__ */ Error(`Контейнер с ID "${e}" не найден.`));
|
|
14224
14224
|
let i = document.createElement("canvas");
|
|
14225
14225
|
return i.id = `${e}-canvas`, r.appendChild(i), n.editorContainer = r, new Promise((t) => {
|
|
14226
14226
|
n._onReadyCallback = t;
|
|
14227
|
-
let r = new
|
|
14227
|
+
let r = new po(i.id, n);
|
|
14228
14228
|
window[e] = r;
|
|
14229
14229
|
});
|
|
14230
14230
|
}
|
|
14231
14231
|
//#endregion
|
|
14232
|
-
export {
|
|
14232
|
+
export { ho as default };
|
|
14233
14233
|
|
|
14234
14234
|
//# sourceMappingURL=main.js.map
|