mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 17:52:21 +00:00
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:
1 parent
2f0c01eaa7
commit
f49352d228
23 files changed
+192
-108
No files matched your search
@@ -271,13 +271,22 @@ test('the rendering part draws the dots, the tracked dot and the rings through t
|
||||
state._enabled = true;
|
||||
state._params = { showPoints: false, showOrbits: false };
|
||||
let at = { x: 10, y: 20, z: 30 };
|
||||
const carrier = rendering._addTrackedEntity({ position: () => at });
|
||||
const issRed = [1, 0.27, 0.27, 1];
|
||||
const carrier = rendering._addTrackedEntity({
|
||||
position: () => at,
|
||||
color: issRed,
|
||||
});
|
||||
assert.deepEqual(carrier, { noradId: 25544 });
|
||||
const tracked = draw.set(points.replace(':points', ':tracked'));
|
||||
assert.equal(tracked.items.size, 0);
|
||||
rendering._preRenderTick({ frame: 3 });
|
||||
assert.deepEqual(tracked.items.get('25544').pos, at);
|
||||
assert.equal(tracked.items.get('25544').pixelSize, 14);
|
||||
assert.deepEqual(
|
||||
tracked.items.get('25544').color,
|
||||
issRed,
|
||||
'the satellite keeps its own colour',
|
||||
);
|
||||
assert.equal(tracked.items.get('25544').disableDepthTest, Infinity);
|
||||
at = { x: 11, y: 21, z: 31 };
|
||||
rendering._preRenderTick({ frame: 4 });
|
||||
|
||||
@@ -34,12 +34,11 @@ const POINT_SCALE_BY_DISTANCE = Object.freeze({
|
||||
});
|
||||
|
||||
/**
|
||||
* The tracked satellite's dot: 14 px yellow with a white outline, drawn
|
||||
* over everything.
|
||||
* The tracked satellite's dot: 14 px in the satellite's own colour with a
|
||||
* white outline, drawn over everything. Tracking never recolours it.
|
||||
*/
|
||||
const TRACKED_DOT = Object.freeze({
|
||||
pixelSize: 14,
|
||||
color: Object.freeze([1, 1, 0, 1]),
|
||||
outlineColor: Object.freeze([1, 1, 1, 1]),
|
||||
outlineWidth: 2,
|
||||
disableDepthTest: Number.POSITIVE_INFINITY,
|
||||
@@ -386,12 +385,13 @@ export function createRendering({
|
||||
/**
|
||||
* Draw the tracked satellite's dot and make the carrier the follow target
|
||||
* and the tracked card read (its entity record holds the card).
|
||||
* @param {{position: () => object, viewFrom: {x: number, y: number,
|
||||
* z: number}}} options `position` is read as the follow camera reads
|
||||
* it, once each frame before the tick moves the sample on.
|
||||
* @param {{position: () => object, color: number[], viewFrom: {x: number,
|
||||
* y: number, z: number}}} options `position` is read as the follow
|
||||
* camera reads it, once each frame before the tick moves the sample on;
|
||||
* `color` is the satellite's own dot colour.
|
||||
* @returns {object} The carrier.
|
||||
*/
|
||||
function _addTrackedEntity({ position }) {
|
||||
function _addTrackedEntity({ position, color }) {
|
||||
const noradId = layerState._trackedNorad;
|
||||
const carrier = { noradId };
|
||||
trackedDot = {
|
||||
@@ -400,6 +400,7 @@ export function createRendering({
|
||||
id: String(noradId),
|
||||
pos: { x: 0, y: 0, z: 0 },
|
||||
...TRACKED_DOT,
|
||||
color,
|
||||
meta: { noradId },
|
||||
},
|
||||
drawn: false,
|
||||
|
||||
@@ -445,6 +445,8 @@ export function createTracking({ state: layerState, services, parts, source }) {
|
||||
|
||||
layerState._trackedEntity = parts.rendering._addTrackedEntity({
|
||||
position: trackedPosition,
|
||||
// Its own dot's colour: tracking never recolours a satellite.
|
||||
color: parts.controls._pointStyleFor(noradId, sat.group).color,
|
||||
viewFrom,
|
||||
});
|
||||
entityRecord(layerState._trackedEntity).selectionOrigin = origin;
|
||||
|
||||
Reference in new issue
Block a user