收到新的 GeoJson 对象后编辑传单可拖动选项
Edit leaflet draggable option after receiving a new GeoJson object
我是使用传单的新手,我想知道您如何编辑对象的 draggable
选项,而不是已经保存在 GeoJson
中并稍后显示在地图上的对象。
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;
});
我也试过在样式后将 draggable
放在 true
,但没有任何反应。
P.S : 我有义务为拖动选项添加 DrawItem
吗?
P.S2 :所有对象都在 circleMarker
或 lines
中进行了转换,并且已经完成的开发非常大,所以我我试图在不破坏所有当前项目的情况下找到解决方案。
感谢您的回答。
好的,我刚刚更新了所有传单库,然后我继续 eachLayer
在图层
.on('mousedown', function(){
map.dragging.disable();
map.on('mousemove', function(e){
layer.setLatLng(e.latlng)
});
使 circleMarker 移动效果很好。
我是使用传单的新手,我想知道您如何编辑对象的 draggable
选项,而不是已经保存在 GeoJson
中并稍后显示在地图上的对象。
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;
});
我也试过在样式后将 draggable
放在 true
,但没有任何反应。
P.S : 我有义务为拖动选项添加 DrawItem
吗?
P.S2 :所有对象都在 circleMarker
或 lines
中进行了转换,并且已经完成的开发非常大,所以我我试图在不破坏所有当前项目的情况下找到解决方案。
感谢您的回答。
好的,我刚刚更新了所有传单库,然后我继续 eachLayer
在图层
.on('mousedown', function(){
map.dragging.disable();
map.on('mousemove', function(e){
layer.setLatLng(e.latlng)
});
使 circleMarker 移动效果很好。