Class: MultiTouch

See Touch Events for a description of the Lens multitouch system. A MultiTouch is an array representing multiple touches. It is a subclass of Array; that is, you can treat it as an array containing Touches, and you can also use a number of additional properties and methods. Note: X and Y coordinates of MultiTouches are calculated as the average X/Y coordinates of their constituent touches.

Instance Properties

id: String

Unique ID for this MultiTouch.

el: Element

Element this multitouch started on.

origX: Number

Original X coordinate of the multitouch.

origY: Number

Original Y coordinate of the multitouch.

pageX: Number

Current X coordinate of the multitouch.

pageY: Number

Current Y coordinate of the multitouch.

elX: Number

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

elY: Number

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

dx: Number

X displacement: pageX-origX

dy: Number

Y displacement: pageY-origY

size: Number

Current size of the multitouch: the average distance, in pixels, between the center and a constituent touch.

origSize: Number

Original size of the multitouch: the average distance, in pixels, between the center and a constituent touch.

dSize: Number

Difference between current size and original size. Equivalent to size - origSize.

rotation: Number

For two-element multitouches: the amount the touch has rotated. Measured in counterclockwise radians.

scale: Number

The amount this multitouch has scaled by. a value of 1 indicates it is the same size, a value of 2 indicates it is twice as large, etc. Equivalent to size / origSize

Instance Methods

ended(fn) → {Binding} common/models/multi_touch.js, line 173

Registers a function to be called when this multitouch ends.

Argument Type Description
fn function

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

Returns:

A Binding that allows this handler to be cleared

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

Registers a function to be called whenever this multitouch moves.

Argument Type Attributes Description
fn function

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

delta Number <optional>

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

Returns:

A Binding that allows this handler to be cleared