Fix: don't show all items if favourites is shown

This commit is contained in:
Pieter Vander Vennet 2024-11-25 02:06:28 +01:00
parent ad4afbaf52
commit 3292307208
4 changed files with 42 additions and 20 deletions

View file

@ -210,7 +210,7 @@ export default class FilteredLayer {
* - the specified 'global filters'
* - the 'isShown'-filter set by the layer
*/
public isShown(properties: Record<string, string>, globalFilters?: GlobalFilter[]): boolean {
public isShown(properties: Record<string, string>, globalFilters?: GlobalFilter[], zoomlevel?: number): boolean {
if (properties._deleted === "yes") {
return false
}
@ -219,9 +219,10 @@ export default class FilteredLayer {
if (neededTags !== undefined) {
const doesMatch = neededTags.matchesProperties(properties)
if (globalFilter.forceShowOnMatch) {
return doesMatch || this.isDisplayed.data
}
if (!doesMatch) {
if(doesMatch){
return true
}
} else if (!doesMatch) {
return false
}
}
@ -240,6 +241,10 @@ export default class FilteredLayer {
}
}
if(zoomlevel !== undefined && (this.layerDef.minzoom > zoomlevel || this.layerDef.minzoomVisible < zoomlevel)){
return false
}
return true
}