Commit 377f4ebf authored by Cody Ede (cme527)'s avatar Cody Ede (cme527)
Browse files

Final Commit

parent 8db02407
......@@ -47,16 +47,16 @@ function FastTapMenu(options) {
for (c = 0; c < this.cols; c++) {
i = r*this.cols + c;
if (i < this.menuItems.length) {
this.menuItems[i].position.x = c*colWidth;
this.menuItems[i].position.y = r*rowHeight;
this.menuItems[i].row = r;
this.menuItems[i].col = c;
this.menuItems[i].w = colWidth;
this.menuItems[i].h = rowHeight;
this.menuItems[i].updateLayout();
this.addChild(this.menuItems[i]); // add to the display tree
this.itemGrid[r][c] = this.menuItems[i];
this.flashTime[r][c] = 0;
this.menuItems[i].position.x = c*colWidth;
this.menuItems[i].position.y = r*rowHeight;
this.menuItems[i].row = r;
this.menuItems[i].col = c;
this.menuItems[i].w = colWidth;
this.menuItems[i].h = rowHeight;
this.menuItems[i].updateLayout();
this.addChild(this.menuItems[i]); // add to the display tree
this.itemGrid[r][c] = this.menuItems[i];
this.flashTime[r][c] = 0;
}
}
}
......@@ -65,7 +65,7 @@ function FastTapMenu(options) {
this.addChild(this.grid);
// SET FALSE FOR KEYBOARD VERSION OF CODE
this.interactive = true;
......@@ -116,14 +116,18 @@ FastTapMenu.prototype.openMenu = function() {
if (this.menuOpen == false) {
this.menuOpen = true;
StudyLogger.logEvent({type: 'event.openmenu'});
}
else{
this.menuOpen = false;
StudyLogger.logEvent({type: 'event.closemenu'});
}
};
FastTapMenu.prototype.closeMenu = function() {
if (this.menuOpen == true) {
this.menuOpen = false;
StudyLogger.logEvent({type: 'event.closemenu'});
}
// if (this.menuOpen == true) {
// this.menuOpen = false;
// StudyLogger.logEvent({type: 'event.closemenu'});
// }
};
FastTapMenu.prototype.flashAround = function(data , value) {
......
var FastTapMenuItem = require('./FastTapMenuItem.js');
var items = [{name:"Left", binding:"Shift+G", value: "G", icon:"assets/images/borders/Left.png"},
var items = [{name:"Left", binding:"Shift+N", value: "N", icon:"assets/images/borders/Left.png"},
{name:"Right", binding:" ", value: " ", icon:"assets/images/borders/Right.png"},
{name:"Top", binding:"Shift+G", value: "G", icon:"assets/images/borders/Top.png"},
{name:"Bottom", binding:"", value:" ", icon:"assets/images/borders/Bottom.png"},
......@@ -29,7 +29,7 @@ var items = [{name:"Left", binding:"Shift+G", value: "G", icon:"assets/images/bo
{name:"12 point", binding:"", value: " ", icon:"assets/images/fontsize/12_point.png"},
{name:"14 point", binding:"Shift+B", value: "B", icon:"assets/images/fontsize/14_point.png"},
{name:"18 point", binding:"", value: " ", icon:"assets/images/fontsize/18_point.png"},
{name:"24 point", binding:"", value: " ", icon:"assets/images/fontsize/24_point.png"},
{name:"24 point", binding:"Shift+W", value: "W", icon:"assets/images/fontsize/24_point.png"},
{name:"28 point", binding:"", value: " ", icon:"assets/images/fontsize/28_point.png"},
{name:"32 point", binding:"Shift+J", value: "J", icon:"assets/images/fontsize/32_point.png"},
{name:"Left Justify", binding:"", value: " ", icon:"assets/images/paragraph/Left_Justify.png"},
......@@ -58,10 +58,10 @@ var items = [{name:"Left", binding:"Shift+G", value: "G", icon:"assets/images/bo
{name:"Superscript", binding:"Shift+I", value: "I", icon:"assets/images/style/Superscript.png"},
{name:"Cloth", binding:"Shift+O", value: "O", icon:"assets/images/textures/Cloth.png"},
{name:"Cork", binding:"", value: " ", icon:"assets/images/textures/Cork.png"},
{name:"Marble", binding:"Shift+N", value: "N", icon:"assets/images/textures/Marble.png"},
{name:"Marble", binding:"", value: " ", icon:"assets/images/textures/Marble.png"},
{name:"Paper", binding:"Shift+4", value: "4", icon:"assets/images/textures/Paper.png"},
{name:"Parchment", binding:"Shift+X", value: "X", icon:"assets/images/textures/Parchment.png"},
{name:"Sand", binding:"Shift+W", value: "W", icon:"assets/images/textures/Sand.png"},
{name:"Sand", binding:"", value: "", icon:"assets/images/textures/Sand.png"},
{name:"Water", binding:"Shift+H", value: "H", icon:"assets/images/textures/Water.png"},
{name:"Wood", binding:"Shift+5", value: "5", icon:"assets/images/textures/Wood.png"}];
......
var kd = require('keydrown');
var kd = require('keydrown'),
StudyLogger = require('study-logger');
function KeyboardManager() {
this._SPACEKeydown = false;
......@@ -60,14 +61,16 @@ KeyboardManager.prototype.tick = function() {
}
if(kd.SHIFT.isDown() && this._SHIFTKeydown == false){
StudyLogger.logEvent({type: "Shift Key Pressed"});
this._SHIFTKeydown = true;
}
if(!kd.SHIFT.isDown() && this._SHIFTKeydown == true){
StudyLogger.logEvent({type: "Shift Key Released"});
this._SHIFTKeydown = false;
}
if(kd.A.isDown() && _aKeydown.state == false && this._SHIFTKeydown == true){
if(kd.A.isDown() && _aKeydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_aKeydown.state = true;
this.notifyShortCutPerformed(_aKeydown);
}
......@@ -75,7 +78,7 @@ KeyboardManager.prototype.tick = function() {
_aKeydown.state = false;
}
if(kd.B.isDown() && _bKeydown.state == false && this._SHIFTKeydown == true){
if(kd.B.isDown() && _bKeydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_bKeydown.state = true;
this.notifyShortCutPerformed(_bKeydown);
}
......@@ -83,7 +86,7 @@ KeyboardManager.prototype.tick = function() {
_bKeydown.state = false;
}
if(kd.C.isDown() && _cKeydown.state == false && this._SHIFTKeydown == true){
if(kd.C.isDown() && _cKeydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_cKeydown.state = true;
this.notifyShortCutPerformed(_cKeydown);
}
......@@ -91,7 +94,7 @@ KeyboardManager.prototype.tick = function() {
_cKeydown.state = false;
}
if(kd.D.isDown() && _dKeydown.state == false && this._SHIFTKeydown == true){
if(kd.D.isDown() && _dKeydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_dKeydown.state = true;
this.notifyShortCutPerformed(_dKeydown);
}
......@@ -99,7 +102,7 @@ KeyboardManager.prototype.tick = function() {
_dKeydown.state = false;
}
if(kd.E.isDown() && _eKeydown.state == false && this._SHIFTKeydown == true){
if(kd.E.isDown() && _eKeydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_eKeydown.state = true;
this.notifyShortCutPerformed(_eKeydown);
}
......@@ -107,7 +110,7 @@ KeyboardManager.prototype.tick = function() {
_eKeydown.state = false;
}
if(kd.F.isDown() && _fKeydown.state == false && this._SHIFTKeydown == true){
if(kd.F.isDown() && _fKeydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_fKeydown.state = true;
this.notifyShortCutPerformed(_fKeydown);
}
......@@ -115,7 +118,7 @@ KeyboardManager.prototype.tick = function() {
_fKeydown.state = false;
}
if(kd.G.isDown() && _gKeydown.state == false && this._SHIFTKeydown == true){
if(kd.G.isDown() && _gKeydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_gKeydown.state = true;
this.notifyShortCutPerformed(_gKeydown);
}
......@@ -123,7 +126,7 @@ KeyboardManager.prototype.tick = function() {
_gKeydown.state = false;
}
if(kd.H.isDown() && _hKeydown.state == false && this._SHIFTKeydown == true){
if(kd.H.isDown() && _hKeydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_hKeydown.state = true;
this.notifyShortCutPerformed(_hKeydown);
}
......@@ -131,7 +134,7 @@ KeyboardManager.prototype.tick = function() {
_hKeydown.state = false;
}
if(kd.I.isDown() && _iKeydown.state == false && this._SHIFTKeydown == true){
if(kd.I.isDown() && _iKeydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_iKeydown.state = true;
this.notifyShortCutPerformed(_iKeydown);
}
......@@ -139,7 +142,7 @@ KeyboardManager.prototype.tick = function() {
_iKeydown.state = false;
}
if(kd.J.isDown() && _jKeydown.state == false && this._SHIFTKeydown == true){
if(kd.J.isDown() && _jKeydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_jKeydown.state = true;
this.notifyShortCutPerformed(_jKeydown);
}
......@@ -147,7 +150,7 @@ KeyboardManager.prototype.tick = function() {
_jKeydown.state = false;
}
if(kd.K.isDown() && _kKeydown.state == false && this._SHIFTKeydown == true){
if(kd.K.isDown() && _kKeydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_kKeydown.state = true;
this.notifyShortCutPerformed(_kKeydown);
}
......@@ -155,7 +158,7 @@ KeyboardManager.prototype.tick = function() {
_kKeydown.state = false;
}
if(kd.L.isDown() && _lKeydown.state == false && this._SHIFTKeydown == true){
if(kd.L.isDown() && _lKeydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_lKeydown.state = true;
this.notifyShortCutPerformed(_lKeydown);
}
......@@ -163,7 +166,7 @@ KeyboardManager.prototype.tick = function() {
_lKeydown.state = false;
}
if(kd.M.isDown() && _mKeydown.state == false && this._SHIFTKeydown == true){
if(kd.M.isDown() && _mKeydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_mKeydown.state = true;
this.notifyShortCutPerformed(_mKeydown);
}
......@@ -171,7 +174,7 @@ KeyboardManager.prototype.tick = function() {
_mKeydown.state = false;
}
if(kd.N.isDown() && _nKeydown.state == false && this._SHIFTKeydown == true){
if(kd.N.isDown() && _nKeydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_nKeydown.state = true;
this.notifyShortCutPerformed(_nKeydown);
}
......@@ -179,7 +182,7 @@ KeyboardManager.prototype.tick = function() {
_nKeydown.state = false;
}
if(kd.O.isDown() && _oKeydown.state == false && this._SHIFTKeydown == true){
if(kd.O.isDown() && _oKeydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_oKeydown.state = true;
this.notifyShortCutPerformed(_oKeydown);
}
......@@ -187,7 +190,7 @@ KeyboardManager.prototype.tick = function() {
_oKeydown.state = false;
}
if(kd.P.isDown() && _pKeydown.state == false && this._SHIFTKeydown == true){
if(kd.P.isDown() && _pKeydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_pKeydown.state = true;
this.notifyShortCutPerformed(_pKeydown);
}
......@@ -195,7 +198,7 @@ KeyboardManager.prototype.tick = function() {
_pKeydown.state = false;
}
if(kd.Q.isDown() && _qKeydown.state == false && this._SHIFTKeydown == true){
if(kd.Q.isDown() && _qKeydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_qKeydown.state = true;
this.notifyShortCutPerformed(_qKeydown);
}
......@@ -203,7 +206,7 @@ KeyboardManager.prototype.tick = function() {
_qKeydown.state = false;
}
if(kd.R.isDown() && _rKeydown.state == false && this._SHIFTKeydown == true){
if(kd.R.isDown() && _rKeydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_rKeydown.state = true;
this.notifyShortCutPerformed(_rKeydown);
}
......@@ -211,7 +214,7 @@ KeyboardManager.prototype.tick = function() {
_rKeydown.state = false;
}
if(kd.S.isDown() && _sKeydown.state == false && this._SHIFTKeydown == true){
if(kd.S.isDown() && _sKeydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_sKeydown.state = true;
this.notifyShortCutPerformed(_sKeydown);
}
......@@ -219,7 +222,7 @@ KeyboardManager.prototype.tick = function() {
_sKeydown.state = false;
}
if(kd.T.isDown() && _tKeydown.state == false && this._SHIFTKeydown == true){
if(kd.T.isDown() && _tKeydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_tKeydown.state = true;
this.notifyShortCutPerformed(_tKeydown);
}
......@@ -227,7 +230,7 @@ KeyboardManager.prototype.tick = function() {
_tKeydown.state = false;
}
if(kd.U.isDown() && _uKeydown.state == false && this._SHIFTKeydown == true){
if(kd.U.isDown() && _uKeydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_uKeydown.state = true;
this.notifyShortCutPerformed(_uKeydown);
}
......@@ -235,7 +238,7 @@ KeyboardManager.prototype.tick = function() {
_uKeydown.state = false;
}
if(kd.V.isDown() && _vKeydown.state == false && this._SHIFTKeydown == true){
if(kd.V.isDown() && _vKeydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_vKeydown.state = true;
this.notifyShortCutPerformed(_vKeydown);
}
......@@ -243,7 +246,7 @@ KeyboardManager.prototype.tick = function() {
_vKeydown.state = false;
}
if(kd.W.isDown() && _wKeydown.state == false && this._SHIFTKeydown == true){
if(kd.W.isDown() && _wKeydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_wKeydown.state = true;
this.notifyShortCutPerformed(_wKeydown);
}
......@@ -251,7 +254,7 @@ KeyboardManager.prototype.tick = function() {
_wKeydown.state = false;
}
if(kd.X.isDown() && _xKeydown.state == false && this._SHIFTKeydown == true){
if(kd.X.isDown() && _xKeydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_xKeydown.state = true;
this.notifyShortCutPerformed(_xKeydown);
}
......@@ -259,7 +262,7 @@ KeyboardManager.prototype.tick = function() {
_xKeydown.state = false;
}
if(kd.Y.isDown() && _yKeydown.state == false && this._SHIFTKeydown == true){
if(kd.Y.isDown() && _yKeydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_yKeydown.state = true;
this.notifyShortCutPerformed(_yKeydown);
}
......@@ -267,7 +270,7 @@ KeyboardManager.prototype.tick = function() {
_yKeydown.state = false;
}
if(kd.Z.isDown() && _zKeydown.state == false && this._SHIFTKeydown == true){
if(kd.Z.isDown() && _zKeydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_zKeydown.state = true;
this.notifyShortCutPerformed(_zKeydown);
}
......@@ -275,7 +278,7 @@ KeyboardManager.prototype.tick = function() {
_zKeydown.state = false;
}
if(kd.ONE.isDown() && _1Keydown.state == false && this._SHIFTKeydown == true){
if(kd.ONE.isDown() && _1Keydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_1Keydown.state = true;
this.notifyShortCutPerformed(_1Keydown);
}
......@@ -283,7 +286,7 @@ KeyboardManager.prototype.tick = function() {
_1Keydown.state = false;
}
if(kd.TWO.isDown() && _2Keydown.state == false && this._SHIFTKeydown == true){
if(kd.TWO.isDown() && _2Keydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_2Keydown.state = true;
this.notifyShortCutPerformed(_2Keydown);
}
......@@ -291,7 +294,7 @@ KeyboardManager.prototype.tick = function() {
_2Keydown.state = false;
}
if(kd.THREE.isDown() && _3Keydown.state == false && this._SHIFTKeydown == true){
if(kd.THREE.isDown() && _3Keydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_3Keydown.state = true;
this.notifyShortCutPerformed(_3Keydown);
}
......@@ -299,7 +302,7 @@ KeyboardManager.prototype.tick = function() {
_3Keydown.state = false;
}
if(kd.FOUR.isDown() && _4Keydown.state == false && this._SHIFTKeydown == true){
if(kd.FOUR.isDown() && _4Keydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_4Keydown.state = true;
this.notifyShortCutPerformed(_4Keydown);
}
......@@ -307,7 +310,7 @@ KeyboardManager.prototype.tick = function() {
_4Keydown.state = false;
}
if(kd.FIVE.isDown() && _5Keydown.state == false && this._SHIFTKeydown == true){
if(kd.FIVE.isDown() && _5Keydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_5Keydown.state = true;
this.notifyShortCutPerformed(_5Keydown);
}
......@@ -315,7 +318,7 @@ KeyboardManager.prototype.tick = function() {
_5Keydown.state = false;
}
if(kd.SIX.isDown() && _6Keydown.state == false && this._SHIFTKeydown == true){
if(kd.SIX.isDown() && _6Keydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_6Keydown.state = true;
this.notifyShortCutPerformed(_6Keydown);
}
......@@ -323,7 +326,7 @@ KeyboardManager.prototype.tick = function() {
_6Keydown.state = false;
}
if(kd.SEVEN.isDown() && _7Keydown.state == false && this._SHIFTKeydown == true){
if(kd.SEVEN.isDown() && _7Keydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_7Keydown.state = true;
this.notifyShortCutPerformed(_7Keydown);
}
......@@ -331,7 +334,7 @@ KeyboardManager.prototype.tick = function() {
_7Keydown.state = false;
}
if(kd.EIGHT.isDown() && _8Keydown.state == false && this._SHIFTKeydown == true){
if(kd.EIGHT.isDown() && _8Keydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_8Keydown.state = true;
this.notifyShortCutPerformed(_8Keydown);
}
......@@ -339,7 +342,7 @@ KeyboardManager.prototype.tick = function() {
_8Keydown.state = false;
}
if(kd.NINE.isDown() && _9Keydown.state == false && this._SHIFTKeydown == true){
if(kd.NINE.isDown() && _9Keydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_9Keydown.state = true;
this.notifyShortCutPerformed(_9Keydown);
}
......@@ -347,7 +350,7 @@ KeyboardManager.prototype.tick = function() {
_9Keydown.state = false;
}
if(kd.ZERO.isDown() && _0Keydown.state == false && this._SHIFTKeydown == true){
if(kd.ZERO.isDown() && _0Keydown.state == false && this._SHIFTKeydown == true && this._SPACEKeydown == false){
_0Keydown.state = true;
this.notifyShortCutPerformed(_0Keydown);
}
......
......@@ -50,6 +50,7 @@ TrainTrial.prototype.start = function() {
this.ShortCutPerformed = function(keyPress) {
this.experiment.fastTapMenu.menuOpen = false;
this.experiment.fastTapMenu.flashAround(undefined,keyPress.value);
this.experiment.fastTapMenu.logPressEvent(keyPress.value);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment