Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to prevent change of links control points? (Read 2596 times)
vishalb
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 11
Joined: May 14th, 2020
How to prevent change of links control points?
May 14th, 2020 at 7:20am
Print Post  
Hello,

I am using TableNodes with no automatic layouts or any default layout.

I need to prevent changes in link control points.

E.g.

I have 2 table nodes A and B. We have incoming link to A from B. After changing the width of B table node, control points for incoming link are getting changed automatically.

E.g.

Before change in width of B lets say
A.getIncomingLinks()[0].bounds.x is 10
After changes in width of B it changes to 40.

And i want to prevent these changes.
Can you please suggest on the same?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: How to prevent change of links control points?
Reply #1 - May 14th, 2020 at 7:44am
Print Post  
Hi,

Do you mean you don't want links to stay connected to table's borders but their end points should stay fixed at same diagram location? You could create unconnected links by passing MindFusion.Drawing.Point objects to Factory.createDiagramLink method, instead of specifying nodes. Also make sure automatic routing is disabled, otherwise intermediate points might still change locations.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
vishalb
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 11
Joined: May 14th, 2020
Re: How to prevent change of links control points?
Reply #2 - May 14th, 2020 at 8:20am
Print Post  
No, it should be connected always, but the link's anchor point should be always same.
Attaching the scenario example image.
  

PointChange.png ( 9 KB | 119 Downloads )
PointChange.png
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: How to prevent change of links control points?
Reply #3 - May 14th, 2020 at 10:57am
Print Post  
It should work as you expect if you disable link's Dynamic property. Alternatively set node's AnchorPattern, and then Dynamic would only switch between the pattern's points.
  
Back to top
 
IP Logged
 
vishalb
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 11
Joined: May 14th, 2020
Re: How to prevent change of links control points?
Reply #4 - May 15th, 2020 at 7:08am
Print Post  
Thank you for your suggestion, its working by setting node's anchor pattern, only when i have node and need to start all incoming links at one point same case with outgoing links.

In my case setting node's anchor pattern is not working properly as i have more then one incoming link and outgoing link.
And for every link there is a different connection point to the node.
Please find attached image.
  

PointChange1.png ( 4 KB | 112 Downloads )
PointChange1.png
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: How to prevent change of links control points?
Reply #5 - May 15th, 2020 at 8:00am
Print Post  
Then do not use AnchorPattern, but disable link.Dynamic property. Once link is created, end points distribution should look similar to your image, and their relative position on node side will be remembered and applied when nodes resize. E.g. A's out links will store something like 1/4 and 3/4 for start points relative to side's length, and end points will store ~1/2 of D and E sides. Resizing A will not change end points being on D/E's sides' centers, and resizing D/E will not change start points being at 1/4 and 3/4. Only if you keep Dynamic enabled, end points will move to keep links pointing to their nodes' centers, which changes positions along node borders.
  
Back to top
 
IP Logged
 
vishalb
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 11
Joined: May 14th, 2020
Re: How to prevent change of links control points?
Reply #6 - May 20th, 2020 at 10:42am
Print Post  
Can you please provide me an example how we can proceed with your suggestion with respect to above post node image?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: How to prevent change of links control points?
Reply #7 - May 20th, 2020 at 3:00pm
Print Post  
Code
Select All
var node1 = diagram.getFactory().createShapeNode(50, 10, 40, 20);
var node2 = diagram.getFactory().createShapeNode(55, 50, 30, 20);
var link = diagram.getFactory().createDiagramLink(node1, node2);
link.setDynamic(false);
//link.setDynamic(true); 



This corresponds to your first image. Resizing B will keep link's point on A fixed, while point on B moves to keep relative position. If you uncomment the true assignment, the A end will move too as you described.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint