state = State.FOUND_DIRECTION;
direction = touch.getPageX() - x > 0 ? Direction.LEFT_TO_RIGHT : Direction.RIGHT_TO_LEFT;
SwipeStartEvent swipeStartEvent =
new SwipeStartEvent(new TouchPoint(touch), touch.getPageX() - x, direction);
source.fireEvent(swipeStartEvent);
} else {
if (Math.abs(touch.getPageY() - y) >= threshold) {
state = State.FOUND_DIRECTION;
direction = touch.getPageY() - y > 0 ? Direction.TOP_TO_BOTTOM : Direction.BOTTOM_TO_TOP;
SwipeStartEvent swipeStartEvent =
new SwipeStartEvent(new TouchPoint(touch), touch.getPageY() - y, direction);
source.fireEvent(swipeStartEvent);
}
}
break;
case FOUND_DIRECTION:
switch (direction) {
case TOP_TO_BOTTOM:
case BOTTOM_TO_TOP:
lastDistance = Math.abs(touch.getPageY() - y);
source.fireEvent(
new SwipeMoveEvent(new TouchPoint(touch), lastDistance > minDistance,
lastDistance, direction));
break;
case LEFT_TO_RIGHT:
case RIGHT_TO_LEFT:
lastDistance = Math.abs(touch.getPageX() - x);
source.fireEvent(
new SwipeMoveEvent(new TouchPoint(touch), lastDistance > minDistance,
lastDistance, direction));
break;
default: