Merge develop

This commit is contained in:
Pieter Vander Vennet 2021-10-26 01:27:35 +02:00
commit 07bc5d6a6d
88 changed files with 3284 additions and 2363 deletions

View file

@ -10,7 +10,7 @@ import LayoutConfig from "../../Models/ThemeConfig/LayoutConfig";
* Makes sure the hash shows the selected element and vice-versa.
*/
export default class SelectedFeatureHandler {
private static readonly _no_trigger_on = new Set(["welcome", "copyright", "layers", "new", "", undefined])
private static readonly _no_trigger_on = new Set(["welcome", "copyright", "layers", "new", "filter","", undefined])
private readonly hash: UIEventSource<string>;
private readonly state: {
selectedElement: UIEventSource<any>,
@ -70,7 +70,7 @@ export default class SelectedFeatureHandler {
this.initialLoad()
}
/**
* On startup: check if the hash is loaded and eventually zoom to it
@ -85,6 +85,11 @@ export default class SelectedFeatureHandler {
return;
}
if (!(hash.startsWith("node") || hash.startsWith("way") || hash.startsWith("relation"))) {
return;
}
OsmObject.DownloadObjectAsync(hash).then(obj => {
try {
@ -129,26 +134,25 @@ export default class SelectedFeatureHandler {
// If a feature is selected via the hash, zoom there
private zoomToSelectedFeature() {
const selected = this.state.selectedElement.data
if(selected === undefined){
if (selected === undefined) {
return
}
const centerpoint= GeoOperations.centerpointCoordinates(selected)
const centerpoint = GeoOperations.centerpointCoordinates(selected)
const location = this.state.locationControl;
location.data.lon = centerpoint[0]
location.data.lat = centerpoint[1]
const minZoom = Math.max(14, ...(this.state.layoutToUse?.layers?.map(l => l.minzoomVisible) ?? []))
if(location.data.zoom < minZoom ){
if (location.data.zoom < minZoom) {
location.data.zoom = minZoom
}
location.ping();
}
}