CanvasLayer

CanvasLayer

An abstract pattern for primary layers of the game canvas to implement.

Members

(static) instance :CanvasLayer

Return a reference to the active instance of this canvas layer

Type:

(static) layerOptions :CanvasLayerOptions

Customize behaviors of this CanvasLayer by modifying some behaviors at a class level.

Type:

_active :boolean

Track whether the canvas layer is currently active for interaction

Type:
  • boolean

name :string

The canonical name of the CanvasLayer

Type:
  • string

options :CanvasLayerOptions

Options for this layer instance.

Type:

Methods

activate() → {CanvasLayer}

Activate the CanvasLayer, deactivating other layers and marking this layer's children as interactive.

Returns:

The layer instance, now activated

Type
CanvasLayer

deactivate() → {CanvasLayer}

Deactivate the CanvasLayer, removing interactivity from its children.

Returns:

The layer instance, now inactive

Type
CanvasLayer

(async) draw() → {Promise.<CanvasLayer>}

Draw the canvas layer, rendering its internal components and returning a Promise The Promise resolves to the drawn layer once its contents are successfully rendered.

Returns:
Type
Promise.<CanvasLayer>

getZIndex() → {number}

Get the zIndex that should be used for ordering this layer vertically relative to others in the same Container.

Returns:
Type
number

(async) tearDown() → {Promise.<CanvasLayer>}

Deconstruct data used in the current layer in preparation to re-draw the canvas

Returns:
Type
Promise.<CanvasLayer>