Skip to content

Commit 2c4f89f

Browse files
[WebGL] Make it optional to use WebGL when creating TimeGraphContainer
Added an entry to TimeGraphContainerOptions, that the caller can use to request that no WebGL context be used for the new TimeGraphContainer: noWebGl?: boolean This can be used when the container is known in advance to be lightweight in terms of rendering, such that using, for it, one of the potentially limited number of available WebGL contexts, is not worth it. Signed-off-by: Marc Dumais <[email protected]>
1 parent b8d6d42 commit 2c4f89f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

timeline-chart/src/time-graph-container.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export interface TimeGraphContainerOptions {
1212
lineColor?: number;
1313
transparent?: boolean;
1414
classNames?: string;
15+
forceCanvasRenderer?: boolean;
1516
}
1617

1718
export class TimeGraphContainer {
@@ -36,7 +37,8 @@ export class TimeGraphContainer {
3637
canvas = extCanvas;
3738
}
3839

39-
const noWebgl2 = !PIXI.utils.isWebGLSupported() || !canvas.getContext('webgl2');
40+
const supported = PIXI.utils.isWebGLSupported();
41+
const noWebgl2 = !supported || config.forceCanvasRenderer || !canvas.getContext('webgl2');
4042
canvas.style.width = config.width + 'px';
4143
canvas.style.height = config.height + 'px';
4244
canvas.width = config.width;

0 commit comments

Comments
 (0)