From b1c74e694e1c52d36e0b52a5928c5bc3d44bb90a Mon Sep 17 00:00:00 2001 From: fillmoreb Date: Thu, 25 Feb 2016 11:58:22 -0700 Subject: [PATCH] Update World.js Phaser.World.centerX and Phaser.World.centerY only worked if the bounds had an origin of 0,0. This change takes into account the actual origin. --- src/core/World.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/World.js b/src/core/World.js index e67ccd102..a18c9b668 100644 --- a/src/core/World.js +++ b/src/core/World.js @@ -299,7 +299,7 @@ Object.defineProperty(Phaser.World.prototype, "height", { Object.defineProperty(Phaser.World.prototype, "centerX", { get: function () { - return this.bounds.halfWidth; + return this.bounds.halfWidth + this.bounds.x; } }); @@ -312,7 +312,7 @@ Object.defineProperty(Phaser.World.prototype, "centerX", { Object.defineProperty(Phaser.World.prototype, "centerY", { get: function () { - return this.bounds.halfHeight; + return this.bounds.halfHeight + this.bounds.y; } });