From c7a6ce60f853e12a5b4db201c9356251ce49998f Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sun, 29 Mar 2015 15:48:07 -0700 Subject: [PATCH] Revert "try to use getCoords everywhere." This reverts commit 92f167eee871d311c45afb1a7cc87bc0423a62c1. --- lib/widget.js | 50 ++++++++++++++++++++++---------------------------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/lib/widget.js b/lib/widget.js index edc6edc..3698ad3 100644 --- a/lib/widget.js +++ b/lib/widget.js @@ -6519,8 +6519,7 @@ Listbar.prototype.addItem = Listbar.prototype.appendItem = function(item, callback) { var self = this , prev = this.items[this.items.length - 1] - , lpos = prev && (prev._getCoords() || { xi: prev.aleft }) - , drawn = prev ? lpos.xi + prev.width : 0 + , drawn = prev ? prev.aleft + prev.width : 0 , cmd , title , len; @@ -6859,12 +6858,10 @@ Terminal.prototype.bootstrap = function() { this.screen.on('mouse', function(data) { if (self.screen.focused !== self) return; - var lpos = self._getCoords() || { xi: self.aleft, yi: self.atop }; - - if (data.x < lpos.xi + self.ileft) return; - if (data.y < lpos.yi + self.itop) return; - if (data.x > lpos.xi - self.ileft + self.width) return; - if (data.y > lpos.yi - self.itop + self.height) return; + if (data.x < self.aleft + self.ileft) return; + if (data.y < self.atop + self.itop) return; + if (data.x > self.aleft - self.ileft + self.width) return; + if (data.y > self.atop - self.itop + self.height) return; if (self.term.x10Mouse || self.term.vt200Mouse @@ -6879,8 +6876,8 @@ Terminal.prototype.bootstrap = function() { } var b = data.raw[0] - , x = data.x - lpos.xi - , y = data.y - lpos.yi + , x = data.x - self.aleft + , y = data.y - self.atop , s; if (self.term.urxvtMouse) { @@ -7220,23 +7217,22 @@ Image.prototype.setImage = function(img, callback) { : callback(null, success); }); - var lpos = self._getCoords() || { xi: self.aleft, yi: self.atop } - , width = self.width * ratio.tw | 0 + var width = self.width * ratio.tw | 0 , height = self.height * ratio.th | 0 - , xi = lpos.xi * ratio.tw | 0 - , yi = lpos.yi * ratio.th | 0; + , aleft = self.aleft * ratio.tw | 0 + , atop = self.atop * ratio.th | 0; var input = '0;1;' - + xi + ';' - + yi + ';' + + aleft + ';' + + atop + ';' + width + ';' + height + ';;;;;' + img + '\n4;\n3;\n'; self._props = { - xi: xi, - yi: yi, + aleft: aleft, + atop: atop, width: width, height: height }; @@ -7268,15 +7264,13 @@ Image.prototype.setImage = function(img, callback) { return callback(err); } - var lpos = self._getCoords() || { xi: self.aleft, yi: self.atop }; - if (self._lastSize && ratio.tw === self._lastSize.tw && ratio.th === self._lastSize.th && size.width === self._lastSize.width && size.height === self._lastSize.height - && lpos.xi === self._lastSize.xi - && lpos.yi === self._lastSize.yi) { + && self.aleft === self._lastSize.aleft + && self.atop === self._lastSize.atop) { if (!callback) return; return callback(null, success); } @@ -7286,8 +7280,8 @@ Image.prototype.setImage = function(img, callback) { th: ratio.th, width: size.width, height: size.height, - xi: lpos.xi, - yi: lpos.yi + aleft: self.aleft, + atop: self.atop }; self.position.width = size.width / ratio.tw | 0; @@ -7336,12 +7330,12 @@ Image.prototype.clearImage = function(callback) { var width = this._props.width + 2 , height = this._props.height + 2 - , xi = this._props.xi - , yi = this._props.yi; + , aleft = this._props.aleft + , atop = this._props.atop; var input = '6;' - + xi + ';' - + yi + ';' + + aleft + ';' + + atop + ';' + width + ';' + height + '\n4;\n3;\n';