From eb086dfd7430f63603b0f37958c5127159c2a7e4 Mon Sep 17 00:00:00 2001 From: Leon van Kammen Date: Tue, 24 Sep 2024 14:27:48 +0000 Subject: [PATCH] xterm fix --- com/isoterminal/feat/xterm.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/com/isoterminal/feat/xterm.js b/com/isoterminal/feat/xterm.js index 2b05ac7..c771944 100644 --- a/com/isoterminal/feat/xterm.js +++ b/com/isoterminal/feat/xterm.js @@ -27,15 +27,24 @@ ISOTerminal.prototype.xtermInit = function(){ }) term.onRender( () => { + return + // xterm relies on requestAnimationFrame (which does not called in immersive mode) let _window = term._core._coreBrowserService._window if( !_window.requestAnimationFrameAFRAME ){ // patch the planet! - // xterm relies on requestAnimationFrame (which does not called in immersive mode) - _window.requestAnimationFrameAFRAME = - AFRAME.utils.throttleLeadingAndTrailing( function(cb){ + _window.requestAnimationFrameAFRAME = function(cb){ + if( term.tid != null ) clearTimeout(term.tid) + term.tid = setTimeout( function(){ + console.log("render") cb() - },150 ) + term.tid = null + },100) + } + //_window.requestAnimationFrameAFRAME = + // AFRAME.utils.throttleLeadingAndTrailing( function(cb){ + // cb() + // },150 ) // we proxy the _window object of xterm, and reroute // requestAnimationFrame to requestAnimationFrameAFRAME