]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/search.js
Position on notes correctly when a link to a comment is loaded
[rails.git] / app / assets / javascripts / index / search.js
index 6efba746e54985ca4916bdc16ffdd96d1ae9cdab..6b6f3231f2b0f3fca684e3d4a93ecf7931c2d449 100644 (file)
@@ -29,17 +29,17 @@ OSM.Search = function(map) {
     var data = $(this).data(),
       center = L.latLng(data.lat, data.lon);
 
-    if (data.type && data.id) return; // Browse link
-
-    e.preventDefault();
-    e.stopPropagation();
-
     if (data.minLon && data.minLat && data.maxLon && data.maxLat) {
-      map.fitBounds([[data.minLat, data.minLon],
-        [data.maxLat, data.maxLon]]);
+      map.fitBounds([[data.minLat, data.minLon], [data.maxLat, data.maxLon]]);
     } else {
       map.setView(center, data.zoom);
     }
+
+    // Let clicks to object browser links propagate.
+    if (data.type && data.id) return;
+
+    e.preventDefault();
+    e.stopPropagation();
   }
 
   var marker = L.marker([0, 0], {icon: getUserIcon()});