fix(map): evitar dibujado residual de marcadores cuando se limpia el mapa rápidamente
This commit is contained in:
@ -3,6 +3,7 @@ import { useMapState } from './useMapState'
|
||||
import { useDirectionsRoute } from './useDirectionsRoute'
|
||||
import { useParadaCercana } from './useParadaCercana'
|
||||
import type { BusStop } from '@/types'
|
||||
import { useRouteStore } from '@/stores/route'
|
||||
|
||||
export const useFlujoPrincipal = () => {
|
||||
const { limpiarMapa, registrarMarker } = useMapState()
|
||||
@ -80,6 +81,12 @@ export const useFlujoPrincipal = () => {
|
||||
return;
|
||||
}
|
||||
|
||||
const routeStore = useRouteStore()
|
||||
if (routeStore.selectedRouteId !== _ruta.id) {
|
||||
console.log('Abortando flujo: el mapa fue limpiado o cambió de ruta.')
|
||||
return;
|
||||
}
|
||||
|
||||
// ── PASO 5: Dibujar tramo relevante (azul vivo) ───────
|
||||
const idx = paradasFormateadas.findIndex(p => p.longitud === paradaCercanaFound.longitude && p.latitud === paradaCercanaFound.latitude)
|
||||
if (idx !== -1) {
|
||||
|
||||
Reference in New Issue
Block a user