Heading is provided by browser in degrees but consumed by Leaflet in radians
This commit is contained in:
parent
ae9f3892c7
commit
1f9c0bd623
@ -3,7 +3,7 @@
|
||||
<v-lmap ref="map" :minZoom="this.minZoom" :maxZoom="this.maxZoom" :options="{ zoomControl: false }" @click="handleClick" @movestart="onMoveStart" @zoomstart="onZoomStart">
|
||||
<v-ltilelayer :url="tileServer" :attribution="attribution"></v-ltilelayer>
|
||||
|
||||
<v-lts v-if="heading" :lat-lng="positionLatLng" :options="markerOptions"></v-lts>
|
||||
<v-lts v-if="heading !== null" :lat-lng="positionLatLng" :options="markerOptions"></v-lts>
|
||||
<v-lcirclemarker v-else :lat-lng="positionLatLng" :color="markerOptions.color" :fillColor="markerOptions.fillColor" :fillOpacity="1.0" :weight="markerOptions.weight" :radius="markerRadius"></v-lcirclemarker>
|
||||
|
||||
<v-lcircle v-if="shouldDisplayAccuracy" :lat-lng="positionLatLng" :radius="radiusFromAccuracy"></v-lcircle>
|
||||
@ -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,
|
||||
};
|
||||
},
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user