function _getNewOffset(pos, zeroPos, maxOffset) {
        var offset = pos - zeroPos;
        offset = Math.min(maxOffset, Math.max(0, offset));
        return offset;
    }
Converts a mouse coordinate to be relative to zeroPos, and clips to [0, maxOffset]