xterm fix
/ mirror_to_github (push) Successful in 19s Details
/ test (push) Successful in 3s Details

This commit is contained in:
Leon van Kammen 2024-09-24 14:27:48 +00:00
parent bc82d87541
commit eb086dfd74
1 changed files with 13 additions and 4 deletions

View File

@ -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