Only show control when edit

This commit is contained in:
2021-09-05 22:13:37 +00:00
parent 0c22a4127f
commit 5b2bcb110e

View File

@@ -5,7 +5,7 @@
<l-polygon :lat-lngs="value" :visible="true" /> <l-polygon :lat-lngs="value" :visible="true" />
</field-map> </field-map>
<l-control position="bottomleft" > <l-control position="bottomleft" v-if="edit">
<button @click="removeLastMarker"> <button @click="removeLastMarker">
Slett forrige Slett forrige
</button> </button>
@@ -78,13 +78,15 @@ export default {
triggerChange() { triggerChange() {
this.$emit('input', this.markers); this.$emit('input', this.markers);
}, },
removeLastMarker() { removeLastMarker(event) {
this.markers.splice(-1,1); this.markers.splice(-1,1);
this.triggerChange(); this.triggerChange();
event.preventDefault();
}, },
removeAllMarkers() { removeAllMarkers(event) {
this.markers = []; this.value = [];
this.triggerChange(); this.triggerChange();
event.preventDefault();
}, },
createMarker(evt) { createMarker(evt) {
this.markers.push(evt.latlng); this.markers.push(evt.latlng);