Home Reference Source Test
public class | source

Input

Tracks a single input and contains information about the current, previous, and initial events. Contains the progress of each Input and it's associated gestures.

Test:

Constructor Summary

Public Constructor
public

constructor(event: Event, identifier: Number)

Constructor function for the Input class.

Member Summary

Public Members
public

Holds the most current event for this Input, disregarding any other past, current, and future events that other Inputs participate in.

public

Refers to the event.touches index, or 0 if a simple mouse event occurred.

public

Holds the initial event object.

public

Holds the previous event that took place.

public

Stores internal state between events for each gesture based off of the gesture's id.

Method Summary

Public Methods
public

Returns the normalized current Event's type.

public

Returns the progress of the specified gesture.

public

Resets a progress/state object of the specified gesture.

public

update(event: Event, touchIdentifier: Number)

Receives an input, updates the internal state of what the input has done next.

Public Constructors

public constructor(event: Event, identifier: Number) source

Constructor function for the Input class.

Params:

NameTypeAttributeDescription
event Event

The Event object from the window

identifier Number
  • optional
  • default: 0

The identifier for each input event (taken from event.changedTouches)

Public Members

public current: ZingEvent source

Holds the most current event for this Input, disregarding any other past, current, and future events that other Inputs participate in. e.g. This event ended in an 'end' event, but another Input is still participating in events -- this will not be updated in such cases.

public identifier: Number source

Refers to the event.touches index, or 0 if a simple mouse event occurred.

public initial: ZingEvent source

Holds the initial event object. A touchstart/mousedown event.

public previous: ZingEvent source

Holds the previous event that took place.

public progress: Object source

Stores internal state between events for each gesture based off of the gesture's id.

Public Methods

public getCurrentEventType(): String source

Returns the normalized current Event's type.

Return:

String

The current event's type ( start | move | end )

Test:

public getGestureProgress(id: String): Object source

Returns the progress of the specified gesture.

Params:

NameTypeAttributeDescription
id String

The identifier for each unique Gesture's progress.

Return:

Object

The progress of the gesture. Creates an empty object if no progress has begun.

Test:

public resetProgress(id: String) source

Resets a progress/state object of the specified gesture.

Params:

NameTypeAttributeDescription
id String

The identifier of the specified gesture

public update(event: Event, touchIdentifier: Number) source

Receives an input, updates the internal state of what the input has done next.

Params:

NameTypeAttributeDescription
event Event

The event object to wrap with a ZingEvent.

touchIdentifier Number

The index of inputs (usually from event.touches)

Test: