关于制作百度地图 API 问题,创建多边形蓝色边框内的白色半透明涂层如何变不见,可以显示地图或者文字。求代码
关于制作百度地图API问题,创建多边形蓝色边框内的白色半透明涂层如何变不见,可以显示地图或者文字。求代码以下为制作多边形的代码:
//创建经纬度数组 冼村街道
var xiancunCenter = new BMap.Point(113.340128,23.128283);
var xiancun = [new BMap.Point(113.327839,23.133434),new BMap.Point(113.327696,23.118844),new BMap.Point(113.349722,23.116584),new BMap.Point(113.350153,23.131939)];
//创建多边形
var xiancunPolygon = new BMap.Polygon(xiancun, {strokeColor:"blue", strokeWeight:5, strokeOpacity:0.5});
//添加多边形到地图上
map.addOverlay(xiancunPolygon);
xiancunPolygon.addEventListener("mouseover",function(){ xiancunPolygon.setStrokeColor("red");});
xiancunPolygon.addEventListener("mouseout",function(){ xiancunPolygon.setStrokeColor("blue");});
xiancunPolygon.addEventListener("click",function(){ map.zoomIn(); xiancunPolygon.setStrokeColor("red"); map.setCenter(xiancunCenter);});
var xiancunLabel2 = new BMap.Label("冼村",{offset: new BMap.Size(10,-20), position: xiancunCenter});xiancunLabel2.setStyle({"padding": "2px"});map.addOverlay(xiancunLabel2);