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

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

    // 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
    • The event object is created by ThreeMouseEventUtil.generate()
    • Despite the "Mouse" naming, supports all pointer input types (mouse, touch, pen)
    interface ThreeMouseEvent<Value> {
        interactionHandler?: ButtonInteractionHandler<Value>;
        isSelected?: boolean;
        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)

    The type of pointer event that occurred