Constructor
new Ruler(The)
Parameters:
Name | Type | Description |
---|---|---|
The |
User | User for whom to construct the Ruler instance |
Members
_state :number
Track the current measurement state
Type:
- number
active
Is the Ruler being actively used to measure distance?
color :number|null
The ruler color - by default the color of the active user
Type:
- number | null
destination :PIXI.Point
The current destination point at the end of the measurement
Type:
- PIXI.Point
labels :PIXI.Container
The Labels element is a Container of Text elements which label the measured path
Type:
- PIXI.Container
name :string
The ruler name - used to differentiate between players
Type:
- string
ruler :PIXI.Graphics
The Ruler element is a Graphics instance which draws the line and points of the measured path
Type:
- PIXI.Graphics
STATES :number
An enumeration of the possible Ruler measurement states.
Type:
- number
user :User
Record the User which this Ruler references
Type:
waypoints :Array.<PIXI.Point>
This Array tracks individual waypoints along the ruler's measured path. The first waypoint is always the origin of the route.
Type:
- Array.<PIXI.Point>
Methods
_onClickLeft()
- See:
-
- {Canvas._onClickLeft}
Handle left-click events on the Canvas during Ruler measurement.
_onClickRight()
- See:
-
- {Canvas._onClickRight}
Handle right-click events on the Canvas during Ruler measurement.
_onDragStart()
- See:
-
- {Canvas._onDragLeftStart}
Handle the beginning of a new Ruler measurement workflow
_onMouseMove()
- See:
-
- {Canvas._onDragLeftMove}
Continue a Ruler measurement workflow for left-mouse movements on the Canvas.
_onMouseUp()
- See:
-
- {Canvas._onDragLeftDrop}
Conclude a Ruler measurement workflow by releasing the left-mouse button.
clear()
Clear display of the current Ruler
measure(destination, gridSpaces)
Measure the distance between two points and render the ruler UI to illustrate it
Parameters:
Name | Type | Description |
---|---|---|
destination |
PIXI.Point | The destination point to which to measure |
gridSpaces |
boolean | Restrict measurement only to grid spaces |
(async) moveToken() → {Promise.<boolean>}
Determine whether a SPACE keypress event entails a legal token movement along a measured ruler
Returns:
An indicator for whether a token was successfully moved or not. If True the event should be prevented from propagating further, if False it should move on to other handlers.
- Type
- Promise.<boolean>
update(data)
Update a Ruler instance using data provided through the cursor activity socket
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | Ruler data with which to update the display |