mouse changes.
This commit is contained in:
+16
-10
@@ -805,24 +805,26 @@ Terminal.prototype.bindMouse = function() {
|
|||||||
|
|
||||||
// should probably check offsetParent
|
// should probably check offsetParent
|
||||||
// but this is more portable
|
// but this is more portable
|
||||||
while (el !== self.document.documentElement) {
|
while (el && el !== self.document.documentElement) {
|
||||||
x -= el.offsetLeft;
|
x -= el.offsetLeft;
|
||||||
y -= el.offsetTop;
|
y -= el.offsetTop;
|
||||||
el = el.parentNode;
|
el = 'offsetParent' in el
|
||||||
|
? el.offsetParent
|
||||||
|
: el.parentNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert to cols/rows
|
// convert to cols/rows
|
||||||
w = self.element.clientWidth;
|
w = self.element.clientWidth;
|
||||||
h = self.element.clientHeight;
|
h = self.element.clientHeight;
|
||||||
x = ((x / w) * self.cols) | 0;
|
x = Math.round((x / w) * self.cols);
|
||||||
y = ((y / h) * self.rows) | 0;
|
y = Math.round((y / h) * self.rows);
|
||||||
|
|
||||||
// be sure to avoid sending
|
// be sure to avoid sending
|
||||||
// bad positions to the program
|
// bad positions to the program
|
||||||
if (x < 0) x = 0;
|
if (x < 0) x = 0;
|
||||||
if (x > self.cols) x = self.cols;
|
if (x >= self.cols) x = self.cols - 1;
|
||||||
if (y < 0) y = 0;
|
if (y < 0) y = 0;
|
||||||
if (y > self.rows) y = self.rows;
|
if (y >= self.rows) y = self.rows - 1;
|
||||||
|
|
||||||
// xterm sends raw bytes and
|
// xterm sends raw bytes and
|
||||||
// starts at 32 (SP) for each.
|
// starts at 32 (SP) for each.
|
||||||
@@ -832,10 +834,9 @@ Terminal.prototype.bindMouse = function() {
|
|||||||
return {
|
return {
|
||||||
x: x,
|
x: x,
|
||||||
y: y,
|
y: y,
|
||||||
down: ev.type === 'mousedown',
|
type: ev.type === wheelEvent
|
||||||
up: ev.type === 'mouseup',
|
? 'mousewheel'
|
||||||
wheel: ev.type === wheelEvent,
|
: ev.type
|
||||||
move: ev.type === 'mousemove'
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -849,6 +850,7 @@ Terminal.prototype.bindMouse = function() {
|
|||||||
self.focus();
|
self.focus();
|
||||||
|
|
||||||
// fix for odd bug
|
// fix for odd bug
|
||||||
|
//if (self.vt200Mouse && !self.normalMouse) {
|
||||||
if (self.vt200Mouse) {
|
if (self.vt200Mouse) {
|
||||||
sendButton({ __proto__: ev, type: 'mouseup' });
|
sendButton({ __proto__: ev, type: 'mouseup' });
|
||||||
return cancel(ev);
|
return cancel(ev);
|
||||||
@@ -870,6 +872,10 @@ Terminal.prototype.bindMouse = function() {
|
|||||||
return cancel(ev);
|
return cancel(ev);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//if (self.normalMouse) {
|
||||||
|
// on(self.document, 'mousemove', sendMove);
|
||||||
|
//}
|
||||||
|
|
||||||
on(el, wheelEvent, function(ev) {
|
on(el, wheelEvent, function(ev) {
|
||||||
if (!self.mouseEvents) return;
|
if (!self.mouseEvents) return;
|
||||||
if (self.x10Mouse
|
if (self.x10Mouse
|
||||||
|
|||||||
Reference in New Issue
Block a user