From 7a75e4f392885c310acaa2411d8d478e70c4f1ad Mon Sep 17 00:00:00 2001 From: portree_kid Date: Wed, 1 Jul 2020 22:03:23 +0200 Subject: [PATCH] https://github.com/Portree-Kid/flightgear-airports/issues/18 --- src/renderer/components/EditLayer.vue | 2 +- src/renderer/components/ParkingEdit.vue | 3 +-- src/renderer/loaders/ParkingSpot.js | 6 +++--- src/renderer/store/modules/Editable.js | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/renderer/components/EditLayer.vue b/src/renderer/components/EditLayer.vue index fcc0ad9..1794cd1 100644 --- a/src/renderer/components/EditLayer.vue +++ b/src/renderer/components/EditLayer.vue @@ -865,7 +865,7 @@ You should have received a copy of the GNU General Public License along with FG }); } this.$store.dispatch('setParking', circle.options.attributes); - this.$store.dispatch('setParkingCoords', circle.getLatLng().lat.toFixed(5) + ' ' + circle.getLatLng().lng.toFixed(5)); + this.$store.dispatch('setParkingCoords', circle.getLatLng().lat.toFixed(6) + ' ' + circle.getLatLng().lng.toFixed(6)); circle.select() addFeature(circle) // console.log(this.groundnetLayerGroup) diff --git a/src/renderer/components/ParkingEdit.vue b/src/renderer/components/ParkingEdit.vue index ce8e330..4e2a9f3 100644 --- a/src/renderer/components/ParkingEdit.vue +++ b/src/renderer/components/ParkingEdit.vue @@ -230,9 +230,8 @@ if (newValue==='unknown') { } - if( newValue.match(/,/g).length === 3) { + if( newValue.match(/,/g) !== null && newValue.match(/,/g).length === 3) { newValue = newValue.replace(', ', ' ').replace(/,/g, '.').replace(' ', ', '); - } this.$store.commit('SET_EDIT_PARKING_COORDS', newValue) } diff --git a/src/renderer/loaders/ParkingSpot.js b/src/renderer/loaders/ParkingSpot.js index ed98bd1..0fc948a 100644 --- a/src/renderer/loaders/ParkingSpot.js +++ b/src/renderer/loaders/ParkingSpot.js @@ -131,7 +131,7 @@ L.ParkingSpot = L.Circle.extend({ }, select() { store.default.dispatch('setParking', this.options.attributes); - store.default.dispatch('setParkingCoords', this.getLatLng().lat.toFixed(5) + ' ' + this.getLatLng().lng.toFixed(5)); + store.default.dispatch('setParkingCoords', this.getLatLng().lat.toFixed(6) + ' ' + this.getLatLng().lng.toFixed(6)); var style = {}; style['color'] = 'red'; this.setStyle(style); @@ -174,7 +174,7 @@ L.ParkingSpot = L.Circle.extend({ this.on('editable:vertex:dragend', function (event) { console.debug("DragEnd Parking : ", event); store.default.dispatch('setParking', event.target.options.attributes); - store.default.dispatch('setParkingCoords', event.target.getLatLng().lat.toFixed(5) + ' ' + event.target.getLatLng().lng.toFixed(5)); + store.default.dispatch('setParkingCoords', event.target.getLatLng().lat.toFixed(6) + ' ' + event.target.getLatLng().lng.toFixed(6)); event.target.updateWheelPos(); /* store.default.dispatch('setParkingHeading', this.options.attributes.heading) @@ -230,7 +230,7 @@ L.ParkingSpot = L.Circle.extend({ } store.default.dispatch('setParking', this.options.attributes); - store.default.dispatch('setParkingCoords', this.getLatLng().lat.toFixed(5) + ' ' + this.getLatLng().lng.toFixed(5)); + store.default.dispatch('setParkingCoords', this.getLatLng().lat.toFixed(6) + ' ' + this.getLatLng().lng.toFixed(6)); this.select(); }, diff --git a/src/renderer/store/modules/Editable.js b/src/renderer/store/modules/Editable.js index 60ed1c2..c8f1d82 100644 --- a/src/renderer/store/modules/Editable.js +++ b/src/renderer/store/modules/Editable.js @@ -134,7 +134,7 @@ const actions = { }, async setNode (context, node) { context.commit('SET_EDIT_NODE', node.attributes) - context.commit('SET_EDIT_NODE_COORDS', node.lat.toFixed(5) + ' ' + node.lng.toFixed(5)) + context.commit('SET_EDIT_NODE_COORDS', node.lat.toFixed(6) + ' ' + node.lng.toFixed(6)) } }