Client fixes

This commit is contained in:
2026-06-24 01:21:21 -04:00
parent b525dd27c8
commit 3fd94626b6
6 changed files with 10 additions and 25 deletions

View File

@@ -1,5 +1,6 @@
<script setup lang="ts">
import { AirTrafficLayer } from '@/services/airtraffic.ts'
import {api} from '@/services/api.ts';
import { computed, onMounted, onUnmounted, ref, watch } from 'vue'
import Map from 'ol/Map'
import View from 'ol/View'
@@ -176,9 +177,10 @@ function buildStationLayer(lat: number, lon: number, dark: boolean): VectorLayer
onMounted(async () => {
await fetchRadarFrames()
const position = await api.position();
const lat = (current.value.latitude as number) || 0
const lon = (current.value.longitude as number) || 0
const lat = position?.latitude || 0
const lon = position?.longitude || 0
stationLayer = buildStationLayer(lat, lon, props.dark)
@@ -226,19 +228,6 @@ watch(() => props.dark, dark => {
stationLayer = buildStationLayer(lat, lon, dark)
map.addLayer(stationLayer)
})
let positioned = false
watch(() => current.value, () => {
const lat = (current.value.latitude as number) || 0
const lon = (current.value.longitude as number) || 0
if (!positioned) {
positioned = true
map.getView().animate({ center: fromLonLat([lon, lat]), duration: 500 })
map.removeLayer(stationLayer)
stationLayer = buildStationLayer(lat, lon, props.dark)
map.addLayer(stationLayer)
}
})
</script>
<style scoped lang="scss">