Class: HorizonComponent<P>
Defined in: src/sdk/components/horizon/HorizonComponent.tsx:43
A component which displays an artificial horizon. A horizon tracks the position, altitude, heading, pitch, and roll of an airplane and uses a persepctive projection to project points in space to a planar pixel grid. Each horizon component maintains a HorizonComponent instance which handles the details of the projection. HorizonLayer objects added to the horizon as children determine what is drawn in the horizon window.
Extends
Type Parameters
| Type Parameter | Default type |
|---|---|
P extends HorizonComponentProps | HorizonComponentProps |
Constructors
Constructor
new HorizonComponent<
P>(props):HorizonComponent<P>
Defined in: src/sdk/components/horizon/HorizonComponent.tsx:65
Parameters
| Parameter | Type |
|---|---|
props | P |
Returns
HorizonComponent<P>
Inherit Doc
Overrides
Properties
context?
optionalcontext: [] =undefined
Defined in: src/sdk/components/FSComponent.ts:64
The context on this component, if any.
Inherited from
contextType?
readonlyoptionalcontextType: readonly [] =undefined
Defined in: src/sdk/components/FSComponent.ts:67
The type of context for this component, if any.
Inherited from
projection
readonlyprojection:HorizonProjection
Defined in: src/sdk/components/horizon/HorizonComponent.tsx:47
This horizon component's projection.
props
props:
P&ComponentProps
Defined in: src/sdk/components/FSComponent.ts:61
The properties of the component.
Inherited from
Accessors
isAwake
Get Signature
get isAwake():
boolean
Defined in: src/sdk/components/horizon/HorizonComponent.tsx:98
Whether this horizon is awake.
Returns
boolean
Methods
attachLayer()
protectedattachLayer(layer):void
Defined in: src/sdk/components/horizon/HorizonComponent.tsx:234
Attaches a layer to this horizon component. If the layer is already attached, then this method has no effect.
Parameters
| Parameter | Type | Description |
|---|---|---|
layer | HorizonLayer | The layer to attach. |
Returns
void
attachLayers()
protectedattachLayers(thisNode):void
Defined in: src/sdk/components/horizon/HorizonComponent.tsx:163
Scans this component's VNode sub-tree for HorizonLayer components and attaches them when found. Only the top-most level of HorizonLayer components are attached; layers that are themselves children of other layers are not attached.
Parameters
| Parameter | Type | Description |
|---|---|---|
thisNode | VNode | This component's VNode. |
Returns
void
destroy()
destroy():
void
Defined in: src/sdk/components/horizon/HorizonComponent.tsx:306
Destroys this component.
Returns
void
Overrides
detachLayer()
protecteddetachLayer(layer):boolean
Defined in: src/sdk/components/horizon/HorizonComponent.tsx:249
Detaches a layer from this horizon component.
Parameters
| Parameter | Type | Description |
|---|---|---|
layer | HorizonLayer | The layer to detach. |
Returns
boolean
Whether the layer was succesfully detached.
getContext()
protectedgetContext(context):never
Defined in: src/sdk/components/FSComponent.ts:106
Gets a context data subscription from the context collection.
Parameters
| Parameter | Type | Description |
|---|---|---|
context | never | The context to get the subscription for. |
Returns
never
The requested context.
Throws
An error if no data for the specified context type could be found.
Inherited from
getProjectedSize()
getProjectedSize():
ReadonlyFloat64Array
Defined in: src/sdk/components/horizon/HorizonComponent.tsx:90
Gets the size of this map's projected window, in pixels.
Returns
The size of this map's projected window.
onAfterRender()
onAfterRender(
thisNode):void
Defined in: src/sdk/components/horizon/HorizonComponent.tsx:131
A callback that is called after the component is rendered.
Parameters
| Parameter | Type | Description |
|---|---|---|
thisNode | VNode | The component's VNode. |
Returns
void
Overrides
DisplayComponent.onAfterRender
onBeforeRender()
onBeforeRender():
void
Defined in: src/sdk/components/FSComponent.ts:80
A callback that is called before the component is rendered.
Returns
void
Inherited from
DisplayComponent.onBeforeRender
onProjectedSizeChanged()
protectedonProjectedSizeChanged():void
Defined in: src/sdk/components/horizon/HorizonComponent.tsx:226
This method is called when the size of this horizon's projected window changes.
Returns
void
onProjectionChanged()
protectedonProjectionChanged(projection,changeFlags):void
Defined in: src/sdk/components/horizon/HorizonComponent.tsx:212
This method is called when this horizon's projection changes.
Parameters
| Parameter | Type | Description |
|---|---|---|
projection | HorizonProjection | This horizon's projection. |
changeFlags | number | The types of changes made to the projection. |
Returns
void
onSleep()
protectedonSleep():void
Defined in: src/sdk/components/horizon/HorizonComponent.tsx:193
This method is called when this horizon is put to sleep.
Returns
void
onUpdated()
protectedonUpdated(time,elapsed):void
Defined in: src/sdk/components/horizon/HorizonComponent.tsx:279
This method is called once every update cycle.
Parameters
| Parameter | Type | Description |
|---|---|---|
time | number | The current real time as a UNIX timestamp in milliseconds. |
elapsed | number | The elapsed time, in milliseconds, since the last update. |
Returns
void
onWake()
protectedonWake():void
Defined in: src/sdk/components/horizon/HorizonComponent.tsx:176
This method is called when this horizon is awakened.
Returns
void
render()
render():
VNode
Defined in: src/sdk/components/horizon/HorizonComponent.tsx:297
Renders the component.
Returns
A JSX element to be rendered.
Overrides
sleep()
sleep():
void
Defined in: src/sdk/components/horizon/HorizonComponent.tsx:105
Puts this horizon to sleep. While asleep, this horizon will not be updated.
Returns
void
sleepLayers()
protectedsleepLayers():void
Defined in: src/sdk/components/horizon/HorizonComponent.tsx:200
Calls the onSleep() method of this horizon's layers.
Returns
void
update()
update(
time):void
Defined in: src/sdk/components/horizon/HorizonComponent.tsx:265
Updates this horizon.
Parameters
| Parameter | Type | Description |
|---|---|---|
time | number | The current real time as a UNIX timestamp in milliseconds. |
Returns
void
updateLayers()
protectedupdateLayers(time,elapsed):void
Defined in: src/sdk/components/horizon/HorizonComponent.tsx:289
Updates this horizon's attached layers.
Parameters
| Parameter | Type | Description |
|---|---|---|
time | number | The current real time as a UNIX timestamp in milliseconds. |
elapsed | number | The elapsed time, in milliseconds, since the last update. |
Returns
void
wake()
wake():
void
Defined in: src/sdk/components/horizon/HorizonComponent.tsx:112
Wakes this horizon, allowing it to be updated.
Returns
void
wakeLayers()
protectedwakeLayers():void
Defined in: src/sdk/components/horizon/HorizonComponent.tsx:183
Calls the onWake() method of this horizon's layers.
Returns
void