Kaynağa Gözat

创建业务空间item修改

haojianlong 3 yıl önce
ebeveyn
işleme
eefb76c05f
1 değiştirilmiş dosya ile 9 ekleme ve 4 silme
  1. 9 4
      src/utils/graph/DrawZoneItem.ts

+ 9 - 4
src/utils/graph/DrawZoneItem.ts

@@ -43,6 +43,8 @@ export class DrawZoneItem extends SGraphStyleItem {
     private isAlt: boolean = false;
     /** undo/redo 堆栈 */
     protected undoStack: SUndoStack = new SUndoStack();
+    /** 创建成功标识 */
+    creatSuc = false;
 
     /**
      * 构造函数
@@ -449,9 +451,7 @@ export class DrawZoneItem extends SGraphStyleItem {
                 );
             }
             if (this.pointList.length > 2 && len > 0 && len < this.scenceLen) {
-                this.$emit("finishCreated");
-                this.status = SItemStatus.Normal;
-                this.releaseItem();
+                this.creatSuc = true;
             } else {
                 this.insertPoint(event.x, event.y);
                 // 记录新增顶点操作记录压入堆栈
@@ -565,7 +565,12 @@ export class DrawZoneItem extends SGraphStyleItem {
         } else if (this.status == SItemStatus.Normal) {
             return super.onMouseUp(event);
         } else if (this.status == SItemStatus.Create) {
-
+            if (this.creatSuc) {
+                this.$emit("finishCreated");
+                this.status = SItemStatus.Normal;
+                this.releaseItem();
+                this.creatSuc = false;
+            }
         }
         return true;
     }