From dc59b37fe1449e693fdc5d3a3873f7cad7c36e57 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Wed, 25 Dec 2024 04:15:34 +0300 Subject: [PATCH] Add new note marker to root map layer instead of noteLayer We want the new note marker in the same layer with its halo. Also we don't want to put anything in noteLayer because it clears its contents on certain zoom levels. --- app/assets/javascripts/index/new_note.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/index/new_note.js b/app/assets/javascripts/index/new_note.js index 7eb132383..c1df93517 100644 --- a/app/assets/javascripts/index/new_note.js +++ b/app/assets/javascripts/index/new_note.js @@ -115,7 +115,7 @@ OSM.NewNote = function (map) { newHalo(newNoteMarker.getLatLng(), a.type); }); - newNoteMarker.addTo(noteLayer); + newNoteMarker.addTo(map); newHalo(newNoteMarker.getLatLng()); newNoteMarker.on("remove", function () { @@ -144,7 +144,7 @@ OSM.NewNote = function (map) { createNote(location, text, (feature) => { content.find("textarea").val(""); addCreatedNoteMarker(feature); - noteLayer.removeLayer(newNoteMarker); + map.removeLayer(newNoteMarker); newNoteMarker = null; addNoteButton.removeClass("active"); OSM.router.route("/note/" + feature.properties.id); @@ -155,7 +155,7 @@ OSM.NewNote = function (map) { }; page.unload = function () { - if (newNoteMarker) noteLayer.removeLayer(newNoteMarker); + if (newNoteMarker) map.removeLayer(newNoteMarker); if (halo) map.removeLayer(halo); addNoteButton.removeClass("active"); }; -- 2.39.5