Skip to content

Commit

Permalink
remove pinch gesture for triggering overview mode on touch devices, e…
Browse files Browse the repository at this point in the history
…nables regular mobile pinch-to-zoom
  • Loading branch information
hakimel committed Jan 10, 2019
1 parent 9712cc9 commit 10e44aa
Showing 1 changed file with 1 addition and 43 deletions.
44 changes: 1 addition & 43 deletions js/reveal.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,6 @@
touch = {
startX: 0,
startY: 0,
startSpan: 0,
startCount: 0,
captured: false,
threshold: 40
Expand Down Expand Up @@ -5066,18 +5065,6 @@
touch.startY = event.touches[0].clientY;
touch.startCount = event.touches.length;

// If there's two touches we need to memorize the distance
// between those two points to detect pinching
if( event.touches.length === 2 && config.overview ) {
touch.startSpan = distanceBetween( {
x: event.touches[1].clientX,
y: event.touches[1].clientY
}, {
x: touch.startX,
y: touch.startY
} );
}

}

/**
Expand All @@ -5096,37 +5083,8 @@
var currentX = event.touches[0].clientX;
var currentY = event.touches[0].clientY;

// If the touch started with two points and still has
// two active touches; test for the pinch gesture
if( event.touches.length === 2 && touch.startCount === 2 && config.overview ) {

// The current distance in pixels between the two touch points
var currentSpan = distanceBetween( {
x: event.touches[1].clientX,
y: event.touches[1].clientY
}, {
x: touch.startX,
y: touch.startY
} );

// If the span is larger than the desire amount we've got
// ourselves a pinch
if( Math.abs( touch.startSpan - currentSpan ) > touch.threshold ) {
touch.captured = true;

if( currentSpan < touch.startSpan ) {
activateOverview();
}
else {
deactivateOverview();
}
}

event.preventDefault();

}
// There was only one touch point, look for a swipe
else if( event.touches.length === 1 && touch.startCount !== 2 ) {
if( event.touches.length === 1 && touch.startCount !== 2 ) {

var deltaX = currentX - touch.startX,
deltaY = currentY - touch.startY;
Expand Down

0 comments on commit 10e44aa

Please sign in to comment.