How to use the vega-scenegraph.CanvasHandler.prototype function in vega-scenegraph

To help you get started, we’ve selected a few vega-scenegraph examples, based on popular ways it is used in public projects.

github vega / vega-webgl-renderer / index.js View on Github external
import {CanvasHandler, renderModule} from 'vega-scenegraph';
import {default as WebGLRenderer} from './src/WebGLRenderer';

// Patch CanvasHandler
CanvasHandler.prototype.context = function() {
  return this._canvas.getContext('2d') || this._canvas._textCanvas.getContext('2d');
};

renderModule('webgl', {handler: CanvasHandler, renderer: WebGLRenderer});

export {WebGLRenderer};