build/out.js
/*
 * detect which column is nearest to a mouse event
 * @param  {Grid}   grid the hypergrid-lite object
 * @param  {Event}  evt  the mouse event to look near
 * @return {object}      object with nearest column, its dimensions and index
 */
detect which column is nearest to a mouse event
@param  {Grid}   grid the hypergrid-lite object
@param  {Event}  evt  the mouse event to look near
@return {object}      object with nearest column, its dimensions and index
detect which column is nearest to a mouse event @param { Grid } grid the hypergrid - lite object @param { Event } evt the mouse event to look near @return { object } object with nearest column its dimensions and index
function detectNearestColumn(grid, evt) {
    var column;
    var columns = grid.getColumns();
    var headerCanvas = grid.getHeaderCanvas();
    var renderedRange = grid.getRenderedRowRange();
    var headerRect = getOffsetRect(headerCanvas);
    var columnLeft = headerRect.left;
    var columnRight = headerRect.left;
    var indexOfNearestColumn = columns.length - 1;
    for(var c = renderedRange.left; c < columns.length; c++) {
        column = columns[c];
        columnLeft = columnRight;
        columnRight += column.getWidth();
        if(evt.pageX < columnRight) {
            indexOfNearestColumn = c;
            break;
        }
    }
    return {
        column: column,
        columnLeft: columnLeft,
        columnRight: columnRight,
        index: indexOfNearestColumn
    }
}
function detectNearestColumn ( grid , evt ) { var column ; var columns = grid . getColumns ( ) ; var headerCanvas = grid . getHeaderCanvas ( ) ; var renderedRange = grid . getRenderedRowRange ( ) ; var headerRect = getOffsetRect ( headerCanvas ) ; var columnLeft = headerRect . left ; var columnRight = headerRect . left ; var indexOfNearestColumn = columns . length - 1 ; for ( var c = renderedRange . left ; c < columns . length ; c ++ ) { column = columns [ c ] ; columnLeft = columnRight ; columnRight += column . getWidth ( ) ; if ( evt . pageX < columnRight ) { indexOfNearestColumn = c ; break ; } } return { column : column , columnLeft : columnLeft , columnRight : columnRight , index : indexOfNearestColumn } }
detect which column is nearest to a mouse event
 @param  {Grid}   grid the hypergrid-lite object
 @param  {Event}  evt  the mouse event to look near
 @return {object}      object with nearest column, its dimensions and index
detect which column is nearest to a mouse event @param { Grid } grid the hypergrid - lite object @param { Event } evt the mouse event to look near @return { object } object with nearest column its dimensions and index
// Note: when no column matches this condition, // `indexOfNearestColumn` will be the last column.