Options
All
  • Public
  • Public/Protected
  • All
Menu

This Canvas Layer provides a container for AmbientSound objects.

Hierarchy

Index

Constructors

Properties

livePreview: boolean = false

Track whether to actively preview ambient sounds with mouse cursor movements

sources: Collection<string, SoundSource> = ...

A mapping of ambient audio sources which are active within the rendered Scene

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 = "AmbientSound"

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

  • 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

  • _tearDown(options: any): Promise<void>
  • initializeSources(): void
  • Initialize all AmbientSound sources which are present on this layer

    Returns void

  • refresh(options?: any): number
  • Update all AmbientSound effects in the layer by toggling their playback status. Sync audio for the positions of tokens which are capable of hearing.

    Parameters

    • options: any = {}

    Returns number

  • previewSound(position: Point): void
  • Preview ambient audio for a given mouse cursor position

    Parameters

    • position: Point

      The cursor position to preview

    Returns void

  • stopAll(): void
  • Terminate playback of all ambient audio sources

    Returns void

  • _onDarknessChange(darkness: number, prior: number): void
  • Actions to take when the darkness level of the Scene is changed

    internal

    Parameters

    • darkness: number

      The new darkness level

    • prior: number

      The prior darkness level

    Returns void

  • _onMouseMove(event: InteractionEvent): void
  • Handle mouse cursor movements which may cause ambient audio previews to occur

    Parameters

    • event: InteractionEvent

      The initiating mouse move interaction event

    Returns void

  • _onDragLeftStart(event: any): Promise<any>
  • _onDragLeftMove(event: any): void
  • _onDragLeftDrop(event: any): Promise<void>
  • _onDragLeftCancel(event: any): void
  • _onDropData(event: DragEvent, data: any): Promise<any>
  • Handle PlaylistSound document drop data.

    Parameters

    • event: DragEvent

      The drag drop event

    • data: any

      The dropped transfer data.

    Returns Promise<any>

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

    Returns Document[]

  • _draw(options: any): Promise<void>
  • _sortObjectsByElevation(): void
  • _activate(): void
  • _deactivate(): 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
  • _syncPositions(listeners: Point[], options: any): void
  • Sync the playing state and volume of all AmbientSound objects based on the position of listener points

    Parameters

    • listeners: Point[]

      Locations of listeners which have the capability to hear

    • options: any

    Returns void

  • _getEasingVolume(distance: any, radius: any): number
  • Define the easing function used to map radial distance to volume. Uses cosine easing which graduates from volume 1 at distance 0 to volume 0 at distance 1

    Parameters

    • distance: any
    • radius: any

    Returns number

    The target volume level