Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/pull/5500'
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhughes committed Jan 16, 2025
2 parents 0ab8d95 + 9d7e597 commit bde5fb4
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions app/assets/javascripts/index/layers/notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit bde5fb4

Please sign in to comment.