diff --git a/src/core/textures/Texture.js b/src/core/textures/Texture.js index c178207..bdb3f18 100644 --- a/src/core/textures/Texture.js +++ b/src/core/textures/Texture.js @@ -92,20 +92,6 @@ this._uvs = null; /** - * The width of the Texture in pixels. - * - * @member {number} - */ - this.width = 0; - - /** - * The height of the Texture in pixels. - * - * @member {number} - */ - this.height = 0; - - /** * This is the area of original texture, before it was put in atlas * * @member {PIXI.Rectangle} @@ -178,9 +164,8 @@ //this.valid = frame && frame.width && frame.height && this.baseTexture.source && this.baseTexture.hasLoaded; this.valid = frame && frame.width && frame.height && this.baseTexture.hasLoaded; - if (!this.trim) { - this.width = frame.width; - this.height = frame.height; + if (!this.trim) + { this.crop = frame; } @@ -212,6 +197,28 @@ this._updateUvs(); } } + }, + + /** + * The width of the Texture in pixels. + * + * @member {number} + */ + width: { + get: function() { + return this.crop ? this.crop.width : 0; + } + }, + + /** + * The height of the Texture in pixels. + * + * @member {number} + */ + height: { + get: function() { + return this.crop ? this.crop.height : 0; + } } });