node-red-contrib-web-worldmap 5.0.6 → 5.0.7

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,6 +1,6 @@
1
1
  ### Change Log for Node-RED Worldmap
2
2
 
3
- - v5.0.6 - Tweak SIDC flag handling slightly to show direction if available and moving.
3
+ - v5.0.7 - Tweak SIDC flag handling slightly to show direction if available and moving.
4
4
  - v5.0.4 - Tweak CoT handling slightly.
5
5
  - v5.0.3 - Add great context menu example flow. PR#290. Bump express lib. PR#291.
6
6
  - v5.0.2 - Fix sidcEdgeIcon docs PR#289.
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.0.7 - Allow Tooltip options (see new example). #PR295.
16
17
  - v5.0.6 - Tweak SIDC flag handling slightly to show direction if available and moving.
17
18
  - v5.0.4 - Tweak CoT handling slightly.
18
19
  - v5.0.3 - Add great context menu example flow. PR#290. Bump express lib. PR#291.
@@ -88,6 +89,7 @@ Optional properties for **msg.payload** include
88
89
  - **popup** : html to fill the popup if you don't want the automatic default of the properties list. Using this overrides photourl, videourl and weblink options.
89
90
  - **label** : displays the contents as a permanent label next to the marker, or
90
91
  - **tooltip** : displays the contents when you hover over the marker. (Mutually exclusive with label. Label has priority)
92
+ - **tooltipOptions** : custom tooltip/label options (offset, direction, permanent, sticky, interactive, opacity, className) )
91
93
  - **contextmenu** : an html fragment to display on right click of marker - defaults to delete marker. You can specify `${name}` to substitute in the name of the marker. Set to `""` to disable just this instance.
92
94
 
93
95
  Any other `msg.payload` properties will be added to the icon popup text box. This can be
@@ -0,0 +1,83 @@
1
+ [
2
+ {
3
+ "id": "ec9da974.051b48",
4
+ "type": "inject",
5
+ "z": "f6f2187d.f17ca8",
6
+ "name": "",
7
+ "repeat": "",
8
+ "crontab": "",
9
+ "once": false,
10
+ "topic": "",
11
+ "payload": "",
12
+ "payloadType": "str",
13
+ "x": 1010,
14
+ "y": 560,
15
+ "wires": [
16
+ [
17
+ "f77a7ed4.f955d"
18
+ ]
19
+ ]
20
+ },
21
+ {
22
+ "id": "f77a7ed4.f955d",
23
+ "type": "function",
24
+ "z": "f6f2187d.f17ca8",
25
+ "name": "Car + Label",
26
+ "func": "var thing = {\n name:\"Jason Isaacs\", \n lat:51, \n lon:-1.45,\n icon:\"car\",\n iconColor:\"darkred\",\n extrainfo:\"Hello to Jason Isaacs\",\n label:\"This is a custom label\",\n tooltipOptions: {\"offset\" : [-100,-100], \"permanent\" : true, \"opacity\" : 1, \"direction\" : \"top\", \"className\" : \"tooltip\"}\n};\nmsg.payload = thing;\nreturn msg;",
27
+ "outputs": 1,
28
+ "timeout": "",
29
+ "noerr": 0,
30
+ "initialize": "",
31
+ "finalize": "",
32
+ "libs": [],
33
+ "x": 1230,
34
+ "y": 560,
35
+ "wires": [
36
+ [
37
+ "f83930ff.b21488"
38
+ ]
39
+ ]
40
+ },
41
+ {
42
+ "id": "cd09f7be.079518",
43
+ "type": "comment",
44
+ "z": "f6f2187d.f17ca8",
45
+ "name": "Simple map - click inject to send info to map.",
46
+ "info": "Adds a map at http://(your-server-ip):1880/worldmap. \n\nThe `function` node creates an object with some basic properties required to add to a map.",
47
+ "x": 1170,
48
+ "y": 500,
49
+ "wires": []
50
+ },
51
+ {
52
+ "id": "f83930ff.b21488",
53
+ "type": "worldmap",
54
+ "z": "f6f2187d.f17ca8",
55
+ "name": "",
56
+ "lat": "",
57
+ "lon": "",
58
+ "zoom": "",
59
+ "layer": "OSMG",
60
+ "cluster": "",
61
+ "maxage": "",
62
+ "usermenu": "show",
63
+ "layers": "show",
64
+ "panit": "false",
65
+ "panlock": "false",
66
+ "zoomlock": "false",
67
+ "hiderightclick": "false",
68
+ "coords": "none",
69
+ "showgrid": "false",
70
+ "showruler": "true",
71
+ "allowFileDrop": "false",
72
+ "path": "/worldmap",
73
+ "overlist": "DR,CO,RA,DN,HM",
74
+ "maplist": "OSMG,OSMC,EsriC,EsriS,EsriT,EsriO,EsriDG,NatGeo,UKOS,OpTop",
75
+ "mapname": "",
76
+ "mapurl": "",
77
+ "mapopt": "",
78
+ "mapwms": false,
79
+ "x": 1400,
80
+ "y": 560,
81
+ "wires": []
82
+ }
83
+ ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-web-worldmap",
3
- "version": "5.0.6",
3
+ "version": "5.0.7",
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.1.0",
@@ -2289,10 +2289,10 @@ function setMarker(data) {
2289
2289
  // If .label then use that rather than name tooltip
2290
2290
  if (data.label) {
2291
2291
  if (typeof data.label === "boolean" && data.label === true) {
2292
- marker.bindTooltip(data["name"], { permanent:true, direction:"right", offset:labelOffset });
2292
+ marker.bindTooltip(data["name"], data.tooltipOptions || { permanent:true, direction:"right", offset:labelOffset });
2293
2293
  }
2294
2294
  else if (typeof data.label === "string" && data.label.length > 0) {
2295
- marker.bindTooltip(data.label, { permanent:true, direction:"right", offset:labelOffset });
2295
+ marker.bindTooltip(data.label, data.tooltipOptions || { permanent:true, direction:"right", offset:labelOffset });
2296
2296
  }
2297
2297
  delete marker.options.title;
2298
2298
  delete data.label;
@@ -2300,7 +2300,7 @@ function setMarker(data) {
2300
2300
  // otherwise check for .tooltip then use that rather than name tooltip
2301
2301
  else if (data.tooltip) {
2302
2302
  if (typeof data.tooltip === "string" && data.tooltip.length > 0) {
2303
- marker.bindTooltip(data.tooltip, { direction:"bottom", offset:[0,4] });
2303
+ marker.bindTooltip(data.tooltip, data.tooltipOptions || { direction:"bottom", offset:[0,4] });
2304
2304
  delete marker.options.title;
2305
2305
  delete data.tooltip;
2306
2306
  }
@@ -2387,7 +2387,7 @@ function setMarker(data) {
2387
2387
  var track = data.track ?? data.COG ?? data.cog ?? data.hdg ?? data.heading ?? data.bearing;
2388
2388
  if (track != undefined) { // if there is a heading
2389
2389
  // Speed is in m/s
2390
- if (data.speed != null && data.length === undefined) { // and a speed - lets convert to a leader length
2390
+ if (data.speed != null && data.length === undefined && !data?.SIDC) { // and a speed - lets convert to a leader length
2391
2391
  data.length = parseFloat(data.speed || "0") * 60;
2392
2392
  var re1 = new RegExp('kn|knot|kt|kts','i');
2393
2393
  var re2 = new RegExp('kph|kmh','i');