angular-leaflet-directive icon indicating copy to clipboard operation
angular-leaflet-directive copied to clipboard

Draw Controls | Disable handlers not working

Open actolap opened this issue 9 years ago • 1 comments

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.

actolap avatar Apr 23 '16 14:04 actolap

controls: { draw: { draw: { polygon:false, rectangle:false } } }

kslo88 avatar Mar 05 '18 07:03 kslo88