Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Diagram problem (Read 1181 times)
Waterfiets
Junior Member
**
Offline


I Love MindFusion!

Posts: 78
Joined: Sep 27th, 2013
Diagram problem
Nov 13th, 2013 at 10:21am
Print Post  
Hi there,

I've created a recursive method which I've called moveConnectedNodeToBottom. This is method is responsible for moving the connected_node of the E shape node when the if_connected_node is added and is called in the resizeHeight method (checked it with the debugger:P).

Here is the code:

Code
Select All
        public void resizeHeight(double height_to_add)
        {
            // Change the bounds of the node according to the size of the child node
            if (lastInflatedNode != this)
            {
                if (lastInflatedNode != null)
                    lastInflatedNode.Bounds = lastBounds;
            }
            double tryHeight = Try_Connected_Node != null ? Try_Connected_Node.Bounds.Height : padding;
            double catchHeight = Catch_Connected_Node != null ? Catch_Connected_Node.Bounds.Height : padding;

            var newHeight = 3 * padding + tryHeight + catchHeight;

            Rect r = this.Bounds;
            lastBounds = r;

            Rect newBounds = new Rect(r.X, r.Y, r.Width, newHeight);
            this.SetBounds(newBounds, false, true);
            lastInflatedNode = this;

            moveConnectedNodeToBottom(this);

        }

        private void moveConnectedNodeToBottom(BRNode parentOfConnected)
        {
            if (parentOfConnected.connected_node != null)
            {
                parentOfConnected.connected_node.Move(parentOfConnected.Bounds.Left, parentOfConnected.Bounds.Bottom);

                if (parentOfConnected.connected_node.connected_node == null)
                    return;
                else
                    moveConnectedNodeToBottom(parentOfConnected.connected_node);
            }
        }  



Actually the method works perfectly, the only problem i have with it, is that i have to drag all the nodes in the diagram field first before it to work. Has this possible anything to do with the dragindicator?

Thanks in advance.

Greets,

Sander
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram problem
Reply #1 - Nov 13th, 2013 at 12:30pm
Print Post  
Quote:
Actually the method works perfectly, the only problem i have with it, is that i have to drag all the nodes in the diagram field first before it to work. Has this possible anything to do with the dragindicator?


Perhaps it does, connected_node might be pointing to the removed dragIndicator, or it might be set on a dragIndicator, check this:
http://mindfusion.eu/Forum/YaBB.pl?num=1384242304/6#6

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint