我正在使用Leaflet 1.0.1和LeafLet Draw,但问题是无法用LeafLet稳定版本点击Marker Layer
https://jsfiddle.net/tb0pct68/2/
var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
osmAttrib = '© <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors',
osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib});
map = new L.Map('map', {center: new L.LatLng(51.505, -0.04), zoom: 13}),
drawnItems = L.featureGroup().addTo(map);
L.control.layers({
//'osm':osm.addTo(map),
"google": osm.addTo(map),
}, {/*'drawlayer':drawnItems*/}, { position: 'topleft', collapsed: false }).addTo(map);
map.addControl(new L.Control.Draw({
edit: {
featureGroup: drawnItems,
poly : {
allowIntersection : false
}
},
draw: {
polygon : {
allowIntersection: false,
showArea:true
}
}
}));
function layerClick(e) {
alert('yes its clicked');
}
map.on('draw:created', function(event) {
var layer = event.layer;
layer.on('click',layerClick);
drawnItems.addLayer(layer);
});
画一个矩形,它会显示警告Dailog,但Marker图层点击不起作用,不确定是什么问题。
由于