liwei 1 year ago
parent
commit
c5dd6cea37
1 changed files with 6 additions and 13 deletions
  1. 6 13
      src/modules/editor/controllers/SelectCtrl/index.ts

+ 6 - 13
src/modules/editor/controllers/SelectCtrl/index.ts

@@ -398,24 +398,17 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
 
     if (isClick) {
       this._state = MODE_NONE;
-      const comps = this.compClickTest(e);
-      if (comps.length < 1) {
-        setTimeout(() => {
-            this.transferStyle.editingText = false;
-            this.actions.selectObjs([]) //清空选择
-        }, 0);
-      } else {
+
+      if (this._downClickedCompId) {
         const compKey = this.getDivFlag(e.target as any, "compKey");
         console.log("up compKey === >", compKey);
         if (compKey == "Text" ) { //点击鼠标上来后 focus文本选中
              const compId = this.getDivFlag(e.target as any, "compId");
-             if ( this.selected.length ==  1 && this.selected[0].comp.id == compId ) {
-
+             if ( this.selected.length ==  1 && this.store.currComp.id == compId ) {
                 //取消当前选择
                 this.selecteObjs([])
                 this.actions.textFocus(compId);
                 this.transferStyle.editingText = true;
-                
              }
         }
       }
@@ -438,7 +431,7 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
     } else if (this._state == MODE_SCALE) {
       this.scaleMouseUp(e);
     } else if (this._state == MODE_MOVING) {
-      this.moveMouseUp(e);
+      this.moveMouseUp(e, isClick);
     }
 
     this._state = MODE_NONE;
@@ -453,7 +446,7 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
     this.upgateGizmoStyle();
     this.helper.extendStreamCard(this.store.currStreamCardId);
   }
-  moveMouseUp(e: MouseEvent) {
+  moveMouseUp(e: MouseEvent, clicked:boolean) {
     const history = this.controls.historyCtrl.history;
 
     const obj = this.objContainer as ObjsContainer;
@@ -466,7 +459,7 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
       this._initMovePos.x = -1;
       this._initMovePos.y = -1;
 
-      if (this.store.selected.length == 1 && this.store.currComp.compKey == "Text") {
+      if ( !clicked && this.store.selected.length == 1 && this.store.currComp.compKey == "Text") {
           this.actions.textFocus(this.store.currCompId, false)
       }