fix settings

This commit is contained in:
Tamius Han 2022-09-28 00:39:49 +02:00
parent d70783cc82
commit 08479242f7
3 changed files with 7 additions and 7 deletions

View File

@ -180,7 +180,7 @@ interface SettingsInterface {
conditionalDifferencePercent: number // black bars less than this wide will trigger stretch
// if mode is set to '1'. 1.0=100%
},
kbmHandler: {
kbm: {
enabled: boolean, // if keyboard/mouse handler service will run
keyboardEnabled: boolean, // if keyboard shortcuts are processed
mouseEnabled: boolean, // if mouse movement is processed

View File

@ -150,7 +150,7 @@ const ExtensionConf: SettingsInterface = {
maxLogZoom: 3,
announceDebounce: 200 // we wait this long before announcing new zoom
},
keyboardHandler: {
kbm: {
enabled: true,
keyboardEnabled: true,
mouseEnabled: true

View File

@ -79,7 +79,7 @@ class KeyboardHandler {
}
load() {
if (!this.settings.isEnabledForSite() || this.settings.active.kbmHandler.enabled) {
if (!this.settings.isEnabledForSite() || this.settings.active.kbm.enabled) {
return;
}
this.addListener();
@ -95,7 +95,7 @@ class KeyboardHandler {
// way, otherwise we can't remove event listener
// https://stackoverflow.com/a/19507086
if (this.settings.active.kbmHandler.keyboardEnabled) {
if (this.settings.active.kbm.keyboardEnabled) {
document.addEventListener('keyup', this );
}
}
@ -111,11 +111,11 @@ class KeyboardHandler {
if (element) {
this.playerElements.push(element);
if (this.settings.active.kbmHandler.mouseEnabled) {
if (this.settings.active.kbm.mouseEnabled) {
element.addEventListener('mousemove', this);
}
} else {
if (this.settings.active.kbmHandler.mouseEnabled) {
if (this.settings.active.kbm.mouseEnabled) {
for (const playerElement of this.playerElements) {
playerElement.addEventListener('mousemove', this);
}
@ -176,7 +176,7 @@ class KeyboardHandler {
}
for (const confKey in config) {
this.settings.active.kbmHandler[confKey] = config[confKey];
this.settings.active.kbm[confKey] = config[confKey];
}
this.settings.save();