Skip to content

Commit a8ae5a0

Browse files
committed
Merge pull request phaserjs#2353 from fillmoreb/patch-1
Fix for world.centerX and world.centerY with negative bounds origin.
2 parents e21ec2f + b1c74e6 commit a8ae5a0

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/core/World.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ Object.defineProperty(Phaser.World.prototype, "height", {
299299
Object.defineProperty(Phaser.World.prototype, "centerX", {
300300

301301
get: function () {
302-
return this.bounds.halfWidth;
302+
return this.bounds.halfWidth + this.bounds.x;
303303
}
304304

305305
});
@@ -312,7 +312,7 @@ Object.defineProperty(Phaser.World.prototype, "centerX", {
312312
Object.defineProperty(Phaser.World.prototype, "centerY", {
313313

314314
get: function () {
315-
return this.bounds.halfHeight;
315+
return this.bounds.halfHeight + this.bounds.y;
316316
}
317317

318318
});

0 commit comments

Comments
 (0)