Get pages working, add to demo

This commit is contained in:
Daniel Imms
2022-10-28 19:30:42 -07:00
parent 67ef455515
commit efba2c9040
7 changed files with 57 additions and 34 deletions
@@ -14,7 +14,7 @@ import { ITerminal } from 'browser/Types';
import { AttributeData } from 'common/buffer/AttributeData';
import { CellData } from 'common/buffer/CellData';
import { Content, NULL_CELL_CHAR, NULL_CELL_CODE } from 'common/buffer/Constants';
import { EventEmitter } from 'common/EventEmitter';
import { EventEmitter, forwardEvent } from 'common/EventEmitter';
import { Disposable, toDisposable } from 'common/Lifecycle';
import { ICoreService, IDecorationService, IOptionsService } from 'common/services/Services';
import { CharData, IBufferLine, ICellData } from 'common/Types';
@@ -49,6 +49,8 @@ export class WebglRenderer extends Disposable implements IRenderer {
private readonly _onChangeTextureAtlas = this.register(new EventEmitter<HTMLCanvasElement>());
public readonly onChangeTextureAtlas = this._onChangeTextureAtlas.event;
private readonly _onAddTextureAtlasCanvas = this.register(new EventEmitter<HTMLCanvasElement>());
public readonly onAddTextureAtlasCanvas = this._onAddTextureAtlasCanvas.event;
private readonly _onRequestRedraw = this.register(new EventEmitter<IRequestRedrawEvent>());
public readonly onRequestRedraw = this._onRequestRedraw.event;
private readonly _onContextLoss = this.register(new EventEmitter<void>());
@@ -262,6 +264,8 @@ export class WebglRenderer extends Disposable implements IRenderer {
);
if (this._charAtlas !== atlas) {
this._onChangeTextureAtlas.fire(atlas.pages[0].canvas);
// TODO: Dispose this when there's a new atlas
forwardEvent(atlas.onAddTextureAtlasCanvas, this._onAddTextureAtlasCanvas);
}
this._charAtlas = atlas;
this._charAtlas.warmUp();