import { Polyline } from 'react-leaflet'; import { onRealWorld } from '../../utils/worldCopy'; /** * P2A-03: an invisible band along a route segment on the Leaflet map, wider * than the drawn line, that takes the click which reshapes the route, as the * GL renderer's hit layer does: an 8 px line is too thin to aim at. */ export function RouteHitBand({ positions, onRouteClick, }: { positions: [number, number][]; onRouteClick: (lat: number, lng: number) => void; }) { return ( { // Stops the map's own click, which would otherwise open the add-place menu underneath the new via. e.originalEvent.stopPropagation(); // The via is saved on the real world, whichever copy of it the route was clicked on (#2976). const at = onRealWorld(e.latlng); onRouteClick(at.lat, at.lng); }, }} /> ); }