Skip to main content

Class: HorizonSyncedCanvasLayer

A canvas horizon layer whose size and position is synced with the horizon projection window.

Hierarchy

Constructors

constructor

new HorizonSyncedCanvasLayer(props): HorizonSyncedCanvasLayer

Creates an instance of a DisplayComponent.

Parameters

NameTypeDescription
propsHorizonCanvasLayerPropsThe propertis of the component.

Returns

HorizonSyncedCanvasLayer

Inherited from

HorizonCanvasLayer.constructor

Defined in

src/sdk/components/FSComponent.ts:73

Properties

context

Optional context: [] = undefined

The context on this component, if any.

Inherited from

HorizonCanvasLayer.context

Defined in

src/sdk/components/FSComponent.ts:64


contextType

Optional Readonly contextType: readonly [] = undefined

The type of context for this component, if any.

Inherited from

HorizonCanvasLayer.contextType

Defined in

src/sdk/components/FSComponent.ts:67


isInit

Protected isInit: boolean = false

Inherited from

HorizonCanvasLayer.isInit

Defined in

src/sdk/components/horizon/layers/HorizonCanvasLayer.tsx:82


props

props: HorizonCanvasLayerProps & ComponentProps

The properties of the component.

Inherited from

HorizonCanvasLayer.props

Defined in

src/sdk/components/FSComponent.ts:61

Accessors

buffer

get buffer(): C

Gets this layer's buffer canvas instance.

Returns

C

This layer's buffer canvas instance.

Throws

Error if this layer's buffer canvas instance has not been initialized.

Inherited from

HorizonCanvasLayer.buffer

Defined in

src/sdk/components/horizon/layers/HorizonCanvasLayer.tsx:102


display

get display(): C

Gets this layer's display canvas instance.

Returns

C

This layer's display canvas instance.

Throws

Error if this layer's display canvas instance has not been initialized.

Inherited from

HorizonCanvasLayer.display

Defined in

src/sdk/components/horizon/layers/HorizonCanvasLayer.tsx:89

Methods

copyBufferToDisplay

copyBufferToDisplay(): void

Copies the contents of the buffer to the display. Has no effect if this layer does not have a buffer.

Returns

void

Inherited from

HorizonCanvasLayer.copyBufferToDisplay

Defined in

src/sdk/components/horizon/layers/HorizonCanvasLayer.tsx:175


createCanvasInstance

createCanvasInstance(canvas, context, isDisplayed): HorizonCanvasLayerCanvasInstance

Creates a canvas instance.

Parameters

NameTypeDescription
canvasHTMLCanvasElementThe canvas element.
contextCanvasRenderingContext2DThe canvas 2D rendering context.
isDisplayedbooleanWhether the canvas is displayed.

Returns

HorizonCanvasLayerCanvasInstance

a canvas instance.

Inherited from

HorizonCanvasLayer.createCanvasInstance

Defined in

src/sdk/components/horizon/layers/HorizonCanvasLayer.tsx:226


destroy

destroy(): void

Destroys this component.

Returns

void

Inherited from

HorizonCanvasLayer.destroy

Defined in

src/sdk/components/FSComponent.ts:98


getContext

getContext(context): never

Gets a context data subscription from the context collection.

Parameters

NameTypeDescription
contextneverThe 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

HorizonCanvasLayer.getContext

Defined in

src/sdk/components/FSComponent.ts:106


getHeight

getHeight(): number

Gets the height of the canvas element, in pixels.

Returns

number

the height of the canvas element.

Inherited from

HorizonCanvasLayer.getHeight

Defined in

src/sdk/components/horizon/layers/HorizonCanvasLayer.tsx:138


getWidth

getWidth(): number

Gets the width of the canvas element, in pixels.

Returns

number

the width of the canvas element.

Inherited from

HorizonCanvasLayer.getWidth

Defined in

src/sdk/components/horizon/layers/HorizonCanvasLayer.tsx:130


isAttached

isAttached(): boolean

Checks whether this layer is attached to a horizon component.

Returns

boolean

Whether this layer is attached to a horizon component.

Inherited from

HorizonCanvasLayer.isAttached

Defined in

src/sdk/components/horizon/HorizonLayer.ts:31


isVisible

isVisible(): boolean

Checks whether this layer is visible.

Returns

boolean

whether this layer is visible.

Inherited from

HorizonCanvasLayer.isVisible

Defined in

src/sdk/components/horizon/HorizonLayer.ts:39


onAfterRender

onAfterRender(): void

A callback called after the component renders.

Returns

void

Inherited from

HorizonCanvasLayer.onAfterRender

Defined in

src/sdk/components/horizon/layers/HorizonCanvasLayer.tsx:186


onAttached

onAttached(): void

This method is called when this layer is attached to its parent horizon component.

Returns

void

Overrides

HorizonCanvasLayer.onAttached

Defined in

src/sdk/components/horizon/layers/HorizonSyncedCanvasLayer.tsx:10


onBeforeRender

onBeforeRender(): void

A callback that is called before the component is rendered.

Returns

void

Inherited from

HorizonCanvasLayer.onBeforeRender

Defined in

src/sdk/components/FSComponent.ts:80


onDetached

onDetached(): void

This method is called when this layer is detached from its parent horizon component.

Returns

void

Inherited from

HorizonCanvasLayer.onDetached

Defined in

src/sdk/components/horizon/HorizonLayer.ts:115


onProjectionChanged

onProjectionChanged(projection, changeFlags): void

This method is called when this layer's horizon projection changes.

Parameters

NameTypeDescription
projectionHorizonProjectionThis layer's horizon projection.
changeFlagsnumberThe types of changes made to the projection.

Returns

void

Overrides

HorizonCanvasLayer.onProjectionChanged

Defined in

src/sdk/components/horizon/layers/HorizonSyncedCanvasLayer.tsx:30


onSleep

onSleep(): void

This method is called when this layer's parent horizon component is put to sleep.

Returns

void

Inherited from

HorizonCanvasLayer.onSleep

Defined in

src/sdk/components/horizon/HorizonLayer.ts:88


onUpdated

onUpdated(time, elapsed): void

This method is called once every update cycle.

Parameters

NameTypeDescription
timenumberThe current time as a UNIX timestamp in milliseconds.
elapsednumberThe elapsed time, in milliseconds, since the last update.

Returns

void

Inherited from

HorizonCanvasLayer.onUpdated

Defined in

src/sdk/components/horizon/HorizonLayer.ts:108


onVisibilityChanged

onVisibilityChanged(): void

This method is called when this layer's visibility changes.

Returns

void

Inherited from

HorizonCanvasLayer.onVisibilityChanged

Defined in

src/sdk/components/horizon/layers/HorizonCanvasLayer.tsx:191


onWake

onWake(): void

This method is called when this layer's parent horizon component is awakened.

Returns

void

Inherited from

HorizonCanvasLayer.onWake

Defined in

src/sdk/components/horizon/HorizonLayer.ts:81


render

render(): VNode

Renders the component.

Returns

VNode

A JSX element to be rendered.

Inherited from

HorizonCanvasLayer.render

Defined in

src/sdk/components/horizon/layers/HorizonCanvasLayer.tsx:255


setHeight

setHeight(height): void

Sets the height of the canvas element, in pixels.

Parameters

NameTypeDescription
heightnumberThe new height.

Returns

void

Inherited from

HorizonCanvasLayer.setHeight

Defined in

src/sdk/components/horizon/layers/HorizonCanvasLayer.tsx:161


setVisible

setVisible(val): void

Sets this layer's visibility.

Parameters

NameTypeDescription
valbooleanWhether this layer should be visible.

Returns

void

Inherited from

HorizonCanvasLayer.setVisible

Defined in

src/sdk/components/horizon/HorizonLayer.ts:47


setWidth

setWidth(width): void

Sets the width of the canvas element, in pixels.

Parameters

NameTypeDescription
widthnumberThe new width.

Returns

void

Inherited from

HorizonCanvasLayer.setWidth

Defined in

src/sdk/components/horizon/layers/HorizonCanvasLayer.tsx:146


tryGetBuffer

tryGetBuffer(): undefined | HorizonCanvasLayerCanvasInstance

Attempts to get this layer's buffer canvas instance.

Returns

undefined | HorizonCanvasLayerCanvasInstance

This layer's buffer canvas instance, or undefined if it has not been initialized.

Inherited from

HorizonCanvasLayer.tryGetBuffer

Defined in

src/sdk/components/horizon/layers/HorizonCanvasLayer.tsx:122


tryGetDisplay

tryGetDisplay(): undefined | HorizonCanvasLayerCanvasInstance

Attempts to get this layer's display canvas instance.

Returns

undefined | HorizonCanvasLayerCanvasInstance

This layer's display canvas instance, or undefined if it has not been initialized.

Inherited from

HorizonCanvasLayer.tryGetDisplay

Defined in

src/sdk/components/horizon/layers/HorizonCanvasLayer.tsx:114


updateCanvasSize

updateCanvasSize(): void

Updates the canvas element's size.

Returns

void

Inherited from

HorizonCanvasLayer.updateCanvasSize

Defined in

src/sdk/components/horizon/layers/HorizonCanvasLayer.tsx:233