UNPKG

@phaserjs/phaser

Version:
12 lines (11 loc) 540 B
/** * @author Richard Davey <rich@photonstorm.com> * @copyright 2020 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ export function RectangleContainsRectangle(rectA, rectB) { if (rectB.width * rectB.height > rectA.width * rectA.height) { return false; } return rectB.x > rectA.x && rectB.x < rectA.right && (rectB.right > rectA.x && rectB.right < rectA.right) && (rectB.y > rectA.y && rectB.y < rectA.bottom) && (rectB.bottom > rectA.y && rectB.bottom < rectA.bottom); }