Skip to content

Commit 4fe1bf6

Browse files
committed
💄 给快捷键分组界面标题增加图标
1 parent 3ce0c43 commit 4fe1bf6

File tree

3 files changed

+94
-27
lines changed

3 files changed

+94
-27
lines changed

app/src/core/service/controlService/shortcutKeysEngine/shortcutKeysGroup.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,31 @@
22
* 专门给各种快捷键分组
33
*/
44

5+
import {
6+
AppWindow,
7+
Brush,
8+
Fullscreen,
9+
Keyboard,
10+
MousePointer,
11+
Move,
12+
Network,
13+
PanelsTopLeft,
14+
SendToBack,
15+
Spline,
16+
SquareDashed,
17+
SquareMenu,
18+
} from "lucide-react";
19+
520
type ShortcutKeysGroup = {
621
title: string;
22+
icon: React.ReactNode;
723
keys: string[];
824
};
925

1026
export const shortcutKeysGroups: ShortcutKeysGroup[] = [
1127
{
1228
title: "basic",
29+
icon: <Keyboard />,
1330
keys: [
1431
"undo",
1532
"redo",
@@ -23,6 +40,7 @@ export const shortcutKeysGroups: ShortcutKeysGroup[] = [
2340
},
2441
{
2542
title: "camera",
43+
icon: <Fullscreen />,
2644
keys: [
2745
"resetView",
2846
"resetCameraScale",
@@ -34,10 +52,12 @@ export const shortcutKeysGroups: ShortcutKeysGroup[] = [
3452
},
3553
{
3654
title: "app",
55+
icon: <AppWindow />,
3756
keys: ["switchDebugShow", "exitSoftware", "checkoutProtectPrivacy", "reload"],
3857
},
3958
{
4059
title: "ui",
60+
icon: <PanelsTopLeft />,
4161
keys: [
4262
"checkoutClassroomMode",
4363
"checkoutWindowOpacityMode",
@@ -52,10 +72,12 @@ export const shortcutKeysGroups: ShortcutKeysGroup[] = [
5272
},
5373
{
5474
title: "draw",
75+
icon: <Brush />,
5576
keys: ["selectEntityByPenStroke", "penStrokeWidthIncrease", "penStrokeWidthDecrease"],
5677
},
5778
{
5879
title: "moveEntity",
80+
icon: <Move />,
5981
keys: [
6082
"moveUpSelectedEntities",
6183
"moveDownSelectedEntities",
@@ -69,10 +91,12 @@ export const shortcutKeysGroups: ShortcutKeysGroup[] = [
6991
},
7092
{
7193
title: "generateTextNodeInTree",
94+
icon: <Network className="-rotate-90" />,
7295
keys: ["generateNodeTreeWithDeepMode", "generateNodeTreeWithBroadMode", "generateNodeGraph"],
7396
},
7497
{
7598
title: "generateTextNodeRoundedSelectedNode",
99+
icon: <SendToBack />,
76100
keys: [
77101
"createTextNodeFromSelectedTop",
78102
"createTextNodeFromSelectedDown",
@@ -82,14 +106,17 @@ export const shortcutKeysGroups: ShortcutKeysGroup[] = [
82106
},
83107
{
84108
title: "createTextNode",
109+
icon: <SquareMenu />,
85110
keys: ["createTextNodeFromCameraLocation", "createTextNodeFromMouseLocation"],
86111
},
87112
{
88113
title: "section",
114+
icon: <SquareDashed />,
89115
keys: ["folderSection", "packEntityToSection", "unpackEntityFromSection", "textNodeToSection"],
90116
},
91117
{
92118
title: "leftMouseModeCheckout",
119+
icon: <MousePointer />,
93120
keys: [
94121
"checkoutLeftMouseToSelectAndMove",
95122
"checkoutLeftMouseToDrawing",
@@ -99,6 +126,7 @@ export const shortcutKeysGroups: ShortcutKeysGroup[] = [
99126
},
100127
{
101128
title: "edge",
129+
icon: <Spline />,
102130
keys: ["reverseEdges", "reverseSelectedNodeEdge"],
103131
},
104132
];

app/src/locales/zh_CN.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,63 @@ keys:
721721
wheelup: 滚轮向上
722722
wheeldown: 滚轮向下
723723

724+
keyBindsGroup:
725+
otherKeys:
726+
title: 未分类的快捷键
727+
description: |
728+
未分类的快捷键,
729+
此处若发现无翻译的无效快捷键项,可能是由于版本升级而未清理旧快捷键导致出现的残留
730+
可手动清理 keybinds.json 文件中的对应项
731+
basic:
732+
title: 基础快捷键
733+
description: |
734+
基本的快捷键,用于常用的功能
735+
camera:
736+
title: 摄像机控制
737+
description: |
738+
用于控制摄像机移动、缩放
739+
app:
740+
title: 应用控制
741+
description: |
742+
用于控制应用的一些功能
743+
ui:
744+
title: UI控制
745+
description: |
746+
用于控制UI的一些功能
747+
draw:
748+
title: 涂鸦
749+
description: |
750+
涂鸦相关功能
751+
moveEntity:
752+
title: 移动实体
753+
description: |
754+
用于移动实体的一些功能
755+
generateTextNodeInTree:
756+
title: 生长节点
757+
description: |
758+
通过键盘生长节点(Xmind用户习惯)
759+
generateTextNodeRoundedSelectedNode:
760+
title: 在选中节点周围生成节点
761+
description: |
762+
按下后,在选中节点周围生成节点
763+
createTextNode:
764+
title: 创建文本节点
765+
description: |
766+
按下后,在当前位置创建文本节点
767+
section:
768+
title: Section框
769+
description: |
770+
Section框相关功能
771+
leftMouseModeCheckout:
772+
title: 左键模式切换
773+
description: |
774+
关于左键模式的切换
775+
edge:
776+
title: 连线相关
777+
description: |
778+
关于连线的一些功能
779+
780+
724781
keyBinds:
725782
title: 快捷键绑定
726783
test:

app/src/pages/settings/keybinds.tsx

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Keyboard } from "lucide-react";
1+
import { FileQuestion, Keyboard } from "lucide-react";
22
import React from "react";
33
import { useTranslation } from "react-i18next";
44
import KeyBind from "../../components/KeyBind";
@@ -28,13 +28,19 @@ export default function KeyBindsPage() {
2828
};
2929

3030
const { t } = useTranslation("keyBinds");
31+
const t2 = useTranslation("keyBindsGroup");
3132

3233
return (
3334
<>
3435
{shortcutKeysGroups.map((group, i) => {
3536
console.log(group);
3637
return (
37-
<FieldGroup title={t(group.title)} key={i}>
38+
<FieldGroup
39+
icon={group.icon}
40+
title={t2.t(`${group.title}.title`)}
41+
description={t2.t(`${group.title}.description`)}
42+
key={i}
43+
>
3844
{group.keys.map((id) => (
3945
<Field
4046
key={id}
@@ -54,7 +60,7 @@ export default function KeyBindsPage() {
5460
</FieldGroup>
5561
);
5662
})}
57-
<FieldGroup title={t("otherKeys")} description={"未分组的快捷键"}>
63+
<FieldGroup title={t2.t(`otherKeys.title`)} description={t2.t(`otherKeys.description`)} icon={<FileQuestion />}>
5864
{getUnGroupedKeys()
5965
.map(([id, bind]) => (
6066
<Field
@@ -79,30 +85,6 @@ export default function KeyBindsPage() {
7985
return a.key.localeCompare(b.key); // 正常比较
8086
})}
8187
</FieldGroup>
82-
{/* <h1>{t("title")}</h1>
83-
{keyBinds
84-
.map(([id, bind]) => (
85-
<Field
86-
key={id}
87-
icon={<Keyboard />}
88-
title={t(`${id}.title`, { defaultValue: id })}
89-
description={t(`${id}.description`, { defaultValue: "" })}
90-
>
91-
<KeyBind
92-
value={bind}
93-
onChange={(value) => {
94-
KeyBinds.set(id, value.key, value.modifiers);
95-
setKeyBinds((prev) => prev.map((item) => (item[0] === id ? [item[0], value] : item)));
96-
}}
97-
/>
98-
</Field>
99-
))
100-
.sort((a, b) => {
101-
if (a.key === null && b.key === null) return 0; // 两者均为 null,相等
102-
if (a.key === null) return 1; // a.key 为 null,把它排到后面
103-
if (b.key === null) return -1; // b.key 为 null,把它排到后面
104-
return a.key.localeCompare(b.key); // 正常比较
105-
})} */}
10688
</>
10789
);
10890
}

0 commit comments

Comments
 (0)