mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-02 18:26:27 +13:00
Store minimum size in options
This commit is contained in:
parent
5de74770e8
commit
e3a419c8b8
4 changed files with 11 additions and 12 deletions
|
@ -32,6 +32,7 @@ namespace ShareX.ScreenCaptureLib
|
||||||
{
|
{
|
||||||
public class RegionCaptureOptions
|
public class RegionCaptureOptions
|
||||||
{
|
{
|
||||||
|
public const int DefaultMinimumSize = 5;
|
||||||
public const int MagnifierPixelCountMinimum = 3;
|
public const int MagnifierPixelCountMinimum = 3;
|
||||||
public const int MagnifierPixelCountMaximum = 35;
|
public const int MagnifierPixelCountMaximum = 35;
|
||||||
public const int MagnifierPixelSizeMinimum = 3;
|
public const int MagnifierPixelSizeMinimum = 3;
|
||||||
|
@ -41,6 +42,7 @@ public class RegionCaptureOptions
|
||||||
public const int MoveSpeedMaximum = 10;
|
public const int MoveSpeedMaximum = 10;
|
||||||
|
|
||||||
public bool QuickCrop = true;
|
public bool QuickCrop = true;
|
||||||
|
public int MinimumSize = DefaultMinimumSize;
|
||||||
public RegionCaptureAction RegionCaptureActionRightClick = RegionCaptureAction.RemoveShapeCancelCapture;
|
public RegionCaptureAction RegionCaptureActionRightClick = RegionCaptureAction.RemoveShapeCancelCapture;
|
||||||
public RegionCaptureAction RegionCaptureActionMiddleClick = RegionCaptureAction.SwapToolType;
|
public RegionCaptureAction RegionCaptureActionMiddleClick = RegionCaptureAction.SwapToolType;
|
||||||
public RegionCaptureAction RegionCaptureActionX1Click = RegionCaptureAction.CaptureFullscreen;
|
public RegionCaptureAction RegionCaptureActionX1Click = RegionCaptureAction.CaptureFullscreen;
|
||||||
|
|
|
@ -33,8 +33,6 @@ namespace ShareX.ScreenCaptureLib
|
||||||
{
|
{
|
||||||
public abstract class BaseShape : IDisposable
|
public abstract class BaseShape : IDisposable
|
||||||
{
|
{
|
||||||
protected const int MinimumSize = 3;
|
|
||||||
|
|
||||||
public abstract ShapeCategory ShapeCategory { get; }
|
public abstract ShapeCategory ShapeCategory { get; }
|
||||||
|
|
||||||
public abstract ShapeType ShapeType { get; }
|
public abstract ShapeType ShapeType { get; }
|
||||||
|
@ -93,7 +91,7 @@ private set
|
||||||
|
|
||||||
public Size InitialSize { get; set; }
|
public Size InitialSize { get; set; }
|
||||||
|
|
||||||
public virtual bool IsValidShape => !Rectangle.IsEmpty && Rectangle.Width >= MinimumSize && Rectangle.Height >= MinimumSize;
|
public virtual bool IsValidShape => !Rectangle.IsEmpty && Rectangle.Width >= Options.MinimumSize && Rectangle.Height >= Options.MinimumSize;
|
||||||
|
|
||||||
public virtual bool IsSelectable => Manager.CurrentTool == ShapeType || Manager.CurrentTool == ShapeType.ToolSelect;
|
public virtual bool IsSelectable => Manager.CurrentTool == ShapeType || Manager.CurrentTool == ShapeType.ToolSelect;
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class LineDrawingShape : BaseDrawingShape
|
||||||
public bool CenterNodeActive { get; private set; }
|
public bool CenterNodeActive { get; private set; }
|
||||||
public int CenterPointCount { get; private set; }
|
public int CenterPointCount { get; private set; }
|
||||||
|
|
||||||
public override bool IsValidShape => Rectangle.Width > 1 || Rectangle.Height > 1;
|
public override bool IsValidShape => Rectangle.Width >= Options.MinimumSize || Rectangle.Height >= Options.MinimumSize;
|
||||||
|
|
||||||
protected override void UseLightResizeNodes()
|
protected override void UseLightResizeNodes()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1179,10 +1179,10 @@ private BaseShape CheckHover()
|
||||||
{
|
{
|
||||||
Point location = InputManager.ClientMousePosition;
|
Point location = InputManager.ClientMousePosition;
|
||||||
|
|
||||||
return new RectangleRegionShape()
|
BaseShape rectangleRegionShape = CreateShape(ShapeType.RegionRectangle);
|
||||||
{
|
rectangleRegionShape.Rectangle = new Rectangle(new Point(location.X - (Options.FixedSize.Width / 2),
|
||||||
Rectangle = new Rectangle(new Point(location.X - (Options.FixedSize.Width / 2), location.Y - (Options.FixedSize.Height / 2)), Options.FixedSize)
|
location.Y - (Options.FixedSize.Height / 2)), Options.FixedSize);
|
||||||
};
|
return rectangleRegionShape;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1192,10 +1192,9 @@ private BaseShape CheckHover()
|
||||||
{
|
{
|
||||||
Rectangle hoverArea = CaptureHelpers.ScreenToClient(window.Rectangle);
|
Rectangle hoverArea = CaptureHelpers.ScreenToClient(window.Rectangle);
|
||||||
|
|
||||||
return new RectangleRegionShape()
|
BaseShape rectangleRegionShape = CreateShape(ShapeType.RegionRectangle);
|
||||||
{
|
rectangleRegionShape.Rectangle = Rectangle.Intersect(Form.ClientArea, hoverArea);
|
||||||
Rectangle = Rectangle.Intersect(Form.ClientArea, hoverArea)
|
return rectangleRegionShape;
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue