Skip to main content

Class: HorizonSharedCanvasLayer

A horizon layer containing a single canvas synced to the horizon's projected size that can be shared amongst multiple sublayers for rendering.

All of the layer's children are rendered on top of the shared canvas element. All children that extend HorizonSharedCanvasSubLayer are treated as sublayers and can render to the shared canvas element.

Hierarchy

Constructors

constructor

new HorizonSharedCanvasLayer(props): HorizonSharedCanvasLayer

Creates an instance of a DisplayComponent.

Parameters

NameTypeDescription
propsHorizonCanvasLayerPropsThe propertis of the component.

Returns

HorizonSharedCanvasLayer

Inherited from

HorizonLayer.constructor

Defined in

src/sdk/components/FSComponent.ts:73

Properties

context

Optional context: [] = undefined

The context on this component, if any.

Inherited from

HorizonLayer.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

HorizonLayer.contextType

Defined in

src/sdk/components/FSComponent.ts:67


props

props: HorizonCanvasLayerProps & ComponentProps

The properties of the component.

Inherited from

HorizonLayer.props

Defined in

src/sdk/components/FSComponent.ts:61

Methods

destroy

destroy(): void

Destroys this component.

Returns

void

Overrides

HorizonLayer.destroy

Defined in

src/sdk/components/horizon/layers/HorizonSharedCanvasLayer.tsx:139


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

HorizonLayer.getContext

Defined in

src/sdk/components/FSComponent.ts:106


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

HorizonLayer.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

HorizonLayer.isVisible

Defined in

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


onAfterRender

onAfterRender(thisNode): void

A callback that is called after the component is rendered.

Parameters

NameTypeDescription
thisNodeVNodeThe component's VNode.

Returns

void

Overrides

HorizonLayer.onAfterRender

Defined in

src/sdk/components/horizon/layers/HorizonSharedCanvasLayer.tsx:50


onAttached

onAttached(): void

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

Returns

void

Overrides

HorizonLayer.onAttached

Defined in

src/sdk/components/horizon/layers/HorizonSharedCanvasLayer.tsx:68


onBeforeRender

onBeforeRender(): void

A callback that is called before the component is rendered.

Returns

void

Inherited from

HorizonLayer.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

HorizonLayer.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

HorizonLayer.onProjectionChanged

Defined in

src/sdk/components/horizon/layers/HorizonSharedCanvasLayer.tsx:95


onSleep

onSleep(): void

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

Returns

void

Overrides

HorizonLayer.onSleep

Defined in

src/sdk/components/horizon/layers/HorizonSharedCanvasLayer.tsx: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

Overrides

HorizonLayer.onUpdated

Defined in

src/sdk/components/horizon/layers/HorizonSharedCanvasLayer.tsx:108


onVisibilityChanged

onVisibilityChanged(isVisible): void

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

Parameters

NameTypeDescription
isVisiblebooleanWhether the layer is now visible.

Returns

void

Overrides

HorizonLayer.onVisibilityChanged

Defined in

src/sdk/components/horizon/layers/HorizonSharedCanvasLayer.tsx:41


onWake

onWake(): void

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

Returns

void

Overrides

HorizonLayer.onWake

Defined in

src/sdk/components/horizon/layers/HorizonSharedCanvasLayer.tsx:81


render

render(): VNode

Renders the component.

Returns

VNode

A JSX element to be rendered.

Overrides

HorizonLayer.render

Defined in

src/sdk/components/horizon/layers/HorizonSharedCanvasLayer.tsx:126


setVisible

setVisible(val): void

Sets this layer's visibility.

Parameters

NameTypeDescription
valbooleanWhether this layer should be visible.

Returns

void

Inherited from

HorizonLayer.setVisible

Defined in

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