Home Reference Source Test
public class | source

Swipe

Extends:

Gesture → Swipe

A swipe is defined as input(s) moving in the same direction in an relatively increasing velocity and leaving the screen at some point before it drops below it's escape velocity.

Constructor Summary

Public Constructor
public

constructor(options: Object)

Constructor function for the Swipe class.

Member Summary

Public Members
public

The minimum velocity the input has to be at to emit a swipe.

public

(EXPERIMENTAL) The maximum amount of move events to keep track of for a swipe.

public

The maximum resting time a point has between it's last move and current move events.

public

The number of inputs to trigger a Swipe can be variable, and the maximum number being a factor of the browser.

public

(EXPERIMENTAL) A value of time in milliseconds to distort between events.

public

The type of the Gesture

Method Summary

Public Methods
public

end(inputs: Array): null | Object

Determines if the input's history validates a swipe motion. Determines if it did not come to a complete stop (maxRestTime), and if it had enough of a velocity to be considered (ESCAPE_VELOCITY).

public

move(inputs: Array, state: Object): null

Event hook for the move of a gesture.

Inherited Summary

From class Gesture
public

The unique identifier for each gesture determined at bind time by the state object.

public

The generic string type of gesture ('expand'|'pan'|'pinch'|'rotate'|'swipe'|'tap').

public

end(inputs: Array): null | Object

end() - Event hook for the move of a gesture

public

Return the id of the event.

public

getType() - Returns the generic type of the gesture

public

move(inputs: Array, state: Object): null | Object

move() - Event hook for the move of a gesture

public

setId(id: String)

Set the id of the gesture to be called during an event

public

setType(type: String)

Set the type of the gesture to be called during an event

public

start(inputs: Array): null | Object

start() - Event hook for the start of a gesture

public

update(object: *)

Updates internal properties with new ones, only if the properties exist.

Public Constructors

public constructor(options: Object) source

Constructor function for the Swipe class.

Override:

Gesture#constructor

Params:

NameTypeAttributeDescription
options Object
  • optional

The options object.

options.numInputs Number
  • optional

The number of inputs to trigger a Swipe can be variable, and the maximum number being a factor of the browser. move and current move events.

options.maxRestTime Number
  • optional

The maximum resting time a point has between it's last

options.escapeVelocity Number
  • optional

The minimum velocity the input has to be at to emit a swipe.

options.timeDistortion Number
  • optional

(EXPERIMENTAL) A value of time in milliseconds to distort between events.

options.maxProgressStack Number
  • optional

(EXPERIMENTAL)The maximum amount of move events to keep track of for a swipe.

Public Members

public escapeVelocity: number source

The minimum velocity the input has to be at to emit a swipe. This is useful for determining the difference between a swipe and a pan gesture.

public maxProgressStack: number source

(EXPERIMENTAL) The maximum amount of move events to keep track of for a swipe. This helps give a more accurate estimate of the user's velocity.

public maxRestTime: Number source

The maximum resting time a point has between it's last move and current move events.

public numInputs: Number source

The number of inputs to trigger a Swipe can be variable, and the maximum number being a factor of the browser.

public timeDistortion: number source

(EXPERIMENTAL) A value of time in milliseconds to distort between events. Browsers do not accurately measure time with the Date constructor in milliseconds, so consecutive events sometimes display the same timestamp but different x/y coordinates. This will distort a previous time in such cases by the timeDistortion's value.

public type: String source

The type of the Gesture

Override:

Gesture#type

Public Methods

public end(inputs: Array): null | Object source

Determines if the input's history validates a swipe motion. Determines if it did not come to a complete stop (maxRestTime), and if it had enough of a velocity to be considered (ESCAPE_VELOCITY).

Override:

Gesture#end

Params:

NameTypeAttributeDescription
inputs Array

The array of Inputs on the screen

Return:

null | Object

null if the gesture is not to be emitted, Object with information otherwise.

public move(inputs: Array, state: Object): null source

Event hook for the move of a gesture. Captures an input's x/y coordinates and the time of it's event on a stack.

Override:

Gesture#move

Params:

NameTypeAttributeDescription
inputs Array

The array of Inputs on the screen.

state Object

The state object of the current region.

Return:

null

Swipe does not emit from a move.