The Ruler constructor.
Optional
user: User = game.userThe User for whom to construct the Ruler instance
Optional
options: { Additional options
The color of the ruler (defaults to the color of the User)
Record the User which this Ruler references
The ruler name - used to differentiate between players
The ruler color - by default the color of the active user
The Ruler element is a Graphics instance which draws the line and points of the measured path
The Labels element is a Container of Text elements which label the measured path
The current destination point at the end of the measurement
This Array tracks individual waypoints along the ruler's measured path. The first waypoint is always the origin of the route.
The array of most recently computed ruler measurement segments
The computed total distance of the Ruler.
The computed total cost of the Ruler.
Protected
_stateThe current state of the Ruler (one of Ruler.STATES).
Private
#throttleA throttled function that broadcasts the measurement data.
The origin point of the measurement, which is the first waypoint.
The measurement history.
The current state of the Ruler (one of Ruler.STATES).
Is the Ruler being actively used to measure distance?
Get a GridHighlight layer for this Ruler
Static
STATESThe possible Ruler measurement states.
Static
canIs the ruler ready for measure?
Measure the distance between two points and render the ruler UI to illustrate it
The destination point to which to measure
Optional
options: { Additional options
Snap the destination?
If not forced and the destination matches the current destination of this ruler, no measuring is done and nothing is returned
The array of measured segments if measured
Determine whether a SPACE keypress event entails a legal token movement along a measured ruler
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.
Update a Ruler instance using data provided through the cursor activity socket
Ruler data with which to update the display
Protected
_getProtected
_getProtected
Get the destination point. By default the point is snapped to grid space centers.
The point coordinates
Optional
options: { Additional options
Snap the point?
The snapped destination point
Protected
_getProtected
Translate the waypoints and destination point of the Ruler into an array of Ray segments.
The segments of the measured path
Protected
_startProtected
Handle the start of a Ruler measurement workflow
The origin
Optional
options: { Additional options
Snap the origin?
The token that is moved (defaults to Ruler#_getMovementToken)
Protected
_endProtected
_addProtected
_removeProtected
_getProtected
_computeProtected
_getProtected
Get the text label for a segment of the measured path
Protected
_drawProtected
_highlightProtected
Highlight the measurement required to complete the move in the minimum number of discrete spaces
Protected
_getProtected
_getProtected
Get the current measurement history.
The current measurement history, if any
Protected
_createProtected
Create the next measurement history from the current history and current Ruler state.
The next measurement history
Protected
_canProtected
Test whether a Token is allowed to execute a measured movement path.
The Token being tested
Whether the movement is allowed
A specific Error message used instead of returning false
Protected
_animateProtected
Animate piecewise Token movement along the measured segment path.
The Token being animated
A Promise which resolves once all animation is completed
Protected
_animateProtected
Update Token position and configure its animation properties for the next leg of its animation.
The Token being updated
The measured segment being moved
The adjusted destination coordinate
Optional
updateOptions: object = {}Additional options to configure the TokenDocument
update
A Promise that resolves once the animation for this segment is done
Protected
_preProtected
An method which can be extended by a subclass of Ruler to define custom behaviors before a confirmed movement.
The Token that will be moving
Protected
_postProtected
An event which can be extended by a subclass of Ruler to define custom behaviors before a confirmed movement.
The Token that finished moving
Protected
_broadcastProtected
_getProtected
Package Ruler data to an object which can be serialized to a string.
Protected
_onProtected
_onProtected
_onProtected
_onProtected
_onProtected
_onPrivate
#broadcast
The Ruler - used to measure distances and trigger movements