Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MouseEventProvider

Hierarchy

  • MouseEventProvider

Index

Constructors

constructor

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

Properties

Protected _clickListener

_clickListener: function

Type declaration

    • (event: MouseEvent): void
    • Parameters

      • event: MouseEvent

      Returns void

Protected _clickSubject

_clickSubject: ReplaySubject<MouseEvent>

Protected _downListener

_downListener: function

Type declaration

    • (event: MouseEvent): void
    • Parameters

      • event: MouseEvent

      Returns void

Protected _downSubject

_downSubject: ReplaySubject<MouseEvent>

Protected _element

_element: HTMLCanvasElement

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

Protected _enterListener

_enterListener: function

Type declaration

    • (event: MouseEvent): void
    • Parameters

      • event: MouseEvent

      Returns void

Protected _enterSubject

_enterSubject: ReplaySubject<MouseEvent>

Protected _leaveListener

_leaveListener: function

Type declaration

    • (event: MouseEvent): void
    • Parameters

      • event: MouseEvent

      Returns void

Protected _leaveSubject

_leaveSubject: ReplaySubject<MouseEvent>

Protected _moveListener

_moveListener: function

Type declaration

    • (event: MouseEvent): void
    • Parameters

      • event: MouseEvent

      Returns void

Protected _moveSubject

_moveSubject: ReplaySubject<MouseEvent>

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: function

Type declaration

    • (event: MouseEvent): void
    • Parameters

      • event: MouseEvent

      Returns void

Protected _upSubject

_upSubject: ReplaySubject<MouseEvent>

Protected _wheelListener

_wheelListener: function

Type declaration

    • (event: WheelEvent): void
    • Parameters

      • event: WheelEvent

      Returns void

Protected _wheelSubject

_wheelSubject: ReplaySubject<WheelEvent>

Accessors

click$

  • get click$(): Observable<MouseEvent>

down$

  • get down$(): Observable<MouseEvent>

enter$

  • get enter$(): Observable<MouseEvent>

leave$

  • get leave$(): Observable<MouseEvent>

move$

  • get move$(): Observable<MouseEvent>

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<MouseEvent>

wheel$

  • get wheel$(): Observable<WheelEvent>

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<MouseEvent> | Observable<WheelEvent> | undefined

preventDefault

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

    Parameters

    • Rest ...types: Type[]

      Event types to prevent default handling on.

    Returns void

Protected preventDefaultOnEvent

  • preventDefaultOnEvent(type: Type, event: MouseEvent): 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 @see{@link prevenDefault}.

    Parameters

    • type: Type

      Internal event type of the incoming event.

    • event: MouseEvent

      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