2017-01-02 00:47:16 +00:00
|
|
|
var Contains = require('./Contains');
|
|
|
|
|
2017-10-13 13:11:54 +00:00
|
|
|
/**
|
2018-01-26 04:53:16 +00:00
|
|
|
* Check to see if the Ellipse contains all four points of the given Rectangle object.
|
2017-10-13 13:11:54 +00:00
|
|
|
*
|
|
|
|
* @function Phaser.Geom.Ellipse.ContainsRect
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {Phaser.Geom.Ellipse} ellipse - [description]
|
2018-01-26 04:53:16 +00:00
|
|
|
* @param {Phaser.Geom.Rectangle|object} rect - The Rectangle object to check if it's within the Ellipse or not.
|
2017-10-13 13:11:54 +00:00
|
|
|
*
|
2018-01-26 04:53:16 +00:00
|
|
|
* @return {boolean} True if all of the Rectangle coordinates are within the ellipse, otherwise false.
|
2017-10-13 13:11:54 +00:00
|
|
|
*/
|
2017-01-02 00:47:16 +00:00
|
|
|
var ContainsRect = function (ellipse, rect)
|
|
|
|
{
|
|
|
|
return (
|
|
|
|
Contains(ellipse, rect.x, rect.y) &&
|
|
|
|
Contains(ellipse, rect.right, rect.y) &&
|
|
|
|
Contains(ellipse, rect.x, rect.bottom) &&
|
|
|
|
Contains(ellipse, rect.right, rect.bottom)
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = ContainsRect;
|