Merge branch 'canvas' of github.com:espterm/espterm-front-end into canvas

cpsdqs/unified-input
Ondřej Hruška 7 years ago
commit cbc21e9e3b
  1. 2
      jssrc/term_input.js
  2. 13
      jssrc/term_screen.js

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

@ -157,7 +157,7 @@ class TermScreen {
};
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)
} else {
Input.onMouseDown(...this.screenToGrid(e.offsetX, e.offsetY),
@ -275,8 +275,11 @@ class TermScreen {
}
});
this.canvas.addEventListener('contextmenu', e => {
// prevent mouse keys getting stuck
e.preventDefault();
if (this.mouseMode.clicks) {
// prevent mouse keys getting stuck
e.preventDefault();
}
selectEnd(e.offsetX, e.offsetY);
});
// bind ctrl+shift+c to copy
@ -903,6 +906,10 @@ class TermScreen {
const audioCtx = this.audioCtx;
if (!audioCtx) return;
// prevent screeching
if (this._lastBeep && this._lastBeep > Date.now() - 50) return;
this._lastBeep = Date.now();
let osc, gain;
// main beep

Loading…
Cancel
Save