From 52f1d5511d6cd662905114f0f45cfe9d2e9306b0 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Fri, 8 Jan 2021 04:06:10 +0100 Subject: [PATCH] Layer filtering now allows items that would show up on another layer --- Logic/FeatureSource/FilteringFeatureSource.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Logic/FeatureSource/FilteringFeatureSource.ts b/Logic/FeatureSource/FilteringFeatureSource.ts index 49fd200..9d68424 100644 --- a/Logic/FeatureSource/FilteringFeatureSource.ts +++ b/Logic/FeatureSource/FilteringFeatureSource.ts @@ -32,7 +32,20 @@ export default class FilteringFeatureSource implements FeatureSource { if (layer === undefined) { throw "No layer found with id " + layerId; } - return layer.isDisplayed.data && (layer.layerDef.minzoom <= location.data.zoom); + if(layer.isDisplayed.data && (layer.layerDef.minzoom <= location.data.zoom)){ + return true; + } + // Does it match any other layer? + for (const toCheck of layers) { + if(!toCheck.isDisplayed.data){ + continue; + } + if(toCheck.layerDef.overpassTags.matchesProperties(f.feature.properties)){ + return true; + } + } + return false; + }); self.features.setData(newFeatures); }