plugins/touchswipe.js
function calculateDirection(startPoint, endPoint ) {
			var angle = calculateAngle(startPoint, endPoint);

			if ((angle <= 45) && (angle >= 0)) {
				return LEFT;
			} else if ((angle <= 360) && (angle >= 315)) {
				return LEFT;
			} else if ((angle >= 135) && (angle <= 225)) {
				return RIGHT;
			} else if ((angle > 45) && (angle < 135)) {
				return DOWN;
			} else {
				return UP;
			}
		}
function calculateDirection(startPoint, endPoint ) {
			var angle = calculateAngle(startPoint, endPoint);

			if ((angle <= 45) && (angle >= 0)) {
				return LEFT;
			} else if ((angle <= 360) && (angle >= 315)) {
				return LEFT;
			} else if ((angle >= 135) && (angle <= 225)) {
				return RIGHT;
			} else if ((angle > 45) && (angle < 135)) {
				return DOWN;
			} else {
				return UP;
			}
		}
function calculateDirection ( startPoint , endPoint ) { var angle = calculateAngle ( startPoint , endPoint ) ; if ( ( angle <= 45 ) && ( angle >= 0 ) ) { return LEFT ; } else if ( ( angle <= 360 ) && ( angle >= 315 ) ) { return LEFT ; } else if ( ( angle >= 135 ) && ( angle <= 225 ) ) { return RIGHT ; } else if ( ( angle > 45 ) && ( angle < 135 ) ) { return DOWN ; } else { return UP ; } }
Calculate the direction of the swipe
This will also call calculateAngle to get the latest angle of swipe
@param {point} startPoint A point object containing x and y co-ordinates
@param {point} endPoint A point object containing x and y co-ordinates
@return string Either {@link $.fn.swipe.directions.LEFT} / {@link $.fn.swipe.directions.RIGHT} / {@link $.fn.swipe.directions.DOWN} / {@link $.fn.swipe.directions.UP}
@see $.fn.swipe.directions
@inner
Calculate the direction of the swipe This will also call calculateAngle to get the latest angle of swipe