mirror of
https://github.com/zvx-echo6/navi.git
synced 2026-05-20 22:54:42 +02:00
fix: search viewport init, theme-clears-route bug, preview-during-route
Three regressions fixed: 1. mapCenter is now initialized on map 'load' event, not just 'moveend'. Searches immediately after page load now correctly include viewport bias instead of falling back to default Twin Falls coords. 2. setThemeOverride had stray code from startDirections that wiped stops and added undefined place data. Toggling theme cleared the active route. Restored setThemeOverride to its correct theme-only implementation. 3. usePanelState returned ROUTE_CALCULATED before checking selectedPlace, so preview cards could never appear alongside a calculated route. Refactored to decouple preview state from route state - preview renders whenever selectedPlace exists, independent of route state.
This commit is contained in:
parent
5eb83e9b4b
commit
f5e0b9606e
3 changed files with 21 additions and 18 deletions
|
|
@ -964,6 +964,13 @@ const MapView = forwardRef(function MapView(_, ref) {
|
|||
}
|
||||
}
|
||||
})
|
||||
// Initialize mapCenter immediately when map loads (Fix 1: search viewport)
|
||||
map.once('load', () => {
|
||||
const center = map.getCenter()
|
||||
const zoom = map.getZoom()
|
||||
setMapCenter({ lat: center.lat, lon: center.lng, zoom })
|
||||
})
|
||||
|
||||
map.on('load', () => {
|
||||
map.addSource(ROUTE_SOURCE, {
|
||||
type: 'geojson',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue