Skip to content

Commit 20c662b

Browse files
author
阿岳
committed
fix: 暂时将中括号键的起飞降落改为固定快捷键,以解决按下后监听不到松开的情况(此快捷键和WSAD一样暂时不支持自定义)
1 parent aff659e commit 20c662b

File tree

2 files changed

+27
-28
lines changed

2 files changed

+27
-28
lines changed

app/src/core/service/controlService/controller/concrete/ControllerCamera.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,20 @@ export class ControllerCameraClass extends ControllerClass {
4242
return;
4343
}
4444
const key = event.key.toLowerCase();
45+
46+
// 视野缩放:起飞(放大)
47+
if (key === "[" || key === "【") {
48+
this.project.camera.isStartZoomIn = true;
49+
this.project.camera.addScaleFollowMouseLocationTime(1);
50+
return;
51+
}
52+
// 视野缩放:降落(缩小)
53+
if (key === "]" || key === "】") {
54+
this.project.camera.isStartZoomOut = true;
55+
this.project.camera.addScaleFollowMouseLocationTime(1);
56+
return;
57+
}
58+
4559
if (ControllerCameraClass.keyMap[key] && Settings.allowMoveCameraByWSAD) {
4660
if (this.project.controller.pressingKeySet.has("control") || this.project.controller.pressingKeySet.has("meta")) {
4761
// ctrl按下时,可能在按 ctrl+s 保存,防止出现冲突
@@ -86,6 +100,19 @@ export class ControllerCameraClass extends ControllerClass {
86100
}
87101
// ------
88102

103+
// 停止视野缩放:起飞
104+
if (key === "[" || key === "【") {
105+
this.project.camera.isStartZoomIn = false;
106+
this.project.camera.addScaleFollowMouseLocationTime(5);
107+
return;
108+
}
109+
// 停止视野缩放:降落
110+
if (key === "]" || key === "】") {
111+
this.project.camera.isStartZoomOut = false;
112+
this.project.camera.addScaleFollowMouseLocationTime(5);
113+
return;
114+
}
115+
89116
if (ControllerCameraClass.keyMap[key] && Settings.allowMoveCameraByWSAD) {
90117
if (this.isPressingCtrlOrMeta) {
91118
// ctrl按下时,可能在按 ctrl+s 保存,防止出现冲突

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

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -178,34 +178,6 @@ export const allKeyBinds: KeyBindItem[] = [
178178
defaultKey: "C-A-r",
179179
onPress: (project) => project!.camera.resetScale(),
180180
},
181-
{
182-
id: "CameraScaleZoomIn",
183-
defaultKey: "[",
184-
onPress: (project) => {
185-
// if (!project!.keyboardOnlyEngine.isOpenning()) return;
186-
// project!.camera.zoomInByKeyboardPress();
187-
project!.camera.isStartZoomIn = true;
188-
project!.camera.addScaleFollowMouseLocationTime(1);
189-
},
190-
onRelease: (project) => {
191-
project!.camera.isStartZoomIn = false;
192-
project!.camera.addScaleFollowMouseLocationTime(5);
193-
},
194-
},
195-
{
196-
id: "CameraScaleZoomOut",
197-
defaultKey: "]",
198-
onPress: (project) => {
199-
// if (!project!.keyboardOnlyEngine.isOpenning()) return;
200-
// project!.camera.zoomOutByKeyboardPress();
201-
project!.camera.isStartZoomOut = true;
202-
project!.camera.addScaleFollowMouseLocationTime(1);
203-
},
204-
onRelease: (project) => {
205-
project!.camera.isStartZoomOut = false;
206-
project!.camera.addScaleFollowMouseLocationTime(5);
207-
},
208-
},
209181

210182
/*------- 相机分页移动(Win) -------*/
211183
// 注意:实际运行时会根据 isMac 注册其一,这里两份都列出方便查阅

0 commit comments

Comments
 (0)