Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MouseEventProvider

Hierarchy

  • MouseEventProvider

Index

Constructors

constructor

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

Properties

Protected _clickListener

_clickListener: (event: MouseEvent) => void

Type declaration

    • (event: MouseEvent): void
    • Parameters

      • event: MouseEvent

      Returns void

Protected _clickSubject

_clickSubject: ReplaySubject<MouseEvent>

Protected _downListener

_downListener: (event: MouseEvent) => void

Type declaration

    • (event: MouseEvent): void
    • Parameters

      • event: MouseEvent

      Returns void

Protected _downSubject

_downSubject: ReplaySubject<MouseEvent>

Protected _dragListener

_dragListener: (event: DragEvent) => void

Type declaration

    • (event: DragEvent): void
    • Parameters

      • event: DragEvent

      Returns void

Protected _dragSubject

_dragSubject: ReplaySubject<DragEvent>

Protected _element

_element: HTMLCanvasElement

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

Protected _enterListener

_enterListener: (event: MouseEvent) => void

Type declaration

    • (event: MouseEvent): void
    • Parameters

      • event: MouseEvent

      Returns void

Protected _enterSubject

_enterSubject: ReplaySubject<MouseEvent>

Protected _leaveListener

_leaveListener: (event: MouseEvent) => void

Type declaration

    • (event: MouseEvent): void
    • Parameters

      • event: MouseEvent

      Returns void

Protected _leaveSubject

_leaveSubject: ReplaySubject<MouseEvent>

Protected _moveListener

_moveListener: (event: MouseEvent) => void

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: undefined | number

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

Protected _upListener

_upListener: (event: MouseEvent) => void

Type declaration

    • (event: MouseEvent): void
    • Parameters

      • event: MouseEvent

      Returns void

Protected _upSubject

_upSubject: ReplaySubject<MouseEvent>

Protected _wheelListener

_wheelListener: (event: WheelEvent) => void

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>

drag$

  • get drag$(): Observable<DragEvent>

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

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

    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