浏览代码

restore selection tool after deleting selection

Johann ELSASS 3 年之前
父节点
当前提交
25511a7434
共有 1 个文件被更改,包括 6 次插入3 次删除
  1. 6 3
      lazpaint/image/uimageaction.pas

+ 6 - 3
lazpaint/image/uimageaction.pas

@@ -1541,10 +1541,12 @@ end;
 
 
 procedure TImageActions.DeleteSelection;
 procedure TImageActions.DeleteSelection;
 var LayerAction: TLayerAction;
 var LayerAction: TLayerAction;
-  doErase: Boolean;
+  doErase, wasSelecting: Boolean;
 begin
 begin
   if image.SelectionMaskEmpty then exit;
   if image.SelectionMaskEmpty then exit;
-  if not image.CheckNoAction then exit;
+  wasSelecting := ToolManager.GetCurrentToolType in [ptSelectPen..ptSelectSpline];
+  if wasSelecting then ToolManager.ToolCloseDontReopen
+  else if not image.CheckNoAction then exit;
   LayerAction := nil;
   LayerAction := nil;
   try
   try
     doErase := Image.SelectionLayerIsEmpty;
     doErase := Image.SelectionLayerIsEmpty;
@@ -1557,7 +1559,8 @@ begin
       FInstance.ShowError('DeleteSelection',ex.Message);
       FInstance.ShowError('DeleteSelection',ex.Message);
   end;
   end;
   LayerAction.Free;
   LayerAction.Free;
-  if (CurrentTool = ptRotateSelection) or
+  if wasSelecting then ToolManager.ToolOpen
+  else if (CurrentTool = ptRotateSelection) or
      (CurrentTool = ptMoveSelection) then
      (CurrentTool = ptMoveSelection) then
     ChooseTool(ptHand);
     ChooseTool(ptHand);
 end;
 end;