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:
Ullrich Schäfer 2026-07-16 07:59:48 +02:00
parent 23882dae68
commit 6871b154db
No known key found for this signature in database
GPG key ID: A32FF691A0F752D9

View file

@ -195,6 +195,11 @@ export function PlannerMap({ yjs, sessionId, onRouteRequest, highlightPosition,
zIndexOffset={highlightedWaypoint === i ? Z_WAYPOINT_HIGHLIGHTED : Z_WAYPOINT}
icon={waypointIcon(i, wp.overnight, highlightedWaypoint === i, !!wp.note)}
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; },
mouseout: () => {
if (!waypointDraggingRef.current) routeInteractionSuspendedRef.current = false;