node-red-contrib-web-worldmap 5.1.6 → 5.3.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 +6 -4
- package/README.md +7 -5
- package/node_modules/compression/HISTORY.md +6 -0
- package/node_modules/compression/README.md +4 -4
- package/node_modules/compression/package.json +4 -4
- package/node_modules/on-headers/HISTORY.md +5 -0
- package/node_modules/on-headers/README.md +7 -7
- package/node_modules/on-headers/index.js +50 -2
- package/node_modules/on-headers/package.json +16 -14
- package/package.json +2 -2
- package/worldmap/worldmap.js +40 -32
- package/worldmap.html +1 -0
- package/worldmap.js +5 -2
- package/node-red-contrib-web-worldmap-5.1.6.tgz +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
### Change Log for Node-RED Worldmap
|
|
2
2
|
|
|
3
|
+
- v5.3.0 - Let msg.payload.popupOptions object set Leaflet popup options so it can be customised. Issue #311
|
|
4
|
+
- 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
5
|
- v5.1.6 - Let Cot __milsym set the SIDC if present.
|
|
4
6
|
- v5.1.5 - Fix links to SIDC unitgenerator so it is now local.
|
|
5
7
|
- v5.1.4 - Fix clearlayer for tracks node.
|
|
@@ -8,13 +10,13 @@
|
|
|
8
10
|
- v5.1.0 - Let special icons be sizeable using iconSize property.
|
|
9
11
|
- v5.0.9 - Slight tidy on flags, bump turf dep.
|
|
10
12
|
- v5.0.8 - Fix flag handling for SIDC 2525D, add example.
|
|
11
|
-
- v5.0.7 - Allow Tooltip options (see new example). #
|
|
13
|
+
- v5.0.7 - Allow Tooltip options (see new example). PR #295.
|
|
12
14
|
- v5.0.6 - Tweak SIDC flag handling slightly to show direction if available and moving.
|
|
13
15
|
- 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.
|
|
16
|
+
- v5.0.3 - Add great context menu example flow. PR #290. Bump express lib. PR #291.
|
|
17
|
+
- v5.0.2 - Fix sidcEdgeIcon docs PR #289.
|
|
16
18
|
- 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.
|
|
19
|
+
- v5.0.0 - Feedback cleanup PR #281, edgeicons option PR #287, bump libs for vuln fixes.
|
|
18
20
|
- v4.9.0 - If payload.flag is two char ISO code replace it with flag emoji. Revert part of PR #271
|
|
19
21
|
- v4.8.1 - Slight tidy of some of the geojson handling
|
|
20
22
|
- v4.8.0 - Merged PR for feedback functionality cleanup and example. PR #271 and #272
|
package/README.md
CHANGED
|
@@ -13,6 +13,8 @@ Feel free to [. #
|
|
26
|
+
- v5.0.7 - Allow Tooltip options (see new example). PR #295.
|
|
25
27
|
- v5.0.6 - Tweak SIDC flag handling slightly to show direction if available and moving.
|
|
26
28
|
- 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.
|
|
29
|
+
- v5.0.3 - Add great context menu example flow. PR #290. Bump express lib. PR #291.
|
|
30
|
+
- v5.0.2 - Fix sidcEdgeIcon docs PR #289.
|
|
29
31
|
- v5.0.1 - Fix isArray error PR #288.
|
|
30
|
-
- v5.0.0 -
|
|
31
|
-
|
|
32
|
+
- v5.0.0 - Feedback cleanup PR #281, edgeicons option PR #287, bump libs for vuln fixes.
|
|
32
33
|
|
|
33
34
|
- see [CHANGELOG](https://github.com/dceejay/RedMap/blob/master/CHANGELOG.md) for full list of changes.
|
|
34
35
|
|
|
@@ -76,6 +77,7 @@ Optional properties for **msg.payload** include
|
|
|
76
77
|
- **clickable** : Default true. Setting to false disables showing any popup.
|
|
77
78
|
- **popped** : set to true to automatically open the popup info box, set to false to close it.
|
|
78
79
|
- **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.
|
|
80
|
+
- **popupOptions** : optional object to help style the popup - See Leaflet popup docs for options - eg to add a custom class - `{className:"mySpecialPopup",width:600}`
|
|
79
81
|
- **label** : displays the contents as a permanent label next to the marker, or
|
|
80
82
|
- **tooltip** : displays the contents when you hover over the marker. (Mutually exclusive with label. Label has priority)
|
|
81
83
|
- **tooltipOptions** : custom tooltip/label options (offset, direction, permanent, sticky, interactive, opacity, className) )
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
1.8.1 / 2025-07-17
|
|
2
|
+
==========
|
|
3
|
+
|
|
4
|
+
* deps: on-headers@~1.1.0
|
|
5
|
+
- Fix [CVE-2025-7339](https://www.cve.org/CVERecord?id=CVE-2025-7339) ([GHSA-76c9-3jph-rj3q](https://github.com/expressjs/on-headers/security/advisories/GHSA-76c9-3jph-rj3q))
|
|
6
|
+
|
|
1
7
|
1.8.0 / 2025-02-10
|
|
2
8
|
==================
|
|
3
9
|
|
|
@@ -46,7 +46,7 @@ as compressing will transform the body.
|
|
|
46
46
|
#### Options
|
|
47
47
|
|
|
48
48
|
`compression()` accepts these properties in the options object. In addition to
|
|
49
|
-
those listed below, [zlib](
|
|
49
|
+
those listed below, [zlib](https://nodejs.org/api/zlib.html) options may be
|
|
50
50
|
passed in to the options object or
|
|
51
51
|
[brotli](https://nodejs.org/api/zlib.html#zlib_class_brotlioptions) options.
|
|
52
52
|
|
|
@@ -55,7 +55,7 @@ passed in to the options object or
|
|
|
55
55
|
Type: `Number`<br>
|
|
56
56
|
Default: `zlib.constants.Z_DEFAULT_CHUNK`, or `16384`.
|
|
57
57
|
|
|
58
|
-
See [Node.js documentation](
|
|
58
|
+
See [Node.js documentation](https://nodejs.org/api/zlib.html#zlib_memory_usage_tuning)
|
|
59
59
|
regarding the usage.
|
|
60
60
|
|
|
61
61
|
##### filter
|
|
@@ -107,7 +107,7 @@ This specifies how much memory should be allocated for the internal compression
|
|
|
107
107
|
state and is an integer in the range of `1` (minimum level) and `9` (maximum
|
|
108
108
|
level).
|
|
109
109
|
|
|
110
|
-
See [Node.js documentation](
|
|
110
|
+
See [Node.js documentation](https://nodejs.org/api/zlib.html#zlib_memory_usage_tuning)
|
|
111
111
|
regarding the usage.
|
|
112
112
|
|
|
113
113
|
##### brotli
|
|
@@ -161,7 +161,7 @@ set a `Content-Length` response header.
|
|
|
161
161
|
Type: `Number`<br>
|
|
162
162
|
Default: `zlib.constants.Z_DEFAULT_WINDOWBITS`, or `15`
|
|
163
163
|
|
|
164
|
-
See [Node.js documentation](
|
|
164
|
+
See [Node.js documentation](https://nodejs.org/api/zlib.html#zlib_memory_usage_tuning)
|
|
165
165
|
regarding the usage.
|
|
166
166
|
|
|
167
167
|
##### enforceEncoding
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "compression",
|
|
3
3
|
"description": "Node.js compression middleware",
|
|
4
|
-
"version": "1.8.
|
|
4
|
+
"version": "1.8.1",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Douglas Christopher Wilson <doug@somethingdoug.com>",
|
|
7
7
|
"Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"compressible": "~2.0.18",
|
|
15
15
|
"debug": "2.6.9",
|
|
16
16
|
"negotiator": "~0.6.4",
|
|
17
|
-
"on-headers": "~1.0
|
|
17
|
+
"on-headers": "~1.1.0",
|
|
18
18
|
"safe-buffer": "5.2.1",
|
|
19
19
|
"vary": "~1.1.2"
|
|
20
20
|
},
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
"after": "0.8.2",
|
|
23
23
|
"eslint": "7.32.0",
|
|
24
24
|
"eslint-config-standard": "14.1.1",
|
|
25
|
-
"eslint-plugin-import": "2.
|
|
25
|
+
"eslint-plugin-import": "2.32.0",
|
|
26
26
|
"eslint-plugin-markdown": "2.2.1",
|
|
27
27
|
"eslint-plugin-node": "11.1.0",
|
|
28
28
|
"eslint-plugin-promise": "5.2.0",
|
|
29
29
|
"eslint-plugin-standard": "4.1.0",
|
|
30
30
|
"mocha": "9.2.2",
|
|
31
31
|
"nyc": "15.1.0",
|
|
32
|
-
"supertest": "6.
|
|
32
|
+
"supertest": "6.3.4"
|
|
33
33
|
},
|
|
34
34
|
"files": [
|
|
35
35
|
"LICENSE",
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
[![NPM Version][npm-version-image]][npm-url]
|
|
4
4
|
[![NPM Downloads][npm-downloads-image]][npm-url]
|
|
5
|
-
[![Node.js Version][node-
|
|
6
|
-
[![Build Status][
|
|
7
|
-
[![
|
|
5
|
+
[![Node.js Version][node-image]][node-url]
|
|
6
|
+
[![Build Status][ci-image]][ci-url]
|
|
7
|
+
[![Coverage Status][coveralls-image]][coveralls-url]
|
|
8
8
|
|
|
9
9
|
Execute a listener when a response is about to write headers.
|
|
10
10
|
|
|
@@ -70,12 +70,12 @@ $ npm test
|
|
|
70
70
|
|
|
71
71
|
[MIT](LICENSE)
|
|
72
72
|
|
|
73
|
+
[ci-image]: https://badgen.net/github/checks/jshttp/on-headers/master?label=ci
|
|
74
|
+
[ci-url]: https://github.com/jshttp/on-headers/actions/workflows/ci.yml
|
|
73
75
|
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/on-headers/master
|
|
74
76
|
[coveralls-url]: https://coveralls.io/r/jshttp/on-headers?branch=master
|
|
75
|
-
[node-
|
|
76
|
-
[node-
|
|
77
|
+
[node-image]: https://badgen.net/npm/node/on-headers
|
|
78
|
+
[node-url]: https://nodejs.org/en/download
|
|
77
79
|
[npm-downloads-image]: https://badgen.net/npm/dm/on-headers
|
|
78
80
|
[npm-url]: https://npmjs.org/package/on-headers
|
|
79
81
|
[npm-version-image]: https://badgen.net/npm/v/on-headers
|
|
80
|
-
[travis-image]: https://badgen.net/travis/jshttp/on-headers/master
|
|
81
|
-
[travis-url]: https://travis-ci.org/jshttp/on-headers
|
|
@@ -13,6 +13,12 @@
|
|
|
13
13
|
|
|
14
14
|
module.exports = onHeaders
|
|
15
15
|
|
|
16
|
+
var http = require('http')
|
|
17
|
+
|
|
18
|
+
// older node versions don't have appendHeader
|
|
19
|
+
var isAppendHeaderSupported = typeof http.ServerResponse.prototype.appendHeader === 'function'
|
|
20
|
+
var set1dArray = isAppendHeaderSupported ? set1dArrayWithAppend : set1dArrayWithSet
|
|
21
|
+
|
|
16
22
|
/**
|
|
17
23
|
* Create a replacement writeHead method.
|
|
18
24
|
*
|
|
@@ -74,8 +80,16 @@ function onHeaders (res, listener) {
|
|
|
74
80
|
*/
|
|
75
81
|
|
|
76
82
|
function setHeadersFromArray (res, headers) {
|
|
77
|
-
|
|
78
|
-
|
|
83
|
+
if (headers.length && Array.isArray(headers[0])) {
|
|
84
|
+
// 2D
|
|
85
|
+
set2dArray(res, headers)
|
|
86
|
+
} else {
|
|
87
|
+
// 1D
|
|
88
|
+
if (headers.length % 2 !== 0) {
|
|
89
|
+
throw new TypeError('headers array is malformed')
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
set1dArray(res, headers)
|
|
79
93
|
}
|
|
80
94
|
}
|
|
81
95
|
|
|
@@ -130,3 +144,37 @@ function setWriteHeadHeaders (statusCode) {
|
|
|
130
144
|
|
|
131
145
|
return args
|
|
132
146
|
}
|
|
147
|
+
|
|
148
|
+
function set2dArray (res, headers) {
|
|
149
|
+
var key
|
|
150
|
+
for (var i = 0; i < headers.length; i++) {
|
|
151
|
+
key = headers[i][0]
|
|
152
|
+
if (key) {
|
|
153
|
+
res.setHeader(key, headers[i][1])
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function set1dArrayWithAppend (res, headers) {
|
|
159
|
+
for (var i = 0; i < headers.length; i += 2) {
|
|
160
|
+
res.removeHeader(headers[i])
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
var key
|
|
164
|
+
for (var j = 0; j < headers.length; j += 2) {
|
|
165
|
+
key = headers[j]
|
|
166
|
+
if (key) {
|
|
167
|
+
res.appendHeader(key, headers[j + 1])
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function set1dArrayWithSet (res, headers) {
|
|
173
|
+
var key
|
|
174
|
+
for (var i = 0; i < headers.length; i += 2) {
|
|
175
|
+
key = headers[i]
|
|
176
|
+
if (key) {
|
|
177
|
+
res.setHeader(key, headers[i + 1])
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "on-headers",
|
|
3
3
|
"description": "Execute a listener when a response is about to write headers",
|
|
4
|
-
"version": "1.0
|
|
4
|
+
"version": "1.1.0",
|
|
5
5
|
"author": "Douglas Christopher Wilson <doug@somethingdoug.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"keywords": [
|
|
@@ -12,16 +12,16 @@
|
|
|
12
12
|
],
|
|
13
13
|
"repository": "jshttp/on-headers",
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"eslint": "
|
|
16
|
-
"eslint-config-standard": "
|
|
17
|
-
"eslint-plugin-import": "2.
|
|
18
|
-
"eslint-plugin-markdown": "1.0.
|
|
19
|
-
"eslint-plugin-node": "
|
|
20
|
-
"eslint-plugin-promise": "4.
|
|
21
|
-
"eslint-plugin-standard": "4.0.
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"supertest": "
|
|
15
|
+
"eslint": "6.8.0",
|
|
16
|
+
"eslint-config-standard": "14.1.1",
|
|
17
|
+
"eslint-plugin-import": "2.21.2",
|
|
18
|
+
"eslint-plugin-markdown": "1.0.2",
|
|
19
|
+
"eslint-plugin-node": "11.1.0",
|
|
20
|
+
"eslint-plugin-promise": "4.2.1",
|
|
21
|
+
"eslint-plugin-standard": "4.0.1",
|
|
22
|
+
"mocha": "10.2.0",
|
|
23
|
+
"nyc": "15.1.0",
|
|
24
|
+
"supertest": "4.0.2"
|
|
25
25
|
},
|
|
26
26
|
"files": [
|
|
27
27
|
"LICENSE",
|
|
@@ -34,9 +34,11 @@
|
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"lint": "eslint --plugin markdown --ext js,md .",
|
|
37
|
-
"test": "mocha --reporter spec --
|
|
38
|
-
"test-
|
|
39
|
-
"test-
|
|
37
|
+
"test": "mocha --reporter spec --check-leaks test/test.js",
|
|
38
|
+
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
|
|
39
|
+
"test-cov": "nyc --reporter=html --reporter=text npm test",
|
|
40
|
+
"update-upstream-hashes": "node scripts/update-upstream-hashes.js",
|
|
41
|
+
"upstream": "mocha --reporter spec --check-leaks test/upstream.js",
|
|
40
42
|
"version": "node scripts/version-history.js && git add HISTORY.md"
|
|
41
43
|
}
|
|
42
44
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-web-worldmap",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.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",
|
|
7
7
|
"cgi": "0.3.1",
|
|
8
|
-
"compression": "^1.8.
|
|
8
|
+
"compression": "^1.8.1",
|
|
9
9
|
"express": "^4.21.2",
|
|
10
10
|
"sockjs": "~0.3.24"
|
|
11
11
|
},
|
package/worldmap/worldmap.js
CHANGED
|
@@ -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
|
-
|
|
942
|
-
|
|
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") {
|
|
@@ -2359,31 +2358,37 @@ function setMarker(data) {
|
|
|
2359
2358
|
if (data.hasOwnProperty("radius")) { delete data.radius; }
|
|
2360
2359
|
if (data.hasOwnProperty("greatcircle")) { delete data.greatcircle; }
|
|
2361
2360
|
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2361
|
+
if (!data.hasOwnProperty("clickable") && data.clickable != false) {
|
|
2362
|
+
var wopt = { autoClose:false, closeButton:true, closeOnClick:false, minWidth:200 };
|
|
2363
|
+
if (words.indexOf('<video ') >=0 || words.indexOf('<img ') >=0 ) { wopt.maxWidth="640"; } // make popup wider if it has an image or video
|
|
2364
|
+
if (data?.popupOptions) { // allow user to override popup options eg to add className
|
|
2365
|
+
wopt = data.popupOptions;
|
|
2366
|
+
delete data.popupOptions;
|
|
2367
|
+
}
|
|
2368
|
+
|
|
2369
|
+
// then any remaining properties to the info box
|
|
2370
|
+
var longline = 0;
|
|
2371
|
+
if (data.popup) { words = data.popup; }
|
|
2372
|
+
else {
|
|
2373
|
+
words += '<table>';
|
|
2374
|
+
for (var i in data) {
|
|
2375
|
+
if ((i != "name") && (i != "length") && (i != "clickable")) {
|
|
2376
|
+
if (typeof data[i] === "object") {
|
|
2377
|
+
words += '<tr><td valign="top">'+ i +'</td><td>' + JSON.stringify(data[i]) + '</td></tr>';
|
|
2378
|
+
}
|
|
2379
|
+
else {
|
|
2380
|
+
// words += i +" : "+data[i]+"<br/>";
|
|
2381
|
+
if (data[i].length > longline) { longline = data[i].length; }
|
|
2382
|
+
words += '<tr><td valign="top">'+ i +'</td><td>' + data[i] + '</td></tr>';
|
|
2383
|
+
}
|
|
2376
2384
|
}
|
|
2377
2385
|
}
|
|
2386
|
+
words += '<tr><td>lat, lon</td><td>'+ marker.getLatLng().toString().replace('LatLng(','').replace(')','') + '</td></tr>';
|
|
2387
|
+
words += '</table>';
|
|
2378
2388
|
}
|
|
2379
|
-
words
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
words = "<b>"+data["name"]+"</b><br/>" + words.replace(/\${name}/g,data["name"]); //"<button style=\"border-radius:4px; float:right; background-color:lightgrey;\" onclick='popped=false;popmark.closePopup();'>X</button><br/>" + words;
|
|
2383
|
-
var wopt = {autoClose:false, closeButton:true, closeOnClick:false, minWidth:200};
|
|
2384
|
-
if (words.indexOf('<video ') >=0 || words.indexOf('<img ') >=0 ) { wopt.maxWidth="640"; } // make popup wider if it has an image or video
|
|
2385
|
-
if (longline > 100) { wopt.minWidth="640"; } // make popup wider if it has a long line
|
|
2386
|
-
if (!data.hasOwnProperty("clickable") && data.clickable != false) {
|
|
2389
|
+
words = "<b>"+data["name"]+"</b><br/>" + words.replace(/\${name}/g,data["name"]); //"<button style=\"border-radius:4px; float:right; background-color:lightgrey;\" onclick='popped=false;popmark.closePopup();'>X</button><br/>" + words;
|
|
2390
|
+
|
|
2391
|
+
if (longline > 100) { wopt.minWidth="640"; } // make popup wider if it has a long line
|
|
2387
2392
|
marker.bindPopup(words, wopt);
|
|
2388
2393
|
marker._popup.dname = data["name"];
|
|
2389
2394
|
}
|
|
@@ -2602,14 +2607,17 @@ function doCommand(cmd) {
|
|
|
2602
2607
|
if (cmd.hasOwnProperty("button")) {
|
|
2603
2608
|
if (!Array.isArray(cmd.button)) { cmd.button = [cmd.button]; }
|
|
2604
2609
|
cmd.button.forEach(function(b) {
|
|
2605
|
-
if (b.icon) {
|
|
2606
|
-
if (
|
|
2607
|
-
buttons[b.name]
|
|
2608
|
-
|
|
2609
|
-
}, b.name, { position:b.position||'topright' }).addTo(map);
|
|
2610
|
+
if (b.name && b.icon) {
|
|
2611
|
+
if (buttons[b.name]) {
|
|
2612
|
+
buttons[b.name].removeFrom(map);
|
|
2613
|
+
delete buttons[b.name];
|
|
2610
2614
|
}
|
|
2615
|
+
buttons[b.name] = L.easyButton( b.icon, function() {
|
|
2616
|
+
ws.send(JSON.stringify({action:"button", name:b.name, value:b?.value}));
|
|
2617
|
+
}, b.name, { position:b.position||'topright' });
|
|
2618
|
+
buttons[b.name].addTo(map);
|
|
2611
2619
|
}
|
|
2612
|
-
else {
|
|
2620
|
+
else if (b.name && !b.icon){
|
|
2613
2621
|
if (buttons[b.name]) {
|
|
2614
2622
|
buttons[b.name].removeFrom(map);
|
|
2615
2623
|
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
|
}
|
|
Binary file
|