comparison js/core.js @ 3119:aa4503f8c630

#283. Will only trigger keydown IF current state is in test
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Wed, 18 Jul 2018 16:32:44 +0100
parents f78a66fbc018
children a21b88d212b6
comparison
equal deleted inserted replaced
3118:f78a66fbc018 3119:aa4503f8c630
2450 } 2450 }
2451 2451
2452 function trackCommentFocus() { 2452 function trackCommentFocus() {
2453 return document.activeElement.className.indexOf("trackComment") >= 0; 2453 return document.activeElement.className.indexOf("trackComment") >= 0;
2454 } 2454 }
2455 if (testState.currentStatePosition != "test") {
2456 return;
2457 }
2455 if (trackCommentFocus()) { 2458 if (trackCommentFocus()) {
2456 return; 2459 return;
2457 } 2460 }
2458 if (e.key === " ") { 2461 if (e.key === " ") {
2459 if (isPlaying()) { 2462 if (isPlaying()) {
2461 audioEngineContext.stop(); 2464 audioEngineContext.stop();
2462 } 2465 }
2463 } else { 2466 } else {
2464 keypress.call(this, e.key); 2467 keypress.call(this, e.key);
2465 } 2468 }
2466 console.log(e);
2467 } 2469 }
2468 }; 2470 };
2469 document.addEventListener("keydown", keyboardInterfaceController, false); 2471 document.addEventListener("keydown", keyboardInterfaceController, false);
2470 return keyboardInterfaceController; 2472 return keyboardInterfaceController;
2471 })(); 2473 })();