mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
Holding Ctrl will ignore shape intersection that way user can draw rectangle inside rectangle without select it
This commit is contained in:
parent
c0ef96641e
commit
e2ebf2afc3
3 changed files with 29 additions and 9 deletions
|
@ -35,7 +35,7 @@ public override void OnCreating()
|
|||
Point pos = InputManager.ClientMousePosition;
|
||||
Rectangle = new Rectangle(pos.X, pos.Y, 1, 1);
|
||||
|
||||
if (Manager.IsCornerMoving && LoadImageFile(AnnotationOptions.LastImageFilePath, true))
|
||||
if (Manager.IsCtrlModifier && LoadImageFile(AnnotationOptions.LastImageFilePath, true))
|
||||
{
|
||||
OnCreated();
|
||||
Manager.IsMoving = true;
|
||||
|
|
|
@ -51,7 +51,7 @@ public override void OnCreating()
|
|||
Point pos = InputManager.ClientMousePosition;
|
||||
Rectangle = new Rectangle(pos.X, pos.Y, 1, 1);
|
||||
|
||||
if (Manager.IsCornerMoving && LoadSticker(AnnotationOptions.LastStickerPath, AnnotationOptions.StickerSize))
|
||||
if (Manager.IsCtrlModifier && LoadSticker(AnnotationOptions.LastStickerPath, AnnotationOptions.StickerSize))
|
||||
{
|
||||
OnCreated();
|
||||
Manager.IsMoving = true;
|
||||
|
|
|
@ -158,6 +158,7 @@ private set
|
|||
public bool IsPanning { get; set; }
|
||||
public bool IsResizing { get; set; }
|
||||
// Is holding Ctrl?
|
||||
public bool IsCtrlModifier { get; private set; }
|
||||
public bool IsCornerMoving { get; private set; }
|
||||
// Is holding Shift?
|
||||
public bool IsProportionalResizing { get; private set; }
|
||||
|
@ -282,7 +283,7 @@ private void form_Shown(object sender, EventArgs e)
|
|||
|
||||
private void form_LostFocus(object sender, EventArgs e)
|
||||
{
|
||||
IsCornerMoving = IsProportionalResizing = IsSnapResizing = false;
|
||||
ResetModifiers();
|
||||
}
|
||||
|
||||
private void form_MouseDown(object sender, MouseEventArgs e)
|
||||
|
@ -410,7 +411,17 @@ private void form_KeyDown(object sender, KeyEventArgs e)
|
|||
switch (e.KeyCode)
|
||||
{
|
||||
case Keys.ControlKey:
|
||||
if (!IsCtrlModifier && !IsCornerMoving)
|
||||
{
|
||||
if (IsCreating || IsResizing)
|
||||
{
|
||||
IsCornerMoving = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
IsCtrlModifier = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Keys.ShiftKey:
|
||||
IsProportionalResizing = true;
|
||||
|
@ -638,6 +649,7 @@ private void form_KeyUp(object sender, KeyEventArgs e)
|
|||
switch (e.KeyCode)
|
||||
{
|
||||
case Keys.ControlKey:
|
||||
IsCtrlModifier = false;
|
||||
IsCornerMoving = false;
|
||||
break;
|
||||
case Keys.ShiftKey:
|
||||
|
@ -1262,6 +1274,11 @@ private void DeleteAllShapes()
|
|||
DeselectCurrentShape();
|
||||
}
|
||||
|
||||
private void ResetModifiers()
|
||||
{
|
||||
IsCtrlModifier = IsCornerMoving = IsProportionalResizing = IsSnapResizing = false;
|
||||
}
|
||||
|
||||
private void ClearTools()
|
||||
{
|
||||
foreach (BaseTool tool in ToolShapes)
|
||||
|
@ -1277,6 +1294,8 @@ public BaseShape GetIntersectShape()
|
|||
}
|
||||
|
||||
public BaseShape GetIntersectShape(Point position)
|
||||
{
|
||||
if (!IsCtrlModifier)
|
||||
{
|
||||
for (int i = Shapes.Count - 1; i >= 0; i--)
|
||||
{
|
||||
|
@ -1287,6 +1306,7 @@ public BaseShape GetIntersectShape(Point position)
|
|||
return shape;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue