Page Index Toggle Pages: 1 [2]  Send TopicPrint
Hot Topic (More than 10 Replies) Action required on Anchor point. (Read 10289 times)
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Action required on Anchor point.
Reply #15 - Sep 23rd, 2009 at 1:16pm
Print Post  
Do you need to allow creating links only when the user starts drawing over an anchor point? I think we did that some time ago using a custom Behavior class.
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Action required on Anchor point.
Reply #16 - Sep 23rd, 2009 at 1:19pm
Print Post  
Yes right, we did this some time before, it is working well in the condition when node is not selected but if the node is selected anchor point comes on mouse move but we are not able to create link in this condition.

We want to draw link from the anchor point even if the node is selected.

Regards,
Anshul
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Action required on Anchor point.
Reply #17 - Sep 24th, 2009 at 7:55am
Print Post  
The base implementation always starts moving or resizing the node if a handle of a selected node is hit. You might move the code that hit-tests for anchor points to a separate method, call it from your diagram_HitTestAdjustmentHandles handler, and if it returns a point, set HitResult to -1. This seems to work fine in the "Anchor point Action" project you sent us some time ago.

Code
Select All
internal static AnchorPoint GetAnchorAt(DiagramNode node, Point point)
{
	foreach (AnchorPoint ap in node.AnchorPattern.Points)
	{
		Rect r = node.Bounds;
		Point p = new Point(
			r.Width * ap.X / 100 + r.X,
			r.Height * ap.Y / 100 + r.Y);

		if (MindFusion.Utilities.Distance(p, point) < 10)
			return ap;
	}

	return null;
}

// in the HitTestAdjustmentHandles handler
if (n.AnchorPattern != null && DrawLinkAtAnchorBehavior.GetAnchorAt(n, e.MousePosition) != null)
{
	e.HitResult = -1;
	return;
}
 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Action required on Anchor point.
Reply #18 - Sep 24th, 2009 at 11:36am
Print Post  
Thanks Stoyan, its working now Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 [2] 
Send TopicPrint