Browse Source

deleting a collapsed frame deletes all the nodes inside

Pamela Wolf 5 years ago
parent
commit
6ecec54033
1 changed files with 11 additions and 5 deletions
  1. 11 5
      nodeEditor/src/diagram/graphFrame.ts

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

@@ -1266,11 +1266,17 @@ export class GraphFrame {
     }
     }
 
 
     public dispose() {
     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) {
         if (this._onSelectionChangedObserver) {
             this._ownerCanvas.globalState.onSelectionChangedObservable.remove(this._onSelectionChangedObserver);
             this._ownerCanvas.globalState.onSelectionChangedObservable.remove(this._onSelectionChangedObserver);