sourceWidth / Height now only set from the texture if the object has a texture.

This commit is contained in:
photonstorm 2015-03-23 15:05:39 +00:00
parent 1486e166bd
commit b07ce89236

View file

@ -71,18 +71,6 @@ Phaser.Physics.Arcade.Body = function (sprite) {
*/
this.preRotation = sprite.rotation;
/**
* @property {number} sourceWidth - The un-scaled original size.
* @readonly
*/
this.sourceWidth = sprite.texture.frame.width;
/**
* @property {number} sourceHeight - The un-scaled original size.
* @readonly
*/
this.sourceHeight = sprite.texture.frame.height;
/**
* @property {number} width - The calculated width of the physics body.
* @readonly
@ -95,6 +83,24 @@ Phaser.Physics.Arcade.Body = function (sprite) {
*/
this.height = sprite.height;
/**
* @property {number} sourceWidth - The un-scaled original size.
* @readonly
*/
this.sourceWidth = sprite.width;
/**
* @property {number} sourceHeight - The un-scaled original size.
* @readonly
*/
this.sourceHeight = sprite.height;
if (sprite.texture)
{
this.sourceWidth = sprite.texture.frame.width;
this.sourceHeight = sprite.texture.frame.height;
}
/**
* @property {number} halfWidth - The calculated width / 2 of the physics body.
* @readonly
@ -650,9 +656,7 @@ Phaser.Physics.Arcade.Body.prototype = {
* @return {boolean} True if the given coordinates are inside this Body, otherwise false.
*/
hitTest: function (x, y) {
return Phaser.Rectangle.contains(this, x, y);
},
/**