ControlsLayer

ControlsLayer

A CanvasLayer for displaying UI controls which are overlayed on top of other layers.

We track three types of events:

  1. Cursor movement
  2. Ruler measurement
  3. Map pings

Constructor

new ControlsLayer()

Members

(static) layerOptions

_cursors :Object

A mapping of user IDs to Cursor instances for quick access

Type:
  • Object

_rulers :Object

A convenience mapping of user IDs to Ruler instances for quick access

Type:
  • Object

cursors :PIXI.Container

Cursor position indicators

Type:
  • PIXI.Container

doors :PIXI.Container|null

Door control icons

Type:
  • PIXI.Container | null

effects

Status effect icons

ruler :Ruler

A convenience accessor to the Ruler for the active game user

Type:

rulers :PIXI.Container

Ruler tools, one per connected user

Type:
  • PIXI.Container

select :PIXI.Graphics

Canvas selection rectangle

Type:
  • PIXI.Graphics

Methods

_onMouseMove(event)

Handle mousemove events on the game canvas to broadcast activity of the user's cursor position

Parameters:
Name Type Description
event PIXI.InteractionEvent

createDoorControl(wall) → {DoorControl|null}

Create a Door Control icon for a given Wall object

Parameters:
Name Type Description
wall Wall

The Wall for which to create a DoorControl

Returns:

The created DoorControl

Type
DoorControl | null

deactivate()

draw()

drawCursor(user)

Create and draw the Cursor object for a given User

Parameters:
Name Type Description
user User

The User entity for whom to draw the cursor Container

drawCursors()

Draw the cursors container

drawDoors()

Draw the Door controls container

drawRulers()

Draw Ruler tools

drawSelect(coords)

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

Parameters:
Name Type Description
coords Object

The rectangle coordinates of the form {x, y, width, height}

getRulerForUser(userId) → {Ruler|null}

Get the Ruler display for a specific User ID

Parameters:
Name Type Description
userId string
Returns:
Type
Ruler | null

updateCursor(user, position)

Update the cursor when the user moves to a new position

Parameters:
Name Type Description
user User

The User for whom to update the cursor

position Point

The new cursor position

updateRuler(user, rulerData)

Update display of an active Ruler object for a user given provided data

Parameters:
Name Type Description
user User

The User for whom to update the ruler

rulerData object

Data which describes the new ruler measurement to display