Fix marker update when polygon exists with same name

This commit is contained in:
Dave Conway-Jones 2019-09-16 21:35:06 +01:00
parent 211603448e
commit e908e2d3c1
No known key found for this signature in database
GPG Key ID: 9E7F9C73F5168CD4
4 changed files with 12 additions and 7 deletions

View File

@ -1,6 +1,7 @@
### Change Log for Node-RED Worldmap ### 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.22 - fix SIDC missing property
- v2.0.21 - allow adding overlays without making them visible (visible:false). Issue #108 - 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. - v2.0.20 - ensure `fit` option is boolean, Issue #109. Fix track layers, Issue #110.

View File

@ -7,7 +7,8 @@ map web page for plotting "things" on.
### Updates ### 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.22 - fix SIDC missing property
- v2.0.21 - allow adding overlays without making them visible (visible:false). Issue #108 - 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. - v2.0.20 - ensure `fit` option is boolean, Issue #109. Fix track layers, Issue #110.

View File

@ -27,5 +27,8 @@
"name": "Dave Conway-Jones", "name": "Dave Conway-Jones",
"email": "ceejay@vnet.ibm.com", "email": "ceejay@vnet.ibm.com",
"url": "http://nodered.org" "url": "http://nodered.org"
} },
"contributors": [
"@HiroyasuNishiyama"
]
} }

View File

@ -914,7 +914,6 @@ var editPoly = function(pname) {
// the MAIN add something to map function // the MAIN add something to map function
function setMarker(data) { function setMarker(data) {
var rightmenu = function(m) { var rightmenu = function(m) {
// customise right click context menu // customise right click context menu
var rightcontext = ""; var rightcontext = "";
@ -1065,7 +1064,8 @@ function setMarker(data) {
//polygons[data.name] = rightmenu(polygons[data.name]); // DCJ Investigate //polygons[data.name] = rightmenu(polygons[data.name]); // DCJ Investigate
layers[lay].addLayer(polygons[data.name]); layers[lay].addLayer(polygons[data.name]);
} }
else {
if (typeof data.coordinates == "object") { ll = new L.LatLng(data.coordinates[1],data.coordinates[0]); } 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")) { else if (data.hasOwnProperty("position") && data.position.hasOwnProperty("lat") && data.position.hasOwnProperty("lon")) {
data.lat = data.position.lat*1; data.lat = data.position.lat*1;
@ -1093,7 +1093,7 @@ function setMarker(data) {
var drag = false; var drag = false;
if (data.draggable === true) { drag = true; } if (data.draggable === true) { drag = true; }
//console.log("ICON",data.icon);
if (data.hasOwnProperty("icon")) { if (data.hasOwnProperty("icon")) {
if (data.icon === "ship") { if (data.icon === "ship") {
marker = L.boatMarker(ll, { marker = L.boatMarker(ll, {
@ -1507,7 +1507,7 @@ function setMarker(data) {
} }
if (panit) { map.setView(ll,map.getZoom()); } if (panit) { map.setView(ll,map.getZoom()); }
if (p === true) { marker.openPopup(); } if (p === true) { marker.openPopup(); }
}
} }
// handle any incoming COMMANDS to control the map remotely // handle any incoming COMMANDS to control the map remotely