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

    A subclass of CanvasLayer which provides support for user interaction with its contained objects.

    Hierarchy (View Summary)

    Index

    Properties

    eventMode: string = "passive"
    interactiveChildren: boolean = false

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

    options: { name: string } = ...

    Options for this layer instance.

    TOGGLE_PALETTE: Partial<SceneControlTool> = ...

    The shared palette tool.

    Accessors

    • get active(): boolean

      Is this layer currently active

      Returns boolean

    • 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(): CanvasLayer

      Return a reference to the active instance of this canvas layer

      Returns CanvasLayer

    • get layerOptions(): { name: string; zIndex: number } & {
          baseClass: typeof InteractionLayer;
      }

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

      Returns { name: string; zIndex: number } & { baseClass: typeof InteractionLayer }

    Methods

    • Activate the InteractionLayer, deactivating other layers and marking this layer's children as interactive.

      Parameters

      • Optionaloptions: { tool?: string } = {}

        Options which configure layer activation

        • Optionaltool?: string

          A specific tool in the control palette to set as active

      Returns InteractionLayer

      The layer instance, now activated

    • Deactivate the InteractionLayer, removing interactivity from its children.

      Returns InteractionLayer

      The layer instance, now inactive

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

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

      Returns number

    • 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

      The inner _activate method which may be defined by each InteractionLayer subclass.

      Returns void

    • Protected

      Does the User have permission to left-click drag on the Canvas?

      Parameters

      • user: User

        The User performing the action.

      • event: FederatedEvent<UIEvent | PixiTouch>

        The event object.

      Returns boolean

    • Protected

      The inner _deactivate method which may be defined by each InteractionLayer subclass.

      Returns void

    • Protected

      The inner _draw method which must be defined by each CanvasLayer subclass.

      Parameters

      • options: object

        Options which configure how the layer is drawn

      Returns Promise<void>

    • Protected

      Highlight the objects of this layer.

      Parameters

      • active: boolean

        Should the objects of this layer be highlighted?

      Returns void

    • Protected

      Handle left mouse-click events which originate from the Canvas stage.

      Parameters

      • event: FederatedEvent<UIEvent | PixiTouch>

        The PIXI InteractionEvent which wraps a PointerEvent

      Returns void

    • Protected

      Handle double left-click events which originate from the Canvas stage.

      Parameters

      • event: FederatedEvent<UIEvent | PixiTouch>

        The PIXI InteractionEvent which wraps a PointerEvent

      Returns void

    • Protected

      Handle right mouse-click events which originate from the Canvas stage.

      Parameters

      • event: FederatedEvent<UIEvent | PixiTouch>

        The PIXI InteractionEvent which wraps a PointerEvent

      Returns void

    • Protected

      Handle double right mouse-click events which originate from the Canvas stage.

      Parameters

      • event: FederatedEvent<UIEvent | PixiTouch>

        The PIXI InteractionEvent which wraps a PointerEvent

      Returns void

    • Protected

      Handle a Copy keypress while this layer is active.

      Parameters

      • event: KeyboardEvent

        The copy key press event

      Returns boolean

      Was the event handled?

    • Protected

      Handle a Cut keypress while this layer is active.

      Parameters

      • event: KeyboardEvent

        The cut key press event

      Returns boolean

      Was the event handled?

    • Protected

      Handle a Cycle View keypress while this layer is active.

      Parameters

      • event: KeyboardEvent

        The cycle-view key press event

      Returns boolean

      Was the event handled?

    • Protected

      Handle a Delete keypress while this layer is active.

      Parameters

      • event: KeyboardEvent

        The delete key press event

      Returns boolean

      Was the event handled?

    • Protected

      Handle a Dismiss keypress while this layer is active.

      Parameters

      • event: KeyboardEvent

        The dismiss key press event

      Returns boolean

      Was the event handled?

    • Protected

      Cancel a left-click drag workflow originating from the Canvas stage.

      Parameters

      • event: FederatedEvent<UIEvent | PixiTouch>

        The PIXI InteractionEvent which wraps a PointerEvent

      Returns void

    • Protected

      Conclude a left-click drag workflow originating from the Canvas stage.

      Parameters

      • event: FederatedEvent<UIEvent | PixiTouch>

        The PIXI InteractionEvent which wraps a PointerEvent

      Returns void

    • Protected

      Continue a left-click drag workflow originating from the Canvas stage.

      Parameters

      • event: FederatedEvent<UIEvent | PixiTouch>

        The PIXI InteractionEvent which wraps a PointerEvent

      Returns void

    • Protected

      Start a left-click drag workflow originating from the Canvas stage.

      Parameters

      • event: FederatedEvent<UIEvent | PixiTouch>

        The PIXI InteractionEvent which wraps a PointerEvent

      Returns void

    • Protected

      Handle mouse-wheel events which occur for this active layer.

      Parameters

      • event: WheelEvent

        The WheelEvent initiated on the document

      Returns void

    • Protected

      Handle a Paste keypress while this layer is active.

      Parameters

      • event: KeyboardEvent

        The paste key press event

      Returns boolean

      Was the event handled?

    • Protected

      Handle a Select All keypress while this layer is active.

      Parameters

      • event: KeyboardEvent

        The select-all key press event

      Returns boolean

      Was the event handled?

    • Protected

      Handle a Undo keypress while this layer is active.

      Parameters

      • event: KeyboardEvent

        The undo key press event

      Returns boolean

      Was the event handled?

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

    • Prepare data used by SceneControls to register tools used by this layer.

      Returns SceneControl | null