Don't centre on load if the location is already in view
authorTom Hughes <tom@compton.nu>
Sat, 1 Nov 2014 17:20:26 +0000 (17:20 +0000)
committerTom Hughes <tom@compton.nu>
Sat, 1 Nov 2014 17:55:21 +0000 (17:55 +0000)
app/assets/javascripts/index/query.js

index 180e203d5b2237ae19b53669cfc4cee9d7fc4722..12261abb823b4c99ea3015be63b696be62a5e07d 100644 (file)
@@ -293,8 +293,7 @@ OSM.Query = function(map) {
     var params = querystring.parse(path.substring(path.indexOf('?') + 1)),
       latlng = L.latLng(params.lat, params.lon);
 
-    if (!window.location.hash &&
-        (!noCentre || !map.getBounds().contains(latlng))) {
+    if (!window.location.hash && !noCentre && !map.getBounds().contains(latlng)) {
       OSM.router.withoutMoveListener(function () {
         map.setView(latlng, 15);
       });