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.<string, Cursor>

A mapping of user IDs to Cursor instances for quick access

Type:

cursors :PIXI.Container

A container of cursor interaction elements. Contains cursors, rulers, interaction rectangles, and pings

Type:
  • PIXI.Container

debug :PIXI.Graphics

A graphics instance used for drawing debugging visualization

Type:
  • PIXI.Graphics

doors :PIXI.Container

A container of DoorControl instances

Type:
  • PIXI.Container

hud :PIXI.Container

A container of HUD interface elements

Type:
  • PIXI.Container

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

The 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

deactivate()

(async) draw()

drawCursor(user)

Create and draw the Cursor object for a given User

Parameters:
Name Type Description
user User

The User document for whom to draw the cursor Container

drawCursors()

Draw the cursors 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

(async) tearDown()

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