arcade-physics
Version:
Use Arcade Physics without Phaser.
30 lines • 1.26 kB
JavaScript
;
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2020 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Contains_1 = __importDefault(require("./Contains"));
/**
* Check to see if the Circle contains all four points of the given Rectangle object.
*
* @function Phaser.Geom.Circle.ContainsRect
* @since 3.0.0
*
* @param {Phaser.Geom.Circle} circle - The Circle to check.
* @param {(Phaser.Geom.Rectangle|object)} rect - The Rectangle object to check if it's within the Circle or not.
*
* @return {boolean} True if all of the Rectangle coordinates are within the circle, otherwise false.
*/
const ContainsRect = (circle, rect) => {
return ((0, Contains_1.default)(circle, rect.x, rect.y) &&
(0, Contains_1.default)(circle, rect.right, rect.y) &&
(0, Contains_1.default)(circle, rect.x, rect.bottom) &&
(0, Contains_1.default)(circle, rect.right, rect.bottom));
};
exports.default = ContainsRect;
//# sourceMappingURL=ContainsRect.js.map