Only allow selection and moving shapes if current shape is same as selected shape that way you can do region capture top of drawings without select drawing shape

This commit is contained in:
Jaex 2016-05-03 14:06:15 +03:00
parent a568e98617
commit 09fdffc32d
9 changed files with 17 additions and 1 deletions

View file

@ -440,7 +440,7 @@ private void RegionSelection(Point location)
PositionOnClick = InputManager.MousePosition0Based;
if (shape != null) // Select area
if (shape != null && shape.ShapeType == CurrentShapeType) // Select area
{
IsMoving = true;
CurrentShape = shape;

View file

@ -31,6 +31,8 @@ namespace ShareX.ScreenCaptureLib
{
public abstract class BaseShape
{
public abstract ShapeType ShapeType { get; }
public Rectangle Rectangle { get; set; }
public BaseShape()

View file

@ -34,6 +34,8 @@ namespace ShareX.ScreenCaptureLib
{
public class RectangleDrawingShape : BaseDrawingShape
{
public override ShapeType ShapeType { get; } = ShapeType.DrawingRectangle;
public override void Draw(Graphics g)
{
if (FillColor != Color.Transparent)

View file

@ -34,6 +34,8 @@ namespace ShareX.ScreenCaptureLib
{
public class RoundedRectangleDrawingShape : BaseDrawingShape
{
public override ShapeType ShapeType { get; } = ShapeType.DrawingRoundedRectangle;
public float Radius { get; set; }
public override void Draw(Graphics g)

View file

@ -35,6 +35,8 @@ namespace ShareX.ScreenCaptureLib
{
public class DiamondRegionShape : BaseRegionShape
{
public override ShapeType ShapeType { get; } = ShapeType.RegionDiamond;
public override void AddShapePath(GraphicsPath gp, Rectangle rect)
{
gp.AddDiamond(rect);

View file

@ -34,6 +34,8 @@ namespace ShareX.ScreenCaptureLib
{
public class EllipseRegionShape : BaseRegionShape
{
public override ShapeType ShapeType { get; } = ShapeType.RegionEllipse;
public override void AddShapePath(GraphicsPath gp, Rectangle rect)
{
gp.AddEllipse(rect);

View file

@ -34,6 +34,8 @@ namespace ShareX.ScreenCaptureLib
{
public class RectangleRegionShape : BaseRegionShape
{
public override ShapeType ShapeType { get; } = ShapeType.RegionRectangle;
public override void AddShapePath(GraphicsPath gp, Rectangle rect)
{
gp.AddRectangle(rect);

View file

@ -35,6 +35,8 @@ namespace ShareX.ScreenCaptureLib
{
public class RoundedRectangleRegionShape : BaseRegionShape
{
public override ShapeType ShapeType { get; } = ShapeType.RegionRoundedRectangle;
public float Radius { get; set; }
public override void AddShapePath(GraphicsPath gp, Rectangle rect)

View file

@ -35,6 +35,8 @@ namespace ShareX.ScreenCaptureLib
{
public class TriangleRegionShape : BaseRegionShape
{
public override ShapeType ShapeType { get; } = ShapeType.RegionTriangle;
public TriangleAngle Angle { get; set; }
public override void AddShapePath(GraphicsPath gp, Rectangle rect)