mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
Auto crop won't automatically crop without user confirmation
This commit is contained in:
parent
4fb70e864a
commit
8eaa3b198e
2 changed files with 10 additions and 9 deletions
|
@ -1537,11 +1537,17 @@ private void ChangeCanvasSize()
|
|||
|
||||
private void AutoCropImage()
|
||||
{
|
||||
Bitmap bmp = ImageHelpers.AutoCropImage((Bitmap)Form.Canvas);
|
||||
Rectangle source = new Rectangle(0, 0, Form.Canvas.Width, Form.Canvas.Height);
|
||||
Rectangle rect = ImageHelpers.FindAutoCropRectangle((Bitmap)Form.Canvas);
|
||||
|
||||
if (bmp != null)
|
||||
if (source != rect && rect.X >= 0 && rect.Y >= 0 && rect.Width > 0 && rect.Height > 0)
|
||||
{
|
||||
UpdateCanvas(bmp);
|
||||
CurrentTool = ShapeType.ToolCrop;
|
||||
CropTool tool = (CropTool)CreateShape(ShapeType.ToolCrop);
|
||||
tool.Rectangle = rect.LocationOffset(Form.CanvasRectangle.Location);
|
||||
tool.OnCreated();
|
||||
AddShape(tool);
|
||||
SelectCurrentShape();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -82,12 +82,7 @@ public override void OnCreated()
|
|||
|
||||
private void ConfirmButton_MousePressed(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (IsValidShape)
|
||||
{
|
||||
Rectangle = RectangleInsideCanvas;
|
||||
Manager.CropArea(Rectangle);
|
||||
}
|
||||
|
||||
Manager.CropArea(RectangleInsideCanvas);
|
||||
Remove();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue