mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 09:17:36 +13:00
Improved escape key handling.
This commit is contained in:
parent
c00b7ae6b9
commit
1ba6769b76
1 changed files with 20 additions and 1 deletions
|
@ -401,12 +401,31 @@ private void form_MouseWheel(object sender, MouseEventArgs e)
|
|||
|
||||
public bool HandleEscape()
|
||||
{
|
||||
// escape key resets tool after first press, escape with select tool active, initiates close
|
||||
// the escape key handling has 3 stages:
|
||||
// 1. initiate exit if region selection is active
|
||||
// 2. if a shape is selected, unselect it
|
||||
// 3. switch to the select tool if a any other tool is active
|
||||
|
||||
switch (CurrentTool)
|
||||
{
|
||||
case ShapeType.RegionRectangle:
|
||||
case ShapeType.RegionEllipse:
|
||||
case ShapeType.RegionFreehand:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (CurrentShape != null)
|
||||
{
|
||||
ClearTools();
|
||||
DeselectCurrentShape();
|
||||
}
|
||||
|
||||
if (CurrentTool != ShapeType.ToolSelect)
|
||||
{
|
||||
CurrentTool = ShapeType.ToolSelect;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue