Skip to main content

PointerEventReceiver

The PointerEventProcessor is responsible for collecting all the events from the canvas and transforming them into GlobalCoordinates

Index

Constructors

constructor

Properties

publiccurrentFrameCancel

currentFrameCancel: PointerEvent[] = []

publiccurrentFrameDown

currentFrameDown: PointerEvent[] = []

publiccurrentFrameMove

currentFrameMove: PointerEvent[] = []

publiccurrentFramePointerCoords

currentFramePointerCoords: Map<number, GlobalCoordinates> = ...

publiccurrentFramePointerDown

currentFramePointerDown: Map<number, boolean> = ...

publiccurrentFrameUp

currentFrameUp: PointerEvent[] = []

publiccurrentFrameWheel

currentFrameWheel: WheelEvent[] = []

publicengine

engine: Engine<any>

publicevents

events: EventEmitter<PointerEvents> = ...

publiclastFramePointerCoords

lastFramePointerCoords: Map<number, GlobalCoordinates> = ...

publiclastFramePointerDown

lastFramePointerDown: Map<number, boolean> = ...

publicprimary

primary: PointerAbstraction = ...

publicreadonlytarget

target: GlobalEventHandlers & EventTarget

Methods

publicat

  • Locates a specific pointer by id, creates it if it doesn't exist


    Parameters

    • index: number

    Returns PointerAbstraction

publicclear

  • clear(): void
  • Clears the current frame event and pointer data


    Returns void

publiccount

  • count(): number
  • The number of pointers currently being tracked by excalibur


    Returns number

publicdetach

  • detach(): void
  • Returns void

publicemit

  • emit<TEventName>(eventName: TEventName, event: PointerEvents[TEventName]): void
  • emit(eventName: string, event?: any): void
  • Type parameters

    Parameters

    • eventName: TEventName
    • event: PointerEvents[TEventName]

    Returns void

publicinit

  • Initializes the pointer event receiver so that it can start listening to native browser events.


    Parameters

    Returns void

publicisDown

  • isDown(pointerId: number): boolean
  • Is the specified pointer id down this frame


    Parameters

    • pointerId: number

    Returns boolean

publicisDragEnd

  • isDragEnd(pointerId: number): boolean
  • Whether the Pointer just ended dragging.


    Parameters

    • pointerId: number

    Returns boolean

publicisDragStart

  • isDragStart(pointerId: number): boolean
  • Whether the Pointer just started dragging.


    Parameters

    • pointerId: number

    Returns boolean

publicisDragging

  • isDragging(pointerId: number): boolean
  • Whether the Pointer is currently dragging.


    Parameters

    • pointerId: number

    Returns boolean

publicoff

  • off<TEventName>(eventName: TEventName, handler: Handler<PointerEvents[TEventName]>): void
  • off(eventName: string, handler: Handler<unknown>): void
  • off(eventName: string): void
  • Type parameters

    Parameters

    • eventName: TEventName
    • handler: Handler<PointerEvents[TEventName]>

    Returns void

publicon

  • Type parameters

    Parameters

    • eventName: TEventName
    • handler: Handler<PointerEvents[TEventName]>

    Returns Subscription

publiconce

  • Type parameters

    Parameters

    • eventName: TEventName
    • handler: Handler<PointerEvents[TEventName]>

    Returns Subscription

publicrecreate

  • Creates a new PointerEventReceiver with a new target and engine while preserving existing pointer event handlers.


    Parameters

    • target: GlobalEventHandlers & EventTarget
    • engine: Engine<any>

    Returns PointerEventReceiver

publictoggleEnabled

  • toggleEnabled(enabled: boolean): void
  • Parameters

    • enabled: boolean

    Returns void

publictriggerEvent

  • triggerEvent(type: down | up | move | cancel, pos: Vector): void
  • Triggers an excalibur pointer event in a world space pos

    Useful for testing pointers in excalibur


    Parameters

    • type: down | up | move | cancel
    • pos: Vector

    Returns void

publicwasDown

  • wasDown(pointerId: number): boolean
  • Was the specified pointer id down last frame


    Parameters

    • pointerId: number

    Returns boolean