diff --git a/public_html/planeObject.js b/public_html/planeObject.js index df5b296..797c5af 100644 --- a/public_html/planeObject.js +++ b/public_html/planeObject.js @@ -13,6 +13,7 @@ function PlaneObject(icao) { this.speed = null; this.track = null; this.position = null; + this.position_from_mlat = false this.sitedist = null; // Data packet numbers @@ -290,6 +291,16 @@ PlaneObject.prototype.updateData = function(receiver_timestamp, data) { if (SitePosition !== null) { this.sitedist = google.maps.geometry.spherical.computeDistanceBetween (SitePosition, this.position); } + + this.position_from_mlat = false; + if (typeof data.mlat !== "undefined") { + for (var i = 0; i < data.mlat.length; ++i) { + if (data.mlat[i] === "lat" || data.mlat[i] == "lon") { + this.position_from_mlat = true; + break; + } + } + } } if (typeof data.flight !== "undefined") this.flight = data.flight; @@ -297,16 +308,6 @@ PlaneObject.prototype.updateData = function(receiver_timestamp, data) { this.squawk = data.squawk; if (typeof data.category !== "undefined") this.category = data.category; - - this.position_from_mlat = false - if (typeof data.mlat !== "undefined") { - for (var i = 0; i < data.mlat.length; ++i) { - if (data.mlat[i] === "lat" || data.mlat[i] == "lon") { - this.position_from_mlat = true; - break; - } - } - } }; PlaneObject.prototype.updateTick = function(receiver_timestamp, last_timestamp) {