liwei 1 year ago
parent
commit
dbe053b3d7
1 changed files with 14 additions and 17 deletions
  1. 14 17
      src/modules/editor/controllers/SelectCtrl/gizemo.ts

+ 14 - 17
src/modules/editor/controllers/SelectCtrl/gizemo.ts

@@ -154,23 +154,7 @@ export class Gizemo extends Events {
           this.parent.updateTransform();
           
           console.log("mouse=>", this.state.mouse);
-          if ( (this.state.mouse == "scaleright" || this.state.mouse == "scaleleft") && this.selected.length == 1 ) {
-              const child = this.selected[0];
-              if (child.comp.compKey =='Text'){
-                  const element: HTMLElement | null = document.querySelector(`#editor_${child.comp.id}`);
-                  if (!element) {
-                      return;
-                    }
-                    const h = pxToDesignSize(element.clientHeight);
-                    const layoutSize = child.comp.layout.size.slice(0);
-                    // @ts-ignore
-                    // child.setHeight(h)
-                    child.comp.layout.setSize([layoutSize[0],h]);
-                    this.rect.height = element.clientHeight;
-                
-             }
-          }
-
+          
           this.updateCompState();
           this.emit("change");
         })
@@ -371,9 +355,22 @@ export class Gizemo extends Events {
 
 
     scaleX(x:number, submit= false) {
+
+        if ( (this.state.mouse == "scaleright" || this.state.mouse == "scaleleft") && this.selected.length == 1 ) {
+            const child = this.selected[0];
+            if (child.comp.compKey =='Text'){
+                const element: HTMLElement | null = document.querySelector(`#editor_${child.comp.id}`);
+                if (!element) {
+                    return;
+                  }
+                  child.height = element.clientHeight;
+           }
+        }
+        
         const t = {...this.state.transform};
         t.sx = x;
         this.state.setTransform(t);
+
         if (submit) this.history.submit();
     }