Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic LayeredLayout link over node (Read 985 times)
PLM Doctor
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 5
Joined: Oct 8th, 2020
LayeredLayout link over node
Oct 9th, 2020 at 2:21am
Print Post  
The links in a LayeredLayout are cutting across the corners of nodes (see attachment of portion of horizontal layout). I found a forum thread from 2012 basically saying, no layout configuration fix; can't be changed. Is this still true or has this issue been resolved in some way since then?

  

2020-10-08_22-17-30.png ( 103 KB | 89 Downloads )
2020-10-08_22-17-30.png
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: LayeredLayout link over node
Reply #1 - Oct 9th, 2020 at 7:20am
Print Post  
You could force links to connect to center points of nodes' left/right sides using AnchorPoint objects, that should take care of cut corners for links to adjacent levels:

Code
Select All
function testLayeredLayout(diagram)
{
	var diagram = Diagram.find("diagram");

	var ioPattern = new AnchorPattern(
		[
			new AnchorPoint(0, 50, true, true, MarkStyle.None),
			new AnchorPoint(100, 50, true, true, MarkStyle.None)
		]);

	for (var node of diagram.nodes)
	{
		node.setAnchorPattern(ioPattern);
	}

	var layeredLayout = MindFusion.Graphs.LayeredLayout;
	layout = new layeredLayout();
	layout.direction = MindFusion.Graphs.LayoutDirection.LeftToRight;
	layout.anchoring = MindFusion.Graphs.Anchoring.Reassign;
	diagram.arrange(layout);

	diagram.resizeToFitItems();
} 



You might still need some adjustments for links that cross several layers, as in this post (will have to adapt it a bit for horizontal layout) -
https://mindfusion.eu/Forum/YaBB.pl?num=1600175113/8#8

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