diff --git a/src/locales/languages/en_US.json b/src/locales/languages/en_US.json index 5c367482..0ffa9d52 100644 --- a/src/locales/languages/en_US.json +++ b/src/locales/languages/en_US.json @@ -231,10 +231,16 @@ "preferences.window.always-top.placeholder": "Keep control window topmost", "preferences.window.disable-screen-saver.name": "Disable Screensaver", "preferences.window.disable-screen-saver.placeholder": "Disable computer screensaver", - "preferences.window.size.width": "Window width", - "preferences.window.size.width.placeholder": "The window width may cause the display to be blurred", - "preferences.window.size.height": "Window height", - "preferences.window.size.height.placeholder": "Window height", + "preferences.window.size.width": "Window Width", + "preferences.window.size.width.placeholder": "Device Width", + "preferences.window.size.width.tips": "Note: Changing this setting may result in blurry display.", + "preferences.window.size.height": "Window Height", + "preferences.window.size.height.placeholder": "Device Height", + "preferences.window.size.height.tips": "Note: Changing this setting may result in blurry display.", + "preferences.window.position.x": "Window X Position", + "preferences.window.position.x.placeholder": "Relative to Desktop Center", + "preferences.window.position.y": "Window Y Position", + "preferences.window.position.y.placeholder": "Relative to Desktop Center", "preferences.record.name": "Recording", "preferences.record.format.name": "Format", diff --git a/src/locales/languages/zh_CN.json b/src/locales/languages/zh_CN.json index 1a060d57..8c2e68bc 100644 --- a/src/locales/languages/zh_CN.json +++ b/src/locales/languages/zh_CN.json @@ -230,9 +230,15 @@ "preferences.window.disable-screen-saver.name": "禁用屏幕保护程序", "preferences.window.disable-screen-saver.placeholder": "开启后将禁用计算机屏幕保护程序", "preferences.window.size.width": "窗口宽度", - "preferences.window.size.width.placeholder": "窗口宽度, 可能会导致显示模糊", + "preferences.window.size.width.placeholder": "设备宽度", + "preferences.window.size.width.tips": "注意:更改此设置可能会导致显示模糊", "preferences.window.size.height": "窗口高度", - "preferences.window.size.height.placeholder": "窗口高度", + "preferences.window.size.height.placeholder": "设备高度", + "preferences.window.size.height.tips": "注意:更改此设置可能会导致显示模糊", + "preferences.window.position.x": "窗口横坐标", + "preferences.window.position.x.placeholder": "相对于桌面中心", + "preferences.window.position.y": "窗口纵坐标", + "preferences.window.position.y.placeholder": "相对于桌面中心", "preferences.record.name": "音视频录制", "preferences.record.format.name": "录制视频格式", diff --git a/src/store/preference/index.js b/src/store/preference/index.js index fce851a4..c1dd16c4 100644 --- a/src/store/preference/index.js +++ b/src/store/preference/index.js @@ -70,7 +70,10 @@ export const usePreferenceStore = defineStore({ this.init() }, setData(data, scope = this.deviceScope) { - const pickData = pickBy(data, value => !!value) + const pickData = pickBy( + data, + value => !!value || typeof value === 'number', + ) if (data.adbPath === adbPath) { delete pickData.adbPath @@ -136,7 +139,7 @@ export const usePreferenceStore = defineStore({ } const valueList = Object.entries(data).reduce((arr, [key, value]) => { - if (!value) { + if (!value && typeof value !== 'number') { return arr } diff --git a/src/store/preference/model/window/index.js b/src/store/preference/model/window/index.js index c443c1ea..ef8a705b 100644 --- a/src/store/preference/model/window/index.js +++ b/src/store/preference/model/window/index.js @@ -3,6 +3,36 @@ export default { field: 'scrcpy', children: { + windowWidth: { + label: 'preferences.window.size.width', + field: '--window-width', + type: 'Input.number', + value: undefined, + placeholder: 'preferences.window.size.width.placeholder', + tips: 'preferences.window.size.width.tips', + }, + windowHeight: { + label: 'preferences.window.size.height', + field: '--window-height', + type: 'Input.number', + value: undefined, + placeholder: 'preferences.window.size.height.placeholder', + tips: 'preferences.window.size.height.tips', + }, + windowX: { + label: 'preferences.window.position.x', + field: '--window-x', + type: 'Input.number', + value: undefined, + placeholder: 'preferences.window.position.x.placeholder', + }, + windowY: { + label: 'preferences.window.position.y', + field: '--window-y', + type: 'Input.number', + value: undefined, + placeholder: 'preferences.window.position.y.placeholder', + }, windowBorderless: { label: 'preferences.window.borderless.name', field: '--window-borderless', @@ -31,19 +61,5 @@ export default { value: undefined, placeholder: 'preferences.window.disable-screen-saver.placeholder', }, - windowWidth: { - label: 'preferences.window.size.width', - field: '--window-width', - type: 'Input.number', - value: undefined, - placeholder: 'preferences.window.size.width.placeholder', - }, - windowHeight: { - label: 'preferences.window.size.height', - field: '--window-height', - type: 'Input.number', - value: undefined, - placeholder: 'preferences.window.size.height.placeholder', - }, }, }