Set rectangle instead of start/end positions

This commit is contained in:
Jaex 2017-11-16 09:02:27 +03:00
parent 7766ba374e
commit 6a072fa079
5 changed files with 5 additions and 14 deletions

View file

@ -128,8 +128,7 @@ public void AddShapePath(GraphicsPath gp, int sizeOffset = 0)
public virtual void Move(int x, int y)
{
StartPosition = StartPosition.Add(x, y);
EndPosition = EndPosition.Add(x, y);
Rectangle = Rectangle.LocationOffset(x, y);
}
public void Move(Point offset)

View file

@ -50,8 +50,7 @@ public void UpdateCursor(IntPtr cursorHandle, Point position)
Icon icon = Icon.FromHandle(cursorHandle);
cursorBitmap = icon.ToBitmap();
StartPosition = position;
EndPosition = new Point(position.X + cursorBitmap.Size.Width - 1, position.Y + cursorBitmap.Size.Height - 1);
Rectangle = new Rectangle(position, cursorBitmap.Size);
}
public override void ShowNodes()

View file

@ -185,10 +185,6 @@ public override void OnNodeVisible()
public override void OnNodeUpdate()
{
if (Manager.IsCornerMoving && !Manager.IsMoving && !Manager.IsPanning)
{
Move(InputManager.MouseVelocity);
}
if (Manager.ResizeNodes[0].IsDragging)
{
Manager.IsResizing = true;

View file

@ -40,8 +40,7 @@ public class StepDrawingShape : EllipseDrawingShape
public StepDrawingShape()
{
StartPosition = new Point(0, 0);
EndPosition = new Point(DefaultSize - 1, DefaultSize - 1);
Rectangle = new Rectangle(0, 0, DefaultSize, DefaultSize);
}
public override void ShowNodes()
@ -52,8 +51,7 @@ public override void OnCreating()
{
Manager.IsMoving = true;
Point pos = InputManager.ClientMousePosition;
StartPosition = new Point(pos.X - DefaultSize / 2, pos.Y - DefaultSize / 2);
EndPosition = new Point(pos.X + DefaultSize / 2 - 1, pos.Y + DefaultSize / 2 - 1);
Rectangle = new Rectangle(new Point(pos.X - Rectangle.Width / 2, pos.Y - Rectangle.Height / 2), Rectangle.Size);
}
public override void OnConfigLoad()

View file

@ -163,8 +163,7 @@ public void AutoSize(bool center)
location = Rectangle.Location;
}
StartPosition = location;
EndPosition = new Point(location.X + size.Width - 1, location.Y + size.Height - 1);
Rectangle = new Rectangle(location, size);
}
}
}