* Start work on setProperty() functionality -- this will replace some of the view controller work

This commit is contained in:
Bryan Ashby 2015-06-28 22:45:57 -06:00
parent 541be2d65a
commit 8a5f890bee
1 changed files with 21 additions and 0 deletions

View File

@ -146,11 +146,17 @@ View.prototype.setDimension = function(dimens) {
}; };
View.prototype.setHeight = function(height) { View.prototype.setHeight = function(height) {
assert(_.isNumber(height));
// :TODO: assert height is within this.client.term.termHeight
this.dimens.height = height; this.dimens.height = height;
this.autoScale.height = false; this.autoScale.height = false;
}; };
View.prototype.setWidth = function(width) { View.prototype.setWidth = function(width) {
assert(_.isNumber(width));
// :TODO: assert width is appropriate for this.client.term.termWidth
this.dimens.width = width; this.dimens.width = width;
this.autoScale.width = false; this.autoScale.width = false;
}; };
@ -168,6 +174,21 @@ View.prototype.getFocusSGR = function() {
return this.ansiFocusSGR; return this.ansiFocusSGR;
}; };
View.prototype.setProperty = function(propName, value) {
switch(propName) {
case 'height' : this.setHeight(value); break;
case 'width' : this.setWidth(value); break;
case 'focus' : this.setFocus(value); break;
}
// :TODO: setStyleSGRx()
/*
if(/styleSGR[0-9]+/.test(propName)) {
this.styleSGR
}
*/
};
View.prototype.redraw = function() { View.prototype.redraw = function() {
this.client.term.write(ansi.goto(this.position.row, this.position.col)); this.client.term.write(ansi.goto(this.position.row, this.position.col));
}; };