mirror of
https://github.com/ShareX/ShareX.git
synced 2024-07-07 07:26:05 +12:00
Using expression bodies in few properties
This commit is contained in:
parent
ecbd01a923
commit
2537316a33
|
@ -38,13 +38,7 @@ public abstract class BaseShape
|
|||
|
||||
public Rectangle Rectangle { get; set; }
|
||||
|
||||
protected AnnotationOptions AnnotationOptions
|
||||
{
|
||||
get
|
||||
{
|
||||
return Manager.Config.AnnotationOptions;
|
||||
}
|
||||
}
|
||||
protected AnnotationOptions AnnotationOptions => Manager.Config.AnnotationOptions;
|
||||
|
||||
private Point startPosition;
|
||||
|
||||
|
@ -78,13 +72,7 @@ public Point EndPosition
|
|||
}
|
||||
}
|
||||
|
||||
public virtual bool IsValidShape
|
||||
{
|
||||
get
|
||||
{
|
||||
return !Rectangle.IsEmpty && Rectangle.Width >= MinimumSize && Rectangle.Height >= MinimumSize;
|
||||
}
|
||||
}
|
||||
public virtual bool IsValidShape => !Rectangle.IsEmpty && Rectangle.Width >= MinimumSize && Rectangle.Height >= MinimumSize;
|
||||
|
||||
public virtual bool IsRegionShape { get; } = false;
|
||||
|
||||
|
|
|
@ -104,55 +104,19 @@ public Rectangle CurrentRectangle
|
|||
}
|
||||
}
|
||||
|
||||
public bool IsCurrentShapeValid
|
||||
{
|
||||
get
|
||||
{
|
||||
return CurrentShape != null && CurrentShape.IsValidShape;
|
||||
}
|
||||
}
|
||||
public bool IsCurrentShapeValid => CurrentShape != null && CurrentShape.IsValidShape;
|
||||
|
||||
public BaseShape[] Regions
|
||||
{
|
||||
get
|
||||
{
|
||||
return Shapes.OfType<BaseRegionShape>().ToArray();
|
||||
}
|
||||
}
|
||||
public BaseShape[] Regions => Shapes.OfType<BaseRegionShape>().ToArray();
|
||||
|
||||
public BaseDrawingShape[] DrawingShapes
|
||||
{
|
||||
get
|
||||
{
|
||||
return Shapes.OfType<BaseDrawingShape>().ToArray();
|
||||
}
|
||||
}
|
||||
public BaseShape[] ValidRegions => Regions.Where(x => x.IsValidShape).ToArray();
|
||||
|
||||
public BaseEffectShape[] EffectShapes
|
||||
{
|
||||
get
|
||||
{
|
||||
return Shapes.OfType<BaseEffectShape>().ToArray();
|
||||
}
|
||||
}
|
||||
public BaseDrawingShape[] DrawingShapes => Shapes.OfType<BaseDrawingShape>().ToArray();
|
||||
|
||||
public BaseShape[] ValidRegions
|
||||
{
|
||||
get
|
||||
{
|
||||
return Regions.Where(x => x.IsValidShape).ToArray();
|
||||
}
|
||||
}
|
||||
public BaseEffectShape[] EffectShapes => Shapes.OfType<BaseEffectShape>().ToArray();
|
||||
|
||||
public BaseShape CurrentHoverShape { get; private set; }
|
||||
|
||||
public bool IsCurrentHoverShapeValid
|
||||
{
|
||||
get
|
||||
{
|
||||
return CurrentHoverShape != null && CurrentHoverShape.IsValidShape;
|
||||
}
|
||||
}
|
||||
public bool IsCurrentHoverShapeValid => CurrentHoverShape != null && CurrentHoverShape.IsValidShape;
|
||||
|
||||
public bool IsCurrentShapeTypeRegion
|
||||
{
|
||||
|
@ -185,13 +149,7 @@ public bool IsCurrentShapeTypeRegion
|
|||
|
||||
public RegionCaptureOptions Config { get; private set; }
|
||||
|
||||
public AnnotationOptions AnnotationOptions
|
||||
{
|
||||
get
|
||||
{
|
||||
return Config.AnnotationOptions;
|
||||
}
|
||||
}
|
||||
public AnnotationOptions AnnotationOptions => Config.AnnotationOptions;
|
||||
|
||||
public NodeObject[] Nodes { get; private set; }
|
||||
|
||||
|
@ -227,13 +185,7 @@ public bool NodesVisible
|
|||
}
|
||||
}
|
||||
|
||||
public bool IsCursorOnNode
|
||||
{
|
||||
get
|
||||
{
|
||||
return NodesVisible && Nodes.Any(node => node.IsCursorHover);
|
||||
}
|
||||
}
|
||||
public bool IsCursorOnNode => NodesVisible && Nodes.Any(node => node.IsCursorHover);
|
||||
|
||||
public event Action<BaseShape> CurrentShapeChanged;
|
||||
public event Action<ShapeType> CurrentShapeTypeChanged;
|
||||
|
|
Loading…
Reference in a new issue