Skip to content

Commit

Permalink
A better tollerance for swipe gesture in fotorama gallery.
Browse files Browse the repository at this point in the history
  • Loading branch information
Danilo Argentiero committed Mar 20, 2018
1 parent 159efeb commit 50579a6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions lib/web/fotorama/fotorama.js
Original file line number Diff line number Diff line change
Expand Up @@ -1447,18 +1447,22 @@ fotoramaVersion = '4.6.4';
}
} else {
stopEvent(e);
if (xDiff > yDiff) {
if (movedEnough(xDiff,yDiff)) {
(options.onMove || noop).call(el, e, {touch: touchFLAG});
}
}

if (!moved && xDiff > yDiff && Math.sqrt(Math.pow(xDiff, 2) + Math.pow(yDiff, 2)) > tolerance) {
if (!moved && movedEnough(xDiff, yDiff) && Math.sqrt(Math.pow(xDiff, 2) + Math.pow(yDiff, 2)) > tolerance) {
moved = true;
}

tail.checked = tail.checked || xWin || yWin;
}

function movedEnough(xDiff, yDiff) {
return xDiff > yDiff && xDiff > 1.5;
}

function onEnd(e) {
(options.onTouchEnd || noop)();

Expand Down
Loading

0 comments on commit 50579a6

Please sign in to comment.