Options
All
  • Public
  • Public/Protected
  • All
Menu

Class EventHandler

... Provider and event handler are explicitly separated in order to reduce the number of observables (reuse of event provider for multiple handler).

Hierarchy

  • EventHandler

Index

Constructors

constructor

Properties

Protected _eyeGazeEventHandlerByType

_eyeGazeEventHandlerByType: Map<Type, EyeGazeEventHandler[]> = new Map<EyeGazeEventProvider.Type, Array<EyeGazeEventHandler>>()

Protected _eyeGazeEventProvider

_eyeGazeEventProvider: EyeGazeEventProvider | undefined

Assigned eye gaze event provider. This is usually created and owned by the eye gaze data stream.

Protected _invalidate

_invalidate: Invalidate | undefined

The event handler's invalidation callback. This should usually be setup by the owning renderer and invoke the same callback the renderer has been given by the canvas. This invalidation is required, when continuous rendering is not present, events might cause need for new rendering requests.

Protected _latestEyeGazeEventsByType

_latestEyeGazeEventsByType: Map<Type, CustomEvent<any>[]> = new Map<EyeGazeEventProvider.Type, Array<EyeGazeEvent>>()

Protected _latestMouseEventsByType

_latestMouseEventsByType: Map<Type, MouseEvent[]> = new Map<MouseEventProvider.Type, Array<MouseEvent>>()

Protected _latestPointerEventsByType

_latestPointerEventsByType: Map<Type, PointerEvent[]> = new Map<PointerEventProvider.Type, Array<PointerEvent>>()

Protected _latestTouchEventsByType

_latestTouchEventsByType: Map<Type, TouchEvent[]> = new Map<TouchEventProvider.Type, Array<TouchEvent>>()

Protected _mouseEventHandlerByType

_mouseEventHandlerByType: Map<Type, MouseEventHandler[]> = new Map<MouseEventProvider.Type, Array<MouseEventHandler>>()

Protected _mouseEventProvider

_mouseEventProvider: MouseEventProvider | undefined

Assigned mouse event provider. This is usually created and owned by the canvas.

Protected _pointerEventHandlerByType

_pointerEventHandlerByType: Map<Type, PointerEventHandler[]> = new Map<PointerEventProvider.Type, Array<PointerEventHandler>>()

Protected _pointerEventProvider

_pointerEventProvider: PointerEventProvider | undefined

Assigned pointer event provider. This is usually created and owned by the canvas.

Protected _previousEyeGazeEventsByType

_previousEyeGazeEventsByType: Map<Type, CustomEvent<any>[]> = new Map<EyeGazeEventProvider.Type, Array<EyeGazeEvent>>()

Protected _previousMouseEventsByType

_previousMouseEventsByType: Map<Type, MouseEvent[]> = new Map<MouseEventProvider.Type, Array<MouseEvent>>()

Protected _previousPointerEventsByType

_previousPointerEventsByType: Map<Type, PointerEvent[]> = new Map<PointerEventProvider.Type, Array<PointerEvent>>()

Protected _previousTouchEventsByType

_previousTouchEventsByType: Map<Type, TouchEvent[]> = new Map<TouchEventProvider.Type, Array<TouchEvent>>()

Protected _subscriptions

_subscriptions: Subscription[] = new Array<Subscription>()

Protected _touchEventHandlerByType

_touchEventHandlerByType: Map<Type, TouchEventHandler[]> = new Map<TouchEventProvider.Type, Array<TouchEventHandler>>()

Protected _touchEventProvider

_touchEventProvider: TouchEventProvider | undefined

Assigned touch event provider. This is usually created and owned by the canvas.

Methods

dispose

  • dispose(): void

exitPointerLock

  • exitPointerLock(): void
  • Forward pointer lock release request to the mouse event provider (if one exists).

    Returns void

Protected invalidate

  • invalidate(force?: boolean): void

Protected invokeEyeGazeEventHandler

  • invokeEyeGazeEventHandler(type: Type): void

Protected invokeMouseEventHandler

  • invokeMouseEventHandler(type: Type): void

Protected invokePointerEventHandler

  • invokePointerEventHandler(type: Type): void

Protected invokeTouchEventHandler

  • invokeTouchEventHandler(type: Type): void

offsets

  • offsets(event: MouseEvent | WheelEvent | TouchEvent, normalize?: boolean): Array<vec2>
  • Normalize mouse and touch event coordinates for various browsers.

    Parameters

    • event: MouseEvent | WheelEvent | TouchEvent

      Mouse, wheel, or touch event.

    • Default value normalize: boolean = true

      Whether or not to compute normalized coordinates (offsets).

    Returns Array<vec2>

    • Array of normalized x and y offsets (in case of multiple touches).

pushClickHandler

  • Register a click event handler that is to be called on update iff at least a single click event has occurred since last update.

    Parameters

    Returns void

pushEyeGazeBinaryMessageParsingErrorHandler

  • Register a eye gaze binary message parsing error event handler that is to be called on update if at least a single eye gaze binary message parsing error event has occurred since last update.

    Parameters

    Returns void

pushEyeGazeConnectionStatusHandler

  • Register a eye gaze connection status event handler that is to be called on update if at least a single eye gaze connection status event has occurred since last update.

    Parameters

    Returns void

pushEyeGazeDataHandler

  • Register a eye gaze data event handler that is to be called on update if at least a single eye gaze data event has occurred since last update.

    Parameters

    Returns void

Protected pushEyeGazeEventHandler

  • Utility for registering an additional touch event handler for updates on touch events of the given type. The handler is to be called on update iff at least a single touch event of the given type has occurred since last update.

    Parameters

    • type: Type

      Touch event type the handler is to be associated with.

    • handler: EyeGazeEventHandler

      Handler to be called on update.

    Returns void

pushEyeGazeServerMessageHandler

  • Register a eye gaze server message event handler that is to be called on update if at least a single eye gaze server message event has occurred since last update.

    Parameters

    Returns void

pushMouseDownHandler

  • Register an mouse down event handler that is to be called on update iff at least a single mouse down event has occurred since last update.

    Parameters

    Returns void

pushMouseEnterHandler

  • Register an mouse enter event handler that is to be called on update iff at least a single mouse enter event has occurred since last update.

    Parameters

    Returns void

Protected pushMouseEventHandler

  • Utility for registering an additional mouse event handler for updates on mouse events of the given type. The handler is to be called on update if at least a single mouse event of the given type has occurred since last update.

    Parameters

    • type: Type

      Mouse event type the handler is to be associated with.

    • handler: MouseEventHandler

      Handler to be called on update.

    Returns void

pushMouseLeaveHandler

  • Register an mouse leave event handler that is to be called on update iff at least a single mouse leave event has occurred since last update.

    Parameters

    Returns void

pushMouseMoveHandler

  • Register an mouse move event handler that is to be called on update iff at least a single mouse move event has occurred since last update.

    Parameters

    Returns void

pushMouseUpHandler

  • Register an mouse up event handler that is to be called on update iff at least a single mouse up event has occurred since last update.

    Parameters

    Returns void

pushMouseWheelHandler

  • Register an mouse wheel event handler that is to be called on update iff at least a single mouse wheel event has occurred since last update.

    Parameters

    Returns void

pushPointerCancelHandler

  • Register a pointer cancel event handler that is to be called on update iff at least a single touch cancel event has occurred since last update.

    Parameters

    Returns void

pushPointerDownHandler

  • Register a pointer down event handler that is to be called on update iff at least a single touch cancel event has occurred since last update.

    Parameters

    Returns void

pushPointerEnterHandler

  • Register a pointer enter event handler that is to be called on update iff at least a single touch cancel event has occurred since last update.

    Parameters

    Returns void

Protected pushPointerEventHandler

  • Utility for registering an additional pointer event handler for updates on pointer events of the given type. The handler is to be called on update iff at least a single touch event of the given type has occurred since last update.

    Parameters

    • type: Type

      Pointer event type the handler is to be associated with.

    • handler: PointerEventHandler

      Handler to be called on update.

    Returns void

pushPointerLeaveHandler

  • Register a pointer leave event handler that is to be called on update iff at least a single touch cancel event has occurred since last update.

    Parameters

    Returns void

pushPointerMoveHandler

  • Register a pointer move event handler that is to be called on update iff at least a single touch cancel event has occurred since last update.

    Parameters

    Returns void

pushPointerUpHandler

  • Register a pointer up event handler that is to be called on update iff at least a single touch cancel event has occurred since last update.

    Parameters

    Returns void

pushTouchCancelHandler

  • Register a touch cancel event handler that is to be called on update iff at least a single touch cancel event has occurred since last update.

    Parameters

    Returns void

pushTouchEndHandler

  • Register a touch end event handler that is to be called on update iff at least a single touch end event has occurred since last update.

    Parameters

    Returns void

Protected pushTouchEventHandler

  • Utility for registering an additional touch event handler for updates on touch events of the given type. The handler is to be called on update iff at least a single touch event of the given type has occurred since last update.

    Parameters

    • type: Type

      Touch event type the handler is to be associated with.

    • handler: TouchEventHandler

      Handler to be called on update.

    Returns void

pushTouchMoveHandler

  • Register a touch move event handler that is to be called on update iff at least a single touch move event has occurred since last update.

    Parameters

    Returns void

pushTouchStartHandler

  • Register a touch start event handler that is to be called on update iff at least a single touch start event has occurred since last update.

    Parameters

    Returns void

requestPointerLock

  • requestPointerLock(): void

update

  • update(): void
  • Triggers (by means of a helper function) invocation of all registered handler of all event types.

    Returns void