function SwipeInput (element, inputController, afterInput) {
  this.element = typeof element !== 'undefined' ? element : document;
  this.inputController = inputController;
  this.afterInput = afterInput;

  var preventDefault = function(event) {event.preventDefault(); };

  this.listeners = {
    touchStart: this.startTouch.bind(this),
    touchMove: preventDefault,
    touchEnd: this.detectSwipe.bind(this),
    mouseDown: this.startTouch.bind(this),
    mouseMove: preventDefault,
    mouseUp: this.detectSwipe.bind(this)
  };

  this.xStart = null;
  this.yStart = null;
}

SwipeInput.prototype.listen = function () {
  this.element.addEventListener('touchstart', this.listeners.touchStart);
  this.element.addEventListener('touchmove', this.listeners.touchMove);
  this.element.addEventListener('touchend', this.listeners.touchEnd);

  //Simulate touch events for mouse
  this.element.addEventListener('mousedown', this.listeners.mouseDown);
  this.element.addEventListener('mousemove', this.listeners.mouseMove);
  this.element.addEventListener('mouseup', this.listeners.mouseUp);
};

SwipeInput.prototype.startTouch = function (event) {
  event.preventDefault();
  this.xStart = event.clientX || event.touches[0].clientX;
  this.yStart = event.clientY || event.touches[0].clientY;
};

SwipeInput.prototype.detectSwipe = function (event) {
  event.preventDefault();

  if (this.xStart === null || this.yStart === null) {
    return;
  }

  var xEnd = event.clientX || event.changedTouches[0].clientX;
  var yEnd = event.clientY || event.changedTouches[0].clientY;

  var deltaX = xEnd - this.xStart;
  var deltaY = yEnd - this.yStart;

  var isHorizontalSwipe = Math.abs(deltaX) > Math.abs(deltaY);

  if (isHorizontalSwipe) {
    deltaX < 0 ? this.inputController.left() : this.inputController.right();
  } else if (deltaY > 0) {
    this.inputController.down();
  } else {
    this.inputController.up();
  }

  this.xStart = null;
  this.yStart = null;

  if (typeof this.afterInput === 'function') {
    this.afterInput();
  }
};

SwipeInput.prototype.detach = function () {
  this.xStart = null;
  this.yStart = null;

  this.element.removeEventListener('touchstart', this.listeners.touchStart);
  this.element.removeEventListener('touchmove', this.listeners.touchMove);
  this.element.removeEventListener('touchend', this.listeners.touchEnd);

  this.element.removeEventListener('mousedown', this.listeners.mouseDown);
  this.element.removeEventListener('mousemove', this.listeners.mouseMove);
  this.element.removeEventListener('mouseup', this.listeners.mouseUp);
};

@@ -203,76 +203,8 @@
 t;%0A%0A
-  var preventDefault = function(event) %7Bevent.preventDefault(); %7D;%0A%0A
   th
@@ -275,38 +275,51 @@
  touchMove: 
-preventDefault
+this.detectSwipe.bind(this)
 ,%0A    touchE
@@ -323,30 +323,27 @@
 chEnd: this.
-detect
+end
 Swipe.bind(t
@@ -406,30 +406,43 @@
 seMove: 
-preventDefault
+this.detectSwipe.bind(this)
 ,%0A    mo
@@ -449,30 +449,27 @@
 useUp: this.
-detect
+end
 Swipe.bind(t
@@ -522,16 +522,40 @@
  = null;
+%0A%0A  this.threshold = 25;
 %0A%7D%0A%0ASwip
@@ -1614,16 +1614,114 @@
 Start;%0A%0A
+  if(Math.abs(deltaX) %3C this.threshold && Math.abs(deltaY) %3C this.threshold) %7B%0A      return;%0A  %7D%0A%0A
   var is
@@ -1775,17 +1775,16 @@
 eltaY);%0A
-%0A
   if (is
@@ -2105,24 +2105,149 @@
 ();%0A  %7D%0A%7D;%0A%0A
+SwipeInput.prototype.endSwipe = function (event) %7B%0A  event.preventDefault();%0A  this.xStart = null;%0A  this.yStart = null;%0A%7D;%0A%0A
 SwipeInput.p

Make swipe gestures more responsive