From ed2886d4495d6199cbeb8d7e8406f140813a6f41 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Sat, 28 Dec 2024 01:42:13 +0100 Subject: [PATCH] add minEnabledHeight to settings --- src/common/interfaces/SettingsInterface.ts | 1 + src/csui/src/PlayerUiPanels/BaseExtensionSettings.vue | 4 ++++ src/csui/src/components/TriggerZoneEditor.vue | 4 +--- src/ext/conf/ExtConfPatches.ts | 1 + src/ext/conf/ExtensionConf.ts | 1 + 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/common/interfaces/SettingsInterface.ts b/src/common/interfaces/SettingsInterface.ts index 4eac694..88161f4 100644 --- a/src/common/interfaces/SettingsInterface.ts +++ b/src/common/interfaces/SettingsInterface.ts @@ -219,6 +219,7 @@ interface SettingsInterface { enabledFullscreenOnly: boolean, popupAlignment: 'left' | 'right', minEnabledWidth: number, // don't show UI if player is narrower than % of screen width + minEnabledHeight: number, // don't show UI if player is narrower than % of screen height activation: 'trigger-zone' | 'player', // what needs to be hovered in order for UI to be visible triggerZoneDimensions: { // how large the trigger zone is (relative to player size) width: number diff --git a/src/csui/src/PlayerUiPanels/BaseExtensionSettings.vue b/src/csui/src/PlayerUiPanels/BaseExtensionSettings.vue index 121cc1c..4346ecc 100644 --- a/src/csui/src/PlayerUiPanels/BaseExtensionSettings.vue +++ b/src/csui/src/PlayerUiPanels/BaseExtensionSettings.vue @@ -104,6 +104,10 @@ export default { return this.settings?.getSiteSettings(this.site) ?? null; } return null; + }, + resetSettings() { + this.settings.active = JSON.parse(JSON.stringify(this.settings.default)); + this.settings.saveWithoutReload(); } }, methods: { diff --git a/src/csui/src/components/TriggerZoneEditor.vue b/src/csui/src/components/TriggerZoneEditor.vue index aa13ff1..a54ef3d 100644 --- a/src/csui/src/components/TriggerZoneEditor.vue +++ b/src/csui/src/components/TriggerZoneEditor.vue @@ -184,7 +184,7 @@ export default { methods: { optionalToFixed(v, n) { if ((`${v}`.split('.')[1]?.length ?? 0) > n) { - return v.toFixed(2); + return v.toFixed(n); } return v; }, @@ -292,8 +292,6 @@ export default { this.settings.active.ui.inPlayer.triggerZoneDimensions.offsetY = cy; }, - - //#region slider window forceNumber(value) { // Change EU format to US if needed diff --git a/src/ext/conf/ExtConfPatches.ts b/src/ext/conf/ExtConfPatches.ts index bf45cb6..495b516 100644 --- a/src/ext/conf/ExtConfPatches.ts +++ b/src/ext/conf/ExtConfPatches.ts @@ -172,6 +172,7 @@ const ExtensionConfPatch = [ enabled: true, // enable by default on new installs enabledFullscreenOnly: false, minEnabledWidth: 0.75, + minEnabledHeight: 0.75, activation: 'player', popupAlignment: 'left', triggerZoneDimensions: { diff --git a/src/ext/conf/ExtensionConf.ts b/src/ext/conf/ExtensionConf.ts index 829af15..4dfde80 100644 --- a/src/ext/conf/ExtensionConf.ts +++ b/src/ext/conf/ExtensionConf.ts @@ -163,6 +163,7 @@ const ExtensionConf: SettingsInterface = { enabled: true, // enable by default on new installs enabledFullscreenOnly: false, minEnabledWidth: 0.75, + minEnabledHeight: 0.75, activation: 'player', popupAlignment: 'left', triggerZoneDimensions: {