Tile

Tile

A Tile is an implementation of PlaceableObject which represents a static piece of artwork or prop within the Scene. Tiles are drawn inside a BackgroundLayer container.

Constructor

new Tile()

See:

Extends

Members

_controlled :boolean

Inherited From:

An indicator for whether the object is currently controlled

Type:
  • boolean

_hover :boolean

Inherited From:

An indicator for whether the object is currently a hover target

Type:
  • boolean

aspectRatio :number

Get the native aspect ratio of the base texture for the Tile sprite

Type:
  • number

bg :PIXI.Graphics

A Tile background which is displayed if no valid image texture is present

Type:
  • PIXI.Graphics

bounds

Overrides:

The bounding box for this PlaceableObject. This is required if the layer uses a Quadtree, otherwise it is optional

center :PIXI.Point

Inherited From:

The central coordinate pair of the placeable object based on it's own width and height

Type:
  • PIXI.Point

controlIcon :ControlIcon

Inherited From:

A control icon for interacting with the object

Type:

data :abstract.DocumentData

Inherited From:

The underlying data object which provides the basis for this placeable object

Type:

document :abstract.Document

Inherited From:

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

Type:

embeddedName :string

Overrides:

Identify the official Document name for this PlaceableObject class

Type:
  • string

fov :PIXI.Circle

Inherited From:

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

Type:
  • PIXI.Circle

frame

Properties:
Name Type Description
border PIXI.Graphics
handle ResizeHandle

The Tile border frame

id :string

Inherited From:

The id of the corresponding Document which this PlaceableObject represents.

Type:
  • string

isRoof

Is this tile a roof

isVideo :boolean

Does this Tile depict an animated video texture?

Type:
  • boolean

layer :PIXI.Container

Inherited From:

Provide a reference to the CanvasLayer which contains this PlaceableObject.

Type:
  • PIXI.Container

los :PointSourcePolygon|null

Inherited From:

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

Type:

mouseInteractionManager :MouseInteractionManager

Inherited From:

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

Type:

occluded :boolean

A flag which tracks whether the overhead tile is currently in an occluded state

Type:
  • boolean

occlusionTile :PIXI.Sprite

The occlusion image sprite

Type:
  • PIXI.Sprite

scene :Scene

Inherited From:

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

Type:

sheet :FormApplication

Inherited From:

A Form Application which is used to configure the properties of this Placeable Object or the Document it represents.

Type:

sourceElement :HTMLImageElement|HTMLVideoElement

The HTML source element for the primary Tile texture

Type:
  • HTMLImageElement | HTMLVideoElement

texture :PIXI.Texture

The primary tile image texture

Type:
  • PIXI.Texture

tile :PIXI.Sprite

The Tile image sprite

Type:
  • PIXI.Sprite

vision :Object

Inherited From:

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:
  • Object

Methods

(static) createPreview(data) → {PlaceableObject}

Create a preview tile with a background texture instead of an image

Parameters:
Name Type Description
data object

Initial data with which to create the preview Tile

Returns:
Type
PlaceableObject

(protected) _canConfigure()

Overrides:

Does the User have permission to configure the Placeable Object?

(protected) _canControl()

Inherited From:

Does the User have permission to control the Placeable Object?

(protected) _canCreate()

Inherited From:

Does the User have permission to create the underlying Document?

(protected) _canDelete()

Inherited From:

Does the User have permission to delete the underlying Document?

(protected) _canDrag()

Inherited From:

Does the User have permission to drag this Placeable Object?

(protected) _canHover()

Inherited From:

Does the User have permission to hover on this Placeable Object?

(protected) _canHUD()

Inherited From:

Can the User access the HUD for this Placeable Object?

(protected) _canUpdate()

Inherited From:

Does the User have permission to update the underlying Document?

(protected) _canView()

Inherited From:

Does the User have permission to view details of the Placeable Object?

(protected) _createInteractionManager()

Inherited From:

Create a standard MouseInteractionManager for the PlaceableObject

_getShiftedPosition(dx, dy) → {Object}

Inherited From:

Obtain a shifted position for the Placeable Object

Parameters:
Name Type Description
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:

The shifted target coordinates

Type
Object

_onClickLeft(event)

Inherited From:
See:
  • MouseInteractionManager#_handleClickLeft

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

Parameters:
Name Type Description
event PIXI.InteractionEvent

The triggering canvas interaction event

_onClickLeft2(event)

Overrides:
See:
  • MouseInteractionManager#_handleClickLeft2

Callback actions which occur on a double left-click event to activate

Parameters:
Name Type Description
event PIXI.InteractionEvent

The triggering canvas interaction event

_onClickRight(event)

Inherited From:
See:
  • MouseInteractionManager#_handleClickRight

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

Parameters:
Name Type Description
event PIXI.InteractionEvent

The triggering canvas interaction event

_onClickRight2(event)

Inherited From:
See:
  • MouseInteractionManager#_handleClickRight2

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

Parameters:
Name Type Description
event PIXI.InteractionEvent

The triggering canvas interaction event

(protected) _onControl(options)

Inherited From:

Additional events which trigger once control of the object is established

Parameters:
Name Type Description
options Object

Optional parameters which apply for specific implementations

(protected) _onCreate()

Inherited From:

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

(protected) _onDelete()

Overrides:

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

_onDragLeftCancel(event)

Overrides:
See:
  • MouseInteractionManager#_handleDragCancel

Callback actions which occur on a mouse-move operation.

Parameters:
Name Type Description
event MouseEvent

The triggering mouse click event

(async) _onDragLeftDrop(event) → {Promise.<*>}

Overrides:
See:
  • MouseInteractionManager#_handleDragDrop

Callback actions which occur on a mouse-move operation.

Parameters:
Name Type Description
event PIXI.InteractionEvent

The triggering canvas interaction event

Returns:
Type
Promise.<*>

_onDragLeftMove(event)

Overrides:
See:
  • MouseInteractionManager#_handleDragMove

Callback actions which occur on a mouse-move operation.

Parameters:
Name Type Description
event PIXI.InteractionEvent

The triggering canvas interaction event

_onDragLeftStart(event)

Overrides:
See:
  • MouseInteractionManager#_handleDragStart

Callback actions which occur when a mouse-drag action is first begun.

Parameters:
Name Type Description
event PIXI.InteractionEvent

The triggering canvas interaction event

(protected) _onHandleDragCancel()

Handle cancellation of a drag event for one of the resizing handles

(protected) _onHandleDragDrop(event)

Handle mouseup after dragging a tile scale handler

Parameters:
Name Type Description
event PIXI.InteractionEvent

The mouseup event

(protected) _onHandleDragMove(event)

Handle mousemove while dragging a tile scale handler

Parameters:
Name Type Description
event PIXI.InteractionEvent

The mousemove event

(protected) _onHandleDragStart(event)

Handle the beginning of a drag event on a resize handle

Parameters:
Name Type Description
event PIXI.InteractionEvent

The mousedown event

(protected) _onHandleHoverIn(event)

Handle mouse-over event on a control handle

Parameters:
Name Type Description
event PIXI.InteractionEvent

The mouseover event

(protected) _onHandleHoverOut(event)

Handle mouse-out event on a control handle

Parameters:
Name Type Description
event PIXI.InteractionEvent

The mouseout event

(protected) _onHandleMouseDown(event)

When we start a drag event - create a preview copy of the Tile for re-positioning

Parameters:
Name Type Description
event PIXI.InteractionEvent

The mousedown event

_onHoverIn(event, options)

Inherited From:
See:
  • MouseInteractionManager#_handleMouseOver

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

Parameters:
Name Type Description
event PIXI.InteractionEvent

The triggering canvas interaction event

options object

Options which customize event handling

Properties
Name Type Attributes Default Description
hoverOutOthers boolean <optional>
true

Trigger hover-out behavior on sibling objects

_onHoverOut(event)

Inherited From:
See:
  • MouseInteractionManager#_handleMouseOut

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

Parameters:
Name Type Description
event PIXI.InteractionEvent

The triggering canvas interaction event

(protected) _onRelease(options)

Inherited From:

Additional events which trigger once control of the object is released

Parameters:
Name Type Description
options Object

Options which modify the releasing workflow

(protected) _onUpdate()

Overrides:

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

(protected) _refreshHandle()

Refresh the display of the Tile resizing handle

_updateRotation(options) → {number}

Inherited From:

Determine a new angle of rotation for a PlaceableObject either from an explicit angle or from a delta offset.

Parameters:
Name Type Description
options object

An object which defines the rotation update parameters

Properties
Name Type Attributes Default Description
angle number <optional>

An explicit angle, either this or delta must be provided

delta number <optional>
0

A relative angle delta, either this or the angle must be provided

snap number <optional>
0

A precision (in degrees) to which the resulting angle should snap. Default is 0.

Returns:

The new rotation angle for the object

Type
number

activateListeners()

Overrides:

Activate interactivity for the Placeable Object

can(user, action) → {boolean}

Inherited From:

Test whether a user can perform a certain interaction with regards to a Placeable Object

Parameters:
Name Type Description
user User

The User performing the action

action string

The named action being attempted

Returns:

Does the User have rights to perform the action?

Type
boolean

clear() → {PlaceableObject}

Inherited From:

Clear the display of the existing object

Returns:

The cleared object

Type
PlaceableObject

clone() → {PlaceableObject}

Inherited From:

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:

A new object with identical data

Type
PlaceableObject

containsPixel(x, y) → {boolean}

Test whether the Tile pixel data contains a specific point in canvas space

Parameters:
Name Type Description
x number
y number
Returns:
Type
boolean

control(options) → {boolean}

Inherited From:

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

Parameters:
Name Type Description
options Object

Additional options which modify the control request

Properties
Name Type Description
releaseOthers boolean

Release any other controlled objects first

Returns:

A flag denoting whether or not control was successful

Type
boolean

destroy()

Overrides:

(async) draw() → {Promise.<PlaceableObject>}

Overrides:

Draw the placeable object into its parent container

Returns:

The drawn object

Type
Promise.<PlaceableObject>

getRoofSprite() → {PIXI.Sprite}

Draw a sprite for the Roof which can be deducted from the fog exploration container

Returns:
Type
PIXI.Sprite

play(playingopt, optionsopt)

Play video for this Tile (if applicable).

Parameters:
Name Type Attributes Default Description
playing boolean <optional>

Should the Tile video be playing?

options object <optional>
{}

Additional options for modifying video playback

Properties
Name Type Attributes Description
loop boolean <optional>

Should the video loop?

offset number <optional>

A specific timestamp between 0 and the video duration to begin playback

volume number <optional>

Desired volume level of the video's audio channel (if any)

refresh(optionsopt, refreshPerceptionopt) → {PlaceableObject}

Overrides:

Refresh the current display state of the Placeable Object

Parameters:
Name Type Attributes Default Description
options object <optional>
refreshPerception boolean <optional>
false

Also refresh the perception layer.

Returns:

The refreshed object

Type
PlaceableObject

release(options) → {boolean}

Inherited From:

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

Parameters:
Name Type Description
options Object

Options which modify the releasing workflow

Returns:

A Boolean flag confirming the object was released.

Type
boolean

(async) rotate(angle, snap) → {Promise.<PlaceableObject>}

Inherited From:

Rotate the PlaceableObject to a certain angle of facing

Parameters:
Name Type Description
angle number

The desired angle of rotation

snap number

Snap the angle of rotation to a certain target degree increment

Returns:

The rotated object

Type
Promise.<PlaceableObject>

swapLayer()

Swap a Tile from the background to the foreground - or vice versa TODO: Refactor to private _onSwapLayer

testOcclusion(token, optionsopt) → {boolean}

Test whether a specific Token occludes this overhead tile. Occlusion is tested against 9 points, the center, the four corners-, and the four cardinal directions

Parameters:
Name Type Attributes Description
token Token

The Token to test

options object <optional>

Additional options that affect testing

Properties
Name Type Attributes Default Description
corners boolean <optional>
true

Test corners of the hit-box in addition to the token center?

Returns:

Is the Token occluded by the Tile?

Type
boolean

updateOcclusion(tokens)

Update the occlusion rendering for this overhead Tile for a given controlled Token.

Parameters:
Name Type Description
tokens Array.<Token>

The set of currently controlled Token objects