code: function(previousState, event) {
      var state = {};
      state.center = getCenter(event.targetTouches);
      state.pointers = [];
      for (var i = 0; i < event.targetTouches.length; ++i) {
        var t = event.targetTouches[i];
        state.pointers.push({ x: t.clientX, y : t.clientY });
      }
      state.numTouches = event.targetTouches.length;
      state.rotation = 0;
      state.scale = 1.0;
      state.deltaScale = 0.0;
      state.deltaRotation = 0.0;
  
      if (previousState.center) {
        state.deltaCenter = {
          x : state.center.x - previousState.center.x, 
          y : state.center.y - previousState.center.y
        };
      }
  
      if (previousState.numTouches !== 2 || state.numTouches !== 2) {
        return state;
      }
      if (previousState.initialPointers) {
        state.initialPointers = previousState.initialPointers;
      } else {
        state.initialPointers = previousState.pointers;
      }
  
      state.scale = getScale(state.initialPointers, state.pointers);
      state.deltaScale = state.scale - previousState.scale;
      state.rotation = getRotationAngle(state.initialPointers, state.pointers);
      state.deltaRotation = state.rotation - previousState.rotation;
      return state;
    }
docs: calculates the relevant touch/gesture properties based on previous touch state and the new event. It returns the new state with deltaScale, deltaRotation and deltaCenter attached than can be used to control the camera.