diff --git a/CHANGELOG.md b/CHANGELOG.md index cf0fc77..bb1dd63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ### Change Log for Node-RED Worldmap + - v2.8.1 - Fix old tracks re-appearing afer hide/show. Issue #135 - v2.8.0 - Align vector with `track`, prioritise hdg and heading over bearing. Add old location to move action. - v2.7.1 - Also allow geojson files to be dropped, and better png handling - v2.7.0 - Allow track and image files to be dragged onto the map, if enabled diff --git a/README.md b/README.md index b05c413..33691af 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ map web page for plotting "things" on. ### Updates +- v2.8.1 - Fix old tracks re-appearing afer hide/show. Issue #135 - v2.8.0 - Align vector with `track`, prioritise hdg and heading over bearing. Add old location to move action. - v2.7.1 - Also allow geojson files to be dropped, and better png handling - v2.7.0 - Allow track and image files to be dragged onto the map, if enabled diff --git a/package.json b/package.json index d4ec0b6..da50733 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-red-contrib-web-worldmap", - "version": "2.8.0", + "version": "2.8.1", "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/worldmap.js b/worldmap/worldmap.js index 3d2dcc2..a79bc01 100644 --- a/worldmap/worldmap.js +++ b/worldmap/worldmap.js @@ -1801,15 +1801,20 @@ function setMarker(data) { } markers[data.name] = marker; layers[lay].addLayer(marker); - - //if ((data.hdg != null) && (data.bearing == null)) { data.bearing = data.hdg; delete data.hdg; } - var track = data.track || data.hdg || data.heading || data.bearing; + var track; + if (data.track !== undefined) { track = data.track; } + else if (data.hdg !== undefined) { track = data.hdg; } + else if (data.heading !== undefined) { track = data.heading; } + else if (data.bearing !== undefined) { track = data.bearing; } if (track != undefined) { // if there is a heading if (data.speed != null) { data.length = parseFloat(data.speed || "0") * 50; } // and a speed if (data.length != null) { if (polygons[data.name] != null && !polygons[data.name].hasOwnProperty("_layers")) { map.removeLayer(polygons[data.name]); } + if (polygons[data.name] != null && polygons[data.name].hasOwnProperty("name") ) { + delete(layers[lay]._layers[polygons[data.name]._leaflet_id]); + } var x = ll.lng * 1; // X coordinate var y = ll.lat * 1; // Y coordinate var ll1 = ll; @@ -1837,6 +1842,7 @@ function setMarker(data) { polygon.setStyle({opacity:0}); } } + polygon.name = data.name; if (polygons[data.name] != null && polygons[data.name].hasOwnProperty("_layers")) { polygons[data.name].addLayer(polygon); }