diff --git a/src/renderer/components/EditBar.vue b/src/renderer/components/EditBar.vue index 074ccbe..a85c8d1 100644 --- a/src/renderer/components/EditBar.vue +++ b/src/renderer/components/EditBar.vue @@ -115,6 +115,8 @@ You should have received a copy of the GNU General Public License along with FG this.centerDialogVisible = false this.$parent.$parent.$refs.map.mapObject.options.minZoom = 1; this.$parent.$parent.$refs.editLayer.disableEdit() + this.$parent.$parent.$refs.towerLayer.disableEdit() + this.$parent.$parent.$refs.thresholdLayer.disableEdit() this.$parent.$parent.$refs.editLayer.reload(true) }, undoLast () { @@ -123,6 +125,8 @@ You should have received a copy of the GNU General Public License along with FG this.centerDialogVisible = false this.$parent.$parent.$refs.map.mapObject.options.minZoom = 1; this.$parent.$parent.$refs.editLayer.disableEdit() + this.$parent.$parent.$refs.towerLayer.disableEdit() + this.$parent.$parent.$refs.thresholdLayer.disableEdit() this.$parent.$parent.$refs.editLayer.reload(false) }, save () { @@ -141,6 +145,8 @@ You should have received a copy of the GNU General Public License along with FG this.$parent.$parent.$refs.towerLayer.save() this.$parent.$parent.$refs.thresholdLayer.save() this.$parent.$parent.$refs.editLayer.disableEdit() + this.$parent.$parent.$refs.towerLayer.disableEdit() + this.$parent.$parent.$refs.thresholdLayer.disableEdit() this.scanGroundnets() Vue.set(this, 'saveDialogVisible', false) }, diff --git a/src/renderer/components/EditLayer.vue b/src/renderer/components/EditLayer.vue index 83d84b4..b85c8ed 100644 --- a/src/renderer/components/EditLayer.vue +++ b/src/renderer/components/EditLayer.vue @@ -149,6 +149,10 @@ You should have received a copy of the GNU General Public License along with FG if (l.updateArrows !== undefined) { l.updateArrows(this.$store.state.Settings.zoom) } + if (typeof l.setInteractive === 'function') { + l.setInteractive(false) + } + }) console.log(this.groundnetLayerGroup.maxId) this.buildLookup() @@ -224,7 +228,8 @@ You should have received a copy of the GNU General Public License along with FG l.setInteractive(true) } }) - this.$store.dispatch('addWip', {icao: this.icao}); }, + this.$store.dispatch('addWip', {icao: this.icao}); + }, disableEdit () { this.editable = false this.editing = false diff --git a/src/renderer/components/FlightgearMap.vue b/src/renderer/components/FlightgearMap.vue index 2d7cefa..2c88d55 100644 --- a/src/renderer/components/FlightgearMap.vue +++ b/src/renderer/components/FlightgearMap.vue @@ -258,6 +258,7 @@ You should have received a copy of the GNU General Public License along with FG } this.$refs.editLayer.enableEdit() this.$refs.towerLayer.enableEdit() + this.$refs.thresholdLayer.enableEdit() this.$refs.editBar.setEditing(event) this.$refs.toolBar.setEditing(event) this.$refs.sidebar.setEditing(event) diff --git a/src/renderer/components/ThresholdLayer.vue b/src/renderer/components/ThresholdLayer.vue index 57ed70d..25d9e4f 100644 --- a/src/renderer/components/ThresholdLayer.vue +++ b/src/renderer/components/ThresholdLayer.vue @@ -77,6 +77,24 @@ this.deferredMountedTo(this.$parent.mapObject) } }, + enableEdit () { + if (this.layerGroup) { + this.layerGroup.eachLayer(l => { + if (l instanceof L.Threshold) { + l.setInteractive(true) + } + }) + } + }, + disableEdit () { + if (this.layerGroup) { + this.layerGroup.eachLayer(l => { + if (l instanceof L.Threshold) { + l.setInteractive(false) + } + }) + } + }, setVisible (visible) { if (this.layerGroup !== undefined) { if (visible !== this.visible) { diff --git a/src/renderer/components/TowerLayer.vue b/src/renderer/components/TowerLayer.vue index 72949b9..b55e411 100644 --- a/src/renderer/components/TowerLayer.vue +++ b/src/renderer/components/TowerLayer.vue @@ -72,6 +72,15 @@ You should have received a copy of the GNU General Public License along with FG }) } }, + disableEdit () { + if (this.layerGroup) { + this.layerGroup.eachLayer(l => { + if (l instanceof L.TowerMarker) { + l.enableEdit(this.$parent.mapObject) + } + }) + } + }, save () { if (this.layerGroup) { this.layerGroup.eachLayer(l => { diff --git a/src/renderer/loaders/ParkingSpot.js b/src/renderer/loaders/ParkingSpot.js index 5470b27..636b2c1 100644 --- a/src/renderer/loaders/ParkingSpot.js +++ b/src/renderer/loaders/ParkingSpot.js @@ -239,7 +239,24 @@ L.ParkingSpot = L.Circle.extend({ if(this.box) { this.box.setStyle(style); } - }, + }, + setInteractive(interactive) { + if (interactive) { + if(this.direction) { + L.DomUtil.addClass(this.direction._path, 'leaflet-interactive'); + } + if(this.box) { + L.DomUtil.addClass(this.box._path, 'leaflet-interactive'); + } + } else { + if(this.direction) { + L.DomUtil.removeClass(this.direction._path, 'leaflet-interactive'); + } + if(this.box) { + L.DomUtil.removeClass(this.box._path, 'leaflet-interactive'); + } + } + }, addListeners: function () { this.on('editable:drawing:move', function (event) { console.debug("Move Parking Spot: ", event); @@ -265,6 +282,7 @@ L.ParkingSpot = L.Circle.extend({ if(event.target.box !== undefined) { event.target.box.addTo(event.target._map); } + event.target.setInteractive(false); }); this.on('remove', function (event) { console.log(event); diff --git a/src/renderer/loaders/RunwayNode.js b/src/renderer/loaders/RunwayNode.js index ff9c1fd..aa677c8 100644 --- a/src/renderer/loaders/RunwayNode.js +++ b/src/renderer/loaders/RunwayNode.js @@ -26,6 +26,20 @@ L.RunwayNode = L.Marker.extend({ store.default.dispatch('setRunway', event.target.options.attributes); } }); + this.on('add', function (event) { + event.target.setInteractive(false); + }); + }, + setInteractive(interactive) { + if (interactive) { + if(this._icon) { + L.DomUtil.addClass(this._icon, 'leaflet-interactive'); + } + } else { + if(this._icon) { + L.DomUtil.removeClass(this._icon, 'leaflet-interactive'); + } + } }, select() { try { diff --git a/src/renderer/loaders/Threshold.js b/src/renderer/loaders/Threshold.js index 218db3a..0f100c3 100644 --- a/src/renderer/loaders/Threshold.js +++ b/src/renderer/loaders/Threshold.js @@ -27,6 +27,7 @@ L.Threshold = L.Marker.extend({ stopw_m: 0, originLatLng: null, rwy: '', + interactive: false, stripSVG: function(fName) { var rx = /<\s*svg[^>]*>([\s\S]*)<\s*\/svg[^>]*>/gm; var svg = fs.readFileSync(path.join(__static, '/', fName), 'utf8'); @@ -48,6 +49,7 @@ L.Threshold = L.Marker.extend({ className: 'threshold-marker-icon', html: `