From: Tom Hughes Date: Thu, 16 Jan 2025 19:03:43 +0000 (+0000) Subject: Merge remote-tracking branch 'upstream/pull/5500' X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/HEAD?hp=0ab8d954ad6d6e4cee5c1238973b8f693c788fcb Merge remote-tracking branch 'upstream/pull/5500' --- diff --git a/app/assets/javascripts/index/layers/notes.js b/app/assets/javascripts/index/layers/notes.js index eaa5c3654..4676aa425 100644 --- a/app/assets/javascripts/index/layers/notes.js +++ b/app/assets/javascripts/index/layers/notes.js @@ -20,20 +20,14 @@ OSM.initializeNotesLayer = function (map) { }) }; - map.on("layeradd", function (e) { - if (e.layer === noteLayer) { - loadNotes(); - map.on("moveend", loadNotes); - } - }).on("layerremove", function (e) { - if (e.layer === noteLayer) { - map.off("moveend", loadNotes); - noteLayer.clearLayers(); - notes = {}; - } - }); - - noteLayer.on("click", function (e) { + noteLayer.on("add", () => { + loadNotes(); + map.on("moveend", loadNotes); + }).on("remove", () => { + map.off("moveend", loadNotes); + noteLayer.clearLayers(); + notes = {}; + }).on("click", function (e) { if (e.layer.id) { OSM.router.route("/note/" + e.layer.id); }