zrender-nightly 5.7.0-dev.20250620 → 5.7.0-dev.20250622
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/README.md +1 -1
- package/build/prepublish.js +20 -0
- package/dist/zrender.js +563 -277
- 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/canvas/graphic.js +1 -1
- 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/dom.d.ts +1 -0
- package/lib/core/dom.js +17 -0
- package/lib/core/env.js +15 -10
- package/lib/core/types.d.ts +1 -0
- package/lib/core/util.d.ts +1 -0
- package/lib/core/util.js +2 -1
- package/lib/graphic/Displayable.js +1 -1
- package/lib/graphic/Text.d.ts +4 -2
- package/lib/graphic/Text.js +23 -14
- package/lib/graphic/helper/parseText.d.ts +13 -4
- package/lib/graphic/helper/parseText.js +110 -54
- package/lib/svg-legacy/helper/ClippathManager.js +6 -6
- package/lib/tool/color.d.ts +3 -1
- package/lib/tool/color.js +6 -6
- package/lib/tool/parseSVG.js +11 -0
- 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/graphic.ts +1 -1
- 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/dom.ts +24 -0
- package/src/core/env.ts +31 -24
- package/src/core/matrix.ts +2 -1
- package/src/core/types.ts +2 -0
- package/src/core/util.ts +4 -2
- package/src/graphic/Displayable.ts +1 -3
- package/src/graphic/Group.ts +2 -0
- package/src/graphic/Text.ts +68 -21
- package/src/graphic/helper/parseText.ts +211 -83
- package/src/svg-legacy/helper/ClippathManager.ts +5 -5
- package/src/tool/color.ts +15 -11
- package/src/tool/parseSVG.ts +12 -1
- package/src/tool/path.ts +9 -4
- package/src/zrender.ts +1 -1
package/dist/zrender.js
CHANGED
@@ -38,7 +38,10 @@
|
|
38
38
|
else if (typeof document === 'undefined' && typeof self !== 'undefined') {
|
39
39
|
env.worker = true;
|
40
40
|
}
|
41
|
-
else if (!env.hasGlobalWindow
|
41
|
+
else if (!env.hasGlobalWindow
|
42
|
+
|| 'Deno' in window
|
43
|
+
|| (typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string'
|
44
|
+
&& navigator.userAgent.indexOf('Node.js') > -1)) {
|
42
45
|
env.node = true;
|
43
46
|
env.svgSupported = true;
|
44
47
|
}
|
@@ -72,15 +75,17 @@
|
|
72
75
|
env.touchEventsSupported = 'ontouchstart' in window && !browser.ie && !browser.edge;
|
73
76
|
env.pointerEventsSupported = 'onpointerdown' in window
|
74
77
|
&& (browser.edge || (browser.ie && +browser.version >= 11));
|
75
|
-
env.domSupported = typeof document !== 'undefined';
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
78
|
+
var domSupported = env.domSupported = typeof document !== 'undefined';
|
79
|
+
if (domSupported) {
|
80
|
+
var style = document.documentElement.style;
|
81
|
+
env.transform3dSupported = ((browser.ie && 'transition' in style)
|
82
|
+
|| browser.edge
|
83
|
+
|| (('WebKitCSSMatrix' in window) && ('m11' in new WebKitCSSMatrix()))
|
84
|
+
|| 'MozPerspective' in style)
|
85
|
+
&& !('OTransition' in style);
|
86
|
+
env.transformSupported = env.transform3dSupported
|
87
|
+
|| (browser.ie && +browser.version >= 9);
|
88
|
+
}
|
84
89
|
}
|
85
90
|
|
86
91
|
var DEFAULT_FONT_SIZE = 12;
|
@@ -292,7 +297,7 @@
|
|
292
297
|
}
|
293
298
|
function defaults(target, source, overlay) {
|
294
299
|
var keysArr = keys(source);
|
295
|
-
for (var i = 0
|
300
|
+
for (var i = 0, len = keysArr.length; i < len; i++) {
|
296
301
|
var key = keysArr[i];
|
297
302
|
if ((overlay ? source[key] != null : target[key] == null)) {
|
298
303
|
target[key] = source[key];
|
@@ -694,7 +699,8 @@
|
|
694
699
|
return own.hasOwnProperty(prop);
|
695
700
|
}
|
696
701
|
function noop() { }
|
697
|
-
var RADIAN_TO_DEGREE = 180 / Math.PI;
|
702
|
+
var RADIAN_TO_DEGREE = 180 / Math.PI;
|
703
|
+
var EPSILON = Number.EPSILON || Math.pow(2, -52);
|
698
704
|
|
699
705
|
var util = /*#__PURE__*/Object.freeze({
|
700
706
|
__proto__: null,
|
@@ -747,7 +753,8 @@
|
|
747
753
|
disableUserSelect: disableUserSelect,
|
748
754
|
hasOwn: hasOwn,
|
749
755
|
noop: noop,
|
750
|
-
RADIAN_TO_DEGREE: RADIAN_TO_DEGREE
|
756
|
+
RADIAN_TO_DEGREE: RADIAN_TO_DEGREE,
|
757
|
+
EPSILON: EPSILON
|
751
758
|
});
|
752
759
|
|
753
760
|
/*! *****************************************************************************
|
@@ -1253,6 +1260,11 @@
|
|
1253
1260
|
el.appendChild(marker);
|
1254
1261
|
markers.push(marker);
|
1255
1262
|
}
|
1263
|
+
saved.clearMarkers = function () {
|
1264
|
+
each(markers, function (marker) {
|
1265
|
+
marker.parentNode && marker.parentNode.removeChild(marker);
|
1266
|
+
});
|
1267
|
+
};
|
1256
1268
|
return markers;
|
1257
1269
|
}
|
1258
1270
|
function preparePointerTransformer(markers, saved, inverse) {
|
@@ -1723,14 +1735,22 @@
|
|
1723
1735
|
|
1724
1736
|
var mathMin = Math.min;
|
1725
1737
|
var mathMax = Math.max;
|
1738
|
+
var mathAbs = Math.abs;
|
1739
|
+
var XY = ['x', 'y'];
|
1740
|
+
var WH = ['width', 'height'];
|
1726
1741
|
var lt = new Point();
|
1727
1742
|
var rb = new Point();
|
1728
1743
|
var lb = new Point();
|
1729
1744
|
var rt = new Point();
|
1730
|
-
var
|
1731
|
-
var
|
1745
|
+
var _intersectCtx = createIntersectContext();
|
1746
|
+
var _minTv = _intersectCtx.minTv;
|
1747
|
+
var _maxTv = _intersectCtx.maxTv;
|
1748
|
+
var _lenMinMax = [0, 0];
|
1732
1749
|
var BoundingRect = (function () {
|
1733
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) {
|
1734
1754
|
if (width < 0) {
|
1735
1755
|
x = x + width;
|
1736
1756
|
width = -width;
|
@@ -1739,11 +1759,12 @@
|
|
1739
1759
|
y = y + height;
|
1740
1760
|
height = -height;
|
1741
1761
|
}
|
1742
|
-
|
1743
|
-
|
1744
|
-
|
1745
|
-
|
1746
|
-
|
1762
|
+
target.x = x;
|
1763
|
+
target.y = y;
|
1764
|
+
target.width = width;
|
1765
|
+
target.height = height;
|
1766
|
+
return target;
|
1767
|
+
};
|
1747
1768
|
BoundingRect.prototype.union = function (other) {
|
1748
1769
|
var x = mathMin(other.x, this.x);
|
1749
1770
|
var y = mathMin(other.y, this.y);
|
@@ -1775,89 +1796,64 @@
|
|
1775
1796
|
translate(m, m, [b.x, b.y]);
|
1776
1797
|
return m;
|
1777
1798
|
};
|
1778
|
-
BoundingRect.prototype.intersect = function (b, mtv) {
|
1779
|
-
|
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) {
|
1780
1812
|
return false;
|
1781
1813
|
}
|
1814
|
+
if (!(a instanceof BoundingRect)) {
|
1815
|
+
a = BoundingRect.set(_tmpIntersectA, a.x, a.y, a.width, a.height);
|
1816
|
+
}
|
1782
1817
|
if (!(b instanceof BoundingRect)) {
|
1783
|
-
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;
|
1784
1833
|
}
|
1785
|
-
var a = this;
|
1786
|
-
var ax0 = a.x;
|
1787
|
-
var ax1 = a.x + a.width;
|
1788
|
-
var ay0 = a.y;
|
1789
|
-
var ay1 = a.y + a.height;
|
1790
|
-
var bx0 = b.x;
|
1791
|
-
var bx1 = b.x + b.width;
|
1792
|
-
var by0 = b.y;
|
1793
|
-
var by1 = b.y + b.height;
|
1794
1834
|
var overlap = !(ax1 < bx0 || bx1 < ax0 || ay1 < by0 || by1 < ay0);
|
1795
|
-
if (
|
1796
|
-
|
1797
|
-
|
1798
|
-
|
1799
|
-
|
1800
|
-
|
1801
|
-
|
1802
|
-
|
1803
|
-
|
1804
|
-
if (ax1 < bx0 || bx1 < ax0) {
|
1805
|
-
if (dx > dMax) {
|
1806
|
-
dMax = dx;
|
1807
|
-
if (d0 < d1) {
|
1808
|
-
Point.set(maxTv, -d0, 0);
|
1809
|
-
}
|
1810
|
-
else {
|
1811
|
-
Point.set(maxTv, d1, 0);
|
1812
|
-
}
|
1813
|
-
}
|
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);
|
1814
1844
|
}
|
1815
|
-
else {
|
1816
|
-
if (dx < dMin) {
|
1817
|
-
dMin = dx;
|
1818
|
-
if (d0 < d1) {
|
1819
|
-
Point.set(minTv, d0, 0);
|
1820
|
-
}
|
1821
|
-
else {
|
1822
|
-
Point.set(minTv, -d1, 0);
|
1823
|
-
}
|
1824
|
-
}
|
1825
|
-
}
|
1826
|
-
if (ay1 < by0 || by1 < ay0) {
|
1827
|
-
if (dy > dMax) {
|
1828
|
-
dMax = dy;
|
1829
|
-
if (d2 < d3) {
|
1830
|
-
Point.set(maxTv, 0, -d2);
|
1831
|
-
}
|
1832
|
-
else {
|
1833
|
-
Point.set(maxTv, 0, d3);
|
1834
|
-
}
|
1835
|
-
}
|
1836
|
-
}
|
1837
|
-
else {
|
1838
|
-
if (dx < dMin) {
|
1839
|
-
dMin = dx;
|
1840
|
-
if (d2 < d3) {
|
1841
|
-
Point.set(minTv, 0, d2);
|
1842
|
-
}
|
1843
|
-
else {
|
1844
|
-
Point.set(minTv, 0, -d3);
|
1845
|
-
}
|
1846
|
-
}
|
1847
|
-
}
|
1848
|
-
}
|
1849
|
-
if (mtv) {
|
1850
|
-
Point.copy(mtv, overlap ? minTv : maxTv);
|
1851
1845
|
}
|
1852
1846
|
return overlap;
|
1853
1847
|
};
|
1854
|
-
BoundingRect.
|
1855
|
-
var rect = this;
|
1848
|
+
BoundingRect.contain = function (rect, x, y) {
|
1856
1849
|
return x >= rect.x
|
1857
1850
|
&& x <= (rect.x + rect.width)
|
1858
1851
|
&& y >= rect.y
|
1859
1852
|
&& y <= (rect.y + rect.height);
|
1860
1853
|
};
|
1854
|
+
BoundingRect.prototype.contain = function (x, y) {
|
1855
|
+
return BoundingRect.contain(this, x, y);
|
1856
|
+
};
|
1861
1857
|
BoundingRect.prototype.clone = function () {
|
1862
1858
|
return new BoundingRect(this.x, this.y, this.width, this.height);
|
1863
1859
|
};
|
@@ -1889,6 +1885,7 @@
|
|
1889
1885
|
target.y = source.y;
|
1890
1886
|
target.width = source.width;
|
1891
1887
|
target.height = source.height;
|
1888
|
+
return target;
|
1892
1889
|
};
|
1893
1890
|
BoundingRect.applyTransform = function (target, source, m) {
|
1894
1891
|
if (!m) {
|
@@ -1932,7 +1929,128 @@
|
|
1932
1929
|
target.height = maxY - target.y;
|
1933
1930
|
};
|
1934
1931
|
return BoundingRect;
|
1935
|
-
}());
|
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
|
+
}
|
1936
2054
|
|
1937
2055
|
var SILENT = 'silent';
|
1938
2056
|
function makeEventPacket(eveType, targetInfo, event) {
|
@@ -2195,7 +2313,7 @@
|
|
2195
2313
|
isSilent = true;
|
2196
2314
|
}
|
2197
2315
|
var hostEl = el.__hostTarget;
|
2198
|
-
el = hostEl ? hostEl : el.parent;
|
2316
|
+
el = hostEl ? (el.ignoreHostSilent ? null : hostEl) : el.parent;
|
2199
2317
|
}
|
2200
2318
|
return isSilent ? SILENT : true;
|
2201
2319
|
}
|
@@ -2795,7 +2913,7 @@
|
|
2795
2913
|
displayList.length = this._displayListLen;
|
2796
2914
|
sort(displayList, shapeCompareFunc);
|
2797
2915
|
};
|
2798
|
-
Storage.prototype._updateAndAddDisplayable = function (el,
|
2916
|
+
Storage.prototype._updateAndAddDisplayable = function (el, parentClipPaths, includeIgnore) {
|
2799
2917
|
if (el.ignore && !includeIgnore) {
|
2800
2918
|
return;
|
2801
2919
|
}
|
@@ -2803,26 +2921,32 @@
|
|
2803
2921
|
el.update();
|
2804
2922
|
el.afterUpdate();
|
2805
2923
|
var userSetClipPath = el.getClipPath();
|
2806
|
-
|
2807
|
-
|
2808
|
-
|
2809
|
-
|
2810
|
-
|
2811
|
-
|
2812
|
-
|
2813
|
-
|
2814
|
-
|
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
|
+
}
|
2815
2936
|
}
|
2816
2937
|
var currentClipPath = userSetClipPath;
|
2817
2938
|
var parentClipPath = el;
|
2818
2939
|
while (currentClipPath) {
|
2819
2940
|
currentClipPath.parent = parentClipPath;
|
2820
2941
|
currentClipPath.updateTransform();
|
2821
|
-
|
2942
|
+
thisClipPaths[clipPathIdx++] = currentClipPath;
|
2822
2943
|
parentClipPath = currentClipPath;
|
2823
2944
|
currentClipPath = currentClipPath.getClipPath();
|
2824
2945
|
}
|
2825
2946
|
}
|
2947
|
+
if (thisClipPaths) {
|
2948
|
+
thisClipPaths.length = clipPathIdx;
|
2949
|
+
}
|
2826
2950
|
if (el.childrenRef) {
|
2827
2951
|
var children = el.childrenRef();
|
2828
2952
|
for (var i = 0; i < children.length; i++) {
|
@@ -2830,18 +2954,12 @@
|
|
2830
2954
|
if (el.__dirty) {
|
2831
2955
|
child.__dirty |= REDRAW_BIT;
|
2832
2956
|
}
|
2833
|
-
this._updateAndAddDisplayable(child,
|
2957
|
+
this._updateAndAddDisplayable(child, thisClipPaths, includeIgnore);
|
2834
2958
|
}
|
2835
2959
|
el.__dirty = 0;
|
2836
2960
|
}
|
2837
2961
|
else {
|
2838
2962
|
var disp = el;
|
2839
|
-
if (clipPaths && clipPaths.length) {
|
2840
|
-
disp.__clipPaths = clipPaths;
|
2841
|
-
}
|
2842
|
-
else if (disp.__clipPaths && disp.__clipPaths.length > 0) {
|
2843
|
-
disp.__clipPaths = [];
|
2844
|
-
}
|
2845
2963
|
if (isNaN(disp.z)) {
|
2846
2964
|
logInvalidZError();
|
2847
2965
|
disp.z = 0;
|
@@ -2858,15 +2976,15 @@
|
|
2858
2976
|
}
|
2859
2977
|
var decalEl = el.getDecalElement && el.getDecalElement();
|
2860
2978
|
if (decalEl) {
|
2861
|
-
this._updateAndAddDisplayable(decalEl,
|
2979
|
+
this._updateAndAddDisplayable(decalEl, thisClipPaths, includeIgnore);
|
2862
2980
|
}
|
2863
2981
|
var textGuide = el.getTextGuideLine();
|
2864
2982
|
if (textGuide) {
|
2865
|
-
this._updateAndAddDisplayable(textGuide,
|
2983
|
+
this._updateAndAddDisplayable(textGuide, thisClipPaths, includeIgnore);
|
2866
2984
|
}
|
2867
2985
|
var textEl = el.getTextContent();
|
2868
2986
|
if (textEl) {
|
2869
|
-
this._updateAndAddDisplayable(textEl,
|
2987
|
+
this._updateAndAddDisplayable(textEl, thisClipPaths, includeIgnore);
|
2870
2988
|
}
|
2871
2989
|
};
|
2872
2990
|
Storage.prototype.addRoot = function (el) {
|
@@ -3110,7 +3228,7 @@
|
|
3110
3228
|
|
3111
3229
|
var mathPow = Math.pow;
|
3112
3230
|
var mathSqrt = Math.sqrt;
|
3113
|
-
var EPSILON = 1e-8;
|
3231
|
+
var EPSILON$1 = 1e-8;
|
3114
3232
|
var EPSILON_NUMERIC = 1e-4;
|
3115
3233
|
var THREE_SQRT = mathSqrt(3);
|
3116
3234
|
var ONE_THIRD = 1 / 3;
|
@@ -3118,10 +3236,10 @@
|
|
3118
3236
|
var _v1 = create();
|
3119
3237
|
var _v2 = create();
|
3120
3238
|
function isAroundZero(val) {
|
3121
|
-
return val > -EPSILON && val < EPSILON;
|
3239
|
+
return val > -EPSILON$1 && val < EPSILON$1;
|
3122
3240
|
}
|
3123
3241
|
function isNotAroundZero(val) {
|
3124
|
-
return val > EPSILON || val < -EPSILON;
|
3242
|
+
return val > EPSILON$1 || val < -EPSILON$1;
|
3125
3243
|
}
|
3126
3244
|
function cubicAt(p0, p1, p2, p3, t) {
|
3127
3245
|
var onet = 1 - t;
|
@@ -4014,9 +4132,9 @@
|
|
4014
4132
|
var colorArr = parse(color);
|
4015
4133
|
if (color) {
|
4016
4134
|
colorArr = rgba2hsla(colorArr);
|
4017
|
-
h != null && (colorArr[0] = clampCssAngle(h));
|
4018
|
-
s != null && (colorArr[1] = parseCssFloat(s));
|
4019
|
-
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));
|
4020
4138
|
return stringify(hsla2rgba(colorArr), 'rgba');
|
4021
4139
|
}
|
4022
4140
|
}
|
@@ -4074,6 +4192,8 @@
|
|
4074
4192
|
|
4075
4193
|
var color = /*#__PURE__*/Object.freeze({
|
4076
4194
|
__proto__: null,
|
4195
|
+
parseCssInt: parseCssInt,
|
4196
|
+
parseCssFloat: parseCssFloat,
|
4077
4197
|
parse: parse,
|
4078
4198
|
lift: lift,
|
4079
4199
|
toHex: toHex,
|
@@ -4107,9 +4227,9 @@
|
|
4107
4227
|
opacity: opacity == null ? 1 : opacity
|
4108
4228
|
};
|
4109
4229
|
}
|
4110
|
-
var EPSILON$
|
4230
|
+
var EPSILON$2 = 1e-4;
|
4111
4231
|
function isAroundZero$1(transform) {
|
4112
|
-
return transform < EPSILON$
|
4232
|
+
return transform < EPSILON$2 && transform > -EPSILON$2;
|
4113
4233
|
}
|
4114
4234
|
function round3(transform) {
|
4115
4235
|
return mathRound(transform * 1e3) / 1e3;
|
@@ -5401,9 +5521,9 @@
|
|
5401
5521
|
var LIGHTER_LABEL_COLOR = '#eee';
|
5402
5522
|
|
5403
5523
|
var mIdentity = identity;
|
5404
|
-
var EPSILON$
|
5524
|
+
var EPSILON$3 = 5e-5;
|
5405
5525
|
function isNotAroundZero$1(val) {
|
5406
|
-
return val > EPSILON$
|
5526
|
+
return val > EPSILON$3 || val < -EPSILON$3;
|
5407
5527
|
}
|
5408
5528
|
var scaleTmp = [];
|
5409
5529
|
var tmpTransform = [];
|
@@ -5641,22 +5761,69 @@
|
|
5641
5761
|
}
|
5642
5762
|
}
|
5643
5763
|
|
5644
|
-
|
5645
|
-
|
5764
|
+
function ensureFontMeasureInfo(font) {
|
5765
|
+
if (!_fontMeasureInfoCache) {
|
5766
|
+
_fontMeasureInfoCache = new LRU(100);
|
5767
|
+
}
|
5646
5768
|
font = font || DEFAULT_FONT;
|
5647
|
-
var
|
5648
|
-
if (!
|
5649
|
-
|
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;
|
5650
5787
|
}
|
5651
|
-
|
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);
|
5652
5819
|
if (width == null) {
|
5653
|
-
width = platformApi.measureText(text, font).width;
|
5654
|
-
|
5820
|
+
width = platformApi.measureText(text, fontMeasureInfo.font).width;
|
5821
|
+
strWidthCache.put(text, width);
|
5655
5822
|
}
|
5656
5823
|
return width;
|
5657
5824
|
}
|
5658
5825
|
function innerGetBoundingRect(text, font, textAlign, textBaseline) {
|
5659
|
-
var width =
|
5826
|
+
var width = measureWidth(ensureFontMeasureInfo(font), text);
|
5660
5827
|
var height = getLineHeight(font);
|
5661
5828
|
var x = adjustTextX(0, width, textAlign);
|
5662
5829
|
var y = adjustTextY$1(0, height, textBaseline);
|
@@ -5678,26 +5845,26 @@
|
|
5678
5845
|
return uniondRect;
|
5679
5846
|
}
|
5680
5847
|
}
|
5681
|
-
function adjustTextX(x, width, textAlign) {
|
5848
|
+
function adjustTextX(x, width, textAlign, inverse) {
|
5682
5849
|
if (textAlign === 'right') {
|
5683
|
-
x -= width;
|
5850
|
+
!inverse ? (x -= width) : (x += width);
|
5684
5851
|
}
|
5685
5852
|
else if (textAlign === 'center') {
|
5686
|
-
x -= width / 2;
|
5853
|
+
!inverse ? (x -= width / 2) : (x += width / 2);
|
5687
5854
|
}
|
5688
5855
|
return x;
|
5689
5856
|
}
|
5690
|
-
function adjustTextY$1(y, height, verticalAlign) {
|
5857
|
+
function adjustTextY$1(y, height, verticalAlign, inverse) {
|
5691
5858
|
if (verticalAlign === 'middle') {
|
5692
|
-
y -= height / 2;
|
5859
|
+
!inverse ? (y -= height / 2) : (y += height / 2);
|
5693
5860
|
}
|
5694
5861
|
else if (verticalAlign === 'bottom') {
|
5695
|
-
y -= height;
|
5862
|
+
!inverse ? (y -= height) : (y += height);
|
5696
5863
|
}
|
5697
5864
|
return y;
|
5698
5865
|
}
|
5699
5866
|
function getLineHeight(font) {
|
5700
|
-
return
|
5867
|
+
return ensureFontMeasureInfo(font).stWideCharWidth;
|
5701
5868
|
}
|
5702
5869
|
function parsePercent(value, maxValue) {
|
5703
5870
|
if (typeof value === 'string') {
|
@@ -5814,6 +5981,7 @@
|
|
5814
5981
|
}, { ignore: false });
|
5815
5982
|
var tmpTextPosCalcRes = {};
|
5816
5983
|
var tmpBoundingRect = new BoundingRect(0, 0, 0, 0);
|
5984
|
+
var tmpInnerTextTrans = [];
|
5817
5985
|
var Element = (function () {
|
5818
5986
|
function Element(props) {
|
5819
5987
|
this.id = guid();
|
@@ -5866,8 +6034,11 @@
|
|
5866
6034
|
innerTransformable.parent = isLocal ? this : null;
|
5867
6035
|
var innerOrigin = false;
|
5868
6036
|
innerTransformable.copyTransform(textEl);
|
5869
|
-
|
5870
|
-
|
6037
|
+
var hasPosition = textConfig.position != null;
|
6038
|
+
var autoOverflowArea = textConfig.autoOverflowArea;
|
6039
|
+
var layoutRect = void 0;
|
6040
|
+
if (autoOverflowArea || hasPosition) {
|
6041
|
+
layoutRect = tmpBoundingRect;
|
5871
6042
|
if (textConfig.layoutRect) {
|
5872
6043
|
layoutRect.copy(textConfig.layoutRect);
|
5873
6044
|
}
|
@@ -5877,6 +6048,8 @@
|
|
5877
6048
|
if (!isLocal) {
|
5878
6049
|
layoutRect.applyTransform(this.transform);
|
5879
6050
|
}
|
6051
|
+
}
|
6052
|
+
if (hasPosition) {
|
5880
6053
|
if (this.calculateTextPosition) {
|
5881
6054
|
this.calculateTextPosition(tmpTextPosCalcRes, textConfig, layoutRect);
|
5882
6055
|
}
|
@@ -5916,10 +6089,21 @@
|
|
5916
6089
|
innerTransformable.originY = -textOffset[1];
|
5917
6090
|
}
|
5918
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
|
+
}
|
5919
6104
|
var isInside = textConfig.inside == null
|
5920
6105
|
? (typeof textConfig.position === 'string' && textConfig.position.indexOf('inside') >= 0)
|
5921
6106
|
: textConfig.inside;
|
5922
|
-
var innerTextDefaultStyle = this._innerTextDefaultStyle || (this._innerTextDefaultStyle = {});
|
5923
6107
|
var textFill = void 0;
|
5924
6108
|
var textStroke = void 0;
|
5925
6109
|
var autoStroke = void 0;
|
@@ -6200,16 +6384,15 @@
|
|
6200
6384
|
}
|
6201
6385
|
};
|
6202
6386
|
Element.prototype.isSilent = function () {
|
6203
|
-
var
|
6204
|
-
|
6205
|
-
|
6206
|
-
|
6207
|
-
isSilent = true;
|
6208
|
-
break;
|
6387
|
+
var el = this;
|
6388
|
+
while (el) {
|
6389
|
+
if (el.silent) {
|
6390
|
+
return true;
|
6209
6391
|
}
|
6210
|
-
|
6392
|
+
var hostEl = el.__hostTarget;
|
6393
|
+
el = hostEl ? (el.ignoreHostSilent ? null : hostEl) : el.parent;
|
6211
6394
|
}
|
6212
|
-
return
|
6395
|
+
return false;
|
6213
6396
|
};
|
6214
6397
|
Element.prototype._updateAnimationTargets = function () {
|
6215
6398
|
for (var i = 0; i < this.animators.length; i++) {
|
@@ -6573,11 +6756,12 @@
|
|
6573
6756
|
elProto.name = '';
|
6574
6757
|
elProto.ignore =
|
6575
6758
|
elProto.silent =
|
6576
|
-
elProto.
|
6577
|
-
elProto.
|
6578
|
-
elProto.
|
6579
|
-
elProto.
|
6580
|
-
elProto.
|
6759
|
+
elProto.ignoreHostSilent =
|
6760
|
+
elProto.isGroup =
|
6761
|
+
elProto.draggable =
|
6762
|
+
elProto.dragging =
|
6763
|
+
elProto.ignoreClip =
|
6764
|
+
elProto.__inHover = false;
|
6581
6765
|
elProto.__dirty = REDRAW_BIT;
|
6582
6766
|
var logs = {};
|
6583
6767
|
function logDeprecatedError(key, xKey, yKey) {
|
@@ -7337,7 +7521,7 @@
|
|
7337
7521
|
function registerSSRDataGetter(getter) {
|
7338
7522
|
ssrDataGetter = getter;
|
7339
7523
|
}
|
7340
|
-
var version = '5.7.0-dev.
|
7524
|
+
var version = '5.7.0-dev.20250622';
|
7341
7525
|
|
7342
7526
|
var STYLE_MAGIC_KEY = '__zr_style_' + Math.round((Math.random() * 10));
|
7343
7527
|
var DEFAULT_COMMON_STYLE = {
|
@@ -7394,7 +7578,7 @@
|
|
7394
7578
|
|| (m && !m[0] && !m[3])) {
|
7395
7579
|
return false;
|
7396
7580
|
}
|
7397
|
-
if (considerClipPath && this.__clipPaths) {
|
7581
|
+
if (considerClipPath && this.__clipPaths && this.__clipPaths.length) {
|
7398
7582
|
for (var i = 0; i < this.__clipPaths.length; ++i) {
|
7399
7583
|
if (this.__clipPaths[i].isZeroArea()) {
|
7400
7584
|
return false;
|
@@ -7800,7 +7984,7 @@
|
|
7800
7984
|
var mathMax$2 = Math.max;
|
7801
7985
|
var mathCos$1 = Math.cos;
|
7802
7986
|
var mathSin$1 = Math.sin;
|
7803
|
-
var mathAbs = Math.abs;
|
7987
|
+
var mathAbs$1 = Math.abs;
|
7804
7988
|
var PI = Math.PI;
|
7805
7989
|
var PI2$1 = PI * 2;
|
7806
7990
|
var hasTypedArray = typeof Float32Array !== 'undefined';
|
@@ -7856,8 +8040,8 @@
|
|
7856
8040
|
PathProxy.prototype.setScale = function (sx, sy, segmentIgnoreThreshold) {
|
7857
8041
|
segmentIgnoreThreshold = segmentIgnoreThreshold || 0;
|
7858
8042
|
if (segmentIgnoreThreshold > 0) {
|
7859
|
-
this._ux = mathAbs(segmentIgnoreThreshold / devicePixelRatio / sx) || 0;
|
7860
|
-
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;
|
7861
8045
|
}
|
7862
8046
|
};
|
7863
8047
|
PathProxy.prototype.setDPR = function (dpr) {
|
@@ -7895,8 +8079,8 @@
|
|
7895
8079
|
return this;
|
7896
8080
|
};
|
7897
8081
|
PathProxy.prototype.lineTo = function (x, y) {
|
7898
|
-
var dx = mathAbs(x - this._xi);
|
7899
|
-
var dy = mathAbs(y - this._yi);
|
8082
|
+
var dx = mathAbs$1(x - this._xi);
|
8083
|
+
var dy = mathAbs$1(y - this._yi);
|
7900
8084
|
var exceedUnit = dx > this._ux || dy > this._uy;
|
7901
8085
|
this.addData(CMD.L, x, y);
|
7902
8086
|
if (this._ctx && exceedUnit) {
|
@@ -7989,6 +8173,9 @@
|
|
7989
8173
|
return this._len;
|
7990
8174
|
};
|
7991
8175
|
PathProxy.prototype.setData = function (data) {
|
8176
|
+
if (!this._saveData) {
|
8177
|
+
return;
|
8178
|
+
}
|
7992
8179
|
var len = data.length;
|
7993
8180
|
if (!(this.data && this.data.length === len) && hasTypedArray) {
|
7994
8181
|
this.data = new Float32Array(len);
|
@@ -7999,6 +8186,9 @@
|
|
7999
8186
|
this._len = len;
|
8000
8187
|
};
|
8001
8188
|
PathProxy.prototype.appendPath = function (path) {
|
8189
|
+
if (!this._saveData) {
|
8190
|
+
return;
|
8191
|
+
}
|
8002
8192
|
if (!(path instanceof Array)) {
|
8003
8193
|
path = [path];
|
8004
8194
|
}
|
@@ -8008,8 +8198,14 @@
|
|
8008
8198
|
for (var i = 0; i < len; i++) {
|
8009
8199
|
appendSize += path[i].len();
|
8010
8200
|
}
|
8011
|
-
|
8201
|
+
var oldData = this.data;
|
8202
|
+
if (hasTypedArray && (oldData instanceof Float32Array || !oldData)) {
|
8012
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
|
+
}
|
8013
8209
|
}
|
8014
8210
|
for (var i = 0; i < len; i++) {
|
8015
8211
|
var appendPathData = path[i].data;
|
@@ -8174,7 +8370,7 @@
|
|
8174
8370
|
var y2 = data[i++];
|
8175
8371
|
var dx = x2 - xi;
|
8176
8372
|
var dy = y2 - yi;
|
8177
|
-
if (mathAbs(dx) > ux || mathAbs(dy) > uy || i === len - 1) {
|
8373
|
+
if (mathAbs$1(dx) > ux || mathAbs$1(dy) > uy || i === len - 1) {
|
8178
8374
|
l = Math.sqrt(dx * dx + dy * dy);
|
8179
8375
|
xi = x2;
|
8180
8376
|
yi = y2;
|
@@ -8298,8 +8494,8 @@
|
|
8298
8494
|
case CMD.L: {
|
8299
8495
|
x = d[i++];
|
8300
8496
|
y = d[i++];
|
8301
|
-
var dx = mathAbs(x - xi);
|
8302
|
-
var dy = mathAbs(y - yi);
|
8497
|
+
var dx = mathAbs$1(x - xi);
|
8498
|
+
var dy = mathAbs$1(y - yi);
|
8303
8499
|
if (dx > ux || dy > uy) {
|
8304
8500
|
if (drawPart) {
|
8305
8501
|
var l = pathSegLen[segCount++];
|
@@ -8379,7 +8575,7 @@
|
|
8379
8575
|
var psi = d[i++];
|
8380
8576
|
var anticlockwise = !d[i++];
|
8381
8577
|
var r = (rx > ry) ? rx : ry;
|
8382
|
-
var isEllipse = mathAbs(rx - ry) > 1e-3;
|
8578
|
+
var isEllipse = mathAbs$1(rx - ry) > 1e-3;
|
8383
8579
|
var endAngle = startAngle + delta;
|
8384
8580
|
var breakBuild = false;
|
8385
8581
|
if (drawPart) {
|
@@ -8461,6 +8657,9 @@
|
|
8461
8657
|
newProxy._len = this._len;
|
8462
8658
|
return newProxy;
|
8463
8659
|
};
|
8660
|
+
PathProxy.prototype.canSave = function () {
|
8661
|
+
return !!this._saveData;
|
8662
|
+
};
|
8464
8663
|
PathProxy.CMD = CMD;
|
8465
8664
|
PathProxy.initDefaultProps = (function () {
|
8466
8665
|
var proto = PathProxy.prototype;
|
@@ -8590,9 +8789,9 @@
|
|
8590
8789
|
|
8591
8790
|
var CMD$1 = PathProxy.CMD;
|
8592
8791
|
var PI2$4 = Math.PI * 2;
|
8593
|
-
var EPSILON$
|
8792
|
+
var EPSILON$4 = 1e-4;
|
8594
8793
|
function isAroundEqual(a, b) {
|
8595
|
-
return Math.abs(a - b) < EPSILON$
|
8794
|
+
return Math.abs(a - b) < EPSILON$4;
|
8596
8795
|
}
|
8597
8796
|
var roots = [-1, -1, -1];
|
8598
8797
|
var extrema = [-1, -1];
|
@@ -9642,16 +9841,19 @@
|
|
9642
9841
|
var pathProxy = createPathProxyFromString(str);
|
9643
9842
|
var innerOpts = extend({}, opts);
|
9644
9843
|
innerOpts.buildPath = function (path) {
|
9645
|
-
|
9646
|
-
|
9844
|
+
var beProxy = isPathProxy(path);
|
9845
|
+
if (beProxy && path.canSave()) {
|
9846
|
+
path.appendPath(pathProxy);
|
9647
9847
|
var ctx = path.getContext();
|
9648
9848
|
if (ctx) {
|
9649
9849
|
path.rebuildPath(ctx, 1);
|
9650
9850
|
}
|
9651
9851
|
}
|
9652
9852
|
else {
|
9653
|
-
var ctx = path;
|
9654
|
-
|
9853
|
+
var ctx = beProxy ? path.getContext() : path;
|
9854
|
+
if (ctx) {
|
9855
|
+
pathProxy.rebuildPath(ctx, 1);
|
9856
|
+
}
|
9655
9857
|
}
|
9656
9858
|
};
|
9657
9859
|
innerOpts.applyTransform = function (m) {
|
@@ -10750,6 +10952,16 @@
|
|
10750
10952
|
var stopColor = styleVals.stopColor
|
10751
10953
|
|| stop.getAttribute('stop-color')
|
10752
10954
|
|| '#000000';
|
10955
|
+
var stopOpacity = styleVals.stopOpacity
|
10956
|
+
|| stop.getAttribute('stop-opacity');
|
10957
|
+
if (stopOpacity) {
|
10958
|
+
var rgba = parse(stopColor);
|
10959
|
+
var stopColorOpacity = rgba && rgba[3];
|
10960
|
+
if (stopColorOpacity) {
|
10961
|
+
rgba[3] *= parseCssFloat(stopOpacity);
|
10962
|
+
stopColor = stringify(rgba, 'rgba');
|
10963
|
+
}
|
10964
|
+
}
|
10753
10965
|
gradient.colorStops.push({
|
10754
10966
|
offset: offset,
|
10755
10967
|
color: stopColor
|
@@ -10992,7 +11204,7 @@
|
|
10992
11204
|
var mathCos$3 = Math.cos;
|
10993
11205
|
var mathACos = Math.acos;
|
10994
11206
|
var mathATan2 = Math.atan2;
|
10995
|
-
var mathAbs$
|
11207
|
+
var mathAbs$2 = Math.abs;
|
10996
11208
|
var mathSqrt$3 = Math.sqrt;
|
10997
11209
|
var mathMax$3 = Math.max;
|
10998
11210
|
var mathMin$3 = Math.min;
|
@@ -11097,7 +11309,7 @@
|
|
11097
11309
|
}
|
11098
11310
|
var cx = shape.cx, cy = shape.cy;
|
11099
11311
|
var clockwise = !!shape.clockwise;
|
11100
|
-
var arc = mathAbs$
|
11312
|
+
var arc = mathAbs$2(endAngle - startAngle);
|
11101
11313
|
var mod = arc > PI2$5 && arc % PI2$5;
|
11102
11314
|
mod > e && (arc = mod);
|
11103
11315
|
if (!(radius > e)) {
|
@@ -11138,7 +11350,7 @@
|
|
11138
11350
|
if (cornerRadius) {
|
11139
11351
|
_a = normalizeCornerRadius(cornerRadius), icrStart = _a[0], icrEnd = _a[1], ocrStart = _a[2], ocrEnd = _a[3];
|
11140
11352
|
}
|
11141
|
-
var halfRd = mathAbs$
|
11353
|
+
var halfRd = mathAbs$2(radius - innerRadius) / 2;
|
11142
11354
|
ocrs = mathMin$3(halfRd, ocrStart);
|
11143
11355
|
ocre = mathMin$3(halfRd, ocrEnd);
|
11144
11356
|
icrs = mathMin$3(halfRd, icrStart);
|
@@ -12551,32 +12763,38 @@
|
|
12551
12763
|
}
|
12552
12764
|
|
12553
12765
|
var STYLE_REG = /\{([a-zA-Z0-9_]+)\|([^}]*)\}/g;
|
12554
|
-
function
|
12766
|
+
function truncateText2(out, text, containerWidth, font, ellipsis, options) {
|
12555
12767
|
if (!containerWidth) {
|
12556
|
-
|
12768
|
+
out.text = '';
|
12769
|
+
out.isTruncated = false;
|
12770
|
+
return;
|
12557
12771
|
}
|
12558
12772
|
var textLines = (text + '').split('\n');
|
12559
12773
|
options = prepareTruncateOptions(containerWidth, font, ellipsis, options);
|
12774
|
+
var isTruncated = false;
|
12775
|
+
var truncateOut = {};
|
12560
12776
|
for (var i = 0, len = textLines.length; i < len; i++) {
|
12561
|
-
|
12777
|
+
truncateSingleLine(truncateOut, textLines[i], options);
|
12778
|
+
textLines[i] = truncateOut.textLine;
|
12779
|
+
isTruncated = isTruncated || truncateOut.isTruncated;
|
12562
12780
|
}
|
12563
|
-
|
12781
|
+
out.text = textLines.join('\n');
|
12782
|
+
out.isTruncated = isTruncated;
|
12564
12783
|
}
|
12565
12784
|
function prepareTruncateOptions(containerWidth, font, ellipsis, options) {
|
12566
12785
|
options = options || {};
|
12567
12786
|
var preparedOpts = extend({}, options);
|
12568
|
-
preparedOpts.font = font;
|
12569
12787
|
ellipsis = retrieve2(ellipsis, '...');
|
12570
12788
|
preparedOpts.maxIterations = retrieve2(options.maxIterations, 2);
|
12571
12789
|
var minChar = preparedOpts.minChar = retrieve2(options.minChar, 0);
|
12572
|
-
preparedOpts.
|
12573
|
-
var ascCharWidth =
|
12790
|
+
var fontMeasureInfo = preparedOpts.fontMeasureInfo = ensureFontMeasureInfo(font);
|
12791
|
+
var ascCharWidth = fontMeasureInfo.asciiCharWidth;
|
12574
12792
|
preparedOpts.placeholder = retrieve2(options.placeholder, '');
|
12575
12793
|
var contentWidth = containerWidth = Math.max(0, containerWidth - 1);
|
12576
12794
|
for (var i = 0; i < minChar && contentWidth >= ascCharWidth; i++) {
|
12577
12795
|
contentWidth -= ascCharWidth;
|
12578
12796
|
}
|
12579
|
-
var ellipsisWidth =
|
12797
|
+
var ellipsisWidth = measureWidth(fontMeasureInfo, ellipsis);
|
12580
12798
|
if (ellipsisWidth > contentWidth) {
|
12581
12799
|
ellipsis = '';
|
12582
12800
|
ellipsisWidth = 0;
|
@@ -12588,16 +12806,20 @@
|
|
12588
12806
|
preparedOpts.containerWidth = containerWidth;
|
12589
12807
|
return preparedOpts;
|
12590
12808
|
}
|
12591
|
-
function truncateSingleLine(textLine, options) {
|
12809
|
+
function truncateSingleLine(out, textLine, options) {
|
12592
12810
|
var containerWidth = options.containerWidth;
|
12593
|
-
var font = options.font;
|
12594
12811
|
var contentWidth = options.contentWidth;
|
12812
|
+
var fontMeasureInfo = options.fontMeasureInfo;
|
12595
12813
|
if (!containerWidth) {
|
12596
|
-
|
12814
|
+
out.textLine = '';
|
12815
|
+
out.isTruncated = false;
|
12816
|
+
return;
|
12597
12817
|
}
|
12598
|
-
var lineWidth =
|
12818
|
+
var lineWidth = measureWidth(fontMeasureInfo, textLine);
|
12599
12819
|
if (lineWidth <= containerWidth) {
|
12600
|
-
|
12820
|
+
out.textLine = textLine;
|
12821
|
+
out.isTruncated = false;
|
12822
|
+
return;
|
12601
12823
|
}
|
12602
12824
|
for (var j = 0;; j++) {
|
12603
12825
|
if (lineWidth <= contentWidth || j >= options.maxIterations) {
|
@@ -12605,38 +12827,47 @@
|
|
12605
12827
|
break;
|
12606
12828
|
}
|
12607
12829
|
var subLength = j === 0
|
12608
|
-
? estimateLength(textLine, contentWidth,
|
12830
|
+
? estimateLength(textLine, contentWidth, fontMeasureInfo)
|
12609
12831
|
: lineWidth > 0
|
12610
12832
|
? Math.floor(textLine.length * contentWidth / lineWidth)
|
12611
12833
|
: 0;
|
12612
12834
|
textLine = textLine.substr(0, subLength);
|
12613
|
-
lineWidth =
|
12835
|
+
lineWidth = measureWidth(fontMeasureInfo, textLine);
|
12614
12836
|
}
|
12615
12837
|
if (textLine === '') {
|
12616
12838
|
textLine = options.placeholder;
|
12617
12839
|
}
|
12618
|
-
|
12840
|
+
out.textLine = textLine;
|
12841
|
+
out.isTruncated = true;
|
12619
12842
|
}
|
12620
|
-
function estimateLength(text, contentWidth,
|
12843
|
+
function estimateLength(text, contentWidth, fontMeasureInfo) {
|
12621
12844
|
var width = 0;
|
12622
12845
|
var i = 0;
|
12623
12846
|
for (var len = text.length; i < len && width < contentWidth; i++) {
|
12624
|
-
|
12625
|
-
width += (0 <= charCode && charCode <= 127) ? ascCharWidth : cnCharWidth;
|
12847
|
+
width += measureCharWidth(fontMeasureInfo, text.charCodeAt(i));
|
12626
12848
|
}
|
12627
12849
|
return i;
|
12628
12850
|
}
|
12629
|
-
function parsePlainText(text, style) {
|
12851
|
+
function parsePlainText(text, style, defaultOuterWidth, defaultOuterHeight) {
|
12630
12852
|
text != null && (text += '');
|
12631
12853
|
var overflow = style.overflow;
|
12632
12854
|
var padding = style.padding;
|
12855
|
+
var paddingH = padding ? padding[1] + padding[3] : 0;
|
12856
|
+
var paddingV = padding ? padding[0] + padding[2] : 0;
|
12633
12857
|
var font = style.font;
|
12634
12858
|
var truncate = overflow === 'truncate';
|
12635
12859
|
var calculatedLineHeight = getLineHeight(font);
|
12636
12860
|
var lineHeight = retrieve2(style.lineHeight, calculatedLineHeight);
|
12637
|
-
var bgColorDrawn = !!(style.backgroundColor);
|
12638
12861
|
var truncateLineOverflow = style.lineOverflow === 'truncate';
|
12862
|
+
var isTruncated = false;
|
12639
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
|
+
}
|
12640
12871
|
var lines;
|
12641
12872
|
if (width != null && (overflow === 'break' || overflow === 'breakAll')) {
|
12642
12873
|
lines = text ? wrapText(text, style.font, width, overflow === 'breakAll', 0).lines : [];
|
@@ -12645,37 +12876,39 @@
|
|
12645
12876
|
lines = text ? text.split('\n') : [];
|
12646
12877
|
}
|
12647
12878
|
var contentHeight = lines.length * lineHeight;
|
12648
|
-
|
12879
|
+
if (height == null) {
|
12880
|
+
height = contentHeight;
|
12881
|
+
}
|
12649
12882
|
if (contentHeight > height && truncateLineOverflow) {
|
12650
12883
|
var lineCount = Math.floor(height / lineHeight);
|
12884
|
+
isTruncated = isTruncated || (lines.length > lineCount);
|
12651
12885
|
lines = lines.slice(0, lineCount);
|
12886
|
+
contentHeight = lines.length * lineHeight;
|
12652
12887
|
}
|
12653
12888
|
if (text && truncate && width != null) {
|
12654
12889
|
var options = prepareTruncateOptions(width, font, style.ellipsis, {
|
12655
12890
|
minChar: style.truncateMinChar,
|
12656
12891
|
placeholder: style.placeholder
|
12657
12892
|
});
|
12893
|
+
var singleOut = {};
|
12658
12894
|
for (var i = 0; i < lines.length; i++) {
|
12659
|
-
|
12895
|
+
truncateSingleLine(singleOut, lines[i], options);
|
12896
|
+
lines[i] = singleOut.textLine;
|
12897
|
+
isTruncated = isTruncated || singleOut.isTruncated;
|
12660
12898
|
}
|
12661
12899
|
}
|
12662
12900
|
var outerHeight = height;
|
12663
12901
|
var contentWidth = 0;
|
12902
|
+
var fontMeasureInfo = ensureFontMeasureInfo(font);
|
12664
12903
|
for (var i = 0; i < lines.length; i++) {
|
12665
|
-
contentWidth = Math.max(
|
12904
|
+
contentWidth = Math.max(measureWidth(fontMeasureInfo, lines[i]), contentWidth);
|
12666
12905
|
}
|
12667
12906
|
if (width == null) {
|
12668
12907
|
width = contentWidth;
|
12669
12908
|
}
|
12670
|
-
var outerWidth =
|
12671
|
-
|
12672
|
-
|
12673
|
-
outerWidth += padding[1] + padding[3];
|
12674
|
-
width += padding[1] + padding[3];
|
12675
|
-
}
|
12676
|
-
if (bgColorDrawn) {
|
12677
|
-
outerWidth = width;
|
12678
|
-
}
|
12909
|
+
var outerWidth = width;
|
12910
|
+
outerHeight += paddingV;
|
12911
|
+
outerWidth += paddingH;
|
12679
12912
|
return {
|
12680
12913
|
lines: lines,
|
12681
12914
|
height: height,
|
@@ -12685,7 +12918,8 @@
|
|
12685
12918
|
calculatedLineHeight: calculatedLineHeight,
|
12686
12919
|
contentWidth: contentWidth,
|
12687
12920
|
contentHeight: contentHeight,
|
12688
|
-
width: width
|
12921
|
+
width: width,
|
12922
|
+
isTruncated: isTruncated
|
12689
12923
|
};
|
12690
12924
|
}
|
12691
12925
|
var RichTextToken = (function () {
|
@@ -12711,17 +12945,27 @@
|
|
12711
12945
|
this.outerWidth = 0;
|
12712
12946
|
this.outerHeight = 0;
|
12713
12947
|
this.lines = [];
|
12948
|
+
this.isTruncated = false;
|
12714
12949
|
}
|
12715
12950
|
return RichTextContentBlock;
|
12716
12951
|
}());
|
12717
|
-
function parseRichText(text, style) {
|
12952
|
+
function parseRichText(text, style, defaultOuterWidth, defaultOuterHeight, topTextAlign) {
|
12718
12953
|
var contentBlock = new RichTextContentBlock();
|
12719
12954
|
text != null && (text += '');
|
12720
12955
|
if (!text) {
|
12721
12956
|
return contentBlock;
|
12722
12957
|
}
|
12958
|
+
var stlPadding = style.padding;
|
12959
|
+
var stlPaddingH = stlPadding ? stlPadding[1] + stlPadding[3] : 0;
|
12960
|
+
var stlPaddingV = stlPadding ? stlPadding[0] + stlPadding[2] : 0;
|
12723
12961
|
var topWidth = style.width;
|
12962
|
+
if (topWidth == null && defaultOuterWidth != null) {
|
12963
|
+
topWidth = defaultOuterWidth - stlPaddingH;
|
12964
|
+
}
|
12724
12965
|
var topHeight = style.height;
|
12966
|
+
if (topHeight == null && defaultOuterHeight != null) {
|
12967
|
+
topHeight = defaultOuterHeight - stlPaddingV;
|
12968
|
+
}
|
12725
12969
|
var overflow = style.overflow;
|
12726
12970
|
var wrapInfo = (overflow === 'break' || overflow === 'breakAll') && topWidth != null
|
12727
12971
|
? { width: topWidth, accumWidth: 0, breakAll: overflow === 'breakAll' }
|
@@ -12742,9 +12986,9 @@
|
|
12742
12986
|
var pendingList = [];
|
12743
12987
|
var calculatedHeight = 0;
|
12744
12988
|
var calculatedWidth = 0;
|
12745
|
-
var stlPadding = style.padding;
|
12746
12989
|
var truncate = overflow === 'truncate';
|
12747
12990
|
var truncateLine = style.lineOverflow === 'truncate';
|
12991
|
+
var tmpTruncateOut = {};
|
12748
12992
|
function finishLine(line, lineWidth, lineHeight) {
|
12749
12993
|
line.width = lineWidth;
|
12750
12994
|
line.lineHeight = lineHeight;
|
@@ -12767,9 +13011,10 @@
|
|
12767
13011
|
textPadding && (tokenHeight += textPadding[0] + textPadding[2]);
|
12768
13012
|
token.height = tokenHeight;
|
12769
13013
|
token.lineHeight = retrieve3(tokenStyle.lineHeight, style.lineHeight, tokenHeight);
|
12770
|
-
token.align = tokenStyle && tokenStyle.align ||
|
13014
|
+
token.align = tokenStyle && tokenStyle.align || topTextAlign;
|
12771
13015
|
token.verticalAlign = tokenStyle && tokenStyle.verticalAlign || 'middle';
|
12772
13016
|
if (truncateLine && topHeight != null && calculatedHeight + token.lineHeight > topHeight) {
|
13017
|
+
var originalLength = contentBlock.lines.length;
|
12773
13018
|
if (j > 0) {
|
12774
13019
|
line.tokens = line.tokens.slice(0, j);
|
12775
13020
|
finishLine(line, lineWidth, lineHeight);
|
@@ -12778,6 +13023,7 @@
|
|
12778
13023
|
else {
|
12779
13024
|
contentBlock.lines = contentBlock.lines.slice(0, i);
|
12780
13025
|
}
|
13026
|
+
contentBlock.isTruncated = contentBlock.isTruncated || (contentBlock.lines.length < originalLength);
|
12781
13027
|
break outer;
|
12782
13028
|
}
|
12783
13029
|
var styleTokenWidth = tokenStyle.width;
|
@@ -12785,7 +13031,7 @@
|
|
12785
13031
|
if (typeof styleTokenWidth === 'string' && styleTokenWidth.charAt(styleTokenWidth.length - 1) === '%') {
|
12786
13032
|
token.percentWidth = styleTokenWidth;
|
12787
13033
|
pendingList.push(token);
|
12788
|
-
token.contentWidth =
|
13034
|
+
token.contentWidth = measureWidth(ensureFontMeasureInfo(font), token.text);
|
12789
13035
|
}
|
12790
13036
|
else {
|
12791
13037
|
if (tokenWidthNotSpecified) {
|
@@ -12806,12 +13052,14 @@
|
|
12806
13052
|
token.width = token.contentWidth = 0;
|
12807
13053
|
}
|
12808
13054
|
else {
|
12809
|
-
|
12810
|
-
token.
|
13055
|
+
truncateText2(tmpTruncateOut, token.text, remainTruncWidth - paddingH, font, style.ellipsis, { minChar: style.truncateMinChar });
|
13056
|
+
token.text = tmpTruncateOut.text;
|
13057
|
+
contentBlock.isTruncated = contentBlock.isTruncated || tmpTruncateOut.isTruncated;
|
13058
|
+
token.width = token.contentWidth = measureWidth(ensureFontMeasureInfo(font), token.text);
|
12811
13059
|
}
|
12812
13060
|
}
|
12813
13061
|
else {
|
12814
|
-
token.contentWidth =
|
13062
|
+
token.contentWidth = measureWidth(ensureFontMeasureInfo(font), token.text);
|
12815
13063
|
}
|
12816
13064
|
}
|
12817
13065
|
token.width += paddingH;
|
@@ -12824,10 +13072,8 @@
|
|
12824
13072
|
contentBlock.outerHeight = contentBlock.height = retrieve2(topHeight, calculatedHeight);
|
12825
13073
|
contentBlock.contentHeight = calculatedHeight;
|
12826
13074
|
contentBlock.contentWidth = calculatedWidth;
|
12827
|
-
|
12828
|
-
|
12829
|
-
contentBlock.outerHeight += stlPadding[0] + stlPadding[2];
|
12830
|
-
}
|
13075
|
+
contentBlock.outerWidth += stlPaddingH;
|
13076
|
+
contentBlock.outerHeight += stlPaddingV;
|
12831
13077
|
for (var i = 0; i < pendingList.length; i++) {
|
12832
13078
|
var token = pendingList[i];
|
12833
13079
|
var percentWidth = token.percentWidth;
|
@@ -12863,9 +13109,10 @@
|
|
12863
13109
|
strLines = res.lines;
|
12864
13110
|
}
|
12865
13111
|
}
|
12866
|
-
|
13112
|
+
if (!strLines) {
|
12867
13113
|
strLines = str.split('\n');
|
12868
13114
|
}
|
13115
|
+
var fontMeasureInfo = ensureFontMeasureInfo(font);
|
12869
13116
|
for (var i = 0; i < strLines.length; i++) {
|
12870
13117
|
var text = strLines[i];
|
12871
13118
|
var token = new RichTextToken();
|
@@ -12878,7 +13125,7 @@
|
|
12878
13125
|
else {
|
12879
13126
|
token.width = linesWidths
|
12880
13127
|
? linesWidths[i]
|
12881
|
-
:
|
13128
|
+
: measureWidth(fontMeasureInfo, text);
|
12882
13129
|
}
|
12883
13130
|
if (!i && !newLine) {
|
12884
13131
|
var tokens = (lines[lines.length - 1] || (lines[0] = new RichTextLine())).tokens;
|
@@ -12919,6 +13166,7 @@
|
|
12919
13166
|
var currentWord = '';
|
12920
13167
|
var currentWordWidth = 0;
|
12921
13168
|
var accumWidth = 0;
|
13169
|
+
var fontMeasureInfo = ensureFontMeasureInfo(font);
|
12922
13170
|
for (var i = 0; i < text.length; i++) {
|
12923
13171
|
var ch = text.charAt(i);
|
12924
13172
|
if (ch === '\n') {
|
@@ -12934,7 +13182,7 @@
|
|
12934
13182
|
accumWidth = 0;
|
12935
13183
|
continue;
|
12936
13184
|
}
|
12937
|
-
var chWidth =
|
13185
|
+
var chWidth = measureCharWidth(fontMeasureInfo, ch.charCodeAt(0));
|
12938
13186
|
var inWord = isBreakAll ? false : !isWordBreakChar(ch);
|
12939
13187
|
if (!lines.length
|
12940
13188
|
? lastAccumWidth + accumWidth + chWidth > lineWidth
|
@@ -12994,11 +13242,6 @@
|
|
12994
13242
|
line += ch;
|
12995
13243
|
}
|
12996
13244
|
}
|
12997
|
-
if (!lines.length && !line) {
|
12998
|
-
line = text;
|
12999
|
-
currentWord = '';
|
13000
|
-
currentWordWidth = 0;
|
13001
|
-
}
|
13002
13245
|
if (currentWord) {
|
13003
13246
|
line += currentWord;
|
13004
13247
|
}
|
@@ -13014,12 +13257,32 @@
|
|
13014
13257
|
lines: lines,
|
13015
13258
|
linesWidths: linesWidths
|
13016
13259
|
};
|
13017
|
-
}
|
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 };
|
13018
13280
|
|
13019
13281
|
var DEFAULT_RICH_TEXT_COLOR = {
|
13020
13282
|
fill: '#000'
|
13021
13283
|
};
|
13022
13284
|
var DEFAULT_STROKE_LINE_WIDTH = 2;
|
13285
|
+
var tmpCITOverflowAreaOut = {};
|
13023
13286
|
var DEFAULT_TEXT_ANIMATION_PROPS = {
|
13024
13287
|
style: defaults({
|
13025
13288
|
fill: true,
|
@@ -13193,8 +13456,16 @@
|
|
13193
13456
|
var style = this.style;
|
13194
13457
|
var textFont = style.font || DEFAULT_FONT;
|
13195
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;
|
13196
13467
|
var text = getStyleText(style);
|
13197
|
-
var contentBlock = parsePlainText(text, style);
|
13468
|
+
var contentBlock = parsePlainText(text, style, tmpCITOverflowAreaOut.outerWidth, tmpCITOverflowAreaOut.outerHeight);
|
13198
13469
|
var needDrawBg = needDrawBackground(style);
|
13199
13470
|
var bgColorDrawn = !!(style.backgroundColor);
|
13200
13471
|
var outerHeight = contentBlock.outerHeight;
|
@@ -13202,11 +13473,7 @@
|
|
13202
13473
|
var contentWidth = contentBlock.contentWidth;
|
13203
13474
|
var textLines = contentBlock.lines;
|
13204
13475
|
var lineHeight = contentBlock.lineHeight;
|
13205
|
-
|
13206
|
-
var baseX = style.x || 0;
|
13207
|
-
var baseY = style.y || 0;
|
13208
|
-
var textAlign = style.align || defaultStyle.align || 'left';
|
13209
|
-
var verticalAlign = style.verticalAlign || defaultStyle.verticalAlign || 'top';
|
13476
|
+
this.isTruncated = !!contentBlock.isTruncated;
|
13210
13477
|
var textX = baseX;
|
13211
13478
|
var textY = adjustTextY$1(baseY, contentBlock.contentHeight, verticalAlign);
|
13212
13479
|
if (needDrawBg || textPadding) {
|
@@ -13269,23 +13536,27 @@
|
|
13269
13536
|
setSeparateFont(subElStyle, style);
|
13270
13537
|
textY += lineHeight;
|
13271
13538
|
if (fixedBoundingRect) {
|
13272
|
-
el.setBoundingRect(new BoundingRect(adjustTextX(subElStyle.x,
|
13539
|
+
el.setBoundingRect(new BoundingRect(adjustTextX(subElStyle.x, contentWidth, subElStyle.textAlign), adjustTextY$1(subElStyle.y, calculatedLineHeight, subElStyle.textBaseline), contentWidth, calculatedLineHeight));
|
13273
13540
|
}
|
13274
13541
|
}
|
13275
13542
|
};
|
13276
13543
|
ZRText.prototype._updateRichTexts = function () {
|
13277
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;
|
13278
13553
|
var text = getStyleText(style);
|
13279
|
-
var contentBlock = parseRichText(text, style);
|
13554
|
+
var contentBlock = parseRichText(text, style, tmpCITOverflowAreaOut.outerWidth, tmpCITOverflowAreaOut.outerHeight, textAlign);
|
13280
13555
|
var contentWidth = contentBlock.width;
|
13281
13556
|
var outerWidth = contentBlock.outerWidth;
|
13282
13557
|
var outerHeight = contentBlock.outerHeight;
|
13283
13558
|
var textPadding = style.padding;
|
13284
|
-
|
13285
|
-
var baseY = style.y || 0;
|
13286
|
-
var defaultStyle = this._defaultStyle;
|
13287
|
-
var textAlign = style.align || defaultStyle.align;
|
13288
|
-
var verticalAlign = style.verticalAlign || defaultStyle.verticalAlign;
|
13559
|
+
this.isTruncated = !!contentBlock.isTruncated;
|
13289
13560
|
var boxX = adjustTextX(baseX, outerWidth, textAlign);
|
13290
13561
|
var boxY = adjustTextY$1(baseY, outerHeight, verticalAlign);
|
13291
13562
|
var xLeft = boxX;
|
@@ -14010,10 +14281,14 @@
|
|
14010
14281
|
return Pattern;
|
14011
14282
|
}());
|
14012
14283
|
|
14013
|
-
var
|
14014
|
-
var
|
14015
|
-
var
|
14016
|
-
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;
|
14017
14292
|
var OrientedBoundingRect = (function () {
|
14018
14293
|
function OrientedBoundingRect(rect, transform) {
|
14019
14294
|
this._corners = [];
|
@@ -14053,59 +14328,69 @@
|
|
14053
14328
|
this._origin[i] = axes[i].dot(corners[0]);
|
14054
14329
|
}
|
14055
14330
|
};
|
14056
|
-
OrientedBoundingRect.prototype.intersect = function (other, mtv) {
|
14331
|
+
OrientedBoundingRect.prototype.intersect = function (other, mtv, opt) {
|
14057
14332
|
var overlapped = true;
|
14058
14333
|
var noMtv = !mtv;
|
14059
|
-
|
14060
|
-
|
14061
|
-
|
14334
|
+
if (mtv) {
|
14335
|
+
Point.set(mtv, 0, 0);
|
14336
|
+
}
|
14337
|
+
_intersectCtx$1.reset(opt, !noMtv);
|
14338
|
+
if (!this._intersectCheckOneSide(this, other, noMtv, 1)) {
|
14062
14339
|
overlapped = false;
|
14063
14340
|
if (noMtv) {
|
14064
14341
|
return overlapped;
|
14065
14342
|
}
|
14066
14343
|
}
|
14067
|
-
if (!this._intersectCheckOneSide(other, this,
|
14344
|
+
if (!this._intersectCheckOneSide(other, this, noMtv, -1)) {
|
14068
14345
|
overlapped = false;
|
14069
14346
|
if (noMtv) {
|
14070
14347
|
return overlapped;
|
14071
14348
|
}
|
14072
14349
|
}
|
14073
|
-
if (!noMtv) {
|
14074
|
-
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);
|
14075
14354
|
}
|
14076
14355
|
return overlapped;
|
14077
14356
|
};
|
14078
|
-
OrientedBoundingRect.prototype._intersectCheckOneSide = function (self, other,
|
14357
|
+
OrientedBoundingRect.prototype._intersectCheckOneSide = function (self, other, noMtv, inverse) {
|
14079
14358
|
var overlapped = true;
|
14080
14359
|
for (var i = 0; i < 2; i++) {
|
14081
|
-
var axis =
|
14082
|
-
|
14083
|
-
|
14084
|
-
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]) {
|
14085
14364
|
overlapped = false;
|
14086
|
-
if (noMtv) {
|
14365
|
+
if (_intersectCtx$1.negativeSize || noMtv) {
|
14087
14366
|
return overlapped;
|
14088
14367
|
}
|
14089
|
-
var dist0 =
|
14090
|
-
var dist1 =
|
14091
|
-
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()) {
|
14092
14371
|
if (dist0 < dist1) {
|
14093
|
-
Point.scale(
|
14372
|
+
Point.scale(_maxTv$1, axis, -dist0 * inverse);
|
14094
14373
|
}
|
14095
14374
|
else {
|
14096
|
-
Point.scale(
|
14375
|
+
Point.scale(_maxTv$1, axis, dist1 * inverse);
|
14097
14376
|
}
|
14098
14377
|
}
|
14099
14378
|
}
|
14100
|
-
else if (
|
14101
|
-
var dist0 =
|
14102
|
-
var dist1 =
|
14103
|
-
if (
|
14104
|
-
if (dist0 < dist1) {
|
14105
|
-
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
|
+
}
|
14106
14388
|
}
|
14107
|
-
|
14108
|
-
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
|
+
}
|
14109
14394
|
}
|
14110
14395
|
}
|
14111
14396
|
}
|
@@ -14120,11 +14405,12 @@
|
|
14120
14405
|
var max = proj;
|
14121
14406
|
for (var i = 1; i < corners.length; i++) {
|
14122
14407
|
var proj_1 = corners[i].dot(axis) + origin[dim];
|
14123
|
-
min =
|
14124
|
-
max =
|
14408
|
+
min = mathMin$4(proj_1, min);
|
14409
|
+
max = mathMax$4(proj_1, max);
|
14125
14410
|
}
|
14126
|
-
out[0] = min;
|
14127
|
-
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];
|
14128
14414
|
};
|
14129
14415
|
return OrientedBoundingRect;
|
14130
14416
|
}());
|
@@ -14418,7 +14704,7 @@
|
|
14418
14704
|
strokePattern = (dirtyFlag || !el.__canvasStrokePattern)
|
14419
14705
|
? createCanvasPattern(ctx, stroke, el)
|
14420
14706
|
: el.__canvasStrokePattern;
|
14421
|
-
el.__canvasStrokePattern =
|
14707
|
+
el.__canvasStrokePattern = strokePattern;
|
14422
14708
|
}
|
14423
14709
|
if (hasFillGradient) {
|
14424
14710
|
ctx.fillStyle = fillGradient;
|