Ver Fonte

添加actrl+a全选功能

liwei há 1 ano atrás
pai
commit
e443c9375a

+ 8 - 0
src/modules/editor/controllers/HotKeyCtrl/index.ts

@@ -95,6 +95,14 @@ export class HotKeyCtrl extends ModuleControl<EditorModule> {
 
   init() {
     const { module, hotKeys } = this;
+    document.addEventListener('keydown',(event) =>{
+      // 判断按下的键是否是 Ctrl 键和 A 键
+      if (event.ctrlKey && event.key === 'a') {
+        event.preventDefault();
+        event.stopPropagation();
+        this.actions.ctrlAndA();
+      }
+    });
 
     hotkeys(
       hotKeys.map((d) => d.hotKey).join(","),

+ 7 - 1
src/modules/editor/module/actions/edit.tsx

@@ -488,7 +488,13 @@ export const editActions = EditorModule.action({
     childs.push(...ids);
     this.store.currStreamCard.children.default = childs;
   },
-
+  ctrlAndA() {
+    const childrens = (this.store.currStreamCard.children.default ||[]).slice(0);
+    this.actions.selectObjs(childrens);
+    // this.controls.selectCtrl.
+    //objc.updateSize();
+    //selectCtrl.upgateGizmoStyle();
+  },
   // 删除组件
   removeSelectComps() {
     const selected = this.store.selected.slice(0);