node-red-contrib-web-worldmap 2.22.0 → 2.23.0

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,8 @@
1
1
  ### Change Log for Node-RED Worldmap
2
2
 
3
+ - v2.23.0 - Give logo and id so it can be overridden by toplogo command. PR #188.
4
+ - v2.22.3 - Don't show empty popup for geojson object. Issue #186. Add wobble to null island.
5
+ - v2.22.2 - Be more tolerant of speed string types
3
6
  - v2.22.0 - Separate out layer events in worldmap in
4
7
  - v2.21.9 - Unbreak Drawing layer that I must have broken recently
5
8
  - v2.21.8 - Let SIDC/icon short code be only 4 chars long
package/README.md CHANGED
@@ -11,6 +11,9 @@ map web page for plotting "things" on.
11
11
 
12
12
  ### Updates
13
13
 
14
+ - v2.23.0 - Give logo and id so it can be overridden by toplogo command. PR #188.
15
+ - v2.22.3 - Don't show empty popup for geojson object. Issue #186. Add wobble to null island.
16
+ - v2.22.2 - Be more tolerant of speed string types
14
17
  - v2.22.0 - Separate out layer events in worldmap in
15
18
  - v2.21.9 - Unbreak Drawing layer that I must have broken recently
16
19
  - v2.21.8 - Let SIDC/icon short code be only 4 chars long
@@ -411,6 +414,8 @@ Optional properties include
411
414
  - **button** - if supplied with a `name` and `icon` property - adds a button to provide user input - sends
412
415
  a msg `{"action":"button", "name":"the_button_name"}` to the worldmap in node. If supplied with a `name` property only, it will remove the button. Optional `position` property can be 'bottomright', 'bottomleft', 'topleft' or 'topright' (default).
413
416
  - **contextmenu** - html string to define the right click menu when not on a marker. Defaults to the simple add marker input. Empty string `""` disables this right click.
417
+ - **toptitle** - Words to replace title in title bar (if not in iframe)
418
+ - **toplogo** - URL to logo image for top tile bar (if not in iframe) - ideally 60px by 24px.
414
419
 
415
420
  #### To switch layer, move map and zoom
416
421
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-web-worldmap",
3
- "version": "2.22.0",
3
+ "version": "2.23.0",
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": "~6.5.0",
@@ -80,7 +80,7 @@
80
80
 
81
81
  <body>
82
82
  <div id="topbar">
83
- <a href="https://nodered.org"><img src="images/node-red.png" width="60" height="24" alt="NRed"/></a>
83
+ <a href="https://nodered.org" id="toplink"><img id="toplogo" src="images/node-red.png" style="max-width:60px; height:24px; margin-top:-3px" alt="NRed"/></a>
84
84
  <span class="topbar" id="topwords"> Node-RED - map all the things</span>
85
85
  </div>
86
86
  <div id="results">
@@ -1340,7 +1340,7 @@ function setMarker(data) {
1340
1340
  }
1341
1341
 
1342
1342
  // console.log("DATA", typeof data, data);
1343
- if (data.deleted) { // remove markers we are told to
1343
+ if (data.deleted == true) { // remove markers we are told to
1344
1344
  delMarker(data.name);
1345
1345
  return;
1346
1346
  }
@@ -1491,6 +1491,13 @@ function setMarker(data) {
1491
1491
  return;
1492
1492
  }
1493
1493
 
1494
+ if (ll.lat === 0 && ll.lng === 0) {
1495
+ // Add a little wobble so we can zoom into each if required.
1496
+ console.log(data.name,"is at null island.");
1497
+ ll.lat = Math.round(1000000 * ll.lat + Math.random() * 10000 - 5000) / 1000000;
1498
+ ll.lng = Math.round(1000000 * ll.lng + Math.random() * 10000 - 5000) / 1000000;
1499
+ }
1500
+
1494
1501
  // Adding new L.LatLng object (lli) when optional intensity value is defined. Only for use in heatmap layer
1495
1502
  if (typeof data.coordinates == "object") { lli = new L.LatLng(data.coordinates[2],data.coordinates[1],data.coordinates[0]); }
1496
1503
  else if (data.hasOwnProperty("lat") && data.hasOwnProperty("lon") && data.hasOwnProperty("intensity")) { lli = new L.LatLng((data.lat*1), (data.lon*1), (data.intensity*1)); }
@@ -1954,7 +1961,7 @@ function setMarker(data) {
1954
1961
  if (data.dashArray) { delete data.dashArray; }
1955
1962
  if (data.fill) { delete data.fill; }
1956
1963
  if (data.draggable) { delete data.draggable; }
1957
- if (!isNaN(data.speed)) { data.speed = data.speed.toFixed(2); }
1964
+ //if (!isNaN(data.speed)) { data.speed = data.speed.toFixed(2); }
1958
1965
  if (data.hasOwnProperty("clickable")) { delete data.clickable; }
1959
1966
  if (data.hasOwnProperty("fillColor")) { delete data.fillColor; }
1960
1967
  if (data.hasOwnProperty("radius")) { delete data.radius; }
@@ -2066,6 +2073,12 @@ function doCommand(cmd) {
2066
2073
  document.getElementById("topwords").innerText = cmd.toptitle;
2067
2074
  }
2068
2075
  }
2076
+ if (cmd.hasOwnProperty("toplogo")) {
2077
+ if (!inIframe ) {
2078
+ document.getElementById("toplogo").src = cmd.toplogo;
2079
+ document.getElementById("toplink").setAttribute("style", "pointer-events:none");
2080
+ }
2081
+ }
2069
2082
  if (cmd.hasOwnProperty("clear")) {
2070
2083
  doTidyUp(cmd.clear);
2071
2084
  }
@@ -2266,7 +2279,8 @@ function doCommand(cmd) {
2266
2279
  return st;
2267
2280
  }};
2268
2281
  opt.onEachFeature = function (f,l) {
2269
- l.bindPopup('<pre>'+JSON.stringify(f.properties,null,' ').replace(/[\{\}"]/g,'')+'</pre>');
2282
+ var pw = '<pre>'+JSON.stringify(f.properties,null,' ').replace(/[\{\}"]/g,'')+'</pre>';
2283
+ if (pw.length > 11) { l.bindPopup(pw); }
2270
2284
  if (cmd.map.hasOwnProperty("clickable") && cmd.map.clickable === true) {
2271
2285
  l.on('click', function (e) {
2272
2286
  ws.send(JSON.stringify({action:"clickgeo",name:cmd.map.overlay,type:f.type,properties:f.properties,geometry:f.geometry}));
package/worldmap.js CHANGED
@@ -252,7 +252,7 @@ module.exports = function(RED) {
252
252
  if ((node.events.indexOf("point")!==-1) && ((message.action === "point")||(message.action === "move")||(message.action === "delete") )) {
253
253
  setImmediate(function() {node.send({payload:message, topic:node.path.substr(1), _sessionid:client.id, _sessionip:sessionip})});
254
254
  }
255
- if ((node.events.indexOf("layer")!==-1) && ((message.action === "layer") )) {
255
+ if ((node.events.indexOf("layer")!==-1) && (message.action.indexOf("layer") !== -1) ) {
256
256
  setImmediate(function() {node.send({payload:message, topic:node.path.substr(1), _sessionid:client.id, _sessionip:sessionip})});
257
257
  }
258
258
  if ((node.events.indexOf("files")!==-1) && (message.action === "file")) {