Class: TouchHandler
input/touch.TouchHandler
Handles touch events for an {@link HTMLElement}.
Constructors
constructor
โข new TouchHandler(element
)
Parameters
Name | Type |
---|---|
element | HTMLElement |
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
Name | Type |
---|---|
release | TouchCallback [] |
tap | TouchCallback [] |
Defined in
src/input/touch.ts:113
Methods
addListener
โธ addListener(fired
, cb
): void
Attaches a listener to a given touch event.
Parameters
Name | Type | Description |
---|---|---|
fired | "release" | "tap" | - |
cb | TouchCallback | The 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
Name | Type | Description |
---|---|---|
e | TouchEvent | The dom {@link TouchEvent} |
Returns
void
Defined in
src/input/touch.ts:143
fireListeners
โธ Private
fireListeners(event
, t
, e
): void
Parameters
Name | Type |
---|---|
event | "release" | "tap" |
t | BLZTouch |
e | TouchEvent |
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
Name | Type | Description |
---|---|---|
e | TouchEvent | The 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
Name | Type | Description |
---|---|---|
event | "release" | "tap" | The event to remove the listener from |
cb | TouchCallback | The callback to remove |
Returns
void
Defined in
src/input/touch.ts:206
updateTouches
โธ Private
updateTouches(e
): void
Parameters
Name | Type |
---|---|
e | TouchEvent |
Returns
void
Defined in
src/input/touch.ts:152