mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
fallback to canvas renderer on webgl context loss
This commit is contained in:
parent
bb0c98f0f6
commit
7cb40b952d
1 changed files with 8 additions and 2 deletions
|
|
@ -215,12 +215,18 @@ export default class Term extends React.PureComponent<
|
|||
this.term.open(this.termRef);
|
||||
|
||||
if (useWebGL) {
|
||||
this.term.loadAddon(new WebglAddon());
|
||||
const webglAddon = new WebglAddon();
|
||||
this.term.loadAddon(webglAddon);
|
||||
webglAddon.onContextLoss(() => {
|
||||
console.warn('WebGL context lost. Falling back to canvas-based rendering.');
|
||||
webglAddon.dispose();
|
||||
this.term.loadAddon(new CanvasAddon());
|
||||
});
|
||||
} else {
|
||||
this.term.loadAddon(new CanvasAddon());
|
||||
}
|
||||
|
||||
if (props.disableLigatures !== true) {
|
||||
if (props.disableLigatures !== true && !useWebGL) {
|
||||
this.term.loadAddon(new LigaturesAddon());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue