diff --git a/html/planeObject.js b/html/planeObject.js
index 67d0a85..d7d89b0 100644
--- a/html/planeObject.js
+++ b/html/planeObject.js
@@ -674,9 +674,7 @@ PlaneObject.prototype.updateTick = function(receiver_timestamp, last_timestamp,
// If no packet in over 58 seconds, clear the plane.
// Only clear the plane if it's not selected individually
- if (this.seen_pos > 100 && (!this.selected || SelectedAllPlanes) )
- this.position = null;
- if ((this.seen > 58 || this.position == null)
+ if ((this.seen > 58 || this.position == null || this.seen_pos > 100)
&& (!this.selected || SelectedAllPlanes)) {
if (this.visible) {
//console.log("hiding " + this.icao);
@@ -789,6 +787,24 @@ PlaneObject.prototype.updateLines = function() {
})
});
+ // create any missing fixed line features
+ for (var i = 0; i < this.track_linesegs.length; ++i) {
+ var seg = this.track_linesegs[i];
+ if (!seg.feature) {
+ seg.feature = new ol.Feature(seg.fixed);
+ if (seg.estimated) {
+ seg.feature.setStyle(estimateStyle);
+ } else {
+ seg.feature.setStyle(this.altitudeLines(seg.altitude));
+ }
+
+ PlaneTrailFeatures.push(seg.feature);
+ }
+ }
+
+ if (!this.position)
+ return;
+
// find the old elastic band so we can replace it in place
// (which should be faster than remove-and-add when PlaneTrailFeatures is large)
var oldElastic = -1;
@@ -813,20 +829,6 @@ PlaneObject.prototype.updateLines = function() {
PlaneTrailFeatures.setAt(oldElastic, this.elastic_feature);
}
- // create any missing fixed line features
- for (var i = 0; i < this.track_linesegs.length; ++i) {
- var seg = this.track_linesegs[i];
- if (!seg.feature) {
- seg.feature = new ol.Feature(seg.fixed);
- if (seg.estimated) {
- seg.feature.setStyle(estimateStyle);
- } else {
- seg.feature.setStyle(this.altitudeLines(seg.altitude));
- }
-
- PlaneTrailFeatures.push(seg.feature);
- }
- }
};
PlaneObject.prototype.destroy = function() {
diff --git a/html/script.js b/html/script.js
index 3d8918d..b4cfaf6 100644
--- a/html/script.js
+++ b/html/script.js
@@ -569,8 +569,12 @@ function parse_history() {
// Final pass to update all planes to their latest state
console.log("Final history cleanup pass");
- for (var i = 0; i < PlanesOrdered.length; ++i) {
+ for (var i in PlanesOrdered) {
var plane = PlanesOrdered[i];
+
+ if (plane.position && SitePosition)
+ plane.sitedist = ol.sphere.getDistance(SitePosition, plane.position);
+
if (plane.dataSource == "uat")
plane.updateTick(uat_now, uat_last, true);
else