Merge pull request #533 from thewheat/show-hide-controller-disable-website-keybinds

Add ability to disable website keybindings for show/hide controller (Fixes: #526)
This commit is contained in:
jacobcolbert
2019-10-20 15:38:26 -04:00
committed by GitHub
3 changed files with 36 additions and 21 deletions

View File

@@ -92,6 +92,17 @@
tc.settings.controllerOpacity = Number(storage.controllerOpacity);
tc.settings.blacklist = String(storage.blacklist);
// ensure that there is a "display" binding (for upgrades from versions that had it as a separate binding)
if (tc.settings.keyBindings.filter(x => x.action == "display").length == 0) {
tc.settings.keyBindings.push({
action: "display",
key: Number(storage.displayKeyCode) || 86,
value: 0,
force: false,
predefined: true
}); // default V
}
initializeWhenReady(document);
});
@@ -362,9 +373,6 @@
return false;
}
if (keyCode == tc.settings.displayKeyCode) {
runAction('display', document, true)
}
var item = tc.settings.keyBindings.find(item => item.key === keyCode);
if (item) {
runAction(item.action, document, item.value);