|
@@ -405,6 +405,15 @@ export class SPolylineItem extends SGraphItem {
|
|
} // Function cancelOperate()
|
|
} // Function cancelOperate()
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * 绘制基本图形
|
|
|
|
+ * */
|
|
|
|
+ drawBaseLine(painter: SPainter): void {
|
|
|
|
+ // 绘制基本图形
|
|
|
|
+ painter.pen.color = new SColor(this.strokeColor);
|
|
|
|
+ painter.drawPolyline(this.pointList);
|
|
|
|
+ } // Function drawBaseLine()
|
|
|
|
+
|
|
|
|
+ /**
|
|
* Item绘制操作
|
|
* Item绘制操作
|
|
*
|
|
*
|
|
* @param painter painter对象
|
|
* @param painter painter对象
|
|
@@ -412,17 +421,18 @@ export class SPolylineItem extends SGraphItem {
|
|
onDraw(painter: SPainter): void {
|
|
onDraw(painter: SPainter): void {
|
|
// 缓存场景长度
|
|
// 缓存场景长度
|
|
this.sceneDis = painter.toPx(this.dis);
|
|
this.sceneDis = painter.toPx(this.dis);
|
|
- // 绘制基本图形
|
|
|
|
- painter.pen.lineWidth = painter.toPx(this.lineWidth);
|
|
|
|
- painter.pen.color = new SColor(this.strokeColor);
|
|
|
|
- painter.drawPolyline(this.pointList);
|
|
|
|
// 创建状态
|
|
// 创建状态
|
|
|
|
+ painter.pen.lineWidth = painter.toPx(this.lineWidth);
|
|
if (this.status == SItemStatus.Create && this.lastPoint) {
|
|
if (this.status == SItemStatus.Create && this.lastPoint) {
|
|
|
|
+ // 绘制基本图形
|
|
|
|
+ this.drawBaseLine(painter);
|
|
painter.drawLine(
|
|
painter.drawLine(
|
|
this.pointList[this.pointList.length - 1],
|
|
this.pointList[this.pointList.length - 1],
|
|
this.lastPoint
|
|
this.lastPoint
|
|
);
|
|
);
|
|
} else if (this.status == SItemStatus.Edit) {
|
|
} else if (this.status == SItemStatus.Edit) {
|
|
|
|
+ // 绘制基本图形
|
|
|
|
+ this.drawBaseLine(painter);
|
|
// 编辑状态
|
|
// 编辑状态
|
|
this.pointList.forEach((t, i): void => {
|
|
this.pointList.forEach((t, i): void => {
|
|
painter.brush.color = SColor.White;
|
|
painter.brush.color = SColor.White;
|
|
@@ -431,6 +441,17 @@ export class SPolylineItem extends SGraphItem {
|
|
}
|
|
}
|
|
painter.drawCircle(t.x, t.y, painter.toPx(5));
|
|
painter.drawCircle(t.x, t.y, painter.toPx(5));
|
|
});
|
|
});
|
|
|
|
+ } else {
|
|
|
|
+ // 查看状态
|
|
|
|
+ if (this.selected) {
|
|
|
|
+ painter.pen.lineWidth = painter.toPx(this.lineWidth * 2);
|
|
|
|
+ painter.shadow.shadowBlur = 10;
|
|
|
|
+ painter.shadow.shadowColor = new SColor(`#00000060`);
|
|
|
|
+ painter.shadow.shadowOffsetX = 5;
|
|
|
|
+ painter.shadow.shadowOffsetY = 5;
|
|
|
|
+ }
|
|
|
|
+ // 绘制基本图形
|
|
|
|
+ this.drawBaseLine(painter);
|
|
}
|
|
}
|
|
} // Function onDraw()
|
|
} // Function onDraw()
|
|
} // Class SPolylineItem
|
|
} // Class SPolylineItem
|