public AnchorPoint(DGNode owner, float dirX, float dirY) { if (owner == null) { throw new ArgumentNullException("owner"); } this.Edges = new List<DGEdge>(); this.mOwner = owner; this.SetParent(owner); this.mDirX = dirX; this.mDirY = dirY; this.UpdateBoundingBox(); }
/// <summary> /// If the right-most node is out of the drawing area, doubles the width. /// If the bottom-most node is out of the drawing area, doubles the height; /// </summary> private void CheckSizing() { if (nodes != null && nodes.Any()) { DGNode rightMostNode = nodes.Aggregate((node1, node2) => node1.Location.X > node2.Location.X ? node1 : node2); DGNode bottomMostNode = nodes.Aggregate((node1, node2) => node1.Location.Y > node2.Location.Y ? node1 : node2); if (rightMostNode.Location.X + rightMostNode.Width >= drawable.Allocation.Width) { drawable.WidthRequest = 2 * drawable.Allocation.Width; } // I Assume that the nodes are circles such that width = height. if (bottomMostNode.Location.Y + bottomMostNode.Width >= drawable.Allocation.Height) { drawable.HeightRequest = 2 * drawable.Allocation.Height; } } }