Search code examples
leafletdraggable

Edit leaflet draggable option after receiving a new GeoJson object


I'm new on using leaflet and I'm wondering how do you edit a draggable option for object than has already been saved in GeoJson and that you display later on your map.

pldata[index] = new L.GeoJSON(plot[i],{
    pointToLayer: function (feature, latlng){
       return new L.circleMarker(larlng, geojsonAOs)
},
    style: set_style
}).addTo(map)

pldata['aos'].eachLayer(function (layer){
    layer.options.draggable: true;
});

I've tried also to put the draggable at true after style but nothing happen.

P.S : Am I obligated to add DrawItem for just drag options ?

P.S2 : All object have been transform in circleMarker or lines and development that has been done is quiet big so I'm trying to find a solution without break the all curent project.

Thanks for your answer.


Solution

  • Ok I've just update the all leaflet library and after I continue with a eachLayer and on Layer

    .on('mousedown', function(){
        map.dragging.disable();
        map.on('mousemove', function(e){
           layer.setLatLng(e.latlng)
    });
    

    it's working well to make a circleMarker move.