node-red-contrib-web-worldmap 5.6.0 → 5.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,6 @@
1
1
  ### Change Log for Node-RED Worldmap
2
2
 
3
+ - v5.6.1 - Also call autoswitch on initial connect to ensure map in view.
3
4
  - v5.6.0 - Autoswitch pmtiles basemaps based on zoom and/or coverage.
4
5
  - v5.5.8 - Bump qs dep for CVE
5
6
  - v5.5.7 - Fix COG handling for built in icons, bump various libs for CVEs
package/README.md CHANGED
@@ -10,6 +10,7 @@ A <a href="https://nodered.org" target="mapinfo">Node-RED</a> node to provide a
10
10
 
11
11
  ### Updates
12
12
 
13
+ - v5.6.1 - Also call autoswitch on initial connect to ensure map in view.
13
14
  - v5.6.0 - Autoswitch pmtiles basemaps based on zoom and/or coverage.
14
15
  - v5.5.8 - Bump qs dep for CVE
15
16
  - v5.5.7 - Fix COG handling for built in icons, bump various libs for CVEs
@@ -21,12 +22,6 @@ A <a href="https://nodered.org" target="mapinfo">Node-RED</a> node to provide a
21
22
  - v5.4.0 - Let msg.payload.command.zoomLevels set an array of acceptable zoom levels. Issue #312
22
23
  - v5.3.0 - Let msg.payload.popupOptions object set Leaflet popup options so it can be customised. Issue #311
23
24
  - v5.2.0 - Allow left click send back co-ords. Let Button be replaceable more easily and take value property. Issue #308 and #309
24
- - v5.1.6 - Let Cot __milsym set the SIDC if present.
25
- - v5.1.5 - Fix links to SIDC unitgenerator so it is now local.
26
- - v5.1.4 - Fix clearlayer for tracks node.
27
- - v5.1.2 - Fix for longer line msg properties.
28
- - v5.1.1 - Fix CoT inline image.
29
- - v5.1.0 - Let special icons be sizeable using iconSize property.
30
25
 
31
26
  - see [CHANGELOG](https://github.com/dceejay/RedMap/blob/master/CHANGELOG.md) for full list of changes.
32
27
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-web-worldmap",
3
- "version": "5.6.0",
3
+ "version": "5.6.1",
4
4
  "description": "A Node-RED node to provide a web page of a world map for plotting things on.",
5
5
  "dependencies": {
6
6
  "@turf/bezier-spline": "~7.3.4",
@@ -94,7 +94,7 @@ var connect = function() {
94
94
  document.getElementById("footer").innerHTML = "<font color='#494'>"+pagefoot+"</font>";
95
95
  }
96
96
  ws.send(JSON.stringify({action:"connected",parameters:Object.fromEntries((new URL(location)).searchParams),clientTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone || false}));
97
- setTimeout(function() { onoffline(); }, 500);
97
+ setTimeout(function() { onoffline(); pickMapLayer();}, 500);
98
98
  };
99
99
  ws.onclose = function() {
100
100
  console.log("DISCONNECTED");
@@ -862,23 +862,7 @@ function showMapCurrentZoom() {
862
862
  },750);
863
863
  }
864
864
 
865
- map.on('zoomend', function() {
866
- showMapCurrentZoom();
867
- window.localStorage.setItem("lastzoom", map.getZoom());
868
- var b = map.getBounds();
869
- oldBounds = {sw:{lat:b._southWest.lat,lng:b._southWest.lng},ne:{lat:b._northEast.lat,lng:b._northEast.lng}};
870
- ws.send(JSON.stringify({action:"bounds", south:b._southWest.lat, west:b._southWest.lng, north:b._northEast.lat, east:b._northEast.lng, zoom:map.getZoom() }));
871
- edgeAware();
872
- });
873
- map.on('moveend', function() {
874
- window.localStorage.setItem("lastpos",JSON.stringify(map.getCenter()));
875
- var b = map.getBounds();
876
- if (b._southWest.lat !== oldBounds.sw.lat && b._southWest.lng !== oldBounds.sw.lng && b._northEast.lat !== oldBounds.ne.lat && b._northEast.lng !== oldBounds.ne.lng) {
877
- ws.send(JSON.stringify({action:"bounds", south:b._southWest.lat, west:b._southWest.lng, north:b._northEast.lat, east:b._northEast.lng, zoom:map.getZoom() }));
878
- oldBounds = {sw:{lat:b._southWest.lat,lng:b._southWest.lng},ne:{lat:b._northEast.lat,lng:b._northEast.lng}};
879
- }
880
- edgeAware();
881
-
865
+ function pickMapLayer() {
882
866
  // if we have bounds meta data for the current baselayer (usually pmtiles)
883
867
  if (basemaps[baselayername] && basemaps[baselayername].hasOwnProperty("meta")) {
884
868
  const m = basemaps[baselayername].meta
@@ -931,6 +915,25 @@ map.on('moveend', function() {
931
915
  }
932
916
  }
933
917
  }
918
+ }
919
+
920
+ map.on('zoomend', function() {
921
+ showMapCurrentZoom();
922
+ window.localStorage.setItem("lastzoom", map.getZoom());
923
+ var b = map.getBounds();
924
+ oldBounds = {sw:{lat:b._southWest.lat,lng:b._southWest.lng},ne:{lat:b._northEast.lat,lng:b._northEast.lng}};
925
+ ws.send(JSON.stringify({action:"bounds", south:b._southWest.lat, west:b._southWest.lng, north:b._northEast.lat, east:b._northEast.lng, zoom:map.getZoom() }));
926
+ edgeAware();
927
+ });
928
+ map.on('moveend', function() {
929
+ window.localStorage.setItem("lastpos",JSON.stringify(map.getCenter()));
930
+ var b = map.getBounds();
931
+ if (b._southWest.lat !== oldBounds.sw.lat && b._southWest.lng !== oldBounds.sw.lng && b._northEast.lat !== oldBounds.ne.lat && b._northEast.lng !== oldBounds.ne.lng) {
932
+ ws.send(JSON.stringify({action:"bounds", south:b._southWest.lat, west:b._southWest.lng, north:b._northEast.lat, east:b._northEast.lng, zoom:map.getZoom() }));
933
+ oldBounds = {sw:{lat:b._southWest.lat,lng:b._southWest.lng},ne:{lat:b._northEast.lat,lng:b._northEast.lng}};
934
+ }
935
+ edgeAware();
936
+ pickMapLayer();
934
937
  });
935
938
  map.on('locationfound', onLocationFound);
936
939
  map.on('locationerror', onLocationError);