Vertex Viewer SDK
    Preparing search index...

    Class BaseInteractionHandlerAbstract

    An InteractionHandler provides a mechanism for customizing the mouse and touch handling in the viewer.

    When an interaction handler is registered with the viewer, it'll call the initialize() method and pass it the internal canvas element and an instance of an InteractionApi that can be used to modify the internal interaction state.

    class CustomInteractionHandler extends InteractionHandler {
    private element: HTMLElement;
    private api: InteractionApi;

    public dispose(): void {
    this.element.removeEventListener('click', this.handleElementClick);
    }

    public initialize(element: HTMLElement, api: InteractionApi): void {
    this.api = api;
    this.element = element;
    this.element.addEventListener('click', this.handleElementClick);
    }

    private handleElementClick = (event: MouseEvent) => {
    api.pick({ x: event.clientX, y: event.clientY });
    }
    }

    const viewer = document.querySelector("vertex-viewer");
    viewer.registerInteractionHandler(new CustomInteractionHandler);

    Implements

    Index

    Constructors

    • Parameters

      • downEvent: "mousedown" | "pointerdown"
      • upEvent: "mouseup" | "pointerup"
      • moveEvent: "mousemove" | "pointermove"
      • rotateInteraction: RotateInteraction
      • rotatePointInteraction: RotatePointInteraction
      • zoomInteraction: ZoomInteraction
      • panInteraction: PanInteraction
      • twistInteraction: TwistInteraction
      • pivotInteraction: PivotInteraction
      • getConfig: ConfigProvider

      Returns BaseInteractionHandler

    Methods

    • Called by the viewer when the interaction handler is registered with the viewer. Used to setup any necessary event listeners to handle user interactions.

      Parameters

      • element: HTMLElement

        The internal viewer element to add event listeners to.

      • api: InteractionApi

        The API to modify internal interaction state.

      Returns void