/// <summary> /// compares limits against the dimensions of the VPanel parameter. Changes the limits if the dimensions are closer to this panel's current offset /// </summary> /// <param name="panel"></param> public void SetDirectionalLimits(VPanel panel) { var panelLeft = Canvas.GetLeft(panel.border); var panelTop = Canvas.GetTop(panel.border); var panelRight = Canvas.GetRight(panel.border); var panelBottom = Canvas.GetBottom(panel.border); var thisPanelLeft = Canvas.GetLeft(border); var thisPanelRight = Canvas.GetRight(border); var thisPanelTop = Canvas.GetTop(border); var thisPanelBottom = Canvas.GetBottom(border); if (CollisionPossible(thisPanelTop, thisPanelBottom, panelTop, panelBottom)) { if ((panelRight > (leftLimit)) && (panelRight <= Canvas.GetLeft(border))) { leftLimit = panelRight; } if ((panelLeft < (rightLimit)) && (panelLeft >= Canvas.GetRight(border))) { rightLimit = panelLeft; } } if (CollisionPossible(thisPanelLeft, thisPanelRight, panelLeft, panelRight)) { if ((panelBottom > (topLimit)) && (panelBottom <= Canvas.GetTop(border))) { topLimit = panelBottom; } if ((panelTop < (bottomLimit)) && (panelTop >= Canvas.GetBottom(border))) { bottomLimit = panelTop; } } }
public void BecomeChild(VPanel panel) { if (ChildPanels.Contains(panel)) //avoid circular dependencies { return; } ParentPanel?.LoseChild(this); ParentPanel = panel; panel.AcquireChild(this); AdjustParentPadding(); }
public void LoseChild(VPanel panel) { ChildPanels.Remove(this); }
public void AcquireChild(VPanel panel) { ChildPanels.Add(panel); }