2018-02-12 16:01:20 +00:00
|
|
|
/**
|
|
|
|
* @author Richard Davey <rich@photonstorm.com>
|
|
|
|
* @copyright 2018 Photon Storm Ltd.
|
|
|
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
|
|
|
*/
|
|
|
|
|
2016-12-29 00:17:20 +00:00
|
|
|
var Contains = require('./Contains');
|
|
|
|
|
2017-10-04 23:58:42 +00:00
|
|
|
/**
|
2018-01-26 04:18:22 +00:00
|
|
|
* Check to see if the Circle contains all four points of the given Rectangle object.
|
2017-10-04 23:58:42 +00:00
|
|
|
*
|
|
|
|
* @function Phaser.Geom.Circle.ContainsRect
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
2018-01-26 04:18:22 +00:00
|
|
|
* @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.
|
2017-10-13 13:11:54 +00:00
|
|
|
*
|
2018-01-26 04:18:22 +00:00
|
|
|
* @return {boolean} True if all of the Rectangle coordinates are within the circle, otherwise false.
|
2017-10-04 23:58:42 +00:00
|
|
|
*/
|
2016-12-29 00:17:20 +00:00
|
|
|
var ContainsRect = function (circle, rect)
|
|
|
|
{
|
|
|
|
return (
|
|
|
|
Contains(circle, rect.x, rect.y) &&
|
|
|
|
Contains(circle, rect.right, rect.y) &&
|
|
|
|
Contains(circle, rect.x, rect.bottom) &&
|
|
|
|
Contains(circle, rect.right, rect.bottom)
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = ContainsRect;
|