Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Avoid snaptonode to the same origin / target (Read 2840 times)
Gabriel
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 30
Joined: Oct 9th, 2012
Avoid snaptonode to the same origin / target
May 8th, 2015 at 11:24am
Print Post  
Hello,

On a flowchart, I would like to activate the snaptonode property when the user tries to create a link between two nodes, however if the snaptonode is true, and the origin node is big enough, the link tries to "snap" to the origin node and it is very awkward.
Is there any way to avoid the "snaptonode" when the link being drawed is over the same node that initiates it?

Thank you in advance
Regards
Gabriel Pulido
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Avoid snaptonode to the same origin / target
Reply #1 - May 8th, 2015 at 11:55am
Print Post  
Hi,

The origin node is ignored for the snap-from-distance feature, but not when the link end is inside it. You could work around it like that:

Code
Select All
diagram.LinkCreating += (s, e) => { e.Link.AutoSnapToNode = e.Origin != e.Destination; }; 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Gabriel
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 30
Joined: Oct 9th, 2012
Re: Avoid snaptonode to the same origin / target
Reply #2 - May 11th, 2015 at 9:06am
Print Post  
Hello,

Thank you for your quick answer.
The solution partially solved the problem, however if the user start draggin from one node and drag over a second node, then the snaptonode is changed to "true", but if he doesn't release and goes back to the original node, as the flag has been changed to "true" and the linkcreation is not launched again unless I set the AllowSelfLoops to true.

Is there any way to avoid setting the AllowSelfLoops to true to achieve the functionality desired?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Avoid snaptonode to the same origin / target
Reply #3 - May 12th, 2015 at 8:09am
Print Post  
Hi,

You could prevent self-loops from LinkCreating too:

Code
Select All
diagram.AllowSelfLoops = true;
diagram.LinkCreating += (s, e) =>
{
	e.Link.AutoSnapToNode = e.Origin != e.Destination;
	e.Cancel = e.Origin == e.Destination;
}; 



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