From d818847abe2d932e586b6f1605eb7aafa3f2ec25 Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Tue, 30 Jul 2019 23:08:22 +0200 Subject: [PATCH] update markers after loading history keep last track and altitude instead of setting to null --- html/planeObject.js | 17 ++++++++--------- html/script.js | 1 + 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/html/planeObject.js b/html/planeObject.js index 8372d03..b1d029a 100644 --- a/html/planeObject.js +++ b/html/planeObject.js @@ -495,18 +495,19 @@ PlaneObject.prototype.updateIcon = function() { // Update our data PlaneObject.prototype.updateData = function(receiver_timestamp, data, locOnly) { // get location data first, return early if only those are needed. - if (data.mlat && data.mlat.indexOf("lat") >= 0) - this.position_from_mlat = true; - else - this.position_from_mlat = false; - if (data.lat != null) { this.position = [data.lon, data.lat]; this.last_position_time = receiver_timestamp - data.seen_pos; } + if (data.mlat && data.mlat.indexOf("lat") >= 0) + this.position_from_mlat = true; + else if (data.lat != null) + this.position_from_mlat = false; - this.track = data.track; - this.altitude = data.alt_baro; + if (data.track != null) + this.track = data.track; + if (data.alt_baro != null) + this.altitude = data.alt_baro; this.last_message_time = receiver_timestamp - data.seen; if (locOnly) @@ -584,8 +585,6 @@ PlaneObject.prototype.updateData = function(receiver_timestamp, data, locOnly) { this.altitude = data.alt_baro; } else if ('alt_geom' in data) { this.altitude = data.alt_geom; - } else { - this.altitude = null; } // Pick vertical rate from either baro or geom rate diff --git a/html/script.js b/html/script.js index 8a41ebd..a97536c 100644 --- a/html/script.js +++ b/html/script.js @@ -600,6 +600,7 @@ function end_load_history() { console.log("Final history cleanup pass"); for (var i = 0; i < PlanesOrdered.length; ++i) { var plane = PlanesOrdered[i]; + plane.updateMarker(true); plane.updateTick(now, last); }