我正在使用传单绘制绘制和编辑以下配置层。
window.drawnItems = new L.FeatureGroup().addTo(map);
var options = {
position: 'topleft',
edit: {
featureGroup: window.drawnItems
},
draw: {
polyline: {
shapeOptions: {
color: '#f357a1',
weight: 10
},
guideLayers: guideLayers,
},
polygon: {
allowIntersection: false, // Restricts shapes to simple polygons
drawError: {
color: '#e1e100',
message: 'You can\'t draw that!'
},
shapeOptions: {
color: '#bada55'
},
guideLayers: guideLayers,
},
marker: {
guideLayers: guideLayers,
snapVertices: false
},
rectangle: false,
circle: false,
circlemarker: false,
}
};
map.addControl(new L.Control.Draw(options));
有了这个,添加新的特征是完全可以的,但是当我试图编辑它时,我的意思是改变特征的几何结构,当我拖动控制柄(白色框)时,我移动的是孔地图而不是特征。所以似乎有些东西妨碍了插件的正常工作。
我也在用
leaflet Snap "0.0.3"
leaflet": "^0.7.7",
leaflet-geometryutil": "*"
leaflet-draw": "^0.3.2"