index.js
function computeInputData(manager, input) {
  var session = manager.session;
  var pointers = input.pointers;
  var pointersLength = pointers.length;

  // store the first input to calculate the distance and direction
  if (!session.firstInput) {
    session.firstInput = simpleCloneInputData(input);
  }

  // to compute scale and rotation we need to store the multiple touches
  if (pointersLength > 1 && !session.firstMultiple) {
    session.firstMultiple = simpleCloneInputData(input);
  } else if (pointersLength === 1) {
    session.firstMultiple = false;
  }

  var firstInput = session.firstInput;
  var firstMultiple = session.firstMultiple;
  var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;

  var center = input.center = getCenter(pointers);
  input.timeStamp = now();
  input.deltaTime = input.timeStamp - firstInput.timeStamp;

  input.angle = getAngle(offsetCenter, center);
  input.distance = getDistance(offsetCenter, center);

  computeDeltaXY(session, input);
  input.offsetDirection = getDirection(input.deltaX, input.deltaY);

  input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;
  input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;

  computeIntervalInputData(session, input);

  // find the correct target
  var target = manager.element;
  if (hasParent(input.srcEvent.target, target)) {
    target = input.srcEvent.target;
  }
  input.target = target;
}
function computeInputData(manager, input) {
  var session = manager.session;
  var pointers = input.pointers;
  var pointersLength = pointers.length;

  // store the first input to calculate the distance and direction
  if (!session.firstInput) {
    session.firstInput = simpleCloneInputData(input);
  }

  // to compute scale and rotation we need to store the multiple touches
  if (pointersLength > 1 && !session.firstMultiple) {
    session.firstMultiple = simpleCloneInputData(input);
  } else if (pointersLength === 1) {
    session.firstMultiple = false;
  }

  var firstInput = session.firstInput;
  var firstMultiple = session.firstMultiple;
  var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;

  var center = input.center = getCenter(pointers);
  input.timeStamp = now();
  input.deltaTime = input.timeStamp - firstInput.timeStamp;

  input.angle = getAngle(offsetCenter, center);
  input.distance = getDistance(offsetCenter, center);

  computeDeltaXY(session, input);
  input.offsetDirection = getDirection(input.deltaX, input.deltaY);

  input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;
  input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;

  computeIntervalInputData(session, input);

  // find the correct target
  var target = manager.element;
  if (hasParent(input.srcEvent.target, target)) {
    target = input.srcEvent.target;
  }
  input.target = target;
}
function computeInputData ( manager , input ) { var session = manager . session ; var pointers = input . pointers ; var pointersLength = pointers . length ; // store the first input to calculate the distance and direction if ( ! session . firstInput ) { session . firstInput = simpleCloneInputData ( input ) ; } // to compute scale and rotation we need to store the multiple touches if ( pointersLength > 1 && ! session . firstMultiple ) { session . firstMultiple = simpleCloneInputData ( input ) ; } else if ( pointersLength === 1 ) { session . firstMultiple = false ; } var firstInput = session . firstInput ; var firstMultiple = session . firstMultiple ; var offsetCenter = firstMultiple ? firstMultiple . center : firstInput . center ; var center = input . center = getCenter ( pointers ) ; input . timeStamp = now ( ) ; input . deltaTime = input . timeStamp - firstInput . timeStamp ; input . angle = getAngle ( offsetCenter , center ) ; input . distance = getDistance ( offsetCenter , center ) ; computeDeltaXY ( session , input ) ; input . offsetDirection = getDirection ( input . deltaX , input . deltaY ) ; input . scale = firstMultiple ? getScale ( firstMultiple . pointers , pointers ) : 1 ; input . rotation = firstMultiple ? getRotation ( firstMultiple . pointers , pointers ) : 0 ; computeIntervalInputData ( session , input ) ; // find the correct target var target = manager . element ; if ( hasParent ( input . srcEvent . target , target ) ) { target = input . srcEvent . target ; } input . target = target ; }
extend the data with some usable properties like scale, rotate, velocity etc
@param {Object} manager
@param {Object} input
extend the data with some usable properties like scale rotate velocity etc