forked from MapComplete/MapComplete
Add search for filters
This commit is contained in:
parent
1378c1a779
commit
c94393e825
24 changed files with 405 additions and 254 deletions
25
src/UI/Search/SearchResultUtils.ts
Normal file
25
src/UI/Search/SearchResultUtils.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { SpecialVisualizationState } from "../SpecialVisualization"
|
||||
import { FilterPayload } from "../../Logic/Geocoding/GeocodingProvider"
|
||||
|
||||
export default class SearchResultUtils {
|
||||
static apply(payload: FilterPayload, state: SpecialVisualizationState) {
|
||||
const { layer, filter, index, option } = payload
|
||||
|
||||
let flayer = state.layerState.filteredLayers.get(layer.id)
|
||||
let filtercontrol = flayer.appliedFilters.get(filter.id)
|
||||
|
||||
for (const [name, otherLayer] of state.layerState.filteredLayers) {
|
||||
if (name === layer.id) {
|
||||
otherLayer.isDisplayed.setData(true)
|
||||
continue
|
||||
}
|
||||
otherLayer.isDisplayed.setData(false)
|
||||
}
|
||||
|
||||
if (filtercontrol.data === index) {
|
||||
filtercontrol.setData(undefined)
|
||||
} else {
|
||||
filtercontrol.setData(index)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue