X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/c4c0e8105a8edc35205add749f461ec7be689aef..58f0eea2a4aba52858361915157a06d0087a99e4:/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,