core/src/ons/gesture-detector.js
function getCalculatedData(ev, center, deltaTime, deltaX, deltaY) {
    var cur = this.current,
        recalc = false,
        calcEv = cur.lastCalcEvent,
        calcData = cur.lastCalcData;

    if (calcEv && ev.timeStamp - calcEv.timeStamp > GestureDetector.CALCULATE_INTERVAL) {
      center = calcEv.center;
      deltaTime = ev.timeStamp - calcEv.timeStamp;
      deltaX = ev.center.clientX - calcEv.center.clientX;
      deltaY = ev.center.clientY - calcEv.center.clientY;
      recalc = true;
    }

    if (ev.eventType == EVENT_TOUCH || ev.eventType == EVENT_RELEASE) {
      cur.futureCalcEvent = ev;
    }

    if (!cur.lastCalcEvent || recalc) {
      calcData.velocity = Utils.getVelocity(deltaTime, deltaX, deltaY);
      calcData.angle = Utils.getAngle(center, ev.center);
      calcData.direction = Utils.getDirection(center, ev.center);

      cur.lastCalcEvent = cur.futureCalcEvent || ev;
      cur.futureCalcEvent = ev;
    }

    ev.velocityX = calcData.velocity.x;
    ev.velocityY = calcData.velocity.y;
    ev.interimAngle = calcData.angle;
    ev.interimDirection = calcData.direction;
  }
function getCalculatedData(ev, center, deltaTime, deltaX, deltaY) {
    var cur = this.current,
        recalc = false,
        calcEv = cur.lastCalcEvent,
        calcData = cur.lastCalcData;

    if (calcEv && ev.timeStamp - calcEv.timeStamp > GestureDetector.CALCULATE_INTERVAL) {
      center = calcEv.center;
      deltaTime = ev.timeStamp - calcEv.timeStamp;
      deltaX = ev.center.clientX - calcEv.center.clientX;
      deltaY = ev.center.clientY - calcEv.center.clientY;
      recalc = true;
    }

    if (ev.eventType == EVENT_TOUCH || ev.eventType == EVENT_RELEASE) {
      cur.futureCalcEvent = ev;
    }

    if (!cur.lastCalcEvent || recalc) {
      calcData.velocity = Utils.getVelocity(deltaTime, deltaX, deltaY);
      calcData.angle = Utils.getAngle(center, ev.center);
      calcData.direction = Utils.getDirection(center, ev.center);

      cur.lastCalcEvent = cur.futureCalcEvent || ev;
      cur.futureCalcEvent = ev;
    }

    ev.velocityX = calcData.velocity.x;
    ev.velocityY = calcData.velocity.y;
    ev.interimAngle = calcData.angle;
    ev.interimDirection = calcData.direction;
  }
function getCalculatedData ( ev , center , deltaTime , deltaX , deltaY ) { var cur = this . current , recalc = false , calcEv = cur . lastCalcEvent , calcData = cur . lastCalcData ; if ( calcEv && ev . timeStamp - calcEv . timeStamp > GestureDetector . CALCULATE_INTERVAL ) { center = calcEv . center ; deltaTime = ev . timeStamp - calcEv . timeStamp ; deltaX = ev . center . clientX - calcEv . center . clientX ; deltaY = ev . center . clientY - calcEv . center . clientY ; recalc = true ; } if ( ev . eventType == EVENT_TOUCH || ev . eventType == EVENT_RELEASE ) { cur . futureCalcEvent = ev ; } if ( ! cur . lastCalcEvent || recalc ) { calcData . velocity = Utils . getVelocity ( deltaTime , deltaX , deltaY ) ; calcData . angle = Utils . getAngle ( center , ev . center ) ; calcData . direction = Utils . getDirection ( center , ev . center ) ; cur . lastCalcEvent = cur . futureCalcEvent || ev ; cur . futureCalcEvent = ev ; } ev . velocityX = calcData . velocity . x ; ev . velocityY = calcData . velocity . y ; ev . interimAngle = calcData . angle ; ev . interimDirection = calcData . direction ; }
calculate velocity, angle and direction
@param {Object} ev
@param {Object} center
@param {Number} deltaTime
@param {Number} deltaX
@param {Number} deltaY
calculate velocity angle and direction