YaolongHan 4 years ago
parent
commit
10cc55e426

+ 0 - 3
src/components/baseEditer.vue

@@ -189,9 +189,6 @@ export default {
       bus.$on("changeFontColor", val => {
         this.scene.updatedFontColor(val);
       });
-      bus.$on("changeFontColor", val => {
-        this.scene.updatedFontColor(val);
-      });
       bus.$on("itemWidth", val => {
         this.scene.updatedWidth(Number(val));
       });

+ 24 - 8
src/components/edit/right_toolbar.vue

@@ -104,15 +104,16 @@ export default {
       } else if (item.name == "Height") {
         bus.$emit("itemHeight", item.msg);
       } else if (item.name == "X" || item.name == "Y") {
-        let x,y=''
-        this.msgList.forEach(t=>{
-          if(t.name == 'X'){
-                x = t.msg
-          }else if(t.name == 'Y'){
-                y = t.msg
+        let x,
+          y = "";
+        this.msgList.forEach(t => {
+          if (t.name == "X") {
+            x = t.msg;
+          } else if (t.name == "Y") {
+            y = t.msg;
           }
-        })
-        bus.$emit("itemPositon", x,y);
+        });
+        bus.$emit("itemPositon", x, y);
       }
     }
   },
@@ -151,9 +152,24 @@ export default {
           }
           if (item.name == "Width") {
             item.msg = Item.boundingRect().width;
+            // 针对icon 以及图片
+            if (
+              Item.data &&
+              Item.data.GraphElementType &&
+              Item.data.GraphElementType == "Image"
+            ) {
+              item.msg = Item.width;
+            }
           }
           if (item.name == "Height") {
             item.msg = Item.boundingRect().height;
+            if (
+              Item.data &&
+              Item.data.GraphElementType &&
+              Item.data.GraphElementType == "Image"
+            ) {
+              item.msg = Item.height;
+            }
           }
         });
       }

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

@@ -27,6 +27,7 @@ export class SImageLegendItem extends SImgTextItem {
             this._num = 1;
             this.data.Num = 1;
         }
+        this.data.Properties.Num = this._num;
         this.text = `${this.data.Num > 1?` × ${this.data.Num}`:''}`;
         this.update();
     }

+ 20 - 4
src/lib/items/SImgTextItem.ts

@@ -69,6 +69,15 @@ export class SImgTextItem extends SObjectItem {
     this.update();
   }
 
+  /** icon宽 */
+  get height(): number {
+    return this.img.height;
+  }
+  set height(v: number) {
+    this.img.height = v
+    this.update();
+  }
+
   /** 是否显示锚点  */
   _showAnchor: boolean = false;
   get showAnchor(): boolean {
@@ -81,13 +90,20 @@ export class SImgTextItem extends SObjectItem {
     })
   }
 
-  get text():string{
+  get text(): string {
     return this.textItem.text;
   }
-  set text(v:string){
+  set text(v: string) {
     this.textItem.text = v;
     this.update();
   }
+  get color(): string {
+    return this.textItem.color;
+  }
+  set color(v: string) {
+    this.textItem.color = v;
+    this.update();
+  }
 
   /** img Item    */
   img: SImageItem = new SImageItem(this);
@@ -161,9 +177,9 @@ export class SImgTextItem extends SObjectItem {
    * @return  SRect   所有子对象的并集
    * */
   boundingRect(): SRect {
-    let rect = this.img.boundingRect().adjusted(this.img.pos.x,this.img.pos.y,0,0);
+    let rect = this.img.boundingRect().adjusted(this.img.pos.x, this.img.pos.y, 0, 0);
     if (this.showText) {
-        rect = rect.unioned(this.textItem.boundingRect().adjusted(this.textItem.pos.x,this.textItem.pos.y,0,0))
+      rect = rect.unioned(this.textItem.boundingRect().adjusted(this.textItem.pos.x, this.textItem.pos.y, 0, 0))
     }
     return rect;
   } // Function boundingRect()