Vertex Viewer SDK
    Preparing search index...

    Interface BasicInteractionHandler

    An BasicInteractionHandler 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 that can be used to modify the internal interaction state.

    class CustomInteractionHandler extends BasicInteractionHandler {
    private element: HTMLElement;

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

    public initialize(element: HTMLElement): void {
    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);
    interface BasicInteractionHandler {
        dispose(): void;
        initialize(element: HTMLElement): void;
    }

    Hierarchy (View Summary)

    Index

    Methods

    • Disposes any resources associated with the object.

      Returns void

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

      Returns void