]> git.openstreetmap.org Git - nominatim.git/commitdiff
UI: keep map position when switch to reverse. Easy switching of lat,lon to lon,lat
authormarc tobias <mtmail@gmx.net>
Sun, 30 Oct 2016 16:45:45 +0000 (17:45 +0100)
committermarc tobias <mtmail@gmx.net>
Sun, 30 Oct 2016 16:45:45 +0000 (17:45 +0100)
lib/template/address-html.php
lib/template/search-html.php
website/css/search.css
website/js/nominatim-ui.js

index 4a9f6325eb7463e67ad830db2ac79953507b2a29..b4c7533e190f52890fbeb2f154e548cfdcf6c1cf 100644 (file)
@@ -14,6 +14,7 @@
         <div class="form-group">
             <input name="format" type="hidden" value="html">
             <input name="lat" type="text" class="form-control input-sm" placeholder="latitude"  value="<?php echo htmlspecialchars($_GET['lat']); ?>" >
+            <span id="switch-coords">&lt;&gt;</span>
             <input name="lon" type="text" class="form-control input-sm" placeholder="longitude" value="<?php echo htmlspecialchars($_GET['lon']); ?>" >
             max zoom
 
index 02c338cd8cfe334a18018c4308b8ea195da9b0f2..14ebacc8020e079b6dee354d5d1d653273521620 100644 (file)
@@ -27,7 +27,7 @@
             </div>
         </div>
         <div class="search-type-link">
-            <a href="<?php echo CONST_Website_BaseURL; ?>reverse.php?format=html">reverse search</a>
+            <a id="switch-to-reverse" href="<?php echo CONST_Website_BaseURL; ?>reverse.php?format=html">reverse search</a>
         </div>
     </form>
 
index d018ab94c3795ce4daa5d342b68a1d8325fffbfb..eb0d06d735d65129fa4d4a658d99d3393ec72b1c 100644 (file)
@@ -26,6 +26,12 @@ form label {
   right: 0
 }
 
+#switch-coords {
+  font-size: 0.8em;
+  font-weight: bold;
+  cursor: pointer;
+}
+
 .sidebar {
   width: 25%;
   padding: 15px;
index 7c19b17a98a82cbfbbc9da2c85e79497d16b31dc..c5e91cf79d45574280899cd1d51be5425567b003 100644 (file)
@@ -72,6 +72,15 @@ jQuery(document).on('ready', function(){
         html_viewbox = "viewbox: " + map_viewbox_as_string();
 
         $('#map-position-inner').html([html_center,html_zoom,html_viewbox,html_click,html_mouse].join('<br/>'));
+
+        var reverse_params = {
+            lat: map.getCenter().lat.toFixed(5),
+            lon: map.getCenter().lng.toFixed(5),
+            zoom: map.getZoom(),
+            format: 'html'
+        }
+        $('#switch-to-reverse').attr('href', 'reverse.php?' + $.param(reverse_params));
+
         $('input#use_viewbox').trigger('change');
     }
 
@@ -202,6 +211,14 @@ jQuery(document).on('ready', function(){
             $('form input[name=lon]').val( e.latlng.lng);
             $('form').submit();
         });
+
+        $('#switch-coords').on('click', function(e){
+            var lat = $('form input[name=lat]').val();
+            var lon = $('form input[name=lon]').val();
+            $('form input[name=lat]').val(lon);
+            $('form input[name=lon]').val(lat);
+            $('form').submit();
+        });
     }
 
     highlight_result(0, false);