and space causing the screen to scroll (again)
cpsdqs/unified-input
cpsdqs 7 years ago
parent 963bfce9cc
commit b3608272a0
Signed by untrusted user: cpsdqs
GPG Key ID: 3F59586BB7448DD1
  1. 2
      jssrc/term_input.js
  2. 9
      jssrc/term_screen.js

@ -143,7 +143,7 @@ var Input = (function() {
if (str.length>0 && str.charCodeAt(0) >= 32) { if (str.length>0 && str.charCodeAt(0) >= 32) {
// console.log("Typed ", str); // console.log("Typed ", str);
// prevent space from scrolling // prevent space from scrolling
if (e.which === 32) e.preventDefault(); if (evt.which === 32) evt.preventDefault();
sendStrMsg(str); sendStrMsg(str);
} }
}); });

@ -156,7 +156,7 @@ class TermScreen {
}; };
this.canvas.addEventListener('mousedown', e => { this.canvas.addEventListener('mousedown', e => {
if (this.selection.selectable || e.altKey) { if ((this.selection.selectable || e.altKey) && e.button === 0) {
selectStart(e.offsetX, e.offsetY) selectStart(e.offsetX, e.offsetY)
} else { } else {
Input.onMouseDown(...this.screenToGrid(e.offsetX, e.offsetY), Input.onMouseDown(...this.screenToGrid(e.offsetX, e.offsetY),
@ -272,8 +272,11 @@ class TermScreen {
} }
}); });
this.canvas.addEventListener('contextmenu', e => { this.canvas.addEventListener('contextmenu', e => {
// prevent mouse keys getting stuck if (this.mouseMode.clicks) {
e.preventDefault(); // prevent mouse keys getting stuck
e.preventDefault();
}
selectEnd(e.offsetX, e.offsetY);
}) })
// bind ctrl+shift+c to copy // bind ctrl+shift+c to copy

Loading…
Cancel
Save