Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Hierarchy

Index

Constructors

Properties

outerBounds: Wall[] = []

Synthetic Wall instances which represent the outer boundaries of the game canvas.

innerBounds: Wall[] = []

Synthetic Wall instances which represent the inner boundaries of the scene rectangle.

chain: any = null

A graphics layer used to display chained Wall selection

_chain: boolean = false

Track whether we are currently within a chained placement workflow

_forceSnap: boolean = false

Track whether the layer is currently toggled to snap at exact grid precision

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
_cloneType: any = null

Track the most recently created or updated wall data for use with the clone tool

last: { point: PointArray } = ...

Reference the last interacted wall endpoint for the purposes of chaining

Type declaration

  • point: PointArray
#hover: any = null
documentName: string = "Wall"

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

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

    Returns Wall[]

  • get gridPrecision(): number
  • Gate the precision of wall snapping to become less precise for small scale maps.

    Returns number

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

    Returns any

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

    Returns BasePlaceableHUD

  • 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

  • _draw(options: any): Promise<void>
  • _deactivate(): void
  • initialize(): void
  • Perform initialization steps for the WallsLayer whenever the composition of walls in the Scene is changed. Cache unique wall endpoints and identify interior walls using overhead roof tiles.

    Returns void

  • identifyWallIntersections(): void
  • Initialization to identify all intersections between walls. These intersections are cached and used later when computing point source polygons.

    Returns void

  • identifyInteriorWalls(): void
  • Identify walls which are treated as "interior" because they are contained fully within a roof tile.

    Returns void

  • checkCollision(ray: Ray, options?: any): any
  • Test whether movement along a given Ray collides with a Wall.

    Parameters

    • ray: Ray

      The attempted movement

    • options: any = {}

    Returns any

  • highlightControlledSegments(): void
  • Highlight the endpoints of Wall segments which are currently group-controlled on the Walls layer

    Returns void

  • 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

  • pasteObjects(position: any, options: any): Promise<any>
  • Paste currently copied PlaceableObjects back to the layer by creating new copies

    Parameters

    • position: any

      The destination position for the copied data.

    • options: any

      Options which modify the paste operation

    Returns Promise<any>

    An Array of created Document instances

  • _onDragLeftStart(event: any): any
  • _onDragLeftMove(event: any): void
  • _onDragLeftDrop(event: any): Promise<any>
  • _onDragLeftCancel(event: any): void
  • _onClickRight(event: any): void
  • getDocuments(): Document[]
  • Obtain an iterable of objects which should be added to this PlaceableLayer

    Returns Document[]

  • _tearDown(options: any): Promise<void>
  • _sortObjectsByElevation(): void
  • _activate(): 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

  • 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

  • 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
  • _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
  • #defineBoundaries(): void
  • Define the canvas boundaries for outer and inner regions

    Returns void

  • _panCanvasEdge(event: MouseEvent, x: number, y: number): any
  • Pan the canvas view when the cursor position gets close to the edge of the frame

    Parameters

    • event: MouseEvent

      The originating mouse movement event

    • x: number

      The x-coordinate

    • y: number

      The y-coordinate

    Returns any

  • _getWallEndpointCoordinates(point: any, [snap=true]?: boolean): number[]
  • Get the endpoint coordinates for a wall placement, snapping to grid at a specified precision Require snap-to-grid until a redesign of the wall chaining system can occur.

    Parameters

    • point: any

      The initial candidate point

    • [snap=true]: boolean = {}

      Whether to snap to grid

    Returns number[]

    The endpoint coordinates [x,y]

  • _getWallDataFromActiveTool(tool: string): any
  • The Scene Controls tools provide several different types of prototypical Walls to choose from This method helps to translate each tool into a default wall data configuration for that type

    Parameters

    • tool: string

      The active canvas tool

    Returns any

  • getClosestEndpoint(point: Point, wall: Wall): PointArray
  • Given a point and the coordinates of a wall, determine which endpoint is closer to the point

    Parameters

    • point: Point

      The origin point of the new Wall placement

    • wall: Wall

      The existing Wall object being chained to

    Returns PointArray

    The [x,y] coordinates of the starting endpoint