瀏覽代碼

deleting a collapsed frame deletes all the nodes inside

Pamela Wolf 4 年之前
父節點
當前提交
6ecec54033
共有 1 個文件被更改,包括 11 次插入5 次删除
  1. 11 5
      nodeEditor/src/diagram/graphFrame.ts

+ 11 - 5
nodeEditor/src/diagram/graphFrame.ts

@@ -1266,11 +1266,17 @@ export class GraphFrame {
     }
 
     public dispose() {
-        this.isCollapsed = false;
-        
-        this._nodes.forEach(node => {
-            node.enclosingFrameId = -1;
-        });
+        if(this.isCollapsed) {
+            while(this._nodes.length > 0) {
+                this._nodes[0].dispose();
+            }
+            this.isCollapsed = false;
+        }
+        else {
+            this._nodes.forEach(node => {
+                node.enclosingFrameId = -1;
+            });
+        }
 
         if (this._onSelectionChangedObserver) {
             this._ownerCanvas.globalState.onSelectionChangedObservable.remove(this._onSelectionChangedObserver);