From 17b83b1180bfa34e7354f1a3ae6927d52331033a Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Sat, 12 Aug 2023 16:24:26 +0100 Subject: [PATCH] fix missing countries overlay when starting disconnected --- CHANGELOG.md | 1 + README.md | 1 + package.json | 2 +- worldmap/worldmap.js | 9 +++++++-- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d92fe7c..04fd39d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ### Change Log for Node-RED Worldmap + - v2.40.1 - Fix missing countries overlay when starting disconnected. - v2.40.0 - Add handling for TAK event points from TAK ingest node. - v2.39.0 - Add client timezone to connect message. PR #245 - v2.38.3 - Better fix for geojson multipoint icons. diff --git a/README.md b/README.md index 4021ea0..55582a0 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ Feel free to [![](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D% ### Updates +- v2.40.1 - Fix missing countries overlay when starting disconnected. - v2.40.0 - Add handling for TAK event points from TAK ingest node. - v2.39.0 - Add client timezone to connect message. PR #245 - v2.38.3 - Better fix for geojson multipoint icons. diff --git a/package.json b/package.json index 7e9556a..f74562c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-red-contrib-web-worldmap", - "version": "2.40.0", + "version": "2.40.1", "description": "A Node-RED node to provide a web page of a world map for plotting things on.", "dependencies": { "@turf/bezier-spline": "~6.5.0", diff --git a/worldmap/worldmap.js b/worldmap/worldmap.js index 22316ef..dfc9397 100644 --- a/worldmap/worldmap.js +++ b/worldmap/worldmap.js @@ -147,7 +147,13 @@ var handleData = function(data) { window.onunload = function() { if (ws) ws.close(); } -var onoffline = function() { if (!navigator.onLine) { map.addLayer(layers["_countries"]); } } +var customTopoLayer = L.geoJson(null, {clickable:false, style: {color:"blue", weight:2, fillColor:"#cf6", fillOpacity:0.04}}); +layers["_countries"] = omnivore.topojson('images/world-50m-flat.json',null,customTopoLayer); +overlays["countries"] = layers["_countries"]; + +var onoffline = function() { if (!navigator.onLine) { + map.addLayer(overlays["countries"]); +} } document.addEventListener ("keydown", function (ev) { // Set Ctl-Alt-3 to switch to 3d view @@ -1216,7 +1222,6 @@ var addOverlays = function(overlist) { sendDrawing(n); }); } - } // Add the countries (world-110m) for offline use