Foundry Virtual Tabletop - API Documentation - Version 14
    Preparing search index...

    A CanvasLayer responsible for drawing a square grid

    Hierarchy (View Summary)

    Index

    Properties

    highlight: Container<DisplayObject>

    The Grid Highlight container

    highlightLayers: Record<string, GridHighlight> = {}

    Map named highlight layers

    interactiveChildren: boolean = false

    Whether this event target has any children that need UI events. This can be used optimize event propagation.

    mesh: GridMesh

    The grid mesh.

    options: { name: string } = ...

    Options for this layer instance.

    Accessors

    • get hookName(): string

      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.

      Returns string

    • get name(): string

      The canonical name of the CanvasLayer is the name of the constructor that is the immediate child of the defined baseClass for the layer type.

      Returns string

      canvas.lighting.name -> "LightingLayer"
      
    • get instance(): any

      Returns any

    • get layerOptions(): object

      Customize behaviors of this CanvasLayer by modifying some behaviors at a class level.

      Returns object

    Methods

    • Parameters

      • options: any

      Returns Promise<void>

    • Define a new Highlight graphic

      Parameters

      • name: string

        The name for the referenced highlight layer

      Returns GridHighlight

    • Clear a specific Highlight graphic

      Parameters

      • name: string

        The name for the referenced highlight layer

      Returns void

    • Destroy a specific Highlight graphic

      Parameters

      • name: string

        The name for the referenced highlight layer

      Returns void

    • 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

      • Optionaloptions: object = {}

        Options which configure how the layer is drawn

      Returns Promise<CanvasLayer>

    • Obtain the highlight layer graphic by name

      Parameters

      • name: string

        The name for the referenced highlight layer

      Returns void | GridHighlight

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

      Returns number

    • Add highlighting for a specific grid position to a named highlight graphic

      Parameters

      • name: string

        The name for the referenced highlight layer

      • options: {
            alpha?: number;
            border?: ColorSource | null;
            color?: ColorSource;
            shape?: Polygon;
            x?: number;
            y?: number;
        }

        If gridless you need to pass shape but not x and y. - If not gridless you need to pass x and y, but not shape.

        • Optionalalpha?: number

          The opacity of the highlight

        • Optionalborder?: ColorSource | null

          The border color of the highlight

        • Optionalcolor?: ColorSource

          The fill color of the highlight

        • Optionalshape?: Polygon

          A predefined shape to highlight

        • Optionalx?: number

          The x-coordinate of the highlighted position

        • Optionaly?: number

          The y-coordinate of the highlighted position

      Returns void

    • Initialize the grid mesh appearance and configure the grid shader.

      Parameters

      • options: { alpha?: number; color?: string; style?: string; thickness?: number } = {}
        • Optionalalpha?: number

          The grid alpha

        • Optionalcolor?: string

          The grid color

        • Optionalstyle?: string

          The grid style

        • Optionalthickness?: number

          The grid thickness

      Returns void

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

      Parameters

      • Optionaloptions: object = {}

        Options which configure how the layer is deconstructed

      Returns Promise<CanvasLayer>

    • Protected

      Creates the grid mesh.

      Returns Promise<GridMesh>

    • Protected

      The inner _tearDown method which may be customized by each CanvasLayer subclass.

      Parameters

      • options: object

        Options which configure how the layer is deconstructed

      Returns Promise<void>