zrender-nightly 5.6.2-dev.20250624 → 5.6.2-dev.20250625
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/zrender.js +491 -253
- package/dist/zrender.js.map +1 -1
- package/dist/zrender.min.js +1 -1
- package/lib/Element.d.ts +4 -0
- package/lib/Element.js +34 -16
- package/lib/Handler.js +1 -1
- package/lib/Storage.js +20 -20
- package/lib/contain/text.d.ts +14 -2
- package/lib/contain/text.js +65 -15
- package/lib/core/BoundingRect.d.ts +25 -3
- package/lib/core/BoundingRect.js +182 -76
- package/lib/core/OrientedBoundingRect.d.ts +2 -2
- package/lib/core/OrientedBoundingRect.js +50 -34
- package/lib/core/PathProxy.d.ts +1 -0
- package/lib/core/PathProxy.js +16 -1
- package/lib/core/types.d.ts +1 -0
- package/lib/core/util.d.ts +1 -0
- package/lib/core/util.js +1 -0
- package/lib/graphic/Displayable.js +1 -1
- package/lib/graphic/Text.d.ts +3 -2
- package/lib/graphic/Text.js +20 -13
- package/lib/graphic/helper/parseText.d.ts +11 -4
- package/lib/graphic/helper/parseText.js +71 -44
- package/lib/svg-legacy/helper/ClippathManager.js +6 -6
- package/lib/tool/color.d.ts +1 -1
- package/lib/tool/color.js +4 -4
- package/lib/tool/path.js +7 -4
- package/lib/zrender.d.ts +1 -1
- package/lib/zrender.js +1 -1
- package/package.json +3 -2
- package/src/Element.ts +69 -16
- package/src/Handler.ts +1 -1
- package/src/Storage.ts +25 -24
- package/src/canvas/helper.ts +1 -1
- package/src/contain/text.ts +103 -19
- package/src/core/BoundingRect.ts +308 -87
- package/src/core/OrientedBoundingRect.ts +86 -46
- package/src/core/PathProxy.ts +17 -1
- package/src/core/Transformable.ts +2 -0
- package/src/core/matrix.ts +2 -1
- package/src/core/types.ts +2 -0
- package/src/core/util.ts +3 -1
- package/src/graphic/Displayable.ts +1 -3
- package/src/graphic/Group.ts +2 -0
- package/src/graphic/Text.ts +59 -22
- package/src/graphic/helper/parseText.ts +151 -73
- package/src/svg-legacy/helper/ClippathManager.ts +5 -5
- package/src/tool/color.ts +13 -9
- package/src/tool/path.ts +9 -4
- package/src/zrender.ts +1 -1
package/dist/zrender.js
CHANGED
|
@@ -699,7 +699,8 @@
|
|
|
699
699
|
return own.hasOwnProperty(prop);
|
|
700
700
|
}
|
|
701
701
|
function noop() { }
|
|
702
|
-
var RADIAN_TO_DEGREE = 180 / Math.PI;
|
|
702
|
+
var RADIAN_TO_DEGREE = 180 / Math.PI;
|
|
703
|
+
var EPSILON = Number.EPSILON || Math.pow(2, -52);
|
|
703
704
|
|
|
704
705
|
var util = /*#__PURE__*/Object.freeze({
|
|
705
706
|
__proto__: null,
|
|
@@ -752,7 +753,8 @@
|
|
|
752
753
|
disableUserSelect: disableUserSelect,
|
|
753
754
|
hasOwn: hasOwn,
|
|
754
755
|
noop: noop,
|
|
755
|
-
RADIAN_TO_DEGREE: RADIAN_TO_DEGREE
|
|
756
|
+
RADIAN_TO_DEGREE: RADIAN_TO_DEGREE,
|
|
757
|
+
EPSILON: EPSILON
|
|
756
758
|
});
|
|
757
759
|
|
|
758
760
|
/*! *****************************************************************************
|
|
@@ -1733,14 +1735,22 @@
|
|
|
1733
1735
|
|
|
1734
1736
|
var mathMin = Math.min;
|
|
1735
1737
|
var mathMax = Math.max;
|
|
1738
|
+
var mathAbs = Math.abs;
|
|
1739
|
+
var XY = ['x', 'y'];
|
|
1740
|
+
var WH = ['width', 'height'];
|
|
1736
1741
|
var lt = new Point();
|
|
1737
1742
|
var rb = new Point();
|
|
1738
1743
|
var lb = new Point();
|
|
1739
1744
|
var rt = new Point();
|
|
1740
|
-
var
|
|
1741
|
-
var
|
|
1745
|
+
var _intersectCtx = createIntersectContext();
|
|
1746
|
+
var _minTv = _intersectCtx.minTv;
|
|
1747
|
+
var _maxTv = _intersectCtx.maxTv;
|
|
1748
|
+
var _lenMinMax = [0, 0];
|
|
1742
1749
|
var BoundingRect = (function () {
|
|
1743
1750
|
function BoundingRect(x, y, width, height) {
|
|
1751
|
+
BoundingRect.set(this, x, y, width, height);
|
|
1752
|
+
}
|
|
1753
|
+
BoundingRect.set = function (target, x, y, width, height) {
|
|
1744
1754
|
if (width < 0) {
|
|
1745
1755
|
x = x + width;
|
|
1746
1756
|
width = -width;
|
|
@@ -1749,11 +1759,12 @@
|
|
|
1749
1759
|
y = y + height;
|
|
1750
1760
|
height = -height;
|
|
1751
1761
|
}
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1762
|
+
target.x = x;
|
|
1763
|
+
target.y = y;
|
|
1764
|
+
target.width = width;
|
|
1765
|
+
target.height = height;
|
|
1766
|
+
return target;
|
|
1767
|
+
};
|
|
1757
1768
|
BoundingRect.prototype.union = function (other) {
|
|
1758
1769
|
var x = mathMin(other.x, this.x);
|
|
1759
1770
|
var y = mathMin(other.y, this.y);
|
|
@@ -1785,89 +1796,64 @@
|
|
|
1785
1796
|
translate(m, m, [b.x, b.y]);
|
|
1786
1797
|
return m;
|
|
1787
1798
|
};
|
|
1788
|
-
BoundingRect.prototype.intersect = function (b, mtv) {
|
|
1789
|
-
|
|
1799
|
+
BoundingRect.prototype.intersect = function (b, mtv, opt) {
|
|
1800
|
+
return BoundingRect.intersect(this, b, mtv, opt);
|
|
1801
|
+
};
|
|
1802
|
+
BoundingRect.intersect = function (a, b, mtv, opt) {
|
|
1803
|
+
if (mtv) {
|
|
1804
|
+
Point.set(mtv, 0, 0);
|
|
1805
|
+
}
|
|
1806
|
+
var outIntersectRect = opt && opt.outIntersectRect || null;
|
|
1807
|
+
var clamp = opt && opt.clamp;
|
|
1808
|
+
if (outIntersectRect) {
|
|
1809
|
+
outIntersectRect.x = outIntersectRect.y = outIntersectRect.width = outIntersectRect.height = NaN;
|
|
1810
|
+
}
|
|
1811
|
+
if (!a || !b) {
|
|
1790
1812
|
return false;
|
|
1791
1813
|
}
|
|
1814
|
+
if (!(a instanceof BoundingRect)) {
|
|
1815
|
+
a = BoundingRect.set(_tmpIntersectA, a.x, a.y, a.width, a.height);
|
|
1816
|
+
}
|
|
1792
1817
|
if (!(b instanceof BoundingRect)) {
|
|
1793
|
-
b = BoundingRect.
|
|
1818
|
+
b = BoundingRect.set(_tmpIntersectB, b.x, b.y, b.width, b.height);
|
|
1819
|
+
}
|
|
1820
|
+
var useMTV = !!mtv;
|
|
1821
|
+
_intersectCtx.reset(opt, useMTV);
|
|
1822
|
+
var touchThreshold = _intersectCtx.touchThreshold;
|
|
1823
|
+
var ax0 = a.x + touchThreshold;
|
|
1824
|
+
var ax1 = a.x + a.width - touchThreshold;
|
|
1825
|
+
var ay0 = a.y + touchThreshold;
|
|
1826
|
+
var ay1 = a.y + a.height - touchThreshold;
|
|
1827
|
+
var bx0 = b.x + touchThreshold;
|
|
1828
|
+
var bx1 = b.x + b.width - touchThreshold;
|
|
1829
|
+
var by0 = b.y + touchThreshold;
|
|
1830
|
+
var by1 = b.y + b.height - touchThreshold;
|
|
1831
|
+
if (ax0 > ax1 || ay0 > ay1 || bx0 > bx1 || by0 > by1) {
|
|
1832
|
+
return false;
|
|
1794
1833
|
}
|
|
1795
|
-
var a = this;
|
|
1796
|
-
var ax0 = a.x;
|
|
1797
|
-
var ax1 = a.x + a.width;
|
|
1798
|
-
var ay0 = a.y;
|
|
1799
|
-
var ay1 = a.y + a.height;
|
|
1800
|
-
var bx0 = b.x;
|
|
1801
|
-
var bx1 = b.x + b.width;
|
|
1802
|
-
var by0 = b.y;
|
|
1803
|
-
var by1 = b.y + b.height;
|
|
1804
1834
|
var overlap = !(ax1 < bx0 || bx1 < ax0 || ay1 < by0 || by1 < ay0);
|
|
1805
|
-
if (
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
if (ax1 < bx0 || bx1 < ax0) {
|
|
1815
|
-
if (dx > dMax) {
|
|
1816
|
-
dMax = dx;
|
|
1817
|
-
if (d0 < d1) {
|
|
1818
|
-
Point.set(maxTv, -d0, 0);
|
|
1819
|
-
}
|
|
1820
|
-
else {
|
|
1821
|
-
Point.set(maxTv, d1, 0);
|
|
1822
|
-
}
|
|
1823
|
-
}
|
|
1824
|
-
}
|
|
1825
|
-
else {
|
|
1826
|
-
if (dx < dMin) {
|
|
1827
|
-
dMin = dx;
|
|
1828
|
-
if (d0 < d1) {
|
|
1829
|
-
Point.set(minTv, d0, 0);
|
|
1830
|
-
}
|
|
1831
|
-
else {
|
|
1832
|
-
Point.set(minTv, -d1, 0);
|
|
1833
|
-
}
|
|
1834
|
-
}
|
|
1835
|
-
}
|
|
1836
|
-
if (ay1 < by0 || by1 < ay0) {
|
|
1837
|
-
if (dy > dMax) {
|
|
1838
|
-
dMax = dy;
|
|
1839
|
-
if (d2 < d3) {
|
|
1840
|
-
Point.set(maxTv, 0, -d2);
|
|
1841
|
-
}
|
|
1842
|
-
else {
|
|
1843
|
-
Point.set(maxTv, 0, d3);
|
|
1844
|
-
}
|
|
1845
|
-
}
|
|
1846
|
-
}
|
|
1847
|
-
else {
|
|
1848
|
-
if (dx < dMin) {
|
|
1849
|
-
dMin = dx;
|
|
1850
|
-
if (d2 < d3) {
|
|
1851
|
-
Point.set(minTv, 0, d2);
|
|
1852
|
-
}
|
|
1853
|
-
else {
|
|
1854
|
-
Point.set(minTv, 0, -d3);
|
|
1855
|
-
}
|
|
1856
|
-
}
|
|
1835
|
+
if (useMTV || outIntersectRect) {
|
|
1836
|
+
_lenMinMax[0] = Infinity;
|
|
1837
|
+
_lenMinMax[1] = 0;
|
|
1838
|
+
intersectOneDim(ax0, ax1, bx0, bx1, 0, useMTV, outIntersectRect, clamp);
|
|
1839
|
+
intersectOneDim(ay0, ay1, by0, by1, 1, useMTV, outIntersectRect, clamp);
|
|
1840
|
+
if (useMTV) {
|
|
1841
|
+
Point.copy(mtv, overlap
|
|
1842
|
+
? (_intersectCtx.useDir ? _intersectCtx.dirMinTv : _minTv)
|
|
1843
|
+
: _maxTv);
|
|
1857
1844
|
}
|
|
1858
1845
|
}
|
|
1859
|
-
if (mtv) {
|
|
1860
|
-
Point.copy(mtv, overlap ? minTv : maxTv);
|
|
1861
|
-
}
|
|
1862
1846
|
return overlap;
|
|
1863
1847
|
};
|
|
1864
|
-
BoundingRect.
|
|
1865
|
-
var rect = this;
|
|
1848
|
+
BoundingRect.contain = function (rect, x, y) {
|
|
1866
1849
|
return x >= rect.x
|
|
1867
1850
|
&& x <= (rect.x + rect.width)
|
|
1868
1851
|
&& y >= rect.y
|
|
1869
1852
|
&& y <= (rect.y + rect.height);
|
|
1870
1853
|
};
|
|
1854
|
+
BoundingRect.prototype.contain = function (x, y) {
|
|
1855
|
+
return BoundingRect.contain(this, x, y);
|
|
1856
|
+
};
|
|
1871
1857
|
BoundingRect.prototype.clone = function () {
|
|
1872
1858
|
return new BoundingRect(this.x, this.y, this.width, this.height);
|
|
1873
1859
|
};
|
|
@@ -1899,6 +1885,7 @@
|
|
|
1899
1885
|
target.y = source.y;
|
|
1900
1886
|
target.width = source.width;
|
|
1901
1887
|
target.height = source.height;
|
|
1888
|
+
return target;
|
|
1902
1889
|
};
|
|
1903
1890
|
BoundingRect.applyTransform = function (target, source, m) {
|
|
1904
1891
|
if (!m) {
|
|
@@ -1942,7 +1929,128 @@
|
|
|
1942
1929
|
target.height = maxY - target.y;
|
|
1943
1930
|
};
|
|
1944
1931
|
return BoundingRect;
|
|
1945
|
-
}());
|
|
1932
|
+
}());
|
|
1933
|
+
var _tmpIntersectA = new BoundingRect(0, 0, 0, 0);
|
|
1934
|
+
var _tmpIntersectB = new BoundingRect(0, 0, 0, 0);
|
|
1935
|
+
function intersectOneDim(a0, a1, b0, b1, updateDimIdx, useMTV, outIntersectRect, clamp) {
|
|
1936
|
+
var d0 = mathAbs(a1 - b0);
|
|
1937
|
+
var d1 = mathAbs(b1 - a0);
|
|
1938
|
+
var d01min = mathMin(d0, d1);
|
|
1939
|
+
var updateDim = XY[updateDimIdx];
|
|
1940
|
+
var zeroDim = XY[1 - updateDimIdx];
|
|
1941
|
+
var wh = WH[updateDimIdx];
|
|
1942
|
+
if (a1 < b0 || b1 < a0) {
|
|
1943
|
+
if (d0 < d1) {
|
|
1944
|
+
if (useMTV) {
|
|
1945
|
+
_maxTv[updateDim] = -d0;
|
|
1946
|
+
}
|
|
1947
|
+
if (clamp) {
|
|
1948
|
+
outIntersectRect[updateDim] = a1;
|
|
1949
|
+
outIntersectRect[wh] = 0;
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
else {
|
|
1953
|
+
if (useMTV) {
|
|
1954
|
+
_maxTv[updateDim] = d1;
|
|
1955
|
+
}
|
|
1956
|
+
if (clamp) {
|
|
1957
|
+
outIntersectRect[updateDim] = a0;
|
|
1958
|
+
outIntersectRect[wh] = 0;
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
}
|
|
1962
|
+
else {
|
|
1963
|
+
if (outIntersectRect) {
|
|
1964
|
+
outIntersectRect[updateDim] = mathMax(a0, b0);
|
|
1965
|
+
outIntersectRect[wh] = mathMin(a1, b1) - outIntersectRect[updateDim];
|
|
1966
|
+
}
|
|
1967
|
+
if (useMTV) {
|
|
1968
|
+
if (d01min < _lenMinMax[0] || _intersectCtx.useDir) {
|
|
1969
|
+
_lenMinMax[0] = mathMin(d01min, _lenMinMax[0]);
|
|
1970
|
+
if (d0 < d1 || !_intersectCtx.bidirectional) {
|
|
1971
|
+
_minTv[updateDim] = d0;
|
|
1972
|
+
_minTv[zeroDim] = 0;
|
|
1973
|
+
if (_intersectCtx.useDir) {
|
|
1974
|
+
_intersectCtx.calcDirMTV();
|
|
1975
|
+
}
|
|
1976
|
+
}
|
|
1977
|
+
if (d0 >= d1 || !_intersectCtx.bidirectional) {
|
|
1978
|
+
_minTv[updateDim] = -d1;
|
|
1979
|
+
_minTv[zeroDim] = 0;
|
|
1980
|
+
if (_intersectCtx.useDir) {
|
|
1981
|
+
_intersectCtx.calcDirMTV();
|
|
1982
|
+
}
|
|
1983
|
+
}
|
|
1984
|
+
}
|
|
1985
|
+
}
|
|
1986
|
+
}
|
|
1987
|
+
}
|
|
1988
|
+
function createIntersectContext() {
|
|
1989
|
+
var _direction = 0;
|
|
1990
|
+
var _dirCheckVec = new Point();
|
|
1991
|
+
var _dirTmp = new Point();
|
|
1992
|
+
var _ctx = {
|
|
1993
|
+
minTv: new Point(),
|
|
1994
|
+
maxTv: new Point(),
|
|
1995
|
+
useDir: false,
|
|
1996
|
+
dirMinTv: new Point(),
|
|
1997
|
+
touchThreshold: 0,
|
|
1998
|
+
bidirectional: true,
|
|
1999
|
+
negativeSize: false,
|
|
2000
|
+
reset: function (opt, useMTV) {
|
|
2001
|
+
_ctx.touchThreshold = 0;
|
|
2002
|
+
if (opt && opt.touchThreshold != null) {
|
|
2003
|
+
_ctx.touchThreshold = mathMax(0, opt.touchThreshold);
|
|
2004
|
+
}
|
|
2005
|
+
_ctx.negativeSize = false;
|
|
2006
|
+
if (!useMTV) {
|
|
2007
|
+
return;
|
|
2008
|
+
}
|
|
2009
|
+
_ctx.minTv.set(Infinity, Infinity);
|
|
2010
|
+
_ctx.maxTv.set(0, 0);
|
|
2011
|
+
_ctx.useDir = false;
|
|
2012
|
+
if (opt && opt.direction != null) {
|
|
2013
|
+
_ctx.useDir = true;
|
|
2014
|
+
_ctx.dirMinTv.copy(_ctx.minTv);
|
|
2015
|
+
_dirTmp.copy(_ctx.minTv);
|
|
2016
|
+
_direction = opt.direction;
|
|
2017
|
+
_ctx.bidirectional = opt.bidirectional == null || !!opt.bidirectional;
|
|
2018
|
+
if (!_ctx.bidirectional) {
|
|
2019
|
+
_dirCheckVec.set(Math.cos(_direction), Math.sin(_direction));
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2022
|
+
},
|
|
2023
|
+
calcDirMTV: function () {
|
|
2024
|
+
var minTv = _ctx.minTv;
|
|
2025
|
+
var dirMinTv = _ctx.dirMinTv;
|
|
2026
|
+
var squareMag = minTv.y * minTv.y + minTv.x * minTv.x;
|
|
2027
|
+
var dirSin = Math.sin(_direction);
|
|
2028
|
+
var dirCos = Math.cos(_direction);
|
|
2029
|
+
var dotProd = dirSin * minTv.y + dirCos * minTv.x;
|
|
2030
|
+
if (nearZero(dotProd)) {
|
|
2031
|
+
if (nearZero(minTv.x) && nearZero(minTv.y)) {
|
|
2032
|
+
dirMinTv.set(0, 0);
|
|
2033
|
+
}
|
|
2034
|
+
return;
|
|
2035
|
+
}
|
|
2036
|
+
_dirTmp.x = squareMag * dirCos / dotProd;
|
|
2037
|
+
_dirTmp.y = squareMag * dirSin / dotProd;
|
|
2038
|
+
if (nearZero(_dirTmp.x) && nearZero(_dirTmp.y)) {
|
|
2039
|
+
dirMinTv.set(0, 0);
|
|
2040
|
+
return;
|
|
2041
|
+
}
|
|
2042
|
+
if ((_ctx.bidirectional
|
|
2043
|
+
|| _dirCheckVec.dot(_dirTmp) > 0)
|
|
2044
|
+
&& _dirTmp.len() < dirMinTv.len()) {
|
|
2045
|
+
dirMinTv.copy(_dirTmp);
|
|
2046
|
+
}
|
|
2047
|
+
}
|
|
2048
|
+
};
|
|
2049
|
+
function nearZero(val) {
|
|
2050
|
+
return mathAbs(val) < 1e-10;
|
|
2051
|
+
}
|
|
2052
|
+
return _ctx;
|
|
2053
|
+
}
|
|
1946
2054
|
|
|
1947
2055
|
var SILENT = 'silent';
|
|
1948
2056
|
function makeEventPacket(eveType, targetInfo, event) {
|
|
@@ -2205,7 +2313,7 @@
|
|
|
2205
2313
|
isSilent = true;
|
|
2206
2314
|
}
|
|
2207
2315
|
var hostEl = el.__hostTarget;
|
|
2208
|
-
el = hostEl ? hostEl : el.parent;
|
|
2316
|
+
el = hostEl ? (el.ignoreHostSilent ? null : hostEl) : el.parent;
|
|
2209
2317
|
}
|
|
2210
2318
|
return isSilent ? SILENT : true;
|
|
2211
2319
|
}
|
|
@@ -2805,7 +2913,7 @@
|
|
|
2805
2913
|
displayList.length = this._displayListLen;
|
|
2806
2914
|
sort(displayList, shapeCompareFunc);
|
|
2807
2915
|
};
|
|
2808
|
-
Storage.prototype._updateAndAddDisplayable = function (el,
|
|
2916
|
+
Storage.prototype._updateAndAddDisplayable = function (el, parentClipPaths, includeIgnore) {
|
|
2809
2917
|
if (el.ignore && !includeIgnore) {
|
|
2810
2918
|
return;
|
|
2811
2919
|
}
|
|
@@ -2813,26 +2921,32 @@
|
|
|
2813
2921
|
el.update();
|
|
2814
2922
|
el.afterUpdate();
|
|
2815
2923
|
var userSetClipPath = el.getClipPath();
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2924
|
+
var parentHasClipPaths = parentClipPaths && parentClipPaths.length;
|
|
2925
|
+
var clipPathIdx = 0;
|
|
2926
|
+
var thisClipPaths = el.__clipPaths;
|
|
2927
|
+
if (!el.ignoreClip
|
|
2928
|
+
&& (parentHasClipPaths || userSetClipPath)) {
|
|
2929
|
+
if (!thisClipPaths) {
|
|
2930
|
+
thisClipPaths = el.__clipPaths = [];
|
|
2931
|
+
}
|
|
2932
|
+
if (parentHasClipPaths) {
|
|
2933
|
+
for (var idx = 0; idx < parentClipPaths.length; idx++) {
|
|
2934
|
+
thisClipPaths[clipPathIdx++] = parentClipPaths[idx];
|
|
2935
|
+
}
|
|
2825
2936
|
}
|
|
2826
2937
|
var currentClipPath = userSetClipPath;
|
|
2827
2938
|
var parentClipPath = el;
|
|
2828
2939
|
while (currentClipPath) {
|
|
2829
2940
|
currentClipPath.parent = parentClipPath;
|
|
2830
2941
|
currentClipPath.updateTransform();
|
|
2831
|
-
|
|
2942
|
+
thisClipPaths[clipPathIdx++] = currentClipPath;
|
|
2832
2943
|
parentClipPath = currentClipPath;
|
|
2833
2944
|
currentClipPath = currentClipPath.getClipPath();
|
|
2834
2945
|
}
|
|
2835
2946
|
}
|
|
2947
|
+
if (thisClipPaths) {
|
|
2948
|
+
thisClipPaths.length = clipPathIdx;
|
|
2949
|
+
}
|
|
2836
2950
|
if (el.childrenRef) {
|
|
2837
2951
|
var children = el.childrenRef();
|
|
2838
2952
|
for (var i = 0; i < children.length; i++) {
|
|
@@ -2840,18 +2954,12 @@
|
|
|
2840
2954
|
if (el.__dirty) {
|
|
2841
2955
|
child.__dirty |= REDRAW_BIT;
|
|
2842
2956
|
}
|
|
2843
|
-
this._updateAndAddDisplayable(child,
|
|
2957
|
+
this._updateAndAddDisplayable(child, thisClipPaths, includeIgnore);
|
|
2844
2958
|
}
|
|
2845
2959
|
el.__dirty = 0;
|
|
2846
2960
|
}
|
|
2847
2961
|
else {
|
|
2848
2962
|
var disp = el;
|
|
2849
|
-
if (clipPaths && clipPaths.length) {
|
|
2850
|
-
disp.__clipPaths = clipPaths;
|
|
2851
|
-
}
|
|
2852
|
-
else if (disp.__clipPaths && disp.__clipPaths.length > 0) {
|
|
2853
|
-
disp.__clipPaths = [];
|
|
2854
|
-
}
|
|
2855
2963
|
if (isNaN(disp.z)) {
|
|
2856
2964
|
logInvalidZError();
|
|
2857
2965
|
disp.z = 0;
|
|
@@ -2868,15 +2976,15 @@
|
|
|
2868
2976
|
}
|
|
2869
2977
|
var decalEl = el.getDecalElement && el.getDecalElement();
|
|
2870
2978
|
if (decalEl) {
|
|
2871
|
-
this._updateAndAddDisplayable(decalEl,
|
|
2979
|
+
this._updateAndAddDisplayable(decalEl, thisClipPaths, includeIgnore);
|
|
2872
2980
|
}
|
|
2873
2981
|
var textGuide = el.getTextGuideLine();
|
|
2874
2982
|
if (textGuide) {
|
|
2875
|
-
this._updateAndAddDisplayable(textGuide,
|
|
2983
|
+
this._updateAndAddDisplayable(textGuide, thisClipPaths, includeIgnore);
|
|
2876
2984
|
}
|
|
2877
2985
|
var textEl = el.getTextContent();
|
|
2878
2986
|
if (textEl) {
|
|
2879
|
-
this._updateAndAddDisplayable(textEl,
|
|
2987
|
+
this._updateAndAddDisplayable(textEl, thisClipPaths, includeIgnore);
|
|
2880
2988
|
}
|
|
2881
2989
|
};
|
|
2882
2990
|
Storage.prototype.addRoot = function (el) {
|
|
@@ -3120,7 +3228,7 @@
|
|
|
3120
3228
|
|
|
3121
3229
|
var mathPow = Math.pow;
|
|
3122
3230
|
var mathSqrt = Math.sqrt;
|
|
3123
|
-
var EPSILON = 1e-8;
|
|
3231
|
+
var EPSILON$1 = 1e-8;
|
|
3124
3232
|
var EPSILON_NUMERIC = 1e-4;
|
|
3125
3233
|
var THREE_SQRT = mathSqrt(3);
|
|
3126
3234
|
var ONE_THIRD = 1 / 3;
|
|
@@ -3128,10 +3236,10 @@
|
|
|
3128
3236
|
var _v1 = create();
|
|
3129
3237
|
var _v2 = create();
|
|
3130
3238
|
function isAroundZero(val) {
|
|
3131
|
-
return val > -EPSILON && val < EPSILON;
|
|
3239
|
+
return val > -EPSILON$1 && val < EPSILON$1;
|
|
3132
3240
|
}
|
|
3133
3241
|
function isNotAroundZero(val) {
|
|
3134
|
-
return val > EPSILON || val < -EPSILON;
|
|
3242
|
+
return val > EPSILON$1 || val < -EPSILON$1;
|
|
3135
3243
|
}
|
|
3136
3244
|
function cubicAt(p0, p1, p2, p3, t) {
|
|
3137
3245
|
var onet = 1 - t;
|
|
@@ -4024,9 +4132,9 @@
|
|
|
4024
4132
|
var colorArr = parse(color);
|
|
4025
4133
|
if (color) {
|
|
4026
4134
|
colorArr = rgba2hsla(colorArr);
|
|
4027
|
-
h != null && (colorArr[0] = clampCssAngle(h));
|
|
4028
|
-
s != null && (colorArr[1] = parseCssFloat(s));
|
|
4029
|
-
l != null && (colorArr[2] = parseCssFloat(l));
|
|
4135
|
+
h != null && (colorArr[0] = clampCssAngle(isFunction(h) ? h(colorArr[0]) : h));
|
|
4136
|
+
s != null && (colorArr[1] = parseCssFloat(isFunction(s) ? s(colorArr[1]) : s));
|
|
4137
|
+
l != null && (colorArr[2] = parseCssFloat(isFunction(l) ? l(colorArr[2]) : l));
|
|
4030
4138
|
return stringify(hsla2rgba(colorArr), 'rgba');
|
|
4031
4139
|
}
|
|
4032
4140
|
}
|
|
@@ -4119,9 +4227,9 @@
|
|
|
4119
4227
|
opacity: opacity == null ? 1 : opacity
|
|
4120
4228
|
};
|
|
4121
4229
|
}
|
|
4122
|
-
var EPSILON$
|
|
4230
|
+
var EPSILON$2 = 1e-4;
|
|
4123
4231
|
function isAroundZero$1(transform) {
|
|
4124
|
-
return transform < EPSILON$
|
|
4232
|
+
return transform < EPSILON$2 && transform > -EPSILON$2;
|
|
4125
4233
|
}
|
|
4126
4234
|
function round3(transform) {
|
|
4127
4235
|
return mathRound(transform * 1e3) / 1e3;
|
|
@@ -5413,9 +5521,9 @@
|
|
|
5413
5521
|
var LIGHTER_LABEL_COLOR = '#eee';
|
|
5414
5522
|
|
|
5415
5523
|
var mIdentity = identity;
|
|
5416
|
-
var EPSILON$
|
|
5524
|
+
var EPSILON$3 = 5e-5;
|
|
5417
5525
|
function isNotAroundZero$1(val) {
|
|
5418
|
-
return val > EPSILON$
|
|
5526
|
+
return val > EPSILON$3 || val < -EPSILON$3;
|
|
5419
5527
|
}
|
|
5420
5528
|
var scaleTmp = [];
|
|
5421
5529
|
var tmpTransform = [];
|
|
@@ -5653,22 +5761,69 @@
|
|
|
5653
5761
|
}
|
|
5654
5762
|
}
|
|
5655
5763
|
|
|
5656
|
-
|
|
5657
|
-
|
|
5764
|
+
function ensureFontMeasureInfo(font) {
|
|
5765
|
+
if (!_fontMeasureInfoCache) {
|
|
5766
|
+
_fontMeasureInfoCache = new LRU(100);
|
|
5767
|
+
}
|
|
5658
5768
|
font = font || DEFAULT_FONT;
|
|
5659
|
-
var
|
|
5660
|
-
if (!
|
|
5661
|
-
|
|
5769
|
+
var measureInfo = _fontMeasureInfoCache.get(font);
|
|
5770
|
+
if (!measureInfo) {
|
|
5771
|
+
measureInfo = {
|
|
5772
|
+
font: font,
|
|
5773
|
+
strWidthCache: new LRU(500),
|
|
5774
|
+
asciiWidthMap: null,
|
|
5775
|
+
asciiWidthMapTried: false,
|
|
5776
|
+
stWideCharWidth: platformApi.measureText('国', font).width,
|
|
5777
|
+
asciiCharWidth: platformApi.measureText('a', font).width,
|
|
5778
|
+
};
|
|
5779
|
+
_fontMeasureInfoCache.put(font, measureInfo);
|
|
5780
|
+
}
|
|
5781
|
+
return measureInfo;
|
|
5782
|
+
}
|
|
5783
|
+
var _fontMeasureInfoCache;
|
|
5784
|
+
function tryCreateASCIIWidthMap(font) {
|
|
5785
|
+
if (_getASCIIWidthMapLongCount >= GET_ASCII_WIDTH_LONG_COUNT_MAX) {
|
|
5786
|
+
return;
|
|
5662
5787
|
}
|
|
5663
|
-
|
|
5788
|
+
font = font || DEFAULT_FONT;
|
|
5789
|
+
var asciiWidthMap = [];
|
|
5790
|
+
var start = +(new Date());
|
|
5791
|
+
for (var code = 0; code <= 127; code++) {
|
|
5792
|
+
asciiWidthMap[code] = platformApi.measureText(String.fromCharCode(code), font).width;
|
|
5793
|
+
}
|
|
5794
|
+
var cost = +(new Date()) - start;
|
|
5795
|
+
if (cost > 16) {
|
|
5796
|
+
_getASCIIWidthMapLongCount = GET_ASCII_WIDTH_LONG_COUNT_MAX;
|
|
5797
|
+
}
|
|
5798
|
+
else if (cost > 2) {
|
|
5799
|
+
_getASCIIWidthMapLongCount++;
|
|
5800
|
+
}
|
|
5801
|
+
return asciiWidthMap;
|
|
5802
|
+
}
|
|
5803
|
+
var _getASCIIWidthMapLongCount = 0;
|
|
5804
|
+
var GET_ASCII_WIDTH_LONG_COUNT_MAX = 5;
|
|
5805
|
+
function measureCharWidth(fontMeasureInfo, charCode) {
|
|
5806
|
+
if (!fontMeasureInfo.asciiWidthMapTried) {
|
|
5807
|
+
fontMeasureInfo.asciiWidthMap = tryCreateASCIIWidthMap(fontMeasureInfo.font);
|
|
5808
|
+
fontMeasureInfo.asciiWidthMapTried = true;
|
|
5809
|
+
}
|
|
5810
|
+
return (0 <= charCode && charCode <= 127)
|
|
5811
|
+
? (fontMeasureInfo.asciiWidthMap != null
|
|
5812
|
+
? fontMeasureInfo.asciiWidthMap[charCode]
|
|
5813
|
+
: fontMeasureInfo.asciiCharWidth)
|
|
5814
|
+
: fontMeasureInfo.stWideCharWidth;
|
|
5815
|
+
}
|
|
5816
|
+
function measureWidth(fontMeasureInfo, text) {
|
|
5817
|
+
var strWidthCache = fontMeasureInfo.strWidthCache;
|
|
5818
|
+
var width = strWidthCache.get(text);
|
|
5664
5819
|
if (width == null) {
|
|
5665
|
-
width = platformApi.measureText(text, font).width;
|
|
5666
|
-
|
|
5820
|
+
width = platformApi.measureText(text, fontMeasureInfo.font).width;
|
|
5821
|
+
strWidthCache.put(text, width);
|
|
5667
5822
|
}
|
|
5668
5823
|
return width;
|
|
5669
5824
|
}
|
|
5670
5825
|
function innerGetBoundingRect(text, font, textAlign, textBaseline) {
|
|
5671
|
-
var width =
|
|
5826
|
+
var width = measureWidth(ensureFontMeasureInfo(font), text);
|
|
5672
5827
|
var height = getLineHeight(font);
|
|
5673
5828
|
var x = adjustTextX(0, width, textAlign);
|
|
5674
5829
|
var y = adjustTextY$1(0, height, textBaseline);
|
|
@@ -5690,26 +5845,26 @@
|
|
|
5690
5845
|
return uniondRect;
|
|
5691
5846
|
}
|
|
5692
5847
|
}
|
|
5693
|
-
function adjustTextX(x, width, textAlign) {
|
|
5848
|
+
function adjustTextX(x, width, textAlign, inverse) {
|
|
5694
5849
|
if (textAlign === 'right') {
|
|
5695
|
-
x -= width;
|
|
5850
|
+
!inverse ? (x -= width) : (x += width);
|
|
5696
5851
|
}
|
|
5697
5852
|
else if (textAlign === 'center') {
|
|
5698
|
-
x -= width / 2;
|
|
5853
|
+
!inverse ? (x -= width / 2) : (x += width / 2);
|
|
5699
5854
|
}
|
|
5700
5855
|
return x;
|
|
5701
5856
|
}
|
|
5702
|
-
function adjustTextY$1(y, height, verticalAlign) {
|
|
5857
|
+
function adjustTextY$1(y, height, verticalAlign, inverse) {
|
|
5703
5858
|
if (verticalAlign === 'middle') {
|
|
5704
|
-
y -= height / 2;
|
|
5859
|
+
!inverse ? (y -= height / 2) : (y += height / 2);
|
|
5705
5860
|
}
|
|
5706
5861
|
else if (verticalAlign === 'bottom') {
|
|
5707
|
-
y -= height;
|
|
5862
|
+
!inverse ? (y -= height) : (y += height);
|
|
5708
5863
|
}
|
|
5709
5864
|
return y;
|
|
5710
5865
|
}
|
|
5711
5866
|
function getLineHeight(font) {
|
|
5712
|
-
return
|
|
5867
|
+
return ensureFontMeasureInfo(font).stWideCharWidth;
|
|
5713
5868
|
}
|
|
5714
5869
|
function parsePercent(value, maxValue) {
|
|
5715
5870
|
if (typeof value === 'string') {
|
|
@@ -5826,6 +5981,7 @@
|
|
|
5826
5981
|
}, { ignore: false });
|
|
5827
5982
|
var tmpTextPosCalcRes = {};
|
|
5828
5983
|
var tmpBoundingRect = new BoundingRect(0, 0, 0, 0);
|
|
5984
|
+
var tmpInnerTextTrans = [];
|
|
5829
5985
|
var Element = (function () {
|
|
5830
5986
|
function Element(props) {
|
|
5831
5987
|
this.id = guid();
|
|
@@ -5878,8 +6034,11 @@
|
|
|
5878
6034
|
innerTransformable.parent = isLocal ? this : null;
|
|
5879
6035
|
var innerOrigin = false;
|
|
5880
6036
|
innerTransformable.copyTransform(textEl);
|
|
5881
|
-
|
|
5882
|
-
|
|
6037
|
+
var hasPosition = textConfig.position != null;
|
|
6038
|
+
var autoOverflowArea = textConfig.autoOverflowArea;
|
|
6039
|
+
var layoutRect = void 0;
|
|
6040
|
+
if (autoOverflowArea || hasPosition) {
|
|
6041
|
+
layoutRect = tmpBoundingRect;
|
|
5883
6042
|
if (textConfig.layoutRect) {
|
|
5884
6043
|
layoutRect.copy(textConfig.layoutRect);
|
|
5885
6044
|
}
|
|
@@ -5889,6 +6048,8 @@
|
|
|
5889
6048
|
if (!isLocal) {
|
|
5890
6049
|
layoutRect.applyTransform(this.transform);
|
|
5891
6050
|
}
|
|
6051
|
+
}
|
|
6052
|
+
if (hasPosition) {
|
|
5892
6053
|
if (this.calculateTextPosition) {
|
|
5893
6054
|
this.calculateTextPosition(tmpTextPosCalcRes, textConfig, layoutRect);
|
|
5894
6055
|
}
|
|
@@ -5928,10 +6089,21 @@
|
|
|
5928
6089
|
innerTransformable.originY = -textOffset[1];
|
|
5929
6090
|
}
|
|
5930
6091
|
}
|
|
6092
|
+
var innerTextDefaultStyle = this._innerTextDefaultStyle || (this._innerTextDefaultStyle = {});
|
|
6093
|
+
if (autoOverflowArea) {
|
|
6094
|
+
var overflowRect = innerTextDefaultStyle.overflowRect =
|
|
6095
|
+
innerTextDefaultStyle.overflowRect || new BoundingRect(0, 0, 0, 0);
|
|
6096
|
+
innerTransformable.getLocalTransform(tmpInnerTextTrans);
|
|
6097
|
+
invert(tmpInnerTextTrans, tmpInnerTextTrans);
|
|
6098
|
+
BoundingRect.copy(overflowRect, layoutRect);
|
|
6099
|
+
overflowRect.applyTransform(tmpInnerTextTrans);
|
|
6100
|
+
}
|
|
6101
|
+
else {
|
|
6102
|
+
innerTextDefaultStyle.overflowRect = null;
|
|
6103
|
+
}
|
|
5931
6104
|
var isInside = textConfig.inside == null
|
|
5932
6105
|
? (typeof textConfig.position === 'string' && textConfig.position.indexOf('inside') >= 0)
|
|
5933
6106
|
: textConfig.inside;
|
|
5934
|
-
var innerTextDefaultStyle = this._innerTextDefaultStyle || (this._innerTextDefaultStyle = {});
|
|
5935
6107
|
var textFill = void 0;
|
|
5936
6108
|
var textStroke = void 0;
|
|
5937
6109
|
var autoStroke = void 0;
|
|
@@ -6212,16 +6384,15 @@
|
|
|
6212
6384
|
}
|
|
6213
6385
|
};
|
|
6214
6386
|
Element.prototype.isSilent = function () {
|
|
6215
|
-
var
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
isSilent = true;
|
|
6220
|
-
break;
|
|
6387
|
+
var el = this;
|
|
6388
|
+
while (el) {
|
|
6389
|
+
if (el.silent) {
|
|
6390
|
+
return true;
|
|
6221
6391
|
}
|
|
6222
|
-
|
|
6392
|
+
var hostEl = el.__hostTarget;
|
|
6393
|
+
el = hostEl ? (el.ignoreHostSilent ? null : hostEl) : el.parent;
|
|
6223
6394
|
}
|
|
6224
|
-
return
|
|
6395
|
+
return false;
|
|
6225
6396
|
};
|
|
6226
6397
|
Element.prototype._updateAnimationTargets = function () {
|
|
6227
6398
|
for (var i = 0; i < this.animators.length; i++) {
|
|
@@ -6585,11 +6756,12 @@
|
|
|
6585
6756
|
elProto.name = '';
|
|
6586
6757
|
elProto.ignore =
|
|
6587
6758
|
elProto.silent =
|
|
6588
|
-
elProto.
|
|
6589
|
-
elProto.
|
|
6590
|
-
elProto.
|
|
6591
|
-
elProto.
|
|
6592
|
-
elProto.
|
|
6759
|
+
elProto.ignoreHostSilent =
|
|
6760
|
+
elProto.isGroup =
|
|
6761
|
+
elProto.draggable =
|
|
6762
|
+
elProto.dragging =
|
|
6763
|
+
elProto.ignoreClip =
|
|
6764
|
+
elProto.__inHover = false;
|
|
6593
6765
|
elProto.__dirty = REDRAW_BIT;
|
|
6594
6766
|
var logs = {};
|
|
6595
6767
|
function logDeprecatedError(key, xKey, yKey) {
|
|
@@ -7349,7 +7521,7 @@
|
|
|
7349
7521
|
function registerSSRDataGetter(getter) {
|
|
7350
7522
|
ssrDataGetter = getter;
|
|
7351
7523
|
}
|
|
7352
|
-
var version = '5.6.2-dev.
|
|
7524
|
+
var version = '5.6.2-dev.20250625';
|
|
7353
7525
|
|
|
7354
7526
|
var STYLE_MAGIC_KEY = '__zr_style_' + Math.round((Math.random() * 10));
|
|
7355
7527
|
var DEFAULT_COMMON_STYLE = {
|
|
@@ -7406,7 +7578,7 @@
|
|
|
7406
7578
|
|| (m && !m[0] && !m[3])) {
|
|
7407
7579
|
return false;
|
|
7408
7580
|
}
|
|
7409
|
-
if (considerClipPath && this.__clipPaths) {
|
|
7581
|
+
if (considerClipPath && this.__clipPaths && this.__clipPaths.length) {
|
|
7410
7582
|
for (var i = 0; i < this.__clipPaths.length; ++i) {
|
|
7411
7583
|
if (this.__clipPaths[i].isZeroArea()) {
|
|
7412
7584
|
return false;
|
|
@@ -7812,7 +7984,7 @@
|
|
|
7812
7984
|
var mathMax$2 = Math.max;
|
|
7813
7985
|
var mathCos$1 = Math.cos;
|
|
7814
7986
|
var mathSin$1 = Math.sin;
|
|
7815
|
-
var mathAbs = Math.abs;
|
|
7987
|
+
var mathAbs$1 = Math.abs;
|
|
7816
7988
|
var PI = Math.PI;
|
|
7817
7989
|
var PI2$1 = PI * 2;
|
|
7818
7990
|
var hasTypedArray = typeof Float32Array !== 'undefined';
|
|
@@ -7868,8 +8040,8 @@
|
|
|
7868
8040
|
PathProxy.prototype.setScale = function (sx, sy, segmentIgnoreThreshold) {
|
|
7869
8041
|
segmentIgnoreThreshold = segmentIgnoreThreshold || 0;
|
|
7870
8042
|
if (segmentIgnoreThreshold > 0) {
|
|
7871
|
-
this._ux = mathAbs(segmentIgnoreThreshold / devicePixelRatio / sx) || 0;
|
|
7872
|
-
this._uy = mathAbs(segmentIgnoreThreshold / devicePixelRatio / sy) || 0;
|
|
8043
|
+
this._ux = mathAbs$1(segmentIgnoreThreshold / devicePixelRatio / sx) || 0;
|
|
8044
|
+
this._uy = mathAbs$1(segmentIgnoreThreshold / devicePixelRatio / sy) || 0;
|
|
7873
8045
|
}
|
|
7874
8046
|
};
|
|
7875
8047
|
PathProxy.prototype.setDPR = function (dpr) {
|
|
@@ -7907,8 +8079,8 @@
|
|
|
7907
8079
|
return this;
|
|
7908
8080
|
};
|
|
7909
8081
|
PathProxy.prototype.lineTo = function (x, y) {
|
|
7910
|
-
var dx = mathAbs(x - this._xi);
|
|
7911
|
-
var dy = mathAbs(y - this._yi);
|
|
8082
|
+
var dx = mathAbs$1(x - this._xi);
|
|
8083
|
+
var dy = mathAbs$1(y - this._yi);
|
|
7912
8084
|
var exceedUnit = dx > this._ux || dy > this._uy;
|
|
7913
8085
|
this.addData(CMD.L, x, y);
|
|
7914
8086
|
if (this._ctx && exceedUnit) {
|
|
@@ -8001,6 +8173,9 @@
|
|
|
8001
8173
|
return this._len;
|
|
8002
8174
|
};
|
|
8003
8175
|
PathProxy.prototype.setData = function (data) {
|
|
8176
|
+
if (!this._saveData) {
|
|
8177
|
+
return;
|
|
8178
|
+
}
|
|
8004
8179
|
var len = data.length;
|
|
8005
8180
|
if (!(this.data && this.data.length === len) && hasTypedArray) {
|
|
8006
8181
|
this.data = new Float32Array(len);
|
|
@@ -8011,6 +8186,9 @@
|
|
|
8011
8186
|
this._len = len;
|
|
8012
8187
|
};
|
|
8013
8188
|
PathProxy.prototype.appendPath = function (path) {
|
|
8189
|
+
if (!this._saveData) {
|
|
8190
|
+
return;
|
|
8191
|
+
}
|
|
8014
8192
|
if (!(path instanceof Array)) {
|
|
8015
8193
|
path = [path];
|
|
8016
8194
|
}
|
|
@@ -8020,8 +8198,14 @@
|
|
|
8020
8198
|
for (var i = 0; i < len; i++) {
|
|
8021
8199
|
appendSize += path[i].len();
|
|
8022
8200
|
}
|
|
8023
|
-
|
|
8201
|
+
var oldData = this.data;
|
|
8202
|
+
if (hasTypedArray && (oldData instanceof Float32Array || !oldData)) {
|
|
8024
8203
|
this.data = new Float32Array(offset + appendSize);
|
|
8204
|
+
if (offset > 0 && oldData) {
|
|
8205
|
+
for (var k = 0; k < offset; k++) {
|
|
8206
|
+
this.data[k] = oldData[k];
|
|
8207
|
+
}
|
|
8208
|
+
}
|
|
8025
8209
|
}
|
|
8026
8210
|
for (var i = 0; i < len; i++) {
|
|
8027
8211
|
var appendPathData = path[i].data;
|
|
@@ -8186,7 +8370,7 @@
|
|
|
8186
8370
|
var y2 = data[i++];
|
|
8187
8371
|
var dx = x2 - xi;
|
|
8188
8372
|
var dy = y2 - yi;
|
|
8189
|
-
if (mathAbs(dx) > ux || mathAbs(dy) > uy || i === len - 1) {
|
|
8373
|
+
if (mathAbs$1(dx) > ux || mathAbs$1(dy) > uy || i === len - 1) {
|
|
8190
8374
|
l = Math.sqrt(dx * dx + dy * dy);
|
|
8191
8375
|
xi = x2;
|
|
8192
8376
|
yi = y2;
|
|
@@ -8310,8 +8494,8 @@
|
|
|
8310
8494
|
case CMD.L: {
|
|
8311
8495
|
x = d[i++];
|
|
8312
8496
|
y = d[i++];
|
|
8313
|
-
var dx = mathAbs(x - xi);
|
|
8314
|
-
var dy = mathAbs(y - yi);
|
|
8497
|
+
var dx = mathAbs$1(x - xi);
|
|
8498
|
+
var dy = mathAbs$1(y - yi);
|
|
8315
8499
|
if (dx > ux || dy > uy) {
|
|
8316
8500
|
if (drawPart) {
|
|
8317
8501
|
var l = pathSegLen[segCount++];
|
|
@@ -8391,7 +8575,7 @@
|
|
|
8391
8575
|
var psi = d[i++];
|
|
8392
8576
|
var anticlockwise = !d[i++];
|
|
8393
8577
|
var r = (rx > ry) ? rx : ry;
|
|
8394
|
-
var isEllipse = mathAbs(rx - ry) > 1e-3;
|
|
8578
|
+
var isEllipse = mathAbs$1(rx - ry) > 1e-3;
|
|
8395
8579
|
var endAngle = startAngle + delta;
|
|
8396
8580
|
var breakBuild = false;
|
|
8397
8581
|
if (drawPart) {
|
|
@@ -8473,6 +8657,9 @@
|
|
|
8473
8657
|
newProxy._len = this._len;
|
|
8474
8658
|
return newProxy;
|
|
8475
8659
|
};
|
|
8660
|
+
PathProxy.prototype.canSave = function () {
|
|
8661
|
+
return !!this._saveData;
|
|
8662
|
+
};
|
|
8476
8663
|
PathProxy.CMD = CMD;
|
|
8477
8664
|
PathProxy.initDefaultProps = (function () {
|
|
8478
8665
|
var proto = PathProxy.prototype;
|
|
@@ -8602,9 +8789,9 @@
|
|
|
8602
8789
|
|
|
8603
8790
|
var CMD$1 = PathProxy.CMD;
|
|
8604
8791
|
var PI2$4 = Math.PI * 2;
|
|
8605
|
-
var EPSILON$
|
|
8792
|
+
var EPSILON$4 = 1e-4;
|
|
8606
8793
|
function isAroundEqual(a, b) {
|
|
8607
|
-
return Math.abs(a - b) < EPSILON$
|
|
8794
|
+
return Math.abs(a - b) < EPSILON$4;
|
|
8608
8795
|
}
|
|
8609
8796
|
var roots = [-1, -1, -1];
|
|
8610
8797
|
var extrema = [-1, -1];
|
|
@@ -9654,16 +9841,19 @@
|
|
|
9654
9841
|
var pathProxy = createPathProxyFromString(str);
|
|
9655
9842
|
var innerOpts = extend({}, opts);
|
|
9656
9843
|
innerOpts.buildPath = function (path) {
|
|
9657
|
-
|
|
9658
|
-
|
|
9844
|
+
var beProxy = isPathProxy(path);
|
|
9845
|
+
if (beProxy && path.canSave()) {
|
|
9846
|
+
path.appendPath(pathProxy);
|
|
9659
9847
|
var ctx = path.getContext();
|
|
9660
9848
|
if (ctx) {
|
|
9661
9849
|
path.rebuildPath(ctx, 1);
|
|
9662
9850
|
}
|
|
9663
9851
|
}
|
|
9664
9852
|
else {
|
|
9665
|
-
var ctx = path;
|
|
9666
|
-
|
|
9853
|
+
var ctx = beProxy ? path.getContext() : path;
|
|
9854
|
+
if (ctx) {
|
|
9855
|
+
pathProxy.rebuildPath(ctx, 1);
|
|
9856
|
+
}
|
|
9667
9857
|
}
|
|
9668
9858
|
};
|
|
9669
9859
|
innerOpts.applyTransform = function (m) {
|
|
@@ -11014,7 +11204,7 @@
|
|
|
11014
11204
|
var mathCos$3 = Math.cos;
|
|
11015
11205
|
var mathACos = Math.acos;
|
|
11016
11206
|
var mathATan2 = Math.atan2;
|
|
11017
|
-
var mathAbs$
|
|
11207
|
+
var mathAbs$2 = Math.abs;
|
|
11018
11208
|
var mathSqrt$3 = Math.sqrt;
|
|
11019
11209
|
var mathMax$3 = Math.max;
|
|
11020
11210
|
var mathMin$3 = Math.min;
|
|
@@ -11119,7 +11309,7 @@
|
|
|
11119
11309
|
}
|
|
11120
11310
|
var cx = shape.cx, cy = shape.cy;
|
|
11121
11311
|
var clockwise = !!shape.clockwise;
|
|
11122
|
-
var arc = mathAbs$
|
|
11312
|
+
var arc = mathAbs$2(endAngle - startAngle);
|
|
11123
11313
|
var mod = arc > PI2$5 && arc % PI2$5;
|
|
11124
11314
|
mod > e && (arc = mod);
|
|
11125
11315
|
if (!(radius > e)) {
|
|
@@ -11160,7 +11350,7 @@
|
|
|
11160
11350
|
if (cornerRadius) {
|
|
11161
11351
|
_a = normalizeCornerRadius(cornerRadius), icrStart = _a[0], icrEnd = _a[1], ocrStart = _a[2], ocrEnd = _a[3];
|
|
11162
11352
|
}
|
|
11163
|
-
var halfRd = mathAbs$
|
|
11353
|
+
var halfRd = mathAbs$2(radius - innerRadius) / 2;
|
|
11164
11354
|
ocrs = mathMin$3(halfRd, ocrStart);
|
|
11165
11355
|
ocre = mathMin$3(halfRd, ocrEnd);
|
|
11166
11356
|
icrs = mathMin$3(halfRd, icrStart);
|
|
@@ -12594,18 +12784,17 @@
|
|
|
12594
12784
|
function prepareTruncateOptions(containerWidth, font, ellipsis, options) {
|
|
12595
12785
|
options = options || {};
|
|
12596
12786
|
var preparedOpts = extend({}, options);
|
|
12597
|
-
preparedOpts.font = font;
|
|
12598
12787
|
ellipsis = retrieve2(ellipsis, '...');
|
|
12599
12788
|
preparedOpts.maxIterations = retrieve2(options.maxIterations, 2);
|
|
12600
12789
|
var minChar = preparedOpts.minChar = retrieve2(options.minChar, 0);
|
|
12601
|
-
preparedOpts.
|
|
12602
|
-
var ascCharWidth =
|
|
12790
|
+
var fontMeasureInfo = preparedOpts.fontMeasureInfo = ensureFontMeasureInfo(font);
|
|
12791
|
+
var ascCharWidth = fontMeasureInfo.asciiCharWidth;
|
|
12603
12792
|
preparedOpts.placeholder = retrieve2(options.placeholder, '');
|
|
12604
12793
|
var contentWidth = containerWidth = Math.max(0, containerWidth - 1);
|
|
12605
12794
|
for (var i = 0; i < minChar && contentWidth >= ascCharWidth; i++) {
|
|
12606
12795
|
contentWidth -= ascCharWidth;
|
|
12607
12796
|
}
|
|
12608
|
-
var ellipsisWidth =
|
|
12797
|
+
var ellipsisWidth = measureWidth(fontMeasureInfo, ellipsis);
|
|
12609
12798
|
if (ellipsisWidth > contentWidth) {
|
|
12610
12799
|
ellipsis = '';
|
|
12611
12800
|
ellipsisWidth = 0;
|
|
@@ -12619,14 +12808,14 @@
|
|
|
12619
12808
|
}
|
|
12620
12809
|
function truncateSingleLine(out, textLine, options) {
|
|
12621
12810
|
var containerWidth = options.containerWidth;
|
|
12622
|
-
var font = options.font;
|
|
12623
12811
|
var contentWidth = options.contentWidth;
|
|
12812
|
+
var fontMeasureInfo = options.fontMeasureInfo;
|
|
12624
12813
|
if (!containerWidth) {
|
|
12625
12814
|
out.textLine = '';
|
|
12626
12815
|
out.isTruncated = false;
|
|
12627
12816
|
return;
|
|
12628
12817
|
}
|
|
12629
|
-
var lineWidth =
|
|
12818
|
+
var lineWidth = measureWidth(fontMeasureInfo, textLine);
|
|
12630
12819
|
if (lineWidth <= containerWidth) {
|
|
12631
12820
|
out.textLine = textLine;
|
|
12632
12821
|
out.isTruncated = false;
|
|
@@ -12638,12 +12827,12 @@
|
|
|
12638
12827
|
break;
|
|
12639
12828
|
}
|
|
12640
12829
|
var subLength = j === 0
|
|
12641
|
-
? estimateLength(textLine, contentWidth,
|
|
12830
|
+
? estimateLength(textLine, contentWidth, fontMeasureInfo)
|
|
12642
12831
|
: lineWidth > 0
|
|
12643
12832
|
? Math.floor(textLine.length * contentWidth / lineWidth)
|
|
12644
12833
|
: 0;
|
|
12645
12834
|
textLine = textLine.substr(0, subLength);
|
|
12646
|
-
lineWidth =
|
|
12835
|
+
lineWidth = measureWidth(fontMeasureInfo, textLine);
|
|
12647
12836
|
}
|
|
12648
12837
|
if (textLine === '') {
|
|
12649
12838
|
textLine = options.placeholder;
|
|
@@ -12651,27 +12840,34 @@
|
|
|
12651
12840
|
out.textLine = textLine;
|
|
12652
12841
|
out.isTruncated = true;
|
|
12653
12842
|
}
|
|
12654
|
-
function estimateLength(text, contentWidth,
|
|
12843
|
+
function estimateLength(text, contentWidth, fontMeasureInfo) {
|
|
12655
12844
|
var width = 0;
|
|
12656
12845
|
var i = 0;
|
|
12657
12846
|
for (var len = text.length; i < len && width < contentWidth; i++) {
|
|
12658
|
-
|
|
12659
|
-
width += (0 <= charCode && charCode <= 127) ? ascCharWidth : cnCharWidth;
|
|
12847
|
+
width += measureCharWidth(fontMeasureInfo, text.charCodeAt(i));
|
|
12660
12848
|
}
|
|
12661
12849
|
return i;
|
|
12662
12850
|
}
|
|
12663
|
-
function parsePlainText(text, style) {
|
|
12851
|
+
function parsePlainText(text, style, defaultOuterWidth, defaultOuterHeight) {
|
|
12664
12852
|
text != null && (text += '');
|
|
12665
12853
|
var overflow = style.overflow;
|
|
12666
12854
|
var padding = style.padding;
|
|
12855
|
+
var paddingH = padding ? padding[1] + padding[3] : 0;
|
|
12856
|
+
var paddingV = padding ? padding[0] + padding[2] : 0;
|
|
12667
12857
|
var font = style.font;
|
|
12668
12858
|
var truncate = overflow === 'truncate';
|
|
12669
12859
|
var calculatedLineHeight = getLineHeight(font);
|
|
12670
12860
|
var lineHeight = retrieve2(style.lineHeight, calculatedLineHeight);
|
|
12671
|
-
var bgColorDrawn = !!(style.backgroundColor);
|
|
12672
12861
|
var truncateLineOverflow = style.lineOverflow === 'truncate';
|
|
12673
12862
|
var isTruncated = false;
|
|
12674
12863
|
var width = style.width;
|
|
12864
|
+
if (width == null && defaultOuterWidth != null) {
|
|
12865
|
+
width = defaultOuterWidth - paddingH;
|
|
12866
|
+
}
|
|
12867
|
+
var height = style.height;
|
|
12868
|
+
if (height == null && defaultOuterHeight != null) {
|
|
12869
|
+
height = defaultOuterHeight - paddingV;
|
|
12870
|
+
}
|
|
12675
12871
|
var lines;
|
|
12676
12872
|
if (width != null && (overflow === 'break' || overflow === 'breakAll')) {
|
|
12677
12873
|
lines = text ? wrapText(text, style.font, width, overflow === 'breakAll', 0).lines : [];
|
|
@@ -12680,11 +12876,14 @@
|
|
|
12680
12876
|
lines = text ? text.split('\n') : [];
|
|
12681
12877
|
}
|
|
12682
12878
|
var contentHeight = lines.length * lineHeight;
|
|
12683
|
-
|
|
12879
|
+
if (height == null) {
|
|
12880
|
+
height = contentHeight;
|
|
12881
|
+
}
|
|
12684
12882
|
if (contentHeight > height && truncateLineOverflow) {
|
|
12685
12883
|
var lineCount = Math.floor(height / lineHeight);
|
|
12686
12884
|
isTruncated = isTruncated || (lines.length > lineCount);
|
|
12687
12885
|
lines = lines.slice(0, lineCount);
|
|
12886
|
+
contentHeight = lines.length * lineHeight;
|
|
12688
12887
|
}
|
|
12689
12888
|
if (text && truncate && width != null) {
|
|
12690
12889
|
var options = prepareTruncateOptions(width, font, style.ellipsis, {
|
|
@@ -12700,21 +12899,16 @@
|
|
|
12700
12899
|
}
|
|
12701
12900
|
var outerHeight = height;
|
|
12702
12901
|
var contentWidth = 0;
|
|
12902
|
+
var fontMeasureInfo = ensureFontMeasureInfo(font);
|
|
12703
12903
|
for (var i = 0; i < lines.length; i++) {
|
|
12704
|
-
contentWidth = Math.max(
|
|
12904
|
+
contentWidth = Math.max(measureWidth(fontMeasureInfo, lines[i]), contentWidth);
|
|
12705
12905
|
}
|
|
12706
12906
|
if (width == null) {
|
|
12707
12907
|
width = contentWidth;
|
|
12708
12908
|
}
|
|
12709
|
-
var outerWidth =
|
|
12710
|
-
|
|
12711
|
-
|
|
12712
|
-
outerWidth += padding[1] + padding[3];
|
|
12713
|
-
width += padding[1] + padding[3];
|
|
12714
|
-
}
|
|
12715
|
-
if (bgColorDrawn) {
|
|
12716
|
-
outerWidth = width;
|
|
12717
|
-
}
|
|
12909
|
+
var outerWidth = width;
|
|
12910
|
+
outerHeight += paddingV;
|
|
12911
|
+
outerWidth += paddingH;
|
|
12718
12912
|
return {
|
|
12719
12913
|
lines: lines,
|
|
12720
12914
|
height: height,
|
|
@@ -12755,14 +12949,23 @@
|
|
|
12755
12949
|
}
|
|
12756
12950
|
return RichTextContentBlock;
|
|
12757
12951
|
}());
|
|
12758
|
-
function parseRichText(text, style) {
|
|
12952
|
+
function parseRichText(text, style, defaultOuterWidth, defaultOuterHeight, topTextAlign) {
|
|
12759
12953
|
var contentBlock = new RichTextContentBlock();
|
|
12760
12954
|
text != null && (text += '');
|
|
12761
12955
|
if (!text) {
|
|
12762
12956
|
return contentBlock;
|
|
12763
12957
|
}
|
|
12958
|
+
var stlPadding = style.padding;
|
|
12959
|
+
var stlPaddingH = stlPadding ? stlPadding[1] + stlPadding[3] : 0;
|
|
12960
|
+
var stlPaddingV = stlPadding ? stlPadding[0] + stlPadding[2] : 0;
|
|
12764
12961
|
var topWidth = style.width;
|
|
12962
|
+
if (topWidth == null && defaultOuterWidth != null) {
|
|
12963
|
+
topWidth = defaultOuterWidth - stlPaddingH;
|
|
12964
|
+
}
|
|
12765
12965
|
var topHeight = style.height;
|
|
12966
|
+
if (topHeight == null && defaultOuterHeight != null) {
|
|
12967
|
+
topHeight = defaultOuterHeight - stlPaddingV;
|
|
12968
|
+
}
|
|
12766
12969
|
var overflow = style.overflow;
|
|
12767
12970
|
var wrapInfo = (overflow === 'break' || overflow === 'breakAll') && topWidth != null
|
|
12768
12971
|
? { width: topWidth, accumWidth: 0, breakAll: overflow === 'breakAll' }
|
|
@@ -12783,7 +12986,6 @@
|
|
|
12783
12986
|
var pendingList = [];
|
|
12784
12987
|
var calculatedHeight = 0;
|
|
12785
12988
|
var calculatedWidth = 0;
|
|
12786
|
-
var stlPadding = style.padding;
|
|
12787
12989
|
var truncate = overflow === 'truncate';
|
|
12788
12990
|
var truncateLine = style.lineOverflow === 'truncate';
|
|
12789
12991
|
var tmpTruncateOut = {};
|
|
@@ -12809,7 +13011,7 @@
|
|
|
12809
13011
|
textPadding && (tokenHeight += textPadding[0] + textPadding[2]);
|
|
12810
13012
|
token.height = tokenHeight;
|
|
12811
13013
|
token.lineHeight = retrieve3(tokenStyle.lineHeight, style.lineHeight, tokenHeight);
|
|
12812
|
-
token.align = tokenStyle && tokenStyle.align ||
|
|
13014
|
+
token.align = tokenStyle && tokenStyle.align || topTextAlign;
|
|
12813
13015
|
token.verticalAlign = tokenStyle && tokenStyle.verticalAlign || 'middle';
|
|
12814
13016
|
if (truncateLine && topHeight != null && calculatedHeight + token.lineHeight > topHeight) {
|
|
12815
13017
|
var originalLength = contentBlock.lines.length;
|
|
@@ -12829,7 +13031,7 @@
|
|
|
12829
13031
|
if (typeof styleTokenWidth === 'string' && styleTokenWidth.charAt(styleTokenWidth.length - 1) === '%') {
|
|
12830
13032
|
token.percentWidth = styleTokenWidth;
|
|
12831
13033
|
pendingList.push(token);
|
|
12832
|
-
token.contentWidth =
|
|
13034
|
+
token.contentWidth = measureWidth(ensureFontMeasureInfo(font), token.text);
|
|
12833
13035
|
}
|
|
12834
13036
|
else {
|
|
12835
13037
|
if (tokenWidthNotSpecified) {
|
|
@@ -12853,11 +13055,11 @@
|
|
|
12853
13055
|
truncateText2(tmpTruncateOut, token.text, remainTruncWidth - paddingH, font, style.ellipsis, { minChar: style.truncateMinChar });
|
|
12854
13056
|
token.text = tmpTruncateOut.text;
|
|
12855
13057
|
contentBlock.isTruncated = contentBlock.isTruncated || tmpTruncateOut.isTruncated;
|
|
12856
|
-
token.width = token.contentWidth =
|
|
13058
|
+
token.width = token.contentWidth = measureWidth(ensureFontMeasureInfo(font), token.text);
|
|
12857
13059
|
}
|
|
12858
13060
|
}
|
|
12859
13061
|
else {
|
|
12860
|
-
token.contentWidth =
|
|
13062
|
+
token.contentWidth = measureWidth(ensureFontMeasureInfo(font), token.text);
|
|
12861
13063
|
}
|
|
12862
13064
|
}
|
|
12863
13065
|
token.width += paddingH;
|
|
@@ -12870,10 +13072,8 @@
|
|
|
12870
13072
|
contentBlock.outerHeight = contentBlock.height = retrieve2(topHeight, calculatedHeight);
|
|
12871
13073
|
contentBlock.contentHeight = calculatedHeight;
|
|
12872
13074
|
contentBlock.contentWidth = calculatedWidth;
|
|
12873
|
-
|
|
12874
|
-
|
|
12875
|
-
contentBlock.outerHeight += stlPadding[0] + stlPadding[2];
|
|
12876
|
-
}
|
|
13075
|
+
contentBlock.outerWidth += stlPaddingH;
|
|
13076
|
+
contentBlock.outerHeight += stlPaddingV;
|
|
12877
13077
|
for (var i = 0; i < pendingList.length; i++) {
|
|
12878
13078
|
var token = pendingList[i];
|
|
12879
13079
|
var percentWidth = token.percentWidth;
|
|
@@ -12909,9 +13109,10 @@
|
|
|
12909
13109
|
strLines = res.lines;
|
|
12910
13110
|
}
|
|
12911
13111
|
}
|
|
12912
|
-
|
|
13112
|
+
if (!strLines) {
|
|
12913
13113
|
strLines = str.split('\n');
|
|
12914
13114
|
}
|
|
13115
|
+
var fontMeasureInfo = ensureFontMeasureInfo(font);
|
|
12915
13116
|
for (var i = 0; i < strLines.length; i++) {
|
|
12916
13117
|
var text = strLines[i];
|
|
12917
13118
|
var token = new RichTextToken();
|
|
@@ -12924,7 +13125,7 @@
|
|
|
12924
13125
|
else {
|
|
12925
13126
|
token.width = linesWidths
|
|
12926
13127
|
? linesWidths[i]
|
|
12927
|
-
:
|
|
13128
|
+
: measureWidth(fontMeasureInfo, text);
|
|
12928
13129
|
}
|
|
12929
13130
|
if (!i && !newLine) {
|
|
12930
13131
|
var tokens = (lines[lines.length - 1] || (lines[0] = new RichTextLine())).tokens;
|
|
@@ -12965,6 +13166,7 @@
|
|
|
12965
13166
|
var currentWord = '';
|
|
12966
13167
|
var currentWordWidth = 0;
|
|
12967
13168
|
var accumWidth = 0;
|
|
13169
|
+
var fontMeasureInfo = ensureFontMeasureInfo(font);
|
|
12968
13170
|
for (var i = 0; i < text.length; i++) {
|
|
12969
13171
|
var ch = text.charAt(i);
|
|
12970
13172
|
if (ch === '\n') {
|
|
@@ -12980,7 +13182,7 @@
|
|
|
12980
13182
|
accumWidth = 0;
|
|
12981
13183
|
continue;
|
|
12982
13184
|
}
|
|
12983
|
-
var chWidth =
|
|
13185
|
+
var chWidth = measureCharWidth(fontMeasureInfo, ch.charCodeAt(0));
|
|
12984
13186
|
var inWord = isBreakAll ? false : !isWordBreakChar(ch);
|
|
12985
13187
|
if (!lines.length
|
|
12986
13188
|
? lastAccumWidth + accumWidth + chWidth > lineWidth
|
|
@@ -13040,11 +13242,6 @@
|
|
|
13040
13242
|
line += ch;
|
|
13041
13243
|
}
|
|
13042
13244
|
}
|
|
13043
|
-
if (!lines.length && !line) {
|
|
13044
|
-
line = text;
|
|
13045
|
-
currentWord = '';
|
|
13046
|
-
currentWordWidth = 0;
|
|
13047
|
-
}
|
|
13048
13245
|
if (currentWord) {
|
|
13049
13246
|
line += currentWord;
|
|
13050
13247
|
}
|
|
@@ -13060,12 +13257,32 @@
|
|
|
13060
13257
|
lines: lines,
|
|
13061
13258
|
linesWidths: linesWidths
|
|
13062
13259
|
};
|
|
13063
|
-
}
|
|
13260
|
+
}
|
|
13261
|
+
function calcInnerTextOverflowArea(out, overflowRect, baseX, baseY, textAlign, textVerticalAlign) {
|
|
13262
|
+
out.baseX = baseX;
|
|
13263
|
+
out.baseY = baseY;
|
|
13264
|
+
out.outerWidth = out.outerHeight = null;
|
|
13265
|
+
if (!overflowRect) {
|
|
13266
|
+
return;
|
|
13267
|
+
}
|
|
13268
|
+
var textWidth = overflowRect.width * 2;
|
|
13269
|
+
var textHeight = overflowRect.height * 2;
|
|
13270
|
+
BoundingRect.set(tmpCITCTextRect, adjustTextX(baseX, textWidth, textAlign), adjustTextY$1(baseY, textHeight, textVerticalAlign), textWidth, textHeight);
|
|
13271
|
+
BoundingRect.intersect(overflowRect, tmpCITCTextRect, null, tmpCITCIntersectRectOpt);
|
|
13272
|
+
var outIntersectRect = tmpCITCIntersectRectOpt.outIntersectRect;
|
|
13273
|
+
out.outerWidth = outIntersectRect.width;
|
|
13274
|
+
out.outerHeight = outIntersectRect.height;
|
|
13275
|
+
out.baseX = adjustTextX(outIntersectRect.x, outIntersectRect.width, textAlign, true);
|
|
13276
|
+
out.baseY = adjustTextY$1(outIntersectRect.y, outIntersectRect.height, textVerticalAlign, true);
|
|
13277
|
+
}
|
|
13278
|
+
var tmpCITCTextRect = new BoundingRect(0, 0, 0, 0);
|
|
13279
|
+
var tmpCITCIntersectRectOpt = { outIntersectRect: {}, clamp: true };
|
|
13064
13280
|
|
|
13065
13281
|
var DEFAULT_RICH_TEXT_COLOR = {
|
|
13066
13282
|
fill: '#000'
|
|
13067
13283
|
};
|
|
13068
13284
|
var DEFAULT_STROKE_LINE_WIDTH = 2;
|
|
13285
|
+
var tmpCITOverflowAreaOut = {};
|
|
13069
13286
|
var DEFAULT_TEXT_ANIMATION_PROPS = {
|
|
13070
13287
|
style: defaults({
|
|
13071
13288
|
fill: true,
|
|
@@ -13239,8 +13456,16 @@
|
|
|
13239
13456
|
var style = this.style;
|
|
13240
13457
|
var textFont = style.font || DEFAULT_FONT;
|
|
13241
13458
|
var textPadding = style.padding;
|
|
13459
|
+
var defaultStyle = this._defaultStyle;
|
|
13460
|
+
var baseX = style.x || 0;
|
|
13461
|
+
var baseY = style.y || 0;
|
|
13462
|
+
var textAlign = style.align || defaultStyle.align || 'left';
|
|
13463
|
+
var verticalAlign = style.verticalAlign || defaultStyle.verticalAlign || 'top';
|
|
13464
|
+
calcInnerTextOverflowArea(tmpCITOverflowAreaOut, defaultStyle.overflowRect, baseX, baseY, textAlign, verticalAlign);
|
|
13465
|
+
baseX = tmpCITOverflowAreaOut.baseX;
|
|
13466
|
+
baseY = tmpCITOverflowAreaOut.baseY;
|
|
13242
13467
|
var text = getStyleText(style);
|
|
13243
|
-
var contentBlock = parsePlainText(text, style);
|
|
13468
|
+
var contentBlock = parsePlainText(text, style, tmpCITOverflowAreaOut.outerWidth, tmpCITOverflowAreaOut.outerHeight);
|
|
13244
13469
|
var needDrawBg = needDrawBackground(style);
|
|
13245
13470
|
var bgColorDrawn = !!(style.backgroundColor);
|
|
13246
13471
|
var outerHeight = contentBlock.outerHeight;
|
|
@@ -13248,12 +13473,7 @@
|
|
|
13248
13473
|
var contentWidth = contentBlock.contentWidth;
|
|
13249
13474
|
var textLines = contentBlock.lines;
|
|
13250
13475
|
var lineHeight = contentBlock.lineHeight;
|
|
13251
|
-
var defaultStyle = this._defaultStyle;
|
|
13252
13476
|
this.isTruncated = !!contentBlock.isTruncated;
|
|
13253
|
-
var baseX = style.x || 0;
|
|
13254
|
-
var baseY = style.y || 0;
|
|
13255
|
-
var textAlign = style.align || defaultStyle.align || 'left';
|
|
13256
|
-
var verticalAlign = style.verticalAlign || defaultStyle.verticalAlign || 'top';
|
|
13257
13477
|
var textX = baseX;
|
|
13258
13478
|
var textY = adjustTextY$1(baseY, contentBlock.contentHeight, verticalAlign);
|
|
13259
13479
|
if (needDrawBg || textPadding) {
|
|
@@ -13322,17 +13542,20 @@
|
|
|
13322
13542
|
};
|
|
13323
13543
|
ZRText.prototype._updateRichTexts = function () {
|
|
13324
13544
|
var style = this.style;
|
|
13545
|
+
var defaultStyle = this._defaultStyle;
|
|
13546
|
+
var textAlign = style.align || defaultStyle.align;
|
|
13547
|
+
var verticalAlign = style.verticalAlign || defaultStyle.verticalAlign;
|
|
13548
|
+
var baseX = style.x || 0;
|
|
13549
|
+
var baseY = style.y || 0;
|
|
13550
|
+
calcInnerTextOverflowArea(tmpCITOverflowAreaOut, defaultStyle.overflowRect, baseX, baseY, textAlign, verticalAlign);
|
|
13551
|
+
baseX = tmpCITOverflowAreaOut.baseX;
|
|
13552
|
+
baseY = tmpCITOverflowAreaOut.baseY;
|
|
13325
13553
|
var text = getStyleText(style);
|
|
13326
|
-
var contentBlock = parseRichText(text, style);
|
|
13554
|
+
var contentBlock = parseRichText(text, style, tmpCITOverflowAreaOut.outerWidth, tmpCITOverflowAreaOut.outerHeight, textAlign);
|
|
13327
13555
|
var contentWidth = contentBlock.width;
|
|
13328
13556
|
var outerWidth = contentBlock.outerWidth;
|
|
13329
13557
|
var outerHeight = contentBlock.outerHeight;
|
|
13330
13558
|
var textPadding = style.padding;
|
|
13331
|
-
var baseX = style.x || 0;
|
|
13332
|
-
var baseY = style.y || 0;
|
|
13333
|
-
var defaultStyle = this._defaultStyle;
|
|
13334
|
-
var textAlign = style.align || defaultStyle.align;
|
|
13335
|
-
var verticalAlign = style.verticalAlign || defaultStyle.verticalAlign;
|
|
13336
13559
|
this.isTruncated = !!contentBlock.isTruncated;
|
|
13337
13560
|
var boxX = adjustTextX(baseX, outerWidth, textAlign);
|
|
13338
13561
|
var boxY = adjustTextY$1(baseY, outerHeight, verticalAlign);
|
|
@@ -14058,10 +14281,14 @@
|
|
|
14058
14281
|
return Pattern;
|
|
14059
14282
|
}());
|
|
14060
14283
|
|
|
14061
|
-
var
|
|
14062
|
-
var
|
|
14063
|
-
var
|
|
14064
|
-
var
|
|
14284
|
+
var mathMin$4 = Math.min;
|
|
14285
|
+
var mathMax$4 = Math.max;
|
|
14286
|
+
var mathAbs$3 = Math.abs;
|
|
14287
|
+
var _extent = [0, 0];
|
|
14288
|
+
var _extent2 = [0, 0];
|
|
14289
|
+
var _intersectCtx$1 = createIntersectContext();
|
|
14290
|
+
var _minTv$1 = _intersectCtx$1.minTv;
|
|
14291
|
+
var _maxTv$1 = _intersectCtx$1.maxTv;
|
|
14065
14292
|
var OrientedBoundingRect = (function () {
|
|
14066
14293
|
function OrientedBoundingRect(rect, transform) {
|
|
14067
14294
|
this._corners = [];
|
|
@@ -14101,59 +14328,69 @@
|
|
|
14101
14328
|
this._origin[i] = axes[i].dot(corners[0]);
|
|
14102
14329
|
}
|
|
14103
14330
|
};
|
|
14104
|
-
OrientedBoundingRect.prototype.intersect = function (other, mtv) {
|
|
14331
|
+
OrientedBoundingRect.prototype.intersect = function (other, mtv, opt) {
|
|
14105
14332
|
var overlapped = true;
|
|
14106
14333
|
var noMtv = !mtv;
|
|
14107
|
-
|
|
14108
|
-
|
|
14109
|
-
|
|
14334
|
+
if (mtv) {
|
|
14335
|
+
Point.set(mtv, 0, 0);
|
|
14336
|
+
}
|
|
14337
|
+
_intersectCtx$1.reset(opt, !noMtv);
|
|
14338
|
+
if (!this._intersectCheckOneSide(this, other, noMtv, 1)) {
|
|
14110
14339
|
overlapped = false;
|
|
14111
14340
|
if (noMtv) {
|
|
14112
14341
|
return overlapped;
|
|
14113
14342
|
}
|
|
14114
14343
|
}
|
|
14115
|
-
if (!this._intersectCheckOneSide(other, this,
|
|
14344
|
+
if (!this._intersectCheckOneSide(other, this, noMtv, -1)) {
|
|
14116
14345
|
overlapped = false;
|
|
14117
14346
|
if (noMtv) {
|
|
14118
14347
|
return overlapped;
|
|
14119
14348
|
}
|
|
14120
14349
|
}
|
|
14121
|
-
if (!noMtv) {
|
|
14122
|
-
Point.copy(mtv, overlapped
|
|
14350
|
+
if (!noMtv && !_intersectCtx$1.negativeSize) {
|
|
14351
|
+
Point.copy(mtv, overlapped
|
|
14352
|
+
? (_intersectCtx$1.useDir ? _intersectCtx$1.dirMinTv : _minTv$1)
|
|
14353
|
+
: _maxTv$1);
|
|
14123
14354
|
}
|
|
14124
14355
|
return overlapped;
|
|
14125
14356
|
};
|
|
14126
|
-
OrientedBoundingRect.prototype._intersectCheckOneSide = function (self, other,
|
|
14357
|
+
OrientedBoundingRect.prototype._intersectCheckOneSide = function (self, other, noMtv, inverse) {
|
|
14127
14358
|
var overlapped = true;
|
|
14128
14359
|
for (var i = 0; i < 2; i++) {
|
|
14129
|
-
var axis =
|
|
14130
|
-
|
|
14131
|
-
|
|
14132
|
-
if (
|
|
14360
|
+
var axis = self._axes[i];
|
|
14361
|
+
self._getProjMinMaxOnAxis(i, self._corners, _extent);
|
|
14362
|
+
self._getProjMinMaxOnAxis(i, other._corners, _extent2);
|
|
14363
|
+
if (_intersectCtx$1.negativeSize || _extent[1] < _extent2[0] || _extent[0] > _extent2[1]) {
|
|
14133
14364
|
overlapped = false;
|
|
14134
|
-
if (noMtv) {
|
|
14365
|
+
if (_intersectCtx$1.negativeSize || noMtv) {
|
|
14135
14366
|
return overlapped;
|
|
14136
14367
|
}
|
|
14137
|
-
var dist0 =
|
|
14138
|
-
var dist1 =
|
|
14139
|
-
if (
|
|
14368
|
+
var dist0 = mathAbs$3(_extent2[0] - _extent[1]);
|
|
14369
|
+
var dist1 = mathAbs$3(_extent[0] - _extent2[1]);
|
|
14370
|
+
if (mathMin$4(dist0, dist1) > _maxTv$1.len()) {
|
|
14140
14371
|
if (dist0 < dist1) {
|
|
14141
|
-
Point.scale(
|
|
14372
|
+
Point.scale(_maxTv$1, axis, -dist0 * inverse);
|
|
14142
14373
|
}
|
|
14143
14374
|
else {
|
|
14144
|
-
Point.scale(
|
|
14375
|
+
Point.scale(_maxTv$1, axis, dist1 * inverse);
|
|
14145
14376
|
}
|
|
14146
14377
|
}
|
|
14147
14378
|
}
|
|
14148
|
-
else if (
|
|
14149
|
-
var dist0 =
|
|
14150
|
-
var dist1 =
|
|
14151
|
-
if (
|
|
14152
|
-
if (dist0 < dist1) {
|
|
14153
|
-
Point.scale(
|
|
14379
|
+
else if (!noMtv) {
|
|
14380
|
+
var dist0 = mathAbs$3(_extent2[0] - _extent[1]);
|
|
14381
|
+
var dist1 = mathAbs$3(_extent[0] - _extent2[1]);
|
|
14382
|
+
if (_intersectCtx$1.useDir || mathMin$4(dist0, dist1) < _minTv$1.len()) {
|
|
14383
|
+
if (dist0 < dist1 || !_intersectCtx$1.bidirectional) {
|
|
14384
|
+
Point.scale(_minTv$1, axis, dist0 * inverse);
|
|
14385
|
+
if (_intersectCtx$1.useDir) {
|
|
14386
|
+
_intersectCtx$1.calcDirMTV();
|
|
14387
|
+
}
|
|
14154
14388
|
}
|
|
14155
|
-
|
|
14156
|
-
Point.scale(
|
|
14389
|
+
if (dist0 >= dist1 || !_intersectCtx$1.bidirectional) {
|
|
14390
|
+
Point.scale(_minTv$1, axis, -dist1 * inverse);
|
|
14391
|
+
if (_intersectCtx$1.useDir) {
|
|
14392
|
+
_intersectCtx$1.calcDirMTV();
|
|
14393
|
+
}
|
|
14157
14394
|
}
|
|
14158
14395
|
}
|
|
14159
14396
|
}
|
|
@@ -14168,11 +14405,12 @@
|
|
|
14168
14405
|
var max = proj;
|
|
14169
14406
|
for (var i = 1; i < corners.length; i++) {
|
|
14170
14407
|
var proj_1 = corners[i].dot(axis) + origin[dim];
|
|
14171
|
-
min =
|
|
14172
|
-
max =
|
|
14408
|
+
min = mathMin$4(proj_1, min);
|
|
14409
|
+
max = mathMax$4(proj_1, max);
|
|
14173
14410
|
}
|
|
14174
|
-
out[0] = min;
|
|
14175
|
-
out[1] = max;
|
|
14411
|
+
out[0] = min + _intersectCtx$1.touchThreshold;
|
|
14412
|
+
out[1] = max - _intersectCtx$1.touchThreshold;
|
|
14413
|
+
_intersectCtx$1.negativeSize = out[1] < out[0];
|
|
14176
14414
|
};
|
|
14177
14415
|
return OrientedBoundingRect;
|
|
14178
14416
|
}());
|