Removed NodeType, Changed ShowNodes to FixedSize

This commit is contained in:
Jaex 2016-08-05 17:20:08 +03:00
parent 05490a90e5
commit 08d1d85df8
5 changed files with 14 additions and 13 deletions

View file

@ -36,8 +36,6 @@ public abstract class BaseShape
public abstract ShapeType ShapeType { get; }
public virtual NodeType NodeType { get; } = NodeType.Rectangle;
public Rectangle Rectangle { get; set; }
protected AnnotationOptions AnnotationOptions
@ -88,7 +86,7 @@ public virtual bool IsValidShape
}
}
public virtual bool ShowNodes { get; } = true;
public virtual bool FixedSize { get; } = false;
internal ShapeManager Manager { get; set; }
@ -149,14 +147,20 @@ public virtual void OnUpdate()
}
else if (Manager.IsProportionalResizing)
{
if (NodeType == NodeType.Rectangle)
float degree, startDegree;
if (ShapeType == ShapeType.DrawingLine || ShapeType == ShapeType.DrawingArrow)
{
pos = CaptureHelpers.SnapPositionToDegree(StartPosition, pos, 90, 45);
degree = 45;
startDegree = 0;
}
else if (NodeType == NodeType.Line)
else
{
pos = CaptureHelpers.SnapPositionToDegree(StartPosition, pos, 45, 0);
degree = 90;
startDegree = 45;
}
pos = CaptureHelpers.SnapPositionToDegree(StartPosition, pos, degree, startDegree);
}
else if (Manager.IsSnapResizing)
{

View file

@ -32,7 +32,6 @@ namespace ShareX.ScreenCaptureLib
public class LineDrawingShape : BaseDrawingShape
{
public override ShapeType ShapeType { get; } = ShapeType.DrawingLine;
public override NodeType NodeType { get; } = NodeType.Line;
public override bool IsValidShape
{

View file

@ -35,8 +35,7 @@ public class StepDrawingShape : BaseDrawingShape
private const int DefaultSize = 30;
public override ShapeType ShapeType { get; } = ShapeType.DrawingStep;
public override NodeType NodeType { get; } = NodeType.Point;
public override bool ShowNodes { get; } = false;
public override bool FixedSize { get; } = true;
public int Number { get; set; }

View file

@ -33,7 +33,6 @@ namespace ShareX.ScreenCaptureLib
public class FreehandRegionShape : BaseRegionShape
{
public override ShapeType ShapeType { get; } = ShapeType.RegionFreehand;
public override NodeType NodeType { get; } = NodeType.Freehand;
public Point LastPosition
{

View file

@ -1201,7 +1201,7 @@ private void StartRegionSelection()
Point pos = InputManager.MousePosition0Based;
if (shape.NodeType == NodeType.Point)
if (shape.FixedSize)
{
IsMoving = true;
shape.Rectangle = new Rectangle(new Point(pos.X - shape.Rectangle.Width / 2, pos.Y - shape.Rectangle.Height / 2), shape.Rectangle.Size);
@ -1517,7 +1517,7 @@ private void SelectShape()
{
BaseShape shape = CurrentShape;
if (shape != null && shape.ShowNodes && !CurrentRectangle.IsEmpty)
if (shape != null && !shape.FixedSize && !CurrentRectangle.IsEmpty)
{
NodesVisible = true;
}