Add "Default opacity" setting for touch controller

This commit is contained in:
redphx 2024-05-07 17:37:49 +07:00
parent b9355d5c01
commit 2df3bb4611
6 changed files with 55 additions and 7 deletions

View File

@ -1,4 +1,6 @@
.bx-number-stepper {
text-align: center;
span {
display: inline-block;
width: 40px;
@ -35,6 +37,13 @@
}
}
input[type="range"] {
display: block;
margin: 12px auto 2px;
width: 180px;
color: #959595 !important;
}
input[type=range]:disabled, button:disabled {
display: none;
}

View File

@ -86,13 +86,6 @@
white-space: nowrap;
}
}
input[type="range"] {
display: block;
margin: 12px auto 2px;
width: 180px;
color: #959595 !important;
}
}

View File

@ -484,6 +484,18 @@ BxLogger.info('patchRemotePlayMkb', ${configsVar});
str = str.replace(text, text + newCode);
return str;
},
patchTouchControlDefaultOpacity(str: string) {
const text = 'opacityMultiplier:1';
if (!str.includes(text)) {
return false;
}
const opacity = (getPref(PrefKey.STREAM_TOUCH_CONTROLLER_DEFAULT_OPACITY) / 100).toFixed(1);
const newCode = `opacityMultiplier: ${opacity}`;
str = str.replace(text, newCode);
return str;
},
};
let PATCH_ORDERS: PatchArray = [
@ -534,6 +546,7 @@ let PLAYING_PATCH_ORDERS: PatchArray = [
STATES.hasTouchSupport && getPref(PrefKey.STREAM_TOUCH_CONTROLLER) === 'all' && 'exposeTouchLayoutManager',
STATES.hasTouchSupport && (getPref(PrefKey.STREAM_TOUCH_CONTROLLER) === 'off' || getPref(PrefKey.STREAM_TOUCH_CONTROLLER_AUTO_OFF)) && 'disableTakRenderer',
STATES.hasTouchSupport && getPref(PrefKey.STREAM_TOUCH_CONTROLLER_DEFAULT_OPACITY) !== 100 && 'patchTouchControlDefaultOpacity',
BX_FLAGS.EnableXcloudLogging && 'enableConsoleLogging',

View File

@ -58,6 +58,7 @@ const SETTINGS_UI = {
items: [
PrefKey.STREAM_TOUCH_CONTROLLER,
PrefKey.STREAM_TOUCH_CONTROLLER_AUTO_OFF,
PrefKey.STREAM_TOUCH_CONTROLLER_DEFAULT_OPACITY,
PrefKey.STREAM_TOUCH_CONTROLLER_STYLE_STANDARD,
PrefKey.STREAM_TOUCH_CONTROLLER_STYLE_CUSTOM,
],

View File

@ -27,6 +27,7 @@ export enum PrefKey {
STREAM_TOUCH_CONTROLLER = 'stream_touch_controller',
STREAM_TOUCH_CONTROLLER_AUTO_OFF = 'stream_touch_controller_auto_off',
STREAM_TOUCH_CONTROLLER_DEFAULT_OPACITY = 'stream_touch_controller_default_opacity',
STREAM_TOUCH_CONTROLLER_STYLE_STANDARD = 'stream_touch_controller_style_standard',
STREAM_TOUCH_CONTROLLER_STYLE_CUSTOM = 'stream_touch_controller_style_custom',
@ -277,6 +278,20 @@ export class Preferences {
default: false,
unsupported: !STATES.hasTouchSupport,
},
[PrefKey.STREAM_TOUCH_CONTROLLER_DEFAULT_OPACITY]: {
type: SettingElementType.NUMBER_STEPPER,
label: t('tc-default-opacity'),
default: 100,
min: 10,
max: 100,
steps: 10,
params: {
suffix: '%',
ticks: 10,
hideSlider: true,
},
unsupported: !STATES.hasTouchSupport,
},
[PrefKey.STREAM_TOUCH_CONTROLLER_STYLE_STANDARD]: {
label: t('tc-standard-layout-style'),
default: 'default',

View File

@ -2754,6 +2754,23 @@ const Texts = {
"Màu của bố cục tùy chọn",
"特殊游戏按钮样式",
],
"tc-default-opacity": [
,
,
"Default opacity",
,
,
,
,
,
,
,
,
,
,
"Độ mờ mặc định",
,
],
"tc-muted-colors": [
"Matte Farben",
"Warna redup",