mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 00:32:21 +00:00
Show a flight's photo, route, model and cockpit view in its Context card
The card's hero tile now previews what was picked. A flight shows its photo when Contacts has one, its route on a small globe from origin to destination with the plane on it, its 3D model turning with callouts of what can be worked out about the flight (phase, flight level, Mach, squawk, signal age), and the view ahead from its cockpit with speed and altitude tapes. The model and the cockpit view take turns, the route hands over to the cockpit view after twenty seconds, and a switch picks one and holds it. Under reduced motion nothing swaps by itself. A satellite shows the ground beneath it and graphs its altitude and speed. Each preview draws in a small scene of its own and frees its graphics context as it closes, so flicking through cards never pushes out the globe's. Co-authored-by: Sameh Khamis <[email protected]>
This commit is contained in:
1 parent
8c1fd235c0
commit
c6bdd38b61
10 files changed
+2196
-14
No files matched your search
@@ -0,0 +1,30 @@
|
||||
// The card previews (the turning model, the route globe) each draw in a
|
||||
// small Cesium scene of their own, so each holds a WebGL context. A browser
|
||||
// keeps only a handful of those open, and when there are too many it drops
|
||||
// the oldest, which is the main globe's. A destroyed widget's context is
|
||||
// otherwise freed only when garbage is collected, so flicking through cards
|
||||
// can push the globe's context out. Losing a preview's context on purpose as
|
||||
// it closes frees it at once.
|
||||
|
||||
/**
|
||||
* Destroy a preview's Cesium widget and free its WebGL context.
|
||||
* @param {object|null} widget a Cesium CesiumWidget
|
||||
*/
|
||||
export function destroyPreviewWidget(widget) {
|
||||
if (!widget || widget.isDestroyed?.()) return;
|
||||
let gl = null;
|
||||
try {
|
||||
gl =
|
||||
widget.scene?.context?._gl ??
|
||||
widget.canvas?.getContext?.('webgl2') ??
|
||||
null;
|
||||
} catch {
|
||||
gl = null;
|
||||
}
|
||||
widget.destroy();
|
||||
try {
|
||||
gl?.getExtension?.('WEBGL_lose_context')?.loseContext();
|
||||
} catch {
|
||||
// Nothing more can be done; the context goes when it is collected.
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user