Class: SC.PinchGesture


Extends SC.Gesture.

Defined in: pinch_gesture.js

Field Summary

Instance Methods

Field Detail

name String
Default value:
"pinch"
pinchDelay Number

The amount of time in milliseconds that touches should stop moving before a pinchEnd event will fire. When a pinch gesture begins, the pinchStart event is fired and as long as the touches continue to change distance, multiple pinch events will fire. If the touches remain active but don't change distance any longer, then after pinchDelay milliseconds the pinchEnd event will fire.

Default value:
500

Instance Method Detail

touchAddedToSession(touch, touchesInSession)

The pinch gesture is always interested in the touch session. When a new touch is added, the distance between all of the touches is registered in order to check for distance changes equating to a pinch gesture.

Parameters:
touch SC.Touch
The touch to be added to the session.
touchesInSession Array
The touches already in the session.
Returns:
Boolean
True.
See:
SC.Gesture#touchAddedToSession
touchCancelledInSession(touch, touchesInSession)

If a touch cancels, the pinch remains interested (even if there's only one touch left, because a second touch may appear again), but updates its internal variable for tracking for pinch movements.

Parameters:
touch SC.Touch
The touch to be removed from the session.
touchesInSession Array
The touches in the session.
Returns:
Boolean
True
See:
SC.Gesture#touchCancelledInSession
touchEndedInSession(touch, touchesInSession)

If a touch ends, the pinch remains interested (even if there's only one touch left, because a second touch may appear again), but updates its internal variable for tracking for pinch movements.

Parameters:
touch SC.Touch
The touch to be removed from the session.
touchesInSession Array
The touches in the session.
Returns:
Boolean
True
See:
SC.Gesture#touchEndedInSession
touchesMovedInSession(touchesInSession)

The pinch is only interested in more than one touch moving. If there are multiple touches moving and the distance between the touches has changed then a pinchStart event will fire. If the touches keep expanding or contracting, the pinch event will repeatedly fire. Finally, if the touch distance stops changing and enough time passes (value of pinchDelay), the pinchEnd event will fire.

Therefore, it's possible for a pinch gesture to start and end more than once in a single touch session. For example, a person may touch two fingers down, expand them to zoom in (pinchStart and multiple pinch events fire) and then if they stop or move their fingers in one direction in tandem to scroll content (pinchEnd event fires after pinchDelay exceeded). If the person then starts expanding their fingers again without lifting them, a new set of pinch events will fire.

Parameters:
touchesInSession Array
All touches in the session.
Returns:
Boolean
True.
See:
SC.Gesture#touchesMovedInSession
touchSessionCancelled()
Cleans up all touch session variables.
Returns:
void
See:
SC.Gesture#touchSessionCancelled
touchSessionEnded()
Cleans up all touch session variables and triggers the gesture.
Returns:
void
See:
SC.Gesture#touchSessionEnded
touchSessionStarted(touch)
Registers the scale of the view when it starts.
Parameters:
touch SC.Touch
The touch that started the session.
Returns:
void
See:
SC.Gesture#touchSessionStarted
Documentation generated by JsDoc Toolkit 2.4.0 on Wed Apr 08 2015 10:02:21 GMT-0600 (CST)