Update map state when following a client side route
authorTom Hughes <tom@compton.nu>
Thu, 13 Mar 2014 13:37:45 +0000 (13:37 +0000)
committerTom Hughes <tom@compton.nu>
Thu, 13 Mar 2014 13:37:45 +0000 (13:37 +0000)
app/assets/javascripts/router.js

index 9657549b1abdb893c304049b76ec894038a21402..ab206410703e81a4db32cecf914551d539b9e535 100644 (file)
@@ -114,7 +114,9 @@ OSM.Router = function(map, rts) {
         route = routes.recognize(path);
       if (!route) return false;
       currentRoute.run('unload');
         route = routes.recognize(path);
       if (!route) return false;
       currentRoute.run('unload');
-      window.history.pushState(OSM.parseHash(url), document.title, url);
+      var state = OSM.parseHash(url);
+      map.setState(state);
+      window.history.pushState(state, document.title, url);
       currentPath = path;
       currentRoute = route;
       currentRoute.run('pushstate', currentPath);
       currentPath = path;
       currentRoute = route;
       currentRoute.run('pushstate', currentPath);