fix routing on other file

This commit is contained in:
vcoppe committed 2026-10-17 19:03:33 +02:00
1 parent 9f49119eec
commit c84e1c9a06
1 file changed
+13 -4
@@ -463,12 +463,21 @@ export class RoutingControls {
// Exit if anchor is being dragged // Exit if anchor is being dragged
return; return;
} }
const controlLayerIds = [...this.layers.values()].map((l) => l.id);
const segmentIds = this.anchorData?.segmentIds ?? [];
if ( if (
e.target.queryRenderedFeatures(e.point, { e.target
layers: [...this.listenedFileIds, ...[...this.layers.values()].map((l) => l.id)], .queryRenderedFeatures(e.point, {
}).length layers: [...this.listenedFileIds, ...controlLayerIds],
})
.some(
(feature) =>
controlLayerIds.includes(feature.layer.id) ||
segmentIds.includes(feature.properties?.segmentId)
)
) { ) {
// Clicked on routing control or layer, ignoring // Clicked on a routing control, or on a segment being routed (an anchor is inserted
// there instead): the other files do not stop the route
return; return;
} }
this.appendAnchorWithCoordinates({ lng: e.lngLat.lng, lat: e.lngLat.lat }); this.appendAnchorWithCoordinates({ lng: e.lngLat.lng, lat: e.lngLat.lat });