Constructor
new Ruler(The)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
The |
User | User for whom to construct the Ruler instance |
Members
(static) STATES :Object
- Source:
The possible Ruler measurement states which can occur
Type:
- Object
_state :number
- Source:
Track the current measurement state
Type:
- number
active
- Source:
Is the Ruler being actively used to measure distance?
color :number|null
- Source:
The ruler color - by default the color of the active user
Type:
- number | null
destination :PIXI.Point
- Source:
The current destination point at the end of the measurement
Type:
- PIXI.Point
labels :PIXI.Container
- Source:
The Labels element is a Container of Text elements which label the measured path
Type:
- PIXI.Container
name :string
- Source:
The ruler name - used to differentiate between players
Type:
- string
ruler :PIXI.Graphics
- Source:
The Ruler element is a Graphics instance which draws the line and points of the measured path
Type:
- PIXI.Graphics
user :User
- Source:
Record the User which this Ruler references
Type:
waypoints :Array.<PIXI.Point>
- Source:
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()
- Source:
- See:
-
- {Canvas._onClickLeft}
Handle left-click events on the Canvas during Ruler measurement.
_onClickRight()
- Source:
- See:
-
- {Canvas._onClickRight}
Handle right-click events on the Canvas during Ruler measurement.
_onDragStart()
- Source:
- See:
-
- {Canvas._onDragLeftStart}
Handle the beginning of a new Ruler measurement workflow
_onMouseMove()
- Source:
- See:
-
- {Canvas._onDragLeftMove}
Continue a Ruler measurement workflow for left-mouse movements on the Canvas.
_onMouseUp()
- Source:
- See:
-
- {Canvas._onDragLeftDrop}
Conclude a Ruler measurement workflow by releasing the left-mouse button.
clear()
- Source:
Clear display of the current Ruler
measure(destination, gridSpaces)
- Source:
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>}
- Source:
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)
- Source:
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 |