node-red-contrib-web-worldmap 2.28.1 → 2.28.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 +1 -0
- package/README.md +4 -1
- package/package.json +1 -1
- package/worldmap/worldmap.js +14 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
### Change Log for Node-RED Worldmap
|
|
2
2
|
|
|
3
|
+
- v2.28.2 - Let button declaration be an array
|
|
3
4
|
- v2.28.1 - Fix layer command bug for non-core layers. Issue #195
|
|
4
5
|
- v2.28.0 - Better Handling of sidc icons in geojson
|
|
5
6
|
- v2.27.3 - Try to handle greatcircles crossing antimeridian
|
package/README.md
CHANGED
|
@@ -11,6 +11,7 @@ map web page for plotting "things" on.
|
|
|
11
11
|
|
|
12
12
|
### Updates
|
|
13
13
|
|
|
14
|
+
- v2.28.2 - Let button declaration be an array
|
|
14
15
|
- v2.28.1 - Fix layer command bug for non-core layers. Issue #195
|
|
15
16
|
- v2.28.0 - Better Handling of sidc icons in geojson
|
|
16
17
|
- v2.27.3 - Try to handle greatcircles crossing antimeridian
|
|
@@ -420,7 +421,7 @@ Optional properties include
|
|
|
420
421
|
- **hiderightclick** - disables the right click that allows adding or deleting points on the map - `{"command":{"hiderightclick":true}}`
|
|
421
422
|
- **coords** - turns on and off a display of the current mouse co-ordinates. Values can be "deg", "dms", or "none" (default). - `{"command":{"coords":"deg"}}`
|
|
422
423
|
- **button** - if supplied with a `name` and `icon` property - adds a button to provide user input - sends
|
|
423
|
-
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).
|
|
424
|
+
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). button can also be an array of button objects.
|
|
424
425
|
- **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.
|
|
425
426
|
- **toptitle** - Words to replace title in title bar (if not in iframe)
|
|
426
427
|
- **toplogo** - URL to logo image for top tile bar (if not in iframe) - ideally 60px by 24px.
|
|
@@ -445,6 +446,8 @@ to remove
|
|
|
445
446
|
|
|
446
447
|
msg.payload.command = { "button": { "name":"My Fancy Button" } };
|
|
447
448
|
|
|
449
|
+
Multiple buttons can declared by using an array of button objects.
|
|
450
|
+
|
|
448
451
|
#### To add a custom popup or contextmenu
|
|
449
452
|
|
|
450
453
|
You can customise a marker's popup, or context menu (right click), by setting the
|
package/package.json
CHANGED
package/worldmap/worldmap.js
CHANGED
|
@@ -2166,19 +2166,22 @@ function doCommand(cmd) {
|
|
|
2166
2166
|
}
|
|
2167
2167
|
}
|
|
2168
2168
|
if (cmd.hasOwnProperty("button")) {
|
|
2169
|
-
if (cmd.button
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2169
|
+
if (!isArray(cmd.button)) { cmd.button = [cmd.button]; }
|
|
2170
|
+
cmd.button.forEach(function(b) {
|
|
2171
|
+
if (b.icon) {
|
|
2172
|
+
if (!buttons[b.name]) {
|
|
2173
|
+
buttons[b.name] = L.easyButton( b.icon, function() {
|
|
2174
|
+
ws.send(JSON.stringify({action:"button", name:b.name}));
|
|
2175
|
+
}, b.name, { position:b.position||'topright' }).addTo(map);
|
|
2176
|
+
}
|
|
2174
2177
|
}
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2178
|
+
else {
|
|
2179
|
+
if (buttons[b.name]) {
|
|
2180
|
+
buttons[b.name].removeFrom(map);
|
|
2181
|
+
delete buttons[b.name];
|
|
2182
|
+
}
|
|
2180
2183
|
}
|
|
2181
|
-
}
|
|
2184
|
+
})
|
|
2182
2185
|
}
|
|
2183
2186
|
if (cmd.hasOwnProperty("contextmenu")) {
|
|
2184
2187
|
if (typeof cmd.contextmenu === "string") {
|