From 8f51fa21ae5b8473e7d10a7faeba5a943c2d97ee Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Tue, 14 Apr 2020 13:46:45 +0100 Subject: [PATCH] Show ruler if grib turned on, better fix for array of tracks to close #127, to close #124 --- CHANGELOG.md | 1 + package.json | 2 +- worldmap.html | 3 --- worldmap.js | 13 ++++++++++--- worldmap/worldmap.js | 4 ++-- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e971c20..f9557a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ### Change Log for Node-RED Worldmap + - v2.3.6 - show ruler if grid is turned on. - v2.3.5 - Let tracks node handle array of points. Let http icons be rotated to hdg or bearing. - v2.3.4 - Add bus icon - v2.3.3 - Fix satellite view max zoom diff --git a/package.json b/package.json index 13c3457..63b4cd7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-red-contrib-web-worldmap", - "version": "2.3.5", + "version": "2.3.6", "description": "A Node-RED node to provide a web page of a world map for plotting things on.", "dependencies": { "cgi": "0.3.1", diff --git a/worldmap.html b/worldmap.html index f6a004a..0c71983 100644 --- a/worldmap.html +++ b/worldmap.html @@ -407,9 +407,6 @@ then by default ⌘⇧m - ctrl-shift-m will load the m labelStyle: function() { return this.name?"node_label_italic":""; }, - info: function() { - return 'The map can be found [here]('+RED.settings.httpNodeRoot.slice(0,-1)+this.path+').'; - }, oneditprepare: function() { $("#node-input-size").elementSizer({ width: "#node-input-width", diff --git a/worldmap.js b/worldmap.js index 196dd57..a94994f 100644 --- a/worldmap.js +++ b/worldmap.js @@ -55,6 +55,7 @@ module.exports = function(RED) { var clients = {}; RED.httpNode.use(compression()); RED.httpNode.use(node.path, express.static(__dirname + '/worldmap')); + // RED.httpNode.use(node.path, express.static(__dirname + '/worldmap', {maxage:3600000})); var callback = function(client) { //client.setMaxListeners(0); @@ -346,10 +347,16 @@ module.exports = function(RED) { } node.on("input", function(m) { - if (Array.isArray(m)) { - m.forEach(item => doTrack(item)); + if (Array.isArray(m.payload)) { + m.payload.forEach(function (pay) { + var n = RED.util.cloneMessage(m) + n.payload = pay; + doTrack(n); + }); + } + else { + doTrack(m); } - else { doTrack(m); } }); node.on("close", function() { diff --git a/worldmap/worldmap.js b/worldmap/worldmap.js index c5dabd9..5964806 100644 --- a/worldmap/worldmap.js +++ b/worldmap/worldmap.js @@ -1651,8 +1651,8 @@ function doCommand(cmd) { if ((cmd.grid.showgrid == "false" || cmd.grid.showgrid == false ) && showGrid) { changed = true; } if (changed) { showGrid = !showGrid; - if (showGrid) { Lgrid.addTo(map); } - else { Lgrid.removeFrom(map); } + if (showGrid) { Lgrid.addTo(map); rulerButton.addTo(map); } + else { Lgrid.removeFrom(map); rulerButton.removeFrom(map); } } } if (cmd.grid.hasOwnProperty("opt")) {