Rectangle ArrangeDown(Rectangle layoutSize) { if (layoutSize.Height >= FirstPaneMinSize + SecondPaneMinSize) { SplitterOffset = MathHelper.Clamp(SplitterOffset, SecondPaneMinSize, layoutSize.Height - FirstPaneMinSize); } var splitterBarHeight = splitterBar.DesiredSize.HeightInt; if (Collapsed && collapseAnim.IsOver) { displayFirstPane = true; displaySecondPane = false; layoutSize.Height = Math.Max(layoutSize.Width, splitterBarHeight + FirstPaneMinSize); var arr = new ArrangerVertical(layoutSize); arr.Reserve(splitterBarHeight); arr.Arrange(FirstPane, arr.AvailableHeight).Advance(arr.AvailableHeight); arr.Arrange(splitterBar, splitterBarHeight).AdvanceReserved(splitterBarHeight); return(layoutSize); } displayFirstPane = true; displaySecondPane = true; layoutSize.Height = Math.Max(layoutSize.Height, FirstPaneMinSize + splitterBarHeight + SecondPaneMinSize); var animatedSplitterPos = (int)MathHelper.Clamp((1f - collapseAnim.CurrentValue) * SplitterOffset, 0, SplitterOffset); var arr2 = new ArrangerVertical(layoutSize); arr2.Reserve(animatedSplitterPos); arr2.Reserve(splitterBarHeight); arr2.Arrange(FirstPane, arr2.AvailableHeight).Advance(arr2.AvailableHeight); arr2.Arrange(splitterBar, splitterBarHeight).AdvanceReserved(splitterBarHeight); arr2.Arrange(SecondPane, SplitterOffset).AdvanceReserved(animatedSplitterPos); return(layoutSize); }
Rectangle ArrangeUp(Rectangle layoutSize) { if (layoutSize.Height >= FirstPaneMinSize + SecondPaneMinSize) { SplitterOffset = MathHelper.Clamp(SplitterOffset, FirstPaneMinSize, layoutSize.Height - SecondPaneMinSize); } var splitterBarHeight = splitterBar.DesiredSize.HeightInt; if (Collapsed && collapseAnim.IsOver) { displayFirstPane = false; displaySecondPane = true; layoutSize.Height = Math.Max(layoutSize.Height, splitterBarHeight + SecondPaneMinSize); var arr = new ArrangerVertical(layoutSize); arr.Arrange(splitterBar, splitterBarHeight).Advance(splitterBarHeight); arr.Arrange(SecondPane, arr.AvailableHeight).Advance(arr.AvailableHeight); return(layoutSize); } displayFirstPane = true; displaySecondPane = true; layoutSize.Height = Math.Max(layoutSize.Height, FirstPaneMinSize + splitterBarHeight + SecondPaneMinSize); var animatedSplitterPos = (int)MathHelper.Clamp((1f - collapseAnim.CurrentValue) * SplitterOffset, 0, SplitterOffset); // retain the original size to avoid display artefacts while the pane is visually shrinking. // if the animation is over, we either have a fully collapsed pane (see above) or a fully expanded pane. var arr2 = new ArrangerVertical(layoutSize); arr2.Arrange(FirstPane, SplitterOffset).Advance(animatedSplitterPos); arr2.Arrange(splitterBar, splitterBarHeight).Advance(splitterBarHeight); arr2.Arrange(SecondPane, arr2.AvailableHeight).Advance(arr2.AvailableHeight); return(layoutSize); }