js/reveal.js
/**
	 * Handler for the document level 'touchmove' event.
	 */
Handler for the document level 'touchmove' event.
Handler for the document level ' touchmove ' event .
function onDocumentTouchMove( event ) {
		if( !touch.handled ) {
			var currentX = event.touches[0].clientX;
			var currentY = event.touches[0].clientY;
			if( event.touches.length === 2 && touch.startCount === 2 && config.overview ) {
				var currentSpan = distanceBetween( {
					x: event.touches[1].clientX,
					y: event.touches[1].clientY
				}, {
					x: touch.startX,
					y: touch.startY
				} );
				if( Math.abs( touch.startSpan - currentSpan ) > touch.threshold ) {
					touch.handled = true;
					if( currentSpan < touch.startSpan ) {
						activateOverview();
					}
					else {
						deactivateOverview();
					}
				}
				event.preventDefault();
			}
			else if( event.touches.length === 1 && touch.startCount !== 2 ) {
				var deltaX = currentX - touch.startX,
					deltaY = currentY - touch.startY;
				if( deltaX > touch.threshold && Math.abs( deltaX ) > Math.abs( deltaY ) ) {
					touch.handled = true;
					navigateLeft();
				}
				else if( deltaX < -touch.threshold && Math.abs( deltaX ) > Math.abs( deltaY ) ) {
					touch.handled = true;
					navigateRight();
				}
				else if( deltaY > touch.threshold ) {
					touch.handled = true;
					navigateUp();
				}
				else if( deltaY < -touch.threshold ) {
					touch.handled = true;
					navigateDown();
				}
				event.preventDefault();
			}
		}
		else if( navigator.userAgent.match( /android/gi ) ) {
			event.preventDefault();
		}
	}
function onDocumentTouchMove ( event ) { if ( ! touch . handled ) { var currentX = event . touches [ 0 ] . clientX ; var currentY = event . touches [ 0 ] . clientY ; if ( event . touches . length === 2 && touch . startCount === 2 && config . overview ) { var currentSpan = distanceBetween ( { x : event . touches [ 1 ] . clientX , y : event . touches [ 1 ] . clientY } , { x : touch . startX , y : touch . startY } ) ; if ( Math . abs ( touch . startSpan - currentSpan ) > touch . threshold ) { touch . handled = true ; if ( currentSpan < touch . startSpan ) { activateOverview ( ) ; } else { deactivateOverview ( ) ; } } event . preventDefault ( ) ; } else if ( event . touches . length === 1 && touch . startCount !== 2 ) { var deltaX = currentX - touch . startX , deltaY = currentY - touch . startY ; if ( deltaX > touch . threshold && Math . abs ( deltaX ) > Math . abs ( deltaY ) ) { touch . handled = true ; navigateLeft ( ) ; } else if ( deltaX < - touch . threshold && Math . abs ( deltaX ) > Math . abs ( deltaY ) ) { touch . handled = true ; navigateRight ( ) ; } else if ( deltaY > touch . threshold ) { touch . handled = true ; navigateUp ( ) ; } else if ( deltaY < - touch . threshold ) { touch . handled = true ; navigateDown ( ) ; } event . preventDefault ( ) ; } } else if ( navigator . userAgent . match ( / android / gi ) ) { event . preventDefault ( ) ; } }
Handler for the document level 'touchmove' event.
Handler for the document level ' touchmove ' event .
// Each touch should only trigger one action // If the touch started off with two points and still has // two active touches; test for the pinch gesture // The current distance in pixels between the two touch points // If the span is larger than the desire amount we've got // ourselves a pinch // There was only one touch point, look for a swipe // There's a bug with swiping on some Android devices unless // the default action is always prevented