From c99cad106ef5be9f818e45d385dfdcec29ce19e5 Mon Sep 17 00:00:00 2001
From: hanbaoshan <hanbaoshan@aiotlink.com>
Date: 星期四, 03 十二月 2020 16:52:24 +0800
Subject: [PATCH] 修复绘制多边形撤销错误的bug

---
 src/components/canvas/Dialog.vue |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/components/canvas/Dialog.vue b/src/components/canvas/Dialog.vue
index 8d66184..3796291 100644
--- a/src/components/canvas/Dialog.vue
+++ b/src/components/canvas/Dialog.vue
@@ -218,7 +218,8 @@
     cancel() {
       this.changeType('0')
       this.undisabled()
-      this.delCursor = {}
+      //this.delCursor = {}
+      this.delCursor = { type: -1, index: -1, remarksName: "", id: "" };
       this.canvasHistory.length = 0;
       this.step = -1;
       this.canvasData = JSON.parse(JSON.stringify(this.canvasDataToChild));
@@ -409,7 +410,7 @@
           break;
         case "5":
           delEle = this.canvasData.polygon[this.delCursor.index];
-          this.canvasData.polygon.splice(this.delCursor.index, 1);
+          this.canvasData.polygon.splice(this.delCursor.index+1, 1);
           break;
       }
       this.clickSelect();
@@ -536,6 +537,7 @@
           _this.type = "0";
           _this.delCursor.type = "2";
           _this.delCursor.index = i;
+          debugger
           _this.delCursor.remarksName = v.name;
           _this.delCursor.id = v.id;
           // console.log("褰撳墠閫変腑鍏冪礌锛�",_this.delCursor)
@@ -1269,7 +1271,10 @@
       this.lineIndex = this.canvasData.line.length;
       this.rectIndex = this.canvasData.rect.length;
       this.arrowIndex = this.canvasData.arrow.length;
-      this.polygonIndex = this.canvasData.polygon.length;
+      //鎺掗櫎this.canvasData.polygon鍏ㄩ儴鍖哄煙(鍏ㄩ儴鍖哄煙鐨刬d灏辨槸鎽勫儚鏈虹殑id)
+
+      let filterPolygonArr = this.canvasData.polygon.filter(item=>item.id != this.TreeDataPool.selectedNode.id)
+      this.polygonIndex = filterPolygonArr.length;
     },
     // 鐢熸垚uuid
     getUuid() {

--
Gitblit v1.8.0