|
@@ -35,6 +35,7 @@
|
|
|
latLngLayers: [],
|
|
|
latLngGroup: [],
|
|
|
isEditableLayers: false,
|
|
|
+ drawControl: null,
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
@@ -58,8 +59,8 @@
|
|
|
remove: true
|
|
|
}
|
|
|
};
|
|
|
- let drawControl = new window.L.Control.Draw(options);
|
|
|
- this.map.addControl(drawControl);
|
|
|
+ this.drawControl = new window.L.Control.Draw(options);
|
|
|
+ this.map.addControl(this.drawControl);
|
|
|
this.map.on(window.L.Draw.Event.CREATED, function (e) {
|
|
|
let editableLayer = e.layer;
|
|
|
let layerType = e.layerType;
|
|
@@ -85,6 +86,8 @@
|
|
|
})
|
|
|
editableLayers.addLayer(editableLayer);
|
|
|
});
|
|
|
+ }else{
|
|
|
+ this.map.removeControl(this.drawControl);
|
|
|
}
|
|
|
},
|
|
|
}
|