]> git.openstreetmap.org Git - rails.git/commitdiff
Update to leaflet 1.8.0
authorTom Hughes <tom@compton.nu>
Mon, 18 Apr 2022 13:10:06 +0000 (14:10 +0100)
committerTom Hughes <tom@compton.nu>
Mon, 18 Apr 2022 13:10:06 +0000 (14:10 +0100)
app/assets/javascripts/index/new_note.js
app/assets/javascripts/index/note.js
package.json
yarn.lock

index b1c07bbbf85ec0ba85689195739a3d230a8333d3..906a6a33a3ba9e38e09592ffc3316f1e58967e19 100644 (file)
@@ -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");
   };
 
index 3793c573e6122d5165df17181e545e99701dd7d0..7efec6c5d931a395f08e591dd64e4503e483dd4c 100644 (file)
@@ -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,
index 5a50c3c21ddae14a1185d4f402fe2c8ec5ccbf86..3eee2496180e784a85fa2c0c599c202a7f81c9bc 100644 (file)
@@ -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": {
index 07b5b6d7ec488893dd4156db71e43958a0911716..0047ecdc75bc23812c63518d342e8cab35bab6b5 100644 (file)
--- 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"