From 46091aa7db3252a4a4dfbdd86700864926d1e976 Mon Sep 17 00:00:00 2001 From: portree_kid Date: Wed, 3 Jun 2020 16:31:27 +0200 Subject: [PATCH] Cancel events on buttons --- src/renderer/components/EditBar.vue | 9 +++++++++ src/renderer/components/EditLayer.vue | 2 ++ src/renderer/leaflet/EditControl.js | 5 +++++ 3 files changed, 16 insertions(+) diff --git a/src/renderer/components/EditBar.vue b/src/renderer/components/EditBar.vue index 3d7112d..ab58462 100644 --- a/src/renderer/components/EditBar.vue +++ b/src/renderer/components/EditBar.vue @@ -81,9 +81,11 @@ this.$refs.upload.check() }, zoomout() { + this.$parent.$parent.$refs.editLayer.stopDrawing() this.$parent.$parent.zoomUpdated(9) }, zoomin() { + this.$parent.$parent.$refs.editLayer.stopDrawing() this.$parent.$parent.zoomUpdated(14) }, edit () { @@ -106,6 +108,7 @@ this.$parent.$parent.$refs.editLayer.reload(false) }, save () { + this.$parent.$parent.$refs.editLayer.stopDrawing() this.editing = false this.$parent.$parent.$refs.map.mapObject.options.minZoom = 1; Vue.set(this, 'saveDialogVisible', true) @@ -191,21 +194,27 @@ } }, drawPolyline () { + this.$parent.$parent.$refs.editLayer.stopDrawing() this.$parent.$parent.$refs.editLayer.drawPolyline() }, drawForwardPolyline () { + this.$parent.$parent.$refs.editLayer.stopDrawing() this.$parent.$parent.$refs.editLayer.drawForwardPolyline() }, drawPushbackPolyline () { + this.$parent.$parent.$refs.editLayer.stopDrawing() this.$parent.$parent.$refs.editLayer.drawPushbackPolyline() }, drawParking () { + this.$parent.$parent.$refs.editLayer.stopDrawing() this.$parent.$parent.$refs.editLayer.drawParking() }, deleteFeature () { + this.$parent.$parent.$refs.editLayer.stopDrawing() this.$parent.$parent.$refs.editLayer.deleteFeature() }, showCheck() { + this.$parent.$parent.$refs.editLayer.stopDrawing() Vue.set(this, 'checkDialogVisible', true) this.check() }, diff --git a/src/renderer/components/EditLayer.vue b/src/renderer/components/EditLayer.vue index 9db2d5c..73f4899 100644 --- a/src/renderer/components/EditLayer.vue +++ b/src/renderer/components/EditLayer.vue @@ -766,6 +766,7 @@ } }, drawParking () { + this.$parent.mapObject._container.style.cursor = 'crosshair' this.$parent.mapObject.on('click', this.addParking) }, removeLayerClick (event) { @@ -789,6 +790,7 @@ addFeature(circle) // console.log(this.groundnetLayerGroup) this.$parent.mapObject.off('click', this.addParking) + this.$parent.mapObject._container.style.cursor = '' }, reload (force) { this.load(this.icao, force) diff --git a/src/renderer/leaflet/EditControl.js b/src/renderer/leaflet/EditControl.js index 9bada9a..8d16bbe 100644 --- a/src/renderer/leaflet/EditControl.js +++ b/src/renderer/leaflet/EditControl.js @@ -17,6 +17,11 @@ L.EditControl = L.Control.extend({ link.title = this.options.tooltip; link.innerHTML = this.options.html; link.callback = this.options.callback; + link.addEventListener('click',function (event) { + event.stopPropagation(); + event.preventDefault(); + event.stopImmediatePropagation(); + }, false); link.addEventListener('mousedown',function (event) { event.stopPropagation(); event.preventDefault();