From 1ca9922b1b307f4567f0d37ec5ee9a493028dc54 Mon Sep 17 00:00:00 2001 From: "Phyks (Lucas Verney)" Date: Thu, 18 Oct 2018 20:05:48 +0200 Subject: [PATCH] Do not show speed badge when manually picking a location --- src/components/LocationError.vue | 6 +++++- src/views/Map.vue | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/LocationError.vue b/src/components/LocationError.vue index 2be7835..6e47d4d 100644 --- a/src/components/LocationError.vue +++ b/src/components/LocationError.vue @@ -26,7 +26,11 @@ export default { this.$store.dispatch( 'setCurrentPosition', { - coords: { latitude: value.latlng.lat, longitude: value.latlng.lng }, + coords: { + latitude: value.latlng.lat, + longitude: value.latlng.lng, + speed: null, + }, timestamp: new Date().getTime(), }, ); diff --git a/src/views/Map.vue b/src/views/Map.vue index 0fd786f..058bde5 100644 --- a/src/views/Map.vue +++ b/src/views/Map.vue @@ -98,10 +98,14 @@ export default { return this.$store.getters.getLastLocation || {}; }, currentSpeed() { - if (this.hasCenterProvidedByRoute || !this.currentLocation) { + if ( + this.hasCenterProvidedByRoute + || !this.currentLocation + || !this.currentLocation.speed + ) { return null; } - return Math.round(this.currentLocation.speed || 0, 0); + return Math.round(this.currentLocation.speed, 0); }, error() { const errorCode = this.$store.state.location.error;