Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic While dragging a node how can i check if that node is hiting any other node in the diagram (Read 1065 times)
PracS
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 1
Joined: May 8th, 2012
While dragging a node how can i check if that node is hiting any other node in the diagram
May 8th, 2012 at 2:36pm
Print Post  
I have following requirement that i wish to implement with Flowchart.net component.
1) Main diagram is displayed on canvas and any of the node is copied and pasted on the canvas.
2) The newly pasted node is not connected in the diagram.
3) Now user is dragging the newly pasted node and dropping it till any node in the diagram.
4) At this point the newly pasted node and the node in the diagram should get linked.
I am wondering how will I get to know which is the node in the diagram up to which the newly pasted node is dragged.
Is there any event in which I will get some information on nodes hit, nodes that coincide..
I appreciate any help on this.
Thanks.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: While dragging a node how can i check if that node is hiting any other node in the diagram
Reply #1 - May 8th, 2012 at 2:53pm
Print Post  
You could check what nodes are there behind the moved one from the NodeModified handler:

Code
Select All
private void diagram_NodeModified(object sender, NodeEventArgs e)
{
	DiagramNodeCollection nodesHere = diagram.GetNodesAt(e.MousePosition);
	if (e.AdjustmentHandle == AdjustmentHandles.Move && nodesHere.Count > 1)
	{
		DiagramNode topmost = nodesHere[0];
		if (topmost == e.Node)
			topmost = nodesHere[1];
		e.Node.Move(topmost.Bounds.Left, topmost.Bounds.Bottom + 5);
		diagram.Factory.CreateDiagramLink(topmost, e.Node);
	}
} 



If you need to create both the node and the link from DragDrop event handlers, see the TreeLayout sample project.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint