node-red-contrib-web-worldmap 5.1.6 → 5.2.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,6 @@
1
1
  ### Change Log for Node-RED Worldmap
2
2
 
3
+ - v5.2.0 - Allow left click send back co-ords. Let Button be replaceable more easily and take value property. Issue #308 and #309
3
4
  - v5.1.6 - Let Cot __milsym set the SIDC if present.
4
5
  - v5.1.5 - Fix links to SIDC unitgenerator so it is now local.
5
6
  - v5.1.4 - Fix clearlayer for tracks node.
@@ -8,13 +9,13 @@
8
9
  - v5.1.0 - Let special icons be sizeable using iconSize property.
9
10
  - v5.0.9 - Slight tidy on flags, bump turf dep.
10
11
  - v5.0.8 - Fix flag handling for SIDC 2525D, add example.
11
- - v5.0.7 - Allow Tooltip options (see new example). #PR295.
12
+ - v5.0.7 - Allow Tooltip options (see new example). PR #295.
12
13
  - v5.0.6 - Tweak SIDC flag handling slightly to show direction if available and moving.
13
14
  - v5.0.4 - Tweak CoT handling slightly.
14
- - v5.0.3 - Add great context menu example flow. PR#290. Bump express lib. PR#291.
15
- - v5.0.2 - Fix sidcEdgeIcon docs PR#289.
15
+ - v5.0.3 - Add great context menu example flow. PR #290. Bump express lib. PR #291.
16
+ - v5.0.2 - Fix sidcEdgeIcon docs PR #289.
16
17
  - v5.0.1 - Fix isArray error PR #288.
17
- - v5.0.0 - Feedback cleanup PR#281, edgeicons option PR#287, bump libs for vuln fixes.
18
+ - v5.0.0 - Feedback cleanup PR #281, edgeicons option PR #287, bump libs for vuln fixes.
18
19
  - v4.9.0 - If payload.flag is two char ISO code replace it with flag emoji. Revert part of PR #271
19
20
  - v4.8.1 - Slight tidy of some of the geojson handling
20
21
  - v4.8.0 - Merged PR for feedback functionality cleanup and example. PR #271 and #272
package/README.md CHANGED
@@ -13,6 +13,7 @@ Feel free to [![](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%
13
13
 
14
14
  ### Updates
15
15
 
16
+ - v5.2.0 - Allow left click send back co-ords. Let Button be replaceable more easily and take value property. Issue #308 and #309
16
17
  - v5.1.6 - Let Cot __milsym set the SIDC if present.
17
18
  - v5.1.5 - Fix links to SIDC unitgenerator so it is now local.
18
19
  - v5.1.4 - Fix clearlayer for tracks node.
@@ -21,13 +22,13 @@ Feel free to [![](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%
21
22
  - v5.1.0 - Let special icons be sizeable using iconSize property.
22
23
  - v5.0.9 - Slight tidy on flags, bump turf dep.
23
24
  - v5.0.8 - Fix flag handling for SIDC 2525D, add example.
24
- - v5.0.7 - Allow Tooltip options (see new example). #PR295.
25
+ - v5.0.7 - Allow Tooltip options (see new example). PR #295.
25
26
  - v5.0.6 - Tweak SIDC flag handling slightly to show direction if available and moving.
26
27
  - v5.0.4 - Tweak CoT handling slightly.
27
- - v5.0.3 - Add great context menu example flow. PR#290. Bump express lib. PR#291.
28
- - v5.0.2 - Fix sidcEdgeIcon docs PR#289.
28
+ - v5.0.3 - Add great context menu example flow. PR #290. Bump express lib. PR #291.
29
+ - v5.0.2 - Fix sidcEdgeIcon docs PR #289.
29
30
  - v5.0.1 - Fix isArray error PR #288.
30
- - v5.0.0 - v5.0.0 - Feedback cleanup PR#281, edgeicons option PR#287, bump libs for vuln fixes.
31
+ - v5.0.0 - v5.0.0 - Feedback cleanup PR #281, edgeicons option PR #287, bump libs for vuln fixes.
31
32
 
32
33
 
33
34
  - see [CHANGELOG](https://github.com/dceejay/RedMap/blob/master/CHANGELOG.md) for full list of changes.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-web-worldmap",
3
- "version": "5.1.6",
3
+ "version": "5.2.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": "~7.2.0",
@@ -938,9 +938,9 @@ var feedback = function(n = "map",v,a = "feedback",c) {
938
938
  if (c === true) { map.closePopup(); }
939
939
  }
940
940
 
941
- // map.on('click', function(e) {
942
- // ws.send(JSON.stringify({action:"click", lat:e.latlng.lat.toFixed(5), lon:e.latlng.lng.toFixed(5)}));
943
- // });
941
+ map.on('click', function(e) {
942
+ ws.send(JSON.stringify({action:"click", lat:e.latlng.lat.toFixed(5), lon:e.latlng.lng.toFixed(5)}));
943
+ });
944
944
 
945
945
  // allow double right click to zoom out (if enabled)
946
946
  // single right click opens a message window that adds a marker
@@ -1966,7 +1966,6 @@ function setMarker(data) {
1966
1966
  iconAnchor: [sizc, sizc],
1967
1967
  html:'<img src="'+svgarrow+'" style="width:'+siz+'px; height:'+siz+'px; -webkit-transform:rotate('+dir+'deg); -moz-transform:rotate('+dir+'deg);"/>',
1968
1968
  });
1969
- console.log("MM",myMarker)
1970
1969
  marker = L.marker(ll, {title:data["name"], icon:myMarker, draggable:drag});
1971
1970
  }
1972
1971
  else if (data.icon === "wind") {
@@ -2602,14 +2601,17 @@ function doCommand(cmd) {
2602
2601
  if (cmd.hasOwnProperty("button")) {
2603
2602
  if (!Array.isArray(cmd.button)) { cmd.button = [cmd.button]; }
2604
2603
  cmd.button.forEach(function(b) {
2605
- if (b.icon) {
2606
- if (!buttons[b.name]) {
2607
- buttons[b.name] = L.easyButton( b.icon, function() {
2608
- ws.send(JSON.stringify({action:"button", name:b.name}));
2609
- }, b.name, { position:b.position||'topright' }).addTo(map);
2604
+ if (b.name && b.icon) {
2605
+ if (buttons[b.name]) {
2606
+ buttons[b.name].removeFrom(map);
2607
+ delete buttons[b.name];
2610
2608
  }
2609
+ buttons[b.name] = L.easyButton( b.icon, function() {
2610
+ ws.send(JSON.stringify({action:"button", name:b.name, value:b?.value}));
2611
+ }, b.name, { position:b.position||'topright' });
2612
+ buttons[b.name].addTo(map);
2611
2613
  }
2612
- else {
2614
+ else if (b.name && !b.icon){
2613
2615
  if (buttons[b.name]) {
2614
2616
  buttons[b.name].removeFrom(map);
2615
2617
  delete buttons[b.name];
package/worldmap.html CHANGED
@@ -667,6 +667,7 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
667
667
  { value: "layer", label: "Add, remove layers"},
668
668
  { value: "bounds", label: "Boundary change"},
669
669
  { value: "files", label: "File drop"},
670
+ { value: "click", label: "Click on map"},
670
671
  { value: "other", label: "All other"}
671
672
  ]
672
673
  }]});
package/worldmap.js CHANGED
@@ -323,7 +323,7 @@ module.exports = function(RED) {
323
323
  var WorldMapIn = function(n) {
324
324
  RED.nodes.createNode(this,n);
325
325
  this.path = n.path || "/worldmap";
326
- this.events = n.events || "connect,disconnect,point,layer,bounds,files,draw,other";
326
+ this.events = n.events || "connect,disconnect,point,layer,bounds,files,draw,click,other";
327
327
  if (this.path.charAt(0) != "/") { this.path = "/" + this.path; }
328
328
  if (!sockets[this.path]) {
329
329
  var libPath = path.posix.join(RED.settings.httpNodeRoot, this.path, 'leaflet', 'sockjs.min.js');
@@ -349,6 +349,9 @@ module.exports = function(RED) {
349
349
  if ((node.events.indexOf("bounds")!==-1) && (message.action === "bounds")) {
350
350
  setImmediate(function() {node.send({payload:message, topic:node.path.substr(1), _sessionid:client.id, _sessionip:sessionip})});
351
351
  }
352
+ if ((node.events.indexOf("click")!==-1) && (message.action === "click")) {
353
+ setImmediate(function() {node.send({payload:message, topic:node.path.substr(1), _sessionid:client.id, _sessionip:sessionip})});
354
+ }
352
355
  if ((node.events.indexOf("point")!==-1) && ((message.action === "point")||(message.action === "move")||(message.action === "delete") )) {
353
356
  setImmediate(function() {node.send({payload:message, topic:node.path.substr(1), _sessionid:client.id, _sessionip:sessionip})});
354
357
  }
@@ -362,7 +365,7 @@ module.exports = function(RED) {
362
365
  if ((node.events.indexOf("draw")!==-1) && ((message.action === "draw")||(message.action === "drawdelete"))) {
363
366
  setImmediate(function() {node.send({payload:message, topic:node.path.substr(1), _sessionid:client.id, _sessionip:sessionip})});
364
367
  }
365
- if (node.events.indexOf("other")!==-1 && "connected,point,addlayer,dellayer,delete,move,draw,drawdelete,files,bounds".indexOf(message.action) === -1) {
368
+ if (node.events.indexOf("other")!==-1 && "connected,point,addlayer,dellayer,delete,move,draw,drawdelete,files,bounds,click".indexOf(message.action) === -1) {
366
369
  setImmediate(function() {node.send({payload:message, topic:node.path.substr(1), _sessionid:client.id, _sessionip:sessionip})});
367
370
  }
368
371
  }