fix(KeyBoard): setting card width

This commit is contained in:
AkiChase 2024-05-19 09:15:27 +08:00
parent ab67d20198
commit d1b6292b8a
9 changed files with 28 additions and 23 deletions

View File

@ -210,14 +210,14 @@ function showSetting() {
> >
<NH4 prefix="bar">{{ <NH4 prefix="bar">{{
keyMapping.type === "CancelSkill" keyMapping.type === "CancelSkill"
? "技能取消" ? t("pages.KeyBoard.KeyCommon.cancelSkill")
: keyMapping.type === "Tap" : keyMapping.type === "Tap"
? "普通点击" ? t("pages.KeyBoard.KeyCommon.tap")
: "宏" : t("pages.KeyBoard.KeyCommon.macro")
}}</NH4> }}</NH4>
<NFormItem <NFormItem
v-if="keyMapping.type === 'Macro'" v-if="keyMapping.type === 'Macro'"
:label="$t('pages.KeyBoard.KeyCommon.macro')" :label="$t('pages.KeyBoard.KeyCommon.macroCode')"
> >
<NButton type="success" @click="editMacro"> <NButton type="success" @click="editMacro">
{{ $t("pages.KeyBoard.KeyCommon.editMacro") }} {{ $t("pages.KeyBoard.KeyCommon.editMacro") }}

View File

@ -77,11 +77,11 @@ function showSetting() {
const keyboardElement = document.getElementById( const keyboardElement = document.getElementById(
"keyboardElement" "keyboardElement"
) as HTMLElement; ) as HTMLElement;
const maxWidth = keyboardElement.clientWidth - 150; const maxWidth = keyboardElement.clientWidth - 200;
const maxHeight = keyboardElement.clientHeight - 420; const maxHeight = keyboardElement.clientHeight - 430;
settingPosX.value = Math.min(keyMapping.value.posX + 40, maxWidth); settingPosX.value = Math.min(keyMapping.value.posX + 40, maxWidth);
settingPosY.value = Math.min(keyMapping.value.posY - 30, maxHeight); settingPosY.value = Math.min(keyMapping.value.posY - 40, maxHeight);
keyboardStore.showButtonSettingFlag = true; keyboardStore.showButtonSettingFlag = true;
} }
</script> </script>
@ -189,8 +189,8 @@ function showSetting() {
flex-direction: column; flex-direction: column;
padding: 10px 20px; padding: 10px 20px;
box-sizing: border-box; box-sizing: border-box;
width: 150px; width: 200px;
height: 420px; height: 430px;
border-radius: 5px; border-radius: 5px;
border: 2px solid var(--light-color); border: 2px solid var(--light-color);
background-color: var(--bg-color); background-color: var(--bg-color);

View File

@ -73,7 +73,7 @@ function showSetting() {
const maxHeight = keyboardElement.clientHeight - 300; const maxHeight = keyboardElement.clientHeight - 300;
settingPosX.value = Math.min(keyMapping.value.posX + 40, maxWidth); settingPosX.value = Math.min(keyMapping.value.posX + 40, maxWidth);
settingPosY.value = Math.min(keyMapping.value.posY - 30, maxHeight); settingPosY.value = Math.min(keyMapping.value.posY - 40, maxHeight);
keyboardStore.showButtonSettingFlag = true; keyboardStore.showButtonSettingFlag = true;
} }
</script> </script>

View File

@ -69,11 +69,11 @@ function showSetting() {
const keyboardElement = document.getElementById( const keyboardElement = document.getElementById(
"keyboardElement" "keyboardElement"
) as HTMLElement; ) as HTMLElement;
const maxWidth = keyboardElement.clientWidth - 150; const maxWidth = keyboardElement.clientWidth - 200;
const maxHeight = keyboardElement.clientHeight - 380; const maxHeight = keyboardElement.clientHeight - 380;
settingPosX.value = Math.min(keyMapping.value.posX + 40, maxWidth); settingPosX.value = Math.min(keyMapping.value.posX + 40, maxWidth);
settingPosY.value = Math.min(keyMapping.value.posY - 30, maxHeight); settingPosY.value = Math.min(keyMapping.value.posY - 40, maxHeight);
keyboardStore.showButtonSettingFlag = true; keyboardStore.showButtonSettingFlag = true;
} }
</script> </script>
@ -176,7 +176,7 @@ function showSetting() {
flex-direction: column; flex-direction: column;
padding: 10px 20px; padding: 10px 20px;
box-sizing: border-box; box-sizing: border-box;
width: 150px; width: 200px;
height: 380px; height: 380px;
border-radius: 5px; border-radius: 5px;
border: 2px solid var(--light-color); border: 2px solid var(--light-color);

View File

@ -184,10 +184,10 @@ function showSetting() {
"keyboardElement" "keyboardElement"
) as HTMLElement; ) as HTMLElement;
// setting // setting
const maxWidth = keyboardElement.clientWidth - 200; const maxWidth = keyboardElement.clientWidth - 220;
const maxHeight = keyboardElement.clientHeight - 430; const maxHeight = keyboardElement.clientHeight - 430;
settingPosX.value = Math.min(keyMapping.value.posX + 40, maxWidth); settingPosX.value = Math.min(keyMapping.value.posX + 40, maxWidth);
settingPosY.value = Math.min(keyMapping.value.posY - 30, maxHeight); settingPosY.value = Math.min(keyMapping.value.posY - 40, maxHeight);
updateRangeIndicator(keyboardElement); updateRangeIndicator(keyboardElement);
keyboardStore.showButtonSettingFlag = true; keyboardStore.showButtonSettingFlag = true;
} }
@ -373,7 +373,7 @@ function updateRangeIndicator(element?: HTMLElement) {
flex-direction: column; flex-direction: column;
padding: 10px 20px; padding: 10px 20px;
box-sizing: border-box; box-sizing: border-box;
width: 200px; width: 220px;
height: 430px; height: 430px;
border-radius: 5px; border-radius: 5px;
border: 2px solid var(--light-color); border: 2px solid var(--light-color);

View File

@ -79,7 +79,7 @@ function showSetting() {
const keyboardElement = document.getElementById( const keyboardElement = document.getElementById(
"keyboardElement" "keyboardElement"
) as HTMLElement; ) as HTMLElement;
const maxWidth = keyboardElement.clientWidth - 150; const maxWidth = keyboardElement.clientWidth - 179;
const maxHeight = keyboardElement.clientHeight - 300; const maxHeight = keyboardElement.clientHeight - 300;
settingPosX.value = Math.min( settingPosX.value = Math.min(
@ -219,7 +219,7 @@ function showSetting() {
flex-direction: column; flex-direction: column;
padding: 10px 20px; padding: 10px 20px;
box-sizing: border-box; box-sizing: border-box;
width: 150px; width: 170px;
height: 300px; height: 300px;
border-radius: 5px; border-radius: 5px;
border: 2px solid var(--light-color); border: 2px solid var(--light-color);

View File

@ -650,7 +650,6 @@ function addSightShortcuts(
sightKeyMapping: KeySight, sightKeyMapping: KeySight,
fireKeyMapping?: KeyFire fireKeyMapping?: KeyFire
) { ) {
// TODO 5. 调整所有按键设置宽度,英文的存在换行问题
const appWindow = getCurrent(); const appWindow = getCurrent();
let mouseLock = false; let mouseLock = false;

View File

@ -143,7 +143,6 @@
"KeyCommon": { "KeyCommon": {
"macroParseSuccess": "The macro code is parsed successfully, but the correctness of the code is not guaranteed. Please test by yourself.", "macroParseSuccess": "The macro code is parsed successfully, but the correctness of the code is not guaranteed. Please test by yourself.",
"macroParseFailed": "Macro code failed to save, please check whether the code format is correct.", "macroParseFailed": "Macro code failed to save, please check whether the code format is correct.",
"macro": "Macro code",
"editMacro": "Edit macro", "editMacro": "Edit macro",
"macroModal": { "macroModal": {
"title": "Macro editor", "title": "Macro editor",
@ -151,7 +150,11 @@
"placeholder": "JSON macro code, can be empty", "placeholder": "JSON macro code, can be empty",
"loop": "Macro executed on key press and hold", "loop": "Macro executed on key press and hold",
"up": "Macro executed on key up" "up": "Macro executed on key up"
} },
"macroCode": "Macro code",
"cancelSkill": "CancelSkill",
"tap": "Tap",
"macro": "Macro"
}, },
"setting": { "setting": {
"touchTime": "Touch duration", "touchTime": "Touch duration",

View File

@ -143,7 +143,6 @@
"KeyCommon": { "KeyCommon": {
"macroParseSuccess": "宏代码解析成功,但不保证代码正确性,请自行测试", "macroParseSuccess": "宏代码解析成功,但不保证代码正确性,请自行测试",
"macroParseFailed": "宏代码保存失败,请检查代码格式是否正确", "macroParseFailed": "宏代码保存失败,请检查代码格式是否正确",
"macro": "宏代码",
"editMacro": "编辑宏代码", "editMacro": "编辑宏代码",
"macroModal": { "macroModal": {
"title": "宏编辑", "title": "宏编辑",
@ -151,7 +150,11 @@
"loop": "按住执行的宏", "loop": "按住执行的宏",
"placeholder": "JSON宏代码, 可为空", "placeholder": "JSON宏代码, 可为空",
"up": "抬起执行的宏" "up": "抬起执行的宏"
} },
"cancelSkill": "技能取消",
"tap": "普通点击",
"macroCode": "宏代码",
"macro": "宏"
}, },
"setting": { "setting": {
"touchTime": "触摸时长", "touchTime": "触摸时长",