Internal
_configPreview container for config previews
Keep track of objects copied with CTRL+C/X which can be pasted later.
Track whether "highlight all objects" is currently active
Keep track of history so that CTRL+Z can undo changes.
Whether this event target has any children that need UI events. This can be used optimize event propagation.
Placeable Layer Objects
Options for this layer instance.
Preview Object Placement
A Quadtree which partitions and organizes Walls into quadrants for efficient target identification.
Static
CREATION_Creation states affected to placeables during their construction.
Static
documentA reference to the named Document type which is contained within this Canvas Layer.
Static
SORT_Sort order for placeables belonging to this layer.
Is this layer currently active
An Array of placeable objects in this layer which have the _controlled attribute
Track the set of PlaceableObjects on this layer which are currently controlled.
Obtain a reference to the Collection of embedded Document instances within the currently viewed Scene
To know wheter this layer has a preview object or not.
The name used by hooks to construct their hook string. Note: You should override this getter if hookName should not return the class constructor name.
Track the PlaceableObject on this layer which is currently hovered upon.
If objects on this PlaceablesLayer have a HUD UI, provide a reference to its instance
A convenience method for accessing the placeable object instances contained in this layer
An array of Tile objects which are rendered within the objects container
Static
instanceReturn a reference to the active instance of this canvas layer
Static
layerConfiguration options for the PlaceablesLayer.
Static
placeableObtain a reference to the PlaceableObject class definition which represents the Document type in this layer.
Internal
Create a preview of this layer's object type from a world document and show its sheet to be finalized.
The data to create the object with.
Optional
options: { left?: number; renderSheet?: boolean; top?: number } = {}Options which configure preview creation
Optional
left?: numberThe offset-left position where the sheet should be rendered
Optional
renderSheet?: booleanRender the preview object config sheet?
Optional
top?: numberThe offset-top position where the sheet should be rendered
The created preview object
Internal
An internal helper method to identify the array of PlaceableObjects which can be copied/cut.
Additional options
Cut instead of copy?
An array of objects which can be copied/cut
Prepare the data object when a new Tile is dropped onto the canvas
The concluding drag event
The extracted Tile data
The prepared data to create
Internal
An internal helper method to identify the array of PlaceableObjects which can be moved or rotated.
An explicit array of IDs requested.
Include locked objects which would otherwise be ignored?
An array of objects which can be moved or rotated
Internal
Prepare the updates and update options for moving the given placeable objects via keyboard.
Internal
Prepare the updates and update options for rotating the given placeable objects via keyboard.
Internal
Send the controlled objects of this layer to the back or bring them to the front.
Bring to front instead of send to back?
Returns true if the layer has sortable object, and false otherwise
The inner _tearDown method which may be customized by each CanvasLayer subclass.
Options which configure how the layer is deconstructed
Activate the InteractionLayer, deactivating other layers and marking this layer's children as interactive.
Optional
options: { tool?: string } = {}Options which configure layer activation
Optional
tool?: stringA specific tool in the control palette to set as active
The layer instance, now activated
Clear the contents of the preview container, restoring visibility of original (non-preview) objects.
Acquire control over all PlaceableObject instances which are visible and controllable within the layer.
Options passed to the control method of each object
An array of objects that were controlled
Copy (or cut) currently controlled PlaceableObjects, ready to paste back into the Scene later.
Optional
options: { cut?: boolean } = {}Additional options
Optional
cut?: booleanCut instead of copy?
The Array of copied PlaceableObject instances
Draw a single placeable object
The Document instance used to create the placeable object
Deactivate the InteractionLayer, removing interactivity from its children.
The layer instance, now inactive
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
An array of Document objects which were deleted by the operation
Draw the canvas layer, rendering its internal components and returning a Promise. The Promise resolves to the drawn layer once its contents are successfully rendered.
Optional
options: object = {}Options which configure how the layer is drawn
Get a PlaceableObject contained in this layer by its ID. Returns undefined if the object doesn't exist or if the canvas is not rendering a Scene.
The ID of the contained object to retrieve
The object instance, or undefined
Obtain an iterable of objects which should be added to this PlaceablesLayer
Get the maximum sort value of all placeables.
The maximum sort value (-Infinity if there are no objects)
Snaps the given point to grid. The layer defines the snapping behavior.
The point that is to be snapped
The snapped point
Get the zIndex that should be used for ordering this layer vertically relative to others in the same Container.
Simultaneously move multiple PlaceableObjects via keyboard movement offsets. This executes a single database operation using Scene#updateEmbeddedDocuments.
Options which configure how multiple objects are moved
Optional
dx?: 0 | 1 | -1Horizontal movement direction
Optional
dy?: 0 | 1 | -1Vertical movement direction
Optional
dz?: 0 | 1 | -1Movement direction along the z-axis (elevation)
Optional
ids?: string[]An Array of object IDs to target for movement. The default is the IDs of controlled objects.
Optional
includeLocked?: booleanMove objects whose documents are locked?
Optional
rotate?: booleanRotate the placeable to direction instead of moving
An array of objects which were moved during the operation
Paste currently copied PlaceableObjects back to the layer by creating new copies
The destination position for the copied data.
Optional
options: { hidden?: boolean; snap?: boolean } = {}Options which modify the paste operation
Optional
hidden?: booleanPaste data in a hidden state, if applicable. Default is false.
Optional
snap?: booleanSnap the resulting objects to the grid. Default is true.
An Array of created Document instances
Release all controlled PlaceableObject instance from this layer.
Options passed to the release method of each object
The number of PlaceableObject instances which were released
Simultaneously rotate multiple PlaceableObjects using a provided angle or incremental. This executes a single database operation using Scene#updateEmbeddedDocuments.
Options which configure how multiple objects are rotated
Optional
angle?: numberA target angle of rotation (in degrees) where zero faces "south"
Optional
delta?: numberAn incremental angle of rotation (in degrees)
Optional
ids?: any[]An Array of object IDs to target for rotation
Optional
includeLocked?: booleanRotate objects whose documents are locked?
Optional
snap?: numberSnap the resulting angle to a multiple of some increment (in degrees)
An array of objects which were rotated
Select all PlaceableObject instances which fall within a coordinate rectangle.
Optional
options: {Optional
controlOptions?: objectOptional arguments provided to any called control() method.
Optional
height?: numberThe height of the selection rectangle.
Optional
releaseOptions?: objectOptional arguments provided to any called release() method.
Optional
width?: numberThe width of the selection rectangle.
Optional
x?: numberThe top-left x-coordinate of the selection rectangle.
Optional
y?: numberThe top-left y-coordinate of the selection rectangle.
Optional
aoptions: { releaseOthers?: boolean } = {}Additional options to configure selection behaviour.
Optional
releaseOthers?: booleanWhether to release other selected objects.
A boolean for whether the controlled set was changed in the operation.
Assign a set of render flags to all placeables in this layer.
The flags to set
Record a new CRUD event in the history log so that it can be undone later. The base implemenation calls PlaceablesLayer#_storeHistory without passing the given options. Subclasses may override this function and can call PlaceablesLayer#_storeHistory themselves to pass options as needed.
The event type
The create/update/delete data
Optional
options: objectThe create/update/delete options
Deconstruct data used in the current layer in preparation to re-draw the canvas
Optional
options: object = {}Options which configure how the layer is deconstructed
Undo a change to the objects in this layer This method is typically activated using CTRL+Z while the layer is active
An array of documents which were modified by the undo operation
Update all objects in this layer with a provided transformation. Conditionally filter to only apply to objects which match a certain condition.
An object of data or function to apply to all matched objects
A function which tests whether to target each object
Optional
options: object = {}Additional options passed to Document.update
An array of updated data once the operation is complete
Protected
_canvasProtected
Get the world-transformed drop position.
Optional
options: { center?: boolean } = {}Optional
center?: booleanReturn the coordinates of the center of the nearest grid element.
Returns the transformed x, y coordinates, or false if the drag event was outside the canvas.
Protected
_confirmProtected
Confirm deletion via the delete key. Called only if foundry.canvas.layers.types.PlaceablesLayerOptions#confirmDeleteKey is true.
The documents that will be deleted on confirmation.
True if the deletion is confirmed to proceed.
Protected
_onProtected
Handle double left-click events which originate from the Canvas stage.
The PIXI InteractionEvent which wraps a PointerEvent
Protected
_onProtected
Handle double right mouse-click events which originate from the Canvas stage.
The PIXI InteractionEvent which wraps a PointerEvent
Protected
_onProtected
Handle a Cycle View keypress while this layer is active.
The cycle-view key press event
Was the event handled?
Protected
_onProtected
Handle drop events for Tile data on the Tiles Layer
The concluding drag event
The extracted Tile data
Protected
_onProtected
Undo creation with deletion workflow
An array of documents which were modified by the undo operation
Protected
_onProtected
Undo deletion with creation workflow.
An array of documents which were modified by the undo operation
Protected
_onProtected
Undo updates with update workflow.
An array of documents which were modified by the undo operation
Protected
_storeProtected
Record a new CRUD event in the history log so that it can be undone later.
Updates without changes are filtered out unless the diff
option is set to false.
This function may not be overridden.
The event type
The create/update/delete data
Optional
options: object = {}The options of the undo operation
Static
prepare
A PlaceablesLayer designed for rendering the visual Scene for a specific vertical cross-section.