Pridani linku na planovac do menu, drobny bugfixing

This commit is contained in:
Michal Kváček
2024-05-06 09:40:25 +02:00
parent be8966b5c1
commit 670e80d998
12 changed files with 245 additions and 98 deletions
+9 -24
View File
@@ -2,9 +2,9 @@
import {computed, ref, watch} from "vue";
import {Marker, CustomMarker, Polyline} from "vue3-google-map";
import MapWrapper from "components/map/MapWrapper.vue";
import AirspaceInfoWindow from "components/map/AirspaceInfoWindow.vue";
import {useFlightPlanObjects, useFlightPlanUtils} from "src/composables/flightPlan";
import {useGeocode} from "src/composables/geocoding";
import AltitudeLimit from "components/AltitudeLimit.vue";
const props = defineProps({
flightPlan: {
@@ -35,24 +35,14 @@ const {center} = useGeocode();
const {markerObject, googleMapsMarkerObject, infoWindowObject, editableNameTypes} = useFlightPlanObjects();
const {getMarkersFrom} = useFlightPlanUtils();
const infoWindow = ref(infoWindowObject({}));
const handleMapClick = ({clickCoordinates, airspaces, airport, reportingPoint}) => {
infoWindow.value = infoWindowObject({
active: true,
position: clickCoordinates,
airspaces,
airport,
reportingPoint,
})
}
const mapWrap = ref(null);
const handleMarkerClick = (marker) => {
infoWindow.value = infoWindowObject({active: true, marker})
mapWrap.value.openInfoWindow({marker});
}
const handlePoiClick = (poi) => {
infoWindow.value = infoWindowObject({active: true, poi})
mapWrap.value.openInfoWindow({poi});
}
const markers = ref([]);
@@ -69,10 +59,10 @@ const addMarker = async (point) => {
const insertAt = Math.min(markers.value.length, props.insertPosition);
markers.value.splice(insertAt, 0, markerObject({...point}));
infoWindow.value = infoWindowObject({active: false});
// infoWindow.value = infoWindowObject({active: false});
emits("markers-changed", markers.value);
emits("change-insert-position",insertAt + 1);
emits("change-insert-position", insertAt + 1);
}
const {searchPlaceName} = useGeocode();
@@ -88,6 +78,7 @@ const handleMarkerMove = async (idx, event) => {
<template>
<MapWrapper
ref="mapWrap"
style="width: 100%; height: 100%; min-height: 500px"
:center="center"
:zoom="8"
@@ -95,15 +86,9 @@ const handleMarkerMove = async (idx, event) => {
:airports="airports"
v-bind="$attrs"
:fullscreen-control="false"
@map-click="handleMapClick"
>
<AirspaceInfoWindow
v-if="infoWindow.active"
:info-window="infoWindow"
@close="infoWindow.active=false"
@add-to-route="addMarker"
/>
@add-to-route="addMarker"
>
<template v-for="poi in pointsOfInterest" :key="poi.name">
<CustomMarker
v-if="poi.gpsLatitude && poi.gpsLongitude"