mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 17:22:19 +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
@@ -600,6 +600,29 @@ test('an aid to navigation is drawn as the upright buoy, a vessel as its kind’
|
||||
assert.deepEqual(sail.size, buoy.size);
|
||||
});
|
||||
|
||||
test('selecting a vessel or an aid never changes its colour', async () => {
|
||||
const aid = {
|
||||
...observation('993672002'),
|
||||
mmsi: '993672002',
|
||||
type: 'Port Hand Mark',
|
||||
speedMps: 0,
|
||||
};
|
||||
const ship = { ...observation('366999004'), type: 'Cargo' };
|
||||
const { layer, icons } = setup({
|
||||
async getSnapshot() {
|
||||
return snapshot([aid, ship]);
|
||||
},
|
||||
});
|
||||
await layer.update();
|
||||
for (const [id, css] of [
|
||||
['366999004', VESSEL_KIND_STYLES.cargo.css],
|
||||
['993672002', AID_TO_NAVIGATION_STYLE.css],
|
||||
]) {
|
||||
assert.equal(layer.selectById(id), true);
|
||||
assert.deepEqual(icons.item(id).color, cssColor(css), id);
|
||||
}
|
||||
});
|
||||
|
||||
test('a virtual aid to navigation keeps its buoy and its virtual flag', async () => {
|
||||
const aid = {
|
||||
...observation('993672009'),
|
||||
|
||||
@@ -61,8 +61,6 @@ const HIDDEN_FOLLOW_MS = 250;
|
||||
|
||||
/** A vessel or aid sprite's drawn size before its scale (CSS px). */
|
||||
const SHIP_ICON_PX = 32;
|
||||
/** A selected vessel's or aid's tint. */
|
||||
const SELECTED_TINT = Object.freeze([1, 1, 1, 1]);
|
||||
|
||||
let instances = 0;
|
||||
|
||||
@@ -413,7 +411,6 @@ export function createRendering({
|
||||
|
||||
/** The icon item a record draws, as it now is. */
|
||||
function iconItem(record, visual) {
|
||||
const selected = record === state.selectedRecord;
|
||||
const aid = isAidToNavigation(record);
|
||||
const courseDeg = vesselCourseDeg(record);
|
||||
// Following the clock, not there yet at the time drawn.
|
||||
@@ -430,8 +427,8 @@ export function createRendering({
|
||||
pos: plan?.pos ?? visual.position,
|
||||
image: shipIcon(record),
|
||||
size: [SHIP_ICON_PX, SHIP_ICON_PX],
|
||||
// Tinted by type; selection changes the colour only, never the size.
|
||||
color: selected ? SELECTED_TINT : shipTint(record),
|
||||
// Tinted by type; selection changes neither the colour nor the size.
|
||||
color: shipTint(record),
|
||||
scale: shipScale(record),
|
||||
// An aid's buoy stands upright on screen; a vessel turns with course.
|
||||
rotationMode: aid ? 'screen' : 'course',
|
||||
|
||||
Reference in new issue
Block a user