mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Get tests reporting failures again
This commit is contained in:
@@ -43,6 +43,7 @@ import { BellSound } from './utils/Sounds';
|
||||
import { DEFAULT_ANSI_COLORS } from './renderer/ColorManager';
|
||||
import { IMouseZoneManager } from './input/Interfaces';
|
||||
import { MouseZoneManager } from './input/MouseZoneManager';
|
||||
import { initialize as initializeCharAtlas } from './renderer/CharAtlas';
|
||||
|
||||
// Declare for RequireJS in loadAddon
|
||||
declare var define: any;
|
||||
@@ -562,6 +563,8 @@ export class Terminal extends EventEmitter implements ITerminal, IInputHandlingT
|
||||
this.document = this.parent.ownerDocument;
|
||||
this.body = <HTMLBodyElement>this.document.body;
|
||||
|
||||
initializeCharAtlas(this.document);
|
||||
|
||||
// Create main element container
|
||||
this.element = this.document.createElement('div');
|
||||
this.element.classList.add('terminal');
|
||||
|
||||
@@ -91,12 +91,20 @@ function configEquals(a: ICharAtlasConfig, b: ICharAtlasConfig): boolean {
|
||||
a.colors.foreground === b.colors.foreground;
|
||||
}
|
||||
|
||||
let generator: CharAtlasGenerator;
|
||||
|
||||
export function initialize(document: Document): void {
|
||||
if (!generator) {
|
||||
generator = new CharAtlasGenerator(document);
|
||||
}
|
||||
}
|
||||
|
||||
class CharAtlasGenerator {
|
||||
private _canvas: HTMLCanvasElement;
|
||||
private _ctx: CanvasRenderingContext2D;
|
||||
|
||||
constructor() {
|
||||
this._canvas = document.createElement('canvas');
|
||||
constructor(private _document: Document) {
|
||||
this._canvas = this._document.createElement('canvas');
|
||||
this._ctx = this._canvas.getContext('2d');
|
||||
this._ctx.scale(window.devicePixelRatio, window.devicePixelRatio);
|
||||
}
|
||||
@@ -147,7 +155,7 @@ class CharAtlasGenerator {
|
||||
if (!('createImageBitmap' in window)) {
|
||||
// Regenerate canvas and context as they are now owned by the char atlas
|
||||
const result = this._canvas;
|
||||
this._canvas = document.createElement('canvas');
|
||||
this._canvas = this._document.createElement('canvas');
|
||||
this._ctx = this._canvas.getContext('2d');
|
||||
this._ctx.scale(window.devicePixelRatio, window.devicePixelRatio);
|
||||
return result;
|
||||
@@ -159,5 +167,3 @@ class CharAtlasGenerator {
|
||||
return promise;
|
||||
}
|
||||
}
|
||||
|
||||
const generator = new CharAtlasGenerator();
|
||||
|
||||
Reference in New Issue
Block a user