@anu3ev/fabric-image-editor 0.8.18 → 0.8.19
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 +577 -540
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1672,8 +1672,33 @@ function Re({ padding: e }) {
|
|
|
1672
1672
|
return t;
|
|
1673
1673
|
}
|
|
1674
1674
|
//#endregion
|
|
1675
|
-
//#region src/editor/shape-manager/domain/shape-
|
|
1675
|
+
//#region src/editor/shape-manager/domain/shape-nodes.ts
|
|
1676
1676
|
var ze = ({ group: e }) => {
|
|
1677
|
+
let t = e.getObjects();
|
|
1678
|
+
for (let e = 0; e < t.length; e += 1) {
|
|
1679
|
+
let n = t[e];
|
|
1680
|
+
if (n.shapeNodeType === "shape") return n;
|
|
1681
|
+
}
|
|
1682
|
+
for (let e = 0; e < t.length; e += 1) {
|
|
1683
|
+
let n = t[e];
|
|
1684
|
+
if (!(n instanceof v)) return n;
|
|
1685
|
+
}
|
|
1686
|
+
return null;
|
|
1687
|
+
}, Be = ({ group: e }) => {
|
|
1688
|
+
let t = e.getObjects();
|
|
1689
|
+
for (let e = 0; e < t.length; e += 1) {
|
|
1690
|
+
let n = t[e];
|
|
1691
|
+
if (n.shapeNodeType === "text" && n instanceof v) return n;
|
|
1692
|
+
}
|
|
1693
|
+
for (let e = 0; e < t.length; e += 1) {
|
|
1694
|
+
let n = t[e];
|
|
1695
|
+
if (n instanceof v) return n;
|
|
1696
|
+
}
|
|
1697
|
+
return null;
|
|
1698
|
+
}, H = ({ group: e }) => ({
|
|
1699
|
+
shape: ze({ group: e }),
|
|
1700
|
+
text: Be({ group: e })
|
|
1701
|
+
}), Ve = ({ group: e }) => {
|
|
1677
1702
|
let t = !!e.locked, n = e;
|
|
1678
1703
|
typeof n.setInteractive == "function" && n.setInteractive(!0), n.set({
|
|
1679
1704
|
evented: !0,
|
|
@@ -1685,7 +1710,7 @@ var ze = ({ group: e }) => {
|
|
|
1685
1710
|
subTargetCheck: !0,
|
|
1686
1711
|
hoverCursor: void 0
|
|
1687
1712
|
});
|
|
1688
|
-
},
|
|
1713
|
+
}, He = ({ text: e }) => {
|
|
1689
1714
|
let t = !!(e.locked || e.group?.locked);
|
|
1690
1715
|
e.set({
|
|
1691
1716
|
hasBorders: !1,
|
|
@@ -1698,7 +1723,7 @@ var ze = ({ group: e }) => {
|
|
|
1698
1723
|
autoExpand: !1,
|
|
1699
1724
|
shapeNodeType: "text"
|
|
1700
1725
|
}), e.setCoords();
|
|
1701
|
-
},
|
|
1726
|
+
}, Ue = ({ group: e }) => {
|
|
1702
1727
|
let { layoutManager: t } = e;
|
|
1703
1728
|
if (!t || typeof t.unsubscribeTargets != "function") return;
|
|
1704
1729
|
let n = e.getObjects();
|
|
@@ -1706,7 +1731,7 @@ var ze = ({ group: e }) => {
|
|
|
1706
1731
|
target: e,
|
|
1707
1732
|
targets: n
|
|
1708
1733
|
});
|
|
1709
|
-
},
|
|
1734
|
+
}, We = ({ group: e }) => {
|
|
1710
1735
|
let t = e.getObjects();
|
|
1711
1736
|
for (let e = 0; e < t.length; e += 1) {
|
|
1712
1737
|
let n = t[e];
|
|
@@ -1717,20 +1742,20 @@ var ze = ({ group: e }) => {
|
|
|
1717
1742
|
if (n instanceof v) return n;
|
|
1718
1743
|
}
|
|
1719
1744
|
return null;
|
|
1720
|
-
},
|
|
1721
|
-
function
|
|
1745
|
+
}, Ge = "shape-group";
|
|
1746
|
+
function Ke() {
|
|
1722
1747
|
let e = new d();
|
|
1723
1748
|
return e.performLayout = () => {}, e;
|
|
1724
1749
|
}
|
|
1725
|
-
function
|
|
1750
|
+
function qe({ layoutManager: e }) {
|
|
1726
1751
|
let t = b.getClass("layoutManager");
|
|
1727
1752
|
if (!e) return new t();
|
|
1728
1753
|
let { strategy: n, type: r } = e, i = b.getClass(r);
|
|
1729
1754
|
return n ? new i(new (b.getClass(n))()) : new i();
|
|
1730
1755
|
}
|
|
1731
|
-
var
|
|
1756
|
+
var Je = class e extends l {
|
|
1732
1757
|
static {
|
|
1733
|
-
this.type =
|
|
1758
|
+
this.type = Ge;
|
|
1734
1759
|
}
|
|
1735
1760
|
constructor(e = [], t = {}) {
|
|
1736
1761
|
let { layoutManager: n, objectCaching: r, centeredScaling: i, lockScalingFlip: a, ...o } = t;
|
|
@@ -1753,17 +1778,17 @@ var Ke = class e extends l {
|
|
|
1753
1778
|
bottom: this.shapePaddingBottom,
|
|
1754
1779
|
left: this.shapePaddingLeft
|
|
1755
1780
|
} });
|
|
1756
|
-
this.shapePaddingTop = e.top, this.shapePaddingRight = e.right, this.shapePaddingBottom = e.bottom, this.shapePaddingLeft = e.left, this._syncRoundability(),
|
|
1757
|
-
let t =
|
|
1758
|
-
t &&
|
|
1781
|
+
this.shapePaddingTop = e.top, this.shapePaddingRight = e.right, this.shapePaddingBottom = e.bottom, this.shapePaddingLeft = e.left, this._syncRoundability(), this._foldGroupOpacityIntoNodes(), Ve({ group: this }), ue({ target: this });
|
|
1782
|
+
let t = We({ group: this });
|
|
1783
|
+
t && He({ text: t }), Ue({ group: this }), this.setCoords();
|
|
1759
1784
|
}
|
|
1760
1785
|
static async fromObject({ type: t, objects: n = [], layoutManager: r, ...i }, a) {
|
|
1761
1786
|
let [o, s] = await Promise.all([w.enlivenObjects(n, a), w.enlivenObjectEnlivables(i, a)]), c = new e(o, {
|
|
1762
1787
|
...i,
|
|
1763
1788
|
...s,
|
|
1764
|
-
layoutManager:
|
|
1789
|
+
layoutManager: Ke()
|
|
1765
1790
|
});
|
|
1766
|
-
return c.layoutManager =
|
|
1791
|
+
return c.layoutManager = qe({ layoutManager: r }), c.layoutManager.subscribeTargets({
|
|
1767
1792
|
type: "initialization",
|
|
1768
1793
|
target: c,
|
|
1769
1794
|
targets: c.getObjects()
|
|
@@ -1779,19 +1804,35 @@ var Ke = class e extends l {
|
|
|
1779
1804
|
let t = we({ presetKey: e });
|
|
1780
1805
|
t && (this.shapeCanRound = ke({ preset: t }));
|
|
1781
1806
|
}
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1807
|
+
_foldGroupOpacityIntoNodes() {
|
|
1808
|
+
let e = this.opacity;
|
|
1809
|
+
if (typeof e != "number" || e === 1) return;
|
|
1810
|
+
let { shape: t, text: n } = H({ group: this });
|
|
1811
|
+
if (!(!t && !n)) {
|
|
1812
|
+
if (t) {
|
|
1813
|
+
let n = (typeof t.opacity == "number" ? t.opacity : this.shapeOpacity ?? 1) * e;
|
|
1814
|
+
t.set({ opacity: n }), t.setCoords(), this.shapeOpacity = n;
|
|
1815
|
+
}
|
|
1816
|
+
if (n) {
|
|
1817
|
+
let t = typeof n.opacity == "number" ? n.opacity : 1;
|
|
1818
|
+
n.set({ opacity: t * e }), n.setCoords();
|
|
1819
|
+
}
|
|
1820
|
+
this.set({ opacity: 1 });
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
}, Ye = () => {
|
|
1824
|
+
b?.setClass && b.setClass(Je, Ge);
|
|
1825
|
+
}, U = (e) => e instanceof Je || e instanceof l && e.shapeComposite === !0, Xe = ({ target: e, subTargets: t = [] }) => {
|
|
1826
|
+
if (U(e)) return e;
|
|
1827
|
+
if (e?.group && U(e.group)) return e.group;
|
|
1787
1828
|
for (let e = 0; e < t.length; e += 1) {
|
|
1788
1829
|
let n = t[e];
|
|
1789
|
-
if (
|
|
1830
|
+
if (U(n)) return n;
|
|
1790
1831
|
let { group: r } = n;
|
|
1791
|
-
if (r &&
|
|
1832
|
+
if (r && U(r)) return r;
|
|
1792
1833
|
}
|
|
1793
1834
|
return null;
|
|
1794
|
-
},
|
|
1835
|
+
}, Ze = {
|
|
1795
1836
|
style: {
|
|
1796
1837
|
position: "absolute",
|
|
1797
1838
|
display: "none",
|
|
@@ -1901,7 +1942,7 @@ var Ke = class e extends l {
|
|
|
1901
1942
|
e.layerManager.sendBackwards(t ?? void 0);
|
|
1902
1943
|
}
|
|
1903
1944
|
}
|
|
1904
|
-
},
|
|
1945
|
+
}, Qe = class {
|
|
1905
1946
|
constructor({ editor: e }) {
|
|
1906
1947
|
this.currentTarget = null, this.currentLocked = !1, this.isTransforming = !1, this.isTemporarilyHidden = !1, this.editor = e, this.canvas = e.canvas, this.options = e.options, this._initToolbar();
|
|
1907
1948
|
}
|
|
@@ -1909,22 +1950,22 @@ var Ke = class e extends l {
|
|
|
1909
1950
|
if (!this.options.showToolbar) return;
|
|
1910
1951
|
let e = this.options.toolbar || {};
|
|
1911
1952
|
this.config = {
|
|
1912
|
-
...
|
|
1953
|
+
...Ze,
|
|
1913
1954
|
...e,
|
|
1914
1955
|
style: {
|
|
1915
|
-
...
|
|
1956
|
+
...Ze.style,
|
|
1916
1957
|
...e.style || {}
|
|
1917
1958
|
},
|
|
1918
1959
|
btnStyle: {
|
|
1919
|
-
...
|
|
1960
|
+
...Ze.btnStyle,
|
|
1920
1961
|
...e.btnStyle || {}
|
|
1921
1962
|
},
|
|
1922
1963
|
icons: {
|
|
1923
|
-
...
|
|
1964
|
+
...Ze.icons,
|
|
1924
1965
|
...e.icons || {}
|
|
1925
1966
|
},
|
|
1926
1967
|
handlers: {
|
|
1927
|
-
...
|
|
1968
|
+
...Ze.handlers,
|
|
1928
1969
|
...e.handlers || {}
|
|
1929
1970
|
}
|
|
1930
1971
|
}, this.currentTarget = null, this.currentLocked = !1, this.isTransforming = !1, this.isTemporarilyHidden = !1, this._onMouseDown = this._handleMouseDown.bind(this), this._onObjectMoving = this._startTransform.bind(this), this._onObjectScaling = this._startTransform.bind(this), this._onObjectRotating = this._startTransform.bind(this), this._onMouseUp = this._endTransform.bind(this), this._onObjectModified = this._endTransform.bind(this), this._onSelectionChange = this._updateToolbar.bind(this), this._onSelectionClear = () => {
|
|
@@ -2001,12 +2042,12 @@ var Ke = class e extends l {
|
|
|
2001
2042
|
}
|
|
2002
2043
|
_resolveCurrentTarget() {
|
|
2003
2044
|
let e = this.canvas.getActiveObject();
|
|
2004
|
-
return
|
|
2045
|
+
return Xe({ target: e }) ?? e ?? null;
|
|
2005
2046
|
}
|
|
2006
2047
|
destroy() {
|
|
2007
2048
|
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();
|
|
2008
2049
|
}
|
|
2009
|
-
},
|
|
2050
|
+
}, $e = {
|
|
2010
2051
|
position: "absolute",
|
|
2011
2052
|
display: "none",
|
|
2012
2053
|
background: "#2B2D33",
|
|
@@ -2020,12 +2061,12 @@ var Ke = class e extends l {
|
|
|
2020
2061
|
"pointer-events": "none",
|
|
2021
2062
|
"white-space": "nowrap",
|
|
2022
2063
|
"box-shadow": "0 2px 8px rgba(0, 0, 0, 0.2)"
|
|
2023
|
-
},
|
|
2064
|
+
}, et = "fabric-editor-angle-indicator", tt = class e {
|
|
2024
2065
|
constructor({ editor: e }) {
|
|
2025
2066
|
this.isActive = !1, this.currentAngle = 0, this.editor = e, this.canvas = e.canvas, this.options = e.options, this._createDOM(), this._bindEvents();
|
|
2026
2067
|
}
|
|
2027
2068
|
_createDOM() {
|
|
2028
|
-
this.el = document.createElement("div"), this.el.className =
|
|
2069
|
+
this.el = document.createElement("div"), this.el.className = et, Object.entries($e).forEach(([e, t]) => {
|
|
2029
2070
|
this.el.style.setProperty(e, t);
|
|
2030
2071
|
}), this.canvas.wrapperEl.appendChild(this.el);
|
|
2031
2072
|
}
|
|
@@ -2070,44 +2111,44 @@ var Ke = class e extends l {
|
|
|
2070
2111
|
destroy() {
|
|
2071
2112
|
this.canvas && (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:cleared", this._onSelectionCleared)), this.el?.parentNode && this.el.parentNode.removeChild(this.el), this.el = null, this.editor = null, this.canvas = null, this.options = null;
|
|
2072
2113
|
}
|
|
2073
|
-
},
|
|
2114
|
+
}, nt = /* @__PURE__ */ "id.backgroundId.customData.backgroundType.format.contentType.width.height.originX.originY.locked.editable.evented.selectable.lockMovementX.lockMovementY.lockRotation.lockScalingX.lockScalingY.lockSkewingX.lockSkewingY.styles.lineFontDefaults.textCaseRaw.uppercase.autoExpand.linethrough.underline.fontStyle.fontWeight.backgroundOpacity.paddingTop.paddingRight.paddingBottom.paddingLeft.radiusTopLeft.radiusTopRight.radiusBottomRight.radiusBottomLeft.shapeComposite.shapePresetKey.shapeBaseWidth.shapeBaseHeight.shapeManualBaseWidth.shapeManualBaseHeight.shapeReplaceBoxWidth.shapeReplaceBoxHeight.shapeTextAutoExpand.shapeTextWrapPolicy.shapeAlignHorizontal.shapeAlignVertical.shapePaddingTop.shapePaddingRight.shapePaddingBottom.shapePaddingLeft.shapeFill.shapeStroke.shapeStrokeWidth.shapeStrokeDashArray.shapeOpacity.shapeRounding.shapeNodeType".split(".");
|
|
2074
2115
|
//#endregion
|
|
2075
2116
|
//#region src/editor/history-manager/diff-normalization.ts
|
|
2076
|
-
function
|
|
2117
|
+
function rt({ state: e }) {
|
|
2077
2118
|
return JSON.parse(JSON.stringify(e));
|
|
2078
2119
|
}
|
|
2079
|
-
function
|
|
2120
|
+
function it({ value: e }) {
|
|
2080
2121
|
if (Array.isArray(e)) {
|
|
2081
2122
|
let t = [];
|
|
2082
|
-
for (let n = 0; n < e.length; n += 1) t.push(
|
|
2123
|
+
for (let n = 0; n < e.length; n += 1) t.push(it({ value: e[n] }));
|
|
2083
2124
|
return t;
|
|
2084
2125
|
}
|
|
2085
2126
|
if (e && typeof e == "object") {
|
|
2086
2127
|
let t = {}, n = Object.keys(e).sort();
|
|
2087
2128
|
for (let r = 0; r < n.length; r += 1) {
|
|
2088
2129
|
let i = n[r];
|
|
2089
|
-
t[i] =
|
|
2130
|
+
t[i] = it({ value: e[i] });
|
|
2090
2131
|
}
|
|
2091
2132
|
return t;
|
|
2092
2133
|
}
|
|
2093
2134
|
return e;
|
|
2094
2135
|
}
|
|
2095
|
-
function
|
|
2096
|
-
let t =
|
|
2136
|
+
function at({ value: e }) {
|
|
2137
|
+
let t = it({ value: e });
|
|
2097
2138
|
return JSON.stringify(t);
|
|
2098
2139
|
}
|
|
2099
|
-
function
|
|
2100
|
-
return
|
|
2140
|
+
function ot({ prevState: e, nextState: t }) {
|
|
2141
|
+
return at({ value: e }) === at({ value: t });
|
|
2101
2142
|
}
|
|
2102
|
-
function
|
|
2143
|
+
function st({ objects: e, id: t }) {
|
|
2103
2144
|
for (let n = 0; n < e.length; n += 1) {
|
|
2104
2145
|
let r = e[n];
|
|
2105
2146
|
if (r.id === t) return r;
|
|
2106
2147
|
}
|
|
2107
2148
|
return null;
|
|
2108
2149
|
}
|
|
2109
|
-
function
|
|
2110
|
-
let t =
|
|
2150
|
+
function ct({ objects: e }) {
|
|
2151
|
+
let t = st({
|
|
2111
2152
|
objects: e,
|
|
2112
2153
|
id: "montage-area"
|
|
2113
2154
|
});
|
|
@@ -2121,7 +2162,7 @@ function ot({ objects: e }) {
|
|
|
2121
2162
|
height: r
|
|
2122
2163
|
};
|
|
2123
2164
|
}
|
|
2124
|
-
function
|
|
2165
|
+
function lt({ objects: e }) {
|
|
2125
2166
|
let t = [], n = [...e];
|
|
2126
2167
|
for (let e = 0; e < n.length; e += 1) {
|
|
2127
2168
|
let r = n[e];
|
|
@@ -2131,20 +2172,20 @@ function st({ objects: e }) {
|
|
|
2131
2172
|
}
|
|
2132
2173
|
return t;
|
|
2133
2174
|
}
|
|
2134
|
-
function
|
|
2135
|
-
let t =
|
|
2175
|
+
function ut({ objects: e }) {
|
|
2176
|
+
let t = lt({ objects: e });
|
|
2136
2177
|
for (let e = 0; e < t.length; e += 1) {
|
|
2137
2178
|
let n = t[e], { type: r, backgroundOpacity: i, backgroundColor: a, textBackgroundColor: o } = n, s = typeof i == "number" ? i : 0, c = typeof a == "string" ? a : "", l = typeof o == "string" ? o : "", u = r === "textbox" || r === "background-textbox", d = c.length > 0 || l.length > 0;
|
|
2138
2179
|
u && (s > 0 && d || (n.backgroundColor = null, n.textBackgroundColor = null));
|
|
2139
2180
|
}
|
|
2140
2181
|
}
|
|
2141
|
-
function
|
|
2142
|
-
let { width: n, height: r, objects: i } = e, { objects: a } = t, { width: o, height: s } =
|
|
2182
|
+
function dt({ prevState: e, nextState: t }) {
|
|
2183
|
+
let { width: n, height: r, objects: i } = e, { objects: a } = t, { width: o, height: s } = ct({ objects: i }), { width: c, height: l } = ct({ objects: a });
|
|
2143
2184
|
o !== c || s !== l || (t.width = n, t.height = r);
|
|
2144
2185
|
}
|
|
2145
|
-
function
|
|
2146
|
-
let n =
|
|
2147
|
-
return
|
|
2186
|
+
function ft({ prevState: e, nextState: t }) {
|
|
2187
|
+
let n = rt({ state: e }), r = rt({ state: t });
|
|
2188
|
+
return ut({ objects: n.objects }), ut({ objects: r.objects }), dt({
|
|
2148
2189
|
prevState: n,
|
|
2149
2190
|
nextState: r
|
|
2150
2191
|
}), {
|
|
@@ -2154,10 +2195,10 @@ function ut({ prevState: e, nextState: t }) {
|
|
|
2154
2195
|
}
|
|
2155
2196
|
//#endregion
|
|
2156
2197
|
//#region src/editor/history-manager/load-state.ts
|
|
2157
|
-
function
|
|
2198
|
+
function pt({ customData: e }) {
|
|
2158
2199
|
return JSON.parse(JSON.stringify(e));
|
|
2159
2200
|
}
|
|
2160
|
-
function
|
|
2201
|
+
function mt({ state: e }) {
|
|
2161
2202
|
let t = JSON.parse(JSON.stringify(e)), n = (t.objects ?? []).filter((e) => e.id !== "overlay-mask");
|
|
2162
2203
|
t.objects = n;
|
|
2163
2204
|
for (let e = 0; e < n.length; e += 1) {
|
|
@@ -2166,7 +2207,7 @@ function ft({ state: e }) {
|
|
|
2166
2207
|
}
|
|
2167
2208
|
return t;
|
|
2168
2209
|
}
|
|
2169
|
-
function
|
|
2210
|
+
function ht({ state: e, canvas: t }) {
|
|
2170
2211
|
let { objects: n = [] } = e, r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
2171
2212
|
for (let e = 0; e < n.length; e += 1) {
|
|
2172
2213
|
let { customData: t, id: a } = n[e];
|
|
@@ -2181,23 +2222,23 @@ function pt({ state: e, canvas: t }) {
|
|
|
2181
2222
|
let a = t.getObjects?.() ?? [];
|
|
2182
2223
|
for (let e = 0; e < a.length; e += 1) {
|
|
2183
2224
|
let t = a[e], { id: n } = t, o;
|
|
2184
|
-
typeof n == "string" && (o = r.get(n)), o ||= i.get(e), o && (t.customData =
|
|
2225
|
+
typeof n == "string" && (o = r.get(n)), o ||= i.get(e), o && (t.customData = pt({ customData: o }));
|
|
2185
2226
|
}
|
|
2186
2227
|
}
|
|
2187
2228
|
//#endregion
|
|
2188
2229
|
//#region src/editor/history-manager/snapshot-interactivity.ts
|
|
2189
|
-
function
|
|
2230
|
+
function gt({ object: e }) {
|
|
2190
2231
|
return typeof e.getObjects == "function" ? e.getObjects() : [];
|
|
2191
2232
|
}
|
|
2192
|
-
function
|
|
2233
|
+
function _t({ objects: e }) {
|
|
2193
2234
|
for (let t = 0; t < e.length; t += 1) if (e[t].isEditing) return !0;
|
|
2194
2235
|
return !1;
|
|
2195
2236
|
}
|
|
2196
|
-
function
|
|
2237
|
+
function vt({ object: e }) {
|
|
2197
2238
|
let t = typeof e.type == "string" ? e.type.toLowerCase() : "";
|
|
2198
2239
|
return t === "textbox" || t === "background-textbox" || typeof e.isEditing == "boolean";
|
|
2199
2240
|
}
|
|
2200
|
-
function
|
|
2241
|
+
function yt({ object: e, withEvented: t = !1 }) {
|
|
2201
2242
|
let n = {
|
|
2202
2243
|
object: e,
|
|
2203
2244
|
lockMovementX: e.lockMovementX,
|
|
@@ -2206,66 +2247,66 @@ function _t({ object: e, withEvented: t = !1 }) {
|
|
|
2206
2247
|
};
|
|
2207
2248
|
return t && (n.evented = e.evented), n;
|
|
2208
2249
|
}
|
|
2209
|
-
function
|
|
2210
|
-
return e.shapeComposite !== !0 || !
|
|
2250
|
+
function bt({ object: e, snapshotStates: t }) {
|
|
2251
|
+
return e.shapeComposite !== !0 || !_t({ objects: gt({ object: e }) }) ? !1 : (t.push(yt({ object: e })), e.lockMovementX = !1, e.lockMovementY = !1, e.selectable = !0, !0);
|
|
2211
2252
|
}
|
|
2212
|
-
function
|
|
2213
|
-
if (!
|
|
2253
|
+
function xt({ object: e, snapshotStates: t }) {
|
|
2254
|
+
if (!vt({ object: e })) return !1;
|
|
2214
2255
|
let n = e.group, { isEditing: r } = e, i = n?.shapeComposite === !0, a = !!n?.locked;
|
|
2215
|
-
return !i || a || !r ? !1 : (t.push(
|
|
2256
|
+
return !i || a || !r ? !1 : (t.push(yt({
|
|
2216
2257
|
object: e,
|
|
2217
2258
|
withEvented: !0
|
|
2218
2259
|
})), e.lockMovementX = !1, e.lockMovementY = !1, e.selectable = !1, e.evented = !1, !0);
|
|
2219
2260
|
}
|
|
2220
|
-
function
|
|
2221
|
-
if (!
|
|
2261
|
+
function St({ object: e, snapshotStates: t }) {
|
|
2262
|
+
if (!vt({ object: e })) return !1;
|
|
2222
2263
|
let n = !!e.lockMovementX, r = !!e.lockMovementY;
|
|
2223
|
-
return !n && !r ? !1 : (t.push(
|
|
2264
|
+
return !n && !r ? !1 : (t.push(yt({ object: e })), e.lockMovementX = !1, e.lockMovementY = !1, e.selectable = !0, !0);
|
|
2224
2265
|
}
|
|
2225
|
-
function
|
|
2266
|
+
function Ct({ objects: e }) {
|
|
2226
2267
|
let t = [];
|
|
2227
2268
|
for (let n = 0; n < e.length; n += 1) {
|
|
2228
2269
|
let r = e[n];
|
|
2229
|
-
r.locked ||
|
|
2270
|
+
r.locked || bt({
|
|
2230
2271
|
object: r,
|
|
2231
2272
|
snapshotStates: t
|
|
2232
|
-
}) ||
|
|
2273
|
+
}) || xt({
|
|
2233
2274
|
object: r,
|
|
2234
2275
|
snapshotStates: t
|
|
2235
|
-
}) ||
|
|
2276
|
+
}) || St({
|
|
2236
2277
|
object: r,
|
|
2237
2278
|
snapshotStates: t
|
|
2238
2279
|
});
|
|
2239
2280
|
}
|
|
2240
2281
|
return t;
|
|
2241
2282
|
}
|
|
2242
|
-
function
|
|
2283
|
+
function wt({ canvas: e }) {
|
|
2243
2284
|
let t = [...e.getObjects?.() ?? []], n = [];
|
|
2244
2285
|
for (let e = 0; e < t.length; e += 1) {
|
|
2245
2286
|
let r = t[e];
|
|
2246
2287
|
n.push(r);
|
|
2247
|
-
let i =
|
|
2288
|
+
let i = gt({ object: r });
|
|
2248
2289
|
for (let e = 0; e < i.length; e += 1) t.push(i[e]);
|
|
2249
2290
|
}
|
|
2250
2291
|
return n;
|
|
2251
2292
|
}
|
|
2252
|
-
function
|
|
2293
|
+
function Tt({ snapshotStates: e }) {
|
|
2253
2294
|
for (let t = 0; t < e.length; t += 1) {
|
|
2254
2295
|
let { object: n, lockMovementX: r, lockMovementY: i, selectable: a, evented: o } = e[t];
|
|
2255
2296
|
n.lockMovementX = r, n.lockMovementY = i, n.selectable = a, o !== void 0 && (n.evented = o);
|
|
2256
2297
|
}
|
|
2257
2298
|
}
|
|
2258
|
-
function
|
|
2259
|
-
let n =
|
|
2299
|
+
function Et({ canvas: e, callback: t }) {
|
|
2300
|
+
let n = Ct({ objects: wt({ canvas: e }) });
|
|
2260
2301
|
try {
|
|
2261
2302
|
return t();
|
|
2262
2303
|
} finally {
|
|
2263
|
-
|
|
2304
|
+
Tt({ snapshotStates: n });
|
|
2264
2305
|
}
|
|
2265
2306
|
}
|
|
2266
2307
|
//#endregion
|
|
2267
2308
|
//#region src/editor/history-manager/index.ts
|
|
2268
|
-
var
|
|
2309
|
+
var Dt = class {
|
|
2269
2310
|
constructor({ editor: e }) {
|
|
2270
2311
|
this.editor = e, this.canvas = e.canvas, this._isSavingState = !1, this._historySuspendCount = 0, this._isActionInProgress = !1, this._actionSnapshot = null, this._actionReason = null, this._pendingSaveTimeoutId = null, this._pendingSaveReason = null, this._pendingCommittedState = null, this._pendingCommittedStateReason = null, this._hasDeferredSaveAfterUnblock = !1, this.baseState = null, this.patches = [], this.currentIndex = 0, this.maxHistoryLength = e.options.maxHistoryLength, this.totalChangesCount = 0, this.baseStateChangesCount = 0, this._createDiffPatcher();
|
|
2271
2312
|
}
|
|
@@ -2330,14 +2371,14 @@ var Tt = class {
|
|
|
2330
2371
|
return console.log("getFullState state", r), r;
|
|
2331
2372
|
}
|
|
2332
2373
|
_captureCurrentState() {
|
|
2333
|
-
return
|
|
2374
|
+
return Et({
|
|
2334
2375
|
canvas: this.canvas,
|
|
2335
2376
|
callback: () => this._serializeCanvasState()
|
|
2336
2377
|
});
|
|
2337
2378
|
}
|
|
2338
2379
|
_serializeCanvasState() {
|
|
2339
2380
|
let { canvas: e } = this;
|
|
2340
|
-
return e.toDatalessObject([...
|
|
2381
|
+
return e.toDatalessObject([...nt]);
|
|
2341
2382
|
}
|
|
2342
2383
|
_handlePendingSaveTimeout() {
|
|
2343
2384
|
this._pendingSaveTimeoutId !== null && (this._pendingSaveTimeoutId = null, this._pendingSaveReason = null, this.saveState());
|
|
@@ -2380,7 +2421,7 @@ var Tt = class {
|
|
|
2380
2421
|
this.baseState = e, this.patches = [], this.currentIndex = 0, console.log("Базовое состояние сохранено.");
|
|
2381
2422
|
return;
|
|
2382
2423
|
}
|
|
2383
|
-
let { prevState: t, nextState: n } =
|
|
2424
|
+
let { prevState: t, nextState: n } = ft({
|
|
2384
2425
|
prevState: this.getFullState(),
|
|
2385
2426
|
nextState: e
|
|
2386
2427
|
}), r = this.diffPatcher.diff(t, n);
|
|
@@ -2388,7 +2429,7 @@ var Tt = class {
|
|
|
2388
2429
|
console.log("Нет изменений для сохранения.");
|
|
2389
2430
|
return;
|
|
2390
2431
|
}
|
|
2391
|
-
if (
|
|
2432
|
+
if (ot({
|
|
2392
2433
|
prevState: t,
|
|
2393
2434
|
nextState: n
|
|
2394
2435
|
})) {
|
|
@@ -2410,9 +2451,9 @@ var Tt = class {
|
|
|
2410
2451
|
try {
|
|
2411
2452
|
let e = this._consumePendingCommittedState();
|
|
2412
2453
|
e && (this._pendingSaveTimeoutId !== null && this._pendingSaveReason === e.reason && this._clearPendingSave(), e.reason === "text-edit" && this._deactivateTextEditing(), this._saveSerializedState({ currentStateObj: e.state }));
|
|
2413
|
-
let t =
|
|
2454
|
+
let t = Et({
|
|
2414
2455
|
canvas: this.canvas,
|
|
2415
|
-
callback: () => this.canvas.toDatalessObject([...
|
|
2456
|
+
callback: () => this.canvas.toDatalessObject([...nt])
|
|
2416
2457
|
});
|
|
2417
2458
|
console.timeEnd("saveState"), this._saveSerializedState({ currentStateObj: t });
|
|
2418
2459
|
} finally {
|
|
@@ -2425,8 +2466,8 @@ var Tt = class {
|
|
|
2425
2466
|
console.log("loadStateFromFullState fullState", e);
|
|
2426
2467
|
let { canvas: t, canvasManager: n, interactionBlocker: r, backgroundManager: i, zoomManager: a, panConstraintManager: o } = this.editor, { width: s, height: c } = t, { width: l, height: u } = this.editor.montageArea;
|
|
2427
2468
|
r.overlayMask = null;
|
|
2428
|
-
let d =
|
|
2429
|
-
await t.loadFromJSON(d),
|
|
2469
|
+
let d = mt({ state: e });
|
|
2470
|
+
await t.loadFromJSON(d), ht({
|
|
2430
2471
|
state: e,
|
|
2431
2472
|
canvas: t
|
|
2432
2473
|
});
|
|
@@ -2508,7 +2549,7 @@ var Tt = class {
|
|
|
2508
2549
|
}
|
|
2509
2550
|
}
|
|
2510
2551
|
}
|
|
2511
|
-
},
|
|
2552
|
+
}, Ot = .1, kt = 4096, At = 4096, jt = "application/image-editor:", Mt = /* @__PURE__ */ "id.customData.backgroundType.format.contentType.width.height.originX.originY.locked.editable.evented.selectable.lockMovementX.lockMovementY.lockRotation.lockScalingX.lockScalingY.lockSkewingX.lockSkewingY.styles.lineFontDefaults.textCaseRaw.uppercase.autoExpand.linethrough.underline.fontStyle.fontWeight.backgroundOpacity.paddingTop.paddingRight.paddingBottom.paddingLeft.radiusTopLeft.radiusTopRight.radiusBottomRight.radiusBottomLeft.shapeComposite.shapePresetKey.shapeBaseWidth.shapeBaseHeight.shapeManualBaseWidth.shapeManualBaseHeight.shapeReplaceBoxWidth.shapeReplaceBoxHeight.shapeTextAutoExpand.shapeTextWrapPolicy.shapeAlignHorizontal.shapeAlignVertical.shapePaddingTop.shapePaddingRight.shapePaddingBottom.shapePaddingLeft.shapeFill.shapeStroke.shapeStrokeWidth.shapeStrokeDashArray.shapeOpacity.shapeRounding.shapeNodeType".split("."), Nt = class e {
|
|
2512
2553
|
constructor({ editor: e }) {
|
|
2513
2554
|
this.editor = e, this.options = e.options, this._createdBlobUrls = [], this.acceptContentTypes = this.editor.options.acceptContentTypes, this.acceptFormats = this.getAllowedFormatsFromContentTypes();
|
|
2514
2555
|
}
|
|
@@ -2705,7 +2746,7 @@ var Tt = class {
|
|
|
2705
2746
|
}
|
|
2706
2747
|
}
|
|
2707
2748
|
async resizeImageToBoundaries(e) {
|
|
2708
|
-
let { dataURL: t, sizeType: n = "max", contentType: r = "image/png", quality: i = 1, maxWidth: a =
|
|
2749
|
+
let { dataURL: t, sizeType: n = "max", contentType: r = "image/png", quality: i = 1, maxWidth: a = kt, maxHeight: o = At, minWidth: s = 16, minHeight: c = 16, asBase64: l = !1, emitMessage: u = !0 } = e, { errorManager: d, workerManager: f } = this.editor, p = {
|
|
2709
2750
|
dataURL: t,
|
|
2710
2751
|
sizeType: n,
|
|
2711
2752
|
contentType: r,
|
|
@@ -2981,11 +3022,11 @@ var Tt = class {
|
|
|
2981
3022
|
let t = e.match(/^[^/]+\/([^+;]+)/);
|
|
2982
3023
|
return t ? t[1] : "";
|
|
2983
3024
|
}
|
|
2984
|
-
},
|
|
2985
|
-
function
|
|
3025
|
+
}, Pt = (e, t, n) => Math.max(Math.min(e, n), t), Ft = (e, t) => e * t;
|
|
3026
|
+
function It(e) {
|
|
2986
3027
|
return (e?.type === "image" || e?.format === "svg") && typeof e?.width == "number" && typeof e?.height == "number";
|
|
2987
3028
|
}
|
|
2988
|
-
var
|
|
3029
|
+
var Lt = class {
|
|
2989
3030
|
constructor({ editor: e }) {
|
|
2990
3031
|
this.editor = e;
|
|
2991
3032
|
}
|
|
@@ -2995,7 +3036,7 @@ var Ft = class {
|
|
|
2995
3036
|
}
|
|
2996
3037
|
getVisibleCenterPoint() {
|
|
2997
3038
|
let { canvas: e } = this.editor, t = e.getZoom(), n = e.viewportTransform, r = e.getWidth(), i = e.getHeight(), a = this.getMontageAreaSceneBounds(), o = (r / 2 - n[4]) / t, s = (i / 2 - n[5]) / t;
|
|
2998
|
-
return new m(
|
|
3039
|
+
return new m(Pt(o, a.left, a.right), Pt(s, a.top, a.bottom));
|
|
2999
3040
|
}
|
|
3000
3041
|
getMontageAreaSceneCenter() {
|
|
3001
3042
|
let { montageArea: e } = this.editor;
|
|
@@ -3074,9 +3115,9 @@ var Ft = class {
|
|
|
3074
3115
|
}
|
|
3075
3116
|
setResolutionWidth(e, { preserveProportional: t, withoutSave: n, adaptCanvasToContainer: r } = {}) {
|
|
3076
3117
|
if (!e) return;
|
|
3077
|
-
let { canvas: i, montageArea: a, options: { canvasBackstoreWidth: o } } = this.editor, { width: s, height: c } = a, l =
|
|
3118
|
+
let { canvas: i, montageArea: a, options: { canvasBackstoreWidth: o } } = this.editor, { width: s, height: c } = a, l = Pt(Number(e), 16, kt);
|
|
3078
3119
|
if (!o || o === "auto" || r ? this.adaptCanvasToContainer() : o ? this.setCanvasBackstoreWidth(Number(o)) : this.setCanvasBackstoreWidth(l), a.set({ width: l }), this.placeMontageAreaAtCanonicalScenePosition(), t) {
|
|
3079
|
-
let e =
|
|
3120
|
+
let e = Ft(c, l / s);
|
|
3080
3121
|
this.setResolutionHeight(e, {
|
|
3081
3122
|
withoutSave: n,
|
|
3082
3123
|
adaptCanvasToContainer: r
|
|
@@ -3092,9 +3133,9 @@ var Ft = class {
|
|
|
3092
3133
|
}
|
|
3093
3134
|
setResolutionHeight(e, { preserveProportional: t, withoutSave: n, adaptCanvasToContainer: r } = {}) {
|
|
3094
3135
|
if (!e) return;
|
|
3095
|
-
let { canvas: i, montageArea: a, options: { canvasBackstoreHeight: o } } = this.editor, { width: s, height: c } = a, l =
|
|
3136
|
+
let { canvas: i, montageArea: a, options: { canvasBackstoreHeight: o } } = this.editor, { width: s, height: c } = a, l = Pt(Number(e), 16, At);
|
|
3096
3137
|
if (!o || o === "auto" || r ? this.adaptCanvasToContainer() : o ? this.setCanvasBackstoreHeight(Number(o)) : this.setCanvasBackstoreHeight(l), a.set({ height: l }), this.placeMontageAreaAtCanonicalScenePosition(), t) {
|
|
3097
|
-
let e =
|
|
3138
|
+
let e = Ft(s, l / c);
|
|
3098
3139
|
this.setResolutionWidth(e, {
|
|
3099
3140
|
withoutSave: n,
|
|
3100
3141
|
adaptCanvasToContainer: r
|
|
@@ -3121,16 +3162,16 @@ var Ft = class {
|
|
|
3121
3162
|
}
|
|
3122
3163
|
setCanvasBackstoreWidth(e) {
|
|
3123
3164
|
if (!e || typeof e != "number") return;
|
|
3124
|
-
let t =
|
|
3165
|
+
let t = Pt(e, 16, kt);
|
|
3125
3166
|
this.editor.canvas.setDimensions({ width: t }, { backstoreOnly: !0 });
|
|
3126
3167
|
}
|
|
3127
3168
|
setCanvasBackstoreHeight(e) {
|
|
3128
3169
|
if (!e || typeof e != "number") return;
|
|
3129
|
-
let t =
|
|
3170
|
+
let t = Pt(e, 16, At);
|
|
3130
3171
|
this.editor.canvas.setDimensions({ height: t }, { backstoreOnly: !0 });
|
|
3131
3172
|
}
|
|
3132
3173
|
adaptCanvasToContainer() {
|
|
3133
|
-
let { canvas: e } = this.editor, t = this.getEditorContainer(), n = t.clientWidth, r = t.clientHeight, i =
|
|
3174
|
+
let { canvas: e } = this.editor, t = this.getEditorContainer(), n = t.clientWidth, r = t.clientHeight, i = Pt(n, 16, kt), a = Pt(r, 16, At);
|
|
3134
3175
|
e.setDimensions({
|
|
3135
3176
|
width: i,
|
|
3136
3177
|
height: a
|
|
@@ -3218,8 +3259,8 @@ var Ft = class {
|
|
|
3218
3259
|
}
|
|
3219
3260
|
scaleMontageAreaToImage({ object: e, preserveAspectRatio: t, withoutSave: n } = {}) {
|
|
3220
3261
|
let { canvas: r, montageArea: i, transformManager: a } = this.editor, o = e || r.getActiveObject();
|
|
3221
|
-
if (!
|
|
3222
|
-
let { width: s, height: c } = o, l = Math.min(s,
|
|
3262
|
+
if (!It(o)) return;
|
|
3263
|
+
let { width: s, height: c } = o, l = Math.min(s, kt), u = Math.min(c, At);
|
|
3223
3264
|
if (t) {
|
|
3224
3265
|
let { width: e, height: t } = i, n = s / e, r = c / t, a = Math.max(n, r);
|
|
3225
3266
|
l = e * a, u = t * a;
|
|
@@ -3247,7 +3288,7 @@ var Ft = class {
|
|
|
3247
3288
|
let { canvas: e, montageArea: t, interactionBlocker: { overlayMask: n }, backgroundManager: { backgroundObject: r } } = this.editor;
|
|
3248
3289
|
return e.getObjects().filter((e) => e.id !== t.id && e.id !== n?.id && e.id !== r?.id);
|
|
3249
3290
|
}
|
|
3250
|
-
},
|
|
3291
|
+
}, Rt = class {
|
|
3251
3292
|
constructor({ editor: e }) {
|
|
3252
3293
|
this.editor = e, this.options = e.options;
|
|
3253
3294
|
}
|
|
@@ -3281,14 +3322,35 @@ var Ft = class {
|
|
|
3281
3322
|
}
|
|
3282
3323
|
setActiveObjectOpacity({ object: t, opacity: n = 1, withoutSave: r } = {}) {
|
|
3283
3324
|
let { canvas: i, historyManager: a } = this.editor, o = t || i.getActiveObject();
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3325
|
+
if (!o) return;
|
|
3326
|
+
let s = !1;
|
|
3327
|
+
if (o instanceof e) {
|
|
3328
|
+
let e = o.getObjects();
|
|
3329
|
+
for (let t = 0; t < e.length; t += 1) {
|
|
3330
|
+
let r = e[t], i = this._setCanvasObjectOpacity({
|
|
3331
|
+
object: r,
|
|
3332
|
+
opacity: n
|
|
3333
|
+
});
|
|
3334
|
+
s ||= i;
|
|
3335
|
+
}
|
|
3336
|
+
} else s = this._setCanvasObjectOpacity({
|
|
3337
|
+
object: o,
|
|
3338
|
+
opacity: n
|
|
3339
|
+
});
|
|
3340
|
+
s && (i.renderAll(), r || a.saveState(), i.fire("editor:object-opacity-changed", {
|
|
3287
3341
|
object: o,
|
|
3288
3342
|
opacity: n,
|
|
3289
3343
|
withoutSave: r
|
|
3290
3344
|
}));
|
|
3291
3345
|
}
|
|
3346
|
+
_setCanvasObjectOpacity({ object: e, opacity: t }) {
|
|
3347
|
+
let n = Xe({ target: e });
|
|
3348
|
+
return n ? !!this.editor.shapeManager.setOpacity({
|
|
3349
|
+
target: n,
|
|
3350
|
+
opacity: t,
|
|
3351
|
+
withoutSave: !0
|
|
3352
|
+
}) : (e.set("opacity", t), !0);
|
|
3353
|
+
}
|
|
3292
3354
|
fitObject({ object: t, type: n = this.options.scaleType, withoutSave: r, fitAsOneObject: i } = {}) {
|
|
3293
3355
|
let { canvas: a, historyManager: o } = this.editor, s = t || a.getActiveObject();
|
|
3294
3356
|
if (s) {
|
|
@@ -3378,7 +3440,7 @@ var Ft = class {
|
|
|
3378
3440
|
});
|
|
3379
3441
|
}
|
|
3380
3442
|
}
|
|
3381
|
-
},
|
|
3443
|
+
}, zt = class {
|
|
3382
3444
|
constructor({ editor: e }) {
|
|
3383
3445
|
this.editor = e, this.options = e.options, this.minZoom = this.options.minZoom || .1, this.maxZoom = this.options.maxZoom || 2, this.defaultZoom = this._normalizeDefaultZoom(this.options.defaultScale);
|
|
3384
3446
|
}
|
|
@@ -3432,7 +3494,7 @@ var Ft = class {
|
|
|
3432
3494
|
y: Math.abs(T) > Math.abs(d) ? d : T
|
|
3433
3495
|
};
|
|
3434
3496
|
}
|
|
3435
|
-
_applyViewportCentering(e, t = !1, n =
|
|
3497
|
+
_applyViewportCentering(e, t = !1, n = Ot) {
|
|
3436
3498
|
let { canvas: r } = this.editor, i = this._getScaledMontageDimensions(e), a = r.getWidth(), o = r.getHeight(), s = i.width > a || i.height > o, c = this._calculateFitZoom(), l = e - c;
|
|
3437
3499
|
if (!(!s || l) && !t) return !1;
|
|
3438
3500
|
let u = r.viewportTransform, d = this._calculateTargetViewportPosition(e);
|
|
@@ -3481,7 +3543,7 @@ var Ft = class {
|
|
|
3481
3543
|
pointY: u.y
|
|
3482
3544
|
});
|
|
3483
3545
|
}
|
|
3484
|
-
zoom(e =
|
|
3546
|
+
zoom(e = Ot, t = {}) {
|
|
3485
3547
|
if (!e) return;
|
|
3486
3548
|
let { minZoom: n, maxZoom: r } = this, { canvas: i } = this.editor, a = e < 0, o = i.getZoom(), s = i.getCenterPoint(), c = new m(t.pointX ?? s.x, t.pointY ?? s.y);
|
|
3487
3549
|
this.editor.montageArea.setCoords(), this.editor.canvas.requestRenderAll();
|
|
@@ -3507,30 +3569,30 @@ var Ft = class {
|
|
|
3507
3569
|
point: r
|
|
3508
3570
|
}), this.editor.panConstraintManager.updateBounds();
|
|
3509
3571
|
}
|
|
3510
|
-
},
|
|
3511
|
-
let r =
|
|
3572
|
+
}, W = ({ value: e, fallback: t = 0 }) => typeof e == "number" && Number.isFinite(e) ? e : typeof t == "number" && Number.isFinite(t) ? t : 0, Bt = ({ value: e, dimension: t, useRelativePositions: n }) => {
|
|
3573
|
+
let r = W({ value: e });
|
|
3512
3574
|
return n ? r : r / (t || 1);
|
|
3513
|
-
},
|
|
3514
|
-
x:
|
|
3575
|
+
}, Vt = ({ object: e, baseWidth: t, baseHeight: n, useRelativePositions: r }) => ({
|
|
3576
|
+
x: Bt({
|
|
3515
3577
|
value: e.left,
|
|
3516
3578
|
dimension: t,
|
|
3517
3579
|
useRelativePositions: r
|
|
3518
3580
|
}),
|
|
3519
|
-
y:
|
|
3581
|
+
y: Bt({
|
|
3520
3582
|
value: e.top,
|
|
3521
3583
|
dimension: n,
|
|
3522
3584
|
useRelativePositions: r
|
|
3523
3585
|
})
|
|
3524
|
-
}),
|
|
3586
|
+
}), Ht = ({ normalizedX: e, normalizedY: t, bounds: n }) => {
|
|
3525
3587
|
let { left: r, top: i, width: a, height: o } = n;
|
|
3526
3588
|
return new m(r + e * a, i + t * o);
|
|
3527
|
-
},
|
|
3589
|
+
}, Ut = ({ object: e }) => {
|
|
3528
3590
|
let { left: t = 0, top: n = 0, width: r = 0, height: i = 0, scaleX: a = 1, scaleY: o = 1, strokeWidth: s = 0, strokeUniform: c = !1 } = e, l = typeof e.type == "string" ? e.type.toLowerCase() : "", u = e instanceof v || l === "textbox" || l === "background-textbox", d = c ? 0 : s, f = r + d, p = i + d, m = {
|
|
3529
3591
|
left: Math.round(t),
|
|
3530
3592
|
top: Math.round(n)
|
|
3531
3593
|
};
|
|
3532
3594
|
u || (f > 0 && (m.scaleX = Math.max(1, Math.round(f * a)) / f), p > 0 && (m.scaleY = Math.max(1, Math.round(p * o)) / p)), e.set(m), e.setCoords();
|
|
3533
|
-
},
|
|
3595
|
+
}, G = ({ object: e }) => {
|
|
3534
3596
|
if (!e) return null;
|
|
3535
3597
|
try {
|
|
3536
3598
|
e.setCoords();
|
|
@@ -3549,17 +3611,17 @@ var Ft = class {
|
|
|
3549
3611
|
};
|
|
3550
3612
|
//#endregion
|
|
3551
3613
|
//#region src/editor/utils/primitive-shapes.ts
|
|
3552
|
-
function
|
|
3614
|
+
function Wt({ canvas: e, object: t, left: n, top: r, centerPoint: i, flags: a }) {
|
|
3553
3615
|
let { withoutSelection: o, withoutAdding: s } = a;
|
|
3554
3616
|
if (n === void 0 && r === void 0) {
|
|
3555
3617
|
let n = i ?? e.getCenterPoint();
|
|
3556
3618
|
t.setPositionByOrigin(n, "center", "center"), t.setCoords();
|
|
3557
3619
|
}
|
|
3558
|
-
return
|
|
3620
|
+
return Ut({ object: t }), s ? t : (e.add(t), o || e.setActiveObject(t), e.renderAll(), t);
|
|
3559
3621
|
}
|
|
3560
|
-
var
|
|
3622
|
+
var Gt = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
3561
3623
|
let { id: i = `rect-${D()}`, left: a, top: o, width: s = 100, height: c = 100, fill: l = "blue", ...u } = t;
|
|
3562
|
-
return
|
|
3624
|
+
return Wt({
|
|
3563
3625
|
canvas: e,
|
|
3564
3626
|
object: new _({
|
|
3565
3627
|
id: i,
|
|
@@ -3575,7 +3637,7 @@ var Ut = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
3575
3637
|
centerPoint: n,
|
|
3576
3638
|
flags: r
|
|
3577
3639
|
});
|
|
3578
|
-
},
|
|
3640
|
+
}, Kt = "ai-generation-overlay", qt = 1080, Jt = Math.PI * 2, Yt = 40, Xt = 8, Zt = Xt / 2, Qt = (qt - Yt * Xt) / (Yt + 1), $t = Xt + Qt, en = .18, tn = .58, nn = "rgba(136, 136, 136, 0.5)", rn = "rgba(255, 255, 255, 0.92)", an = [
|
|
3579
3641
|
{
|
|
3580
3642
|
rx: 540,
|
|
3581
3643
|
ry: 430,
|
|
@@ -3637,40 +3699,40 @@ var Ut = ({ canvas: e, options: t = {}, centerPoint: n, flags: r = {} }) => {
|
|
|
3637
3699
|
seed: 5.37
|
|
3638
3700
|
}
|
|
3639
3701
|
];
|
|
3640
|
-
function
|
|
3702
|
+
function on({ value: e, min: t = 0, max: n = 1 }) {
|
|
3641
3703
|
return Math.max(t, Math.min(n, e));
|
|
3642
3704
|
}
|
|
3643
|
-
function
|
|
3705
|
+
function sn({ from: e, to: t, progress: n }) {
|
|
3644
3706
|
return e + (t - e) * n;
|
|
3645
3707
|
}
|
|
3646
|
-
function
|
|
3647
|
-
let r =
|
|
3708
|
+
function cn({ edgeStart: e, edgeEnd: t, value: n }) {
|
|
3709
|
+
let r = on({ value: (n - e) / (t - e) });
|
|
3648
3710
|
return r * r * (3 - 2 * r);
|
|
3649
3711
|
}
|
|
3650
|
-
function
|
|
3651
|
-
return
|
|
3712
|
+
function ln({ time: e, seed: t }) {
|
|
3713
|
+
return on({ value: .5 + .5 * (.53 * Math.sin(e * .73 + t * 11.17) + .29 * Math.sin(e * 1.37 + t * 7.13 + 1.1) + .18 * Math.sin(e * 2.21 + t * 3.97 + 2.4)) });
|
|
3652
3714
|
}
|
|
3653
|
-
function
|
|
3715
|
+
function un() {
|
|
3654
3716
|
let e = [];
|
|
3655
|
-
for (let t = 0; t <
|
|
3656
|
-
x:
|
|
3657
|
-
y:
|
|
3717
|
+
for (let t = 0; t < Yt; t += 1) for (let n = 0; n < Yt; n += 1) e.push({
|
|
3718
|
+
x: Qt + Zt + n * $t,
|
|
3719
|
+
y: Qt + Zt + t * $t
|
|
3658
3720
|
});
|
|
3659
3721
|
return e;
|
|
3660
3722
|
}
|
|
3661
|
-
var
|
|
3662
|
-
function
|
|
3663
|
-
let n = t * e.speed, r = t * e.pulseSpeed + e.seed * 3.1, i = -e.travelPadX, a =
|
|
3723
|
+
var dn = un();
|
|
3724
|
+
function fn({ blob: e, time: t }) {
|
|
3725
|
+
let n = t * e.speed, r = t * e.pulseSpeed + e.seed * 3.1, i = -e.travelPadX, a = qt + e.travelPadX, o = -e.travelPadY, s = qt + e.travelPadY, c = ln({
|
|
3664
3726
|
time: n,
|
|
3665
3727
|
seed: e.seed + .11
|
|
3666
|
-
}), l =
|
|
3728
|
+
}), l = ln({
|
|
3667
3729
|
time: n * .93 + 7.3,
|
|
3668
3730
|
seed: e.seed + .67
|
|
3669
|
-
}), u =
|
|
3731
|
+
}), u = sn({
|
|
3670
3732
|
from: i,
|
|
3671
3733
|
to: a,
|
|
3672
3734
|
progress: c
|
|
3673
|
-
}), d =
|
|
3735
|
+
}), d = sn({
|
|
3674
3736
|
from: o,
|
|
3675
3737
|
to: s,
|
|
3676
3738
|
progress: l
|
|
@@ -3683,46 +3745,46 @@ function un({ blob: e, time: t }) {
|
|
|
3683
3745
|
weight: e.weight
|
|
3684
3746
|
};
|
|
3685
3747
|
}
|
|
3686
|
-
function
|
|
3748
|
+
function pn({ state: e, dot: t }) {
|
|
3687
3749
|
let n = (t.x - e.x) / e.rx, r = (t.y - e.y) / e.ry;
|
|
3688
3750
|
return Math.exp(-(n * n + r * r) * 1.6) * e.weight;
|
|
3689
3751
|
}
|
|
3690
|
-
function
|
|
3752
|
+
function mn({ dot: e, states: t, time: n }) {
|
|
3691
3753
|
let r = 0;
|
|
3692
|
-
for (let n of t) r +=
|
|
3754
|
+
for (let n of t) r += pn({
|
|
3693
3755
|
state: n,
|
|
3694
3756
|
dot: e
|
|
3695
3757
|
});
|
|
3696
3758
|
let i = .98 + .02 * Math.sin(e.x * .012 + e.y * .01 + n * 3.1);
|
|
3697
|
-
return
|
|
3698
|
-
edgeStart:
|
|
3699
|
-
edgeEnd:
|
|
3759
|
+
return cn({
|
|
3760
|
+
edgeStart: en,
|
|
3761
|
+
edgeEnd: tn,
|
|
3700
3762
|
value: r
|
|
3701
3763
|
}) * i;
|
|
3702
3764
|
}
|
|
3703
|
-
function
|
|
3704
|
-
let n =
|
|
3765
|
+
function hn({ ctx: e, time: t }) {
|
|
3766
|
+
let n = an.map((e) => fn({
|
|
3705
3767
|
blob: e,
|
|
3706
3768
|
time: t
|
|
3707
3769
|
}));
|
|
3708
|
-
e.fillStyle =
|
|
3709
|
-
for (let r of
|
|
3710
|
-
let i =
|
|
3770
|
+
e.fillStyle = rn;
|
|
3771
|
+
for (let r of dn) {
|
|
3772
|
+
let i = mn({
|
|
3711
3773
|
dot: r,
|
|
3712
3774
|
states: n,
|
|
3713
3775
|
time: t
|
|
3714
3776
|
});
|
|
3715
|
-
i <= .01 || (e.beginPath(), e.arc(r.x, r.y,
|
|
3777
|
+
i <= .01 || (e.beginPath(), e.arc(r.x, r.y, Zt * Math.min(i, 1), 0, Jt), e.fill());
|
|
3716
3778
|
}
|
|
3717
3779
|
}
|
|
3718
|
-
var
|
|
3780
|
+
var gn = class extends _ {
|
|
3719
3781
|
static {
|
|
3720
|
-
this.type =
|
|
3782
|
+
this.type = Kt;
|
|
3721
3783
|
}
|
|
3722
3784
|
constructor(e = {}) {
|
|
3723
3785
|
super({
|
|
3724
3786
|
...e,
|
|
3725
|
-
fill:
|
|
3787
|
+
fill: nn,
|
|
3726
3788
|
objectCaching: !1
|
|
3727
3789
|
}), this._animationFrameId = null, this._renderTimeMs = 0;
|
|
3728
3790
|
}
|
|
@@ -3743,16 +3805,16 @@ var mn = class extends _ {
|
|
|
3743
3805
|
}
|
|
3744
3806
|
_render(e) {
|
|
3745
3807
|
let t = this.width ?? 0, n = this.height ?? 0;
|
|
3746
|
-
t <= 0 || n <= 0 || (e.save(), e.beginPath(), e.rect(-t / 2, -n / 2, t, n), e.clip(), e.fillStyle =
|
|
3808
|
+
t <= 0 || n <= 0 || (e.save(), e.beginPath(), e.rect(-t / 2, -n / 2, t, n), e.clip(), e.fillStyle = nn, e.fillRect(-t / 2, -n / 2, t, n), e.translate(-t / 2, -n / 2), e.scale(t / qt, n / qt), hn({
|
|
3747
3809
|
ctx: e,
|
|
3748
3810
|
time: this._renderTimeMs / 1e3
|
|
3749
3811
|
}), e.restore());
|
|
3750
3812
|
}
|
|
3751
|
-
},
|
|
3752
|
-
b?.setClass && b.setClass(
|
|
3753
|
-
},
|
|
3813
|
+
}, _n = () => {
|
|
3814
|
+
b?.setClass && b.setClass(gn, Kt);
|
|
3815
|
+
}, vn = "default", yn = "overlay-mask", bn = class {
|
|
3754
3816
|
constructor({ editor: e }) {
|
|
3755
|
-
|
|
3817
|
+
_n(), this.editor = e, this.isBlocked = !1, this.overlayMask = null, this._overlayType = vn;
|
|
3756
3818
|
}
|
|
3757
3819
|
_getOverlayGeometry() {
|
|
3758
3820
|
let { canvasManager: e } = this.editor, t = e.getMontageAreaSceneBounds();
|
|
@@ -3780,12 +3842,12 @@ var mn = class extends _ {
|
|
|
3780
3842
|
hasControls: !1,
|
|
3781
3843
|
excludeFromExport: !0,
|
|
3782
3844
|
visible: !1,
|
|
3783
|
-
id:
|
|
3845
|
+
id: yn
|
|
3784
3846
|
};
|
|
3785
3847
|
}
|
|
3786
3848
|
_createDefaultOverlay() {
|
|
3787
3849
|
let { options: { overlayMaskColor: e = "rgba(136, 136, 136, 0.5)" } } = this.editor;
|
|
3788
|
-
return
|
|
3850
|
+
return Gt({
|
|
3789
3851
|
canvas: this.editor.canvas,
|
|
3790
3852
|
options: {
|
|
3791
3853
|
...this._getOverlayBaseOptions(),
|
|
@@ -3795,11 +3857,11 @@ var mn = class extends _ {
|
|
|
3795
3857
|
});
|
|
3796
3858
|
}
|
|
3797
3859
|
_createAiGenerationOverlay() {
|
|
3798
|
-
let e = new
|
|
3860
|
+
let e = new gn(this._getOverlayBaseOptions());
|
|
3799
3861
|
return this.editor.canvas.add(e), e;
|
|
3800
3862
|
}
|
|
3801
3863
|
_stopOverlayAnimation() {
|
|
3802
|
-
this.overlayMask instanceof
|
|
3864
|
+
this.overlayMask instanceof gn && this.overlayMask.stopAnimation();
|
|
3803
3865
|
}
|
|
3804
3866
|
_createOverlay({ overlay: e }) {
|
|
3805
3867
|
let { canvas: t, historyManager: n } = this.editor;
|
|
@@ -3811,7 +3873,7 @@ var mn = class extends _ {
|
|
|
3811
3873
|
}
|
|
3812
3874
|
}
|
|
3813
3875
|
_startOverlayAnimation() {
|
|
3814
|
-
this.overlayMask instanceof
|
|
3876
|
+
this.overlayMask instanceof gn && this.overlayMask.startAnimation({ canvas: this.editor.canvas });
|
|
3815
3877
|
}
|
|
3816
3878
|
ensureOverlay({ overlay: e = this._overlayType } = {}) {
|
|
3817
3879
|
(!this.overlayMask || this._overlayType !== e) && this._createOverlay({ overlay: e }), this.overlayMask && (this.overlayMask.set(this._getOverlayGeometry()), this.overlayMask.visible = this.isBlocked, this.overlayMask.setCoords());
|
|
@@ -3827,7 +3889,7 @@ var mn = class extends _ {
|
|
|
3827
3889
|
}
|
|
3828
3890
|
}
|
|
3829
3891
|
}
|
|
3830
|
-
block({ overlay: e =
|
|
3892
|
+
block({ overlay: e = vn } = {}) {
|
|
3831
3893
|
if (this.isBlocked) {
|
|
3832
3894
|
this.ensureOverlay();
|
|
3833
3895
|
return;
|
|
@@ -3856,7 +3918,7 @@ var mn = class extends _ {
|
|
|
3856
3918
|
}
|
|
3857
3919
|
n.flushDeferredSaveAfterUnblock();
|
|
3858
3920
|
}
|
|
3859
|
-
},
|
|
3921
|
+
}, xn = class e {
|
|
3860
3922
|
constructor({ editor: e }) {
|
|
3861
3923
|
this.editor = e, this.backgroundObject = null;
|
|
3862
3924
|
}
|
|
@@ -4048,7 +4110,7 @@ var mn = class extends _ {
|
|
|
4048
4110
|
this.backgroundObject && a !== i + 1 && e.moveObjectTo(this.backgroundObject, i + 1), e.requestRenderAll(), n.resumeHistory();
|
|
4049
4111
|
}
|
|
4050
4112
|
_createColorBackground(e) {
|
|
4051
|
-
this.backgroundObject =
|
|
4113
|
+
this.backgroundObject = Gt({
|
|
4052
4114
|
canvas: this.editor.canvas,
|
|
4053
4115
|
options: {
|
|
4054
4116
|
...this._getMontageBackgroundRectOptions(),
|
|
@@ -4065,7 +4127,7 @@ var mn = class extends _ {
|
|
|
4065
4127
|
}), this.refresh();
|
|
4066
4128
|
}
|
|
4067
4129
|
_createGradientBackground(t) {
|
|
4068
|
-
this.backgroundObject =
|
|
4130
|
+
this.backgroundObject = Gt({
|
|
4069
4131
|
canvas: this.editor.canvas,
|
|
4070
4132
|
options: {
|
|
4071
4133
|
...this._getMontageBackgroundRectOptions(),
|
|
@@ -4164,7 +4226,7 @@ var mn = class extends _ {
|
|
|
4164
4226
|
return e.color === n.color && Math.abs(e.offset - n.offset) < 1e-4;
|
|
4165
4227
|
}) ? !1 : e.type === "linear" && t.type === "linear" ? Math.abs(e.coords.x1 - t.coords.x1) < 1e-4 && Math.abs(e.coords.y1 - t.coords.y1) < 1e-4 && Math.abs(e.coords.x2 - t.coords.x2) < 1e-4 && Math.abs(e.coords.y2 - t.coords.y2) < 1e-4 : e.type === "radial" && t.type === "radial" ? Math.abs(e.coords.x1 - t.coords.x1) < 1e-4 && Math.abs(e.coords.y1 - t.coords.y1) < 1e-4 && Math.abs(e.coords.x2 - t.coords.x2) < 1e-4 && Math.abs(e.coords.y2 - t.coords.y2) < 1e-4 && Math.abs(e.coords.r1 - t.coords.r1) < 1e-4 && Math.abs(e.coords.r2 - t.coords.r2) < 1e-4 : !1;
|
|
4166
4228
|
}
|
|
4167
|
-
},
|
|
4229
|
+
}, Sn = class t {
|
|
4168
4230
|
constructor({ editor: e }) {
|
|
4169
4231
|
this.editor = e;
|
|
4170
4232
|
}
|
|
@@ -4238,24 +4300,24 @@ var mn = class extends _ {
|
|
|
4238
4300
|
e.sendObjectBackwards(t.obj);
|
|
4239
4301
|
});
|
|
4240
4302
|
}
|
|
4241
|
-
},
|
|
4242
|
-
function
|
|
4303
|
+
}, Cn = 1, wn = 1e-4;
|
|
4304
|
+
function K({ value: e }) {
|
|
4243
4305
|
return Number(e.toFixed(4));
|
|
4244
4306
|
}
|
|
4245
|
-
function
|
|
4307
|
+
function Tn({ rounding: e }) {
|
|
4246
4308
|
return R({ rounding: e }) > 0;
|
|
4247
4309
|
}
|
|
4248
|
-
function
|
|
4310
|
+
function En({ width: e, height: t, strokeWidth: n }) {
|
|
4249
4311
|
let r = Math.max(0, n ?? 0);
|
|
4250
4312
|
return {
|
|
4251
|
-
width: Math.max(
|
|
4252
|
-
height: Math.max(
|
|
4313
|
+
width: Math.max(Cn, e - r),
|
|
4314
|
+
height: Math.max(Cn, t - r)
|
|
4253
4315
|
};
|
|
4254
4316
|
}
|
|
4255
|
-
function
|
|
4256
|
-
let a =
|
|
4257
|
-
width: Math.max(
|
|
4258
|
-
height: Math.max(
|
|
4317
|
+
function Dn({ shape: e, width: t, height: n, rounding: r, strokeWidth: i }) {
|
|
4318
|
+
let a = En({
|
|
4319
|
+
width: Math.max(Cn, t),
|
|
4320
|
+
height: Math.max(Cn, n),
|
|
4259
4321
|
strokeWidth: i
|
|
4260
4322
|
});
|
|
4261
4323
|
if (e instanceof _) {
|
|
@@ -4274,7 +4336,7 @@ function Tn({ shape: e, width: t, height: n, rounding: r, strokeWidth: i }) {
|
|
|
4274
4336
|
}), e.setCoords();
|
|
4275
4337
|
return;
|
|
4276
4338
|
}
|
|
4277
|
-
let { width: o =
|
|
4339
|
+
let { width: o = Cn, height: s = Cn } = e, c = Math.max(Cn, o), l = Math.max(Cn, s);
|
|
4278
4340
|
e.set({
|
|
4279
4341
|
scaleX: a.width / c,
|
|
4280
4342
|
scaleY: a.height / l,
|
|
@@ -4284,7 +4346,7 @@ function Tn({ shape: e, width: t, height: n, rounding: r, strokeWidth: i }) {
|
|
|
4284
4346
|
originY: "center"
|
|
4285
4347
|
}), e.setCoords();
|
|
4286
4348
|
}
|
|
4287
|
-
function
|
|
4349
|
+
function On({ shape: e, style: t }) {
|
|
4288
4350
|
let { fill: n, stroke: r, strokeWidth: i, strokeDashArray: a, opacity: o } = t, s = {
|
|
4289
4351
|
strokeUniform: !0,
|
|
4290
4352
|
strokeLineCap: "round",
|
|
@@ -4292,7 +4354,7 @@ function En({ shape: e, style: t }) {
|
|
|
4292
4354
|
};
|
|
4293
4355
|
n !== void 0 && (s.fill = n), r !== void 0 && (s.stroke = r), i !== void 0 && (s.strokeWidth = i), a !== void 0 && (s.strokeDashArray = a), o !== void 0 && (s.opacity = o), e.set(s), e.setCoords();
|
|
4294
4356
|
}
|
|
4295
|
-
function
|
|
4357
|
+
function kn({ shape: e, style: t }) {
|
|
4296
4358
|
let n = [e];
|
|
4297
4359
|
for (let e = 0; e < n.length; e += 1) {
|
|
4298
4360
|
let r = n[e];
|
|
@@ -4302,22 +4364,22 @@ function Dn({ shape: e, style: t }) {
|
|
|
4302
4364
|
t.opacity !== void 0 && r.set({ opacity: t.opacity }), r.setCoords();
|
|
4303
4365
|
continue;
|
|
4304
4366
|
}
|
|
4305
|
-
|
|
4367
|
+
On({
|
|
4306
4368
|
shape: r,
|
|
4307
4369
|
style: t
|
|
4308
4370
|
});
|
|
4309
4371
|
}
|
|
4310
4372
|
}
|
|
4311
|
-
function
|
|
4373
|
+
function An({ points: e, closed: t }) {
|
|
4312
4374
|
if (e.length === 0) return "";
|
|
4313
|
-
let n = `M ${
|
|
4375
|
+
let n = `M ${K({ value: e[0].x })} ${K({ value: e[0].y })}`;
|
|
4314
4376
|
for (let t = 1; t < e.length; t += 1) {
|
|
4315
4377
|
let r = e[t];
|
|
4316
|
-
n += ` L ${
|
|
4378
|
+
n += ` L ${K({ value: r.x })} ${K({ value: r.y })}`;
|
|
4317
4379
|
}
|
|
4318
4380
|
return t && (n += " Z"), n;
|
|
4319
4381
|
}
|
|
4320
|
-
function
|
|
4382
|
+
function jn({ previous: e, current: t, next: n, roundingRatio: r }) {
|
|
4321
4383
|
let i = {
|
|
4322
4384
|
x: e.x - t.x,
|
|
4323
4385
|
y: e.y - t.y
|
|
@@ -4325,36 +4387,36 @@ function kn({ previous: e, current: t, next: n, roundingRatio: r }) {
|
|
|
4325
4387
|
x: n.x - t.x,
|
|
4326
4388
|
y: n.y - t.y
|
|
4327
4389
|
}, o = Math.hypot(i.x, i.y), s = Math.hypot(a.x, a.y);
|
|
4328
|
-
if (o <=
|
|
4390
|
+
if (o <= wn || s <= wn) return {
|
|
4329
4391
|
start: {
|
|
4330
|
-
x:
|
|
4331
|
-
y:
|
|
4392
|
+
x: K({ value: t.x }),
|
|
4393
|
+
y: K({ value: t.y })
|
|
4332
4394
|
},
|
|
4333
4395
|
end: {
|
|
4334
|
-
x:
|
|
4335
|
-
y:
|
|
4396
|
+
x: K({ value: t.x }),
|
|
4397
|
+
y: K({ value: t.y })
|
|
4336
4398
|
}
|
|
4337
4399
|
};
|
|
4338
4400
|
let c = Math.min(o / 2, s / 2) * r;
|
|
4339
4401
|
return {
|
|
4340
4402
|
start: {
|
|
4341
|
-
x:
|
|
4342
|
-
y:
|
|
4403
|
+
x: K({ value: t.x + i.x / o * c }),
|
|
4404
|
+
y: K({ value: t.y + i.y / o * c })
|
|
4343
4405
|
},
|
|
4344
4406
|
end: {
|
|
4345
|
-
x:
|
|
4346
|
-
y:
|
|
4407
|
+
x: K({ value: t.x + a.x / s * c }),
|
|
4408
|
+
y: K({ value: t.y + a.y / s * c })
|
|
4347
4409
|
}
|
|
4348
4410
|
};
|
|
4349
4411
|
}
|
|
4350
|
-
function
|
|
4412
|
+
function Mn({ points: e, roundingRatio: t, closed: n }) {
|
|
4351
4413
|
let r = e.length;
|
|
4352
4414
|
if (r === 0) return "";
|
|
4353
4415
|
if (!n && r === 1) {
|
|
4354
4416
|
let t = e[0];
|
|
4355
|
-
return `M ${
|
|
4417
|
+
return `M ${K({ value: t.x })} ${K({ value: t.y })}`;
|
|
4356
4418
|
}
|
|
4357
|
-
if (t <= 0) return
|
|
4419
|
+
if (t <= 0) return An({
|
|
4358
4420
|
points: e,
|
|
4359
4421
|
closed: n
|
|
4360
4422
|
});
|
|
@@ -4362,7 +4424,7 @@ function An({ points: e, roundingRatio: t, closed: n }) {
|
|
|
4362
4424
|
let n = [];
|
|
4363
4425
|
for (let i = 0; i < r; i += 1) {
|
|
4364
4426
|
let a = i === 0 ? r - 1 : i - 1, o = i === r - 1 ? 0 : i + 1;
|
|
4365
|
-
n.push(
|
|
4427
|
+
n.push(jn({
|
|
4366
4428
|
previous: e[a],
|
|
4367
4429
|
current: e[i],
|
|
4368
4430
|
next: e[o],
|
|
@@ -4376,13 +4438,13 @@ function An({ points: e, roundingRatio: t, closed: n }) {
|
|
|
4376
4438
|
}
|
|
4377
4439
|
return a += " Z", a;
|
|
4378
4440
|
}
|
|
4379
|
-
if (r === 2) return
|
|
4441
|
+
if (r === 2) return An({
|
|
4380
4442
|
points: e,
|
|
4381
4443
|
closed: !1
|
|
4382
4444
|
});
|
|
4383
|
-
let i = `M ${
|
|
4445
|
+
let i = `M ${K({ value: e[0].x })} ${K({ value: e[0].y })}`;
|
|
4384
4446
|
for (let n = 1; n < r - 1; n += 1) {
|
|
4385
|
-
let r =
|
|
4447
|
+
let r = jn({
|
|
4386
4448
|
previous: e[n - 1],
|
|
4387
4449
|
current: e[n],
|
|
4388
4450
|
next: e[n + 1],
|
|
@@ -4391,10 +4453,10 @@ function An({ points: e, roundingRatio: t, closed: n }) {
|
|
|
4391
4453
|
i += ` L ${r.start.x} ${r.start.y}`, i += ` Q ${e[n].x} ${e[n].y} ${r.end.x} ${r.end.y}`;
|
|
4392
4454
|
}
|
|
4393
4455
|
let a = e[r - 1];
|
|
4394
|
-
return i += ` L ${
|
|
4456
|
+
return i += ` L ${K({ value: a.x })} ${K({ value: a.y })}`, i;
|
|
4395
4457
|
}
|
|
4396
|
-
function
|
|
4397
|
-
return new f(
|
|
4458
|
+
function Nn({ points: e, rounding: t, closed: n }) {
|
|
4459
|
+
return new f(Mn({
|
|
4398
4460
|
points: e,
|
|
4399
4461
|
roundingRatio: pe({ rounding: t }),
|
|
4400
4462
|
closed: n
|
|
@@ -4405,8 +4467,8 @@ function jn({ points: e, rounding: t, closed: n }) {
|
|
|
4405
4467
|
top: 0
|
|
4406
4468
|
});
|
|
4407
4469
|
}
|
|
4408
|
-
function
|
|
4409
|
-
return
|
|
4470
|
+
function Pn({ rounding: e }) {
|
|
4471
|
+
return Tn({ rounding: e }) ? Nn({
|
|
4410
4472
|
points: [
|
|
4411
4473
|
{
|
|
4412
4474
|
x: 50,
|
|
@@ -4432,7 +4494,7 @@ function Mn({ rounding: e }) {
|
|
|
4432
4494
|
top: 0
|
|
4433
4495
|
});
|
|
4434
4496
|
}
|
|
4435
|
-
function
|
|
4497
|
+
function Fn({ path: e }) {
|
|
4436
4498
|
return new f(e, {
|
|
4437
4499
|
originX: "center",
|
|
4438
4500
|
originY: "center",
|
|
@@ -4440,8 +4502,8 @@ function Nn({ path: e }) {
|
|
|
4440
4502
|
top: 0
|
|
4441
4503
|
});
|
|
4442
4504
|
}
|
|
4443
|
-
function
|
|
4444
|
-
let n =
|
|
4505
|
+
function In({ path: e, rounding: t }) {
|
|
4506
|
+
let n = Fn({ path: e }).path ?? [], r = w.makePathSimpler(n), i = [], a = !1;
|
|
4445
4507
|
for (let e = 0; e < r.length; e += 1) {
|
|
4446
4508
|
let t = r[e];
|
|
4447
4509
|
if (!t) return null;
|
|
@@ -4461,19 +4523,19 @@ function Pn({ path: e, rounding: t }) {
|
|
|
4461
4523
|
}
|
|
4462
4524
|
return null;
|
|
4463
4525
|
}
|
|
4464
|
-
return i.length < 2 || a && i.length < 3 ? null :
|
|
4526
|
+
return i.length < 2 || a && i.length < 3 ? null : Nn({
|
|
4465
4527
|
points: i,
|
|
4466
4528
|
rounding: t,
|
|
4467
4529
|
closed: a
|
|
4468
4530
|
});
|
|
4469
4531
|
}
|
|
4470
|
-
function
|
|
4471
|
-
return
|
|
4532
|
+
function Ln({ path: e, rounding: t }) {
|
|
4533
|
+
return Tn({ rounding: t }) && In({
|
|
4472
4534
|
path: e,
|
|
4473
4535
|
rounding: R({ rounding: t })
|
|
4474
|
-
}) ||
|
|
4536
|
+
}) || Fn({ path: e });
|
|
4475
4537
|
}
|
|
4476
|
-
function
|
|
4538
|
+
function Rn({ points: e, type: t, rounding: n }) {
|
|
4477
4539
|
let r = e.length > 0 ? e : [
|
|
4478
4540
|
{
|
|
4479
4541
|
x: 0,
|
|
@@ -4489,12 +4551,12 @@ function In({ points: e, type: t, rounding: n }) {
|
|
|
4489
4551
|
}
|
|
4490
4552
|
], i = R({ rounding: n });
|
|
4491
4553
|
if (i > 0) {
|
|
4492
|
-
if (t === "polygon" && r.length >= 3) return
|
|
4554
|
+
if (t === "polygon" && r.length >= 3) return Nn({
|
|
4493
4555
|
points: r,
|
|
4494
4556
|
rounding: i,
|
|
4495
4557
|
closed: !0
|
|
4496
4558
|
});
|
|
4497
|
-
if (t === "polyline" && r.length >= 2) return
|
|
4559
|
+
if (t === "polyline" && r.length >= 2) return Nn({
|
|
4498
4560
|
points: r,
|
|
4499
4561
|
rounding: i,
|
|
4500
4562
|
closed: !1
|
|
@@ -4507,7 +4569,7 @@ function In({ points: e, type: t, rounding: n }) {
|
|
|
4507
4569
|
top: 0
|
|
4508
4570
|
});
|
|
4509
4571
|
}
|
|
4510
|
-
async function
|
|
4572
|
+
async function zn({ svg: e }) {
|
|
4511
4573
|
let t = await S(e), n = w.groupSVGElements(t.objects, t.options);
|
|
4512
4574
|
return n.set({
|
|
4513
4575
|
originX: "center",
|
|
@@ -4516,7 +4578,7 @@ async function Ln({ svg: e }) {
|
|
|
4516
4578
|
top: 0
|
|
4517
4579
|
}), n.setCoords(), n;
|
|
4518
4580
|
}
|
|
4519
|
-
async function
|
|
4581
|
+
async function Bn({ preset: e, rounding: t }) {
|
|
4520
4582
|
switch (e.type) {
|
|
4521
4583
|
case "rect": return new _({
|
|
4522
4584
|
width: 100,
|
|
@@ -4534,22 +4596,22 @@ async function Rn({ preset: e, rounding: t }) {
|
|
|
4534
4596
|
left: 0,
|
|
4535
4597
|
top: 0
|
|
4536
4598
|
});
|
|
4537
|
-
case "triangle": return
|
|
4538
|
-
case "polygon": return
|
|
4599
|
+
case "triangle": return Pn({ rounding: t });
|
|
4600
|
+
case "polygon": return Rn({
|
|
4539
4601
|
points: e.points,
|
|
4540
4602
|
type: "polygon",
|
|
4541
4603
|
rounding: t
|
|
4542
4604
|
});
|
|
4543
|
-
case "polyline": return
|
|
4605
|
+
case "polyline": return Rn({
|
|
4544
4606
|
points: e.points,
|
|
4545
4607
|
type: "polyline",
|
|
4546
4608
|
rounding: t
|
|
4547
4609
|
});
|
|
4548
|
-
case "path": return
|
|
4610
|
+
case "path": return Ln({
|
|
4549
4611
|
path: e.path,
|
|
4550
4612
|
rounding: t
|
|
4551
4613
|
});
|
|
4552
|
-
case "svg": return
|
|
4614
|
+
case "svg": return zn({ svg: e.svg });
|
|
4553
4615
|
default: return new _({
|
|
4554
4616
|
width: 100,
|
|
4555
4617
|
height: 100,
|
|
@@ -4560,15 +4622,15 @@ async function Rn({ preset: e, rounding: t }) {
|
|
|
4560
4622
|
});
|
|
4561
4623
|
}
|
|
4562
4624
|
}
|
|
4563
|
-
async function
|
|
4564
|
-
let a = await
|
|
4625
|
+
async function Vn({ preset: e, width: t, height: n, style: r, rounding: i }) {
|
|
4626
|
+
let a = await Bn({
|
|
4565
4627
|
preset: e,
|
|
4566
4628
|
rounding: i
|
|
4567
4629
|
});
|
|
4568
|
-
return
|
|
4630
|
+
return kn({
|
|
4569
4631
|
shape: a,
|
|
4570
4632
|
style: r
|
|
4571
|
-
}),
|
|
4633
|
+
}), Dn({
|
|
4572
4634
|
shape: a,
|
|
4573
4635
|
width: t,
|
|
4574
4636
|
height: n,
|
|
@@ -4585,30 +4647,30 @@ async function zn({ preset: e, width: t, height: n, style: r, rounding: i }) {
|
|
|
4585
4647
|
}
|
|
4586
4648
|
//#endregion
|
|
4587
4649
|
//#region src/editor/shape-manager/domain/shape-style.ts
|
|
4588
|
-
var
|
|
4589
|
-
function
|
|
4650
|
+
var Hn = "#B4B7BD", Un = 0, Wn = 1;
|
|
4651
|
+
function Gn({ options: e, fallback: t }) {
|
|
4590
4652
|
let { fill: n, stroke: r, strokeWidth: i, strokeDashArray: a, opacity: o } = e, s = a === void 0 ? t?.shapeStrokeDashArray : a;
|
|
4591
4653
|
return {
|
|
4592
|
-
fill: n ?? t?.shapeFill ??
|
|
4654
|
+
fill: n ?? t?.shapeFill ?? Hn,
|
|
4593
4655
|
stroke: r ?? t?.shapeStroke ?? null,
|
|
4594
|
-
strokeWidth: i ?? t?.shapeStrokeWidth ??
|
|
4656
|
+
strokeWidth: i ?? t?.shapeStrokeWidth ?? Un,
|
|
4595
4657
|
strokeDashArray: s ?? null,
|
|
4596
|
-
opacity: o ?? t?.shapeOpacity ??
|
|
4658
|
+
opacity: o ?? t?.shapeOpacity ?? Wn
|
|
4597
4659
|
};
|
|
4598
4660
|
}
|
|
4599
4661
|
//#endregion
|
|
4600
4662
|
//#region src/editor/shape-manager/layout/shape-layout-padding.ts
|
|
4601
|
-
var
|
|
4602
|
-
function
|
|
4663
|
+
var Kn = .5, qn = 12;
|
|
4664
|
+
function Jn({ width: e, padding: t }) {
|
|
4603
4665
|
let n = Math.max(0, t.left), r = Math.max(0, t.right);
|
|
4604
4666
|
return Math.max(1, e - n - r);
|
|
4605
4667
|
}
|
|
4606
|
-
function
|
|
4668
|
+
function Yn({ text: e }) {
|
|
4607
4669
|
return (e.text ?? "").trim().length > 0;
|
|
4608
4670
|
}
|
|
4609
|
-
function
|
|
4671
|
+
function Xn({ start: e, end: t, maxTotalPadding: n, startChanged: r, endChanged: i }) {
|
|
4610
4672
|
let a = Math.max(0, e), o = Math.max(0, t), s = Math.max(0, n);
|
|
4611
|
-
if (a + o <= s +
|
|
4673
|
+
if (a + o <= s + Kn) return {
|
|
4612
4674
|
start: a,
|
|
4613
4675
|
end: o
|
|
4614
4676
|
};
|
|
@@ -4637,8 +4699,8 @@ function Jn({ start: e, end: t, maxTotalPadding: n, startChanged: r, endChanged:
|
|
|
4637
4699
|
end: o * l
|
|
4638
4700
|
};
|
|
4639
4701
|
}
|
|
4640
|
-
function
|
|
4641
|
-
let s = Math.max(0, n), c = Math.max(0, r), l = Math.max(0, i - s - c), u =
|
|
4702
|
+
function Zn({ start: e, end: t, insetStart: n, insetEnd: r, maxTotalPadding: i, startChanged: a, endChanged: o }) {
|
|
4703
|
+
let s = Math.max(0, n), c = Math.max(0, r), l = Math.max(0, i - s - c), u = Xn({
|
|
4642
4704
|
start: Math.max(0, e),
|
|
4643
4705
|
end: Math.max(0, t),
|
|
4644
4706
|
maxTotalPadding: l,
|
|
@@ -4652,23 +4714,23 @@ function Yn({ start: e, end: t, insetStart: n, insetEnd: r, maxTotalPadding: i,
|
|
|
4652
4714
|
appliedUserPaddingEnd: f
|
|
4653
4715
|
};
|
|
4654
4716
|
}
|
|
4655
|
-
function
|
|
4717
|
+
function Qn({ text: e, minFrameWidth: t, maxFrameWidth: n, frameHeight: r, measureTextboxHeightForFrame: i }) {
|
|
4656
4718
|
let a = Math.max(1, t), o = Math.max(a, n), s = Math.max(1, r);
|
|
4657
|
-
if (!
|
|
4719
|
+
if (!Yn({ text: e }) || i({
|
|
4658
4720
|
text: e,
|
|
4659
4721
|
frameWidth: a
|
|
4660
|
-
}) <= s +
|
|
4722
|
+
}) <= s + Kn) return a;
|
|
4661
4723
|
if (i({
|
|
4662
4724
|
text: e,
|
|
4663
4725
|
frameWidth: o
|
|
4664
|
-
}) > s +
|
|
4726
|
+
}) > s + Kn) return o;
|
|
4665
4727
|
let c = a, l = o;
|
|
4666
|
-
for (let t = 0; t <
|
|
4728
|
+
for (let t = 0; t < qn; t += 1) {
|
|
4667
4729
|
let t = (c + l) / 2;
|
|
4668
4730
|
if (i({
|
|
4669
4731
|
text: e,
|
|
4670
4732
|
frameWidth: t
|
|
4671
|
-
}) <= s +
|
|
4733
|
+
}) <= s + Kn) {
|
|
4672
4734
|
l = t;
|
|
4673
4735
|
continue;
|
|
4674
4736
|
}
|
|
@@ -4676,16 +4738,16 @@ function Xn({ text: e, minFrameWidth: t, maxFrameWidth: n, frameHeight: r, measu
|
|
|
4676
4738
|
}
|
|
4677
4739
|
return l;
|
|
4678
4740
|
}
|
|
4679
|
-
function
|
|
4680
|
-
let l = Math.max(1, t), u = Math.max(1, n), d =
|
|
4681
|
-
a || (f =
|
|
4741
|
+
function $n({ text: e, width: t, availableTextFrameHeight: n, padding: r, internalShapeTextInset: i, expandShapeHeightToFitText: a, changedPadding: o, measureTextboxHeightForFrame: s, resolveMinimumTextFrameWidth: c }) {
|
|
4742
|
+
let l = Math.max(1, t), u = Math.max(1, n), d = Yn({ text: e }) ? c({ text: e }) : 1, f = d;
|
|
4743
|
+
a || (f = Qn({
|
|
4682
4744
|
text: e,
|
|
4683
4745
|
minFrameWidth: d,
|
|
4684
4746
|
maxFrameWidth: l,
|
|
4685
4747
|
frameHeight: u,
|
|
4686
4748
|
measureTextboxHeightForFrame: s
|
|
4687
4749
|
}));
|
|
4688
|
-
let p = f + i.left + i.right, m = Math.max(0, l - f), h =
|
|
4750
|
+
let p = f + i.left + i.right, m = Math.max(0, l - f), h = Zn({
|
|
4689
4751
|
start: r.left,
|
|
4690
4752
|
end: r.right,
|
|
4691
4753
|
insetStart: i.left,
|
|
@@ -4706,8 +4768,8 @@ function Zn({ text: e, width: t, availableTextFrameHeight: n, padding: r, intern
|
|
|
4706
4768
|
requiredWidth: p
|
|
4707
4769
|
};
|
|
4708
4770
|
}
|
|
4709
|
-
function
|
|
4710
|
-
let a = Math.max(0, Math.max(1, n) - Math.max(1, r)), o =
|
|
4771
|
+
function er({ padding: e, internalShapeTextInset: t, height: n, textHeight: r, changedPadding: i }) {
|
|
4772
|
+
let a = Math.max(0, Math.max(1, n) - Math.max(1, r)), o = Zn({
|
|
4711
4773
|
start: e.top,
|
|
4712
4774
|
end: e.bottom,
|
|
4713
4775
|
insetStart: t.top,
|
|
@@ -4727,8 +4789,8 @@ function Qn({ padding: e, internalShapeTextInset: t, height: n, textHeight: r, c
|
|
|
4727
4789
|
}
|
|
4728
4790
|
};
|
|
4729
4791
|
}
|
|
4730
|
-
function
|
|
4731
|
-
let l = Math.max(1, t), u = Math.max(1, n), d = V({ padding: r }), f = V({ padding: i }), p = !!o?.left || !!o?.right, m = !!o?.top || !!o?.bottom, h = !a && p && !m, g = f.top + f.bottom, _ = g + (h ? d.top + d.bottom : 0), v =
|
|
4792
|
+
function tr({ text: e, width: t, height: n, padding: r, internalShapeTextInset: i, expandShapeHeightToFitText: a, changedPadding: o, measureTextboxHeightForFrame: s, resolveMinimumTextFrameWidth: c }) {
|
|
4793
|
+
let l = Math.max(1, t), u = Math.max(1, n), d = V({ padding: r }), f = V({ padding: i }), p = !!o?.left || !!o?.right, m = !!o?.top || !!o?.bottom, h = !a && p && !m, g = f.top + f.bottom, _ = g + (h ? d.top + d.bottom : 0), v = $n({
|
|
4732
4794
|
text: e,
|
|
4733
4795
|
width: l,
|
|
4734
4796
|
availableTextFrameHeight: Math.max(1, u - _),
|
|
@@ -4738,7 +4800,7 @@ function $n({ text: e, width: t, height: n, padding: r, internalShapeTextInset:
|
|
|
4738
4800
|
changedPadding: o,
|
|
4739
4801
|
measureTextboxHeightForFrame: s,
|
|
4740
4802
|
resolveMinimumTextFrameWidth: c
|
|
4741
|
-
}), y =
|
|
4803
|
+
}), y = Jn({
|
|
4742
4804
|
width: l,
|
|
4743
4805
|
padding: {
|
|
4744
4806
|
top: 0,
|
|
@@ -4746,10 +4808,10 @@ function $n({ text: e, width: t, height: n, padding: r, internalShapeTextInset:
|
|
|
4746
4808
|
bottom: 0,
|
|
4747
4809
|
left: v.appliedPadding.left
|
|
4748
4810
|
}
|
|
4749
|
-
}), b =
|
|
4811
|
+
}), b = Yn({ text: e }) ? s({
|
|
4750
4812
|
text: e,
|
|
4751
4813
|
frameWidth: y
|
|
4752
|
-
}) : 1, x = d.top + d.bottom, S = a ? Math.max(u, b + g + x) : u, C =
|
|
4814
|
+
}) : 1, x = d.top + d.bottom, S = a ? Math.max(u, b + g + x) : u, C = er({
|
|
4753
4815
|
padding: d,
|
|
4754
4816
|
internalShapeTextInset: f,
|
|
4755
4817
|
height: S,
|
|
@@ -4775,14 +4837,14 @@ function $n({ text: e, width: t, height: n, padding: r, internalShapeTextInset:
|
|
|
4775
4837
|
}
|
|
4776
4838
|
//#endregion
|
|
4777
4839
|
//#region src/editor/shape-manager/layout/shape-text-measurement.ts
|
|
4778
|
-
var
|
|
4779
|
-
function
|
|
4780
|
-
let a = Math.max(
|
|
4840
|
+
var nr = 1, rr = .5, ir = 1e6;
|
|
4841
|
+
function ar({ text: e, frameWidth: t, splitByGrapheme: n, requiresGraphemeSplit: r, measurementCache: i }) {
|
|
4842
|
+
let a = Math.max(nr, t), o = xr({
|
|
4781
4843
|
frameWidth: a,
|
|
4782
4844
|
splitByGrapheme: n
|
|
4783
4845
|
}), s = i?.measurementsByKey.get(o);
|
|
4784
4846
|
if (s) return s;
|
|
4785
|
-
let c =
|
|
4847
|
+
let c = _r({ text: e }), l = r ?? ur({
|
|
4786
4848
|
text: e,
|
|
4787
4849
|
frameWidth: a,
|
|
4788
4850
|
measurementCache: i
|
|
@@ -4794,24 +4856,24 @@ function rr({ text: e, frameWidth: t, splitByGrapheme: n, requiresGraphemeSplit:
|
|
|
4794
4856
|
scaleX: 1,
|
|
4795
4857
|
scaleY: 1
|
|
4796
4858
|
}), e.initDimensions();
|
|
4797
|
-
let u =
|
|
4798
|
-
measuredHeight:
|
|
4859
|
+
let u = hr({ text: e }), d = mr({ text: e }), f = {
|
|
4860
|
+
measuredHeight: fr({ text: e }),
|
|
4799
4861
|
renderedLineCount: u > 0 ? u : d,
|
|
4800
|
-
longestLineWidth: Math.ceil(
|
|
4862
|
+
longestLineWidth: Math.ceil(pr({ text: e })),
|
|
4801
4863
|
requiresGraphemeSplit: l
|
|
4802
4864
|
};
|
|
4803
|
-
return
|
|
4865
|
+
return vr({
|
|
4804
4866
|
text: e,
|
|
4805
4867
|
state: c
|
|
4806
4868
|
}), i?.measurementsByKey.set(o, f), f;
|
|
4807
4869
|
}
|
|
4808
|
-
function
|
|
4809
|
-
let i =
|
|
4870
|
+
function or({ text: e, frameWidth: t, wrapPolicy: n, measurementCache: r }) {
|
|
4871
|
+
let i = mr({ text: e }), a = ur({
|
|
4810
4872
|
text: e,
|
|
4811
4873
|
frameWidth: t,
|
|
4812
4874
|
wrapPolicy: n,
|
|
4813
4875
|
measurementCache: r
|
|
4814
|
-
}), o =
|
|
4876
|
+
}), o = ar({
|
|
4815
4877
|
text: e,
|
|
4816
4878
|
frameWidth: t,
|
|
4817
4879
|
splitByGrapheme: a,
|
|
@@ -4823,14 +4885,14 @@ function ir({ text: e, frameWidth: t, wrapPolicy: n, measurementCache: r }) {
|
|
|
4823
4885
|
longestLineWidth: o.longestLineWidth
|
|
4824
4886
|
};
|
|
4825
4887
|
}
|
|
4826
|
-
function
|
|
4827
|
-
let a = n ??
|
|
4888
|
+
function sr({ text: e, frameWidth: t, splitByGrapheme: n, wrapPolicy: r, measurementCache: i }) {
|
|
4889
|
+
let a = n ?? ur({
|
|
4828
4890
|
text: e,
|
|
4829
4891
|
frameWidth: t,
|
|
4830
4892
|
wrapPolicy: r,
|
|
4831
4893
|
measurementCache: i
|
|
4832
4894
|
});
|
|
4833
|
-
return
|
|
4895
|
+
return ar({
|
|
4834
4896
|
text: e,
|
|
4835
4897
|
frameWidth: t,
|
|
4836
4898
|
splitByGrapheme: a,
|
|
@@ -4838,25 +4900,25 @@ function ar({ text: e, frameWidth: t, splitByGrapheme: n, wrapPolicy: r, measure
|
|
|
4838
4900
|
measurementCache: i
|
|
4839
4901
|
}).measuredHeight;
|
|
4840
4902
|
}
|
|
4841
|
-
function
|
|
4903
|
+
function cr({ text: e, measurementCache: t }) {
|
|
4842
4904
|
if (t?.minimumTextFrameWidth !== null && t?.minimumTextFrameWidth !== void 0) return t.minimumTextFrameWidth;
|
|
4843
|
-
let n =
|
|
4905
|
+
let n = dr({
|
|
4844
4906
|
text: e,
|
|
4845
|
-
frameWidth:
|
|
4907
|
+
frameWidth: nr,
|
|
4846
4908
|
splitByGrapheme: !0,
|
|
4847
4909
|
measurementCache: t
|
|
4848
|
-
}), r = Math.max(
|
|
4910
|
+
}), r = Math.max(nr, n);
|
|
4849
4911
|
return t && (t.minimumTextFrameWidth = r), r;
|
|
4850
4912
|
}
|
|
4851
|
-
function
|
|
4913
|
+
function lr({ alignV: e, frameHeight: t, frameTop: n, textHeight: r }) {
|
|
4852
4914
|
let i = Math.max(0, t - r);
|
|
4853
4915
|
return e === "top" ? n : e === "bottom" ? n + i : n + i / 2;
|
|
4854
4916
|
}
|
|
4855
|
-
function
|
|
4917
|
+
function ur({ text: e, frameWidth: t, wrapPolicy: n, measurementCache: r }) {
|
|
4856
4918
|
if (n === "words-only") return !1;
|
|
4857
|
-
let i = Math.max(
|
|
4919
|
+
let i = Math.max(nr, t), a = br({ frameWidth: i }), o = r?.splitByGraphemeByFrameWidth.get(a);
|
|
4858
4920
|
if (typeof o == "boolean") return o;
|
|
4859
|
-
let s =
|
|
4921
|
+
let s = _r({ text: e });
|
|
4860
4922
|
e.set({
|
|
4861
4923
|
autoExpand: !1,
|
|
4862
4924
|
width: i,
|
|
@@ -4864,70 +4926,70 @@ function cr({ text: e, frameWidth: t, wrapPolicy: n, measurementCache: r }) {
|
|
|
4864
4926
|
scaleX: 1,
|
|
4865
4927
|
scaleY: 1
|
|
4866
4928
|
}), e.initDimensions();
|
|
4867
|
-
let c =
|
|
4868
|
-
return
|
|
4929
|
+
let c = yr({ text: e }) > i + rr;
|
|
4930
|
+
return vr({
|
|
4869
4931
|
text: e,
|
|
4870
4932
|
state: s
|
|
4871
4933
|
}), r?.splitByGraphemeByFrameWidth.set(a, c), c;
|
|
4872
4934
|
}
|
|
4873
|
-
function
|
|
4874
|
-
let i = r?.measurementsByKey.get(
|
|
4935
|
+
function dr({ text: e, frameWidth: t, splitByGrapheme: n, measurementCache: r }) {
|
|
4936
|
+
let i = r?.measurementsByKey.get(xr({
|
|
4875
4937
|
frameWidth: t,
|
|
4876
4938
|
splitByGrapheme: n
|
|
4877
4939
|
}));
|
|
4878
4940
|
if (i) return i.longestLineWidth;
|
|
4879
|
-
let a =
|
|
4941
|
+
let a = _r({ text: e });
|
|
4880
4942
|
e.set({
|
|
4881
4943
|
autoExpand: !1,
|
|
4882
|
-
width: Math.max(
|
|
4944
|
+
width: Math.max(nr, t),
|
|
4883
4945
|
splitByGrapheme: n,
|
|
4884
4946
|
scaleX: 1,
|
|
4885
4947
|
scaleY: 1
|
|
4886
4948
|
}), e.initDimensions();
|
|
4887
|
-
let o =
|
|
4888
|
-
return
|
|
4949
|
+
let o = pr({ text: e });
|
|
4950
|
+
return vr({
|
|
4889
4951
|
text: e,
|
|
4890
4952
|
state: a
|
|
4891
4953
|
}), o;
|
|
4892
4954
|
}
|
|
4893
|
-
function
|
|
4955
|
+
function fr({ text: e }) {
|
|
4894
4956
|
let { height: t } = e;
|
|
4895
4957
|
if (typeof t == "number" && Number.isFinite(t)) return t;
|
|
4896
4958
|
if (typeof e.calcTextHeight == "function") {
|
|
4897
4959
|
let t = e.calcTextHeight();
|
|
4898
4960
|
if (typeof t == "number" && Number.isFinite(t)) return t;
|
|
4899
4961
|
}
|
|
4900
|
-
return
|
|
4962
|
+
return nr;
|
|
4901
4963
|
}
|
|
4902
|
-
function
|
|
4903
|
-
let t =
|
|
4904
|
-
if (t > 0) return
|
|
4964
|
+
function pr({ text: e }) {
|
|
4965
|
+
let t = hr({ text: e });
|
|
4966
|
+
if (t > 0) return gr({
|
|
4905
4967
|
text: e,
|
|
4906
4968
|
lineCount: t
|
|
4907
4969
|
});
|
|
4908
4970
|
let n = e.text ?? "";
|
|
4909
|
-
return
|
|
4971
|
+
return gr({
|
|
4910
4972
|
text: e,
|
|
4911
4973
|
lineCount: Math.max(n.split("\n").length, 1)
|
|
4912
4974
|
});
|
|
4913
4975
|
}
|
|
4914
|
-
function
|
|
4976
|
+
function mr({ text: e }) {
|
|
4915
4977
|
let t = e.text ?? "";
|
|
4916
4978
|
return Math.max(t.split("\n").length, 1);
|
|
4917
4979
|
}
|
|
4918
|
-
function
|
|
4980
|
+
function hr({ text: e }) {
|
|
4919
4981
|
let t = e;
|
|
4920
4982
|
return Array.isArray(t.textLines) ? t.textLines.length : 0;
|
|
4921
4983
|
}
|
|
4922
|
-
function
|
|
4923
|
-
let n =
|
|
4984
|
+
function gr({ text: e, lineCount: t }) {
|
|
4985
|
+
let n = nr;
|
|
4924
4986
|
for (let r = 0; r < t; r += 1) {
|
|
4925
4987
|
let t = e.getLineWidth(r);
|
|
4926
4988
|
t > n && (n = t);
|
|
4927
4989
|
}
|
|
4928
4990
|
return n;
|
|
4929
4991
|
}
|
|
4930
|
-
function
|
|
4992
|
+
function _r({ text: e }) {
|
|
4931
4993
|
let { autoExpand: t, splitByGrapheme: n, width: r, scaleX: i, scaleY: a } = e;
|
|
4932
4994
|
return {
|
|
4933
4995
|
autoExpand: t,
|
|
@@ -4937,25 +4999,25 @@ function hr({ text: e }) {
|
|
|
4937
4999
|
scaleY: typeof a == "number" ? a : void 0
|
|
4938
5000
|
};
|
|
4939
5001
|
}
|
|
4940
|
-
function
|
|
5002
|
+
function vr({ text: e, state: t }) {
|
|
4941
5003
|
let { autoExpand: n, splitByGrapheme: r, width: i, scaleX: a, scaleY: o } = t, s = {};
|
|
4942
5004
|
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());
|
|
4943
5005
|
}
|
|
4944
|
-
function
|
|
5006
|
+
function yr({ text: e }) {
|
|
4945
5007
|
let { dynamicMinWidth: t } = e;
|
|
4946
5008
|
return typeof t == "number" && Number.isFinite(t) ? t : 0;
|
|
4947
5009
|
}
|
|
4948
|
-
function
|
|
4949
|
-
return String(Math.round(Math.max(
|
|
5010
|
+
function br({ frameWidth: e }) {
|
|
5011
|
+
return String(Math.round(Math.max(nr, e) * ir) / ir);
|
|
4950
5012
|
}
|
|
4951
|
-
function
|
|
4952
|
-
return `${
|
|
5013
|
+
function xr({ frameWidth: e, splitByGrapheme: t }) {
|
|
5014
|
+
return `${br({ frameWidth: e })}:${t ? 1 : 0}`;
|
|
4953
5015
|
}
|
|
4954
5016
|
//#endregion
|
|
4955
5017
|
//#region src/editor/shape-manager/layout/shape-layout.ts
|
|
4956
|
-
var
|
|
4957
|
-
function
|
|
4958
|
-
let { frame: s, splitByGrapheme: c, textTop: l } =
|
|
5018
|
+
var q = 1, J = .5, Sr = 24, Cr = 20, wr = 16;
|
|
5019
|
+
function Tr({ text: e, alignV: t, width: n, height: r, appliedPadding: i, appliedUserPadding: a, wrapPolicy: o }) {
|
|
5020
|
+
let { frame: s, splitByGrapheme: c, textTop: l } = Pr({
|
|
4959
5021
|
text: e,
|
|
4960
5022
|
width: n,
|
|
4961
5023
|
height: r,
|
|
@@ -4974,8 +5036,8 @@ function Cr({ text: e, alignV: t, width: n, height: r, appliedPadding: i, applie
|
|
|
4974
5036
|
wrapPolicy: o
|
|
4975
5037
|
};
|
|
4976
5038
|
}
|
|
4977
|
-
var
|
|
4978
|
-
let { width: p, height: m, appliedPadding: h, appliedUserPadding: g } = c ?
|
|
5039
|
+
var Er = ({ 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 }) => {
|
|
5040
|
+
let { width: p, height: m, appliedPadding: h, appliedUserPadding: g } = c ? jr({
|
|
4979
5041
|
text: e,
|
|
4980
5042
|
width: t,
|
|
4981
5043
|
height: n,
|
|
@@ -4987,7 +5049,7 @@ var wr = ({ text: e, width: t, height: n, alignV: r, padding: i, wrapPolicy: a,
|
|
|
4987
5049
|
montageAreaWidth: u,
|
|
4988
5050
|
expandShapeHeightToFitText: d,
|
|
4989
5051
|
changedPadding: f
|
|
4990
|
-
}) :
|
|
5052
|
+
}) : Br({
|
|
4991
5053
|
text: e,
|
|
4992
5054
|
width: t,
|
|
4993
5055
|
height: n,
|
|
@@ -4998,7 +5060,7 @@ var wr = ({ text: e, width: t, height: n, alignV: r, padding: i, wrapPolicy: a,
|
|
|
4998
5060
|
expandShapeHeightToFitText: d,
|
|
4999
5061
|
changedPadding: f
|
|
5000
5062
|
});
|
|
5001
|
-
return
|
|
5063
|
+
return Tr({
|
|
5002
5064
|
text: e,
|
|
5003
5065
|
alignV: r,
|
|
5004
5066
|
width: p,
|
|
@@ -5007,18 +5069,18 @@ var wr = ({ text: e, width: t, height: n, alignV: r, padding: i, wrapPolicy: a,
|
|
|
5007
5069
|
appliedUserPadding: g,
|
|
5008
5070
|
wrapPolicy: a
|
|
5009
5071
|
});
|
|
5010
|
-
},
|
|
5011
|
-
let d = Ne({ padding: i }), f = V({ padding: o }), p = Math.max(
|
|
5072
|
+
}, Dr = ({ text: e, width: t, height: n, alignV: r, padding: i, wrapPolicy: a, internalShapeTextInset: o, resolveInternalShapeTextInset: s, expandShapeHeightToFitText: c = !0, changedPadding: l, measurementCache: u }) => {
|
|
5073
|
+
let d = Ne({ padding: i }), f = V({ padding: o }), p = Math.max(q, t), m = Math.max(q, n), h = ({ text: e, frameWidth: t }) => sr({
|
|
5012
5074
|
text: e,
|
|
5013
5075
|
frameWidth: t,
|
|
5014
5076
|
wrapPolicy: a,
|
|
5015
5077
|
measurementCache: u
|
|
5016
|
-
}), g =
|
|
5078
|
+
}), g = tr({
|
|
5017
5079
|
text: e,
|
|
5018
5080
|
width: p,
|
|
5019
5081
|
height: m,
|
|
5020
5082
|
padding: d,
|
|
5021
|
-
internalShapeTextInset:
|
|
5083
|
+
internalShapeTextInset: zr({
|
|
5022
5084
|
width: p,
|
|
5023
5085
|
height: m,
|
|
5024
5086
|
internalShapeTextInset: f,
|
|
@@ -5027,20 +5089,20 @@ var wr = ({ text: e, width: t, height: n, alignV: r, padding: i, wrapPolicy: a,
|
|
|
5027
5089
|
expandShapeHeightToFitText: c,
|
|
5028
5090
|
changedPadding: l,
|
|
5029
5091
|
measureTextboxHeightForFrame: h,
|
|
5030
|
-
resolveMinimumTextFrameWidth: ({ text: e }) =>
|
|
5092
|
+
resolveMinimumTextFrameWidth: ({ text: e }) => cr({
|
|
5031
5093
|
text: e,
|
|
5032
5094
|
measurementCache: u
|
|
5033
5095
|
})
|
|
5034
5096
|
});
|
|
5035
|
-
for (let t = 0; t <
|
|
5097
|
+
for (let t = 0; t < Sr; t += 1) {
|
|
5036
5098
|
let t = Math.max(m, g.requiredHeight);
|
|
5037
|
-
if (t <= m +
|
|
5038
|
-
m = t, g =
|
|
5099
|
+
if (t <= m + J) break;
|
|
5100
|
+
m = t, g = tr({
|
|
5039
5101
|
text: e,
|
|
5040
5102
|
width: p,
|
|
5041
5103
|
height: m,
|
|
5042
5104
|
padding: d,
|
|
5043
|
-
internalShapeTextInset:
|
|
5105
|
+
internalShapeTextInset: zr({
|
|
5044
5106
|
width: p,
|
|
5045
5107
|
height: m,
|
|
5046
5108
|
internalShapeTextInset: f,
|
|
@@ -5049,13 +5111,13 @@ var wr = ({ text: e, width: t, height: n, alignV: r, padding: i, wrapPolicy: a,
|
|
|
5049
5111
|
expandShapeHeightToFitText: c,
|
|
5050
5112
|
changedPadding: l,
|
|
5051
5113
|
measureTextboxHeightForFrame: h,
|
|
5052
|
-
resolveMinimumTextFrameWidth: ({ text: e }) =>
|
|
5114
|
+
resolveMinimumTextFrameWidth: ({ text: e }) => cr({
|
|
5053
5115
|
text: e,
|
|
5054
5116
|
measurementCache: u
|
|
5055
5117
|
})
|
|
5056
5118
|
});
|
|
5057
5119
|
}
|
|
5058
|
-
return
|
|
5120
|
+
return Tr({
|
|
5059
5121
|
text: e,
|
|
5060
5122
|
alignV: r,
|
|
5061
5123
|
width: p,
|
|
@@ -5065,9 +5127,9 @@ var wr = ({ text: e, width: t, height: n, alignV: r, padding: i, wrapPolicy: a,
|
|
|
5065
5127
|
wrapPolicy: a
|
|
5066
5128
|
});
|
|
5067
5129
|
};
|
|
5068
|
-
function
|
|
5069
|
-
let o = Math.max(
|
|
5070
|
-
|
|
5130
|
+
function Or({ group: e, shape: t, text: n, alignH: r, alignV: i, resolvedLayout: a }) {
|
|
5131
|
+
let o = Math.max(q, e.shapeManualBaseWidth ?? a.width), s = Math.max(q, e.shapeManualBaseHeight ?? a.height), { width: c, height: l, appliedUserPadding: u, frame: d, splitByGrapheme: f, textTop: p, wrapPolicy: m } = a;
|
|
5132
|
+
Dn({
|
|
5071
5133
|
shape: t,
|
|
5072
5134
|
width: c,
|
|
5073
5135
|
height: l,
|
|
@@ -5096,14 +5158,14 @@ function Er({ group: e, shape: t, text: n, alignH: r, alignV: i, resolvedLayout:
|
|
|
5096
5158
|
scaleY: 1
|
|
5097
5159
|
}), e.set("dirty", !0), e.setCoords();
|
|
5098
5160
|
}
|
|
5099
|
-
var
|
|
5100
|
-
|
|
5161
|
+
var kr = ({ 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 }) => {
|
|
5162
|
+
Or({
|
|
5101
5163
|
group: e,
|
|
5102
5164
|
shape: t,
|
|
5103
5165
|
text: n,
|
|
5104
5166
|
alignH: a,
|
|
5105
5167
|
alignV: o,
|
|
5106
|
-
resolvedLayout:
|
|
5168
|
+
resolvedLayout: Er({
|
|
5107
5169
|
text: n,
|
|
5108
5170
|
width: r,
|
|
5109
5171
|
height: i,
|
|
@@ -5119,14 +5181,14 @@ var Dr = ({ group: e, shape: t, text: n, width: r, height: i, alignH: a, alignV:
|
|
|
5119
5181
|
changedPadding: h
|
|
5120
5182
|
})
|
|
5121
5183
|
});
|
|
5122
|
-
},
|
|
5123
|
-
|
|
5184
|
+
}, Ar = ({ 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 }) => {
|
|
5185
|
+
Or({
|
|
5124
5186
|
group: e,
|
|
5125
5187
|
shape: t,
|
|
5126
5188
|
text: n,
|
|
5127
5189
|
alignH: a,
|
|
5128
5190
|
alignV: o,
|
|
5129
|
-
resolvedLayout:
|
|
5191
|
+
resolvedLayout: Dr({
|
|
5130
5192
|
text: n,
|
|
5131
5193
|
width: r,
|
|
5132
5194
|
height: i,
|
|
@@ -5140,9 +5202,9 @@ var Dr = ({ group: e, shape: t, text: n, width: r, height: i, alignH: a, alignV:
|
|
|
5140
5202
|
})
|
|
5141
5203
|
});
|
|
5142
5204
|
};
|
|
5143
|
-
function
|
|
5144
|
-
let d = Math.max(
|
|
5145
|
-
if (!
|
|
5205
|
+
function jr({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalShapeTextInset: a, resolveInternalShapeTextInset: o, shapeTextAutoExpandEnabled: s = !0, montageAreaWidth: c, expandShapeHeightToFitText: l = !0, changedPadding: u }) {
|
|
5206
|
+
let d = Math.max(q, t), f = Math.max(q, n), p = Number.isFinite(c) && (c ?? 0) > 0 ? Math.max(q, c ?? q) : null;
|
|
5207
|
+
if (!Ir({ text: e })) return Br({
|
|
5146
5208
|
text: e,
|
|
5147
5209
|
width: d,
|
|
5148
5210
|
height: f,
|
|
@@ -5154,7 +5216,7 @@ function kr({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalS
|
|
|
5154
5216
|
changedPadding: u
|
|
5155
5217
|
});
|
|
5156
5218
|
let m = f / d, h = ({ width: t }) => {
|
|
5157
|
-
let n = Math.max(
|
|
5219
|
+
let n = Math.max(q, t * m), s = Br({
|
|
5158
5220
|
text: e,
|
|
5159
5221
|
width: t,
|
|
5160
5222
|
height: n,
|
|
@@ -5167,13 +5229,13 @@ function kr({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalS
|
|
|
5167
5229
|
});
|
|
5168
5230
|
return {
|
|
5169
5231
|
candidateHeight: n,
|
|
5170
|
-
frameWidth:
|
|
5232
|
+
frameWidth: Jn({
|
|
5171
5233
|
width: t,
|
|
5172
5234
|
padding: s.appliedPadding
|
|
5173
5235
|
}),
|
|
5174
5236
|
layoutResolution: s
|
|
5175
5237
|
};
|
|
5176
|
-
}, g = ({ candidateWidth: e, candidateHeight: t, layoutResolution: n }) => !(n.width > e +
|
|
5238
|
+
}, g = ({ candidateWidth: e, candidateHeight: t, layoutResolution: n }) => !(n.width > e + J || n.height > t + J);
|
|
5177
5239
|
if (!s) {
|
|
5178
5240
|
let e = ({ width: e }) => {
|
|
5179
5241
|
let { candidateHeight: t, layoutResolution: n } = h({ width: e });
|
|
@@ -5183,11 +5245,11 @@ function kr({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalS
|
|
|
5183
5245
|
layoutResolution: n
|
|
5184
5246
|
});
|
|
5185
5247
|
}, t = p ? Math.max(d, p) : d;
|
|
5186
|
-
e({ width: t }) || (t =
|
|
5248
|
+
e({ width: t }) || (t = Vr({
|
|
5187
5249
|
minimumWidth: t,
|
|
5188
5250
|
isWidthValid: e
|
|
5189
5251
|
}));
|
|
5190
|
-
let { layoutResolution: n } = h({ width:
|
|
5252
|
+
let { layoutResolution: n } = h({ width: Hr({
|
|
5191
5253
|
minimumWidth: d,
|
|
5192
5254
|
maximumWidth: t,
|
|
5193
5255
|
isWidthValid: e
|
|
@@ -5200,21 +5262,21 @@ function kr({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalS
|
|
|
5200
5262
|
candidateWidth: t,
|
|
5201
5263
|
candidateHeight: r,
|
|
5202
5264
|
layoutResolution: o
|
|
5203
|
-
}) || n !== void 0 && a < n -
|
|
5265
|
+
}) || n !== void 0 && a < n - J ? !1 : !or({
|
|
5204
5266
|
text: e,
|
|
5205
5267
|
frameWidth: a,
|
|
5206
5268
|
wrapPolicy: i
|
|
5207
5269
|
}).hasWrappedLines;
|
|
5208
|
-
}, v = p ? Math.max(d, p) :
|
|
5270
|
+
}, v = p ? Math.max(d, p) : Vr({
|
|
5209
5271
|
minimumWidth: d,
|
|
5210
5272
|
isWidthValid: ({ width: e }) => _({ width: e })
|
|
5211
|
-
}), y = h({ width: v }), b =
|
|
5273
|
+
}), y = h({ width: v }), b = or({
|
|
5212
5274
|
text: e,
|
|
5213
5275
|
frameWidth: y.frameWidth,
|
|
5214
5276
|
wrapPolicy: i
|
|
5215
5277
|
});
|
|
5216
5278
|
if (b.hasWrappedLines) return y.layoutResolution;
|
|
5217
|
-
let x = Math.max(
|
|
5279
|
+
let x = Math.max(q, b.longestLineWidth), { layoutResolution: S } = h({ width: Hr({
|
|
5218
5280
|
minimumWidth: d,
|
|
5219
5281
|
maximumWidth: v,
|
|
5220
5282
|
isWidthValid: ({ width: e }) => _({
|
|
@@ -5224,73 +5286,73 @@ function kr({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalS
|
|
|
5224
5286
|
}) });
|
|
5225
5287
|
return S;
|
|
5226
5288
|
}
|
|
5227
|
-
var
|
|
5228
|
-
let s = Math.max(
|
|
5229
|
-
if (!
|
|
5230
|
-
let l = Math.max(c, Number.isFinite(a) && a > 0 ? Math.max(
|
|
5289
|
+
var Mr = ({ text: e, currentWidth: t, minimumWidth: n, padding: r, wrapPolicy: i, montageAreaWidth: a, resolvePaddingForWidth: o }) => {
|
|
5290
|
+
let s = Math.max(q, t), c = Math.max(q, n);
|
|
5291
|
+
if (!Ir({ text: e })) return c;
|
|
5292
|
+
let l = Math.max(c, Number.isFinite(a) && a > 0 ? Math.max(q, a) : Math.max(s, c)), u = Jn({
|
|
5231
5293
|
width: l,
|
|
5232
|
-
padding:
|
|
5294
|
+
padding: Lr({
|
|
5233
5295
|
width: l,
|
|
5234
5296
|
padding: r,
|
|
5235
5297
|
resolvePaddingForWidth: o
|
|
5236
5298
|
})
|
|
5237
|
-
}), d = l, f =
|
|
5299
|
+
}), d = l, f = or({
|
|
5238
5300
|
text: e,
|
|
5239
5301
|
frameWidth: u,
|
|
5240
5302
|
wrapPolicy: i
|
|
5241
5303
|
});
|
|
5242
5304
|
if (f.hasWrappedLines) return d;
|
|
5243
|
-
let p = Math.max(
|
|
5244
|
-
return
|
|
5305
|
+
let p = Math.max(q, f.longestLineWidth);
|
|
5306
|
+
return Hr({
|
|
5245
5307
|
minimumWidth: c,
|
|
5246
5308
|
maximumWidth: d,
|
|
5247
5309
|
isWidthValid: ({ width: t }) => {
|
|
5248
|
-
let n =
|
|
5310
|
+
let n = Jn({
|
|
5249
5311
|
width: t,
|
|
5250
|
-
padding:
|
|
5312
|
+
padding: Lr({
|
|
5251
5313
|
width: t,
|
|
5252
5314
|
padding: r,
|
|
5253
5315
|
resolvePaddingForWidth: o
|
|
5254
5316
|
})
|
|
5255
5317
|
});
|
|
5256
|
-
return n < p -
|
|
5318
|
+
return n < p - J ? !1 : !or({
|
|
5257
5319
|
text: e,
|
|
5258
5320
|
frameWidth: n,
|
|
5259
5321
|
wrapPolicy: i
|
|
5260
5322
|
}).hasWrappedLines;
|
|
5261
5323
|
}
|
|
5262
5324
|
});
|
|
5263
|
-
},
|
|
5264
|
-
if (!
|
|
5265
|
-
let i =
|
|
5325
|
+
}, Nr = ({ text: e, padding: t, resolvePaddingForWidth: n, measurementCache: r }) => {
|
|
5326
|
+
if (!Ir({ text: e })) return q;
|
|
5327
|
+
let i = cr({
|
|
5266
5328
|
text: e,
|
|
5267
5329
|
measurementCache: r
|
|
5268
|
-
}), a = Math.max(
|
|
5330
|
+
}), a = Math.max(q, i), o = ({ width: e }) => Jn({
|
|
5269
5331
|
width: e,
|
|
5270
|
-
padding:
|
|
5332
|
+
padding: Lr({
|
|
5271
5333
|
width: e,
|
|
5272
5334
|
padding: t,
|
|
5273
5335
|
resolvePaddingForWidth: n
|
|
5274
5336
|
})
|
|
5275
|
-
}) >= i -
|
|
5276
|
-
return
|
|
5337
|
+
}) >= i - J;
|
|
5338
|
+
return Hr({
|
|
5277
5339
|
minimumWidth: a,
|
|
5278
|
-
maximumWidth:
|
|
5340
|
+
maximumWidth: Vr({
|
|
5279
5341
|
minimumWidth: a,
|
|
5280
5342
|
isWidthValid: o
|
|
5281
5343
|
}),
|
|
5282
5344
|
isWidthValid: o
|
|
5283
5345
|
});
|
|
5284
|
-
},
|
|
5285
|
-
let o =
|
|
5286
|
-
width: Math.max(
|
|
5287
|
-
height: Math.max(
|
|
5346
|
+
}, Pr = ({ text: e, width: t, height: n, alignV: r, wrapPolicy: i, padding: a }) => {
|
|
5347
|
+
let o = Ur({
|
|
5348
|
+
width: Math.max(q, t),
|
|
5349
|
+
height: Math.max(q, n),
|
|
5288
5350
|
padding: V({ padding: a })
|
|
5289
|
-
}), s =
|
|
5351
|
+
}), s = ur({
|
|
5290
5352
|
text: e,
|
|
5291
5353
|
frameWidth: o.width,
|
|
5292
5354
|
wrapPolicy: i
|
|
5293
|
-
}), c =
|
|
5355
|
+
}), c = sr({
|
|
5294
5356
|
text: e,
|
|
5295
5357
|
frameWidth: o.width,
|
|
5296
5358
|
splitByGrapheme: s,
|
|
@@ -5299,66 +5361,66 @@ var Ar = ({ text: e, currentWidth: t, minimumWidth: n, padding: r, wrapPolicy: i
|
|
|
5299
5361
|
return {
|
|
5300
5362
|
frame: o,
|
|
5301
5363
|
splitByGrapheme: s,
|
|
5302
|
-
textTop:
|
|
5364
|
+
textTop: lr({
|
|
5303
5365
|
alignV: r,
|
|
5304
5366
|
frameHeight: o.height,
|
|
5305
5367
|
frameTop: o.top,
|
|
5306
5368
|
textHeight: c
|
|
5307
5369
|
})
|
|
5308
5370
|
};
|
|
5309
|
-
},
|
|
5310
|
-
let s = Math.max(
|
|
5311
|
-
if (!
|
|
5312
|
-
let c = Math.max(
|
|
5313
|
-
for (let t = 0; t <
|
|
5314
|
-
let t =
|
|
5371
|
+
}, Fr = ({ text: e, width: t, height: n, padding: r, wrapPolicy: i, resolvePaddingForSize: a, measurementCache: o }) => {
|
|
5372
|
+
let s = Math.max(q, n);
|
|
5373
|
+
if (!Ir({ text: e })) return s;
|
|
5374
|
+
let c = Math.max(q, t), l = s;
|
|
5375
|
+
for (let t = 0; t < Sr; t += 1) {
|
|
5376
|
+
let t = Rr({
|
|
5315
5377
|
width: c,
|
|
5316
5378
|
height: l,
|
|
5317
5379
|
padding: r,
|
|
5318
5380
|
resolvePaddingForSize: a
|
|
5319
|
-
}), n =
|
|
5381
|
+
}), n = sr({
|
|
5320
5382
|
text: e,
|
|
5321
|
-
frameWidth:
|
|
5383
|
+
frameWidth: Jn({
|
|
5322
5384
|
width: c,
|
|
5323
5385
|
padding: t
|
|
5324
5386
|
}),
|
|
5325
5387
|
wrapPolicy: i,
|
|
5326
5388
|
measurementCache: o
|
|
5327
5389
|
}), u = Math.max(s, n + t.top + t.bottom);
|
|
5328
|
-
if (u <= l +
|
|
5390
|
+
if (u <= l + J) return u;
|
|
5329
5391
|
l = u;
|
|
5330
5392
|
}
|
|
5331
5393
|
return l;
|
|
5332
5394
|
};
|
|
5333
|
-
function
|
|
5395
|
+
function Ir({ text: e }) {
|
|
5334
5396
|
return (e.text ?? "").trim().length > 0;
|
|
5335
5397
|
}
|
|
5336
|
-
function
|
|
5337
|
-
return V(n ? { padding: n({ width: Math.max(
|
|
5398
|
+
function Lr({ width: e, padding: t, resolvePaddingForWidth: n }) {
|
|
5399
|
+
return V(n ? { padding: n({ width: Math.max(q, e) }) } : { padding: t });
|
|
5338
5400
|
}
|
|
5339
|
-
function
|
|
5401
|
+
function Rr({ width: e, height: t, padding: n, resolvePaddingForSize: r }) {
|
|
5340
5402
|
return V(r ? { padding: r({
|
|
5341
|
-
width: Math.max(
|
|
5342
|
-
height: Math.max(
|
|
5403
|
+
width: Math.max(q, e),
|
|
5404
|
+
height: Math.max(q, t)
|
|
5343
5405
|
}) } : { padding: n });
|
|
5344
5406
|
}
|
|
5345
|
-
function
|
|
5407
|
+
function zr({ width: e, height: t, internalShapeTextInset: n, resolveInternalShapeTextInset: r }) {
|
|
5346
5408
|
return V(r ? { padding: r({
|
|
5347
|
-
width: Math.max(
|
|
5348
|
-
height: Math.max(
|
|
5409
|
+
width: Math.max(q, e),
|
|
5410
|
+
height: Math.max(q, t)
|
|
5349
5411
|
}) } : { padding: n });
|
|
5350
5412
|
}
|
|
5351
|
-
function
|
|
5352
|
-
let l = Ne({ padding: r }), u = V({ padding: a }), d = Math.max(
|
|
5413
|
+
function Br({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalShapeTextInset: a, resolveInternalShapeTextInset: o, expandShapeHeightToFitText: s = !0, changedPadding: c }) {
|
|
5414
|
+
let l = Ne({ padding: r }), u = V({ padding: a }), d = Math.max(q, t), f = Math.max(q, n), p = ({ text: e, frameWidth: t }) => sr({
|
|
5353
5415
|
text: e,
|
|
5354
5416
|
frameWidth: t,
|
|
5355
5417
|
wrapPolicy: i
|
|
5356
|
-
}), m =
|
|
5418
|
+
}), m = tr({
|
|
5357
5419
|
text: e,
|
|
5358
5420
|
width: d,
|
|
5359
5421
|
height: f,
|
|
5360
5422
|
padding: l,
|
|
5361
|
-
internalShapeTextInset:
|
|
5423
|
+
internalShapeTextInset: zr({
|
|
5362
5424
|
width: d,
|
|
5363
5425
|
height: f,
|
|
5364
5426
|
internalShapeTextInset: u,
|
|
@@ -5367,17 +5429,17 @@ function Rr({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalS
|
|
|
5367
5429
|
expandShapeHeightToFitText: s,
|
|
5368
5430
|
changedPadding: c,
|
|
5369
5431
|
measureTextboxHeightForFrame: p,
|
|
5370
|
-
resolveMinimumTextFrameWidth:
|
|
5432
|
+
resolveMinimumTextFrameWidth: cr
|
|
5371
5433
|
});
|
|
5372
|
-
for (let t = 0; t <
|
|
5434
|
+
for (let t = 0; t < Sr; t += 1) {
|
|
5373
5435
|
let t = Math.max(d, m.requiredWidth), n = Math.max(f, m.requiredHeight);
|
|
5374
|
-
if (t <= d +
|
|
5375
|
-
d = t, f = n, m =
|
|
5436
|
+
if (t <= d + J && n <= f + J) break;
|
|
5437
|
+
d = t, f = n, m = tr({
|
|
5376
5438
|
text: e,
|
|
5377
5439
|
width: d,
|
|
5378
5440
|
height: f,
|
|
5379
5441
|
padding: l,
|
|
5380
|
-
internalShapeTextInset:
|
|
5442
|
+
internalShapeTextInset: zr({
|
|
5381
5443
|
width: d,
|
|
5382
5444
|
height: f,
|
|
5383
5445
|
internalShapeTextInset: u,
|
|
@@ -5386,7 +5448,7 @@ function Rr({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalS
|
|
|
5386
5448
|
expandShapeHeightToFitText: s,
|
|
5387
5449
|
changedPadding: c,
|
|
5388
5450
|
measureTextboxHeightForFrame: p,
|
|
5389
|
-
resolveMinimumTextFrameWidth:
|
|
5451
|
+
resolveMinimumTextFrameWidth: cr
|
|
5390
5452
|
});
|
|
5391
5453
|
}
|
|
5392
5454
|
return {
|
|
@@ -5396,17 +5458,17 @@ function Rr({ text: e, width: t, height: n, padding: r, wrapPolicy: i, internalS
|
|
|
5396
5458
|
appliedUserPadding: m.appliedUserPadding
|
|
5397
5459
|
};
|
|
5398
5460
|
}
|
|
5399
|
-
function
|
|
5400
|
-
let n = Math.max(
|
|
5461
|
+
function Vr({ minimumWidth: e, isWidthValid: t }) {
|
|
5462
|
+
let n = Math.max(q, e);
|
|
5401
5463
|
if (t({ width: n })) return n;
|
|
5402
|
-
for (let e = 0; e <
|
|
5464
|
+
for (let e = 0; e < wr; e += 1) if (n = Math.max(n + 1, n * 2), t({ width: n })) return n;
|
|
5403
5465
|
return n;
|
|
5404
5466
|
}
|
|
5405
|
-
function
|
|
5406
|
-
let r = Math.max(
|
|
5467
|
+
function Hr({ minimumWidth: e, maximumWidth: t, isWidthValid: n }) {
|
|
5468
|
+
let r = Math.max(q, e), i = Math.max(r, t);
|
|
5407
5469
|
if (n({ width: r })) return r;
|
|
5408
5470
|
if (!n({ width: i })) return i;
|
|
5409
|
-
for (let e = 0; e <
|
|
5471
|
+
for (let e = 0; e < Cr && !(i - r <= J); e += 1) {
|
|
5410
5472
|
let e = r + (i - r) / 2;
|
|
5411
5473
|
if (n({ width: e })) {
|
|
5412
5474
|
i = e;
|
|
@@ -5416,43 +5478,18 @@ function Br({ minimumWidth: e, maximumWidth: t, isWidthValid: n }) {
|
|
|
5416
5478
|
}
|
|
5417
5479
|
return i;
|
|
5418
5480
|
}
|
|
5419
|
-
function
|
|
5481
|
+
function Ur({ width: e, height: t, padding: n }) {
|
|
5420
5482
|
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);
|
|
5421
5483
|
return {
|
|
5422
5484
|
left: -e / 2 + r,
|
|
5423
5485
|
top: -t / 2 + a,
|
|
5424
|
-
width: Math.max(
|
|
5425
|
-
height: Math.max(
|
|
5486
|
+
width: Math.max(q, e - r - i),
|
|
5487
|
+
height: Math.max(q, t - a - o)
|
|
5426
5488
|
};
|
|
5427
5489
|
}
|
|
5428
5490
|
//#endregion
|
|
5429
|
-
//#region src/editor/shape-manager/
|
|
5430
|
-
var
|
|
5431
|
-
let t = e.getObjects();
|
|
5432
|
-
for (let e = 0; e < t.length; e += 1) {
|
|
5433
|
-
let n = t[e];
|
|
5434
|
-
if (n.shapeNodeType === "shape") return n;
|
|
5435
|
-
}
|
|
5436
|
-
for (let e = 0; e < t.length; e += 1) {
|
|
5437
|
-
let n = t[e];
|
|
5438
|
-
if (!(n instanceof v)) return n;
|
|
5439
|
-
}
|
|
5440
|
-
return null;
|
|
5441
|
-
}, Ur = ({ group: e }) => {
|
|
5442
|
-
let t = e.getObjects();
|
|
5443
|
-
for (let e = 0; e < t.length; e += 1) {
|
|
5444
|
-
let n = t[e];
|
|
5445
|
-
if (n.shapeNodeType === "text" && n instanceof v) return n;
|
|
5446
|
-
}
|
|
5447
|
-
for (let e = 0; e < t.length; e += 1) {
|
|
5448
|
-
let n = t[e];
|
|
5449
|
-
if (n instanceof v) return n;
|
|
5450
|
-
}
|
|
5451
|
-
return null;
|
|
5452
|
-
}, J = ({ group: e }) => ({
|
|
5453
|
-
shape: Hr({ group: e }),
|
|
5454
|
-
text: Ur({ group: e })
|
|
5455
|
-
}), Wr = ({ transform: e, key: t }) => {
|
|
5491
|
+
//#region src/editor/shape-manager/scaling/shape-scaling-transform.ts
|
|
5492
|
+
var Wr = ({ transform: e, key: t }) => {
|
|
5456
5493
|
let n = e?.original;
|
|
5457
5494
|
if (!n || typeof n != "object") return null;
|
|
5458
5495
|
let r = n[t];
|
|
@@ -5486,7 +5523,7 @@ function Zr({ size: e, scale: t, strokeWidth: n, minSize: r, scaleEpsilon: i })
|
|
|
5486
5523
|
}
|
|
5487
5524
|
function Qr({ group: e, shape: t, width: n, height: r, scaleX: i, scaleY: a, minSize: o, scaleEpsilon: s }) {
|
|
5488
5525
|
let c = Math.max(0, e.shapeStrokeWidth ?? 0);
|
|
5489
|
-
|
|
5526
|
+
Dn({
|
|
5490
5527
|
shape: t,
|
|
5491
5528
|
width: Zr({
|
|
5492
5529
|
size: n,
|
|
@@ -5616,7 +5653,7 @@ function ui({ group: e, text: t, width: n, height: r, measurementCache: i, const
|
|
|
5616
5653
|
}), f = ai({
|
|
5617
5654
|
height: s,
|
|
5618
5655
|
padding: u
|
|
5619
|
-
}), p =
|
|
5656
|
+
}), p = ar({
|
|
5620
5657
|
text: t,
|
|
5621
5658
|
frameWidth: d,
|
|
5622
5659
|
splitByGrapheme: !1,
|
|
@@ -5661,7 +5698,7 @@ function di({ group: e, text: t, state: n }) {
|
|
|
5661
5698
|
};
|
|
5662
5699
|
}
|
|
5663
5700
|
function fi({ group: e, text: t, width: n, padding: r, wrapPolicy: i, measurementCache: a }) {
|
|
5664
|
-
return
|
|
5701
|
+
return Fr({
|
|
5665
5702
|
text: t,
|
|
5666
5703
|
width: n,
|
|
5667
5704
|
height: 1,
|
|
@@ -5676,7 +5713,7 @@ function fi({ group: e, text: t, width: n, padding: r, wrapPolicy: i, measuremen
|
|
|
5676
5713
|
});
|
|
5677
5714
|
}
|
|
5678
5715
|
function pi({ group: e, text: t, constraintPadding: n, startDimensions: r, appliedScaleX: i, appliedScaleY: a, minimumHeight: o, wrapPolicy: s, measurementCache: c }) {
|
|
5679
|
-
let l = r.canScaleWidth ? Math.max(1, r.startWidth * i) : r.startWidth, u = r.canScaleHeight ? Math.max(1, r.startHeight * a) : r.startManualBaseHeight, d = o ??
|
|
5716
|
+
let l = r.canScaleWidth ? Math.max(1, r.startWidth * i) : r.startWidth, u = r.canScaleHeight ? Math.max(1, r.startHeight * a) : r.startManualBaseHeight, d = o ?? Fr({
|
|
5680
5717
|
text: t,
|
|
5681
5718
|
width: l,
|
|
5682
5719
|
height: u,
|
|
@@ -5696,7 +5733,7 @@ function pi({ group: e, text: t, constraintPadding: n, startDimensions: r, appli
|
|
|
5696
5733
|
}
|
|
5697
5734
|
function mi({ group: e, text: t, state: n, appliedScaleX: r, appliedScaleY: i, minimumHeight: a }) {
|
|
5698
5735
|
let o = n.canScaleWidth ? Math.max(1, n.startWidth * r) : n.startWidth, s = n.canScaleHeight ? Math.max(1, n.startHeight * i) : n.startManualBaseHeight, c = a == null ? s : Math.max(s, a), l = !n.canScaleHeight, u = ni({ isProportionalScaling: n.isProportionalScaling });
|
|
5699
|
-
return
|
|
5736
|
+
return Dr({
|
|
5700
5737
|
text: t,
|
|
5701
5738
|
width: o,
|
|
5702
5739
|
height: c,
|
|
@@ -5836,7 +5873,7 @@ function yi({ group: e, shape: t, text: n, width: r, height: i, alignH: a, align
|
|
|
5836
5873
|
width: t,
|
|
5837
5874
|
height: n
|
|
5838
5875
|
});
|
|
5839
|
-
!l && u ?
|
|
5876
|
+
!l && u ? Ar({
|
|
5840
5877
|
group: e,
|
|
5841
5878
|
shape: t,
|
|
5842
5879
|
text: n,
|
|
@@ -5849,7 +5886,7 @@ function yi({ group: e, shape: t, text: n, width: r, height: i, alignH: a, align
|
|
|
5849
5886
|
internalShapeTextInset: h,
|
|
5850
5887
|
expandShapeHeightToFitText: g,
|
|
5851
5888
|
resolveInternalShapeTextInset: _
|
|
5852
|
-
}) :
|
|
5889
|
+
}) : kr({
|
|
5853
5890
|
group: e,
|
|
5854
5891
|
shape: t,
|
|
5855
5892
|
text: n,
|
|
@@ -5960,7 +5997,7 @@ var bi = class {
|
|
|
5960
5997
|
e.setCoords(), this.canvas.requestRenderAll();
|
|
5961
5998
|
}
|
|
5962
5999
|
commitGroupScaling({ group: e, scaleX: t, scaleY: n, transform: r }) {
|
|
5963
|
-
let { shape: i, text: a } =
|
|
6000
|
+
let { shape: i, text: a } = H({ group: e });
|
|
5964
6001
|
if (!i || !a) return this.shapeScalingState.delete(e), !1;
|
|
5965
6002
|
let o = this.shapeScalingState.get(e), s = o ?? hi({
|
|
5966
6003
|
group: e,
|
|
@@ -6015,8 +6052,8 @@ var bi = class {
|
|
|
6015
6052
|
_collectPreviewItems({ selection: e, transform: t }) {
|
|
6016
6053
|
let n = [];
|
|
6017
6054
|
for (let r of e.getObjects()) {
|
|
6018
|
-
if (!
|
|
6019
|
-
let { shape: e, text: i } =
|
|
6055
|
+
if (!U(r)) continue;
|
|
6056
|
+
let { shape: e, text: i } = H({ group: r });
|
|
6020
6057
|
if (!e || !i) continue;
|
|
6021
6058
|
let a = Z({ group: r }), o = gi({
|
|
6022
6059
|
scalingState: this.shapeScalingState,
|
|
@@ -6272,7 +6309,7 @@ var bi = class {
|
|
|
6272
6309
|
}
|
|
6273
6310
|
_resolveMinimumShapeWidth({ item: e, scaleY: t }) {
|
|
6274
6311
|
let { group: n, text: r, constraintPadding: i, state: a } = e, o = Math.max(1, a.startHeight * t);
|
|
6275
|
-
return
|
|
6312
|
+
return Nr({
|
|
6276
6313
|
text: r,
|
|
6277
6314
|
padding: i,
|
|
6278
6315
|
measurementCache: a.previewTextMeasurementCache ?? void 0,
|
|
@@ -6380,8 +6417,8 @@ var bi = class {
|
|
|
6380
6417
|
});
|
|
6381
6418
|
return;
|
|
6382
6419
|
}
|
|
6383
|
-
if (!
|
|
6384
|
-
let i = n, { shape: a, text: o } =
|
|
6420
|
+
if (!U(n)) return;
|
|
6421
|
+
let i = n, { shape: a, text: o } = H({ group: i });
|
|
6385
6422
|
if (!a || !o) return;
|
|
6386
6423
|
i.set({
|
|
6387
6424
|
lockScalingFlip: !0,
|
|
@@ -6465,10 +6502,10 @@ var bi = class {
|
|
|
6465
6502
|
});
|
|
6466
6503
|
return;
|
|
6467
6504
|
}
|
|
6468
|
-
if (!
|
|
6505
|
+
if (!U(r)) return;
|
|
6469
6506
|
let i = r, a = this.scalingState.get(i);
|
|
6470
6507
|
if (!a) return;
|
|
6471
|
-
let { shape: o, text: s } =
|
|
6508
|
+
let { shape: o, text: s } = H({ group: i });
|
|
6472
6509
|
if (!o || !s) return;
|
|
6473
6510
|
let c = Z({ group: i }), l = i.shapeAlignHorizontal ?? "center", { canScaleWidth: u, canScaleHeight: d } = a;
|
|
6474
6511
|
if (!u && !d) return;
|
|
@@ -6506,7 +6543,7 @@ var bi = class {
|
|
|
6506
6543
|
state: a,
|
|
6507
6544
|
axis: "x"
|
|
6508
6545
|
})) {
|
|
6509
|
-
let e =
|
|
6546
|
+
let e = Nr({
|
|
6510
6547
|
text: s,
|
|
6511
6548
|
padding: c,
|
|
6512
6549
|
resolvePaddingForWidth: ({ width: e }) => Z({
|
|
@@ -6593,12 +6630,12 @@ var bi = class {
|
|
|
6593
6630
|
}), this.canvas.requestRenderAll();
|
|
6594
6631
|
}, this.handleObjectModified = (e) => {
|
|
6595
6632
|
let { target: t } = e;
|
|
6596
|
-
if (!
|
|
6633
|
+
if (!U(t)) return;
|
|
6597
6634
|
let n = t, r = this.scalingState.get(n), i = Math.abs(n.scaleX ?? 1) || 1, a = Math.abs(n.scaleY ?? 1) || 1;
|
|
6598
6635
|
if (!(Math.abs(i - 1) > 1e-4 || Math.abs(a - 1) > 1e-4) && !r) return;
|
|
6599
6636
|
let o = r?.startWidth ?? Math.max(1, n.shapeBaseWidth ?? n.width ?? n.shapeManualBaseWidth ?? 1), s = r?.startHeight ?? Math.max(1, n.shapeBaseHeight ?? n.height ?? n.shapeManualBaseHeight ?? 1), c = r?.startManualBaseWidth ?? Math.max(1, n.shapeManualBaseWidth ?? o), l = r?.startManualBaseHeight ?? Math.max(1, n.shapeManualBaseHeight ?? s);
|
|
6600
6637
|
if (r?.blockedScaleAttempt && r) {
|
|
6601
|
-
let { shape: e, text: t } =
|
|
6638
|
+
let { shape: e, text: t } = H({ group: n });
|
|
6602
6639
|
if (!e || !t) {
|
|
6603
6640
|
n.shapeScalingNoopTransform = !1, this.scalingState.delete(n);
|
|
6604
6641
|
return;
|
|
@@ -6616,7 +6653,7 @@ var bi = class {
|
|
|
6616
6653
|
}), n.shapeScalingNoopTransform = !1, this.scalingState.delete(n), this.canvas.requestRenderAll();
|
|
6617
6654
|
return;
|
|
6618
6655
|
}
|
|
6619
|
-
let { shape: u, text: d } =
|
|
6656
|
+
let { shape: u, text: d } = H({ group: n });
|
|
6620
6657
|
if (!u || !d) {
|
|
6621
6658
|
this.scalingState.delete(n);
|
|
6622
6659
|
return;
|
|
@@ -6643,7 +6680,7 @@ var bi = class {
|
|
|
6643
6680
|
(i < e.scale - 1e-4 || a < e.scale - 1e-4) && (v = e.scale, y = e.scale);
|
|
6644
6681
|
}
|
|
6645
6682
|
} else {
|
|
6646
|
-
let t =
|
|
6683
|
+
let t = Nr({
|
|
6647
6684
|
text: d,
|
|
6648
6685
|
padding: m,
|
|
6649
6686
|
resolvePaddingForWidth: ({ width: e }) => Z({
|
|
@@ -6769,7 +6806,7 @@ var bi = class {
|
|
|
6769
6806
|
};
|
|
6770
6807
|
}
|
|
6771
6808
|
_resolveScalingConstraintState({ group: e, text: t, constraintPadding: n, state: r, scaleX: i, scaleY: a }) {
|
|
6772
|
-
let { canScaleHeight: o, canScaleWidth: s, startHeight: c, startWidth: l, cannotScaleDownAtStart: u, crossedOppositeCorner: d, isProportionalScaling: f, lastAllowedScaleX: p, lastAllowedScaleY: m, startScaleY: h } = r, g = o && !s, _ = s ? Math.max(1, l * i) : l, v = o ? Math.max(1, c * a) : c, y = i < p - X, b = a < m - X, x = a < h - X, S = g ? r.fixedWidthMinimumTextFitHeight : null, C = s && y ?
|
|
6809
|
+
let { canScaleHeight: o, canScaleWidth: s, startHeight: c, startWidth: l, cannotScaleDownAtStart: u, crossedOppositeCorner: d, isProportionalScaling: f, lastAllowedScaleX: p, lastAllowedScaleY: m, startScaleY: h } = r, g = o && !s, _ = s ? Math.max(1, l * i) : l, v = o ? Math.max(1, c * a) : c, y = i < p - X, b = a < m - X, x = a < h - X, S = g ? r.fixedWidthMinimumTextFitHeight : null, C = s && y ? Nr({
|
|
6773
6810
|
text: t,
|
|
6774
6811
|
padding: n,
|
|
6775
6812
|
measurementCache: r.previewTextMeasurementCache ?? void 0,
|
|
@@ -6990,7 +7027,7 @@ var bi = class {
|
|
|
6990
7027
|
width: t,
|
|
6991
7028
|
height: n
|
|
6992
7029
|
});
|
|
6993
|
-
!r.canScaleWidth && r.canScaleHeight ?
|
|
7030
|
+
!r.canScaleWidth && r.canScaleHeight ? Ar({
|
|
6994
7031
|
group: e,
|
|
6995
7032
|
shape: t,
|
|
6996
7033
|
text: n,
|
|
@@ -7002,7 +7039,7 @@ var bi = class {
|
|
|
7002
7039
|
wrapPolicy: m,
|
|
7003
7040
|
internalShapeTextInset: d,
|
|
7004
7041
|
resolveInternalShapeTextInset: h
|
|
7005
|
-
}) :
|
|
7042
|
+
}) : kr({
|
|
7006
7043
|
group: e,
|
|
7007
7044
|
shape: t,
|
|
7008
7045
|
text: n,
|
|
@@ -7029,17 +7066,17 @@ var bi = class {
|
|
|
7029
7066
|
}, Si = class {
|
|
7030
7067
|
constructor({ canvas: e }) {
|
|
7031
7068
|
this.handleMouseDown = (e) => {
|
|
7032
|
-
let { target: t, e: n, subTargets: r = [] } = e, i =
|
|
7069
|
+
let { target: t, e: n, subTargets: r = [] } = e, i = Xe({
|
|
7033
7070
|
target: t,
|
|
7034
7071
|
subTargets: r
|
|
7035
7072
|
});
|
|
7036
7073
|
if (!i) return;
|
|
7037
|
-
let { text: a } =
|
|
7074
|
+
let { text: a } = H({ group: i });
|
|
7038
7075
|
if (!a) return;
|
|
7039
7076
|
let o = this.canvas.getActiveObject(), s = o === i;
|
|
7040
7077
|
if (!(o === a && a.isEditing)) {
|
|
7041
7078
|
if (!s) {
|
|
7042
|
-
a.isEditing ||
|
|
7079
|
+
a.isEditing || He({ text: a });
|
|
7043
7080
|
return;
|
|
7044
7081
|
}
|
|
7045
7082
|
n instanceof MouseEvent && (n.detail < 2 || this.enterTextEditing({ group: i }));
|
|
@@ -7048,7 +7085,7 @@ var bi = class {
|
|
|
7048
7085
|
let { target: t } = e;
|
|
7049
7086
|
if (!(t instanceof v)) return;
|
|
7050
7087
|
let n = t, { group: r } = n;
|
|
7051
|
-
|
|
7088
|
+
U(r) && (this._enterTextEditingInteractionMode({
|
|
7052
7089
|
group: r,
|
|
7053
7090
|
text: n
|
|
7054
7091
|
}), this.canvas.requestRenderAll());
|
|
@@ -7056,17 +7093,17 @@ var bi = class {
|
|
|
7056
7093
|
let { target: t } = e;
|
|
7057
7094
|
if (!(t instanceof v)) return;
|
|
7058
7095
|
let n = t, { group: r } = n;
|
|
7059
|
-
|
|
7096
|
+
U(r) && (this._restoreTextEditingInteractionMode({
|
|
7060
7097
|
group: r,
|
|
7061
7098
|
text: n
|
|
7062
|
-
}),
|
|
7099
|
+
}), He({ text: n }), this.canvas.getActiveObject() === n && this.canvas.setActiveObject(r), this.canvas.requestRenderAll());
|
|
7063
7100
|
}, this.canvas = e, this.editingInteractionState = /* @__PURE__ */ new WeakMap(), this.editingTargetResolverState = void 0;
|
|
7064
7101
|
}
|
|
7065
7102
|
enterTextEditing({ group: e }) {
|
|
7066
|
-
let { text: t } =
|
|
7103
|
+
let { text: t } = H({ group: e });
|
|
7067
7104
|
if (t) {
|
|
7068
7105
|
if (e.locked || t.locked) {
|
|
7069
|
-
|
|
7106
|
+
He({ text: t }), this.canvas.requestRenderAll();
|
|
7070
7107
|
return;
|
|
7071
7108
|
}
|
|
7072
7109
|
this._enterTextEditingInteractionMode({
|
|
@@ -7126,7 +7163,7 @@ var bi = class {
|
|
|
7126
7163
|
let r = this.canvas, i = r.findTarget.bind(r);
|
|
7127
7164
|
r.findTarget = (n) => {
|
|
7128
7165
|
let r = i(n);
|
|
7129
|
-
if (this.canvas.getActiveObject() !== t || !t.isEditing || r.target === t ||
|
|
7166
|
+
if (this.canvas.getActiveObject() !== t || !t.isEditing || r.target === t || Xe({
|
|
7130
7167
|
target: r.target,
|
|
7131
7168
|
subTargets: r.subTargets
|
|
7132
7169
|
}) !== e) return r;
|
|
@@ -7184,7 +7221,7 @@ var bi = class {
|
|
|
7184
7221
|
let t = null;
|
|
7185
7222
|
if (e.target instanceof v) {
|
|
7186
7223
|
let n = e.target, { group: r } = n;
|
|
7187
|
-
|
|
7224
|
+
U(r) && (this.runtime.editingPlacements.delete(r), t = {
|
|
7188
7225
|
group: r,
|
|
7189
7226
|
textNode: n
|
|
7190
7227
|
});
|
|
@@ -7193,18 +7230,18 @@ var bi = class {
|
|
|
7193
7230
|
}, this._handleTextEditingEntered = (e) => {
|
|
7194
7231
|
if (e.target instanceof v) {
|
|
7195
7232
|
let { group: t } = e.target;
|
|
7196
|
-
|
|
7233
|
+
U(t) && (this.runtime.detachShapeGroupAutoLayout({ group: t }), this.runtime.lifecycleController.beginTextEditing({ group: t }), this.runtime.editingPlacements.set(t, this.runtime.editor.canvasManager.getObjectPlacement({ object: t })));
|
|
7197
7234
|
}
|
|
7198
7235
|
this.runtime.editingController.handleTextEditingEntered(e);
|
|
7199
7236
|
}, this._handleTextChanged = (e) => {
|
|
7200
7237
|
if (!(e.target instanceof v)) return;
|
|
7201
7238
|
let t = e.target;
|
|
7202
|
-
|
|
7239
|
+
U(t.group) && this.runtime.syncShapeTextLayoutAfterTextMutation({ textNode: t }) && this.runtime.editor.canvas.requestRenderAll();
|
|
7203
7240
|
}, this._handleBeforeTextUpdated = (e) => {
|
|
7204
7241
|
let { textbox: t, style: n } = e;
|
|
7205
7242
|
if (!(t instanceof v)) return;
|
|
7206
7243
|
let r = t, { group: i } = r;
|
|
7207
|
-
if (!
|
|
7244
|
+
if (!U(i) || this.runtime.internalTextUpdates.has(r)) return;
|
|
7208
7245
|
let a = this.runtime.lifecycleController.beginTextUpdate({
|
|
7209
7246
|
group: i,
|
|
7210
7247
|
textNode: r,
|
|
@@ -7232,7 +7269,7 @@ var bi = class {
|
|
|
7232
7269
|
e.off("object:scaling", this._handleObjectScaling), e.off("object:modified", this._handleObjectModified), e.off("mouse:move", this._handleMouseMove), e.off("mouse:down", this._handleMouseDown), e.off("mouse:up", this._handleMouseUp), e.off("text:editing:entered", this._handleTextEditingEntered), e.off("text:editing:exited", this._handleTextEditingExited), e.off("text:changed", this._handleTextChanged), e.off("editor:before:text-updated", this._handleBeforeTextUpdated), e.off("editor:text-updated", this._handleTextUpdated);
|
|
7233
7270
|
}
|
|
7234
7271
|
_commitActiveSelectionShapeScaling({ selection: t, transform: n }) {
|
|
7235
|
-
let r = t.getObjects(), i = r.filter((e) =>
|
|
7272
|
+
let r = t.getObjects(), i = r.filter((e) => U(e));
|
|
7236
7273
|
if (!i.length) return;
|
|
7237
7274
|
let { scaleX: a, scaleY: o } = this.runtime.scalingController.resolveActiveSelectionCommittedScale({ selection: t });
|
|
7238
7275
|
if (!(Math.abs(a - 1) > Ci || Math.abs(o - 1) > Ci)) {
|
|
@@ -7372,7 +7409,7 @@ var bi = class {
|
|
|
7372
7409
|
width: y,
|
|
7373
7410
|
height: b
|
|
7374
7411
|
}), S = u ?? e.shapeTextWrapPolicy, C = r ?? this.editor.canvasManager.getObjectPlacement({ object: e });
|
|
7375
|
-
|
|
7412
|
+
kr({
|
|
7376
7413
|
group: e,
|
|
7377
7414
|
shape: t,
|
|
7378
7415
|
text: n,
|
|
@@ -7396,7 +7433,7 @@ var bi = class {
|
|
|
7396
7433
|
}
|
|
7397
7434
|
_resolveAutoExpandShapeWidth({ text: e, currentWidth: t, minimumWidth: n, padding: r, resolvePaddingForWidth: i }) {
|
|
7398
7435
|
let a = this.resolveMontageAreaWidth();
|
|
7399
|
-
return a ?
|
|
7436
|
+
return a ? Mr({
|
|
7400
7437
|
text: e,
|
|
7401
7438
|
currentWidth: t,
|
|
7402
7439
|
minimumWidth: n,
|
|
@@ -7470,7 +7507,7 @@ var bi = class {
|
|
|
7470
7507
|
if (!t) return null;
|
|
7471
7508
|
this.pendingTextUpdates.delete(e);
|
|
7472
7509
|
let n = this.fireUpdated({ lifecycle: t }), { group: r } = e;
|
|
7473
|
-
return
|
|
7510
|
+
return U(r) && this.textEditingSnapshots.has(r) && this.textEditingSnapshots.set(r, n), n;
|
|
7474
7511
|
}
|
|
7475
7512
|
captureResizeStart({ group: t }) {
|
|
7476
7513
|
this.resizeStartSnapshots.has(t) || this.resizeStartSnapshots.set(t, e.getSnapshot({ group: t }));
|
|
@@ -7502,7 +7539,7 @@ var bi = class {
|
|
|
7502
7539
|
}));
|
|
7503
7540
|
}
|
|
7504
7541
|
static getSnapshot({ group: t }) {
|
|
7505
|
-
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 } =
|
|
7542
|
+
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 } = H({ group: t });
|
|
7506
7543
|
return {
|
|
7507
7544
|
id: n,
|
|
7508
7545
|
presetKey: r,
|
|
@@ -8339,7 +8376,7 @@ var da = {
|
|
|
8339
8376
|
options: n,
|
|
8340
8377
|
styleState: i,
|
|
8341
8378
|
dimensionState: a
|
|
8342
|
-
}), c = await
|
|
8379
|
+
}), c = await Vn({
|
|
8343
8380
|
preset: r.effectivePreset,
|
|
8344
8381
|
width: s.width,
|
|
8345
8382
|
height: s.height,
|
|
@@ -8397,7 +8434,7 @@ var da = {
|
|
|
8397
8434
|
};
|
|
8398
8435
|
}
|
|
8399
8436
|
_resolvePreparedCurrentNodes({ currentGroup: e }) {
|
|
8400
|
-
let { shape: t, text: n } =
|
|
8437
|
+
let { shape: t, text: n } = H({ group: e });
|
|
8401
8438
|
if (!t || !n) return null;
|
|
8402
8439
|
let r = e.getObjects().indexOf(t);
|
|
8403
8440
|
return r < 0 ? null : {
|
|
@@ -8571,7 +8608,7 @@ var da = {
|
|
|
8571
8608
|
setFill({ target: e, fill: t, withoutSave: n }) {
|
|
8572
8609
|
let r = this._resolveUnlockedGroup({ target: e });
|
|
8573
8610
|
if (!r) return null;
|
|
8574
|
-
let { shape: i } =
|
|
8611
|
+
let { shape: i } = H({ group: r });
|
|
8575
8612
|
if (!i) return null;
|
|
8576
8613
|
let a = this.runtime.lifecycleController.createContext({
|
|
8577
8614
|
group: r,
|
|
@@ -8581,7 +8618,7 @@ var da = {
|
|
|
8581
8618
|
});
|
|
8582
8619
|
this.runtime.beginMutation();
|
|
8583
8620
|
try {
|
|
8584
|
-
|
|
8621
|
+
kn({
|
|
8585
8622
|
shape: i,
|
|
8586
8623
|
style: { fill: t }
|
|
8587
8624
|
}), r.shapeFill = t, r.setCoords(), this.runtime.lifecycleController.fireBefore({ lifecycle: a }), this.runtime.editor.canvas.requestRenderAll();
|
|
@@ -8593,7 +8630,7 @@ var da = {
|
|
|
8593
8630
|
setStroke({ target: e, stroke: t, strokeWidth: n, dash: r, withoutSave: i }) {
|
|
8594
8631
|
let a = this._resolveUnlockedGroup({ target: e });
|
|
8595
8632
|
if (!a) return null;
|
|
8596
|
-
let { shape: o, text: s } =
|
|
8633
|
+
let { shape: o, text: s } = H({ group: a });
|
|
8597
8634
|
if (!o) return null;
|
|
8598
8635
|
let c = this.runtime.lifecycleController.createContext({
|
|
8599
8636
|
group: a,
|
|
@@ -8619,7 +8656,7 @@ var da = {
|
|
|
8619
8656
|
setOpacity({ target: e, opacity: t, applyToText: n = !0, withoutSave: r }) {
|
|
8620
8657
|
let i = this._resolveUnlockedGroup({ target: e });
|
|
8621
8658
|
if (!i) return null;
|
|
8622
|
-
let { shape: a, text: o } =
|
|
8659
|
+
let { shape: a, text: o } = H({ group: i });
|
|
8623
8660
|
if (!a) return null;
|
|
8624
8661
|
let s = this.runtime.lifecycleController.createContext({
|
|
8625
8662
|
group: i,
|
|
@@ -8629,10 +8666,10 @@ var da = {
|
|
|
8629
8666
|
});
|
|
8630
8667
|
this.runtime.beginMutation();
|
|
8631
8668
|
try {
|
|
8632
|
-
|
|
8669
|
+
kn({
|
|
8633
8670
|
shape: a,
|
|
8634
8671
|
style: { opacity: t }
|
|
8635
|
-
}), n && o && (o.set({ opacity: t }), o.setCoords()), i.shapeOpacity = t, i.setCoords(), this.runtime.lifecycleController.fireBefore({ lifecycle: s }), this.runtime.editor.canvas.requestRenderAll();
|
|
8672
|
+
}), n && o && (o.set({ opacity: t }), o.setCoords()), i.shapeOpacity = t, i.set({ opacity: 1 }), i.setCoords(), this.runtime.lifecycleController.fireBefore({ lifecycle: s }), this.runtime.editor.canvas.requestRenderAll();
|
|
8636
8673
|
} finally {
|
|
8637
8674
|
this.runtime.endMutation({ withoutSave: r });
|
|
8638
8675
|
}
|
|
@@ -8641,7 +8678,7 @@ var da = {
|
|
|
8641
8678
|
updateTextStyle({ target: e, style: t = {}, withoutSave: n } = {}) {
|
|
8642
8679
|
let r = this._resolveUnlockedGroup({ target: e });
|
|
8643
8680
|
if (!r) return null;
|
|
8644
|
-
let { shape: i, text: a } =
|
|
8681
|
+
let { shape: i, text: a } = H({ group: r }), o = Object.keys(t).length > 0;
|
|
8645
8682
|
if (!i || !a) return null;
|
|
8646
8683
|
if (!o) return r;
|
|
8647
8684
|
let s = this.runtime.resolveManualDimensions({ group: r }), c = this.runtime.editor.canvasManager.getObjectPlacement({ object: r }), l = this.runtime.resolveShapeTextHorizontalAlign({
|
|
@@ -8672,7 +8709,7 @@ var da = {
|
|
|
8672
8709
|
setTextAlign({ target: e, horizontal: t, vertical: n, withoutSave: r }) {
|
|
8673
8710
|
let i = this._resolveUnlockedGroup({ target: e });
|
|
8674
8711
|
if (!i) return null;
|
|
8675
|
-
let { shape: a, text: o } =
|
|
8712
|
+
let { shape: a, text: o } = H({ group: i });
|
|
8676
8713
|
if (!a || !o) return null;
|
|
8677
8714
|
let s = this.runtime.resolveCurrentDimensions({ group: i }), c = t ?? i.shapeAlignHorizontal ?? "center", l = n ?? i.shapeAlignVertical ?? "middle", u = this.runtime.lifecycleController.createContext({
|
|
8678
8715
|
group: i,
|
|
@@ -8712,7 +8749,7 @@ var da = {
|
|
|
8712
8749
|
commitRehydratedShapeLayout({ target: e, textScale: t = 1, shapeTextAutoExpand: n }) {
|
|
8713
8750
|
let r = this.runtime.resolveShapeGroup({ target: e });
|
|
8714
8751
|
if (!r) return !1;
|
|
8715
|
-
let { shape: i, text: a } =
|
|
8752
|
+
let { shape: i, text: a } = H({ group: r });
|
|
8716
8753
|
if (!i || !a) return !1;
|
|
8717
8754
|
let o = this.runtime.editor.canvasManager.getObjectPlacement({ object: r }), { currentDimensions: s, manualDimensions: c, replaceBoxDimensions: l } = la({ group: r });
|
|
8718
8755
|
return ua({
|
|
@@ -8734,7 +8771,7 @@ var da = {
|
|
|
8734
8771
|
return !t || t.locked ? null : t;
|
|
8735
8772
|
}
|
|
8736
8773
|
_applyStrokeAndTextLayout({ group: e, shape: t, text: n, stroke: r, strokeWidth: i, dash: a }) {
|
|
8737
|
-
if (
|
|
8774
|
+
if (kn({
|
|
8738
8775
|
shape: t,
|
|
8739
8776
|
style: {
|
|
8740
8777
|
stroke: r,
|
|
@@ -8840,7 +8877,7 @@ var da = {
|
|
|
8840
8877
|
}
|
|
8841
8878
|
}, ma = class {
|
|
8842
8879
|
constructor({ editor: e }) {
|
|
8843
|
-
this.editor = e,
|
|
8880
|
+
this.editor = e, Ye(), this.scalingController = new xi({ canvas: e.canvas }), this.editingController = new Si({ canvas: e.canvas }), this.editingPlacements = /* @__PURE__ */ new WeakMap(), this.lifecycleController = new Ei({ canvas: e.canvas }), this.layoutController = new Ti({ editor: this.editor }), this.mutationController = new pa({ runtime: {
|
|
8844
8881
|
editor: this.editor,
|
|
8845
8882
|
lifecycleController: this.lifecycleController,
|
|
8846
8883
|
editingPlacements: this.editingPlacements,
|
|
@@ -8850,7 +8887,7 @@ var da = {
|
|
|
8850
8887
|
resolveReplaceBoxDimensions: (e) => this._resolveReplaceBoxDimensions(e),
|
|
8851
8888
|
resolveGroupUserPadding: (e) => this._resolveGroupUserPadding(e),
|
|
8852
8889
|
isShapeTextAutoExpandEnabled: (e) => this._isShapeTextAutoExpandEnabled(e),
|
|
8853
|
-
resolveShapeStyle:
|
|
8890
|
+
resolveShapeStyle: Gn,
|
|
8854
8891
|
resolveCurrentTextStyle: (e) => this._resolveCurrentTextStyle(e),
|
|
8855
8892
|
createTextNode: (e) => this._createTextNode(e),
|
|
8856
8893
|
applyTextUpdates: (e) => this._applyTextUpdates(e),
|
|
@@ -8928,7 +8965,7 @@ var da = {
|
|
|
8928
8965
|
let w = a !== !1, T = this._resolveHorizontalAlign({
|
|
8929
8966
|
explicitAlign: c,
|
|
8930
8967
|
textStyle: s
|
|
8931
|
-
}), E = l ?? "middle", O =
|
|
8968
|
+
}), E = l ?? "middle", O = Gn({
|
|
8932
8969
|
options: t,
|
|
8933
8970
|
fallback: null
|
|
8934
8971
|
}), k = Ne({ padding: u }), A = ({ width: e, height: t }) => Le({
|
|
@@ -8971,7 +9008,7 @@ var da = {
|
|
|
8971
9008
|
addition: k
|
|
8972
9009
|
})
|
|
8973
9010
|
}));
|
|
8974
|
-
let I = await
|
|
9011
|
+
let I = await Vn({
|
|
8975
9012
|
preset: m,
|
|
8976
9013
|
width: F,
|
|
8977
9014
|
height: x,
|
|
@@ -9050,7 +9087,7 @@ var da = {
|
|
|
9050
9087
|
getTextNode({ target: e } = {}) {
|
|
9051
9088
|
let t = this._resolveShapeGroup({ target: e });
|
|
9052
9089
|
if (!t) return null;
|
|
9053
|
-
let { text: n } =
|
|
9090
|
+
let { text: n } = H({ group: t });
|
|
9054
9091
|
return n || null;
|
|
9055
9092
|
}
|
|
9056
9093
|
updateTextStyle({ target: e, style: t = {}, withoutSave: n } = {}) {
|
|
@@ -9086,7 +9123,7 @@ var da = {
|
|
|
9086
9123
|
this.eventController.destroy();
|
|
9087
9124
|
}
|
|
9088
9125
|
_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 }) {
|
|
9089
|
-
let x = new
|
|
9126
|
+
let x = new Je([r, i], {
|
|
9090
9127
|
originX: "center",
|
|
9091
9128
|
originY: "center",
|
|
9092
9129
|
left: 0,
|
|
@@ -9111,7 +9148,7 @@ var da = {
|
|
|
9111
9148
|
padding: h,
|
|
9112
9149
|
style: y,
|
|
9113
9150
|
rounding: b
|
|
9114
|
-
}), x.rehydrateRuntimeState(),
|
|
9151
|
+
}), x.rehydrateRuntimeState(), Ve({ group: x }), He({ text: i }), kr({
|
|
9115
9152
|
group: x,
|
|
9116
9153
|
shape: r,
|
|
9117
9154
|
text: i,
|
|
@@ -9176,7 +9213,7 @@ var da = {
|
|
|
9176
9213
|
return s.set({
|
|
9177
9214
|
shapeNodeType: "text",
|
|
9178
9215
|
splitByGrapheme: !1
|
|
9179
|
-
}),
|
|
9216
|
+
}), He({ text: s }), s;
|
|
9180
9217
|
}
|
|
9181
9218
|
_applyTextUpdates({ textNode: e, text: t, textStyle: n, align: r, syncLineStylesWithText: i }) {
|
|
9182
9219
|
let a = {};
|
|
@@ -9308,8 +9345,8 @@ var da = {
|
|
|
9308
9345
|
}
|
|
9309
9346
|
_syncShapeTextLayoutAfterTextMutation({ textNode: e, textStyle: t }) {
|
|
9310
9347
|
let { group: n } = e;
|
|
9311
|
-
if (!
|
|
9312
|
-
let { shape: r, text: i } =
|
|
9348
|
+
if (!U(n)) return !1;
|
|
9349
|
+
let { shape: r, text: i } = H({ group: n });
|
|
9313
9350
|
if (!r || !i) return !1;
|
|
9314
9351
|
this._detachShapeGroupAutoLayout({ group: n });
|
|
9315
9352
|
let a = this._resolveEditingPlacement({ group: n }), o = this._resolveManualDimensions({ group: n }), s = this._resolveShapeTextHorizontalAlign({
|
|
@@ -9329,7 +9366,7 @@ var da = {
|
|
|
9329
9366
|
return this.editingPlacements.get(e) || this.editor.canvasManager.getObjectPlacement({ object: e });
|
|
9330
9367
|
}
|
|
9331
9368
|
_detachShapeGroupAutoLayout({ group: e }) {
|
|
9332
|
-
|
|
9369
|
+
Ue({ group: e });
|
|
9333
9370
|
}
|
|
9334
9371
|
_resolveHorizontalAlign({ explicitAlign: e, textStyle: t }) {
|
|
9335
9372
|
if (e) return e;
|
|
@@ -9354,12 +9391,12 @@ var da = {
|
|
|
9354
9391
|
});
|
|
9355
9392
|
return;
|
|
9356
9393
|
}
|
|
9357
|
-
if (
|
|
9394
|
+
if (U(t)) {
|
|
9358
9395
|
r.includes(t) || r.push(t);
|
|
9359
9396
|
return;
|
|
9360
9397
|
}
|
|
9361
9398
|
let { group: n } = t;
|
|
9362
|
-
!n || !
|
|
9399
|
+
!n || !U(n) || r.includes(n) || r.push(n);
|
|
9363
9400
|
};
|
|
9364
9401
|
return i(t), n.forEach((e) => {
|
|
9365
9402
|
i(e);
|
|
@@ -9377,24 +9414,24 @@ var da = {
|
|
|
9377
9414
|
return !1;
|
|
9378
9415
|
}
|
|
9379
9416
|
_resolveShapeGroup({ target: e }) {
|
|
9380
|
-
if (e instanceof l &&
|
|
9417
|
+
if (e instanceof l && U(e)) return e;
|
|
9381
9418
|
if (!e) {
|
|
9382
9419
|
let e = this.editor.canvas.getActiveObject();
|
|
9383
|
-
if (
|
|
9420
|
+
if (U(e)) return e;
|
|
9384
9421
|
let t = e?.group;
|
|
9385
|
-
return t &&
|
|
9422
|
+
return t && U(t) ? t : null;
|
|
9386
9423
|
}
|
|
9387
9424
|
if (typeof e == "string") {
|
|
9388
9425
|
let t = this.editor.canvas.getObjects();
|
|
9389
9426
|
for (let n = 0; n < t.length; n += 1) {
|
|
9390
9427
|
let r = t[n];
|
|
9391
|
-
if (r.id === e &&
|
|
9428
|
+
if (r.id === e && U(r)) return r;
|
|
9392
9429
|
}
|
|
9393
9430
|
}
|
|
9394
9431
|
if (e instanceof o) {
|
|
9395
|
-
if (
|
|
9432
|
+
if (U(e)) return e;
|
|
9396
9433
|
let { group: t } = e;
|
|
9397
|
-
if (t &&
|
|
9434
|
+
if (t && U(t)) return t;
|
|
9398
9435
|
}
|
|
9399
9436
|
return null;
|
|
9400
9437
|
}
|
|
@@ -9431,7 +9468,7 @@ var da = {
|
|
|
9431
9468
|
async _cloneToInternalClipboard(e) {
|
|
9432
9469
|
let { canvas: t, errorManager: n } = this.editor;
|
|
9433
9470
|
try {
|
|
9434
|
-
let n = await e.clone(
|
|
9471
|
+
let n = await e.clone(Mt);
|
|
9435
9472
|
this._materializeCloneGeometry({ clonedObject: n }), this.clipboard = n, t.fire("editor:object-copied", { object: n });
|
|
9436
9473
|
} catch (e) {
|
|
9437
9474
|
n.emitError({
|
|
@@ -9452,7 +9489,7 @@ var da = {
|
|
|
9452
9489
|
message: "navigator.clipboard не поддерживается в этом браузере или отсутствует HTTPS-соединение."
|
|
9453
9490
|
}), !1;
|
|
9454
9491
|
try {
|
|
9455
|
-
let t = e.toObject(
|
|
9492
|
+
let t = e.toObject(Mt), n = JSON.stringify(t);
|
|
9456
9493
|
return e.type === "image" ? this._copyImageToClipboard(e, n) : this._copyTextToClipboard(n);
|
|
9457
9494
|
} catch (e) {
|
|
9458
9495
|
return t.emitError({
|
|
@@ -9482,7 +9519,7 @@ var da = {
|
|
|
9482
9519
|
}
|
|
9483
9520
|
async _copyTextToClipboard(e) {
|
|
9484
9521
|
try {
|
|
9485
|
-
let t = `${
|
|
9522
|
+
let t = `${jt}${e}`;
|
|
9486
9523
|
return await navigator.clipboard.writeText(t), console.info("Text copied to clipboard successfully"), !0;
|
|
9487
9524
|
} catch (e) {
|
|
9488
9525
|
let { errorManager: t } = this.editor;
|
|
@@ -9569,7 +9606,7 @@ var da = {
|
|
|
9569
9606
|
let { canvas: t } = this.editor, n = e || t.getActiveObject();
|
|
9570
9607
|
if (!n || n.locked) return !1;
|
|
9571
9608
|
try {
|
|
9572
|
-
let e = await n.clone(
|
|
9609
|
+
let e = await n.clone(Mt);
|
|
9573
9610
|
return ha({ rootObject: e }), e.set({
|
|
9574
9611
|
left: e.left + 10,
|
|
9575
9612
|
top: e.top + 10
|
|
@@ -9636,7 +9673,7 @@ var da = {
|
|
|
9636
9673
|
let { canvas: e } = this.editor;
|
|
9637
9674
|
if (!this.clipboard) return !1;
|
|
9638
9675
|
try {
|
|
9639
|
-
let t = await this.clipboard.clone(
|
|
9676
|
+
let t = await this.clipboard.clone(Mt);
|
|
9640
9677
|
return e.discardActiveObject(), ha({ rootObject: t }), t.set({
|
|
9641
9678
|
left: t.left + 10,
|
|
9642
9679
|
top: t.top + 10
|
|
@@ -9661,7 +9698,7 @@ var da = {
|
|
|
9661
9698
|
this.editor = e;
|
|
9662
9699
|
}
|
|
9663
9700
|
lockObject({ object: e, skipInnerObjects: n, withoutSave: r } = {}) {
|
|
9664
|
-
let { canvas: i, historyManager: a } = this.editor, o = e || i.getActiveObject(), s =
|
|
9701
|
+
let { canvas: i, historyManager: a } = this.editor, o = e || i.getActiveObject(), s = Xe({ target: o }) ?? o;
|
|
9665
9702
|
if (!s || s.locked) return;
|
|
9666
9703
|
let c = {
|
|
9667
9704
|
lockMovementX: !0,
|
|
@@ -9683,7 +9720,7 @@ var da = {
|
|
|
9683
9720
|
});
|
|
9684
9721
|
}
|
|
9685
9722
|
unlockObject({ object: e, withoutSave: n } = {}) {
|
|
9686
|
-
let { canvas: r, historyManager: i } = this.editor, a = e || r.getActiveObject(), o =
|
|
9723
|
+
let { canvas: r, historyManager: i } = this.editor, a = e || r.getActiveObject(), o = Xe({ target: a }) ?? a;
|
|
9687
9724
|
if (!o) return;
|
|
9688
9725
|
let s = {
|
|
9689
9726
|
lockMovementX: !1,
|
|
@@ -11553,7 +11590,7 @@ var Ha = class {
|
|
|
11553
11590
|
}), c.commitStandaloneTextScale({ target: e }), s.commitRehydratedShapeLayout({
|
|
11554
11591
|
target: e,
|
|
11555
11592
|
textScale: h
|
|
11556
|
-
}),
|
|
11593
|
+
}), Ut({ object: e }), ha({ rootObject: e }), n.add(e), e));
|
|
11557
11594
|
return !d.length && !v ? null : (_ = d.length > 0 || v, d.length && t._activateObjects({
|
|
11558
11595
|
canvas: n,
|
|
11559
11596
|
objects: d
|
|
@@ -11621,22 +11658,22 @@ var Ha = class {
|
|
|
11621
11658
|
naturalHeight: 0,
|
|
11622
11659
|
width: 0,
|
|
11623
11660
|
height: 0
|
|
11624
|
-
}, m =
|
|
11661
|
+
}, m = W({
|
|
11625
11662
|
value: u || f || c.width,
|
|
11626
11663
|
fallback: 0
|
|
11627
|
-
}), h =
|
|
11664
|
+
}), h = W({
|
|
11628
11665
|
value: d || p || c.height,
|
|
11629
11666
|
fallback: 0
|
|
11630
|
-
}), g =
|
|
11667
|
+
}), g = W({
|
|
11631
11668
|
value: r,
|
|
11632
11669
|
fallback: m
|
|
11633
|
-
}), _ =
|
|
11670
|
+
}), _ = W({
|
|
11634
11671
|
value: i,
|
|
11635
11672
|
fallback: h
|
|
11636
|
-
}), v =
|
|
11673
|
+
}), v = W({
|
|
11637
11674
|
value: a,
|
|
11638
11675
|
fallback: c.scaleX || 1
|
|
11639
|
-
}), y =
|
|
11676
|
+
}), y = W({
|
|
11640
11677
|
value: o,
|
|
11641
11678
|
fallback: c.scaleY || 1
|
|
11642
11679
|
}), b = g * v, x = _ * y, S = m > 0, C = h > 0, w = b > 0, T = x > 0, E = t._resolveImageFit({ customData: s }), D = {};
|
|
@@ -11703,18 +11740,18 @@ var Ha = class {
|
|
|
11703
11740
|
}
|
|
11704
11741
|
}
|
|
11705
11742
|
_transformObject({ object: e, scale: n, bounds: r, baseWidth: i, baseHeight: a, useRelativePositions: o }) {
|
|
11706
|
-
let s = e, { x: c, y: l } =
|
|
11743
|
+
let s = e, { x: c, y: l } = Vt({
|
|
11707
11744
|
object: e,
|
|
11708
11745
|
baseWidth: i,
|
|
11709
11746
|
baseHeight: a,
|
|
11710
11747
|
useRelativePositions: o
|
|
11711
|
-
}), { scaleX: u, scaleY: d } = e, f =
|
|
11748
|
+
}), { scaleX: u, scaleY: d } = e, f = W({
|
|
11712
11749
|
value: u,
|
|
11713
11750
|
fallback: 1
|
|
11714
|
-
}), p =
|
|
11751
|
+
}), p = W({
|
|
11715
11752
|
value: d,
|
|
11716
11753
|
fallback: 1
|
|
11717
|
-
}), m =
|
|
11754
|
+
}), m = Ht({
|
|
11718
11755
|
normalizedX: c,
|
|
11719
11756
|
normalizedY: l,
|
|
11720
11757
|
bounds: t._getPositioningBounds({
|
|
@@ -11790,10 +11827,10 @@ var Ha = class {
|
|
|
11790
11827
|
if (!(e instanceof v)) return;
|
|
11791
11828
|
let r = typeof e.text == "string" ? e.text : "";
|
|
11792
11829
|
if (!r) return;
|
|
11793
|
-
let i =
|
|
11830
|
+
let i = W({
|
|
11794
11831
|
value: n,
|
|
11795
11832
|
fallback: 0
|
|
11796
|
-
}), a =
|
|
11833
|
+
}), a = W({
|
|
11797
11834
|
value: e.width,
|
|
11798
11835
|
fallback: 0
|
|
11799
11836
|
});
|
|
@@ -11818,7 +11855,7 @@ var Ha = class {
|
|
|
11818
11855
|
return i;
|
|
11819
11856
|
}
|
|
11820
11857
|
_serializeObject({ object: e, bounds: n, baseWidth: r, baseHeight: i }) {
|
|
11821
|
-
let a = e.toDatalessObject([...
|
|
11858
|
+
let a = e.toDatalessObject([...nt]);
|
|
11822
11859
|
if (t._isSvgObject(e)) {
|
|
11823
11860
|
let n = t._extractSvgMarkup(e);
|
|
11824
11861
|
n && (a.svgMarkup = n, delete a.objects, delete a.path);
|
|
@@ -12695,7 +12732,7 @@ var Ha = class {
|
|
|
12695
12732
|
target: n,
|
|
12696
12733
|
transform: i
|
|
12697
12734
|
}), !this.anchors.vertical.length && !this.anchors.horizontal.length && this._cacheAnchors({ activeObject: n });
|
|
12698
|
-
let a =
|
|
12735
|
+
let a = G({ object: n });
|
|
12699
12736
|
if (!a) {
|
|
12700
12737
|
this._clearSpacingContexts(), this._clearGuides();
|
|
12701
12738
|
return;
|
|
@@ -12710,7 +12747,7 @@ var Ha = class {
|
|
|
12710
12747
|
n.set({
|
|
12711
12748
|
left: e + l,
|
|
12712
12749
|
top: t + u
|
|
12713
|
-
}), n.setCoords(), a =
|
|
12750
|
+
}), n.setCoords(), a = G({ object: n }) ?? a;
|
|
12714
12751
|
}
|
|
12715
12752
|
let d = this._resolveCurrentTargetBounds({ activeObject: n }), f = this.spacingContexts.vertical || this.spacingContexts.horizontal ? 10 / s : c, p = Do({
|
|
12716
12753
|
activeBounds: a,
|
|
@@ -12727,13 +12764,13 @@ var Ha = class {
|
|
|
12727
12764
|
n.set({
|
|
12728
12765
|
left: e + p.deltaX,
|
|
12729
12766
|
top: t + p.deltaY
|
|
12730
|
-
}), n.setCoords(), a =
|
|
12767
|
+
}), n.setCoords(), a = G({ object: n }) ?? a;
|
|
12731
12768
|
}
|
|
12732
12769
|
m || e._applyMovementStep({
|
|
12733
12770
|
target: n,
|
|
12734
12771
|
transform: i
|
|
12735
12772
|
});
|
|
12736
|
-
let h =
|
|
12773
|
+
let h = G({ object: n }) ?? a, g = wo({
|
|
12737
12774
|
activeBounds: h,
|
|
12738
12775
|
threshold: c,
|
|
12739
12776
|
anchors: this.anchors
|
|
@@ -12777,7 +12814,7 @@ var Ha = class {
|
|
|
12777
12814
|
}
|
|
12778
12815
|
let { anchors: l } = this, { vertical: u, horizontal: d } = l;
|
|
12779
12816
|
!u.length && !d.length && this._cacheAnchors({ activeObject: n });
|
|
12780
|
-
let f =
|
|
12817
|
+
let f = G({ object: n });
|
|
12781
12818
|
if (!f) {
|
|
12782
12819
|
this._clearGuides();
|
|
12783
12820
|
return;
|
|
@@ -12901,7 +12938,7 @@ var Ha = class {
|
|
|
12901
12938
|
}
|
|
12902
12939
|
let { anchors: a } = this, { vertical: o, horizontal: s } = a;
|
|
12903
12940
|
!o.length && !s.length && this._cacheAnchors({ activeObject: t });
|
|
12904
|
-
let c =
|
|
12941
|
+
let c = G({ object: t });
|
|
12905
12942
|
if (!c) {
|
|
12906
12943
|
this._clearGuides();
|
|
12907
12944
|
return;
|
|
@@ -13180,13 +13217,13 @@ var Ha = class {
|
|
|
13180
13217
|
horizontal: []
|
|
13181
13218
|
}, r = [];
|
|
13182
13219
|
for (let e of t) {
|
|
13183
|
-
let t =
|
|
13220
|
+
let t = G({ object: e });
|
|
13184
13221
|
t && (jo({
|
|
13185
13222
|
anchors: n,
|
|
13186
13223
|
bounds: t
|
|
13187
13224
|
}), r.push(t));
|
|
13188
13225
|
}
|
|
13189
|
-
let { montageArea: i } = this.editor, a =
|
|
13226
|
+
let { montageArea: i } = this.editor, a = G({ object: i });
|
|
13190
13227
|
if (a) {
|
|
13191
13228
|
jo({
|
|
13192
13229
|
anchors: n,
|
|
@@ -13214,7 +13251,7 @@ var Ha = class {
|
|
|
13214
13251
|
_resolveCurrentTargetBounds({ activeObject: e }) {
|
|
13215
13252
|
let t = this._collectTargets({ activeObject: e }), n = [];
|
|
13216
13253
|
for (let e of t) {
|
|
13217
|
-
let t =
|
|
13254
|
+
let t = G({ object: e });
|
|
13218
13255
|
t && n.push(t);
|
|
13219
13256
|
}
|
|
13220
13257
|
return n;
|
|
@@ -13292,7 +13329,7 @@ var Ha = class {
|
|
|
13292
13329
|
this._clearGuides();
|
|
13293
13330
|
return;
|
|
13294
13331
|
}
|
|
13295
|
-
let a =
|
|
13332
|
+
let a = G({ object: i });
|
|
13296
13333
|
if (!a) {
|
|
13297
13334
|
this._clearGuides();
|
|
13298
13335
|
return;
|
|
@@ -13300,7 +13337,7 @@ var Ha = class {
|
|
|
13300
13337
|
let o = e._resolveTarget({
|
|
13301
13338
|
event: t,
|
|
13302
13339
|
activeObject: i
|
|
13303
|
-
}), { montageArea: s } = r, c = o ?? s, l = c === s, u =
|
|
13340
|
+
}), { montageArea: s } = r, c = o ?? s, l = c === s, u = G({ object: c });
|
|
13304
13341
|
if (!u) {
|
|
13305
13342
|
this._clearGuides();
|
|
13306
13343
|
return;
|
|
@@ -13474,7 +13511,7 @@ var Ha = class {
|
|
|
13474
13511
|
}
|
|
13475
13512
|
async init() {
|
|
13476
13513
|
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;
|
|
13477
|
-
if (de.apply(), this.canvas = new t(this.containerId, this.options), this.moduleLoader = new A(), this.workerManager = new M(), this.errorManager = new Sa({ editor: this }), this.historyManager = new
|
|
13514
|
+
if (de.apply(), this.canvas = new t(this.containerId, this.options), this.moduleLoader = new A(), this.workerManager = new M(), this.errorManager = new Sa({ editor: this }), this.historyManager = new Dt({ editor: this }), this.toolbar = new Qe({ editor: this }), this.transformManager = new Rt({ editor: this }), this.zoomManager = new zt({ editor: this }), this.canvasManager = new Lt({ editor: this }), this.imageManager = new Nt({ editor: this }), this.layerManager = new Sn({ editor: this }), this.shapeManager = new ma({ editor: this }), this.interactionBlocker = new bn({ editor: this }), this.backgroundManager = new xn({ editor: this }), this.clipboardManager = new ga({ editor: this }), this.objectLockManager = new _a({ editor: this }), this.groupingManager = new va({ editor: this }), this.selectionManager = new ya({ editor: this }), this.deletionManager = new ba({ editor: this }), this.panConstraintManager = new Ca({ editor: this }), this.snappingManager = new Lo({ editor: this }), this.measurementManager = new zo({ editor: this }), this.fontManager = new fe(this.options.fonts ?? []), this.textManager = new Ua({ editor: this }), this.templateManager = new Ja({ editor: this }), u && (this.angleIndicator = new tt({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.interactionBlocker.ensureOverlay(), this.listeners = new k({
|
|
13478
13515
|
editor: this,
|
|
13479
13516
|
options: this.options
|
|
13480
13517
|
}), 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) {
|
|
@@ -13515,7 +13552,7 @@ var Ha = class {
|
|
|
13515
13552
|
}
|
|
13516
13553
|
_createMontageArea() {
|
|
13517
13554
|
let { montageAreaWidth: t, montageAreaHeight: n } = this.options, r = new m(t / 2, n / 2);
|
|
13518
|
-
this.montageArea =
|
|
13555
|
+
this.montageArea = Gt({
|
|
13519
13556
|
canvas: this.canvas,
|
|
13520
13557
|
centerPoint: r,
|
|
13521
13558
|
options: {
|
|
@@ -13539,7 +13576,7 @@ var Ha = class {
|
|
|
13539
13576
|
}
|
|
13540
13577
|
_createClippingArea() {
|
|
13541
13578
|
let { montageAreaWidth: e, montageAreaHeight: t } = this.options, n = new m(e / 2, t / 2);
|
|
13542
|
-
this.canvas.clipPath =
|
|
13579
|
+
this.canvas.clipPath = Gt({
|
|
13543
13580
|
canvas: this.canvas,
|
|
13544
13581
|
centerPoint: n,
|
|
13545
13582
|
options: {
|