small JS improvement

dev_contacts
PhilW 6 years ago
parent 0b2eecc397
commit 0f1bcf7b95

@ -220,11 +220,13 @@ rcube_webmail.prototype.swipe = {
changeY = opts.vertical ? Math.min(opts.vertical.maxmove, changeY) : 0;
changeX = opts.horizontal ? (changeX < 0 ? Math.max(opts.horizontal.maxmove * -1, changeX) : Math.min(opts.horizontal.maxmove, changeX)) : 0;
// use Math.abs() to ensure value is always a positive number
var min_move = 5; // the minimum amount of pointer movement required to trigger the swipe
var temp_axis;
if (((changeY > 5 || changeY < -5) && changeX < 5 && changeX > -5) || (opts.vertical && opts.vertical.target_obj.hasClass('swipe-active'))) {
if (opts.vertical && (Math.abs(changeY) > min_move || opts.vertical.target_obj.hasClass('swipe-active'))) {
temp_axis = 'vertical';
}
else if (((changeX > 5 || changeX < -5) && changeY < 5 && changeY > -5) || (opts.horizontal && opts.horizontal.target_obj.hasClass('swipe-active'))) {
else if (opts.horizontal && (Math.abs(changeX) > min_move || opts.horizontal.target_obj.hasClass('swipe-active'))) {
temp_axis = 'horizontal';
}
else {

Loading…
Cancel
Save