function testRectContainsRect(rect1, rect2) {
  if (rectHasNoSize(rect1) || rectHasNoSize(rect2)) {
    return false;
  }
  const points = [
    { x: rect2.x, y: rect2.y },
    { x: rect2.x + rect2.width, y: rect2.y },
    { x: rect2.x + rect2.width, y: rect2.y + rect2.height },
    { x: rect2.x, y: rect2.y + rect2.height },
  ];
  return points.every((p) => testRectPoint(rect1, p));
}
/**
 * Test if a rectangle contains  another rectangle. If so, returns true and false otherwise.
 * Both rectangles must have a width and height greather then 0.
 * @private
 * @param {object} rect
 * @param {number} rect.x - x-coordinate
 * @param {number} rect.y - y-coordinate
 * @param {number} rect.width - width
 * @param {number} rect.height - height
 * @param {object} rect
 * @param {number} rect.x - x-coordinate
 * @param {number} rect.y - y-coordinate
 * @param {number} rect.width - width
 * @param {number} rect.height - height
 * @return {boolean} true if rectangle collide with rectangle
 */
Test if a rectangle contains  another rectangle. If so, returns true and false otherwise.
Both rectangles must have a width and height greather then 0.
Test if a rectangle contains another rectangle . If so returns true and false otherwise . Both rectangles must have a width and height greather then 0 .
function testRectContainsRect(rect1, rect2) {
  if (rectHasNoSize(rect1) || rectHasNoSize(rect2)) {
    return false;
  }
  const points = [
    { x: rect2.x, y: rect2.y },
    { x: rect2.x + rect2.width, y: rect2.y },
    { x: rect2.x + rect2.width, y: rect2.y + rect2.height },
    { x: rect2.x, y: rect2.y + rect2.height },
  ];
  return points.every((p) => testRectPoint(rect1, p));
}
function testRectContainsRect ( rect1 , rect2 ) { if ( rectHasNoSize ( rect1 ) || rectHasNoSize ( rect2 ) ) { return false ; } const points = [ { x : rect2 . x , y : rect2 . y } , { x : rect2 . x + rect2 . width , y : rect2 . y } , { x : rect2 . x + rect2 . width , y : rect2 . y + rect2 . height } , { x : rect2 . x , y : rect2 . y + rect2 . height } , ] ; return points . every ( ( p ) => testRectPoint ( rect1 , p ) ) ; }
Test if a rectangle contains  another rectangle.
Test if a rectangle contains another rectangle .