haojianlong il y a 4 ans
Parent
commit
dec03d4b78

+ 4 - 3
persagy-web-edit/src/SGraphEdit.ts

@@ -50,7 +50,7 @@ export class SGraphEdit extends SGraphItem {
         const newStatus = value;
         this._status = value;
         //状态变更触发事件
-        this.$emit('statusChange', oldStatus, newStatus);
+        this.$emit("statusChange", oldStatus, newStatus);
         this.update();
     }
 
@@ -59,7 +59,7 @@ export class SGraphEdit extends SGraphItem {
     /** 存储数据 legend */
     legendData: any;
     /** 存储数据 Relation */
-    relationData: any
+    relationData: any;
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////
     //函数
     /**
@@ -69,6 +69,7 @@ export class SGraphEdit extends SGraphItem {
      */
     constructor(parent: SGraphItem | null) {
         super();
+        // 传入父级
         if (parent) {
             this.parent = parent;
         }
@@ -105,7 +106,7 @@ export class SGraphEdit extends SGraphItem {
      * @return 针对 item 类型保持相应的格式
      */
     onContextMenu(event: SMouseEvent): boolean {
-        this.$emit('onContextMenu', event);
+        this.$emit("onContextMenu", event);
         return true;
     }
 }

+ 13 - 1
persagy-web-edit/src/SGraphEditScene.ts

@@ -124,6 +124,7 @@ export class SGraphEditScene extends SGraphScene {
         this.grabItem = lineItem;
         lineItem.connect("finishCreated", this, this.finishCreated);
         lineItem.connect("onContextMenu", this, this.getItem);
+        // 视图存在
         if (this.view) {
             this.view.update();
         }
@@ -155,6 +156,7 @@ export class SGraphEditScene extends SGraphScene {
         this.grabItem = item;
         item.connect("finishCreated", this, this.finishCreated);
         item.connect("onContextMenu", this, this.getItem);
+        // 视图存在
         if (this.view) {
             this.view.update();
         }
@@ -301,6 +303,7 @@ export class SGraphEditScene extends SGraphScene {
         this.grabItem = triangleItem;
         triangleItem.connect("finishCreated", this, this.finishCreated);
         triangleItem.connect("onContextMenu", this, this.getItem);
+        // 视图存在
         if (this.view) {
             this.view.update();
         }
@@ -333,6 +336,7 @@ export class SGraphEditScene extends SGraphScene {
         this.addItem(circleItem);
         circleItem.connect("finishCreated", this, this.finishCreated);
         circleItem.connect("onContextMenu", this, this.getItem);
+        // 视图存在
         if (this.view) {
             this.view.update();
         }
@@ -366,6 +370,7 @@ export class SGraphEditScene extends SGraphScene {
         this.grabItem = polygonItem;
         polygonItem.connect("finishCreated", this, this.finishCreated);
         polygonItem.connect("onContextMenu", this, this.getItem);
+        // 视图存在
         if (this.view) {
             this.view.update();
         }
@@ -400,6 +405,7 @@ export class SGraphEditScene extends SGraphScene {
         this.grabItem = arrowItem;
         arrowItem.connect("finishCreated", this, this.finishCreated);
         arrowItem.connect("onContextMenu", this, this.getItem);
+        // 视图存在
         if (this.view) {
             this.view.update();
         }
@@ -440,6 +446,7 @@ export class SGraphEditScene extends SGraphScene {
         icon.connect("finishCreated", this, this.finishCreated);
         icon.connect("onContextMenu", this, this.getItem);
         icon.$emit("finishCreated");
+        // 视图存在
         if (this.view) {
             this.view.update();
         }
@@ -455,14 +462,18 @@ export class SGraphEditScene extends SGraphScene {
     clickIsAnchor(event: SMouseEvent): SAnchorItem | null {
         let minAnchor = null;
         let len = -1;
+        // 遍历场景中的对象
         this.root.children.forEach(item => {
+            // 子对象是 icontext 类型,且存在锚点
             if (
                 item instanceof SBaseIconTextEdit &&
                 item.anchorList &&
                 item.anchorList.length
             ) {
+                // 该对象中有图片,且为基础图片类型
                 if (item.img && item.img instanceof SBaseImageEdit) {
                     let scenePoint = item.img.mapFromScene(event.x, event.y);
+                    // 点击点在图片区域内
                     if (item.img.contains(scenePoint.x, scenePoint.y)) {
                         let anchor = item.anchorList[0];
                         let anchorPoint = anchor.mapToScene(0, 0);
@@ -472,11 +483,12 @@ export class SGraphEditScene extends SGraphScene {
                             anchorPoint.x,
                             anchorPoint.y
                         );
+                        // 第一次进入循环
                         if (len < 0) {
                             minAnchor = anchor;
                             len = dis;
                         }
-
+                        // 得到距离最小的锚点
                         if (dis < len) {
                             minAnchor = anchor;
                             len = dis;

+ 32 - 4
persagy-web-edit/src/items/SBaseRectEdit.ts

@@ -140,28 +140,31 @@ export class SBaseRectEdit extends SGraphEdit {
     constructor(parent: SGraphItem | null, data: Marker) {
         super(parent);
         this.data = data;
+        // 数据存在默认样式
         if (data.style && data.style.default) {
-            // 关于顶点
+            // 设置顶点
             if (data.style.default.line) {
                 let setPointList: SPoint[];
+                // 遍历点集列表
                 setPointList = data.style.default.line.map(i => {
                     return new SPoint(i.x, i.y);
                 });
                 this.line = setPointList;
                 this.calRect();
             }
-            // 颜色
+            // 设置线条颜色
             if (data.style.default.strokeColor) {
                 this.strokeColor = new SColor(data.style.default.strokeColor);
             }
+            // 设置填充颜色
             if (data.style.default.fillColor) {
                 this.fillColor = new SColor(data.style.default.fillColor);
             }
-            // 线宽
+            // 设置线宽
             if (data.style.default.lineWidth) {
                 this.lineWidth = data.style.default.lineWidth;
             }
-            // 线样式
+            // 设置线样式
             if (data.style.default.lineStyle) {
                 this.lineStyle = data.style.default.lineStyle;
             }
@@ -177,6 +180,7 @@ export class SBaseRectEdit extends SGraphEdit {
     resize(oldSize: SRect, newSize: SRect): void {
         const xs = newSize.width / oldSize.width;
         const ys = newSize.height / oldSize.height;
+        // 遍历点列表,设置放缩
         this.line = this.line.map(t => {
             t.x = t.x * xs;
             t.y = t.y * ys;
@@ -193,11 +197,14 @@ export class SBaseRectEdit extends SGraphEdit {
      * @return 是否处理事件
      */
     onMouseDown(event: SMouseEvent): boolean {
+        // 按下左键
         if (event.buttons == SMouseButton.LeftButton) {
+            // 处于创建态
             if (this.status == SItemStatus.Create) {
                 this.addPoint(new SPoint(event.x, event.y));
                 return true;
             } else {
+                // 否则
                 super.onMouseDown(event);
             }
         }
@@ -212,12 +219,15 @@ export class SBaseRectEdit extends SGraphEdit {
      * @return 是否处理事件
      */
     onMouseMove(event: SMouseEvent): boolean {
+        // 处于创建态
         if (this.status == SItemStatus.Create) {
+            // 列表第一项是点
             if (this.line[0] instanceof SPoint) {
                 this.line[1] = new SPoint(event.x, event.y);
                 this.calRect();
             }
         } else {
+            // 否则
             super.onMouseMove(event);
         }
 
@@ -232,6 +242,7 @@ export class SBaseRectEdit extends SGraphEdit {
      * @return 是否处理事件
      */
     onMouseUp(event: SMouseEvent): boolean {
+        // 处于创建态
         if (this.status != SItemStatus.Create) {
             super.onMouseUp(event);
         }
@@ -243,10 +254,12 @@ export class SBaseRectEdit extends SGraphEdit {
      * 计算矩形的左上角和右下角
      */
     protected calRect(): void {
+        // 点列表有效
         if (this.line.length > 1) {
             const fi = this.line[0];
             const se = this.line[1];
             let minx, maxx, miny, maxy;
+            // 获取 x 最小值和最大值
             if (fi.x < se.x) {
                 minx = fi.x;
                 maxx = se.x;
@@ -255,6 +268,7 @@ export class SBaseRectEdit extends SGraphEdit {
                 maxx = fi.x;
             }
 
+            // 获取 y 最小值和最大值
             if (fi.y < se.y) {
                 miny = fi.y;
                 maxy = se.y;
@@ -274,10 +288,12 @@ export class SBaseRectEdit extends SGraphEdit {
      * @param p     添加的点
      */
     private addPoint(p: SPoint): void {
+        // 列表项少于2项
         if (this.line.length < 2) {
             this.line.push(p);
             this.recordAction(SGraphPointListInsert, [this.line, p]);
         } else {
+            // 否则
             this.line[1] = p;
             this.recordAction(SGraphPointListInsert, [this.line, p, 1]);
             this.status = SItemStatus.Normal;
@@ -307,6 +323,7 @@ export class SBaseRectEdit extends SGraphEdit {
      * @return 外接矩阵
      */
     boundingRect(): SRect {
+        // 点列表有效
         if (this.line.length > 1) {
             // this.calRect();
             return new SRect(this._leftTop, this._rightBottom);
@@ -319,6 +336,7 @@ export class SBaseRectEdit extends SGraphEdit {
      * 撤销操作
      */
     undo(): void {
+        // 处于非正常态
         if (this._status != SItemStatus.Normal) {
             this.undoStack.undo();
         }
@@ -328,6 +346,7 @@ export class SBaseRectEdit extends SGraphEdit {
      * 重做操作
      */
     redo(): void {
+        // 处于非正常态
         if (this._status != SItemStatus.Normal) {
             this.undoStack.redo();
         }
@@ -337,10 +356,12 @@ export class SBaseRectEdit extends SGraphEdit {
      * 取消操作执行
      */
     cancelOperate(): void {
+        // 处于创建态
         if (this.status == SItemStatus.Create) {
             this.parent = null;
             this.releaseItem();
         } else if (this.status == SItemStatus.Edit) {
+            // 处于编辑态
             this.status = SItemStatus.Normal;
             this.releaseItem();
         }
@@ -350,6 +371,7 @@ export class SBaseRectEdit extends SGraphEdit {
      * 移动后处理所有坐标,并肩原点置为场景原点
      */
     moveToOrigin(): void {
+        // 遍历点列表
         this.line = this.line.map(t => {
             t.x = t.x + this.x;
             t.y = t.y + this.y;
@@ -368,6 +390,7 @@ export class SBaseRectEdit extends SGraphEdit {
     toData(): any {
         this.moveToOrigin();
         const Line: any = [];
+        // 生成点列表数据
         this.line.forEach(item => {
             Line.push({ x: item.x, y: item.y });
         });
@@ -385,6 +408,7 @@ export class SBaseRectEdit extends SGraphEdit {
      * @param painter   绘制对象
      */
     onDraw(painter: SPainter): void {
+        // 列表中有 2 个点
         if (this.line.length == 2) {
             painter.pen.color = this.strokeColor;
             painter.brush.color = this.fillColor;
@@ -396,18 +420,21 @@ export class SBaseRectEdit extends SGraphEdit {
                 // 否则
                 painter.pen.lineWidth = this.lineWidth;
             }
+            // 线类型为虚线
             if (this.lineStyle == SLineStyle.Dashed) {
                 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 * 2),
                     painter.toPx(this.lineWidth * 2)
                 ];
             }
 
+            // 设置了圆角半径
             if (this.radius != 0) {
                 painter.drawRoundRect(
                     this._leftTop,
@@ -415,6 +442,7 @@ export class SBaseRectEdit extends SGraphEdit {
                     this.radius
                 );
             } else {
+                // 否则
                 painter.drawRect(this._leftTop, this._rightBottom);
             }
         }

+ 45 - 17
persagy-web-edit/src/items/SBaseTextEdit.ts

@@ -23,13 +23,25 @@
  *
  * *********************************************************************************************************************
  */
-import { SPainter, SRect, SColor, SFont, SPoint, SSize } from "@persagy-web/draw";
-import { SGraphItem, STextOrigin, SLineStyle, SAnchorItem } from "@persagy-web/graph/";
+import {
+    SPainter,
+    SRect,
+    SColor,
+    SFont,
+    SPoint,
+    SSize
+} from "@persagy-web/draw";
+import {
+    SGraphItem,
+    STextOrigin,
+    SLineStyle,
+    SAnchorItem
+} from "@persagy-web/graph/";
 import { SItemStatus } from "@persagy-web/big";
-import { SGraphEdit } from ".."
+import { SGraphEdit } from "..";
 import { Marker } from "../type/Marker";
-import { ItemOrder } from '@persagy-web/big/lib';
-import { SMouseEvent } from '@persagy-web/base/lib';
+import { ItemOrder } from "@persagy-web/big/lib";
+import { SMouseEvent } from "@persagy-web/base/lib";
 
 /**
  * 文本编辑类
@@ -42,7 +54,7 @@ export class SBaseTextEdit extends SGraphEdit {
     /**编辑相关操作的数据 */
     data: Marker | null = null;
     /** 存储相关的信息数据 */
-    propertyData: any
+    propertyData: any;
     /** 起始锚点 */
     startItem: SGraphItem | null = null;
     /** 结束锚点 */
@@ -57,7 +69,7 @@ export class SBaseTextEdit extends SGraphEdit {
         const newStatus = value;
         this._status = value;
         //状态变更触发事件
-        this.$emit('StatusChange', oldStatus, newStatus)
+        this.$emit("StatusChange", oldStatus, newStatus);
         this.update();
     }
 
@@ -86,7 +98,9 @@ export class SBaseTextEdit extends SGraphEdit {
         return this._width;
     }
     set width(v: number) {
+        // 宽度有效
         if (v > 0) {
+            // 不等于旧值
             if (v != this._width) {
                 let w = this._width;
                 this._width = v;
@@ -104,7 +118,9 @@ export class SBaseTextEdit extends SGraphEdit {
         return this._height;
     }
     set height(v: number) {
+        // 高度有效
         if (v > 0) {
+            // 不等于旧值
             if (v != this._height) {
                 let h = this._height;
                 this._height = v;
@@ -201,8 +217,9 @@ export class SBaseTextEdit extends SGraphEdit {
      */
     constructor(parent: SGraphItem | null, data: Marker | null) {
         super(parent);
+        // 传入数据
         if (data) {
-            this.initData(data)
+            this.initData(data);
         }
     } // Constructor
 
@@ -218,30 +235,34 @@ export class SBaseTextEdit extends SGraphEdit {
         this.data = data;
         this.name = data.name;
         this.moveTo(data.pos.x, data.pos.y);
+        // 设置宽高
         if (data.size) {
             this.width = data.size.width;
             this.height = data.size.height;
         }
+        // 数据中存有默认样式
         if (data.style && data.style.default) {
-            // 高度
+            // 设置层级
             if (data.style.default.zorder) {
                 this.zOrder = data.style.default.zorder;
             }
-            // 文本
+            // 设置文本
             if (data.style.default.text) {
                 this.text = data.style.default.text;
             }
-            // 文本颜色
+            // 设置文本颜色
             if (data.style.default.color) {
                 this.color = new SColor(data.style.default.color);
             }
-            // 字体大小
+            // 设置字体大小
             if (data.style.default.font) {
                 this.font = new SFont("sans-serif", data.style.default.font);
             }
-            // 背景色
+            // 设置背景色
             if (data.style.default.backgroundColor) {
-                this.backgroundColor = new SColor(data.style.default.backgroundColor);
+                this.backgroundColor = new SColor(
+                    data.style.default.backgroundColor
+                );
             }
         }
     }
@@ -252,7 +273,7 @@ export class SBaseTextEdit extends SGraphEdit {
      * @param oldSize 改之前的大小
      * @param newSize 改之后大小
      */
-    protected onResize(oldSize: SSize, newSize: SSize) { }
+    protected onResize(oldSize: SSize, newSize: SSize) {}
 
     /**
      * 对象边界区域
@@ -285,7 +306,7 @@ export class SBaseTextEdit extends SGraphEdit {
      * @return 是否处理事件
      */
     onMouseDown(event: SMouseEvent): boolean {
-        this.$emit('textSelect')
+        this.$emit("textSelect");
         super.onMouseDown(event);
         return this.moveable;
     } // Function onMouseDown()
@@ -341,15 +362,18 @@ export class SBaseTextEdit extends SGraphEdit {
      * 根据换行切割文本,绘制多行并计算外轮廓宽高
      */
     protected drawFormatText(): void {
+        // 设置了绘制对象
         if (this._painter instanceof SPainter) {
             this._painter.save();
             this._painter.font = this.font;
             let textMaxWidth = 0;
             let fontSize: number = this.font.size;
+            // 遍历文本列表
             this._textArr.forEach((text: string, index: number) => {
                 let textWidth: number = this._painter
                     ? this._painter.textWidth(text) + fontSize / 2
                     : fontSize / 2;
+                // 文本宽度超出最大文本宽度
                 if (textWidth > textMaxWidth) {
                     textMaxWidth = textWidth;
                 }
@@ -372,15 +396,18 @@ export class SBaseTextEdit extends SGraphEdit {
      * @return 对象储存的相关数据
      */
     toData(): any {
+        // 数据不存在不处理
         if (!this.data) return;
+        // 设置宽高
         if (this.data.size) {
             this.data.size.width = this.width;
             this.data.size.height = this.height;
         } else {
+            // 设置默认大小
             this.data.size = {
                 width: this.width,
                 height: this.height
-            }
+            };
         }
 
         this.data.pos.x = this.pos.x;
@@ -400,6 +427,7 @@ export class SBaseTextEdit extends SGraphEdit {
      * @param painter       绘画类
      */
     onDraw(painter: SPainter): void {
+        // 设置了绘制对象
         if (!(this._painter instanceof SPainter)) {
             this._painter = painter;
             this.drawFormatText();

+ 43 - 13
persagy-web-edit/src/items/SBaseTriangleEdit.ts

@@ -29,7 +29,8 @@ import { SMouseButton, SMouseEvent, SUndoStack } from "@persagy-web/base";
 import { SItemStatus } from "@persagy-web/big";
 import {
     SLineStyle,
-    SGraphItem, SGraphPointListInsert
+    SGraphItem,
+    SGraphPointListInsert
 } from "@persagy-web/graph/";
 import { SGraphEdit } from "..";
 import { Marker } from "../type/Marker";
@@ -121,29 +122,31 @@ export class SBaseTriangleEdit extends SGraphEdit {
     constructor(parent: SGraphItem | null, data: Marker) {
         super(parent);
         this.data = data;
+        // 数据中存有默认样式
         if (data.style && data.style.default) {
             // 关于顶点
             if (data.style.default.Line) {
                 let setPointList: SPoint[];
+                // 生成点列表
                 setPointList = data.style.default.line.map(i => {
-                    return new SPoint(i.x, i.y)
+                    return new SPoint(i.x, i.y);
                 });
                 this.line = setPointList;
             }
 
-            // 颜色
+            // 设置颜色
             if (data.style.default.strokeColor) {
-                this.strokeColor = new SColor(data.style.default.strokeColor)
+                this.strokeColor = new SColor(data.style.default.strokeColor);
             }
 
-            // 线宽
+            // 设置线宽
             if (data.style.default.lineWidth) {
-                this.lineWidth = data.style.default.lineWidth
+                this.lineWidth = data.style.default.lineWidth;
             }
 
-            // 线样式
+            // 设置线样式
             if (data.style.default.lineStyle) {
-                this.lineStyle = data.style.default.lineStyle
+                this.lineStyle = data.style.default.lineStyle;
             }
         }
     }
@@ -157,6 +160,7 @@ export class SBaseTriangleEdit extends SGraphEdit {
     resize(oldSize: SRect, newSize: SRect): void {
         const xs = newSize.width / oldSize.width;
         const ys = newSize.height / oldSize.height;
+        // 遍历点列表
         this.line = this.line.map(t => {
             t.x = t.x * xs;
             t.y = t.y * ys;
@@ -173,11 +177,14 @@ export class SBaseTriangleEdit extends SGraphEdit {
      * @return 是否处理事件
      */
     onMouseDown(event: SMouseEvent): boolean {
+        // 按下左键
         if (event.buttons == SMouseButton.LeftButton) {
+            // 处于创建态
             if (this.status == SItemStatus.Create) {
                 this.addPoint(new SPoint(event.x, event.y));
                 return true;
             } else {
+                // 否则
                 return super.onMouseDown(event);
             }
         }
@@ -192,12 +199,15 @@ export class SBaseTriangleEdit extends SGraphEdit {
      * @return 是否处理事件
      */
     onMouseMove(event: SMouseEvent): boolean {
+        // 处于创建态
         if (this.status == SItemStatus.Create) {
+            // 存在一个点
             if (this.line[0] instanceof SPoint) {
                 this.line[1] = new SPoint(event.x, event.y);
-                this.calRect()
+                this.calRect();
             }
         } else {
+            // 否则
             return super.onMouseMove(event);
         }
 
@@ -212,6 +222,7 @@ export class SBaseTriangleEdit extends SGraphEdit {
      * @return 是否处理事件
      */
     onMouseUp(event: SMouseEvent): boolean {
+        // 处于非创建态
         if (this.status != SItemStatus.Create) {
             super.onMouseUp(event);
         }
@@ -227,6 +238,7 @@ export class SBaseTriangleEdit extends SGraphEdit {
             const fi = this.line[0];
             const se = this.line[1];
             let minx, maxx, miny, maxy;
+            // 保存 x 最大值和最小值
             if (fi.x < se.x) {
                 minx = fi.x;
                 maxx = se.x;
@@ -235,6 +247,7 @@ export class SBaseTriangleEdit extends SGraphEdit {
                 maxx = fi.x;
             }
 
+            // 保存 y 最大值和最小值
             if (fi.y < se.y) {
                 miny = fi.y;
                 maxy = se.y;
@@ -245,7 +258,7 @@ export class SBaseTriangleEdit extends SGraphEdit {
 
             this._leftTop = new SPoint(minx, miny);
             this._rightBottom = new SPoint(maxx, maxy);
-            this.calTriangle()
+            this.calTriangle();
         }
     }
 
@@ -255,8 +268,15 @@ export class SBaseTriangleEdit extends SGraphEdit {
     private calTriangle(): void {
         this.pointList = [];
         this.pointList.push(new SPoint(this._leftTop.x, this._rightBottom.y));
-        this.pointList.push(new SPoint((this._leftTop.x + this._rightBottom.x) / 2, this._leftTop.y));
-        this.pointList.push(new SPoint(this._rightBottom.x, this._rightBottom.y));
+        this.pointList.push(
+            new SPoint(
+                (this._leftTop.x + this._rightBottom.x) / 2,
+                this._leftTop.y
+            )
+        );
+        this.pointList.push(
+            new SPoint(this._rightBottom.x, this._rightBottom.y)
+        );
     }
 
     /**
@@ -265,10 +285,12 @@ export class SBaseTriangleEdit extends SGraphEdit {
      * @param p     添加的点
      */
     private addPoint(p: SPoint): void {
+        // 列表中点个数少于 2 个
         if (this.line.length < 2) {
             this.line.push(p);
             this.recordAction(SGraphPointListInsert, [this.line, p]);
         } else {
+            // 否则
             this.line[1] = p;
             this.recordAction(SGraphPointListInsert, [this.line, p, 1]);
             this.status = SItemStatus.Normal;
@@ -298,18 +320,20 @@ export class SBaseTriangleEdit extends SGraphEdit {
      * @return 边界区域
      */
     boundingRect(): SRect {
+        // 列表中点个超个 1 个
         if (this.line.length > 1) {
             this.calRect();
             return new SRect(this._leftTop, this._rightBottom);
         }
 
-        return new SRect()
+        return new SRect();
     }
 
     /**
      * 撤销操作
      */
     undo(): void {
+        // 处于非正常态
         if (this._status != SItemStatus.Normal) {
             this.undoStack.undo();
         }
@@ -319,6 +343,7 @@ export class SBaseTriangleEdit extends SGraphEdit {
      * 重做操作
      */
     redo(): void {
+        // 处于非正常态
         if (this._status != SItemStatus.Normal) {
             this.undoStack.redo();
         }
@@ -328,10 +353,12 @@ export class SBaseTriangleEdit extends SGraphEdit {
      * 取消操作执行
      */
     cancelOperate(): void {
+        // 处于创建态
         if (this.status == SItemStatus.Create) {
             this.parent = null;
             this.releaseItem();
         } else if (this.status == SItemStatus.Edit) {
+            // 处于编辑态
             this.status = SItemStatus.Normal;
             this.releaseItem();
         }
@@ -343,16 +370,19 @@ export class SBaseTriangleEdit extends SGraphEdit {
      * @param painter   绘制对象
      */
     onDraw(painter: SPainter): void {
+        // 列表中点个数为 2
         if (this.line.length == 2) {
             painter.pen.color = this.strokeColor;
             painter.brush.color = this.fillColor;
             painter.pen.lineWidth = this.lineWidth;
+            // 线类型为虚线
             if (this.lineStyle == SLineStyle.Dashed) {
                 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 * 2),
                     painter.toPx(this.lineWidth * 2)