Przeglądaj źródła

当父组件尺寸使用%时,子组件采用%偏移

lianghongjie 1 rok temu
rodzic
commit
178eb9f717

+ 4 - 1
src/modules/editor/objects/DesignTemp/creates/createCompStyle.ts

@@ -97,7 +97,10 @@ export function createCompStyle(
   if (layout.transformMatrix) {
     const m = Matrix.createFromMatrixStr(layout.transformMatrix);
     m.ty = parseFloat(
-      designToNaturalSize(pxToDesignSize(m.ty), { adaptiveH: true })
+      designToNaturalSize(pxToDesignSize(m.ty), {
+        adaptiveH:
+          module.helper.findParentComp(comp.id)?.layout.size[2]?.unit === "%",
+      })
     );
     style.transform = m.getMatrixStr(); //layout.transformMatrix;
     style.transformOrigin = "0 0";