Skip to content

Commit

Permalink
Merge pull request #12411 from apache/improve-bmap
Browse files Browse the repository at this point in the history
fix(bmap): fix bmap style changed by the sdk and cause unexpected refresh bug
  • Loading branch information
pissang authored Apr 10, 2020
2 parents 4d06b72 + defffbe commit 381b21e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
5 changes: 3 additions & 2 deletions extension-src/bmap/BMapView.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

import * as echarts from 'echarts';
import { clone } from 'zrender/src/core/util';

export default echarts.extendComponentView({
type: 'bmap',
Expand Down Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down
6 changes: 5 additions & 1 deletion src/chart/helper/LineDraw.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
17 changes: 15 additions & 2 deletions test/lines-bus.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<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>
Expand All @@ -34,8 +34,14 @@
height: 100%;
margin: 0;
}
#clear {
position: absolute;
left: 10px;
top: 10px;
}
</style>
<div id='main'></div>
<button id='clear'>Clear</button>
<script>

require([
Expand Down Expand Up @@ -244,8 +250,15 @@
});

});
});

document.getElementById('clear').addEventListener('click', function() {
myChart.setOption({
series: [{
data: []
}]
});
});
});
</script>
</body>
</html>

0 comments on commit 381b21e

Please sign in to comment.