Browse Source

Merge pull request #9190 from BabylonJS/msDestiny14/nme

Reconnecting Frame Port Refresh Bug
PirateJC 4 years ago
parent
commit
8232fd3271
2 changed files with 10 additions and 4 deletions
  1. 4 4
      nodeEditor/src/diagram/graphFrame.ts
  2. 6 0
      nodeEditor/src/diagram/graphNode.ts

+ 4 - 4
nodeEditor/src/diagram/graphFrame.ts

@@ -225,7 +225,7 @@ export class GraphFrame {
                     portAdded = true;
                     const onLinkDisposedObserver = link.onDisposedObservable.add((nodeLink: NodeLink) => {
                         this.removePortFromExposedWithLink(nodeLink, this._exposedInPorts);
-                        this._redrawFramePorts();
+                        this.redrawFramePorts();
                     });
                     this._onNodeLinkDisposedObservers.push(onLinkDisposedObserver);
                 }
@@ -255,7 +255,7 @@ export class GraphFrame {
 
                         const onLinkDisposedObserver = link.onDisposedObservable.add((nodeLink: NodeLink) => {
                             this.removePortFromExposedWithLink(nodeLink, this._exposedOutPorts);
-                            this._redrawFramePorts();
+                            this.redrawFramePorts();
                         });
 
                         this._onNodeLinkDisposedObservers.push(onLinkDisposedObserver); 
@@ -291,7 +291,7 @@ export class GraphFrame {
         return false;
     }
 
-    private _redrawFramePorts() {
+    public redrawFramePorts() {
         if(!this.isCollapsed) {
             return;
         }
@@ -643,7 +643,7 @@ export class GraphFrame {
             if (this.nodes.indexOf(node) === -1) {
                 return;
             }
-            this._redrawFramePorts();
+            this.redrawFramePorts();
         });
 
         this._commentsElement = document.createElement('div');

+ 6 - 0
nodeEditor/src/diagram/graphNode.ts

@@ -297,6 +297,12 @@ export class GraphNode {
             port.refresh();
         }
 
+        if(this.enclosingFrameId !== -1) {   
+            let index = this._ownerCanvas.frames.findIndex(frame => frame.id === this.enclosingFrameId);
+            if(index >= 0 && this._ownerCanvas.frames[index].isCollapsed) {
+                this._ownerCanvas.frames[index].redrawFramePorts();
+            }
+        }   
         this._comments.innerHTML = this.block.comments || "";
         this._comments.title = this.block.comments || "";