Skip to content

Commit

Permalink
Merge branch 'feature_prevent_swipe' of https://github.com/Calyhre/re…
Browse files Browse the repository at this point in the history
…veal.js into dev
  • Loading branch information
hakimel committed Sep 10, 2015
2 parents bd6a592 + ed8d90b commit be7545d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions js/reveal.js
Original file line number Diff line number Diff line change
Expand Up @@ -3954,6 +3954,8 @@
*/
function onTouchStart( event ) {

if(preventSwipe(event.target)) return true;

touch.startX = event.touches[0].clientX;
touch.startY = event.touches[0].clientY;
touch.startCount = event.touches.length;
Expand All @@ -3977,6 +3979,8 @@
*/
function onTouchMove( event ) {

if(preventSwipe(event.target)) return true;

// Each touch should only trigger one action
if( !touch.captured ) {
onUserInput( event );
Expand Down Expand Up @@ -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 ------------------------//
Expand Down

0 comments on commit be7545d

Please sign in to comment.