From: Tom Hughes Date: Mon, 18 Apr 2022 13:10:06 +0000 (+0100) Subject: Update to leaflet 1.8.0 X-Git-Tag: live~1827 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/2f6eebcd970d5f595f1c66359fe2322b9dedaa55?ds=inline Update to leaflet 1.8.0 --- diff --git a/app/assets/javascripts/index/new_note.js b/app/assets/javascripts/index/new_note.js index b1c07bbbf..906a6a33a 100644 --- a/app/assets/javascripts/index/new_note.js +++ b/app/assets/javascripts/index/new_note.js @@ -85,10 +85,12 @@ OSM.NewNote = function (map) { }; function newHalo(loc, a) { - if (a === "dragstart" && map.hasLayer(halo)) { + var hasHalo = halo && map.hasLayer(halo) + + if (a === "dragstart" && hasHalo) { map.removeLayer(halo); } else { - if (map.hasLayer(halo)) map.removeLayer(halo); + if (hasHalo) map.removeLayer(halo); halo = L.circleMarker(loc, { weight: 2.5, @@ -160,8 +162,8 @@ OSM.NewNote = function (map) { }; page.unload = function () { - noteLayer.removeLayer(newNote); - map.removeLayer(halo); + if (newNote) noteLayer.removeLayer(newNote); + if (halo) map.removeLayer(halo); addNoteButton.removeClass("active"); }; 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, diff --git a/package.json b/package.json index 5a50c3c21..3eee24961 100644 --- a/package.json +++ b/package.json @@ -5,8 +5,8 @@ "bs-custom-file-input": "^1.3.4", "jquery-simulate": "^1.0.2", "js-cookie": "^3.0.0", - "leaflet": "^1.6.0", - "leaflet.locatecontrol": "^0.75.0", + "leaflet": "^1.8.0", + "leaflet.locatecontrol": "^0.76.0", "qs": "^6.9.4" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index 07b5b6d7e..0047ecdc7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -444,15 +444,15 @@ json-stable-stringify-without-jsonify@^1.0.1: resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= -leaflet.locatecontrol@^0.75.0: - version "0.75.0" - resolved "https://registry.yarnpkg.com/leaflet.locatecontrol/-/leaflet.locatecontrol-0.75.0.tgz#8c7996de4425380660431fbfa548d5fe3a3595d8" - integrity sha512-Mz/+4dgmUoBVxy7BN+Rtf76XcIJw2qK+S41FnejS/AC88Ec5hpaFnI5gYcS+W6zcQ90sAKxqu1rXii+c01ot5g== - -leaflet@^1.6.0: - version "1.7.1" - resolved "https://registry.yarnpkg.com/leaflet/-/leaflet-1.7.1.tgz#10d684916edfe1bf41d688a3b97127c0322a2a19" - integrity sha512-/xwPEBidtg69Q3HlqPdU3DnrXQOvQU/CCHA1tcDQVzOwm91YMYaILjNp7L4Eaw5Z4sOYdbBz6koWyibppd8Zqw== +leaflet.locatecontrol@^0.76.0: + version "0.76.0" + resolved "https://registry.yarnpkg.com/leaflet.locatecontrol/-/leaflet.locatecontrol-0.76.0.tgz#afca63a3ccf3161bed0e8bf94a98ddba364e90e1" + integrity sha512-Mx8uiihBi8KrrW3LgblsNL/pS8HR0gj60m8VFDFrnhSvDuitChazc095XcMSscf/XqZW+TSqQMCTe+AUy/4/eA== + +leaflet@^1.8.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/leaflet/-/leaflet-1.8.0.tgz#4615db4a22a304e8e692cae9270b983b38a2055e" + integrity sha512-gwhMjFCQiYs3x/Sf+d49f10ERXaEFCPr+nVTryhAW8DWbMGqJqt9G4XuIaHmFW08zYvhgdzqXGr8AlW8v8dQkA== levn@^0.4.1: version "0.4.1"