From 49c7d34c9f3922d343ddd7ba700891c960160a10 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Sat, 19 Apr 2025 17:38:21 +0300 Subject: [PATCH] Ignore changeset highlight changes mid-zoom Otherwise, if highlights are implemented as new Leaflet layers, these layers may appear at unexpected locations. --- app/assets/javascripts/index/history.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/assets/javascripts/index/history.js b/app/assets/javascripts/index/history.js index d1bcb20a1..f180c885d 100644 --- a/app/assets/javascripts/index/history.js +++ b/app/assets/javascripts/index/history.js @@ -13,11 +13,17 @@ OSM.History = function (map) { toggleChangesetHighlight($(this).data("changeset").id, false); }); + let inZoom = false; + map.on("zoomstart", () => inZoom = true); + map.on("zoomend", () => inZoom = false); + const changesetsLayer = new OSM.HistoryChangesetsLayer() .on("mouseover", function (e) { + if (inZoom) return; toggleChangesetHighlight(e.layer.id, true); }) .on("mouseout", function (e) { + if (inZoom) return; toggleChangesetHighlight(e.layer.id, false); }) .on("click", function (e) { -- 2.39.5