Add Camera#centerX, Camera#centerY

This commit is contained in:
samme 2018-05-20 12:59:55 -07:00
parent 9875318f20
commit 68ebce077e

View file

@ -1284,6 +1284,40 @@ var Camera = new Class({
this._bounds = null;
this.scene = null;
},
/**
* The x position of the center of the Camera's viewport, relative to the top-left of the game canvas.
*
* @name Phaser.Cameras.Scene2D.Camera#centerX
* @type {number}
* @readOnly
* @since 3.10.0
*/
centerX: {
get: function ()
{
return this.x + (0.5 * this.width);
}
},
/**
* The y position of the center of the Camera's viewport, relative to the top-left of the game canvas.
*
* @name Phaser.Cameras.Scene2D.Camera#centerY
* @type {number}
* @readOnly
* @since 3.10.0
*/
centerY: {
get: function ()
{
return this.y + (0.5 * this.height);
}
}
});