ThreePresenter API Documentation - v0.1.2
    Preparing search index...

    Class InputController

    InputController - Handles mouse/touch input and raycasting

    This class provides a decoupled input handling system that:

    • Performs raycasting against 3D models and annotations
    • Detects clicks, double-clicks, and multi-select (Ctrl/Cmd + click)
    • Manages picking mode (crosshair cursor for point selection)
    • Handles window resizing for accurate picking

    The controller communicates via callbacks, making it independent from the main presenter and suitable for testing and custom implementations.

    const controller = new InputController({
    domElement: canvas,
    getCamera: () => camera,
    getModels: () => [model1, model2],
    getAnnotations: () => annotations.children,
    onModelDoubleClick: (point) => console.log('Clicked at', point),
    onAnnotationClick: (obj, isMulti) => handleAnnotationSelect(obj),
    onBackgroundClick: () => deselectAll()
    });

    // For creating new annotations via picking
    controller.setPickingMode(true);
    Index

    Constructors

    Methods

    • Helper to update mouse coordinates

      Parameters

      • event: MouseEvent

      Returns void

    Properties

    raycaster: Raycaster = ...
    mouse: Vector2 = ...
    isPickingMode: boolean = false
    enabled: boolean = true