Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Anchor points not within the bounds... (Read 1861 times)
SavyCat
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 38
Joined: Sep 4th, 2007
Anchor points not within the bounds...
Mar 7th, 2009 at 3:26pm
Print Post  
Hi guys, I am trying to get the diagram to accept anchor points whose positions are outside of a diagram item's bounds.

Ive told the diagram to disallow free links, but the link cant get created because i can only override functions that are activated when the mouse is over the node's bounds.

Ive got a diagram behavior which i created that allows the creation of a link when the user left clicks over one of those anchor points - but when i drag it over an input anchor that is outside its node's bounds, the link cannot be created. I dont know where to change it so that the link can actually get created when its over that point.

any suggestions?

Much appreciated
Mat
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Anchor points not within the bounds...
Reply #1 - Mar 9th, 2009 at 10:04am
Print Post  
Hi Mat,

The only way I can think of doing this is with the AllowUnconnectedLinks property set to true. Handle LinkCreating and set e.Cancel = false if there isn't any node whose Bounds contains the current end point of the link. In LinkCreated find the node whose Bounds contains the end point and set it as the link's Destination.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
SavyCat
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 38
Joined: Sep 4th, 2007
Re: Anchor points not within the bounds...
Reply #2 - Mar 10th, 2009 at 11:51am
Print Post  
Ok thanks Stoyo, just a quick question though.. is there an optimized way of getting relevant nodes / anchor points. Currently im doing something like this

Code
Select All
foreach ( DiagramNode n in Diagram.Nodes )
        foreach ( AnchorPoint ap in n.AnchorPattern.Points)
             //Do stuff if the point is within the ap rect  



Is this the best way to do it?

Thanks
Mat
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Anchor points not within the bounds...
Reply #3 - Mar 10th, 2009 at 12:38pm
Print Post  
You could optimize this by moving the loop over the anchor points into an if (n.Bounds.Contains(mousePoint)) statement.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint