]> git.openstreetmap.org Git - rails.git/commitdiff
Zoom in to note if zoom < 15
authorAaron Lidman <aaronlidman@gmail.com>
Wed, 13 Nov 2013 18:33:16 +0000 (10:33 -0800)
committerAaron Lidman <aaronlidman@gmail.com>
Wed, 13 Nov 2013 18:33:16 +0000 (10:33 -0800)
app/assets/javascripts/index/note.js.erb

index 2586f84c6d9af2f1082379bf3af21d726539086c..6458626f41abb25eca8cdada6b847251878c22c1 100644 (file)
@@ -70,7 +70,10 @@ OSM.Note = function (map) {
 
     var data = $('.details').data();
     if (!noteState) map.addLayer(noteLayer);
 
     var data = $('.details').data();
     if (!noteState) map.addLayer(noteLayer);
-    if (window.location.hash == "") map.panTo(data.coordinates.split(','));
+    if (window.location.hash == "") {
+      var coords = data.coordinates.split(',');
+      map.getZoom() > 15 ? map.panTo(coords) : map.setView(coords, 16);
+    }
 
     if (!map.hasLayer(halo)) {
       halo = L.circleMarker(data.coordinates.split(','), {
 
     if (!map.hasLayer(halo)) {
       halo = L.circleMarker(data.coordinates.split(','), {