Make ShapeManager and NodeManager internal

This commit is contained in:
Jaex 2016-08-05 15:10:05 +03:00
parent 1409c72716
commit 0834ca540c
4 changed files with 15 additions and 13 deletions

View file

@ -39,8 +39,6 @@ public class RectangleRegionForm : BaseRegionForm
{
public RectangleRegionMode Mode { get; private set; }
public ShapeManager ShapeManager { get; private set; }
public Point CurrentPosition { get; private set; }
public Color CurrentColor
@ -60,6 +58,8 @@ public Color CurrentColor
public SimpleWindowInfo SelectedWindow { get; private set; }
internal ShapeManager ShapeManager { get; private set; }
private ColorBlinkAnimation colorBlinkAnimation = new ColorBlinkAnimation();
private TextAnimation shapeTypeTextAnimation = new TextAnimation(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(0.5));
private Bitmap bmpBackgroundImage;

View file

@ -39,8 +39,6 @@ public abstract class BaseShape
public Rectangle Rectangle { get; set; }
public ShapeManager Manager { get; set; }
protected AnnotationOptions AnnotationOptions
{
get
@ -89,6 +87,8 @@ public virtual bool IsValidShape
}
}
internal ShapeManager Manager { get; set; }
public virtual bool Intersects(Point position)
{
return Rectangle.Contains(position);
@ -134,7 +134,7 @@ public virtual void OnCreated()
public virtual void OnUpdate()
{
if (Manager.IsCreating && !Rectangle.IsEmpty)
if (Manager.IsCreating)
{
Point pos = InputManager.MousePosition0Based;

View file

@ -30,7 +30,7 @@ You should have received a copy of the GNU General Public License
namespace ShareX.ScreenCaptureLib
{
public class NodeManager
internal class NodeManager
{
private bool visible;

View file

@ -34,7 +34,7 @@ You should have received a copy of the GNU General Public License
namespace ShareX.ScreenCaptureLib
{
public class ShapeManager
internal class ShapeManager
{
public List<BaseShape> Shapes { get; private set; } = new List<BaseShape>();
@ -817,7 +817,7 @@ private void form_MouseDown(object sender, MouseEventArgs e)
{
if (!IsCreating)
{
RegionSelection(InputManager.MousePosition0Based);
StartRegionSelection();
}
}
}
@ -925,7 +925,7 @@ private void form_KeyDown(object sender, KeyEventArgs e)
if (CurrentShape == null || CurrentShape != GetShapeIntersect())
{
RegionSelection(InputManager.MousePosition0Based);
StartRegionSelection();
}
}
break;
@ -1145,7 +1145,7 @@ public void Update()
nodeManager.Update();
}
private void RegionSelection(Point position)
private void StartRegionSelection()
{
if (nodeManager.IsCursorOnNode)
{
@ -1166,20 +1166,22 @@ private void RegionSelection(Point position)
shape = AddShape();
Point pos = InputManager.MousePosition0Based;
if (shape.NodeType == NodeType.Point)
{
IsMoving = true;
shape.Rectangle = new Rectangle(new Point(position.X - shape.Rectangle.Width / 2, position.Y - shape.Rectangle.Height / 2), shape.Rectangle.Size);
shape.Rectangle = new Rectangle(new Point(pos.X - shape.Rectangle.Width / 2, pos.Y - shape.Rectangle.Height / 2), shape.Rectangle.Size);
}
else if (Config.IsFixedSize && IsCurrentShapeTypeRegion)
{
IsMoving = true;
shape.Rectangle = new Rectangle(new Point(position.X - Config.FixedSize.Width / 2, position.Y - Config.FixedSize.Height / 2), Config.FixedSize);
shape.Rectangle = new Rectangle(new Point(pos.X - Config.FixedSize.Width / 2, pos.Y - Config.FixedSize.Height / 2), Config.FixedSize);
}
else
{
IsCreating = true;
shape.StartPosition = shape.EndPosition = position;
shape.StartPosition = shape.EndPosition = pos;
}
}
}