Browse Source

修复尺寸问题

liwei 1 year ago
parent
commit
a47d7fc478

+ 4 - 3
src/modules/editor/controllers/SelectCtrl/ObjsContainer.ts

@@ -155,7 +155,8 @@ export class ObjsContainer {
         this.parent.updateTransform();
 
         this.pivotIndex = index;
-        return { x: point.x * 0.5, y: point.y * 0.5 };
+
+        return { x: point.x, y: point.y};
     }
 
     getPivotXY(index:number) {
@@ -189,8 +190,8 @@ export class ObjsContainer {
         let pX = { x: pointX.x, y: pointX.y } as any;
         this.parent.worldTransform.apply(pX, pX);
 
-        let xVec = { x: (pX.x - point.x) * 0.5, y: (pX.y - point.y) * 0.5 };
-        let yVec = { x: (pY.x - point.x) * 0.5, y: (pY.y - point.y) * 0.5 };
+        let xVec = { x: (pX.x - point.x), y: (pX.y - point.y) };
+        let yVec = { x: (pY.x - point.x), y: (pY.y - point.y) };
 
         return { x: xVec, y: yVec };
     }

+ 7 - 0
src/modules/editor/module/actions/edit.ts

@@ -230,6 +230,13 @@ export const editActions = EditorModule.action({
     console.log(comp);
   },
 
+  // 设置组件变换
+  setCompTransformMatrix(comp: DesignComp, transformMatrix: string) {
+    if (!comp) return;
+    
+    comp.layout.transformMatrix = transformMatrix;
+  },
+
   updateCompData(comp: DesignComp, path: string, value: any) {
     set(comp, path, value);
   },