add focus history.
This commit is contained in:
parent
a19d9baf48
commit
c260bb9a02
|
@ -142,7 +142,8 @@ function Screen(options) {
|
|||
bottom: this.bottom = 0
|
||||
};
|
||||
|
||||
this.focused = null;
|
||||
//this.focused = null;
|
||||
this.history = [];
|
||||
this.clickable = [];
|
||||
this.input = [];
|
||||
this.grabKeys = false;
|
||||
|
@ -449,6 +450,26 @@ Screen.prototype.focusNext = function() {
|
|||
return this.focus(1);
|
||||
};
|
||||
|
||||
Screen.prototype.focusPush = function(el) {
|
||||
if (this.history.length === 10) {
|
||||
this.history.shift();
|
||||
}
|
||||
this.history.push(el);
|
||||
};
|
||||
|
||||
Screen.prototype.focusLast =
|
||||
Screen.prototype.focusPop = function() {
|
||||
return this.history.pop();
|
||||
};
|
||||
|
||||
Screen.prototype.__defineGetter__('focused', function() {
|
||||
return this.history[this.history.length-1];
|
||||
});
|
||||
|
||||
Screen.prototype.__defineSetter__('focused', function(el) {
|
||||
return this.focusPush(el);
|
||||
});
|
||||
|
||||
Screen.prototype.clearRegion = function(xi, xl, yi, yl) {
|
||||
return this.fillRegion(this.dattr, ' ', xi, xl, yi, yl);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue