1
0
Fork 0

Merge branch '2380-linear-navigation-mobile' of https://github.com/earboxer/reveal.js into dev

This commit is contained in:
Hakim El Hattab 2019-06-10 07:04:49 +02:00
commit 51e8da5d9a
1 changed files with 39 additions and 4 deletions

View File

@ -3951,6 +3951,11 @@
} }
} }
if( config.navigationMode === 'linear' ) {
routes.right = routes.right || routes.down;
routes.left = routes.left || routes.up;
}
// Reverse horizontal controls for rtl // Reverse horizontal controls for rtl
if( config.rtl ) { if( config.rtl ) {
var left = routes.left; var left = routes.left;
@ -5436,20 +5441,50 @@
if( deltaX > touch.threshold && Math.abs( deltaX ) > Math.abs( deltaY ) ) { if( deltaX > touch.threshold && Math.abs( deltaX ) > Math.abs( deltaY ) ) {
touch.captured = true; touch.captured = true;
if (config.navigationMode === 'linear') {
if( config.rtl ) {
navigateNext();
}
else {
navigatePrev();
}
}
else {
navigateLeft(); navigateLeft();
} }
}
else if( deltaX < -touch.threshold && Math.abs( deltaX ) > Math.abs( deltaY ) ) { else if( deltaX < -touch.threshold && Math.abs( deltaX ) > Math.abs( deltaY ) ) {
touch.captured = true; touch.captured = true;
if (config.navigationMode === 'linear') {
if( config.rtl ) {
navigatePrev();
}
else {
navigateNext();
}
}
else {
navigateRight(); navigateRight();
} }
}
else if( deltaY > touch.threshold ) { else if( deltaY > touch.threshold ) {
touch.captured = true; touch.captured = true;
if (config.navigationMode === 'linear') {
navigatePrev();
}
else {
navigateUp(); navigateUp();
} }
}
else if( deltaY < -touch.threshold ) { else if( deltaY < -touch.threshold ) {
touch.captured = true; touch.captured = true;
if (config.navigationMode === 'linear') {
navigateNext();
}
else {
navigateDown(); navigateDown();
} }
}
// If we're embedded, only block touch events if they have // If we're embedded, only block touch events if they have
// triggered an action // triggered an action