mirror of
https://github.com/nuintun/command-manager.git
synced 2025-06-28 18:32:43 +08:00
update files
This commit is contained in:
parent
130100e053
commit
ad53cbed09
@ -20,13 +20,48 @@ function textRepeat(text, n){
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* iterator
|
||||||
|
* @param from
|
||||||
|
* @param iterator
|
||||||
|
* @param context
|
||||||
|
*/
|
||||||
|
function iterator(from, iterator, context){
|
||||||
|
for (var key in from) {
|
||||||
|
if (from.hasOwnProperty(key)) {
|
||||||
|
iterator.call(context, key, from[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// default font
|
||||||
|
var FONT = {
|
||||||
|
size: 13,
|
||||||
|
color: '#fff',
|
||||||
|
lineHeight: 20,
|
||||||
|
family: 'Consolas'
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CanvasXTerm
|
* CanvasXTerm
|
||||||
* @param font
|
* @param font
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function CanvasXTerm(font){
|
function CanvasXTerm(font){
|
||||||
this.font = font || { family: 'Consolas', lineHeight: 20, size: 13, color: '#fff' };
|
font = font || {};
|
||||||
|
|
||||||
|
// font setting
|
||||||
|
this.font = {};
|
||||||
|
|
||||||
|
// inherits
|
||||||
|
iterator(FONT, function (key, value){
|
||||||
|
if (font.hasOwnProperty(key)) {
|
||||||
|
this.font[key] = font[key];
|
||||||
|
} else {
|
||||||
|
this.font[key] = value;
|
||||||
|
}
|
||||||
|
}, this);
|
||||||
|
|
||||||
this.canvas = document.createElement('canvas');
|
this.canvas = document.createElement('canvas');
|
||||||
this.canvas.style.backgroundColor = 'transparent';
|
this.canvas.style.backgroundColor = 'transparent';
|
||||||
this.brush = this.canvas.getContext('2d');
|
this.brush = this.canvas.getContext('2d');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user