Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic AllowLinksRepeat not working (Read 1263 times)
PauliusP
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 3
Joined: Feb 10th, 2017
AllowLinksRepeat not working
Mar 3rd, 2017 at 3:26pm
Print Post  
Hello,

I need to implement functionality that links between nodes (shapenode) won't repeat in my diagram. Available only 1 link from one node to another.

I found out that there is the exact method: "AllowLinksRepeat", that would solve the problem.

But it didn't work when I tried to use it like this:

Code (HTML)
Select All
<Diagram RouteLinks="true" AllowLinksRepeat="false" GridStyle="Lines" AlignToGrid="True" ShowGrid="True" GridColor="#1B000000" GridSizeY="10" GridSizeX="10"
                                AdjustmentHandlesSize="8" LinkCrossings="Arcs" HitTestPriority="ZOrder" AllowUnconnectedLinks="false" AutoResize="None">
                            </Diagram> 



  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3154
Joined: Oct 19th, 2005
Re: AllowLinksRepeat not working
Reply #1 - Mar 3rd, 2017 at 4:55pm
Print Post  
Hi,

The AllowLinksRepeat property is not available yet in JavaScript diagram library. At this time you could prevent repeated links from linkCreating validation event -

Code
Select All
function onLinkCreating(sender, args)
{
	var link = args.getLink();
	if (!link.targetConnection)
		return;

	var origin = link.getOrigin();
	var dest = link.targetConnection.node;

	args.setCancel(
		linkExists(origin, dest));
}

function linkExists(from, to)
{
	var links = [];
	from.getAllOutgoingLinks(links);
	for (var l = 0; l < links.length; l++)
		if (links[l].getDestination() == to)
			return true;
	return false;
} 



Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint