TilesLayer

TilesLayer

The Tiles canvas layer which provides a container for Tile objects which are rendered immediately above the BackgroundLayer and below the GridLayer.

Constructor

new TilesLayer()

Source:
See:

Extends

Members

(static) layerOptions

Source:

_controlled :Object

Source:
Inherited From:

Track the set of PlaceableObjects on this layer which are currently controlled by their id

Type:
  • Object

_copy :Array

Source:
Inherited From:

Keep track of an object copied with CTRL+C which can be pasted later

Type:

_hover :PlaceableObject

Source:
Inherited From:

Track the PlaceableObject on this layer which is currently being hovered upon

Type:

controlled

Source:
Inherited From:

An Array of placeable objects in this layer which have the _controlled attribute

gridPrecision

Source:
Inherited From:

Return the precision relative to the Scene grid with which Placeable objects should be snapped

history :Array

Source:
Inherited From:

Keep track of history so that CTRL+Z can undo changes

Type:

hud :TileHUD

Source:
Overrides:

Tile objects on this layer utilize the TileHUD

Type:

objects :PIXI.Container

Source:
Inherited From:

Placeable Layer Objects

Type:
  • PIXI.Container

options :Object

Source:
Inherited From:

PlaceableObject layer options

Type:
  • Object

placeables :Array

Source:
Inherited From:

A convenience method for accessing the placeable object instances contained in this layer

Type:

preview

Source:
Inherited From:

Preview Object Placement

Methods

_onClickLeft()

Source:
Inherited From:
See:
  • {Canvas#_onClickLeft}

Handle left mouse-click events which originate from the Canvas stage and are dispatched to this Layer.

_onClickLeft2()

Source:
Inherited From:
See:

Handle double left-click events which originate from the Canvas stage and are dispatched to this Layer.

_onClickRight()

Source:
Inherited From:
See:
  • {Canvas#_onClickRight}

Handle right mouse-click events which originate from the Canvas stage and are dispatched to this Layer.

_onDragLeftCancel()

Source:
Overrides:
See:
  • {Canvas#_onDragLeftDrop}

Cancel a left-click drag workflow originating from the Canvas stage.

_onDragLeftDrop()

Source:
Overrides:
See:
  • {Canvas#_onDragLeftDrop}

Conclude a left-click drag workflow originating from the Canvas stage.

_onDragLeftMove()

Source:
Overrides:
See:
  • {Canvas#_onDragLeftMove}

Continue a left-click drag workflow originating from the Canvas stage.

_onDragLeftStart()

Source:
Overrides:
See:
  • {Canvas#_onDragLeftStart}

Start a left-click drag workflow originating from the Canvas stage.

_onMouseWheel(event)

Source:
Inherited From:

Handle mouse-wheel events at the PlaceableObjects layer level to rotate multiple objects at once. This handler will rotate all controlled objects by some incremental angle.

Parameters:
Name Type Description
event Event

The mousewheel event which originated the request

activate()

Source:
Inherited From:

Override the activation behavior of the PlaceablesLayer. While active, ambient sound previews are displayed.

copyObjects() → {Array}

Source:
Inherited From:

Copy currently controlled PlaceableObjects to a temporary Array, ready to paste back into the scene later

Returns:

The Array of copied Objects

Type
Array

(async) createMany(data, options) → {Promise}

Source:
Inherited From:

Create multiple embedded entities in a parent Entity collection using an Array of provided data

Parameters:
Name Type Description
data Array

An Array of update data Objects which provide incremental data

options Object

Additional options which customize the update workflow

Returns:

A Promise which resolves to the returned socket response (if successful)

Type
Promise

createObject() → {Promise.<PlaceableObject>}

Source:
Inherited From:

Draw a single placeable object

Returns:
Type
Promise.<PlaceableObject>

deactivate()

Source:
Overrides:

Override the deactivation behavior of the PlaceablesLayer. When inactive, ambient sound previews are hidden from view.

deleteAll()

Source:
Inherited From:

A helper method to prompt for deletion of all PlaceableObject instances within the Scene Renders a confirmation dialogue to confirm with the requester that all objects will be deleted

(async) deleteMany(ids, options) → {Promise}

Source:
Inherited From:

Simultaneously delete multiple PlaceableObjects. This executes a single database operation using Scene.update. If deleting only a single object, this will delegate to PlaceableObject.delete for performance reasons.

Parameters:
Name Type Description
ids Array

An Array of object IDs to target for deletion

options Object

Additional options which customize the update workflow

Returns:

A Promise which resolves to the returned socket response (if successful)

Type
Promise

(async) draw()

Source:
Inherited From:

Draw the PlaceablesLayer and draw each PlaceableObject which exists within the layer. Resolve a Promise once all objects have finished drawing.

get(objectId) → {PlaceableObject}

Source:
Inherited From:

Get a PlaceableObject contained in this layer by it's ID

Parameters:
Name Type Description
objectId string

The ID of the contained object to retrieve

Returns:

The object instance, or undefined

Type
PlaceableObject

getDragDestination(object, destination, snap) → {Object}

Source:
Inherited From:

Given an object and a proposed destination point, confirm the destination position or throw an Error

Parameters:
Name Type Default Description
object PlaceableObject

The object being dragged

destination Object

The destination position

snap boolean true

Snap to grid?

Returns:

The confirmed destination coordinates

Type
Object

(async) moveMany(dx, dy, rotate, ids) → {Promise}

Source:
Inherited From:

Simultaneously move multiple PlaceableObjects via keyboard movement offsets. This executes a single database operation using Scene.update. If moving only a single object, this will delegate to PlaceableObject.update for performance reasons.

Parameters:
Name Type Description
dx Number

The number of incremental grid units in the horizontal direction

dy Number

The number of incremental grid units in the vertical direction

rotate Boolean

Rotate the token to the keyboard direction instead of moving

ids Array | Set

An Array or Set of object IDs to target for rotation

Returns:

The resulting Promise from the Scene.update operation

Type
Promise

(async) pasteObjects() → {Promise.<Array>}

Source:
Inherited From:

Paste currently copied PlaceableObjects back to the layer by creating new copies

Returns:

An Array of created Objects

Type
Promise.<Array>

releaseAll() → {Number}

Source:
Inherited From:

Release all controlled PlaceableObject instance from this layer.

Returns:

The number of PlaceableObject instances which were released

Type
Number

(async) rotateMany(angle, delta, snap, ids) → {Promise}

Source:
Inherited From:

Simultaneously rotate multiple PlaceableObjects using a provided angle or incremental. This executes a single database operation using Scene.update. If rotating only a single object, it is better to use the PlaceableObject.rotate instance method.

Parameters:
Name Type Description
angle Number

A target angle of rotation (in degrees) where zero faces "south"

delta Number

An incremental angle of rotation (in degrees)

snap Number

Snap the resulting angle to a multiple of some increment (in degrees)

ids Array | Set

An Array or Set of object IDs to target for rotation

Returns:

The resulting Promise from the Scene.update operation

Type
Promise

selectObjects(x, y, width, height, releaseOptions, controlOptions) → {boolean}

Source:
Inherited From:

Select all PlaceableObject instances which fall within a coordinate rectangle.

Parameters:
Name Type Description
x Number

The top-left x-coordinate of the selection rectangle

y Number

The top-left y-coordinate of the selection rectangle

width Number

The width of the selection rectangle

height Number

The height of the selection rectangle

releaseOptions Object

Optional arguments provided to any called release() method

controlOptions Object

Optional arguments provided to any called control() method

Returns:

A boolean for whether the controlled set was changed in the operation

Type
boolean

storeHistory(type, data)

Source:
Inherited From:

Record a new CRUD event in the history log so that it can be undone later

Parameters:
Name Type Description
type String

The event type (create, update, delete)

data Object

The object data

(async) tearDown()

Source:
Inherited From:

(async) undoHistory() → {Promise}

Source:
Inherited From:

Undo a change to the objects in this layer This method is typically activated using CTRL+Z while the layer is active

Returns:
Type
Promise

(async) updateMany(data, options) → {Promise}

Source:
Inherited From:

Update multiple embedded entities in a parent Entity collection using an Array of provided data

Parameters:
Name Type Description
data Array

An Array of update data Objects which provide incremental data

options Object

Additional options which customize the update workflow

Returns:

A Promise which resolves to the returned socket response (if successful)

Type
Promise