angular-leaflet-directive
angular-leaflet-directive copied to clipboard
Draw Controls | Disable handlers not working
Seems draw control to disable specific handler are not working. Example html:
<script>
var app = angular.module("demoapp", ["leaflet-directive"]);
app.controller("ControlsDrawController", [ "$scope", "leafletData", function($scope, leafletData) {
var drawnItems;
angular.extend($scope, {
london: {
lat: 51.505,
lng: -0.09,
zoom: 4
},
controls: {
draw: {
polyline: false,
polygon: false,
circle: true,
marker: true
}
},
layers: {
baselayers: {
osm : {
name : 'OpenStreetMap',
url : 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
type : 'xyz'
}
},
overlays: {
draw: {
name: 'draw',
type: 'group',
visible: true,
layerParams: {
showOnSelector: false
}
}
}
}
});
leafletData.getMap().then(function(map) {
leafletData.getLayers().then(function(baselayers) {
drawnItems = baselayers.overlays.draw;
map.on('draw:created', function (e) {
var layer = e.layer;
drawnItems.addLayer(layer);
console.log(JSON.stringify(layer.toGeoJSON()));
});
});
});
}]);
</script>
Please suggest the workaround.
controls: { draw: { draw: { polygon:false, rectangle:false } } }