diff --git a/src/pixi/renderers/canvas/CanvasRenderer.js b/src/pixi/renderers/canvas/CanvasRenderer.js index c3fabda..1beb8ab 100644 --- a/src/pixi/renderers/canvas/CanvasRenderer.js +++ b/src/pixi/renderers/canvas/CanvasRenderer.js @@ -104,7 +104,7 @@ /** * The canvas 2d context that everything is drawn with * @property context - * @type CanvasRenderingContext2D 2d Context + * @type CanvasRenderingContext2D */ this.context = this.view.getContext( "2d", { alpha: this.transparent } ); @@ -221,6 +221,28 @@ }; /** + * Removes everything from the renderer and optionally removes the Canvas DOM element. + * + * @method destroy + * @param [removeView=true] {boolean} Removes the Canvas element from the DOM. + */ +PIXI.CanvasRenderer.prototype.destroy = function(removeView) +{ + if (typeof removeView === 'undefined') { removeView = true; } + + if (removeView && this.view.parent) + { + this.view.parent.removeChild(this.view); + } + + this.view = null; + this.context = null; + this.maskManager = null; + this.renderSession = null; + +}; + +/** * Resizes the canvas view to the specified width and height * * @method resize