Display a polyline with the previous positions

This commit is contained in:
Lucas Verney 2018-07-09 15:25:18 +02:00
parent 3d134d438d
commit ae9f3892c7
2 changed files with 5 additions and 1 deletions

View File

@ -7,6 +7,7 @@
<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>
<v-lpolyline :latLngs="polyline" :opacity="0.6" color="#00FF00"></v-lpolyline>
<ReportMarker v-for="marker in markers" :key="marker.id" :marker="marker"></ReportMarker>
</v-lmap>
@ -58,6 +59,7 @@ export default {
heading: Number,
markers: Array,
onPress: Function,
polyline: Array,
positionLatLng: Array,
},
computed: {

View File

@ -10,7 +10,7 @@
<v-layout v-else row wrap fill-height>
<ReportCard></ReportCard>
<v-flex xs12 fill-height v-if="latLng">
<Map :positionLatLng="latLng" :heading="heading" :accuracy="accuracy" :markers="reportsMarkers" :onPress="showReportDialog"></Map>
<Map :positionLatLng="latLng" :polyline="positionHistory" :heading="heading" :accuracy="accuracy" :markers="reportsMarkers" :onPress="showReportDialog"></Map>
<v-btn
absolute
dark
@ -83,6 +83,7 @@ export default {
isIntro: true,
latLng: null,
noSleep: null,
positionHistory: [],
reportLat: null,
reportLng: null,
watchID: null,
@ -138,6 +139,7 @@ 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.accuracy = position.coords.accuracy ? position.coords.accuracy : null;
},