Skip to content

Commit 3bb98db

Browse files
author
Stanislav Idolov
authored
ENGCOM-1006: Change photo only if user swipe horizontally #14123
2 parents 5989bbf + 0da3ab3 commit 3bb98db

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

lib/web/fotorama/fotorama.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,16 +1447,22 @@ fotoramaVersion = '4.6.4';
14471447
}
14481448
} else {
14491449
stopEvent(e);
1450-
(options.onMove || noop).call(el, e, {touch: touchFLAG});
1450+
if (movedEnough(xDiff,yDiff)) {
1451+
(options.onMove || noop).call(el, e, {touch: touchFLAG});
1452+
}
14511453
}
14521454

1453-
if (!moved && 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) {
14541456
moved = true;
14551457
}
14561458

14571459
tail.checked = tail.checked || xWin || yWin;
14581460
}
14591461

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

0 commit comments

Comments
 (0)