mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-02 18:26:27 +13:00
Prevent cuts that would remove the entire image
And also don't show resize nodes
This commit is contained in:
parent
f9d144400e
commit
ce02e9ab07
1 changed files with 13 additions and 1 deletions
|
@ -38,12 +38,24 @@ public class CutOutTool : BaseTool
|
||||||
public bool IsHorizontalTrim => Rectangle.Width >= Options.MinimumSize && Rectangle.Width > Rectangle.Height;
|
public bool IsHorizontalTrim => Rectangle.Width >= Options.MinimumSize && Rectangle.Width > Rectangle.Height;
|
||||||
public bool IsVerticalTrim => Rectangle.Height >= Options.MinimumSize && Rectangle.Height >= Rectangle.Width;
|
public bool IsVerticalTrim => Rectangle.Height >= Options.MinimumSize && Rectangle.Height >= Rectangle.Width;
|
||||||
|
|
||||||
public override bool IsValidShape => IsHorizontalTrim || IsVerticalTrim;
|
public override bool IsValidShape {
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (!IsHorizontalTrim && !IsVerticalTrim) return false;
|
||||||
|
if (IsHorizontalTrim && Rectangle.Left <= Manager.Form.CanvasRectangle.Left && Rectangle.Right >= Manager.Form.CanvasRectangle.Right) return false;
|
||||||
|
if (IsVerticalTrim && Rectangle.Top <= Manager.Form.CanvasRectangle.Top && Rectangle.Bottom >= Manager.Form.CanvasRectangle.Bottom) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private ImageEditorButton confirmButton, cancelButton;
|
private ImageEditorButton confirmButton, cancelButton;
|
||||||
private Size buttonSize = new Size(80, 40);
|
private Size buttonSize = new Size(80, 40);
|
||||||
private int buttonOffset = 15;
|
private int buttonOffset = 15;
|
||||||
|
|
||||||
|
public override void ShowNodes()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public override void OnUpdate()
|
public override void OnUpdate()
|
||||||
{
|
{
|
||||||
base.OnUpdate();
|
base.OnUpdate();
|
||||||
|
|
Loading…
Reference in a new issue