aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2024-01-22 03:29:43 +0100
committerGuilhem Moulin <guilhem@fripost.org>2024-01-22 03:31:35 +0100
commiteb468bb98ce4b8e91b8e14ec3643f1fdbe662977 (patch)
tree4b66046c32e0140ea34fe8990bdd965239c414e2
parent0548452b7c2dfe57ade979483b9046d1e1e17f43 (diff)
map.forEachFeatureAtPixel(): Add a layerFilter.
-rw-r--r--main.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/main.js b/main.js
index 017063c..f0ab6f5 100644
--- a/main.js
+++ b/main.js
@@ -577,7 +577,8 @@ const styles = Object.keys(layers).reduce(function(result, key) {
result[key] = layers[key].style;
return result;
}, {});
-map.addLayer(new VectorTileLayer({
+
+const vectorLayer = new VectorTileLayer({
source: vectorSource,
/* XXX switch to 'hybrid' if there are perf issues; but that seems to
* put lines above points regardless of their respective z-index */
@@ -596,7 +597,8 @@ map.addLayer(new VectorTileLayer({
return style[i];
}
},
-}));
+});
+map.addLayer(vectorLayer);
/* layer selection panel */
(function() {
@@ -1032,6 +1034,7 @@ map.addLayer(new VectorTileLayer({
}, {
hitTolerance: 5,
checkWrapped: false,
+ layerFilter: (l) => l === vectorLayer,
});
});
}());