Browse Source

Merge branch 'develop' of http://39.106.8.246:3003/web/wanda-editer into develop

haojianlong 4 years ago
parent
commit
85390cb857

+ 12 - 4
src/components/edit/attr_select.vue

@@ -399,14 +399,20 @@ export default {
     },
     // 改变线的颜色
     changeBorderColor() {
-      bus.$emit("changeBorderColor", this.borderColor);
+      if (this.borderColor) {
+        bus.$emit("changeBorderColor", this.borderColor);
+      }
     },
     // 改变字体颜色
     changeFontColor(color) {
-      bus.$emit("changeFontColor", color);
+      if (color) {
+        bus.$emit("changeFontColor", color);
+      }
     },
     changebackColor(color) {
-      bus.$emit("changebackColor", color);
+      if (color) {
+        bus.$emit("changebackColor", color);
+      }
     },
     customRequest(info) {
       const formData = new FormData();
@@ -450,7 +456,9 @@ export default {
       bus.$emit("changeImageNum", this.imageNum);
     },
     changefillColor() {
-      bus.$emit("changefillColor", this.fillColor);
+      if (this.fillColor) {
+        bus.$emit("changefillColor", this.fillColor);
+      }
     },
     //设置缩小item为编辑状态
     OpenEditStatus() {

+ 13 - 6
src/components/edit/right_toolbar.vue

@@ -97,7 +97,7 @@ export default {
       attrType: "",
       elementData: [],
       key: "",
-      isLock: false,
+      isLock: true,
       aspectRatio: 1,// 元素宽高比
     };
   },
@@ -214,19 +214,26 @@ export default {
           }
           if (item.name == "Width") {
             item.msg = width;
-            // 针对图片
-            if (Item instanceof SImageMarkerItem) {
+            // Icon显示图片宽
+            if (Item instanceof SImageLegendItem) {
+              item.msg = Item.img.width;
+            }
+            // 针对图片及Icon
+            if (Item instanceof SImageMarkerItem || Item instanceof SImageLegendItem) {
               item.disable = false;
-              // item.msg = Item.width;
             } else {
               item.disable = true;
             }
           }
           if (item.name == "Height") {
             item.msg = height;
-            if (Item instanceof SImageMarkerItem) {
+            // Icon显示图片高
+            if (Item instanceof SImageLegendItem) {
+              item.msg = Item.img.height;
+            }
+            // 针对图片及Icon
+            if (Item instanceof SImageMarkerItem || Item instanceof SImageLegendItem) {
               item.disable = false;
-              // item.msg = Item.height;
             } else {
               item.disable = true;
             }

+ 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() {

+ 1 - 1
src/components/mapClass/EditScence.ts

@@ -415,7 +415,7 @@ export class EditScence extends SGraphScene {
                 sWidth: 24,  //icon 的宽
                 sHeight: 24,   //icon 的高
                 font: 12,    //font
-                color: ''  //字体颜色
+                color: '',  //字体颜色
             },
         }
         const item = new SImageLegendItem(null, LegendData);

+ 8 - 0
src/lib/items/SImageLegendItem.ts

@@ -56,6 +56,12 @@ export class SImageLegendItem extends SIconTextItem {
         if (data.Properties && data.Properties.Url) {
             this.img.url = data.Properties.Url;
         }
+        if (data.Properties.ImgPos) {
+            this.img.moveTo(data.Properties.ImgPos.X, data.Properties.ImgPos.Y);
+        }
+        if (data.Properties.TextPos) {
+            this.textItem.moveTo(data.Properties.TextPos.X, data.Properties.TextPos.Y);
+        }
         if (data.Properties && data.Properties.sWidth) {
             this.sWidth = data.Properties.sWidth;
         }
@@ -75,6 +81,8 @@ export class SImageLegendItem extends SIconTextItem {
         this.data.Size = {Width: this.width, Height: this.height};
         this.data.Name = this.name;
         this.data.Properties.Url = this.img.url;
+        this.data.Properties.TextPos = {X: this.textItem.x, Y: this.textItem.y};
+        this.data.Properties.ImgPos = {X: this.img.x, Y: this.img.y};
         this.data.Properties.sWidth = this.sWidth;
         this.data.Properties.sHeight = this.sHeight;
         this.data.Properties.font = this.font.size;