Initial commit: SIBU 2.0 MISSION
This commit is contained in:
39
frontend/src/stores/map.ts
Normal file
39
frontend/src/stores/map.ts
Normal file
@ -0,0 +1,39 @@
|
||||
/** Pinia store for map state */
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
import type { BusStop } from '@/types'
|
||||
|
||||
export const useMapStore = defineStore('map', () => {
|
||||
const markers = ref<BusStop[]>([])
|
||||
const selectedStop = ref<BusStop | null>(null)
|
||||
const center = ref({ lat: 8.4177, lng: -82.4270 }) // Panama coordinates (David/Boquete area)
|
||||
const zoom = ref(12)
|
||||
|
||||
function setMarkers(stops: BusStop[]) {
|
||||
markers.value = stops
|
||||
}
|
||||
|
||||
function setSelectedStop(stop: BusStop | null) {
|
||||
selectedStop.value = stop
|
||||
}
|
||||
|
||||
function setCenter(lat: number, lng: number) {
|
||||
center.value = { lat, lng }
|
||||
}
|
||||
|
||||
function setZoom(level: number) {
|
||||
zoom.value = level
|
||||
}
|
||||
|
||||
return {
|
||||
markers,
|
||||
selectedStop,
|
||||
center,
|
||||
zoom,
|
||||
setMarkers,
|
||||
setSelectedStop,
|
||||
setCenter,
|
||||
setZoom,
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user