From: Jan Piskvor Martinec Date: Wed, 8 Mar 2023 14:59:32 +0000 (+0100) Subject: add Nominatim_Config.Map_Default_Bounds config value X-Git-Url: https://git.openstreetmap.org./nominatim-ui.git/commitdiff_plain/bdb214b388f5d9dae7f06c8205780284b7b20a11 add Nominatim_Config.Map_Default_Bounds config value - use fitBounds(Map_Default_Bounds) if this config value exists - center and zoom is not always provided from data - getting a bounding box might be easier in some use cases --- diff --git a/dist/config.defaults.js b/dist/config.defaults.js index fa0556c..27d98a8 100644 --- a/dist/config.defaults.js +++ b/dist/config.defaults.js @@ -33,6 +33,7 @@ let Nominatim_Config = { Map_Default_Lat: 20.0, Map_Default_Lon: 0.0, Map_Default_Zoom: 2, + Map_Default_Bounds: null, // For what {x}, {y} etc stand for see // https://leafletjs.com/reference-1.9.1.html#tilelayer diff --git a/src/components/Map.svelte b/src/components/Map.svelte index 5426864..1ef199c 100644 --- a/src/components/Map.svelte +++ b/src/components/Map.svelte @@ -28,6 +28,9 @@ ], zoom: Nominatim_Config.Map_Default_Zoom }); + if (typeof Nominatim_Config.Map_Default_Bounds !== 'undefined' && Nominatim_Config.Map_Default_Bounds) { + map.fitBounds(Nominatim_Config.Map_Default_Bounds); + } if (attribution && attribution.length) { L.control.attribution({ prefix: 'Leaflet' }).addTo(map);