Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PointerEventProvider

Hierarchy

  • PointerEventProvider

Index

Constructors

constructor

  • new PointerEventProvider(element: HTMLCanvasElement, timeframe?: undefined | number): PointerEventProvider

Properties

Protected _cancelListener

_cancelListener: (event: PointerEvent) => void

Type declaration

    • (event: PointerEvent): void
    • Parameters

      • event: PointerEvent

      Returns void

Protected _cancelSubject

_cancelSubject: ReplaySubject<PointerEvent>

Protected _downListener

_downListener: (event: PointerEvent) => void

Type declaration

    • (event: PointerEvent): void
    • Parameters

      • event: PointerEvent

      Returns void

Protected _downSubject

_downSubject: ReplaySubject<PointerEvent>

Protected _element

_element: HTMLCanvasElement

HTML canvas element within the HTML5 document to register event listeners to.

Protected _enterListener

_enterListener: (event: PointerEvent) => void

Type declaration

    • (event: PointerEvent): void
    • Parameters

      • event: PointerEvent

      Returns void

Protected _enterSubject

_enterSubject: ReplaySubject<PointerEvent>

Protected _leaveListener

_leaveListener: (event: PointerEvent) => void

Type declaration

    • (event: PointerEvent): void
    • Parameters

      • event: PointerEvent

      Returns void

Protected _leaveSubject

_leaveSubject: ReplaySubject<PointerEvent>

Protected _moveListener

_moveListener: (event: PointerEvent) => void

Type declaration

    • (event: PointerEvent): void
    • Parameters

      • event: PointerEvent

      Returns void

Protected _moveSubject

_moveSubject: ReplaySubject<PointerEvent>

Protected _pointerLockRequestPending

_pointerLockRequestPending: boolean = false

Protected _preventDefaultMask

_preventDefaultMask: Type

This mask saves for which types of events, event.preventDefault should be called. This is useful to disallow some kinds of standard events like scrolling or clicking on links.

Protected _timeframe

_timeframe: number | undefined

Time frame for events to be buffered (windowTime in rxjs per ReplaySubject).

Protected _upListener

_upListener: (event: PointerEvent) => void

Type declaration

    • (event: PointerEvent): void
    • Parameters

      • event: PointerEvent

      Returns void

Protected _upSubject

_upSubject: ReplaySubject<PointerEvent>

Accessors

cancel$

  • get cancel$(): Observable<PointerEvent>

down$

  • get down$(): Observable<PointerEvent>

enter$

  • get enter$(): Observable<PointerEvent>

leave$

  • get leave$(): Observable<PointerEvent>

move$

  • get move$(): Observable<PointerEvent>

pointerLock

  • get pointerLock(): boolean
  • set pointerLock(lock: boolean): void
  • Enable/disable pointer lock on click. If true, the next click on this event provider's canvas will invoke a pointer lock request on the canvas element.

    Returns boolean

  • Enable/disable pointer lock on click. If true, the next click on this event provider's canvas will invoke a pointer lock request on the canvas element.

    Parameters

    • lock: boolean

    Returns void

up$

  • get up$(): Observable<PointerEvent>

Methods

allowDefault

  • allowDefault(...types: Type[]): void
  • Allow default event handling on specific event types (not calling preventDefault on the event).

    Parameters

    • Rest ...types: Type[]

      Event types to allow default handling on.

    Returns void

observable

  • observable(type: Type): Observable<PointerEvent> | undefined

preventDefault

  • preventDefault(...types: Type[]): void
  • Prevent default event handling on specific event types (using preventDefault on the event).

    Parameters

    • Rest ...types: Type[]

      Event types to prevent default handling on.

    Returns void

Protected preventDefaultOnEvent

  • preventDefaultOnEvent(type: Type, event: PointerEvent): void
  • Checks whether or not to prevent the default handling of the given event. This depends on the internal preventDefaultMask which can be modified using preventDefault function @seepreventDefault.

    Parameters

    • type: Type

      Internal event type of the incoming event.

    • event: PointerEvent

      Actual event to prevent default handling on (if masked).

    Returns void

Protected processPointerLockRequests

  • processPointerLockRequests(): void
  • The pointer lock API requires a little workaround in order to avoid something like '... not called from inside a short running user-generated event handler'. A click event listener is registered and whenever a pointer lock is requested, e.g., from an event handler (which in turn exposes this interface to, e.g., a navigation), the next click will result in a probably more successful pointer lock.

    Returns void