mirror of
https://github.com/embarklabs/neo-blessed.git
synced 2025-02-02 22:24:55 +00:00
fix calls to clearPos in render hooks.
This commit is contained in:
parent
65fd7d2529
commit
18d97ce0d7
@ -613,7 +613,9 @@ Screen.prototype.render = function() {
|
||||
this._ci = 0;
|
||||
this.children.forEach(function(el) {
|
||||
el.index = self._ci++;
|
||||
//el._rendering = true;
|
||||
el.render();
|
||||
//el._rendering = false;
|
||||
});
|
||||
this._ci = -1;
|
||||
|
||||
@ -1857,9 +1859,9 @@ function Element(options) {
|
||||
self.parseContent();
|
||||
});
|
||||
|
||||
// this.on('detach', function() {
|
||||
// delete self._lpos;
|
||||
// });
|
||||
this.on('detach', function() {
|
||||
delete self._lpos;
|
||||
});
|
||||
|
||||
if (options.hoverBg != null) {
|
||||
options.hoverEffects = options.hoverEffects || {};
|
||||
@ -2329,18 +2331,9 @@ Element.prototype.setBack = function() {
|
||||
return this.setIndex(0);
|
||||
};
|
||||
|
||||
Element.prototype.clearPos = function() {
|
||||
Element.prototype.clearPos = function(get) {
|
||||
if (this.detached) return;
|
||||
// Need to use _getCoords() over lpos here to avoid clearing
|
||||
// elements which are obfuscated by a scrollable parent.
|
||||
|
||||
// NOTE: COULD USE THIS MULTIPLE PLACES - explanation:
|
||||
// We could use this.lpos because we don't want
|
||||
// to clear coordinates that may have changed and may
|
||||
// not be what/where is actually rendered.
|
||||
// var lpos = this._getCoords() && this.lpos;
|
||||
|
||||
var lpos = this._getCoords();
|
||||
var lpos = this._getCoords(get);
|
||||
if (!lpos) return;
|
||||
this.screen.clearRegion(
|
||||
lpos.xi, lpos.xl,
|
||||
@ -2929,6 +2922,8 @@ Element.prototype._getShrink = function(xi, xl, yi, yl, get) {
|
||||
Element.prototype._getCoords = function(get) {
|
||||
if (this.hidden) return;
|
||||
|
||||
// if (this.parent._rendering) get = true;
|
||||
|
||||
var xi = this._getLeft(get)
|
||||
, xl = xi + this._getWidth(get)
|
||||
, yi = this._getTop(get)
|
||||
@ -3314,7 +3309,9 @@ Element.prototype.render = function() {
|
||||
if (el.screen._ci !== -1) {
|
||||
el.index = el.screen._ci++;
|
||||
}
|
||||
//if (el.screen._rendering) el._rendering = true;
|
||||
el.render();
|
||||
//if (el.screen._rendering) el._rendering = false;
|
||||
});
|
||||
|
||||
this._emit('render', [coords]);
|
||||
@ -5206,7 +5203,8 @@ Checkbox.prototype.__proto__ = Input.prototype;
|
||||
Checkbox.prototype.type = 'checkbox';
|
||||
|
||||
Checkbox.prototype.render = function() {
|
||||
this.setContent('[' + (this.checked ? 'x' : ' ') + '] ' + this.text);
|
||||
this.clearPos(true);
|
||||
this.setContent('[' + (this.checked ? 'x' : ' ') + '] ' + this.text, true);
|
||||
return this._render();
|
||||
};
|
||||
|
||||
@ -5283,7 +5281,8 @@ RadioButton.prototype.__proto__ = Checkbox.prototype;
|
||||
RadioButton.prototype.type = 'radio-button';
|
||||
|
||||
RadioButton.prototype.render = function() {
|
||||
this.setContent('(' + (this.checked ? '*' : ' ') + ') ' + this.text);
|
||||
this.clearPos(true);
|
||||
this.setContent('(' + (this.checked ? '*' : ' ') + ') ' + this.text, true);
|
||||
return this._render();
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user