Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Dynamic Link Anchor Points (Read 2870 times)
Natasha
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 2
Joined: Jan 26th, 2016
Dynamic Link Anchor Points
Jan 26th, 2016 at 10:16am
Print Post  
I want anchor points for links to always be calculated automatically.

With the 'Dynamic' property enabled, the behavior when creating new links is perfect.  Moving nodes around also updates the anchor points of links dynamically.  My problem is when moving existing links (e.g. drag the end point of a link to a different destination node) - the link anchors to where you dropped it.  Is there a way to force the link to recalculate it's start and end control points using the same algorithm it uses when creating new links between nodes?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: Dynamic Link Anchor Points
Reply #1 - Jan 26th, 2016 at 11:05am
Print Post  
You can force it from LinkModified event handler like this -

Code
Select All
private void diagram_LinkModified(object sender, LinkEventArgs e)
{
	var link = e.Link;
	if (e.AdjustmentHandle == 0 ||
		e.AdjustmentHandle == link.ControlPoints.Count - 1)
	{
		link.StartPoint = link.Origin.GetCenter();
		link.EndPoint = link.Destination.GetCenter();
		link.UpdateIntersections();
	}
} 



Another option is to enable link.AutoSnapToNode to still allow users some control over position of end points while aligning them to node borders.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Natasha
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 2
Joined: Jan 26th, 2016
Re: Dynamic Link Anchor Points
Reply #2 - Jan 26th, 2016 at 11:26am
Print Post  
Thanks so much Smiley  This is exactly what I was looking for Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint