index.js
/**
		* Event handler for a touch end event.
		* Calculate the direction and trigger events
		* @inner
		* @param {object} jqEvent The normalised jQuery event object.
		*/
Event handler for a touch end event.
Calculate the direction and trigger events
@inner
@param {object} jqEvent The normalised jQuery event object.
Event handler for a touch end event . Calculate the direction and trigger events @inner @param { object } jqEvent The normalised jQuery event object .
function touchEnd(jqEvent) {
			var event = jqEvent.originalEvent;
			if (SUPPORTS_TOUCH) {
				if(event.touches.length>0) {
					startMultiFingerRelease();
					return true;
				}
			}
			if(inMultiFingerRelease()) {
				fingerCount=previousTouchFingerCount;
			}
			jqEvent.preventDefault();
			endTime = getTimeStamp();
			duration = calculateDuration();
			if(didSwipeBackToCancel()) {
			    phase = PHASE_CANCEL;
                triggerHandler(event, phase);
			} else if (options.triggerOnTouchEnd || (options.triggerOnTouchEnd == false && phase === PHASE_MOVE)) {
				phase = PHASE_END;
                triggerHandler(event, phase);
			}
			else if (!options.triggerOnTouchEnd && hasTap()) {
			    phase = PHASE_END;
			    triggerHandlerForGesture(event, phase, TAP);
			}
			else if (phase === PHASE_MOVE) {
				phase = PHASE_CANCEL;
				triggerHandler(event, phase);
			}
			setTouchInProgress(false);
            return null;
		}
function touchEnd ( jqEvent ) { var event = jqEvent . originalEvent ; if ( SUPPORTS_TOUCH ) { if ( event . touches . length > 0 ) { startMultiFingerRelease ( ) ; return true ; } } if ( inMultiFingerRelease ( ) ) { fingerCount = previousTouchFingerCount ; } jqEvent . preventDefault ( ) ; endTime = getTimeStamp ( ) ; duration = calculateDuration ( ) ; if ( didSwipeBackToCancel ( ) ) { phase = PHASE_CANCEL ; triggerHandler ( event , phase ) ; } else if ( options . triggerOnTouchEnd || ( options . triggerOnTouchEnd == false && phase === PHASE_MOVE ) ) { phase = PHASE_END ; triggerHandler ( event , phase ) ; } else if ( ! options . triggerOnTouchEnd && hasTap ( ) ) { phase = PHASE_END ; triggerHandlerForGesture ( event , phase , TAP ) ; } else if ( phase === PHASE_MOVE ) { phase = PHASE_CANCEL ; triggerHandler ( event , phase ) ; } setTouchInProgress ( false ) ; return null ; }
Event handler for a touch end event.
Event handler for a touch end event .
//As we use Jquery bind for events, we need to target the original event object //If we are still in a touch with another finger return //This allows us to wait a fraction and see if the other finger comes up, if it does within the threshold, then we treat it as a multi release, not a single release. //If a previous finger has been released, check how long ago, if within the threshold, then assume it was a multifinger release. //This is used to allow 2 fingers to release fractionally after each other, whilst maintainig the event as containg 2 fingers, not 1 //call this on jq event so we are cross browser //Set end of swipe //Get duration incase move was never fired //If we trigger handlers at end of swipe OR, we trigger during, but they didnt trigger and we are still in the move phase //Special cases - A tap should always fire on touch end regardless, //So here we manually trigger the tap end handler by itself //We dont run trigger handler as it will re-trigger events that may have fired already //Trigger the pinch events...