- Welcome, Guest. Please Login or Register
MindFusion  
  Version 2 of our Xamarin Calendar component adds Resource view and support for Universal Windows Platform. Now beta testing spreadsheet component for Java Swing. We have released our Java Swing Pack.  
  HomeHelpSearchLoginRegister   
     
     
   
 
Page Index Toggle Pages: 1 Send Topic Print  
setDestination function do not attach to anchor point
Read 49 times

Gravity   Offline
Junior Member
**
Posts: 52
I Love MindFusion!


   
     
 
setDestination function do not attach to anchor point
Sep 8th, 2017 at 7:59am
 
My question would be why setDestination function does not attach to anchor point?


Code (Javascript):
   var gatewayAnchorPoints = [new AnchorPoint(50, 0),
        new AnchorPoint(100, 50),
        new AnchorPoint(50, 100),
        new AnchorPoint(0, 50)];

    gateway.setAnchorPattern(gatewayAnchorPoints);

diagram.addItem(gateway);

destinationNode.incomingLinks[1].setDestination(gateway, gateway.getAnchorFromIndex(1));


diagram.routeAllLinks();

 



This kindof place link at correct anchor point, but does not attach to it. Maybe you would know why?

In documentaiton i can find "ReassignAnchorPoints" method, but can't find it in source...is this something that ought to be?

If links are reacreated it works just fine. Is there a method, to reatach link to node anchor point?
 
 
 
IP Logged    
 
     

Slavcho   Offline
God Member
*****
Posts: 1141
Gender: male
tech.support


   
     
 
Re: setDestination function do not attach to anchor point
Reply #1 - Sep 8th, 2017 at 9:08am
 
That second argument seems to be for internal use (you have the code I guess). If you are using it, you'll need to also call link.destinationConnection.addLinkToNode();

Otherwise if you need to set explicit anchor point, try this -

link.setDestination(gateway);
link.setDestinationAnchor(1);

Regards,
Slavcho
 
 
 
IP Logged    
 
     

Gravity   Offline
Junior Member
**
Posts: 52
I Love MindFusion!


   
     
 
Re: setDestination function do not attach to anchor point
Reply #2 - Sep 8th, 2017 at 10:08am
 
Slavcho wrote on Sep 8th, 2017 at 9:08am:
That second argument seems to be for internal use (you have the code I guess). If you are using it, you'll need to also call link.destinationConnection.addLinkToNode();

Otherwise if you need to set explicit anchor point, try this -

link.setDestination(gateway);
link.setDestinationAnchor(1);

Regards,
Slavcho


Yeah you are right, but it seems here is some math problem....i got the desired behaviour modifying source...but can't find yet why it does attach near anchor point, but not on anchoir.


fix was, adding that method you mentioned, calling Shapes updateFromEndPoint, and invalidate();

but if they are attached to the same anchor point, they appear attached near that point (~5px apart)

 
 
 
IP Logged    
 
     

Slavcho   Offline
God Member
*****
Posts: 1141
Gender: male
tech.support


   
     
 
Re: setDestination function do not attach to anchor point
Reply #3 - Sep 8th, 2017 at 11:14am
 
routeAllLinks pulls apart link segments when they would overlap, maybe that's what adds the distance between end points. Try setting MindFusion.Diagramming.Router.prototype.pullLinksApart = function (links) {} to see if it helps.

Regards,
Slavcho
 
 
 
IP Logged    
 
     

Gravity   Offline
Junior Member
**
Posts: 52
I Love MindFusion!


   
     
 
Re: setDestination function do not attach to anchor point
Reply #4 - Sep 8th, 2017 at 12:08pm
 
Oh cool, thanks Slavcho! It works now like japanese train!
 
 
 
IP Logged    
 
     
Page Index Toggle Pages: 1 Send Topic Print