From 22f6f080580fe1310d2e63f3ca84ec65ecfa1774 Mon Sep 17 00:00:00 2001 From: samme Date: Fri, 24 Mar 2023 18:04:48 -0700 Subject: [PATCH] Change GetBounds() output to Rectangle --- src/display/bounds/GetBounds.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/display/bounds/GetBounds.js b/src/display/bounds/GetBounds.js index 4bf7ef184..cf981e902 100644 --- a/src/display/bounds/GetBounds.js +++ b/src/display/bounds/GetBounds.js @@ -8,6 +8,7 @@ var GetBottom = require('./GetBottom'); var GetLeft = require('./GetLeft'); var GetRight = require('./GetRight'); var GetTop = require('./GetTop'); +var Rectangle = require('../../geom/rectangle/Rectangle'); /** * Returns the unrotated bounds of the Game Object as a rectangle. @@ -16,13 +17,13 @@ var GetTop = require('./GetTop'); * @since 3.24.0 * * @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. */ var GetBounds = function (gameObject, output) { - if (output === undefined) { output = {}; } + if (output === undefined) { output = new Rectangle(); } var left = GetLeft(gameObject); var top = GetTop(gameObject);