소스 검색

Merge branch 'dev' of http://39.106.8.246:3003/yunxing/wanda-bm-guide-h5 into dev

yunxing 4 년 전
부모
커밋
1b2f7d5d1c
1개의 변경된 파일9개의 추가작업 그리고 7개의 파일을 삭제
  1. 9 7
      src/lib/items/SImageLegendItem.ts

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

@@ -13,6 +13,8 @@ import { SMouseEvent } from "@saga-web/base/lib";
 export class SImageLegendItem extends SIconTextItem {
     /** 图例节点对象数据 */
     data: Legend;
+    /** 图标缩放比例 */
+    _iconScale: number = 0.6;
     /** 图例数量 */
     _num: number = 1;
     get num(): number {
@@ -78,8 +80,8 @@ export class SImageLegendItem extends SIconTextItem {
             this.num = data.Num;
         }
         if (data.Size) {
-            this.width = data.Size.Width;
-            this.height = data.Size.Height;
+            this.width = data.Size.Width * this._iconScale;
+            this.height = data.Size.Height * this._iconScale;
         }
         if (data.Properties.Zorder) {
             this.zOrder = data.Properties.Zorder;
@@ -88,10 +90,10 @@ export class SImageLegendItem extends SIconTextItem {
             this.img.url = data.Properties.Url;
         }
         if (data.Properties && data.Properties.Size && data.Properties.Size.Width) {
-            this.sWidth = data.Properties.Size.Width;
+            this.sWidth = data.Properties.Size.Width * this._iconScale;
         }
         if (data.Properties && data.Properties.Size && data.Properties.Size.Height) {
-            this.sHeight = data.Properties.Size.Height;
+            this.sHeight = data.Properties.Size.Height * this._iconScale;
         }
         if (data.Properties.ImgPos) {
             this.img.moveTo(data.Properties.ImgPos.X, data.Properties.ImgPos.Y);
@@ -136,7 +138,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.Size = { Width: this.width / this._iconScale, Height: this.height/ this._iconScale };
         this.data.Name = this.name;
         this.data.Properties.Zorder = this.zOrder;
         this.data.Properties.Url = this.img.url;
@@ -144,8 +146,8 @@ export class SImageLegendItem extends SIconTextItem {
         this.data.Properties.ImgPos = { X: this.img.x, Y: this.img.y };
         this.data.Properties.ImgRotate = this.img.rotate;
         this.data.Properties.Size = {
-            Width: this.sWidth,
-            Height: this.sHeight
+            Width: this.sWidth / this._iconScale,
+            Height: this.sHeight / this._iconScale
         };
         this.data.Properties.font = this.font.size;
         this.data.Properties.color = this.color.value;