source/sortable-helper.js
function (pos, event) {
          // mouse position last events
          pos.lastX = pos.nowX;
          pos.lastY = pos.nowY;

          // mouse position this events
          pos.nowX = event.pageX;
          pos.nowY = event.pageY;

          // distance mouse moved between events
          pos.distX = pos.nowX - pos.lastX;
          pos.distY = pos.nowY - pos.lastY;

          // direction mouse was moving
          pos.lastDirX = pos.dirX;
          pos.lastDirY = pos.dirY;

          // direction mouse is now moving (on both axis)
          pos.dirX = pos.distX === 0 ? 0 : pos.distX > 0 ? 1 : -1;
          pos.dirY = pos.distY === 0 ? 0 : pos.distY > 0 ? 1 : -1;

          // axis mouse is now moving on
          var newAx = Math.abs(pos.distX) > Math.abs(pos.distY) ? 1 : 0;

          // calc distance moved on this axis (and direction)
          if (pos.dirAx !== newAx) {
            pos.distAxX = 0;
            pos.distAxY = 0;
          } else {
            pos.distAxX += Math.abs(pos.distX);
            if (pos.dirX !== 0 && pos.dirX !== pos.lastDirX) {
              pos.distAxX = 0;
            }

            pos.distAxY += Math.abs(pos.distY);
            if (pos.dirY !== 0 && pos.dirY !== pos.lastDirY) {
              pos.distAxY = 0;
            }
          }
          pos.dirAx = newAx;
        }
function (pos, event) {
          // mouse position last events
          pos.lastX = pos.nowX;
          pos.lastY = pos.nowY;

          // mouse position this events
          pos.nowX = event.pageX;
          pos.nowY = event.pageY;

          // distance mouse moved between events
          pos.distX = pos.nowX - pos.lastX;
          pos.distY = pos.nowY - pos.lastY;

          // direction mouse was moving
          pos.lastDirX = pos.dirX;
          pos.lastDirY = pos.dirY;

          // direction mouse is now moving (on both axis)
          pos.dirX = pos.distX === 0 ? 0 : pos.distX > 0 ? 1 : -1;
          pos.dirY = pos.distY === 0 ? 0 : pos.distY > 0 ? 1 : -1;

          // axis mouse is now moving on
          var newAx = Math.abs(pos.distX) > Math.abs(pos.distY) ? 1 : 0;

          // calc distance moved on this axis (and direction)
          if (pos.dirAx !== newAx) {
            pos.distAxX = 0;
            pos.distAxY = 0;
          } else {
            pos.distAxX += Math.abs(pos.distX);
            if (pos.dirX !== 0 && pos.dirX !== pos.lastDirX) {
              pos.distAxX = 0;
            }

            pos.distAxY += Math.abs(pos.distY);
            if (pos.dirY !== 0 && pos.dirY !== pos.lastDirY) {
              pos.distAxY = 0;
            }
          }
          pos.dirAx = newAx;
        }
function ( pos , event ) { // mouse position last events pos . lastX = pos . nowX ; pos . lastY = pos . nowY ; // mouse position this events pos . nowX = event . pageX ; pos . nowY = event . pageY ; // distance mouse moved between events pos . distX = pos . nowX - pos . lastX ; pos . distY = pos . nowY - pos . lastY ; // direction mouse was moving pos . lastDirX = pos . dirX ; pos . lastDirY = pos . dirY ; // direction mouse is now moving (on both axis) pos . dirX = pos . distX === 0 ? 0 : pos . distX > 0 ? 1 : - 1 ; pos . dirY = pos . distY === 0 ? 0 : pos . distY > 0 ? 1 : - 1 ; // axis mouse is now moving on var newAx = Math . abs ( pos . distX ) > Math . abs ( pos . distY ) ? 1 : 0 ; // calc distance moved on this axis (and direction) if ( pos . dirAx !== newAx ) { pos . distAxX = 0 ; pos . distAxY = 0 ; } else { pos . distAxX += Math . abs ( pos . distX ) ; if ( pos . dirX !== 0 && pos . dirX !== pos . lastDirX ) { pos . distAxX = 0 ; } pos . distAxY += Math . abs ( pos . distY ) ; if ( pos . dirY !== 0 && pos . dirY !== pos . lastDirY ) { pos . distAxY = 0 ; } } pos . dirAx = newAx ; }
Calculates the event position and sets the direction
properties.

@param pos the current position of the element.
@param event the move event.
Calculates the event position and sets the direction properties .