Class AbstractKeyboardControls

Abstract class for all keyboard controls implementations.

Hierarchy

  • EventDispatcher
    • AbstractKeyboardControls

Implements

Constructors

Properties

domElement: HTMLCanvasElement
enabled: boolean
keyStates: Record<string, boolean>

E.g. KeyW = true

object: Object3D<Object3DEventMap>
onKeyDownEvent: ((event) => void)

Type declaration

    • (event): void
    • Parameters

      • event: KeyboardEvent

      Returns void

onKeyUpEvent: ((event) => void)

Type declaration

    • (event): void
    • Parameters

      • event: KeyboardEvent

      Returns void

Methods

  • Adds a listener to an event type.

    Type Parameters

    • T extends never

    Parameters

    • type: T

      The type of event to listen to.

    • listener: EventListener<{}[T], T, AbstractKeyboardControls>

      The function that gets called when the event is fired.

    Returns void

  • Fire an event type.

    Type Parameters

    • T extends never

    Parameters

    • event: BaseEvent<T> & {}[T]

      The event that gets fired.

    Returns void

  • Checks if listener is added to an event type.

    Type Parameters

    • T extends never

    Parameters

    • type: T

      The type of event to listen to.

    • listener: EventListener<{}[T], T, AbstractKeyboardControls>

      The function that gets called when the event is fired.

    Returns boolean

  • Removes a listener from an event type.

    Type Parameters

    • T extends never

    Parameters

    • type: T

      The type of the listener that gets removed.

    • listener: EventListener<{}[T], T, AbstractKeyboardControls>

      The listener function that gets removed.

    Returns void

Generated using TypeDoc