Class: BLZTouch
input/touch.BLZTouch
Represents a tap on the screen.
A BLZTouch should only be used until it's release event is fired.
Constructors
constructor
โข new BLZTouch(touch
, e
, element
)
Creates a BLZTouch.
Parameters
Name | Type | Description |
---|---|---|
touch | Touch | The native {@link Touch} to wrap |
e | TouchEvent | The {@link TouchEvent} which created the given touch |
element | HTMLElement | The dom element the TouchHandler is attached to |
Defined in
src/input/touch.ts:33
Properties
element
โข Private
element: HTMLElement
Defined in
src/input/touch.ts:14
holding
โข holding: boolean
= true
Defined in
src/input/touch.ts:19
listeners
โข Private
listeners: Object
Type declaration
Name | Type |
---|---|
move | TouchCallback [] |
release | TouchCallback [] |
Defined in
src/input/touch.ts:21
pos
โข pos: vec2
Defined in
src/input/touch.ts:18
startPos
โข startPos: vec2
Defined in
src/input/touch.ts:17
touch
โข touch: Touch
Defined in
src/input/touch.ts:15
Methods
addListener
โธ addListener(event
, cb
): void
Adds an event listener to the touch.
Parameters
Name | Type | Description |
---|---|---|
event | "move" | "release" | The event to listen for |
cb | TouchCallback | The callback to fire |
Returns
void
Defined in
src/input/touch.ts:89
fireListeners
โธ Private
fireListeners(event
, e
): void
Fires the listeners for the given event.
Parameters
Name | Type | Description |
---|---|---|
event | "move" | "release" | The event to fire listeners of |
e | TouchEvent | The {@link TouchEvent} of the update |
Returns
void
Defined in
src/input/touch.ts:77
release
โธ release(touch
, e
): void
Performs a final update and fires release events for the BLZTouch.
Parameters
Name | Type | Description |
---|---|---|
touch | Touch | The touch from the touchend event |
e | TouchEvent | The {@link TouchEvent} which created the given touch |
Returns
void
Defined in
src/input/touch.ts:64
removeListener
โธ removeListener(event
, cb
): void
Removes an event listener from the touch.
Parameters
Name | Type | Description |
---|---|---|
event | "move" | "release" | The event to remove from |
cb | TouchCallback | The callback to remove |
Returns
void
Defined in
src/input/touch.ts:99
update
โธ update(touch
, e
): void
Updates the BLZTouch's state.
Parameters
Name | Type | Description |
---|---|---|
touch | Touch | The native touch to grab values from |
e | TouchEvent | The {@link TouchEvent} which created the given touch |
Returns
void
Defined in
src/input/touch.ts:48