Avoid effect flicker when moving with keyboard

This commit is contained in:
Jaex 2017-11-18 10:49:46 +03:00
parent 5d1c347644
commit 782099c5c8

View file

@ -559,13 +559,13 @@ private void form_KeyDown(object sender, KeyEventArgs e)
{
if (e.Control)
{
shape.OnMoving();
shape.Move(x, y);
shape.OnMoved();
}
else
{
shape.OnResizing();
shape.Resize(x, y, !e.Alt);
shape.OnResized();
}
}
}
@ -587,22 +587,39 @@ private void form_KeyUp(object sender, KeyEventArgs e)
case Keys.Left:
case Keys.A:
isLeftPressed = false;
ShapeMoved();
break;
case Keys.Right:
case Keys.D:
isRightPressed = false;
ShapeMoved();
break;
case Keys.Up:
case Keys.W:
isUpPressed = false;
ShapeMoved();
break;
case Keys.Down:
case Keys.S:
isDownPressed = false;
ShapeMoved();
break;
}
}
private void ShapeMoved()
{
if (!IsCreating)
{
BaseShape shape = CurrentShape;
if (shape != null)
{
shape.OnMoved();
}
}
}
private void RunAction(RegionCaptureAction action)
{
switch (action)