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