From 90b1c47c3e98f874099df20d643152b432b442a7 Mon Sep 17 00:00:00 2001 From: Ray Schamp Date: Tue, 18 Sep 2018 15:21:01 -0400 Subject: [PATCH] Add getter for the renderer's canvas Resolves #309 --- src/RenderWebGL.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/RenderWebGL.js b/src/RenderWebGL.js index 91e17e8..c6c7efa 100644 --- a/src/RenderWebGL.js +++ b/src/RenderWebGL.js @@ -201,6 +201,13 @@ class RenderWebGL extends EventEmitter { return this._gl; } + /** + * @returns {HTMLCanvasElement} the canvas of the WebGL rendering context associated with this renderer. + */ + get canvas () { + return this._gl && this._gl.canvas; + } + /** * Set the physical size of the stage in device-independent pixels. * This will be multiplied by the device's pixel ratio on high-DPI displays.