Added shape move support when creating (hold ctrl when dragging region)

This commit is contained in:
Jaex 2016-06-11 12:48:58 +03:00
parent ad21a0bad2
commit 70d959da89

View file

@ -168,6 +168,7 @@ public bool IsResizing
} }
public bool IsProportionalResizing { get; private set; } public bool IsProportionalResizing { get; private set; }
public bool IsCornerMoving { get; private set; }
public bool IsSnapResizing { get; private set; } public bool IsSnapResizing { get; private set; }
public List<SimpleWindowInfo> Windows { get; set; } public List<SimpleWindowInfo> Windows { get; set; }
@ -890,6 +891,9 @@ private void form_KeyDown(object sender, KeyEventArgs e)
case Keys.ShiftKey: case Keys.ShiftKey:
IsProportionalResizing = true; IsProportionalResizing = true;
break; break;
case Keys.ControlKey:
IsCornerMoving = true;
break;
case Keys.Menu: case Keys.Menu:
IsSnapResizing = true; IsSnapResizing = true;
break; break;
@ -940,6 +944,9 @@ private void form_KeyUp(object sender, KeyEventArgs e)
case Keys.ShiftKey: case Keys.ShiftKey:
IsProportionalResizing = false; IsProportionalResizing = false;
break; break;
case Keys.ControlKey:
IsCornerMoving = false;
break;
case Keys.Menu: case Keys.Menu:
IsSnapResizing = false; IsSnapResizing = false;
break; break;
@ -981,8 +988,12 @@ public void Update()
newPosition = CaptureHelpers.SnapPositionToDegree(PositionOnClick, CurrentPosition, 45, 0); newPosition = CaptureHelpers.SnapPositionToDegree(PositionOnClick, CurrentPosition, 45, 0);
} }
} }
else if (IsCornerMoving)
if (IsSnapResizing) {
PositionOnClick = PositionOnClick.Add(InputManager.MouseVelocity.X, InputManager.MouseVelocity.Y);
shape.StartPosition = PositionOnClick;
}
else if (IsSnapResizing)
{ {
newPosition = SnapPosition(PositionOnClick, newPosition); newPosition = SnapPosition(PositionOnClick, newPosition);
} }