mirror of
https://github.com/photonstorm/phaser
synced 2024-11-26 22:52:14 +00:00
Change GetBounds() output to Rectangle
This commit is contained in:
parent
4eb5a180a7
commit
22f6f08058
1 changed files with 3 additions and 2 deletions
|
@ -8,6 +8,7 @@ var GetBottom = require('./GetBottom');
|
||||||
var GetLeft = require('./GetLeft');
|
var GetLeft = require('./GetLeft');
|
||||||
var GetRight = require('./GetRight');
|
var GetRight = require('./GetRight');
|
||||||
var GetTop = require('./GetTop');
|
var GetTop = require('./GetTop');
|
||||||
|
var Rectangle = require('../../geom/rectangle/Rectangle');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the unrotated bounds of the Game Object as a rectangle.
|
* Returns the unrotated bounds of the Game Object as a rectangle.
|
||||||
|
@ -16,13 +17,13 @@ var GetTop = require('./GetTop');
|
||||||
* @since 3.24.0
|
* @since 3.24.0
|
||||||
*
|
*
|
||||||
* @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from.
|
* @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from.
|
||||||
* @param {(Phaser.Geom.Rectangle|object)} [output] - An object to store the values in.
|
* @param {(Phaser.Geom.Rectangle|object)} [output] - An object to store the values in. If not provided a new Rectangle will be created.
|
||||||
*
|
*
|
||||||
* @return {(Phaser.Geom.Rectangle|object)} - The bounds of the Game Object.
|
* @return {(Phaser.Geom.Rectangle|object)} - The bounds of the Game Object.
|
||||||
*/
|
*/
|
||||||
var GetBounds = function (gameObject, output)
|
var GetBounds = function (gameObject, output)
|
||||||
{
|
{
|
||||||
if (output === undefined) { output = {}; }
|
if (output === undefined) { output = new Rectangle(); }
|
||||||
|
|
||||||
var left = GetLeft(gameObject);
|
var left = GetLeft(gameObject);
|
||||||
var top = GetTop(gameObject);
|
var top = GetTop(gameObject);
|
||||||
|
|
Loading…
Reference in a new issue