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