fix(local-adsb): a double-click follows a local aircraft with its card again

Each aircraft was an entity, which the default renderer's double-click
followed, showing its tracked card; an aircraft that expired took the
follow with it. As a draw-port icon it took no part in it. A double-click
follow can now carry the holder whose entity record shows the card.
This commit is contained in:
Sameh Khamis committed 2026-11-14 01:12:14 -08:00
1 parent f2983e8c1a
commit 766cf68272
3 files changed
+71 -3

No files matched your search

+9 -3
View File
@@ -9,6 +9,7 @@
*/
import { followOffsetFitting } from '../geo/frames.js';
import { findCamera, findQuery } from '../render/rendererOf.js';
import { entityFollowTarget } from './followed.js';
/**
* Where the camera frames a part it starts following: `followOffsetFitting`
@@ -37,11 +38,13 @@ export function followViewFrom(sphere, at, camera) {
* @param {() => boolean} options.enabled Whether the layer takes clicks now.
* @param {(hit: import('../render/contract/query').Hit) =>
* ({key: string, position: () => ({x: number, y: number, z: number}|null),
* sphere?: {center: object, radius: number}}
* sphere?: {center: object, radius: number}, entity?: object}
* | {zoomTo: {center: object, radius: number}}
* | null)} options.targetFor What a hit on one of the layer's items is
* followed by (`key`, its live `position`, the bounds it is framed by,
* radius 0 by default), or zoomed to (`zoomTo`); null for anything else.
* radius 0 by default, and the holder whose entity record shows it, as
* `entityFollowTarget` reads one), or zoomed to (`zoomTo`); null for
* anything else.
* @returns {{readonly following: object|null, stop(): void, destroy(): void}}
*/
export function followOnDoubleClick({
@@ -77,7 +80,7 @@ export function followOnDoubleClick({
}
const at = found.position();
if (!at) return;
const target = {
const fields = {
key: found.key,
position: found.position,
frame: 'enu',
@@ -87,6 +90,9 @@ export function followOnDoubleClick({
camera,
),
};
const target = found.entity
? entityFollowTarget(found.entity, fields)
: fields;
camera.follow(target);
follow = target;
} catch (error) {