Skip to content

Commit

Permalink
modify Android optimization fix to use first event, but still respect…
Browse files Browse the repository at this point in the history
… absolute distance threshold
  • Loading branch information
Jon Klein committed Jan 12, 2012
1 parent 8a0e38b commit 3e6d0bf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions src/iscroll-lite.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,13 @@ iScroll.prototype = {
newY = that.options.bounce ? that.y + (deltaY / 2) : newY >= 0 || that.maxScrollY >= 0 ? 0 : that.maxScrollY;
}

that.distX += deltaX;
that.distY += deltaY;
that.absDistX = m.abs(that.distX);
that.absDistY = m.abs(that.distY);

if (that.absDistX < 6 && that.absDistY < 6) {
that.distX += deltaX;
that.distY += deltaY;
that.absDistX = m.abs(that.distX);
that.absDistY = m.abs(that.distY);
return;
}

// Lock direction
Expand Down
10 changes: 6 additions & 4 deletions src/iscroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,11 +425,13 @@ iScroll.prototype = {
newY = that.options.bounce ? that.y + (deltaY / 2) : newY >= that.minScrollY || that.maxScrollY >= 0 ? that.minScrollY : that.maxScrollY;
}

that.distX += deltaX;
that.distY += deltaY;
that.absDistX = m.abs(that.distX);
that.absDistY = m.abs(that.distY);

if (that.absDistX < 6 && that.absDistY < 6) {
that.distX += deltaX;
that.distY += deltaY;
that.absDistX = m.abs(that.distX);
that.absDistY = m.abs(that.distY);
return;
}

// Lock direction
Expand Down

0 comments on commit 3e6d0bf

Please sign in to comment.