Skip to content

Commit

Permalink
ENGCOM-4633: [backport] issue - 21507 Change photo only if user swipe…
Browse files Browse the repository at this point in the history
… horizontally #22078
  • Loading branch information
sivaschenko authored Apr 17, 2019
2 parents 5cb3a0f + dce1682 commit b55bb34
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
12 changes: 10 additions & 2 deletions lib/web/fotorama/fotorama.js
Original file line number Diff line number Diff line change
Expand Up @@ -1455,16 +1455,24 @@ fotoramaVersion = '4.6.4';
}
} else {
stopEvent(e);
(options.onMove || noop).call(el, e, {touch: touchFLAG});
if (movedEnough(xDiff,yDiff)) {
(options.onMove || noop).call(el, e, {touch: touchFLAG});
}
}

if (!moved && 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 b55bb34

Please sign in to comment.