From c6e3cc007cd024506321def1523d65ef265025eb Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Sat, 29 Oct 2022 12:49:11 -0700 Subject: [PATCH] Stop atlas flickering on demo --- demo/client.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/demo/client.ts b/demo/client.ts index 3829b6dd..3c8a2919 100644 --- a/demo/client.ts +++ b/demo/client.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-restricted-syntax */ /** * Copyright (c) 2018 The xterm.js authors. All rights reserved. * @license MIT @@ -650,11 +651,17 @@ function htmlSerializeButtonHandler(): void { } function setTextureAtlas(e: HTMLCanvasElement): void { + styleAtlasPage(e); document.querySelector('#texture-atlas').replaceChildren(e); } function appendTextureAtlas(e: HTMLCanvasElement): void { + styleAtlasPage(e); document.querySelector('#texture-atlas').appendChild(e); } +function styleAtlasPage(e: HTMLCanvasElement): void { + e.style.width = `${e.width / window.devicePixelRatio}px`; + e.style.height = `${e.height / window.devicePixelRatio}px`; +} function writeCustomGlyphHandler(): void { term.write('\n\r');