Stop old tracks reappearing

to close #135
This commit is contained in:
Dave Conway-Jones 2021-01-23 11:56:46 +00:00
parent c0c20f6e6a
commit bfe0c49a4d
No known key found for this signature in database
GPG Key ID: 88BA2B8A411BE9FF
4 changed files with 12 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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",

View File

@ -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);
}