scrollbar improvement
/ mirror_to_github (push) Successful in 19s Details
/ test (push) Successful in 4s Details

This commit is contained in:
Leon van Kammen 2024-11-29 21:02:51 +00:00
parent cfef6cabdf
commit 3c58e9134a
3 changed files with 15 additions and 8 deletions

View File

@ -44,7 +44,7 @@ if( typeof AFRAME != 'undefined '){
muteUntilPrompt:{ type: 'boolean',"default":true}, // mute stdout until a prompt is detected in ISO
HUD: { type: 'boolean',"default":false}, // link to camera movement
transparent: { type:'boolean', "default":false }, // need good gpu
memory: { type: 'number', "default":40 }, // VM memory (in MB) [NOTE: quest or smartphone might crash > 40mb ]
memory: { type: 'number', "default":64 }, // VM memory (in MB) [NOTE: quest or smartphone might crash > 40mb ]
bufferLatency: { type: 'number', "default":1 }, // in ms: bufferlatency from webworker to xterm (batch-update every char to texture)
debug: { type: 'boolean', "default":false }
},
@ -311,7 +311,7 @@ if( typeof AFRAME != 'undefined '){
cols: this.cols,
rows: this.rows,
el_or_id: el,
max_scroll_lines: this.rows,
max_scroll_lines: this.rows*2,
nodim: true,
rainbow: [VT100.COLOR_MAGENTA, VT100.COLOR_CYAN ],
xr: AFRAME.scenes[0].renderer.xr,
@ -376,7 +376,7 @@ if( typeof AFRAME != 'undefined '){
this.data.width -= this.data.padding*2
this.data.height -= this.data.padding*2
this.cols = Math.floor(this.data.width/this.data.lineHeight*2)
this.rows = Math.floor(this.data.height*0.53/this.data.lineHeight*1.7)
this.rows = Math.floor( (this.data.height*0.93)/this.data.lineHeight)
},
events:{

View File

@ -227,6 +227,8 @@ ISOTerminal.prototype.startVM = function(opts){
\r https://www.w3.org/TR/webxr
\r https://three.org
\r https://aframe.org
\r https://busybox.net
\r https://buildroot.org
`
const text_color = "\r"

View File

@ -100,6 +100,8 @@ function VT100(opts)
bg = VT100.COLOR_TRANSPARENT //COLOR_BLACK;
}
console.dir(opts)
var r;
var c;
var scr = typeof el_or_id == 'string' ? document.getElementById(el_or_id) : el_or_id
@ -120,7 +122,9 @@ function VT100(opts)
this.redraw_[r] = 1;
}
this.scr_ = scr;
this.scr_.style.display = 'inline'
this.scr_.style.display = 'block'
this.scr_.style.overflowY = 'scroll'
this.scr_.style.height = '100%'
this.setupTouchInputFallback() // smartphone/android
this.cursor_vis_ = true;
this.cursor_key_mode_ = VT100.CK_CURSOR;
@ -659,7 +663,7 @@ VT100.prototype.refresh = function VT100_refresh()
// XXX: Remove older rows if past max_ht_ rows.
var num_rows = this.num_rows_ - this.start_row_id;
if (num_rows >= (this.max_ht_ + 100)) {
if ( this.scr_.firstChild && num_rows >= (this.max_ht_ + 100)) {
// Remove one group of rows (i.e. a 100 rows).
this.scr_.removeChild(this.scr_.firstChild);
this.start_row_id += 100;
@ -744,6 +748,7 @@ VT100.prototype.refresh = function VT100_refresh()
div_element.innerHTML = row_html;
//dump("adding row html: " + row_html + "\n");
}
this.scr_.scrollTop = this.scr_.scrollHeight
this.curs_set(1)
}