Przeglądaj źródła

修复旋转缩放的功能

liwei 1 rok temu
rodzic
commit
6087d432d7
1 zmienionych plików z 17 dodań i 1 usunięć
  1. 17 1
      src/modules/editor/controllers/SelectCtrl/index.ts

+ 17 - 1
src/modules/editor/controllers/SelectCtrl/index.ts

@@ -675,17 +675,27 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
     let initrad = scope.objinitAngleRad;
 
     const history = this.controls.historyCtrl.history;
+    this.objContainer?.setPivot(0);
+  
     history.record({
       undo: () => {
-        console.log("undo ");
+       
+        const objContainer = this.objContainer as ObjsContainer;
+  
         this.objContainer?.setPivot(4);
         this.objContainer?.rotate(initrad);
+        this.objContainer?.setPivot(0);
+        this.objContainer?.updateCompState();
         this.upgateGizmoStyle();
       },
+
       redo: () => {
         console.log("redo ");
+        const objContainer = this.objContainer as ObjsContainer;
         this.objContainer?.setPivot(4);
         this.objContainer?.rotate(last);
+        this.objContainer?.setPivot(0);
+        this.objContainer?.updateCompState();
         this.upgateGizmoStyle();
       },
     } as any);
@@ -802,6 +812,7 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
       let lastScale = { x: this.lastScale.x, y: this.lastScale.y };
 
       const history = this.controls.historyCtrl.history;
+      this.objContainer?.setPivot(0);
 
       history.record({
         undo: () => {
@@ -809,12 +820,17 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
 
           this.objContainer?.setPivot(scaleIndex);
           this.objContainer?.scaleSize(preScale.x, preScale.y);
+          this.objContainer?.setPivot(0);
+          this.objContainer?.updateCompState();
+
           this.upgateGizmoStyle();
         },
         redo: () => {
           console.log("redo ");
           this.objContainer?.setPivot(scaleIndex);
           this.objContainer?.scaleSize(lastScale.x, lastScale.y);
+          this.objContainer?.setPivot(0);
+          this.objContainer?.updateCompState();
           this.upgateGizmoStyle();
         },
       } as any);