zhangyu 5 éve
szülő
commit
03b2f332e8
2 módosított fájl, 10 hozzáadás és 6 törlés
  1. 1 1
      saga-web-big/package.json
  2. 9 5
      saga-web-big/src/items/SPolylineItem.ts

+ 1 - 1
saga-web-big/package.json

@@ -42,6 +42,6 @@
         "typescript": "^3.9.3"
     },
     "dependencies": {
-        "@saga-web/graph": "2.1.84"
+        "@saga-web/graph": "2.1.86"
     }
 }

+ 9 - 5
saga-web-big/src/items/SPolylineItem.ts

@@ -1,5 +1,5 @@
 import { SColor, SLine, SPainter, SPoint, SRect } from "@saga-web/draw";
-import { SMouseEvent, SUndoStack } from "@saga-web/base";
+import { SMouseEvent, SUndoStack, SKeyCode } from "@saga-web/base";
 import { SItemStatus } from "..";
 import { SMathUtil } from "../utils/SMathUtil";
 import {
@@ -166,7 +166,7 @@ export class SPolylineItem extends SGraphItem {
      * @return  boolean 是否处理事件
      * */
     onMouseDown(event: SMouseEvent): boolean {
-        this.curIndex = -1;
+        // this.curIndex = -1;
         this.curPoint = null;
         if (event.buttons == 1) {
             if (this.status == SItemStatus.Create) {
@@ -241,8 +241,8 @@ export class SPolylineItem extends SGraphItem {
                 ]);
             }
         }
-        this.curIndex = -1;
-        this.curPoint = null;
+        // this.curIndex = -1;
+        // this.curPoint = null;
         return true;
     } // Function onMouseMove()
 
@@ -272,11 +272,15 @@ export class SPolylineItem extends SGraphItem {
      * @param	event         事件参数
      */
     onKeyUp(event: KeyboardEvent): void {
-        if (event.keyCode == 13) {
+        if (event.keyCode == SKeyCode.Enter) {
             this.status = SItemStatus.Normal;
             this.releaseItem();
             this.$emit("finishCreated");
         }
+        // delete删除点
+        if (event.keyCode == SKeyCode.Delete && this.status == SItemStatus.Edit) {
+            this.delPoint(this.curIndex);
+        }
     } // Function onKeyUp()
 
     /**