Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Layered layout link overlapping issue (Read 2981 times)
Kiran B
Full Member
***
Offline


I Love MindFusion!

Posts: 102
Joined: Apr 19th, 2013
Layered layout link overlapping issue
Dec 3rd, 2013 at 8:18am
Print Post  
Hi,

Is there any way the avoid link overlapping  issue when we use Layered Layout.
Crossing the links are fine. But in some cases two links gets overlapped and its not easy to recognize the links.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Layered layout link overlapping issue
Reply #1 - Dec 3rd, 2013 at 11:42am
Print Post  
Hi,

Links overlap after LayeredLayout if they connect the same pair of nodes. You could pull them apart by offsetting their control points after calling layout.arrange:

Code
Select All
var Utils = MindFusion.Diagramming.Utils;

for (var i1 = 0; i1 < diagram.links.length; i1++)
{
	var l1 = diagram.links[i1];
	for (var i2 = i1 + 1; i2 < diagram.links.length; i2++)
	{
		var l2 = diagram.links[i2];

		if (l1.getOrigin() == l2.getOrigin() &&
			l1.getDestination() == l2.getDestination())
		{
			Utils.offsetPointCollection(l1.points, l1.points, { x: -1, y: 0 });
			Utils.offsetPointCollection(l2.points, l2.points, { x: +1, y: 0 });
			l1.updateFromPoints();
			l2.updateFromPoints();
		}
	}
} 



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