mirror of
https://github.com/nuintun/command-manager.git
synced 2025-06-08 04:04:04 +08:00
update files
This commit is contained in:
parent
c8b7de1fce
commit
53bce3cfc8
@ -24,9 +24,9 @@ function CanvasXTerm(font){
|
|||||||
CanvasXTerm.prototype = {
|
CanvasXTerm.prototype = {
|
||||||
draw: function (screen){
|
draw: function (screen){
|
||||||
var text = '';
|
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 node, styles, i, j, x, y, attrCache;
|
||||||
var baseY = (this.font.lineHeight + this.font.size) / 2;
|
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) {
|
||||||
@ -48,10 +48,47 @@ CanvasXTerm.prototype = {
|
|||||||
y = i * 20 + baseY;
|
y = i * 20 + baseY;
|
||||||
|
|
||||||
for (j = 0; j < rows; j++) {
|
for (j = 0; j < rows; j++) {
|
||||||
|
node = screen[i][j];
|
||||||
|
|
||||||
|
if (j = 0) {
|
||||||
|
attrCache = node.attr;
|
||||||
|
|
||||||
|
styles = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (node.value) {
|
||||||
|
if (node.attr !== attrCache) {
|
||||||
|
|
||||||
|
x = this.measureWidth(text);
|
||||||
|
attrCache = node.attr;
|
||||||
|
}
|
||||||
|
|
||||||
|
text += node.value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
getStyles: function (node){
|
||||||
|
var styles = {};
|
||||||
|
|
||||||
|
if (node.background) {
|
||||||
|
styles.background = background;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (node.foreground) {
|
||||||
|
styles.foreground = foreground;
|
||||||
|
} else {
|
||||||
|
styles.foreground = this.font.color;
|
||||||
|
}
|
||||||
|
|
||||||
|
['bold', 'italic', 'underline', 'blink', 'conceal'].forEach(function (key){
|
||||||
|
styles[key] = node[key];
|
||||||
|
});
|
||||||
|
|
||||||
|
return styles;
|
||||||
|
},
|
||||||
|
drawText: function (text, x, y, styles){
|
||||||
|
},
|
||||||
measureWidth: function (text, styles){
|
measureWidth: function (text, styles){
|
||||||
this.brush.save();
|
this.brush.save();
|
||||||
|
|
||||||
|
@ -2769,11 +2769,15 @@ function htmlStyle(styles){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (styles.italic) {
|
if (styles.italic) {
|
||||||
style += 'font-style: italic;';
|
style += 'font-style:italic;';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (styles.underline) {
|
if (styles.underline) {
|
||||||
style += 'text-decoration: underline;';
|
style += 'text-decoration:underline;';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (styles.conceal) {
|
||||||
|
style += 'visibility:hidden;';
|
||||||
}
|
}
|
||||||
|
|
||||||
return style;
|
return style;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user