Kaynağa Gözat

图片item问题

haojianlong 5 yıl önce
ebeveyn
işleme
0b217814ce

+ 1 - 1
saga-web-graph/package.json

@@ -1,6 +1,6 @@
 {
     "name": "@saga-web/graph",
-    "version": "2.1.81",
+    "version": "2.1.82",
     "description": "上格云二维图形引擎。",
     "main": "lib/index.js",
     "types": "lib/index.d.js",

+ 9 - 7
saga-web-graph/src/items/SImageItem.ts

@@ -43,7 +43,7 @@ export class SImageItem extends SObjectItem {
             this.update();
             console.log("加载图片错误!");
             console.log(e);
-        }
+        };
     }
 
     /**
@@ -89,16 +89,18 @@ export class SImageItem extends SObjectItem {
     onDraw(painter: SPainter): void {
         if (this.isLoadOver) {
             // 要绘制图片的宽度
-            let width: number = 0;
+            let width = 0;
             // 要绘制图片的宽度
-            let height: number = 0;
+            let height = 0;
             // 图片item的宽高比
             let itemAspectRatio: number = this.width / this.height;
             // 原始图片的宽高比
             let imgAspectRatio: number =
+                // @ts-ignore
                 (this.img.width as number) / (this.img.height as number);
             // 原始图片的高宽比
             let imgHwRatio: number =
+                // @ts-ignore
                 (this.img.height as number) / (this.img.width as number);
             if (this.showType == SImageShowType.Full) {
                 width = this.width;
@@ -115,18 +117,18 @@ export class SImageItem extends SObjectItem {
                     height = this.height;
                 }
             } else if (this.showType == SImageShowType.AutoFit) {
+                // @ts-ignore
                 this.width = this.img.width as number;
+                // @ts-ignore
                 this.height = this.img.height as number;
                 width = this.width;
                 height = this.height;
             }
+            // @ts-ignore
             painter.drawImage(this.img, -width / 2, -height / 2, width, height);
         } else {
             painter.pen.lineWidth = painter.toPx(1);
-            painter.pen.lineDash = [
-                painter.toPx(3),
-                painter.toPx(7)
-            ];
+            painter.pen.lineDash = [painter.toPx(3), painter.toPx(7)];
             painter.pen.color = new SColor("#c0ccda");
             painter.brush.color = SColor.Transparent;
             painter.drawRect(this.boundingRect());