Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Link snapping (Read 1439 times)
luffy911
YaBB Newbies
*
Offline



Posts: 8
Joined: Sep 2nd, 2010
Link snapping
Sep 28th, 2010 at 6:20pm
Print Post  
Hello,
   I would like to implement a feature of snapping to anchor points when creating links.  For instance, I would like that when I get close to an anchor, the link would automatically connect to it visually and if I release the mouse button then the link is created.

Does anyone have suggestions on how to tackle this feature ?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Link snapping
Reply #1 - Sep 28th, 2010 at 6:48pm
Print Post  
Hi,

There are AutoSnapLinks and AutoSnapDistance properties in the Silverlight version of the control; we can port them to WinForms for the next release. You could implement this yourself by overriding DiagramLink.UpdateCreate and using the Diagram.GetNodeAt(point, threshold) and DiagramNode.GetClosestAnchorPoint(point) methods to find the position for the end point.

Stoyan
  
Back to top
 
IP Logged
 
luffy911
YaBB Newbies
*
Offline



Posts: 8
Joined: Sep 2nd, 2010
Re: Link snapping
Reply #2 - Sep 28th, 2010 at 10:44pm
Print Post  
Hi Stoyan,
   I try it and the link draw properly to the target node.  I manage to get everything working by also overriding the AllowCreate and The CompleteCreate function since both of these function would work with the mouse position instead of the Destination. 
I just called the base function by passing the Destination Location.


Luffy
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint