Browse Source

editer:feat:顶部删除问题修改

haojianlong 4 years ago
parent
commit
6a991ee714
1 changed files with 9 additions and 16 deletions
  1. 9 16
      src/components/editClass/big-edit/SBaseEditScene.ts

+ 9 - 16
src/components/editClass/big-edit/SBaseEditScene.ts

@@ -333,29 +333,22 @@ export class SBaseEditScene extends SGraphEditScene {
      */
     deleteItem(itemArr: SGraphItem[] = []): any {
         let itemList = null;
-        if (itemArr && itemArr.length) {
-            itemList = itemArr
-            itemArr.forEach((element: any) => {
-                this.removeItem(element)
-            });
-            if (this.view) {
-                this.view.update()
-            }
+        if (itemArr && itemArr.length && itemArr[0]) {
+            itemList = [...itemArr]
         } else {
             if (this.selectContainer.count == 0) {
                 return []
             }
             itemList = this.selectContainer.itemList;
-            // 推入 undo/redo 栈
             this.undoStack.push(new SGraphDeleteListCommand(this, [...itemList]))
-            itemList.forEach((element: any) => {
-                this.removeItem(element)
-            });
-            if (this.view) {
-                this.view.update()
-            }
         }
-
+        // 推入 undo/redo 栈
+        itemList.forEach((element: any) => {
+            this.removeItem(element)
+        });
+        if (this.view) {
+            this.view.update()
+        }
         return itemList
     } // Function deleteItem()