mirror of
https://github.com/nuintun/command-manager.git
synced 2025-06-27 09:32:41 +08:00
update files
This commit is contained in:
parent
82f178d728
commit
c8b7de1fce
@ -68,6 +68,8 @@
|
||||
console.log('C + a: ', C + a);
|
||||
console.log('Ca: ', context.measureText('Ca').width);
|
||||
|
||||
canvas.style.backgroundColor = 'transparent';
|
||||
|
||||
var xterm = new AnsiTerminal(120, 80, 0);
|
||||
|
||||
xterm.debug = false;
|
||||
@ -89,7 +91,7 @@
|
||||
write();
|
||||
|
||||
var canvasXTerm = new CanvasXTerm();
|
||||
|
||||
|
||||
canvasXTerm.draw(xterm.stylesBuffer);
|
||||
|
||||
console.log(canvasXTerm.canvas);
|
||||
|
@ -15,7 +15,7 @@ function textRepeat(text, n){
|
||||
function CanvasXTerm(font){
|
||||
this.font = font || { family: 'Consolas', lineHeight: 20, size: 13, color: '#fff' };
|
||||
this.canvas = document.createElement('canvas');
|
||||
this.canvas.backgroundAlpha = 0;
|
||||
this.canvas.style.backgroundColor = 'transparent';
|
||||
this.brush = this.canvas.getContext('2d');
|
||||
this.brush.font = this.font + ' ' + this.fontSize;
|
||||
this.brush.fillStyle = this.font.color;
|
||||
@ -23,8 +23,11 @@ function CanvasXTerm(font){
|
||||
|
||||
CanvasXTerm.prototype = {
|
||||
draw: function (screen){
|
||||
var text = '';
|
||||
var i, j, x, y, attrCache;
|
||||
var rows = screen.length;
|
||||
var cols = rows ? screen[0].length : 0;
|
||||
var baseY = (this.font.lineHeight + this.font.size) / 2;
|
||||
|
||||
if (!this.rows || !this.cols || this.rows !== rows || this.cols !== cols) {
|
||||
this.rows = rows;
|
||||
@ -39,6 +42,15 @@ CanvasXTerm.prototype = {
|
||||
|
||||
this.canvas.height = rows * this.font.lineHeight;
|
||||
}
|
||||
|
||||
for (i = 0; i < rows; i++) {
|
||||
x = 0;
|
||||
y = i * 20 + baseY;
|
||||
|
||||
for (j = 0; j < rows; j++) {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
measureWidth: function (text, styles){
|
||||
this.brush.save();
|
||||
|
@ -1032,8 +1032,8 @@ AnsiTerminal.prototype.toString = function (type){
|
||||
if (type === 'html') {
|
||||
var line = '';
|
||||
var style = '';
|
||||
var styleBuffer;
|
||||
var attrCache;
|
||||
var styleBuffer;
|
||||
var stylesBuffer = this.stylesBuffer || [];
|
||||
|
||||
stylesBuffer = stylesBuffer.slice(0, rows);
|
||||
|
Loading…
x
Reference in New Issue
Block a user