Class: SC.PinchGesture
Extends
SC.Gesture.
Defined in: pinch_gesture.js
Field Summary
Instance Methods
- touchAddedToSession(touch, touchesInSession)
- touchCancelledInSession(touch, touchesInSession)
- touchEndedInSession(touch, touchesInSession)
- touchesMovedInSession(touchesInSession)
- touchSessionCancelled()
- touchSessionEnded()
- touchSessionStarted(touch)
Field Detail
name String- Default value:
- "pinch"
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
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
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
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
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.
- See:
- SC.Gesture#touchesMovedInSession
- Returns:
- void
- See:
- SC.Gesture#touchSessionCancelled
- Returns:
- void
- See:
- SC.Gesture#touchSessionEnded
- Parameters:
- touch SC.Touch
- The touch that started the session.
- Returns:
- void
- See:
- SC.Gesture#touchSessionStarted