Fix vykreslovani mapy

This commit is contained in:
Michal Kváček
2023-10-09 14:57:15 +02:00
parent e76d34fab4
commit bf8df8bb34
3 changed files with 8 additions and 13 deletions
+5 -9
View File
@@ -13,20 +13,16 @@ const props = defineProps({
const mapPhotos = computed(() => flight.value.photos.filter(photo => photo.gpsLatitude && photo.gpsLongitude)); const mapPhotos = computed(() => flight.value.photos.filter(photo => photo.gpsLatitude && photo.gpsLongitude));
const poisWithGPS = computed(() => { const poisWithGPS = computed(() => flight.value.track.map(poi => poi.pointOfInterest || poi.airport));
return flight.value.track.filter(poi => {
const item = poi.pointOfInterest || poi.airport;
return item.gpsLatitude && item.gpsLongitude;
}).map(poi => poi.pointOfInterest || poi.airport)
});
const mapMarkers = [flight.value.takeoffAirport].concat(poisWithGPS.value).concat([flight.value.landingAirport]); const mapMarkers = [flight.value.takeoffAirport].concat(poisWithGPS.value).concat([flight.value.landingAirport]);
const pointsOfInterests = computed(() => mapMarkers.map( const pointsOfInterests = computed(() => mapMarkers
.filter(marker => marker.gpsLatitude && marker.gpsLongiture)
.map(
marker => ({label: marker.name, position: {lat: marker.gpsLatitude, lng: marker.gpsLongitude}}) marker => ({label: marker.name, position: {lat: marker.gpsLatitude, lng: marker.gpsLongitude}})
)); ));
const gpxTrack = flight.value.gpxTrack; const gpxTrack = flight.value.gpxTrack;
const displayMap = computed(() => { const displayMap = computed(() => {
return ( return (
!!gpxTrack || !!gpxTrack ||
@@ -80,7 +76,7 @@ if (gpxTrack) {
const currentPositionMarker = ref(null); const currentPositionMarker = ref(null);
const drawCurrentPositionMarker = (e) => { const drawCurrentPositionMarker = (e) => {
const res = e.chart.getElementsAtEventForMode(e, 'nearest', {intersect: false},); const res = e.chart.getElementsAtEventForMode(e, 'nearest', {intersect: false});
if (res.length === 0) { if (res.length === 0) {
currentPositionMarker.value = null; currentPositionMarker.value = null;
return; return;
@@ -74,7 +74,7 @@ watch(() => props.flight.track, (newVal) => {
<template> <template>
<FormWrapper v-model="formData"> <FormWrapper v-model="formData">
<q-banner class="bg-green text-white" v-if="flight.gpxTrackUrl"> <q-banner class="bg-green text-white" v-if="flight.gpxTrack">
<q-icon name="check"/> <q-icon name="check"/>
Trasa nahrána Trasa nahrána
</q-banner> </q-banner>
-1
View File
@@ -47,7 +47,6 @@ fragment flightFullInfo on Flight {
name name
} }
gpxTrackUrl
gpxTrack { gpxTrack {
coordinates { coordinates {
lat lat