Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Auto align node (Read 1649 times)
gamjaradio
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 42
Joined: Jul 16th, 2010
Auto align node
Feb 24th, 2011 at 1:51am
Print Post  
just clicking a button , the nodes that I drew have to be aligned ,sometime vertically or horizontally.

How can I do this?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Auto align node
Reply #1 - Feb 24th, 2011 at 11:54am
Print Post  
Call the nodes' move() method to set either x or y to the same value. Here's an example.

Code
Select All
float x = diagram.getActiveItem().getBounds().x;
for (DiagramNode node : diagram.getSelection().getNodes())
{
	float y = node.getBounds().y;
	node.moveTo(x, y);
}
 



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