Browse Source

item修改 及 注释添加

haojianlong 4 years ago
parent
commit
10586c1813
32 changed files with 122 additions and 16 deletions
  1. 2 2
      persagy-web-big/package.json
  2. 4 2
      persagy-web-draw/src/SBrush.ts
  3. 2 2
      persagy-web-draw/src/SCanvasView.ts
  4. 3 1
      persagy-web-draw/src/SLinearGradient.ts
  5. 1 1
      persagy-web-draw/src/SPath.ts
  6. 1 1
      persagy-web-draw/src/SPen.ts
  7. 3 1
      persagy-web-draw/src/SRadialGradient.ts
  8. 9 0
      persagy-web-draw/src/engines/SCanvasPaintEngine.ts
  9. 1 0
      persagy-web-draw/src/engines/SPaintEngine.ts
  10. 2 0
      persagy-web-draw/src/engines/SPaintState.ts
  11. 2 0
      persagy-web-draw/src/engines/SSvgPaintEngine.ts
  12. 0 0
      persagy-web-draw/src/types/SPathCommand.ts
  13. 3 0
      persagy-web-graph/README.md
  14. 1 1
      persagy-web-graph/package.json
  15. 2 1
      persagy-web-graph/src/SGraphItem.ts
  16. 2 0
      persagy-web-graph/src/SGraphSelectContainer.ts
  17. 1 0
      persagy-web-graph/src/commands/SGraphMoveCommand.ts
  18. 5 0
      persagy-web-graph/src/commands/SGraphPointListDelete.ts
  19. 4 0
      persagy-web-graph/src/commands/SGraphPointListInsert.ts
  20. 1 0
      persagy-web-graph/src/items/SAnchorItem.ts
  21. 7 0
      persagy-web-graph/src/items/SGraphAreaGroupItem.ts
  22. 3 0
      persagy-web-graph/src/items/SGraphBaseCircle.ts
  23. 6 0
      persagy-web-graph/src/items/SGraphCircleItem.ts
  24. 6 0
      persagy-web-graph/src/items/SGraphPolyGroupItem.ts
  25. 8 0
      persagy-web-graph/src/items/SGraphRectItem.ts
  26. 4 0
      persagy-web-graph/src/items/SGraphShape.ts
  27. 4 0
      persagy-web-graph/src/items/SGraphStyleItem.ts
  28. 6 0
      persagy-web-graph/src/items/SGraphSvgItem.ts
  29. 19 1
      persagy-web-graph/src/items/SImageItem.ts
  30. 6 2
      persagy-web-graph/src/items/SObjectItem.ts
  31. 2 1
      persagy-web-graph/src/items/STextItem.ts
  32. 2 0
      persagy-web-graph/src/utils/SMathUtil.ts

+ 2 - 2
persagy-web-big/package.json

@@ -1,6 +1,6 @@
 {
 {
     "name": "@persagy-web/big",
     "name": "@persagy-web/big",
-    "version": "2.2.46",
+    "version": "2.2.47",
     "description": "博锐尚格建筑信息化库",
     "description": "博锐尚格建筑信息化库",
     "main": "lib/index.js",
     "main": "lib/index.js",
     "types": "lib/index.d.js",
     "types": "lib/index.d.js",
@@ -41,7 +41,7 @@
         "typescript": "^3.9.3"
         "typescript": "^3.9.3"
     },
     },
     "dependencies": {
     "dependencies": {
-        "@persagy-web/graph": "2.2.43",
+        "@persagy-web/graph": "2.2.44",
         "axios": "^0.18.0",
         "axios": "^0.18.0",
         "pako": "^1.0.10",
         "pako": "^1.0.10",
         "crypto-js": "^4.0.0",
         "crypto-js": "^4.0.0",

+ 4 - 2
persagy-web-draw/src/SBrush.ts

@@ -96,10 +96,12 @@ export class SBrush {
         // 实现重载 constructor(gradient: SGradient);
         // 实现重载 constructor(gradient: SGradient);
         if (brush instanceof SGradient) {
         if (brush instanceof SGradient) {
             this.gradient = brush;
             this.gradient = brush;
-        } else if (brush instanceof SBrush) { // 实现重载 constructor(brush: SBrush);
+        } else if (brush instanceof SBrush) {
+            // 实现重载 constructor(brush: SBrush);
             this.type = brush.type;
             this.type = brush.type;
             this.color = new SColor(brush.color);
             this.color = new SColor(brush.color);
-        } else { // 实现重载 constructor(color: SColor);
+        } else {
+            // 实现重载 constructor(color: SColor);
             this.color = new SColor(brush);
             this.color = new SColor(brush);
         }
         }
     }
     }

+ 2 - 2
persagy-web-draw/src/SCanvasView.ts

@@ -260,7 +260,7 @@ export class SCanvasView extends SObject {
     protected onMouseDown(event: MouseEvent): void {
     protected onMouseDown(event: MouseEvent): void {
         let se = new SMouseEvent(event);
         let se = new SMouseEvent(event);
 
 
-        // 按下鼠标中键
+        // 按下鼠标滚轮
         if (se.buttons & SMouseButton.MidButton) {
         if (se.buttons & SMouseButton.MidButton) {
             this._midKeyPos.x = se.x;
             this._midKeyPos.x = se.x;
             this._midKeyPos.y = se.y;
             this._midKeyPos.y = se.y;
@@ -278,7 +278,7 @@ export class SCanvasView extends SObject {
             // 按中键移动
             // 按中键移动
             let se = new SMouseEvent(event);
             let se = new SMouseEvent(event);
 
 
-            // 按下鼠标中键
+            // 按下鼠标滚轮
             if (se.buttons & SMouseButton.MidButton) {
             if (se.buttons & SMouseButton.MidButton) {
                 this.origin.x += se.x - this._midKeyPos.x;
                 this.origin.x += se.x - this._midKeyPos.x;
                 this.origin.y += se.y - this._midKeyPos.y;
                 this.origin.y += se.y - this._midKeyPos.y;

+ 3 - 1
persagy-web-draw/src/SLinearGradient.ts

@@ -69,7 +69,8 @@ export class SLinearGradient extends SGradient {
         if (x1 instanceof SPoint && y1 instanceof SPoint) {
         if (x1 instanceof SPoint && y1 instanceof SPoint) {
             this.start = new SPoint(x1);
             this.start = new SPoint(x1);
             this.end = new SPoint(y1);
             this.end = new SPoint(y1);
-        } else { // 重载 constructor(x1: number, y1: number, x2: number, y2: number);
+        } else {
+            // 重载 constructor(x1: number, y1: number, x2: number, y2: number);
             this.start = new SPoint(x1 as number, y1 as number);
             this.start = new SPoint(x1 as number, y1 as number);
             this.end = new SPoint(x2 as number, y2 as number);
             this.end = new SPoint(x2 as number, y2 as number);
         }
         }
@@ -84,6 +85,7 @@ export class SLinearGradient extends SGradient {
         let str = `SLinearGradient{`;
         let str = `SLinearGradient{`;
         str += `${this.x1},${this.y1};`;
         str += `${this.x1},${this.y1};`;
         str += `${this.x2},${this.y2};`;
         str += `${this.x2},${this.y2};`;
+        // 遍历停点
         this.stopList.forEach((t): void => {
         this.stopList.forEach((t): void => {
             str += `${t.pos},${t.color.value};`;
             str += `${t.pos},${t.color.value};`;
         });
         });

+ 1 - 1
persagy-web-draw/src/SPath.ts

@@ -24,7 +24,7 @@
  * *********************************************************************************************************************
  * *********************************************************************************************************************
  */
  */
 
 
-import { SPathCommand } from "./SPathCommand";
+import { SPathCommand } from "./types/SPathCommand";
 import { SPoint } from "./types/SPoint";
 import { SPoint } from "./types/SPoint";
 
 
 /**
 /**

+ 1 - 1
persagy-web-draw/src/SPen.ts

@@ -1,4 +1,4 @@
-/*
+ /*
  * *********************************************************************************************************************
  * *********************************************************************************************************************
  *
  *
  *          !!
  *          !!

+ 3 - 1
persagy-web-draw/src/SRadialGradient.ts

@@ -91,7 +91,8 @@ export class SRadialGradient extends SGradient {
             this.end = new SPoint(r1);
             this.end = new SPoint(r1);
             this.r1 = y1;
             this.r1 = y1;
             this.r2 = x2;
             this.r2 = x2;
-        } else { // 重载 constructor(x1: number, y1: number, r1: number, x2: number, y2: number, r2: number);
+        } else {
+            // 重载 constructor(x1: number, y1: number, r1: number, x2: number, y2: number, r2: number);
             this.start = new SPoint(x1 as number, y1 as number);
             this.start = new SPoint(x1 as number, y1 as number);
             this.end = new SPoint(x2 as number, y2 as number);
             this.end = new SPoint(x2 as number, y2 as number);
             this.r1 = r1 as number;
             this.r1 = r1 as number;
@@ -107,6 +108,7 @@ export class SRadialGradient extends SGradient {
         let str = `SRadialGradient{`;
         let str = `SRadialGradient{`;
         str += `${this.x1},${this.y1},${this.r1};`;
         str += `${this.x1},${this.y1},${this.r1};`;
         str += `${this.x2},${this.y2},${this.r2};`;
         str += `${this.x2},${this.y2},${this.r2};`;
+        // 遍历停点
         this.stopList.forEach((t): void => {
         this.stopList.forEach((t): void => {
             str += `${t.pos},${t.color.value};`;
             str += `${t.pos},${t.color.value};`;
         });
         });

+ 9 - 0
persagy-web-draw/src/engines/SCanvasPaintEngine.ts

@@ -637,15 +637,20 @@ export class SCanvasPaintEngine extends SPaintEngine {
      */
      */
     private drawWay(path: SPath): void {
     private drawWay(path: SPath): void {
         this._canvas.beginPath();
         this._canvas.beginPath();
+        // 遍历 path 命令列表
         path.cmdList.forEach((cmd): void => {
         path.cmdList.forEach((cmd): void => {
+            // 连线命令
             if (cmd.command == "L") {
             if (cmd.command == "L") {
                 this._canvas.lineTo(cmd.args[0], cmd.args[1]);
                 this._canvas.lineTo(cmd.args[0], cmd.args[1]);
             } else if (cmd.command == "M") {
             } else if (cmd.command == "M") {
+                // 移动命令
                 this._canvas.moveTo(cmd.args[0], cmd.args[1]);
                 this._canvas.moveTo(cmd.args[0], cmd.args[1]);
             } else if (cmd.command == "Z") {
             } else if (cmd.command == "Z") {
+                // 闭合路径
                 this._canvas.closePath();
                 this._canvas.closePath();
                 this._canvas.fill();
                 this._canvas.fill();
             } else if (cmd.command == "Q") {
             } else if (cmd.command == "Q") {
+                // 二次贝塞尔曲线
                 this._canvas.quadraticCurveTo(
                 this._canvas.quadraticCurveTo(
                     cmd.args[0],
                     cmd.args[0],
                     cmd.args[1],
                     cmd.args[1],
@@ -653,6 +658,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
                     cmd.args[3]
                     cmd.args[3]
                 );
                 );
             } else if (cmd.command == "T") {
             } else if (cmd.command == "T") {
+                // 三次贝塞尔曲线
                 // @ts-ignore
                 // @ts-ignore
                 this._canvas.bezierCurveTo(
                 this._canvas.bezierCurveTo(
                     cmd.args[0],
                     cmd.args[0],
@@ -662,6 +668,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
                     cmd.args[4]
                     cmd.args[4]
                 );
                 );
             } else if (cmd.command == "Ellipse") {
             } else if (cmd.command == "Ellipse") {
+                // 椭圆命令
                 this._canvas.ellipse(
                 this._canvas.ellipse(
                     cmd.args[0],
                     cmd.args[0],
                     cmd.args[1],
                     cmd.args[1],
@@ -672,6 +679,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
                     Math.PI * 2
                     Math.PI * 2
                 );
                 );
             } else if (cmd.command == "Arc") {
             } else if (cmd.command == "Arc") {
+                // 弧线 圆或部分圆
                 this._canvas.arc(
                 this._canvas.arc(
                     cmd.args[0],
                     cmd.args[0],
                     cmd.args[1],
                     cmd.args[1],
@@ -681,6 +689,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
                     cmd.args[5] == 1
                     cmd.args[5] == 1
                 );
                 );
             } else if (cmd.command == "ArcTo") {
             } else if (cmd.command == "ArcTo") {
+                // 两个切线之间的弧/曲线
                 this._canvas.arcTo(
                 this._canvas.arcTo(
                     cmd.args[0],
                     cmd.args[0],
                     cmd.args[1],
                     cmd.args[1],

+ 1 - 0
persagy-web-draw/src/engines/SPaintEngine.ts

@@ -61,6 +61,7 @@ export abstract class SPaintEngine {
      * 恢复 painter 状态
      * 恢复 painter 状态
      */
      */
     restore(): void {
     restore(): void {
+        // 绘制命令栈有内容
         if (this.stateStack.length > 0) {
         if (this.stateStack.length > 0) {
             this.state = this.stateStack.pop() as SPaintState;
             this.state = this.stateStack.pop() as SPaintState;
         }
         }

+ 2 - 0
persagy-web-draw/src/engines/SPaintState.ts

@@ -83,6 +83,7 @@ export class SPaintState {
         return this._clip;
         return this._clip;
     }
     }
     set clip(v: SPath | undefined) {
     set clip(v: SPath | undefined) {
+        // 传入了裁剪路径
         if (v) {
         if (v) {
             this._clip = new SPath();
             this._clip = new SPath();
             this._clip.addPath(v);
             this._clip.addPath(v);
@@ -97,6 +98,7 @@ export class SPaintState {
      * @param state     绘制状态
      * @param state     绘制状态
      */
      */
     constructor(state?: SPaintState) {
     constructor(state?: SPaintState) {
+        // 回执状态有值
         if (state != undefined) {
         if (state != undefined) {
             this.pen = new SPen(state.pen);
             this.pen = new SPen(state.pen);
             this.brush = new SBrush(state.brush);
             this.brush = new SBrush(state.brush);

+ 2 - 0
persagy-web-draw/src/engines/SSvgPaintEngine.ts

@@ -242,6 +242,7 @@ export class SSvgPaintEngine extends SPaintEngine {
         width?: number,
         width?: number,
         height?: number
         height?: number
     ): void {
     ): void {
+        // 图片路径存在
         // @ts-ignore
         // @ts-ignore
         if (img.src) {
         if (img.src) {
             // @ts-ignore
             // @ts-ignore
@@ -293,6 +294,7 @@ export class SSvgPaintEngine extends SPaintEngine {
      */
      */
     private static pointsToStr(points: SPoint[]): string {
     private static pointsToStr(points: SPoint[]): string {
         let strBuilder = new SStringBuilder();
         let strBuilder = new SStringBuilder();
+        // 遍历点集
         for (let p of points) {
         for (let p of points) {
             strBuilder.append(`${p.x},${p.y}`);
             strBuilder.append(`${p.x},${p.y}`);
         }
         }

persagy-web-draw/src/SPathCommand.ts → persagy-web-draw/src/types/SPathCommand.ts


+ 3 - 0
persagy-web-graph/README.md

@@ -6,6 +6,9 @@
     无特殊说明单版本为跟随依赖版本升级
     无特殊说明单版本为跟随依赖版本升级
     |
     |
     |
     |
+    |-- 2.2.44 item中通过参数控制,当前item入选择器时是增选还是替换
+    |
+    |
     |-- 2.2.43 场景从SObject派生,可以抛出事件
     |-- 2.2.43 场景从SObject派生,可以抛出事件
     |
     |
     |
     |

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

@@ -1,6 +1,6 @@
 {
 {
     "name": "@persagy-web/graph",
     "name": "@persagy-web/graph",
-    "version": "2.2.43",
+    "version": "2.2.44",
     "description": "博锐尚格二维图形引擎。",
     "description": "博锐尚格二维图形引擎。",
     "main": "lib/index.js",
     "main": "lib/index.js",
     "types": "lib/index.d.js",
     "types": "lib/index.d.js",

+ 2 - 1
persagy-web-graph/src/SGraphItem.ts

@@ -222,6 +222,7 @@ export class SGraphItem extends SObject {
         return this._data;
         return this._data;
     }
     }
 
 
+    likeCtrl: boolean = false;
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // 函数
     // 函数
     /**
     /**
@@ -792,7 +793,7 @@ export class SGraphItem extends SObject {
             return false;
             return false;
         }
         }
         // 如果按下 Ctrl 键,只改变当前 item 的选择标志
         // 如果按下 Ctrl 键,只改变当前 item 的选择标志
-        if (event.ctrlKey) {
+        if (event.ctrlKey || this.likeCtrl) {
             scene.selectContainer.toggleItem(this);
             scene.selectContainer.toggleItem(this);
         } else {
         } else {
             scene.selectContainer.setItem(this);
             scene.selectContainer.setItem(this);

+ 2 - 0
persagy-web-graph/src/SGraphSelectContainer.ts

@@ -42,6 +42,8 @@ export class SGraphSelectContainer extends SGraphItem {
     get itemList(): SGraphItem[] {
     get itemList(): SGraphItem[] {
         return this._itemList;
         return this._itemList;
     }
     }
+    /** 变化前的值 */
+    oldList: SGraphItem[] = [];
 
 
     /** 外接点的 list */
     /** 外接点的 list */
     private pointList: SPoint[] = [];
     private pointList: SPoint[] = [];

+ 1 - 0
persagy-web-graph/src/commands/SGraphMoveCommand.ts

@@ -74,6 +74,7 @@ export class SGraphMoveCommand extends SGraphCommand {
      * @return 是否已执行合并命令
      * @return 是否已执行合并命令
      */
      */
     mergeWith(command: SUndoCommand): boolean {
     mergeWith(command: SUndoCommand): boolean {
+        // 命令相同且执行命令的对象相同
         if (command instanceof SGraphMoveCommand && command.item == this.item) {
         if (command instanceof SGraphMoveCommand && command.item == this.item) {
             command.pos = this.pos;
             command.pos = this.pos;
             return true;
             return true;

+ 5 - 0
persagy-web-graph/src/commands/SGraphPointListDelete.ts

@@ -73,9 +73,11 @@ export class SGraphPointListDelete extends SGraphCommand {
      * 执行重做操作执行
      * 执行重做操作执行
      */
      */
     redo(): void {
     redo(): void {
+        // 未传索引
         if (this.index == null) {
         if (this.index == null) {
             this.pointList.pop();
             this.pointList.pop();
         } else {
         } else {
+            // 否则
             this.pointList.splice(this.index, 1);
             this.pointList.splice(this.index, 1);
         }
         }
         this.item.update();
         this.item.update();
@@ -85,10 +87,13 @@ export class SGraphPointListDelete extends SGraphCommand {
      * 执行取消操作执行
      * 执行取消操作执行
      */
      */
     undo(): void {
     undo(): void {
+        // 删除的点存在
         if (this.pos == null) return;
         if (this.pos == null) return;
+        // 未传索引
         if (this.index == null) {
         if (this.index == null) {
             this.pointList.push(this.pos);
             this.pointList.push(this.pos);
         } else {
         } else {
+            // 否则
             this.pointList.splice(this.index, 0, this.pos);
             this.pointList.splice(this.index, 0, this.pos);
         }
         }
         this.item.update();
         this.item.update();

+ 4 - 0
persagy-web-graph/src/commands/SGraphPointListInsert.ts

@@ -74,9 +74,11 @@ export class SGraphPointListInsert extends SGraphCommand {
      */
      */
     redo(): void {
     redo(): void {
         const point = new SPoint(this.pos.x, this.pos.y);
         const point = new SPoint(this.pos.x, this.pos.y);
+        // 传入索引
         if (this.index == null) {
         if (this.index == null) {
             this.pointList.push(point);
             this.pointList.push(point);
         } else {
         } else {
+            // 否则
             this.pointList.splice(this.index, 0, point);
             this.pointList.splice(this.index, 0, point);
         }
         }
         this.item.update();
         this.item.update();
@@ -86,9 +88,11 @@ export class SGraphPointListInsert extends SGraphCommand {
      * 执行取消操作执行
      * 执行取消操作执行
      */
      */
     undo(): void {
     undo(): void {
+        // 传入索引
         if (this.index == null) {
         if (this.index == null) {
             this.pointList.pop();
             this.pointList.pop();
         } else {
         } else {
+            // 否则
             this.pointList.splice(this.index, 1);
             this.pointList.splice(this.index, 1);
         }
         }
         this.item.update();
         this.item.update();

+ 1 - 0
persagy-web-graph/src/items/SAnchorItem.ts

@@ -65,6 +65,7 @@ export class SAnchorItem extends SGraphItem {
         painter.pen.lineWidth = painter.toPx(1);
         painter.pen.lineWidth = painter.toPx(1);
         painter.pen.color = new SColor("#2196f3");
         painter.pen.color = new SColor("#2196f3");
         painter.brush.color = SColor.White;
         painter.brush.color = SColor.White;
+        // 如果已连接
         if (this.isConnected) {
         if (this.isConnected) {
             painter.brush.color = painter.pen.color;
             painter.brush.color = painter.pen.color;
         }
         }

+ 7 - 0
persagy-web-graph/src/items/SGraphAreaGroupItem.ts

@@ -62,6 +62,7 @@ export class SGraphAreaGroupItem extends SGraphStyleItem {
      */
      */
     constructor(parent: SGraphItem | null, data: AreaGroup) {
     constructor(parent: SGraphItem | null, data: AreaGroup) {
         super(parent);
         super(parent);
+        // outline 属性符合条件
         if (data.outline.length && data.outline[0] && data.outline[0].length) {
         if (data.outline.length && data.outline[0] && data.outline[0].length) {
             let tempArr = data.outline;
             let tempArr = data.outline;
             this.minX = tempArr[0][0][0].x;
             this.minX = tempArr[0][0][0].x;
@@ -127,21 +128,26 @@ export class SGraphAreaGroupItem extends SGraphStyleItem {
      * @return 是否在区域内
      * @return 是否在区域内
      */
      */
     contains(x: number, y: number): boolean {
     contains(x: number, y: number): boolean {
+        // 遍历点集
         for (let j = 0; j < this.pointList.length; j++) {
         for (let j = 0; j < this.pointList.length; j++) {
             let arr = this.pointList[j];
             let arr = this.pointList[j];
+            // 空数组 或者 不在第一个轮廓内
             if (arr.length < 1 || !SPolygonUtil.pointIn(x, y, arr[0])) {
             if (arr.length < 1 || !SPolygonUtil.pointIn(x, y, arr[0])) {
                 continue;
                 continue;
             }
             }
+            // 在第一个轮廓内
             if (arr.length == 1) {
             if (arr.length == 1) {
                 return true;
                 return true;
             }
             }
             let flag = false;
             let flag = false;
+            // 是否在后边的轮廓内
             for (let i = 1; i < arr.length; i++) {
             for (let i = 1; i < arr.length; i++) {
                 if (SPolygonUtil.pointIn(x, y, arr[i])) {
                 if (SPolygonUtil.pointIn(x, y, arr[i])) {
                     flag = true;
                     flag = true;
                     break;
                     break;
                 }
                 }
             }
             }
+            // 在后边的轮廓内
             if (flag) {
             if (flag) {
                 continue;
                 continue;
             }
             }
@@ -158,6 +164,7 @@ export class SGraphAreaGroupItem extends SGraphStyleItem {
     onDraw(painter: SPainter): void {
     onDraw(painter: SPainter): void {
         painter.pen.color = this.strokeColor;
         painter.pen.color = this.strokeColor;
         painter.brush.color = this.fillColor;
         painter.brush.color = this.fillColor;
+        // 边宽是否需要转成像素
         if (this.widthIsPx) {
         if (this.widthIsPx) {
             painter.pen.lineWidth = painter.toPx(this.lineWidth);
             painter.pen.lineWidth = painter.toPx(this.lineWidth);
         } else {
         } else {

+ 3 - 0
persagy-web-graph/src/items/SGraphBaseCircle.ts

@@ -71,17 +71,20 @@ export class SGraphBaseCircle extends SGraphStyleItem {
     onDraw(painter: SPainter): void {
     onDraw(painter: SPainter): void {
         painter.pen.color = this.strokeColor;
         painter.pen.color = this.strokeColor;
         painter.brush.color = this.fillColor;
         painter.brush.color = this.fillColor;
+        // 线宽转像素
         if (this.widthIsPx) {
         if (this.widthIsPx) {
             painter.pen.lineWidth = painter.toPx(this.lineWidth);
             painter.pen.lineWidth = painter.toPx(this.lineWidth);
         } else {
         } else {
             painter.pen.lineWidth = this.lineWidth;
             painter.pen.lineWidth = this.lineWidth;
         }
         }
+        // 虚线
         if (this.lineStyle == SLineStyle.Dashed) {
         if (this.lineStyle == SLineStyle.Dashed) {
             painter.pen.lineDash = [
             painter.pen.lineDash = [
                 painter.toPx(this.lineWidth * 3),
                 painter.toPx(this.lineWidth * 3),
                 painter.toPx(this.lineWidth * 7)
                 painter.toPx(this.lineWidth * 7)
             ];
             ];
         } else if (this.lineStyle == SLineStyle.Dotted) {
         } else if (this.lineStyle == SLineStyle.Dotted) {
+            // 点线
             painter.pen.lineDash = [
             painter.pen.lineDash = [
                 painter.toPx(this.lineWidth * 2),
                 painter.toPx(this.lineWidth * 2),
                 painter.toPx(this.lineWidth * 2)
                 painter.toPx(this.lineWidth * 2)

+ 6 - 0
persagy-web-graph/src/items/SGraphCircleItem.ts

@@ -70,6 +70,7 @@ export class SGraphCircleItem extends SGraphStyleItem {
      * 计算矩形的左上角和右下角
      * 计算矩形的左上角和右下角
      */
      */
     private calRect(): void {
     private calRect(): void {
+        // 存在2个点
         if (this.line.length > 1) {
         if (this.line.length > 1) {
             const fi = this.line[0];
             const fi = this.line[0];
             const se = this.line[1];
             const se = this.line[1];
@@ -101,6 +102,7 @@ export class SGraphCircleItem extends SGraphStyleItem {
      * @return SRect   外接矩阵
      * @return SRect   外接矩阵
      */
      */
     boundingRect(): SRect {
     boundingRect(): SRect {
+        // 存在2个点
         if (this.line.length > 1) {
         if (this.line.length > 1) {
             this.calRect();
             this.calRect();
             return new SRect(this._leftTop, this._rightBottom);
             return new SRect(this._leftTop, this._rightBottom);
@@ -114,20 +116,24 @@ export class SGraphCircleItem extends SGraphStyleItem {
      * @param painter    绘制对象
      * @param painter    绘制对象
      */
      */
     onDraw(painter: SPainter): void {
     onDraw(painter: SPainter): void {
+        // 数据中有2个点
         if (this.line.length == 2) {
         if (this.line.length == 2) {
             painter.pen.color = this.strokeColor;
             painter.pen.color = this.strokeColor;
             painter.brush.color = this.fillColor;
             painter.brush.color = this.fillColor;
+            // 线宽是否需要转像素
             if (this.widthIsPx) {
             if (this.widthIsPx) {
                 painter.pen.lineWidth = painter.toPx(this.lineWidth);
                 painter.pen.lineWidth = painter.toPx(this.lineWidth);
             } else {
             } else {
                 painter.pen.lineWidth = this.lineWidth;
                 painter.pen.lineWidth = this.lineWidth;
             }
             }
+            // 虚线
             if (this.lineStyle == SLineStyle.Dashed) {
             if (this.lineStyle == SLineStyle.Dashed) {
                 painter.pen.lineDash = [
                 painter.pen.lineDash = [
                     painter.toPx(this.lineWidth * 3),
                     painter.toPx(this.lineWidth * 3),
                     painter.toPx(this.lineWidth * 7)
                     painter.toPx(this.lineWidth * 7)
                 ];
                 ];
             } else if (this.lineStyle == SLineStyle.Dotted) {
             } else if (this.lineStyle == SLineStyle.Dotted) {
+                // 点线样式
                 painter.pen.lineDash = [
                 painter.pen.lineDash = [
                     painter.toPx(this.lineWidth * 2),
                     painter.toPx(this.lineWidth * 2),
                     painter.toPx(this.lineWidth * 2)
                     painter.toPx(this.lineWidth * 2)

+ 6 - 0
persagy-web-graph/src/items/SGraphPolyGroupItem.ts

@@ -54,11 +54,13 @@ export class SGraphPolyGroupItem extends SGraphStyleItem {
      */
      */
     constructor(parent: SGraphItem | null, data: PolyGroup) {
     constructor(parent: SGraphItem | null, data: PolyGroup) {
         super(parent);
         super(parent);
+        // 轮廓线数据正确
         if (data.outline.length && data.outline[0] && data.outline[0].length) {
         if (data.outline.length && data.outline[0] && data.outline[0].length) {
             this.minX = data.outline[0][0].x;
             this.minX = data.outline[0][0].x;
             this.maxX = this.minX;
             this.maxX = this.minX;
             this.minY = data.outline[0][0].y;
             this.minY = data.outline[0][0].y;
             this.maxY = this.minY;
             this.maxY = this.minY;
+            // 遍历点集,计算最大最小值
             this.pointList = data.outline.map((t): SPoint[] => {
             this.pointList = data.outline.map((t): SPoint[] => {
                 return t.map(
                 return t.map(
                     (it): SPoint => {
                     (it): SPoint => {
@@ -111,7 +113,9 @@ export class SGraphPolyGroupItem extends SGraphStyleItem {
      */
      */
     contains(x: number, y: number): boolean {
     contains(x: number, y: number): boolean {
         let arr = this.pointList;
         let arr = this.pointList;
+        // 遍历点集
         for (let i = 0; i < arr.length; i++) {
         for (let i = 0; i < arr.length; i++) {
+            // 在轮廓线内
             if (SPolygonUtil.pointIn(x, y, arr[i])) {
             if (SPolygonUtil.pointIn(x, y, arr[i])) {
                 return true;
                 return true;
             }
             }
@@ -127,11 +131,13 @@ export class SGraphPolyGroupItem extends SGraphStyleItem {
     onDraw(painter: SPainter): void {
     onDraw(painter: SPainter): void {
         painter.pen.color = this.strokeColor;
         painter.pen.color = this.strokeColor;
         painter.brush.color = this.fillColor;
         painter.brush.color = this.fillColor;
+        // 线宽转像素
         if (this.widthIsPx) {
         if (this.widthIsPx) {
             painter.pen.lineWidth = painter.toPx(this.lineWidth);
             painter.pen.lineWidth = painter.toPx(this.lineWidth);
         } else {
         } else {
             painter.pen.lineWidth = this.lineWidth;
             painter.pen.lineWidth = this.lineWidth;
         }
         }
+        // 遍历轮廓线集合
         this.pointList.forEach((t): void => {
         this.pointList.forEach((t): void => {
             painter.drawPolygon(t);
             painter.drawPolygon(t);
         });
         });

+ 8 - 0
persagy-web-graph/src/items/SGraphRectItem.ts

@@ -57,6 +57,7 @@ export class SGraphRectItem extends SGraphStyleItem {
         return this._radius;
         return this._radius;
     }
     }
     set radius(v: number) {
     set radius(v: number) {
+        // 与旧值相等,不做处理
         if (v == this._radius) {
         if (v == this._radius) {
             return;
             return;
         }
         }
@@ -73,6 +74,7 @@ export class SGraphRectItem extends SGraphStyleItem {
      */
      */
     constructor(parent: SGraphItem | null, data: SPoint[], radius: number = 0) {
     constructor(parent: SGraphItem | null, data: SPoint[], radius: number = 0) {
         super(parent);
         super(parent);
+        // 点不少于一个
         if (data.length) {
         if (data.length) {
             this.line = data;
             this.line = data;
             this.calRect();
             this.calRect();
@@ -86,6 +88,7 @@ export class SGraphRectItem extends SGraphStyleItem {
      * @return	边界区域
      * @return	边界区域
      */
      */
     boundingRect(): SRect {
     boundingRect(): SRect {
+        // 点不少于1个
         if (this.line.length > 1) {
         if (this.line.length > 1) {
             return new SRect(this._leftTop, this._rightBottom);
             return new SRect(this._leftTop, this._rightBottom);
         }
         }
@@ -97,6 +100,7 @@ export class SGraphRectItem extends SGraphStyleItem {
      * 计算矩形的左上角和右下角
      * 计算矩形的左上角和右下角
      */
      */
     protected calRect(): void {
     protected calRect(): void {
+        // 点不少于1个
         if (this.line.length > 1) {
         if (this.line.length > 1) {
             const fi = this.line[0];
             const fi = this.line[0];
             const se = this.line[1];
             const se = this.line[1];
@@ -128,20 +132,24 @@ export class SGraphRectItem extends SGraphStyleItem {
      * @param painter   绘制对象
      * @param painter   绘制对象
      */
      */
     onDraw(painter: SPainter): void {
     onDraw(painter: SPainter): void {
+        // 点有2个
         if (this.line.length == 2) {
         if (this.line.length == 2) {
             painter.pen.color = this.strokeColor;
             painter.pen.color = this.strokeColor;
             painter.brush.color = this.fillColor;
             painter.brush.color = this.fillColor;
+            // 线宽转像素
             if (this.widthIsPx) {
             if (this.widthIsPx) {
                 painter.pen.lineWidth = painter.toPx(this.lineWidth);
                 painter.pen.lineWidth = painter.toPx(this.lineWidth);
             } else {
             } else {
                 painter.pen.lineWidth = this.lineWidth;
                 painter.pen.lineWidth = this.lineWidth;
             }
             }
+            // 虚线
             if (this.lineStyle == SLineStyle.Dashed) {
             if (this.lineStyle == SLineStyle.Dashed) {
                 painter.pen.lineDash = [
                 painter.pen.lineDash = [
                     painter.toPx(this.lineWidth * 3),
                     painter.toPx(this.lineWidth * 3),
                     painter.toPx(this.lineWidth * 7)
                     painter.toPx(this.lineWidth * 7)
                 ];
                 ];
             } else if (this.lineStyle == SLineStyle.Dotted) {
             } else if (this.lineStyle == SLineStyle.Dotted) {
+                // 点线
                 painter.pen.lineDash = [
                 painter.pen.lineDash = [
                     painter.toPx(this.lineWidth * 2),
                     painter.toPx(this.lineWidth * 2),
                     painter.toPx(this.lineWidth * 2)
                     painter.toPx(this.lineWidth * 2)

+ 4 - 0
persagy-web-graph/src/items/SGraphShape.ts

@@ -58,6 +58,7 @@ export class SGraphShape extends SGraphItem {
      * 绘制前设置绘制样式
      * 绘制前设置绘制样式
      *
      *
      * @return 当前 item 状态值
      * @return 当前 item 状态值
+     * @deprecated
      */
      */
     setStyle(): string {
     setStyle(): string {
         let status = "default";
         let status = "default";
@@ -93,6 +94,7 @@ export class SGraphShape extends SGraphItem {
                     // @ts-ignore
                     // @ts-ignore
                     ...dataArr[1].split(",")
                     ...dataArr[1].split(",")
                 );
                 );
+                // 处理停点
                 for (let i = 2; i < dataArr.length; i++) {
                 for (let i = 2; i < dataArr.length; i++) {
                     const cur = dataArr[i].split(",");
                     const cur = dataArr[i].split(",");
                     grad.addColorStop(Number(cur[0]), new SColor(cur[1]));
                     grad.addColorStop(Number(cur[0]), new SColor(cur[1]));
@@ -109,6 +111,7 @@ export class SGraphShape extends SGraphItem {
                     // @ts-ignore
                     // @ts-ignore
                     ...dataArr[1].split(",")
                     ...dataArr[1].split(",")
                 );
                 );
+                // 处理停点
                 for (let i = 2; i < dataArr.length; i++) {
                 for (let i = 2; i < dataArr.length; i++) {
                     const cur = dataArr[i].split(",");
                     const cur = dataArr[i].split(",");
                     grad.addColorStop(Number(cur[0]), new SColor(cur[1]));
                     grad.addColorStop(Number(cur[0]), new SColor(cur[1]));
@@ -125,6 +128,7 @@ export class SGraphShape extends SGraphItem {
      * 绘制
      * 绘制
      *
      *
      * @param painter   绘制对象
      * @param painter   绘制对象
+     * @deprecated
      */
      */
     onDraw(painter: SPainter): void {
     onDraw(painter: SPainter): void {
         const status = this.setStyle();
         const status = this.setStyle();

+ 4 - 0
persagy-web-graph/src/items/SGraphStyleItem.ts

@@ -102,6 +102,7 @@ export class SGraphStyleItem extends SGraphItem {
         const index2 = str.indexOf("}");
         const index2 = str.indexOf("}");
         const temp = str.substring(index1 + 1, index2 - 1);
         const temp = str.substring(index1 + 1, index2 - 1);
         const dataArr = temp.split(";");
         const dataArr = temp.split(";");
+        // 线性渐变类型
         if (str.indexOf("SLinearGradient") > -1) {
         if (str.indexOf("SLinearGradient") > -1) {
             try {
             try {
                 // @ts-ignore
                 // @ts-ignore
@@ -110,6 +111,7 @@ export class SGraphStyleItem extends SGraphItem {
                     // @ts-ignore
                     // @ts-ignore
                     ...dataArr[1].split(",")
                     ...dataArr[1].split(",")
                 );
                 );
+                // 处理停点
                 for (let i = 2; i < dataArr.length; i++) {
                 for (let i = 2; i < dataArr.length; i++) {
                     const cur = dataArr[i].split(",");
                     const cur = dataArr[i].split(",");
                     grad.addColorStop(Number(cur[0]), new SColor(cur[1]));
                     grad.addColorStop(Number(cur[0]), new SColor(cur[1]));
@@ -119,6 +121,7 @@ export class SGraphStyleItem extends SGraphItem {
                 console.log("渐变颜色格式有误", e, str);
                 console.log("渐变颜色格式有误", e, str);
             }
             }
         } else if (str.indexOf("SRadialGradient") > -1) {
         } else if (str.indexOf("SRadialGradient") > -1) {
+            // 放射渐变类型
             try {
             try {
                 // @ts-ignore
                 // @ts-ignore
                 const grad = new SRadialGradient(
                 const grad = new SRadialGradient(
@@ -126,6 +129,7 @@ export class SGraphStyleItem extends SGraphItem {
                     // @ts-ignore
                     // @ts-ignore
                     ...dataArr[1].split(",")
                     ...dataArr[1].split(",")
                 );
                 );
+                // 处理停点
                 for (let i = 2; i < dataArr.length; i++) {
                 for (let i = 2; i < dataArr.length; i++) {
                     const cur = dataArr[i].split(",");
                     const cur = dataArr[i].split(",");
                     grad.addColorStop(Number(cur[0]), new SColor(cur[1]));
                     grad.addColorStop(Number(cur[0]), new SColor(cur[1]));

+ 6 - 0
persagy-web-graph/src/items/SGraphSvgItem.ts

@@ -45,10 +45,12 @@ export class SGraphSvgItem extends SGraphShape {
         return this._url;
         return this._url;
     }
     }
     set url(v: string) {
     set url(v: string) {
+        // 与旧值相等不做处理
         if (this._url == v) {
         if (this._url == v) {
             return;
             return;
         }
         }
         this._url = v;
         this._url = v;
+        // image 对象未创建则创建
         if (!this.img) {
         if (!this.img) {
             this.img = new Image();
             this.img = new Image();
         }
         }
@@ -61,6 +63,7 @@ export class SGraphSvgItem extends SGraphShape {
         return this._width;
         return this._width;
     }
     }
     set width(v: number) {
     set width(v: number) {
+        // 与旧值相等不做处理
         if (v == this._width) {
         if (v == this._width) {
             return;
             return;
         }
         }
@@ -73,6 +76,7 @@ export class SGraphSvgItem extends SGraphShape {
         return this._height;
         return this._height;
     }
     }
     set height(v: number) {
     set height(v: number) {
+        // 与旧值相等不做处理
         if (v == this._height) {
         if (v == this._height) {
             return;
             return;
         }
         }
@@ -93,6 +97,7 @@ export class SGraphSvgItem extends SGraphShape {
      */
      */
     constructor(parent: SGraphItem | null, data: SGraphSvg) {
     constructor(parent: SGraphItem | null, data: SGraphSvg) {
         super(parent, data.style);
         super(parent, data.style);
+        // 传入图片路径
         if (data.url) {
         if (data.url) {
             this.img = new Image();
             this.img = new Image();
             this.url = data.url;
             this.url = data.url;
@@ -126,6 +131,7 @@ export class SGraphSvgItem extends SGraphShape {
      * @param painter   绘制对象
      * @param painter   绘制对象
      */
      */
     onDraw(painter: SPainter): void {
     onDraw(painter: SPainter): void {
+        // 加载图片成功
         if (this.isLoadOver) {
         if (this.isLoadOver) {
             // @ts-ignore
             // @ts-ignore
             painter.drawImage(this.img, 0, 0, this.width, this.height);
             painter.drawImage(this.img, 0, 0, this.width, this.height);

+ 19 - 1
persagy-web-graph/src/items/SImageItem.ts

@@ -115,12 +115,14 @@ export class SImageItem extends SObjectItem {
                 /\(i[^;]+;( U;)? CPU.+Mac OS X/
                 /\(i[^;]+;( U;)? CPU.+Mac OS X/
             ); //ios终端
             ); //ios终端
             try {
             try {
+                // ios终端
                 if (isiOS) {
                 if (isiOS) {
                     this.isLoadOver = true;
                     this.isLoadOver = true;
                     this.computeImgSize();
                     this.computeImgSize();
                     this.$emit("imgLoadOver");
                     this.$emit("imgLoadOver");
                     this.update();
                     this.update();
                 } else {
                 } else {
+                    // 否则
                     // @ts-ignore
                     // @ts-ignore
                     const imgSrc = e.path[0].src;
                     const imgSrc = e.path[0].src;
                     if (this.isUrlIdentical(imgSrc)) {
                     if (this.isUrlIdentical(imgSrc)) {
@@ -143,12 +145,14 @@ export class SImageItem extends SObjectItem {
             try {
             try {
                 const isiOS = !!navigator.userAgent.match(
                 const isiOS = !!navigator.userAgent.match(
                     /\(i[^;]+;( U;)? CPU.+Mac OS X/
                     /\(i[^;]+;( U;)? CPU.+Mac OS X/
-                ); //ios终端
+                );
+                // ios终端
                 if (isiOS) {
                 if (isiOS) {
                     this.isLoadOver = false;
                     this.isLoadOver = false;
                     this.$emit("imgLoadOver");
                     this.$emit("imgLoadOver");
                     this.update();
                     this.update();
                 } else {
                 } else {
+                    // 否则
                     // @ts-ignore
                     // @ts-ignore
                     const imgSrc = e.path[0].src;
                     const imgSrc = e.path[0].src;
                     if (this.isUrlIdentical(imgSrc)) {
                     if (this.isUrlIdentical(imgSrc)) {
@@ -184,6 +188,7 @@ export class SImageItem extends SObjectItem {
      * 根据显示模式计算图片的宽高
      * 根据显示模式计算图片的宽高
      */
      */
     computeImgSize(): void {
     computeImgSize(): void {
+        // 加载图片成功
         if (this.isLoadOver) {
         if (this.isLoadOver) {
             // 要绘制图片的宽度
             // 要绘制图片的宽度
             let width = 0;
             let width = 0;
@@ -199,21 +204,28 @@ export class SImageItem extends SObjectItem {
             let imgHwRatio: number =
             let imgHwRatio: number =
                 // @ts-ignore
                 // @ts-ignore
                 (this.img.height as number) / (this.img.width as number);
                 (this.img.height as number) / (this.img.width as number);
+            // 图片展示类型铺满
             if (this.showType == SImageShowType.Full) {
             if (this.showType == SImageShowType.Full) {
                 width = this.width;
                 width = this.width;
                 height = this.height;
                 height = this.height;
             } else if (this.showType == SImageShowType.Equivalency) {
             } else if (this.showType == SImageShowType.Equivalency) {
+                // 等比缩放
+
+                // 比较宽高比-图片item的高较小,以小的为准
                 if (itemAspectRatio > imgAspectRatio) {
                 if (itemAspectRatio > imgAspectRatio) {
                     height = this.height;
                     height = this.height;
                     width = imgAspectRatio * height;
                     width = imgAspectRatio * height;
                 } else if (itemAspectRatio < imgAspectRatio) {
                 } else if (itemAspectRatio < imgAspectRatio) {
+                    // 图片item 的宽较小
                     width = this.width;
                     width = this.width;
                     height = width * imgHwRatio;
                     height = width * imgHwRatio;
                 } else {
                 } else {
+                    // 两者相等
                     width = this.width;
                     width = this.width;
                     height = this.height;
                     height = this.height;
                 }
                 }
             } else if (this.showType == SImageShowType.AutoFit) {
             } else if (this.showType == SImageShowType.AutoFit) {
+                // 图片展示类型自适应
                 // @ts-ignore
                 // @ts-ignore
                 this.width = this.img.width as number;
                 this.width = this.img.width as number;
                 // @ts-ignore
                 // @ts-ignore
@@ -237,12 +249,15 @@ export class SImageItem extends SObjectItem {
      * @return 当前地址和回调地址是否相同
      * @return 当前地址和回调地址是否相同
      */
      */
     private isUrlIdentical(imgUrl: string): boolean {
     private isUrlIdentical(imgUrl: string): boolean {
+        // 如果 url 包含该符号
         if (this.url.indexOf("://") == -1) {
         if (this.url.indexOf("://") == -1) {
             // eslint-disable-next-line max-len
             // eslint-disable-next-line max-len
             const reg = /^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*?)\s*$/i;
             const reg = /^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*?)\s*$/i;
             if (reg.test(this.url)) {
             if (reg.test(this.url)) {
+                // base64 格式
                 return this.url == imgUrl;
                 return this.url == imgUrl;
             } else {
             } else {
+                // 否则
                 return this.url == this.GetUrlRelativePath(imgUrl);
                 return this.url == this.GetUrlRelativePath(imgUrl);
             }
             }
         } else {
         } else {
@@ -295,6 +310,7 @@ export class SImageItem extends SObjectItem {
      */
      */
     onDraw(painter: SPainter): void {
     onDraw(painter: SPainter): void {
         painter.translate(-this.origin.x, -this.origin.y);
         painter.translate(-this.origin.x, -this.origin.y);
+        // 图片加载成功
         if (this.isLoadOver) {
         if (this.isLoadOver) {
             // @ts-ignore
             // @ts-ignore
             painter.drawImage(this.img, 0, 0, this.imgWidth, this.imgHeight);
             painter.drawImage(this.img, 0, 0, this.imgWidth, this.imgHeight);
@@ -310,12 +326,14 @@ export class SImageItem extends SObjectItem {
             painter.shadow.shadowColor = SColor.Transparent;
             painter.shadow.shadowColor = SColor.Transparent;
         }
         }
 
 
+        // 虚线
         if (this.lineStyle == SLineStyle.Dashed) {
         if (this.lineStyle == SLineStyle.Dashed) {
             painter.pen.lineDash = [
             painter.pen.lineDash = [
                 painter.toPx(this.lineWidth * 3),
                 painter.toPx(this.lineWidth * 3),
                 painter.toPx(this.lineWidth * 7)
                 painter.toPx(this.lineWidth * 7)
             ];
             ];
         } else if (this.lineStyle == SLineStyle.Dotted) {
         } else if (this.lineStyle == SLineStyle.Dotted) {
+            // 点线
             painter.pen.lineDash = [
             painter.pen.lineDash = [
                 painter.toPx(2 * this.lineWidth),
                 painter.toPx(2 * this.lineWidth),
                 painter.toPx(2 * this.lineWidth)
                 painter.toPx(2 * this.lineWidth)

+ 6 - 2
persagy-web-graph/src/items/SObjectItem.ts

@@ -42,7 +42,9 @@ export abstract class SObjectItem extends SGraphItem {
         return this._width;
         return this._width;
     }
     }
     set width(v: number) {
     set width(v: number) {
-        if (v > 0) {
+        // 值有效
+        if (v >= 0) {
+            // 不等于旧值
             if (v != this._width) {
             if (v != this._width) {
                 let w = this._width;
                 let w = this._width;
                 this._width = v;
                 this._width = v;
@@ -60,7 +62,9 @@ export abstract class SObjectItem extends SGraphItem {
         return this._height;
         return this._height;
     }
     }
     set height(v: number) {
     set height(v: number) {
-        if (v > 0) {
+        // 值有效
+        if (v >= 0) {
+            // 不等于旧值
             if (v != this._height) {
             if (v != this._height) {
                 let h = this._height;
                 let h = this._height;
                 this._height = v;
                 this._height = v;

+ 2 - 1
persagy-web-graph/src/items/STextItem.ts

@@ -172,7 +172,7 @@ export class STextItem extends SObjectItem {
      */
      */
     protected drawShowText(painter: SPainter): void {
     protected drawShowText(painter: SPainter): void {
         painter.translate(-this.origin.x, -this.origin.y);
         painter.translate(-this.origin.x, -this.origin.y);
-        //绘制矩形轮廓,是否选中
+        // 绘制矩形轮廓,是否选中
         if (this.selected) {
         if (this.selected) {
             painter.shadow.shadowBlur = 10;
             painter.shadow.shadowBlur = 10;
             painter.shadow.shadowColor = new SColor(`#00000033`);
             painter.shadow.shadowColor = new SColor(`#00000033`);
@@ -190,6 +190,7 @@ export class STextItem extends SObjectItem {
         painter.brush.color = new SColor(this.color);
         painter.brush.color = new SColor(this.color);
         painter.shadow.shadowColor = SColor.Transparent;
         painter.shadow.shadowColor = SColor.Transparent;
         painter.font = this.font;
         painter.font = this.font;
+        // 遍历文本数组
         this._textArr.forEach((text: string, index: number): void => {
         this._textArr.forEach((text: string, index: number): void => {
             painter.drawText(
             painter.drawText(
                 text,
                 text,

+ 2 - 0
persagy-web-graph/src/utils/SMathUtil.ts

@@ -82,6 +82,7 @@ export class SMathUtil {
         let b1 = line1.y1 - k1 * line1.x1;
         let b1 = line1.y1 - k1 * line1.x1;
         let k2 = line2.dy / line2.dx;
         let k2 = line2.dy / line2.dx;
         let b2 = line2.y1 - k2 * line2.x1;
         let b2 = line2.y1 - k2 * line2.x1;
+        // 斜率是否相等
         if (k1 == k2) {
         if (k1 == k2) {
             if (b1 == b2) {
             if (b1 == b2) {
                 return "repeat";
                 return "repeat";
@@ -92,6 +93,7 @@ export class SMathUtil {
         let intersectionY = k1 * intersectionX + b1;
         let intersectionY = k1 * intersectionX + b1;
         let minX = Math.min(line1.x1, line1.x2);
         let minX = Math.min(line1.x1, line1.x2);
         let maxX = Math.min(line2.x1, line2.x2);
         let maxX = Math.min(line2.x1, line2.x2);
+        // 交点是否在两条线上
         if (intersectionX >= minX && intersectionX <= maxX) {
         if (intersectionX >= minX && intersectionX <= maxX) {
             return new SPoint(intersectionX, intersectionY);
             return new SPoint(intersectionX, intersectionY);
         }
         }