diff --git a/src/extras/cacheAsBitmap.js b/src/extras/cacheAsBitmap.js index c047b51..dc946f4 100644 --- a/src/extras/cacheAsBitmap.js +++ b/src/extras/cacheAsBitmap.js @@ -9,6 +9,7 @@ DisplayObject.prototype._originalRenderWebGL = false; DisplayObject.prototype._originalUpdateTransform = null; +DisplayObject.prototype._originalHitTest = null; DisplayObject.prototype._cachedSprite = null; @@ -33,9 +34,11 @@ { this._originalRenderWebGL = this.renderWebGL; this._originalUpdateTransform = this.updateTransform; + this._originalHitTest = this.hitTest; this.renderWebGL = this._renderCachedWebGL; this.updateTransform = this.displayObjectUpdateTransform; + } else { @@ -46,6 +49,7 @@ this.renderWebGL = this._originalRenderWebGL; this.updateTransform = this._originalUpdateTransform; + this.hitTest = this._originalHitTest; } } } @@ -97,6 +101,7 @@ this._cachedSprite.worldTransform = this.worldTransform; this._cachedSprite.anchor.x = -( bounds.x / bounds.width ); this._cachedSprite.anchor.y = -( bounds.y / bounds.height ); + this.hitTest = this._cachedSprite.hitTest.bind(this._cachedSprite); }; DisplayObject.prototype._destroyCachedDisplayObject = function()