/// <summary> /// Set the initial layout state such that our current margin is stored and the new margin is taken from the given rb /// </summary> public void SetInitialLayoutState(RectangularClusterBoundary bounds) { isInInitialLayoutState = true; if (RectangularBoundary != null && bounds != null) { RectangularBoundary.StoreDefaultMargin(); RectangularBoundary.LeftMargin = bounds.LeftMargin; RectangularBoundary.RightMargin = bounds.RightMargin; RectangularBoundary.BottomMargin = bounds.BottomMargin; RectangularBoundary.TopMargin = bounds.TopMargin; } }
/// <summary> /// Calculate cluster's RectangularBoundary to preserve the offsets calculated in initial layout, for example, /// to allow for extra space required for non-shortest path edge routes or for labels. /// </summary> /// <param name="padding">amount of padding between child node bounding box and expected inner bounds</param> internal void SetInitialLayoutState(double padding) { isInInitialLayoutState = true; if (RectangularBoundary != null) { RectangularBoundary.StoreDefaultMargin(); var childBounds = new Rectangle(from v in Nodes.Concat(Clusters) select v.BoundingBox); childBounds.Pad(padding); RectangularBoundary.LeftMargin = childBounds.Left - RectangularBoundary.Rect.Left; RectangularBoundary.RightMargin = RectangularBoundary.Rect.Right - childBounds.Right; RectangularBoundary.BottomMargin = childBounds.Bottom - RectangularBoundary.Rect.Bottom; RectangularBoundary.TopMargin = RectangularBoundary.Rect.Top - childBounds.Top; } }