Temp fix until mouse getCoords PR merged

This commit is contained in:
Daniel Imms 2017-05-21 12:16:36 -07:00
parent e63fdf580b
commit a5c48c891e

View File

@ -801,9 +801,19 @@ Terminal.prototype.bindMouse = function() {
button = getButton(ev);
// get mouse coordinates
pos = Mouse.getCoords(ev, this.rowContainer, this.charMeasure);
pos = Mouse.getCoords(ev, self.rowContainer, self.charMeasure);
if (!pos) return;
// Temp fix until getcoords PR is pushed
pos.x = pos[0];
pos.y = pos[1];
if (pos.x < 0) pos.x = 0;
if (pos.x > self.cols) pos.x = self.cols;
if (pos.y < 0) pos.y = 0;
if (pos.y > self.rows) pos.y = self.rows;
pos.x += 32;
pos.y += 32;
sendEvent(button, pos);
switch (ev.overrideType || ev.type) {
@ -829,9 +839,19 @@ Terminal.prototype.bindMouse = function() {
var button = pressed
, pos;
pos = Mouse.getCoords(ev, this.rowContainer, this.charMeasure);
pos = Mouse.getCoords(ev, self.rowContainer, self.charMeasure);
if (!pos) return;
// Temp fix until getcoords PR is pushed
pos.x = pos[0];
pos.y = pos[1];
if (pos.x < 0) pos.x = 0;
if (pos.x > self.cols) pos.x = self.cols;
if (pos.y < 0) pos.y = 0;
if (pos.y > self.rows) pos.y = self.rows;
pos.x += 32;
pos.y += 32;
// buttons marked as motions
// are incremented by 32
button += 32;