Prechádzať zdrojové kódy

对齐选中的小于2个元素置灰

zhulizhen1111 4 rokov pred
rodič
commit
4e529e202e
1 zmenil súbory, kde vykonal 25 pridanie a 10 odobranie
  1. 25 10
      src/components/edit/top_toolbar.vue

+ 25 - 10
src/components/edit/top_toolbar.vue

@@ -37,7 +37,7 @@
               <a-icon type="caret-down" class="down-icon" />
             </div>
             <a-menu slot="overlay">
-              <a-menu-item v-for="item in alignmentOptions" :key="item.value" @click="changeAlignItem(item.value)">
+              <a-menu-item :disabled='item.disable' v-for="item in alignmentOptions" :key="item.value" @click="changeAlignItem(item.value)">
                 <img style="width: 16px;margin-right: 5px;" :src="require(`./../../assets/images/`+item.img+`.png`)" alt />
                 <span>{{item.label}}</span>
               </a-menu-item>
@@ -89,42 +89,50 @@ export default {
         {
           value: SGraphLayoutType.Left,
           label: "左对齐",
-          img: "t-left"
+          img: "t-left",
+          disable:true,
         },
         {
           value: SGraphLayoutType.Right,
           label: "右对齐",
-          img: "t-right"
+          img: "t-right",
+           disable:true,
         },
         {
           value: SGraphLayoutType.Top,
           label: "顶对齐",
-          img: "t-top"
+          img: "t-top",
+           disable:true,
         },
         {
           value: SGraphLayoutType.Bottom,
           label: "底对齐",
-          img: "t-bottom"
+          img: "t-bottom",
+           disable:true,
         },
         {
           value: SGraphLayoutType.Center,
           label: "水平居中对齐",
-          img: "t-center"
+          img: "t-center",
+           disable:true,
         },
         {
           value: SGraphLayoutType.Middle,
           label: "垂直居中对齐",
-          img: "t-topandbottm"
+          img: "t-topandbottm",
+           disable:true,
         },
         {
           value: SGraphLayoutType.Vertical,
           label: "垂直分布",
-          img: "t-vertical"
+          img: "t-vertical",
+           disable:true,
         },
         {
           value: SGraphLayoutType.Horizontal,
           label: "水平分布",
-          img: "t-level"
+          img: "t-level",
+           disable:true,
         }
       ],
       scale: 0.5, //底图缩放比例
@@ -182,10 +190,17 @@ export default {
       bus.$emit('changeScale', this.scale / oldScale)
     },
     FocusItemChanged(itemMsg) {
-      this.focusItem = null;
+      this.focusItem = null; 
+      this.alignmentOptions.forEach(el=>{
+            el.disable = true
+        })
       if (itemMsg.itemList.length == 1) {
         this.isLock = itemMsg.itemList[0].moveable;
         this.focusItem = itemMsg.itemList[0];
+      }else if (itemMsg.itemList.length > 1) {
+          this.alignmentOptions.forEach(el=>{
+              el.disable = false
+          })
       }
     },
     lockItem() {