Skip to content

Commit

Permalink
Merge pull request apache#12868 from plainheart/feat-add-initial-opti…
Browse files Browse the repository at this point in the history
…on-for-bmap

feat(extension/bmap): support for specifying initial map options.
  • Loading branch information
pissang authored Jul 7, 2020
2 parents 491d30b + 8b2ac9d commit 00f2c32
Show file tree
Hide file tree
Showing 3 changed files with 543 additions and 3 deletions.
9 changes: 7 additions & 2 deletions extension-src/bmap/BMapCoordSys.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -215,4 +220,4 @@ BMapCoordSys.create = function (ecModel, api) {
});
};

export default BMapCoordSys;
export default BMapCoordSys;
7 changes: 6 additions & 1 deletion extension-src/bmap/BMapModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,15 @@ 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 https://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference.html#a0b1
mapOptions: {},

roam: false
}
});
});
Loading

0 comments on commit 00f2c32

Please sign in to comment.