|
@@ -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()
|
|
|
|