node-red-contrib-web-worldmap 2.21.8 → 2.22.2

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.22.2 - Be more tolerant of speed string types
4
+ - v2.22.0 - Separate out layer events in worldmap in
5
+ - v2.21.9 - Unbreak Drawing layer that I must have broken recently
3
6
  - v2.21.8 - Let SIDC/icon short code be only 4 chars long
4
7
  - v2.21.5 - Fix handling of "old" ship nav to ship navigation
5
8
  - v2.21.4 - Fix speed leader length. Add transparentPixels option.
package/README.md CHANGED
@@ -11,6 +11,9 @@ map web page for plotting "things" on.
11
11
 
12
12
  ### Updates
13
13
 
14
+ - v2.22.2 - Be more tolerant of speed string types
15
+ - v2.22.0 - Separate out layer events in worldmap in
16
+ - v2.21.9 - Unbreak Drawing layer that I must have broken recently
14
17
  - v2.21.8 - Let SIDC/icon short code be only 4 chars long
15
18
  - v2.21.5 - Fix handling of "old" ship nav to ship navigation
16
19
  - v2.21.4 - Fix speed leader length. Add transparentPixels option..
@@ -29,13 +32,6 @@ map web page for plotting "things" on.
29
32
  - v2.16.3 - Ensure polygons can be deleted.
30
33
  - v2.16.2 - Better handling of unpacked kmz objects.
31
34
  - v2.16.0 - Allow specifying custom base map server.
32
- - v2.15.8 - Adjust ui check timing for UI worldmap.
33
- - v2.15.7 - Tidy up geoJson handling a bit more.
34
- - v2.15.5 - Fix SIDC icons to accept unicoded icons as labels.
35
- - v2.15.4 - Let clear heatmap command do what it says.
36
- - v2.15.3 - Fix panit command to work, try to use alt units, popup alignments.
37
- - v2.15.0 - Let speed be text and specify units if required (kt,kn,knots,mph,kmh,kph) default m/s.
38
- - v2.14.0 - Let geojson features be clickable if added as overlay.
39
35
 
40
36
  - see [CHANGELOG](https://github.com/dceejay/RedMap/blob/master/CHANGELOG.md) for full list of changes.
41
37
 
@@ -464,6 +460,13 @@ Or with an input box
464
460
  contextmenu: '<input name="slide1" type="range" min="1" max="100" value="50" onchange=\'feedback(this.name,this.value,"myEventName")\' >'
465
461
  }
466
462
 
463
+ Example simple form
464
+
465
+ ```
466
+ [{"id":"7351100bacb1f5fe","type":"function","z":"4aa2ed2fd1b11362","name":"","func":"msg.payload = { command: {\ncontextmenu: String.raw`\nText <input type=\"text\" id=\"sometext\" value=\"hello\"><br/>\nNumber <input type=\"number\" id=\"somenum\" value=\"5\"><br/>\n<input type=\"button\" value=\"Send\" onclick=\n'feedback(\"myform\",{\n \"st\":document.getElementById(\"sometext\").value,\n \"sn\":document.getElementById(\"somenum\").value,\n})'\n>\n`\n}}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":350,"y":360,"wires":[["a6a82f2e8efc44fc"]]},{"id":"7b595f0c8f6ac710","type":"worldmap in","z":"4aa2ed2fd1b11362","name":"","path":"/worldmap","events":"connect","x":195,"y":360,"wires":[["7351100bacb1f5fe"]]}]
467
+ ```
468
+
469
+
467
470
  See the section on **Utility Functions** for details of the feedback function.
468
471
 
469
472
  #### To add and remove a legend
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-web-worldmap",
3
- "version": "2.21.8",
3
+ "version": "2.22.2",
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",
@@ -28,7 +28,10 @@ var heat;
28
28
  var minimap;
29
29
  var sidebyside;
30
30
  var layercontrol;
31
+ var drawControl;
31
32
  var drawingColour = "#910000";
33
+ var sendRoute;
34
+ var sendDrawing;
32
35
 
33
36
  var iconSz = {
34
37
  "Team/Crew": 24,
@@ -930,7 +933,7 @@ var addOverlays = function(overlist) {
930
933
  overlays["drawing"] = layers["_drawing"];
931
934
  map.options.drawControlTooltips = false;
932
935
  var drawCount = 0;
933
- var drawControl = new L.Control.Draw({
936
+ drawControl = new L.Control.Draw({
934
937
  draw: {
935
938
  polyline: { shapeOptions: { clickable:true } },
936
939
  marker: false,
@@ -996,7 +999,7 @@ var addOverlays = function(overlist) {
996
999
  setTimeout(function() {map.openPopup(rightmenuMarker)},25);
997
1000
  });
998
1001
 
999
- var sendDrawing = function(n) {
1002
+ sendDrawing = function(n) {
1000
1003
  var thing = document.getElementById('dinput').value;
1001
1004
  map.closePopup();
1002
1005
  shape.m.name = thing;
@@ -1079,7 +1082,7 @@ var addOverlays = function(overlist) {
1079
1082
  return numbers;
1080
1083
  }
1081
1084
 
1082
- var sendRoute = function(n) {
1085
+ sendRoute = function(n) {
1083
1086
  var p = (polygons[n]._latlngs.map(function(x) {
1084
1087
  return x.lng+","+x.lat;
1085
1088
  })).join(';');
@@ -1337,7 +1340,7 @@ function setMarker(data) {
1337
1340
  }
1338
1341
 
1339
1342
  // console.log("DATA", typeof data, data);
1340
- if (data.deleted) { // remove markers we are told to
1343
+ if (data.deleted == true) { // remove markers we are told to
1341
1344
  delMarker(data.name);
1342
1345
  return;
1343
1346
  }
@@ -1951,7 +1954,7 @@ function setMarker(data) {
1951
1954
  if (data.dashArray) { delete data.dashArray; }
1952
1955
  if (data.fill) { delete data.fill; }
1953
1956
  if (data.draggable) { delete data.draggable; }
1954
- if (!isNaN(data.speed)) { data.speed = data.speed.toFixed(2); }
1957
+ //if (!isNaN(data.speed)) { data.speed = data.speed.toFixed(2); }
1955
1958
  if (data.hasOwnProperty("clickable")) { delete data.clickable; }
1956
1959
  if (data.hasOwnProperty("fillColor")) { delete data.fillColor; }
1957
1960
  if (data.hasOwnProperty("radius")) { delete data.radius; }
package/worldmap.html CHANGED
@@ -604,7 +604,7 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
604
604
  defaults: {
605
605
  name: {value:""},
606
606
  path: {value:"/worldmap"},
607
- events: {value:"connect,disconnect,point,bounds,files,draw,other"}
607
+ events: {value:"connect,disconnect,point,layer,bounds,files,draw,other"}
608
608
  },
609
609
  inputs:0,
610
610
  outputs:1,
@@ -620,7 +620,7 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
620
620
  },
621
621
  oneditprepare: function() {
622
622
  if ($("#node-input-events").val() === "all") {
623
- $("#node-input-events").val("connect,disconnect,point,bounds,files,draw,other");
623
+ $("#node-input-events").val("connect,disconnect,point,layer,bounds,files,draw,other");
624
624
  }
625
625
  $("#node-input-events").typedInput({type:"event", types:[{
626
626
  value: "event",
@@ -629,6 +629,7 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
629
629
  { value: "connect", label: "Connect"},
630
630
  { value: "disconnect", label: "Disconnect"},
631
631
  { value: "point", label: "Add, move, delete point"},
632
+ { value: "layer", label: "Add, remove layers"},
632
633
  { value: "bounds", label: "Boundary change"},
633
634
  { value: "files", label: "File drop"},
634
635
  { value: "draw", label: "Drawing"},
package/worldmap.js CHANGED
@@ -252,6 +252,9 @@ 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.indexOf("layer") !== -1) ) {
256
+ setImmediate(function() {node.send({payload:message, topic:node.path.substr(1), _sessionid:client.id, _sessionip:sessionip})});
257
+ }
255
258
  if ((node.events.indexOf("files")!==-1) && (message.action === "file")) {
256
259
  message.content = Buffer.from(message.content.split('base64,')[1], 'base64');
257
260
  setImmediate(function() {node.send({payload:message, topic:node.path.substr(1), _sessionid:client.id, _sessionip:sessionip})});