]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/history.js
Remove params from url when viewing place history and map is moved
[rails.git] / app / assets / javascripts / index / history.js
index 235f11ba111985cdc72cfee89ad5a337f84a6128..9f883367a799393be5cc2d2b3a20dfbda48271e7 100644 (file)
@@ -189,6 +189,11 @@ OSM.History = function (map) {
     });
   }
 
+  function reloadChangesetsBecauseOfMapMovement() {
+    OSM.router.replace("/history" + window.location.hash);
+    loadFirstChangesets();
+  }
+
   let changesets = [];
 
   function updateBounds() {
@@ -250,7 +255,7 @@ OSM.History = function (map) {
     map.addLayer(group);
 
     if (location.pathname === "/history") {
-      map.on("moveend", loadFirstChangesets);
+      map.on("moveend", reloadChangesetsBecauseOfMapMovement);
     }
 
     map.on("zoomend", updateBounds);
@@ -260,7 +265,7 @@ OSM.History = function (map) {
 
   page.unload = function () {
     map.removeLayer(group);
-    map.off("moveend", loadFirstChangesets);
+    map.off("moveend", reloadChangesetsBecauseOfMapMovement);
     map.off("zoomend", updateBounds);
     disableChangesetIntersectionObserver();
   };