Fix vykreslovani mapy
This commit is contained in:
@@ -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
|
||||||
marker => ({label: marker.name, position: {lat: marker.gpsLatitude, lng: marker.gpsLongitude}})
|
.filter(marker => marker.gpsLatitude && marker.gpsLongiture)
|
||||||
));
|
.map(
|
||||||
|
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>
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ fragment flightFullInfo on Flight {
|
|||||||
name
|
name
|
||||||
}
|
}
|
||||||
|
|
||||||
gpxTrackUrl
|
|
||||||
gpxTrack {
|
gpxTrack {
|
||||||
coordinates {
|
coordinates {
|
||||||
lat
|
lat
|
||||||
|
|||||||
Reference in New Issue
Block a user