mirror of
https://github.com/BigBodyCobain/Shadowbroker.git
synced 2026-09-21 00:10:49 +02:00
fix(map): keep tracked aircraft and yacht labels in step with data filters
Tracked-flight and tracked-yacht HTML labels are rendered from the raw store arrays, while their icons come from the worker GeoJSON that already has the operator's data filters applied. Filtering Tracked Aircraft to a category therefore removed the icons but left every other aircraft's name on the map. Derive the label subjects from the ids in the filtered feature collection so a label is only drawn where an icon is. The id rule lives in one shared helper used by both the worker builders and the label selector; rows with no identifier keep the worker's positional fallback and draw no label. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
a5fb1c392e
commit
f95b0eccc5
@@ -0,0 +1,18 @@
|
||||
import type { Ship } from '@/types/dashboard';
|
||||
|
||||
/**
|
||||
* Feature ids shared by the worker that builds map icons and the main-thread
|
||||
* code that picks label subjects, so both sides agree on which record a
|
||||
* feature represents. Records with no identifier get the worker's positional
|
||||
* fallback, which cannot be matched from outside and so draw no label.
|
||||
*/
|
||||
export function trackedFlightFeatureId(
|
||||
f: { icao24?: string; callsign?: string },
|
||||
fallback = '',
|
||||
): string {
|
||||
return f.icao24 || f.callsign || fallback;
|
||||
}
|
||||
|
||||
export function shipFeatureId(s: Pick<Ship, 'mmsi' | 'name'>, fallback = ''): string {
|
||||
return String(s.mmsi || s.name || fallback);
|
||||
}
|
||||
Reference in New Issue
Block a user