src/core/dom/layout/rect.js
/**
 * Returns the intersection between a, b or null if there is none.
 * @param {...?LayoutRectDef|undefined} var_args
 * @return {?LayoutRectDef}
 */
Returns the intersection between a, b or null if there is none.
Returns the intersection between a b or null if there is none .
function rectIntersection(var_args) {
  let x0 = -Infinity;
  let x1 = Infinity;
  let y0 = -Infinity;
  let y1 = Infinity;
  for (let i = 0; i < arguments.length; i++) {
    const current = arguments[i];
    if (!current) {
      continue;
    }
    x0 = Math.max(x0, current.left);
    x1 = Math.min(x1, current.left + current.width);
    y0 = Math.max(y0, current.top);
    y1 = Math.min(y1, current.top + current.height);
    if (x1 < x0 || y1 < y0) {
      return null;
    }
  }
  if (x1 == Infinity) {
    return null;
  }
  return layoutRectLtwh(x0, y0, x1 - x0, y1 - y0);
}
function rectIntersection ( var_args ) { let x0 = - Infinity ; let x1 = Infinity ; let y0 = - Infinity ; let y1 = Infinity ; for ( let i = 0 ; i < arguments . length ; i ++ ) { const current = arguments [ i ] ; if ( ! current ) { continue ; } x0 = Math . max ( x0 , current . left ) ; x1 = Math . min ( x1 , current . left + current . width ) ; y0 = Math . max ( y0 , current . top ) ; y1 = Math . min ( y1 , current . top + current . height ) ; if ( x1 < x0 || y1 < y0 ) { return null ; } } if ( x1 == Infinity ) { return null ; } return layoutRectLtwh ( x0 , y0 , x1 - x0 , y1 - y0 ) ; }
Returns the intersection between a, b or null if there is none.
Returns the intersection between a b or null if there is none .