Browse Source

enable pinch to zoom interaction if overview is disabled (#175)

Hakim El Hattab 11 years ago
parent
commit
86a907e8cc
2 changed files with 10 additions and 6 deletions
  1. 10 6
      js/reveal.js
  2. 0 0
      js/reveal.min.js

+ 10 - 6
js/reveal.js

@@ -102,7 +102,7 @@ var Reveal = (function(){
 			startSpan: 0,
 			startCount: 0,
 			handled: false,
-			threshold: 40
+			threshold: 80
 		};
 	
 	/**
@@ -471,7 +471,7 @@ var Reveal = (function(){
 
 		// If there's two touches we need to memorize the distance 
 		// between those two points to detect pinching
-		if( event.touches.length === 2 ) {
+		if( event.touches.length === 2 && config.overview ) {
 			touch.startSpan = distanceBetween( {
 				x: event.touches[1].clientX,
 				y: event.touches[1].clientY
@@ -493,7 +493,7 @@ var Reveal = (function(){
 
 			// If the touch started off with two points and still has 
 			// two active touches; test for the pinch gesture
-			if( event.touches.length === 2 && touch.startCount === 2 ) {
+			if( event.touches.length === 2 && touch.startCount === 2 && config.overview ) {
 
 				// The current distance in pixels between the two touch points
 				var currentSpan = distanceBetween( {
@@ -517,9 +517,12 @@ var Reveal = (function(){
 					}
 				}
 
+				event.preventDefault();
+
 			}
 			// There was only one touch point, look for a swipe
-			else if( event.touches.length === 1 ) {
+			else if( event.touches.length === 1 && touch.startCount !== 2 ) {
+
 				var deltaX = currentX - touch.startX,
 					deltaY = currentY - touch.startY;
 
@@ -539,9 +542,10 @@ var Reveal = (function(){
 					touch.handled = true;
 					navigateDown();
 				}
-			}
 
-			event.preventDefault();
+				event.preventDefault();
+
+			}
 		}
 		// There's a bug with swiping on some Android devices unless 
 		// the default action is always prevented

File diff suppressed because it is too large
+ 0 - 0
js/reveal.min.js


Some files were not shown because too many files changed in this diff