Ignore keypress if in input box

This commit is contained in:
Joel Collins 2018-11-09 17:15:08 +00:00
parent 4d9de7652b
commit 52d667feec

View file

@ -129,6 +129,9 @@ addEventListener("keydown", function (e) {
keysDown[e.keyCode] = true; //Add key to array keysDown[e.keyCode] = true; //Add key to array
console.log(keysDown) console.log(keysDown)
// If not currently in an input box
if (!(e.target instanceof HTMLInputElement)) {
// If stage movement keys are pressed // If stage movement keys are pressed
if ((leftKeyID in keysDown) || (rightKeyID in keysDown) || (upKeyID in keysDown) || (downKeyID in keysDown) || (pgupKeyID in keysDown) || (pgdnKeyID in keysDown)) { if ((leftKeyID in keysDown) || (rightKeyID in keysDown) || (upKeyID in keysDown) || (downKeyID in keysDown) || (pgupKeyID in keysDown) || (pgdnKeyID in keysDown)) {
// Calculate movement array // Calculate movement array
@ -157,6 +160,7 @@ addEventListener("keydown", function (e) {
// Make a position request // Make a position request
moveStagePositions(x_rel, y_rel, z_rel) moveStagePositions(x_rel, y_rel, z_rel)
} }
}
}, false); }, false);