The Tokens Layer

The Tokens Layer is the middle layer of the tabletop Canvas and it contains all the Sprites which represent actors within the game space. Tokens are placed onto the Tokens Layer by dragging actors from the Actors Directory (in the right sidebar) onto the canvas.

Tokens and Related Concepts

Token Layer API

All tokens which are rendered on the canvas are drawn as children of the TokenLayer(). The token layer may be accessed globally as canvas.tokens and provides the following API.

class TokenLayer()

The Token Container subclass of the PlaceablesLayer

TokenLayer.activate()

Override the activation behavior of the PlaceablesLayer. This layer is never interactive

TokenLayer.controlledTokens

type: Array

An Array of tokens which are currently controlled

TokenLayer.dataArray

type: Array

Define the source data array underlying the placeable objects contained in this layer

TokenLayer.deactivate()

Override the deactivation behavior of the PlaceablesLayer. Allow tokens to remain visible even when the layer is inactive

TokenLayer.draw()

Draw the TokenLayer. Draw each contained Token within the scene as a child of the objects container

Returns:TokenLayer
TokenLayer.drawSelect(event)

Draw the select rectangle given an event originated within the base canvas layer

Arguments:
  • event
TokenLayer.ownedTokens

type: Array

An Array of tokens which belong to actors which are owned

TokenLayer.placeableClass

type: PIXI.Container

Define a Container implementation used to render placeable objects contained in this layer

TokenLayer.playerTokens

type: Array

An Array of tokens which belong to the impersonated character

TokenLayer.releaseAllTokens(resetSight)

Release control of all tokens on the board

TokenLayer.select

type: PIXI.Graphics

Token Selection Rectangle

TokenLayer.selectTokens(coords)

Select all the tokens within a provided set of rectangular coordinates. Control any tokens within the area which you are able to control based on token permissions.

TokenLayer.tokens

type: Array

An Array of all tokens which are present in the Scene