liwei 1 year ago
parent
commit
a47ce5a9c0
1 changed files with 8 additions and 3 deletions
  1. 8 3
      src/modules/editor/objects/Toolbars/default.ts

+ 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);