Example #1
0
            static Size Arrange(FrameworkElement parent, ElementsBag elementsBag, IEnumerable <Coordinate> existingCoordinates, Size finalSize,
                                int x, int y, double widthRatio, double heightRatio, bool useDesiredSize, bool useAnimation)
            {
                var size = FinalArrange(parent, elementsBag, finalSize, x, y,
                                        SelectionCoordinatesForRegions(existingCoordinates), useAnimation, widthRatio, heightRatio, useDesiredSize).ToArray();

                return(new Size(size.Sum(s => s.Height), size.Sum(a => a.Width)));
Example #2
0
        protected override Size ArrangeOverride(Size finalSize)
        {
            List <List <Coordinate> > coordinates = new List <List <Coordinate> >();

            var elementsBag = new ElementsBag();
            var elems       = InternalChildren.Cast <FrameworkElement>().ToArray();

            elementsBag.CountPositions(elems);
            var(x, y) = elementsBag.GetSize();
            var existingCoordinates = SelectExistingCoordinates(elems, x, y);

            var arrange = Arrange(this, elementsBag, existingCoordinates, finalSize, x, y, WidthRatio, HeightRatio, UseDesiredSize, UseAnimation);
Example #3
0
        SelectPotentialCoordinatesForRegions(ElementsBag bag, IEnumerable <Coordinate> existingCoordinates, int x, int y)
        {
            var combos = GetCoordinateCombinations(x, y).ToArray();
            //var test = combos.Select(a => a.Min).Select(x, y).ToArray();
            var remainingCoordinates = combos.Select(a => a.Min).Except(existingCoordinates).ToList();

            if (bag.right.Count > 0)
            {
                yield return(GetCoordinateBoxesByRegion(Region.Right, x, y, remainingCoordinates));
            }
            if (bag.left.Count > 0)
            {
                yield return(GetCoordinateBoxesByRegion(Region.Left, x, y, remainingCoordinates));
            }
            if (bag.top.Count > 0)
            {
                yield return(GetCoordinateBoxesByRegion(Region.Top, x, y, remainingCoordinates));
            }
            if (bag.bottom.Count > 0)
            {
                yield return(GetCoordinateBoxesByRegion(Region.Bottom, x, y, remainingCoordinates));
            }
            if (bag.topleft.Count > 0)
            {
                yield return(GetCoordinateBoxesByRegion(Region.TopLeft, x, y, remainingCoordinates));
            }
            if (bag.topright.Count > 0)
            {
                yield return(GetCoordinateBoxesByRegion(Region.TopRight, x, y, remainingCoordinates));
            }
            if (bag.bottomleft.Count > 0)
            {
                yield return(GetCoordinateBoxesByRegion(Region.BottomLeft, x, y, remainingCoordinates));
            }
            if (bag.bottomright.Count > 0)
            {
                yield return(GetCoordinateBoxesByRegion(Region.BottomRight, x, y, remainingCoordinates));
            }
            if (bag.middle.Count > 0)
            {
                yield return(GetCoordinateBoxesByRegion(Region.Middle, x, y, remainingCoordinates));
            }
Example #4
0
 static IEnumerable <Size> FinalArrange(FrameworkElement parent, ElementsBag elementsBag, Size finalSize, int x, int y,
                                        (Region Key, List <Coordinate> ac)[][] combinations, bool useAnimation,
Example #5
0
            static async void Arrange(UIElement parent, ElementsBag elementsBag, IEnumerable <Coordinate> existingCoordinates, Size finalSize,
                                      int x, int y, double widthRatio, double heightRatio, bool useDesiredSize)
            {
                FinalArrange(parent, elementsBag, finalSize, x, y, await SelectionCoordinatesForRegions(), widthRatio, heightRatio, useDesiredSize);

                async Task <(Region region, List <Coordinate> ac)[][]> SelectionCoordinatesForRegions()