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()

Source:

Members

_cursors :Object

Source:

A mapping of user IDs to Cursor instances for quick access

Type:
  • Object

_rulers :Object

Source:

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

Type:
  • Object

cursors :PIXI.Container

Source:

Cursor position indicators

Type:
  • PIXI.Container

doors

Source:

Door control icons

effects

Source:

Status effect icons

ruler :Ruler

Source:

A convenience accessor to the Ruler for the active game user

Type:

rulers :PIXI.Container

Source:

Ruler tools, one per connected user

Type:
  • PIXI.Container

select :PIXI.Graphics

Source:

Canvas selection rectangle

Type:
  • PIXI.Graphics

Methods

draw()

Source:

Draw current cursor UI elements

drawCursor(user)

Source:

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()

Source:

Draw the cursors container

drawDoors()

Source:

Draw the Door controls container

drawRulers()

Source:

Draw Ruler tools

drawSelect(coords)

Source:

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}

Source:

Get the Ruler display for a specific User ID

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

updateCursor()

Source:

Update the cursor when the user moves to a new position

updateRuler(user, rulerData)

Source:

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

Parameters:
Name Type Description
user User
rulerData Object