public void shiftUp(float offsetY) { this.NodeLocation = new PointF(this.NodeLocation.X, this.NodeLocation.Y - offsetY); if (this.OutConnector.EndNode == null || this is DecisionNode) { return; } if (this is HolderNode) { if (this.ParentNode is IfElseNode) { IfElseNode pNode = this.ParentNode as IfElseNode; PointF preLocation = pNode.MiddleNode.NodeLocation; pNode.balanceHolderNodes(); if (pNode.MiddleNode.NodeLocation.Y == preLocation.Y) { return; } } else if (this.ParentNode is IfNode) { IfNode pNode = (this.ParentNode as IfNode); pNode.MiddleNode.NodeLocation = new PointF(pNode.MiddleNode.connectedShape().Location.X, pNode.BackNode.NodeLocation.Y); } this.ParentNode.OutConnector.EndNode.shiftUp(offsetY); } else { this.OutConnector.EndNode.shiftUp(offsetY); } }
//used to shift nodes up offsetY is how much to shift up public void shiftUp(float offsetY) { NodeLocation = new PointF(NodeLocation.X, NodeLocation.Y - offsetY); if (OutConnector.EndNode == null || this is DecisionNode) { return; } if (this is HolderNode) //what about middleNode shift { //to decide shifting middle node or not if (this.ParentNode is IfElseNode) { IfElseNode pNode = this.ParentNode as IfElseNode; PointF preLocation = pNode.MiddleNode.NodeLocation; pNode.balanceHolderNodes(); if (pNode.MiddleNode.NodeLocation.Y == preLocation.Y) { return; //thus don't shift the node after parent node } } //shifting middle node else if (this.ParentNode is IfNode) { IfNode pNode = (this.ParentNode as IfNode); pNode.MiddleNode.NodeLocation = new PointF(pNode.MiddleNode.connectedShape().Location.X, pNode.BackNode.NodeLocation.Y); } this.ParentNode.OutConnector.EndNode.shiftUp(offsetY); } else { OutConnector.EndNode.shiftUp(offsetY); } }