UNPKG

@phaserjs/phaser

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