Deleting nodes

This commit is contained in:
portree_kid
2020-02-03 22:13:51 +01:00
parent 79088be6f6
commit da1509ae82
3 changed files with 32 additions and 44 deletions
+20 -3
View File
@@ -138,9 +138,26 @@
})
},
deleteFeature () {
this.groundnetLayerGroup.eachLayer(l => {
l.on('click', this.removeLayerClick)
})
switch (this.$store.state.Editable.type) {
case 'node':
this.removeNode(this.$store.state.Editable.index)
}
},
removeNode (index) {
this.featureLookup[index].forEach((element, i) => {
if (element instanceof L.Polyline) {
// element.latlngs.forEach();
element._latlngs.forEach((e1, index1) => {
console.log(e1);
e1.__vertex.removeFrom(element.editor.editLayer);
element._latlngs.splice(index1,1);
if (element._latlngs.length==1) {
this.featureLookup[index].splice(i,1);
element.removeFrom(this.groundnetLayerGroup);
}
});
}
});
},
drawPolyline () {
var polyLine = this.$parent.mapObject.editTools.startPolyline()