diff --git a/src/core/Group.js b/src/core/Group.js index 0a6a82089..7ad260151 100644 --- a/src/core/Group.js +++ b/src/core/Group.js @@ -2711,11 +2711,6 @@ Object.defineProperty(Phaser.Group.prototype, "angle", { * It is derived by calling `getBounds`, calculating the Groups dimensions based on its * visible children. * -* Note that no ancestors are factored into the result, meaning that if this Group is -* nested within another Group, with heavy transforms on it, the result of this property -* is likely to be incorrect. It is safe to get and set this property if the Group is a -* top-level descendant of Phaser.World, or untransformed parents. -* * @name Phaser.Group#centerX * @property {number} centerX */ @@ -2723,13 +2718,13 @@ Object.defineProperty(Phaser.Group.prototype, "centerX", { get: function () { - return this.getBounds().centerX; + return this.getBounds(this.parent).centerX; }, set: function (value) { - var r = this.getBounds(); + var r = this.getBounds(this.parent); var offset = this.x - r.x; this.x = (value + offset) - r.halfWidth; @@ -2744,11 +2739,6 @@ Object.defineProperty(Phaser.Group.prototype, "centerX", { * It is derived by calling `getBounds`, calculating the Groups dimensions based on its * visible children. * -* Note that no ancestors are factored into the result, meaning that if this Group is -* nested within another Group, with heavy transforms on it, the result of this property -* is likely to be incorrect. It is safe to get and set this property if the Group is a -* top-level descendant of Phaser.World, or untransformed parents. -* * @name Phaser.Group#centerY * @property {number} centerY */ @@ -2756,13 +2746,13 @@ Object.defineProperty(Phaser.Group.prototype, "centerY", { get: function () { - return this.getBounds().centerY; + return this.getBounds(this.parent).centerY; }, set: function (value) { - var r = this.getBounds(); + var r = this.getBounds(this.parent); var offset = this.y - r.y; this.y = (value + offset) - r.halfHeight; @@ -2777,11 +2767,6 @@ Object.defineProperty(Phaser.Group.prototype, "centerY", { * It is derived by calling `getBounds`, calculating the Groups dimensions based on its * visible children. * -* Note that no ancestors are factored into the result, meaning that if this Group is -* nested within another Group, with heavy transforms on it, the result of this property -* is likely to be incorrect. It is safe to get and set this property if the Group is a -* top-level descendant of Phaser.World, or untransformed parents. -* * @name Phaser.Group#left * @property {number} left */ @@ -2789,13 +2774,13 @@ Object.defineProperty(Phaser.Group.prototype, "left", { get: function () { - return this.getBounds().left; + return this.getBounds(this.parent).left; }, set: function (value) { - var r = this.getBounds(); + var r = this.getBounds(this.parent); var offset = this.x - r.x; this.x = value + offset; @@ -2809,11 +2794,6 @@ Object.defineProperty(Phaser.Group.prototype, "left", { * * It is derived by calling `getBounds`, calculating the Groups dimensions based on its * visible children. -* -* Note that no ancestors are factored into the result, meaning that if this Group is -* nested within another Group, with heavy transforms on it, the result of this property -* is likely to be incorrect. It is safe to get and set this property if the Group is a -* top-level descendant of Phaser.World, or untransformed parents. * * @name Phaser.Group#right * @property {number} right @@ -2822,13 +2802,13 @@ Object.defineProperty(Phaser.Group.prototype, "right", { get: function () { - return this.getBounds().right; + return this.getBounds(this.parent).right; }, set: function (value) { - var r = this.getBounds(); + var r = this.getBounds(this.parent); var offset = this.x - r.x; this.x = (value + offset) - r.width; @@ -2842,11 +2822,6 @@ Object.defineProperty(Phaser.Group.prototype, "right", { * * It is derived by calling `getBounds`, calculating the Groups dimensions based on its * visible children. -* -* Note that no ancestors are factored into the result, meaning that if this Group is -* nested within another Group, with heavy transforms on it, the result of this property -* is likely to be incorrect. It is safe to get and set this property if the Group is a -* top-level descendant of Phaser.World, or untransformed parents. * * @name Phaser.Group#top * @property {number} top @@ -2855,13 +2830,13 @@ Object.defineProperty(Phaser.Group.prototype, "top", { get: function () { - return this.getBounds().top; + return this.getBounds(this.parent).top; }, set: function (value) { - var r = this.getBounds(); + var r = this.getBounds(this.parent); var offset = this.y - r.y; this.y = (value + offset); @@ -2876,11 +2851,6 @@ Object.defineProperty(Phaser.Group.prototype, "top", { * It is derived by calling `getBounds`, calculating the Groups dimensions based on its * visible children. * -* Note that no ancestors are factored into the result, meaning that if this Group is -* nested within another Group, with heavy transforms on it, the result of this property -* is likely to be incorrect. It is safe to get and set this property if the Group is a -* top-level descendant of Phaser.World, or untransformed parents. -* * @name Phaser.Group#bottom * @property {number} bottom */ @@ -2888,13 +2858,13 @@ Object.defineProperty(Phaser.Group.prototype, "bottom", { get: function () { - return this.getBounds().bottom; + return this.getBounds(this.parent).bottom; }, set: function (value) { - var r = this.getBounds(); + var r = this.getBounds(this.parent); var offset = this.y - r.y; this.y = (value + offset) - r.height;