Quellcode durchsuchen

Merge branch 'dev' of http://124.70.149.18:10880/lianghj/queenshow into dev

qinyan vor 1 Jahr
Ursprung
Commit
35b3ab6809

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

@@ -77,7 +77,7 @@ export class PageCtrl extends ModuleControl<EditorModule> {
         const keys = Object.keys(this.designData.compMap);
         const compMap :any = {};
         keys.forEach(k=>{
-           compMap[k] = this.designData.compMap[k].toJson();
+           compMap[k] = this.designData.compMap[k].toJson?.();
         })
         out.compMap = compMap;
         console.log(out);

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

@@ -181,6 +181,7 @@ export class ScreenCtrl extends ModuleControl<EditorModule> {
       }
       
       this.controls.editorCtrl.state.setPage({w, h});
+      if (!page.rootPage.layout.size) page.rootPage.layout.size = [0, 0]
       page.rootPage.layout.size[0] = this.getCurrScreenWidth();
       page.rootPage.layout.size[1] = this.getCurrScreenHeight(); 
 

+ 1 - 1
src/modules/editor/module/helpers/index.ts

@@ -177,7 +177,7 @@ export const helpers = EditorModule.helper({
         const comp = compMap[id];
         if (!comp) return;
         used.add(id);
-        getUsedIds(comp.children.default);
+        getUsedIds(comp.children.default || []);
       });
       return used;
     };

+ 2 - 4
src/modules/editor/objects/DesignTemp/factory.ts

@@ -106,10 +106,8 @@ export function createObj( data:any, init = true) :DesignComp {
     }
 
     //兼容老数据
-    if (compKey == "Cover") {
-      console.log( data );
-      debugger;
-    }
+   
+    console.log("compKey=>", compKey);
 
     return data;
 }

+ 8 - 3
src/modules/editor/objects/Toolbars/default.ts

@@ -211,7 +211,8 @@ export const toolbars = createToolbars({
     component: TipIcons.LayerUp,
     getVisible: (comp) => !!comp,
     onClick(comp) {
-      this.actions.setCompLayer(comp, 1);
+      const paths = this.helper.getCompTrees(comp.id)
+      this.actions.setCompLayer(paths[2], 1);
     },
   },
   // 定位图层下移
@@ -219,7 +220,8 @@ export const toolbars = createToolbars({
     component: TipIcons.LayerDown,
     getVisible: (comp) => !!comp,
     onClick(comp) {
-      this.actions.setCompLayer(comp, -1);
+      const paths = this.helper.getCompTrees(comp.id)
+      this.actions.setCompLayer(paths[2], -1);
     },
   },
   // 切换到父组件
@@ -276,7 +278,10 @@ export const toolbars = createToolbars({
   imageCropper: {
     component: TipIcons.Cropper,
     getVisible(comp) {
-      return  this.store.currComp && this.store.currComp.compKey == "Image";
+      const gizmo = this.controls.selectCtrl.gizmo
+      let isRight = gizmo.selectedIds.length == 1 
+      if (!isRight) return false;
+      return gizmo.selected[0].comp.compKey == "Image";
     },
     onClick(comp) {
       this.controls.cropCtrl.croppImage(this.store.currComp.id);