Skip to main content

Class: HorizonSharedCanvasLayer

Defined in: src/sdk/components/horizon/layers/HorizonSharedCanvasLayer.tsx:31

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.

Extends

Constructors

Constructor

new HorizonSharedCanvasLayer(props): HorizonSharedCanvasLayer

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

Creates an instance of a DisplayComponent.

Parameters

ParameterTypeDescription
propsHorizonCanvasLayerPropsThe propertis of the component.

Returns

HorizonSharedCanvasLayer

Inherited from

HorizonLayer.constructor

Properties

context?

optional context: [] = undefined

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

The context on this component, if any.

Inherited from

HorizonLayer.context


contextType?

readonly optional contextType: readonly [] = undefined

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

The type of context for this component, if any.

Inherited from

HorizonLayer.contextType


props

props: HorizonCanvasLayerProps & ComponentProps

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

The properties of the component.

Inherited from

HorizonLayer.props

Methods

destroy()

destroy(): void

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

Destroys this component.

Returns

void

Overrides

HorizonLayer.destroy


getContext()

protected getContext(context): never

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

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

HorizonLayer.getContext


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

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

HorizonLayer.isVisible


onAfterRender()

onAfterRender(thisNode): void

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

A callback that is called after the component is rendered.

Parameters

ParameterTypeDescription
thisNodeVNodeThe component's VNode.

Returns

void

Overrides

HorizonLayer.onAfterRender


onAttached()

onAttached(): void

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

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

Returns

void

Overrides

HorizonLayer.onAttached


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

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

HorizonLayer.onDetached


onProjectionChanged()

onProjectionChanged(projection, changeFlags): void

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

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

HorizonLayer.onProjectionChanged


onSleep()

onSleep(): void

Defined in: src/sdk/components/horizon/layers/HorizonSharedCanvasLayer.tsx:88

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

Returns

void

Overrides

HorizonLayer.onSleep


onUpdated()

onUpdated(time, elapsed): void

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

Overrides

HorizonLayer.onUpdated


onVisibilityChanged()

protected onVisibilityChanged(isVisible): void

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

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

Parameters

ParameterTypeDescription
isVisiblebooleanWhether the layer is now visible.

Returns

void

Overrides

HorizonLayer.onVisibilityChanged


onWake()

onWake(): void

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

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

Returns

void

Overrides

HorizonLayer.onWake


render()

render(): VNode

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

Renders the component.

Returns

VNode

A JSX element to be rendered.

Overrides

HorizonLayer.render


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

HorizonLayer.setVisible