Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Diagram link connection to middle of shapenode border (Read 1273 times)
Sivaraj p
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 21
Joined: Mar 14th, 2013
Diagram link connection to middle of shapenode border
Mar 28th, 2013 at 6:26am
Print Post  
Hi stoyo,
When I draw two nodes, and then connect them using a link, then I want the connection to be established in such a way that the link will always connect to the middle of the destination rectangle's width. Could you please help me in implementing this? I have attached a diagram for clarity on this.

  

diagramlinkconnection.JPG (Attachment deleted)
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram link connection to middle of shapenode border
Reply #1 - Mar 28th, 2013 at 6:55am
Print Post  
Hi,

Set nodes' AnchorPattern property:
Code
Select All
public MainWindow()
{
	InitializeComponent();

	new AnchorPattern(new[]
	{
		// percents of width / height
		new AnchorPoint(50, 0),
		new AnchorPoint(100, 50),
		new AnchorPoint(50, 100),
		new AnchorPoint(0, 50)
	},
	"MiddlePoints");
}

private void diagram_InitializeNode(object sender, NodeEventArgs e)
{
	e.Node.AnchorPattern = AnchorPattern.FromId("MiddlePoints");
} 



Or alternatively align links' StartPoint and EndPoint coordinates to Origin/Destination centers from LinkCreated handlers.

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