This commit is contained in:
Alex Yatskov 2016-04-24 11:26:42 -07:00
parent 709094455e
commit 7f661fdd81
2 changed files with 6 additions and 3 deletions

View File

@ -23,6 +23,7 @@ body {
font-size: 14px; font-size: 14px;
line-height: 1.42857143; line-height: 1.42857143;
overflow-y: auto; overflow-y: auto;
padding: 5px;
} }
.term { .term {

View File

@ -22,6 +22,8 @@ class Client {
this.popup = new Popup(); this.popup = new Popup();
this.lastMousePos = null; this.lastMousePos = null;
this.lastRange = null; this.lastRange = null;
this.activateKey = 16;
this.activateBtn = 2;
this.enabled = false; this.enabled = false;
this.options = {}; this.options = {};
@ -40,21 +42,21 @@ class Client {
} }
onKeyDown(e) { onKeyDown(e) {
if (this.enabled && this.lastMousePos !== null && (e.keyCode === 16 || e.charCode === 16)) { if (this.enabled && this.lastMousePos !== null && (e.keyCode === this.activateKey || e.charCode === this.activateKey)) {
this.searchAt(this.lastMousePos); this.searchAt(this.lastMousePos);
} }
} }
onMouseMove(e) { onMouseMove(e) {
this.lastMousePos = {x: e.clientX, y: e.clientY}; this.lastMousePos = {x: e.clientX, y: e.clientY};
if (this.enabled && (e.shiftKey || e.which === 2)) { if (this.enabled && (e.shiftKey || e.which === this.activateBtn)) {
this.searchAt(this.lastMousePos); this.searchAt(this.lastMousePos);
} }
} }
onMouseDown(e) { onMouseDown(e) {
this.lastMousePos = {x: e.clientX, y: e.clientY}; this.lastMousePos = {x: e.clientX, y: e.clientY};
if (this.enabled && (e.shiftKey || e.which === 2)) { if (this.enabled && (e.shiftKey || e.which === this.activateBtn)) {
this.searchAt(this.lastMousePos); this.searchAt(this.lastMousePos);
} else { } else {
this.hidePopup(); this.hidePopup();