diff --git a/src/views/MissionPlanningView.vue b/src/views/MissionPlanningView.vue
index 0d54a1fe4..dfe82fd66 100644
--- a/src/views/MissionPlanningView.vue
+++ b/src/views/MissionPlanningView.vue
@@ -94,6 +94,12 @@
size="x-small"
@click="goHome"
/>
+
{
planningMap.value.addControl(layerControl)
})
+const vehiclePosition = computed((): [number, number] | undefined =>
+ vehicleStore.coordinates.latitude
+ ? [vehicleStore.coordinates.latitude, vehicleStore.coordinates.longitude]
+ : undefined
+)
+
const vehicleMarker = ref()
watch(vehicleStore.coordinates, () => {
if (planningMap.value === undefined) throw new Error('Map not yet defined')
- const position = vehicleStore.coordinates.latitude
- ? [vehicleStore.coordinates.latitude, vehicleStore.coordinates.longitude]
- : undefined
- if (position === undefined) return
+ if (vehiclePosition.value === undefined) return
if (vehicleMarker.value === undefined) {
- vehicleMarker.value = L.marker(position as LatLngTuple)
+ vehicleMarker.value = L.marker(vehiclePosition.value)
var vehicleMarkerIcon = L.divIcon({ className: 'marker-icon', iconSize: [16, 16], iconAnchor: [8, 8] })
vehicleMarker.value.setIcon(vehicleMarkerIcon)
const vehicleMarkerTooltip = L.tooltip({
@@ -336,7 +345,7 @@ watch(vehicleStore.coordinates, () => {
vehicleMarker.value.bindTooltip(vehicleMarkerTooltip)
planningMap.value.addLayer(vehicleMarker.value)
}
- vehicleMarker.value.setLatLng(position as LatLngTuple)
+ vehicleMarker.value.setLatLng(vehiclePosition.value)
})
const homeMarker = ref()