diff --git a/EduNetworkBuilder/NetShape.cs b/EduNetworkBuilder/NetShape.cs index 111189c..8b853ce 100644 --- a/EduNetworkBuilder/NetShape.cs +++ b/EduNetworkBuilder/NetShape.cs @@ -83,6 +83,36 @@ namespace EduNetworkBuilder return tCorners; } + public bool CornersAreClickedOn(Point ClickPoint) + { + foreach(Rectangle rec in Corners()) + { + if (rec.Contains(ClickPoint)) + return true; + } + return false; + } + + /// + /// return the opposite point from the one clicked on. This is so we can start + /// dragging from here. + /// + /// + /// + public Point OppositePoint(Point ClickPoint) + { + int fX = ClickPoint.X; + int fY = ClickPoint.Y; + int halfWidth = InArea.Width / 2; + int halfHeight = InArea.Height / 2; + if (ClickPoint.X < InArea.X + halfWidth) fX = InArea.X; + else fX = InArea.X + InArea.Width; + if (ClickPoint.Y < InArea.Y + halfHeight) fY = InArea.Y; + else fY = InArea.Y + InArea.Height; + return new Point(fX, fY); + + } + public void Load(XmlNode theNode) { foreach (XmlNode Individual in theNode.ChildNodes)