@anu3ev/fabric-image-editor 0.8.0 → 0.8.1
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 +261 -261
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -605,7 +605,7 @@ var H = 180, U = {
|
|
|
605
605
|
width: oe({ value: e * n }),
|
|
606
606
|
height: oe({ value: t * n })
|
|
607
607
|
};
|
|
608
|
-
},
|
|
608
|
+
}, se = ({ spikes: e, outerRadius: t = 50, innerRadius: n = 22, centerX: r = 50, centerY: i = 50, rotation: a = -Math.PI / 2 }) => {
|
|
609
609
|
let o = [], s = e * 2;
|
|
610
610
|
for (let c = 0; c < s; c += 1) {
|
|
611
611
|
let s = c % 2 == 0 ? t : n, l = a + c * Math.PI / e;
|
|
@@ -615,7 +615,7 @@ var H = 180, U = {
|
|
|
615
615
|
});
|
|
616
616
|
}
|
|
617
617
|
return o;
|
|
618
|
-
},
|
|
618
|
+
}, G = [
|
|
619
619
|
{
|
|
620
620
|
key: "circle",
|
|
621
621
|
type: "ellipse",
|
|
@@ -822,7 +822,7 @@ var H = 180, U = {
|
|
|
822
822
|
type: "polygon",
|
|
823
823
|
width: H,
|
|
824
824
|
height: H,
|
|
825
|
-
points:
|
|
825
|
+
points: se({
|
|
826
826
|
spikes: 16,
|
|
827
827
|
outerRadius: 50,
|
|
828
828
|
innerRadius: 45,
|
|
@@ -840,7 +840,7 @@ var H = 180, U = {
|
|
|
840
840
|
type: "polygon",
|
|
841
841
|
width: H,
|
|
842
842
|
height: H,
|
|
843
|
-
points:
|
|
843
|
+
points: se({
|
|
844
844
|
spikes: 4,
|
|
845
845
|
outerRadius: 50,
|
|
846
846
|
innerRadius: 19.1,
|
|
@@ -1424,7 +1424,7 @@ var H = 180, U = {
|
|
|
1424
1424
|
type: "polygon",
|
|
1425
1425
|
width: H,
|
|
1426
1426
|
height: H,
|
|
1427
|
-
points:
|
|
1427
|
+
points: se({
|
|
1428
1428
|
spikes: 14,
|
|
1429
1429
|
outerRadius: 50,
|
|
1430
1430
|
innerRadius: 40,
|
|
@@ -1503,8 +1503,8 @@ var H = 180, U = {
|
|
|
1503
1503
|
}
|
|
1504
1504
|
}
|
|
1505
1505
|
], ce = "circle", le = "center", ue = "middle", de = {};
|
|
1506
|
-
for (let e = 0; e <
|
|
1507
|
-
let t =
|
|
1506
|
+
for (let e = 0; e < G.length; e += 1) {
|
|
1507
|
+
let t = G[e];
|
|
1508
1508
|
de[t.key] = t;
|
|
1509
1509
|
}
|
|
1510
1510
|
var fe = de, pe = ({ presetKey: e }) => fe[e] ?? null, me = ({ preset: e, rounding: t }) => B({ rounding: t }) <= 0 || e.type === "rect" ? e.key : e.roundedVariant ?? e.key;
|
|
@@ -1559,7 +1559,7 @@ function be({ value: e }) {
|
|
|
1559
1559
|
function xe({ stroke: e, strokeWidth: t }) {
|
|
1560
1560
|
return e == null ? !1 : Math.max(0, t ?? 0) > 0;
|
|
1561
1561
|
}
|
|
1562
|
-
function
|
|
1562
|
+
function K({ padding: e }) {
|
|
1563
1563
|
return {
|
|
1564
1564
|
top: ye({ value: e?.top }),
|
|
1565
1565
|
right: ye({ value: e?.right }),
|
|
@@ -1567,7 +1567,7 @@ function Se({ padding: e }) {
|
|
|
1567
1567
|
left: ye({ value: e?.left })
|
|
1568
1568
|
};
|
|
1569
1569
|
}
|
|
1570
|
-
function
|
|
1570
|
+
function Se({ padding: e }) {
|
|
1571
1571
|
return {
|
|
1572
1572
|
top: be({ value: e?.top }),
|
|
1573
1573
|
right: be({ value: e?.right }),
|
|
@@ -1575,7 +1575,7 @@ function Ce({ padding: e }) {
|
|
|
1575
1575
|
left: be({ value: e?.left })
|
|
1576
1576
|
};
|
|
1577
1577
|
}
|
|
1578
|
-
function
|
|
1578
|
+
function Ce({ stroke: e, strokeWidth: t }) {
|
|
1579
1579
|
if (!xe({
|
|
1580
1580
|
stroke: e,
|
|
1581
1581
|
strokeWidth: t
|
|
@@ -1593,16 +1593,16 @@ function we({ stroke: e, strokeWidth: t }) {
|
|
|
1593
1593
|
left: n
|
|
1594
1594
|
};
|
|
1595
1595
|
}
|
|
1596
|
-
function
|
|
1597
|
-
return t ?
|
|
1596
|
+
function we({ base: e, override: t }) {
|
|
1597
|
+
return t ? Se({ padding: {
|
|
1598
1598
|
top: t.top ?? e.top,
|
|
1599
1599
|
right: t.right ?? e.right,
|
|
1600
1600
|
bottom: t.bottom ?? e.bottom,
|
|
1601
1601
|
left: t.left ?? e.left
|
|
1602
1602
|
} }) : e;
|
|
1603
1603
|
}
|
|
1604
|
-
function
|
|
1605
|
-
let n =
|
|
1604
|
+
function Te({ base: e, addition: t }) {
|
|
1605
|
+
let n = K({ padding: e }), r = K({ padding: t });
|
|
1606
1606
|
return {
|
|
1607
1607
|
top: n.top + r.top,
|
|
1608
1608
|
right: n.right + r.right,
|
|
@@ -1610,16 +1610,16 @@ function Ee({ base: e, addition: t }) {
|
|
|
1610
1610
|
left: n.left + r.left
|
|
1611
1611
|
};
|
|
1612
1612
|
}
|
|
1613
|
-
function
|
|
1614
|
-
return
|
|
1613
|
+
function Ee({ baseInset: e, stroke: t, strokeWidth: n }) {
|
|
1614
|
+
return Te({
|
|
1615
1615
|
base: e,
|
|
1616
|
-
addition:
|
|
1616
|
+
addition: Ce({
|
|
1617
1617
|
stroke: t,
|
|
1618
1618
|
strokeWidth: n
|
|
1619
1619
|
})
|
|
1620
1620
|
});
|
|
1621
1621
|
}
|
|
1622
|
-
function
|
|
1622
|
+
function De({ padding: e }) {
|
|
1623
1623
|
if (!e) return {};
|
|
1624
1624
|
let t = {}, n = Object.keys(e);
|
|
1625
1625
|
for (let r = 0; r < n.length; r += 1) {
|
|
@@ -1630,7 +1630,7 @@ function Oe({ padding: e }) {
|
|
|
1630
1630
|
}
|
|
1631
1631
|
//#endregion
|
|
1632
1632
|
//#region src/editor/shape-manager/shape-runtime.ts
|
|
1633
|
-
var
|
|
1633
|
+
var Oe = ({ group: e }) => {
|
|
1634
1634
|
let t = !!e.locked, n = e;
|
|
1635
1635
|
typeof n.setInteractive == "function" && n.setInteractive(!0), n.set({
|
|
1636
1636
|
evented: !0,
|
|
@@ -1642,7 +1642,7 @@ var ke = ({ group: e }) => {
|
|
|
1642
1642
|
subTargetCheck: !0,
|
|
1643
1643
|
hoverCursor: void 0
|
|
1644
1644
|
});
|
|
1645
|
-
},
|
|
1645
|
+
}, ke = ({ text: e }) => {
|
|
1646
1646
|
let t = !!(e.locked || e.group?.locked);
|
|
1647
1647
|
e.set({
|
|
1648
1648
|
hasBorders: !1,
|
|
@@ -1655,7 +1655,7 @@ var ke = ({ group: e }) => {
|
|
|
1655
1655
|
autoExpand: !1,
|
|
1656
1656
|
shapeNodeType: "text"
|
|
1657
1657
|
}), e.setCoords();
|
|
1658
|
-
},
|
|
1658
|
+
}, Ae = ({ group: e }) => {
|
|
1659
1659
|
let { layoutManager: t } = e;
|
|
1660
1660
|
if (!t || typeof t.unsubscribeTargets != "function") return;
|
|
1661
1661
|
let n = e.getObjects();
|
|
@@ -1663,7 +1663,7 @@ var ke = ({ group: e }) => {
|
|
|
1663
1663
|
target: e,
|
|
1664
1664
|
targets: n
|
|
1665
1665
|
});
|
|
1666
|
-
},
|
|
1666
|
+
}, je = ({ group: e }) => {
|
|
1667
1667
|
let t = e.getObjects();
|
|
1668
1668
|
for (let e = 0; e < t.length; e += 1) {
|
|
1669
1669
|
let n = t[e];
|
|
@@ -1674,23 +1674,23 @@ var ke = ({ group: e }) => {
|
|
|
1674
1674
|
if (n instanceof _) return n;
|
|
1675
1675
|
}
|
|
1676
1676
|
return null;
|
|
1677
|
-
},
|
|
1677
|
+
}, Me = [
|
|
1678
1678
|
"tl",
|
|
1679
1679
|
"tr",
|
|
1680
1680
|
"bl",
|
|
1681
1681
|
"br"
|
|
1682
|
-
],
|
|
1682
|
+
], Ne = ({ transform: e }) => {
|
|
1683
1683
|
let { originX: t, originY: n } = e;
|
|
1684
1684
|
return (t === "center" || t === .5) && (n === "center" || n === .5);
|
|
1685
|
-
},
|
|
1685
|
+
}, Pe = ({ transform: e, x: t, y: n }) => {
|
|
1686
1686
|
let r = e, { target: i } = r, { scaleX: a = 1, scaleY: o = 1 } = i, s = b.getLocalPoint(r, r.originX, r.originY, t, n), c = Math.sign(s.x || r.signX || 1), l = Math.sign(s.y || r.signY || 1);
|
|
1687
1687
|
r.signX === void 0 && (r.signX = c), r.signY === void 0 && (r.signY = l);
|
|
1688
1688
|
let u = i._getTransformedDimensions(), d = Math.abs(s.x * a / u.x), f = Math.abs(s.y * o / u.y);
|
|
1689
|
-
|
|
1689
|
+
Ne({ transform: r }) && (d *= 2, f *= 2);
|
|
1690
1690
|
let p = !i.lockScalingX && (!i.lockScalingFlip || r.signX === c), m = !i.lockScalingY && (!i.lockScalingFlip || r.signY === l);
|
|
1691
1691
|
return p && i.set("scaleX", d), m && i.set("scaleY", f), a !== i.scaleX || o !== i.scaleY;
|
|
1692
|
-
},
|
|
1693
|
-
let e = b.wrapWithFireEvent("scaling", b.wrapWithFixedAnchor((e, t, n, r) =>
|
|
1692
|
+
}, Fe = () => {
|
|
1693
|
+
let e = b.wrapWithFireEvent("scaling", b.wrapWithFixedAnchor((e, t, n, r) => Pe({
|
|
1694
1694
|
transform: t,
|
|
1695
1695
|
x: n,
|
|
1696
1696
|
y: r
|
|
@@ -1706,31 +1706,31 @@ var ke = ({ group: e }) => {
|
|
|
1706
1706
|
a.uniformScaling = s;
|
|
1707
1707
|
}
|
|
1708
1708
|
};
|
|
1709
|
-
},
|
|
1709
|
+
}, Ie = ({ control: e }) => {
|
|
1710
1710
|
let t = new r({
|
|
1711
1711
|
...e,
|
|
1712
|
-
actionHandler:
|
|
1712
|
+
actionHandler: Fe()
|
|
1713
1713
|
});
|
|
1714
1714
|
return t.shapeFreeScaleCornerControl = !0, t;
|
|
1715
|
-
},
|
|
1715
|
+
}, Le = ({ group: e }) => {
|
|
1716
1716
|
let t = { ...e.controls };
|
|
1717
|
-
|
|
1717
|
+
Me.forEach((n) => {
|
|
1718
1718
|
let r = e.controls[n];
|
|
1719
|
-
r && (r.shapeFreeScaleCornerControl || (t[n] =
|
|
1719
|
+
r && (r.shapeFreeScaleCornerControl || (t[n] = Ie({ control: r })));
|
|
1720
1720
|
}), e.controls = t;
|
|
1721
|
-
},
|
|
1722
|
-
function
|
|
1721
|
+
}, Re = "shape-group";
|
|
1722
|
+
function ze() {
|
|
1723
1723
|
return { performLayout() {} };
|
|
1724
1724
|
}
|
|
1725
|
-
function
|
|
1725
|
+
function Be({ layoutManager: e }) {
|
|
1726
1726
|
let t = y.getClass("layoutManager");
|
|
1727
1727
|
if (!e) return new t();
|
|
1728
1728
|
let { strategy: n, type: r } = e, i = y.getClass(r);
|
|
1729
1729
|
return n ? new i(new (y.getClass(n))()) : new i();
|
|
1730
1730
|
}
|
|
1731
|
-
var
|
|
1731
|
+
var Ve = class e extends l {
|
|
1732
1732
|
static {
|
|
1733
|
-
this.type =
|
|
1733
|
+
this.type = Re;
|
|
1734
1734
|
}
|
|
1735
1735
|
constructor(e = [], t = {}) {
|
|
1736
1736
|
let { layoutManager: n, objectCaching: r, centeredScaling: i, lockScalingFlip: a, ...o } = t;
|
|
@@ -1747,23 +1747,23 @@ var He = class e extends l {
|
|
|
1747
1747
|
objectCaching: !1,
|
|
1748
1748
|
shapeComposite: !0
|
|
1749
1749
|
}), this.shapeTextAutoExpand === void 0 && (this.shapeTextAutoExpand = !0), this.shapeAlignHorizontal === void 0 && (this.shapeAlignHorizontal = le), this.shapeAlignVertical === void 0 && (this.shapeAlignVertical = ue);
|
|
1750
|
-
let e =
|
|
1750
|
+
let e = Se({ padding: {
|
|
1751
1751
|
top: this.shapePaddingTop,
|
|
1752
1752
|
right: this.shapePaddingRight,
|
|
1753
1753
|
bottom: this.shapePaddingBottom,
|
|
1754
1754
|
left: this.shapePaddingLeft
|
|
1755
1755
|
} });
|
|
1756
|
-
this.shapePaddingTop = e.top, this.shapePaddingRight = e.right, this.shapePaddingBottom = e.bottom, this.shapePaddingLeft = e.left, this._syncRoundability(),
|
|
1757
|
-
let t =
|
|
1758
|
-
t &&
|
|
1756
|
+
this.shapePaddingTop = e.top, this.shapePaddingRight = e.right, this.shapePaddingBottom = e.bottom, this.shapePaddingLeft = e.left, this._syncRoundability(), Oe({ group: this }), Le({ group: this });
|
|
1757
|
+
let t = je({ group: this });
|
|
1758
|
+
t && ke({ text: t }), Ae({ group: this }), this.setCoords();
|
|
1759
1759
|
}
|
|
1760
1760
|
static async fromObject({ type: t, objects: n = [], layoutManager: r, ...i }, a) {
|
|
1761
1761
|
let [o, s] = await Promise.all([C.enlivenObjects(n, a), C.enlivenObjectEnlivables(i, a)]), c = new e(o, {
|
|
1762
1762
|
...i,
|
|
1763
1763
|
...s,
|
|
1764
|
-
layoutManager:
|
|
1764
|
+
layoutManager: ze()
|
|
1765
1765
|
});
|
|
1766
|
-
return c.layoutManager =
|
|
1766
|
+
return c.layoutManager = Be({ layoutManager: r }), c.layoutManager.subscribeTargets({
|
|
1767
1767
|
type: "initialization",
|
|
1768
1768
|
target: c,
|
|
1769
1769
|
targets: c.getObjects()
|
|
@@ -1776,19 +1776,19 @@ var He = class e extends l {
|
|
|
1776
1776
|
let t = pe({ presetKey: e });
|
|
1777
1777
|
t && (this.shapeCanRound = ve({ preset: t }));
|
|
1778
1778
|
}
|
|
1779
|
-
},
|
|
1780
|
-
y?.setClass && y.setClass(
|
|
1781
|
-
},
|
|
1782
|
-
if (
|
|
1783
|
-
if (e?.group &&
|
|
1779
|
+
}, He = () => {
|
|
1780
|
+
y?.setClass && y.setClass(Ve, Re);
|
|
1781
|
+
}, q = (e) => e instanceof Ve || e instanceof l && e.shapeComposite === !0, Ue = ({ target: e, subTargets: t = [] }) => {
|
|
1782
|
+
if (q(e)) return e;
|
|
1783
|
+
if (e?.group && q(e.group)) return e.group;
|
|
1784
1784
|
for (let e = 0; e < t.length; e += 1) {
|
|
1785
1785
|
let n = t[e];
|
|
1786
|
-
if (
|
|
1786
|
+
if (q(n)) return n;
|
|
1787
1787
|
let { group: r } = n;
|
|
1788
|
-
if (r &&
|
|
1788
|
+
if (r && q(r)) return r;
|
|
1789
1789
|
}
|
|
1790
1790
|
return null;
|
|
1791
|
-
},
|
|
1791
|
+
}, We = ({ group: e }) => {
|
|
1792
1792
|
let t = e.getObjects();
|
|
1793
1793
|
for (let e = 0; e < t.length; e += 1) {
|
|
1794
1794
|
let n = t[e];
|
|
@@ -1799,7 +1799,7 @@ var He = class e extends l {
|
|
|
1799
1799
|
if (!(n instanceof _)) return n;
|
|
1800
1800
|
}
|
|
1801
1801
|
return null;
|
|
1802
|
-
},
|
|
1802
|
+
}, Ge = ({ group: e }) => {
|
|
1803
1803
|
let t = e.getObjects();
|
|
1804
1804
|
for (let e = 0; e < t.length; e += 1) {
|
|
1805
1805
|
let n = t[e];
|
|
@@ -1810,11 +1810,11 @@ var He = class e extends l {
|
|
|
1810
1810
|
if (n instanceof _) return n;
|
|
1811
1811
|
}
|
|
1812
1812
|
return null;
|
|
1813
|
-
},
|
|
1814
|
-
shape:
|
|
1815
|
-
text:
|
|
1813
|
+
}, Ke = ({ group: e }) => ({
|
|
1814
|
+
shape: We({ group: e }),
|
|
1815
|
+
text: Ge({ group: e })
|
|
1816
1816
|
}), qe = ({ group: e }) => {
|
|
1817
|
-
|
|
1817
|
+
Oe({ group: e });
|
|
1818
1818
|
}, Je = {
|
|
1819
1819
|
style: {
|
|
1820
1820
|
position: "absolute",
|
|
@@ -2017,7 +2017,7 @@ var He = class e extends l {
|
|
|
2017
2017
|
}
|
|
2018
2018
|
_resolveCurrentTarget() {
|
|
2019
2019
|
let e = this.canvas.getActiveObject();
|
|
2020
|
-
return
|
|
2020
|
+
return Ue({ target: e }) ?? e ?? null;
|
|
2021
2021
|
}
|
|
2022
2022
|
destroy() {
|
|
2023
2023
|
this.el.removeEventListener("mouseover", this._onBtnOver), this.el.removeEventListener("mouseout", this._onBtnOut), this.canvas.off("mouse:down", this._onMouseDown), this.canvas.off("object:moving", this._onObjectMoving), this.canvas.off("object:scaling", this._onObjectScaling), this.canvas.off("object:rotating", this._onObjectRotating), this.canvas.off("mouse:up", this._onMouseUp), this.canvas.off("object:modified", this._onObjectModified), this.canvas.off("selection:created", this._onSelectionChange), this.canvas.off("selection:updated", this._onSelectionChange), this.canvas.off("after:render", this._onSelectionChange), this.canvas.off("selection:cleared", this._onSelectionClear), this.el.remove();
|
|
@@ -4483,7 +4483,7 @@ function xn({ padding: e, internalShapeTextInset: t, height: n, textHeight: r, c
|
|
|
4483
4483
|
};
|
|
4484
4484
|
}
|
|
4485
4485
|
function Sn({ text: e, width: t, height: n, padding: r, internalShapeTextInset: i, expandShapeHeightToFitText: a, changedPadding: o, measureTextboxHeightForFrame: s, resolveMinimumTextFrameWidth: c }) {
|
|
4486
|
-
let l = Math.max(1, t), u = Math.max(1, n), d =
|
|
4486
|
+
let l = Math.max(1, t), u = Math.max(1, n), d = K({ padding: r }), f = K({ padding: i }), p = bn({
|
|
4487
4487
|
text: e,
|
|
4488
4488
|
width: l,
|
|
4489
4489
|
height: u,
|
|
@@ -4580,7 +4580,7 @@ var On = ({ text: e, width: t, height: n, alignV: r, padding: i, internalShapeTe
|
|
|
4580
4580
|
appliedUserPadding: h
|
|
4581
4581
|
});
|
|
4582
4582
|
}, kn = ({ text: e, width: t, height: n, alignV: r, padding: i, internalShapeTextInset: a, resolveInternalShapeTextInset: o, expandShapeHeightToFitText: s = !0, changedPadding: c }) => {
|
|
4583
|
-
let l =
|
|
4583
|
+
let l = Se({ padding: i }), u = K({ padding: a }), d = Math.max(Y, t), f = Math.max(Y, n), p = Sn({
|
|
4584
4584
|
text: e,
|
|
4585
4585
|
width: d,
|
|
4586
4586
|
height: f,
|
|
@@ -4804,7 +4804,7 @@ var Mn = ({ text: e, currentWidth: t, minimumWidth: n, padding: r, montageAreaWi
|
|
|
4804
4804
|
let a = Un({
|
|
4805
4805
|
width: Math.max(Y, t),
|
|
4806
4806
|
height: Math.max(Y, n),
|
|
4807
|
-
padding:
|
|
4807
|
+
padding: K({ padding: i })
|
|
4808
4808
|
}), o = Xn({
|
|
4809
4809
|
text: e,
|
|
4810
4810
|
frameWidth: a.width
|
|
@@ -4849,22 +4849,22 @@ function In({ text: e }) {
|
|
|
4849
4849
|
return (e.text ?? "").trim().length > 0;
|
|
4850
4850
|
}
|
|
4851
4851
|
function Ln({ width: e, padding: t, resolvePaddingForWidth: n }) {
|
|
4852
|
-
return
|
|
4852
|
+
return K(n ? { padding: n({ width: Math.max(Y, e) }) } : { padding: t });
|
|
4853
4853
|
}
|
|
4854
4854
|
function Rn({ width: e, height: t, padding: n, resolvePaddingForSize: r }) {
|
|
4855
|
-
return
|
|
4855
|
+
return K(r ? { padding: r({
|
|
4856
4856
|
width: Math.max(Y, e),
|
|
4857
4857
|
height: Math.max(Y, t)
|
|
4858
4858
|
}) } : { padding: n });
|
|
4859
4859
|
}
|
|
4860
4860
|
function zn({ width: e, height: t, internalShapeTextInset: n, resolveInternalShapeTextInset: r }) {
|
|
4861
|
-
return
|
|
4861
|
+
return K(r ? { padding: r({
|
|
4862
4862
|
width: Math.max(Y, e),
|
|
4863
4863
|
height: Math.max(Y, t)
|
|
4864
4864
|
}) } : { padding: n });
|
|
4865
4865
|
}
|
|
4866
4866
|
function Bn({ text: e, width: t, height: n, padding: r, internalShapeTextInset: i, resolveInternalShapeTextInset: a, expandShapeHeightToFitText: o = !0, changedPadding: s }) {
|
|
4867
|
-
let c =
|
|
4867
|
+
let c = Se({ padding: r }), l = K({ padding: i }), u = Math.max(Y, t), d = Math.max(Y, n), f = Sn({
|
|
4868
4868
|
text: e,
|
|
4869
4869
|
width: u,
|
|
4870
4870
|
height: d,
|
|
@@ -5160,8 +5160,8 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
5160
5160
|
constructor({ canvas: t }) {
|
|
5161
5161
|
this.handleObjectScaling = (t) => {
|
|
5162
5162
|
let { target: n, transform: r } = t;
|
|
5163
|
-
if (!
|
|
5164
|
-
let i = n, { shape: a, text: o } =
|
|
5163
|
+
if (!q(n)) return;
|
|
5164
|
+
let i = n, { shape: a, text: o } = Ke({ group: i });
|
|
5165
5165
|
if (!a || !o) return;
|
|
5166
5166
|
i.set({
|
|
5167
5167
|
lockScalingFlip: !0,
|
|
@@ -5221,12 +5221,12 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
5221
5221
|
let n = this.canvas._currentTransform;
|
|
5222
5222
|
if (!n) return;
|
|
5223
5223
|
let { target: r } = n;
|
|
5224
|
-
if (!
|
|
5224
|
+
if (!q(r)) return;
|
|
5225
5225
|
let { canScaleHeight: i, canScaleWidth: a } = sr({ transform: n });
|
|
5226
5226
|
if (!a && !i) return;
|
|
5227
5227
|
let o = r, s = this.scalingState.get(o);
|
|
5228
5228
|
if (!s || s.isProportionalScaling) return;
|
|
5229
|
-
let { shape: c, text: l } =
|
|
5229
|
+
let { shape: c, text: l } = Ke({ group: o });
|
|
5230
5230
|
if (!c || !l) return;
|
|
5231
5231
|
let u = e._resolveScalingConstraintPadding({ group: o }), d = o.shapeAlignHorizontal ?? "center", f = Math.abs(o.scaleX ?? s.lastAllowedScaleX ?? 1) || 1, p = Math.abs(o.scaleY ?? s.lastAllowedScaleY ?? 1) || 1, m = {
|
|
5232
5232
|
...t,
|
|
@@ -5310,12 +5310,12 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
5310
5310
|
}), this.canvas.requestRenderAll();
|
|
5311
5311
|
}, this.handleObjectModified = (t) => {
|
|
5312
5312
|
let { target: n } = t;
|
|
5313
|
-
if (!
|
|
5313
|
+
if (!q(n)) return;
|
|
5314
5314
|
let r = n, i = this.scalingState.get(r), a = Math.abs(r.scaleX ?? 1) || 1, o = Math.abs(r.scaleY ?? 1) || 1;
|
|
5315
5315
|
if (!(Math.abs(a - 1) > Z || Math.abs(o - 1) > Z) && !i) return;
|
|
5316
5316
|
let s = i?.startWidth ?? Math.max(X, r.shapeBaseWidth ?? r.width ?? r.shapeManualBaseWidth ?? X), c = i?.startHeight ?? Math.max(X, r.shapeBaseHeight ?? r.height ?? r.shapeManualBaseHeight ?? X), l = i?.startManualBaseWidth ?? Math.max(X, r.shapeManualBaseWidth ?? s), u = i?.startManualBaseHeight ?? Math.max(X, r.shapeManualBaseHeight ?? c);
|
|
5317
5317
|
if (i?.blockedScaleAttempt && i) {
|
|
5318
|
-
let { shape: e, text: t } =
|
|
5318
|
+
let { shape: e, text: t } = Ke({ group: r });
|
|
5319
5319
|
this._restoreGroupTransformOnly({
|
|
5320
5320
|
group: r,
|
|
5321
5321
|
shape: e,
|
|
@@ -5324,7 +5324,7 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
5324
5324
|
}), r.shapeScalingNoopTransform = !1, this.scalingState.delete(r), this.canvas.requestRenderAll();
|
|
5325
5325
|
return;
|
|
5326
5326
|
}
|
|
5327
|
-
let { shape: d, text: f } =
|
|
5327
|
+
let { shape: d, text: f } = Ke({ group: r });
|
|
5328
5328
|
if (!d || !f) {
|
|
5329
5329
|
this.scalingState.delete(r);
|
|
5330
5330
|
return;
|
|
@@ -5647,7 +5647,7 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
5647
5647
|
});
|
|
5648
5648
|
}
|
|
5649
5649
|
static _resolveUserPadding({ group: e }) {
|
|
5650
|
-
return
|
|
5650
|
+
return Se({ padding: {
|
|
5651
5651
|
top: e.shapePaddingTop,
|
|
5652
5652
|
right: e.shapePaddingRight,
|
|
5653
5653
|
bottom: e.shapePaddingBottom,
|
|
@@ -5656,7 +5656,7 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
5656
5656
|
}
|
|
5657
5657
|
static _resolveInternalShapeTextInset({ group: e, width: t, height: n }) {
|
|
5658
5658
|
let r = e.shapePresetKey ?? "", i = r ? pe({ presetKey: r }) : null;
|
|
5659
|
-
return
|
|
5659
|
+
return Ee({
|
|
5660
5660
|
baseInset: i ? ge({
|
|
5661
5661
|
preset: i,
|
|
5662
5662
|
width: t,
|
|
@@ -5763,17 +5763,17 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
5763
5763
|
}, vr = class {
|
|
5764
5764
|
constructor({ canvas: e }) {
|
|
5765
5765
|
this.handleMouseDown = (e) => {
|
|
5766
|
-
let { target: t, e: n, subTargets: r = [] } = e, i =
|
|
5766
|
+
let { target: t, e: n, subTargets: r = [] } = e, i = Ue({
|
|
5767
5767
|
target: t,
|
|
5768
5768
|
subTargets: r
|
|
5769
5769
|
});
|
|
5770
5770
|
if (!i) return;
|
|
5771
|
-
let { text: a } =
|
|
5771
|
+
let { text: a } = Ke({ group: i });
|
|
5772
5772
|
if (!a) return;
|
|
5773
5773
|
let o = this.canvas.getActiveObject(), s = o === i;
|
|
5774
5774
|
if (!(o === a && a.isEditing)) {
|
|
5775
5775
|
if (!s) {
|
|
5776
|
-
a.isEditing ||
|
|
5776
|
+
a.isEditing || ke({ text: a });
|
|
5777
5777
|
return;
|
|
5778
5778
|
}
|
|
5779
5779
|
n instanceof MouseEvent && (n.detail < 2 || this.enterTextEditing({ group: i }));
|
|
@@ -5782,7 +5782,7 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
5782
5782
|
let { target: t } = e;
|
|
5783
5783
|
if (!(t instanceof _)) return;
|
|
5784
5784
|
let n = t, { group: r } = n;
|
|
5785
|
-
|
|
5785
|
+
q(r) && (this._enterTextEditingInteractionMode({
|
|
5786
5786
|
group: r,
|
|
5787
5787
|
text: n
|
|
5788
5788
|
}), this.canvas.requestRenderAll());
|
|
@@ -5790,17 +5790,17 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
5790
5790
|
let { target: t } = e;
|
|
5791
5791
|
if (!(t instanceof _)) return;
|
|
5792
5792
|
let n = t, { group: r } = n;
|
|
5793
|
-
|
|
5793
|
+
q(r) && (this._restoreTextEditingInteractionMode({
|
|
5794
5794
|
group: r,
|
|
5795
5795
|
text: n
|
|
5796
|
-
}),
|
|
5796
|
+
}), ke({ text: n }), this.canvas.getActiveObject() === n && this.canvas.setActiveObject(r), this.canvas.requestRenderAll());
|
|
5797
5797
|
}, this.canvas = e, this.editingInteractionState = /* @__PURE__ */ new WeakMap(), this.editingTargetResolverState = void 0;
|
|
5798
5798
|
}
|
|
5799
5799
|
enterTextEditing({ group: e }) {
|
|
5800
|
-
let { text: t } =
|
|
5800
|
+
let { text: t } = Ke({ group: e });
|
|
5801
5801
|
if (t) {
|
|
5802
5802
|
if (e.locked || t.locked) {
|
|
5803
|
-
|
|
5803
|
+
ke({ text: t }), this.canvas.requestRenderAll();
|
|
5804
5804
|
return;
|
|
5805
5805
|
}
|
|
5806
5806
|
this._enterTextEditingInteractionMode({
|
|
@@ -5860,7 +5860,7 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
5860
5860
|
let r = this.canvas, i = r.findTarget.bind(r);
|
|
5861
5861
|
r.findTarget = (n) => {
|
|
5862
5862
|
let r = i(n);
|
|
5863
|
-
if (this.canvas.getActiveObject() !== t || !t.isEditing || r.target === t ||
|
|
5863
|
+
if (this.canvas.getActiveObject() !== t || !t.isEditing || r.target === t || Ue({
|
|
5864
5864
|
target: r.target,
|
|
5865
5865
|
subTargets: r.subTargets
|
|
5866
5866
|
}) !== e) return r;
|
|
@@ -5949,7 +5949,7 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
5949
5949
|
if (!t) return null;
|
|
5950
5950
|
this.pendingTextUpdates.delete(e);
|
|
5951
5951
|
let n = this.fireUpdated({ lifecycle: t }), { group: r } = e;
|
|
5952
|
-
return
|
|
5952
|
+
return q(r) && this.textEditingSnapshots.has(r) && this.textEditingSnapshots.set(r, n), n;
|
|
5953
5953
|
}
|
|
5954
5954
|
captureResizeStart({ group: t }) {
|
|
5955
5955
|
this.resizeStartSnapshots.has(t) || this.resizeStartSnapshots.set(t, e.getSnapshot({ group: t }));
|
|
@@ -5981,7 +5981,7 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
5981
5981
|
}));
|
|
5982
5982
|
}
|
|
5983
5983
|
static getSnapshot({ group: t }) {
|
|
5984
|
-
let { id: n, shapePresetKey: r, shapeBaseWidth: i, shapeBaseHeight: a, shapeManualBaseWidth: o, shapeManualBaseHeight: s, shapeTextAutoExpand: c, shapeAlignHorizontal: l, shapeAlignVertical: u, shapePaddingTop: d, shapePaddingRight: f, shapePaddingBottom: p, shapePaddingLeft: m, shapeFill: h, shapeStroke: g, shapeStrokeWidth: _, shapeStrokeDashArray: v, shapeOpacity: y, shapeRounding: b, left: x, top: S, originX: C, originY: w, angle: T, flipX: E, flipY: D, scaleX: O, scaleY: k } = t, { text: A } =
|
|
5984
|
+
let { id: n, shapePresetKey: r, shapeBaseWidth: i, shapeBaseHeight: a, shapeManualBaseWidth: o, shapeManualBaseHeight: s, shapeTextAutoExpand: c, shapeAlignHorizontal: l, shapeAlignVertical: u, shapePaddingTop: d, shapePaddingRight: f, shapePaddingBottom: p, shapePaddingLeft: m, shapeFill: h, shapeStroke: g, shapeStrokeWidth: _, shapeStrokeDashArray: v, shapeOpacity: y, shapeRounding: b, left: x, top: S, originX: C, originY: w, angle: T, flipX: E, flipY: D, scaleX: O, scaleY: k } = t, { text: A } = Ke({ group: t });
|
|
5985
5985
|
return {
|
|
5986
5986
|
id: n,
|
|
5987
5987
|
presetKey: r,
|
|
@@ -6083,11 +6083,11 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
6083
6083
|
}, br = "#B4B7BD", xr = 0, Sr = 1, Cr = class {
|
|
6084
6084
|
constructor({ editor: e }) {
|
|
6085
6085
|
this._handleObjectScaling = (e) => {
|
|
6086
|
-
let t = e.target &&
|
|
6086
|
+
let t = e.target && q(e.target) ? e.target : null;
|
|
6087
6087
|
t && this.lifecycleController.beginResize({ group: t }), this.scalingController.handleObjectScaling(e);
|
|
6088
6088
|
}, this._handleObjectModified = (e) => {
|
|
6089
6089
|
this.scalingController.handleObjectModified(e);
|
|
6090
|
-
let t = e.target &&
|
|
6090
|
+
let t = e.target && q(e.target) ? e.target : null;
|
|
6091
6091
|
t && this.lifecycleController.finishResize({ group: t });
|
|
6092
6092
|
}, this._handleMouseMove = (e) => {
|
|
6093
6093
|
this.scalingController.handleCanvasMouseMove(e);
|
|
@@ -6104,7 +6104,7 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
6104
6104
|
let t = null, { target: n } = e;
|
|
6105
6105
|
if (n instanceof _) {
|
|
6106
6106
|
let e = n, { group: r } = e;
|
|
6107
|
-
|
|
6107
|
+
q(r) && (this.editingPlacements.delete(r), t = {
|
|
6108
6108
|
group: r,
|
|
6109
6109
|
textNode: e
|
|
6110
6110
|
});
|
|
@@ -6114,19 +6114,19 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
6114
6114
|
let { target: t } = e;
|
|
6115
6115
|
if (t instanceof _) {
|
|
6116
6116
|
let { group: e } = t;
|
|
6117
|
-
|
|
6117
|
+
q(e) && (this._detachShapeGroupAutoLayout({ group: e }), this.lifecycleController.beginTextEditing({ group: e }), this.editingPlacements.set(e, this.editor.canvasManager.getObjectPlacement({ object: e })));
|
|
6118
6118
|
}
|
|
6119
6119
|
this.editingController.handleTextEditingEntered(e);
|
|
6120
6120
|
}, this._handleTextChanged = (e) => {
|
|
6121
6121
|
let { target: t } = e;
|
|
6122
6122
|
if (!(t instanceof _)) return;
|
|
6123
6123
|
let n = t, { group: r } = n;
|
|
6124
|
-
|
|
6124
|
+
q(r) && this._syncShapeTextLayoutAfterTextMutation({ textNode: n }) && this.editor.canvas.requestRenderAll();
|
|
6125
6125
|
}, this._handleBeforeTextUpdated = (e) => {
|
|
6126
6126
|
let { textbox: t, style: n } = e;
|
|
6127
6127
|
if (!(t instanceof _)) return;
|
|
6128
6128
|
let r = t, { group: i } = r;
|
|
6129
|
-
if (!
|
|
6129
|
+
if (!q(i) || this.internalTextUpdates.has(r)) return;
|
|
6130
6130
|
let a = this.lifecycleController.beginTextUpdate({
|
|
6131
6131
|
group: i,
|
|
6132
6132
|
textNode: r,
|
|
@@ -6145,7 +6145,7 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
6145
6145
|
if (!(t instanceof _)) return;
|
|
6146
6146
|
let n = t;
|
|
6147
6147
|
this.lifecycleController.finishTextUpdate({ textNode: n });
|
|
6148
|
-
}, this.editor = e,
|
|
6148
|
+
}, this.editor = e, He(), this.scalingController = new _r({ canvas: e.canvas }), this.editingController = new vr({ canvas: e.canvas }), this.editingPlacements = /* @__PURE__ */ new WeakMap(), this.lifecycleController = new yr({ canvas: e.canvas }), this.internalTextUpdates = /* @__PURE__ */ new WeakSet(), this._bindEvents();
|
|
6149
6149
|
}
|
|
6150
6150
|
async add({ presetKey: e = ce, options: t = {} } = {}) {
|
|
6151
6151
|
let n = pe({ presetKey: e });
|
|
@@ -6203,7 +6203,7 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
6203
6203
|
}), E = l ?? "middle", O = this._resolveShapeStyle({
|
|
6204
6204
|
options: t,
|
|
6205
6205
|
fallback: null
|
|
6206
|
-
}), k =
|
|
6206
|
+
}), k = Se({ padding: u }), A = ({ width: e, height: t }) => Ee({
|
|
6207
6207
|
baseInset: ge({
|
|
6208
6208
|
preset: m,
|
|
6209
6209
|
width: e,
|
|
@@ -6211,7 +6211,7 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
6211
6211
|
}),
|
|
6212
6212
|
stroke: O.stroke,
|
|
6213
6213
|
strokeWidth: O.strokeWidth
|
|
6214
|
-
}), j =
|
|
6214
|
+
}), j = Ee({
|
|
6215
6215
|
baseInset: ge({
|
|
6216
6216
|
preset: m,
|
|
6217
6217
|
width: b,
|
|
@@ -6219,10 +6219,10 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
6219
6219
|
}),
|
|
6220
6220
|
stroke: O.stroke,
|
|
6221
6221
|
strokeWidth: O.strokeWidth
|
|
6222
|
-
}), M =
|
|
6222
|
+
}), M = Te({
|
|
6223
6223
|
base: j,
|
|
6224
6224
|
addition: k
|
|
6225
|
-
}), N =
|
|
6225
|
+
}), N = De({ padding: u }), P = this._createTextNode({
|
|
6226
6226
|
text: o,
|
|
6227
6227
|
textStyle: s,
|
|
6228
6228
|
width: b,
|
|
@@ -6235,7 +6235,7 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
6235
6235
|
manualWidth: b,
|
|
6236
6236
|
shapeTextAutoExpandEnabled: w,
|
|
6237
6237
|
padding: M,
|
|
6238
|
-
resolvePaddingForWidth: ({ width: e }) =>
|
|
6238
|
+
resolvePaddingForWidth: ({ width: e }) => Te({
|
|
6239
6239
|
base: A({
|
|
6240
6240
|
width: e,
|
|
6241
6241
|
height: x
|
|
@@ -6277,60 +6277,60 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
6277
6277
|
async update({ target: e, presetKey: t, options: n = {} } = {}) {
|
|
6278
6278
|
let r = this._resolveShapeGroup({ target: e });
|
|
6279
6279
|
if (!r) return null;
|
|
6280
|
-
let i =
|
|
6281
|
-
if (!
|
|
6282
|
-
let { left:
|
|
6280
|
+
let i = r.shapePresetKey ?? "circle", a = t ?? i, o = pe({ presetKey: a });
|
|
6281
|
+
if (!o) return null;
|
|
6282
|
+
let { left: s, top: c, originX: l, originY: u, width: d, height: f, preserveCurrentAspectRatio: p, shapeTextAutoExpand: m, text: h, textStyle: g, alignH: _, alignV: v, textPadding: y, rounding: b, withoutSelection: x, withoutSave: S } = n, C = this.editor.canvasManager.resolveObjectPlacement({
|
|
6283
6283
|
object: r,
|
|
6284
|
-
left:
|
|
6285
|
-
top:
|
|
6286
|
-
originX:
|
|
6287
|
-
originY:
|
|
6288
|
-
}),
|
|
6289
|
-
preset:
|
|
6290
|
-
rounding:
|
|
6291
|
-
}) }) ??
|
|
6292
|
-
width: Math.max(1,
|
|
6293
|
-
height: Math.max(1,
|
|
6294
|
-
} : null, { width:
|
|
6295
|
-
targetWidth:
|
|
6296
|
-
targetHeight:
|
|
6297
|
-
aspectWidth:
|
|
6298
|
-
aspectHeight:
|
|
6284
|
+
left: s,
|
|
6285
|
+
top: c,
|
|
6286
|
+
originX: l,
|
|
6287
|
+
originY: u
|
|
6288
|
+
}), w = this._resolveCurrentDimensions({ group: r }), T = this._resolveManualDimensions({ group: r }), E = this._resolveReplaceBoxDimensions({ group: r }), D = this._isShapeTextAutoExpandEnabled({ group: r }), O = m === void 0 ? D : m !== !1, k = B(b === void 0 ? { rounding: r.shapeRounding } : { rounding: b }), A = pe({ presetKey: me({
|
|
6289
|
+
preset: o,
|
|
6290
|
+
rounding: k
|
|
6291
|
+
}) }) ?? o, j = ve({ preset: A }), M = j ? k : 0, { width: N, height: P } = A, F = !!p, I = t !== void 0 && a !== i, ee = I && !F, te = ee ? {
|
|
6292
|
+
width: Math.max(1, d ?? E.width),
|
|
6293
|
+
height: Math.max(1, f ?? E.height)
|
|
6294
|
+
} : null, { width: L, height: ne } = te ? this._resolveAspectRatioFittedDimensions({
|
|
6295
|
+
targetWidth: te.width,
|
|
6296
|
+
targetHeight: te.height,
|
|
6297
|
+
aspectWidth: N,
|
|
6298
|
+
aspectHeight: P
|
|
6299
6299
|
}) : {
|
|
6300
|
-
width: Math.max(1,
|
|
6301
|
-
height: Math.max(1,
|
|
6302
|
-
},
|
|
6303
|
-
base:
|
|
6304
|
-
override:
|
|
6305
|
-
}),
|
|
6300
|
+
width: Math.max(1, d ?? w.width),
|
|
6301
|
+
height: Math.max(1, f ?? w.height)
|
|
6302
|
+
}, re = _ ?? r.shapeAlignHorizontal ?? "center", R = v ?? r.shapeAlignVertical ?? "middle", ie = this._resolveGroupUserPadding({ group: r }), z = De({ padding: y }), V = we({
|
|
6303
|
+
base: ie,
|
|
6304
|
+
override: y
|
|
6305
|
+
}), H = this._resolveShapeStyle({
|
|
6306
6306
|
options: n,
|
|
6307
6307
|
fallback: r
|
|
6308
|
-
}),
|
|
6308
|
+
}), U = ({ width: e, height: t }) => Ee({
|
|
6309
6309
|
baseInset: ge({
|
|
6310
|
-
preset:
|
|
6310
|
+
preset: A,
|
|
6311
6311
|
width: e,
|
|
6312
6312
|
height: t
|
|
6313
6313
|
}),
|
|
6314
|
-
stroke:
|
|
6315
|
-
strokeWidth:
|
|
6316
|
-
}),
|
|
6317
|
-
base:
|
|
6318
|
-
width:
|
|
6319
|
-
height:
|
|
6314
|
+
stroke: H.stroke,
|
|
6315
|
+
strokeWidth: H.strokeWidth
|
|
6316
|
+
}), ae = Te({
|
|
6317
|
+
base: U({
|
|
6318
|
+
width: L,
|
|
6319
|
+
height: ne
|
|
6320
6320
|
}),
|
|
6321
|
-
addition:
|
|
6322
|
-
}),
|
|
6323
|
-
|
|
6324
|
-
let { shape:
|
|
6325
|
-
if (!
|
|
6326
|
-
let
|
|
6321
|
+
addition: V
|
|
6322
|
+
}), oe = T.width, W = T.height;
|
|
6323
|
+
I && (oe = L, W = ne), !I && d !== void 0 && (oe = Math.max(1, d)), !I && f !== void 0 && (W = Math.max(1, f)), !I && d === void 0 && D && !O && (oe = w.width);
|
|
6324
|
+
let { shape: se, text: G } = Ke({ group: r });
|
|
6325
|
+
if (!se || !G) return null;
|
|
6326
|
+
let ce = this.lifecycleController.createContext({
|
|
6327
6327
|
group: r,
|
|
6328
6328
|
source: "update",
|
|
6329
6329
|
target: e,
|
|
6330
|
-
presetKey:
|
|
6330
|
+
presetKey: A.key,
|
|
6331
6331
|
options: n,
|
|
6332
|
-
withoutSave:
|
|
6333
|
-
}),
|
|
6332
|
+
withoutSave: S
|
|
6333
|
+
}), le = {
|
|
6334
6334
|
angle: 0,
|
|
6335
6335
|
skewX: 0,
|
|
6336
6336
|
skewY: 0,
|
|
@@ -6343,91 +6343,91 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
6343
6343
|
top: 0,
|
|
6344
6344
|
originX: "left",
|
|
6345
6345
|
originY: "top"
|
|
6346
|
-
},
|
|
6347
|
-
text:
|
|
6348
|
-
textStyle: this._resolveCurrentTextStyle({ textNode:
|
|
6349
|
-
width: Math.max(1,
|
|
6350
|
-
align:
|
|
6346
|
+
}, ue = G, de = this._createTextNode({
|
|
6347
|
+
text: ue.textCaseRaw ?? G.text ?? "",
|
|
6348
|
+
textStyle: this._resolveCurrentTextStyle({ textNode: G }),
|
|
6349
|
+
width: Math.max(1, G.width ?? w.width),
|
|
6350
|
+
align: re
|
|
6351
6351
|
});
|
|
6352
|
-
|
|
6353
|
-
textNode:
|
|
6354
|
-
text:
|
|
6355
|
-
textStyle:
|
|
6356
|
-
align:
|
|
6352
|
+
de.set(le), this._applyTextUpdates({
|
|
6353
|
+
textNode: de,
|
|
6354
|
+
text: h,
|
|
6355
|
+
textStyle: g,
|
|
6356
|
+
align: re
|
|
6357
6357
|
});
|
|
6358
|
-
let
|
|
6359
|
-
|
|
6360
|
-
text:
|
|
6361
|
-
currentWidth:
|
|
6362
|
-
manualWidth:
|
|
6363
|
-
shapeTextAutoExpandEnabled:
|
|
6364
|
-
padding:
|
|
6365
|
-
resolvePaddingForWidth: ({ width: e }) =>
|
|
6366
|
-
base:
|
|
6358
|
+
let fe = d === void 0 && f === void 0 && !I && m === void 0 && b === void 0 && h === void 0 && !this._hasShapeTextSizeAffectingStyleChanges({ textStyle: g }), he = y !== void 0 && fe, _e = L, ye = ne;
|
|
6359
|
+
fe ? (_e = w.width, ye = w.height) : ee || (_e = this._resolveShapeLayoutWidth({
|
|
6360
|
+
text: de,
|
|
6361
|
+
currentWidth: L,
|
|
6362
|
+
manualWidth: oe,
|
|
6363
|
+
shapeTextAutoExpandEnabled: O,
|
|
6364
|
+
padding: ae,
|
|
6365
|
+
resolvePaddingForWidth: ({ width: e }) => Te({
|
|
6366
|
+
base: U({
|
|
6367
6367
|
width: e,
|
|
6368
|
-
height:
|
|
6368
|
+
height: ne
|
|
6369
6369
|
}),
|
|
6370
|
-
addition:
|
|
6370
|
+
addition: V
|
|
6371
6371
|
})
|
|
6372
6372
|
}));
|
|
6373
|
-
let
|
|
6374
|
-
width:
|
|
6375
|
-
height:
|
|
6376
|
-
}),
|
|
6377
|
-
preset:
|
|
6378
|
-
width:
|
|
6379
|
-
height:
|
|
6380
|
-
style:
|
|
6381
|
-
rounding:
|
|
6382
|
-
}),
|
|
6383
|
-
if (
|
|
6384
|
-
let
|
|
6385
|
-
this._detachShapeGroupAutoLayout({ group: r }),
|
|
6386
|
-
textNode:
|
|
6387
|
-
text:
|
|
6388
|
-
textStyle:
|
|
6389
|
-
align:
|
|
6390
|
-
}), r.remove(
|
|
6373
|
+
let be = U({
|
|
6374
|
+
width: _e,
|
|
6375
|
+
height: ye
|
|
6376
|
+
}), xe = await fn({
|
|
6377
|
+
preset: A,
|
|
6378
|
+
width: _e,
|
|
6379
|
+
height: ye,
|
|
6380
|
+
style: H,
|
|
6381
|
+
rounding: M
|
|
6382
|
+
}), K = r.getObjects().indexOf(se);
|
|
6383
|
+
if (K < 0) return null;
|
|
6384
|
+
let Se = () => {
|
|
6385
|
+
this._detachShapeGroupAutoLayout({ group: r }), G.set(le), this._applyTextUpdates({
|
|
6386
|
+
textNode: G,
|
|
6387
|
+
text: h,
|
|
6388
|
+
textStyle: g,
|
|
6389
|
+
align: re
|
|
6390
|
+
}), r.remove(se), r.insertAt(K, xe), this._applyShapeGroupMetadata({
|
|
6391
6391
|
group: r,
|
|
6392
|
-
presetKey:
|
|
6393
|
-
presetCanRound:
|
|
6394
|
-
width:
|
|
6395
|
-
height:
|
|
6396
|
-
manualWidth:
|
|
6397
|
-
manualHeight:
|
|
6398
|
-
replaceBoxWidth:
|
|
6399
|
-
replaceBoxHeight:
|
|
6400
|
-
shapeTextAutoExpand:
|
|
6401
|
-
alignH:
|
|
6402
|
-
alignV:
|
|
6403
|
-
padding:
|
|
6404
|
-
style:
|
|
6405
|
-
rounding:
|
|
6392
|
+
presetKey: A.key,
|
|
6393
|
+
presetCanRound: j,
|
|
6394
|
+
width: _e,
|
|
6395
|
+
height: ye,
|
|
6396
|
+
manualWidth: oe,
|
|
6397
|
+
manualHeight: W,
|
|
6398
|
+
replaceBoxWidth: te?.width,
|
|
6399
|
+
replaceBoxHeight: te?.height,
|
|
6400
|
+
shapeTextAutoExpand: O,
|
|
6401
|
+
alignH: re,
|
|
6402
|
+
alignV: R,
|
|
6403
|
+
padding: V,
|
|
6404
|
+
style: H,
|
|
6405
|
+
rounding: M
|
|
6406
6406
|
}), this._applyCurrentLayout({
|
|
6407
6407
|
group: r,
|
|
6408
|
-
shape:
|
|
6409
|
-
text:
|
|
6410
|
-
placement:
|
|
6411
|
-
width:
|
|
6412
|
-
height:
|
|
6413
|
-
alignH:
|
|
6414
|
-
alignV:
|
|
6415
|
-
internalShapeTextInset:
|
|
6416
|
-
resolveInternalShapeTextInset:
|
|
6417
|
-
preserveAspectRatio:
|
|
6418
|
-
minimumReplaceBox:
|
|
6419
|
-
expandShapeHeightToFitText: !
|
|
6420
|
-
changedPadding:
|
|
6421
|
-
}),
|
|
6408
|
+
shape: xe,
|
|
6409
|
+
text: G,
|
|
6410
|
+
placement: C,
|
|
6411
|
+
width: _e,
|
|
6412
|
+
height: ye,
|
|
6413
|
+
alignH: re,
|
|
6414
|
+
alignV: R,
|
|
6415
|
+
internalShapeTextInset: be,
|
|
6416
|
+
resolveInternalShapeTextInset: U,
|
|
6417
|
+
preserveAspectRatio: ee,
|
|
6418
|
+
minimumReplaceBox: te ?? void 0,
|
|
6419
|
+
expandShapeHeightToFitText: !he,
|
|
6420
|
+
changedPadding: z
|
|
6421
|
+
}), ee && (r.shapeManualBaseWidth = Math.max(1, r.shapeBaseWidth ?? _e), r.shapeManualBaseHeight = Math.max(1, r.shapeBaseHeight ?? ye)), G.isEditing && this.editingPlacements.set(r, C);
|
|
6422
6422
|
};
|
|
6423
|
-
if (!this._isOnCanvas({ object: r })) return
|
|
6423
|
+
if (!this._isOnCanvas({ object: r })) return Se(), this.lifecycleController.fireBefore({ lifecycle: ce }), this.lifecycleController.fireUpdated({ lifecycle: ce }), r;
|
|
6424
6424
|
this._beginMutation();
|
|
6425
6425
|
try {
|
|
6426
|
-
|
|
6426
|
+
Se(), !G.isEditing && !x && this.editor.canvas.setActiveObject(r), this.lifecycleController.fireBefore({ lifecycle: ce }), this.editor.canvas.requestRenderAll();
|
|
6427
6427
|
} finally {
|
|
6428
|
-
this._endMutation({ withoutSave:
|
|
6428
|
+
this._endMutation({ withoutSave: S });
|
|
6429
6429
|
}
|
|
6430
|
-
return this.lifecycleController.fireUpdated({ lifecycle:
|
|
6430
|
+
return this.lifecycleController.fireUpdated({ lifecycle: ce }), r;
|
|
6431
6431
|
}
|
|
6432
6432
|
_resolveAspectRatioFittedDimensions({ targetWidth: e, targetHeight: t, aspectWidth: n, aspectHeight: r }) {
|
|
6433
6433
|
let i = Math.max(1, n), a = Math.max(1, r), o = e === void 0 ? void 0 : Math.max(1, e), s = t === void 0 ? void 0 : Math.max(1, t);
|
|
@@ -6463,7 +6463,7 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
6463
6463
|
setFill({ target: e, fill: t, withoutSave: n }) {
|
|
6464
6464
|
let r = this._resolveShapeGroup({ target: e });
|
|
6465
6465
|
if (!r) return null;
|
|
6466
|
-
let { shape: i } =
|
|
6466
|
+
let { shape: i } = Ke({ group: r });
|
|
6467
6467
|
if (!i) return null;
|
|
6468
6468
|
let a = this.lifecycleController.createContext({
|
|
6469
6469
|
group: r,
|
|
@@ -6485,7 +6485,7 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
6485
6485
|
setStroke({ target: e, stroke: t, strokeWidth: n, dash: r, withoutSave: i }) {
|
|
6486
6486
|
let a = this._resolveShapeGroup({ target: e });
|
|
6487
6487
|
if (!a) return null;
|
|
6488
|
-
let { shape: o, text: s } =
|
|
6488
|
+
let { shape: o, text: s } = Ke({ group: a });
|
|
6489
6489
|
if (!o) return null;
|
|
6490
6490
|
let c = this.lifecycleController.createContext({
|
|
6491
6491
|
group: a,
|
|
@@ -6521,7 +6521,7 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
6521
6521
|
setOpacity({ target: e, opacity: t, applyToText: n = !0, withoutSave: r }) {
|
|
6522
6522
|
let i = this._resolveShapeGroup({ target: e });
|
|
6523
6523
|
if (!i) return null;
|
|
6524
|
-
let { shape: a, text: o } =
|
|
6524
|
+
let { shape: a, text: o } = Ke({ group: i });
|
|
6525
6525
|
if (!a) return null;
|
|
6526
6526
|
let s = this.lifecycleController.createContext({
|
|
6527
6527
|
group: i,
|
|
@@ -6543,13 +6543,13 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
6543
6543
|
getTextNode({ target: e } = {}) {
|
|
6544
6544
|
let t = this._resolveShapeGroup({ target: e });
|
|
6545
6545
|
if (!t) return null;
|
|
6546
|
-
let { text: n } =
|
|
6546
|
+
let { text: n } = Ke({ group: t });
|
|
6547
6547
|
return n || null;
|
|
6548
6548
|
}
|
|
6549
6549
|
updateTextStyle({ target: e, style: t = {}, withoutSave: n } = {}) {
|
|
6550
6550
|
let r = this._resolveShapeGroup({ target: e });
|
|
6551
6551
|
if (!r) return null;
|
|
6552
|
-
let { shape: i, text: a } =
|
|
6552
|
+
let { shape: i, text: a } = Ke({ group: r });
|
|
6553
6553
|
if (!i || !a) return null;
|
|
6554
6554
|
if (!(Object.keys(t).length > 0)) return r;
|
|
6555
6555
|
let o = this._resolveManualDimensions({ group: r }), s = this.editor.canvasManager.getObjectPlacement({ object: r }), c = this._resolveShapeTextHorizontalAlign({
|
|
@@ -6583,7 +6583,7 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
6583
6583
|
setTextAlign({ target: e, horizontal: t, vertical: n, withoutSave: r }) {
|
|
6584
6584
|
let i = this._resolveShapeGroup({ target: e });
|
|
6585
6585
|
if (!i) return null;
|
|
6586
|
-
let { shape: a, text: o } =
|
|
6586
|
+
let { shape: a, text: o } = Ke({ group: i });
|
|
6587
6587
|
if (!a || !o) return null;
|
|
6588
6588
|
let s = this._resolveCurrentDimensions({ group: i }), c = t ?? i.shapeAlignHorizontal ?? "center", l = n ?? i.shapeAlignVertical ?? "middle", u = this.lifecycleController.createContext({
|
|
6589
6589
|
group: i,
|
|
@@ -6634,7 +6634,7 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
6634
6634
|
e.on("object:scaling", this._handleObjectScaling), e.on("object:modified", this._handleObjectModified), e.on("mouse:move", this._handleMouseMove), e.on("mouse:down", this._handleMouseDown), e.on("mouse:up", this._handleMouseUp), e.on("text:editing:entered", this._handleTextEditingEntered), e.on("text:editing:exited", this._handleTextEditingExited), e.on("text:changed", this._handleTextChanged), e.on("editor:before:text-updated", this._handleBeforeTextUpdated), e.on("editor:text-updated", this._handleTextUpdated);
|
|
6635
6635
|
}
|
|
6636
6636
|
_createShapeGroup({ id: e, presetKey: t, presetCanRound: n, shape: r, text: i, width: a, height: o, manualWidth: s, manualHeight: c, replaceBoxWidth: l, replaceBoxHeight: u, preserveAspectRatio: d, shapeTextAutoExpand: f, alignH: p, alignV: m, padding: h, internalShapeTextInset: g, resolveInternalShapeTextInset: _, changedPadding: v, style: y, rounding: b }) {
|
|
6637
|
-
let x = new
|
|
6637
|
+
let x = new Ve([r, i], {
|
|
6638
6638
|
originX: "center",
|
|
6639
6639
|
originY: "center",
|
|
6640
6640
|
left: 0,
|
|
@@ -6657,7 +6657,7 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
6657
6657
|
padding: h,
|
|
6658
6658
|
style: y,
|
|
6659
6659
|
rounding: b
|
|
6660
|
-
}), x.rehydrateRuntimeState(), qe({ group: x }),
|
|
6660
|
+
}), x.rehydrateRuntimeState(), qe({ group: x }), ke({ text: i }), An({
|
|
6661
6661
|
group: x,
|
|
6662
6662
|
shape: r,
|
|
6663
6663
|
text: i,
|
|
@@ -6722,7 +6722,7 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
6722
6722
|
return s.set({
|
|
6723
6723
|
shapeNodeType: "text",
|
|
6724
6724
|
splitByGrapheme: !1
|
|
6725
|
-
}),
|
|
6725
|
+
}), ke({ text: s }), s;
|
|
6726
6726
|
}
|
|
6727
6727
|
_applyTextUpdates({ textNode: e, text: t, textStyle: n, align: r }) {
|
|
6728
6728
|
let i = {};
|
|
@@ -6802,7 +6802,7 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
6802
6802
|
};
|
|
6803
6803
|
}
|
|
6804
6804
|
_resolveGroupUserPadding({ group: e }) {
|
|
6805
|
-
return
|
|
6805
|
+
return Se({ padding: {
|
|
6806
6806
|
top: e.shapePaddingTop,
|
|
6807
6807
|
right: e.shapePaddingRight,
|
|
6808
6808
|
bottom: e.shapePaddingBottom,
|
|
@@ -6811,7 +6811,7 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
6811
6811
|
}
|
|
6812
6812
|
_resolveGroupInternalShapeTextInset({ group: e, width: t, height: n }) {
|
|
6813
6813
|
let r = pe({ presetKey: e.shapePresetKey ?? "circle" });
|
|
6814
|
-
return
|
|
6814
|
+
return Ee({
|
|
6815
6815
|
baseInset: r ? ge({
|
|
6816
6816
|
preset: r,
|
|
6817
6817
|
width: t,
|
|
@@ -6868,14 +6868,14 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
6868
6868
|
currentWidth: m.width,
|
|
6869
6869
|
manualWidth: h.width,
|
|
6870
6870
|
shapeTextAutoExpandEnabled: _,
|
|
6871
|
-
padding:
|
|
6871
|
+
padding: Te({
|
|
6872
6872
|
base: v({
|
|
6873
6873
|
width: y,
|
|
6874
6874
|
height: e
|
|
6875
6875
|
}),
|
|
6876
6876
|
addition: g
|
|
6877
6877
|
}),
|
|
6878
|
-
resolvePaddingForWidth: ({ width: t }) =>
|
|
6878
|
+
resolvePaddingForWidth: ({ width: t }) => Te({
|
|
6879
6879
|
base: v({
|
|
6880
6880
|
width: t,
|
|
6881
6881
|
height: e
|
|
@@ -6911,8 +6911,8 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
6911
6911
|
}
|
|
6912
6912
|
_syncShapeTextLayoutAfterTextMutation({ textNode: e, textStyle: t }) {
|
|
6913
6913
|
let { group: n } = e;
|
|
6914
|
-
if (!
|
|
6915
|
-
let { shape: r, text: i } =
|
|
6914
|
+
if (!q(n)) return !1;
|
|
6915
|
+
let { shape: r, text: i } = Ke({ group: n });
|
|
6916
6916
|
if (!r || !i) return !1;
|
|
6917
6917
|
this._detachShapeGroupAutoLayout({ group: n });
|
|
6918
6918
|
let a = this._resolveEditingPlacement({ group: n }), o = this._resolveManualDimensions({ group: n }), s = this._resolveShapeTextHorizontalAlign({
|
|
@@ -6932,7 +6932,7 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
6932
6932
|
return this.editingPlacements.get(e) || this.editor.canvasManager.getObjectPlacement({ object: e });
|
|
6933
6933
|
}
|
|
6934
6934
|
_detachShapeGroupAutoLayout({ group: e }) {
|
|
6935
|
-
|
|
6935
|
+
Ae({ group: e });
|
|
6936
6936
|
}
|
|
6937
6937
|
_resolveHorizontalAlign({ explicitAlign: e, textStyle: t }) {
|
|
6938
6938
|
if (e) return e;
|
|
@@ -6967,12 +6967,12 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
6967
6967
|
});
|
|
6968
6968
|
return;
|
|
6969
6969
|
}
|
|
6970
|
-
if (
|
|
6970
|
+
if (q(t)) {
|
|
6971
6971
|
r.includes(t) || r.push(t);
|
|
6972
6972
|
return;
|
|
6973
6973
|
}
|
|
6974
6974
|
let { group: n } = t;
|
|
6975
|
-
!n || !
|
|
6975
|
+
!n || !q(n) || r.includes(n) || r.push(n);
|
|
6976
6976
|
};
|
|
6977
6977
|
return i(t), n.forEach((e) => {
|
|
6978
6978
|
i(e);
|
|
@@ -6990,24 +6990,24 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
6990
6990
|
return !1;
|
|
6991
6991
|
}
|
|
6992
6992
|
_resolveShapeGroup({ target: e }) {
|
|
6993
|
-
if (e instanceof l &&
|
|
6993
|
+
if (e instanceof l && q(e)) return e;
|
|
6994
6994
|
if (!e) {
|
|
6995
6995
|
let e = this.editor.canvas.getActiveObject();
|
|
6996
|
-
if (
|
|
6996
|
+
if (q(e)) return e;
|
|
6997
6997
|
let t = e?.group;
|
|
6998
|
-
return t &&
|
|
6998
|
+
return t && q(t) ? t : null;
|
|
6999
6999
|
}
|
|
7000
7000
|
if (typeof e == "string") {
|
|
7001
7001
|
let t = this.editor.canvas.getObjects();
|
|
7002
7002
|
for (let n = 0; n < t.length; n += 1) {
|
|
7003
7003
|
let r = t[n];
|
|
7004
|
-
if (r.id === e &&
|
|
7004
|
+
if (r.id === e && q(r)) return r;
|
|
7005
7005
|
}
|
|
7006
7006
|
}
|
|
7007
7007
|
if (e instanceof o) {
|
|
7008
|
-
if (
|
|
7008
|
+
if (q(e)) return e;
|
|
7009
7009
|
let { group: t } = e;
|
|
7010
|
-
if (t &&
|
|
7010
|
+
if (t && q(t)) return t;
|
|
7011
7011
|
}
|
|
7012
7012
|
return null;
|
|
7013
7013
|
}
|
|
@@ -7272,7 +7272,7 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
7272
7272
|
this.editor = e;
|
|
7273
7273
|
}
|
|
7274
7274
|
lockObject({ object: e, skipInnerObjects: n, withoutSave: r } = {}) {
|
|
7275
|
-
let { canvas: i, historyManager: a } = this.editor, o = e || i.getActiveObject(), s =
|
|
7275
|
+
let { canvas: i, historyManager: a } = this.editor, o = e || i.getActiveObject(), s = Ue({ target: o }) ?? o;
|
|
7276
7276
|
if (!s || s.locked) return;
|
|
7277
7277
|
let c = {
|
|
7278
7278
|
lockMovementX: !0,
|
|
@@ -7294,7 +7294,7 @@ var hr = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
7294
7294
|
});
|
|
7295
7295
|
}
|
|
7296
7296
|
unlockObject({ object: e, withoutSave: n } = {}) {
|
|
7297
|
-
let { canvas: r, historyManager: i } = this.editor, a = e || r.getActiveObject(), o =
|
|
7297
|
+
let { canvas: r, historyManager: i } = this.editor, a = e || r.getActiveObject(), o = Ue({ target: a }) ?? a;
|
|
7298
7298
|
if (!o) return;
|
|
7299
7299
|
let s = {
|
|
7300
7300
|
lockMovementX: !1,
|
|
@@ -8776,16 +8776,16 @@ var ui = class {
|
|
|
8776
8776
|
}) : null, V = {}, H = {}, U = {}, ae, oe, W = Pr({
|
|
8777
8777
|
textbox: s,
|
|
8778
8778
|
range: z
|
|
8779
|
-
}),
|
|
8780
|
-
if (h !== void 0 && (B && (H.fontFamily = h),
|
|
8779
|
+
}), se = !z || W, G = !z;
|
|
8780
|
+
if (h !== void 0 && (B && (H.fontFamily = h), se && (R.fontFamily = h, G && (U.fontFamily = h))), g !== void 0 && (B && (H.fontSize = g), se && (R.fontSize = g, G && (U.fontSize = g))), _ !== void 0) {
|
|
8781
8781
|
let e = _ ? "bold" : "normal";
|
|
8782
|
-
z && (V.fontWeight = e),
|
|
8782
|
+
z && (V.fontWeight = e), se && (R.fontWeight = e, G && (U.fontWeight = e));
|
|
8783
8783
|
}
|
|
8784
8784
|
if (v !== void 0) {
|
|
8785
8785
|
let e = v ? "italic" : "normal";
|
|
8786
|
-
z && (V.fontStyle = e),
|
|
8786
|
+
z && (V.fontStyle = e), se && (R.fontStyle = e, G && (U.fontStyle = e));
|
|
8787
8787
|
}
|
|
8788
|
-
if (y !== void 0 && (z && (V.underline = y),
|
|
8788
|
+
if (y !== void 0 && (z && (V.underline = y), se && (R.underline = y, G && (U.underline = y))), x !== void 0 && (z && (V.linethrough = x), se && (R.linethrough = x, G && (U.linethrough = x))), S !== void 0 && (R.textAlign = S), C !== void 0 && (z && (V.fill = C), se && (R.fill = C, G && (U.fill = C))), w !== void 0 || T !== void 0) {
|
|
8789
8789
|
let e = z ? Ir({
|
|
8790
8790
|
textbox: s,
|
|
8791
8791
|
range: z,
|
|
@@ -8798,7 +8798,7 @@ var ui = class {
|
|
|
8798
8798
|
oe = Rr({ width: T ?? e ?? s.strokeWidth ?? 0 }), ae = Lr({
|
|
8799
8799
|
strokeColor: w ?? t ?? s.stroke ?? void 0,
|
|
8800
8800
|
width: oe
|
|
8801
|
-
}), z && (V.stroke = ae, V.strokeWidth = oe),
|
|
8801
|
+
}), z && (V.stroke = ae, V.strokeWidth = oe), se && (R.stroke = ae, R.strokeWidth = oe, G && (U.stroke = ae, U.strokeWidth = oe));
|
|
8802
8802
|
}
|
|
8803
8803
|
E !== void 0 && (R.opacity = E), D !== void 0 && (R.backgroundColor = D), O !== void 0 && (R.backgroundOpacity = O), k !== void 0 && (R.paddingTop = k), A !== void 0 && (R.paddingRight = A), j !== void 0 && (R.paddingBottom = j), M !== void 0 && (R.paddingLeft = M), N !== void 0 && (R.radiusTopLeft = N), P !== void 0 && (R.radiusTopRight = P), F !== void 0 && (R.radiusBottomRight = F), I !== void 0 && (R.radiusBottomLeft = I);
|
|
8804
8804
|
let ce = s.textCaseRaw ?? c, le = !!s.uppercase, ue = p !== void 0, de = ue ? p ?? "" : ce, fe = b ?? le, pe = fe !== le;
|
|
@@ -8824,7 +8824,7 @@ var ui = class {
|
|
|
8824
8824
|
originX: ie.originX,
|
|
8825
8825
|
originY: ie.originY
|
|
8826
8826
|
})), s.uppercase = fe, s.set(R);
|
|
8827
|
-
let
|
|
8827
|
+
let K = !1;
|
|
8828
8828
|
if (z) {
|
|
8829
8829
|
let e = Fr({
|
|
8830
8830
|
textbox: s,
|
|
@@ -8835,21 +8835,21 @@ var ui = class {
|
|
|
8835
8835
|
styles: H,
|
|
8836
8836
|
range: B
|
|
8837
8837
|
}) : !1;
|
|
8838
|
-
|
|
8838
|
+
K = e || t;
|
|
8839
8839
|
} else if (Object.keys(U).length) {
|
|
8840
8840
|
let e = Nr({ textbox: s });
|
|
8841
|
-
e && (
|
|
8841
|
+
e && (K = Fr({
|
|
8842
8842
|
textbox: s,
|
|
8843
8843
|
styles: U,
|
|
8844
8844
|
range: e
|
|
8845
8845
|
}));
|
|
8846
8846
|
}
|
|
8847
|
-
let
|
|
8847
|
+
let Se = K && $r({ stylesList: [
|
|
8848
8848
|
V,
|
|
8849
8849
|
H,
|
|
8850
8850
|
U
|
|
8851
8851
|
] });
|
|
8852
|
-
if (
|
|
8852
|
+
if (K && (s.dirty = !0), B && (h !== void 0 || g !== void 0)) {
|
|
8853
8853
|
let e = mi({
|
|
8854
8854
|
textbox: s,
|
|
8855
8855
|
range: B
|
|
@@ -8871,7 +8871,7 @@ var ui = class {
|
|
|
8871
8871
|
updates: t
|
|
8872
8872
|
});
|
|
8873
8873
|
}
|
|
8874
|
-
|
|
8874
|
+
Se && (s.initDimensions(), s.dirty = !0), [
|
|
8875
8875
|
D,
|
|
8876
8876
|
O,
|
|
8877
8877
|
...ge,
|
|
@@ -8880,38 +8880,38 @@ var ui = class {
|
|
|
8880
8880
|
F,
|
|
8881
8881
|
I
|
|
8882
8882
|
].some((e) => e !== void 0) && (s.dirty = !0);
|
|
8883
|
-
let { autoExpand:
|
|
8884
|
-
|
|
8885
|
-
let
|
|
8883
|
+
let { autoExpand: Ce } = s, we = m !== void 0, Te = (m ?? Ce) !== !1;
|
|
8884
|
+
we ? s.autoExpand = m !== !1 : Ce === void 0 && (s.autoExpand = !0);
|
|
8885
|
+
let Ee = Te && !ye && (ue || pe || me);
|
|
8886
8886
|
this._normalizeTextboxAfterContentChange({
|
|
8887
8887
|
textbox: s,
|
|
8888
8888
|
placement: ie,
|
|
8889
|
-
shouldAutoExpand:
|
|
8889
|
+
shouldAutoExpand: Ee
|
|
8890
8890
|
}), xe && this._restoreTextboxContentPlacement({
|
|
8891
8891
|
textbox: s,
|
|
8892
8892
|
contentPlacement: xe
|
|
8893
8893
|
}), s.setCoords();
|
|
8894
|
-
let
|
|
8894
|
+
let De = {
|
|
8895
8895
|
withoutSave: !!r,
|
|
8896
8896
|
skipRender: !!i
|
|
8897
|
-
},
|
|
8897
|
+
}, Oe = !!z && Object.keys(V).length > 0, ke = {
|
|
8898
8898
|
textbox: s,
|
|
8899
8899
|
target: t,
|
|
8900
8900
|
style: n,
|
|
8901
|
-
options:
|
|
8901
|
+
options: De,
|
|
8902
8902
|
updates: R,
|
|
8903
8903
|
selectionRange: z ?? void 0,
|
|
8904
|
-
selectionStyles:
|
|
8904
|
+
selectionStyles: Oe ? V : void 0
|
|
8905
8905
|
};
|
|
8906
|
-
o && d.fire("editor:before:text-updated",
|
|
8907
|
-
let
|
|
8906
|
+
o && d.fire("editor:before:text-updated", ke), i || d.requestRenderAll();
|
|
8907
|
+
let Ae = e._getSnapshot(s);
|
|
8908
8908
|
l.resumeHistory(), r || l.saveState();
|
|
8909
|
-
let
|
|
8910
|
-
...
|
|
8909
|
+
let je = {
|
|
8910
|
+
...ke,
|
|
8911
8911
|
before: f,
|
|
8912
|
-
after:
|
|
8912
|
+
after: Ae
|
|
8913
8913
|
};
|
|
8914
|
-
return o && d.fire("editor:text-updated",
|
|
8914
|
+
return o && d.fire("editor:text-updated", je), s;
|
|
8915
8915
|
}
|
|
8916
8916
|
stylesFromArray(e, t) {
|
|
8917
8917
|
return C.stylesFromArray(e, t);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anu3ev/fabric-image-editor",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "TypeScript image editor library built on FabricJS, allowing you to create instances with an integrated montage area and providing an API to modify and manage state.",
|
|
5
5
|
"module": "dist/main.js",
|
|
6
6
|
"files": [
|