소스 검색

deleteing code

Pamela Wolf 4 년 전
부모
커밋
3e765f0c5b
3개의 변경된 파일0개의 추가작업 그리고 244개의 파일을 삭제
  1. 0 23
      guiEditor/src/diagram/graphCanvas.tsx
  2. 0 155
      guiEditor/src/diagram/graphFrame.ts
  3. 0 66
      guiEditor/src/diagram/graphNode.ts

+ 0 - 23
guiEditor/src/diagram/graphCanvas.tsx

@@ -328,29 +328,6 @@ export class GraphCanvasComponent extends React.Component<IGraphCanvasComponentP
         var nodeA = this.findNodeFromBlock(blockA);
         var nodeB = this.findNodeFromBlock(blockB);
 
-        if (!nodeA || !nodeB) {
-            return;
-        }
-
-        var portA = nodeA.getPortForConnectionPoint(pointA);
-        var portB = nodeB.getPortForConnectionPoint(pointB);
-
-        if (!portA || !portB) {
-            return;
-        }
-
-        for (var currentLink of this._links) {
-            if (currentLink.portA === portA && currentLink.portB === portB) {
-                return;
-            }
-            if (currentLink.portA === portB && currentLink.portB === portA) {
-                return;
-            }
-        }
-
-        const link = new NodeLink(this, portA, nodeA, portB, nodeB);
-        this._links.push(link);
-
     }
 
     removeLink(link: NodeLink) {

+ 0 - 155
guiEditor/src/diagram/graphFrame.ts

@@ -134,61 +134,6 @@ export class GraphFrame {
         }
     }
 
-    private _createFramePorts() {
-
-        for (var node of this._nodes) {
-            node.isVisible = false;
-        }
-
-        for (var i = 0; i < this._exposedOutPorts.length; ) { // Output
-            var port = this._exposedOutPorts[i];
-            if(port.node === null || port.node.enclosingFrameId != this.id) {
-                if(this.removePortFromExposedWithNode(port, this._exposedOutPorts))
-                    continue;
-            }
-            else {
-                if(!this.createOutputPorts(port, port.node) && this.removePortFromExposedWithNode(port, this._exposedOutPorts)) {
-                    continue;
-                }
-            }
-            ++i;
-        }
-
-        for (var i = 0; i < this._exposedInPorts.length; ) { // Input
-            var port = this._exposedInPorts[i];
-            if(port.node === null || port.node.enclosingFrameId != this.id) {
-                if(this.removePortFromExposedWithNode(port, this._exposedInPorts)) {
-                    continue;
-                }
-            }
-            else {
-                if(!this.createInputPorts(port, port.node) && this.removePortFromExposedWithNode(port, this._exposedInPorts)) {
-                    continue;
-                }
-            }
-            ++i;
-        }
-
-        for (var node of this._nodes) {
-            for (let port of node.outputPorts) { // Output
-                port.exposedPortPosition = this._exposedOutPorts.findIndex(nodePort => nodePort === port);
-                if(port.exposedPortPosition < 0) {
-                    if(this.createOutputPorts(port,node)) {
-                        port.node.enclosingFrameId = this.id;
-                        this._exposedOutPorts.push(port);
-                        port.exposedPortPosition = this._exposedOutPorts.length - 1;
-                    }
-                }
-            }
-            for (var port of node.inputPorts) { // Input
-                port.exposedPortPosition = this._exposedInPorts.findIndex(nodePort => nodePort === port);
-                if(port.exposedPortPosition < 0){
-                    this.createInputPorts(port, node);
-                }
-            }
-        }
-    }
-
     private removePortFromExposedWithNode(port: NodePort,exposedPorts: NodePort[])
     {
         let index = exposedPorts.findIndex(nodePort => nodePort === port);
@@ -220,83 +165,6 @@ export class GraphFrame {
         return false;
     }
     
-    private createInputPorts(port: NodePort, node: GraphNode){
-        if (port.connectionPoint.isConnected) {
-            let portAdded = false;
-            for (var link of node.links) {
-                if (link.portB === port && this.nodes.indexOf(link.nodeA) === -1) {
-                    this._createInputPort(port, node);
-                    link.isVisible = true;
-                    portAdded = true;
-                    const onLinkDisposedObserver = link.onDisposedObservable.add((nodeLink: NodeLink) => {
-                        if(this.removePortFromExposedWithLink(nodeLink, this._exposedInPorts)) {
-                            this.redrawFramePorts();
-                        }
-                    });
-                    this._onNodeLinkDisposedObservers.push(onLinkDisposedObserver);
-                }
-            }
-            if(portAdded) return true;
-        } 
-        else if(port.exposedOnFrame) {
-            this._createInputPort(port, node);
-            return true;
-        }
-        return false;
-    }
-
-    private createOutputPorts(port: NodePort, node: GraphNode){
-        if (port.connectionPoint.hasEndpoints) {
-            let portAdded = false;
-            for (var link of node.links) {
-                if (link.portA === port && this.nodes.indexOf(link.nodeB!) === -1) {
-                    let localPort: FrameNodePort;
-
-                    if (!portAdded) {
-                        portAdded = true;
-                        localPort = FrameNodePort.CreateFrameNodePortElement(port.connectionPoint, link.nodeA!, this._outputPortContainer, null, this._ownerCanvas.globalState, false, GraphFrame._FramePortCounter++, this.id);
-                        this._frameOutPorts.push(localPort);
-
-                        link.isVisible = true;
-
-                        const onLinkDisposedObserver = link.onDisposedObservable.add((nodeLink: NodeLink) => {
-                            if(this.removePortFromExposedWithLink(nodeLink, this._exposedOutPorts)) {
-                                this.redrawFramePorts();
-                            }
-                        });
-
-                        this._onNodeLinkDisposedObservers.push(onLinkDisposedObserver); 
-
-                    } else if (this.nodes.indexOf(link.nodeB!) === -1) {
-                        link.isVisible = true;
-                        localPort = this.ports.filter(p => p.connectionPoint === port.connectionPoint)[0];
-                    } else {
-                        localPort = this.ports.filter(p => p.connectionPoint === port.connectionPoint)[0];
-                    }
-                    port.delegatedPort = localPort;
-                    this._controlledPorts.push(port);
-                }
-                else if(port.exposedPortPosition >= 0 && !portAdded)
-                {
-                    let localPort = FrameNodePort.CreateFrameNodePortElement(port.connectionPoint, node, this._outputPortContainer, null, this._ownerCanvas.globalState, false, GraphFrame._FramePortCounter++, this.id);
-                    this._frameOutPorts.push(localPort);
-                    port.delegatedPort = localPort;
-                    this._controlledPorts.push(port);
-                    portAdded = true;
-                }
-            }
-            if(portAdded)  return true;
-        } 
-        else if(port.exposedOnFrame) {
-            let localPort = FrameNodePort.CreateFrameNodePortElement(port.connectionPoint, node, this._outputPortContainer, null, this._ownerCanvas.globalState, false, GraphFrame._FramePortCounter++, this.id);
-            this._frameOutPorts.push(localPort);
-            port.delegatedPort = localPort;
-            this._controlledPorts.push(port);
-            return true;
-        }
-
-        return false;
-    }
 
     public redrawFramePorts() {
         if(!this.isCollapsed) {
@@ -318,9 +186,7 @@ export class GraphFrame {
         this._frameOutPorts = [];
         this._controlledPorts = [];
 
-        this._createFramePorts();
         this._markFramePortPositions();
-        this.ports.forEach((framePort: FrameNodePort) => framePort.node._refreshLinks());
     }
 
     public set isCollapsed(value: boolean) {
@@ -337,8 +203,6 @@ export class GraphFrame {
 
             this._moveFrame((this.width - this.CollapsedWidth) / 2, 0);
 
-            this._createFramePorts()
-
             this._markFramePortPositions()
 
         } else {
@@ -799,7 +663,6 @@ export class GraphFrame {
             [this._exposedOutPorts[indexInContainer -1], this._exposedOutPorts[indexInContainer]] = [this._exposedOutPorts[indexInContainer], this._exposedOutPorts[indexInContainer -1]]; // swap idicies
             this._movePortUp(elementsArray, nodePort, this._frameOutPorts);
         }
-        this.ports.forEach((framePort: FrameNodePort) => framePort.node._refreshLinks());
     }
 
     private _movePortUp(elementsArray: ChildNode[], nodePort: FrameNodePort, framePortList: FrameNodePort[]) {
@@ -855,7 +718,6 @@ export class GraphFrame {
             this._movePortDown(elementsArray, nodePort, this._frameOutPorts);
         }
 
-        this.ports.forEach((framePort: FrameNodePort) => framePort.node._refreshLinks());
     }
 
     private _movePortDown(elementsArray: ChildNode[], nodePort: FrameNodePort, framePortList: FrameNodePort[]) {
@@ -1461,23 +1323,6 @@ export class GraphFrame {
             newFrame.refresh();
         }
         
-        for (var node of newFrame.nodes) {
-            for (var port of node.outputPorts) { // Output
-                if(port.exposedOnFrame) {
-                    if(port.exposedPortPosition !== -1) {
-                        newFrame._exposedOutPorts[port.exposedPortPosition] = port;
-                    }
-                }
-            }
-
-            for (var port of node.inputPorts) { // Inports
-                if(port.exposedOnFrame) {
-                    if(port.exposedPortPosition !== -1) {
-                         newFrame._exposedInPorts[port.exposedPortPosition] = port;
-                    }
-                }
-            }
-        }
 
         newFrame.isCollapsed = isCollapsed;
         if (isCollapsed) {

+ 0 - 66
guiEditor/src/diagram/graphNode.ts

@@ -22,8 +22,6 @@ export class GraphNode {
     private _outputsContainer: HTMLDivElement;
     private _content: HTMLDivElement;    
     private _comments: HTMLDivElement;
-    private _inputPorts: NodePort[] = [];
-    private _outputPorts: NodePort[] = []; 
     private _x = 0;
     private _y = 0;
     private _gridAlignedX = 0;
@@ -52,27 +50,9 @@ export class GraphNode {
             this._visual.classList.add("hidden");
         } else {
             this._visual.classList.remove("hidden");
-            this._upateNodePortNames();
         }
     }
 
-    private _upateNodePortNames(){
-        for (var port of this._inputPorts.concat(this._outputPorts)) {
-            if(port.hasLabel()){
-                port.portName = port.connectionPoint.displayName || port.connectionPoint.name;
-            }
-        }
-    }
-
-    public get outputPorts() {
-        return this._outputPorts;
-    }
-
-    public get inputPorts() {
-        return this._inputPorts;
-    }
-
-
     public get gridAlignedX() {
         return this._gridAlignedX;
     }
@@ -230,27 +210,6 @@ export class GraphNode {
         }
         return isOverlappingFrame;
     }
-
-    public getPortForConnectionPoint(point: NodeMaterialConnectionPoint) {
-        for (var port of this._inputPorts) {
-            let attachedPoint = port.connectionPoint;
-
-            if (attachedPoint === point) {
-                return port;
-            }
-        }
-
-        for (var port of this._outputPorts) {
-            let attachedPoint = port.connectionPoint;
-
-            if (attachedPoint === point) {
-                return port;
-            }
-        }
-
-        return null;
-    }
-
     
     private _refreshFrames() {       
         if (this._ownerCanvas._frameIsMoving || this._ownerCanvas._isLoading) {
@@ -277,14 +236,6 @@ export class GraphNode {
             this._header.innerHTML = this.block.name;
         }
 
-        for (var port of this._inputPorts) {
-            port.refresh();
-        }
-
-        for (var port of this._outputPorts) {
-            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) {
@@ -438,15 +389,6 @@ export class GraphNode {
             
         this._visual.appendChild(this._comments);    
 
-        // Connections
-        for (var input of this.block.inputs) {
-            this._inputPorts.push(NodePort.CreatePortElement(input,  this, this._inputsContainer, this._displayManager, this._globalState));
-        }
-
-        for (var output of this.block.outputs) {
-            this._outputPorts.push(NodePort.CreatePortElement(output,  this, this._outputsContainer, this._displayManager, this._globalState));
-        }
-
         this.refresh();
     }
 
@@ -474,14 +416,6 @@ export class GraphNode {
             this._globalState.onFrameCreatedObservable.remove(this._onFrameCreatedObserver);
         }
 
-        for (var port of this._inputPorts) {
-            port.dispose();
-        }
-
-        for (var port of this._outputPorts) {
-            port.dispose();
-        }
-
         this.block.dispose();
     }
 }