@masatomakino/threejs-interactive-object
    Preparing search index...

    Interface ThreeMouseEvent<Value>

    Event object passed to all pointer interaction event handlers.

    This interface defines the standardized event payload that all interactive objects emit. It provides access to the event type, the interaction handler that generated the event, and selection state information when applicable.

    Cross-Platform Support: These events work consistently across all pointer input types (mouse, touch, pen) thanks to the underlying PointerEvent implementation.

    import type { ThreeMouseEvent } from '@masatomakino/threejs-interactive-object';

    function handlePointerInteraction(e: ThreeMouseEvent<string>) {
    // Event type is always available
    console.log(`Event: ${e.type}`); // 'click', 'over', 'select', etc.

    // Pointer ID for multitouch support
    console.log(`Pointer ID: ${e.pointerId}`); // 1 (default), 2, 3, etc.

    // Access to the interaction handler (if available)
    if (e.interactionHandler) {
    console.log(`Value: ${e.interactionHandler.value}`);
    console.log(`Enabled: ${e.interactionHandler.enabled}`);
    }

    // Selection state (for checkboxes and radio buttons)
    if (e.isSelected !== undefined) {
    console.log(`Selected: ${e.isSelected}`);
    }
    }

    // Works for mouse clicks, touch taps, and pen interactions
    clickableMesh.interactionHandler.on('click', handlePointerInteraction);
    • All properties are readonly to prevent accidental modification
    • interactionHandler may be undefined in some contexts
    • isSelected is only meaningful for checkbox and radio button events
    • pointerId defaults to 1 for single-pointer interactions
    • The event object is created by createThreeMouseEvent()
    • Treat pointerId as an opaque number (may be negative or large); do not assume ranges or sequencing
    • Despite the "Mouse" naming, supports all pointer input types (mouse, touch, pen)
    interface ThreeMouseEvent<Value> {
        interactionHandler?: ButtonInteractionHandler<Value>;
        isSelected?: boolean;
        pointerId: number;
        type: keyof ThreeMouseEventMap<Value>;
    }

    Type Parameters

    • Value

      The type of value associated with the interactive object's handler

    Index

    Properties

    interactionHandler?: ButtonInteractionHandler<Value>

    The interaction handler that generated this event (may be undefined)

    isSelected?: boolean

    Selection state for checkbox/radio button events (undefined for basic buttons)

    pointerId: number

    Pointer identifier for multitouch support (defaults to 1 for primary pointer)

    The type of pointer event that occurred