node-red-contrib-web-worldmap 5.1.2 → 5.1.3
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 +20 -22
- package/package.json +1 -1
- package/worldmap.js +2 -2
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -13,6 +13,7 @@ Feel free to [ drone icon.
|
|
40
|
-
- v4.3.3 - Fix for objects changing layers.
|
|
41
|
-
- v4.3.2 - Fix geojson popup missing label name.
|
|
42
|
-
- v4.3.1 - Small fix to icon transparency, and routing detail.
|
|
43
|
-
- v4.3.0 - Add support for PMtiles files.
|
|
44
|
-
- v4.2.1 - Revert use of optional chaining to extend life slightly. Issue #252
|
|
45
|
-
- v4.2.0 - Let icons also be inline images data:image...
|
|
46
|
-
- v4.1.0 - Add optional SOG, COG, altft, altm input properties.
|
|
47
|
-
- v4.0.0 - Breaking - Better context menu variable substitution and retention
|
|
48
|
-
Now uses ${name} syntax rather than $name so we can handle user defined variables in context menus.
|
|
29
|
+
|
|
49
30
|
|
|
50
31
|
- see [CHANGELOG](https://github.com/dceejay/RedMap/blob/master/CHANGELOG.md) for full list of changes.
|
|
51
32
|
|
|
@@ -723,7 +704,7 @@ There are some internal functions available to make interacting with Node-RED ea
|
|
|
723
704
|
|
|
724
705
|
- **addToForm()** : takes a property name value pair to add to a variable called `form`. When used with contextmenu feedback (above) you can set the feedback value to `"_form"` to substitute this accumulated value. This allows you to do things like `onBlur='addToForm(this.name,this.value)'` over several different fields in the menu and then use `feedback(this.name,"_form")` to submit them all at once. For example a simple multiple line form could be as per the example below:
|
|
725
706
|
|
|
726
|
-
|
|
707
|
+
Retain Values - If you wish to retain the values between separate openings of this form you can assign property names to the value field in the form `value="${foo}`, etc. These will then appear as part of an **value** property on the worldmap-in node message.
|
|
727
708
|
|
|
728
709
|
```
|
|
729
710
|
var menu = 'Add some data <input name="foo" value="${foo}" onchange=\'addToForm(this.name,this.value)\'></input><br/>'
|
|
@@ -732,6 +713,23 @@ menu += '<button name="my_form" onclick=\'feedback(this.name,"_form","formAction
|
|
|
732
713
|
msg.payload = { command: { "contextmenu":menu } }
|
|
733
714
|
```
|
|
734
715
|
|
|
716
|
+
Custom Feedback Content - The example below shows how you can pass the latitude and longitude location value from the contextmenu popup when right clicking the map. You can also use this method with other data you wish.
|
|
717
|
+
|
|
718
|
+
```
|
|
719
|
+
var menu ='<center><br/>';
|
|
720
|
+
menu += 'Add some data <input type="text" id="foo" placeholder="foo"><br/>';
|
|
721
|
+
menu += 'Add more data <input type="text" id="bar" placeholder="bar"><br/>';
|
|
722
|
+
menu += '<input type="button" value="Submit" onclick=';
|
|
723
|
+
menu += '\'feedback("myform",{';
|
|
724
|
+
menu += '"foo":document.getElementById("foo").value,';
|
|
725
|
+
menu += '"bar":document.getElementById("bar").value,';
|
|
726
|
+
menu += '"lat":rclk.lat.toFixed(12),';
|
|
727
|
+
menu += '"lon":rclk.lng.toFixed(12),';
|
|
728
|
+
menu += '},"formAction",true)\' > <br/><br/> ';
|
|
729
|
+
msg.payload = { command: { "contextmenu":menu } }
|
|
730
|
+
```
|
|
731
|
+
For a more detailed example flow using this method see: [Moving Icons Demo & Builder](https://github.com/dceejay/RedMap/blob/master/examples/Moving%20Icons%20Demo%20%26%20Builder.json)
|
|
732
|
+
|
|
735
733
|
- **delMarker()** : takes the name of the marker as a parameter. In a popup this can be specified as `${name}` for dynamic substitution.
|
|
736
734
|
|
|
737
735
|
- **editPoly()** : takes the name of the shape or line as a parameter. In a popup this can be specified as `${name}` for dynamic substitution.
|
package/package.json
CHANGED
package/worldmap.js
CHANGED
|
@@ -494,7 +494,7 @@ module.exports = function(RED) {
|
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
496
|
if (msg.payload?.command?.clear) {
|
|
497
|
-
if (!isArray(msg.payload?.command?.clear)) {
|
|
497
|
+
if (!Array.isArray(msg.payload?.command?.clear)) {
|
|
498
498
|
msg.payload.command.clear = [ msg.payload.command.clear ]
|
|
499
499
|
}
|
|
500
500
|
msg.payload.command.clear.forEach(function(el) {
|
|
@@ -508,7 +508,7 @@ module.exports = function(RED) {
|
|
|
508
508
|
})
|
|
509
509
|
}
|
|
510
510
|
if (msg.payload?.command?.clearlayer) {
|
|
511
|
-
if (!isArray(msg.payload?.command?.clearlayer)) {
|
|
511
|
+
if (!Array.isArray(msg.payload?.command?.clearlayer)) {
|
|
512
512
|
msg.payload.command.clearlayer = [ msg.payload.command.clearlayer ]
|
|
513
513
|
}
|
|
514
514
|
msg.payload.command.clearlayer.forEach(function(el) {
|