mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +00:00
Let a view show an aircraft's cockpit view
A view's follow may ask for cockpit view, which the app enters after it follows the aircraft; links cannot carry it and open the app following. Applying a view no longer flies the camera when the followed entity is already there, since the flight ended the follow; it flies only while waiting for the entity. The panel applies its first view again only when it asks for cockpit view.
This commit is contained in:
1 parent
89a448ee83
commit
d4311a9d54
6 files changed
+77
-25
No files matched your search
@@ -48,11 +48,13 @@ const FOLLOWABLE = Object.freeze({
|
||||
layer: 'flights',
|
||||
owner: 'flights',
|
||||
key: 'selectedFlightsTrackingId',
|
||||
cockpit: true,
|
||||
},
|
||||
military_aircraft: {
|
||||
layer: 'military',
|
||||
owner: 'flights',
|
||||
key: 'selectedMilitaryTrackingId',
|
||||
cockpit: true,
|
||||
},
|
||||
satellite: {
|
||||
layer: 'satellites',
|
||||
@@ -169,6 +171,12 @@ export const VIEW_PROPERTIES = Object.freeze({
|
||||
properties: {
|
||||
kind: { type: 'string', enum: [...VIEW_FOLLOW_KINDS] },
|
||||
id: { type: 'string', pattern: '^[0-9A-Za-z~_-]{1,16}$' },
|
||||
cockpit: {
|
||||
type: 'boolean',
|
||||
description:
|
||||
"Show the aircraft's cockpit view instead of following it from " +
|
||||
'outside. Aircraft only; links open the app following it.',
|
||||
},
|
||||
},
|
||||
required: ['kind', 'id'],
|
||||
additionalProperties: false,
|
||||
@@ -253,6 +261,8 @@ export function createView({
|
||||
const followed = follow ? FOLLOWABLE[follow.kind] : null;
|
||||
if (follow && !followed)
|
||||
throw new TypeError(`Cannot follow a ${follow.kind}`);
|
||||
if (follow?.cockpit === true && !followed.cockpit)
|
||||
throw new TypeError(`A ${follow.kind} has no cockpit view`);
|
||||
const enabled = new Set(
|
||||
layers.filter((layer) => REGISTERED_LAYER_IDS.includes(layer)),
|
||||
);
|
||||
@@ -276,6 +286,7 @@ export function createView({
|
||||
? Object.freeze({
|
||||
kind: follow.kind,
|
||||
id: String(follow.id).toLowerCase(),
|
||||
...(follow.cockpit === true ? { cockpit: true } : {}),
|
||||
})
|
||||
: null,
|
||||
annotations: Object.freeze(
|
||||
|
||||
Reference in new issue
Block a user