fix label reposition. fixes #134.
This commit is contained in:
parent
173f62c519
commit
da1ff18493
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue