Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #8260 from crdlc/bug-843832
Browse files Browse the repository at this point in the history
Bug 843832 - [Homescreen] Tapping icons causes swipes [r=arcturus](cherry picked from commit 8983833)
(cherry picked from commit dd29452)
  • Loading branch information
Cristian Rodriguez committed Feb 26, 2013
1 parent cf4b08a commit 823ae47
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions apps/homescreen/js/grid.js
Expand Up @@ -73,6 +73,10 @@ const GridManager = (function() {
break;

case touchmove:
if (evt.preventPanning === true) {
return;
}

// Start panning immediately but only disable
// the tap when we've moved far enough.
deltaX = getX(evt) - startEvent.pageX;
Expand Down Expand Up @@ -242,9 +246,11 @@ const GridManager = (function() {

function onTouchEnd(deltaX, evt) {
var page = currentPage;
/* Bigger than panning threshold or fast gesture */
// If movement over 25% of the screen size or
// fast movement over threshold for tapping, then swipe
if (Math.abs(deltaX) > panningThreshold ||
touchEndTimestamp - touchStartTimestamp < kPageTransitionDuration) {
(Math.abs(deltaX) > tapThreshold &&
touchEndTimestamp - touchStartTimestamp < kPageTransitionDuration)) {
var forward = dirCtrl.goesForward(deltaX);
if (forward && currentPage < pages.length - 1) {
page = page + 1;
Expand Down Expand Up @@ -356,10 +362,10 @@ const GridManager = (function() {
}

return;
} else {
togglePagesVisibility(start, end);
}

togglePagesVisibility(start, end);

// Force a reflow otherwise the newPage appears immediately because it is
// still considered display: none;
newPage.container.getBoundingClientRect();
Expand Down

0 comments on commit 823ae47

Please sign in to comment.