Obey the hash
authorAaron Lidman <aaronlidman@gmail.com>
Fri, 15 Nov 2013 02:16:23 +0000 (18:16 -0800)
committerAaron Lidman <aaronlidman@gmail.com>
Fri, 15 Nov 2013 02:16:23 +0000 (18:16 -0800)
app/assets/javascripts/index/note.js.erb
app/assets/javascripts/leaflet.map.js.erb

index a98cea307a4aa39c097410ff1244933b569be55a..09044bf0ef35219a477a9495ab5cda5d30cc6172 100644 (file)
@@ -70,7 +70,7 @@ OSM.Note = function (map) {
 
     var data = $('.details').data();
     if (!noteState) map.addLayer(noteLayer);
-    if (window.location.hash == "") {
+    if (!window.location.hash) {
       var coords = data.coordinates.split(',');
       OSM.route.moveListenerOff();
       map.once('moveend', OSM.route.moveListenerOn);
index dec544d336b133beb2e2d86b33d4025c15565663..69fd1f3e3da6531540a926d11d7f1579faddde60 100644 (file)
@@ -218,12 +218,13 @@ L.OSM.Map = L.Map.extend({
         map._objectLayer.addData(xml);
         map._objectLayer.addTo(map);
 
-        var bounds = map._objectLayer.getBounds();
-        if (bounds.isValid()) {
-          OSM.route.moveListenerOff();
-          map.once('moveend', OSM.route.moveListenerOn);
-
-          map.fitBounds(bounds);
+        if (!window.location.hash) {
+          var bounds = map._objectLayer.getBounds();
+          if (bounds.isValid()) {
+            OSM.route.moveListenerOff();
+            map.once('moveend', OSM.route.moveListenerOn);
+            map.fitBounds(bounds);
+          }
         }
       }
     });