phaser/src/geom/rectangle/Offset.js

30 lines
797 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
/**
* Nudges (translates) the top left corner of a Rectangle by a given offset.
2017-10-13 13:11:54 +00:00
*
* @function Phaser.Geom.Rectangle.Offset
* @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.
* @param {number} x - The distance to move the Rectangle horizontally.
* @param {number} y - The distance to move the Rectangle vertically.
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-28 23:41:02 +00:00
var Offset = function (rect, x, y)
{
rect.x += x;
rect.y += y;
return rect;
};
module.exports = Offset;