phaser/src/geom/rectangle/Contains.js

24 lines
506 B
JavaScript
Raw Normal View History

2017-10-13 13:11:54 +00:00
/**
* [description]
*
* @function Phaser.Geom.Rectangle.Contains
* @since 3.0.0
*
* @param {Phaser.Geom.Rectangle} rect - [description]
* @param {number} x - [description]
* @param {number} y - [description]
*
* @return {boolean} [description]
*/
2016-12-29 00:17:20 +00:00
var Contains = function (rect, x, y)
2016-12-20 17:07:16 +00:00
{
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);
};
2016-12-29 00:17:20 +00:00
module.exports = Contains;