点击鼠标右键获取经纬度,并画经纬度10公里范围圈,添加地图右键监听后,点击鼠标右键,可以正常获得经纬度,并画范围圈,但是map的click事件会被触发,导致再次点击右键时失效,点完鼠标右键,必须再次点击鼠标左键,才会释放,然后再点右键才起作用。var rightclick = function(e){ map.clearOverlays(); //var rightclickPoint = {lng:e.point.lng,lat:e.point.lat};
var mPoint = new BMap.Point(e.point.lng, e.point.lat);
$('#lat1').val(e.point.lat);
$('#lng1').val(e.point.lng);
var circle = new BMap.Circle(mPoint,10000,{fillColor:"blue", strokeWeight: 1 ,fillOpacity: 0.1, strokeOpacity: 0.3}); map.addOverlay(circle);
}map.addEventListener("rightclick", rightclick);
添加回答
举报
0/150
提交
取消