Skip to main content

Class: TouchHandler

input/touch.TouchHandler

Handles touch events for an {@link HTMLElement}.

Constructors

constructor

โ€ข new TouchHandler(element)

Parameters

NameType
elementHTMLElement

Defined in

src/input/touch.ts:123

Properties

activeTouches

โ€ข Private activeTouches: Map<number, BLZTouch>

Maps native {@link Touch} events to BLZTouch instances.

Defined in

src/input/touch.ts:121


element

โ€ข Readonly element: HTMLElement

Defined in

src/input/touch.ts:111


listeners

โ€ข Private listeners: Object

Type declaration

NameType
releaseTouchCallback[]
tapTouchCallback[]

Defined in

src/input/touch.ts:113

Methods

addListener

โ–ธ addListener(fired, cb): void

Attaches a listener to a given touch event.

Parameters

NameTypeDescription
fired"release" | "tap"-
cbTouchCallbackThe callback to execute when the event is fired

Returns

void

Defined in

src/input/touch.ts:196


addListeners

โ–ธ Private addListeners(): void

Returns

void

Defined in

src/input/touch.ts:128


addNewTouches

โ–ธ Private addNewTouches(e): void

Adds all the give touches to the handler's active touches list.

Parameters

NameTypeDescription
eTouchEventThe dom {@link TouchEvent}

Returns

void

Defined in

src/input/touch.ts:143


fireListeners

โ–ธ Private fireListeners(event, t, e): void

Parameters

NameType
event"release" | "tap"
tBLZTouch
eTouchEvent

Returns

void

Defined in

src/input/touch.ts:184


releaseTouches

โ–ธ Private releaseTouches(e): void

Releases and removes touches from the handler's active touches list.

Parameters

NameTypeDescription
eTouchEventThe dom {@link TouchEvent}

Returns

void

Defined in

src/input/touch.ts:170


removeListener

โ–ธ removeListener(event, cb): void

Removes a listener from a given touch event.

Parameters

NameTypeDescription
event"release" | "tap"The event to remove the listener from
cbTouchCallbackThe callback to remove

Returns

void

Defined in

src/input/touch.ts:206


updateTouches

โ–ธ Private updateTouches(e): void

Parameters

NameType
eTouchEvent

Returns

void

Defined in

src/input/touch.ts:152