Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic how to use the UP,Down,Left,Right Key of the keyboard to move the UnconnectedLinks? (Read 1490 times)
heyx
Junior Member
**
Offline


I Love MindFusion!

Posts: 69
Joined: Oct 9th, 2014
how to use the UP,Down,Left,Right Key of the keyboard to move the UnconnectedLinks?
Mar 24th, 2015 at 2:37am
Print Post  
how to use the UP,Down,Left,Right Key of the keyboard to move the UnconnectedLinks?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: how to use the UP,Down,Left,Right Key of the keyboard to move the UnconnectedLinks?
Reply #1 - Mar 24th, 2015 at 9:50am
Print Post  
Code
Select All
void MoveLink(DiagramLink link, double dx, double dy)
{
	var offset = new Vector(dx, dy);
	var points = link.ControlPoints;
	for (int i = 0; i < points.Count; i++)
		points[i] += offset;
	link.UpdateFromPoints();
}

diagram.CommandBindings.Add(
	new CommandBinding(Diagram.NavigateLeft, (sender, args) =>
	{
		var link = diagram.ActiveItem as DiagramLink;
		if (link != null && !link.IsConnected)
			MoveLink(link, -8, 0);
	}));

diagram.CommandBindings.Add(
	new CommandBinding(Diagram.NavigateUp, (sender, args) =>
	{
		var link = diagram.ActiveItem as DiagramLink;
		if (link != null && !link.IsConnected)
			MoveLink(link, 0, -8);
	}));

diagram.CommandBindings.Add(
	new CommandBinding(Diagram.NavigateRight, (sender, args) =>
	{
		var link = diagram.ActiveItem as DiagramLink;
		if (link != null && !link.IsConnected)
			MoveLink(link, 8, 0);
	}));

diagram.CommandBindings.Add(
	new CommandBinding(Diagram.NavigateDown, (sender, args) =>
	{
		var link = diagram.ActiveItem as DiagramLink;
		if (link != null && !link.IsConnected)
			MoveLink(link, 0, 8);
	}));
 



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