X-Git-Url: https://git.openstreetmap.org./nominatim-ui.git/blobdiff_plain/152e6d847003cb0b2b4505f79531941dc98e9e95..b63424c366297d79a9b40cb324d62b5a86bdb310:/src/components/Map.svelte?ds=sidebyside diff --git a/src/components/Map.svelte b/src/components/Map.svelte index d77b81d..dd2a1ae 100644 --- a/src/components/Map.svelte +++ b/src/components/Map.svelte @@ -6,7 +6,6 @@ import 'leaflet-minimap/dist/Control.MiniMap.min.css'; import { get } from 'svelte/store'; - import { get_config_value } from '../lib/config_reader.js'; import { map_store } from '../lib/stores.js'; import MapPosition from '../components/MapPosition.svelte'; @@ -17,24 +16,33 @@ let dataLayers = []; function createMap(container) { - const attribution = get_config_value('Map_Tile_Attribution') || null; + const attribution = Nominatim_Config.Map_Tile_Attribution; + let map = new L.map(container, { - attributionControl: (attribution && attribution.length), + attributionControl: false, scrollWheelZoom: true, // !L.Browser.touch, touchZoom: false, center: [ - get_config_value('Map_Default_Lat'), - get_config_value('Map_Default_Lon') + Nominatim_Config.Map_Default_Lat, + Nominatim_Config.Map_Default_Lon ], - zoom: get_config_value('Map_Default_Zoom') + 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); + } - L.tileLayer(get_config_value('Map_Tile_URL'), { + if (attribution && attribution.length) { + L.control.attribution({ prefix: 'Leaflet' }).addTo(map); + } + + L.tileLayer(Nominatim_Config.Map_Tile_URL, { attribution: attribution }).addTo(map); if (display_minimap) { - let osm2 = new L.TileLayer(get_config_value('Map_Tile_URL'), { + let osm2 = new L.TileLayer(Nominatim_Config.Map_Tile_URL, { minZoom: 0, maxZoom: 13, attribution: attribution @@ -109,6 +117,7 @@ clickable: false } ); + cm.bindTooltip(`Search (${position_marker[0]},${position_marker[1]})`).openTooltip(); cm.addTo(map); dataLayers.push(cm); } @@ -137,6 +146,9 @@ let circle = L.circleMarker([lat, lon], { radius: 10, weight: 2, fillColor: '#ff7800', color: 'blue', opacity: 0.75 }); + if (position_marker) { // reverse result + circle.bindTooltip('Result').openTooltip(); + } map.addLayer(circle); dataLayers.push(circle); }