Restore old //e key handling behavior.

This commit is contained in:
Will Scullin 2020-06-21 15:52:39 -07:00
parent fe2b85f6e3
commit 4046a9dbce
No known key found for this signature in database
GPG Key ID: 9092A5C0A673416B
2 changed files with 2 additions and 5 deletions

View File

@ -49,9 +49,7 @@
<div id="subtitle">An Apple //e Emulator in JavaScript</div> <div id="subtitle">An Apple //e Emulator in JavaScript</div>
</div> </div>
<div id="display"> <div id="display">
<div class="overscan" <div class="overscan">
onkeydown="Apple2._keydown(event);"
onkeyup="Apple2._keyup(event);">
<canvas id="screen" width="560" height="384"></canvas> <canvas id="screen" width="560" height="384"></canvas>
</div> </div>
</div> </div>

View File

@ -592,7 +592,7 @@ function processHash(hash) {
*/ */
function _keydown(evt) { function _keydown(evt) {
if (!focused && (!evt.metaKey || evt.ctrlKey)) { if (!focused && (!evt.metaKey || evt.ctrlKey || window.e)) {
evt.preventDefault(); evt.preventDefault();
var key = keyboard.mapKeyEvent(evt); var key = keyboard.mapKeyEvent(evt);
@ -817,7 +817,6 @@ export function initUI(apple2, disk2, cffa, e) {
document.body.addEventListener('mousemove', _mousemove); document.body.addEventListener('mousemove', _mousemove);
document.querySelectorAll('input,textarea').forEach(function(input) { document.querySelectorAll('input,textarea').forEach(function(input) {
input.addEventListener('input', function() { focused = true; });
input.addEventListener('focus', function() { focused = true; }); input.addEventListener('focus', function() { focused = true; });
input.addEventListener('blur', function() { focused = false; }); input.addEventListener('blur', function() { focused = false; });
}); });