Skip to main content

Class: HorizonSyncedCanvasLayer

Defined in: src/sdk/components/horizon/layers/HorizonSyncedCanvasLayer.tsx:8

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

Extends​

Constructors​

Constructor​

new HorizonSyncedCanvasLayer(props): HorizonSyncedCanvasLayer

Defined in: src/sdk/components/FSComponent.ts:76

Creates an instance of a DisplayComponent.

Parameters​

ParameterTypeDescription
propsHorizonCanvasLayerPropsThe propertis of the component.

Returns​

HorizonSyncedCanvasLayer

Inherited from​

HorizonCanvasLayer.constructor

Properties​

context?​

optional context: [] = undefined

Defined in: src/sdk/components/FSComponent.ts:67

The context on this component, if any.

Inherited from​

HorizonCanvasLayer.context


contextType?​

readonly optional contextType: readonly [] = undefined

Defined in: src/sdk/components/FSComponent.ts:70

The type of context for this component, if any.

Inherited from​

HorizonCanvasLayer.contextType


isInit​

protected isInit: boolean = false

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

Inherited from​

HorizonCanvasLayer.isInit


props​

props: HorizonCanvasLayerProps & ComponentProps

Defined in: src/sdk/components/FSComponent.ts:64

The properties of the component.

Inherited from​

HorizonCanvasLayer.props

Accessors​

buffer​

Get Signature​

get buffer(): C

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

Gets this layer's buffer canvas instance.

Throws​

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

Returns​

C

This layer's buffer canvas instance.

Inherited from​

HorizonCanvasLayer.buffer


display​

Get Signature​

get display(): C

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

Gets this layer's display canvas instance.

Throws​

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

Returns​

C

This layer's display canvas instance.

Inherited from​

HorizonCanvasLayer.display

Methods​

copyBufferToDisplay()​

copyBufferToDisplay(): void

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

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


createCanvasInstance()​

protected createCanvasInstance(canvas, context, isDisplayed): HorizonCanvasLayerCanvasInstance

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

Creates a canvas instance.

Parameters​

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

Returns​

HorizonCanvasLayerCanvasInstance

a canvas instance.

Inherited from​

HorizonCanvasLayer.createCanvasInstance


destroy()​

destroy(): void

Defined in: src/sdk/components/FSComponent.ts:101

Destroys this component.

Returns​

void

Inherited from​

HorizonCanvasLayer.destroy


getContext()​

protected getContext(context): never

Defined in: src/sdk/components/FSComponent.ts:109

Gets a context data subscription from the context collection.

Parameters​

ParameterTypeDescription
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


getHeight()​

getHeight(): number

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

Gets the height of the canvas element, in pixels.

Returns​

number

the height of the canvas element.

Inherited from​

HorizonCanvasLayer.getHeight


getWidth()​

getWidth(): number

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

Gets the width of the canvas element, in pixels.

Returns​

number

the width of the canvas element.

Inherited from​

HorizonCanvasLayer.getWidth


isAttached()​

protected isAttached(): boolean

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

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


isVisible()​

isVisible(): boolean

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

Checks whether this layer is visible.

Returns​

boolean

whether this layer is visible.

Inherited from​

HorizonCanvasLayer.isVisible


onAfterRender()​

onAfterRender(): void

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

A callback called after the component renders.

Returns​

void

Inherited from​

HorizonCanvasLayer.onAfterRender


onAttached()​

onAttached(): void

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

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

Returns​

void

Overrides​

HorizonCanvasLayer.onAttached


onBeforeRender()​

onBeforeRender(): void

Defined in: src/sdk/components/FSComponent.ts:83

A callback that is called before the component is rendered.

Returns​

void

Inherited from​

HorizonCanvasLayer.onBeforeRender


onDetached()​

onDetached(): void

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

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

Returns​

void

Inherited from​

HorizonCanvasLayer.onDetached


onProjectionChanged()​

onProjectionChanged(projection, changeFlags): void

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

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

Parameters​

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

Returns​

void

Overrides​

HorizonCanvasLayer.onProjectionChanged


onSleep()​

onSleep(): void

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

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

Returns​

void

Inherited from​

HorizonCanvasLayer.onSleep


onUpdated()​

onUpdated(time, elapsed): void

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

This method is called once every update cycle.

Parameters​

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

Returns​

void

Inherited from​

HorizonCanvasLayer.onUpdated


onVisibilityChanged()​

protected onVisibilityChanged(): void

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

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

Returns​

void

Inherited from​

HorizonCanvasLayer.onVisibilityChanged


onWake()​

onWake(): void

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

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

Returns​

void

Inherited from​

HorizonCanvasLayer.onWake


render()​

render(): VNode

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

Renders the component.

Returns​

VNode

A JSX element to be rendered.

Inherited from​

HorizonCanvasLayer.render


setHeight()​

setHeight(height): void

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

Sets the height of the canvas element, in pixels.

Parameters​

ParameterTypeDescription
heightnumberThe new height.

Returns​

void

Inherited from​

HorizonCanvasLayer.setHeight


setVisible()​

setVisible(val): void

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

Sets this layer's visibility.

Parameters​

ParameterTypeDescription
valbooleanWhether this layer should be visible.

Returns​

void

Inherited from​

HorizonCanvasLayer.setVisible


setWidth()​

setWidth(width): void

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

Sets the width of the canvas element, in pixels.

Parameters​

ParameterTypeDescription
widthnumberThe new width.

Returns​

void

Inherited from​

HorizonCanvasLayer.setWidth


tryGetBuffer()​

tryGetBuffer(): HorizonCanvasLayerCanvasInstance | undefined

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

Attempts to get this layer's buffer canvas instance.

Returns​

HorizonCanvasLayerCanvasInstance | undefined

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

Inherited from​

HorizonCanvasLayer.tryGetBuffer


tryGetDisplay()​

tryGetDisplay(): HorizonCanvasLayerCanvasInstance | undefined

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

Attempts to get this layer's display canvas instance.

Returns​

HorizonCanvasLayerCanvasInstance | undefined

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

Inherited from​

HorizonCanvasLayer.tryGetDisplay


updateCanvasSize()​

protected updateCanvasSize(): void

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

Updates the canvas element's size.

Returns​

void

Inherited from​

HorizonCanvasLayer.updateCanvasSize