Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic blocks folding nodes. (Read 2674 times)
gamjaradio
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 42
Joined: Jul 16th, 2010
blocks folding nodes.
Feb 24th, 2011 at 1:54am
Print Post  
I'm using a IconNode.

and One thing I want is , whenever drawing the Node , it have not to be folded.

Is there method solving it?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: blocks folding nodes.
Reply #1 - Feb 24th, 2011 at 11:57am
Print Post  
What do you mean by folded IconNode?
  
Back to top
 
IP Logged
 
gamjaradio
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 42
Joined: Jul 16th, 2010
Re: blocks folding nodes.
Reply #2 - Feb 24th, 2011 at 1:12pm
Print Post  
it means ,

I draw a Node at the Point of x=10 , y=10.

Then event if I draw another at x=10 , y=10 ,
that thing has to be relocated x=20 , y=10 automatically cause of blocking folding each other
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: blocks folding nodes.
Reply #3 - Feb 24th, 2011 at 2:54pm
Print Post  
Call this from the NodeCreated handler:

Code
Select All
Rectangle2D rect1 = e.getNode().getBounds();
ArrayList<DiagramNode> nodesAtSameX = new ArrayList<DiagramNode>();
for (DiagramNode node : diagram.getNodes())
{
	if (node == e.getNode())
		continue;
	Rectangle2D.Float rect2 = node.getBounds();
	if (rect2.getMinX() > rect1.getMaxX() ||
		rect1.getMinX() > rect2.getMaxX())
		continue;
	nodesAtSameX.add(node);
}
boolean intersects = false;
do
{
	intersects = false;
	for (DiagramNode node : nodesAtSameX)
	{
		if (DiagramNode.nodesIntersect(node, e.getNode()))
		{
			e.getNode().moveTo(
				e.getNode().getBounds().x,
				(float)node.getBounds().getMaxY() + 5);
			intersects = true;
			break;
		}
	}
}
while (intersects); 



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