A Token is an implementation of PlaceableObject which represents an Actor within a viewed Scene on the game canvas.

See

-

Hierarchy (view full)

Properties

Accessors

Methods

getMovementAdjustedPoint initializeSources initializeLightSource initializeVisionSource clear _destroy _draw _applyRenderFlags drawBars drawEffects getRingColors getRingEffects animate stopAnimation checkCollision getSize getShape getCenterPoint getSnappedPosition testInsideRegion segmentizeRegionMovement setTarget getLightRadius _getShiftedPosition _updateRotation _onCreate _onUpdate _onDelete _configureFilterEffect _updateSpecialStatusFilterEffects _removeAllFilterEffects _onControl _onRelease _overlapsSelection _canControl _canHUD _canConfigure _canHover _canView _canDrag _onHoverIn _onHoverOut _onClickLeft _propagateLeftClick _onClickLeft2 _onClickRight2 _onDragLeftStart _prepareDragLeftDropUpdates _onDragLeftMove _onDragEnd applyRenderFlags destroy draw _partialDraw refresh _updateQuadtree control release clone rotate activateListeners can _isLightSource _getLightSourceData _getVisionBlindedStates _getVisionSourceData _isVisionSource _renderDetectionFilter _refreshRingVisuals _refreshVisibility _refreshState _refreshSize _refreshShape _refreshRotation _refreshPosition _refreshElevation _refreshTooltip _refreshNameplate _refreshMesh _refreshShader _refreshBorder _getBorderColor _refreshTarget _drawTarget _drawBar _getTooltipText _getTextStyle _drawEffects _drawEffect _drawOverlay _refreshEffects _canViewMode _getAnimationData _getAnimationDuration _onAnimationUpdate _prepareAnimation _onApplyStatusEffect _getTargetAlpha _createInteractionManager _canCreate _canDragLeftStart _canUpdate _canDelete _onUnclickLeft _propagateRightClick _onClickRight _onUnclickRight _onDragStart _onDragLeftDrop _onDragLeftCancel _onDragRightStart _onDragRightMove _onDragRightDrop _onDragRightCancel _onLongPress #initialize #initializeRing #createLightSource #destroyLightSource #createVisionSource #destroyVisionSource #cleanData #drawAttributeBars #getBorderColor #drawNameplate #drawTooltip #animateFrame #handleTeleportAnimation #handleTransitionChanges #prepareTargetToken #getMovementSource #snapToSquareGrid #snapToHexagonalGrid #recordPosition #panCanvas #commitDragLeftDropUpdates #handleRotationChanges #updatePadding #createTransitionFilter #getHexagonalShape #createHexagonalEllipseOrTrapezoid #createHexagonalRectangle

Properties

shape: Rectangle | Polygon | Circle

The shape of this token.

detectionFilter: any = null

Defines the filter to use for detection.

Param: filter

border: Graphics

A Graphics instance which renders the border frame for this Token inside the GridLayer.

effects: Container

The effects icons of temporary ActiveEffects that are applied to the Actor of this Token.

bars: Container

The attribute bars of this Token.

tooltip: PreciseText

The tooltip text of this Token, which contains its elevation.

target: Graphics

The target marker, which indicates that this Token is targeted by this User or others.

nameplate: PreciseText

The nameplate of this Token, which displays its name.

targeted: Set<User> = ...

Track the set of User documents which are currently targeting this Token

A reference to the SpriteMesh which displays this Token in the PrimaryCanvasGroup.

voidMesh: DisplayObject

Renders the mesh of this Token with ERASE blending in the Token.

detectionFilterMesh: DisplayObject

Renders the mesh of with the detection filter.

texture: Texture

The texture of this Token, which is used by its mesh.

vision: PointVisionSource

A reference to the VisionSource object which defines this vision source area of effect. This is undefined if the Token does not provide an active source of vision.

light: PointLightSource

A reference to the LightSource object which defines this light source area of effect. This is undefined if the Token does not provide an active source of light.

scene: Scene

Retain a reference to the Scene within which this Placeable Object resides

document: Document

A reference to the Scene embedded Document instance which this object represents

controlIcon: ControlIcon

A control icon for interacting with the object

mouseInteractionManager: MouseInteractionManager

A mouse interaction manager instance which handles mouse workflows related to this object.

#priorMovement: {
    dx: number;
    dy: number;
    ox: number;
    oy: number;
}

An Object which records the Token's prior velocity dx and dy. This can be used to determine which direction a Token was previously moving.

Type declaration

  • dx: number
  • dy: number
  • ox: number
  • oy: number
#adjustedCenter: Point

The Token central coordinate, adjusted for its most recent movement vector.

#validPosition: Point

The Token's most recent valid position and rotation.

#unlinkedVideo: boolean = false

A flag to capture whether this Token has an unlinked video texture.

#animationData: TokenAnimationData

The current animation data of this Token.

#priorAnimationData: TokenAnimationData

The prior animation data of this Token.

#filterEffects: Map<string, any> = ...

A map of effects id and their filters applied on this token placeable.

#original: PlaceableObject

The object that this object is a preview of if this object is a preview.

#lastQuadtreeBounds: Rectangle

The bounds that the placeable was added to the quadtree with.

#drawing: Promise<PlaceableObject> = ...

An internal reference to a Promise in-progress to draw the Placeable Object.

#drawn: boolean = false

Has this Placeable Object been drawn and is there no drawing in progress?

embeddedName: string = "Token"

Identify the official Document name for this PlaceableObject class

RENDER_FLAGS: {
    redraw: {
        propagate: string[];
    };
    redrawEffects: {};
    refresh: {
        propagate: string[];
        alias: boolean;
    };
    refreshState: {
        propagate: string[];
    };
    refreshVisibility: {};
    refreshTransform: {
        propagate: string[];
        alias: boolean;
    };
    refreshPosition: {};
    refreshRotation: {};
    refreshSize: {
        propagate: string[];
    };
    refreshElevation: {};
    refreshMesh: {
        propagate: string[];
    };
    refreshShader: {};
    refreshShape: {
        propagate: string[];
    };
    refreshBorder: {};
    refreshBars: {};
    refreshEffects: {};
    refreshNameplate: {};
    refreshTarget: {};
    refreshTooltip: {};
    refreshRingVisuals: {};
    recoverFromPreview: {
        deprecated: {
            since: number;
            until: number;
        };
    };
} = ...

Type declaration

  • redraw: {
        propagate: string[];
    }
    • propagate: string[]
  • redrawEffects: {}
    • refresh: {
          propagate: string[];
          alias: boolean;
      }
      • propagate: string[]
      • alias: boolean
    • refreshState: {
          propagate: string[];
      }
      • propagate: string[]
    • refreshVisibility: {}
      • refreshTransform: {
            propagate: string[];
            alias: boolean;
        }
        • propagate: string[]
        • alias: boolean
      • refreshPosition: {}
        • refreshRotation: {}
          • refreshSize: {
                propagate: string[];
            }
            • propagate: string[]
          • refreshElevation: {}
            • refreshMesh: {
                  propagate: string[];
              }
              • propagate: string[]
            • refreshShader: {}
              • refreshShape: {
                    propagate: string[];
                }
                • propagate: string[]
              • refreshBorder: {}
                • refreshBars: {}
                  • refreshEffects: {}
                    • refreshNameplate: {}
                      • refreshTarget: {}
                        • refreshTooltip: {}
                          • refreshRingVisuals: {}
                            • recoverFromPreview: {
                                  deprecated: {
                                      since: number;
                                      until: number;
                                  };
                              }

                              Deprecated

                              since v12 Stable 4

                              • deprecated: {
                                    since: number;
                                    until: number;
                                }
                                • since: number
                                • until: number
                            #DETECTION_FILTER_ARRAY: [detectionFilter: any] = ...
                            #hexagonalShapes: Map<string, DeepReadonly<TokenHexagonalShape>> = ...

                            The cache of hexagonal shapes.

                            Accessors

                            • get ring(): any
                            • A TokenRing instance which is used if this Token applies a dynamic ring. This property is null if the Token does not use a dynamic ring.

                              Returns any

                            • get hasDynamicRing(): boolean
                            • A convenience boolean to test whether the Token is using a dynamic ring.

                              Returns boolean

                            • get actor(): Actor
                            • A convenient reference to the Actor object associated with the Token embedded document.

                              Returns Actor

                            • get observer(): boolean
                            • A boolean flag for whether the current game User has observer permission for the Token

                              Returns boolean

                            • get name(): string
                            • Convenience access to the token's nameplate string

                              Returns string

                            • get bounds(): Rectangle
                            • Returns Rectangle

                            • get w(): number
                            • Translate the token's grid width into a pixel width based on the canvas size

                              Returns number

                            • get h(): number
                            • Translate the token's grid height into a pixel height based on the canvas size

                              Returns number

                            • get center(): Point
                            • The Token's current central position

                              Returns Point

                            • get sourceElement(): HTMLImageElement | HTMLVideoElement
                            • The HTML source element for the primary Tile texture

                              Returns HTMLImageElement | HTMLVideoElement

                            • get sourceId(): string
                            • Returns string

                            • get isVideo(): boolean
                            • Does this Tile depict an animated video texture?

                              Returns boolean

                            • get inCombat(): boolean
                            • An indicator for whether or not this token is currently involved in the active combat encounter.

                              Returns boolean

                            • get combatant(): Combatant
                            • Return a reference to a Combatant that represents this Token, if one is present in the current encounter.

                              Returns Combatant

                            • get isTargeted(): boolean
                            • An indicator for whether the Token is currently targeted by the active game User

                              Returns boolean

                            • get detectionModes(): [any]
                            • Return a reference to the detection modes array.

                              Returns [any]

                            • get isVisible(): boolean
                            • Determine whether the Token is visible to the calling user's perspective. Hidden Tokens are only displayed to GM Users. Non-hidden Tokens are always visible if Token Vision is not required. Controlled tokens are always visible. All Tokens are visible to a GM user if no Token is controlled.

                              Returns boolean

                              See

                            • get animationName(): string
                            • The animation name used for Token movement

                              Returns string

                            • get hasSight(): boolean
                            • Test whether the Token has sight (or blindness) at any radius

                              Returns boolean

                            • get emitsDarkness(): boolean
                            • Does this Ambient Light actively emit darkness given its properties and the current darkness level of the Scene?

                              Returns boolean

                            • get emitsLight(): boolean
                            • Does this Ambient Light actively emit light given its properties and the current darkness level of the Scene?

                              Returns boolean

                            • get hasLimitedSourceAngle(): boolean
                            • Test whether the Token uses a limited angle of vision or light emission.

                              Returns boolean

                            • get dimRadius(): number
                            • Translate the token's dim light distance in units into a radius in pixels.

                              Returns number

                            • get brightRadius(): number
                            • Translate the token's bright light distance in units into a radius in pixels.

                              Returns number

                            • get radius(): number
                            • The maximum radius in pixels of the light field

                              Returns number

                            • get lightPerceptionRange(): number
                            • The range of this token's light perception in pixels.

                              Returns number

                            • get sightRange(): number
                            • Translate the token's vision range in units into a radius in pixels.

                              Returns number

                            • get optimalSightRange(): number
                            • Translate the token's maximum vision range that takes into account lights.

                              Returns number

                            • get externalRadius(): number
                            • The external radius of the token in pixels.

                              Returns number

                            • get _original(): PlaceableObject
                            • The object that this object is a preview of if this object is a preview.

                              Returns PlaceableObject

                            • get isOwner(): boolean
                            • A convenient reference for whether the current User has full control over the document.

                              Returns boolean

                            • get interactionState(): {
                                  NONE: number;
                                  HOVER: number;
                                  CLICKED: number;
                                  GRABBED: number;
                                  DRAG: number;
                                  DROP: number;
                              }
                            • The mouse interaction state of this placeable.

                              Returns {
                                  NONE: number;
                                  HOVER: number;
                                  CLICKED: number;
                                  GRABBED: number;
                                  DRAG: number;
                                  DROP: number;
                              }

                              • NONE: number
                              • HOVER: number
                              • CLICKED: number
                              • GRABBED: number
                              • DRAG: number
                              • DROP: number
                            • get id(): string
                            • The id of the corresponding Document which this PlaceableObject represents.

                              Returns string

                            • get objectId(): string
                            • A unique identifier which is used to uniquely identify elements on the canvas related to this object.

                              Returns string

                            • get isPreview(): boolean
                            • Is this placeable object a temporary preview?

                              Returns boolean

                            • get hasPreview(): boolean
                            • Does there exist a temporary preview of this placeable object?

                              Returns boolean

                            • get layer(): PlaceablesLayer
                            • Provide a reference to the CanvasLayer which contains this PlaceableObject.

                              Returns PlaceablesLayer

                            • get sheet(): FormApplication
                            • A Form Application which is used to configure the properties of this Placeable Object or the Document it represents.

                              Returns FormApplication

                            • get controlled(): boolean
                            • An indicator for whether the object is currently controlled

                              Returns boolean

                            • get hover(): boolean
                            • An indicator for whether the object is currently a hover target

                              Returns boolean

                            • get hasActiveHUD(): boolean
                            • Is the HUD display active for this Placeable?

                              Returns boolean

                            Methods

                            • The Token's central position, adjusted in each direction by one or zero pixels to offset it relative to walls.

                              Parameters

                              • point: any
                              • __namedParameters: {
                                    offsetX: any;
                                    offsetY: any;
                                } = {}
                                • offsetX: any
                                • offsetY: any

                              Returns {
                                  x: number;
                                  y: number;
                              }

                              • x: number
                              • y: number
                            • Update the light and vision source objects associated with this Token.

                              Parameters

                              • Optional options: {
                                    deleted: boolean;
                                } = {}

                                Options which configure how perception sources are updated

                                • deleted: boolean

                                  Indicate that this light and vision source has been deleted

                              Returns void

                            • Update an emitted light source associated with this Token.

                              Parameters

                              • Optional options: {
                                    deleted: boolean;
                                } = {}
                                • deleted: boolean

                                  Indicate that this light source has been deleted.

                              Returns void

                            • Update the VisionSource instance associated with this Token.

                              Parameters

                              • Optional options: {
                                    deleted: boolean;
                                } = {}

                                Options which affect how the vision source is updated

                                • deleted: boolean

                                  Indicate that this vision source has been deleted.

                              Returns void

                            • The inner _destroy method which may optionally be defined by each PlaceableObject subclass.

                              Parameters

                              • options: any

                                Options passed to the initial destroy call

                              Returns void

                            • Parameters

                              • options: any

                              Returns Promise<void>

                            • Refresh the display of Token attribute bars, rendering its latest resource data. If the bar attribute is valid (has a value and max), draw the bar. Otherwise hide it.

                              Returns void

                            • Draw the effect icons for ActiveEffect documents which apply to the Token's Actor.

                              Returns Promise<PlaceableObject>

                            • Override ring colors for this particular Token instance.

                              Returns {}

                              • Apply additional ring effects for this particular Token instance. Effects are returned as an array of integers in foundry.canvas.tokens.TokenRing.effects.

                                Returns number[]

                              • Animate from the old to the new state of this Token.

                                Parameters

                                • to: Partial<TokenAnimationData>

                                  The animation data to animate to

                                • Optional options: {
                                      duration: number;
                                      movementSpeed: number;
                                      transition: string;
                                      easing: string | Function;
                                      name: string | symbol;
                                      ontick: Function;
                                  } = {}

                                  The options that configure the animation behavior. Passed to Token#_getAnimationDuration.

                                  • duration: number

                                    The duration of the animation in milliseconds

                                  • movementSpeed: number

                                    A desired token movement speed in grid spaces per second

                                  • transition: string

                                    The desired texture transition type

                                  • easing: string | Function

                                    The easing function of the animation

                                  • name: string | symbol

                                    The name of the animation, or null if nameless. The default is Token#animationName.

                                  • ontick: Function

                                    A on-tick callback

                                Returns Promise<void>

                                A promise which resolves once the animation has finished or stopped

                              • Terminate the animations of this particular Token, if exists.

                                Parameters

                                • Optional options: {
                                      reset: boolean;
                                  } = {}

                                  Additional options.

                                  • reset: boolean

                                    Reset the TokenDocument?

                                Returns void

                              • Check for collision when attempting a move to a new position

                                Parameters

                                • destination: Point

                                  The central destination point of the attempted movement

                                • Optional options: {
                                      origin: Point;
                                      type: PointSourcePolygonType;
                                      mode: "all" | "closest" | "any";
                                  } = {}

                                  Additional options forwarded to PointSourcePolygon.testCollision

                                  • origin: Point

                                    The origin to be used instead of the current origin

                                  • type: PointSourcePolygonType

                                    The collision type

                                  • mode: "all" | "closest" | "any"

                                    The collision mode to test: "any", "all", or "closest"

                                Returns any

                                The collision result depends on the mode of the test: * any: returns a boolean for whether any collision occurred * all: returns a sorted array of PolygonVertex instances * closest: returns a PolygonVertex instance or null

                              • Get the width and height of the Token in pixels.

                                Returns {
                                    width: number;
                                    height: number;
                                }

                                The size in pixels

                                • width: number
                                • height: number
                              • Get the shape of this Token.

                                Returns Rectangle | Polygon | Circle

                              • Get the center point for a given position or the current position.

                                Parameters

                                • Optional position: Point

                                  The position to be used instead of the current position

                                Returns Point

                                The center point

                              • Test whether the Token is inside the Region. This function determines the state of TokenDocument#regions and RegionDocument#tokens.

                                Implementations of this function are restricted in the following ways:

                                • If the bounds (given by Token#getSize) of the Token do not intersect the Region, then the Token is not contained within the Region.
                                • If the Token is inside the Region a particular elevation, then the Token is inside the Region at any elevation within the elevation range of the Region.

                                If this function is overridden, then Token#segmentizeRegionMovement must be overridden too.

                                Parameters

                                • region: Region

                                  The region.

                                • position: any

                                  The (x, y) and/or elevation to use instead of the current values.

                                Returns boolean

                                Is the Token inside the Region?

                              • Split the Token movement through the waypoints into its segments.

                                Implementations of this function are restricted in the following ways:

                                • The segments must go through the waypoints.
                                • The from position matches the to position of the succeeding segment.
                                • The Token must be contained (w.r.t. Token#testInsideRegion) within the Region at the from and to of MOVE segments.
                                • The Token must be contained (w.r.t. Token#testInsideRegion) within the Region at the to position of ENTER segments.
                                • The Token must be contained (w.r.t. Token#testInsideRegion) within the Region at the from position of EXIT segments.
                                • The Token must not be contained (w.r.t. Token#testInsideRegion) within the Region at the from position of ENTER segments.
                                • The Token must not be contained (w.r.t. Token#testInsideRegion) within the Region at the to position of EXIT segments.

                                Parameters

                                • region: Region

                                  The region.

                                • waypoints: RegionMovementWaypoint[]

                                  The waypoints of movement.

                                • Optional options: {
                                      teleport: boolean;
                                  } = {}

                                  Additional options

                                  • teleport: boolean

                                    Is it teleportation?

                                Returns RegionMovementSegment[]

                                The movement split into its segments.

                              • Set this Token as an active target for the current game User. Note: If the context is set with groupSelection:true, you need to manually broadcast the activity for other users.

                                Parameters

                                • targeted: boolean = true

                                  Is the Token now targeted?

                                • Optional context: {
                                      user: User;
                                      releaseOthers: boolean;
                                      groupSelection: boolean;
                                  } = {}

                                  Additional context options

                                  • user: User

                                    Assign the token as a target for a specific User

                                  • releaseOthers: boolean

                                    Release other active targets for the same player?

                                  • groupSelection: boolean

                                    Is this target being set as part of a group selection workflow?

                                Returns void

                              • A generic transformation to turn a certain number of grid units into a radius in canvas pixels. This function adds additional padding to the light radius equal to the external radius of the token. This causes light to be measured from the outer token edge, rather than from the center-point.

                                Parameters

                                • units: number

                                  The radius in grid units

                                Returns number

                                The radius in pixels

                              • Internal

                                Obtain a shifted position for the Placeable Object

                                Parameters

                                • dx: any

                                  The number of grid units to shift along the X-axis

                                • dy: any

                                  The number of grid units to shift along the Y-axis

                                Returns any

                                The shifted target coordinates

                              • Parameters

                                • __namedParameters: {
                                      angle: any;
                                      delta: number;
                                      snap: number;
                                  } = {}
                                  • angle: any
                                  • delta: number
                                  • snap: number

                                Returns any

                              • Register pending canvas operations which should occur after a new PlaceableObject of this type is created

                                Parameters

                                • data: any
                                • options: any
                                • userId: any

                                Returns void

                              • Define additional steps taken when an existing placeable object of this type is updated with new data

                                Parameters

                                • changed: any
                                • options: any
                                • userId: any

                                Returns void

                              • Define additional steps taken when an existing placeable object of this type is deleted

                                Parameters

                                • options: any
                                • userId: any

                                Returns void

                              • Internal

                                Add/Modify a filter effect on this token.

                                Parameters

                                • statusId: string

                                  The status effect ID being applied, from CONFIG.specialStatusEffects

                                • active: boolean

                                  Is the special status effect now active?

                                Returns void

                              • Internal

                                Update the filter effects depending on special status effects TODO: replace this method by something more convenient.

                                Returns void

                              • Internal

                                Remove all filter effects on this placeable.

                                Returns void

                              • Additional events which trigger once control of the object is established

                                Parameters

                                • __namedParameters: {
                                      releaseOthers: boolean;
                                      pan: boolean;
                                  } = {}

                                  Optional parameters which apply for specific implementations

                                  • releaseOthers: boolean
                                  • pan: boolean

                                Returns void

                              • Additional events which trigger once control of the object is released

                                Parameters

                                • options: any

                                  Options which modify the releasing workflow

                                Returns void

                              • Actions that should be taken for this Placeable Object when a mouseover event occurs. Hover events on PlaceableObject instances allow event propagation by default.

                                Parameters

                                • event: any

                                  The triggering canvas interaction event

                                • options: any

                                  Options which customize event handling

                                Returns void

                                See

                                MouseInteractionManager##handlePointerOver

                              • Actions that should be taken for this Placeable Object when a mouseout event occurs

                                Parameters

                                • event: any

                                  The triggering canvas interaction event

                                Returns void

                                See

                                MouseInteractionManager##handlePointerOut

                              • Callback actions which occur on a single left-click event to assume control of the object

                                Parameters

                                • event: any

                                  The triggering canvas interaction event

                                Returns void

                                See

                                MouseInteractionManager##handleClickLeft

                              • Parameters

                                • event: any

                                Returns {
                                    _id: any;
                                    x: any;
                                    y: any;
                                }[]

                              • Draw the placeable object into its parent container

                                Parameters

                                • Optional options: any = {}

                                  Options which may modify the draw and refresh workflow

                                Returns Promise<PlaceableObject>

                                The drawn object

                              • Refresh all incremental render flags for the PlaceableObject. This method is no longer used by the core software but provided for backwards compatibility.

                                Parameters

                                • Optional options: any = {}

                                  Options which may modify the refresh workflow

                                Returns PlaceableObject

                                The refreshed object

                              • Assume control over a PlaceableObject, flagging it as controlled and enabling downstream behaviors

                                Parameters

                                • options: {
                                      releaseOthers: boolean;
                                  } = {}

                                  Additional options which modify the control request

                                  • releaseOthers: boolean

                                    Release any other controlled objects first

                                Returns boolean

                                A flag denoting whether control was successful

                              • Release control over a PlaceableObject, removing it from the controlled set

                                Parameters

                                • options: any = {}

                                  Options which modify the releasing workflow

                                Returns boolean

                                A Boolean flag confirming the object was released.

                              • Clone the placeable object, returning a new object with identical attributes. The returned object is non-interactive, and has no assigned ID. If you plan to use it permanently you should call the create method.

                                Returns PlaceableObject

                                A new object with identical data

                              • Rotate the PlaceableObject to a certain angle of facing

                                Parameters

                                • angle: number

                                  The desired angle of rotation

                                • snap: number

                                  Snap the angle of rotation to a certain target degree increment

                                Returns Promise<PlaceableObject>

                                The rotated object

                              • Test whether a user can perform a certain interaction regarding a Placeable Object

                                Parameters

                                • user: User

                                  The User performing the action

                                • action: string

                                  The named action being attempted

                                Returns boolean

                                Does the User have rights to perform the action?

                              • Protected

                                Does this Token actively emit light given its properties and the current darkness level of the Scene?

                                Returns boolean

                              • Protected

                                Get the light source data.

                                Returns LightSourceData

                              • Protected

                                Returns a record of blinding state.

                                Returns Record<string, boolean>

                              • Protected

                                Get the vision source data.

                                Returns VisionSourceData

                              • Protected

                                Test whether this Token is a viable vision source for the current User.

                                Returns boolean

                              • Protected

                                Render the bound mesh detection filter. Note: this method does not verify that the detection filter exists.

                                Parameters

                                • renderer: Renderer

                                Returns void

                              • Protected

                                Refresh the token ring visuals if necessary.

                                Returns void

                              • Protected

                                Refresh the visibility.

                                Returns void

                              • Protected

                                Refresh aspects of the user interaction state. For example the border, nameplate, or bars may be shown on Hover or on Control.

                                Returns void

                              • Protected

                                Refresh the size.

                                Returns void

                              • Protected

                                Refresh the shape.

                                Returns void

                              • Protected

                                Refresh the rotation.

                                Returns void

                              • Protected

                                Refresh the position.

                                Returns void

                              • Protected

                                Refresh the elevation

                                Returns void

                              • Protected

                                Refresh the tooltip.

                                Returns void

                              • Protected

                                Refresh the text content, position, and visibility of the Token nameplate.

                                Returns void

                              • Protected

                                Refresh the token mesh.

                                Returns void

                              • Protected

                                Refresh the token mesh shader.

                                Returns void

                              • Protected

                                Refresh the border.

                                Returns void

                              • Protected

                                Get the hex color that should be used to render the Token border

                                Returns number

                                The hex color used to depict the border color

                              • Protected

                                Refresh the target indicators for the Token. Draw both target arrows for the primary User and indicator pips for other Users targeting the same Token.

                                Parameters

                                • Optional reticule: ReticuleOptions

                                  Additional parameters to configure how the targeting reticule is drawn.

                                Returns void

                              • Protected

                                Draw the targeting arrows around this token.

                                Parameters

                                • Optional reticule: ReticuleOptions = {}

                                  Additional parameters to configure how the targeting reticule is drawn.

                                Returns void

                              • Protected

                                Draw a single resource bar, given provided data

                                Parameters

                                • number: number

                                  The Bar number

                                • bar: Graphics

                                  The Bar container

                                • data: any

                                  Resource data for this bar

                                Returns boolean

                              • Protected

                                Return the text which should be displayed in a token's tooltip field

                                Returns string

                              • Protected

                                Get the text style that should be used for this Token's tooltip.

                                Returns string

                              • Protected

                                Draw the effect icons for ActiveEffect documents which apply to the Token's Actor. Called by Token#drawEffects.

                                Returns Promise<void>

                              • Protected

                                Draw a status effect icon

                                Parameters

                                • src: string
                                • tint: any

                                Returns Promise<any>

                              • Protected

                                Draw the overlay effect icon

                                Parameters

                                • src: string
                                • tint: number

                                Returns Promise<Sprite>

                              • Protected

                                Refresh the display of status effects, adjusting their position for the token width and height.

                                Returns void

                              • Protected

                                Helper method to determine whether a token attribute is viewable under a certain mode

                                Parameters

                                • mode: number

                                  The mode from CONST.TOKEN_DISPLAY_MODES

                                Returns boolean

                                Is the attribute viewable?

                              • Protected

                                Get the duration of the animation.

                                Parameters

                                • from: TokenAnimationData

                                  The animation data to animate from

                                • to: Partial<TokenAnimationData>

                                  The animation data to animate to

                                • Optional options: {
                                      movementSpeed: number;
                                  } = {}

                                  The options that configure the animation behavior

                                  • movementSpeed: number

                                    A desired token movement speed in grid spaces per second

                                Returns number

                                The duration of the animation in milliseconds

                              • Protected

                                Called each animation frame.

                                Parameters

                                Returns void

                              • Protected

                                Prepare the animation data changes: performs special handling required for animating rotation.

                                Parameters

                                • from: TokenAnimationData

                                  The animation data to animate from

                                • changes: Partial<TokenAnimationData>

                                  The animation data changes

                                • context: Omit<TokenAnimationContext, "promise">

                                  The animation context

                                • Optional options: {
                                      transition: string;
                                  } = {}

                                  The options that configure the animation behavior

                                  • transition: string

                                    The desired texture transition type

                                Returns CanvasAnimationAttribute[]

                                The animation attributes

                              • Protected Internal

                                Handle changes to Token behavior when a significant status effect is applied

                                Parameters

                                • statusId: string

                                  The status effect ID being applied, from CONFIG.specialStatusEffects

                                • active: boolean

                                  Is the special status effect now active?

                                Returns void

                              • Protected

                                Get the target opacity that should be used for a Placeable Object depending on its preview state.

                                Returns number

                              • Protected

                                Does the User have permission to create the underlying Document?

                                Parameters

                                • user: User

                                  The User performing the action.

                                • event: any

                                  The event object.

                                Returns boolean

                                The returned status.

                              • Protected

                                Does the User have permission to left-click drag this Placeable Object?

                                Parameters

                                • user: User

                                  The User performing the action.

                                • event: any

                                  The event object.

                                Returns boolean

                                The returned status.

                              • Protected

                                Does the User have permission to update the underlying Document?

                                Parameters

                                • user: User

                                  The User performing the action.

                                • event: any

                                  The event object.

                                Returns boolean

                                The returned status.

                              • Protected

                                Does the User have permission to delete the underlying Document?

                                Parameters

                                • user: User

                                  The User performing the action.

                                • event: any

                                  The event object.

                                Returns boolean

                                The returned status.

                              • Protected

                                Callback actions which occur on a single left-unclick event to assume control of the object

                                Parameters

                                • event: FederatedEvent

                                  The triggering canvas interaction event

                                Returns void

                              • Protected

                                Should the placeable propagate right click downstream?

                                Parameters

                                • event: FederatedEvent

                                Returns boolean

                              • Protected

                                Callback actions which occur on a single right-click event to configure properties of the object

                                Parameters

                                • event: FederatedEvent

                                  The triggering canvas interaction event

                                Returns void

                                See

                                MouseInteractionManager##handleClickRight

                              • Protected

                                Callback actions which occur on a single right-unclick event

                                Parameters

                                • event: FederatedEvent

                                  The triggering canvas interaction event

                                Returns void

                              • Protected

                                Begin a drag operation from the perspective of the preview clone. Modify the appearance of both the clone (this) and the original (_original) object.

                                Returns void

                              • Protected

                                Callback actions which occur on a mouse-move operation.

                                Parameters

                                • event: FederatedEvent

                                  The triggering canvas interaction event

                                Returns boolean

                                See

                                MouseInteractionManager##handleDragDrop

                              • Protected

                                Callback actions which occur on a mouse-move operation.

                                Parameters

                                • event: FederatedEvent

                                  The triggering mouse click event

                                Returns void

                                See

                                MouseInteractionManager##handleDragCancel

                              • Protected

                                Callback actions which occur on a right mouse-drag operation.

                                Parameters

                                • event: FederatedEvent

                                  The triggering mouse click event

                                Returns any

                                See

                                MouseInteractionManager##handleDragStart

                              • Protected

                                Callback actions which occur on a right mouse-drag operation.

                                Parameters

                                • event: FederatedEvent

                                  The triggering canvas interaction event

                                Returns any

                                See

                                MouseInteractionManager##handleDragMove

                              • Protected

                                Callback actions which occur on a right mouse-drag operation.

                                Parameters

                                • event: FederatedEvent

                                  The triggering canvas interaction event

                                Returns Promise<any>

                                See

                                MouseInteractionManager##handleDragDrop

                              • Protected

                                Callback actions which occur on a right mouse-drag operation.

                                Parameters

                                • event: FederatedEvent

                                  The triggering mouse click event

                                Returns any

                                See

                                MouseInteractionManager##handleDragCancel

                              • Protected

                                Callback action which occurs on a long press.

                                Parameters

                                • event: FederatedEvent

                                  The triggering canvas interaction event

                                • origin: Point

                                  The local canvas coordinates of the mousepress.

                                Returns any

                                See

                                MouseInteractionManager##handleLongPress

                              • Establish an initial velocity of the token based on its direction of facing. Assume the Token made some prior movement towards the direction that it is currently facing.

                                Returns void

                              • Initialize a TokenRing instance for this Token, if a dynamic ring is enabled.

                                Returns void

                              • Create a point light source according to token options.

                                Returns any

                              • Destroy the PointLightSource or PointDarknessSource instance associated with this Token.

                                Returns void

                              • Create a point vision source for the Token.

                                Returns PointVisionSource

                              • Destroy the PointVisionSource instance associated with this Token.

                                Returns void

                              • Apply initial sanitizations to the provided input data to ensure that a Token has valid required attributes. Constrain the Token position to remain within the Canvas rectangle.

                                Returns void

                              • Draw resource bars for the Token

                                Returns Container

                              • Get the hex color that should be used to render the Token border

                                Returns number

                                The border color

                              • Draw the token's nameplate as a text object

                                Returns PreciseText

                                The Text object for the Token nameplate

                              • Draw a text tooltip for the token which can be used to display Elevation or a resource value

                                Returns PreciseText

                                The text object used to render the tooltip

                              • Handle a single frame of a token animation.

                                Parameters

                                Returns void

                              • Move the token immediately to the destination if it is teleported.

                                Parameters

                                Returns void

                              • Handle the transition changes, creating the necessary filter and preparing the textures.

                                Parameters

                                Returns void

                              • Internal

                                Prepare a target token by cloning the current token and setting its texture.

                                Parameters

                                • targetTexture: Texture

                                  The texture to set on the target token

                                Returns Token

                                The prepared target token

                              • Prepare a PointMovementSource for the document

                                Parameters

                                • origin: Point

                                  The origin of the source

                                Returns PointMovementSource

                              • Get the snapped position for a given position on a square grid.

                                Parameters

                                • position: Point

                                  The position that is snapped

                                Returns Point

                                The snapped position

                              • Get the snapped position for a given position on a hexagonal grid.

                                Parameters

                                • position: Point

                                  The position that is snapped

                                Returns Point

                                The snapped position

                              • When Token position or rotation changes, record the movement vector. Update cached values for both #validPosition and #priorMovement.

                                Parameters

                                • positionChange: boolean

                                  Did the x/y position change?

                                • rotationChange: boolean

                                  Did rotation change?

                                • sizeChange: boolean

                                  Did the width or height change?

                                Returns void

                              • Automatically pan the canvas when a controlled Token moves offscreen.

                                Returns void

                              • Perform database updates using the result of a drag-left-drop operation.

                                Parameters

                                • updates: any[]

                                  The database updates for documents in this collection

                                Returns Promise<void>

                              • Handle the rotation changes for the animation, ensuring the shortest rotation path.

                                Parameters

                                Returns void

                              • Update the padding for both the source and target tokens to ensure they are square.

                                Parameters

                                Returns void

                              • Get the hexagonal shape given the type, width, and height.

                                Parameters

                                • columns: boolean

                                  Column-based instead of row-based hexagonal grid?

                                • type: number

                                  The hexagonal shape (one of CONST.TOKEN_HEXAGONAL_SHAPES)

                                • width: number

                                  The width of the Token (positive)

                                • height: number

                                  The height of the Token (positive)

                                Returns any

                                The hexagonal shape or null if there is no shape for the given combination of arguments

                              • Create the row-based hexagonal ellipse/trapezoid given the type, width, and height.

                                Parameters

                                • type: number

                                  The shape type (must be ELLIPSE_1, ELLIPSE_1, TRAPEZOID_1, or TRAPEZOID_2)

                                • width: number

                                  The width of the Token (positive)

                                • height: number

                                  The height of the Token (positive)

                                Returns TokenHexagonalShape

                                The hexagonal shape or null if there is no shape for the given combination of arguments

                              • Create the row-based hexagonal rectangle given the type, width, and height.

                                Parameters

                                • type: number

                                  The shape type (must be RECTANGLE_1 or RECTANGLE_2)

                                • width: number

                                  The width of the Token (positive)

                                • height: number

                                  The height of the Token (positive)

                                Returns TokenHexagonalShape

                                The hexagonal shape or null if there is no shape for the given combination of arguments