app/src/views/reflowableScrollview.js
/**
     * Helper function to return a transformation matrix representing the previous position 
     * @param {Object} previousObj has two properties: position and row. position is a translation vector [x, y, z], row is the index of the current view in the viewSequence 
     * @param {Object} currentObj has two properties: position and row. position is a translation vector [x, y, z], row is the index of the current view in the viewSequence 
     * @return {Transform} the result transformation matrix to get back to the previous position
     */
Helper function to return a transformation matrix representing the previous position
@param {Object} previousObj has two properties: position and row. position is a translation vector [x, y, z], row is the index of the current view in the viewSequence
@param {Object} currentObj has two properties: position and row. position is a translation vector [x, y, z], row is the index of the current view in the viewSequence
@return {Transform} the result transformation matrix to get back to the previous position
Helper function to return a transformation matrix representing the previous position @param { Object } previousObj has two properties : position and row . position is a translation vector [ x y z ] row is the index of the current view in the viewSequence @param { Object } currentObj has two properties : position and row . position is a translation vector [ x y z ] row is the index of the current view in the viewSequence @return { Transform } the result transformation matrix to get back to the previous position
function _getPreviousPosition(previousObj, currentObj) {
        var direction = this.options.direction;
        var offsetDirection = (direction === 0 ? 1 : 0);
        var positionTransform = Transform.identity;
        var rowTransform = Transform.identity;
        var currentPosition = currentObj.position[offsetDirection];
        var previousPosition = previousObj.position[offsetDirection];
        var currentMax = currentObj.position[direction];
        var previousMax = previousObj.position[direction];
        var currentRow = currentObj.row;
        var previousRow = previousObj.row;
        var vectorPos = [0, 0, 0];
        if (currentPosition > previousPosition) {
            vectorPos[offsetDirection] = -(currentPosition - previousPosition);
            positionTransform = Transform.translate.apply(null, vectorPos);
        }
        else if (previousPosition > currentPosition) {
            vectorPos[offsetDirection] = previousPosition - currentPosition;
            positionTransform = Transform.translate.apply(null, vectorPos);
        }
        var vectorRow = [0, 0, 0];
        if (currentRow > previousRow) {
            vectorRow[direction] = -previousMax;
            rowTransform = Transform.translate.apply(null, vectorRow);
        }
        else if (previousRow > currentRow) {
            vectorRow[direction] = currentMax;
            rowTransform = Transform.translate.apply(null, vectorRow);
        }
        return Transform.multiply(positionTransform, rowTransform);
    }
function _getPreviousPosition ( previousObj , currentObj ) { var direction = this . options . direction ; var offsetDirection = ( direction === 0 ? 1 : 0 ) ; var positionTransform = Transform . identity ; var rowTransform = Transform . identity ; var currentPosition = currentObj . position [ offsetDirection ] ; var previousPosition = previousObj . position [ offsetDirection ] ; var currentMax = currentObj . position [ direction ] ; var previousMax = previousObj . position [ direction ] ; var currentRow = currentObj . row ; var previousRow = previousObj . row ; var vectorPos = [ 0 , 0 , 0 ] ; if ( currentPosition > previousPosition ) { vectorPos [ offsetDirection ] = - ( currentPosition - previousPosition ) ; positionTransform = Transform . translate . apply ( null , vectorPos ) ; } else if ( previousPosition > currentPosition ) { vectorPos [ offsetDirection ] = previousPosition - currentPosition ; positionTransform = Transform . translate . apply ( null , vectorPos ) ; } var vectorRow = [ 0 , 0 , 0 ] ; if ( currentRow > previousRow ) { vectorRow [ direction ] = - previousMax ; rowTransform = Transform . translate . apply ( null , vectorRow ) ; } else if ( previousRow > currentRow ) { vectorRow [ direction ] = currentMax ; rowTransform = Transform . translate . apply ( null , vectorRow ) ; } return Transform . multiply ( positionTransform , rowTransform ) ; }
Helper function to return a transformation matrix representing the previous position
 @param {Object} previousObj has two properties: position and row.
Helper function to return a transformation matrix representing the previous position @param { Object } previousObj has two properties : position and row .
// _getPreviousPosition.call(this, previousObj, currentObj) - where 'this' is an instance of reflowable scrollview // calculate the row data separately, cannot be part of the same if/else chain