re-enable draw editing

This commit is contained in:
Dave Conway-Jones 2019-04-30 08:21:57 +01:00
parent 18466c0542
commit 7f205e874e
No known key found for this signature in database
GPG Key ID: 9E7F9C73F5168CD4
2 changed files with 10 additions and 15 deletions

View File

@ -267,9 +267,6 @@ if (window.self !== window.top) {
}
else {
console.log("NOT in an iframe");
// window.onbeforeunload = function(e) {
// return 'Reloading will delete all the local markers, including any drawing on the "drawing" layer';
// };
if (!showUserMenu) {
document.getElementById("bars").style.display="none";
}
@ -570,10 +567,8 @@ map.on('overlayadd', function(e) {
}
if (e.name == "drawing") {
overlays["drawing"].bringToFront();
// And the actual draw controls
map.addControl(drawControl);
// Add the color change buttons
//colorControl.addTo(map);
//map.addControl(colorControl);
}
ws.send(JSON.stringify({action:"addlayer", name:e.name}));
});
@ -837,24 +832,24 @@ layers["_drawing"] = new L.FeatureGroup();
overlays["drawing"] = layers["_drawing"];
var drawControl = new L.Control.Draw({
draw: {
polyline: { shapeOptions: { clickable:false } },
polyline: { shapeOptions: { clickable:true } },
marker: false,
circle: false,
// circle: { shapeOptions: { clickable:false } },
//circle: false,
circle: { shapeOptions: { clickable:false } },
circlemarker: false,
rectangle: { shapeOptions: { clickable:true } },
polygon: { shapeOptions: { clickable:true } },
polygon: { shapeOptions: { clickable:true } }
},
edit: {
featureGroup: layers["_drawing"],
remove: true,
edit: false
edit: true
}
});
map.on('draw:created', function (e) {
var type = e.layerType;
var layer = e.layer;
//console.log(type, layer._latlngs);
console.log("DRAW",type, layer);
//console.log(JSON.stringify(layer.toGeoJSON()));
ws.send(JSON.stringify({action:"draw", type:type, points:layer._latlngs}));
layers["_drawing"].addLayer(layer);

File diff suppressed because one or more lines are too long