2018-02-12 16:01:20 +00:00
|
|
|
/**
|
|
|
|
* @author Richard Davey <rich@photonstorm.com>
|
2019-01-15 16:20:22 +00:00
|
|
|
* @copyright 2019 Photon Storm Ltd.
|
2018-02-12 16:01:20 +00:00
|
|
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
|
|
|
*/
|
|
|
|
|
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
|
|
|
|
*
|
2018-06-21 17:42:40 +00:00
|
|
|
* @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to check.
|
2018-03-20 15:01:08 +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;
|