X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/a7092491b069de43bb8d8c30d3526e7095c5cc98..0295b05bdf052c4a031a5bc937ca48a5b185b232:/app/assets/javascripts/index/note.js diff --git a/app/assets/javascripts/index/note.js b/app/assets/javascripts/index/note.js index 3793c573e..7efec6c5d 100644 --- a/app/assets/javascripts/index/note.js +++ b/app/assets/javascripts/index/note.js @@ -73,7 +73,7 @@ OSM.Note = function (map) { var data = $(".details").data(), latLng = L.latLng(data.coordinates.split(",")); - if (!map.hasLayer(halo)) { + if (!halo || !map.hasLayer(halo)) { halo = L.circleMarker(latLng, { weight: 2.5, radius: 20, @@ -83,7 +83,8 @@ OSM.Note = function (map) { map.addLayer(halo); } - if (map.hasLayer(currentNote)) map.removeLayer(currentNote); + if (currentNote && map.hasLayer(currentNote)) map.removeLayer(currentNote); + currentNote = L.marker(latLng, { icon: noteIcons[data.status], opacity: 1,