From: Anton Khorev Date: Mon, 7 Apr 2025 10:34:06 +0000 (+0300) Subject: Rename map listeners on history page X-Git-Tag: live~49^2~1 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/d780c788685bff050c83e236a3a83c299dd3d494?ds=sidebyside;hp=-c Rename map listeners on history page --- d780c788685bff050c83e236a3a83c299dd3d494 diff --git a/app/assets/javascripts/index/history.js b/app/assets/javascripts/index/history.js index baf7d03f5..3d572b6c7 100644 --- a/app/assets/javascripts/index/history.js +++ b/app/assets/javascripts/index/history.js @@ -232,12 +232,14 @@ OSM.History = function (map) { } } - function reloadChangesetsBecauseOfMapMovement() { - OSM.router.replace("/history" + window.location.hash); - loadFirstChangesets(); + function moveEndListener() { + if (location.pathname === "/history") { + OSM.router.replace("/history" + window.location.hash); + loadFirstChangesets(); + } } - function updateBounds() { + function zoomEndListener() { changesetsLayer.updateChangesetShapes(map); } @@ -262,20 +264,15 @@ OSM.History = function (map) { page.load = function () { map.addLayer(changesetsLayer); - - if (location.pathname === "/history") { - map.on("moveend", reloadChangesetsBecauseOfMapMovement); - } - - map.on("zoomend", updateBounds); - + map.on("moveend", moveEndListener); + map.on("zoomend", zoomEndListener); loadFirstChangesets(); }; page.unload = function () { map.removeLayer(changesetsLayer); - map.off("moveend", reloadChangesetsBecauseOfMapMovement); - map.off("zoomend", updateBounds); + map.off("moveend", moveEndListener); + map.off("zoomend", zoomEndListener); disableChangesetIntersectionObserver(); };