Options
All
  • Public
  • Public/Protected
  • All
Menu

A type of Placeable Object which highlights an area of the grid as covered by some area of effect.

see

MeasuredTemplateDocument

see

TemplateLayer

Hierarchy

Index

Constructors

Properties

shape: any

The geometry shape used for testing point intersection

texture: Texture

The tiling texture used for this template, if any

template: any

The template graphics

controlIcon: ControlIcon

The template control icon

The measurement ruler label

ray: Ray
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

vision: { fov: Circle; los: PointSourcePolygon }

Track the field of vision for the placeable object. This is necessary to determine whether a player has line-of-sight towards a placeable object or vice-versa

Type declaration

mouseInteractionManager: MouseInteractionManager

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

cullable: boolean
_isHoverIn: boolean = false

Know if a placeable is in the hover-in state.

internal
zIndex: number
alpha: number
visible: boolean
_dragPassthrough: boolean = false

Passthrough certain drag operations on locked objects.

_borderThickness: number = 3

Internal property used to configure the control border thickness

#controlled: boolean = false
#hover: boolean = false
embeddedName: string = "MeasuredTemplate"

Identify the official Document name for this PlaceableObject class

Accessors

  • inheritdoc

    Returns Rectangle

  • get borderColor(): number
  • A convenience accessor for the border color as a numeric hex code

    Returns number

  • get fillColor(): number
  • A convenience accessor for the fill color as a numeric hex code

    Returns number

  • get owner(): boolean
  • A flag for whether the current User has full ownership over the MeasuredTemplate document.

    Returns boolean

  • get isVisible(): boolean
  • Is this MeasuredTemplate currently visible on the Canvas?

    Returns boolean

  • get highlightId(): string
  • A unique identifier which is used to uniquely identify related objects like a template effect or grid highlight.

    Returns string

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

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

    • NONE: number
    • HOVER: number
    • CLICKED: number
    • DRAG: number
    • DROP: number
  • get center(): Point
  • The central coordinate pair of the placeable object based on it's own width and height

    Returns Point

  • 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 sourceId(): string
  • The named identified for the source object associated with this PlaceableObject. This differs from the objectId because the sourceId is the same for preview objects as for the original.

    Returns string

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

    Returns boolean

  • The field-of-vision polygon for the object, if it has been computed

    Returns Circle

  • Provide a reference to the CanvasLayer which contains this PlaceableObject.

    Returns PlaceablesLayer

  • The line-of-sight polygon for the object, if it has been computed

    Returns PointSourcePolygon

  • 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
  • set hover(state: boolean): void
  • An indicator for whether the object is currently a hover target

    Returns boolean

  • An indicator for whether the object is currently a hover target

    Parameters

    • state: boolean

    Returns void

Methods

  • _draw(): Promise<void>
  • _destroy(options: any): void
  • _refresh(options: any): void
  • highlightGrid(): void
  • Highlight the grid squares which should be shown under the area of effect

    Returns void

  • rotate(angle: any, snap: any): Promise<any>
  • _canControl(user: any, event: any): any
  • _canHUD(user: any, event: any): boolean
  • Can the User access the HUD for this Placeable Object?

    Parameters

    • user: any

      The User performing the action.

    • event: any

      The event object.

    Returns boolean

    The returned status.

  • _canConfigure(user: any, event: any): boolean
  • Does the User have permission to configure the Placeable Object?

    Parameters

    • user: any

      The User performing the action.

    • event: any

      The event object.

    Returns boolean

    The returned status.

  • _canView(user: any, event: any): any
  • _onClickRight(event: any): void
  • Callback actions which occur on a single right-click event to configure properties of the object

    Parameters

    • event: any

      The triggering canvas interaction event

    Returns void

  • _onDragStart(): void
  • 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

  • _onDragEnd(): void
  • Conclude 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

  • _onUpdate(data: any, options: any, userId: any): void
  • can(user: User, action: string): boolean
  • 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?

  • 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

  • destroy(options: any): any
  • control(options?: { releaseOthers: boolean }): boolean
  • 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(options?: any): boolean
  • 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.

  • _updateRotation(options?: { angle: number; delta: number; snap: number }): number
  • Determine a new angle of rotation for a PlaceableObject either from an explicit angle or from a delta offset.

    Parameters

    • options: { angle: number; delta: number; snap: number } = {}

      An object which defines the rotation update parameters

      • angle: number
      • delta: number
      • snap: number

    Returns number

    The new rotation angle for the object

  • _getShiftedPosition(dx: number, dy: number): { x: number; y: number }
  • Obtain a shifted position for the Placeable Object

    Parameters

    • dx: number

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

    • dy: number

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

    Returns { x: number; y: number }

    The shifted target coordinates

    • x: number
    • y: number
  • activateListeners(): void
  • _onHoverIn(event: InteractionEvent, options?: { hoverOutOthers: boolean }): boolean
  • Actions that should be taken for this Placeable Object when a mouseover event occurs

    see

    MouseInteractionManager#_handleMouseOver

    Parameters

    • event: InteractionEvent

      The triggering canvas interaction event

    • options: { hoverOutOthers: boolean } = {}

      Options which customize event handling

      • hoverOutOthers: boolean

    Returns boolean

  • _onHoverOut(event: InteractionEvent): boolean
  • Actions that should be taken for this Placeable Object when a mouseout event occurs

    see

    MouseInteractionManager#_handleMouseOut

    Parameters

    • event: InteractionEvent

      The triggering canvas interaction event

    Returns boolean

  • _onClickLeft(event: InteractionEvent): boolean
  • Callback actions which occur on a single left-click event to assume control of the object

    see

    MouseInteractionManager#_handleClickLeft

    Parameters

    • event: InteractionEvent

      The triggering canvas interaction event

    Returns boolean

  • _onClickLeft2(event: InteractionEvent): void
  • Callback actions which occur on a double left-click event to activate

    see

    MouseInteractionManager#_handleClickLeft2

    Parameters

    • event: InteractionEvent

      The triggering canvas interaction event

    Returns void

  • _onClickRight2(event: InteractionEvent): void
  • Callback actions which occur on a double right-click event to configure properties of the object

    see

    MouseInteractionManager#_handleClickRight2

    Parameters

    • event: InteractionEvent

      The triggering canvas interaction event

    Returns void

  • _onDragLeftStart(event: InteractionEvent): any
  • Callback actions which occur when a mouse-drag action is first begun.

    see

    MouseInteractionManager#_handleDragStart

    Parameters

    • event: InteractionEvent

      The triggering canvas interaction event

    Returns any

  • _onDragLeftMove(event: InteractionEvent): any
  • Callback actions which occur on a mouse-move operation.

    see

    MouseInteractionManager#_handleDragMove

    Parameters

    • event: InteractionEvent

      The triggering canvas interaction event

    Returns any

  • _onDragLeftDrop(event: InteractionEvent): Promise<any>
  • Callback actions which occur on a mouse-move operation.

    see

    MouseInteractionManager#_handleDragDrop

    Parameters

    • event: InteractionEvent

      The triggering canvas interaction event

    Returns Promise<any>

  • _onDragLeftCancel(event: MouseEvent): any
  • Callback actions which occur on a mouse-move operation.

    see

    MouseInteractionManager#_handleDragCancel

    Parameters

    • event: MouseEvent

      The triggering mouse click event

    Returns any

  • _refreshTemplate(): void
  • Refresh the display of the template outline and shape.

    Returns void

  • _refreshControlIcon(): void
  • Refresh the display of the ControlIcon for this MeasuredTemplate object.

    Returns void

  • _getGridHighlightPositions(): Point[]
  • Get an array of points which define top-left grid spaces to highlight for square or hexagonal grids.

    Returns Point[]

  • _canCreate(user: User, event: any): boolean
  • 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.

  • _canDrag(user: User, event: any): boolean
  • Does the User have permission to drag this Placeable Object?

    Parameters

    • user: User

      The User performing the action.

    • event: any

      The event object.

    Returns boolean

    The returned status.

  • _canHover(user: User, event: any): boolean
  • Does the User have permission to hover on this Placeable Object?

    Parameters

    • user: User

      The User performing the action.

    • event: any

      The event object.

    Returns boolean

    The returned status.

  • _canUpdate(user: User, event: any): boolean
  • 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.

  • _canDelete(user: User, event: any): boolean
  • 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.

  • _onCreate(data: any, options: any, userId: string): void
  • Register pending canvas operations which should occur after a new PlaceableObject of this type is created

    Parameters

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

    Returns void

  • _onDelete(options: any, userId: string): void
  • Define additional steps taken when an existing placeable object of this type is deleted

    Parameters

    • options: any
    • userId: string

    Returns void

  • _onControl(options: any): void
  • Additional events which trigger once control of the object is established

    Parameters

    • options: any

      Optional parameters which apply for specific implementations

    Returns void

  • _onRelease(options: any): void
  • Additional events which trigger once control of the object is released

    Parameters

    • options: any

      Options which modify the releasing workflow

    Returns void

  • _onLongPress(event: InteractionEvent, origin: Point): any
  • Callback action which occurs on a long press.

    see

    MouseInteractionManager#_handleLongPress

    Parameters

    • event: InteractionEvent

      The triggering canvas interaction event

    • origin: Point

      The local canvas coordinates of the mousepress.

    Returns any

  • Draw the ControlIcon for the MeasuredTemplate

    Returns ControlIcon

  • Draw the Text label used for the MeasuredTemplate

    Returns PreciseText

  • _getCircleShape(distance: number): Circle
  • Get a Circular area of effect given a radius of effect

    Parameters

    • distance: number

    Returns Circle

  • _getConeShape(direction: number, angle: number, distance: number): Polygon
  • Get a Conical area of effect given a direction, angle, and distance

    Parameters

    • direction: number
    • angle: number
    • distance: number

    Returns Polygon

  • _getRectShape(direction: number, distance: number): Rectangle
  • Get a Rectangular area of effect given a width and height

    Parameters

    • direction: number
    • distance: number

    Returns Rectangle

  • _getRayShape(direction: number, distance: number, width: number): Polygon
  • Get a rotated Rectangular area of effect given a width, height, and direction

    Parameters

    • direction: number
    • distance: number
    • width: number

    Returns Polygon

  • _refreshRulerText(): void
  • Update the displayed ruler tooltip text

    Returns void