enable pinch to zoom interaction if overview is disabled (#175)
This commit is contained in:
parent
6e0d0e279d
commit
86a907e8cc
14
js/reveal.js
14
js/reveal.js
|
@ -102,7 +102,7 @@ var Reveal = (function(){
|
||||||
startSpan: 0,
|
startSpan: 0,
|
||||||
startCount: 0,
|
startCount: 0,
|
||||||
handled: false,
|
handled: false,
|
||||||
threshold: 40
|
threshold: 80
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -471,7 +471,7 @@ var Reveal = (function(){
|
||||||
|
|
||||||
// If there's two touches we need to memorize the distance
|
// If there's two touches we need to memorize the distance
|
||||||
// between those two points to detect pinching
|
// between those two points to detect pinching
|
||||||
if( event.touches.length === 2 ) {
|
if( event.touches.length === 2 && config.overview ) {
|
||||||
touch.startSpan = distanceBetween( {
|
touch.startSpan = distanceBetween( {
|
||||||
x: event.touches[1].clientX,
|
x: event.touches[1].clientX,
|
||||||
y: event.touches[1].clientY
|
y: event.touches[1].clientY
|
||||||
|
@ -493,7 +493,7 @@ var Reveal = (function(){
|
||||||
|
|
||||||
// If the touch started off with two points and still has
|
// If the touch started off with two points and still has
|
||||||
// two active touches; test for the pinch gesture
|
// 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
|
// The current distance in pixels between the two touch points
|
||||||
var currentSpan = distanceBetween( {
|
var currentSpan = distanceBetween( {
|
||||||
|
@ -517,9 +517,12 @@ var Reveal = (function(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
}
|
}
|
||||||
// There was only one touch point, look for a swipe
|
// 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,
|
var deltaX = currentX - touch.startX,
|
||||||
deltaY = currentY - touch.startY;
|
deltaY = currentY - touch.startY;
|
||||||
|
|
||||||
|
@ -539,9 +542,10 @@ var Reveal = (function(){
|
||||||
touch.handled = true;
|
touch.handled = true;
|
||||||
navigateDown();
|
navigateDown();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// There's a bug with swiping on some Android devices unless
|
// There's a bug with swiping on some Android devices unless
|
||||||
// the default action is always prevented
|
// the default action is always prevented
|
||||||
|
|
10
js/reveal.min.js
vendored
10
js/reveal.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user