Skip to content

Commit 50579a6

Browse files
author
Danilo Argentiero
committed
A better tollerance for swipe gesture in fotorama gallery.
1 parent 159efeb commit 50579a6

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lib/web/fotorama/fotorama.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,18 +1447,22 @@ fotoramaVersion = '4.6.4';
14471447
}
14481448
} else {
14491449
stopEvent(e);
1450-
if (xDiff > yDiff) {
1450+
if (movedEnough(xDiff,yDiff)) {
14511451
(options.onMove || noop).call(el, e, {touch: touchFLAG});
14521452
}
14531453
}
14541454

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

14591459
tail.checked = tail.checked || xWin || yWin;
14601460
}
14611461

1462+
function movedEnough(xDiff, yDiff) {
1463+
return xDiff > yDiff && xDiff > 1.5;
1464+
}
1465+
14621466
function onEnd(e) {
14631467
(options.onTouchEnd || noop)();
14641468

0 commit comments

Comments
 (0)