echarts 4.2.0-rc.2 → 4.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/KEYS +60 -0
- package/LICENSE +7 -8
- package/dist/echarts-en.common.js +1250 -717
- package/dist/echarts-en.common.min.js +1 -1
- package/dist/echarts-en.js +2284 -1763
- package/dist/echarts-en.js.map +1 -1
- package/dist/echarts-en.min.js +1 -1
- package/dist/echarts-en.simple.js +1001 -560
- package/dist/echarts-en.simple.min.js +1 -1
- package/dist/echarts.common.js +1250 -717
- package/dist/echarts.common.min.js +1 -1
- package/dist/echarts.js +2284 -1763
- package/dist/echarts.js.map +1 -1
- package/dist/echarts.min.js +1 -1
- package/dist/echarts.simple.js +1001 -560
- package/dist/echarts.simple.min.js +1 -1
- package/dist/extension/dataTool.js +32 -33
- package/dist/extension/dataTool.js.map +1 -1
- package/lib/chart/graph/GraphView.js +17 -9
- package/lib/chart/graph/forceHelper.js +15 -20
- package/lib/chart/helper/Line.js +5 -1
- package/lib/chart/map/MapSeries.js +32 -26
- package/lib/chart/map/MapView.js +93 -40
- package/lib/chart/pie/labelLayout.js +23 -16
- package/lib/chart/sankey/sankeyLayout.js +18 -17
- package/lib/chart/sunburst/SunburstPiece.js +10 -5
- package/lib/chart/themeRiver/ThemeRiverSeries.js +26 -29
- package/lib/chart/tree/layoutHelper.js +57 -10
- package/lib/chart/treemap/treemapLayout.js +13 -7
- package/lib/component/axis/AxisBuilder.js +11 -2
- package/lib/component/helper/MapDraw.js +4 -0
- package/lib/component/helper/RoamController.js +3 -3
- package/lib/component/legend/LegendView.js +19 -1
- package/lib/component/legend/ScrollableLegendView.js +105 -70
- package/lib/coord/axisHelper.js +24 -1
- package/lib/coord/axisTickLabelBuilder.js +7 -12
- package/lib/coord/geo/Geo.js +1 -1
- package/lib/data/List.js +111 -36
- package/lib/echarts.js +13 -4
- package/lib/model/Model.js +1 -1
- package/lib/model/mixin/textStyle.js +1 -1
- package/lib/scale/Time.js +14 -4
- package/lib/util/format.js +30 -1
- package/lib/util/graphic.js +114 -27
- package/lib/util/model.js +27 -1
- package/lib/util/number.js +12 -33
- package/lib/visual/visualSolution.js +1 -1
- package/package.json +3 -4
- package/src/chart/graph/GraphView.js +15 -10
- package/src/chart/graph/forceHelper.js +17 -24
- package/src/chart/helper/Line.js +5 -1
- package/src/chart/map/MapSeries.js +28 -31
- package/src/chart/map/MapView.js +96 -38
- package/src/chart/pie/labelLayout.js +19 -14
- package/src/chart/sankey/sankeyLayout.js +17 -19
- package/src/chart/sunburst/SunburstPiece.js +11 -3
- package/src/chart/themeRiver/ThemeRiverSeries.js +18 -33
- package/src/chart/tree/layoutHelper.js +56 -10
- package/src/chart/treemap/treemapLayout.js +13 -7
- package/src/component/axis/AxisBuilder.js +7 -1
- package/src/component/helper/MapDraw.js +5 -1
- package/src/component/helper/RoamController.js +3 -4
- package/src/component/legend/LegendView.js +20 -1
- package/src/component/legend/ScrollableLegendView.js +119 -85
- package/src/coord/axisHelper.js +19 -0
- package/src/coord/axisTickLabelBuilder.js +10 -13
- package/src/coord/geo/Geo.js +1 -1
- package/src/data/List.js +107 -28
- package/src/echarts.js +11 -5
- package/src/model/Model.js +1 -1
- package/src/model/mixin/textStyle.js +1 -0
- package/src/scale/Time.js +14 -4
- package/src/util/format.js +39 -1
- package/src/util/graphic.js +110 -28
- package/src/util/model.js +25 -0
- package/src/util/number.js +12 -33
- package/src/visual/visualSolution.js +1 -1
- package/extension/dataTool/quantile.js +0 -82
- package/lib/component/tooltip/TooltipContentManager.js +0 -126
- package/lib/util/nest.js +0 -148
- package/src/component/tooltip/TooltipContentManager.js +0 -120
- package/src/util/nest.js +0 -127
|
@@ -300,7 +300,7 @@ function $override(name, fn) {
|
|
|
300
300
|
* @return {*} new
|
|
301
301
|
*/
|
|
302
302
|
function clone(source) {
|
|
303
|
-
if (source == null || typeof source
|
|
303
|
+
if (source == null || typeof source !== 'object') {
|
|
304
304
|
return source;
|
|
305
305
|
}
|
|
306
306
|
|
|
@@ -504,13 +504,13 @@ function mixin(target, source, overlay) {
|
|
|
504
504
|
* @param {Array|TypedArray} data
|
|
505
505
|
*/
|
|
506
506
|
function isArrayLike(data) {
|
|
507
|
-
if (!
|
|
507
|
+
if (!data) {
|
|
508
508
|
return;
|
|
509
509
|
}
|
|
510
|
-
if (typeof data
|
|
510
|
+
if (typeof data === 'string') {
|
|
511
511
|
return false;
|
|
512
512
|
}
|
|
513
|
-
return typeof data.length
|
|
513
|
+
return typeof data.length === 'number';
|
|
514
514
|
}
|
|
515
515
|
|
|
516
516
|
/**
|
|
@@ -685,7 +685,7 @@ function isObject$1(value) {
|
|
|
685
685
|
// Avoid a V8 JIT bug in Chrome 19-20.
|
|
686
686
|
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
|
|
687
687
|
var type = typeof value;
|
|
688
|
-
return type === 'function' || (!!value && type
|
|
688
|
+
return type === 'function' || (!!value && type === 'object');
|
|
689
689
|
}
|
|
690
690
|
|
|
691
691
|
/**
|
|
@@ -1262,38 +1262,7 @@ Eventful.prototype = {
|
|
|
1262
1262
|
* @param {Object} context
|
|
1263
1263
|
*/
|
|
1264
1264
|
one: function (event, query, handler, context) {
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
if (typeof query === 'function') {
|
|
1268
|
-
context = handler;
|
|
1269
|
-
handler = query;
|
|
1270
|
-
query = null;
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1273
|
-
if (!handler || !event) {
|
|
1274
|
-
return this;
|
|
1275
|
-
}
|
|
1276
|
-
|
|
1277
|
-
query = normalizeQuery(this, query);
|
|
1278
|
-
|
|
1279
|
-
if (!_h[event]) {
|
|
1280
|
-
_h[event] = [];
|
|
1281
|
-
}
|
|
1282
|
-
|
|
1283
|
-
for (var i = 0; i < _h[event].length; i++) {
|
|
1284
|
-
if (_h[event][i].h === handler) {
|
|
1285
|
-
return this;
|
|
1286
|
-
}
|
|
1287
|
-
}
|
|
1288
|
-
|
|
1289
|
-
_h[event].push({
|
|
1290
|
-
h: handler,
|
|
1291
|
-
one: true,
|
|
1292
|
-
query: query,
|
|
1293
|
-
ctx: context || this
|
|
1294
|
-
});
|
|
1295
|
-
|
|
1296
|
-
return this;
|
|
1265
|
+
return on(this, event, query, handler, context, true);
|
|
1297
1266
|
},
|
|
1298
1267
|
|
|
1299
1268
|
/**
|
|
@@ -1305,38 +1274,7 @@ Eventful.prototype = {
|
|
|
1305
1274
|
* @param {Object} [context]
|
|
1306
1275
|
*/
|
|
1307
1276
|
on: function (event, query, handler, context) {
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
if (typeof query === 'function') {
|
|
1311
|
-
context = handler;
|
|
1312
|
-
handler = query;
|
|
1313
|
-
query = null;
|
|
1314
|
-
}
|
|
1315
|
-
|
|
1316
|
-
if (!handler || !event) {
|
|
1317
|
-
return this;
|
|
1318
|
-
}
|
|
1319
|
-
|
|
1320
|
-
query = normalizeQuery(this, query);
|
|
1321
|
-
|
|
1322
|
-
if (!_h[event]) {
|
|
1323
|
-
_h[event] = [];
|
|
1324
|
-
}
|
|
1325
|
-
|
|
1326
|
-
for (var i = 0; i < _h[event].length; i++) {
|
|
1327
|
-
if (_h[event][i].h === handler) {
|
|
1328
|
-
return this;
|
|
1329
|
-
}
|
|
1330
|
-
}
|
|
1331
|
-
|
|
1332
|
-
_h[event].push({
|
|
1333
|
-
h: handler,
|
|
1334
|
-
one: false,
|
|
1335
|
-
query: query,
|
|
1336
|
-
ctx: context || this
|
|
1337
|
-
});
|
|
1338
|
-
|
|
1339
|
-
return this;
|
|
1277
|
+
return on(this, event, query, handler, context, false);
|
|
1340
1278
|
},
|
|
1341
1279
|
|
|
1342
1280
|
/**
|
|
@@ -1347,7 +1285,7 @@ Eventful.prototype = {
|
|
|
1347
1285
|
*/
|
|
1348
1286
|
isSilent: function (event) {
|
|
1349
1287
|
var _h = this._$handlers;
|
|
1350
|
-
return _h[event]
|
|
1288
|
+
return !_h[event] || !_h[event].length;
|
|
1351
1289
|
},
|
|
1352
1290
|
|
|
1353
1291
|
/**
|
|
@@ -1520,6 +1458,50 @@ function normalizeQuery(host, query) {
|
|
|
1520
1458
|
return query;
|
|
1521
1459
|
}
|
|
1522
1460
|
|
|
1461
|
+
function on(eventful, event, query, handler, context, isOnce) {
|
|
1462
|
+
var _h = eventful._$handlers;
|
|
1463
|
+
|
|
1464
|
+
if (typeof query === 'function') {
|
|
1465
|
+
context = handler;
|
|
1466
|
+
handler = query;
|
|
1467
|
+
query = null;
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
if (!handler || !event) {
|
|
1471
|
+
return eventful;
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
query = normalizeQuery(eventful, query);
|
|
1475
|
+
|
|
1476
|
+
if (!_h[event]) {
|
|
1477
|
+
_h[event] = [];
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1480
|
+
for (var i = 0; i < _h[event].length; i++) {
|
|
1481
|
+
if (_h[event][i].h === handler) {
|
|
1482
|
+
return eventful;
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
var wrap = {
|
|
1487
|
+
h: handler,
|
|
1488
|
+
one: isOnce,
|
|
1489
|
+
query: query,
|
|
1490
|
+
ctx: context || eventful,
|
|
1491
|
+
// FIXME
|
|
1492
|
+
// Do not publish this feature util it is proved that it makes sense.
|
|
1493
|
+
callAtLast: handler.zrEventfulCallAtLast
|
|
1494
|
+
};
|
|
1495
|
+
|
|
1496
|
+
var lastIndex = _h[event].length - 1;
|
|
1497
|
+
var lastWrap = _h[event][lastIndex];
|
|
1498
|
+
(lastWrap && lastWrap.callAtLast)
|
|
1499
|
+
? _h[event].splice(lastIndex, 0, wrap)
|
|
1500
|
+
: _h[event].push(wrap);
|
|
1501
|
+
|
|
1502
|
+
return eventful;
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1523
1505
|
/**
|
|
1524
1506
|
* 事件辅助类
|
|
1525
1507
|
* @module zrender/core/event
|
|
@@ -1604,7 +1586,7 @@ function normalizeEvent(el, e, calculate) {
|
|
|
1604
1586
|
e.zrDelta = (e.wheelDelta) ? e.wheelDelta / 120 : -(e.detail || 0) / 3;
|
|
1605
1587
|
}
|
|
1606
1588
|
else {
|
|
1607
|
-
var touch = eventType
|
|
1589
|
+
var touch = eventType !== 'touchend'
|
|
1608
1590
|
? e.targetTouches[0]
|
|
1609
1591
|
: e.changedTouches[0];
|
|
1610
1592
|
touch && clientToLocal(el, touch, e, calculate);
|
|
@@ -1618,6 +1600,10 @@ function normalizeEvent(el, e, calculate) {
|
|
|
1618
1600
|
if (e.which == null && button !== undefined && MOUSE_EVENT_REG.test(e.type)) {
|
|
1619
1601
|
e.which = (button & 1 ? 1 : (button & 2 ? 3 : (button & 4 ? 2 : 0)));
|
|
1620
1602
|
}
|
|
1603
|
+
// [Caution]: `e.which` from browser is not always reliable. For example,
|
|
1604
|
+
// when press left button and `mousemove (pointermove)` in Edge, the `e.which`
|
|
1605
|
+
// is 65536 and the `e.button` is -1. But the `mouseup (pointerup)` and
|
|
1606
|
+
// `mousedown (pointerdown)` is the same as Chrome does.
|
|
1621
1607
|
|
|
1622
1608
|
return e;
|
|
1623
1609
|
}
|
|
@@ -1686,6 +1672,134 @@ var stop = isDomLevel2
|
|
|
1686
1672
|
e.cancelBubble = true;
|
|
1687
1673
|
};
|
|
1688
1674
|
|
|
1675
|
+
/**
|
|
1676
|
+
* This method only works for mouseup and mousedown. The functionality is restricted
|
|
1677
|
+
* for fault tolerance, See the `e.which` compatibility above.
|
|
1678
|
+
*
|
|
1679
|
+
* @param {MouseEvent} e
|
|
1680
|
+
* @return {boolean}
|
|
1681
|
+
*/
|
|
1682
|
+
|
|
1683
|
+
|
|
1684
|
+
/**
|
|
1685
|
+
* To be removed.
|
|
1686
|
+
* @deprecated
|
|
1687
|
+
*/
|
|
1688
|
+
|
|
1689
|
+
/**
|
|
1690
|
+
* Only implements needed gestures for mobile.
|
|
1691
|
+
*/
|
|
1692
|
+
|
|
1693
|
+
var GestureMgr = function () {
|
|
1694
|
+
|
|
1695
|
+
/**
|
|
1696
|
+
* @private
|
|
1697
|
+
* @type {Array.<Object>}
|
|
1698
|
+
*/
|
|
1699
|
+
this._track = [];
|
|
1700
|
+
};
|
|
1701
|
+
|
|
1702
|
+
GestureMgr.prototype = {
|
|
1703
|
+
|
|
1704
|
+
constructor: GestureMgr,
|
|
1705
|
+
|
|
1706
|
+
recognize: function (event, target, root) {
|
|
1707
|
+
this._doTrack(event, target, root);
|
|
1708
|
+
return this._recognize(event);
|
|
1709
|
+
},
|
|
1710
|
+
|
|
1711
|
+
clear: function () {
|
|
1712
|
+
this._track.length = 0;
|
|
1713
|
+
return this;
|
|
1714
|
+
},
|
|
1715
|
+
|
|
1716
|
+
_doTrack: function (event, target, root) {
|
|
1717
|
+
var touches = event.touches;
|
|
1718
|
+
|
|
1719
|
+
if (!touches) {
|
|
1720
|
+
return;
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1723
|
+
var trackItem = {
|
|
1724
|
+
points: [],
|
|
1725
|
+
touches: [],
|
|
1726
|
+
target: target,
|
|
1727
|
+
event: event
|
|
1728
|
+
};
|
|
1729
|
+
|
|
1730
|
+
for (var i = 0, len = touches.length; i < len; i++) {
|
|
1731
|
+
var touch = touches[i];
|
|
1732
|
+
var pos = clientToLocal(root, touch, {});
|
|
1733
|
+
trackItem.points.push([pos.zrX, pos.zrY]);
|
|
1734
|
+
trackItem.touches.push(touch);
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1737
|
+
this._track.push(trackItem);
|
|
1738
|
+
},
|
|
1739
|
+
|
|
1740
|
+
_recognize: function (event) {
|
|
1741
|
+
for (var eventName in recognizers) {
|
|
1742
|
+
if (recognizers.hasOwnProperty(eventName)) {
|
|
1743
|
+
var gestureInfo = recognizers[eventName](this._track, event);
|
|
1744
|
+
if (gestureInfo) {
|
|
1745
|
+
return gestureInfo;
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
};
|
|
1751
|
+
|
|
1752
|
+
function dist$1(pointPair) {
|
|
1753
|
+
var dx = pointPair[1][0] - pointPair[0][0];
|
|
1754
|
+
var dy = pointPair[1][1] - pointPair[0][1];
|
|
1755
|
+
|
|
1756
|
+
return Math.sqrt(dx * dx + dy * dy);
|
|
1757
|
+
}
|
|
1758
|
+
|
|
1759
|
+
function center(pointPair) {
|
|
1760
|
+
return [
|
|
1761
|
+
(pointPair[0][0] + pointPair[1][0]) / 2,
|
|
1762
|
+
(pointPair[0][1] + pointPair[1][1]) / 2
|
|
1763
|
+
];
|
|
1764
|
+
}
|
|
1765
|
+
|
|
1766
|
+
var recognizers = {
|
|
1767
|
+
|
|
1768
|
+
pinch: function (track, event) {
|
|
1769
|
+
var trackLen = track.length;
|
|
1770
|
+
|
|
1771
|
+
if (!trackLen) {
|
|
1772
|
+
return;
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
var pinchEnd = (track[trackLen - 1] || {}).points;
|
|
1776
|
+
var pinchPre = (track[trackLen - 2] || {}).points || pinchEnd;
|
|
1777
|
+
|
|
1778
|
+
if (pinchPre
|
|
1779
|
+
&& pinchPre.length > 1
|
|
1780
|
+
&& pinchEnd
|
|
1781
|
+
&& pinchEnd.length > 1
|
|
1782
|
+
) {
|
|
1783
|
+
var pinchScale = dist$1(pinchEnd) / dist$1(pinchPre);
|
|
1784
|
+
!isFinite(pinchScale) && (pinchScale = 1);
|
|
1785
|
+
|
|
1786
|
+
event.pinchScale = pinchScale;
|
|
1787
|
+
|
|
1788
|
+
var pinchCenter = center(pinchEnd);
|
|
1789
|
+
event.pinchX = pinchCenter[0];
|
|
1790
|
+
event.pinchY = pinchCenter[1];
|
|
1791
|
+
|
|
1792
|
+
return {
|
|
1793
|
+
type: 'pinch',
|
|
1794
|
+
target: track[0].target,
|
|
1795
|
+
event: event
|
|
1796
|
+
};
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
// Only pinch currently.
|
|
1801
|
+
};
|
|
1802
|
+
|
|
1689
1803
|
var SILENT = 'silent';
|
|
1690
1804
|
|
|
1691
1805
|
function makeEventPacket(eveType, targetInfo, event) {
|
|
@@ -1714,7 +1828,7 @@ function stopEvent(event) {
|
|
|
1714
1828
|
stop(this.event);
|
|
1715
1829
|
}
|
|
1716
1830
|
|
|
1717
|
-
function EmptyProxy
|
|
1831
|
+
function EmptyProxy() {}
|
|
1718
1832
|
EmptyProxy.prototype.dispose = function () {};
|
|
1719
1833
|
|
|
1720
1834
|
var handlerNames = [
|
|
@@ -1730,7 +1844,7 @@ var handlerNames = [
|
|
|
1730
1844
|
* @param {module:zrender/dom/HandlerProxy} proxy HandlerProxy instance.
|
|
1731
1845
|
* @param {HTMLElement} painterRoot painter.root (not painter.getViewportRoot()).
|
|
1732
1846
|
*/
|
|
1733
|
-
var Handler = function(storage, painter, proxy, painterRoot) {
|
|
1847
|
+
var Handler = function (storage, painter, proxy, painterRoot) {
|
|
1734
1848
|
Eventful.call(this);
|
|
1735
1849
|
|
|
1736
1850
|
this.storage = storage;
|
|
@@ -1771,6 +1885,12 @@ var Handler = function(storage, painter, proxy, painterRoot) {
|
|
|
1771
1885
|
*/
|
|
1772
1886
|
this._lastY;
|
|
1773
1887
|
|
|
1888
|
+
/**
|
|
1889
|
+
* @private
|
|
1890
|
+
* @type {module:zrender/core/GestureMgr}
|
|
1891
|
+
*/
|
|
1892
|
+
this._gestureMgr;
|
|
1893
|
+
|
|
1774
1894
|
|
|
1775
1895
|
Draggable.call(this);
|
|
1776
1896
|
|
|
@@ -1845,7 +1965,7 @@ Handler.prototype = {
|
|
|
1845
1965
|
do {
|
|
1846
1966
|
element = element && element.parentNode;
|
|
1847
1967
|
}
|
|
1848
|
-
while (element && element.nodeType
|
|
1968
|
+
while (element && element.nodeType !== 9 && !(
|
|
1849
1969
|
innerDom = element === this.painterRoot
|
|
1850
1970
|
));
|
|
1851
1971
|
|
|
@@ -1926,7 +2046,7 @@ Handler.prototype = {
|
|
|
1926
2046
|
// 分发事件到用户自定义层
|
|
1927
2047
|
// 用户有可能在全局 click 事件中 dispose,所以需要判断下 painter 是否存在
|
|
1928
2048
|
this.painter && this.painter.eachOtherLayer(function (layer) {
|
|
1929
|
-
if (typeof(layer[eventHandler])
|
|
2049
|
+
if (typeof (layer[eventHandler]) === 'function') {
|
|
1930
2050
|
layer[eventHandler].call(layer, eventPacket);
|
|
1931
2051
|
}
|
|
1932
2052
|
if (layer.trigger) {
|
|
@@ -1944,11 +2064,11 @@ Handler.prototype = {
|
|
|
1944
2064
|
* @return {model:zrender/Element}
|
|
1945
2065
|
* @method
|
|
1946
2066
|
*/
|
|
1947
|
-
findHover: function(x, y, exclude) {
|
|
2067
|
+
findHover: function (x, y, exclude) {
|
|
1948
2068
|
var list = this.storage.getDisplayList();
|
|
1949
2069
|
var out = {x: x, y: y};
|
|
1950
2070
|
|
|
1951
|
-
for (var i = list.length - 1; i >= 0
|
|
2071
|
+
for (var i = list.length - 1; i >= 0; i--) {
|
|
1952
2072
|
var hoverCheckResult;
|
|
1953
2073
|
if (list[i] !== exclude
|
|
1954
2074
|
// getDisplayList may include ignored item in VML mode
|
|
@@ -1964,6 +2084,31 @@ Handler.prototype = {
|
|
|
1964
2084
|
}
|
|
1965
2085
|
|
|
1966
2086
|
return out;
|
|
2087
|
+
},
|
|
2088
|
+
|
|
2089
|
+
processGesture: function (event, stage) {
|
|
2090
|
+
if (!this._gestureMgr) {
|
|
2091
|
+
this._gestureMgr = new GestureMgr();
|
|
2092
|
+
}
|
|
2093
|
+
var gestureMgr = this._gestureMgr;
|
|
2094
|
+
|
|
2095
|
+
stage === 'start' && gestureMgr.clear();
|
|
2096
|
+
|
|
2097
|
+
var gestureInfo = gestureMgr.recognize(
|
|
2098
|
+
event,
|
|
2099
|
+
this.findHover(event.zrX, event.zrY, null).target,
|
|
2100
|
+
this.proxy.dom
|
|
2101
|
+
);
|
|
2102
|
+
|
|
2103
|
+
stage === 'end' && gestureMgr.clear();
|
|
2104
|
+
|
|
2105
|
+
// Do not do any preventDefault here. Upper application do that if necessary.
|
|
2106
|
+
if (gestureInfo) {
|
|
2107
|
+
var type = gestureInfo.type;
|
|
2108
|
+
event.gestureEvent = type;
|
|
2109
|
+
|
|
2110
|
+
this.dispatchToElement({target: gestureInfo.target}, type, gestureInfo.event);
|
|
2111
|
+
}
|
|
1967
2112
|
}
|
|
1968
2113
|
};
|
|
1969
2114
|
|
|
@@ -2010,7 +2155,7 @@ function isHover(displayable, x, y) {
|
|
|
2010
2155
|
// If clipped by ancestor.
|
|
2011
2156
|
// FIXME: If clipPath has neither stroke nor fill,
|
|
2012
2157
|
// el.clipPath.contain(x, y) will always return false.
|
|
2013
|
-
if (el.clipPath && !el.clipPath.contain(x, y))
|
|
2158
|
+
if (el.clipPath && !el.clipPath.contain(x, y)) {
|
|
2014
2159
|
return false;
|
|
2015
2160
|
}
|
|
2016
2161
|
if (el.silent) {
|
|
@@ -2034,7 +2179,7 @@ mixin(Handler, Draggable);
|
|
|
2034
2179
|
|
|
2035
2180
|
var ArrayCtor$1 = typeof Float32Array === 'undefined'
|
|
2036
2181
|
? Array
|
|
2037
|
-
|
|
2182
|
+
: Float32Array;
|
|
2038
2183
|
|
|
2039
2184
|
/**
|
|
2040
2185
|
* Create a identity matrix.
|
|
@@ -2701,13 +2846,14 @@ var easing = {
|
|
|
2701
2846
|
return 1;
|
|
2702
2847
|
}
|
|
2703
2848
|
if (!a || a < 1) {
|
|
2704
|
-
a = 1;
|
|
2849
|
+
a = 1;
|
|
2850
|
+
s = p / 4;
|
|
2705
2851
|
}
|
|
2706
2852
|
else {
|
|
2707
2853
|
s = p * Math.asin(1 / a) / (2 * Math.PI);
|
|
2708
2854
|
}
|
|
2709
|
-
return -(a * Math.pow(2, 10 * (k -= 1))
|
|
2710
|
-
Math.sin((k - s) * (2 * Math.PI) / p));
|
|
2855
|
+
return -(a * Math.pow(2, 10 * (k -= 1))
|
|
2856
|
+
* Math.sin((k - s) * (2 * Math.PI) / p));
|
|
2711
2857
|
},
|
|
2712
2858
|
/**
|
|
2713
2859
|
* @param {number} k
|
|
@@ -2724,13 +2870,14 @@ var easing = {
|
|
|
2724
2870
|
return 1;
|
|
2725
2871
|
}
|
|
2726
2872
|
if (!a || a < 1) {
|
|
2727
|
-
a = 1;
|
|
2873
|
+
a = 1;
|
|
2874
|
+
s = p / 4;
|
|
2728
2875
|
}
|
|
2729
2876
|
else {
|
|
2730
2877
|
s = p * Math.asin(1 / a) / (2 * Math.PI);
|
|
2731
2878
|
}
|
|
2732
|
-
return (a * Math.pow(2, -10 * k)
|
|
2733
|
-
|
|
2879
|
+
return (a * Math.pow(2, -10 * k)
|
|
2880
|
+
* Math.sin((k - s) * (2 * Math.PI) / p) + 1);
|
|
2734
2881
|
},
|
|
2735
2882
|
/**
|
|
2736
2883
|
* @param {number} k
|
|
@@ -2747,7 +2894,8 @@ var easing = {
|
|
|
2747
2894
|
return 1;
|
|
2748
2895
|
}
|
|
2749
2896
|
if (!a || a < 1) {
|
|
2750
|
-
a = 1;
|
|
2897
|
+
a = 1;
|
|
2898
|
+
s = p / 4;
|
|
2751
2899
|
}
|
|
2752
2900
|
else {
|
|
2753
2901
|
s = p * Math.asin(1 / a) / (2 * Math.PI);
|
|
@@ -2897,7 +3045,7 @@ Clip.prototype = {
|
|
|
2897
3045
|
percent = Math.min(percent, 1);
|
|
2898
3046
|
|
|
2899
3047
|
var easing$$1 = this.easing;
|
|
2900
|
-
var easingFunc = typeof easing$$1
|
|
3048
|
+
var easingFunc = typeof easing$$1 === 'string' ? easing[easing$$1] : easing$$1;
|
|
2901
3049
|
var schedule = typeof easingFunc === 'function'
|
|
2902
3050
|
? easingFunc(percent)
|
|
2903
3051
|
: percent;
|
|
@@ -2905,9 +3053,9 @@ Clip.prototype = {
|
|
|
2905
3053
|
this.fire('frame', schedule);
|
|
2906
3054
|
|
|
2907
3055
|
// 结束
|
|
2908
|
-
if (percent
|
|
3056
|
+
if (percent === 1) {
|
|
2909
3057
|
if (this.loop) {
|
|
2910
|
-
this.restart
|
|
3058
|
+
this.restart(globalTime);
|
|
2911
3059
|
// 重新开始周期
|
|
2912
3060
|
// 抛出而不是直接调用事件直到 stage.update 后再统一调用这些事件
|
|
2913
3061
|
return 'restart';
|
|
@@ -3141,80 +3289,80 @@ LRUProto.clear = function () {
|
|
|
3141
3289
|
};
|
|
3142
3290
|
|
|
3143
3291
|
var kCSSColorTable = {
|
|
3144
|
-
'transparent': [0,0,0,0], 'aliceblue': [240,248,255,1],
|
|
3145
|
-
'antiquewhite': [250,235,215,1], 'aqua': [0,255,255,1],
|
|
3146
|
-
'aquamarine': [127,255,212,1], 'azure': [240,255,255,1],
|
|
3147
|
-
'beige': [245,245,220,1], 'bisque': [255,228,196,1],
|
|
3148
|
-
'black': [0,0,0,1], 'blanchedalmond': [255,235,205,1],
|
|
3149
|
-
'blue': [0,0,255,1], 'blueviolet': [138,43,226,1],
|
|
3150
|
-
'brown': [165,42,42,1], 'burlywood': [222,184,135,1],
|
|
3151
|
-
'cadetblue': [95,158,160,1], 'chartreuse': [127,255,0,1],
|
|
3152
|
-
'chocolate': [210,105,30,1], 'coral': [255,127,80,1],
|
|
3153
|
-
'cornflowerblue': [100,149,237,1], 'cornsilk': [255,248,220,1],
|
|
3154
|
-
'crimson': [220,20,60,1], 'cyan': [0,255,255,1],
|
|
3155
|
-
'darkblue': [0,0,139,1], 'darkcyan': [0,139,139,1],
|
|
3156
|
-
'darkgoldenrod': [184,134,11,1], 'darkgray': [169,169,169,1],
|
|
3157
|
-
'darkgreen': [0,100,0,1], 'darkgrey': [169,169,169,1],
|
|
3158
|
-
'darkkhaki': [189,183,107,1], 'darkmagenta': [139,0,139,1],
|
|
3159
|
-
'darkolivegreen': [85,107,47,1], 'darkorange': [255,140,0,1],
|
|
3160
|
-
'darkorchid': [153,50,204,1], 'darkred': [139,0,0,1],
|
|
3161
|
-
'darksalmon': [233,150,122,1], 'darkseagreen': [143,188,143,1],
|
|
3162
|
-
'darkslateblue': [72,61,139,1], 'darkslategray': [47,79,79,1],
|
|
3163
|
-
'darkslategrey': [47,79,79,1], 'darkturquoise': [0,206,209,1],
|
|
3164
|
-
'darkviolet': [148,0,211,1], 'deeppink': [255,20,147,1],
|
|
3165
|
-
'deepskyblue': [0,191,255,1], 'dimgray': [105,105,105,1],
|
|
3166
|
-
'dimgrey': [105,105,105,1], 'dodgerblue': [30,144,255,1],
|
|
3167
|
-
'firebrick': [178,34,34,1], 'floralwhite': [255,250,240,1],
|
|
3168
|
-
'forestgreen': [34,139,34,1], 'fuchsia': [255,0,255,1],
|
|
3169
|
-
'gainsboro': [220,220,220,1], 'ghostwhite': [248,248,255,1],
|
|
3170
|
-
'gold': [255,215,0,1], 'goldenrod': [218,165,32,1],
|
|
3171
|
-
'gray': [128,128,128,1], 'green': [0,128,0,1],
|
|
3172
|
-
'greenyellow': [173,255,47,1], 'grey': [128,128,128,1],
|
|
3173
|
-
'honeydew': [240,255,240,1], 'hotpink': [255,105,180,1],
|
|
3174
|
-
'indianred': [205,92,92,1], 'indigo': [75,0,130,1],
|
|
3175
|
-
'ivory': [255,255,240,1], 'khaki': [240,230,140,1],
|
|
3176
|
-
'lavender': [230,230,250,1], 'lavenderblush': [255,240,245,1],
|
|
3177
|
-
'lawngreen': [124,252,0,1], 'lemonchiffon': [255,250,205,1],
|
|
3178
|
-
'lightblue': [173,216,230,1], 'lightcoral': [240,128,128,1],
|
|
3179
|
-
'lightcyan': [224,255,255,1], 'lightgoldenrodyellow': [250,250,210,1],
|
|
3180
|
-
'lightgray': [211,211,211,1], 'lightgreen': [144,238,144,1],
|
|
3181
|
-
'lightgrey': [211,211,211,1], 'lightpink': [255,182,193,1],
|
|
3182
|
-
'lightsalmon': [255,160,122,1], 'lightseagreen': [32,178,170,1],
|
|
3183
|
-
'lightskyblue': [135,206,250,1], 'lightslategray': [119,136,153,1],
|
|
3184
|
-
'lightslategrey': [119,136,153,1], 'lightsteelblue': [176,196,222,1],
|
|
3185
|
-
'lightyellow': [255,255,224,1], 'lime': [0,255,0,1],
|
|
3186
|
-
'limegreen': [50,205,50,1], 'linen': [250,240,230,1],
|
|
3187
|
-
'magenta': [255,0,255,1], 'maroon': [128,0,0,1],
|
|
3188
|
-
'mediumaquamarine': [102,205,170,1], 'mediumblue': [0,0,205,1],
|
|
3189
|
-
'mediumorchid': [186,85,211,1], 'mediumpurple': [147,112,219,1],
|
|
3190
|
-
'mediumseagreen': [60,179,113,1], 'mediumslateblue': [123,104,238,1],
|
|
3191
|
-
'mediumspringgreen': [0,250,154,1], 'mediumturquoise': [72,209,204,1],
|
|
3192
|
-
'mediumvioletred': [199,21,133,1], 'midnightblue': [25,25,112,1],
|
|
3193
|
-
'mintcream': [245,255,250,1], 'mistyrose': [255,228,225,1],
|
|
3194
|
-
'moccasin': [255,228,181,1], 'navajowhite': [255,222,173,1],
|
|
3195
|
-
'navy': [0,0,128,1], 'oldlace': [253,245,230,1],
|
|
3196
|
-
'olive': [128,128,0,1], 'olivedrab': [107,142,35,1],
|
|
3197
|
-
'orange': [255,165,0,1], 'orangered': [255,69,0,1],
|
|
3198
|
-
'orchid': [218,112,214,1], 'palegoldenrod': [238,232,170,1],
|
|
3199
|
-
'palegreen': [152,251,152,1], 'paleturquoise': [175,238,238,1],
|
|
3200
|
-
'palevioletred': [219,112,147,1], 'papayawhip': [255,239,213,1],
|
|
3201
|
-
'peachpuff': [255,218,185,1], 'peru': [205,133,63,1],
|
|
3202
|
-
'pink': [255,192,203,1], 'plum': [221,160,221,1],
|
|
3203
|
-
'powderblue': [176,224,230,1], 'purple': [128,0,128,1],
|
|
3204
|
-
'red': [255,0,0,1], 'rosybrown': [188,143,143,1],
|
|
3205
|
-
'royalblue': [65,105,225,1], 'saddlebrown': [139,69,19,1],
|
|
3206
|
-
'salmon': [250,128,114,1], 'sandybrown': [244,164,96,1],
|
|
3207
|
-
'seagreen': [46,139,87,1], 'seashell': [255,245,238,1],
|
|
3208
|
-
'sienna': [160,82,45,1], 'silver': [192,192,192,1],
|
|
3209
|
-
'skyblue': [135,206,235,1], 'slateblue': [106,90,205,1],
|
|
3210
|
-
'slategray': [112,128,144,1], 'slategrey': [112,128,144,1],
|
|
3211
|
-
'snow': [255,250,250,1], 'springgreen': [0,255,127,1],
|
|
3212
|
-
'steelblue': [70,130,180,1], 'tan': [210,180,140,1],
|
|
3213
|
-
'teal': [0,128,128,1], 'thistle': [216,191,216,1],
|
|
3214
|
-
'tomato': [255,99,71,1], 'turquoise': [64,224,208,1],
|
|
3215
|
-
'violet': [238,130,238,1], 'wheat': [245,222,179,1],
|
|
3216
|
-
'white': [255,255,255,1], 'whitesmoke': [245,245,245,1],
|
|
3217
|
-
'yellow': [255,255,0,1], 'yellowgreen': [154,205,50,1]
|
|
3292
|
+
'transparent': [0, 0, 0, 0], 'aliceblue': [240, 248, 255, 1],
|
|
3293
|
+
'antiquewhite': [250, 235, 215, 1], 'aqua': [0, 255, 255, 1],
|
|
3294
|
+
'aquamarine': [127, 255, 212, 1], 'azure': [240, 255, 255, 1],
|
|
3295
|
+
'beige': [245, 245, 220, 1], 'bisque': [255, 228, 196, 1],
|
|
3296
|
+
'black': [0, 0, 0, 1], 'blanchedalmond': [255, 235, 205, 1],
|
|
3297
|
+
'blue': [0, 0, 255, 1], 'blueviolet': [138, 43, 226, 1],
|
|
3298
|
+
'brown': [165, 42, 42, 1], 'burlywood': [222, 184, 135, 1],
|
|
3299
|
+
'cadetblue': [95, 158, 160, 1], 'chartreuse': [127, 255, 0, 1],
|
|
3300
|
+
'chocolate': [210, 105, 30, 1], 'coral': [255, 127, 80, 1],
|
|
3301
|
+
'cornflowerblue': [100, 149, 237, 1], 'cornsilk': [255, 248, 220, 1],
|
|
3302
|
+
'crimson': [220, 20, 60, 1], 'cyan': [0, 255, 255, 1],
|
|
3303
|
+
'darkblue': [0, 0, 139, 1], 'darkcyan': [0, 139, 139, 1],
|
|
3304
|
+
'darkgoldenrod': [184, 134, 11, 1], 'darkgray': [169, 169, 169, 1],
|
|
3305
|
+
'darkgreen': [0, 100, 0, 1], 'darkgrey': [169, 169, 169, 1],
|
|
3306
|
+
'darkkhaki': [189, 183, 107, 1], 'darkmagenta': [139, 0, 139, 1],
|
|
3307
|
+
'darkolivegreen': [85, 107, 47, 1], 'darkorange': [255, 140, 0, 1],
|
|
3308
|
+
'darkorchid': [153, 50, 204, 1], 'darkred': [139, 0, 0, 1],
|
|
3309
|
+
'darksalmon': [233, 150, 122, 1], 'darkseagreen': [143, 188, 143, 1],
|
|
3310
|
+
'darkslateblue': [72, 61, 139, 1], 'darkslategray': [47, 79, 79, 1],
|
|
3311
|
+
'darkslategrey': [47, 79, 79, 1], 'darkturquoise': [0, 206, 209, 1],
|
|
3312
|
+
'darkviolet': [148, 0, 211, 1], 'deeppink': [255, 20, 147, 1],
|
|
3313
|
+
'deepskyblue': [0, 191, 255, 1], 'dimgray': [105, 105, 105, 1],
|
|
3314
|
+
'dimgrey': [105, 105, 105, 1], 'dodgerblue': [30, 144, 255, 1],
|
|
3315
|
+
'firebrick': [178, 34, 34, 1], 'floralwhite': [255, 250, 240, 1],
|
|
3316
|
+
'forestgreen': [34, 139, 34, 1], 'fuchsia': [255, 0, 255, 1],
|
|
3317
|
+
'gainsboro': [220, 220, 220, 1], 'ghostwhite': [248, 248, 255, 1],
|
|
3318
|
+
'gold': [255, 215, 0, 1], 'goldenrod': [218, 165, 32, 1],
|
|
3319
|
+
'gray': [128, 128, 128, 1], 'green': [0, 128, 0, 1],
|
|
3320
|
+
'greenyellow': [173, 255, 47, 1], 'grey': [128, 128, 128, 1],
|
|
3321
|
+
'honeydew': [240, 255, 240, 1], 'hotpink': [255, 105, 180, 1],
|
|
3322
|
+
'indianred': [205, 92, 92, 1], 'indigo': [75, 0, 130, 1],
|
|
3323
|
+
'ivory': [255, 255, 240, 1], 'khaki': [240, 230, 140, 1],
|
|
3324
|
+
'lavender': [230, 230, 250, 1], 'lavenderblush': [255, 240, 245, 1],
|
|
3325
|
+
'lawngreen': [124, 252, 0, 1], 'lemonchiffon': [255, 250, 205, 1],
|
|
3326
|
+
'lightblue': [173, 216, 230, 1], 'lightcoral': [240, 128, 128, 1],
|
|
3327
|
+
'lightcyan': [224, 255, 255, 1], 'lightgoldenrodyellow': [250, 250, 210, 1],
|
|
3328
|
+
'lightgray': [211, 211, 211, 1], 'lightgreen': [144, 238, 144, 1],
|
|
3329
|
+
'lightgrey': [211, 211, 211, 1], 'lightpink': [255, 182, 193, 1],
|
|
3330
|
+
'lightsalmon': [255, 160, 122, 1], 'lightseagreen': [32, 178, 170, 1],
|
|
3331
|
+
'lightskyblue': [135, 206, 250, 1], 'lightslategray': [119, 136, 153, 1],
|
|
3332
|
+
'lightslategrey': [119, 136, 153, 1], 'lightsteelblue': [176, 196, 222, 1],
|
|
3333
|
+
'lightyellow': [255, 255, 224, 1], 'lime': [0, 255, 0, 1],
|
|
3334
|
+
'limegreen': [50, 205, 50, 1], 'linen': [250, 240, 230, 1],
|
|
3335
|
+
'magenta': [255, 0, 255, 1], 'maroon': [128, 0, 0, 1],
|
|
3336
|
+
'mediumaquamarine': [102, 205, 170, 1], 'mediumblue': [0, 0, 205, 1],
|
|
3337
|
+
'mediumorchid': [186, 85, 211, 1], 'mediumpurple': [147, 112, 219, 1],
|
|
3338
|
+
'mediumseagreen': [60, 179, 113, 1], 'mediumslateblue': [123, 104, 238, 1],
|
|
3339
|
+
'mediumspringgreen': [0, 250, 154, 1], 'mediumturquoise': [72, 209, 204, 1],
|
|
3340
|
+
'mediumvioletred': [199, 21, 133, 1], 'midnightblue': [25, 25, 112, 1],
|
|
3341
|
+
'mintcream': [245, 255, 250, 1], 'mistyrose': [255, 228, 225, 1],
|
|
3342
|
+
'moccasin': [255, 228, 181, 1], 'navajowhite': [255, 222, 173, 1],
|
|
3343
|
+
'navy': [0, 0, 128, 1], 'oldlace': [253, 245, 230, 1],
|
|
3344
|
+
'olive': [128, 128, 0, 1], 'olivedrab': [107, 142, 35, 1],
|
|
3345
|
+
'orange': [255, 165, 0, 1], 'orangered': [255, 69, 0, 1],
|
|
3346
|
+
'orchid': [218, 112, 214, 1], 'palegoldenrod': [238, 232, 170, 1],
|
|
3347
|
+
'palegreen': [152, 251, 152, 1], 'paleturquoise': [175, 238, 238, 1],
|
|
3348
|
+
'palevioletred': [219, 112, 147, 1], 'papayawhip': [255, 239, 213, 1],
|
|
3349
|
+
'peachpuff': [255, 218, 185, 1], 'peru': [205, 133, 63, 1],
|
|
3350
|
+
'pink': [255, 192, 203, 1], 'plum': [221, 160, 221, 1],
|
|
3351
|
+
'powderblue': [176, 224, 230, 1], 'purple': [128, 0, 128, 1],
|
|
3352
|
+
'red': [255, 0, 0, 1], 'rosybrown': [188, 143, 143, 1],
|
|
3353
|
+
'royalblue': [65, 105, 225, 1], 'saddlebrown': [139, 69, 19, 1],
|
|
3354
|
+
'salmon': [250, 128, 114, 1], 'sandybrown': [244, 164, 96, 1],
|
|
3355
|
+
'seagreen': [46, 139, 87, 1], 'seashell': [255, 245, 238, 1],
|
|
3356
|
+
'sienna': [160, 82, 45, 1], 'silver': [192, 192, 192, 1],
|
|
3357
|
+
'skyblue': [135, 206, 235, 1], 'slateblue': [106, 90, 205, 1],
|
|
3358
|
+
'slategray': [112, 128, 144, 1], 'slategrey': [112, 128, 144, 1],
|
|
3359
|
+
'snow': [255, 250, 250, 1], 'springgreen': [0, 255, 127, 1],
|
|
3360
|
+
'steelblue': [70, 130, 180, 1], 'tan': [210, 180, 140, 1],
|
|
3361
|
+
'teal': [0, 128, 128, 1], 'thistle': [216, 191, 216, 1],
|
|
3362
|
+
'tomato': [255, 99, 71, 1], 'turquoise': [64, 224, 208, 1],
|
|
3363
|
+
'violet': [238, 130, 238, 1], 'wheat': [245, 222, 179, 1],
|
|
3364
|
+
'white': [255, 255, 255, 1], 'whitesmoke': [245, 245, 245, 1],
|
|
3365
|
+
'yellow': [255, 255, 0, 1], 'yellowgreen': [154, 205, 50, 1]
|
|
3218
3366
|
};
|
|
3219
3367
|
|
|
3220
3368
|
function clampCssByte(i) { // Clamp to integer 0 .. 255.
|
|
@@ -3255,7 +3403,7 @@ function cssHueToRgb(m1, m2, h) {
|
|
|
3255
3403
|
return m2;
|
|
3256
3404
|
}
|
|
3257
3405
|
if (h * 3 < 2) {
|
|
3258
|
-
return m1 + (m2 - m1) * (2/3 - h) * 6;
|
|
3406
|
+
return m1 + (m2 - m1) * (2 / 3 - h) * 6;
|
|
3259
3407
|
}
|
|
3260
3408
|
return m1;
|
|
3261
3409
|
}
|
|
@@ -3344,7 +3492,8 @@ function parse(colorStr, rgbaArr) {
|
|
|
3344
3492
|
|
|
3345
3493
|
return;
|
|
3346
3494
|
}
|
|
3347
|
-
var op = str.indexOf('(')
|
|
3495
|
+
var op = str.indexOf('(');
|
|
3496
|
+
var ep = str.indexOf(')');
|
|
3348
3497
|
if (op !== -1 && ep + 1 === str.length) {
|
|
3349
3498
|
var fname = str.substr(0, op);
|
|
3350
3499
|
var params = str.substr(op + 1, ep - (op + 1)).split(',');
|
|
@@ -3565,7 +3714,7 @@ function interpolateString(p0, p1, percent) {
|
|
|
3565
3714
|
*/
|
|
3566
3715
|
function interpolateArray(p0, p1, percent, out, arrDim) {
|
|
3567
3716
|
var len = p0.length;
|
|
3568
|
-
if (arrDim
|
|
3717
|
+
if (arrDim === 1) {
|
|
3569
3718
|
for (var i = 0; i < len; i++) {
|
|
3570
3719
|
out[i] = interpolateNumber(p0[i], p1[i], percent);
|
|
3571
3720
|
}
|
|
@@ -3671,7 +3820,7 @@ function catmullRomInterpolateArray(
|
|
|
3671
3820
|
p0, p1, p2, p3, t, t2, t3, out, arrDim
|
|
3672
3821
|
) {
|
|
3673
3822
|
var len = p0.length;
|
|
3674
|
-
if (arrDim
|
|
3823
|
+
if (arrDim === 1) {
|
|
3675
3824
|
for (var i = 0; i < len; i++) {
|
|
3676
3825
|
out[i] = catmullRomInterpolate(
|
|
3677
3826
|
p0[i], p1[i], p2[i], p3[i], t, t2, t3
|
|
@@ -3760,7 +3909,7 @@ function createTrackClip(animator, easing, oneTrackDone, keyframes, propName, fo
|
|
|
3760
3909
|
|
|
3761
3910
|
var trackMaxTime;
|
|
3762
3911
|
// Sort keyframe as ascending
|
|
3763
|
-
keyframes.sort(function(a, b) {
|
|
3912
|
+
keyframes.sort(function (a, b) {
|
|
3764
3913
|
return a.time - b.time;
|
|
3765
3914
|
});
|
|
3766
3915
|
|
|
@@ -3784,7 +3933,7 @@ function createTrackClip(animator, easing, oneTrackDone, keyframes, propName, fo
|
|
|
3784
3933
|
prevValue = value;
|
|
3785
3934
|
|
|
3786
3935
|
// Try converting a string to a color array
|
|
3787
|
-
if (typeof value
|
|
3936
|
+
if (typeof value === 'string') {
|
|
3788
3937
|
var colorArray = parse(value);
|
|
3789
3938
|
if (colorArray) {
|
|
3790
3939
|
value = colorArray;
|
|
@@ -3962,7 +4111,7 @@ function createTrackClip(animator, easing, oneTrackDone, keyframes, propName, fo
|
|
|
3962
4111
|
* @param {Function} getter
|
|
3963
4112
|
* @param {Function} setter
|
|
3964
4113
|
*/
|
|
3965
|
-
var Animator = function(target, loop, getter, setter) {
|
|
4114
|
+
var Animator = function (target, loop, getter, setter) {
|
|
3966
4115
|
this._tracks = {};
|
|
3967
4116
|
this._target = target;
|
|
3968
4117
|
|
|
@@ -3989,7 +4138,7 @@ Animator.prototype = {
|
|
|
3989
4138
|
* @param {Object} props 关键帧的属性值,key-value表示
|
|
3990
4139
|
* @return {module:zrender/animation/Animator}
|
|
3991
4140
|
*/
|
|
3992
|
-
when: function(time /* ms */, props) {
|
|
4141
|
+
when: function (time /* ms */, props) {
|
|
3993
4142
|
var tracks = this._tracks;
|
|
3994
4143
|
for (var propName in props) {
|
|
3995
4144
|
if (!props.hasOwnProperty(propName)) {
|
|
@@ -4074,7 +4223,7 @@ Animator.prototype = {
|
|
|
4074
4223
|
var self = this;
|
|
4075
4224
|
var clipCount = 0;
|
|
4076
4225
|
|
|
4077
|
-
var oneTrackDone = function() {
|
|
4226
|
+
var oneTrackDone = function () {
|
|
4078
4227
|
clipCount--;
|
|
4079
4228
|
if (!clipCount) {
|
|
4080
4229
|
self._doneCallback();
|
|
@@ -4154,7 +4303,7 @@ Animator.prototype = {
|
|
|
4154
4303
|
* @param {Function} cb
|
|
4155
4304
|
* @return {module:zrender/animation/Animator}
|
|
4156
4305
|
*/
|
|
4157
|
-
done: function(cb) {
|
|
4306
|
+
done: function (cb) {
|
|
4158
4307
|
if (cb) {
|
|
4159
4308
|
this._doneList.push(cb);
|
|
4160
4309
|
}
|
|
@@ -4894,7 +5043,7 @@ BoundingRect.prototype = {
|
|
|
4894
5043
|
var by0 = b.y;
|
|
4895
5044
|
var by1 = b.y + b.height;
|
|
4896
5045
|
|
|
4897
|
-
return !
|
|
5046
|
+
return !(ax1 < bx0 || bx1 < ax0 || ay1 < by0 || by1 < ay0);
|
|
4898
5047
|
},
|
|
4899
5048
|
|
|
4900
5049
|
contain: function (x, y) {
|
|
@@ -5693,7 +5842,7 @@ function TimSort(array, compare) {
|
|
|
5693
5842
|
}
|
|
5694
5843
|
}
|
|
5695
5844
|
|
|
5696
|
-
function mergeHigh
|
|
5845
|
+
function mergeHigh(start1, length1, start2, length2) {
|
|
5697
5846
|
var i = 0;
|
|
5698
5847
|
|
|
5699
5848
|
for (i = 0; i < length2; i++) {
|
|
@@ -6164,6 +6313,15 @@ var fixShadow = function (ctx, propName, value) {
|
|
|
6164
6313
|
return value;
|
|
6165
6314
|
};
|
|
6166
6315
|
|
|
6316
|
+
var ContextCachedBy = {
|
|
6317
|
+
NONE: 0,
|
|
6318
|
+
STYLE_BIND: 1,
|
|
6319
|
+
PLAIN_TEXT: 2
|
|
6320
|
+
};
|
|
6321
|
+
|
|
6322
|
+
// Avoid confused with 0/false.
|
|
6323
|
+
var WILL_BE_RESTORED = 9;
|
|
6324
|
+
|
|
6167
6325
|
var STYLE_COMMON_PROPS = [
|
|
6168
6326
|
['shadowBlur', 0], ['shadowOffsetX', 0], ['shadowOffsetY', 0], ['shadowColor', '#000'],
|
|
6169
6327
|
['lineCap', 'butt'], ['lineJoin', 'miter'], ['miterLimit', 10]
|
|
@@ -6523,30 +6681,34 @@ Style.prototype = {
|
|
|
6523
6681
|
bind: function (ctx, el, prevEl) {
|
|
6524
6682
|
var style = this;
|
|
6525
6683
|
var prevStyle = prevEl && prevEl.style;
|
|
6526
|
-
|
|
6684
|
+
// If no prevStyle, it means first draw.
|
|
6685
|
+
// Only apply cache if the last time cachced by this function.
|
|
6686
|
+
var notCheckCache = !prevStyle || ctx.__attrCachedBy !== ContextCachedBy.STYLE_BIND;
|
|
6687
|
+
|
|
6688
|
+
ctx.__attrCachedBy = ContextCachedBy.STYLE_BIND;
|
|
6527
6689
|
|
|
6528
6690
|
for (var i = 0; i < STYLE_COMMON_PROPS.length; i++) {
|
|
6529
6691
|
var prop = STYLE_COMMON_PROPS[i];
|
|
6530
6692
|
var styleName = prop[0];
|
|
6531
6693
|
|
|
6532
|
-
if (
|
|
6694
|
+
if (notCheckCache || style[styleName] !== prevStyle[styleName]) {
|
|
6533
6695
|
// FIXME Invalid property value will cause style leak from previous element.
|
|
6534
6696
|
ctx[styleName] =
|
|
6535
6697
|
fixShadow(ctx, styleName, style[styleName] || prop[1]);
|
|
6536
6698
|
}
|
|
6537
6699
|
}
|
|
6538
6700
|
|
|
6539
|
-
if ((
|
|
6701
|
+
if ((notCheckCache || style.fill !== prevStyle.fill)) {
|
|
6540
6702
|
ctx.fillStyle = style.fill;
|
|
6541
6703
|
}
|
|
6542
|
-
if ((
|
|
6704
|
+
if ((notCheckCache || style.stroke !== prevStyle.stroke)) {
|
|
6543
6705
|
ctx.strokeStyle = style.stroke;
|
|
6544
6706
|
}
|
|
6545
|
-
if ((
|
|
6707
|
+
if ((notCheckCache || style.opacity !== prevStyle.opacity)) {
|
|
6546
6708
|
ctx.globalAlpha = style.opacity == null ? 1 : style.opacity;
|
|
6547
6709
|
}
|
|
6548
6710
|
|
|
6549
|
-
if ((
|
|
6711
|
+
if ((notCheckCache || style.blend !== prevStyle.blend)) {
|
|
6550
6712
|
ctx.globalCompositeOperation = style.blend || 'source-over';
|
|
6551
6713
|
}
|
|
6552
6714
|
if (this.hasStroke()) {
|
|
@@ -6703,7 +6865,7 @@ function createDom(id, painter, dpr) {
|
|
|
6703
6865
|
* @param {module:zrender/Painter} painter
|
|
6704
6866
|
* @param {number} [dpr]
|
|
6705
6867
|
*/
|
|
6706
|
-
var Layer = function(id, painter, dpr) {
|
|
6868
|
+
var Layer = function (id, painter, dpr) {
|
|
6707
6869
|
var dom;
|
|
6708
6870
|
dpr = dpr || devicePixelRatio;
|
|
6709
6871
|
if (typeof id === 'string') {
|
|
@@ -6792,7 +6954,7 @@ Layer.prototype = {
|
|
|
6792
6954
|
this.domBack = createDom('back-' + this.id, this.painter, dpr);
|
|
6793
6955
|
this.ctxBack = this.domBack.getContext('2d');
|
|
6794
6956
|
|
|
6795
|
-
if (dpr
|
|
6957
|
+
if (dpr !== 1) {
|
|
6796
6958
|
this.ctxBack.scale(dpr, dpr);
|
|
6797
6959
|
}
|
|
6798
6960
|
},
|
|
@@ -6820,7 +6982,7 @@ Layer.prototype = {
|
|
|
6820
6982
|
domBack.width = width * dpr;
|
|
6821
6983
|
domBack.height = height * dpr;
|
|
6822
6984
|
|
|
6823
|
-
if (dpr
|
|
6985
|
+
if (dpr !== 1) {
|
|
6824
6986
|
this.ctxBack.scale(dpr, dpr);
|
|
6825
6987
|
}
|
|
6826
6988
|
}
|
|
@@ -6953,7 +7115,7 @@ function createOrUpdateImage(newImageOrSrc, image, hostEl, cb, cbPayload) {
|
|
|
6953
7115
|
!isImageReady(image) && cachedImgObj.pending.push(pendingWrap);
|
|
6954
7116
|
}
|
|
6955
7117
|
else {
|
|
6956
|
-
|
|
7118
|
+
image = new Image();
|
|
6957
7119
|
image.onload = image.onerror = imageOnLoad;
|
|
6958
7120
|
|
|
6959
7121
|
globalImageCache.put(
|
|
@@ -6998,7 +7160,7 @@ var textWidthCacheCounter = 0;
|
|
|
6998
7160
|
var TEXT_CACHE_MAX = 5000;
|
|
6999
7161
|
var STYLE_REG = /\{([a-zA-Z0-9_]+)\|([^}]*)\}/g;
|
|
7000
7162
|
|
|
7001
|
-
var DEFAULT_FONT = '12px sans-serif';
|
|
7163
|
+
var DEFAULT_FONT$1 = '12px sans-serif';
|
|
7002
7164
|
|
|
7003
7165
|
// Avoid assign to an exported variable, for transforming to cjs.
|
|
7004
7166
|
var methods$1 = {};
|
|
@@ -7012,7 +7174,7 @@ var methods$1 = {};
|
|
|
7012
7174
|
* @return {number} width
|
|
7013
7175
|
*/
|
|
7014
7176
|
function getWidth(text, font) {
|
|
7015
|
-
font = font || DEFAULT_FONT;
|
|
7177
|
+
font = font || DEFAULT_FONT$1;
|
|
7016
7178
|
var key = text + ':' + font;
|
|
7017
7179
|
if (textWidthCache[key]) {
|
|
7018
7180
|
return textWidthCache[key];
|
|
@@ -7047,14 +7209,14 @@ function getWidth(text, font) {
|
|
|
7047
7209
|
* @param {Object} [truncate]
|
|
7048
7210
|
* @return {Object} {x, y, width, height, lineHeight}
|
|
7049
7211
|
*/
|
|
7050
|
-
function getBoundingRect(text, font, textAlign, textVerticalAlign, textPadding, rich, truncate) {
|
|
7212
|
+
function getBoundingRect(text, font, textAlign, textVerticalAlign, textPadding, textLineHeight, rich, truncate) {
|
|
7051
7213
|
return rich
|
|
7052
|
-
? getRichTextRect(text, font, textAlign, textVerticalAlign, textPadding, rich, truncate)
|
|
7053
|
-
: getPlainTextRect(text, font, textAlign, textVerticalAlign, textPadding, truncate);
|
|
7214
|
+
? getRichTextRect(text, font, textAlign, textVerticalAlign, textPadding, textLineHeight, rich, truncate)
|
|
7215
|
+
: getPlainTextRect(text, font, textAlign, textVerticalAlign, textPadding, textLineHeight, truncate);
|
|
7054
7216
|
}
|
|
7055
7217
|
|
|
7056
|
-
function getPlainTextRect(text, font, textAlign, textVerticalAlign, textPadding, truncate) {
|
|
7057
|
-
var contentBlock = parsePlainText(text, font, textPadding, truncate);
|
|
7218
|
+
function getPlainTextRect(text, font, textAlign, textVerticalAlign, textPadding, textLineHeight, truncate) {
|
|
7219
|
+
var contentBlock = parsePlainText(text, font, textPadding, textLineHeight, truncate);
|
|
7058
7220
|
var outerWidth = getWidth(text, font);
|
|
7059
7221
|
if (textPadding) {
|
|
7060
7222
|
outerWidth += textPadding[1] + textPadding[3];
|
|
@@ -7070,13 +7232,14 @@ function getPlainTextRect(text, font, textAlign, textVerticalAlign, textPadding,
|
|
|
7070
7232
|
return rect;
|
|
7071
7233
|
}
|
|
7072
7234
|
|
|
7073
|
-
function getRichTextRect(text, font, textAlign, textVerticalAlign, textPadding, rich, truncate) {
|
|
7235
|
+
function getRichTextRect(text, font, textAlign, textVerticalAlign, textPadding, textLineHeight, rich, truncate) {
|
|
7074
7236
|
var contentBlock = parseRichText(text, {
|
|
7075
7237
|
rich: rich,
|
|
7076
7238
|
truncate: truncate,
|
|
7077
7239
|
font: font,
|
|
7078
7240
|
textAlign: textAlign,
|
|
7079
|
-
textPadding: textPadding
|
|
7241
|
+
textPadding: textPadding,
|
|
7242
|
+
textLineHeight: textLineHeight
|
|
7080
7243
|
});
|
|
7081
7244
|
var outerWidth = contentBlock.outerWidth;
|
|
7082
7245
|
var outerHeight = contentBlock.outerHeight;
|
|
@@ -7277,7 +7440,7 @@ function prepareTruncateOptions(containerWidth, font, ellipsis, options) {
|
|
|
7277
7440
|
contentWidth -= ascCharWidth;
|
|
7278
7441
|
}
|
|
7279
7442
|
|
|
7280
|
-
var ellipsisWidth = getWidth(ellipsis);
|
|
7443
|
+
var ellipsisWidth = getWidth(ellipsis, font);
|
|
7281
7444
|
if (ellipsisWidth > contentWidth) {
|
|
7282
7445
|
ellipsis = '';
|
|
7283
7446
|
ellipsisWidth = 0;
|
|
@@ -7308,7 +7471,7 @@ function truncateSingleLine(textLine, options) {
|
|
|
7308
7471
|
return textLine;
|
|
7309
7472
|
}
|
|
7310
7473
|
|
|
7311
|
-
for (var j = 0
|
|
7474
|
+
for (var j = 0; ; j++) {
|
|
7312
7475
|
if (lineWidth <= contentWidth || j >= options.maxIterations) {
|
|
7313
7476
|
textLine += options.ellipsis;
|
|
7314
7477
|
break;
|
|
@@ -7364,7 +7527,7 @@ function measureText(text, font) {
|
|
|
7364
7527
|
// Avoid assign to an exported variable, for transforming to cjs.
|
|
7365
7528
|
methods$1.measureText = function (text, font) {
|
|
7366
7529
|
var ctx = getContext();
|
|
7367
|
-
ctx.font = font || DEFAULT_FONT;
|
|
7530
|
+
ctx.font = font || DEFAULT_FONT$1;
|
|
7368
7531
|
return ctx.measureText(text);
|
|
7369
7532
|
};
|
|
7370
7533
|
|
|
@@ -7376,10 +7539,10 @@ methods$1.measureText = function (text, font) {
|
|
|
7376
7539
|
* @return {Object} block: {lineHeight, lines, height, outerHeight}
|
|
7377
7540
|
* Notice: for performance, do not calculate outerWidth util needed.
|
|
7378
7541
|
*/
|
|
7379
|
-
function parsePlainText(text, font, padding, truncate) {
|
|
7542
|
+
function parsePlainText(text, font, padding, textLineHeight, truncate) {
|
|
7380
7543
|
text != null && (text += '');
|
|
7381
7544
|
|
|
7382
|
-
var lineHeight = getLineHeight(font);
|
|
7545
|
+
var lineHeight = retrieve2(textLineHeight, getLineHeight(font));
|
|
7383
7546
|
var lines = text ? text.split('\n') : [];
|
|
7384
7547
|
var height = lines.length * lineHeight;
|
|
7385
7548
|
var outerHeight = height;
|
|
@@ -7663,6 +7826,15 @@ function makeFont(style) {
|
|
|
7663
7826
|
return font && trim(font) || style.textFont || style.font;
|
|
7664
7827
|
}
|
|
7665
7828
|
|
|
7829
|
+
/**
|
|
7830
|
+
* @param {Object} ctx
|
|
7831
|
+
* @param {Object} shape
|
|
7832
|
+
* @param {number} shape.x
|
|
7833
|
+
* @param {number} shape.y
|
|
7834
|
+
* @param {number} shape.width
|
|
7835
|
+
* @param {number} shape.height
|
|
7836
|
+
* @param {number} shape.r
|
|
7837
|
+
*/
|
|
7666
7838
|
function buildPath(ctx, shape) {
|
|
7667
7839
|
var x = shape.x;
|
|
7668
7840
|
var y = shape.y;
|
|
@@ -7743,6 +7915,8 @@ function buildPath(ctx, shape) {
|
|
|
7743
7915
|
r1 !== 0 && ctx.arc(x + r1, y + r1, r1, Math.PI, Math.PI * 1.5);
|
|
7744
7916
|
}
|
|
7745
7917
|
|
|
7918
|
+
var DEFAULT_FONT = DEFAULT_FONT$1;
|
|
7919
|
+
|
|
7746
7920
|
// TODO: Have not support 'start', 'end' yet.
|
|
7747
7921
|
var VALID_TEXT_ALIGN = {left: 1, right: 1, center: 1};
|
|
7748
7922
|
var VALID_TEXT_VERTICAL_ALIGN = {top: 1, bottom: 1, middle: 1};
|
|
@@ -7796,11 +7970,11 @@ function normalizeStyle(style) {
|
|
|
7796
7970
|
* @param {module:zrender/graphic/Style} style
|
|
7797
7971
|
* @param {Object|boolean} [rect] {x, y, width, height}
|
|
7798
7972
|
* If set false, rect text is not used.
|
|
7799
|
-
* @param {Element} [prevEl] For ctx prop cache.
|
|
7973
|
+
* @param {Element|module:zrender/graphic/helper/constant.WILL_BE_RESTORED} [prevEl] For ctx prop cache.
|
|
7800
7974
|
*/
|
|
7801
7975
|
function renderText(hostEl, ctx, text, style, rect, prevEl) {
|
|
7802
7976
|
style.rich
|
|
7803
|
-
? renderRichText(hostEl, ctx, text, style, rect)
|
|
7977
|
+
? renderRichText(hostEl, ctx, text, style, rect, prevEl)
|
|
7804
7978
|
: renderPlainText(hostEl, ctx, text, style, rect, prevEl);
|
|
7805
7979
|
}
|
|
7806
7980
|
|
|
@@ -7809,14 +7983,45 @@ function renderText(hostEl, ctx, text, style, rect, prevEl) {
|
|
|
7809
7983
|
function renderPlainText(hostEl, ctx, text, style, rect, prevEl) {
|
|
7810
7984
|
'use strict';
|
|
7811
7985
|
|
|
7812
|
-
var
|
|
7813
|
-
|
|
7814
|
-
var
|
|
7986
|
+
var needDrawBg = needDrawBackground(style);
|
|
7987
|
+
|
|
7988
|
+
var prevStyle;
|
|
7989
|
+
var checkCache = false;
|
|
7990
|
+
var cachedByMe = ctx.__attrCachedBy === ContextCachedBy.PLAIN_TEXT;
|
|
7991
|
+
|
|
7992
|
+
// Only take and check cache for `Text` el, but not RectText.
|
|
7993
|
+
if (prevEl !== WILL_BE_RESTORED) {
|
|
7994
|
+
if (prevEl) {
|
|
7995
|
+
prevStyle = prevEl.style;
|
|
7996
|
+
checkCache = !needDrawBg && cachedByMe && prevStyle;
|
|
7997
|
+
}
|
|
7998
|
+
|
|
7999
|
+
// Prevent from using cache in `Style::bind`, because of the case:
|
|
8000
|
+
// ctx property is modified by other properties than `Style::bind`
|
|
8001
|
+
// used, and Style::bind is called next.
|
|
8002
|
+
ctx.__attrCachedBy = needDrawBg ? ContextCachedBy.NONE : ContextCachedBy.PLAIN_TEXT;
|
|
8003
|
+
}
|
|
8004
|
+
// Since this will be restored, prevent from using these props to check cache in the next
|
|
8005
|
+
// entering of this method. But do not need to clear other cache like `Style::bind`.
|
|
8006
|
+
else if (cachedByMe) {
|
|
8007
|
+
ctx.__attrCachedBy = ContextCachedBy.NONE;
|
|
8008
|
+
}
|
|
7815
8009
|
|
|
7816
8010
|
var styleFont = style.font || DEFAULT_FONT;
|
|
7817
|
-
|
|
8011
|
+
// PENDING
|
|
8012
|
+
// Only `Text` el set `font` and keep it (`RectText` will restore). So theoretically
|
|
8013
|
+
// we can make font cache on ctx, which can cache for text el that are discontinuous.
|
|
8014
|
+
// But layer save/restore needed to be considered.
|
|
8015
|
+
// if (styleFont !== ctx.__fontCache) {
|
|
8016
|
+
// ctx.font = styleFont;
|
|
8017
|
+
// if (prevEl !== WILL_BE_RESTORED) {
|
|
8018
|
+
// ctx.__fontCache = styleFont;
|
|
8019
|
+
// }
|
|
8020
|
+
// }
|
|
8021
|
+
if (!checkCache || styleFont !== (prevStyle.font || DEFAULT_FONT)) {
|
|
7818
8022
|
ctx.font = styleFont;
|
|
7819
8023
|
}
|
|
8024
|
+
|
|
7820
8025
|
// Use the final font from context-2d, because the final
|
|
7821
8026
|
// font might not be the style.font when it is illegal.
|
|
7822
8027
|
// But get `ctx.font` might be time consuming.
|
|
@@ -7827,11 +8032,12 @@ function renderPlainText(hostEl, ctx, text, style, rect, prevEl) {
|
|
|
7827
8032
|
}
|
|
7828
8033
|
|
|
7829
8034
|
var textPadding = style.textPadding;
|
|
8035
|
+
var textLineHeight = style.textLineHeight;
|
|
7830
8036
|
|
|
7831
8037
|
var contentBlock = hostEl.__textCotentBlock;
|
|
7832
8038
|
if (!contentBlock || hostEl.__dirtyText) {
|
|
7833
8039
|
contentBlock = hostEl.__textCotentBlock = parsePlainText(
|
|
7834
|
-
text, computedFont, textPadding, style.truncate
|
|
8040
|
+
text, computedFont, textPadding, textLineHeight, style.truncate
|
|
7835
8041
|
);
|
|
7836
8042
|
}
|
|
7837
8043
|
|
|
@@ -7853,7 +8059,6 @@ function renderPlainText(hostEl, ctx, text, style, rect, prevEl) {
|
|
|
7853
8059
|
var textX = baseX;
|
|
7854
8060
|
var textY = boxY;
|
|
7855
8061
|
|
|
7856
|
-
var needDrawBg = needDrawBackground(style);
|
|
7857
8062
|
if (needDrawBg || textPadding) {
|
|
7858
8063
|
// Consider performance, do not call getTextWidth util necessary.
|
|
7859
8064
|
var textWidth = getWidth(text, computedFont);
|
|
@@ -7876,6 +8081,8 @@ function renderPlainText(hostEl, ctx, text, style, rect, prevEl) {
|
|
|
7876
8081
|
// Force baseline to be "middle". Otherwise, if using "top", the
|
|
7877
8082
|
// text will offset downward a little bit in font "Microsoft YaHei".
|
|
7878
8083
|
ctx.textBaseline = 'middle';
|
|
8084
|
+
// Set text opacity
|
|
8085
|
+
ctx.globalAlpha = style.opacity || 1;
|
|
7879
8086
|
|
|
7880
8087
|
// Always set shadowBlur and shadowOffset to avoid leak from displayable.
|
|
7881
8088
|
for (var i = 0; i < SHADOW_STYLE_COMMON_PROPS.length; i++) {
|
|
@@ -7883,7 +8090,7 @@ function renderPlainText(hostEl, ctx, text, style, rect, prevEl) {
|
|
|
7883
8090
|
var styleProp = propItem[0];
|
|
7884
8091
|
var ctxProp = propItem[1];
|
|
7885
8092
|
var val = style[styleProp];
|
|
7886
|
-
if (!
|
|
8093
|
+
if (!checkCache || val !== prevStyle[styleProp]) {
|
|
7887
8094
|
ctx[ctxProp] = fixShadow(ctx, ctxProp, val || propItem[2]);
|
|
7888
8095
|
}
|
|
7889
8096
|
}
|
|
@@ -7892,9 +8099,9 @@ function renderPlainText(hostEl, ctx, text, style, rect, prevEl) {
|
|
|
7892
8099
|
textY += lineHeight / 2;
|
|
7893
8100
|
|
|
7894
8101
|
var textStrokeWidth = style.textStrokeWidth;
|
|
7895
|
-
var textStrokeWidthPrev =
|
|
7896
|
-
var strokeWidthChanged = !
|
|
7897
|
-
var strokeChanged = !
|
|
8102
|
+
var textStrokeWidthPrev = checkCache ? prevStyle.textStrokeWidth : null;
|
|
8103
|
+
var strokeWidthChanged = !checkCache || textStrokeWidth !== textStrokeWidthPrev;
|
|
8104
|
+
var strokeChanged = !checkCache || strokeWidthChanged || style.textStroke !== prevStyle.textStroke;
|
|
7898
8105
|
var textStroke = getStroke(style.textStroke, textStrokeWidth);
|
|
7899
8106
|
var textFill = getFill(style.textFill);
|
|
7900
8107
|
|
|
@@ -7907,7 +8114,7 @@ function renderPlainText(hostEl, ctx, text, style, rect, prevEl) {
|
|
|
7907
8114
|
}
|
|
7908
8115
|
}
|
|
7909
8116
|
if (textFill) {
|
|
7910
|
-
if (!
|
|
8117
|
+
if (!checkCache || style.textFill !== prevStyle.textFill) {
|
|
7911
8118
|
ctx.fillStyle = textFill;
|
|
7912
8119
|
}
|
|
7913
8120
|
}
|
|
@@ -7928,7 +8135,13 @@ function renderPlainText(hostEl, ctx, text, style, rect, prevEl) {
|
|
|
7928
8135
|
}
|
|
7929
8136
|
}
|
|
7930
8137
|
|
|
7931
|
-
function renderRichText(hostEl, ctx, text, style, rect) {
|
|
8138
|
+
function renderRichText(hostEl, ctx, text, style, rect, prevEl) {
|
|
8139
|
+
// Do not do cache for rich text because of the complexity.
|
|
8140
|
+
// But `RectText` this will be restored, do not need to clear other cache like `Style::bind`.
|
|
8141
|
+
if (prevEl !== WILL_BE_RESTORED) {
|
|
8142
|
+
ctx.__attrCachedBy = ContextCachedBy.NONE;
|
|
8143
|
+
}
|
|
8144
|
+
|
|
7932
8145
|
var contentBlock = hostEl.__textCotentBlock;
|
|
7933
8146
|
|
|
7934
8147
|
if (!contentBlock || hostEl.__dirtyText) {
|
|
@@ -8098,8 +8311,10 @@ function placeToken(hostEl, ctx, token, style, lineHeight, lineTop, x, textAlign
|
|
|
8098
8311
|
}
|
|
8099
8312
|
|
|
8100
8313
|
function needDrawBackground(style) {
|
|
8101
|
-
return
|
|
8102
|
-
|
|
8314
|
+
return !!(
|
|
8315
|
+
style.textBackgroundColor
|
|
8316
|
+
|| (style.textBorderWidth && style.textBorderColor)
|
|
8317
|
+
);
|
|
8103
8318
|
}
|
|
8104
8319
|
|
|
8105
8320
|
// style: {textBackgroundColor, textBorderWidth, textBorderColor, textBorderRadius, text}
|
|
@@ -8142,10 +8357,6 @@ function drawBackground(hostEl, ctx, style, x, y, width, height) {
|
|
|
8142
8357
|
ctx.fill();
|
|
8143
8358
|
}
|
|
8144
8359
|
}
|
|
8145
|
-
else if (isFunction$1(textBackgroundColor)) {
|
|
8146
|
-
setCtx(ctx, 'fillStyle', textBackgroundColor(style));
|
|
8147
|
-
ctx.fill();
|
|
8148
|
-
}
|
|
8149
8360
|
else if (isObject$1(textBackgroundColor)) {
|
|
8150
8361
|
var image = textBackgroundColor.image;
|
|
8151
8362
|
|
|
@@ -8336,7 +8547,7 @@ RectText.prototype = {
|
|
|
8336
8547
|
}
|
|
8337
8548
|
|
|
8338
8549
|
// transformText and textRotation can not be used at the same time.
|
|
8339
|
-
renderText(this, ctx, text, style, rect);
|
|
8550
|
+
renderText(this, ctx, text, style, rect, WILL_BE_RESTORED);
|
|
8340
8551
|
|
|
8341
8552
|
ctx.restore();
|
|
8342
8553
|
}
|
|
@@ -8363,8 +8574,8 @@ function Displayable(opts) {
|
|
|
8363
8574
|
// Extend properties
|
|
8364
8575
|
for (var name in opts) {
|
|
8365
8576
|
if (
|
|
8366
|
-
opts.hasOwnProperty(name)
|
|
8367
|
-
|
|
8577
|
+
opts.hasOwnProperty(name)
|
|
8578
|
+
&& name !== 'style'
|
|
8368
8579
|
) {
|
|
8369
8580
|
this[name] = opts[name];
|
|
8370
8581
|
}
|
|
@@ -8698,14 +8909,14 @@ ZImage.prototype = {
|
|
|
8698
8909
|
// Draw rect text
|
|
8699
8910
|
if (style.text != null) {
|
|
8700
8911
|
// Only restore transform when needs draw text.
|
|
8701
|
-
this.restoreTransform(ctx);
|
|
8912
|
+
this.restoreTransform(ctx);
|
|
8702
8913
|
this.drawRectText(ctx, this.getBoundingRect());
|
|
8703
8914
|
}
|
|
8704
8915
|
},
|
|
8705
8916
|
|
|
8706
8917
|
getBoundingRect: function () {
|
|
8707
8918
|
var style = this.style;
|
|
8708
|
-
if (!
|
|
8919
|
+
if (!this._rect) {
|
|
8709
8920
|
this._rect = new BoundingRect(
|
|
8710
8921
|
style.x || 0, style.y || 0, style.width || 0, style.height || 0
|
|
8711
8922
|
);
|
|
@@ -8735,8 +8946,8 @@ function isLayerValid(layer) {
|
|
|
8735
8946
|
return true;
|
|
8736
8947
|
}
|
|
8737
8948
|
|
|
8738
|
-
if (typeof(layer.resize) !== 'function'
|
|
8739
|
-
|| typeof(layer.refresh) !== 'function'
|
|
8949
|
+
if (typeof (layer.resize) !== 'function'
|
|
8950
|
+
|| typeof (layer.refresh) !== 'function'
|
|
8740
8951
|
) {
|
|
8741
8952
|
return false;
|
|
8742
8953
|
}
|
|
@@ -8757,7 +8968,7 @@ function isDisplayableCulled(el, width, height) {
|
|
|
8757
8968
|
}
|
|
8758
8969
|
|
|
8759
8970
|
function isClipPathChanged(clipPaths, prevClipPaths) {
|
|
8760
|
-
if (clipPaths
|
|
8971
|
+
if (clipPaths === prevClipPaths) { // Can both be null or undefined
|
|
8761
8972
|
return false;
|
|
8762
8973
|
}
|
|
8763
8974
|
|
|
@@ -9566,7 +9777,7 @@ Painter.prototype = {
|
|
|
9566
9777
|
domRoot.style.display = '';
|
|
9567
9778
|
|
|
9568
9779
|
// 优化没有实际改变的resize
|
|
9569
|
-
if (this._width
|
|
9780
|
+
if (this._width !== width || height !== this._height) {
|
|
9570
9781
|
domRoot.style.width = width + 'px';
|
|
9571
9782
|
domRoot.style.height = height + 'px';
|
|
9572
9783
|
|
|
@@ -9802,7 +10013,7 @@ var Animation = function (options) {
|
|
|
9802
10013
|
|
|
9803
10014
|
this.stage = options.stage || {};
|
|
9804
10015
|
|
|
9805
|
-
this.onframe = options.onframe || function() {};
|
|
10016
|
+
this.onframe = options.onframe || function () {};
|
|
9806
10017
|
|
|
9807
10018
|
// private properties
|
|
9808
10019
|
this._clips = [];
|
|
@@ -9845,7 +10056,7 @@ Animation.prototype = {
|
|
|
9845
10056
|
* 删除动画片段
|
|
9846
10057
|
* @param {module:zrender/animation/Clip} clip
|
|
9847
10058
|
*/
|
|
9848
|
-
removeClip: function(clip) {
|
|
10059
|
+
removeClip: function (clip) {
|
|
9849
10060
|
var idx = indexOf(this._clips, clip);
|
|
9850
10061
|
if (idx >= 0) {
|
|
9851
10062
|
this._clips.splice(idx, 1);
|
|
@@ -9864,7 +10075,7 @@ Animation.prototype = {
|
|
|
9864
10075
|
animator.animation = null;
|
|
9865
10076
|
},
|
|
9866
10077
|
|
|
9867
|
-
_update: function() {
|
|
10078
|
+
_update: function () {
|
|
9868
10079
|
var time = new Date().getTime() - this._pausedTime;
|
|
9869
10080
|
var delta = time - this._time;
|
|
9870
10081
|
var clips = this._clips;
|
|
@@ -10012,120 +10223,6 @@ Animation.prototype = {
|
|
|
10012
10223
|
|
|
10013
10224
|
mixin(Animation, Eventful);
|
|
10014
10225
|
|
|
10015
|
-
/**
|
|
10016
|
-
* Only implements needed gestures for mobile.
|
|
10017
|
-
*/
|
|
10018
|
-
|
|
10019
|
-
var GestureMgr = function () {
|
|
10020
|
-
|
|
10021
|
-
/**
|
|
10022
|
-
* @private
|
|
10023
|
-
* @type {Array.<Object>}
|
|
10024
|
-
*/
|
|
10025
|
-
this._track = [];
|
|
10026
|
-
};
|
|
10027
|
-
|
|
10028
|
-
GestureMgr.prototype = {
|
|
10029
|
-
|
|
10030
|
-
constructor: GestureMgr,
|
|
10031
|
-
|
|
10032
|
-
recognize: function (event, target, root) {
|
|
10033
|
-
this._doTrack(event, target, root);
|
|
10034
|
-
return this._recognize(event);
|
|
10035
|
-
},
|
|
10036
|
-
|
|
10037
|
-
clear: function () {
|
|
10038
|
-
this._track.length = 0;
|
|
10039
|
-
return this;
|
|
10040
|
-
},
|
|
10041
|
-
|
|
10042
|
-
_doTrack: function (event, target, root) {
|
|
10043
|
-
var touches = event.touches;
|
|
10044
|
-
|
|
10045
|
-
if (!touches) {
|
|
10046
|
-
return;
|
|
10047
|
-
}
|
|
10048
|
-
|
|
10049
|
-
var trackItem = {
|
|
10050
|
-
points: [],
|
|
10051
|
-
touches: [],
|
|
10052
|
-
target: target,
|
|
10053
|
-
event: event
|
|
10054
|
-
};
|
|
10055
|
-
|
|
10056
|
-
for (var i = 0, len = touches.length; i < len; i++) {
|
|
10057
|
-
var touch = touches[i];
|
|
10058
|
-
var pos = clientToLocal(root, touch, {});
|
|
10059
|
-
trackItem.points.push([pos.zrX, pos.zrY]);
|
|
10060
|
-
trackItem.touches.push(touch);
|
|
10061
|
-
}
|
|
10062
|
-
|
|
10063
|
-
this._track.push(trackItem);
|
|
10064
|
-
},
|
|
10065
|
-
|
|
10066
|
-
_recognize: function (event) {
|
|
10067
|
-
for (var eventName in recognizers) {
|
|
10068
|
-
if (recognizers.hasOwnProperty(eventName)) {
|
|
10069
|
-
var gestureInfo = recognizers[eventName](this._track, event);
|
|
10070
|
-
if (gestureInfo) {
|
|
10071
|
-
return gestureInfo;
|
|
10072
|
-
}
|
|
10073
|
-
}
|
|
10074
|
-
}
|
|
10075
|
-
}
|
|
10076
|
-
};
|
|
10077
|
-
|
|
10078
|
-
function dist$1(pointPair) {
|
|
10079
|
-
var dx = pointPair[1][0] - pointPair[0][0];
|
|
10080
|
-
var dy = pointPair[1][1] - pointPair[0][1];
|
|
10081
|
-
|
|
10082
|
-
return Math.sqrt(dx * dx + dy * dy);
|
|
10083
|
-
}
|
|
10084
|
-
|
|
10085
|
-
function center(pointPair) {
|
|
10086
|
-
return [
|
|
10087
|
-
(pointPair[0][0] + pointPair[1][0]) / 2,
|
|
10088
|
-
(pointPair[0][1] + pointPair[1][1]) / 2
|
|
10089
|
-
];
|
|
10090
|
-
}
|
|
10091
|
-
|
|
10092
|
-
var recognizers = {
|
|
10093
|
-
|
|
10094
|
-
pinch: function (track, event) {
|
|
10095
|
-
var trackLen = track.length;
|
|
10096
|
-
|
|
10097
|
-
if (!trackLen) {
|
|
10098
|
-
return;
|
|
10099
|
-
}
|
|
10100
|
-
|
|
10101
|
-
var pinchEnd = (track[trackLen - 1] || {}).points;
|
|
10102
|
-
var pinchPre = (track[trackLen - 2] || {}).points || pinchEnd;
|
|
10103
|
-
|
|
10104
|
-
if (pinchPre
|
|
10105
|
-
&& pinchPre.length > 1
|
|
10106
|
-
&& pinchEnd
|
|
10107
|
-
&& pinchEnd.length > 1
|
|
10108
|
-
) {
|
|
10109
|
-
var pinchScale = dist$1(pinchEnd) / dist$1(pinchPre);
|
|
10110
|
-
!isFinite(pinchScale) && (pinchScale = 1);
|
|
10111
|
-
|
|
10112
|
-
event.pinchScale = pinchScale;
|
|
10113
|
-
|
|
10114
|
-
var pinchCenter = center(pinchEnd);
|
|
10115
|
-
event.pinchX = pinchCenter[0];
|
|
10116
|
-
event.pinchY = pinchCenter[1];
|
|
10117
|
-
|
|
10118
|
-
return {
|
|
10119
|
-
type: 'pinch',
|
|
10120
|
-
target: track[0].target,
|
|
10121
|
-
event: event
|
|
10122
|
-
};
|
|
10123
|
-
}
|
|
10124
|
-
}
|
|
10125
|
-
|
|
10126
|
-
// Only pinch currently.
|
|
10127
|
-
};
|
|
10128
|
-
|
|
10129
10226
|
var TOUCH_CLICK_DELAY = 300;
|
|
10130
10227
|
|
|
10131
10228
|
var mouseHandlerNames = [
|
|
@@ -10150,28 +10247,6 @@ function eventNameFix(name) {
|
|
|
10150
10247
|
return (name === 'mousewheel' && env$1.browser.firefox) ? 'DOMMouseScroll' : name;
|
|
10151
10248
|
}
|
|
10152
10249
|
|
|
10153
|
-
function processGesture(proxy, event, stage) {
|
|
10154
|
-
var gestureMgr = proxy._gestureMgr;
|
|
10155
|
-
|
|
10156
|
-
stage === 'start' && gestureMgr.clear();
|
|
10157
|
-
|
|
10158
|
-
var gestureInfo = gestureMgr.recognize(
|
|
10159
|
-
event,
|
|
10160
|
-
proxy.handler.findHover(event.zrX, event.zrY, null).target,
|
|
10161
|
-
proxy.dom
|
|
10162
|
-
);
|
|
10163
|
-
|
|
10164
|
-
stage === 'end' && gestureMgr.clear();
|
|
10165
|
-
|
|
10166
|
-
// Do not do any preventDefault here. Upper application do that if necessary.
|
|
10167
|
-
if (gestureInfo) {
|
|
10168
|
-
var type = gestureInfo.type;
|
|
10169
|
-
event.gestureEvent = type;
|
|
10170
|
-
|
|
10171
|
-
proxy.handler.dispatchToElement({target: gestureInfo.target}, type, gestureInfo.event);
|
|
10172
|
-
}
|
|
10173
|
-
}
|
|
10174
|
-
|
|
10175
10250
|
// function onMSGestureChange(proxy, event) {
|
|
10176
10251
|
// if (event.translationX || event.translationY) {
|
|
10177
10252
|
// // mousemove is carried by MSGesture to reduce the sensitivity.
|
|
@@ -10222,8 +10297,8 @@ var domHandlers = {
|
|
|
10222
10297
|
event = normalizeEvent(this.dom, event);
|
|
10223
10298
|
|
|
10224
10299
|
var element = event.toElement || event.relatedTarget;
|
|
10225
|
-
if (element
|
|
10226
|
-
while (element && element.nodeType
|
|
10300
|
+
if (element !== this.dom) {
|
|
10301
|
+
while (element && element.nodeType !== 9) {
|
|
10227
10302
|
// 忽略包含在root中的dom引起的mouseOut
|
|
10228
10303
|
if (element === this.dom) {
|
|
10229
10304
|
return;
|
|
@@ -10252,7 +10327,7 @@ var domHandlers = {
|
|
|
10252
10327
|
|
|
10253
10328
|
this._lastTouchMoment = new Date();
|
|
10254
10329
|
|
|
10255
|
-
processGesture(this, event, 'start');
|
|
10330
|
+
this.handler.processGesture(this, event, 'start');
|
|
10256
10331
|
|
|
10257
10332
|
// In touch device, trigger `mousemove`(`mouseover`) should
|
|
10258
10333
|
// be triggered, and must before `mousedown` triggered.
|
|
@@ -10276,7 +10351,7 @@ var domHandlers = {
|
|
|
10276
10351
|
// mouse event in upper applicatoin.
|
|
10277
10352
|
event.zrByTouch = true;
|
|
10278
10353
|
|
|
10279
|
-
processGesture(this, event, 'change');
|
|
10354
|
+
this.handler.processGesture(this, event, 'change');
|
|
10280
10355
|
|
|
10281
10356
|
// Mouse move should always be triggered no matter whether
|
|
10282
10357
|
// there is gestrue event, because mouse move and pinch may
|
|
@@ -10299,7 +10374,7 @@ var domHandlers = {
|
|
|
10299
10374
|
// mouse event in upper applicatoin.
|
|
10300
10375
|
event.zrByTouch = true;
|
|
10301
10376
|
|
|
10302
|
-
processGesture(this, event, 'end');
|
|
10377
|
+
this.handler.processGesture(this, event, 'end');
|
|
10303
10378
|
|
|
10304
10379
|
domHandlers.mouseup.call(this, event);
|
|
10305
10380
|
|
|
@@ -10419,12 +10494,6 @@ function HandlerDomProxy(dom) {
|
|
|
10419
10494
|
*/
|
|
10420
10495
|
this._touchTimer;
|
|
10421
10496
|
|
|
10422
|
-
/**
|
|
10423
|
-
* @private
|
|
10424
|
-
* @type {module:zrender/core/GestureMgr}
|
|
10425
|
-
*/
|
|
10426
|
-
this._gestureMgr = new GestureMgr();
|
|
10427
|
-
|
|
10428
10497
|
this._handlers = {};
|
|
10429
10498
|
|
|
10430
10499
|
initDomHandler(this);
|
|
@@ -10510,12 +10579,12 @@ var painterCtors = {
|
|
|
10510
10579
|
/**
|
|
10511
10580
|
* @type {string}
|
|
10512
10581
|
*/
|
|
10513
|
-
var version$1 = '4.0.
|
|
10582
|
+
var version$1 = '4.0.7';
|
|
10514
10583
|
|
|
10515
10584
|
/**
|
|
10516
10585
|
* Initializing a zrender instance
|
|
10517
10586
|
* @param {HTMLElement} dom
|
|
10518
|
-
* @param {Object} opts
|
|
10587
|
+
* @param {Object} [opts]
|
|
10519
10588
|
* @param {string} [opts.renderer='canvas'] 'canvas' or 'svg'
|
|
10520
10589
|
* @param {number} [opts.devicePixelRatio]
|
|
10521
10590
|
* @param {number|string} [opts.width] Can be 'auto' (the same as null/undefined)
|
|
@@ -10704,7 +10773,7 @@ ZRender.prototype = {
|
|
|
10704
10773
|
/**
|
|
10705
10774
|
* Mark and repaint the canvas in the next frame of browser
|
|
10706
10775
|
*/
|
|
10707
|
-
refresh: function() {
|
|
10776
|
+
refresh: function () {
|
|
10708
10777
|
this._needsRefresh = true;
|
|
10709
10778
|
},
|
|
10710
10779
|
|
|
@@ -10783,7 +10852,7 @@ ZRender.prototype = {
|
|
|
10783
10852
|
* @param {number|string} [opts.width] Can be 'auto' (the same as null/undefined)
|
|
10784
10853
|
* @param {number|string} [opts.height] Can be 'auto' (the same as null/undefined)
|
|
10785
10854
|
*/
|
|
10786
|
-
resize: function(opts) {
|
|
10855
|
+
resize: function (opts) {
|
|
10787
10856
|
opts = opts || {};
|
|
10788
10857
|
this.painter.resize(opts.width, opts.height);
|
|
10789
10858
|
this.handler.resize();
|
|
@@ -10799,14 +10868,14 @@ ZRender.prototype = {
|
|
|
10799
10868
|
/**
|
|
10800
10869
|
* Get container width
|
|
10801
10870
|
*/
|
|
10802
|
-
getWidth: function() {
|
|
10871
|
+
getWidth: function () {
|
|
10803
10872
|
return this.painter.getWidth();
|
|
10804
10873
|
},
|
|
10805
10874
|
|
|
10806
10875
|
/**
|
|
10807
10876
|
* Get container height
|
|
10808
10877
|
*/
|
|
10809
|
-
getHeight: function() {
|
|
10878
|
+
getHeight: function () {
|
|
10810
10879
|
return this.painter.getHeight();
|
|
10811
10880
|
},
|
|
10812
10881
|
|
|
@@ -10829,7 +10898,7 @@ ZRender.prototype = {
|
|
|
10829
10898
|
* @param {number} width
|
|
10830
10899
|
* @param {number} height
|
|
10831
10900
|
*/
|
|
10832
|
-
pathToImage: function(e, dpr) {
|
|
10901
|
+
pathToImage: function (e, dpr) {
|
|
10833
10902
|
return this.painter.pathToImage(e, dpr);
|
|
10834
10903
|
},
|
|
10835
10904
|
|
|
@@ -10858,7 +10927,7 @@ ZRender.prototype = {
|
|
|
10858
10927
|
* @param {Function} eventHandler Handler function
|
|
10859
10928
|
* @param {Object} [context] Context object
|
|
10860
10929
|
*/
|
|
10861
|
-
on: function(eventName, eventHandler, context) {
|
|
10930
|
+
on: function (eventName, eventHandler, context) {
|
|
10862
10931
|
this.handler.on(eventName, eventHandler, context);
|
|
10863
10932
|
},
|
|
10864
10933
|
|
|
@@ -10867,7 +10936,7 @@ ZRender.prototype = {
|
|
|
10867
10936
|
* @param {string} eventName Event name
|
|
10868
10937
|
* @param {Function} [eventHandler] Handler function
|
|
10869
10938
|
*/
|
|
10870
|
-
off: function(eventName, eventHandler) {
|
|
10939
|
+
off: function (eventName, eventHandler) {
|
|
10871
10940
|
this.handler.off(eventName, eventHandler);
|
|
10872
10941
|
},
|
|
10873
10942
|
|
|
@@ -11401,6 +11470,18 @@ function getTooltipRenderMode(renderModeOption) {
|
|
|
11401
11470
|
}
|
|
11402
11471
|
}
|
|
11403
11472
|
|
|
11473
|
+
/**
|
|
11474
|
+
* Group a list by key.
|
|
11475
|
+
*
|
|
11476
|
+
* @param {Array} array
|
|
11477
|
+
* @param {Function} getKey
|
|
11478
|
+
* param {*} Array item
|
|
11479
|
+
* return {string} key
|
|
11480
|
+
* @return {Object} Result
|
|
11481
|
+
* {Array}: keys,
|
|
11482
|
+
* {module:zrender/core/util/HashMap} buckets: {key -> Array}
|
|
11483
|
+
*/
|
|
11484
|
+
|
|
11404
11485
|
/*
|
|
11405
11486
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
11406
11487
|
* or more contributor license agreements. See the NOTICE file
|
|
@@ -11863,7 +11944,7 @@ function cubicRootAt(p0, p1, p2, p3, val, roots) {
|
|
|
11863
11944
|
// Evaluate roots of cubic functions
|
|
11864
11945
|
var a = p3 + 3 * (p1 - p2) - p0;
|
|
11865
11946
|
var b = 3 * (p2 - p1 * 2 + p0);
|
|
11866
|
-
var c = 3 * (p1
|
|
11947
|
+
var c = 3 * (p1 - p0);
|
|
11867
11948
|
var d = p0 - val;
|
|
11868
11949
|
|
|
11869
11950
|
var A = b * b - 3 * a * c;
|
|
@@ -11960,7 +12041,7 @@ function cubicExtrema(p0, p1, p2, p3, extrema) {
|
|
|
11960
12041
|
if (isAroundZero(a)) {
|
|
11961
12042
|
if (isNotAroundZero$1(b)) {
|
|
11962
12043
|
var t1 = -c / b;
|
|
11963
|
-
if (t1 >= 0 && t1 <=1) {
|
|
12044
|
+
if (t1 >= 0 && t1 <= 1) {
|
|
11964
12045
|
extrema[n++] = t1;
|
|
11965
12046
|
}
|
|
11966
12047
|
}
|
|
@@ -12538,7 +12619,7 @@ var mathSin$1 = Math.sin;
|
|
|
12538
12619
|
var mathSqrt$1 = Math.sqrt;
|
|
12539
12620
|
var mathAbs = Math.abs;
|
|
12540
12621
|
|
|
12541
|
-
var hasTypedArray = typeof Float32Array
|
|
12622
|
+
var hasTypedArray = typeof Float32Array !== 'undefined';
|
|
12542
12623
|
|
|
12543
12624
|
/**
|
|
12544
12625
|
* @alias module:zrender/core/PathProxy
|
|
@@ -12828,7 +12909,7 @@ PathProxy.prototype = {
|
|
|
12828
12909
|
|
|
12829
12910
|
var len$$1 = data.length;
|
|
12830
12911
|
|
|
12831
|
-
if (!
|
|
12912
|
+
if (!(this.data && this.data.length === len$$1) && hasTypedArray) {
|
|
12832
12913
|
this.data = new Float32Array(len$$1);
|
|
12833
12914
|
}
|
|
12834
12915
|
|
|
@@ -12936,7 +13017,7 @@ PathProxy.prototype = {
|
|
|
12936
13017
|
y -= offset * dy;
|
|
12937
13018
|
|
|
12938
13019
|
while ((dx > 0 && x <= x1) || (dx < 0 && x >= x1)
|
|
12939
|
-
|| (dx
|
|
13020
|
+
|| (dx === 0 && ((dy > 0 && y <= y1) || (dy < 0 && y >= y1)))) {
|
|
12940
13021
|
idx = this._dashIdx;
|
|
12941
13022
|
dash = lineDash[idx];
|
|
12942
13023
|
x += dx * dash;
|
|
@@ -13066,7 +13147,7 @@ PathProxy.prototype = {
|
|
|
13066
13147
|
for (var i = 0; i < data.length;) {
|
|
13067
13148
|
var cmd = data[i++];
|
|
13068
13149
|
|
|
13069
|
-
if (i
|
|
13150
|
+
if (i === 1) {
|
|
13070
13151
|
// 如果第一个命令是 L, C, Q
|
|
13071
13152
|
// 则 previous point 同绘制命令的第一个 point
|
|
13072
13153
|
//
|
|
@@ -13121,10 +13202,10 @@ PathProxy.prototype = {
|
|
|
13121
13202
|
var startAngle = data[i++];
|
|
13122
13203
|
var endAngle = data[i++] + startAngle;
|
|
13123
13204
|
// TODO Arc 旋转
|
|
13124
|
-
|
|
13205
|
+
i += 1;
|
|
13125
13206
|
var anticlockwise = 1 - data[i++];
|
|
13126
13207
|
|
|
13127
|
-
if (i
|
|
13208
|
+
if (i === 1) {
|
|
13128
13209
|
// 直接使用 arc 命令
|
|
13129
13210
|
// 第一个命令起点还未定义
|
|
13130
13211
|
x0 = mathCos$1(startAngle) * rx + cx;
|
|
@@ -13184,7 +13265,7 @@ PathProxy.prototype = {
|
|
|
13184
13265
|
for (var i = 0; i < len$$1;) {
|
|
13185
13266
|
var cmd = d[i++];
|
|
13186
13267
|
|
|
13187
|
-
if (i
|
|
13268
|
+
if (i === 1) {
|
|
13188
13269
|
// 如果第一个命令是 L, C, Q
|
|
13189
13270
|
// 则 previous point 同绘制命令的第一个 point
|
|
13190
13271
|
//
|
|
@@ -13250,7 +13331,7 @@ PathProxy.prototype = {
|
|
|
13250
13331
|
ctx.arc(cx, cy, r, theta, endAngle, 1 - fs);
|
|
13251
13332
|
}
|
|
13252
13333
|
|
|
13253
|
-
if (i
|
|
13334
|
+
if (i === 1) {
|
|
13254
13335
|
// 直接使用 arc 命令
|
|
13255
13336
|
// 第一个命令起点还未定义
|
|
13256
13337
|
x0 = mathCos$1(theta) * rx + cx;
|
|
@@ -13305,7 +13386,7 @@ function containStroke$1(x0, y0, x1, y1, lineWidth, x, y) {
|
|
|
13305
13386
|
|
|
13306
13387
|
if (x0 !== x1) {
|
|
13307
13388
|
_a = (y0 - y1) / (x0 - x1);
|
|
13308
|
-
_b = (x0 * y1 - x1 * y0) / (x0 - x1)
|
|
13389
|
+
_b = (x0 * y1 - x1 * y0) / (x0 - x1);
|
|
13309
13390
|
}
|
|
13310
13391
|
else {
|
|
13311
13392
|
return Math.abs(x - x0) <= _l / 2;
|
|
@@ -13435,7 +13516,8 @@ function containStroke$4(
|
|
|
13435
13516
|
var tmp = startAngle;
|
|
13436
13517
|
startAngle = normalizeRadian(endAngle);
|
|
13437
13518
|
endAngle = normalizeRadian(tmp);
|
|
13438
|
-
}
|
|
13519
|
+
}
|
|
13520
|
+
else {
|
|
13439
13521
|
startAngle = normalizeRadian(startAngle);
|
|
13440
13522
|
endAngle = normalizeRadian(endAngle);
|
|
13441
13523
|
}
|
|
@@ -13507,7 +13589,8 @@ function windingCubic(x0, y0, x1, y1, x2, y2, x3, y3, x, y) {
|
|
|
13507
13589
|
else {
|
|
13508
13590
|
var w = 0;
|
|
13509
13591
|
var nExtrema = -1;
|
|
13510
|
-
var y0_
|
|
13592
|
+
var y0_;
|
|
13593
|
+
var y1_;
|
|
13511
13594
|
for (var i = 0; i < nRoots; i++) {
|
|
13512
13595
|
var t = roots[i];
|
|
13513
13596
|
|
|
@@ -13528,7 +13611,7 @@ function windingCubic(x0, y0, x1, y1, x2, y2, x3, y3, x, y) {
|
|
|
13528
13611
|
y1_ = cubicAt(y0, y1, y2, y3, extrema[1]);
|
|
13529
13612
|
}
|
|
13530
13613
|
}
|
|
13531
|
-
if (nExtrema
|
|
13614
|
+
if (nExtrema === 2) {
|
|
13532
13615
|
// 分成三段单调函数
|
|
13533
13616
|
if (t < extrema[0]) {
|
|
13534
13617
|
w += y0_ < y0 ? unit : -unit;
|
|
@@ -13625,7 +13708,8 @@ function windingArc(
|
|
|
13625
13708
|
var dir = anticlockwise ? 1 : -1;
|
|
13626
13709
|
if (x >= roots[0] + cx && x <= roots[1] + cx) {
|
|
13627
13710
|
return dir;
|
|
13628
|
-
}
|
|
13711
|
+
}
|
|
13712
|
+
else {
|
|
13629
13713
|
return 0;
|
|
13630
13714
|
}
|
|
13631
13715
|
}
|
|
@@ -13687,7 +13771,7 @@ function containPath(data, lineWidth, isStroke, x, y) {
|
|
|
13687
13771
|
// }
|
|
13688
13772
|
}
|
|
13689
13773
|
|
|
13690
|
-
if (i
|
|
13774
|
+
if (i === 1) {
|
|
13691
13775
|
// 如果第一个命令是 L, C, Q
|
|
13692
13776
|
// 则 previous point 同绘制命令的第一个 point
|
|
13693
13777
|
//
|
|
@@ -13768,7 +13852,7 @@ function containPath(data, lineWidth, isStroke, x, y) {
|
|
|
13768
13852
|
var theta = data[i++];
|
|
13769
13853
|
var dTheta = data[i++];
|
|
13770
13854
|
// TODO Arc 旋转
|
|
13771
|
-
|
|
13855
|
+
i += 1;
|
|
13772
13856
|
var anticlockwise = 1 - data[i++];
|
|
13773
13857
|
var x1 = Math.cos(theta) * rx + cx;
|
|
13774
13858
|
var y1 = Math.sin(theta) * ry + cy;
|
|
@@ -13889,6 +13973,12 @@ Path.prototype = {
|
|
|
13889
13973
|
|
|
13890
13974
|
strokeContainThreshold: 5,
|
|
13891
13975
|
|
|
13976
|
+
/**
|
|
13977
|
+
* See `module:zrender/src/graphic/helper/subPixelOptimize`.
|
|
13978
|
+
* @type {boolean}
|
|
13979
|
+
*/
|
|
13980
|
+
subPixelOptimize: false,
|
|
13981
|
+
|
|
13892
13982
|
brush: function (ctx, prevEl) {
|
|
13893
13983
|
var style = this.style;
|
|
13894
13984
|
var path = this.path || pathProxyForDraw;
|
|
@@ -14208,7 +14298,7 @@ Path.extend = function (defaults$$1) {
|
|
|
14208
14298
|
var thisShape = this.shape;
|
|
14209
14299
|
for (var name in defaultShape) {
|
|
14210
14300
|
if (
|
|
14211
|
-
!
|
|
14301
|
+
!thisShape.hasOwnProperty(name)
|
|
14212
14302
|
&& defaultShape.hasOwnProperty(name)
|
|
14213
14303
|
) {
|
|
14214
14304
|
thisShape[name] = defaultShape[name];
|
|
@@ -14338,13 +14428,13 @@ var mathSin = Math.sin;
|
|
|
14338
14428
|
var mathCos = Math.cos;
|
|
14339
14429
|
var PI = Math.PI;
|
|
14340
14430
|
|
|
14341
|
-
var vMag = function(v) {
|
|
14431
|
+
var vMag = function (v) {
|
|
14342
14432
|
return Math.sqrt(v[0] * v[0] + v[1] * v[1]);
|
|
14343
14433
|
};
|
|
14344
|
-
var vRatio = function(u, v) {
|
|
14434
|
+
var vRatio = function (u, v) {
|
|
14345
14435
|
return (u[0] * v[0] + u[1] * v[1]) / (vMag(u) * vMag(v));
|
|
14346
14436
|
};
|
|
14347
|
-
var vAngle = function(u, v) {
|
|
14437
|
+
var vAngle = function (u, v) {
|
|
14348
14438
|
return (u[0] * v[1] < u[1] * v[0] ? -1 : 1)
|
|
14349
14439
|
* Math.acos(vRatio(u, v));
|
|
14350
14440
|
};
|
|
@@ -14796,6 +14886,9 @@ Text.prototype = {
|
|
|
14796
14886
|
// style.bind(ctx, this, prevEl);
|
|
14797
14887
|
|
|
14798
14888
|
if (!needDrawText(text, style)) {
|
|
14889
|
+
// The current el.style is not applied
|
|
14890
|
+
// and should not be used as cache.
|
|
14891
|
+
ctx.__attrCachedBy = ContextCachedBy.NONE;
|
|
14799
14892
|
return;
|
|
14800
14893
|
}
|
|
14801
14894
|
|
|
@@ -14822,6 +14915,7 @@ Text.prototype = {
|
|
|
14822
14915
|
style.textAlign,
|
|
14823
14916
|
style.textVerticalAlign,
|
|
14824
14917
|
style.textPadding,
|
|
14918
|
+
style.textLineHeight,
|
|
14825
14919
|
style.rich
|
|
14826
14920
|
);
|
|
14827
14921
|
|
|
@@ -15127,7 +15221,8 @@ var smoothBezier = function (points, smooth, isLoop, constraint) {
|
|
|
15127
15221
|
var prevPoint;
|
|
15128
15222
|
var nextPoint;
|
|
15129
15223
|
|
|
15130
|
-
var min$$1
|
|
15224
|
+
var min$$1;
|
|
15225
|
+
var max$$1;
|
|
15131
15226
|
if (constraint) {
|
|
15132
15227
|
min$$1 = [Infinity, Infinity];
|
|
15133
15228
|
max$$1 = [-Infinity, -Infinity];
|
|
@@ -15276,11 +15371,120 @@ var Polyline = Path.extend({
|
|
|
15276
15371
|
}
|
|
15277
15372
|
});
|
|
15278
15373
|
|
|
15374
|
+
/**
|
|
15375
|
+
* Sub-pixel optimize for canvas rendering, prevent from blur
|
|
15376
|
+
* when rendering a thin vertical/horizontal line.
|
|
15377
|
+
*/
|
|
15378
|
+
|
|
15379
|
+
var round$1 = Math.round;
|
|
15380
|
+
|
|
15381
|
+
/**
|
|
15382
|
+
* Sub pixel optimize line for canvas
|
|
15383
|
+
*
|
|
15384
|
+
* @param {Object} outputShape The modification will be performed on `outputShape`.
|
|
15385
|
+
* `outputShape` and `inputShape` can be the same object.
|
|
15386
|
+
* `outputShape` object can be used repeatly, because all of
|
|
15387
|
+
* the `x1`, `x2`, `y1`, `y2` will be assigned in this method.
|
|
15388
|
+
* @param {Object} [inputShape]
|
|
15389
|
+
* @param {number} [inputShape.x1]
|
|
15390
|
+
* @param {number} [inputShape.y1]
|
|
15391
|
+
* @param {number} [inputShape.x2]
|
|
15392
|
+
* @param {number} [inputShape.y2]
|
|
15393
|
+
* @param {Object} [style]
|
|
15394
|
+
* @param {number} [style.lineWidth]
|
|
15395
|
+
*/
|
|
15396
|
+
function subPixelOptimizeLine$1(outputShape, inputShape, style) {
|
|
15397
|
+
var lineWidth = style && style.lineWidth;
|
|
15398
|
+
|
|
15399
|
+
if (!inputShape || !lineWidth) {
|
|
15400
|
+
return;
|
|
15401
|
+
}
|
|
15402
|
+
|
|
15403
|
+
var x1 = inputShape.x1;
|
|
15404
|
+
var x2 = inputShape.x2;
|
|
15405
|
+
var y1 = inputShape.y1;
|
|
15406
|
+
var y2 = inputShape.y2;
|
|
15407
|
+
|
|
15408
|
+
if (round$1(x1 * 2) === round$1(x2 * 2)) {
|
|
15409
|
+
outputShape.x1 = outputShape.x2 = subPixelOptimize$1(x1, lineWidth, true);
|
|
15410
|
+
}
|
|
15411
|
+
else {
|
|
15412
|
+
outputShape.x1 = x1;
|
|
15413
|
+
outputShape.x2 = x2;
|
|
15414
|
+
}
|
|
15415
|
+
if (round$1(y1 * 2) === round$1(y2 * 2)) {
|
|
15416
|
+
outputShape.y1 = outputShape.y2 = subPixelOptimize$1(y1, lineWidth, true);
|
|
15417
|
+
}
|
|
15418
|
+
else {
|
|
15419
|
+
outputShape.y1 = y1;
|
|
15420
|
+
outputShape.y2 = y2;
|
|
15421
|
+
}
|
|
15422
|
+
}
|
|
15423
|
+
|
|
15424
|
+
/**
|
|
15425
|
+
* Sub pixel optimize rect for canvas
|
|
15426
|
+
*
|
|
15427
|
+
* @param {Object} outputShape The modification will be performed on `outputShape`.
|
|
15428
|
+
* `outputShape` and `inputShape` can be the same object.
|
|
15429
|
+
* `outputShape` object can be used repeatly, because all of
|
|
15430
|
+
* the `x`, `y`, `width`, `height` will be assigned in this method.
|
|
15431
|
+
* @param {Object} [inputShape]
|
|
15432
|
+
* @param {number} [inputShape.x]
|
|
15433
|
+
* @param {number} [inputShape.y]
|
|
15434
|
+
* @param {number} [inputShape.width]
|
|
15435
|
+
* @param {number} [inputShape.height]
|
|
15436
|
+
* @param {Object} [style]
|
|
15437
|
+
* @param {number} [style.lineWidth]
|
|
15438
|
+
*/
|
|
15439
|
+
function subPixelOptimizeRect$1(outputShape, inputShape, style) {
|
|
15440
|
+
var lineWidth = style && style.lineWidth;
|
|
15441
|
+
|
|
15442
|
+
if (!inputShape || !lineWidth) {
|
|
15443
|
+
return;
|
|
15444
|
+
}
|
|
15445
|
+
|
|
15446
|
+
var originX = inputShape.x;
|
|
15447
|
+
var originY = inputShape.y;
|
|
15448
|
+
var originWidth = inputShape.width;
|
|
15449
|
+
var originHeight = inputShape.height;
|
|
15450
|
+
|
|
15451
|
+
outputShape.x = subPixelOptimize$1(originX, lineWidth, true);
|
|
15452
|
+
outputShape.y = subPixelOptimize$1(originY, lineWidth, true);
|
|
15453
|
+
outputShape.width = Math.max(
|
|
15454
|
+
subPixelOptimize$1(originX + originWidth, lineWidth, false) - outputShape.x,
|
|
15455
|
+
originWidth === 0 ? 0 : 1
|
|
15456
|
+
);
|
|
15457
|
+
outputShape.height = Math.max(
|
|
15458
|
+
subPixelOptimize$1(originY + originHeight, lineWidth, false) - outputShape.y,
|
|
15459
|
+
originHeight === 0 ? 0 : 1
|
|
15460
|
+
);
|
|
15461
|
+
}
|
|
15462
|
+
|
|
15463
|
+
/**
|
|
15464
|
+
* Sub pixel optimize for canvas
|
|
15465
|
+
*
|
|
15466
|
+
* @param {number} position Coordinate, such as x, y
|
|
15467
|
+
* @param {number} lineWidth Should be nonnegative integer.
|
|
15468
|
+
* @param {boolean=} positiveOrNegative Default false (negative).
|
|
15469
|
+
* @return {number} Optimized position.
|
|
15470
|
+
*/
|
|
15471
|
+
function subPixelOptimize$1(position, lineWidth, positiveOrNegative) {
|
|
15472
|
+
// Assure that (position + lineWidth / 2) is near integer edge,
|
|
15473
|
+
// otherwise line will be fuzzy in canvas.
|
|
15474
|
+
var doubledPosition = round$1(position * 2);
|
|
15475
|
+
return (doubledPosition + round$1(lineWidth)) % 2 === 0
|
|
15476
|
+
? doubledPosition / 2
|
|
15477
|
+
: (doubledPosition + (positiveOrNegative ? 1 : -1)) / 2;
|
|
15478
|
+
}
|
|
15479
|
+
|
|
15279
15480
|
/**
|
|
15280
15481
|
* 矩形
|
|
15281
15482
|
* @module zrender/graphic/shape/Rect
|
|
15282
15483
|
*/
|
|
15283
15484
|
|
|
15485
|
+
// Avoid create repeatly.
|
|
15486
|
+
var subPixelOptimizeOutputShape = {};
|
|
15487
|
+
|
|
15284
15488
|
var Rect = Path.extend({
|
|
15285
15489
|
|
|
15286
15490
|
type: 'rect',
|
|
@@ -15300,10 +15504,27 @@ var Rect = Path.extend({
|
|
|
15300
15504
|
},
|
|
15301
15505
|
|
|
15302
15506
|
buildPath: function (ctx, shape) {
|
|
15303
|
-
var x
|
|
15304
|
-
var y
|
|
15305
|
-
var width
|
|
15306
|
-
var height
|
|
15507
|
+
var x;
|
|
15508
|
+
var y;
|
|
15509
|
+
var width;
|
|
15510
|
+
var height;
|
|
15511
|
+
|
|
15512
|
+
if (this.subPixelOptimize) {
|
|
15513
|
+
subPixelOptimizeRect$1(subPixelOptimizeOutputShape, shape, this.style);
|
|
15514
|
+
x = subPixelOptimizeOutputShape.x;
|
|
15515
|
+
y = subPixelOptimizeOutputShape.y;
|
|
15516
|
+
width = subPixelOptimizeOutputShape.width;
|
|
15517
|
+
height = subPixelOptimizeOutputShape.height;
|
|
15518
|
+
subPixelOptimizeOutputShape.r = shape.r;
|
|
15519
|
+
shape = subPixelOptimizeOutputShape;
|
|
15520
|
+
}
|
|
15521
|
+
else {
|
|
15522
|
+
x = shape.x;
|
|
15523
|
+
y = shape.y;
|
|
15524
|
+
width = shape.width;
|
|
15525
|
+
height = shape.height;
|
|
15526
|
+
}
|
|
15527
|
+
|
|
15307
15528
|
if (!shape.r) {
|
|
15308
15529
|
ctx.rect(x, y, width, height);
|
|
15309
15530
|
}
|
|
@@ -15320,6 +15541,9 @@ var Rect = Path.extend({
|
|
|
15320
15541
|
* @module zrender/graphic/shape/Line
|
|
15321
15542
|
*/
|
|
15322
15543
|
|
|
15544
|
+
// Avoid create repeatly.
|
|
15545
|
+
var subPixelOptimizeOutputShape$1 = {};
|
|
15546
|
+
|
|
15323
15547
|
var Line = Path.extend({
|
|
15324
15548
|
|
|
15325
15549
|
type: 'line',
|
|
@@ -15341,10 +15565,25 @@ var Line = Path.extend({
|
|
|
15341
15565
|
},
|
|
15342
15566
|
|
|
15343
15567
|
buildPath: function (ctx, shape) {
|
|
15344
|
-
var x1
|
|
15345
|
-
var y1
|
|
15346
|
-
var x2
|
|
15347
|
-
var y2
|
|
15568
|
+
var x1;
|
|
15569
|
+
var y1;
|
|
15570
|
+
var x2;
|
|
15571
|
+
var y2;
|
|
15572
|
+
|
|
15573
|
+
if (this.subPixelOptimize) {
|
|
15574
|
+
subPixelOptimizeLine$1(subPixelOptimizeOutputShape$1, shape, this.style);
|
|
15575
|
+
x1 = subPixelOptimizeOutputShape$1.x1;
|
|
15576
|
+
y1 = subPixelOptimizeOutputShape$1.y1;
|
|
15577
|
+
x2 = subPixelOptimizeOutputShape$1.x2;
|
|
15578
|
+
y2 = subPixelOptimizeOutputShape$1.y2;
|
|
15579
|
+
}
|
|
15580
|
+
else {
|
|
15581
|
+
x1 = shape.x1;
|
|
15582
|
+
y1 = shape.y1;
|
|
15583
|
+
x2 = shape.x2;
|
|
15584
|
+
y2 = shape.y2;
|
|
15585
|
+
}
|
|
15586
|
+
|
|
15348
15587
|
var percent = shape.percent;
|
|
15349
15588
|
|
|
15350
15589
|
if (percent === 0) {
|
|
@@ -15701,7 +15940,7 @@ inherits(RadialGradient, Gradient);
|
|
|
15701
15940
|
|
|
15702
15941
|
/**
|
|
15703
15942
|
* Displayable for incremental rendering. It will be rendered in a separate layer
|
|
15704
|
-
* IncrementalDisplay have
|
|
15943
|
+
* IncrementalDisplay have two main methods. `clearDisplayables` and `addDisplayables`
|
|
15705
15944
|
* addDisplayables will render the added displayables incremetally.
|
|
15706
15945
|
*
|
|
15707
15946
|
* It use a not clearFlag to tell the painter don't clear the layer if it's the first element.
|
|
@@ -15748,7 +15987,7 @@ IncrementalDisplayble.prototype.addDisplayables = function (displayables, notPer
|
|
|
15748
15987
|
}
|
|
15749
15988
|
};
|
|
15750
15989
|
|
|
15751
|
-
IncrementalDisplayble.prototype.eachPendingDisplayable = function
|
|
15990
|
+
IncrementalDisplayble.prototype.eachPendingDisplayable = function (cb) {
|
|
15752
15991
|
for (var i = this._cursor; i < this._displayables.length; i++) {
|
|
15753
15992
|
cb && cb(this._displayables[i]);
|
|
15754
15993
|
}
|
|
@@ -15856,6 +16095,8 @@ var mathMin$1 = Math.min;
|
|
|
15856
16095
|
|
|
15857
16096
|
var EMPTY_OBJ = {};
|
|
15858
16097
|
|
|
16098
|
+
var Z2_EMPHASIS_LIFT = 1;
|
|
16099
|
+
|
|
15859
16100
|
/**
|
|
15860
16101
|
* Extend shape with parameters
|
|
15861
16102
|
*/
|
|
@@ -16073,11 +16314,12 @@ function cacheElementStl(el) {
|
|
|
16073
16314
|
|
|
16074
16315
|
var hoverStyle = el.__hoverStl;
|
|
16075
16316
|
if (!hoverStyle) {
|
|
16076
|
-
el.
|
|
16317
|
+
el.__cachedNormalStl = el.__cachedNormalZ2 = null;
|
|
16077
16318
|
return;
|
|
16078
16319
|
}
|
|
16079
16320
|
|
|
16080
|
-
var normalStyle = el.
|
|
16321
|
+
var normalStyle = el.__cachedNormalStl = {};
|
|
16322
|
+
el.__cachedNormalZ2 = el.z2;
|
|
16081
16323
|
var elStyle = el.style;
|
|
16082
16324
|
|
|
16083
16325
|
for (var name in hoverStyle) {
|
|
@@ -16115,9 +16357,6 @@ function doSingleEnterHover(el) {
|
|
|
16115
16357
|
targetStyle = elTarget.style;
|
|
16116
16358
|
}
|
|
16117
16359
|
|
|
16118
|
-
// Consider case: only `position: 'top'` is set on emphasis, then text
|
|
16119
|
-
// color should be returned to `autoColor`, rather than remain '#fff'.
|
|
16120
|
-
// So we should rollback then apply again after style merging.
|
|
16121
16360
|
rollbackDefaultTextStyle(targetStyle);
|
|
16122
16361
|
|
|
16123
16362
|
if (!useHoverLayer) {
|
|
@@ -16152,7 +16391,7 @@ function doSingleEnterHover(el) {
|
|
|
16152
16391
|
|
|
16153
16392
|
if (!useHoverLayer) {
|
|
16154
16393
|
el.dirty(false);
|
|
16155
|
-
el.z2 +=
|
|
16394
|
+
el.z2 += Z2_EMPHASIS_LIFT;
|
|
16156
16395
|
}
|
|
16157
16396
|
}
|
|
16158
16397
|
|
|
@@ -16163,32 +16402,34 @@ function setDefaultHoverFillStroke(targetStyle, hoverStyle, prop) {
|
|
|
16163
16402
|
}
|
|
16164
16403
|
|
|
16165
16404
|
function doSingleLeaveHover(el) {
|
|
16166
|
-
|
|
16167
|
-
|
|
16168
|
-
|
|
16405
|
+
var highlighted = el.__highlighted;
|
|
16406
|
+
|
|
16407
|
+
if (!highlighted) {
|
|
16408
|
+
return;
|
|
16169
16409
|
}
|
|
16170
|
-
}
|
|
16171
16410
|
|
|
16172
|
-
|
|
16173
|
-
var highlighted = el.__highlighted;
|
|
16411
|
+
el.__highlighted = false;
|
|
16174
16412
|
|
|
16175
16413
|
if (highlighted === 'layer') {
|
|
16176
16414
|
el.__zr && el.__zr.removeHover(el);
|
|
16177
16415
|
}
|
|
16178
16416
|
else if (highlighted) {
|
|
16179
16417
|
var style = el.style;
|
|
16180
|
-
var normalStl = el.__normalStl;
|
|
16181
16418
|
|
|
16419
|
+
var normalStl = el.__cachedNormalStl;
|
|
16182
16420
|
if (normalStl) {
|
|
16183
16421
|
rollbackDefaultTextStyle(style);
|
|
16184
|
-
|
|
16185
16422
|
// Consider null/undefined value, should use
|
|
16186
16423
|
// `setStyle` but not `extendFrom(stl, true)`.
|
|
16187
16424
|
el.setStyle(normalStl);
|
|
16188
|
-
|
|
16189
16425
|
applyDefaultTextStyle(style);
|
|
16190
|
-
|
|
16191
|
-
|
|
16426
|
+
}
|
|
16427
|
+
// `__cachedNormalZ2` will not be reset if calling `setElementHoverStyle`
|
|
16428
|
+
// when `el` is on emphasis state. So here by comparing with 1, we try
|
|
16429
|
+
// hard to make the bug case rare.
|
|
16430
|
+
var normalZ2 = el.__cachedNormalZ2;
|
|
16431
|
+
if (normalZ2 != null && el.z2 - normalZ2 === Z2_EMPHASIS_LIFT) {
|
|
16432
|
+
el.z2 = normalZ2;
|
|
16192
16433
|
}
|
|
16193
16434
|
}
|
|
16194
16435
|
}
|
|
@@ -16202,7 +16443,10 @@ function traverseCall(el, method) {
|
|
|
16202
16443
|
}
|
|
16203
16444
|
|
|
16204
16445
|
/**
|
|
16205
|
-
* Set hover style of element
|
|
16446
|
+
* Set hover style (namely "emphasis style") of element, based on the current
|
|
16447
|
+
* style of the given `el`.
|
|
16448
|
+
* This method should be called after all of the normal styles have been adopted
|
|
16449
|
+
* to the `el`. See the reason on `setHoverStyle`.
|
|
16206
16450
|
*
|
|
16207
16451
|
* @param {module:zrender/Element} el Should not be `zrender/container/Group`.
|
|
16208
16452
|
* @param {Object|boolean} [hoverStl] The specified hover style.
|
|
@@ -16214,11 +16458,29 @@ function traverseCall(el, method) {
|
|
|
16214
16458
|
* @param {boolean} [opt.hoverSilentOnTouch=false] See `graphic.setAsHoverStyleTrigger`
|
|
16215
16459
|
*/
|
|
16216
16460
|
function setElementHoverStyle(el, hoverStl) {
|
|
16461
|
+
// For performance consideration, it might be better to make the "hover style" only the
|
|
16462
|
+
// difference properties from the "normal style", but not a entire copy of all styles.
|
|
16217
16463
|
hoverStl = el.__hoverStl = hoverStl !== false && (hoverStl || {});
|
|
16218
16464
|
el.__hoverStlDirty = true;
|
|
16219
16465
|
|
|
16466
|
+
// FIXME
|
|
16467
|
+
// It is not completely right to save "normal"/"emphasis" flag on elements.
|
|
16468
|
+
// It probably should be saved on `data` of series. Consider the cases:
|
|
16469
|
+
// (1) A highlighted elements are moved out of the view port and re-enter
|
|
16470
|
+
// again by dataZoom.
|
|
16471
|
+
// (2) call `setOption` and replace elements totally when they are highlighted.
|
|
16220
16472
|
if (el.__highlighted) {
|
|
16473
|
+
// Consider the case:
|
|
16474
|
+
// The styles of a highlighted `el` is being updated. The new "emphasis style"
|
|
16475
|
+
// should be adapted to the `el`. Notice here new "normal styles" should have
|
|
16476
|
+
// been set outside and the cached "normal style" is out of date.
|
|
16477
|
+
el.__cachedNormalStl = null;
|
|
16478
|
+
// Do not clear `__cachedNormalZ2` here, because setting `z2` is not a constraint
|
|
16479
|
+
// of this method. In most cases, `z2` is not set and hover style should be able
|
|
16480
|
+
// to rollback. Of course, that would bring bug, but only in a rare case, see
|
|
16481
|
+
// `doSingleLeaveHover` for details.
|
|
16221
16482
|
doSingleLeaveHover(el);
|
|
16483
|
+
|
|
16222
16484
|
doSingleEnterHover(el);
|
|
16223
16485
|
}
|
|
16224
16486
|
}
|
|
@@ -16267,12 +16529,29 @@ function leaveEmphasis() {
|
|
|
16267
16529
|
}
|
|
16268
16530
|
|
|
16269
16531
|
/**
|
|
16270
|
-
* Set hover style of element
|
|
16532
|
+
* Set hover style (namely "emphasis style") of element,
|
|
16533
|
+
* based on the current style of the given `el`.
|
|
16534
|
+
*
|
|
16535
|
+
* (1)
|
|
16536
|
+
* **CONSTRAINTS** for this method:
|
|
16537
|
+
* <A> This method MUST be called after all of the normal styles having been adopted
|
|
16538
|
+
* to the `el`.
|
|
16539
|
+
* <B> The input `hoverStyle` (that is, "emphasis style") MUST be the subset of the
|
|
16540
|
+
* "normal style" having been set to the el.
|
|
16541
|
+
* <C> `color` MUST be one of the "normal styles" (because color might be lifted as
|
|
16542
|
+
* a default hover style).
|
|
16271
16543
|
*
|
|
16272
|
-
*
|
|
16273
|
-
*
|
|
16544
|
+
* The reason: this method treat the current style of the `el` as the "normal style"
|
|
16545
|
+
* and cache them when enter/update the "emphasis style". Consider the case: the `el`
|
|
16546
|
+
* is in "emphasis" state and `setOption`/`dispatchAction` trigger the style updating
|
|
16547
|
+
* logic, where the el should shift from the original emphasis style to the new
|
|
16548
|
+
* "emphasis style" and should be able to "downplay" back to the new "normal style".
|
|
16274
16549
|
*
|
|
16275
|
-
*
|
|
16550
|
+
* Indeed, it is error-prone to make a interface has so many constraints, but I have
|
|
16551
|
+
* not found a better solution yet to fit the backward compatibility, performance and
|
|
16552
|
+
* the current programming style.
|
|
16553
|
+
*
|
|
16554
|
+
* (2)
|
|
16276
16555
|
* Call the method for a "root" element once. Do not call it for each descendants.
|
|
16277
16556
|
* If the descendants elemenets of a group has itself hover style different from the
|
|
16278
16557
|
* root group, we can simply mount the style on `el.hoverStyle` for them, but should
|
|
@@ -16327,6 +16606,7 @@ function setAsHoverStyleTrigger(el, opt) {
|
|
|
16327
16606
|
}
|
|
16328
16607
|
|
|
16329
16608
|
/**
|
|
16609
|
+
* See more info in `setTextStyleCommon`.
|
|
16330
16610
|
* @param {Object|module:zrender/graphic/Style} normalStyle
|
|
16331
16611
|
* @param {Object} emphasisStyle
|
|
16332
16612
|
* @param {module:echarts/model/Model} normalModel
|
|
@@ -16399,6 +16679,7 @@ function setLabelStyle(
|
|
|
16399
16679
|
|
|
16400
16680
|
/**
|
|
16401
16681
|
* Set basic textStyle properties.
|
|
16682
|
+
* See more info in `setTextStyleCommon`.
|
|
16402
16683
|
* @param {Object|module:zrender/graphic/Style} textStyle
|
|
16403
16684
|
* @param {module:echarts/model/Model} model
|
|
16404
16685
|
* @param {Object} [specifiedTextStyle] Can be overrided by settings in model.
|
|
@@ -16417,6 +16698,7 @@ function setTextStyle(
|
|
|
16417
16698
|
|
|
16418
16699
|
/**
|
|
16419
16700
|
* Set text option in the style.
|
|
16701
|
+
* See more info in `setTextStyleCommon`.
|
|
16420
16702
|
* @deprecated
|
|
16421
16703
|
* @param {Object} textStyle
|
|
16422
16704
|
* @param {module:echarts/model/Model} labelModel
|
|
@@ -16439,7 +16721,23 @@ function setText(textStyle, labelModel, defaultColor) {
|
|
|
16439
16721
|
}
|
|
16440
16722
|
|
|
16441
16723
|
/**
|
|
16442
|
-
*
|
|
16724
|
+
* The uniform entry of set text style, that is, retrieve style definitions
|
|
16725
|
+
* from `model` and set to `textStyle` object.
|
|
16726
|
+
*
|
|
16727
|
+
* Never in merge mode, but in overwrite mode, that is, all of the text style
|
|
16728
|
+
* properties will be set. (Consider the states of normal and emphasis and
|
|
16729
|
+
* default value can be adopted, merge would make the logic too complicated
|
|
16730
|
+
* to manage.)
|
|
16731
|
+
*
|
|
16732
|
+
* The `textStyle` object can either be a plain object or an instance of
|
|
16733
|
+
* `zrender/src/graphic/Style`, and either be the style of normal or emphasis.
|
|
16734
|
+
* After this mothod called, the `textStyle` object can then be used in
|
|
16735
|
+
* `el.setStyle(textStyle)` or `el.hoverStyle = textStyle`.
|
|
16736
|
+
*
|
|
16737
|
+
* Default value will be adopted and `insideRollbackOpt` will be created.
|
|
16738
|
+
* See `applyDefaultTextStyle` `rollbackDefaultTextStyle` for more details.
|
|
16739
|
+
*
|
|
16740
|
+
* opt: {
|
|
16443
16741
|
* disableBox: boolean, Whether diable drawing box of block (outer most).
|
|
16444
16742
|
* isRectText: boolean,
|
|
16445
16743
|
* autoColor: string, specify a color when color is 'auto',
|
|
@@ -16620,14 +16918,27 @@ function getAutoColor(color, opt) {
|
|
|
16620
16918
|
return color !== 'auto' ? color : (opt && opt.autoColor) ? opt.autoColor : null;
|
|
16621
16919
|
}
|
|
16622
16920
|
|
|
16623
|
-
|
|
16624
|
-
|
|
16625
|
-
|
|
16626
|
-
|
|
16921
|
+
/**
|
|
16922
|
+
* Give some default value to the input `textStyle` object, based on the current settings
|
|
16923
|
+
* in this `textStyle` object.
|
|
16924
|
+
*
|
|
16925
|
+
* The Scenario:
|
|
16926
|
+
* when text position is `inside` and `textFill` is not specified, we show
|
|
16927
|
+
* text border by default for better view. But it should be considered that text position
|
|
16928
|
+
* might be changed when hovering or being emphasis, where the `insideRollback` is used to
|
|
16929
|
+
* restore the style.
|
|
16930
|
+
*
|
|
16931
|
+
* Usage (& NOTICE):
|
|
16932
|
+
* When a style object (eithor plain object or instance of `zrender/src/graphic/Style`) is
|
|
16933
|
+
* about to be modified on its text related properties, `rollbackDefaultTextStyle` should
|
|
16934
|
+
* be called before the modification and `applyDefaultTextStyle` should be called after that.
|
|
16935
|
+
* (For the case that all of the text related properties is reset, like `setTextStyleCommon`
|
|
16936
|
+
* does, `rollbackDefaultTextStyle` is not needed to be called).
|
|
16937
|
+
*/
|
|
16627
16938
|
function applyDefaultTextStyle(textStyle) {
|
|
16628
16939
|
var opt = textStyle.insideRollbackOpt;
|
|
16629
16940
|
|
|
16630
|
-
// Only insideRollbackOpt
|
|
16941
|
+
// Only `insideRollbackOpt` created (in `setTextStyleCommon`),
|
|
16631
16942
|
// applyDefaultTextStyle works.
|
|
16632
16943
|
if (!opt || textStyle.textFill != null) {
|
|
16633
16944
|
return;
|
|
@@ -16671,6 +16982,16 @@ function applyDefaultTextStyle(textStyle) {
|
|
|
16671
16982
|
}
|
|
16672
16983
|
}
|
|
16673
16984
|
|
|
16985
|
+
/**
|
|
16986
|
+
* Consider the case: in a scatter,
|
|
16987
|
+
* label: {
|
|
16988
|
+
* normal: {position: 'inside'},
|
|
16989
|
+
* emphasis: {position: 'top'}
|
|
16990
|
+
* }
|
|
16991
|
+
* In the normal state, the `textFill` will be set as '#fff' for pretty view (see
|
|
16992
|
+
* `applyDefaultTextStyle`), but when switching to emphasis state, the `textFill`
|
|
16993
|
+
* should be retured to 'autoColor', but not keep '#fff'.
|
|
16994
|
+
*/
|
|
16674
16995
|
function rollbackDefaultTextStyle(style) {
|
|
16675
16996
|
var insideRollback = style.insideRollback;
|
|
16676
16997
|
if (insideRollback) {
|
|
@@ -16961,6 +17282,7 @@ function createIcon(iconStr, opt, rect) {
|
|
|
16961
17282
|
|
|
16962
17283
|
|
|
16963
17284
|
var graphic = (Object.freeze || Object)({
|
|
17285
|
+
Z2_EMPHASIS_LIFT: Z2_EMPHASIS_LIFT,
|
|
16964
17286
|
extendShape: extendShape,
|
|
16965
17287
|
extendPath: extendPath,
|
|
16966
17288
|
makePath: makePath,
|
|
@@ -17061,6 +17383,7 @@ var textStyleMixin = {
|
|
|
17061
17383
|
this.getShallow('align'),
|
|
17062
17384
|
this.getShallow('verticalAlign') || this.getShallow('baseline'),
|
|
17063
17385
|
this.getShallow('padding'),
|
|
17386
|
+
this.getShallow('lineHeight'),
|
|
17064
17387
|
this.getShallow('rich'),
|
|
17065
17388
|
this.getShallow('truncateText')
|
|
17066
17389
|
);
|
|
@@ -17145,7 +17468,7 @@ var inner = makeInner();
|
|
|
17145
17468
|
/**
|
|
17146
17469
|
* @alias module:echarts/model/Model
|
|
17147
17470
|
* @constructor
|
|
17148
|
-
* @param {Object} option
|
|
17471
|
+
* @param {Object} [option]
|
|
17149
17472
|
* @param {module:echarts/model/Model} [parentModel]
|
|
17150
17473
|
* @param {module:echarts/model/Global} [ecModel]
|
|
17151
17474
|
*/
|
|
@@ -17531,6 +17854,15 @@ function enableTopologicalTravel(entity, dependencyGetter) {
|
|
|
17531
17854
|
* under the License.
|
|
17532
17855
|
*/
|
|
17533
17856
|
|
|
17857
|
+
/*
|
|
17858
|
+
* A third-party license is embeded for some of the code in this file:
|
|
17859
|
+
* The method "quantile" was copied from "d3.js".
|
|
17860
|
+
* (See more details in the comment of the method below.)
|
|
17861
|
+
* The use of the source code of this file is also subject to the terms
|
|
17862
|
+
* and consitions of the license of "d3.js" (BSD-3Clause, see
|
|
17863
|
+
* </licenses/LICENSE-d3>).
|
|
17864
|
+
*/
|
|
17865
|
+
|
|
17534
17866
|
var RADIAN_EPSILON = 1e-4;
|
|
17535
17867
|
|
|
17536
17868
|
function _trim(str) {
|
|
@@ -17634,7 +17966,7 @@ function parsePercent$1(percent, all) {
|
|
|
17634
17966
|
* @param {boolean} [returnStr]
|
|
17635
17967
|
* @return {number|string}
|
|
17636
17968
|
*/
|
|
17637
|
-
function round$
|
|
17969
|
+
function round$2(x, precision, returnStr) {
|
|
17638
17970
|
if (precision == null) {
|
|
17639
17971
|
precision = 10;
|
|
17640
17972
|
}
|
|
@@ -17923,39 +18255,9 @@ function nice(val, round) {
|
|
|
17923
18255
|
}
|
|
17924
18256
|
|
|
17925
18257
|
/**
|
|
17926
|
-
*
|
|
17927
|
-
*
|
|
17928
|
-
*
|
|
17929
|
-
* All rights reserved.
|
|
17930
|
-
*
|
|
17931
|
-
* Redistribution and use in source and binary forms, with or without
|
|
17932
|
-
* modification, are permitted provided that the following conditions are met:
|
|
17933
|
-
*
|
|
17934
|
-
* * Redistributions of source code must retain the above copyright notice, this
|
|
17935
|
-
* list of conditions and the following disclaimer.
|
|
17936
|
-
*
|
|
17937
|
-
* * Redistributions in binary form must reproduce the above copyright notice,
|
|
17938
|
-
* this list of conditions and the following disclaimer in the documentation
|
|
17939
|
-
* and/or other materials provided with the distribution.
|
|
17940
|
-
*
|
|
17941
|
-
* * The name Michael Bostock may not be used to endorse or promote products
|
|
17942
|
-
* derived from this software without specific prior written permission.
|
|
17943
|
-
*
|
|
17944
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
17945
|
-
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
17946
|
-
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
17947
|
-
* DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT,
|
|
17948
|
-
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
17949
|
-
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
17950
|
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
|
17951
|
-
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
17952
|
-
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
17953
|
-
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
17954
|
-
*/
|
|
17955
|
-
|
|
17956
|
-
/**
|
|
17957
|
-
* @see <https://github.com/mbostock/d3/blob/master/src/arrays/quantile.js>
|
|
17958
|
-
* @see <http://en.wikipedia.org/wiki/Quantile>
|
|
18258
|
+
* This code was copied from "d3.js"
|
|
18259
|
+
* <https://github.com/d3/d3/blob/9cc9a875e636a1dcf36cc1e07bdf77e1ad6e2c74/src/arrays/quantile.js>.
|
|
18260
|
+
* See the license statement at the head of this file.
|
|
17959
18261
|
* @param {Array.<number>} ascArr
|
|
17960
18262
|
*/
|
|
17961
18263
|
|
|
@@ -18208,6 +18510,28 @@ function formatTime(tpl, value, isUTC) {
|
|
|
18208
18510
|
|
|
18209
18511
|
var truncateText$1 = truncateText;
|
|
18210
18512
|
|
|
18513
|
+
/**
|
|
18514
|
+
* @public
|
|
18515
|
+
* @param {Object} opt
|
|
18516
|
+
* @param {string} opt.text
|
|
18517
|
+
* @param {string} opt.font
|
|
18518
|
+
* @param {string} [opt.textAlign='left']
|
|
18519
|
+
* @param {string} [opt.textVerticalAlign='top']
|
|
18520
|
+
* @param {Array.<number>} [opt.textPadding]
|
|
18521
|
+
* @param {number} [opt.textLineHeight]
|
|
18522
|
+
* @param {Object} [opt.rich]
|
|
18523
|
+
* @param {Object} [opt.truncate]
|
|
18524
|
+
* @return {Object} {x, y, width, height, lineHeight}
|
|
18525
|
+
*/
|
|
18526
|
+
|
|
18527
|
+
|
|
18528
|
+
/**
|
|
18529
|
+
* @deprecated
|
|
18530
|
+
* the `textLineHeight` was added later.
|
|
18531
|
+
* For backward compatiblility, put it as the last parameter.
|
|
18532
|
+
* But deprecated this interface. Please use `getTextBoundingRect` instead.
|
|
18533
|
+
*/
|
|
18534
|
+
|
|
18211
18535
|
/*
|
|
18212
18536
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
18213
18537
|
* or more contributor license agreements. See the NOTICE file
|
|
@@ -25568,9 +25892,8 @@ function parseTransformAttribute(xmlNode, node) {
|
|
|
25568
25892
|
break;
|
|
25569
25893
|
}
|
|
25570
25894
|
}
|
|
25895
|
+
node.setLocalTransform(m);
|
|
25571
25896
|
}
|
|
25572
|
-
node.setLocalTransform(m);
|
|
25573
|
-
|
|
25574
25897
|
}
|
|
25575
25898
|
|
|
25576
25899
|
// Value may contain space.
|
|
@@ -25763,10 +26086,10 @@ var isFunction = isFunction$1;
|
|
|
25763
26086
|
var isObject = isObject$1;
|
|
25764
26087
|
var parseClassType = ComponentModel.parseClassType;
|
|
25765
26088
|
|
|
25766
|
-
var version = '4.2.
|
|
26089
|
+
var version = '4.2.1';
|
|
25767
26090
|
|
|
25768
26091
|
var dependencies = {
|
|
25769
|
-
zrender: '4.0.
|
|
26092
|
+
zrender: '4.0.6'
|
|
25770
26093
|
};
|
|
25771
26094
|
|
|
25772
26095
|
var TEST_FRAME_REMAIN_TIME = 1;
|
|
@@ -27218,7 +27541,7 @@ var MOUSE_EVENT_NAMES = [
|
|
|
27218
27541
|
*/
|
|
27219
27542
|
echartsProto._initEvents = function () {
|
|
27220
27543
|
each(MOUSE_EVENT_NAMES, function (eveName) {
|
|
27221
|
-
|
|
27544
|
+
var handler = function (e) {
|
|
27222
27545
|
var ecModel = this.getModel();
|
|
27223
27546
|
var el = e.target;
|
|
27224
27547
|
var params;
|
|
@@ -27287,8 +27610,14 @@ echartsProto._initEvents = function () {
|
|
|
27287
27610
|
|
|
27288
27611
|
this.trigger(eveName, params);
|
|
27289
27612
|
}
|
|
27290
|
-
|
|
27291
|
-
|
|
27613
|
+
};
|
|
27614
|
+
// Consider that some component (like tooltip, brush, ...)
|
|
27615
|
+
// register zr event handler, but user event handler might
|
|
27616
|
+
// do anything, such as call `setOption` or `dispatchAction`,
|
|
27617
|
+
// which probably update any of the content and probably
|
|
27618
|
+
// cause problem if it is called previous other inner handlers.
|
|
27619
|
+
handler.zrEventfulCallAtLast = true;
|
|
27620
|
+
this._zr.on(eveName, handler, this);
|
|
27292
27621
|
}, this);
|
|
27293
27622
|
|
|
27294
27623
|
each(eventActionMap, function (actionType, eventType) {
|
|
@@ -28375,6 +28704,7 @@ function mayLabelDimType(dimType) {
|
|
|
28375
28704
|
var isObject$4 = isObject$1;
|
|
28376
28705
|
|
|
28377
28706
|
var UNDEFINED = 'undefined';
|
|
28707
|
+
var INDEX_NOT_FOUND = -1;
|
|
28378
28708
|
|
|
28379
28709
|
// Use prefix to avoid index to be the same as otherIdList[idx],
|
|
28380
28710
|
// which will cause weird udpate animation.
|
|
@@ -28394,6 +28724,7 @@ var dataCtors = {
|
|
|
28394
28724
|
// Caution: MUST not use `new CtorUint32Array(arr, 0, len)`, because the Ctor of array is
|
|
28395
28725
|
// different from the Ctor of typed array.
|
|
28396
28726
|
var CtorUint32Array = typeof Uint32Array === UNDEFINED ? Array : Uint32Array;
|
|
28727
|
+
var CtorInt32Array = typeof Int32Array === UNDEFINED ? Array : Int32Array;
|
|
28397
28728
|
var CtorUint16Array = typeof Uint16Array === UNDEFINED ? Array : Uint16Array;
|
|
28398
28729
|
|
|
28399
28730
|
function getIndicesCtor(list) {
|
|
@@ -28754,10 +29085,10 @@ listProto.initData = function (data, nameList, dimValueGetter) {
|
|
|
28754
29085
|
this.defaultDimValueGetter = defaultDimValueGetters[
|
|
28755
29086
|
this._rawData.getSource().sourceFormat
|
|
28756
29087
|
];
|
|
28757
|
-
|
|
28758
29088
|
// Default dim value getter
|
|
28759
29089
|
this._dimValueGetter = dimValueGetter = dimValueGetter
|
|
28760
29090
|
|| this.defaultDimValueGetter;
|
|
29091
|
+
this._dimValueGetterArrayRows = defaultDimValueGetters.arrayRows;
|
|
28761
29092
|
|
|
28762
29093
|
// Reset raw extent.
|
|
28763
29094
|
this._rawExtent = {};
|
|
@@ -28774,6 +29105,9 @@ listProto.getProvider = function () {
|
|
|
28774
29105
|
return this._rawData;
|
|
28775
29106
|
};
|
|
28776
29107
|
|
|
29108
|
+
/**
|
|
29109
|
+
* Caution: Can be only called on raw data (before `this._indices` created).
|
|
29110
|
+
*/
|
|
28777
29111
|
listProto.appendData = function (data) {
|
|
28778
29112
|
if (__DEV__) {
|
|
28779
29113
|
assert$1(!this._indices, 'appendData can only be called on raw data.');
|
|
@@ -28789,6 +29123,77 @@ listProto.appendData = function (data) {
|
|
|
28789
29123
|
this._initDataFromProvider(start, end);
|
|
28790
29124
|
};
|
|
28791
29125
|
|
|
29126
|
+
/**
|
|
29127
|
+
* Caution: Can be only called on raw data (before `this._indices` created).
|
|
29128
|
+
* This method does not modify `rawData` (`dataProvider`), but only
|
|
29129
|
+
* add values to storage.
|
|
29130
|
+
*
|
|
29131
|
+
* The final count will be increased by `Math.max(values.length, names.length)`.
|
|
29132
|
+
*
|
|
29133
|
+
* @param {Array.<Array.<*>>} values That is the SourceType: 'arrayRows', like
|
|
29134
|
+
* [
|
|
29135
|
+
* [12, 33, 44],
|
|
29136
|
+
* [NaN, 43, 1],
|
|
29137
|
+
* ['-', 'asdf', 0]
|
|
29138
|
+
* ]
|
|
29139
|
+
* Each item is exaclty cooresponding to a dimension.
|
|
29140
|
+
* @param {Array.<string>} [names]
|
|
29141
|
+
*/
|
|
29142
|
+
listProto.appendValues = function (values, names) {
|
|
29143
|
+
var chunkSize = this._chunkSize;
|
|
29144
|
+
var storage = this._storage;
|
|
29145
|
+
var dimensions = this.dimensions;
|
|
29146
|
+
var dimLen = dimensions.length;
|
|
29147
|
+
var rawExtent = this._rawExtent;
|
|
29148
|
+
|
|
29149
|
+
var start = this.count();
|
|
29150
|
+
var end = start + Math.max(values.length, names ? names.length : 0);
|
|
29151
|
+
var originalChunkCount = this._chunkCount;
|
|
29152
|
+
|
|
29153
|
+
for (var i = 0; i < dimLen; i++) {
|
|
29154
|
+
var dim = dimensions[i];
|
|
29155
|
+
if (!rawExtent[dim]) {
|
|
29156
|
+
rawExtent[dim] = getInitialExtent();
|
|
29157
|
+
}
|
|
29158
|
+
if (!storage[dim]) {
|
|
29159
|
+
storage[dim] = [];
|
|
29160
|
+
}
|
|
29161
|
+
prepareChunks(storage, this._dimensionInfos[dim], chunkSize, originalChunkCount, end);
|
|
29162
|
+
this._chunkCount = storage[dim].length;
|
|
29163
|
+
}
|
|
29164
|
+
|
|
29165
|
+
var emptyDataItem = new Array(dimLen);
|
|
29166
|
+
for (var idx = start; idx < end; idx++) {
|
|
29167
|
+
var sourceIdx = idx - start;
|
|
29168
|
+
var chunkIndex = Math.floor(idx / chunkSize);
|
|
29169
|
+
var chunkOffset = idx % chunkSize;
|
|
29170
|
+
|
|
29171
|
+
// Store the data by dimensions
|
|
29172
|
+
for (var k = 0; k < dimLen; k++) {
|
|
29173
|
+
var dim = dimensions[k];
|
|
29174
|
+
var val = this._dimValueGetterArrayRows(
|
|
29175
|
+
values[sourceIdx] || emptyDataItem, dim, sourceIdx, k
|
|
29176
|
+
);
|
|
29177
|
+
storage[dim][chunkIndex][chunkOffset] = val;
|
|
29178
|
+
|
|
29179
|
+
var dimRawExtent = rawExtent[dim];
|
|
29180
|
+
val < dimRawExtent[0] && (dimRawExtent[0] = val);
|
|
29181
|
+
val > dimRawExtent[1] && (dimRawExtent[1] = val);
|
|
29182
|
+
}
|
|
29183
|
+
|
|
29184
|
+
if (names) {
|
|
29185
|
+
this._nameList[idx] = names[sourceIdx];
|
|
29186
|
+
}
|
|
29187
|
+
}
|
|
29188
|
+
|
|
29189
|
+
this._rawCount = this._count = end;
|
|
29190
|
+
|
|
29191
|
+
// Reset data extent
|
|
29192
|
+
this._extent = {};
|
|
29193
|
+
|
|
29194
|
+
prepareInvertedIndex(this);
|
|
29195
|
+
};
|
|
29196
|
+
|
|
28792
29197
|
listProto._initDataFromProvider = function (start, end) {
|
|
28793
29198
|
// Optimize.
|
|
28794
29199
|
if (start >= end) {
|
|
@@ -28807,8 +29212,7 @@ listProto._initDataFromProvider = function (start, end) {
|
|
|
28807
29212
|
var nameRepeatCount = this._nameRepeatCount = {};
|
|
28808
29213
|
var nameDimIdx;
|
|
28809
29214
|
|
|
28810
|
-
var
|
|
28811
|
-
var lastChunkIndex = chunkCount - 1;
|
|
29215
|
+
var originalChunkCount = this._chunkCount;
|
|
28812
29216
|
for (var i = 0; i < dimLen; i++) {
|
|
28813
29217
|
var dim = dimensions[i];
|
|
28814
29218
|
if (!rawExtent[dim]) {
|
|
@@ -28822,26 +29226,13 @@ listProto._initDataFromProvider = function (start, end) {
|
|
|
28822
29226
|
if (dimInfo.otherDims.itemId === 0) {
|
|
28823
29227
|
this._idDimIdx = i;
|
|
28824
29228
|
}
|
|
28825
|
-
var DataCtor = dataCtors[dimInfo.type];
|
|
28826
29229
|
|
|
28827
29230
|
if (!storage[dim]) {
|
|
28828
29231
|
storage[dim] = [];
|
|
28829
29232
|
}
|
|
28830
|
-
var resizeChunkArray = storage[dim][lastChunkIndex];
|
|
28831
|
-
if (resizeChunkArray && resizeChunkArray.length < chunkSize) {
|
|
28832
|
-
var newStore = new DataCtor(Math.min(end - lastChunkIndex * chunkSize, chunkSize));
|
|
28833
|
-
// The cost of the copy is probably inconsiderable
|
|
28834
|
-
// within the initial chunkSize.
|
|
28835
|
-
for (var j = 0; j < resizeChunkArray.length; j++) {
|
|
28836
|
-
newStore[j] = resizeChunkArray[j];
|
|
28837
|
-
}
|
|
28838
|
-
storage[dim][lastChunkIndex] = newStore;
|
|
28839
|
-
}
|
|
28840
29233
|
|
|
28841
|
-
|
|
28842
|
-
|
|
28843
|
-
storage[dim].push(new DataCtor(Math.min(end - k, chunkSize)));
|
|
28844
|
-
}
|
|
29234
|
+
prepareChunks(storage, dimInfo, chunkSize, originalChunkCount, end);
|
|
29235
|
+
|
|
28845
29236
|
this._chunkCount = storage[dim].length;
|
|
28846
29237
|
}
|
|
28847
29238
|
|
|
@@ -28867,12 +29258,8 @@ listProto._initDataFromProvider = function (start, end) {
|
|
|
28867
29258
|
dimStorage[chunkOffset] = val;
|
|
28868
29259
|
|
|
28869
29260
|
var dimRawExtent = rawExtent[dim];
|
|
28870
|
-
|
|
28871
|
-
|
|
28872
|
-
}
|
|
28873
|
-
if (val > dimRawExtent[1]) {
|
|
28874
|
-
dimRawExtent[1] = val;
|
|
28875
|
-
}
|
|
29261
|
+
val < dimRawExtent[0] && (dimRawExtent[0] = val);
|
|
29262
|
+
val > dimRawExtent[1] && (dimRawExtent[1] = val);
|
|
28876
29263
|
}
|
|
28877
29264
|
|
|
28878
29265
|
// ??? FIXME not check by pure but sourceFormat?
|
|
@@ -28931,6 +29318,27 @@ listProto._initDataFromProvider = function (start, end) {
|
|
|
28931
29318
|
prepareInvertedIndex(this);
|
|
28932
29319
|
};
|
|
28933
29320
|
|
|
29321
|
+
function prepareChunks(storage, dimInfo, chunkSize, chunkCount, end) {
|
|
29322
|
+
var DataCtor = dataCtors[dimInfo.type];
|
|
29323
|
+
var lastChunkIndex = chunkCount - 1;
|
|
29324
|
+
var dim = dimInfo.name;
|
|
29325
|
+
var resizeChunkArray = storage[dim][lastChunkIndex];
|
|
29326
|
+
if (resizeChunkArray && resizeChunkArray.length < chunkSize) {
|
|
29327
|
+
var newStore = new DataCtor(Math.min(end - lastChunkIndex * chunkSize, chunkSize));
|
|
29328
|
+
// The cost of the copy is probably inconsiderable
|
|
29329
|
+
// within the initial chunkSize.
|
|
29330
|
+
for (var j = 0; j < resizeChunkArray.length; j++) {
|
|
29331
|
+
newStore[j] = resizeChunkArray[j];
|
|
29332
|
+
}
|
|
29333
|
+
storage[dim][lastChunkIndex] = newStore;
|
|
29334
|
+
}
|
|
29335
|
+
|
|
29336
|
+
// Create new chunks.
|
|
29337
|
+
for (var k = chunkCount * chunkSize; k < end; k += chunkSize) {
|
|
29338
|
+
storage[dim].push(new DataCtor(Math.min(end - k, chunkSize)));
|
|
29339
|
+
}
|
|
29340
|
+
}
|
|
29341
|
+
|
|
28934
29342
|
function prepareInvertedIndex(list) {
|
|
28935
29343
|
var invertedIndicesMap = list._invertedIndicesMap;
|
|
28936
29344
|
each$1(invertedIndicesMap, function (invertedIndices, dim) {
|
|
@@ -28939,13 +29347,13 @@ function prepareInvertedIndex(list) {
|
|
|
28939
29347
|
// Currently, only dimensions that has ordinalMeta can create inverted indices.
|
|
28940
29348
|
var ordinalMeta = dimInfo.ordinalMeta;
|
|
28941
29349
|
if (ordinalMeta) {
|
|
28942
|
-
invertedIndices = invertedIndicesMap[dim] = new
|
|
29350
|
+
invertedIndices = invertedIndicesMap[dim] = new CtorInt32Array(
|
|
28943
29351
|
ordinalMeta.categories.length
|
|
28944
29352
|
);
|
|
28945
29353
|
// The default value of TypedArray is 0. To avoid miss
|
|
28946
|
-
// mapping to 0, we should set it as
|
|
29354
|
+
// mapping to 0, we should set it as INDEX_NOT_FOUND.
|
|
28947
29355
|
for (var i = 0; i < invertedIndices.length; i++) {
|
|
28948
|
-
invertedIndices[i] =
|
|
29356
|
+
invertedIndices[i] = INDEX_NOT_FOUND;
|
|
28949
29357
|
}
|
|
28950
29358
|
for (var i = 0; i < list._count; i++) {
|
|
28951
29359
|
// Only support the case that all values are distinct.
|
|
@@ -29310,7 +29718,7 @@ listProto.rawIndexOf = function (dim, value) {
|
|
|
29310
29718
|
}
|
|
29311
29719
|
var rawIndex = invertedIndices[value];
|
|
29312
29720
|
if (rawIndex == null || isNaN(rawIndex)) {
|
|
29313
|
-
return
|
|
29721
|
+
return INDEX_NOT_FOUND;
|
|
29314
29722
|
}
|
|
29315
29723
|
return rawIndex;
|
|
29316
29724
|
};
|
|
@@ -32816,10 +33224,10 @@ function createPolarClipShape(polar, hasAnimation, forSymbol, seriesModel) {
|
|
|
32816
33224
|
|
|
32817
33225
|
var clipPath = new Sector({
|
|
32818
33226
|
shape: {
|
|
32819
|
-
cx: round$
|
|
32820
|
-
cy: round$
|
|
32821
|
-
r0: round$
|
|
32822
|
-
r: round$
|
|
33227
|
+
cx: round$2(polar.cx, 1),
|
|
33228
|
+
cy: round$2(polar.cy, 1),
|
|
33229
|
+
r0: round$2(radiusExtent[0], 1),
|
|
33230
|
+
r: round$2(radiusExtent[1], 1),
|
|
32823
33231
|
startAngle: -angleExtent[0] * RADIAN,
|
|
32824
33232
|
endAngle: -angleExtent[1] * RADIAN,
|
|
32825
33233
|
clockwise: angleAxis.inverse
|
|
@@ -34199,7 +34607,7 @@ OrdinalScale.create = function () {
|
|
|
34199
34607
|
* For testable.
|
|
34200
34608
|
*/
|
|
34201
34609
|
|
|
34202
|
-
var roundNumber$1 = round$
|
|
34610
|
+
var roundNumber$1 = round$2;
|
|
34203
34611
|
|
|
34204
34612
|
/**
|
|
34205
34613
|
* @param {Array.<number>} extent Both extent[0] and extent[1] should be valid number.
|
|
@@ -34320,7 +34728,7 @@ function intervalScaleGetTicks(interval, extent, niceTickExtent, intervalPrecisi
|
|
|
34320
34728
|
*/
|
|
34321
34729
|
|
|
34322
34730
|
|
|
34323
|
-
var roundNumber = round$
|
|
34731
|
+
var roundNumber = round$2;
|
|
34324
34732
|
|
|
34325
34733
|
/**
|
|
34326
34734
|
* @alias module:echarts/coord/scale/Interval
|
|
@@ -34930,11 +35338,16 @@ function getValueAxisStart(baseAxis, valueAxis, stacked) {
|
|
|
34930
35338
|
*/
|
|
34931
35339
|
|
|
34932
35340
|
/*
|
|
34933
|
-
*
|
|
34934
|
-
*
|
|
34935
|
-
*
|
|
35341
|
+
* A third-party license is embeded for some of the code in this file:
|
|
35342
|
+
* The "scaleLevels" was originally copied from "d3.js" with some
|
|
35343
|
+
* modifications made for this project.
|
|
35344
|
+
* (See more details in the comment on the definition of "scaleLevels" below.)
|
|
35345
|
+
* The use of the source code of this file is also subject to the terms
|
|
35346
|
+
* and consitions of the license of "d3.js" (BSD-3Clause, see
|
|
35347
|
+
* </licenses/LICENSE-d3>).
|
|
34936
35348
|
*/
|
|
34937
35349
|
|
|
35350
|
+
|
|
34938
35351
|
// [About UTC and local time zone]:
|
|
34939
35352
|
// In most cases, `number.parseDate` will treat input data string as local time
|
|
34940
35353
|
// (except time zone is specified in time string). And `format.formateTime` returns
|
|
@@ -35010,10 +35423,10 @@ var TimeScale = IntervalScale.extend({
|
|
|
35010
35423
|
var interval = this._interval;
|
|
35011
35424
|
|
|
35012
35425
|
if (!opt.fixMin) {
|
|
35013
|
-
extent[0] = round$
|
|
35426
|
+
extent[0] = round$2(mathFloor(extent[0] / interval) * interval);
|
|
35014
35427
|
}
|
|
35015
35428
|
if (!opt.fixMax) {
|
|
35016
|
-
extent[1] = round$
|
|
35429
|
+
extent[1] = round$2(mathCeil(extent[1] / interval) * interval);
|
|
35017
35430
|
}
|
|
35018
35431
|
},
|
|
35019
35432
|
|
|
@@ -35077,7 +35490,12 @@ each$1(['contain', 'normalize'], function (methodName) {
|
|
|
35077
35490
|
};
|
|
35078
35491
|
});
|
|
35079
35492
|
|
|
35080
|
-
|
|
35493
|
+
/**
|
|
35494
|
+
* This implementation was originally copied from "d3.js"
|
|
35495
|
+
* <https://github.com/d3/d3/blob/b516d77fb8566b576088e73410437494717ada26/src/time/scale.js>
|
|
35496
|
+
* with some modifications made for this program.
|
|
35497
|
+
* See the license statement at the head of this file.
|
|
35498
|
+
*/
|
|
35081
35499
|
var scaleLevels = [
|
|
35082
35500
|
// Format interval
|
|
35083
35501
|
['hh:mm:ss', ONE_SECOND], // 1s
|
|
@@ -35154,7 +35572,7 @@ var scaleProto$1 = Scale.prototype;
|
|
|
35154
35572
|
var intervalScaleProto$1 = IntervalScale.prototype;
|
|
35155
35573
|
|
|
35156
35574
|
var getPrecisionSafe$1 = getPrecisionSafe;
|
|
35157
|
-
var roundingErrorFix = round$
|
|
35575
|
+
var roundingErrorFix = round$2;
|
|
35158
35576
|
|
|
35159
35577
|
var mathFloor$1 = Math.floor;
|
|
35160
35578
|
var mathCeil$1 = Math.ceil;
|
|
@@ -35182,7 +35600,7 @@ var LogScale = Scale.extend({
|
|
|
35182
35600
|
var originalExtent = originalScale.getExtent();
|
|
35183
35601
|
|
|
35184
35602
|
return map(intervalScaleProto$1.getTicks.call(this), function (val) {
|
|
35185
|
-
var powVal = round$
|
|
35603
|
+
var powVal = round$2(mathPow$1(this.base, val));
|
|
35186
35604
|
|
|
35187
35605
|
// Fix #4158
|
|
35188
35606
|
powVal = (val === extent[0] && originalScale.__fixMin)
|
|
@@ -35287,8 +35705,8 @@ var LogScale = Scale.extend({
|
|
|
35287
35705
|
}
|
|
35288
35706
|
|
|
35289
35707
|
var niceExtent = [
|
|
35290
|
-
round$
|
|
35291
|
-
round$
|
|
35708
|
+
round$2(mathCeil$1(extent[0] / interval) * interval),
|
|
35709
|
+
round$2(mathFloor$1(extent[1] / interval) * interval)
|
|
35292
35710
|
];
|
|
35293
35711
|
|
|
35294
35712
|
this._interval = interval;
|
|
@@ -35697,6 +36115,26 @@ function rotateTextRect(textRect, rotate) {
|
|
|
35697
36115
|
return rotatedRect;
|
|
35698
36116
|
}
|
|
35699
36117
|
|
|
36118
|
+
/**
|
|
36119
|
+
* @param {module:echarts/src/model/Model} model axisLabelModel or axisTickModel
|
|
36120
|
+
* @return {number|String} Can be null|'auto'|number|function
|
|
36121
|
+
*/
|
|
36122
|
+
function getOptionCategoryInterval(model) {
|
|
36123
|
+
var interval = model.get('interval');
|
|
36124
|
+
return interval == null ? 'auto' : interval;
|
|
36125
|
+
}
|
|
36126
|
+
|
|
36127
|
+
/**
|
|
36128
|
+
* Set `categoryInterval` as 0 implicitly indicates that
|
|
36129
|
+
* show all labels reguardless of overlap.
|
|
36130
|
+
* @param {Object} axis axisModel.axis
|
|
36131
|
+
* @return {boolean}
|
|
36132
|
+
*/
|
|
36133
|
+
function shouldShowAllLabels(axis) {
|
|
36134
|
+
return axis.type === 'category'
|
|
36135
|
+
&& getOptionCategoryInterval(axis.getLabelModel()) === 0;
|
|
36136
|
+
}
|
|
36137
|
+
|
|
35700
36138
|
/*
|
|
35701
36139
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
35702
36140
|
* or more contributor license agreements. See the NOTICE file
|
|
@@ -36259,12 +36697,11 @@ function makeLabelsByNumericCategoryInterval(axis, categoryInterval, onlyTick) {
|
|
|
36259
36697
|
// suitable for splitLine and splitArea rendering.
|
|
36260
36698
|
// (2) Scales except category always contain min max label so
|
|
36261
36699
|
// do not need to perform this process.
|
|
36262
|
-
var
|
|
36263
|
-
|
|
36264
|
-
|
|
36265
|
-
};
|
|
36700
|
+
var showAllLabel = shouldShowAllLabels(axis);
|
|
36701
|
+
var includeMinLabel = labelModel.get('showMinLabel') || showAllLabel;
|
|
36702
|
+
var includeMaxLabel = labelModel.get('showMaxLabel') || showAllLabel;
|
|
36266
36703
|
|
|
36267
|
-
if (
|
|
36704
|
+
if (includeMinLabel && startTick !== ordinalExtent[0]) {
|
|
36268
36705
|
addItem(ordinalExtent[0]);
|
|
36269
36706
|
}
|
|
36270
36707
|
|
|
@@ -36274,7 +36711,7 @@ function makeLabelsByNumericCategoryInterval(axis, categoryInterval, onlyTick) {
|
|
|
36274
36711
|
addItem(tickValue);
|
|
36275
36712
|
}
|
|
36276
36713
|
|
|
36277
|
-
if (
|
|
36714
|
+
if (includeMaxLabel && tickValue !== ordinalExtent[1]) {
|
|
36278
36715
|
addItem(ordinalExtent[1]);
|
|
36279
36716
|
}
|
|
36280
36717
|
|
|
@@ -36316,12 +36753,6 @@ function makeLabelsByCustomizedCategoryInterval(axis, categoryInterval, onlyTick
|
|
|
36316
36753
|
return result;
|
|
36317
36754
|
}
|
|
36318
36755
|
|
|
36319
|
-
// Can be null|'auto'|number|function
|
|
36320
|
-
function getOptionCategoryInterval(model) {
|
|
36321
|
-
var interval = model.get('interval');
|
|
36322
|
-
return interval == null ? 'auto' : interval;
|
|
36323
|
-
}
|
|
36324
|
-
|
|
36325
36756
|
/*
|
|
36326
36757
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
36327
36758
|
* or more contributor license agreements. See the NOTICE file
|
|
@@ -38169,7 +38600,8 @@ var builders = {
|
|
|
38169
38600
|
symbol.attr({
|
|
38170
38601
|
rotation: point.rotate,
|
|
38171
38602
|
position: pos,
|
|
38172
|
-
silent: true
|
|
38603
|
+
silent: true,
|
|
38604
|
+
z2: 11
|
|
38173
38605
|
});
|
|
38174
38606
|
this.group.add(symbol);
|
|
38175
38607
|
}
|
|
@@ -38410,6 +38842,10 @@ function isSilent(axisModel) {
|
|
|
38410
38842
|
}
|
|
38411
38843
|
|
|
38412
38844
|
function fixMinMaxLabelShow(axisModel, labelEls, tickEls) {
|
|
38845
|
+
if (shouldShowAllLabels(axisModel.axis)) {
|
|
38846
|
+
return;
|
|
38847
|
+
}
|
|
38848
|
+
|
|
38413
38849
|
// If min or max are user set, we need to check
|
|
38414
38850
|
// If the tick on min(max) are overlap on their neighbour tick
|
|
38415
38851
|
// If they are overlapped, we need to hide the min(max) tick label
|
|
@@ -40823,7 +41259,6 @@ function adjustSingleSide(list, cx, cy, r, dir, viewWidth, viewHeight) {
|
|
|
40823
41259
|
return a.y - b.y;
|
|
40824
41260
|
});
|
|
40825
41261
|
|
|
40826
|
-
// 压
|
|
40827
41262
|
function shiftDown(start, end, delta, dir) {
|
|
40828
41263
|
for (var j = start; j < end; j++) {
|
|
40829
41264
|
list[j].y += delta;
|
|
@@ -40839,7 +41274,6 @@ function adjustSingleSide(list, cx, cy, r, dir, viewWidth, viewHeight) {
|
|
|
40839
41274
|
shiftUp(end - 1, delta / 2);
|
|
40840
41275
|
}
|
|
40841
41276
|
|
|
40842
|
-
// 弹
|
|
40843
41277
|
function shiftUp(end, delta) {
|
|
40844
41278
|
for (var j = end; j >= 0; j--) {
|
|
40845
41279
|
list[j].y -= delta;
|
|
@@ -40853,18 +41287,14 @@ function adjustSingleSide(list, cx, cy, r, dir, viewWidth, viewHeight) {
|
|
|
40853
41287
|
|
|
40854
41288
|
function changeX(list, isDownList, cx, cy, r, dir) {
|
|
40855
41289
|
var lastDeltaX = dir > 0
|
|
40856
|
-
? isDownList //
|
|
40857
|
-
? Number.MAX_VALUE //
|
|
40858
|
-
: 0 //
|
|
40859
|
-
: isDownList //
|
|
40860
|
-
? Number.MAX_VALUE //
|
|
40861
|
-
: 0; //
|
|
41290
|
+
? isDownList // right-side
|
|
41291
|
+
? Number.MAX_VALUE // down
|
|
41292
|
+
: 0 // up
|
|
41293
|
+
: isDownList // left-side
|
|
41294
|
+
? Number.MAX_VALUE // down
|
|
41295
|
+
: 0; // up
|
|
40862
41296
|
|
|
40863
41297
|
for (var i = 0, l = list.length; i < l; i++) {
|
|
40864
|
-
// Not change x for center label
|
|
40865
|
-
if (list[i].position === 'center') {
|
|
40866
|
-
continue;
|
|
40867
|
-
}
|
|
40868
41298
|
var deltaY = Math.abs(list[i].y - cy);
|
|
40869
41299
|
var length = list[i].len;
|
|
40870
41300
|
var length2 = list[i].len2;
|
|
@@ -40875,11 +41305,11 @@ function adjustSingleSide(list, cx, cy, r, dir, viewWidth, viewHeight) {
|
|
|
40875
41305
|
)
|
|
40876
41306
|
: Math.abs(list[i].x - cx);
|
|
40877
41307
|
if (isDownList && deltaX >= lastDeltaX) {
|
|
40878
|
-
//
|
|
41308
|
+
// right-down, left-down
|
|
40879
41309
|
deltaX = lastDeltaX - 10;
|
|
40880
41310
|
}
|
|
40881
41311
|
if (!isDownList && deltaX <= lastDeltaX) {
|
|
40882
|
-
//
|
|
41312
|
+
// right-up, left-up
|
|
40883
41313
|
deltaX = lastDeltaX + 10;
|
|
40884
41314
|
}
|
|
40885
41315
|
|
|
@@ -40919,6 +41349,9 @@ function avoidOverlap(labelLayoutList, cx, cy, r, viewWidth, viewHeight) {
|
|
|
40919
41349
|
var leftList = [];
|
|
40920
41350
|
var rightList = [];
|
|
40921
41351
|
for (var i = 0; i < labelLayoutList.length; i++) {
|
|
41352
|
+
if (isPositionCenter(labelLayoutList[i])) {
|
|
41353
|
+
continue;
|
|
41354
|
+
}
|
|
40922
41355
|
if (labelLayoutList[i].x < cx) {
|
|
40923
41356
|
leftList.push(labelLayoutList[i]);
|
|
40924
41357
|
}
|
|
@@ -40931,6 +41364,9 @@ function avoidOverlap(labelLayoutList, cx, cy, r, viewWidth, viewHeight) {
|
|
|
40931
41364
|
adjustSingleSide(leftList, cx, cy, r, -1, viewWidth, viewHeight);
|
|
40932
41365
|
|
|
40933
41366
|
for (var i = 0; i < labelLayoutList.length; i++) {
|
|
41367
|
+
if (isPositionCenter(labelLayoutList[i])) {
|
|
41368
|
+
continue;
|
|
41369
|
+
}
|
|
40934
41370
|
var linePoints = labelLayoutList[i].linePoints;
|
|
40935
41371
|
if (linePoints) {
|
|
40936
41372
|
var dist = linePoints[1][0] - linePoints[2][0];
|
|
@@ -40946,6 +41382,11 @@ function avoidOverlap(labelLayoutList, cx, cy, r, viewWidth, viewHeight) {
|
|
|
40946
41382
|
}
|
|
40947
41383
|
}
|
|
40948
41384
|
|
|
41385
|
+
function isPositionCenter(layout) {
|
|
41386
|
+
// Not change x for center label
|
|
41387
|
+
return layout.position === 'center';
|
|
41388
|
+
}
|
|
41389
|
+
|
|
40949
41390
|
var labelLayout = function (seriesModel, r, viewWidth, viewHeight) {
|
|
40950
41391
|
var data = seriesModel.getData();
|
|
40951
41392
|
var labelLayoutList = [];
|