diff --git a/extension-src/bmap/BMapCoordSys.js b/extension-src/bmap/BMapCoordSys.js index 30a05ef024..0881f37522 100644 --- a/extension-src/bmap/BMapCoordSys.js +++ b/extension-src/bmap/BMapCoordSys.js @@ -201,8 +201,13 @@ BMapCoordSys.create = function (ecModel, api) { var center = bmapModel.get('center'); var zoom = bmapModel.get('zoom'); if (center && zoom) { - var pt = new BMap.Point(center[0], center[1]); - bmap.centerAndZoom(pt, zoom); + var bmapCenter = bmap.getCenter(); + var bmapZoom = bmap.getZoom(); + var centerOrZoomChanged = bmapModel.centerOrZoomChanged([bmapCenter.lng, bmapCenter.lat], bmapZoom); + if (centerOrZoomChanged) { + var pt = new BMap.Point(center[0], center[1]); + bmap.centerAndZoom(pt, zoom); + } } bmapCoordSys = new BMapCoordSys(bmap, api); diff --git a/extension-src/bmap/BMapView.js b/extension-src/bmap/BMapView.js index b1ff0045e8..e8a99e4298 100644 --- a/extension-src/bmap/BMapView.js +++ b/extension-src/bmap/BMapView.js @@ -67,12 +67,10 @@ export default echarts.extendComponentView({ } bmap.removeEventListener('moving', this._oldMoveHandler); - // FIXME - // Moveend may be triggered by centerAndZoom method when creating coordSys next time - // bmap.removeEventListener('moveend', this._oldMoveHandler); + bmap.removeEventListener('moveend', this._oldMoveHandler); bmap.removeEventListener('zoomend', this._oldZoomEndHandler); bmap.addEventListener('moving', moveHandler); - // bmap.addEventListener('moveend', moveHandler); + bmap.addEventListener('moveend', moveHandler); bmap.addEventListener('zoomend', zoomEndHandler); this._oldMoveHandler = moveHandler; diff --git a/test/bmap2.html b/test/bmap2.html new file mode 100644 index 0000000000..c2ce976cbd --- /dev/null +++ b/test/bmap2.html @@ -0,0 +1,592 @@ + + + + + + + + + + + + + +
+ + +