forked from MapComplete/MapComplete
Search: load the popup of the OSM-object when clicked on the map, also when zoomed out
This commit is contained in:
parent
a9d6aaa448
commit
48dc03b1e6
2 changed files with 34 additions and 7 deletions
|
|
@ -135,12 +135,21 @@ export default class SearchState {
|
|||
}
|
||||
}
|
||||
|
||||
clickedOnMap(feature: Feature) {
|
||||
async clickedOnMap(feature: Feature) {
|
||||
const osmid = feature.properties.osm_id
|
||||
const localElement = this.state.indexedFeatures.featuresById.data.get(osmid)
|
||||
if (localElement) {
|
||||
this.state.selectedElement.set(localElement)
|
||||
return
|
||||
}
|
||||
// This feature might not be loaded because we zoomed out
|
||||
const object = await this.state.osmObjectDownloader.DownloadObjectAsync(osmid)
|
||||
if(object === "deleted"){
|
||||
return
|
||||
}
|
||||
const f = object.asGeoJson()
|
||||
this.state.indexedFeatures.addItem(f)
|
||||
this.state.featureProperties.trackFeature(f)
|
||||
this.state.selectedElement.set(f)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue