use helper functions to detect if a keyboard combo is used
This commit is contained in:
parent
70614928af
commit
2dbc9387d1
@ -1856,6 +1856,8 @@ function setArrayMatch(set1, array1) {
|
|||||||
|
|
||||||
},{}],2:[function(require,module,exports){
|
},{}],2:[function(require,module,exports){
|
||||||
"use strict";
|
"use strict";
|
||||||
|
var HELPER_FUNCTIONS = require('helperFunctions');
|
||||||
|
|
||||||
exports.CURSOR_ID = 'spatialnavigation-cursor';
|
exports.CURSOR_ID = 'spatialnavigation-cursor';
|
||||||
exports.URLDISPLAY_ID = 'spatialnavigation-urldisplay';
|
exports.URLDISPLAY_ID = 'spatialnavigation-urldisplay';
|
||||||
exports.MARKER_TAG = 'spatialnavigation-marker';
|
exports.MARKER_TAG = 'spatialnavigation-marker';
|
||||||
@ -1868,6 +1870,7 @@ function attribute(event, cursor) {
|
|||||||
exports.attribute = attribute;
|
exports.attribute = attribute;
|
||||||
|
|
||||||
function key2command(event) {
|
function key2command(event) {
|
||||||
|
HELPER_FUNCTIONS.addToKeysDown(event);
|
||||||
// ===============================================================================================================================
|
// ===============================================================================================================================
|
||||||
// Adding a hotkey for extension disable (Nomadic 07.03.2021 )
|
// Adding a hotkey for extension disable (Nomadic 07.03.2021 )
|
||||||
// ===============================================================================================================================
|
// ===============================================================================================================================
|
||||||
@ -1885,68 +1888,44 @@ function key2command(event) {
|
|||||||
localStorage.setItem("isEnabled", true);
|
localStorage.setItem("isEnabled", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check to see if the key combo is the enable/disable command ( Ctrl + Shift + X )
|
// check to see if the key combo is the enable/disable command
|
||||||
if (event.ctrlKey && event.shiftKey && event.key.toLowerCase() === "x") {
|
if (HELPER_FUNCTIONS.isHotkeyPressed("disableKeys")) {
|
||||||
// flip the value in storage
|
// flip the value in storage
|
||||||
isSpatialNavEnabled = !isSpatialNavEnabled;
|
isSpatialNavEnabled = !isSpatialNavEnabled;
|
||||||
localStorage.setItem("isEnabled", isSpatialNavEnabled);
|
localStorage.setItem("isEnabled", isSpatialNavEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
// prevent other keys when disabled
|
// prevent other keys when disabled
|
||||||
if (!isSpatialNavEnabled) return 11;
|
if (!isSpatialNavEnabled) return 11; // INVALID
|
||||||
|
|
||||||
// ===============================================================================================================================
|
// check to see if key combo matches an action
|
||||||
// END CHANGED SECTION
|
if(HELPER_FUNCTIONS.isHotkeyPressed("navUp")) {
|
||||||
// ===============================================================================================================================
|
return 0;
|
||||||
|
} else if(HELPER_FUNCTIONS.isHotkeyPressed("navLeft")) {
|
||||||
// ... change or leave any logic below however you need
|
return 4;
|
||||||
if (event.altKey || event.metaKey) {
|
} else if(HELPER_FUNCTIONS.isHotkeyPressed("navDown")) {
|
||||||
return 11 /* INVALID */;
|
return 2;
|
||||||
}
|
} else if(HELPER_FUNCTIONS.isHotkeyPressed("navRight")) {
|
||||||
|
return 5;
|
||||||
if (event.shiftKey) {
|
} else if(HELPER_FUNCTIONS.isHotkeyPressed("expand")) {
|
||||||
switch (event.keyCode) {
|
return 6;
|
||||||
case 13: // Enter
|
} else if(HELPER_FUNCTIONS.isHotkeyPressed("contract")) {
|
||||||
case 70: // F
|
return 7;
|
||||||
return 9; // SHIFT+ENTER
|
} else if(HELPER_FUNCTIONS.isHotkeyPressed("quit")) {
|
||||||
default:
|
return 10;
|
||||||
return 11;
|
} else if(HELPER_FUNCTIONS.isHotkeyPressed("click")) {
|
||||||
}
|
return 8;
|
||||||
}
|
} else if(HELPER_FUNCTIONS.isHotkeyPressed("shiftClick")) {
|
||||||
else if (event.ctrlKey) {
|
return 9;
|
||||||
switch (event.keyCode) {
|
} else if(HELPER_FUNCTIONS.isHotkeyPressed("controlClick")) {
|
||||||
case 13: // Enter
|
return 12;
|
||||||
case 70: // F
|
} else {
|
||||||
return 7; // CTRL+ENTER
|
return 11; // INVALID
|
||||||
default:
|
}
|
||||||
return 11;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
switch (event.keyCode) {
|
|
||||||
case 81: // Q
|
|
||||||
return 10; // QUIT
|
|
||||||
case 69: // E
|
|
||||||
return 6; // EXPAND
|
|
||||||
case 87: // W
|
|
||||||
return 0; // UP
|
|
||||||
case 83: // S
|
|
||||||
return 2; // DOWN
|
|
||||||
case 65: // A
|
|
||||||
return 4; // LEFT
|
|
||||||
case 68: // D
|
|
||||||
return 5; // RIGHT
|
|
||||||
case 13: // Enter
|
|
||||||
case 70: // F
|
|
||||||
return 8; // ENTER
|
|
||||||
default:
|
|
||||||
return 11 /* INVALID */;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
exports.key2command = key2command;
|
exports.key2command = key2command;
|
||||||
|
|
||||||
},{}],3:[function(require,module,exports){
|
},{"helperFunctions":13}],3:[function(require,module,exports){
|
||||||
"use strict";
|
"use strict";
|
||||||
var MODEL = require('../model/model');
|
var MODEL = require('../model/model');
|
||||||
var VIEW = require('../view/view');
|
var VIEW = require('../view/view');
|
||||||
|
Loading…
Reference in New Issue
Block a user