WallsLayer

WallsLayer

The Walls canvas layer which provides a container for Wall objects within the rendered Scene.

Constructor

new WallsLayer()

Source:
See:

Extends

Members

(static) dataArray

Source:

(static) layerOptions

Source:

(static) placeableClass

Source:

_controlled :Object

Source:
Overrides:

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

Type:
  • Object

_copy :Array

Source:
Overrides:

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

Type:

_hover :PlaceableObject

Source:
Overrides:

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

Type:

blockMovement :Array.<Wall>

Source:

An Array of Wall instances in the current Scene which block Token movement.

Type:

blockVision :Array.<Wall>

Source:

An Array of Wall instances in the current Scene which currently block Token vision.

Type:

chain :PIXI.Graphics

Source:

A graphics layer used to display chained Wall selection

Type:
  • PIXI.Graphics

controlled

Source:
Overrides:

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

doors :Array.<Wall>

Source:

An Array of Wall instances in the current Scene which act as Doors.

Type:

endpoints :Array

Source:

The set of unique vision-blocking wall endpoints Used to shortcut calculation of line-of-sight

Type:

gridPrecision :number

Source:
Overrides:

Gate the precision of wall snapping to become less precise for small scale maps.

Type:
  • number

history :Array

Source:
Overrides:

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

Type:

hud :BasePlaceableHUD|null

Source:
Overrides:

If objects on this PlaceableLayer have a HUD UI, provide a reference to its instance

Type:

objects :PIXI.Container

Source:
Overrides:

Placeable Layer Objects

Type:
  • PIXI.Container

options :Object

Source:
Overrides:

PlaceableObject layer options

Type:
  • Object

placeables :Array

Source:
Overrides:

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

Type:

preview

Source:
Overrides:

Preview Object Placement

walls :PIXI.Container

Source:

The Walls Container - just references objects array for backwards compatibility

Type:
  • PIXI.Container

Methods

activate()

Source:
Overrides:

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

checkCollision(ray) → {boolean}

Source:

Test whether movement along a given Ray collides with a Wall.

Parameters:
Name Type Description
ray Ray

The attempted movement

Returns:

Does a collision occur?

Type
boolean

copyObjects() → {Array}

Source:
Overrides:

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:
Overrides:

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() → {PlaceableObject}

Source:
Overrides:

Draw a single placeable object

Returns:
Type
PlaceableObject

deactivate()

Source:
Overrides:

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

deleteAll()

Source:
Overrides:

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:
Overrides:

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:
Overrides:

Draw the PlaceablesLayer. Draw each Sound within the scene as a child of the sounds container.

get(objectId) → {PlaceableObject}

Source:
Overrides:

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:
Overrides:

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

highlightControlledSegments()

Source:

Highlight the endpoints of Wall segments which are currently group-controlled on the Walls layer

initialize()

Source:

Initialize the Walls Layer. This operation is needed when the canvas is first drawn, or when walls data changes.

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

Source:
Overrides:

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:
Overrides:

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

Returns:

An Array of created Objects

Type
Promise.<Array>

releaseAll() → {Number}

Source:
Overrides:

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:
Overrides:

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:
Overrides:

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

sortObjects()

Source:
Overrides:

Reorder the child objects of the layer according to their z-index (if one exists)

(async) tearDown()

Source:
Inherited From:

(async) undoHistory() → {Promise}

Source:
Overrides:

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:
Overrides:

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