fix label reposition. fixes #134.

This commit is contained in:
Christopher Jeffrey 2015-05-07 18:53:06 -07:00
parent 173f62c519
commit da1ff18493
1 changed files with 6 additions and 2 deletions

View File

@ -980,11 +980,11 @@ Element.prototype.setLabel = function(options) {
self.screen.render();
};
this.on('scroll', function() {
this.on('scroll', this._labelScroll = function() {
reposition();
});
this.on('resize', function() {
this.on('resize', this._labelResize = function() {
nextTick(function() {
reposition();
});
@ -994,6 +994,10 @@ Element.prototype.setLabel = function(options) {
Element.prototype.removeLabel = function() {
if (!this._label) return;
this._label.detach();
this.removeListener('scroll', this._labelScroll);
this.removeListener('resize', this._labelResize);
delete this._labelScroll;
delete this._labelResize;
delete this._label;
};