The followed aircraft's trail runs to where the aircraft is drawn

When an application places live contacts itself, the tracked trail was cut at the layer's own delayed clock, which can run minutes behind the placed aircraft: the trail ended far behind the aircraft, and its head was dropped while that clock warmed up. The trail now reads the aircraft's time off its own reports at the point where it is drawn, for Flights and Military Flights.
This commit is contained in:
Sameh Khamis committed 2026-11-17 17:36:36 -08:00
1 parent 2f0c01eaa7
commit 914b28822a
10 files changed
+374 -15

No files matched your search

+40 -5
View File
@@ -50,6 +50,7 @@ import {
trailBodySegments,
trailHeadCurvePoints,
trailHeadStartFix,
trailTimeAt,
} from '../../data/trailContinuity.js';
import { roundHeadingDegrees } from '../../data/headingDegrees.js';
import { entityRecord } from '../../data/entityRecords.js';
@@ -396,12 +397,46 @@ export function createTracking({
);
}
/** Reports at or before the time the aircraft is drawn (now − the display delay). */
/** Reports at or before the time the aircraft is drawn (`_trailDisplayMs`). */
function _trailBodyCountNow() {
return trailBodyCount(
return trailBodyCount(flightState._trailFixes, _trailDisplayMs());
}
/**
* The time on its trail at which a host-supplied placement draws the
* aircraft, read off the trail where it is drawn (`trailTimeAt`): such a
* placement draws at a delay of its own, not this layer's. NaN when this
* layer's own motion draws it, or the trail has no pair to read.
* @returns {number} Epoch ms or NaN.
*/
function _placedTrailMs() {
if (!parts.motion._trackedPlaced?.()) return NaN;
return trailTimeAt(
flightState._trailFixes,
flightState.now() - displayDelayMs(flightState),
parts.motion._trackedDisplayCached(),
);
}
/**
* The time the trail runs up to: the time the aircraft is drawn at, now −
* the display delay, or where a placement draws it. Otherwise the trail
* ends short of a placed aircraft, or runs on ahead of it.
* @returns {number} Epoch ms.
*/
function _trailDisplayMs() {
const placedMs = _placedTrailMs();
return Number.isFinite(placedMs)
? placedMs
: flightState.now() - displayDelayMs(flightState);
}
/** Whether the trail holds no report behind the aircraft yet: this
* layer's own motion draws it before its oldest fix. Never for an
* aircraft a placement draws: its trail is read where it is drawn. */
function _trailWarmingUp() {
return (
!Number.isFinite(_placedTrailMs()) && parts.motion._isTrackWarmingUp()
);
}
@@ -418,7 +453,7 @@ export function createTracking({
if (
!flightState._trackedIcao ||
!flightState._trailFixes.length ||
parts.motion._isTrackWarmingUp()
_trailWarmingUp()
)
return [];
const head =
@@ -441,7 +476,7 @@ export function createTracking({
trailHeadCurvePoints(
flightState._trailFixes,
flightState._trailBodyCount,
flightState.now() - displayDelayMs(flightState),
_trailDisplayMs(),
),
head,
parts.motion._trackedModelCenterWorld(),