fix(selection): selecting or tracking a contact never recolours it

A tracked aircraft's icon and 3D model keep the colours they have
untracked in Flights and Military Flights (no cyan, no lighter amber);
only the icon's alpha changes (stale fade, clear while its model draws).
A selected vessel or aid keeps its type colour instead of white, and a
tracked satellite's dot keeps its class colour instead of yellow. An
emergency stays red while tracked.
This commit is contained in:
Sameh Khamis committed 2026-11-17 17:49:33 -08:00
1 parent 2f0c01eaa7
commit f49352d228
23 files changed
+192 -108

No files matched your search

+14 -17
View File
@@ -15,6 +15,7 @@ import {
createTrackedAircraftIcon,
isOtherTrackedIconSet,
trackedContactHolder,
trackedIconColor,
} from '../../data/trackedAircraftIcon.js';
import { fromDegrees, toLonLatH } from '../../geo/ellipsoid.js';
import { julianToEpochMs } from '../../geo/julian.js';
@@ -36,8 +37,6 @@ import {
followsClock,
STALE_ALPHA,
TRAIL_COLOR,
AMBER_TRANSPARENT,
TRACKED_ICON_COLOR,
} from './policy.js';
import {
drawTrailSegments,
@@ -64,11 +63,6 @@ function aircraftPickId(hit) {
return isOtherTrackedIconSet(hit.set, 'military') ? undefined : hit.id;
}
const STALE_TRACKED_COLOR = Object.freeze([
...TRACKED_ICON_COLOR.slice(0, 3),
STALE_ALPHA,
]);
export function createTracking({
flightState,
services,
@@ -312,14 +306,18 @@ export function createTracking({
return { text: '', dimmed: false };
}
/** The tracked billboard's colour: amber, faded while stale, clear while the 3D model is the visual. */
/** The tracked billboard's colour: the contact's own fleet colour (tracking
* never recolours it), faded while stale, clear while the 3D model is the
* visual. */
function _trackedIconColor() {
if (parts.rendering._modelOwnsVisual(flightState._trackedIcao))
return AMBER_TRANSPARENT;
return _trackedStaleCue(flightState._trackedIcao).dimmed
? STALE_TRACKED_COLOR
: TRACKED_ICON_COLOR;
const icao24 = flightState._trackedIcao;
const color = parts.rendering._fleetBillboardColor(icao24);
if (parts.rendering._modelOwnsVisual(icao24))
return trackedIconColor(color, 0);
return _trackedStaleCue(icao24).dimmed
? trackedIconColor(color, STALE_ALPHA)
: color;
}
/**
@@ -1048,14 +1046,13 @@ export function createTracking({
imageLod: _trackedBillboardLook().imageLod,
sprite,
position: getTrackedPosition,
// Solid amber when the billboard is the visual (zoomed out, 3D off, or model still loading);
// transparent once the tracked model is actually up (ready + shown).
// Amber (faded while stale), transparent once the tracked model is the visual.
// Its own colour (faded while stale) when the billboard is the visual (zoomed out, 3D off,
// or model still loading); transparent once the tracked model is actually up (ready + shown).
color: _trackedIconColor,
// Screen-projected rotation, evaluated per frame on the camera's own
// axes, so it stays exact through a tracked orbit. The tracked target
// must never vanish into tile geometry — tracking a taxiing plane at
// street level would otherwise bury the amber icon inside the runway
// street level would otherwise bury the icon inside the runway
// skin, so it draws over depth like the fleet icon set; its
// shared-host tracked card is top-composited separately.
rotation: () => {