diff --git a/src/components/Map.vue b/src/components/Map.vue index 87dfcbc..e4a71e9 100644 --- a/src/components/Map.vue +++ b/src/components/Map.vue @@ -3,7 +3,7 @@ - + @@ -56,7 +56,7 @@ export default { type: Number, default: null, }, - heading: Number, + heading: Number, // in degrees, clockwise wrt north markers: Array, onPress: Function, polyline: Array, @@ -84,7 +84,7 @@ export default { return { fillColor: '#00ff00', color: '#000000', - heading: this.heading, + heading: this.heading * (Math.PI / 180), weight: 1, }; }, diff --git a/src/views/Map.vue b/src/views/Map.vue index a1a7d1c..766ce0d 100644 --- a/src/views/Map.vue +++ b/src/views/Map.vue @@ -140,7 +140,10 @@ export default { } this.latLng = [position.coords.latitude, position.coords.longitude]; this.positionHistory.push(this.latLng); - this.heading = Object.prototype.hasOwnProperty.call(position.coords, 'heading') ? position.coords.heading : null; + this.heading = null; + if (position.coords.heading !== null && !isNaN(position.coords.heading)) { + this.heading = position.coords.heading; + } this.accuracy = position.coords.accuracy ? position.coords.accuracy : null; }, setNoSleep() {