Here's a dirty way to find out which drawControl is active.
The trick is to place them in different corners of the map. This helps to check which is ul.leaflet-draw-actionsdisplayed when the user draws. For example, in div.leaflet-topor in div.leaflet-bottom:
var drawControl = new L.Control.Draw({
position: 'topleft',
draw: {
polygon: false,
rectangle: false,
circle: false,
marker: false
}
});
map.addControl(drawControl);
var drawControl2 = new L.Control.Draw({
position: 'bottomleft',
draw: {
polygon: false,
rectangle: false,
circle: false,
marker: false
}
});
map.addControl(drawControl2);
map.on('draw:drawvertex', function (e) {
console.log("Vertex drawn", e);
if ($('div.leaflet-top ul.leaflet-draw-actions').is(':visible')){
console.log('it was drawn with drawControl');
}
else {
console.log('it was drawn with drawControl2 !');
}
});
, .