mirror of
https://github.com/zvx-echo6/navi.git
synced 2026-05-20 14:44:51 +02:00
fix: preserve click coordinates for wilderness routing
When clicking on a labeled feature (e.g., "Monument Peak"), the code was using the feature's canonical coordinates instead of the actual click coordinates. This caused wilderness clicks to snap to named places that might be on roads, bypassing wilderness routing. Fix: Always use click coordinates (e.lngLat) for routing purposes. Feature coordinates are only used for display/detail fetching. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
7523ddd0a2
commit
a6942b35ea
1 changed files with 9 additions and 5 deletions
|
|
@ -2199,12 +2199,16 @@ const MapView = forwardRef(function MapView(_, ref) {
|
||||||
const props = labelFeature.properties
|
const props = labelFeature.properties
|
||||||
const geom = labelFeature.geometry
|
const geom = labelFeature.geometry
|
||||||
|
|
||||||
// Get feature coordinates (Point geometry)
|
// CRITICAL: Always use CLICK coordinates for routing (lat, lng from e.lngLat)
|
||||||
let featureLat = lat
|
// Feature coordinates are only for display/fetching details
|
||||||
let featureLon = lng
|
let featureLat = lat // Click coordinate - used for routing
|
||||||
|
let featureLon = lng // Click coordinate - used for routing
|
||||||
|
let displayLat = lat // May be updated to feature coords for display
|
||||||
|
let displayLon = lng
|
||||||
if (geom && geom.type === 'Point' && geom.coordinates) {
|
if (geom && geom.type === 'Point' && geom.coordinates) {
|
||||||
featureLon = geom.coordinates[0]
|
// Store feature's canonical coords separately - NOT for routing
|
||||||
featureLat = geom.coordinates[1]
|
displayLon = geom.coordinates[0]
|
||||||
|
displayLat = geom.coordinates[1]
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIX A: For park-type features, also query polygon layers to get boundary geometry
|
// FIX A: For park-type features, also query polygon layers to get boundary geometry
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue