diff --git a/src/core/textures/Texture.js b/src/core/textures/Texture.js index 49f668e..8a91c09 100644 --- a/src/core/textures/Texture.js +++ b/src/core/textures/Texture.js @@ -20,6 +20,7 @@ */ function Texture(baseTexture, frame, crop, trim, rotate) { + console.log(trim, frame, crop, "......") /** * Does this Texture have any frame data assigned to it? * @@ -159,6 +160,7 @@ if (this.trim) { + this.width = this.trim.width; this.height = this.trim.height; this._frame.width = this.trim.width; @@ -258,6 +260,19 @@ return texture; }; + +Texture.fromFrame = function (frameId) +{ + var texture = utils.TextureCache[frameId]; + + if (!texture) + { + throw new Error('The frameId "' + frameId + '" does not exist in the texture cache' + this); + } + + return texture; +}; + /** * Helper function that creates a new Texture based on the given canvas element. *