Stub canvas addon

This commit is contained in:
Daniel Imms
2022-07-27 09:26:52 -07:00
parent 440ab765c4
commit ab7da06cc1
11 changed files with 249 additions and 0 deletions
@@ -0,0 +1,49 @@
/**
* Copyright (c) 2022 The xterm.js authors. All rights reserved.
* @license MIT
*/
import { ITerminalAddon, Terminal } from 'xterm';
export class CanvasAddon implements ITerminalAddon {
private _terminal?: Terminal;
// private _renderer?: WebglRenderer;
// private _onContextLoss = new EventEmitter<void>();
// public get onContextLoss(): IEvent<void> { return this._onContextLoss.event; }
public activate(terminal: Terminal): void {
// if (!terminal.element) {
// throw new Error('Cannot activate WebglAddon before Terminal.open');
// }
// if (isSafari) {
// throw new Error('Webgl is not currently supported on Safari');
// }
this._terminal = terminal;
// const renderService: IRenderService = (terminal as any)._core._renderService;
// const characterJoinerService: ICharacterJoinerService = (terminal as any)._core._characterJoinerService;
// const decorationService: IDecorationService = (terminal as any)._core._decorationService;
// const colors: IColorSet = (terminal as any)._core._colorManager.colors;
// this._renderer = new WebglRenderer(terminal, colors, characterJoinerService, decorationService, this._preserveDrawingBuffer);
// this._renderer.onContextLoss(() => this._onContextLoss.fire());
// renderService.setRenderer(this._renderer);
}
public dispose(): void {
// if (!this._terminal) {
// throw new Error('Cannot dispose WebglAddon because it is activated');
// }
// const renderService: IRenderService = (this._terminal as any)._core._renderService;
// renderService.setRenderer((this._terminal as any)._core._createRenderer());
// renderService.onResize(this._terminal.cols, this._terminal.rows);
// this._renderer?.dispose();
// this._renderer = undefined;
}
// public get textureAtlas(): HTMLCanvasElement | undefined {
// return this._renderer?.textureAtlas;
// }
// public clearTextureAtlas(): void {
// this._renderer?.clearCharAtlas();
// }
}
@@ -0,0 +1,40 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"lib": [
"dom",
"es6",
],
"rootDir": ".",
"outDir": "../out",
"sourceMap": true,
"removeComments": true,
"baseUrl": ".",
"paths": {
"common/*": [
"../../../src/common/*"
],
"browser/*": [
"../../../src/browser/*"
]
},
"strict": true,
"downlevelIteration": true,
"types": [
"../../../node_modules/@types/mocha"
]
},
"include": [
"./**/*",
"../../../typings/xterm.d.ts"
],
"references": [
{
"path": "../../../src/common"
},
{
"path": "../../../src/browser"
}
]
}