diff --git a/html/planeObject.js b/html/planeObject.js index f4e4832..95197eb 100644 --- a/html/planeObject.js +++ b/html/planeObject.js @@ -1426,23 +1426,7 @@ PlaneObject.prototype.updateFeatures = function(now, last, redraw) { moved = this.updateTrack(now, last); } - - const zoomedOut = 40 * Math.max(0, 7 - ZoomLvl); - const jaeroTime = (this.dataSource == "adsc") ? 35*60 : 0; - const mlatTime = (this.dataSource == "mlat") ? 25 : 0; - const tisbReduction = (this.icao[0] == '~') ? 15 : 0; - // If no packet in over 58 seconds, clear the plane. - // Only clear the plane if it's not selected individually - - - if ( !this.isFiltered() && - ( - (!globeIndex && this.seen < (58 - tisbReduction + jaeroTime)) - || (globeIndex && this.seen_pos < inactive / 100 * (40 + zoomedOut + jaeroTime + mlatTime - tisbReduction)) - || (this.selected && (onlySelected || (!SelectedAllPlanes && !multiSelect))) - || noVanish - ) - ) { + if (!this.isFiltered() && this.checkVisible()) { const lastVisible = this.visible; this.visible = true; if (SelectedAllPlanes) @@ -2466,3 +2450,20 @@ PlaneObject.prototype.isNonIcao = function() { else return false; } + +PlaneObject.prototype.checkVisible = function() { + const zoomedOut = 40 * Math.max(0, 7 - ZoomLvl); + const jaeroTime = (this.dataSource == "adsc") ? 35*60 : 0; + const mlatTime = (this.dataSource == "mlat") ? 25 : 0; + const tisbReduction = (this.icao[0] == '~') ? 15 : 0; + // If no packet in over 58 seconds, clear the plane. + // Only clear the plane if it's not selected individually + + + return ( + (!globeIndex && this.seen < (58 - tisbReduction + jaeroTime)) + || (globeIndex && this.seen_pos < inactive / 100 * (40 + zoomedOut + jaeroTime + mlatTime - tisbReduction)) + || (this.selected && (onlySelected || (!SelectedAllPlanes && !multiSelect))) + || noVanish + ); +} diff --git a/html/script.js b/html/script.js index 8d187f0..61d7f8b 100644 --- a/html/script.js +++ b/html/script.js @@ -1769,7 +1769,7 @@ function refreshSelected() { } const selected = SelectedPlane; - if (SelectedPlane.position && SelectedPlane.seen_pos > 25) + if (SelectedPlane.position) SelectedPlane.updateMarker(true); if (selected.flight != selCall) { selCall = selected.flight; @@ -2259,7 +2259,7 @@ function refreshTableInfo() { nMapPlanes++; } - if (!plane.isFiltered() && (plane.seen < 58 || noVanish)) { + if (plane.visible) { TrackedAircraft++; if (!tableInView && plane.position != null) @@ -3756,7 +3756,7 @@ function findPlanes(query, byIcao, byCallsign, byReg, byType) { || (byReg && plane.registration != null && plane.registration.toLowerCase().match(query)) || (byType && plane.icaoType != null && plane.icaoType.toLowerCase().match(query)) ) { - if (plane.seen < 70 || noVanish) + if (plane.checkVisible()) results.push(plane); } }