diff --git a/src/extras/cacheAsBitmap.js b/src/extras/cacheAsBitmap.js index 3ea836c..f6f5b31 100644 --- a/src/extras/cacheAsBitmap.js +++ b/src/extras/cacheAsBitmap.js @@ -37,6 +37,9 @@ this._originalRenderCanvas = this.renderCanvas; this._originalUpdateTransform = this.updateTransform; + this._originalGetBounds = this.getBounds; + + this._originalHitTest = this.hitTest; this.renderWebGL = this._renderCachedWebGL; @@ -54,6 +57,7 @@ this.renderWebGL = this._originalRenderWebGL; this.renderCanvas = this._originalRenderCanvas; + this.getBounds = this._originalGetBounds this.updateTransform = this._originalUpdateTransform; this.hitTest = this._originalHitTest; @@ -102,6 +106,9 @@ renderer.setRenderTarget(cachedRenderTarget); this.renderWebGL = this._renderCachedWebGL; + this.getBounds = this._getCahcedBounds; + + this._cacheAsBitmap = true; // create our cached sprite @@ -153,6 +160,9 @@ renderer.context = cachedRenderTarget; this.renderCanvas = this._renderCachedCanvas; + this.getBounds = this._getCahcedBounds; + + this._cacheAsBitmap = true; // create our cached sprite @@ -163,6 +173,10 @@ this.hitTest = this._cachedSprite.hitTest.bind(this._cachedSprite); }; +DisplayObject.prototype._getCahcedBounds = function() +{ + return this._cachedSprite.getBounds(); +} DisplayObject.prototype._destroyCachedDisplayObject = function() {