qinyan 1 年之前
父节点
当前提交
7b2b07ee4a

+ 2 - 1
src/modules/editor/components/CompUI/basicUI/Text/component2.tsx

@@ -10,6 +10,7 @@ import { CompTextObj } from ".";
 import { Matrix } from "@/modules/editor/controllers/SelectCtrl/matrix";
 import { Transform } from "@/modules/editor/controllers/SelectCtrl/objects/transform";
 import { DesignComp } from "@/modules/editor/objects/DesignTemp/DesignComp";
+import { Design_Page_Size } from "@/modules/editor/dicts/CompOptions";
 
 export const Component = defineComponent({
   props: {
@@ -43,7 +44,7 @@ export const Component = defineComponent({
       m.tx = 0;
       m.rotate(-m.getRotate());
 
-      const [w, h] = comp.layout.size;
+      const [w, h] = comp.layout.size || [Design_Page_Size[0], 0];
 
       const currWidth = w * t.scale.x;
       const textWidth = currWidth / t.scale.y;

+ 3 - 1
src/modules/editor/components/Viewport/Slider/SliderRight/CompTree.tsx

@@ -41,7 +41,9 @@ export const CompTree = defineComponent({
                 compUICtrl.state.components.get(comp.compKey)?.name ||
                 "未命名",
               value: comp.id,
-              children: getCompChildren(comp.getChildIds()),
+              children: comp?.getChildIds
+                ? getCompChildren(comp?.getChildIds())
+                : [],
             };
           });
         }

+ 1 - 1
src/modules/editor/controllers/ScreenCtrl/index.ts

@@ -230,7 +230,7 @@ export class ScreenCtrl extends ModuleControl<EditorModule> {
          childrs.forEach(item=>{
             newChilds.push(item.id);
             const screenComp = this.helper.findComp(item.id) as DesignComp;
-            if(!screenComp) return
+            if(!screenComp || !screenComp.layout.size) return;
             screenComp.layout.size[0] = item.size[0];
             screenComp.layout.size[1] = item.size[1];
             screenComp.layout.transformMatrix = item.matrix;

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

@@ -27,6 +27,7 @@ export function createViewStyles(
       style["overflow"] = "hidden";
     }
     if (layout.border.radius2 !== undefined) {
+      if (!layout.size) return;
       style["border-radius"] =
         (designSizeToPx(Math.min(layout.size[0], layout.size[1])) *
           layout.border.radius2) /