Class: Touch

Represents a single touch. See Touch Events for a description of the Lens multitouch system.

Instance Properties

id: String

The ID of this touch. These IDs are not unique: they are shared between Touches that represent the same touch on different elements.

el: Element

Element this touch is fired on.

target: Element

Element this touch started on before bubbling up.

origX: Number

Original X coordinate of the touch.

origY: Number

Original Y coordinate of the touch.

pageX: Number

Current X coordinate of the touch.

pageY: Number

Current Y coordinate of the touch.

elX: Number

Current X coordinate of the touch, relative to the parent element

elY: Number

Current Y coordinate of the touch, relative to the parent element.

dx: Number

X displacement: pageX-origX

dy: Number

Y displacement: pageY-origY

w: Number

Width of the touch

h: Number

Height of the touch

Instance Methods

_markDone() common/models/touch.js, line 93

Ends this touch, informing end subscribers.

_update(newX, newY) common/models/touch.js, line 62

Updates this touch to a new position, informing movement subscribers.

Argument Type Description
newX Number

New X position

newY Number

New Y position

_vector() common/models/touch.js, line 101

Returns the position of the touch as a Sylvester vector.

coordinate() → {Coordinate} common/models/touch.js, line 157

Returns a Coordinate representing the position of this Touch, in the projector coordinate system.

ended(fn) → {Binding} common/models/touch.js, line 137

Registers a function to be called when this touch ends.

Argument Type Description
fn function

The function to call. Gets this touch as an argument.

Returns:

A Binding that allows this handler to be cleared

isInEl() → {Boolean} common/models/touch.js, line 147

Returns true if the touch is inside the element it started in.

moved(fn, delta) → {Binding} common/models/touch.js, line 114

Registers a function to be called whenever this touch moves.

Argument Type Attributes Description
fn function

The function to call. Gets this touch as an argument.

delta Number <optional>

If given, the function will only be called when the touch has moved this many pixels.

Returns:

A Binding that allows this handler to be cleared