Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to control link appearance (Read 3854 times)
Al
Junior Member
**
Offline


I Love MindFusion!

Posts: 56
Joined: Sep 3rd, 2014
How to control link appearance
Sep 3rd, 2014 at 3:41pm
Print Post  
Hi, I have these values set for my diagram object:

Code (Javascript)
Select All
diagram.setRouteLinks(true);
diagram.setLinkShape(1);
diagram.setLinkHeadShapeSize(2);
 



'setLinkHeadShapeSize' works fine but the link settings
seem to have no effect and my links are regular polygon lines.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to control link appearance
Reply #1 - Sep 3rd, 2014 at 4:30pm
Print Post  
Hi,

These settings will have effect only on newly drawn links. If you need to change existing links, you will have to set their individual AutoRoute and Shape properties. 1 is value for the poly-line link style:

Code
Select All
/**
* Specifies available styles for the segments of links.
* @enum
* @name LinkShape
* @param [Bezier] The segments of a link are Bézier curves.
* @param [Polyline] The segments of a link are straight lines.
* @param [Cascading] The segments of a link are alternating horizontal and vertical lines, orthogonal to each other.
*/
MindFusion.Diagramming.LinkShape = {
	Bezier: 0,
	Polyline: 1,
	Cascading: 2
}; 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Al
Junior Member
**
Offline


I Love MindFusion!

Posts: 56
Joined: Sep 3rd, 2014
Re: How to control link appearance
Reply #2 - Sep 4th, 2014 at 6:38am
Print Post  
Thanks Stoyan, I setup my diagram before populating it programmatically ie. the settings exist before the links are created - do these settings maybe only apply to manually drawn links?
  
Back to top
 
IP Logged
 
Al
Junior Member
**
Offline


I Love MindFusion!

Posts: 56
Joined: Sep 3rd, 2014
Re: How to control link appearance
Reply #3 - Sep 4th, 2014 at 7:25am
Print Post  
Some more testing and I still can't get it working:
I have this set for the diagram object on initialization:
Code (Javascript)
Select All
            diagram.setLinkHeadShapeSize(2);
            diagram.setLinkShape(2);
 


Then I have this set when creating the links:
Code (Javascript)
Select All
                var newLink = diagram.getFactory().createDiagramLink(
                    nodeMap[origin],
                    nodeMap[target]);
                newLink.setShape(2);
                newLink.route(true);
 



But still I only get Poly-lines
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to control link appearance
Reply #4 - Sep 4th, 2014 at 7:54am
Print Post  
Are you calling LayeredLayout later as in the tutorial? It resets link shapes to Polyline. Or if you have some large node used as background, set its Obstacle property to false before routing links, or otherwise the route() function might fail to find a path.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Al
Junior Member
**
Offline


I Love MindFusion!

Posts: 56
Joined: Sep 3rd, 2014
Re: How to control link appearance
Reply #5 - Sep 4th, 2014 at 8:05am
Print Post  
Thanks Stoyan, I am using LayeredLayout after creating my nodes and links. So how would I then get cascading links in this case?
  
Back to top
 
IP Logged
 
Al
Junior Member
**
Offline


I Love MindFusion!

Posts: 56
Joined: Sep 3rd, 2014
Re: How to control link appearance
Reply #6 - Sep 4th, 2014 at 8:28am
Print Post  
It looks like calling

diagram.routeAllLinks();

after my layout is complete makes the links appear cascaded as I require them.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint