Browse Source

STextItem颜色类型问题修改

zhangyu 5 years ago
parent
commit
92f1cf7b43
2 changed files with 28 additions and 11 deletions
  1. 18 7
      saga-web-big/src/items/SLineItem.ts
  2. 10 4
      saga-web-graph/src/items/STextItem.ts

+ 18 - 7
saga-web-big/src/items/SLineItem.ts

@@ -1,8 +1,13 @@
-import {SColor, SLine, SPainter, SPoint, SRect} from "@saga-web/draw/lib";
-import {SMouseButton, SMouseEvent, SUndoStack} from "@saga-web/base";
-import {SMathUtil} from "../utils/SMathUtil";
-import {SItemStatus} from "..";
-import {SGraphItem, SGraphPointListInsert, SGraphPointListUpdate, SLineStyle} from "@saga-web/graph/lib";
+import { SColor, SLine, SPainter, SPoint, SRect } from "@saga-web/draw/lib";
+import { SMouseButton, SMouseEvent, SUndoStack } from "@saga-web/base";
+import { SMathUtil } from "../utils/SMathUtil";
+import { SItemStatus } from "..";
+import {
+    SGraphItem,
+    SGraphPointListInsert,
+    SGraphPointListUpdate,
+    SLineStyle
+} from "@saga-web/graph/lib";
 
 /**
  * 直线item
@@ -410,9 +415,15 @@ export class SLineItem extends SGraphItem {
             // 绘制直线
             painter.pen.color = new SColor(this.strokeColor);
             if (this.lineStyle == SLineStyle.Dashed) {
-                painter.pen.lineDash = [painter.toPx(this.lineWidth * 3), painter.toPx(this.lineWidth * 7)];
+                painter.pen.lineDash = [
+                    painter.toPx(this.lineWidth * 3),
+                    painter.toPx(this.lineWidth * 7)
+                ];
             } else if (this.lineStyle == SLineStyle.Dotted) {
-                painter.pen.lineDash = [painter.toPx(this.lineWidth), painter.toPx(this.lineWidth)];
+                painter.pen.lineDash = [
+                    painter.toPx(this.lineWidth),
+                    painter.toPx(this.lineWidth)
+                ];
             }
             painter.drawLine(this.line[0], this.line[1]);
             if (

+ 10 - 4
saga-web-graph/src/items/STextItem.ts

@@ -111,13 +111,19 @@ export class STextItem extends SObjectItem {
      */
     protected drawShowText(painter: SPainter): void {
         //绘制矩形轮廓
-        painter.brush.color = this.backgroundColor;
-        painter.pen.color = this.borderColor;
+        painter.brush.color = new SColor(this.backgroundColor);
+        painter.pen.color = new SColor(this.borderColor);
         painter.pen.lineWidth = painter.toPx(this.borderWidth);
         if (this.borderStyle == SLineStyle.Dashed) {
-            painter.pen.lineDash = [painter.toPx(this.borderWidth * 3), painter.toPx(this.borderWidth * 7)];
+            painter.pen.lineDash = [
+                painter.toPx(this.borderWidth * 3),
+                painter.toPx(this.borderWidth * 7)
+            ];
         } else if (this.borderStyle == SLineStyle.Dotted) {
-            painter.pen.lineDash = [painter.toPx(this.borderWidth), painter.toPx(this.borderWidth)];
+            painter.pen.lineDash = [
+                painter.toPx(this.borderWidth),
+                painter.toPx(this.borderWidth)
+            ];
         }
         painter.drawRect(this.boundingRect());