Allow renderer to be swapped in and out at runtime

Fixes #1589
This commit is contained in:
Daniel Imms
2018-07-29 13:50:45 -07:00
parent 6691f80906
commit 5aaf9ef11b
7 changed files with 62 additions and 12 deletions
+4
View File
@@ -36,6 +36,10 @@ export abstract class BaseRenderLayer implements IRenderLayer {
this._container.appendChild(this._canvas);
}
public dispose(): void {
this._container.removeChild(this._canvas);
}
private _initCanvas(): void {
this._ctx = this._canvas.getContext('2d', {alpha: this._alpha});
// Draw the background if this is an opaque layer