Immediately load and show the selected feature

This commit is contained in:
Pieter Vander Vennet 2021-05-13 13:04:17 +02:00
parent c3b6353259
commit cd4a2608a2
5 changed files with 8 additions and 14 deletions

View file

@ -2,6 +2,7 @@ import FeatureSource from "./FeatureSource";
import {UIEventSource} from "../UIEventSource";
import LayerConfig from "../../Customizations/JSON/LayerConfig";
import Loc from "../../Models/Loc";
import Hash from "../Web/Hash";
export default class FilteringFeatureSource implements FeatureSource {
public features: UIEventSource<{ feature: any; freshness: Date }[]> = new UIEventSource<{ feature: any; freshness: Date }[]>([]);
@ -34,7 +35,7 @@ export default class FilteringFeatureSource implements FeatureSource {
const newFeatures = features.filter(f => {
const layerId = f.feature._matching_layer_id;
if(selectedElement.data !== undefined && selectedElement.data?.id === f.feature.id){
if(selectedElement.data?.id === f.feature.id || f.feature.id === Hash.hash.data){
// This is the selected object - it gets a free pass even if zoom is not sufficient
return true;
}

View file

@ -11,13 +11,7 @@ export default class OsmApiFeatureSource implements FeatureSource {
public readonly name: string = "OsmApiFeatureSource";
private readonly loadedTiles: Set<string> = new Set<string>();
constructor(location: UIEventSource<Loc>) {
/* const self = this
location.addCallback(_ => {
self.loadArea()
})
*/
constructor() {
}
@ -26,6 +20,7 @@ export default class OsmApiFeatureSource implements FeatureSource {
// Newly added point - not yet in OSM
return;
}
console.debug("Downloading", id, "from the OSM-API")
OsmObject.DownloadObject(id, (element, meta) => {
const geojson = element.asGeoJson();
geojson.id = geojson.properties.id;