phaser/src/geom/rectangle/FloorAll.js

30 lines
824 B
JavaScript
Raw Normal View History

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}
*/
2017-10-13 13:11:54 +00:00
/**
* Rounds a Rectangle's position and size down to the largest integer less than or equal to each current coordinate or dimension.
2017-10-13 13:11:54 +00:00
*
* @function Phaser.Geom.Rectangle.FloorAll
* @since 3.0.0
*
2018-03-27 13:27:08 +00:00
* @generic {Phaser.Geom.Rectangle} O - [rect,$return]
*
* @param {Phaser.Geom.Rectangle} rect - The Rectangle to adjust.
2017-10-13 13:11:54 +00:00
*
* @return {Phaser.Geom.Rectangle} The adjusted Rectangle.
2017-10-13 13:11:54 +00:00
*/
2016-12-20 17:07:16 +00:00
var FloorAll = function (rect)
{
rect.x = Math.floor(rect.x);
rect.y = Math.floor(rect.y);
rect.width = Math.floor(rect.width);
rect.height = Math.floor(rect.height);
return rect;
};
module.exports = FloorAll;