Home Reference Source Test
import Distance from 'zingtouch/src/gestures/Distance.js'
public class | source

Distance

Extends:

Gesture → Distance

Direct Subclass:

Expand, Pinch

A Distance is defined as two inputs moving either together or apart.

Constructor Summary

Public Constructor
public

constructor(options: *)

Constructor function for the Distance class.

Member Summary

Public Members
public

The minimum amount in pixels the inputs must move until it is fired.

public

The type of the Gesture.

Method Summary

Public Methods
public

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

Event hook for the move of a gesture.

public

start(inputs: *)

start() - Event hook for the start 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: *) source

Constructor function for the Distance class.

Override:

Gesture#constructor

Params:

NameTypeAttributeDescription
options *

Public Members

public threshold: Number source

The minimum amount in pixels the inputs must move until it is fired.

public type: String source

The type of the Gesture.

Override:

Gesture#type

Public Methods

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

Event hook for the move of a gesture. Determines if the two points are moved in the expected direction relative to the current distance and the last distance.

Override:

Gesture#move

Params:

NameTypeAttributeDescription
inputs Array

The array of Inputs on the screen.

state Object

The state object of the current region.

Return:

Object | null

Returns the distance in pixels between the two inputs.

public start(inputs: *) source

start() - Event hook for the start of a gesture. Initialized the lastEmitted gesture and stores it in the first input for reference. events.

Override:

Gesture#start

Params:

NameTypeAttributeDescription
inputs *