fix(planner): clicking a waypoint no longer adds a duplicate
Waypoint markers had no click listener, so Leaflet routed the click to the map — MapClickHandler then added a new waypoint on top of the one you clicked (and made markers feel unresponsive). Add a click handler that consumes the event, so Leaflet treats the marker as the target and suppresses the map click. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
23882dae68
commit
6871b154db
1 changed files with 5 additions and 0 deletions
|
|
@ -195,6 +195,11 @@ export function PlannerMap({ yjs, sessionId, onRouteRequest, highlightPosition,
|
||||||
zIndexOffset={highlightedWaypoint === i ? Z_WAYPOINT_HIGHLIGHTED : Z_WAYPOINT}
|
zIndexOffset={highlightedWaypoint === i ? Z_WAYPOINT_HIGHLIGHTED : Z_WAYPOINT}
|
||||||
icon={waypointIcon(i, wp.overnight, highlightedWaypoint === i, !!wp.note)}
|
icon={waypointIcon(i, wp.overnight, highlightedWaypoint === i, !!wp.note)}
|
||||||
eventHandlers={{
|
eventHandlers={{
|
||||||
|
// Consume the click on the marker. Without a click listener,
|
||||||
|
// Leaflet routes the click to the map (which adds a duplicate
|
||||||
|
// waypoint on top of this one). Registering it makes Leaflet
|
||||||
|
// treat the marker as the event target instead.
|
||||||
|
click: (e) => { e.originalEvent.stopPropagation(); },
|
||||||
mouseover: () => { routeInteractionSuspendedRef.current = true; },
|
mouseover: () => { routeInteractionSuspendedRef.current = true; },
|
||||||
mouseout: () => {
|
mouseout: () => {
|
||||||
if (!waypointDraggingRef.current) routeInteractionSuspendedRef.current = false;
|
if (!waypointDraggingRef.current) routeInteractionSuspendedRef.current = false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue