mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 00:32:21 +00:00
Rebuild the Context panel around the selected item and the view
Clicking anything a layer can identify opens one card in Context: a hero tile (route globe and 3D model for a flight, the camera for CCTV, headline figures otherwise), its facts, actions with Cockpit or the orbital view as the primary one, and a standard set of nearby blocks (weather and local time, flights, vessels, hazards, alerts) within one radius the user sets. Aircraft show altitude as a graph. Things that move are followed when picked, and a card closes when its layer is turned off. With nothing selected the panel describes the view: the layers that are on with a breakdown of what each holds, the camera's height, what is in view, then time, weather and local news. From far out it shows worldwide counts per layer. A search field in the header narrows whatever the panel shows. Prototype. Context reads weather and hazard feeds while its panel is closed, the two 3D previews on a flight card repaint continuously, Follow can show pressed after tracking has ended elsewhere, and most new strings are fixed English. Same-named sites are told apart by position, not by a stable id.
This commit is contained in:
1 parent
f7f18c2823
commit
cc83763452
21 files changed
+6595
-1
No files matched your search
@@ -0,0 +1,82 @@
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
// Context's layer tabs: when a layer that has its own settings is on, those
|
||||
// settings move out of the panel they normally live in (Visual) into a tab
|
||||
// in the Context panel, so they sit beside what they affect.
|
||||
// Each tab's content is teleported into `#context-tab-<id>`; when the layer
|
||||
// goes off the content returns to its usual panel.
|
||||
const AIRCRAFT = ['flights', 'military', 'local-adsb'];
|
||||
|
||||
// Layers that draw labels and cards through the world overlay, which the
|
||||
// Dense settings (density, allocation, fade, outside) govern.
|
||||
export const LABEL_LAYERS = new Set([
|
||||
'satellites',
|
||||
'ais-live-vessels',
|
||||
'rocket-launches',
|
||||
'cctv',
|
||||
'transit',
|
||||
'bikeshare',
|
||||
'radio',
|
||||
'local-adsb',
|
||||
'earthquakes',
|
||||
'local-firms',
|
||||
'fire-perimeters',
|
||||
'weather-cyclones',
|
||||
'air-quality',
|
||||
'alpr-cameras',
|
||||
'drone-airspace',
|
||||
'military-installations',
|
||||
'telegeography-submarine-cables',
|
||||
'osm-places',
|
||||
's2-ghostmaps',
|
||||
'directions',
|
||||
]);
|
||||
|
||||
// Which of the layers that are on each tab acts on.
|
||||
export const TAB_AFFECTS = {
|
||||
labels: (on) => [...on].filter((id) => LABEL_LAYERS.has(id)),
|
||||
aircraft: (on) => [...on].filter((id) => AIRCRAFT.includes(id)),
|
||||
};
|
||||
|
||||
export const LAYER_TABS = [
|
||||
// Labels and cards the world overlay draws for the label layers.
|
||||
{ id: 'labels', label: 'Labels', icon: 'label', when: (on) => TAB_AFFECTS.labels(on).length > 0 },
|
||||
{ id: 'aircraft', label: '3D aircraft', icon: 'flight', when: (on) => TAB_AFFECTS.aircraft(on).length > 0 },
|
||||
];
|
||||
|
||||
/** Ids of the layers that are on; Context refreshes it. */
|
||||
export const enabledLayerIds = ref(new Set());
|
||||
|
||||
export function setEnabledLayers(ids) {
|
||||
const next = new Set(ids);
|
||||
const prev = enabledLayerIds.value;
|
||||
if (next.size === prev.size && [...next].every((id) => prev.has(id))) return;
|
||||
enabledLayerIds.value = next;
|
||||
}
|
||||
|
||||
/** Whether Context is mounted and can host tab content. */
|
||||
export const contextReady = ref(false);
|
||||
|
||||
/** The tabs available now. */
|
||||
export const availableTabs = computed(() =>
|
||||
contextReady.value ? LAYER_TABS.filter((tab) => tab.when(enabledLayerIds.value)) : [],
|
||||
);
|
||||
|
||||
export const hasTab = (id) => availableTabs.value.some((tab) => tab.id === id);
|
||||
|
||||
/** The tab Context shows: 'view' (the card) or a layer tab's id. */
|
||||
export const activeTab = ref('view');
|
||||
|
||||
// Each tab's content lands in an element made here, before any panel mounts,
|
||||
// so a panel that mounts ahead of Context still has a real target; Context
|
||||
// places these elements in its tab panes when it mounts.
|
||||
const targets = new Map();
|
||||
export function tabTarget(id) {
|
||||
if (!targets.has(id) && globalThis.document) {
|
||||
const el = document.createElement('div');
|
||||
el.className = 'context-tab-body';
|
||||
el.dataset.tab = id;
|
||||
targets.set(id, el);
|
||||
}
|
||||
return targets.get(id) ?? 'body';
|
||||
}
|
||||
Reference in new issue
Block a user