Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Custom handling of DiagramLink position. (Read 2050 times)
Khaostyke
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Jan 27th, 2010
Custom handling of DiagramLink position.
Aug 27th, 2010 at 3:01pm
Print Post  
Hi,

I have a diagram in which I handle myself the position of all diagram links. Here is how I proceed (I spare you the details) :

Code
Select All
DiagramNode origin = GetNearestNonFoldedNode(transition.Origin);
DiagramNode destination = GetNearestNonFoldedNode(transition.Destination);

PointF originCenter = origin.GetCenter();
PointF destinationCenter = destination.GetCenter();

transition.ControlPoints[0] = origin.GetIntersection(originCenter, destinationCenter);
transition.ControlPoints[1] = destination.GetIntersection(originCenter, destinationCenter);

transition.UpdateFromPoints();
 



This code works in all cases except when my destination is a folded ContainerNode. When I update the link's position while moving the origin node, the position of the link is perfect, but when I release my mouse button and stop moving the node, my link is moved at the wrong place and I don't know why. I look at the ContaineNode's bounds and everything seem to be ok in my algorithm... There is someone somewhere that seem to move (after me) the link (my links aren't dynamic).

Thanks for your help.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Custom handling of DiagramLink position.
Reply #1 - Aug 27th, 2010 at 3:32pm
Print Post  
Hi,

When are you calling that code? If whatever moves the link happens before NodeModified is raised, perhaps you could handle that event and update all links connected to e.Node.

Stoyan
  
Back to top
 
IP Logged
 
Khaostyke
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Jan 27th, 2010
Re: Custom handling of DiagramLink position.
Reply #2 - Aug 27th, 2010 at 3:54pm
Print Post  
I call that code in NodeModifying and also tried to call it in NodeModified... but it's not working.

The case is that my origin is linked to another DiagramNode inside the ContainerNode. So when the ContainerNode is folded, I use the ContainerNode as the destination in order to correctly position the link (but the "real" destination of the link is still the DiagramNode).
  
Back to top
 
IP Logged
 
Khaostyke
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Jan 27th, 2010
Re: Custom handling of DiagramLink position.
Reply #3 - Aug 27th, 2010 at 9:43pm
Print Post  
I found the problem! It's a little bit tricky to explain but the important is that everything work now Wink
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint