fix handling of old ship nav layer

This commit is contained in:
Dave Conway-Jones 2021-11-10 09:39:36 +00:00
parent ac8bc0f499
commit 39271a6179
No known key found for this signature in database
GPG Key ID: 88BA2B8A411BE9FF
4 changed files with 9 additions and 3 deletions

View File

@ -1,6 +1,7 @@
### Change Log for Node-RED Worldmap ### Change Log for Node-RED Worldmap
- v2.21.4 - fix speed leader length. Add transparentPixels option. - v2.21.5 - Fix handling of "old" sjip nav to ship navigat
- v2.21.4 - Fix speed leader length. Add transparentPixels option.
- v2.21.3 - Add zoom to bounds action. Adjust map layers max zoom levels. - v2.21.3 - Add zoom to bounds action. Adjust map layers max zoom levels.
- v2.21.2 - Expand ship nav to ship navigation. - v2.21.2 - Expand ship nav to ship navigation.
- v2.21.1 - Fix ui check callback to not use . - v2.21.1 - Fix ui check callback to not use .

View File

@ -11,7 +11,8 @@ map web page for plotting "things" on.
### Updates ### Updates
- v2.21.4 - fix speed leader length. Add transparentPixels option.. - v2.21.5 - Fix handling of "old" sjip nav to ship navigation
- v2.21.4 - Fix speed leader length. Add transparentPixels option..
- v2.21.3 - Add zoom to bounds action. Adjust map layers max zoom levels. - v2.21.3 - Add zoom to bounds action. Adjust map layers max zoom levels.
- v2.21.2 - Expand ship nav to ship navigation. - v2.21.2 - Expand ship nav to ship navigation.
- v2.21.1 - Fix ui check callback to not use . - v2.21.1 - Fix ui check callback to not use .

File diff suppressed because one or more lines are too long

View File

@ -2513,6 +2513,8 @@ function doCommand(cmd) {
// Turn on an existing overlay(s) // Turn on an existing overlay(s)
if (cmd.hasOwnProperty("showlayer")) { if (cmd.hasOwnProperty("showlayer")) {
if (typeof cmd.showlayer === "string") { cmd.showlayer = [ cmd.showlayer ]; } if (typeof cmd.showlayer === "string") { cmd.showlayer = [ cmd.showlayer ]; }
var sn = cmd.showlayer.indexOf("ship nav");
if (sn !== -1) { cmd.showlayer[sn] = "ship navigation"; }
for (var i=0; i < cmd.showlayer.length; i++) { for (var i=0; i < cmd.showlayer.length; i++) {
if (overlays.hasOwnProperty(cmd.showlayer[i])) { if (overlays.hasOwnProperty(cmd.showlayer[i])) {
map.addLayer(overlays[cmd.showlayer[i]]); map.addLayer(overlays[cmd.showlayer[i]]);
@ -2522,6 +2524,8 @@ function doCommand(cmd) {
// Turn off an existing overlay(s) // Turn off an existing overlay(s)
if (cmd.hasOwnProperty("hidelayer")) { if (cmd.hasOwnProperty("hidelayer")) {
if (typeof cmd.hidelayer === "string") { cmd.hidelayer = [ cmd.hidelayer ]; } if (typeof cmd.hidelayer === "string") { cmd.hidelayer = [ cmd.hidelayer ]; }
var sn = cmd.hidelayer.indexOf("ship nav");
if (sn !== -1) { cmd.hidelayer[sn] = "ship navigation"; }
for (var i=0; i < cmd.hidelayer.length; i++) { for (var i=0; i < cmd.hidelayer.length; i++) {
if (overlays.hasOwnProperty(cmd.hidelayer[i])) { if (overlays.hasOwnProperty(cmd.hidelayer[i])) {
map.removeLayer(overlays[cmd.hidelayer[i]]); map.removeLayer(overlays[cmd.hidelayer[i]]);