From 1368d2c03f37ddc1ca0783ebaf30b50ff26b0a15 Mon Sep 17 00:00:00 2001 From: plainheart Date: Thu, 7 May 2020 16:46:48 +0800 Subject: [PATCH 1/2] feat(bmap): add `mapOptions` for bmap extension. --- extension-src/bmap/BMapCoordSys.js | 9 +++++++-- extension-src/bmap/BMapModel.js | 5 ++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/extension-src/bmap/BMapCoordSys.js b/extension-src/bmap/BMapCoordSys.js index 2bd8070d12..30a05ef024 100644 --- a/extension-src/bmap/BMapCoordSys.js +++ b/extension-src/bmap/BMapCoordSys.js @@ -179,7 +179,12 @@ BMapCoordSys.create = function (ecModel, api) { // Not support IE8 bmapRoot.classList.add('ec-extension-bmap'); root.appendChild(bmapRoot); - var bmap = bmapModel.__bmap = new BMap.Map(bmapRoot); + + // initialize bmap + var mapOptions = bmapModel.get('mapOptions') || {}; + // Not support `mapType`, use `bmap.setMapType(MapType)` instead. + delete mapOptions.mapType; + var bmap = bmapModel.__bmap = new BMap.Map(bmapRoot, mapOptions); var overlay = new Overlay(viewportRoot); bmap.addOverlay(overlay); @@ -215,4 +220,4 @@ BMapCoordSys.create = function (ecModel, api) { }); }; -export default BMapCoordSys; \ No newline at end of file +export default BMapCoordSys; diff --git a/extension-src/bmap/BMapModel.js b/extension-src/bmap/BMapModel.js index ca5cb6525a..29cacdf929 100644 --- a/extension-src/bmap/BMapModel.js +++ b/extension-src/bmap/BMapModel.js @@ -51,6 +51,9 @@ export default echarts.extendComponentModel({ mapStyleV2: {}, + // See http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a0b1 + mapOptions: {}, + roam: false } -}); \ No newline at end of file +}); From 8b2ac9d7f889ba59e47dd026a5136b3f6ce61e8b Mon Sep 17 00:00:00 2001 From: plainheart Date: Tue, 30 Jun 2020 15:43:29 +0800 Subject: [PATCH 2/2] test(extension/bmap): added test case bmap-mapOptions.html. --- extension-src/bmap/BMapModel.js | 4 +- test/bmap-mapOptions.html | 530 ++++++++++++++++++++++++++++++++ 2 files changed, 533 insertions(+), 1 deletion(-) create mode 100644 test/bmap-mapOptions.html diff --git a/extension-src/bmap/BMapModel.js b/extension-src/bmap/BMapModel.js index 29cacdf929..5f0d4d6b1c 100644 --- a/extension-src/bmap/BMapModel.js +++ b/extension-src/bmap/BMapModel.js @@ -47,11 +47,13 @@ export default echarts.extendComponentModel({ zoom: 5, + // 2.0 http://lbsyun.baidu.com/custom/index.htm mapStyle: {}, + // 3.0 http://lbsyun.baidu.com/index.php?title=open/custom mapStyleV2: {}, - // See http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a0b1 + // See https://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference.html#a0b1 mapOptions: {}, roam: false diff --git a/test/bmap-mapOptions.html b/test/bmap-mapOptions.html new file mode 100644 index 0000000000..8df0c1c4d7 --- /dev/null +++ b/test/bmap-mapOptions.html @@ -0,0 +1,530 @@ + + + + + + + + + + + + + + +
+ + +