mirror of
https://github.com/photonstorm/phaser
synced 2024-11-16 01:38:23 +00:00
sourceWidth / Height now only set from the texture if the object has a texture.
This commit is contained in:
parent
1486e166bd
commit
b07ce89236
1 changed files with 18 additions and 14 deletions
|
@ -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);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue