update files

This commit is contained in:
nuintun 2015-12-03 17:17:48 +08:00
parent efbd0100b9
commit 10b9f8f8d9

View File

@ -23,6 +23,7 @@ function CanvasXTerm(font){
CanvasXTerm.prototype = { CanvasXTerm.prototype = {
draw: function (screen){ draw: function (screen){
var text = ''; var text = '';
var width, height;
var rows = screen.length; var rows = screen.length;
var cols = rows ? screen[0].length : 0; var cols = rows ? screen[0].length : 0;
var node, i, j, x, y, attrCache, stylesCache; var node, i, j, x, y, attrCache, stylesCache;
@ -31,14 +32,21 @@ CanvasXTerm.prototype = {
this.rows = rows; this.rows = rows;
this.cols = cols; this.cols = cols;
this.canvas.width = this.measureWidth( width = this.measureWidth(
textRepeat('A', cols), textRepeat('A', cols),
'italic bold ' + this.font.size + 'px ' + this.font.family 'italic bold ' + this.font.size + 'px ' + this.font.family
); );
this.canvas.height = rows * this.font.lineHeight; height = rows * this.font.lineHeight;
} else {
width = this.canvas.width;
height = this.canvas.height;
} }
// clear canvas
this.canvas.width = width;
this.canvas.height = height;
for (i = 0; i < rows; i++) { for (i = 0; i < rows; i++) {
x = 0; x = 0;
y = i * this.font.lineHeight + this.baseY; y = i * this.font.lineHeight + this.baseY;