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 Layer

TokenLayer._onMouseEnd(event)

Conclude an area selection event

TokenLayer.drawSelect(event)

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

Arguments:
  • event
TokenLayer.drawToken(tokenData)

Draw a new Token onto the canvas TokenLayer

Arguments:
  • tokenData (Object) – The data object from which to create a new Token
Returns:

Token – The new Token container

TokenLayer.getToken(tokenId)

Get a token by its tokenId

TokenLayer.releaseAllTokens()

Release control of all tokens on the board

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.