X-Git-Url: https://git.openstreetmap.org./nominatim-ui.git/blobdiff_plain/6e68f11776a8f6f5a62b989f13ebf7438ef32476..93e26bcdb513375933713ad7fad61b30c14dc7ab:/src/components/Map.svelte

diff --git a/src/components/Map.svelte b/src/components/Map.svelte
index b3b9e83..7b13187 100644
--- a/src/components/Map.svelte
+++ b/src/components/Map.svelte
@@ -17,8 +17,9 @@
 
   function createMap(container) {
     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: [
@@ -27,6 +28,14 @@
       ],
       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: '<a href="https://leafletjs.com/">Leaflet</a>' }).addTo(map);
+    }
 
     L.tileLayer(Nominatim_Config.Map_Tile_URL, {
       attribution: attribution
@@ -108,6 +117,7 @@
           clickable: false
         }
       );
+      cm.bindTooltip(`Search (${position_marker[0]},${position_marker[1]})`).openTooltip();
       cm.addTo(map);
       dataLayers.push(cm);
     }
@@ -117,13 +127,16 @@
     if (viewbox) {
       let coords = viewbox.split(','); // <x1>,<y1>,<x2>,<y2>
       let bounds = L.latLngBounds([coords[1], coords[0]], [coords[3], coords[2]]);
-      L.rectangle(bounds, {
+      let viewbox_on_map = L.rectangle(bounds, {
         color: '#69d53e',
         weight: 3,
         dashArray: '5 5',
         opacity: 0.8,
-        fill: false
-      }).addTo(map);
+        fill: false,
+        interactive: false
+      });
+      map.addLayer(viewbox_on_map);
+      dataLayers.push(viewbox_on_map);
     }
 
     if (!aFeature) return;
@@ -136,6 +149,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);
     }
@@ -171,9 +187,9 @@
 
 <MapPosition />
 <div id="map" use:mapAction />
-<div id="show-map-position" class="leaflet-bar btn btn-sm btn-outline-secondary"
+<button id="show-map-position" class="leaflet-bar btn btn-sm btn-outline-secondary"
       on:click|stopPropagation={show_map_position_click}
->show map bounds</div>
+>show map bounds</button>
 
 <style>
   #map {
