瀏覽代碼

折线修改

haojianlong 4 年之前
父節點
當前提交
12cbaaf5b4
共有 1 個文件被更改,包括 43 次插入11 次删除
  1. 43 11
      src/lib/items/TipelineItem.ts

+ 43 - 11
src/lib/items/TipelineItem.ts

@@ -1,5 +1,5 @@
 import { SPolylineItem, ItemOrder, SItemStatus } from '@saga-web/big/lib';
-import { SPainter, SColor } from '@saga-web/draw';
+import { SPainter, SColor, SRect } from '@saga-web/draw';
 import { SAnchorItem, SGraphItem } from '@saga-web/graph/lib';
 import { Relation } from '../types/Relation';
 import { SPoint } from "@saga-web/draw/lib";
@@ -158,14 +158,46 @@ export class TipelineItem extends SPolylineItem {
     return this.data
   }
 
-  onDraw(painter: SPainter) {
-    if (this.maskFlag && this.status == SItemStatus.Normal) {
-      let color = new SColor(this.strokeColor)
-      color.alpha = color.alpha / 2
-      painter.pen.color = color;
-      painter.drawPolyline(this.pointList);
-    } else {
-      super.onDraw(painter);
-    }
-  }
+  // onDraw(painter: SPainter) {
+    //     if (this.maskFlag && this.status == SItemStatus.Normal) {
+    //         let color = new SColor(this.strokeColor)
+    //         color.alpha = color.alpha / 8
+    //         painter.pen.color = color
+
+    //         if (this.selected) {
+    //             painter.pen.lineWidth = painter.toPx(this.lineWidth * 2);
+    //             painter.shadow.shadowBlur = 10;
+    //             painter.shadow.shadowColor = new SColor(`#00000033`);
+    //             painter.shadow.shadowOffsetX = 5;
+    //             painter.shadow.shadowOffsetY = 5;
+    //         } else {
+    //             painter.pen.lineWidth = painter.toPx(this.lineWidth);
+    //             painter.shadow.shadowColor = SColor.Transparent
+    //         }
+    //         painter.drawPolyline(this.pointList)
+
+    //         painter.pen.color = new SColor('#ffffff80')
+    //         painter.drawPolyline(this.pointList)
+    //     } else {
+    //         super.onDraw(painter)
+    //     }
+    // }
+  /**
+     * Item绘制框架
+     *
+     * @param   painter       painter对象
+     * @param   rect          绘制区域
+     */
+    onPaint(painter: SPainter, rect: SRect): void {
+      super.onPaint(painter, rect);
+      if (this.maskFlag && this.status == SItemStatus.Normal) {
+          if (this.selected) {
+              painter.pen.lineWidth = painter.toPx(this.lineWidth * 2);
+          } else {
+              painter.pen.lineWidth = painter.toPx(this.lineWidth);
+          }
+          painter.pen.color = new SColor('#ffffff80')
+          painter.drawPolyline(this.pointList)
+      }
+  } // Function onPaint()
 }