Hide speed badge when setting map center manually

This commit is contained in:
Lucas Verney 2018-10-21 23:42:36 +02:00
parent 8a52c94fbb
commit 93b0ec340e
2 changed files with 10 additions and 12 deletions

View File

@ -15,6 +15,8 @@
</template> </template>
<script> <script>
import { DEFAULT_ZOOM } from '@/constants';
import AddressInput from '@/components/AddressInput.vue'; import AddressInput from '@/components/AddressInput.vue';
export default { export default {
@ -23,17 +25,14 @@ export default {
}, },
methods: { methods: {
onManualLocationPicker(value) { onManualLocationPicker(value) {
this.$store.dispatch( this.$router.push({
'setCurrentPosition', name: 'SharedMap',
{ params: {
coords: { lat: value.latlng.lat,
latitude: value.latlng.lat, lng: value.latlng.lng,
longitude: value.latlng.lng, zoom: DEFAULT_ZOOM,
speed: null,
}, },
timestamp: new Date().getTime(), });
},
);
}, },
}, },
props: { props: {

View File

@ -101,11 +101,10 @@ export default {
if ( if (
this.hasCenterProvidedByRoute this.hasCenterProvidedByRoute
|| !this.currentLocation || !this.currentLocation
|| !this.currentLocation.speed
) { ) {
return null; return null;
} }
return Math.round(this.currentLocation.speed, 0); return Math.round(this.currentLocation.speed || 0, 0);
}, },
error() { error() {
const errorCode = this.$store.state.location.error; const errorCode = this.$store.state.location.error;