From e908e2d3c1dd4bc2578eff103031d9b2153888cf Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Mon, 16 Sep 2019 21:35:06 +0100 Subject: [PATCH] Fix marker update when polygon exists with same name --- CHANGELOG.md | 3 ++- README.md | 3 ++- package.json | 5 ++++- worldmap/worldmap.js | 8 ++++---- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b10621..8f73c00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ### Change Log for Node-RED Worldmap - - v2.1.0 - Add ui-worldmap node to make embedding in Dashboard easier. Let -in node specify connection actions only. + - v2.1.1 - fix bug in repeated add with polygon + - v2.1.0 - add ui-worldmap node to make embedding in Dashboard easier. Let -in node specify connection actions only. - v2.0.22 - fix SIDC missing property - v2.0.21 - allow adding overlays without making them visible (visible:false). Issue #108 - v2.0.20 - ensure `fit` option is boolean, Issue #109. Fix track layers, Issue #110. diff --git a/README.md b/README.md index e7c0a7a..9db4b28 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,8 @@ map web page for plotting "things" on. ### Updates -- v2.1.0 - Add ui-worldmap node to make embedding in Dashboard easier. Let -in node specify connection actions only. +- v2.1.1 - fix bug in repeated add with polygon +- v2.1.0 - add ui-worldmap node to make embedding in Dashboard easier. Let -in node specify connection actions only. - v2.0.22 - fix SIDC missing property - v2.0.21 - allow adding overlays without making them visible (visible:false). Issue #108 - v2.0.20 - ensure `fit` option is boolean, Issue #109. Fix track layers, Issue #110. diff --git a/package.json b/package.json index 917d294..3dd0659 100644 --- a/package.json +++ b/package.json @@ -27,5 +27,8 @@ "name": "Dave Conway-Jones", "email": "ceejay@vnet.ibm.com", "url": "http://nodered.org" - } + }, + "contributors": [ + "@HiroyasuNishiyama" + ] } diff --git a/worldmap/worldmap.js b/worldmap/worldmap.js index 8e06536..580f402 100644 --- a/worldmap/worldmap.js +++ b/worldmap/worldmap.js @@ -914,7 +914,6 @@ var editPoly = function(pname) { // the MAIN add something to map function function setMarker(data) { - var rightmenu = function(m) { // customise right click context menu var rightcontext = ""; @@ -1065,7 +1064,8 @@ function setMarker(data) { //polygons[data.name] = rightmenu(polygons[data.name]); // DCJ Investigate layers[lay].addLayer(polygons[data.name]); } - else { + + if (typeof data.coordinates == "object") { ll = new L.LatLng(data.coordinates[1],data.coordinates[0]); } else if (data.hasOwnProperty("position") && data.position.hasOwnProperty("lat") && data.position.hasOwnProperty("lon")) { data.lat = data.position.lat*1; @@ -1093,7 +1093,7 @@ function setMarker(data) { var drag = false; if (data.draggable === true) { drag = true; } - //console.log("ICON",data.icon); + if (data.hasOwnProperty("icon")) { if (data.icon === "ship") { marker = L.boatMarker(ll, { @@ -1507,7 +1507,7 @@ function setMarker(data) { } if (panit) { map.setView(ll,map.getZoom()); } if (p === true) { marker.openPopup(); } - } + } // handle any incoming COMMANDS to control the map remotely