Merge branch 'feature_prevent_swipe' of https://github.com/Calyhre/reveal.js into dev
This commit is contained in:
		
							
								
								
									
										13
									
								
								js/reveal.js
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								js/reveal.js
									
									
									
									
									
								
							| @@ -3954,6 +3954,8 @@ | |||||||
| 	 */ | 	 */ | ||||||
| 	function onTouchStart( event ) { | 	function onTouchStart( event ) { | ||||||
|  |  | ||||||
|  | 		if(preventSwipe(event.target)) return true; | ||||||
|  |  | ||||||
| 		touch.startX = event.touches[0].clientX; | 		touch.startX = event.touches[0].clientX; | ||||||
| 		touch.startY = event.touches[0].clientY; | 		touch.startY = event.touches[0].clientY; | ||||||
| 		touch.startCount = event.touches.length; | 		touch.startCount = event.touches.length; | ||||||
| @@ -3977,6 +3979,8 @@ | |||||||
| 	 */ | 	 */ | ||||||
| 	function onTouchMove( event ) { | 	function onTouchMove( event ) { | ||||||
|  |  | ||||||
|  | 		if(preventSwipe(event.target)) return true; | ||||||
|  |  | ||||||
| 		// Each touch should only trigger one action | 		// Each touch should only trigger one action | ||||||
| 		if( !touch.captured ) { | 		if( !touch.captured ) { | ||||||
| 			onUserInput( event ); | 			onUserInput( event ); | ||||||
| @@ -4267,6 +4271,15 @@ | |||||||
|  |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	function preventSwipe(target) { | ||||||
|  | 		while( target && typeof target.hasAttribute === 'function' ) { | ||||||
|  | 			if(target.hasAttribute('prevent-swipe')) return true; | ||||||
|  | 			target = target.parentNode; | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		return false; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  |  | ||||||
| 	// --------------------------------------------------------------------// | 	// --------------------------------------------------------------------// | ||||||
| 	// ------------------------ PLAYBACK COMPONENT ------------------------// | 	// ------------------------ PLAYBACK COMPONENT ------------------------// | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user