Skip to content

Commit 166a8bb

Browse files
author
Danilo Argentiero
committed
Change photo only if user swipe horizontally
1 parent cd151d5 commit 166a8bb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/web/fotorama/fotorama.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,10 +1447,12 @@ fotoramaVersion = '4.6.4';
14471447
}
14481448
} else {
14491449
stopEvent(e);
1450-
(options.onMove || noop).call(el, e, {touch: touchFLAG});
1450+
if (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 && xDiff > yDiff && Math.sqrt(Math.pow(xDiff, 2) + Math.pow(yDiff, 2)) > tolerance) {
14541456
moved = true;
14551457
}
14561458

0 commit comments

Comments
 (0)