Fix track polygons layer, clickable, and ensure fit is boolean

To close #109, to address #110,
bump package
This commit is contained in:
Dave Conway-Jones 2019-08-07 21:56:26 +01:00
parent 0e25222b2a
commit 209fcbd441
No known key found for this signature in database
GPG Key ID: 9E7F9C73F5168CD4
3 changed files with 8 additions and 7 deletions

View File

@ -9,6 +9,7 @@ map web page for plotting "things" on.
### Updates ### Updates
- v2.0.19 - ensure `fit` option is boolean, Issue #109. Fix tracks, Issue #110.
- v2.0.18 - Stop map contextmenu bleedthrough to marker. Add compress middleware. - v2.0.18 - Stop map contextmenu bleedthrough to marker. Add compress middleware.
- v2.0.17 - Let clear command also clear tracks from tracks node - v2.0.17 - Let clear command also clear tracks from tracks node
- v2.0.16 - Revert use of ES6 import. Keep IE11 happy for while - v2.0.16 - Revert use of ES6 import. Keep IE11 happy for while
@ -411,7 +412,7 @@ The geojson features may contain a `properties` property. That may also include
The `opt` property is optional. See the <a href="https://leafletjs.com/examples/geojson/">Leaflet geojson docs</a> for more info on possible options. Note: only simple options are supported as functions cannot be serialised. The `opt` property is optional. See the <a href="https://leafletjs.com/examples/geojson/">Leaflet geojson docs</a> for more info on possible options. Note: only simple options are supported as functions cannot be serialised.
The `fit` property is optional. If present the map will automatically zoom to fit the area relevant to the geojson. The `fit` property is optional. If boolean true the map will automatically zoom to fit the area relevant to the geojson.
see http://leafletjs.com/examples/geojson/ for more details about options for opt. see http://leafletjs.com/examples/geojson/ for more details about options for opt.
@ -430,7 +431,7 @@ As per the geojson overlay you can also inject a KML layer, GPX layer or TOPOJSO
- **icon** : <a href="https://fontawesome.com/v4.7.0/icons/" target="mapinfo">font awesome</a> icon name. - **icon** : <a href="https://fontawesome.com/v4.7.0/icons/" target="mapinfo">font awesome</a> icon name.
- **iconColor** : Standard CSS colour name or #rrggbb hex value. - **iconColor** : Standard CSS colour name or #rrggbb hex value.
Again the `fit` property can be added to make the map zoom to the relevant area. Again the boolean `fit` property can be added to make the map zoom to the relevant area.
#### To add a Velocity Grid Overlay #### To add a Velocity Grid Overlay

View File

@ -1,6 +1,6 @@
{ {
"name": "node-red-contrib-web-worldmap", "name": "node-red-contrib-web-worldmap",
"version": "2.0.18", "version": "2.0.19",
"description": "A Node-RED node to provide a web page of a world map for plotting things on.", "description": "A Node-RED node to provide a web page of a world map for plotting things on.",
"dependencies": { "dependencies": {
"cgi": "0.3.1", "cgi": "0.3.1",

View File

@ -1011,7 +1011,7 @@ function setMarker(data) {
delete data.action; delete data.action;
if (typeof markers[data.name] != "undefined") { if (typeof markers[data.name] != "undefined") {
if (markers[data.name].lay !== data.layer) { if (markers[data.name].lay !== lay) {
delMarker(data.name); delMarker(data.name);
} }
else { else {
@ -1055,12 +1055,12 @@ function setMarker(data) {
if (polygons[data.name] !== undefined) { if (polygons[data.name] !== undefined) {
polygons[data.name].lay = lay; polygons[data.name].lay = lay;
if (opt.clickable) { if (opt.clickable === true) {
var words = "<b>"+data.name+"</b>"; var words = "<b>"+data.name+"</b>";
if (data.popup) { var words = words + "<br/>" + data.popup; } if (data.popup) { var words = words + "<br/>" + data.popup; }
polygons[data.name].bindPopup(words, {autoClose:false, closeButton:true, closeOnClick:false, minWidth:200}); polygons[data.name].bindPopup(words, {autoClose:false, closeButton:true, closeOnClick:false, minWidth:200});
} }
polygons[data.name] = rightmenu(polygons[data.name]); //polygons[data.name] = rightmenu(polygons[data.name]); // DCJ Investigate
layers[lay].addLayer(polygons[data.name]); layers[lay].addLayer(polygons[data.name]);
} }
else { else {
@ -1678,7 +1678,7 @@ function doCommand(cmd) {
layercontrol.addOverlay(overlays[cmd.map.overlay],cmd.map.overlay); layercontrol.addOverlay(overlays[cmd.map.overlay],cmd.map.overlay);
} }
map.addLayer(overlays[cmd.map.overlay]); map.addLayer(overlays[cmd.map.overlay]);
if (cmd.map.hasOwnProperty("fit")) { map.fitBounds(overlays[cmd.map.overlay].getBounds()); } if (cmd.map.hasOwnProperty("fit") && cmd.map.fit === true)) { map.fitBounds(overlays[cmd.map.overlay].getBounds()); }
} }
// Add a new NVG XML overlay layer // Add a new NVG XML overlay layer
if (cmd.map && cmd.map.hasOwnProperty("overlay") && cmd.map.hasOwnProperty("nvg") ) { if (cmd.map && cmd.map.hasOwnProperty("overlay") && cmd.map.hasOwnProperty("nvg") ) {