Page Index Toggle Pages: [1] 2  Send TopicPrint
Hot Topic (More than 10 Replies) Node anchor points are out of place (Read 7910 times)
tadeus
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 9
Joined: Mar 17th, 2017
Node anchor points are out of place
May 12th, 2017 at 12:01pm
Print Post  
Hello!
I create programmically gateway node and links connected to that node. And have this result:

This result occurs only when I create links from code.

Thanks, Tadeus
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: Node anchor points are out of place
Reply #1 - May 12th, 2017 at 4:58pm
Print Post  
Hi,

Have you actually set nodes' AnchorPattern property? See the Anchors.js example, link creation seems correct there.

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


I Love MindFusion!

Posts: 9
Joined: Mar 17th, 2017
Re: Node anchor points are out of place
Reply #2 - May 23rd, 2017 at 8:21am
Print Post  
Yes AnchorPattern is set. Problem is only when I use destNodeLink.setDestination(gateway) method.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: Node anchor points are out of place
Reply #3 - May 23rd, 2017 at 9:07am
Print Post  
By gateway node do you mean one of custom node type, or it's a standard ShapeNode with BpmnInclusive shape set? What AnchorPattern value have you assigned to it?
  
Back to top
 
IP Logged
 
tadeus
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 9
Joined: Mar 17th, 2017
Re: Node anchor points are out of place
Reply #4 - May 23rd, 2017 at 9:23am
Print Post  
It is standart node:
...
case ShapeType.InclusiveGateway:
this.Shape = Shapes.BpmnInclusive;
this.Brush = new MindFusion.Drawing.SolidBrush(Color.White);
this.Pen = new MindFusion.Drawing.Pen(Color.Black, 1);
this.EnabledHandles = AdjustmentHandles.Move;
this.HandlesStyle = HandlesStyle.EasyMove;
break;
...
There is anchor pattern:
...
var gatewayAnchorPoints = [new AnchorPoint(50, 0),
new AnchorPoint(100, 50),
new AnchorPoint(50, 100),
new AnchorPoint(0, 50)];

...
Thanks!
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: Node anchor points are out of place
Reply #5 - May 23rd, 2017 at 1:39pm
Print Post  
That's ASP.NET code for custom node type constructor?
  
Back to top
 
IP Logged
 
tadeus
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 9
Joined: Mar 17th, 2017
Re: Node anchor points are out of place
Reply #6 - May 24th, 2017 at 5:04am
Print Post  
Yes it is ASP.NET.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: Node anchor points are out of place
Reply #7 - May 24th, 2017 at 5:31am
Print Post  
Creating them from server or client -side code?
  
Back to top
 
IP Logged
 
tadeus
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 9
Joined: Mar 17th, 2017
Re: Node anchor points are out of place
Reply #8 - May 24th, 2017 at 5:47am
Print Post  
All is created from server.

Tahnks.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: Node anchor points are out of place
Reply #9 - May 24th, 2017 at 10:00am
Print Post  
Here we've ported our AnchorPoints sample project to ASP.NET -
https://mindfusion.eu/_samples/AnchorPoints.ASP.NET.zip

Note it defines custom AnchorPattern on both server and client sides; at this time only the pattern ID is JSON-serialized along with nodes so you need the definition on both sides.

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


I Love MindFusion!

Posts: 9
Joined: Mar 17th, 2017
Re: Node anchor points are out of place
Reply #10 - Aug 23rd, 2017 at 12:47pm
Print Post  
Slavcho wrote on May 24th, 2017 at 10:00am:
Here we've ported our AnchorPoints sample project to ASP.NET -
https://mindfusion.eu/_samples/AnchorPoints.ASP.NET.zip

Note it defines custom AnchorPattern on both server and client sides; at this time only the pattern ID is JSON-serialized along with nodes so you need the definition on both sides.

Regards,
Slavcho


I create gateway and link from client side, but this code dont work correctly:

var gateway = new DLXShapeNode();
        gateway.setBounds(
            new MindFusion.Drawing.Rect(
                destNode.bounds.right() - 140,
                destNode.bounds.center().y - 20,
                40,
                40)
            );

        var gatewayAnchorPoints = [new AnchorPoint(50, 0, true, true),
                                new AnchorPoint(100, 50, true, true),
                                new AnchorPoint(50, 100, true, true),
                                new AnchorPoint(0, 50, true, true)];

        var gatewayAnchorPattern = new AnchorPattern(gatewayAnchorPoints);

        gateway.setAnchorPattern(gatewayAnchorPattern);

        gateway.setShapeType(ShapeTypes.InclusiveGateway);
        diagram.addItem(gateway);

        // get first created destination node link
        var destNodeLink = destNode.incomingLinks[1];
        destNodeLink.setDestination(gateway);

        var connectionLink = new DLXDiagramLink(diagram, gateway, destNode);

       
        diagram.addItem(connectionLink);

        destNode.incomingLinks[0].setDestination(gateway);
        ...
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: Node anchor points are out of place
Reply #11 - Aug 24th, 2017 at 8:43am
Print Post  
The constructor and addItem calls alone seem to attach to anchor points -

Code
Select All
var connectionLink = new DLXDiagramLink(diagram, gateway, destNode);
diagram.addItem(connectionLink); 



We'll investigate why setDestination does not - try removing it for time being, or if you need to change destination to a different node, call setDestinationAnchor too.

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


I Love MindFusion!

Posts: 9
Joined: Mar 17th, 2017
Re: Node anchor points are out of place
Reply #12 - Aug 24th, 2017 at 11:37am
Print Post  
Slavcho wrote on Aug 24th, 2017 at 8:43am:
The constructor and addItem calls alone seem to attach to anchor points -

Code
Select All
var connectionLink = new DLXDiagramLink(diagram, gateway, destNode);
diagram.addItem(connectionLink); 



We'll investigate why setDestination does not - try removing it for time being, or if you need to change destination to a different node, call setDestinationAnchor too.

Regards,
Slavcho


Thank you!
  
Back to top
 
IP Logged
 
Gravity
Junior Member
**
Offline


I Love MindFusion!

Posts: 52
Joined: Sep 21st, 2016
Re: Node anchor points are out of place
Reply #13 - Sep 7th, 2017 at 10:16am
Print Post  
I see problem here in a usage. setDestination function takes two arguments (destination, anchorpoint)
If second parameter not set it use already created parameters "details")
  
Back to top
 
IP Logged
 
Gravity
Junior Member
**
Offline


I Love MindFusion!

Posts: 52
Joined: Sep 21st, 2016
Re: Node anchor points are out of place
Reply #14 - Sep 7th, 2017 at 1:05pm
Print Post  
Gravity wrote on Sep 7th, 2017 at 10:16am:
I see problem here in a usage. setDestination function takes two arguments (destination, anchorpoint)
If second parameter not set it use already created parameters "details")



My question would be why setDestination function does not attach to anchor point?


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

    gateway.setAnchorPattern(gatewayAnchorPoints);

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?
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint