Options
All
  • Public
  • Public/Protected
  • All
Menu

A PlaceablesLayer designed for rendering the visual Scene for a specific vertical cross-section.

Hierarchy

Index

Constructors

Properties

textureDataMap: Map<string, any> = ...

A mapping of url to texture data

objects: any = null

Placeable Layer Objects

preview: any = null

Preview Object Placement

history: CanvasHistory[] = []

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

_highlight: boolean = false

Track whether "highlight all objects" is currently active

_copy: PlaceableObject[] = []

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

quadtree: Quadtree = ...

A Quadtree which partitions and organizes Walls into quadrants for efficient target identification.

visible: boolean
sortDirty: boolean
zIndex: number
interactive: boolean
interactiveChildren: boolean
hitArea: any
options: { name: string } = ...

Options for this layer instance.

Type declaration

  • name: string
renderable: boolean
#hover: any = null
documentName: string = "Tile"

A reference to the named Document type which is contained within this Canvas Layer.

CREATION_STATES: { NONE: number; POTENTIAL: number; CONFIRMED: number; COMPLETED: number } = ...

Creation states affected to placeables during their construction.

Type declaration

  • NONE: number
  • POTENTIAL: number
  • CONFIRMED: number
  • COMPLETED: number

Accessors

  • get hookName(): string
  • inheritdoc

    Returns string

  • get hud(): any
  • inheritdoc

    Returns any

  • An array of Tile objects which are rendered within the objects container

    Returns Tile[]

  • Get an array of overhead Tile objects which are roofs

    Returns Tile[]

  • get displayRoofs(): boolean
  • Determine whether to display roofs

    Returns boolean

  • A convenience reference to the tile occlusion mask on the primary canvas group.

    Returns CachedContainer

  • get documentCollection(): any
  • Obtain a reference to the Collection of embedded Document instances within the currently viewed Scene

    Returns any

  • get gridPrecision(): number
  • Return the precision relative to the Scene grid with which Placeable objects should be snapped

    Returns number

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

    Returns PlaceableObject[]

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

    Returns PlaceableObject[]

  • Track the set of PlaceableObjects on this layer which are currently controlled.

    Returns Map<string, PlaceableObject>

  • Track the PlaceableObject on this layer which is currently hovered upon.

    Returns PlaceableObject

  • Track the PlaceableObject on this layer which is currently hovered upon.

    Parameters

    Returns void

  • get active(): boolean
  • Is this layer currently active

    Returns boolean

  • get name(): string
  • The canonical name of the CanvasLayer

    Returns string

  • get layerOptions(): any
  • inheritdoc

    Returns any

  • get placeableClass(): Function
  • Obtain a reference to the PlaceableObject class definition which represents the Document type in this layer.

    Returns Function

  • Return a reference to the active instance of this canvas layer

    Returns CanvasLayer

Methods

  • _activate(): void
  • _deactivate(): void
  • _activateSubLayer(foreground?: boolean): void
  • Activate a sublayer of the tiles layer, which controls interactivity of placeables and release controlled objects.

    internal

    Parameters

    • foreground: boolean = false

    Returns void

  • _tearDown(options: any): Promise<void>
  • _onDragLeftStart(event: any): Promise<void>
  • _onDragLeftMove(event: any): void
  • _onDragLeftDrop(event: any): void
  • _onDragLeftCancel(event: any): void
  • _getDropData(event: DragEvent, data: any): any
  • Prepare the data object when a new Tile is dropped onto the canvas

    Parameters

    • event: DragEvent

      The concluding drag event

    • data: any

      The extracted Tile data

    Returns any

    The prepared data to create

  • getDocuments(): Document[]
  • Obtain an iterable of objects which should be added to this PlaceableLayer

    Returns Document[]

  • _draw(options: any): Promise<void>
  • _sortObjectsByElevation(): void
  • clearPreviewContainer(): void
  • 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.

    Parameters

    • objectId: string

      The ID of the contained object to retrieve

    Returns PlaceableObject

    The object instance, or undefined

  • Acquire control over all PlaceableObject instances which are visible and controllable within the layer.

    Parameters

    • options: any = {}

      Options passed to the control method of each object

    Returns PlaceableObject[]

    An array of objects that were controlled

  • releaseAll(options?: any): number
  • Release all controlled PlaceableObject instance from this layer.

    Parameters

    • options: any = {}

      Options passed to the release method of each object

    Returns number

    The number of PlaceableObject instances which were released

  • rotateMany(options?: { angle: number; delta: number; snap: number; ids: any[] }): Promise<PlaceableObject[]>
  • 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

    • options: { angle: number; delta: number; snap: number; ids: any[] } = {}

      Options which configure how multiple objects are rotated

      • angle: number
      • delta: number
      • snap: number
      • ids: any[]

    Returns Promise<PlaceableObject[]>

    An array of objects which were rotated

  • moveMany(options?: { dx: number; dy: number; rotate: boolean; ids: any[] }): Promise<PlaceableObject[]>
  • 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

    • options: { dx: number; dy: number; rotate: boolean; ids: any[] } = {}

      Options which configure how multiple objects are moved

      • dx: number
      • dy: number
      • rotate: boolean
      • ids: any[]

    Returns Promise<PlaceableObject[]>

    An array of objects which were moved during the operation

  • undoHistory(): Promise<Document[]>
  • Undo a change to the objects in this layer This method is typically activated using CTRL+Z while the layer is active

    Returns Promise<Document[]>

    An array of documents which were modified by the undo operation

  • deleteAll(): Promise<Document[]>
  • 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

    Returns Promise<Document[]>

    An array of Document objects which were deleted by the operation

  • storeHistory(type: string, data: any[]): void
  • Record a new CRUD event in the history log so that it can be undone later

    Parameters

    • type: string

      The event type (create, update, delete)

    • data: any[]

      The object data

    Returns void

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

    Returns PlaceableObject[]

    The Array of copied PlaceableObject instances

  • pasteObjects(position: Point, [options]?: { hidden: boolean; snap: boolean }): Promise<Document[]>
  • Paste currently copied PlaceableObjects back to the layer by creating new copies

    Parameters

    • position: Point

      The destination position for the copied data.

    • [options]: { hidden: boolean; snap: boolean } = {}

      Options which modify the paste operation

      • hidden: boolean
      • snap: boolean

    Returns Promise<Document[]>

    An Array of created Document instances

  • selectObjects(__namedParameters?: number, __namedParameters?: number): boolean
  • Select all PlaceableObject instances which fall within a coordinate rectangle.

    Parameters

    • __namedParameters: number = {}
    • __namedParameters: number = {}

    Returns boolean

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

  • updateAll(transformation: any, condition?: Function, options?: any): Promise<Document[]>
  • Update all objects in this layer with a provided transformation. Conditionally filter to only apply to objects which match a certain condition.

    Parameters

    • transformation: any

      An object of data or function to apply to all matched objects

    • condition: Function = null

      A function which tests whether to target each object

    • options: any = {}

    Returns Promise<Document[]>

    An array of updated data once the operation is complete

  • _onClickLeft(event: any): void
  • _onClickRight(event: any): void
  • _onDeleteKey(event: any): Promise<any>
  • Activate the InteractionLayer, deactivating other layers and marking this layer's children as interactive.

    Parameters

    • [options]: { tool: string } = {}

      Options which configure layer activation

      • tool: string

    Returns InteractionLayer

    The layer instance, now activated

  • getZIndex(): number
  • Get the zIndex that should be used for ordering this layer vertically relative to others in the same Container.

    Returns number

  • 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.

    Parameters

    • options: any = {}

    Returns Promise<CanvasLayer>

  • Deconstruct data used in the current layer in preparation to re-draw the canvas

    Parameters

    • options: any = {}

    Returns Promise<CanvasLayer>

  • _canvasCoordinatesFromDrop(event: DragEvent, __namedParameters?: any): boolean | number[]
  • Get the world-transformed drop position.

    Parameters

    • event: DragEvent
    • __namedParameters: any = {}

    Returns boolean | number[]

    Returns the transformed x, y co-ordinates, or false if the drag event was outside the canvas.

  • _createPreview(createData: any, position: { top: number; left: number }): Promise<any>
  • Create a preview of this layer's object type from a world document and show its sheet so it can be finalized.

    Parameters

    • createData: any

      The data to create the object with.

    • position: { top: number; left: number }

      The position to render the sheet at.

      • top: number
      • left: number

    Returns Promise<any>

  • _onClickLeft2(event: InteractionEvent): void
  • _onDropData(event: DragEvent, data: any): Promise<any>
  • Handle drop events for Tile data on the Tiles Layer

    Parameters

    • event: DragEvent

      The concluding drag event

    • data: any

      The extracted Tile data

    Returns Promise<any>