فهرست منبع

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

YaolongHan 4 سال پیش
والد
کامیت
9b3a95784d
1فایلهای تغییر یافته به همراه13 افزوده شده و 7 حذف شده
  1. 13 7
      src/lib/items/SImageLegendItem.ts

+ 13 - 7
src/lib/items/SImageLegendItem.ts

@@ -3,13 +3,15 @@ import { SGraphItem } from "@saga-web/graph/lib";
 import { SIconTextItem } from '@saga-web/big/lib/items/SIconTextItem';
 import { Legend } from '../types/Legend';
 import { ItemOrder } from '@saga-web/big/lib';
+import { SImgTextItem } from './SImgTextItem';
 
 /**
  * 图例节点Item(图标类型)
  *
  * * @author  张宇(taohuzy@163.com)
  */
-export class SImageLegendItem extends SIconTextItem {
+// export class SImageLegendItem extends SIconTextItem {
+export class SImageLegendItem extends SImgTextItem {
     /** 图例节点对象数据 */
     data: Legend;
     /** 图例数量 */
@@ -18,8 +20,13 @@ export class SImageLegendItem extends SIconTextItem {
         return this._num;
     }
     set num(v: number) {
-        this._num = v;
-        this.data.Num = v;
+        if (v) {
+            this._num = v;
+            this.data.Num = v;
+        } else {
+            this._num = 1;
+            this.data.Num = 1;
+        }
         this.update();
     }
 
@@ -43,8 +50,8 @@ export class SImageLegendItem extends SIconTextItem {
             this.width = data.Size.Width;
             this.height = data.Size.Height;
         }
-        if (data.Properties && data.Properties.Text) {
-            this.text = `${data.Properties.Text}${data.Num?` × ${data.Num}`:''}`;
+        if (data.Num) {
+            this.text = `${data.Name}${data.Num > 1?` × ${data.Num}`:''}`;
         }
         if (data.Properties && data.Properties.Url) {
             this.img.url = data.Properties.Url;
@@ -54,8 +61,7 @@ export class SImageLegendItem extends SIconTextItem {
     toData(): Legend {
         this.data.Pos = {X: this.x, Y: this.y};
         this.data.Size = {Width: this.width, Height: this.height};
-        this.data.Num = this.num;
-        this.data.Properties.Text = this.text;
+        this.data.Name = this.name;
         this.data.Properties.Url = this.img.url;
         return this.data;
     }