This is an automated email from the ASF dual-hosted git repository. shenyi pushed a commit to branch improve-bmap in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
commit defffbe9779ae04d81e5a54f4a27b73e140ecc16 Author: pissang <[email protected]> AuthorDate: Fri Apr 10 12:12:58 2020 +0800 fix(bmap): fix bmap style changed by the sdk and cause unexpected refresh bug. --- extension-src/bmap/BMapView.js | 5 +++-- src/chart/helper/LineDraw.js | 6 +++++- test/lines-bus.html | 17 +++++++++++++++-- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/extension-src/bmap/BMapView.js b/extension-src/bmap/BMapView.js index b69149e..1f793b5 100644 --- a/extension-src/bmap/BMapView.js +++ b/extension-src/bmap/BMapView.js @@ -18,6 +18,7 @@ */ import * as echarts from 'echarts'; +import { clone } from 'zrender/src/core/util'; export default echarts.extendComponentView({ type: 'bmap', @@ -96,7 +97,7 @@ export default echarts.extendComponentView({ if (JSON.stringify(originalStyle) !== mapStyleStr) { // FIXME May have blank tile when dragging if setMapStyle if (Object.keys(newMapStyle).length) { - bmap.setMapStyle(newMapStyle); + bmap.setMapStyle(clone(newMapStyle)); } bMapModel.__mapStyle = JSON.parse(mapStyleStr); } @@ -110,7 +111,7 @@ export default echarts.extendComponentView({ if (JSON.stringify(originalStyle2) !== mapStyleStr2) { // FIXME May have blank tile when dragging if setMapStyle if (Object.keys(newMapStyle2).length) { - bmap.setMapStyleV2(newMapStyle2); + bmap.setMapStyleV2(clone(newMapStyle2)); } bMapModel.__mapStyle2 = JSON.parse(mapStyleStr2); } diff --git a/src/chart/helper/LineDraw.js b/src/chart/helper/LineDraw.js index 707957a..27f7e3f 100644 --- a/src/chart/helper/LineDraw.js +++ b/src/chart/helper/LineDraw.js @@ -123,9 +123,13 @@ lineDrawProto.incrementalPrepareUpdate = function (lineData) { this.group.removeAll(); }; +function isEffectObject(el) { + return el.animators && el.animators.length > 0; +} + lineDrawProto.incrementalUpdate = function (taskParams, lineData) { function updateIncrementalAndHover(el) { - if (!el.isGroup) { + if (!el.isGroup && !isEffectObject(el)) { el.incremental = el.useHoverLayer = true; } } diff --git a/test/lines-bus.html b/test/lines-bus.html index dbf03f7..6fa0dc8 100644 --- a/test/lines-bus.html +++ b/test/lines-bus.html @@ -24,7 +24,7 @@ under the License. <script src='lib/esl.js'></script> <script src='lib/config.js'></script> <script src='lib/jquery.min.js'></script> - <script src='http://api.map.baidu.com/api?v=2.0&ak=KOmVjPVUAey1G2E8zNhPiuQ6QiEmAwZu'></script> + <script src='http://api.map.baidu.com/api?v=3.0&ak=KOmVjPVUAey1G2E8zNhPiuQ6QiEmAwZu'></script> <meta name='viewport' content='width=device-width, initial-scale=1' /> </head> <body> @@ -34,8 +34,14 @@ under the License. height: 100%; margin: 0; } + #clear { + position: absolute; + left: 10px; + top: 10px; + } </style> <div id='main'></div> + <button id='clear'>Clear</button> <script> require([ @@ -244,8 +250,15 @@ under the License. }); }); - }); + document.getElementById('clear').addEventListener('click', function() { + myChart.setOption({ + series: [{ + data: [] + }] + }); + }); + }); </script> </body> </html> \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
