split routing controls in zoom-specific layers to improve performance

This commit is contained in:
vcoppe
2026-02-14 15:05:23 +01:00
parent 88abd72a41
commit d6c9fb1025
3 changed files with 111 additions and 66 deletions

View File

@@ -5,7 +5,13 @@
map.onLoad((map_) => {
map_.on('contextmenu', (e) => {
if (map_.queryRenderedFeatures(e.point, { layers: ['routing-controls'] }).length) {
if (
map_.queryRenderedFeatures(e.point, {
layers: map_
.getLayersOrder()
.filter((layerId) => layerId.startsWith('routing-controls')),
}).length
) {
// Clicked on routing control, ignoring
return;
}