提交 defffbe9 编写于 作者: P pissang

fix(bmap): fix bmap style changed by the sdk and cause unexpected refresh bug.

上级 7887f27a
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
import * as echarts from 'echarts'; import * as echarts from 'echarts';
import { clone } from 'zrender/src/core/util';
export default echarts.extendComponentView({ export default echarts.extendComponentView({
type: 'bmap', type: 'bmap',
...@@ -96,7 +97,7 @@ export default echarts.extendComponentView({ ...@@ -96,7 +97,7 @@ export default echarts.extendComponentView({
if (JSON.stringify(originalStyle) !== mapStyleStr) { if (JSON.stringify(originalStyle) !== mapStyleStr) {
// FIXME May have blank tile when dragging if setMapStyle // FIXME May have blank tile when dragging if setMapStyle
if (Object.keys(newMapStyle).length) { if (Object.keys(newMapStyle).length) {
bmap.setMapStyle(newMapStyle); bmap.setMapStyle(clone(newMapStyle));
} }
bMapModel.__mapStyle = JSON.parse(mapStyleStr); bMapModel.__mapStyle = JSON.parse(mapStyleStr);
} }
...@@ -110,7 +111,7 @@ export default echarts.extendComponentView({ ...@@ -110,7 +111,7 @@ export default echarts.extendComponentView({
if (JSON.stringify(originalStyle2) !== mapStyleStr2) { if (JSON.stringify(originalStyle2) !== mapStyleStr2) {
// FIXME May have blank tile when dragging if setMapStyle // FIXME May have blank tile when dragging if setMapStyle
if (Object.keys(newMapStyle2).length) { if (Object.keys(newMapStyle2).length) {
bmap.setMapStyleV2(newMapStyle2); bmap.setMapStyleV2(clone(newMapStyle2));
} }
bMapModel.__mapStyle2 = JSON.parse(mapStyleStr2); bMapModel.__mapStyle2 = JSON.parse(mapStyleStr2);
} }
......
...@@ -123,9 +123,13 @@ lineDrawProto.incrementalPrepareUpdate = function (lineData) { ...@@ -123,9 +123,13 @@ lineDrawProto.incrementalPrepareUpdate = function (lineData) {
this.group.removeAll(); this.group.removeAll();
}; };
function isEffectObject(el) {
return el.animators && el.animators.length > 0;
}
lineDrawProto.incrementalUpdate = function (taskParams, lineData) { lineDrawProto.incrementalUpdate = function (taskParams, lineData) {
function updateIncrementalAndHover(el) { function updateIncrementalAndHover(el) {
if (!el.isGroup) { if (!el.isGroup && !isEffectObject(el)) {
el.incremental = el.useHoverLayer = true; el.incremental = el.useHoverLayer = true;
} }
} }
......
...@@ -24,7 +24,7 @@ under the License. ...@@ -24,7 +24,7 @@ under the License.
<script src='lib/esl.js'></script> <script src='lib/esl.js'></script>
<script src='lib/config.js'></script> <script src='lib/config.js'></script>
<script src='lib/jquery.min.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' /> <meta name='viewport' content='width=device-width, initial-scale=1' />
</head> </head>
<body> <body>
...@@ -34,8 +34,14 @@ under the License. ...@@ -34,8 +34,14 @@ under the License.
height: 100%; height: 100%;
margin: 0; margin: 0;
} }
#clear {
position: absolute;
left: 10px;
top: 10px;
}
</style> </style>
<div id='main'></div> <div id='main'></div>
<button id='clear'>Clear</button>
<script> <script>
require([ require([
...@@ -244,8 +250,15 @@ under the License. ...@@ -244,8 +250,15 @@ under the License.
}); });
}); });
});
document.getElementById('clear').addEventListener('click', function() {
myChart.setOption({
series: [{
data: []
}]
});
});
});
</script> </script>
</body> </body>
</html> </html>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册