Skip to main content

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

NameTypeDescription
touchTouchThe native {@link Touch} to wrap
eTouchEventThe {@link TouchEvent} which created the given touch
elementHTMLElementThe 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

NameType
moveTouchCallback[]
releaseTouchCallback[]

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

NameTypeDescription
event"move" | "release"The event to listen for
cbTouchCallbackThe 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

NameTypeDescription
event"move" | "release"The event to fire listeners of
eTouchEventThe {@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

NameTypeDescription
touchTouchThe touch from the touchend event
eTouchEventThe {@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

NameTypeDescription
event"move" | "release"The event to remove from
cbTouchCallbackThe callback to remove

Returns

void

Defined in

src/input/touch.ts:99


update

โ–ธ update(touch, e): void

Updates the BLZTouch's state.

Parameters

NameTypeDescription
touchTouchThe native touch to grab values from
eTouchEventThe {@link TouchEvent} which created the given touch

Returns

void

Defined in

src/input/touch.ts:48