PlaceablesLayer

PlaceablesLayer

The base PlaceablesLayer subclass of CanvasLayer

Constructor

new PlaceablesLayer()

Source:

Members

(static) dataArray :String

Source:

Define the named Array within Scene.data containing the placeable objects displayed in this layer

Type:

(static) instance :PlaceablesLayer

Source:

Return a reference to the active instance of this canvas layer

Type:

(static) layerOptions :Object

Source:
Properties:
Name Type Description
canDragCreate boolean

Does this layer support a mouse-drag workflow to create new objects?

controllableObjects boolean

Can placeable objects in this layer be controlled?

rotatableObjects boolean

Can placeable objects in this layer be rotated?

snapToGrid boolean

Do objects in this layer snap to the grid

gridPrecision number

At what numeric grid precision do objects snap?

Customize behaviors of this PlaceablesLayer by modifying some behaviors at a class level

Type:
  • Object

(static) placeableClass :PIXI.Container

Source:

Define a Container implementation used to render placeable objects contained in this layer

Type:
  • PIXI.Container

_controlled :Object

Source:

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

Type:
  • Object

_copy :Array

Source:

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

Type:

_hover :PlaceableObject

Source:

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

Type:

controlled

Source:

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

gridPrecision

Source:

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

history :Array

Source:

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

Type:

hud :BasePlaceableHUD|null

Source:

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

Type:

objects :PIXI.Container

Source:

Placeable Layer Objects

Type:
  • PIXI.Container

options :Object

Source:

PlaceableObject layer options

Type:
  • Object

placeables :Array

Source:

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

Type:

preview

Source:

Preview Object Placement

Methods

activate()

Source:

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

copyObjects() → {Array}

Source:

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:

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:

Draw a single placeable object

Returns:
Type
PlaceableObject

deactivate()

Source:

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

deleteAll()

Source:

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:

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:

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

get(objectId) → {PlaceableObject}

Source:

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

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

Source:

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:

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

Returns:

An Array of created Objects

Type
Promise.<Array>

releaseAll(options) → {Number}

Source:

Release all controlled PlaceableObject instance from this layer.

Parameters:
Name Type Description
options Object

Additional options which customize the Object releasing behavior

Returns:

The number of PlaceableObject instances which were released

Type
Number

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

Source:

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

Source:

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:

The number of PlaceableObject instances which were controlled.

Type
Number

sortObjects()

Source:

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

(async) undoHistory() → {Promise}

Source:

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:

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