mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-19 13:21:46 +00:00
Render GPX and route overlays once the Mapbox style has loaded (#1036)
The GPX and route geojson effects ran before the map 'load' event had attached their sources, so on the first paint they hit the early return and never re-ran. Add mapReady to their dependencies so they fire again the moment the sources exist.
This commit is contained in:
@@ -447,7 +447,7 @@ export function MapViewGL({
|
|||||||
geometry: { type: 'LineString' as const, coordinates: seg.map(([lat, lng]) => [lng, lat]) },
|
geometry: { type: 'LineString' as const, coordinates: seg.map(([lat, lng]) => [lng, lat]) },
|
||||||
}))
|
}))
|
||||||
src.setData({ type: 'FeatureCollection', features })
|
src.setData({ type: 'FeatureCollection', features })
|
||||||
}, [route])
|
}, [route, mapReady])
|
||||||
|
|
||||||
// Travel times now live in the day sidebar (per-segment connectors), not on the map.
|
// Travel times now live in the day sidebar (per-segment connectors), not on the map.
|
||||||
|
|
||||||
@@ -470,7 +470,7 @@ export function MapViewGL({
|
|||||||
} catch { return [] }
|
} catch { return [] }
|
||||||
})
|
})
|
||||||
src.setData({ type: 'FeatureCollection', features })
|
src.setData({ type: 'FeatureCollection', features })
|
||||||
}, [places])
|
}, [places, mapReady])
|
||||||
|
|
||||||
// Reservation overlay — mirrors the Leaflet ReservationOverlay: great-
|
// Reservation overlay — mirrors the Leaflet ReservationOverlay: great-
|
||||||
// circle arcs for flights/cruises, straight lines for trains/cars,
|
// circle arcs for flights/cruises, straight lines for trains/cars,
|
||||||
|
|||||||
Reference in New Issue
Block a user