Browse Source

removing expose port option when it is not in a frame

Pamela Wolf 5 years ago
parent
commit
9bd63fa1f5

+ 6 - 1
nodeEditor/src/diagram/graphFrame.ts

@@ -533,6 +533,7 @@ export class GraphFrame {
             if (index === -1) {
                 return;
             } else {
+                node.enclosingFrameId = -1;
                 this._nodes.splice(index, 1);
             }
         });
@@ -575,8 +576,8 @@ export class GraphFrame {
 
     public removeNode(node: GraphNode) {
         let index = this.nodes.indexOf(node);
-
         if (index > -1) {
+            node.enclosingFrameId = -1;
             this.nodes.splice(index, 1);
         }
     }
@@ -1266,6 +1267,10 @@ export class GraphFrame {
 
     public dispose() {
         this.isCollapsed = false;
+        
+        this._nodes.forEach(node => {
+            node.enclosingFrameId = -1;
+        });
 
         if (this._onSelectionChangedObserver) {
             this._ownerCanvas.globalState.onSelectionChangedObservable.remove(this._onSelectionChangedObserver);

+ 1 - 1
nodeEditor/src/diagram/graphNode.ts

@@ -39,7 +39,7 @@ export class GraphNode {
     private _isSelected: boolean;
     private _displayManager: Nullable<IDisplayManager> = null;
     private _isVisible = true;
-    private _enclosingFrameId: number;
+    private _enclosingFrameId = -1;
 
     public get isVisible() {
         return this._isVisible;

+ 1 - 1
nodeEditor/src/diagram/properties/nodePortPropertyComponent.tsx

@@ -45,7 +45,7 @@ export class NodePortPropertyTabComponent extends React.Component<IFrameNodePort
                 <div>
                     <LineContainerComponent title="GENERAL">
                         {this.props.nodePort.hasLabel() && <TextInputLineComponent globalState={this.props.globalState} label="Port Label" propertyName="portName" target={this.props.nodePort} />}
-                        {this.props.nodePort.node.enclosingFrameId !== undefined && <CheckBoxLineComponent label= "Expose Port on Frame" target={this.props.nodePort} isSelected={() => this.props.nodePort.exposedOnFrame} onSelect={(value: boolean) => this.toggleExposeOnFrame(value)}  propertyName="exposedOnFrame" disabled={this.props.nodePort.disabled} />}
+                        {this.props.nodePort.node.enclosingFrameId !== -1 && <CheckBoxLineComponent label= "Expose Port on Frame" target={this.props.nodePort} isSelected={() => this.props.nodePort.exposedOnFrame} onSelect={(value: boolean) => this.toggleExposeOnFrame(value)}  propertyName="exposedOnFrame" disabled={this.props.nodePort.disabled} />}
                     </LineContainerComponent>
                 </div>
             </div>