OnKeyDown
(
System.Windows.Input.KeyEventArgs e
)
{
AssertValid();
if (this.IsLayingOutGraph)
{
return;
}
// Check for an arrow key. An arrow key by itself moves the selected
// vertices a small distance. An arrow key combined with a shift key
// moves them a larger distance.
const Single SmallDistance = 1;
const Single LargeDistance = 10;
Single fMoveDistance =
( Keyboard.IsKeyDown(Key.LeftShift) ||
Keyboard.IsKeyDown(Key.RightShift) ) ?
LargeDistance : SmallDistance;
Key eKey = e.Key;
switch (eKey)
{
case Key.Left:
MoveSelectedVertices(-fMoveDistance, 0);
return;
case Key.Right:
MoveSelectedVertices(fMoveDistance, 0);
return;
case Key.Up:
MoveSelectedVertices(0, -fMoveDistance);
return;
case Key.Down:
MoveSelectedVertices(0, fMoveDistance);
return;
default:
break;
}
base.OnKeyDown(e);
}