-
Notifications
You must be signed in to change notification settings - Fork 7.1k
/
GetBounds.js
34 lines (29 loc) · 1009 Bytes
/
GetBounds.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**
* @author Richard Davey <rich@phaser.io>
* @copyright 2013-2024 Phaser Studio Inc.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
var Rectangle = require('../rectangle/Rectangle');
/**
* Returns the bounds of the Ellipse object.
*
* @function Phaser.Geom.Ellipse.GetBounds
* @since 3.0.0
*
* @generic {Phaser.Geom.Rectangle} O - [out,$return]
*
* @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to get the bounds from.
* @param {(Phaser.Geom.Rectangle|object)} [out] - A Rectangle, or rectangle-like object, to store the ellipse bounds in. If not given a new Rectangle will be created.
*
* @return {(Phaser.Geom.Rectangle|object)} The Rectangle object containing the Ellipse bounds.
*/
var GetBounds = function (ellipse, out)
{
if (out === undefined) { out = new Rectangle(); }
out.x = ellipse.left;
out.y = ellipse.top;
out.width = ellipse.width;
out.height = ellipse.height;
return out;
};
module.exports = GetBounds;