]> git.openstreetmap.org Git - rails.git/commitdiff
Tone down the highlighting of Nominatim search results
authorTom Hughes <tom@compton.nu>
Thu, 18 Jul 2013 14:29:01 +0000 (15:29 +0100)
committerTom Hughes <tom@compton.nu>
Thu, 18 Jul 2013 14:29:01 +0000 (15:29 +0100)
app/assets/javascripts/browse.js
app/assets/javascripts/index.js
app/assets/javascripts/map.js.erb

index cde7c1276a76ad334bac9bc4414b6e3ec88854fd..edfb4643aef8e80216f0f087909a37a369dfe712 100644 (file)
@@ -74,33 +74,36 @@ $(document).ready(function () {
       object.version = params.version - 1;
     }
 
-    addObjectToMap(object, true, function(extent) {
-      $("#loading").hide();
-      $("#browse_map .geolink").show();
-
-      if (extent) {
-        $("a.bbox[data-editor=remote]").click(function () {
-          return remoteEditHandler(extent);
-        });
-
-        $("a.object[data-editor=remote]").click(function () {
-          return remoteEditHandler(extent, params.type + params.id);
-        });
-
-        $("#object_larger_map").show();
-        $("#object_edit").show();
-
-        var centre = extent.getCenter();
-        updatelinks(centre.lng,
-                    centre.lat,
-                    16, null,
-                    extent.getWest(),
-                    extent.getSouth(),
-                    extent.getEast(),
-                    extent.getNorth(),
-                    object);
-      } else {
-        $("#small_map").hide();
+    addObjectToMap(object, {
+      zoom: true, 
+      callback: function(extent) {
+        $("#loading").hide();
+        $("#browse_map .geolink").show();
+
+        if (extent) {
+          $("a.bbox[data-editor=remote]").click(function () {
+            return remoteEditHandler(extent);
+          });
+
+          $("a.object[data-editor=remote]").click(function () {
+            return remoteEditHandler(extent, params.type + params.id);
+          });
+
+          $("#object_larger_map").show();
+          $("#object_edit").show();
+
+          var centre = extent.getCenter();
+          updatelinks(centre.lng,
+                      centre.lat,
+                      16, null,
+                      extent.getWest(),
+                      extent.getSouth(),
+                      extent.getEast(),
+                      extent.getNorth(),
+                      object);
+        } else {
+          $("#small_map").hide();
+        }
       }
     });
   }
index 98f24a6e7bd104f7668dc7c5feb2f1f2675047d3..9f0c8649340e63678c8288f60b0e0fa88c7ff093 100644 (file)
@@ -40,7 +40,7 @@ $(document).ready(function () {
   }
 
   if (params.object) {
-    addObjectToMap(params.object, params.object_zoom);
+    addObjectToMap(params.object, { zoom: params.object_zoom });
   }
 
   handleResize();
@@ -59,7 +59,7 @@ $(document).ready(function () {
     }
 
     if (data.type && data.id) {
-      addObjectToMap(data, true);
+      addObjectToMap(data, { zoom: true, style: { opacity: 0.2, fill: false } });
     }
 
     if (marker) {
index 8b621e3aed4473302d4963473b7c9d75556e8d36..90aefa94580a5fd466c4eb5316d5111c896f9978 100644 (file)
@@ -96,7 +96,7 @@ function getUserIcon(url) {
   });
 }
 
-function addObjectToMap(object, zoom, callback) {
+function addObjectToMap(object, options) {
   if (objectLoader) {
     objectLoader.abort();
   }
@@ -110,13 +110,10 @@ function addObjectToMap(object, zoom, callback) {
     dataType: "xml",
     success: function (xml) {
       objectLayer = new L.OSM.DataLayer(null, {
-        style: {
-          strokeColor: "blue",
-          strokeWidth: 3,
-          strokeOpacity: 0.5,
-          fillOpacity: 0.2,
-          fillColor: "lightblue",
-          pointRadius: 6
+        styles: {
+          node: options.style,
+          way: options.style,
+          area: options.style
         }
       });
 
@@ -136,12 +133,12 @@ function addObjectToMap(object, zoom, callback) {
 
       var bounds = objectLayer.getBounds();
 
-      if (zoom) {
+      if (options.zoom) {
         map.fitBounds(bounds);
       }
 
-      if (callback) {
-        callback(bounds);
+      if (options.callback) {
+        options.callback(bounds);
       }
 
       objectLayer.addTo(map);