phaser/src/geom/rectangle/Floor.js

28 lines
792 B
JavaScript
Raw Normal View History

2018-02-12 16:01:20 +00:00
/**
* @author Richard Davey <rich@photonstorm.com>
2020-01-15 12:07:09 +00:00
* @copyright 2020 Photon Storm Ltd.
2019-05-10 15:15:04 +00:00
* @license {@link https://opensource.org/licenses/MIT|MIT License}
2018-02-12 16:01:20 +00:00
*/
2017-10-13 13:11:54 +00:00
/**
2019-10-29 05:50:33 +00:00
* Rounds down (floors) the top left X and Y coordinates of the given Rectangle to the largest integer less than or equal to them
2017-10-13 13:11:54 +00:00
*
* @function Phaser.Geom.Rectangle.Floor
* @since 3.0.0
*
2018-03-27 13:27:08 +00:00
* @generic {Phaser.Geom.Rectangle} O - [rect,$return]
*
2019-10-29 05:50:33 +00:00
* @param {Phaser.Geom.Rectangle} rect - The rectangle to floor the top left X and Y coordinates of
2017-10-13 13:11:54 +00:00
*
2019-10-29 05:50:33 +00:00
* @return {Phaser.Geom.Rectangle} The rectangle that was passed to this function with its coordinates floored.
2017-10-13 13:11:54 +00:00
*/
2016-12-20 17:07:16 +00:00
var Floor = function (rect)
{
rect.x = Math.floor(rect.x);
rect.y = Math.floor(rect.y);
return rect;
};
module.exports = Floor;